aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/Kconfig38
-rw-r--r--arch/alpha/Kconfig3
-rw-r--r--arch/alpha/include/asm/atomic.h68
-rw-r--r--arch/alpha/include/asm/cmpxchg.h71
-rw-r--r--arch/alpha/include/asm/rtc.h8
-rw-r--r--arch/alpha/include/asm/xchg.h4
-rw-r--r--arch/alpha/kernel/Makefile2
-rw-r--r--arch/alpha/kernel/core_tsunami.c1
-rw-r--r--arch/alpha/kernel/init_task.c17
-rw-r--r--arch/alpha/kernel/perf_event.c3
-rw-r--r--arch/alpha/kernel/smp.c20
-rw-r--r--arch/alpha/kernel/sys_marvel.c2
-rw-r--r--arch/arm/Kconfig83
-rw-r--r--arch/arm/Makefile6
-rw-r--r--arch/arm/boot/compressed/atags_to_fdt.c2
-rw-r--r--arch/arm/boot/compressed/head-xscale.S7
-rw-r--r--arch/arm/boot/compressed/head.S73
-rw-r--r--arch/arm/boot/dts/at91sam9260.dtsi273
-rw-r--r--arch/arm/boot/dts/at91sam9263.dtsi220
-rw-r--r--arch/arm/boot/dts/at91sam9263ek.dts156
-rw-r--r--arch/arm/boot/dts/at91sam9g20.dtsi223
-rw-r--r--arch/arm/boot/dts/at91sam9g20ek.dts29
-rw-r--r--arch/arm/boot/dts/at91sam9g20ek_2mmc.dts29
-rw-r--r--arch/arm/boot/dts/at91sam9g20ek_common.dtsi142
-rw-r--r--arch/arm/boot/dts/at91sam9g45.dtsi38
-rw-r--r--arch/arm/boot/dts/at91sam9n12.dtsi221
-rw-r--r--arch/arm/boot/dts/at91sam9n12ek.dts84
-rw-r--r--arch/arm/boot/dts/at91sam9x5.dtsi39
-rw-r--r--arch/arm/boot/dts/db8500.dtsi64
-rw-r--r--arch/arm/boot/dts/emev2-kzm9d.dts26
-rw-r--r--arch/arm/boot/dts/emev2.dtsi63
-rw-r--r--arch/arm/boot/dts/ethernut5.dts84
-rw-r--r--arch/arm/boot/dts/highbank.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-dns320.dts64
-rw-r--r--arch/arm/boot/dts/kirkwood-dns325.dts59
-rw-r--r--arch/arm/boot/dts/kirkwood-ib62x0.dts44
-rw-r--r--arch/arm/boot/dts/kirkwood-iconnect.dts26
-rw-r--r--arch/arm/boot/dts/kirkwood.dtsi15
-rw-r--r--arch/arm/boot/dts/kizbox.dts138
-rw-r--r--arch/arm/boot/dts/lpc32xx.dtsi292
-rw-r--r--arch/arm/boot/dts/mmp2-brownstone.dts38
-rw-r--r--arch/arm/boot/dts/mmp2.dtsi220
-rw-r--r--arch/arm/boot/dts/msm8660-surf.dts4
-rw-r--r--arch/arm/boot/dts/omap3-beagle.dts49
-rw-r--r--arch/arm/boot/dts/omap3.dtsi102
-rw-r--r--arch/arm/boot/dts/omap4-panda.dts71
-rw-r--r--arch/arm/boot/dts/omap4-sdp.dts140
-rw-r--r--arch/arm/boot/dts/omap4.dtsi117
-rw-r--r--arch/arm/boot/dts/phy3250.dts145
-rw-r--r--arch/arm/boot/dts/pxa168.dtsi67
-rw-r--r--arch/arm/boot/dts/pxa910-dkb.dts38
-rw-r--r--arch/arm/boot/dts/pxa910.dtsi140
-rw-r--r--arch/arm/boot/dts/r8a7740-armadillo800eva.dts22
-rw-r--r--arch/arm/boot/dts/sh7372.dtsi21
-rw-r--r--arch/arm/boot/dts/sh73a0-kzm9g.dts22
-rw-r--r--arch/arm/boot/dts/snowball.dts40
-rw-r--r--arch/arm/boot/dts/spear300-evb.dts221
-rw-r--r--arch/arm/boot/dts/spear300.dtsi77
-rw-r--r--arch/arm/boot/dts/spear310-evb.dts172
-rw-r--r--arch/arm/boot/dts/spear310.dtsi80
-rw-r--r--arch/arm/boot/dts/spear320-evb.dts173
-rw-r--r--arch/arm/boot/dts/spear320.dtsi95
-rw-r--r--arch/arm/boot/dts/spear3xx.dtsi144
-rw-r--r--arch/arm/boot/dts/spear600-evb.dts4
-rw-r--r--arch/arm/boot/dts/spear600.dtsi8
-rw-r--r--arch/arm/boot/dts/tegra-cardhu.dts44
-rw-r--r--arch/arm/boot/dts/tegra-harmony.dts224
-rw-r--r--arch/arm/boot/dts/tegra-paz00.dts220
-rw-r--r--arch/arm/boot/dts/tegra-seaboard.dts243
-rw-r--r--arch/arm/boot/dts/tegra-trimslice.dts230
-rw-r--r--arch/arm/boot/dts/tegra-ventana.dts230
-rw-r--r--arch/arm/boot/dts/tny_a9260.dts15
-rw-r--r--arch/arm/boot/dts/tny_a9260_common.dtsi83
-rw-r--r--arch/arm/boot/dts/tny_a9263.dts97
-rw-r--r--arch/arm/boot/dts/tny_a9g20.dts15
-rw-r--r--arch/arm/boot/dts/twl4030.dtsi47
-rw-r--r--arch/arm/boot/dts/twl6030.dtsi86
-rw-r--r--arch/arm/boot/dts/usb_a9260.dts23
-rw-r--r--arch/arm/boot/dts/usb_a9260_common.dtsi117
-rw-r--r--arch/arm/boot/dts/usb_a9263.dts131
-rw-r--r--arch/arm/boot/dts/usb_a9g20.dts102
-rw-r--r--arch/arm/boot/dts/versatile-ab.dts2
-rw-r--r--arch/arm/boot/dts/versatile-pb.dts2
-rw-r--r--arch/arm/common/Makefile2
-rw-r--r--arch/arm/common/it8152.c7
-rw-r--r--arch/arm/common/uengine.c507
-rw-r--r--arch/arm/common/via82c505.c11
-rw-r--r--arch/arm/common/vic.c65
-rw-r--r--arch/arm/configs/armadillo800eva_defconfig142
-rw-r--r--arch/arm/configs/at91_dt_defconfig196
-rw-r--r--arch/arm/configs/at91rm9200_defconfig1
-rw-r--r--arch/arm/configs/bcmring_defconfig2
-rw-r--r--arch/arm/configs/imx_v4_v5_defconfig5
-rw-r--r--arch/arm/configs/ixp2000_defconfig99
-rw-r--r--arch/arm/configs/ixp23xx_defconfig105
-rw-r--r--arch/arm/configs/kzm9g_defconfig139
-rw-r--r--arch/arm/configs/lpc32xx_defconfig44
-rw-r--r--arch/arm/configs/mini2440_defconfig2
-rw-r--r--arch/arm/configs/nhk8815_defconfig1
-rw-r--r--arch/arm/configs/omap2plus_defconfig2
-rw-r--r--arch/arm/configs/rpc_defconfig2
-rw-r--r--arch/arm/configs/spear3xx_defconfig52
-rw-r--r--arch/arm/configs/spear6xx_defconfig41
-rw-r--r--arch/arm/configs/u8500_defconfig9
-rw-r--r--arch/arm/include/asm/arch_timer.h19
-rw-r--r--arch/arm/include/asm/cacheflush.h6
-rw-r--r--arch/arm/include/asm/cmpxchg.h73
-rw-r--r--arch/arm/include/asm/cpu.h1
-rw-r--r--arch/arm/include/asm/glue-df.h8
-rw-r--r--arch/arm/include/asm/glue-proc.h18
-rw-r--r--arch/arm/include/asm/hardware/cs89712.h49
-rw-r--r--arch/arm/include/asm/hardware/ep7211.h40
-rw-r--r--arch/arm/include/asm/hardware/ep7212.h83
-rw-r--r--arch/arm/include/asm/hardware/it8152.h2
-rw-r--r--arch/arm/include/asm/hardware/uengine.h62
-rw-r--r--arch/arm/include/asm/jump_label.h2
-rw-r--r--arch/arm/include/asm/mach/pci.h17
-rw-r--r--arch/arm/include/asm/mach/time.h5
-rw-r--r--arch/arm/include/asm/mmu.h7
-rw-r--r--arch/arm/include/asm/mmu_context.h104
-rw-r--r--arch/arm/include/asm/page.h9
-rw-r--r--arch/arm/include/asm/pgtable-3level.h2
-rw-r--r--arch/arm/include/asm/processor.h2
-rw-r--r--arch/arm/include/asm/ptrace.h5
-rw-r--r--arch/arm/include/asm/syscall.h93
-rw-r--r--arch/arm/include/asm/thread_info.h8
-rw-r--r--arch/arm/include/asm/tlbflush.h21
-rw-r--r--arch/arm/include/asm/tls.h4
-rw-r--r--arch/arm/kernel/Makefile3
-rw-r--r--arch/arm/kernel/arch_timer.c350
-rw-r--r--arch/arm/kernel/bios32.c37
-rw-r--r--arch/arm/kernel/entry-armv.S4
-rw-r--r--arch/arm/kernel/entry-common.S28
-rw-r--r--arch/arm/kernel/head.S9
-rw-r--r--arch/arm/kernel/init_task.c37
-rw-r--r--arch/arm/kernel/irq.c6
-rw-r--r--arch/arm/kernel/perf_event_v6.c4
-rw-r--r--arch/arm/kernel/perf_event_v7.c4
-rw-r--r--arch/arm/kernel/perf_event_xscale.c8
-rw-r--r--arch/arm/kernel/process.c20
-rw-r--r--arch/arm/kernel/ptrace.c41
-rw-r--r--arch/arm/kernel/setup.c16
-rw-r--r--arch/arm/kernel/signal.c57
-rw-r--r--arch/arm/kernel/smp.c61
-rw-r--r--arch/arm/kernel/smp_scu.c3
-rw-r--r--arch/arm/kernel/sys_arm.c2
-rw-r--r--arch/arm/kernel/thumbee.c4
-rw-r--r--arch/arm/kernel/time.c36
-rw-r--r--arch/arm/kernel/traps.c11
-rw-r--r--arch/arm/lib/Makefile23
-rw-r--r--arch/arm/lib/io-readsw-armv3.S106
-rw-r--r--arch/arm/lib/io-writesw-armv3.S126
-rw-r--r--arch/arm/lib/uaccess.S564
-rw-r--r--arch/arm/mach-at91/Kconfig194
-rw-r--r--arch/arm/mach-at91/Makefile27
-rw-r--r--arch/arm/mach-at91/Makefile.boot14
-rw-r--r--arch/arm/mach-at91/at91rm9200.c22
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c17
-rw-r--r--arch/arm/mach-at91/at91rm9200_time.c2
-rw-r--r--arch/arm/mach-at91/at91sam9260.c20
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c122
-rw-r--r--arch/arm/mach-at91/at91sam9261.c12
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c12
-rw-r--r--arch/arm/mach-at91/at91sam9263.c22
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c32
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c21
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c143
-rw-r--r--arch/arm/mach-at91/at91sam9n12.c233
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c12
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c12
-rw-r--r--arch/arm/mach-at91/at91sam9x5.c6
-rw-r--r--arch/arm/mach-at91/board-1arm.c24
-rw-r--r--arch/arm/mach-at91/board-afeb-9260v1.c28
-rw-r--r--arch/arm/mach-at91/board-cam60.c8
-rw-r--r--arch/arm/mach-at91/board-carmeva.c18
-rw-r--r--arch/arm/mach-at91/board-cpu9krea.c52
-rw-r--r--arch/arm/mach-at91/board-cpuat91.c40
-rw-r--r--arch/arm/mach-at91/board-csb337.c13
-rw-r--r--arch/arm/mach-at91/board-csb637.c8
-rw-r--r--arch/arm/mach-at91/board-dt.c8
-rw-r--r--arch/arm/mach-at91/board-eb9200.c24
-rw-r--r--arch/arm/mach-at91/board-ecbat91.c20
-rw-r--r--arch/arm/mach-at91/board-eco920.c13
-rw-r--r--arch/arm/mach-at91/board-flexibity.c8
-rw-r--r--arch/arm/mach-at91/board-foxg20.c71
-rw-r--r--arch/arm/mach-at91/board-gsia18s.c63
-rw-r--r--arch/arm/mach-at91/board-kafa.c20
-rw-r--r--arch/arm/mach-at91/board-kb9202.c32
-rw-r--r--arch/arm/mach-at91/board-neocore926.c14
-rw-r--r--arch/arm/mach-at91/board-pcontrol-g20.c21
-rw-r--r--arch/arm/mach-at91/board-picotux200.c18
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c31
-rw-r--r--arch/arm/mach-at91/board-rm9200dk.c24
-rw-r--r--arch/arm/mach-at91/board-rm9200ek.c26
-rw-r--r--arch/arm/mach-at91/board-rsi-ews.c36
-rw-r--r--arch/arm/mach-at91/board-sam9-l9260.c30
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c24
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c19
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c14
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c38
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c28
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c14
-rw-r--r--arch/arm/mach-at91/board-snapper9260.c18
-rw-r--r--arch/arm/mach-at91/board-stamp9g20.c64
-rw-r--r--arch/arm/mach-at91/board-usb-a926x.c12
-rw-r--r--arch/arm/mach-at91/board-yl-9200.c36
-rw-r--r--arch/arm/mach-at91/clock.c16
-rw-r--r--arch/arm/mach-at91/cpuidle.c8
-rw-r--r--arch/arm/mach-at91/generic.h11
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pmc.h2
-rw-r--r--arch/arm/mach-at91/include/mach/at91rm9200.h5
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9260.h7
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9261.h4
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9263.h4
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9g45.h5
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9n12.h60
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9n12_matrix.h53
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9rl.h5
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9x5.h8
-rw-r--r--arch/arm/mach-at91/include/mach/board.h1
-rw-r--r--arch/arm/mach-at91/include/mach/cpu.h38
-rw-r--r--arch/arm/mach-at91/include/mach/hardware.h18
-rw-r--r--arch/arm/mach-at91/include/mach/uncompress.h178
-rw-r--r--arch/arm/mach-at91/pm.c12
-rw-r--r--arch/arm/mach-at91/pm.h15
-rw-r--r--arch/arm/mach-at91/pm_slowclock.S2
-rw-r--r--arch/arm/mach-at91/setup.c8
-rw-r--r--arch/arm/mach-at91/soc.h19
-rw-r--r--arch/arm/mach-bcmring/core.c4
-rw-r--r--arch/arm/mach-clps711x/Kconfig21
-rw-r--r--arch/arm/mach-clps711x/common.c17
-rw-r--r--arch/arm/mach-clps711x/include/mach/clps711x.h (renamed from arch/arm/include/asm/hardware/clps7111.h)130
-rw-r--r--arch/arm/mach-clps711x/include/mach/debug-macro.S5
-rw-r--r--arch/arm/mach-clps711x/include/mach/entry-macro.S3
-rw-r--r--arch/arm/mach-clps711x/include/mach/hardware.h59
-rw-r--r--arch/arm/mach-clps711x/include/mach/irqs.h5
-rw-r--r--arch/arm/mach-clps711x/include/mach/time.h49
-rw-r--r--arch/arm/mach-clps711x/include/mach/uncompress.h21
-rw-r--r--arch/arm/mach-clps711x/p720t-leds.c3
-rw-r--r--arch/arm/mach-cns3xxx/pcie.c12
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c2
-rw-r--r--arch/arm/mach-davinci/davinci.h4
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c2
-rw-r--r--arch/arm/mach-davinci/dm355.c2
-rw-r--r--arch/arm/mach-davinci/dm365.c2
-rw-r--r--arch/arm/mach-davinci/dma.c6
-rw-r--r--arch/arm/mach-davinci/include/mach/da8xx.h3
-rw-r--r--arch/arm/mach-davinci/include/mach/psc.h2
-rw-r--r--arch/arm/mach-dove/common.c2
-rw-r--r--arch/arm/mach-dove/mpp.c8
-rw-r--r--arch/arm/mach-dove/pcie.c24
-rw-r--r--arch/arm/mach-ep93xx/Kconfig5
-rw-r--r--arch/arm/mach-ep93xx/core.c110
-rw-r--r--arch/arm/mach-exynos/Kconfig17
-rw-r--r--arch/arm/mach-exynos/clock-exynos4.c24
-rw-r--r--arch/arm/mach-exynos/clock-exynos5.c26
-rw-r--r--arch/arm/mach-exynos/common.c14
-rw-r--r--arch/arm/mach-exynos/cpuidle.c53
-rw-r--r--arch/arm/mach-exynos/dev-ahci.c12
-rw-r--r--arch/arm/mach-exynos/dev-audio.c156
-rw-r--r--arch/arm/mach-exynos/dev-dwmci.c13
-rw-r--r--arch/arm/mach-exynos/include/mach/irqs.h3
-rw-r--r--arch/arm/mach-exynos/include/mach/map.h8
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-clock.h6
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-pmu.h3
-rw-r--r--arch/arm/mach-exynos/mach-armlex4210.c16
-rw-r--r--arch/arm/mach-exynos/mach-exynos5-dt.c2
-rw-r--r--arch/arm/mach-exynos/mach-nuri.c93
-rw-r--r--arch/arm/mach-exynos/mach-origen.c37
-rw-r--r--arch/arm/mach-exynos/mach-smdk4x12.c18
-rw-r--r--arch/arm/mach-exynos/mach-smdkv310.c47
-rw-r--r--arch/arm/mach-exynos/mach-universal_c210.c53
-rw-r--r--arch/arm/mach-exynos/setup-usb-phy.c100
-rw-r--r--arch/arm/mach-footbridge/cats-pci.c9
-rw-r--r--arch/arm/mach-footbridge/dc21285.c7
-rw-r--r--arch/arm/mach-footbridge/ebsa285-pci.c3
-rw-r--r--arch/arm/mach-footbridge/netwinder-pci.c3
-rw-r--r--arch/arm/mach-footbridge/personal-pci.c2
-rw-r--r--arch/arm/mach-imx/Kconfig39
-rw-r--r--arch/arm/mach-imx/Makefile4
-rw-r--r--arch/arm/mach-imx/eukrea_mbimx27-baseboard.c2
-rw-r--r--arch/arm/mach-imx/eukrea_mbimx51-baseboard.c206
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c51
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c42
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c (renamed from arch/arm/mach-imx/eukrea_mbimxsd-baseboard.c)120
-rw-r--r--arch/arm/mach-imx/imx27-dt.c6
-rw-r--r--arch/arm/mach-imx/imx51-dt.c3
-rw-r--r--arch/arm/mach-imx/imx53-dt.c3
-rw-r--r--arch/arm/mach-imx/mach-cpuimx35.c2
-rw-r--r--arch/arm/mach-imx/mach-cpuimx51.c301
-rw-r--r--arch/arm/mach-imx/mach-cpuimx51sd.c50
-rw-r--r--arch/arm/mach-imx/mach-eukrea_cpuimx25.c2
-rw-r--r--arch/arm/mach-imx/mach-imx27_visstrim_m10.c55
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c7
-rw-r--r--arch/arm/mach-imx/mach-mx1ads.c2
-rw-r--r--arch/arm/mach-imx/mach-mx21ads.c3
-rw-r--r--arch/arm/mach-imx/mach-mx31lite.c2
-rw-r--r--arch/arm/mach-imx/mach-mx31moboard.c2
-rw-r--r--arch/arm/mach-imx/mach-mx35_3ds.c195
-rw-r--r--arch/arm/mach-imx/mach-mx51_efikamx.c3
-rw-r--r--arch/arm/mach-imx/mach-mx51_efikasb.c2
-rw-r--r--arch/arm/mach-imx/mach-pcm037.c2
-rw-r--r--arch/arm/mach-imx/mach-pcm043.c2
-rw-r--r--arch/arm/mach-imx/mach-vpr200.c2
-rw-r--r--arch/arm/mach-imx/mm-imx1.c2
-rw-r--r--arch/arm/mach-imx/mm-imx21.c2
-rw-r--r--arch/arm/mach-imx/mm-imx25.c2
-rw-r--r--arch/arm/mach-imx/mm-imx27.c2
-rw-r--r--arch/arm/mach-imx/mm-imx3.c2
-rw-r--r--arch/arm/mach-imx/mm-imx5.c4
-rw-r--r--arch/arm/mach-integrator/impd1.c22
-rw-r--r--arch/arm/mach-integrator/include/mach/entry-macro.S39
-rw-r--r--arch/arm/mach-integrator/include/mach/irqs.h63
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c10
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c33
-rw-r--r--arch/arm/mach-integrator/pci.c19
-rw-r--r--arch/arm/mach-integrator/pci_v3.c8
-rw-r--r--arch/arm/mach-iop13xx/iq81340mc.c1
-rw-r--r--arch/arm/mach-iop13xx/iq81340sc.c1
-rw-r--r--arch/arm/mach-iop32x/em7210.c3
-rw-r--r--arch/arm/mach-iop32x/glantank.c3
-rw-r--r--arch/arm/mach-iop32x/iq31244.c6
-rw-r--r--arch/arm/mach-iop32x/iq80321.c3
-rw-r--r--arch/arm/mach-iop32x/n2100.c3
-rw-r--r--arch/arm/mach-iop33x/iq80331.c3
-rw-r--r--arch/arm/mach-iop33x/iq80332.c3
-rw-r--r--arch/arm/mach-ixp2000/Kconfig72
-rw-r--r--arch/arm/mach-ixp2000/Makefile14
-rw-r--r--arch/arm/mach-ixp2000/Makefile.boot3
-rw-r--r--arch/arm/mach-ixp2000/core.c520
-rw-r--r--arch/arm/mach-ixp2000/enp2611.c265
-rw-r--r--arch/arm/mach-ixp2000/include/mach/debug-macro.S25
-rw-r--r--arch/arm/mach-ixp2000/include/mach/enp2611.h46
-rw-r--r--arch/arm/mach-ixp2000/include/mach/entry-macro.S54
-rw-r--r--arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h48
-rw-r--r--arch/arm/mach-ixp2000/include/mach/hardware.h36
-rw-r--r--arch/arm/mach-ixp2000/include/mach/io.h133
-rw-r--r--arch/arm/mach-ixp2000/include/mach/irqs.h207
-rw-r--r--arch/arm/mach-ixp2000/include/mach/ixdp2x00.h92
-rw-r--r--arch/arm/mach-ixp2000/include/mach/ixdp2x01.h57
-rw-r--r--arch/arm/mach-ixp2000/include/mach/ixp2000-regs.h451
-rw-r--r--arch/arm/mach-ixp2000/include/mach/memory.h31
-rw-r--r--arch/arm/mach-ixp2000/include/mach/platform.h153
-rw-r--r--arch/arm/mach-ixp2000/include/mach/timex.h13
-rw-r--r--arch/arm/mach-ixp2000/include/mach/uncompress.h47
-rw-r--r--arch/arm/mach-ixp2000/ixdp2400.c180
-rw-r--r--arch/arm/mach-ixp2000/ixdp2800.c295
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x00.c306
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x01.c483
-rw-r--r--arch/arm/mach-ixp2000/pci.c252
-rw-r--r--arch/arm/mach-ixp23xx/Kconfig25
-rw-r--r--arch/arm/mach-ixp23xx/Makefile11
-rw-r--r--arch/arm/mach-ixp23xx/Makefile.boot2
-rw-r--r--arch/arm/mach-ixp23xx/core.c455
-rw-r--r--arch/arm/mach-ixp23xx/espresso.c93
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/debug-macro.S25
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/entry-macro.S31
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/hardware.h32
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/io.h22
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/irqs.h223
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/ixdp2351.h89
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/ixp23xx.h298
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/memory.h34
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/platform.h58
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/time.h3
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/timex.h7
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/uncompress.h40
-rw-r--r--arch/arm/mach-ixp23xx/ixdp2351.c347
-rw-r--r--arch/arm/mach-ixp23xx/pci.c294
-rw-r--r--arch/arm/mach-ixp23xx/roadrunner.c180
-rw-r--r--arch/arm/mach-ixp4xx/avila-pci.c3
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c6
-rw-r--r--arch/arm/mach-ixp4xx/coyote-pci.c3
-rw-r--r--arch/arm/mach-ixp4xx/dsmg600-pci.c3
-rw-r--r--arch/arm/mach-ixp4xx/fsg-pci.c3
-rw-r--r--arch/arm/mach-ixp4xx/gateway7001-pci.c3
-rw-r--r--arch/arm/mach-ixp4xx/goramo_mlr.c3
-rw-r--r--arch/arm/mach-ixp4xx/gtwx5715-pci.c3
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/ixp46x_ts.h3
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/platform.h2
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-pci.c3
-rw-r--r--arch/arm/mach-ixp4xx/ixdpg425-pci.c3
-rw-r--r--arch/arm/mach-ixp4xx/miccpt-pci.c3
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-pci.c3
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-pci.c3
-rw-r--r--arch/arm/mach-ixp4xx/vulcan-pci.c3
-rw-r--r--arch/arm/mach-ixp4xx/wg302v2-pci.c3
-rw-r--r--arch/arm/mach-kirkwood/Kconfig22
-rw-r--r--arch/arm/mach-kirkwood/Makefile3
-rw-r--r--arch/arm/mach-kirkwood/Makefile.boot4
-rw-r--r--arch/arm/mach-kirkwood/board-dnskw.c275
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c14
-rw-r--r--arch/arm/mach-kirkwood/board-ib62x0.c143
-rw-r--r--arch/arm/mach-kirkwood/board-iconnect.c165
-rw-r--r--arch/arm/mach-kirkwood/common.c12
-rw-r--r--arch/arm/mach-kirkwood/common.h18
-rw-r--r--arch/arm/mach-kirkwood/pcie.c16
-rw-r--r--arch/arm/mach-ks8695/pci.c9
-rw-r--r--arch/arm/mach-lpc32xx/Kconfig26
-rw-r--r--arch/arm/mach-lpc32xx/clock.c77
-rw-r--r--arch/arm/mach-lpc32xx/common.c188
-rw-r--r--arch/arm/mach-lpc32xx/common.h14
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/i2c.h63
-rw-r--r--arch/arm/mach-lpc32xx/irq.c78
-rw-r--r--arch/arm/mach-lpc32xx/phy3250.c149
-rw-r--r--arch/arm/mach-mmp/Kconfig36
-rw-r--r--arch/arm/mach-mmp/Makefile14
-rw-r--r--arch/arm/mach-mmp/aspenite.c20
-rw-r--r--arch/arm/mach-mmp/devices.c282
-rw-r--r--arch/arm/mach-mmp/include/mach/addr-map.h12
-rw-r--r--arch/arm/mach-mmp/include/mach/devices.h3
-rw-r--r--arch/arm/mach-mmp/include/mach/entry-macro.S4
-rw-r--r--arch/arm/mach-mmp/include/mach/irqs.h27
-rw-r--r--arch/arm/mach-mmp/include/mach/pm-mmp2.h61
-rw-r--r--arch/arm/mach-mmp/include/mach/pm-pxa910.h77
-rw-r--r--arch/arm/mach-mmp/include/mach/pxa168.h8
-rw-r--r--arch/arm/mach-mmp/include/mach/pxa910.h3
-rw-r--r--arch/arm/mach-mmp/include/mach/regs-apbc.h3
-rw-r--r--arch/arm/mach-mmp/include/mach/regs-apmu.h3
-rw-r--r--arch/arm/mach-mmp/include/mach/regs-usb.h253
-rw-r--r--arch/arm/mach-mmp/irq-mmp2.c158
-rw-r--r--arch/arm/mach-mmp/irq-pxa168.c54
-rw-r--r--arch/arm/mach-mmp/irq.c458
-rw-r--r--arch/arm/mach-mmp/mmp-dt.c66
-rw-r--r--arch/arm/mach-mmp/mmp2-dt.c60
-rw-r--r--arch/arm/mach-mmp/pm-mmp2.c264
-rw-r--r--arch/arm/mach-mmp/pm-pxa910.c285
-rw-r--r--arch/arm/mach-mmp/pxa168.c20
-rw-r--r--arch/arm/mach-mmp/pxa910.c2
-rw-r--r--arch/arm/mach-mmp/time.c81
-rw-r--r--arch/arm/mach-mmp/ttc_dkb.c48
-rw-r--r--arch/arm/mach-msm/board-halibut.c3
-rw-r--r--arch/arm/mach-msm/board-msm7x30.c1
-rw-r--r--arch/arm/mach-msm/board-msm8x60.c25
-rw-r--r--arch/arm/mach-msm/board-qsd8x50.c1
-rw-r--r--arch/arm/mach-msm/board-trout-panel.c1
-rw-r--r--arch/arm/mach-msm/board-trout.c1
-rw-r--r--arch/arm/mach-msm/include/mach/debug-macro.S3
-rw-r--r--arch/arm/mach-msm/proc_comm.c2
-rw-r--r--arch/arm/mach-msm/scm.c3
-rw-r--r--arch/arm/mach-mv78xx0/pcie.c24
-rw-r--r--arch/arm/mach-mxs/Kconfig2
-rw-r--r--arch/arm/mach-mxs/devices-mx23.h12
-rw-r--r--arch/arm/mach-mxs/devices-mx28.h12
-rw-r--r--arch/arm/mach-mxs/devices.c16
-rw-r--r--arch/arm/mach-mxs/devices/Makefile1
-rw-r--r--arch/arm/mach-mxs/devices/amba-duart.c40
-rw-r--r--arch/arm/mach-mxs/include/mach/common.h2
-rw-r--r--arch/arm/mach-mxs/include/mach/devices-common.h5
-rw-r--r--arch/arm/mach-mxs/mach-apx4devkit.c2
-rw-r--r--arch/arm/mach-mxs/mach-m28evk.c2
-rw-r--r--arch/arm/mach-mxs/mach-mx23evk.c2
-rw-r--r--arch/arm/mach-mxs/mach-mx28evk.c2
-rw-r--r--arch/arm/mach-mxs/mach-stmp378x_devb.c2
-rw-r--r--arch/arm/mach-mxs/mach-tx28.c2
-rw-r--r--arch/arm/mach-mxs/mm.c11
-rw-r--r--arch/arm/mach-nomadik/Kconfig1
-rw-r--r--arch/arm/mach-omap1/Kconfig1
-rw-r--r--arch/arm/mach-omap1/Makefile13
-rw-r--r--arch/arm/mach-omap1/ams-delta-fiq.c4
-rw-r--r--arch/arm/mach-omap1/board-fsample.c16
-rw-r--r--arch/arm/mach-omap1/board-h2.c17
-rw-r--r--arch/arm/mach-omap1/board-h3.c16
-rw-r--r--arch/arm/mach-omap1/board-nand.c37
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c4
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c16
-rw-r--r--arch/arm/mach-omap1/clock.c3
-rw-r--r--arch/arm/mach-omap1/common.h15
-rw-r--r--arch/arm/mach-omap1/fpga.c2
-rw-r--r--arch/arm/mach-omap1/id.c2
-rw-r--r--arch/arm/mach-omap1/io.c3
-rw-r--r--arch/arm/mach-omap1/irq.c2
-rw-r--r--arch/arm/mach-omap1/lcd_dma.c7
-rw-r--r--arch/arm/mach-omap1/mux.c1
-rw-r--r--arch/arm/mach-omap1/ocpi.c (renamed from arch/arm/plat-omap/ocpi.c)7
-rw-r--r--arch/arm/mach-omap1/pm.c9
-rw-r--r--arch/arm/mach-omap1/reset.c2
-rw-r--r--arch/arm/mach-omap1/timer.c7
-rw-r--r--arch/arm/mach-omap1/usb.c3
-rw-r--r--arch/arm/mach-omap2/Kconfig1
-rw-r--r--arch/arm/mach-omap2/Makefile13
-rw-r--r--arch/arm/mach-omap2/am35xx-emac.c37
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c38
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c103
-rw-r--r--arch/arm/mach-omap2/board-am3517crane.c2
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c25
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c35
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c30
-rw-r--r--arch/arm/mach-omap2/board-flash.c4
-rw-r--r--arch/arm/mach-omap2/board-flash.h11
-rw-r--r--arch/arm/mach-omap2/board-generic.c37
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c118
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c44
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c37
-rw-r--r--arch/arm/mach-omap2/board-omap3logic.c26
-rw-r--r--arch/arm/mach-omap2/board-omap3stalker.c29
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c132
-rw-r--r--arch/arm/mach-omap2/board-overo.c25
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c92
-rw-r--r--arch/arm/mach-omap2/board-rx51.c38
-rw-r--r--arch/arm/mach-omap2/board-zoom-display.c1
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c80
-rw-r--r--arch/arm/mach-omap2/clock.c7
-rw-r--r--arch/arm/mach-omap2/clock.h8
-rw-r--r--arch/arm/mach-omap2/clock3xxx_data.c25
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c11
-rw-r--r--arch/arm/mach-omap2/clockdomain.c7
-rw-r--r--arch/arm/mach-omap2/clockdomain44xx.c6
-rw-r--r--arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c10
-rw-r--r--arch/arm/mach-omap2/clockdomains3xxx_data.c6
-rw-r--r--arch/arm/mach-omap2/clockdomains44xx_data.c2
-rw-r--r--arch/arm/mach-omap2/clockdomains_common_data.c24
-rw-r--r--arch/arm/mach-omap2/cm-regbits-34xx.h4
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c28
-rw-r--r--arch/arm/mach-omap2/common.c1
-rw-r--r--arch/arm/mach-omap2/common.h6
-rw-r--r--arch/arm/mach-omap2/cpuidle34xx.c298
-rw-r--r--arch/arm/mach-omap2/cpuidle44xx.c126
-rw-r--r--arch/arm/mach-omap2/devices.c47
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c23
-rw-r--r--arch/arm/mach-omap2/dsp.c5
-rw-r--r--arch/arm/mach-omap2/gpio.c10
-rw-r--r--arch/arm/mach-omap2/gpmc-onenand.c3
-rw-r--r--arch/arm/mach-omap2/gpmc.c3
-rw-r--r--arch/arm/mach-omap2/hdq1w.c72
-rw-r--r--arch/arm/mach-omap2/hwspinlock.c2
-rw-r--r--arch/arm/mach-omap2/id.c5
-rw-r--r--arch/arm/mach-omap2/include/mach/ctrl_module_pad_core_44xx.h8
-rw-r--r--arch/arm/mach-omap2/io.c19
-rw-r--r--arch/arm/mach-omap2/irq.c6
-rw-r--r--arch/arm/mach-omap2/mailbox.c6
-rw-r--r--arch/arm/mach-omap2/msdi.c88
-rw-r--r--arch/arm/mach-omap2/mux.c2
-rw-r--r--arch/arm/mach-omap2/omap-secure.c1
-rw-r--r--arch/arm/mach-omap2/omap-wakeupgen.c2
-rw-r--r--arch/arm/mach-omap2/omap4-common.c58
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c1160
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c1581
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c1969
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c9
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c22
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c266
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c585
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c3088
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c6332
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_common_data.h76
-rw-r--r--arch/arm/mach-omap2/pm.h21
-rw-r--r--arch/arm/mach-omap2/pm24xx.c3
-rw-r--r--arch/arm/mach-omap2/pm34xx.c10
-rw-r--r--arch/arm/mach-omap2/powerdomain.c10
-rw-r--r--arch/arm/mach-omap2/powerdomain.h1
-rw-r--r--arch/arm/mach-omap2/prcm-common.h17
-rw-r--r--arch/arm/mach-omap2/prcm.c8
-rw-r--r--arch/arm/mach-omap2/prm_common.c4
-rw-r--r--arch/arm/mach-omap2/prminst44xx.c27
-rw-r--r--arch/arm/mach-omap2/serial.c134
-rw-r--r--arch/arm/mach-omap2/timer.c22
-rw-r--r--arch/arm/mach-omap2/twl-common.c227
-rw-r--r--arch/arm/mach-omap2/twl-common.h12
-rw-r--r--arch/arm/mach-omap2/usb-tusb6010.c2
-rw-r--r--arch/arm/mach-omap2/vc3xxx_data.c1
-rw-r--r--arch/arm/mach-omap2/voltage.c21
-rw-r--r--arch/arm/mach-omap2/wd_timer.c45
-rw-r--r--arch/arm/mach-omap2/wd_timer.h1
-rw-r--r--arch/arm/mach-orion5x/Kconfig1
-rw-r--r--arch/arm/mach-orion5x/addr-map.c2
-rw-r--r--arch/arm/mach-orion5x/common.c2
-rw-r--r--arch/arm/mach-orion5x/common.h1
-rw-r--r--arch/arm/mach-orion5x/db88f5281-setup.c1
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c26
-rw-r--r--arch/arm/mach-orion5x/kurobox_pro-setup.c1
-rw-r--r--arch/arm/mach-orion5x/mpp.h4
-rw-r--r--arch/arm/mach-orion5x/mss2-setup.c1
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c1
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-ge-setup.c1
-rw-r--r--arch/arm/mach-orion5x/rd88f5182-setup.c1
-rw-r--r--arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c1
-rw-r--r--arch/arm/mach-orion5x/terastation_pro2-setup.c1
-rw-r--r--arch/arm/mach-orion5x/ts209-setup.c1
-rw-r--r--arch/arm/mach-orion5x/ts409-setup.c1
-rw-r--r--arch/arm/mach-orion5x/ts78xx-fpga.h6
-rw-r--r--arch/arm/mach-orion5x/ts78xx-setup.c52
-rw-r--r--arch/arm/mach-orion5x/wnr854t-setup.c1
-rw-r--r--arch/arm/mach-orion5x/wrt350n-v2-setup.c1
-rw-r--r--arch/arm/mach-pnx4008/i2c.c64
-rw-r--r--arch/arm/mach-pnx4008/include/mach/i2c.h64
-rw-r--r--arch/arm/mach-prima2/irq.c6
-rw-r--r--arch/arm/mach-pxa/balloon3.c4
-rw-r--r--arch/arm/mach-pxa/cm-x2xx-pci.c3
-rw-r--r--arch/arm/mach-pxa/cm-x300.c4
-rw-r--r--arch/arm/mach-pxa/em-x270.c5
-rw-r--r--arch/arm/mach-pxa/hx4700.c47
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa27x.h1
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h7
-rw-r--r--arch/arm/mach-pxa/include/mach/mioa701.h3
-rw-r--r--arch/arm/mach-pxa/include/mach/pcm990_baseboard.h68
-rw-r--r--arch/arm/mach-pxa/magician.c8
-rw-r--r--arch/arm/mach-pxa/mfp-pxa2xx.c21
-rw-r--r--arch/arm/mach-pxa/mioa701.c6
-rw-r--r--arch/arm/mach-pxa/palm27x.c4
-rw-r--r--arch/arm/mach-pxa/pcm990-baseboard.c83
-rw-r--r--arch/arm/mach-pxa/pxa27x.c6
-rw-r--r--arch/arm/mach-pxa/spitz.c4
-rw-r--r--arch/arm/mach-pxa/stargate2.c5
-rw-r--r--arch/arm/mach-pxa/vpac270.c4
-rw-r--r--arch/arm/mach-pxa/z2.c4
-rw-r--r--arch/arm/mach-s3c24xx/Kconfig8
-rw-r--r--arch/arm/mach-s3c24xx/bast-ide.c36
-rw-r--r--arch/arm/mach-s3c24xx/mach-amlm5900.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-anubis.c62
-rw-r--r--arch/arm/mach-s3c24xx/mach-at2440evb.c19
-rw-r--r--arch/arm/mach-s3c24xx/mach-bast.c45
-rw-r--r--arch/arm/mach-s3c24xx/mach-gta02.c7
-rw-r--r--arch/arm/mach-s3c24xx/mach-h1940.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-mini2440.c19
-rw-r--r--arch/arm/mach-s3c24xx/mach-nexcoder.c6
-rw-r--r--arch/arm/mach-s3c24xx/mach-osiris.c12
-rw-r--r--arch/arm/mach-s3c24xx/mach-otom.c6
-rw-r--r--arch/arm/mach-s3c24xx/mach-qt2410.c12
-rw-r--r--arch/arm/mach-s3c24xx/mach-rx1950.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-tct_hammer.c7
-rw-r--r--arch/arm/mach-s3c24xx/mach-vr1000.c39
-rw-r--r--arch/arm/mach-s3c24xx/simtec-nor.c6
-rw-r--r--arch/arm/mach-s3c64xx/dev-audio.c120
-rw-r--r--arch/arm/mach-s3c64xx/dev-uart.c48
-rw-r--r--arch/arm/mach-s3c64xx/mach-anw6410.c19
-rw-r--r--arch/arm/mach-s3c64xx/mach-crag6410.c46
-rw-r--r--arch/arm/mach-s3c64xx/mach-mini6410.c19
-rw-r--r--arch/arm/mach-s3c64xx/mach-real6410.c19
-rw-r--r--arch/arm/mach-s3c64xx/mach-smartq.c2
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6410.c15
-rw-r--r--arch/arm/mach-s5p64x0/dev-audio.c72
-rw-r--r--arch/arm/mach-s5pc100/dev-audio.c138
-rw-r--r--arch/arm/mach-s5pv210/Kconfig1
-rw-r--r--arch/arm/mach-s5pv210/dev-audio.c156
-rw-r--r--arch/arm/mach-s5pv210/dma.c2
-rw-r--r--arch/arm/mach-s5pv210/mach-aquila.c4
-rw-r--r--arch/arm/mach-s5pv210/mach-goni.c12
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkv210.c19
-rw-r--r--arch/arm/mach-sa1100/generic.c2
-rw-r--r--arch/arm/mach-sa1100/pci-nanoengine.c8
-rw-r--r--arch/arm/mach-shark/pci.c3
-rw-r--r--arch/arm/mach-shmobile/Kconfig29
-rw-r--r--arch/arm/mach-shmobile/Makefile5
-rw-r--r--arch/arm/mach-shmobile/board-ag5evm.c22
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c2
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c784
-rw-r--r--arch/arm/mach-shmobile/board-bonito.c2
-rw-r--r--arch/arm/mach-shmobile/board-kzm9d.c85
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c460
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c32
-rw-r--r--arch/arm/mach-shmobile/clock-emev2.c249
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c128
-rw-r--r--arch/arm/mach-shmobile/headsmp.S56
-rw-r--r--arch/arm/mach-shmobile/include/mach/common.h4
-rw-r--r--arch/arm/mach-shmobile/include/mach/emev2.h19
-rw-r--r--arch/arm/mach-shmobile/include/mach/intc.h44
-rw-r--r--arch/arm/mach-shmobile/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh7372.h2
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh73a0.h37
-rw-r--r--arch/arm/mach-shmobile/intc-sh7372.c34
-rw-r--r--arch/arm/mach-shmobile/pfc-r8a7740.c39
-rw-r--r--arch/arm/mach-shmobile/pfc-sh73a0.c4
-rw-r--r--arch/arm/mach-shmobile/platsmp.c21
-rw-r--r--arch/arm/mach-shmobile/setup-emev2.c452
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c19
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c4
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c58
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c4
-rw-r--r--arch/arm/mach-shmobile/smp-emev2.c97
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7779.c8
-rw-r--r--arch/arm/mach-shmobile/smp-sh73a0.c7
-rw-r--r--arch/arm/mach-shmobile/timer.c27
-rw-r--r--arch/arm/mach-spear3xx/Kconfig37
-rw-r--r--arch/arm/mach-spear3xx/Makefile13
-rw-r--r--arch/arm/mach-spear3xx/Makefile.boot4
-rw-r--r--arch/arm/mach-spear3xx/clock.c280
-rw-r--r--arch/arm/mach-spear3xx/include/mach/generic.h164
-rw-r--r--arch/arm/mach-spear3xx/include/mach/hardware.h24
-rw-r--r--arch/arm/mach-spear3xx/include/mach/irqs.h130
-rw-r--r--arch/arm/mach-spear3xx/include/mach/misc_regs.h144
-rw-r--r--arch/arm/mach-spear3xx/include/mach/spear.h47
-rw-r--r--arch/arm/mach-spear3xx/include/mach/spear300.h54
-rw-r--r--arch/arm/mach-spear3xx/include/mach/spear310.h58
-rw-r--r--arch/arm/mach-spear3xx/include/mach/spear320.h67
-rw-r--r--arch/arm/mach-spear3xx/spear300.c654
-rw-r--r--arch/arm/mach-spear3xx/spear300_evb.c75
-rw-r--r--arch/arm/mach-spear3xx/spear310.c476
-rw-r--r--arch/arm/mach-spear3xx/spear310_evb.c81
-rw-r--r--arch/arm/mach-spear3xx/spear320.c725
-rw-r--r--arch/arm/mach-spear3xx/spear320_evb.c79
-rw-r--r--arch/arm/mach-spear3xx/spear3xx.c547
-rw-r--r--arch/arm/mach-spear6xx/Kconfig18
-rw-r--r--arch/arm/mach-spear6xx/Makefile.boot2
-rw-r--r--arch/arm/mach-spear6xx/clock.c186
-rw-r--r--arch/arm/mach-spear6xx/include/mach/generic.h29
-rw-r--r--arch/arm/mach-spear6xx/include/mach/hardware.h24
-rw-r--r--arch/arm/mach-spear6xx/include/mach/irqs.h75
-rw-r--r--arch/arm/mach-spear6xx/include/mach/misc_regs.h154
-rw-r--r--arch/arm/mach-spear6xx/include/mach/spear.h55
-rw-r--r--arch/arm/mach-spear6xx/include/mach/spear600.h21
-rw-r--r--arch/arm/mach-spear6xx/spear6xx.c417
-rw-r--r--arch/arm/mach-tegra/Makefile3
-rw-r--r--arch/arm/mach-tegra/board-dt-tegra20.c32
-rw-r--r--arch/arm/mach-tegra/board-harmony-pinmux.c266
-rw-r--r--arch/arm/mach-tegra/board-harmony.c2
-rw-r--r--arch/arm/mach-tegra/board-paz00-pinmux.c263
-rw-r--r--arch/arm/mach-tegra/board-paz00.c3
-rw-r--r--arch/arm/mach-tegra/board-pinmux.c105
-rw-r--r--arch/arm/mach-tegra/board-pinmux.h40
-rw-r--r--arch/arm/mach-tegra/board-seaboard-pinmux.c346
-rw-r--r--arch/arm/mach-tegra/board-seaboard.c23
-rw-r--r--arch/arm/mach-tegra/board-trimslice-pinmux.c264
-rw-r--r--arch/arm/mach-tegra/board-trimslice.c17
-rw-r--r--arch/arm/mach-tegra/devices.c5
-rw-r--r--arch/arm/mach-tegra/flowctrl.c4
-rw-r--r--arch/arm/mach-tegra/include/mach/dma.h4
-rw-r--r--arch/arm/mach-tegra/include/mach/gpio-tegra.h9
-rw-r--r--arch/arm/mach-tegra/include/mach/pinmux-tegra20.h184
-rw-r--r--arch/arm/mach-tegra/include/mach/pinmux-tegra30.h320
-rw-r--r--arch/arm/mach-tegra/include/mach/pinmux.h302
-rw-r--r--arch/arm/mach-tegra/pcie.c1
-rw-r--r--arch/arm/mach-tegra/pinmux-tegra20-tables.c244
-rw-r--r--arch/arm/mach-tegra/pinmux-tegra30-tables.c376
-rw-r--r--arch/arm/mach-tegra/pinmux.c987
-rw-r--r--arch/arm/mach-tegra/tegra2_clocks.c6
-rw-r--r--arch/arm/mach-tegra/timer.c5
-rw-r--r--arch/arm/mach-tegra/usb_phy.c1
-rw-r--r--arch/arm/mach-u300/core.c6
-rw-r--r--arch/arm/mach-u300/i2c.c9
-rw-r--r--arch/arm/mach-u300/include/mach/irqs.h150
-rw-r--r--arch/arm/mach-ux500/Kconfig29
-rw-r--r--arch/arm/mach-ux500/Makefile9
-rw-r--r--arch/arm/mach-ux500/board-mop500-msp.c267
-rw-r--r--arch/arm/mach-ux500/board-mop500-msp.h14
-rw-r--r--arch/arm/mach-ux500/board-mop500-pins.c733
-rw-r--r--arch/arm/mach-ux500/board-mop500-uib.c2
-rw-r--r--arch/arm/mach-ux500/board-mop500.c130
-rw-r--r--arch/arm/mach-ux500/board-mop500.h10
-rw-r--r--arch/arm/mach-ux500/board-u5500-sdi.c74
-rw-r--r--arch/arm/mach-ux500/board-u5500.c162
-rw-r--r--arch/arm/mach-ux500/cache-l2x0.c18
-rw-r--r--arch/arm/mach-ux500/clock.c20
-rw-r--r--arch/arm/mach-ux500/cpu-db5500.c247
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c43
-rw-r--r--arch/arm/mach-ux500/cpu.c22
-rw-r--r--arch/arm/mach-ux500/cpuidle.c171
-rw-r--r--arch/arm/mach-ux500/devices-common.c33
-rw-r--r--arch/arm/mach-ux500/devices-common.h35
-rw-r--r--arch/arm/mach-ux500/devices-db5500.h99
-rw-r--r--arch/arm/mach-ux500/devices-db8500.h12
-rw-r--r--arch/arm/mach-ux500/dma-db5500.c137
-rw-r--r--arch/arm/mach-ux500/id.c9
-rw-r--r--arch/arm/mach-ux500/include/mach/db5500-regs.h143
-rw-r--r--arch/arm/mach-ux500/include/mach/db8500-regs.h6
-rw-r--r--arch/arm/mach-ux500/include/mach/debug-macro.S4
-rw-r--r--arch/arm/mach-ux500/include/mach/devices.h1
-rw-r--r--arch/arm/mach-ux500/include/mach/hardware.h4
-rw-r--r--arch/arm/mach-ux500/include/mach/id.h17
-rw-r--r--arch/arm/mach-ux500/include/mach/irqs-board-u5500.h21
-rw-r--r--arch/arm/mach-ux500/include/mach/irqs-db5500.h113
-rw-r--r--arch/arm/mach-ux500/include/mach/irqs.h7
-rw-r--r--arch/arm/mach-ux500/include/mach/mbox-db5500.h88
-rw-r--r--arch/arm/mach-ux500/include/mach/msp.h29
-rw-r--r--arch/arm/mach-ux500/include/mach/setup.h6
-rw-r--r--arch/arm/mach-ux500/include/mach/uncompress.h7
-rw-r--r--arch/arm/mach-ux500/mbox-db5500.c565
-rw-r--r--arch/arm/mach-ux500/modem-irq-db5500.c143
-rw-r--r--arch/arm/mach-ux500/pins-db5500.h620
-rw-r--r--arch/arm/mach-ux500/pins-db8500.h72
-rw-r--r--arch/arm/mach-ux500/platsmp.c10
-rw-r--r--arch/arm/mach-ux500/ste-dma40-db5500.h135
-rw-r--r--arch/arm/mach-ux500/timer.c37
-rw-r--r--arch/arm/mach-versatile/core.c18
-rw-r--r--arch/arm/mach-versatile/pci.c13
-rw-r--r--arch/arm/mach-vexpress/v2m.c8
-rw-r--r--arch/arm/mm/Kconfig48
-rw-r--r--arch/arm/mm/Makefile4
-rw-r--r--arch/arm/mm/abort-ev6.S17
-rw-r--r--arch/arm/mm/cache-l2x0.c25
-rw-r--r--arch/arm/mm/cache-tauros2.c24
-rw-r--r--arch/arm/mm/cache-v3.S1
-rw-r--r--arch/arm/mm/cache-v4.S1
-rw-r--r--arch/arm/mm/cache-v4wb.S6
-rw-r--r--arch/arm/mm/cache-v4wt.S1
-rw-r--r--arch/arm/mm/cache-v6.S10
-rw-r--r--arch/arm/mm/cache-v7.S10
-rw-r--r--arch/arm/mm/context.c57
-rw-r--r--arch/arm/mm/copypage-v3.c81
-rw-r--r--arch/arm/mm/fault.c9
-rw-r--r--arch/arm/mm/init.c4
-rw-r--r--arch/arm/mm/mmu.c7
-rw-r--r--arch/arm/mm/nommu.c2
-rw-r--r--arch/arm/mm/proc-arm1020.S1
-rw-r--r--arch/arm/mm/proc-arm1020e.S1
-rw-r--r--arch/arm/mm/proc-arm1022.S1
-rw-r--r--arch/arm/mm/proc-arm1026.S1
-rw-r--r--arch/arm/mm/proc-arm6_7.S327
-rw-r--r--arch/arm/mm/proc-arm920.S1
-rw-r--r--arch/arm/mm/proc-arm922.S1
-rw-r--r--arch/arm/mm/proc-arm925.S1
-rw-r--r--arch/arm/mm/proc-arm926.S1
-rw-r--r--arch/arm/mm/proc-arm940.S6
-rw-r--r--arch/arm/mm/proc-arm946.S1
-rw-r--r--arch/arm/mm/proc-feroceon.S1
-rw-r--r--arch/arm/mm/proc-mohawk.S36
-rw-r--r--arch/arm/mm/proc-v7-2level.S9
-rw-r--r--arch/arm/mm/proc-v7.S12
-rw-r--r--arch/arm/mm/tlb-v3.S48
-rw-r--r--arch/arm/plat-iop/pci.c8
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx51.h48
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx53.h4
-rw-r--r--arch/arm/plat-nomadik/include/plat/gpio-nomadik.h8
-rw-r--r--arch/arm/plat-nomadik/include/plat/pincfg.h32
-rw-r--r--arch/arm/plat-omap/Makefile3
-rw-r--r--arch/arm/plat-omap/clock.c26
-rw-r--r--arch/arm/plat-omap/common.c1
-rw-r--r--arch/arm/plat-omap/counter_32k.c6
-rw-r--r--arch/arm/plat-omap/devices.c4
-rw-r--r--arch/arm/plat-omap/dma.c27
-rw-r--r--arch/arm/plat-omap/dmtimer.c3
-rw-r--r--arch/arm/plat-omap/include/plat/board.h2
-rw-r--r--arch/arm/plat-omap/include/plat/clkdev_omap.h4
-rw-r--r--arch/arm/plat-omap/include/plat/clock.h10
-rw-r--r--arch/arm/plat-omap/include/plat/common.h2
-rw-r--r--arch/arm/plat-omap/include/plat/cpu.h1
-rw-r--r--arch/arm/plat-omap/include/plat/dma.h1
-rw-r--r--arch/arm/plat-omap/include/plat/dmtimer.h6
-rw-r--r--arch/arm/plat-omap/include/plat/hdq1w.h36
-rw-r--r--arch/arm/plat-omap/include/plat/mmc.h4
-rw-r--r--arch/arm/plat-omap/include/plat/omap-serial.h1
-rw-r--r--arch/arm/plat-omap/include/plat/omap_hwmod.h45
-rw-r--r--arch/arm/plat-omap/omap_device.c2
-rw-r--r--arch/arm/plat-omap/sram.c16
-rw-r--r--arch/arm/plat-omap/usb.c8
-rw-r--r--arch/arm/plat-orion/gpio.c27
-rw-r--r--arch/arm/plat-orion/include/plat/gpio.h2
-rw-r--r--arch/arm/plat-samsung/Kconfig1
-rw-r--r--arch/arm/plat-samsung/devs.c18
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-usb-hsotg.h379
-rw-r--r--arch/arm/plat-samsung/include/plat/sdhci.h35
-rw-r--r--arch/arm/plat-samsung/include/plat/udc-hs.h34
-rw-r--r--arch/arm/plat-samsung/platformdata.c2
-rw-r--r--arch/arm/plat-spear/Kconfig4
-rw-r--r--arch/arm/plat-spear/Makefile4
-rw-r--r--arch/arm/plat-spear/include/plat/debug-macro.S2
-rw-r--r--arch/arm/plat-spear/include/plat/hardware.h17
-rw-r--r--arch/arm/plat-spear/include/plat/padmux.h92
-rw-r--r--arch/arm/plat-spear/include/plat/pl080.h21
-rw-r--r--arch/arm/plat-spear/include/plat/uncompress.h2
-rw-r--r--arch/arm/plat-spear/padmux.c164
-rw-r--r--arch/arm/plat-spear/pl080.c80
-rw-r--r--arch/arm/plat-spear/restart.c2
-rw-r--r--arch/arm/plat-spear/time.c17
-rw-r--r--arch/arm/plat-versatile/Kconfig6
-rw-r--r--arch/arm/plat-versatile/fpga-irq.c116
-rw-r--r--arch/arm/plat-versatile/include/plat/fpga-irq.h11
-rw-r--r--arch/arm/tools/mach-types505
-rw-r--r--arch/arm/vfp/vfpmodule.c115
-rw-r--r--arch/avr32/kernel/Makefile2
-rw-r--r--arch/avr32/kernel/init_task.c31
-rw-r--r--arch/blackfin/ADI_BSD.txt41
-rw-r--r--arch/blackfin/Clear_BSD.txt33
-rw-r--r--arch/blackfin/Kconfig185
-rw-r--r--arch/blackfin/Kconfig.debug7
-rw-r--r--arch/blackfin/Makefile4
-rw-r--r--arch/blackfin/configs/BF561-EZKIT-SMP_defconfig4
-rw-r--r--arch/blackfin/configs/BF609-EZKIT_defconfig155
-rw-r--r--arch/blackfin/include/asm/bfin-global.h5
-rw-r--r--arch/blackfin/include/asm/bfin6xx_spi.h258
-rw-r--r--arch/blackfin/include/asm/bfin_crc.h139
-rw-r--r--arch/blackfin/include/asm/bfin_dma.h84
-rw-r--r--arch/blackfin/include/asm/bfin_pfmon.h2
-rw-r--r--arch/blackfin/include/asm/bfin_ppi.h128
-rw-r--r--arch/blackfin/include/asm/bfin_rotary.h1
-rw-r--r--arch/blackfin/include/asm/bfin_serial.h182
-rw-r--r--arch/blackfin/include/asm/bfin_sport.h1
-rw-r--r--arch/blackfin/include/asm/bfin_sport3.h107
-rw-r--r--arch/blackfin/include/asm/bfin_twi.h142
-rw-r--r--arch/blackfin/include/asm/blackfin.h8
-rw-r--r--arch/blackfin/include/asm/clkdev.h14
-rw-r--r--arch/blackfin/include/asm/clocks.h23
-rw-r--r--arch/blackfin/include/asm/cplb.h4
-rw-r--r--arch/blackfin/include/asm/def_LPBlackfin.h6
-rw-r--r--arch/blackfin/include/asm/dma.h137
-rw-r--r--arch/blackfin/include/asm/dpmc.h656
-rw-r--r--arch/blackfin/include/asm/fixed_code.h30
-rw-r--r--arch/blackfin/include/asm/gpio.h44
-rw-r--r--arch/blackfin/include/asm/gptimers.h104
-rw-r--r--arch/blackfin/include/asm/irqflags.h6
-rw-r--r--arch/blackfin/include/asm/page.h5
-rw-r--r--arch/blackfin/include/asm/pda.h2
-rw-r--r--arch/blackfin/include/asm/pm.h31
-rw-r--r--arch/blackfin/include/asm/unistd.h2
-rw-r--r--arch/blackfin/kernel/Makefile2
-rw-r--r--arch/blackfin/kernel/bfin_dma.c146
-rw-r--r--arch/blackfin/kernel/bfin_gpio.c28
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbinit.c4
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbmgr.c6
-rw-r--r--arch/blackfin/kernel/debug-mmrs.c9
-rw-r--r--arch/blackfin/kernel/entry.S10
-rw-r--r--arch/blackfin/kernel/gptimers.c85
-rw-r--r--arch/blackfin/kernel/init_task.c32
-rw-r--r--arch/blackfin/kernel/process.c8
-rw-r--r--arch/blackfin/kernel/reboot.c6
-rw-r--r--arch/blackfin/kernel/setup.c132
-rw-r--r--arch/blackfin/kernel/shadow_console.c6
-rw-r--r--arch/blackfin/kernel/time-ts.c27
-rw-r--r--arch/blackfin/lib/divsi3.S2
-rw-r--r--arch/blackfin/lib/memchr.S2
-rw-r--r--arch/blackfin/lib/memcmp.S2
-rw-r--r--arch/blackfin/lib/memcpy.S2
-rw-r--r--arch/blackfin/lib/memmove.S2
-rw-r--r--arch/blackfin/lib/memset.S2
-rw-r--r--arch/blackfin/lib/modsi3.S2
-rw-r--r--arch/blackfin/lib/muldi3.S2
-rw-r--r--arch/blackfin/lib/smulsi3_highpart.S2
-rw-r--r--arch/blackfin/lib/strcmp.S2
-rw-r--r--arch/blackfin/lib/strcpy.S2
-rw-r--r--arch/blackfin/lib/strncmp.S2
-rw-r--r--arch/blackfin/lib/strncpy.S2
-rw-r--r--arch/blackfin/lib/udivsi3.S2
-rw-r--r--arch/blackfin/lib/umodsi3.S2
-rw-r--r--arch/blackfin/lib/umulsi3_highpart.S2
-rw-r--r--arch/blackfin/mach-bf518/boards/ezbrd.c5
-rw-r--r--arch/blackfin/mach-bf518/boards/tcm-bf518.c5
-rw-r--r--arch/blackfin/mach-bf518/include/mach/anomaly.h3
-rw-r--r--arch/blackfin/mach-bf518/include/mach/cdefBF512.h2
-rw-r--r--arch/blackfin/mach-bf518/include/mach/cdefBF514.h2
-rw-r--r--arch/blackfin/mach-bf518/include/mach/cdefBF516.h2
-rw-r--r--arch/blackfin/mach-bf518/include/mach/cdefBF518.h2
-rw-r--r--arch/blackfin/mach-bf518/include/mach/defBF512.h73
-rw-r--r--arch/blackfin/mach-bf518/include/mach/defBF514.h2
-rw-r--r--arch/blackfin/mach-bf518/include/mach/defBF516.h2
-rw-r--r--arch/blackfin/mach-bf518/include/mach/defBF518.h2
-rw-r--r--arch/blackfin/mach-bf527/boards/ad7160eval.c6
-rw-r--r--arch/blackfin/mach-bf527/boards/cm_bf527.c5
-rw-r--r--arch/blackfin/mach-bf527/boards/ezbrd.c5
-rw-r--r--arch/blackfin/mach-bf527/boards/ezkit.c6
-rw-r--r--arch/blackfin/mach-bf527/boards/tll6527m.c5
-rw-r--r--arch/blackfin/mach-bf527/include/mach/anomaly.h3
-rw-r--r--arch/blackfin/mach-bf527/include/mach/defBF522.h73
-rw-r--r--arch/blackfin/mach-bf527/include/mach/defBF525.h2
-rw-r--r--arch/blackfin/mach-bf527/include/mach/defBF527.h2
-rw-r--r--arch/blackfin/mach-bf533/include/mach/anomaly.h3
-rw-r--r--arch/blackfin/mach-bf533/include/mach/defBF532.h2
-rw-r--r--arch/blackfin/mach-bf537/boards/cm_bf537e.c5
-rw-r--r--arch/blackfin/mach-bf537/boards/cm_bf537u.c5
-rw-r--r--arch/blackfin/mach-bf537/boards/dnp5370.c5
-rw-r--r--arch/blackfin/mach-bf537/boards/minotaur.c5
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c66
-rw-r--r--arch/blackfin/mach-bf537/boards/tcm_bf537.c5
-rw-r--r--arch/blackfin/mach-bf537/include/mach/anomaly.h3
-rw-r--r--arch/blackfin/mach-bf537/include/mach/defBF534.h71
-rw-r--r--arch/blackfin/mach-bf537/include/mach/defBF537.h2
-rw-r--r--arch/blackfin/mach-bf538/boards/ezkit.c61
-rw-r--r--arch/blackfin/mach-bf538/include/mach/anomaly.h3
-rw-r--r--arch/blackfin/mach-bf538/include/mach/defBF538.h78
-rw-r--r--arch/blackfin/mach-bf538/include/mach/defBF539.h2
-rw-r--r--arch/blackfin/mach-bf548/boards/cm_bf548.c10
-rw-r--r--arch/blackfin/mach-bf548/boards/ezkit.c11
-rw-r--r--arch/blackfin/mach-bf548/include/mach/anomaly.h3
-rw-r--r--arch/blackfin/mach-bf548/include/mach/defBF542.h2
-rw-r--r--arch/blackfin/mach-bf548/include/mach/defBF544.h2
-rw-r--r--arch/blackfin/mach-bf548/include/mach/defBF547.h2
-rw-r--r--arch/blackfin/mach-bf548/include/mach/defBF548.h2
-rw-r--r--arch/blackfin/mach-bf548/include/mach/defBF549.h2
-rw-r--r--arch/blackfin/mach-bf548/include/mach/defBF54x_base.h111
-rw-r--r--arch/blackfin/mach-bf561/include/mach/anomaly.h3
-rw-r--r--arch/blackfin/mach-bf561/include/mach/defBF561.h2
-rw-r--r--arch/blackfin/mach-bf609/Kconfig56
-rw-r--r--arch/blackfin/mach-bf609/Makefile6
-rw-r--r--arch/blackfin/mach-bf609/boards/Kconfig12
-rw-r--r--arch/blackfin/mach-bf609/boards/Makefile5
-rw-r--r--arch/blackfin/mach-bf609/boards/ezkit.c1340
-rw-r--r--arch/blackfin/mach-bf609/clock.c390
-rw-r--r--arch/blackfin/mach-bf609/dma.c202
-rw-r--r--arch/blackfin/mach-bf609/hibernate.S65
-rw-r--r--arch/blackfin/mach-bf609/include/mach/anomaly.h130
-rw-r--r--arch/blackfin/mach-bf609/include/mach/bf609.h93
-rw-r--r--arch/blackfin/mach-bf609/include/mach/bfin_serial.h17
-rw-r--r--arch/blackfin/mach-bf609/include/mach/blackfin.h25
-rw-r--r--arch/blackfin/mach-bf609/include/mach/cdefBF609.h15
-rw-r--r--arch/blackfin/mach-bf609/include/mach/cdefBF60x_base.h3252
-rw-r--r--arch/blackfin/mach-bf609/include/mach/defBF609.h15
-rw-r--r--arch/blackfin/mach-bf609/include/mach/defBF60x_base.h3587
-rw-r--r--arch/blackfin/mach-bf609/include/mach/dma.h116
-rw-r--r--arch/blackfin/mach-bf609/include/mach/gpio.h171
-rw-r--r--arch/blackfin/mach-bf609/include/mach/irq.h318
-rw-r--r--arch/blackfin/mach-bf609/include/mach/mem_map.h86
-rw-r--r--arch/blackfin/mach-bf609/include/mach/pll.h1
-rw-r--r--arch/blackfin/mach-bf609/include/mach/pm.h21
-rw-r--r--arch/blackfin/mach-bf609/include/mach/portmux.h347
-rw-r--r--arch/blackfin/mach-bf609/pm.c362
-rw-r--r--arch/blackfin/mach-common/Makefile5
-rw-r--r--arch/blackfin/mach-common/clock.h27
-rw-r--r--arch/blackfin/mach-common/clocks-init.c153
-rw-r--r--arch/blackfin/mach-common/cpufreq.c46
-rw-r--r--arch/blackfin/mach-common/dpmc_modes.S606
-rw-r--r--arch/blackfin/mach-common/entry.S5
-rw-r--r--arch/blackfin/mach-common/head.S2
-rw-r--r--arch/blackfin/mach-common/ints-priority.c423
-rw-r--r--arch/blackfin/mach-common/pm.c62
-rw-r--r--arch/blackfin/mach-common/smp.c19
-rw-r--r--arch/blackfin/mm/init.c14
-rw-r--r--arch/blackfin/mm/sram-alloc.c36
-rw-r--r--arch/c6x/Kconfig14
-rw-r--r--arch/c6x/include/asm/elf.h14
-rw-r--r--arch/c6x/include/asm/irq.h4
-rw-r--r--arch/c6x/include/asm/mmu.h4
-rw-r--r--arch/c6x/include/asm/ptrace.h5
-rw-r--r--arch/c6x/include/asm/thread_info.h17
-rw-r--r--arch/c6x/kernel/irq.c13
-rw-r--r--arch/c6x/kernel/process.c16
-rw-r--r--arch/cris/Kconfig1
-rw-r--r--arch/cris/arch-v32/kernel/smp.c14
-rw-r--r--arch/cris/include/asm/processor.h5
-rw-r--r--arch/cris/include/asm/thread_info.h6
-rw-r--r--arch/cris/kernel/process.c28
-rw-r--r--arch/frv/Makefile2
-rw-r--r--arch/frv/include/asm/processor.h4
-rw-r--r--arch/frv/include/asm/thread_info.h15
-rw-r--r--arch/frv/kernel/Makefile2
-rw-r--r--arch/frv/kernel/init_task.c32
-rw-r--r--arch/frv/kernel/process.c15
-rw-r--r--arch/h8300/kernel/Makefile2
-rw-r--r--arch/h8300/kernel/init_task.c36
-rw-r--r--arch/hexagon/Kconfig3
-rw-r--r--arch/hexagon/Makefile3
-rw-r--r--arch/hexagon/include/asm/thread_info.h8
-rw-r--r--arch/hexagon/kernel/Makefile2
-rw-r--r--arch/hexagon/kernel/dma.c1
-rw-r--r--arch/hexagon/kernel/init_task.c54
-rw-r--r--arch/hexagon/kernel/process.c43
-rw-r--r--arch/hexagon/kernel/ptrace.c1
-rw-r--r--arch/hexagon/kernel/smp.c19
-rw-r--r--arch/hexagon/kernel/time.c1
-rw-r--r--arch/hexagon/kernel/vdso.c1
-rw-r--r--arch/ia64/Kconfig4
-rw-r--r--arch/ia64/include/asm/cmpxchg.h148
-rw-r--r--arch/ia64/include/asm/futex.h9
-rw-r--r--arch/ia64/include/asm/intrinsics.h114
-rw-r--r--arch/ia64/include/asm/irq_remapping.h4
-rw-r--r--arch/ia64/include/asm/processor.h1
-rw-r--r--arch/ia64/include/asm/thread_info.h3
-rw-r--r--arch/ia64/include/asm/topology.h25
-rw-r--r--arch/ia64/kernel/perfmon.c18
-rw-r--r--arch/ia64/kernel/process.c20
-rw-r--r--arch/ia64/kernel/smpboot.c63
-rw-r--r--arch/ia64/kvm/kvm-ia64.c2
-rw-r--r--arch/m32r/Makefile2
-rw-r--r--arch/m32r/include/asm/thread_info.h17
-rw-r--r--arch/m32r/kernel/Makefile2
-rw-r--r--arch/m32r/kernel/init_task.c34
-rw-r--r--arch/m32r/kernel/smpboot.c6
-rw-r--r--arch/m68k/Makefile25
-rw-r--r--arch/m68k/amiga/platform.c126
-rw-r--r--arch/m68k/atari/ataints.c4
-rw-r--r--arch/m68k/configs/m5275evb_defconfig1
-rw-r--r--arch/m68k/configs/m5475evb_defconfig62
-rw-r--r--arch/m68k/include/asm/atariints.h4
-rw-r--r--arch/m68k/include/asm/cacheflush_no.h32
-rw-r--r--arch/m68k/include/asm/entry.h6
-rw-r--r--arch/m68k/include/asm/flat.h7
-rw-r--r--arch/m68k/include/asm/io_mm.h7
-rw-r--r--arch/m68k/include/asm/m528xsim.h179
-rw-r--r--arch/m68k/include/asm/mcfgpio.h57
-rw-r--r--arch/m68k/include/asm/unaligned.h2
-rw-r--r--arch/m68k/include/asm/vga.h27
-rw-r--r--arch/m68k/kernel/Makefile2
-rw-r--r--arch/m68k/kernel/dma.c165
-rw-r--r--arch/m68k/kernel/dma_mm.c131
-rw-r--r--arch/m68k/kernel/dma_no.c75
-rw-r--r--arch/m68k/kernel/init_task.c35
-rw-r--r--arch/m68k/kernel/signal.c1201
-rw-r--r--arch/m68k/kernel/signal_mm.c1115
-rw-r--r--arch/m68k/kernel/signal_no.c765
-rw-r--r--arch/m68k/mm/fault.c42
-rw-r--r--arch/m68k/platform/5206/Makefile18
-rw-r--r--arch/m68k/platform/5206/gpio.c49
-rw-r--r--arch/m68k/platform/520x/Makefile17
-rw-r--r--arch/m68k/platform/520x/gpio.c175
-rw-r--r--arch/m68k/platform/523x/Makefile17
-rw-r--r--arch/m68k/platform/523x/gpio.c284
-rw-r--r--arch/m68k/platform/5249/Makefile18
-rw-r--r--arch/m68k/platform/5249/gpio.c65
-rw-r--r--arch/m68k/platform/5272/Makefile18
-rw-r--r--arch/m68k/platform/5272/gpio.c81
-rw-r--r--arch/m68k/platform/527x/Makefile18
-rw-r--r--arch/m68k/platform/527x/gpio.c609
-rw-r--r--arch/m68k/platform/528x/Makefile18
-rw-r--r--arch/m68k/platform/528x/gpio.c438
-rw-r--r--arch/m68k/platform/5307/Makefile20
-rw-r--r--arch/m68k/platform/5307/gpio.c49
-rw-r--r--arch/m68k/platform/532x/Makefile18
-rw-r--r--arch/m68k/platform/532x/gpio.c337
-rw-r--r--arch/m68k/platform/5407/Makefile18
-rw-r--r--arch/m68k/platform/5407/gpio.c49
-rw-r--r--arch/m68k/platform/54xx/Makefile19
-rw-r--r--arch/m68k/platform/68EZ328/Makefile6
-rw-r--r--arch/m68k/platform/68VZ328/Makefile9
-rw-r--r--arch/m68k/platform/68VZ328/bootlogo.h (renamed from arch/m68k/platform/68EZ328/bootlogo.h)2
-rw-r--r--arch/m68k/platform/coldfire/Makefile28
-rw-r--r--arch/m68k/platform/coldfire/device.c8
-rw-r--r--arch/m68k/platform/coldfire/firebee.c (renamed from arch/m68k/platform/54xx/firebee.c)0
-rw-r--r--arch/m68k/platform/coldfire/gpio.c4
-rw-r--r--arch/m68k/platform/coldfire/intc-5249.c (renamed from arch/m68k/platform/5249/intc2.c)0
-rw-r--r--arch/m68k/platform/coldfire/intc-5272.c (renamed from arch/m68k/platform/5272/intc.c)0
-rw-r--r--arch/m68k/platform/coldfire/m5206.c (renamed from arch/m68k/platform/5206/config.c)9
-rw-r--r--arch/m68k/platform/coldfire/m520x.c (renamed from arch/m68k/platform/520x/config.c)22
-rw-r--r--arch/m68k/platform/coldfire/m523x.c (renamed from arch/m68k/platform/523x/config.c)28
-rw-r--r--arch/m68k/platform/coldfire/m5249.c (renamed from arch/m68k/platform/5249/config.c)16
-rw-r--r--arch/m68k/platform/coldfire/m5272.c (renamed from arch/m68k/platform/5272/config.c)11
-rw-r--r--arch/m68k/platform/coldfire/m527x.c (renamed from arch/m68k/platform/527x/config.c)51
-rw-r--r--arch/m68k/platform/coldfire/m528x.c (renamed from arch/m68k/platform/528x/config.c)37
-rw-r--r--arch/m68k/platform/coldfire/m5307.c (renamed from arch/m68k/platform/5307/config.c)9
-rw-r--r--arch/m68k/platform/coldfire/m532x.c (renamed from arch/m68k/platform/532x/config.c)31
-rw-r--r--arch/m68k/platform/coldfire/m5407.c (renamed from arch/m68k/platform/5407/config.c)9
-rw-r--r--arch/m68k/platform/coldfire/m54xx.c (renamed from arch/m68k/platform/54xx/config.c)7
-rw-r--r--arch/m68k/platform/coldfire/nettel.c (renamed from arch/m68k/platform/5307/nettel.c)0
-rw-r--r--arch/microblaze/kernel/Makefile2
-rw-r--r--arch/microblaze/kernel/init_task.c26
-rw-r--r--arch/microblaze/kernel/ptrace.c2
-rw-r--r--arch/microblaze/pci/pci-common.c1
-rw-r--r--arch/mips/Kconfig1
-rw-r--r--arch/mips/Makefile2
-rw-r--r--arch/mips/ath79/dev-wmac.c2
-rw-r--r--arch/mips/configs/mtx1_defconfig4
-rw-r--r--arch/mips/include/asm/mach-ip27/topology.h17
-rw-r--r--arch/mips/include/asm/mach-jz4740/irq.h2
-rw-r--r--arch/mips/include/asm/mmu_context.h6
-rw-r--r--arch/mips/include/asm/thread_info.h12
-rw-r--r--arch/mips/kernel/Makefile2
-rw-r--r--arch/mips/kernel/init_task.c35
-rw-r--r--arch/mips/kernel/perf_event_mipsxx.c2
-rw-r--r--arch/mips/kernel/ptrace.c2
-rw-r--r--arch/mips/kernel/signal.c27
-rw-r--r--arch/mips/kernel/signal32.c20
-rw-r--r--arch/mips/kernel/signal_n32.c10
-rw-r--r--arch/mips/kernel/smp.c56
-rw-r--r--arch/mn10300/Makefile2
-rw-r--r--arch/mn10300/include/asm/thread_info.h17
-rw-r--r--arch/mn10300/kernel/Makefile2
-rw-r--r--arch/mn10300/kernel/init_task.c39
-rw-r--r--arch/mn10300/kernel/kgdb.c3
-rw-r--r--arch/mn10300/kernel/smp.c11
-rw-r--r--arch/openrisc/Kconfig1
-rw-r--r--arch/openrisc/Makefile2
-rw-r--r--arch/openrisc/include/asm/Kbuild3
-rw-r--r--arch/openrisc/include/asm/dma-mapping.h147
-rw-r--r--arch/openrisc/include/asm/elf.h12
-rw-r--r--arch/openrisc/include/asm/ptrace.h6
-rw-r--r--arch/openrisc/kernel/Makefile2
-rw-r--r--arch/openrisc/kernel/dma.c109
-rw-r--r--arch/openrisc/kernel/entry.S8
-rw-r--r--arch/openrisc/kernel/init_task.c42
-rw-r--r--arch/openrisc/kernel/irq.c83
-rw-r--r--arch/openrisc/mm/fault.c32
-rw-r--r--arch/parisc/Kconfig1
-rw-r--r--arch/parisc/Makefile2
-rw-r--r--arch/parisc/include/asm/hardware.h3
-rw-r--r--arch/parisc/include/asm/page.h6
-rw-r--r--arch/parisc/include/asm/pdc.h7
-rw-r--r--arch/parisc/include/asm/pgtable.h2
-rw-r--r--arch/parisc/include/asm/prefetch.h7
-rw-r--r--arch/parisc/include/asm/spinlock.h2
-rw-r--r--arch/parisc/kernel/Makefile2
-rw-r--r--arch/parisc/kernel/entry.S4
-rw-r--r--arch/parisc/kernel/init_task.c70
-rw-r--r--arch/parisc/kernel/pacache.S38
-rw-r--r--arch/parisc/kernel/pdc_cons.c3
-rw-r--r--arch/parisc/kernel/smp.c33
-rw-r--r--arch/parisc/kernel/time.c1
-rw-r--r--arch/parisc/mm/init.c12
-rw-r--r--arch/powerpc/Kconfig7
-rw-r--r--arch/powerpc/boot/dts/fsl/pq3-mpic-message-B.dtsi43
-rw-r--r--arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi10
-rw-r--r--arch/powerpc/configs/chroma_defconfig2
-rw-r--r--arch/powerpc/configs/gamecube_defconfig2
-rw-r--r--arch/powerpc/configs/wii_defconfig2
-rw-r--r--arch/powerpc/include/asm/exception-64s.h7
-rw-r--r--arch/powerpc/include/asm/irq.h6
-rw-r--r--arch/powerpc/include/asm/kvm_book3s.h7
-rw-r--r--arch/powerpc/include/asm/mpic.h18
-rw-r--r--arch/powerpc/include/asm/mpic_msgr.h1
-rw-r--r--arch/powerpc/include/asm/processor.h1
-rw-r--r--arch/powerpc/include/asm/reg_booke.h5
-rw-r--r--arch/powerpc/include/asm/thread_info.h13
-rw-r--r--arch/powerpc/include/asm/topology.h36
-rw-r--r--arch/powerpc/kernel/Makefile2
-rw-r--r--arch/powerpc/kernel/entry_32.S39
-rw-r--r--arch/powerpc/kernel/entry_64.S62
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S2
-rw-r--r--arch/powerpc/kernel/idle.c23
-rw-r--r--arch/powerpc/kernel/init_task.c29
-rw-r--r--arch/powerpc/kernel/irq.c33
-rw-r--r--arch/powerpc/kernel/machine_kexec.c7
-rw-r--r--arch/powerpc/kernel/process.c35
-rw-r--r--arch/powerpc/kernel/ptrace.c2
-rw-r--r--arch/powerpc/kernel/setup_32.c3
-rw-r--r--arch/powerpc/kernel/smp.c76
-rw-r--r--arch/powerpc/kernel/traps.c10
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_host.c13
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_hv.c22
-rw-r--r--arch/powerpc/kvm/book3s_hv.c2
-rw-r--r--arch/powerpc/kvm/book3s_hv_rm_mmu.c1
-rw-r--r--arch/powerpc/kvm/book3s_segment.S42
-rw-r--r--arch/powerpc/mm/hugetlbpage.c3
-rw-r--r--arch/powerpc/net/bpf_jit.h8
-rw-r--r--arch/powerpc/net/bpf_jit_64.S108
-rw-r--r--arch/powerpc/net/bpf_jit_comp.c26
-rw-r--r--arch/powerpc/perf/core-book3s.c3
-rw-r--r--arch/powerpc/perf/core-fsl-emb.c3
-rw-r--r--arch/powerpc/platforms/85xx/common.c6
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c11
-rw-r--r--arch/powerpc/platforms/85xx/p1022_ds.c13
-rw-r--r--arch/powerpc/platforms/cell/axon_msi.c8
-rw-r--r--arch/powerpc/platforms/cell/beat_interrupt.c4
-rw-r--r--arch/powerpc/platforms/powermac/low_i2c.c9
-rw-r--r--arch/powerpc/platforms/powermac/pic.c6
-rw-r--r--arch/powerpc/platforms/powermac/smp.c2
-rw-r--r--arch/powerpc/platforms/ps3/interrupt.c3
-rw-r--r--arch/powerpc/platforms/pseries/Kconfig4
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c2
-rw-r--r--arch/powerpc/sysdev/cpm2_pic.c3
-rw-r--r--arch/powerpc/sysdev/mpc8xx_pic.c61
-rw-r--r--arch/powerpc/sysdev/mpic.c54
-rw-r--r--arch/powerpc/sysdev/mpic_msgr.c12
-rw-r--r--arch/powerpc/sysdev/scom.c1
-rw-r--r--arch/powerpc/sysdev/xics/xics-common.c7
-rw-r--r--arch/s390/Kconfig57
-rw-r--r--arch/s390/Makefile1
-rw-r--r--arch/s390/boot/.gitignore2
-rw-r--r--arch/s390/boot/compressed/.gitignore3
-rw-r--r--arch/s390/defconfig38
-rw-r--r--arch/s390/include/asm/barrier.h37
-rw-r--r--arch/s390/include/asm/ccwgroup.h14
-rw-r--r--arch/s390/include/asm/facility.h3
-rw-r--r--arch/s390/include/asm/io.h7
-rw-r--r--arch/s390/include/asm/pgalloc.h3
-rw-r--r--arch/s390/include/asm/qdio.h19
-rw-r--r--arch/s390/include/asm/setup.h3
-rw-r--r--arch/s390/include/asm/smp.h2
-rw-r--r--arch/s390/include/asm/swab.h2
-rw-r--r--arch/s390/include/asm/thread_info.h2
-rw-r--r--arch/s390/include/asm/timex.h17
-rw-r--r--arch/s390/include/asm/tlb.h22
-rw-r--r--arch/s390/kernel/.gitignore1
-rw-r--r--arch/s390/kernel/Makefile2
-rw-r--r--arch/s390/kernel/compat_signal.c7
-rw-r--r--arch/s390/kernel/early.c2
-rw-r--r--arch/s390/kernel/entry.S21
-rw-r--r--arch/s390/kernel/entry64.S51
-rw-r--r--arch/s390/kernel/head.S125
-rw-r--r--arch/s390/kernel/init_task.c38
-rw-r--r--arch/s390/kernel/irq.c9
-rw-r--r--arch/s390/kernel/perf_cpum_cf.c4
-rw-r--r--arch/s390/kernel/ptrace.c2
-rw-r--r--arch/s390/kernel/signal.c16
-rw-r--r--arch/s390/kernel/smp.c39
-rw-r--r--arch/s390/kernel/vdso32/.gitignore1
-rw-r--r--arch/s390/kernel/vdso64/.gitignore1
-rw-r--r--arch/s390/mm/fault.c45
-rw-r--r--arch/s390/mm/hugetlbpage.c2
-rw-r--r--arch/s390/mm/maccess.c94
-rw-r--r--arch/s390/mm/pgtable.c65
-rw-r--r--arch/score/include/asm/thread_info.h10
-rw-r--r--arch/score/kernel/Makefile2
-rw-r--r--arch/score/kernel/init_task.c46
-rw-r--r--arch/sh/Kconfig4
-rw-r--r--arch/sh/Makefile2
-rw-r--r--arch/sh/configs/sh7785lcr_32bit_defconfig2
-rw-r--r--arch/sh/include/asm/atomic.h2
-rw-r--r--arch/sh/include/asm/processor.h5
-rw-r--r--arch/sh/include/asm/thread_info.h11
-rw-r--r--arch/sh/include/asm/topology.h25
-rw-r--r--arch/sh/kernel/Makefile2
-rw-r--r--arch/sh/kernel/idle.c20
-rw-r--r--arch/sh/kernel/init_task.c30
-rw-r--r--arch/sh/kernel/process.c46
-rw-r--r--arch/sh/kernel/ptrace_32.c2
-rw-r--r--arch/sh/kernel/ptrace_64.c2
-rw-r--r--arch/sh/kernel/smp.c14
-rw-r--r--arch/sh/mm/fault_32.c2
-rw-r--r--arch/sparc/Kbuild8
-rw-r--r--arch/sparc/Kconfig16
-rw-r--r--arch/sparc/Makefile48
-rw-r--r--arch/sparc/boot/Makefile61
-rw-r--r--arch/sparc/boot/btfixupprep.c386
-rw-r--r--arch/sparc/configs/sparc64_defconfig2
-rw-r--r--arch/sparc/include/asm/asi.h14
-rw-r--r--arch/sparc/include/asm/asmmacro.h17
-rw-r--r--arch/sparc/include/asm/btfixup.h208
-rw-r--r--arch/sparc/include/asm/cache.h114
-rw-r--r--arch/sparc/include/asm/cacheflush.h4
-rw-r--r--arch/sparc/include/asm/cacheflush_32.h73
-rw-r--r--arch/sparc/include/asm/cacheflush_64.h3
-rw-r--r--arch/sparc/include/asm/cachetlb_32.h29
-rw-r--r--arch/sparc/include/asm/cmpxchg_32.h27
-rw-r--r--arch/sparc/include/asm/contregs.h22
-rw-r--r--arch/sparc/include/asm/cpu_type.h20
-rw-r--r--arch/sparc/include/asm/cpudata_32.h1
-rw-r--r--arch/sparc/include/asm/cypress.h79
-rw-r--r--arch/sparc/include/asm/dma.h52
-rw-r--r--arch/sparc/include/asm/elf_32.h13
-rw-r--r--arch/sparc/include/asm/floppy_32.h45
-rw-r--r--arch/sparc/include/asm/floppy_64.h6
-rw-r--r--arch/sparc/include/asm/head_32.h21
-rw-r--r--arch/sparc/include/asm/leon.h66
-rw-r--r--arch/sparc/include/asm/machines.h23
-rw-r--r--arch/sparc/include/asm/mbus.h4
-rw-r--r--arch/sparc/include/asm/memreg.h51
-rw-r--r--arch/sparc/include/asm/mmu_context_32.h11
-rw-r--r--arch/sparc/include/asm/obio.h13
-rw-r--r--arch/sparc/include/asm/oplib_32.h8
-rw-r--r--arch/sparc/include/asm/page_32.h13
-rw-r--r--arch/sparc/include/asm/pgalloc_32.h76
-rw-r--r--arch/sparc/include/asm/pgtable_32.h387
-rw-r--r--arch/sparc/include/asm/pgtable_64.h4
-rw-r--r--arch/sparc/include/asm/pgtsrmmu.h50
-rw-r--r--arch/sparc/include/asm/pgtsun4c.h172
-rw-r--r--arch/sparc/include/asm/processor_32.h1
-rw-r--r--arch/sparc/include/asm/setup.h3
-rw-r--r--arch/sparc/include/asm/shmparam_32.h4
-rw-r--r--arch/sparc/include/asm/smp_32.h114
-rw-r--r--arch/sparc/include/asm/smpprim.h54
-rw-r--r--arch/sparc/include/asm/string_32.h63
-rw-r--r--arch/sparc/include/asm/sysen.h15
-rw-r--r--arch/sparc/include/asm/thread_info_32.h10
-rw-r--r--arch/sparc/include/asm/thread_info_64.h25
-rw-r--r--arch/sparc/include/asm/timer_32.h33
-rw-r--r--arch/sparc/include/asm/timex_32.h1
-rw-r--r--arch/sparc/include/asm/tlbflush_32.h56
-rw-r--r--arch/sparc/include/asm/topology_64.h19
-rw-r--r--arch/sparc/include/asm/uaccess_32.h1
-rw-r--r--arch/sparc/include/asm/vac-ops.h127
-rw-r--r--arch/sparc/include/asm/vaddrs.h16
-rw-r--r--arch/sparc/include/asm/winmacro.h49
-rw-r--r--arch/sparc/kernel/Makefile4
-rw-r--r--arch/sparc/kernel/auxio_32.c13
-rw-r--r--arch/sparc/kernel/central.c2
-rw-r--r--arch/sparc/kernel/devices.c4
-rw-r--r--arch/sparc/kernel/ds.c4
-rw-r--r--arch/sparc/kernel/entry.S432
-rw-r--r--arch/sparc/kernel/etrap_32.S50
-rw-r--r--arch/sparc/kernel/head_32.S639
-rw-r--r--arch/sparc/kernel/head_64.S2
-rw-r--r--arch/sparc/kernel/idprom.c19
-rw-r--r--arch/sparc/kernel/init_task.c22
-rw-r--r--arch/sparc/kernel/ioport.c23
-rw-r--r--arch/sparc/kernel/irq.h60
-rw-r--r--arch/sparc/kernel/irq_32.c19
-rw-r--r--arch/sparc/kernel/irq_64.c2
-rw-r--r--arch/sparc/kernel/kernel.h10
-rw-r--r--arch/sparc/kernel/leon_kernel.c98
-rw-r--r--arch/sparc/kernel/leon_pci.c13
-rw-r--r--arch/sparc/kernel/leon_smp.c125
-rw-r--r--arch/sparc/kernel/module.c21
-rw-r--r--arch/sparc/kernel/muldiv.c238
-rw-r--r--arch/sparc/kernel/of_device_32.c4
-rw-r--r--arch/sparc/kernel/pcic.c55
-rw-r--r--arch/sparc/kernel/perf_event.c4
-rw-r--r--arch/sparc/kernel/process_32.c116
-rw-r--r--arch/sparc/kernel/ptrace_64.c2
-rw-r--r--arch/sparc/kernel/rtrap_32.S76
-rw-r--r--arch/sparc/kernel/rtrap_64.S19
-rw-r--r--arch/sparc/kernel/setup_32.c70
-rw-r--r--arch/sparc/kernel/signal_32.c7
-rw-r--r--arch/sparc/kernel/smp_32.c187
-rw-r--r--arch/sparc/kernel/smp_64.c12
-rw-r--r--arch/sparc/kernel/sparc_ksyms_32.c14
-rw-r--r--arch/sparc/kernel/sun4c_irq.c264
-rw-r--r--arch/sparc/kernel/sun4d_irq.c48
-rw-r--r--arch/sparc/kernel/sun4d_smp.c127
-rw-r--r--arch/sparc/kernel/sun4m_irq.c58
-rw-r--r--arch/sparc/kernel/sun4m_smp.c124
-rw-r--r--arch/sparc/kernel/sys_sparc_32.c11
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c7
-rw-r--r--arch/sparc/kernel/systbls_64.S2
-rw-r--r--arch/sparc/kernel/time_32.c220
-rw-r--r--arch/sparc/kernel/trampoline_32.S22
-rw-r--r--arch/sparc/kernel/traps_32.c2
-rw-r--r--arch/sparc/kernel/ttable_32.S417
-rw-r--r--arch/sparc/kernel/ttable_64.S (renamed from arch/sparc/kernel/ttable.S)0
-rw-r--r--arch/sparc/kernel/unaligned_64.c1
-rw-r--r--arch/sparc/kernel/wof.S72
-rw-r--r--arch/sparc/kernel/wuf.S60
-rw-r--r--arch/sparc/lib/Makefile6
-rw-r--r--arch/sparc/lib/ashldi3.S7
-rw-r--r--arch/sparc/lib/ashrdi3.S7
-rw-r--r--arch/sparc/lib/atomic_32.S44
-rw-r--r--arch/sparc/lib/atomic_64.S49
-rw-r--r--arch/sparc/lib/bitops.S37
-rw-r--r--arch/sparc/lib/blockops.S10
-rw-r--r--arch/sparc/lib/bzero.S20
-rw-r--r--arch/sparc/lib/divdi3.S4
-rw-r--r--arch/sparc/lib/ipcsum.S9
-rw-r--r--arch/sparc/lib/ksyms.c22
-rw-r--r--arch/sparc/lib/lshrdi3.S5
-rw-r--r--arch/sparc/lib/memmove.S9
-rw-r--r--arch/sparc/lib/mul.S137
-rw-r--r--arch/sparc/lib/muldi3.S4
-rw-r--r--arch/sparc/lib/rem.S384
-rw-r--r--arch/sparc/lib/sdiv.S381
-rw-r--r--arch/sparc/lib/strlen_user_64.S8
-rw-r--r--arch/sparc/lib/strncmp_32.S8
-rw-r--r--arch/sparc/lib/strncmp_64.S8
-rw-r--r--arch/sparc/lib/strncpy_from_user_32.S6
-rw-r--r--arch/sparc/lib/strncpy_from_user_64.S8
-rw-r--r--arch/sparc/lib/ucmpdi2.c19
-rw-r--r--arch/sparc/lib/udiv.S357
-rw-r--r--arch/sparc/lib/udivdi3.S3
-rw-r--r--arch/sparc/lib/umul.S171
-rw-r--r--arch/sparc/lib/urem.S357
-rw-r--r--arch/sparc/lib/xor.S50
-rw-r--r--arch/sparc/mm/Makefile9
-rw-r--r--arch/sparc/mm/btfixup.c328
-rw-r--r--arch/sparc/mm/fault_32.c244
-rw-r--r--arch/sparc/mm/fault_64.c37
-rw-r--r--arch/sparc/mm/init_32.c51
-rw-r--r--arch/sparc/mm/init_64.c121
-rw-r--r--arch/sparc/mm/io-unit.c35
-rw-r--r--arch/sparc/mm/iommu.c71
-rw-r--r--arch/sparc/mm/leon_mm.c95
-rw-r--r--arch/sparc/mm/loadmmu.c43
-rw-r--r--arch/sparc/mm/nosun4c.c77
-rw-r--r--arch/sparc/mm/srmmu.c1232
-rw-r--r--arch/sparc/mm/srmmu.h4
-rw-r--r--arch/sparc/mm/sun4c.c2166
-rw-r--r--arch/sparc/mm/ultra.S6
-rw-r--r--arch/sparc/mm/viking.S1
-rw-r--r--arch/sparc/net/Makefile4
-rw-r--r--arch/sparc/net/bpf_jit.h68
-rw-r--r--arch/sparc/net/bpf_jit_asm.S205
-rw-r--r--arch/sparc/net/bpf_jit_comp.c802
-rw-r--r--arch/sparc/prom/Makefile1
-rw-r--r--arch/sparc/prom/segment.c28
-rw-r--r--arch/tile/Kconfig1
-rw-r--r--arch/tile/include/asm/pci.h4
-rw-r--r--arch/tile/include/asm/thread_info.h15
-rw-r--r--arch/tile/include/asm/topology.h26
-rw-r--r--arch/tile/kernel/Makefile2
-rw-r--r--arch/tile/kernel/compat_signal.c12
-rw-r--r--arch/tile/kernel/init_task.c59
-rw-r--r--arch/tile/kernel/intvec_32.S41
-rw-r--r--arch/tile/kernel/intvec_64.S38
-rw-r--r--arch/tile/kernel/pci.c4
-rw-r--r--arch/tile/kernel/proc.c4
-rw-r--r--arch/tile/kernel/process.c30
-rw-r--r--arch/tile/kernel/setup.c16
-rw-r--r--arch/tile/kernel/single_step.c4
-rw-r--r--arch/tile/kernel/smpboot.c4
-rw-r--r--arch/um/drivers/cow.h35
-rw-r--r--arch/um/drivers/cow_user.c43
-rw-r--r--arch/um/drivers/mconsole_kern.c2
-rw-r--r--arch/um/include/asm/Kbuild3
-rw-r--r--arch/um/include/asm/processor-generic.h2
-rw-r--r--arch/um/kernel/Makefile9
-rw-r--r--arch/um/kernel/init_task.c38
-rw-r--r--arch/um/kernel/process.c6
-rw-r--r--arch/um/kernel/skas/mmu.c1
-rw-r--r--arch/um/kernel/smp.c2
-rw-r--r--arch/um/kernel/um_arch.c5
-rw-r--r--arch/unicore32/Makefile1
-rw-r--r--arch/unicore32/kernel/Makefile2
-rw-r--r--arch/unicore32/kernel/init_task.c44
-rw-r--r--arch/x86/Kconfig10
-rw-r--r--arch/x86/Makefile4
-rw-r--r--arch/x86/Makefile.um3
-rw-r--r--arch/x86/boot/compressed/Makefile9
-rw-r--r--arch/x86/boot/compressed/head_32.S14
-rw-r--r--arch/x86/boot/compressed/head_64.S22
-rw-r--r--arch/x86/boot/tools/build.c15
-rw-r--r--arch/x86/ia32/ia32_aout.c35
-rw-r--r--arch/x86/ia32/ia32_signal.c4
-rw-r--r--arch/x86/include/asm/apic.h23
-rw-r--r--arch/x86/include/asm/apicdef.h2
-rw-r--r--arch/x86/include/asm/boot.h2
-rw-r--r--arch/x86/include/asm/cmpxchg.h4
-rw-r--r--arch/x86/include/asm/compat.h2
-rw-r--r--arch/x86/include/asm/current.h2
-rw-r--r--arch/x86/include/asm/desc.h1
-rw-r--r--arch/x86/include/asm/fpu-internal.h6
-rw-r--r--arch/x86/include/asm/ftrace.h3
-rw-r--r--arch/x86/include/asm/hardirq.h9
-rw-r--r--arch/x86/include/asm/ia32.h6
-rw-r--r--arch/x86/include/asm/io_apic.h35
-rw-r--r--arch/x86/include/asm/irq_regs.h4
-rw-r--r--arch/x86/include/asm/irq_remapping.h118
-rw-r--r--arch/x86/include/asm/kvm_para.h3
-rw-r--r--arch/x86/include/asm/mmu_context.h12
-rw-r--r--arch/x86/include/asm/msr-index.h5
-rw-r--r--arch/x86/include/asm/nmi.h22
-rw-r--r--arch/x86/include/asm/page_32_types.h4
-rw-r--r--arch/x86/include/asm/page_64_types.h4
-rw-r--r--arch/x86/include/asm/percpu.h24
-rw-r--r--arch/x86/include/asm/perf_event.h12
-rw-r--r--arch/x86/include/asm/posix_types.h6
-rw-r--r--arch/x86/include/asm/processor.h2
-rw-r--r--arch/x86/include/asm/sigcontext.h2
-rw-r--r--arch/x86/include/asm/siginfo.h8
-rw-r--r--arch/x86/include/asm/smp.h15
-rw-r--r--arch/x86/include/asm/stackprotector.h4
-rw-r--r--arch/x86/include/asm/stat.h21
-rw-r--r--arch/x86/include/asm/syscall.h27
-rw-r--r--arch/x86/include/asm/thread_info.h23
-rw-r--r--arch/x86/include/asm/tlbflush.h4
-rw-r--r--arch/x86/include/asm/topology.h38
-rw-r--r--arch/x86/include/asm/uaccess.h2
-rw-r--r--arch/x86/include/asm/uaccess_32.h5
-rw-r--r--arch/x86/include/asm/uaccess_64.h4
-rw-r--r--arch/x86/include/asm/unistd.h6
-rw-r--r--arch/x86/include/asm/word-at-a-time.h33
-rw-r--r--arch/x86/include/asm/x86_init.h10
-rw-r--r--arch/x86/kernel/Makefile2
-rw-r--r--arch/x86/kernel/acpi/boot.c2
-rw-r--r--arch/x86/kernel/acpi/sleep.c4
-rw-r--r--arch/x86/kernel/acpi/sleep.h4
-rw-r--r--arch/x86/kernel/acpi/wakeup_32.S4
-rw-r--r--arch/x86/kernel/acpi/wakeup_64.S4
-rw-r--r--arch/x86/kernel/apic/apic.c76
-rw-r--r--arch/x86/kernel/apic/apic_flat_64.c2
-rw-r--r--arch/x86/kernel/apic/apic_noop.c1
-rw-r--r--arch/x86/kernel/apic/apic_numachip.c8
-rw-r--r--arch/x86/kernel/apic/bigsmp_32.c1
-rw-r--r--arch/x86/kernel/apic/es7000_32.c2
-rw-r--r--arch/x86/kernel/apic/io_apic.c383
-rw-r--r--arch/x86/kernel/apic/numaq_32.c1
-rw-r--r--arch/x86/kernel/apic/probe_32.c1
-rw-r--r--arch/x86/kernel/apic/summit_32.c1
-rw-r--r--arch/x86/kernel/apic/x2apic_cluster.c1
-rw-r--r--arch/x86/kernel/apic/x2apic_phys.c7
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c1
-rw-r--r--arch/x86/kernel/apm_32.c2
-rw-r--r--arch/x86/kernel/cpu/amd.c29
-rw-r--r--arch/x86/kernel/cpu/common.c11
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c8
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c18
-rw-r--r--arch/x86/kernel/cpu/perf_event.c7
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd.c11
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd_ibs.c570
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c4
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_ds.c6
-rw-r--r--arch/x86/kernel/cpu/perf_event_p4.c6
-rw-r--r--arch/x86/kernel/ftrace.c500
-rw-r--r--arch/x86/kernel/i387.c3
-rw-r--r--arch/x86/kernel/init_task.c42
-rw-r--r--arch/x86/kernel/irq_32.c8
-rw-r--r--arch/x86/kernel/kvm.c9
-rw-r--r--arch/x86/kernel/microcode_amd.c12
-rw-r--r--arch/x86/kernel/microcode_core.c10
-rw-r--r--arch/x86/kernel/microcode_intel.c14
-rw-r--r--arch/x86/kernel/nmi.c93
-rw-r--r--arch/x86/kernel/nmi_selftest.c1
-rw-r--r--arch/x86/kernel/paravirt.c12
-rw-r--r--arch/x86/kernel/process.c44
-rw-r--r--arch/x86/kernel/process_32.c2
-rw-r--r--arch/x86/kernel/process_64.c11
-rw-r--r--arch/x86/kernel/ptrace.c7
-rw-r--r--arch/x86/kernel/setup.c3
-rw-r--r--arch/x86/kernel/setup_percpu.c14
-rw-r--r--arch/x86/kernel/smpboot.c191
-rw-r--r--arch/x86/kernel/traps.c8
-rw-r--r--arch/x86/kernel/vsyscall_64.c6
-rw-r--r--arch/x86/kernel/x86_init.c9
-rw-r--r--arch/x86/kvm/pmu.c18
-rw-r--r--arch/x86/kvm/vmx.c5
-rw-r--r--arch/x86/kvm/x86.c9
-rw-r--r--arch/x86/lib/insn.c53
-rw-r--r--arch/x86/lib/usercopy.c99
-rw-r--r--arch/x86/lib/usercopy_32.c87
-rw-r--r--arch/x86/lib/usercopy_64.c49
-rw-r--r--arch/x86/mm/numa_emulation.c8
-rw-r--r--arch/x86/mm/tlb.c10
-rw-r--r--arch/x86/pci/acpi.c128
-rw-r--r--arch/x86/pci/amd_bus.c91
-rw-r--r--arch/x86/pci/broadcom_bus.c12
-rw-r--r--arch/x86/pci/bus_numa.c69
-rw-r--r--arch/x86/pci/bus_numa.h18
-rw-r--r--arch/x86/pci/common.c43
-rw-r--r--arch/x86/pci/i386.c2
-rw-r--r--arch/x86/platform/geode/net5501.c2
-rw-r--r--arch/x86/platform/mrst/mrst.c4
-rw-r--r--arch/x86/platform/visws/visws_quirks.c2
-rw-r--r--arch/x86/tools/.gitignore1
-rw-r--r--arch/x86/tools/Makefile4
-rw-r--r--arch/x86/tools/relocs.c (renamed from arch/x86/boot/compressed/relocs.c)242
-rw-r--r--arch/x86/um/asm/barrier.h75
-rw-r--r--arch/x86/um/asm/system.h135
-rw-r--r--arch/x86/xen/Makefile2
-rw-r--r--arch/x86/xen/apic.c33
-rw-r--r--arch/x86/xen/enlighten.c48
-rw-r--r--arch/x86/xen/mmu.c11
-rw-r--r--arch/x86/xen/smp.c34
-rw-r--r--arch/x86/xen/xen-asm.S2
-rw-r--r--arch/x86/xen/xen-ops.h4
-rw-r--r--arch/xtensa/configs/common_defconfig5
-rw-r--r--arch/xtensa/include/asm/hardirq.h3
-rw-r--r--arch/xtensa/include/asm/io.h1
-rw-r--r--arch/xtensa/kernel/Makefile2
-rw-r--r--arch/xtensa/kernel/init_task.c31
-rw-r--r--arch/xtensa/kernel/signal.c1
1602 files changed, 53275 insertions, 54767 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index 684eb5af439d..1f9461b9cc89 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -145,6 +145,21 @@ config HAVE_DMA_ATTRS
145config USE_GENERIC_SMP_HELPERS 145config USE_GENERIC_SMP_HELPERS
146 bool 146 bool
147 147
148config GENERIC_SMP_IDLE_THREAD
149 bool
150
151# Select if arch init_task initializer is different to init/init_task.c
152config ARCH_INIT_TASK
153 bool
154
155# Select if arch has its private alloc_task_struct() function
156config ARCH_TASK_STRUCT_ALLOCATOR
157 bool
158
159# Select if arch has its private alloc_thread_info() function
160config ARCH_THREAD_INFO_ALLOCATOR
161 bool
162
148config HAVE_REGS_AND_STACK_ACCESS_API 163config HAVE_REGS_AND_STACK_ACCESS_API
149 bool 164 bool
150 help 165 help
@@ -216,4 +231,27 @@ config HAVE_CMPXCHG_DOUBLE
216config ARCH_WANT_OLD_COMPAT_IPC 231config ARCH_WANT_OLD_COMPAT_IPC
217 bool 232 bool
218 233
234config HAVE_ARCH_SECCOMP_FILTER
235 bool
236 help
237 An arch should select this symbol if it provides all of these things:
238 - syscall_get_arch()
239 - syscall_get_arguments()
240 - syscall_rollback()
241 - syscall_set_return_value()
242 - SIGSYS siginfo_t support
243 - secure_computing is called from a ptrace_event()-safe context
244 - secure_computing return value is checked and a return value of -1
245 results in the system call being skipped immediately.
246
247config SECCOMP_FILTER
248 def_bool y
249 depends on HAVE_ARCH_SECCOMP_FILTER && SECCOMP && NET
250 help
251 Enable tasks to build secure computing environments defined
252 in terms of Berkeley Packet Filter programs which implement
253 task-defined system call filtering polices.
254
255 See Documentation/prctl/seccomp_filter.txt for details.
256
219source "kernel/gcov/Kconfig" 257source "kernel/gcov/Kconfig"
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 56a4df952fb0..0893f023efb8 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -15,6 +15,7 @@ config ALPHA
15 select GENERIC_IRQ_SHOW 15 select GENERIC_IRQ_SHOW
16 select ARCH_WANT_OPTIONAL_GPIOLIB 16 select ARCH_WANT_OPTIONAL_GPIOLIB
17 select ARCH_HAVE_NMI_SAFE_CMPXCHG 17 select ARCH_HAVE_NMI_SAFE_CMPXCHG
18 select GENERIC_SMP_IDLE_THREAD
18 help 19 help
19 The Alpha is a 64-bit general-purpose processor designed and 20 The Alpha is a 64-bit general-purpose processor designed and
20 marketed by the Digital Equipment Corporation of blessed memory, 21 marketed by the Digital Equipment Corporation of blessed memory,
@@ -477,7 +478,7 @@ config ALPHA_BROKEN_IRQ_MASK
477 478
478config VGA_HOSE 479config VGA_HOSE
479 bool 480 bool
480 depends on ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL || ALPHA_TSUNAMI 481 depends on VGA_CONSOLE && (ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL || ALPHA_TSUNAMI)
481 default y 482 default y
482 help 483 help
483 Support VGA on an arbitrary hose; needed for several platforms 484 Support VGA on an arbitrary hose; needed for several platforms
diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h
index f62251e82ffa..3bb7ffeae3bc 100644
--- a/arch/alpha/include/asm/atomic.h
+++ b/arch/alpha/include/asm/atomic.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <asm/barrier.h> 5#include <asm/barrier.h>
6#include <asm/cmpxchg.h>
6 7
7/* 8/*
8 * Atomic operations that C can't guarantee us. Useful for 9 * Atomic operations that C can't guarantee us. Useful for
@@ -168,73 +169,6 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
168 return result; 169 return result;
169} 170}
170 171
171/*
172 * Atomic exchange routines.
173 */
174
175#define __ASM__MB
176#define ____xchg(type, args...) __xchg ## type ## _local(args)
177#define ____cmpxchg(type, args...) __cmpxchg ## type ## _local(args)
178#include <asm/xchg.h>
179
180#define xchg_local(ptr,x) \
181 ({ \
182 __typeof__(*(ptr)) _x_ = (x); \
183 (__typeof__(*(ptr))) __xchg_local((ptr), (unsigned long)_x_, \
184 sizeof(*(ptr))); \
185 })
186
187#define cmpxchg_local(ptr, o, n) \
188 ({ \
189 __typeof__(*(ptr)) _o_ = (o); \
190 __typeof__(*(ptr)) _n_ = (n); \
191 (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \
192 (unsigned long)_n_, \
193 sizeof(*(ptr))); \
194 })
195
196#define cmpxchg64_local(ptr, o, n) \
197 ({ \
198 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
199 cmpxchg_local((ptr), (o), (n)); \
200 })
201
202#ifdef CONFIG_SMP
203#undef __ASM__MB
204#define __ASM__MB "\tmb\n"
205#endif
206#undef ____xchg
207#undef ____cmpxchg
208#define ____xchg(type, args...) __xchg ##type(args)
209#define ____cmpxchg(type, args...) __cmpxchg ##type(args)
210#include <asm/xchg.h>
211
212#define xchg(ptr,x) \
213 ({ \
214 __typeof__(*(ptr)) _x_ = (x); \
215 (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, \
216 sizeof(*(ptr))); \
217 })
218
219#define cmpxchg(ptr, o, n) \
220 ({ \
221 __typeof__(*(ptr)) _o_ = (o); \
222 __typeof__(*(ptr)) _n_ = (n); \
223 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
224 (unsigned long)_n_, sizeof(*(ptr)));\
225 })
226
227#define cmpxchg64(ptr, o, n) \
228 ({ \
229 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
230 cmpxchg((ptr), (o), (n)); \
231 })
232
233#undef __ASM__MB
234#undef ____cmpxchg
235
236#define __HAVE_ARCH_CMPXCHG 1
237
238#define atomic64_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), old, new)) 172#define atomic64_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), old, new))
239#define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) 173#define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
240 174
diff --git a/arch/alpha/include/asm/cmpxchg.h b/arch/alpha/include/asm/cmpxchg.h
new file mode 100644
index 000000000000..429e8cd0d78e
--- /dev/null
+++ b/arch/alpha/include/asm/cmpxchg.h
@@ -0,0 +1,71 @@
1#ifndef _ALPHA_CMPXCHG_H
2#define _ALPHA_CMPXCHG_H
3
4/*
5 * Atomic exchange routines.
6 */
7
8#define __ASM__MB
9#define ____xchg(type, args...) __xchg ## type ## _local(args)
10#define ____cmpxchg(type, args...) __cmpxchg ## type ## _local(args)
11#include <asm/xchg.h>
12
13#define xchg_local(ptr, x) \
14({ \
15 __typeof__(*(ptr)) _x_ = (x); \
16 (__typeof__(*(ptr))) __xchg_local((ptr), (unsigned long)_x_, \
17 sizeof(*(ptr))); \
18})
19
20#define cmpxchg_local(ptr, o, n) \
21({ \
22 __typeof__(*(ptr)) _o_ = (o); \
23 __typeof__(*(ptr)) _n_ = (n); \
24 (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \
25 (unsigned long)_n_, \
26 sizeof(*(ptr))); \
27})
28
29#define cmpxchg64_local(ptr, o, n) \
30({ \
31 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
32 cmpxchg_local((ptr), (o), (n)); \
33})
34
35#ifdef CONFIG_SMP
36#undef __ASM__MB
37#define __ASM__MB "\tmb\n"
38#endif
39#undef ____xchg
40#undef ____cmpxchg
41#define ____xchg(type, args...) __xchg ##type(args)
42#define ____cmpxchg(type, args...) __cmpxchg ##type(args)
43#include <asm/xchg.h>
44
45#define xchg(ptr, x) \
46({ \
47 __typeof__(*(ptr)) _x_ = (x); \
48 (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, \
49 sizeof(*(ptr))); \
50})
51
52#define cmpxchg(ptr, o, n) \
53({ \
54 __typeof__(*(ptr)) _o_ = (o); \
55 __typeof__(*(ptr)) _n_ = (n); \
56 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
57 (unsigned long)_n_, sizeof(*(ptr)));\
58})
59
60#define cmpxchg64(ptr, o, n) \
61({ \
62 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
63 cmpxchg((ptr), (o), (n)); \
64})
65
66#undef __ASM__MB
67#undef ____cmpxchg
68
69#define __HAVE_ARCH_CMPXCHG 1
70
71#endif /* _ALPHA_CMPXCHG_H */
diff --git a/arch/alpha/include/asm/rtc.h b/arch/alpha/include/asm/rtc.h
index 1f7fba671ae6..d70408d36677 100644
--- a/arch/alpha/include/asm/rtc.h
+++ b/arch/alpha/include/asm/rtc.h
@@ -1,14 +1,10 @@
1#ifndef _ALPHA_RTC_H 1#ifndef _ALPHA_RTC_H
2#define _ALPHA_RTC_H 2#define _ALPHA_RTC_H
3 3
4#if defined(CONFIG_ALPHA_GENERIC) 4#if defined(CONFIG_ALPHA_MARVEL) && defined(CONFIG_SMP) \
5 || defined(CONFIG_ALPHA_GENERIC)
5# define get_rtc_time alpha_mv.rtc_get_time 6# define get_rtc_time alpha_mv.rtc_get_time
6# define set_rtc_time alpha_mv.rtc_set_time 7# define set_rtc_time alpha_mv.rtc_set_time
7#else
8# if defined(CONFIG_ALPHA_MARVEL) && defined(CONFIG_SMP)
9# define get_rtc_time marvel_get_rtc_time
10# define set_rtc_time marvel_set_rtc_time
11# endif
12#endif 8#endif
13 9
14#include <asm-generic/rtc.h> 10#include <asm-generic/rtc.h>
diff --git a/arch/alpha/include/asm/xchg.h b/arch/alpha/include/asm/xchg.h
index 1d1b436fbff2..0ca9724597c1 100644
--- a/arch/alpha/include/asm/xchg.h
+++ b/arch/alpha/include/asm/xchg.h
@@ -1,10 +1,10 @@
1#ifndef _ALPHA_ATOMIC_H 1#ifndef _ALPHA_CMPXCHG_H
2#error Do not include xchg.h directly! 2#error Do not include xchg.h directly!
3#else 3#else
4/* 4/*
5 * xchg/xchg_local and cmpxchg/cmpxchg_local share the same code 5 * xchg/xchg_local and cmpxchg/cmpxchg_local share the same code
6 * except that local version do not have the expensive memory barrier. 6 * except that local version do not have the expensive memory barrier.
7 * So this file is included twice from asm/system.h. 7 * So this file is included twice from asm/cmpxchg.h.
8 */ 8 */
9 9
10/* 10/*
diff --git a/arch/alpha/kernel/Makefile b/arch/alpha/kernel/Makefile
index 7a6d908bb865..84ec46b38f7d 100644
--- a/arch/alpha/kernel/Makefile
+++ b/arch/alpha/kernel/Makefile
@@ -6,7 +6,7 @@ extra-y := head.o vmlinux.lds
6asflags-y := $(KBUILD_CFLAGS) 6asflags-y := $(KBUILD_CFLAGS)
7ccflags-y := -Wno-sign-compare 7ccflags-y := -Wno-sign-compare
8 8
9obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \ 9obj-y := entry.o traps.o process.o osf_sys.o irq.o \
10 irq_alpha.o signal.o setup.o ptrace.o time.o \ 10 irq_alpha.o signal.o setup.o ptrace.o time.o \
11 alpha_ksyms.o systbls.o err_common.o io.o 11 alpha_ksyms.o systbls.o err_common.o io.o
12 12
diff --git a/arch/alpha/kernel/core_tsunami.c b/arch/alpha/kernel/core_tsunami.c
index 5e7c28f92f19..61893d7bdda5 100644
--- a/arch/alpha/kernel/core_tsunami.c
+++ b/arch/alpha/kernel/core_tsunami.c
@@ -11,6 +11,7 @@
11#include <asm/core_tsunami.h> 11#include <asm/core_tsunami.h>
12#undef __EXTERN_INLINE 12#undef __EXTERN_INLINE
13 13
14#include <linux/module.h>
14#include <linux/types.h> 15#include <linux/types.h>
15#include <linux/pci.h> 16#include <linux/pci.h>
16#include <linux/sched.h> 17#include <linux/sched.h>
diff --git a/arch/alpha/kernel/init_task.c b/arch/alpha/kernel/init_task.c
deleted file mode 100644
index 6f80ca4f9766..000000000000
--- a/arch/alpha/kernel/init_task.c
+++ /dev/null
@@ -1,17 +0,0 @@
1#include <linux/mm.h>
2#include <linux/module.h>
3#include <linux/sched.h>
4#include <linux/init.h>
5#include <linux/init_task.h>
6#include <linux/fs.h>
7#include <linux/mqueue.h>
8#include <asm/uaccess.h>
9
10
11static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
12static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
13struct task_struct init_task = INIT_TASK(init_task);
14EXPORT_SYMBOL(init_task);
15
16union thread_union init_thread_union __init_task_data =
17 { INIT_THREAD_INFO(init_task) };
diff --git a/arch/alpha/kernel/perf_event.c b/arch/alpha/kernel/perf_event.c
index 0dae252f7a33..d821b17047e0 100644
--- a/arch/alpha/kernel/perf_event.c
+++ b/arch/alpha/kernel/perf_event.c
@@ -824,7 +824,6 @@ static void alpha_perf_event_irq_handler(unsigned long la_ptr,
824 824
825 idx = la_ptr; 825 idx = la_ptr;
826 826
827 perf_sample_data_init(&data, 0);
828 for (j = 0; j < cpuc->n_events; j++) { 827 for (j = 0; j < cpuc->n_events; j++) {
829 if (cpuc->current_idx[j] == idx) 828 if (cpuc->current_idx[j] == idx)
830 break; 829 break;
@@ -848,7 +847,7 @@ static void alpha_perf_event_irq_handler(unsigned long la_ptr,
848 847
849 hwc = &event->hw; 848 hwc = &event->hw;
850 alpha_perf_event_update(event, hwc, idx, alpha_pmu->pmc_max_period[idx]+1); 849 alpha_perf_event_update(event, hwc, idx, alpha_pmu->pmc_max_period[idx]+1);
851 data.period = event->hw.last_period; 850 perf_sample_data_init(&data, 0, hwc->last_period);
852 851
853 if (alpha_perf_event_set_period(event, hwc, idx)) { 852 if (alpha_perf_event_set_period(event, hwc, idx)) {
854 if (perf_event_overflow(event, &data, regs)) { 853 if (perf_event_overflow(event, &data, regs)) {
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index 50d438db1f6b..35ddc02bfa4a 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -357,24 +357,10 @@ secondary_cpu_start(int cpuid, struct task_struct *idle)
357 * Bring one cpu online. 357 * Bring one cpu online.
358 */ 358 */
359static int __cpuinit 359static int __cpuinit
360smp_boot_one_cpu(int cpuid) 360smp_boot_one_cpu(int cpuid, struct task_struct *idle)
361{ 361{
362 struct task_struct *idle;
363 unsigned long timeout; 362 unsigned long timeout;
364 363
365 /* Cook up an idler for this guy. Note that the address we
366 give to kernel_thread is irrelevant -- it's going to start
367 where HWRPB.CPU_restart says to start. But this gets all
368 the other task-y sort of data structures set up like we
369 wish. We can't use kernel_thread since we must avoid
370 rescheduling the child. */
371 idle = fork_idle(cpuid);
372 if (IS_ERR(idle))
373 panic("failed fork for CPU %d", cpuid);
374
375 DBGS(("smp_boot_one_cpu: CPU %d state 0x%lx flags 0x%lx\n",
376 cpuid, idle->state, idle->flags));
377
378 /* Signal the secondary to wait a moment. */ 364 /* Signal the secondary to wait a moment. */
379 smp_secondary_alive = -1; 365 smp_secondary_alive = -1;
380 366
@@ -487,9 +473,9 @@ smp_prepare_boot_cpu(void)
487} 473}
488 474
489int __cpuinit 475int __cpuinit
490__cpu_up(unsigned int cpu) 476__cpu_up(unsigned int cpu, struct task_struct *tidle)
491{ 477{
492 smp_boot_one_cpu(cpu); 478 smp_boot_one_cpu(cpu, tidle);
493 479
494 return cpu_online(cpu) ? 0 : -ENOSYS; 480 return cpu_online(cpu) ? 0 : -ENOSYS;
495} 481}
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c
index 14a4b6a7cf59..407accc80877 100644
--- a/arch/alpha/kernel/sys_marvel.c
+++ b/arch/alpha/kernel/sys_marvel.c
@@ -317,7 +317,7 @@ marvel_init_irq(void)
317} 317}
318 318
319static int 319static int
320marvel_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 320marvel_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
321{ 321{
322 struct pci_controller *hose = dev->sysdata; 322 struct pci_controller *hose = dev->sysdata;
323 struct io7_port *io7_port = hose->sysdata; 323 struct io7_port *io7_port = hose->sysdata;
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 73f90dd5554b..76edcfe8b56f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -11,6 +11,7 @@ config ARM
11 select HAVE_OPROFILE if (HAVE_PERF_EVENTS) 11 select HAVE_OPROFILE if (HAVE_PERF_EVENTS)
12 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL 12 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
13 select HAVE_ARCH_KGDB 13 select HAVE_ARCH_KGDB
14 select HAVE_ARCH_TRACEHOOK
14 select HAVE_KPROBES if !XIP_KERNEL 15 select HAVE_KPROBES if !XIP_KERNEL
15 select HAVE_KRETPROBES if (HAVE_KPROBES) 16 select HAVE_KRETPROBES if (HAVE_KPROBES)
16 select HAVE_FUNCTION_TRACER if (!XIP_KERNEL) 17 select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
@@ -30,10 +31,15 @@ config ARM
30 select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)) 31 select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7))
31 select HAVE_C_RECORDMCOUNT 32 select HAVE_C_RECORDMCOUNT
32 select HAVE_GENERIC_HARDIRQS 33 select HAVE_GENERIC_HARDIRQS
34 select HARDIRQS_SW_RESEND
35 select GENERIC_IRQ_PROBE
33 select GENERIC_IRQ_SHOW 36 select GENERIC_IRQ_SHOW
37 select GENERIC_IRQ_PROBE
38 select HARDIRQS_SW_RESEND
34 select CPU_PM if (SUSPEND || CPU_IDLE) 39 select CPU_PM if (SUSPEND || CPU_IDLE)
35 select GENERIC_PCI_IOMAP 40 select GENERIC_PCI_IOMAP
36 select HAVE_BPF_JIT if NET 41 select HAVE_BPF_JIT
42 select GENERIC_SMP_IDLE_THREAD
37 help 43 help
38 The ARM series is a line of low-power-consumption RISC chip designs 44 The ARM series is a line of low-power-consumption RISC chip designs
39 licensed by ARM Ltd and targeted at embedded applications and 45 licensed by ARM Ltd and targeted at embedded applications and
@@ -126,14 +132,6 @@ config TRACE_IRQFLAGS_SUPPORT
126 bool 132 bool
127 default y 133 default y
128 134
129config HARDIRQS_SW_RESEND
130 bool
131 default y
132
133config GENERIC_IRQ_PROBE
134 bool
135 default y
136
137config GENERIC_LOCKBREAK 135config GENERIC_LOCKBREAK
138 bool 136 bool
139 default y 137 default y
@@ -159,9 +157,6 @@ config ARCH_HAS_CPUFREQ
159 and that the relevant menu configurations are displayed for 157 and that the relevant menu configurations are displayed for
160 it. 158 it.
161 159
162config ARCH_HAS_CPU_IDLE_WAIT
163 def_bool y
164
165config GENERIC_HWEIGHT 160config GENERIC_HWEIGHT
166 bool 161 bool
167 default y 162 default y
@@ -280,6 +275,7 @@ config ARCH_INTEGRATOR
280 select NEED_MACH_IO_H 275 select NEED_MACH_IO_H
281 select NEED_MACH_MEMORY_H 276 select NEED_MACH_MEMORY_H
282 select SPARSE_IRQ 277 select SPARSE_IRQ
278 select MULTI_IRQ_HANDLER
283 help 279 help
284 Support for ARM's Integrator platform. 280 Support for ARM's Integrator platform.
285 281
@@ -340,8 +336,8 @@ config ARCH_AT91
340 select IRQ_DOMAIN 336 select IRQ_DOMAIN
341 select NEED_MACH_IO_H if PCCARD 337 select NEED_MACH_IO_H if PCCARD
342 help 338 help
343 This enables support for systems based on the Atmel AT91RM9200, 339 This enables support for systems based on Atmel
344 AT91SAM9 processors. 340 AT91RM9200 and AT91SAM9* processors.
345 341
346config ARCH_BCMRING 342config ARCH_BCMRING
347 bool "Broadcom BCMRING" 343 bool "Broadcom BCMRING"
@@ -373,12 +369,12 @@ config ARCH_HIGHBANK
373 Support for the Calxeda Highbank SoC based boards. 369 Support for the Calxeda Highbank SoC based boards.
374 370
375config ARCH_CLPS711X 371config ARCH_CLPS711X
376 bool "Cirrus Logic CLPS711x/EP721x-based" 372 bool "Cirrus Logic CLPS711x/EP721x/EP731x-based"
377 select CPU_ARM720T 373 select CPU_ARM720T
378 select ARCH_USES_GETTIMEOFFSET 374 select ARCH_USES_GETTIMEOFFSET
379 select NEED_MACH_MEMORY_H 375 select NEED_MACH_MEMORY_H
380 help 376 help
381 Support for Cirrus Logic 711x/721x based boards. 377 Support for Cirrus Logic 711x/721x/731x based boards.
382 378
383config ARCH_CNS3XXX 379config ARCH_CNS3XXX
384 bool "Cavium Networks CNS3XXX family" 380 bool "Cavium Networks CNS3XXX family"
@@ -407,6 +403,8 @@ config ARCH_PRIMA2
407 select CLKDEV_LOOKUP 403 select CLKDEV_LOOKUP
408 select GENERIC_IRQ_CHIP 404 select GENERIC_IRQ_CHIP
409 select MIGHT_HAVE_CACHE_L2X0 405 select MIGHT_HAVE_CACHE_L2X0
406 select PINCTRL
407 select PINCTRL_SIRF
410 select USE_OF 408 select USE_OF
411 select ZONE_DMA 409 select ZONE_DMA
412 help 410 help
@@ -469,6 +467,7 @@ config ARCH_MXS
469 select CLKDEV_LOOKUP 467 select CLKDEV_LOOKUP
470 select CLKSRC_MMIO 468 select CLKSRC_MMIO
471 select HAVE_CLK_PREPARE 469 select HAVE_CLK_PREPARE
470 select PINCTRL
472 help 471 help
473 Support for Freescale MXS-based family of processors 472 Support for Freescale MXS-based family of processors
474 473
@@ -528,28 +527,6 @@ config ARCH_IOP33X
528 help 527 help
529 Support for Intel's IOP33X (XScale) family of processors. 528 Support for Intel's IOP33X (XScale) family of processors.
530 529
531config ARCH_IXP23XX
532 bool "IXP23XX-based"
533 depends on MMU
534 select CPU_XSC3
535 select PCI
536 select ARCH_USES_GETTIMEOFFSET
537 select NEED_MACH_IO_H
538 select NEED_MACH_MEMORY_H
539 help
540 Support for Intel's IXP23xx (XScale) family of processors.
541
542config ARCH_IXP2000
543 bool "IXP2400/2800-based"
544 depends on MMU
545 select CPU_XSCALE
546 select PCI
547 select ARCH_USES_GETTIMEOFFSET
548 select NEED_MACH_IO_H
549 select NEED_MACH_MEMORY_H
550 help
551 Support for Intel's IXP2400/2800 (XScale) family of processors.
552
553config ARCH_IXP4XX 530config ARCH_IXP4XX
554 bool "IXP4xx-based" 531 bool "IXP4xx-based"
555 depends on MMU 532 depends on MMU
@@ -597,6 +574,7 @@ config ARCH_LPC32XX
597 select USB_ARCH_HAS_OHCI 574 select USB_ARCH_HAS_OHCI
598 select CLKDEV_LOOKUP 575 select CLKDEV_LOOKUP
599 select GENERIC_CLOCKEVENTS 576 select GENERIC_CLOCKEVENTS
577 select USE_OF
600 help 578 help
601 Support for the NXP LPC32XX family of processors 579 Support for the NXP LPC32XX family of processors
602 580
@@ -632,7 +610,7 @@ config ARCH_MMP
632 select CLKDEV_LOOKUP 610 select CLKDEV_LOOKUP
633 select GENERIC_CLOCKEVENTS 611 select GENERIC_CLOCKEVENTS
634 select GPIO_PXA 612 select GPIO_PXA
635 select TICK_ONESHOT 613 select IRQ_DOMAIN
636 select PLAT_PXA 614 select PLAT_PXA
637 select SPARSE_IRQ 615 select SPARSE_IRQ
638 select GENERIC_ALLOCATOR 616 select GENERIC_ALLOCATOR
@@ -716,7 +694,6 @@ config ARCH_PXA
716 select ARCH_REQUIRE_GPIOLIB 694 select ARCH_REQUIRE_GPIOLIB
717 select GENERIC_CLOCKEVENTS 695 select GENERIC_CLOCKEVENTS
718 select GPIO_PXA 696 select GPIO_PXA
719 select TICK_ONESHOT
720 select PLAT_PXA 697 select PLAT_PXA
721 select SPARSE_IRQ 698 select SPARSE_IRQ
722 select AUTO_ZRELADDR 699 select AUTO_ZRELADDR
@@ -783,7 +760,6 @@ config ARCH_SA1100
783 select CPU_FREQ 760 select CPU_FREQ
784 select GENERIC_CLOCKEVENTS 761 select GENERIC_CLOCKEVENTS
785 select CLKDEV_LOOKUP 762 select CLKDEV_LOOKUP
786 select TICK_ONESHOT
787 select ARCH_REQUIRE_GPIOLIB 763 select ARCH_REQUIRE_GPIOLIB
788 select HAVE_IDE 764 select HAVE_IDE
789 select NEED_MACH_MEMORY_H 765 select NEED_MACH_MEMORY_H
@@ -946,6 +922,7 @@ config ARCH_NOMADIK
946 select CPU_ARM926T 922 select CPU_ARM926T
947 select CLKDEV_LOOKUP 923 select CLKDEV_LOOKUP
948 select GENERIC_CLOCKEVENTS 924 select GENERIC_CLOCKEVENTS
925 select PINCTRL
949 select MIGHT_HAVE_CACHE_L2X0 926 select MIGHT_HAVE_CACHE_L2X0
950 select ARCH_REQUIRE_GPIOLIB 927 select ARCH_REQUIRE_GPIOLIB
951 help 928 help
@@ -1046,10 +1023,6 @@ source "arch/arm/mach-iop13xx/Kconfig"
1046 1023
1047source "arch/arm/mach-ixp4xx/Kconfig" 1024source "arch/arm/mach-ixp4xx/Kconfig"
1048 1025
1049source "arch/arm/mach-ixp2000/Kconfig"
1050
1051source "arch/arm/mach-ixp23xx/Kconfig"
1052
1053source "arch/arm/mach-kirkwood/Kconfig" 1026source "arch/arm/mach-kirkwood/Kconfig"
1054 1027
1055source "arch/arm/mach-ks8695/Kconfig" 1028source "arch/arm/mach-ks8695/Kconfig"
@@ -1186,6 +1159,15 @@ if !MMU
1186source "arch/arm/Kconfig-nommu" 1159source "arch/arm/Kconfig-nommu"
1187endif 1160endif
1188 1161
1162config ARM_ERRATA_326103
1163 bool "ARM errata: FSR write bit incorrect on a SWP to read-only memory"
1164 depends on CPU_V6
1165 help
1166 Executing a SWP instruction to read-only memory does not set bit 11
1167 of the FSR on the ARM 1136 prior to r1p0. This causes the kernel to
1168 treat the access as a read, preventing a COW from occurring and
1169 causing the faulting task to livelock.
1170
1189config ARM_ERRATA_411920 1171config ARM_ERRATA_411920
1190 bool "ARM errata: Invalidation of the Instruction Cache operation can fail" 1172 bool "ARM errata: Invalidation of the Instruction Cache operation can fail"
1191 depends on CPU_V6 || CPU_V6K 1173 depends on CPU_V6 || CPU_V6K
@@ -1543,10 +1525,15 @@ config HAVE_ARM_SCU
1543 help 1525 help
1544 This option enables support for the ARM system coherency unit 1526 This option enables support for the ARM system coherency unit
1545 1527
1528config ARM_ARCH_TIMER
1529 bool "Architected timer support"
1530 depends on CPU_V7
1531 help
1532 This option enables support for the ARM architected timer
1533
1546config HAVE_ARM_TWD 1534config HAVE_ARM_TWD
1547 bool 1535 bool
1548 depends on SMP 1536 depends on SMP
1549 select TICK_ONESHOT
1550 help 1537 help
1551 This options enables support for the ARM timer and watchdog unit 1538 This options enables support for the ARM timer and watchdog unit
1552 1539
@@ -2272,9 +2259,9 @@ menu "Power management options"
2272source "kernel/power/Kconfig" 2259source "kernel/power/Kconfig"
2273 2260
2274config ARCH_SUSPEND_POSSIBLE 2261config ARCH_SUSPEND_POSSIBLE
2275 depends on !ARCH_S5PC100 2262 depends on !ARCH_S5PC100 && !ARCH_TEGRA
2276 depends on CPU_ARM920T || CPU_ARM926T || CPU_SA1100 || \ 2263 depends on CPU_ARM920T || CPU_ARM926T || CPU_SA1100 || \
2277 CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE 2264 CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE || CPU_MOHAWK
2278 def_bool y 2265 def_bool y
2279 2266
2280config ARM_CPU_SUSPEND 2267config ARM_CPU_SUSPEND
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 047a20780fc1..157900da8782 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -70,8 +70,6 @@ arch-$(CONFIG_CPU_32v4) :=-D__LINUX_ARM_ARCH__=4 -march=armv4
70arch-$(CONFIG_CPU_32v3) :=-D__LINUX_ARM_ARCH__=3 -march=armv3 70arch-$(CONFIG_CPU_32v3) :=-D__LINUX_ARM_ARCH__=3 -march=armv3
71 71
72# This selects how we optimise for the processor. 72# This selects how we optimise for the processor.
73tune-$(CONFIG_CPU_ARM610) :=-mtune=arm610
74tune-$(CONFIG_CPU_ARM710) :=-mtune=arm710
75tune-$(CONFIG_CPU_ARM7TDMI) :=-mtune=arm7tdmi 73tune-$(CONFIG_CPU_ARM7TDMI) :=-mtune=arm7tdmi
76tune-$(CONFIG_CPU_ARM720T) :=-mtune=arm7tdmi 74tune-$(CONFIG_CPU_ARM720T) :=-mtune=arm7tdmi
77tune-$(CONFIG_CPU_ARM740T) :=-mtune=arm7tdmi 75tune-$(CONFIG_CPU_ARM740T) :=-mtune=arm7tdmi
@@ -119,7 +117,7 @@ KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_THUMB2) $(arch-y) $(tune-y) -include asm/
119CHECKFLAGS += -D__arm__ 117CHECKFLAGS += -D__arm__
120 118
121#Default value 119#Default value
122head-y := arch/arm/kernel/head$(MMUEXT).o arch/arm/kernel/init_task.o 120head-y := arch/arm/kernel/head$(MMUEXT).o
123textofs-y := 0x00008000 121textofs-y := 0x00008000
124textofs-$(CONFIG_ARCH_CLPS711X) := 0x00028000 122textofs-$(CONFIG_ARCH_CLPS711X) := 0x00028000
125# We don't want the htc bootloader to corrupt kernel during resume 123# We don't want the htc bootloader to corrupt kernel during resume
@@ -149,8 +147,6 @@ machine-$(CONFIG_ARCH_INTEGRATOR) := integrator
149machine-$(CONFIG_ARCH_IOP13XX) := iop13xx 147machine-$(CONFIG_ARCH_IOP13XX) := iop13xx
150machine-$(CONFIG_ARCH_IOP32X) := iop32x 148machine-$(CONFIG_ARCH_IOP32X) := iop32x
151machine-$(CONFIG_ARCH_IOP33X) := iop33x 149machine-$(CONFIG_ARCH_IOP33X) := iop33x
152machine-$(CONFIG_ARCH_IXP2000) := ixp2000
153machine-$(CONFIG_ARCH_IXP23XX) := ixp23xx
154machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx 150machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx
155machine-$(CONFIG_ARCH_KIRKWOOD) := kirkwood 151machine-$(CONFIG_ARCH_KIRKWOOD) := kirkwood
156machine-$(CONFIG_ARCH_KS8695) := ks8695 152machine-$(CONFIG_ARCH_KS8695) := ks8695
diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c
index 6ce11c481178..797f04bedb47 100644
--- a/arch/arm/boot/compressed/atags_to_fdt.c
+++ b/arch/arm/boot/compressed/atags_to_fdt.c
@@ -77,6 +77,8 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space)
77 } else if (atag->hdr.tag == ATAG_MEM) { 77 } else if (atag->hdr.tag == ATAG_MEM) {
78 if (memcount >= sizeof(mem_reg_property)/4) 78 if (memcount >= sizeof(mem_reg_property)/4)
79 continue; 79 continue;
80 if (!atag->u.mem.size)
81 continue;
80 mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.start); 82 mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.start);
81 mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.size); 83 mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.size);
82 } else if (atag->hdr.tag == ATAG_INITRD2) { 84 } else if (atag->hdr.tag == ATAG_INITRD2) {
diff --git a/arch/arm/boot/compressed/head-xscale.S b/arch/arm/boot/compressed/head-xscale.S
index aa5ee49c5c5a..6ab0599c02dd 100644
--- a/arch/arm/boot/compressed/head-xscale.S
+++ b/arch/arm/boot/compressed/head-xscale.S
@@ -32,10 +32,3 @@ __XScale_start:
32 bic r0, r0, #0x1000 @ clear Icache 32 bic r0, r0, #0x1000 @ clear Icache
33 mcr p15, 0, r0, c1, c0, 0 33 mcr p15, 0, r0, c1, c0, 0
34 34
35#ifdef CONFIG_ARCH_IXP2000
36 mov r1, #-1
37 mov r0, #0xd6000000
38 str r1, [r0, #0x14]
39 str r1, [r0, #0x18]
40#endif
41
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 5f6045f1766c..b8c64b80bafc 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -273,7 +273,7 @@ restart: adr r0, LC0
273 add r0, r0, #0x100 273 add r0, r0, #0x100
274 mov r1, r6 274 mov r1, r6
275 sub r2, sp, r6 275 sub r2, sp, r6
276 blne atags_to_fdt 276 bleq atags_to_fdt
277 277
278 ldmfd sp!, {r0-r3, ip, lr} 278 ldmfd sp!, {r0-r3, ip, lr}
279 sub sp, sp, #0x10000 279 sub sp, sp, #0x10000
@@ -567,6 +567,12 @@ __armv3_mpu_cache_on:
567 mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3 567 mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3
568 mov pc, lr 568 mov pc, lr
569 569
570#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
571#define CB_BITS 0x08
572#else
573#define CB_BITS 0x0c
574#endif
575
570__setup_mmu: sub r3, r4, #16384 @ Page directory size 576__setup_mmu: sub r3, r4, #16384 @ Page directory size
571 bic r3, r3, #0xff @ Align the pointer 577 bic r3, r3, #0xff @ Align the pointer
572 bic r3, r3, #0x3f00 578 bic r3, r3, #0x3f00
@@ -578,17 +584,14 @@ __setup_mmu: sub r3, r4, #16384 @ Page directory size
578 mov r9, r0, lsr #18 584 mov r9, r0, lsr #18
579 mov r9, r9, lsl #18 @ start of RAM 585 mov r9, r9, lsl #18 @ start of RAM
580 add r10, r9, #0x10000000 @ a reasonable RAM size 586 add r10, r9, #0x10000000 @ a reasonable RAM size
581 mov r1, #0x12 587 mov r1, #0x12 @ XN|U + section mapping
582 orr r1, r1, #3 << 10 588 orr r1, r1, #3 << 10 @ AP=11
583 add r2, r3, #16384 589 add r2, r3, #16384
5841: cmp r1, r9 @ if virt > start of RAM 5901: cmp r1, r9 @ if virt > start of RAM
585#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH 591 cmphs r10, r1 @ && end of RAM > virt
586 orrhs r1, r1, #0x08 @ set cacheable 592 bic r1, r1, #0x1c @ clear XN|U + C + B
587#else 593 orrlo r1, r1, #0x10 @ Set XN|U for non-RAM
588 orrhs r1, r1, #0x0c @ set cacheable, bufferable 594 orrhs r1, r1, r6 @ set RAM section settings
589#endif
590 cmp r1, r10 @ if virt > end of RAM
591 bichs r1, r1, #0x0c @ clear cacheable, bufferable
592 str r1, [r0], #4 @ 1:1 mapping 595 str r1, [r0], #4 @ 1:1 mapping
593 add r1, r1, #1048576 596 add r1, r1, #1048576
594 teq r0, r2 597 teq r0, r2
@@ -599,7 +602,7 @@ __setup_mmu: sub r3, r4, #16384 @ Page directory size
599 * so there is no map overlap problem for up to 1 MB compressed kernel. 602 * so there is no map overlap problem for up to 1 MB compressed kernel.
600 * If the execution is in RAM then we would only be duplicating the above. 603 * If the execution is in RAM then we would only be duplicating the above.
601 */ 604 */
602 mov r1, #0x1e 605 orr r1, r6, #0x04 @ ensure B is set for this
603 orr r1, r1, #3 << 10 606 orr r1, r1, #3 << 10
604 mov r2, pc 607 mov r2, pc
605 mov r2, r2, lsr #20 608 mov r2, r2, lsr #20
@@ -620,6 +623,7 @@ __arm926ejs_mmu_cache_on:
620__armv4_mmu_cache_on: 623__armv4_mmu_cache_on:
621 mov r12, lr 624 mov r12, lr
622#ifdef CONFIG_MMU 625#ifdef CONFIG_MMU
626 mov r6, #CB_BITS | 0x12 @ U
623 bl __setup_mmu 627 bl __setup_mmu
624 mov r0, #0 628 mov r0, #0
625 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 629 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
@@ -641,6 +645,7 @@ __armv7_mmu_cache_on:
641#ifdef CONFIG_MMU 645#ifdef CONFIG_MMU
642 mrc p15, 0, r11, c0, c1, 4 @ read ID_MMFR0 646 mrc p15, 0, r11, c0, c1, 4 @ read ID_MMFR0
643 tst r11, #0xf @ VMSA 647 tst r11, #0xf @ VMSA
648 movne r6, #CB_BITS | 0x02 @ !XN
644 blne __setup_mmu 649 blne __setup_mmu
645 mov r0, #0 650 mov r0, #0
646 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 651 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
@@ -655,7 +660,7 @@ __armv7_mmu_cache_on:
655 orr r0, r0, #1 << 25 @ big-endian page tables 660 orr r0, r0, #1 << 25 @ big-endian page tables
656#endif 661#endif
657 orrne r0, r0, #1 @ MMU enabled 662 orrne r0, r0, #1 @ MMU enabled
658 movne r1, #-1 663 movne r1, #0xfffffffd @ domain 0 = client
659 mcrne p15, 0, r3, c2, c0, 0 @ load page table pointer 664 mcrne p15, 0, r3, c2, c0, 0 @ load page table pointer
660 mcrne p15, 0, r1, c3, c0, 0 @ load domain access control 665 mcrne p15, 0, r1, c3, c0, 0 @ load domain access control
661#endif 666#endif
@@ -668,6 +673,7 @@ __armv7_mmu_cache_on:
668 673
669__fa526_cache_on: 674__fa526_cache_on:
670 mov r12, lr 675 mov r12, lr
676 mov r6, #CB_BITS | 0x12 @ U
671 bl __setup_mmu 677 bl __setup_mmu
672 mov r0, #0 678 mov r0, #0
673 mcr p15, 0, r0, c7, c7, 0 @ Invalidate whole cache 679 mcr p15, 0, r0, c7, c7, 0 @ Invalidate whole cache
@@ -680,18 +686,6 @@ __fa526_cache_on:
680 mcr p15, 0, r0, c8, c7, 0 @ flush UTLB 686 mcr p15, 0, r0, c8, c7, 0 @ flush UTLB
681 mov pc, r12 687 mov pc, r12
682 688
683__arm6_mmu_cache_on:
684 mov r12, lr
685 bl __setup_mmu
686 mov r0, #0
687 mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3
688 mcr p15, 0, r0, c5, c0, 0 @ invalidate whole TLB v3
689 mov r0, #0x30
690 bl __common_mmu_cache_on
691 mov r0, #0
692 mcr p15, 0, r0, c5, c0, 0 @ invalidate whole TLB v3
693 mov pc, r12
694
695__common_mmu_cache_on: 689__common_mmu_cache_on:
696#ifndef CONFIG_THUMB2_KERNEL 690#ifndef CONFIG_THUMB2_KERNEL
697#ifndef DEBUG 691#ifndef DEBUG
@@ -756,16 +750,6 @@ call_cache_fn: adr r12, proc_types
756 .align 2 750 .align 2
757 .type proc_types,#object 751 .type proc_types,#object
758proc_types: 752proc_types:
759 .word 0x41560600 @ ARM6/610
760 .word 0xffffffe0
761 W(b) __arm6_mmu_cache_off @ works, but slow
762 W(b) __arm6_mmu_cache_off
763 mov pc, lr
764 THUMB( nop )
765@ b __arm6_mmu_cache_on @ untested
766@ b __arm6_mmu_cache_off
767@ b __armv3_mmu_cache_flush
768
769 .word 0x00000000 @ old ARM ID 753 .word 0x00000000 @ old ARM ID
770 .word 0x0000f000 754 .word 0x0000f000
771 mov pc, lr 755 mov pc, lr
@@ -777,8 +761,10 @@ proc_types:
777 761
778 .word 0x41007000 @ ARM7/710 762 .word 0x41007000 @ ARM7/710
779 .word 0xfff8fe00 763 .word 0xfff8fe00
780 W(b) __arm7_mmu_cache_off 764 mov pc, lr
781 W(b) __arm7_mmu_cache_off 765 THUMB( nop )
766 mov pc, lr
767 THUMB( nop )
782 mov pc, lr 768 mov pc, lr
783 THUMB( nop ) 769 THUMB( nop )
784 770
@@ -977,21 +963,6 @@ __armv7_mmu_cache_off:
977 mcr p15, 0, r0, c7, c5, 4 @ ISB 963 mcr p15, 0, r0, c7, c5, 4 @ ISB
978 mov pc, r12 964 mov pc, r12
979 965
980__arm6_mmu_cache_off:
981 mov r0, #0x00000030 @ ARM6 control reg.
982 b __armv3_mmu_cache_off
983
984__arm7_mmu_cache_off:
985 mov r0, #0x00000070 @ ARM7 control reg.
986 b __armv3_mmu_cache_off
987
988__armv3_mmu_cache_off:
989 mcr p15, 0, r0, c1, c0, 0 @ turn MMU and cache off
990 mov r0, #0
991 mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3
992 mcr p15, 0, r0, c5, c0, 0 @ invalidate whole TLB v3
993 mov pc, lr
994
995/* 966/*
996 * Clean and flush the cache to maintain consistency. 967 * Clean and flush the cache to maintain consistency.
997 * 968 *
diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
new file mode 100644
index 000000000000..f449efc9825f
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -0,0 +1,273 @@
1/*
2 * at91sam9260.dtsi - Device Tree Include file for AT91SAM9260 family SoC
3 *
4 * Copyright (C) 2011 Atmel,
5 * 2011 Nicolas Ferre <nicolas.ferre@atmel.com>,
6 * 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
7 *
8 * Licensed under GPLv2 or later.
9 */
10
11/include/ "skeleton.dtsi"
12
13/ {
14 model = "Atmel AT91SAM9260 family SoC";
15 compatible = "atmel,at91sam9260";
16 interrupt-parent = <&aic>;
17
18 aliases {
19 serial0 = &dbgu;
20 serial1 = &usart0;
21 serial2 = &usart1;
22 serial3 = &usart2;
23 serial4 = &usart3;
24 serial5 = &usart4;
25 serial6 = &usart5;
26 gpio0 = &pioA;
27 gpio1 = &pioB;
28 gpio2 = &pioC;
29 tcb0 = &tcb0;
30 tcb1 = &tcb1;
31 };
32 cpus {
33 cpu@0 {
34 compatible = "arm,arm926ejs";
35 };
36 };
37
38 memory {
39 reg = <0x20000000 0x04000000>;
40 };
41
42 ahb {
43 compatible = "simple-bus";
44 #address-cells = <1>;
45 #size-cells = <1>;
46 ranges;
47
48 apb {
49 compatible = "simple-bus";
50 #address-cells = <1>;
51 #size-cells = <1>;
52 ranges;
53
54 aic: interrupt-controller@fffff000 {
55 #interrupt-cells = <2>;
56 compatible = "atmel,at91rm9200-aic";
57 interrupt-controller;
58 reg = <0xfffff000 0x200>;
59 };
60
61 ramc0: ramc@ffffea00 {
62 compatible = "atmel,at91sam9260-sdramc";
63 reg = <0xffffea00 0x200>;
64 };
65
66 pmc: pmc@fffffc00 {
67 compatible = "atmel,at91rm9200-pmc";
68 reg = <0xfffffc00 0x100>;
69 };
70
71 rstc@fffffd00 {
72 compatible = "atmel,at91sam9260-rstc";
73 reg = <0xfffffd00 0x10>;
74 };
75
76 shdwc@fffffd10 {
77 compatible = "atmel,at91sam9260-shdwc";
78 reg = <0xfffffd10 0x10>;
79 };
80
81 pit: timer@fffffd30 {
82 compatible = "atmel,at91sam9260-pit";
83 reg = <0xfffffd30 0xf>;
84 interrupts = <1 4>;
85 };
86
87 tcb0: timer@fffa0000 {
88 compatible = "atmel,at91rm9200-tcb";
89 reg = <0xfffa0000 0x100>;
90 interrupts = <17 4 18 4 19 4>;
91 };
92
93 tcb1: timer@fffdc000 {
94 compatible = "atmel,at91rm9200-tcb";
95 reg = <0xfffdc000 0x100>;
96 interrupts = <26 4 27 4 28 4>;
97 };
98
99 pioA: gpio@fffff400 {
100 compatible = "atmel,at91rm9200-gpio";
101 reg = <0xfffff400 0x100>;
102 interrupts = <2 4>;
103 #gpio-cells = <2>;
104 gpio-controller;
105 interrupt-controller;
106 };
107
108 pioB: gpio@fffff600 {
109 compatible = "atmel,at91rm9200-gpio";
110 reg = <0xfffff600 0x100>;
111 interrupts = <3 4>;
112 #gpio-cells = <2>;
113 gpio-controller;
114 interrupt-controller;
115 };
116
117 pioC: gpio@fffff800 {
118 compatible = "atmel,at91rm9200-gpio";
119 reg = <0xfffff800 0x100>;
120 interrupts = <4 4>;
121 #gpio-cells = <2>;
122 gpio-controller;
123 interrupt-controller;
124 };
125
126 dbgu: serial@fffff200 {
127 compatible = "atmel,at91sam9260-usart";
128 reg = <0xfffff200 0x200>;
129 interrupts = <1 4>;
130 status = "disabled";
131 };
132
133 usart0: serial@fffb0000 {
134 compatible = "atmel,at91sam9260-usart";
135 reg = <0xfffb0000 0x200>;
136 interrupts = <6 4>;
137 atmel,use-dma-rx;
138 atmel,use-dma-tx;
139 status = "disabled";
140 };
141
142 usart1: serial@fffb4000 {
143 compatible = "atmel,at91sam9260-usart";
144 reg = <0xfffb4000 0x200>;
145 interrupts = <7 4>;
146 atmel,use-dma-rx;
147 atmel,use-dma-tx;
148 status = "disabled";
149 };
150
151 usart2: serial@fffb8000 {
152 compatible = "atmel,at91sam9260-usart";
153 reg = <0xfffb8000 0x200>;
154 interrupts = <8 4>;
155 atmel,use-dma-rx;
156 atmel,use-dma-tx;
157 status = "disabled";
158 };
159
160 usart3: serial@fffd0000 {
161 compatible = "atmel,at91sam9260-usart";
162 reg = <0xfffd0000 0x200>;
163 interrupts = <23 4>;
164 atmel,use-dma-rx;
165 atmel,use-dma-tx;
166 status = "disabled";
167 };
168
169 usart4: serial@fffd4000 {
170 compatible = "atmel,at91sam9260-usart";
171 reg = <0xfffd4000 0x200>;
172 interrupts = <24 4>;
173 atmel,use-dma-rx;
174 atmel,use-dma-tx;
175 status = "disabled";
176 };
177
178 usart5: serial@fffd8000 {
179 compatible = "atmel,at91sam9260-usart";
180 reg = <0xfffd8000 0x200>;
181 interrupts = <25 4>;
182 atmel,use-dma-rx;
183 atmel,use-dma-tx;
184 status = "disabled";
185 };
186
187 macb0: ethernet@fffc4000 {
188 compatible = "cdns,at32ap7000-macb", "cdns,macb";
189 reg = <0xfffc4000 0x100>;
190 interrupts = <21 4>;
191 status = "disabled";
192 };
193
194 usb1: gadget@fffa4000 {
195 compatible = "atmel,at91rm9200-udc";
196 reg = <0xfffa4000 0x4000>;
197 interrupts = <10 4>;
198 status = "disabled";
199 };
200
201 adc0: adc@fffe0000 {
202 compatible = "atmel,at91sam9260-adc";
203 reg = <0xfffe0000 0x100>;
204 interrupts = <5 4>;
205 atmel,adc-use-external-triggers;
206 atmel,adc-channels-used = <0xf>;
207 atmel,adc-vref = <3300>;
208 atmel,adc-num-channels = <4>;
209 atmel,adc-startup-time = <15>;
210 atmel,adc-channel-base = <0x30>;
211 atmel,adc-drdy-mask = <0x10000>;
212 atmel,adc-status-register = <0x1c>;
213 atmel,adc-trigger-register = <0x04>;
214
215 trigger@0 {
216 trigger-name = "timer-counter-0";
217 trigger-value = <0x1>;
218 };
219 trigger@1 {
220 trigger-name = "timer-counter-1";
221 trigger-value = <0x3>;
222 };
223
224 trigger@2 {
225 trigger-name = "timer-counter-2";
226 trigger-value = <0x5>;
227 };
228
229 trigger@3 {
230 trigger-name = "external";
231 trigger-value = <0x13>;
232 trigger-external;
233 };
234 };
235 };
236
237 nand0: nand@40000000 {
238 compatible = "atmel,at91rm9200-nand";
239 #address-cells = <1>;
240 #size-cells = <1>;
241 reg = <0x40000000 0x10000000
242 0xffffe800 0x200
243 >;
244 atmel,nand-addr-offset = <21>;
245 atmel,nand-cmd-offset = <22>;
246 gpios = <&pioC 13 0
247 &pioC 14 0
248 0
249 >;
250 status = "disabled";
251 };
252
253 usb0: ohci@00500000 {
254 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
255 reg = <0x00500000 0x100000>;
256 interrupts = <20 4>;
257 status = "disabled";
258 };
259 };
260
261 i2c@0 {
262 compatible = "i2c-gpio";
263 gpios = <&pioA 23 0 /* sda */
264 &pioA 24 0 /* scl */
265 >;
266 i2c-gpio,sda-open-drain;
267 i2c-gpio,scl-open-drain;
268 i2c-gpio,delay-us = <2>; /* ~100 kHz */
269 #address-cells = <1>;
270 #size-cells = <0>;
271 status = "disabled";
272 };
273};
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
new file mode 100644
index 000000000000..0209913a65a2
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -0,0 +1,220 @@
1/*
2 * at91sam9263.dtsi - Device Tree Include file for AT91SAM9263 family SoC
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2 only.
7 */
8
9/include/ "skeleton.dtsi"
10
11/ {
12 model = "Atmel AT91SAM9263 family SoC";
13 compatible = "atmel,at91sam9263";
14 interrupt-parent = <&aic>;
15
16 aliases {
17 serial0 = &dbgu;
18 serial1 = &usart0;
19 serial2 = &usart1;
20 serial3 = &usart2;
21 gpio0 = &pioA;
22 gpio1 = &pioB;
23 gpio2 = &pioC;
24 gpio3 = &pioD;
25 gpio4 = &pioE;
26 tcb0 = &tcb0;
27 };
28 cpus {
29 cpu@0 {
30 compatible = "arm,arm926ejs";
31 };
32 };
33
34 memory {
35 reg = <0x20000000 0x08000000>;
36 };
37
38 ahb {
39 compatible = "simple-bus";
40 #address-cells = <1>;
41 #size-cells = <1>;
42 ranges;
43
44 apb {
45 compatible = "simple-bus";
46 #address-cells = <1>;
47 #size-cells = <1>;
48 ranges;
49
50 aic: interrupt-controller@fffff000 {
51 #interrupt-cells = <2>;
52 compatible = "atmel,at91rm9200-aic";
53 interrupt-controller;
54 reg = <0xfffff000 0x200>;
55 };
56
57 pmc: pmc@fffffc00 {
58 compatible = "atmel,at91rm9200-pmc";
59 reg = <0xfffffc00 0x100>;
60 };
61
62 ramc: ramc@ffffe200 {
63 compatible = "atmel,at91sam9260-sdramc";
64 reg = <0xffffe200 0x200
65 0xffffe800 0x200>;
66 };
67
68 pit: timer@fffffd30 {
69 compatible = "atmel,at91sam9260-pit";
70 reg = <0xfffffd30 0xf>;
71 interrupts = <1 4>;
72 };
73
74 tcb0: timer@fff7c000 {
75 compatible = "atmel,at91rm9200-tcb";
76 reg = <0xfff7c000 0x100>;
77 interrupts = <19 4>;
78 };
79
80 rstc@fffffd00 {
81 compatible = "atmel,at91sam9260-rstc";
82 reg = <0xfffffd00 0x10>;
83 };
84
85 shdwc@fffffd10 {
86 compatible = "atmel,at91sam9260-shdwc";
87 reg = <0xfffffd10 0x10>;
88 };
89
90 pioA: gpio@fffff200 {
91 compatible = "atmel,at91rm9200-gpio";
92 reg = <0xfffff200 0x100>;
93 interrupts = <2 4>;
94 #gpio-cells = <2>;
95 gpio-controller;
96 interrupt-controller;
97 };
98
99 pioB: gpio@fffff400 {
100 compatible = "atmel,at91rm9200-gpio";
101 reg = <0xfffff400 0x100>;
102 interrupts = <3 4>;
103 #gpio-cells = <2>;
104 gpio-controller;
105 interrupt-controller;
106 };
107
108 pioC: gpio@fffff600 {
109 compatible = "atmel,at91rm9200-gpio";
110 reg = <0xfffff600 0x100>;
111 interrupts = <4 4>;
112 #gpio-cells = <2>;
113 gpio-controller;
114 interrupt-controller;
115 };
116
117 pioD: gpio@fffff800 {
118 compatible = "atmel,at91rm9200-gpio";
119 reg = <0xfffff800 0x100>;
120 interrupts = <4 4>;
121 #gpio-cells = <2>;
122 gpio-controller;
123 interrupt-controller;
124 };
125
126 pioE: gpio@fffffa00 {
127 compatible = "atmel,at91rm9200-gpio";
128 reg = <0xfffffa00 0x100>;
129 interrupts = <4 4>;
130 #gpio-cells = <2>;
131 gpio-controller;
132 interrupt-controller;
133 };
134
135 dbgu: serial@ffffee00 {
136 compatible = "atmel,at91sam9260-usart";
137 reg = <0xffffee00 0x200>;
138 interrupts = <1 4>;
139 status = "disabled";
140 };
141
142 usart0: serial@fff8c000 {
143 compatible = "atmel,at91sam9260-usart";
144 reg = <0xfff8c000 0x200>;
145 interrupts = <7 4>;
146 atmel,use-dma-rx;
147 atmel,use-dma-tx;
148 status = "disabled";
149 };
150
151 usart1: serial@fff90000 {
152 compatible = "atmel,at91sam9260-usart";
153 reg = <0xfff90000 0x200>;
154 interrupts = <8 4>;
155 atmel,use-dma-rx;
156 atmel,use-dma-tx;
157 status = "disabled";
158 };
159
160 usart2: serial@fff94000 {
161 compatible = "atmel,at91sam9260-usart";
162 reg = <0xfff94000 0x200>;
163 interrupts = <9 4>;
164 atmel,use-dma-rx;
165 atmel,use-dma-tx;
166 status = "disabled";
167 };
168
169 macb0: ethernet@fffbc000 {
170 compatible = "cdns,at32ap7000-macb", "cdns,macb";
171 reg = <0xfffbc000 0x100>;
172 interrupts = <21 4>;
173 status = "disabled";
174 };
175
176 usb1: gadget@fff78000 {
177 compatible = "atmel,at91rm9200-udc";
178 reg = <0xfff78000 0x4000>;
179 interrupts = <24 4>;
180 status = "disabled";
181 };
182 };
183
184 nand0: nand@40000000 {
185 compatible = "atmel,at91rm9200-nand";
186 #address-cells = <1>;
187 #size-cells = <1>;
188 reg = <0x40000000 0x10000000
189 0xffffe000 0x200
190 >;
191 atmel,nand-addr-offset = <21>;
192 atmel,nand-cmd-offset = <22>;
193 gpios = <&pioA 22 0
194 &pioD 15 0
195 0
196 >;
197 status = "disabled";
198 };
199
200 usb0: ohci@00a00000 {
201 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
202 reg = <0x00a00000 0x100000>;
203 interrupts = <29 4>;
204 status = "disabled";
205 };
206 };
207
208 i2c@0 {
209 compatible = "i2c-gpio";
210 gpios = <&pioB 4 0 /* sda */
211 &pioB 5 0 /* scl */
212 >;
213 i2c-gpio,sda-open-drain;
214 i2c-gpio,scl-open-drain;
215 i2c-gpio,delay-us = <2>; /* ~100 kHz */
216 #address-cells = <1>;
217 #size-cells = <0>;
218 status = "disabled";
219 };
220};
diff --git a/arch/arm/boot/dts/at91sam9263ek.dts b/arch/arm/boot/dts/at91sam9263ek.dts
new file mode 100644
index 000000000000..f86ac4b609fc
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9263ek.dts
@@ -0,0 +1,156 @@
1/*
2 * at91sam9263ek.dts - Device Tree file for Atmel at91sam9263 reference board
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2 only
7 */
8/dts-v1/;
9/include/ "at91sam9263.dtsi"
10
11/ {
12 model = "Atmel at91sam9263ek";
13 compatible = "atmel,at91sam9263ek", "atmel,at91sam9263", "atmel,at91sam9";
14
15 chosen {
16 bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock5 rw rootfstype=ubifs";
17 };
18
19 memory {
20 reg = <0x20000000 0x4000000>;
21 };
22
23 clocks {
24 #address-cells = <1>;
25 #size-cells = <1>;
26 ranges;
27
28 main_clock: clock@0 {
29 compatible = "atmel,osc", "fixed-clock";
30 clock-frequency = <16367660>;
31 };
32 };
33
34 ahb {
35 apb {
36 dbgu: serial@ffffee00 {
37 status = "okay";
38 };
39
40 usart0: serial@fff8c000 {
41 status = "okay";
42 };
43
44 macb0: ethernet@fffbc000 {
45 phy-mode = "rmii";
46 status = "okay";
47 };
48
49 usb1: gadget@fff78000 {
50 atmel,vbus-gpio = <&pioA 25 0>;
51 status = "okay";
52 };
53 };
54
55 nand0: nand@40000000 {
56 nand-bus-width = <8>;
57 nand-ecc-mode = "soft";
58 nand-on-flash-bbt = <1>;
59 status = "okay";
60
61 at91bootstrap@0 {
62 label = "at91bootstrap";
63 reg = <0x0 0x20000>;
64 };
65
66 barebox@20000 {
67 label = "barebox";
68 reg = <0x20000 0x40000>;
69 };
70
71 bareboxenv@60000 {
72 label = "bareboxenv";
73 reg = <0x60000 0x20000>;
74 };
75
76 bareboxenv2@80000 {
77 label = "bareboxenv2";
78 reg = <0x80000 0x20000>;
79 };
80
81 oftree@80000 {
82 label = "oftree";
83 reg = <0xa0000 0x20000>;
84 };
85
86 kernel@a0000 {
87 label = "kernel";
88 reg = <0xc0000 0x400000>;
89 };
90
91 rootfs@4a0000 {
92 label = "rootfs";
93 reg = <0x4c0000 0x7800000>;
94 };
95
96 data@7ca0000 {
97 label = "data";
98 reg = <0x7cc0000 0x8340000>;
99 };
100 };
101
102 usb0: ohci@00a00000 {
103 num-ports = <2>;
104 status = "okay";
105 atmel,vbus-gpio = <&pioA 24 0
106 &pioA 21 0
107 >;
108 };
109 };
110
111 leds {
112 compatible = "gpio-leds";
113
114 d3 {
115 label = "d3";
116 gpios = <&pioB 7 0>;
117 linux,default-trigger = "heartbeat";
118 };
119
120 d2 {
121 label = "d2";
122 gpios = <&pioC 29 1>;
123 linux,default-trigger = "nand-disk";
124 };
125 };
126
127 gpio_keys {
128 compatible = "gpio-keys";
129 #address-cells = <1>;
130 #size-cells = <0>;
131
132 left_click {
133 label = "left_click";
134 gpios = <&pioC 5 1>;
135 linux,code = <272>;
136 gpio-key,wakeup;
137 };
138
139 right_click {
140 label = "right_click";
141 gpios = <&pioC 4 1>;
142 linux,code = <273>;
143 gpio-key,wakeup;
144 };
145 };
146
147 i2c@0 {
148 status = "okay";
149
150 24c512@50 {
151 compatible = "24c512";
152 reg = <0x50>;
153 pagesize = <128>;
154 };
155 };
156};
diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi
index 799ad1889b51..2a1d1ca8bd86 100644
--- a/arch/arm/boot/dts/at91sam9g20.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20.dtsi
@@ -1,239 +1,26 @@
1/* 1/*
2 * at91sam9g20.dtsi - Device Tree Include file for AT91SAM9G20 family SoC 2 * at91sam9g20.dtsi - Device Tree Include file for AT91SAM9G20 family SoC
3 * 3 *
4 * Copyright (C) 2011 Atmel, 4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 * 2011 Nicolas Ferre <nicolas.ferre@atmel.com>,
6 * 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
7 * 5 *
8 * Licensed under GPLv2 or later. 6 * Licensed under GPLv2.
9 */ 7 */
10 8
11/include/ "skeleton.dtsi" 9/include/ "at91sam9260.dtsi"
12 10
13/ { 11/ {
14 model = "Atmel AT91SAM9G20 family SoC"; 12 model = "Atmel AT91SAM9G20 family SoC";
15 compatible = "atmel,at91sam9g20"; 13 compatible = "atmel,at91sam9g20";
16 interrupt-parent = <&aic>;
17
18 aliases {
19 serial0 = &dbgu;
20 serial1 = &usart0;
21 serial2 = &usart1;
22 serial3 = &usart2;
23 serial4 = &usart3;
24 serial5 = &usart4;
25 serial6 = &usart5;
26 gpio0 = &pioA;
27 gpio1 = &pioB;
28 gpio2 = &pioC;
29 tcb0 = &tcb0;
30 tcb1 = &tcb1;
31 };
32 cpus {
33 cpu@0 {
34 compatible = "arm,arm926ejs";
35 };
36 };
37 14
38 memory { 15 memory {
39 reg = <0x20000000 0x08000000>; 16 reg = <0x20000000 0x08000000>;
40 }; 17 };
41 18
42 ahb { 19 ahb {
43 compatible = "simple-bus";
44 #address-cells = <1>;
45 #size-cells = <1>;
46 ranges;
47
48 apb { 20 apb {
49 compatible = "simple-bus"; 21 adc0: adc@fffe0000 {
50 #address-cells = <1>; 22 atmel,adc-startup-time = <40>;
51 #size-cells = <1>;
52 ranges;
53
54 aic: interrupt-controller@fffff000 {
55 #interrupt-cells = <2>;
56 compatible = "atmel,at91rm9200-aic";
57 interrupt-controller;
58 interrupt-parent;
59 reg = <0xfffff000 0x200>;
60 };
61
62 ramc0: ramc@ffffea00 {
63 compatible = "atmel,at91sam9260-sdramc";
64 reg = <0xffffea00 0x200>;
65 };
66
67 pmc: pmc@fffffc00 {
68 compatible = "atmel,at91rm9200-pmc";
69 reg = <0xfffffc00 0x100>;
70 };
71
72 rstc@fffffd00 {
73 compatible = "atmel,at91sam9260-rstc";
74 reg = <0xfffffd00 0x10>;
75 };
76
77 shdwc@fffffd10 {
78 compatible = "atmel,at91sam9260-shdwc";
79 reg = <0xfffffd10 0x10>;
80 };
81
82 pit: timer@fffffd30 {
83 compatible = "atmel,at91sam9260-pit";
84 reg = <0xfffffd30 0xf>;
85 interrupts = <1 4>;
86 };
87
88 tcb0: timer@fffa0000 {
89 compatible = "atmel,at91rm9200-tcb";
90 reg = <0xfffa0000 0x100>;
91 interrupts = <17 4 18 4 19 4>;
92 };
93
94 tcb1: timer@fffdc000 {
95 compatible = "atmel,at91rm9200-tcb";
96 reg = <0xfffdc000 0x100>;
97 interrupts = <26 4 27 4 28 4>;
98 };
99
100 pioA: gpio@fffff400 {
101 compatible = "atmel,at91rm9200-gpio";
102 reg = <0xfffff400 0x100>;
103 interrupts = <2 4>;
104 #gpio-cells = <2>;
105 gpio-controller;
106 interrupt-controller;
107 };
108
109 pioB: gpio@fffff600 {
110 compatible = "atmel,at91rm9200-gpio";
111 reg = <0xfffff600 0x100>;
112 interrupts = <3 4>;
113 #gpio-cells = <2>;
114 gpio-controller;
115 interrupt-controller;
116 };
117
118 pioC: gpio@fffff800 {
119 compatible = "atmel,at91rm9200-gpio";
120 reg = <0xfffff800 0x100>;
121 interrupts = <4 4>;
122 #gpio-cells = <2>;
123 gpio-controller;
124 interrupt-controller;
125 };
126
127 dbgu: serial@fffff200 {
128 compatible = "atmel,at91sam9260-usart";
129 reg = <0xfffff200 0x200>;
130 interrupts = <1 4>;
131 status = "disabled";
132 };
133
134 usart0: serial@fffb0000 {
135 compatible = "atmel,at91sam9260-usart";
136 reg = <0xfffb0000 0x200>;
137 interrupts = <6 4>;
138 atmel,use-dma-rx;
139 atmel,use-dma-tx;
140 status = "disabled";
141 };
142
143 usart1: serial@fffb4000 {
144 compatible = "atmel,at91sam9260-usart";
145 reg = <0xfffb4000 0x200>;
146 interrupts = <7 4>;
147 atmel,use-dma-rx;
148 atmel,use-dma-tx;
149 status = "disabled";
150 };
151
152 usart2: serial@fffb8000 {
153 compatible = "atmel,at91sam9260-usart";
154 reg = <0xfffb8000 0x200>;
155 interrupts = <8 4>;
156 atmel,use-dma-rx;
157 atmel,use-dma-tx;
158 status = "disabled";
159 };
160
161 usart3: serial@fffd0000 {
162 compatible = "atmel,at91sam9260-usart";
163 reg = <0xfffd0000 0x200>;
164 interrupts = <23 4>;
165 atmel,use-dma-rx;
166 atmel,use-dma-tx;
167 status = "disabled";
168 };
169
170 usart4: serial@fffd4000 {
171 compatible = "atmel,at91sam9260-usart";
172 reg = <0xfffd4000 0x200>;
173 interrupts = <24 4>;
174 atmel,use-dma-rx;
175 atmel,use-dma-tx;
176 status = "disabled";
177 };
178
179 usart5: serial@fffd8000 {
180 compatible = "atmel,at91sam9260-usart";
181 reg = <0xfffd8000 0x200>;
182 interrupts = <25 4>;
183 atmel,use-dma-rx;
184 atmel,use-dma-tx;
185 status = "disabled";
186 };
187
188 macb0: ethernet@fffc4000 {
189 compatible = "cdns,at32ap7000-macb", "cdns,macb";
190 reg = <0xfffc4000 0x100>;
191 interrupts = <21 4>;
192 status = "disabled";
193 };
194
195 usb1: gadget@fffa4000 {
196 compatible = "atmel,at91rm9200-udc";
197 reg = <0xfffa4000 0x4000>;
198 interrupts = <10 4>;
199 status = "disabled";
200 }; 23 };
201 }; 24 };
202
203 nand0: nand@40000000 {
204 compatible = "atmel,at91rm9200-nand";
205 #address-cells = <1>;
206 #size-cells = <1>;
207 reg = <0x40000000 0x10000000
208 0xffffe800 0x200
209 >;
210 atmel,nand-addr-offset = <21>;
211 atmel,nand-cmd-offset = <22>;
212 gpios = <&pioC 13 0
213 &pioC 14 0
214 0
215 >;
216 status = "disabled";
217 };
218
219 usb0: ohci@00500000 {
220 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
221 reg = <0x00500000 0x100000>;
222 interrupts = <20 4>;
223 status = "disabled";
224 };
225 };
226
227 i2c@0 {
228 compatible = "i2c-gpio";
229 gpios = <&pioA 23 0 /* sda */
230 &pioA 24 0 /* scl */
231 >;
232 i2c-gpio,sda-open-drain;
233 i2c-gpio,scl-open-drain;
234 i2c-gpio,delay-us = <2>; /* ~100 kHz */
235 #address-cells = <1>;
236 #size-cells = <0>;
237 status = "disabled";
238 }; 25 };
239}; 26};
diff --git a/arch/arm/boot/dts/at91sam9g20ek.dts b/arch/arm/boot/dts/at91sam9g20ek.dts
new file mode 100644
index 000000000000..e5324bf9d529
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9g20ek.dts
@@ -0,0 +1,29 @@
1/*
2 * at91sam9g20ek.dts - Device Tree file for Atmel at91sam9g20ek board
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8/dts-v1/;
9/include/ "at91sam9g20ek_common.dtsi"
10
11/ {
12 model = "Atmel at91sam9g20ek";
13 compatible = "atmel,at91sam9g20ek", "atmel,at91sam9g20", "atmel,at91sam9";
14
15 leds {
16 compatible = "gpio-leds";
17
18 ds1 {
19 label = "ds1";
20 gpios = <&pioA 9 0>;
21 linux,default-trigger = "heartbeat";
22 };
23
24 ds5 {
25 label = "ds5";
26 gpios = <&pioA 6 1>;
27 };
28 };
29};
diff --git a/arch/arm/boot/dts/at91sam9g20ek_2mmc.dts b/arch/arm/boot/dts/at91sam9g20ek_2mmc.dts
new file mode 100644
index 000000000000..f1b2e148ac8c
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9g20ek_2mmc.dts
@@ -0,0 +1,29 @@
1/*
2 * at91sam9g20ek_2mmc.dts - Device Tree file for Atmel at91sam9g20ek 2 MMC board
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8/dts-v1/;
9/include/ "at91sam9g20ek_common.dtsi"
10
11/ {
12 model = "Atmel at91sam9g20ek 2 mmc";
13 compatible = "atmel,at91sam9g20ek_2mmc", "atmel,at91sam9g20", "atmel,at91sam9";
14
15 leds {
16 compatible = "gpio-leds";
17
18 ds1 {
19 label = "ds1";
20 gpios = <&pioB 9 0>;
21 linux,default-trigger = "heartbeat";
22 };
23
24 ds5 {
25 label = "ds5";
26 gpios = <&pioB 8 1>;
27 };
28 };
29};
diff --git a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
new file mode 100644
index 000000000000..b06c0db273b1
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
@@ -0,0 +1,142 @@
1/*
2 * at91sam9g20ek_common.dtsi - Device Tree file for Atmel at91sam9g20ek board
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8/include/ "at91sam9g20.dtsi"
9
10/ {
11
12 chosen {
13 bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock5 rw rootfstype=ubifs";
14 };
15
16 memory {
17 reg = <0x20000000 0x4000000>;
18 };
19
20 clocks {
21 #address-cells = <1>;
22 #size-cells = <1>;
23 ranges;
24
25 main_clock: clock@0 {
26 compatible = "atmel,osc", "fixed-clock";
27 clock-frequency = <18432000>;
28 };
29 };
30
31 ahb {
32 apb {
33 dbgu: serial@fffff200 {
34 status = "okay";
35 };
36
37 usart0: serial@fffb0000 {
38 status = "okay";
39 };
40
41 usart1: serial@fffb4000 {
42 status = "okay";
43 };
44
45 macb0: ethernet@fffc4000 {
46 phy-mode = "rmii";
47 status = "okay";
48 };
49
50 usb1: gadget@fffa4000 {
51 atmel,vbus-gpio = <&pioC 5 0>;
52 status = "okay";
53 };
54 };
55
56 nand0: nand@40000000 {
57 nand-bus-width = <8>;
58 nand-ecc-mode = "soft";
59 nand-on-flash-bbt;
60 status = "okay";
61
62 at91bootstrap@0 {
63 label = "at91bootstrap";
64 reg = <0x0 0x20000>;
65 };
66
67 barebox@20000 {
68 label = "barebox";
69 reg = <0x20000 0x40000>;
70 };
71
72 bareboxenv@60000 {
73 label = "bareboxenv";
74 reg = <0x60000 0x20000>;
75 };
76
77 bareboxenv2@80000 {
78 label = "bareboxenv2";
79 reg = <0x80000 0x20000>;
80 };
81
82 oftree@80000 {
83 label = "oftree";
84 reg = <0xa0000 0x20000>;
85 };
86
87 kernel@a0000 {
88 label = "kernel";
89 reg = <0xc0000 0x400000>;
90 };
91
92 rootfs@4a0000 {
93 label = "rootfs";
94 reg = <0x4c0000 0x7800000>;
95 };
96
97 data@7ca0000 {
98 label = "data";
99 reg = <0x7cc0000 0x8340000>;
100 };
101 };
102
103 usb0: ohci@00500000 {
104 num-ports = <2>;
105 status = "okay";
106 };
107 };
108
109 i2c@0 {
110 status = "okay";
111
112 24c512@50 {
113 compatible = "24c512";
114 reg = <0x50>;
115 };
116
117 wm8731@1b {
118 compatible = "wm8731";
119 reg = <0x1b>;
120 };
121 };
122
123 gpio_keys {
124 compatible = "gpio-keys";
125 #address-cells = <1>;
126 #size-cells = <0>;
127
128 btn3 {
129 label = "Buttin 3";
130 gpios = <&pioA 30 1>;
131 linux,code = <0x103>;
132 gpio-key,wakeup;
133 };
134
135 btn4 {
136 label = "Buttin 4";
137 gpios = <&pioA 31 1>;
138 linux,code = <0x104>;
139 gpio-key,wakeup;
140 };
141 };
142};
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index 9e6eb6ecea0e..7dbccaf199f7 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -56,7 +56,6 @@
56 #interrupt-cells = <2>; 56 #interrupt-cells = <2>;
57 compatible = "atmel,at91rm9200-aic"; 57 compatible = "atmel,at91rm9200-aic";
58 interrupt-controller; 58 interrupt-controller;
59 interrupt-parent;
60 reg = <0xfffff000 0x200>; 59 reg = <0xfffff000 0x200>;
61 }; 60 };
62 61
@@ -200,6 +199,43 @@
200 interrupts = <25 4>; 199 interrupts = <25 4>;
201 status = "disabled"; 200 status = "disabled";
202 }; 201 };
202
203 adc0: adc@fffb0000 {
204 compatible = "atmel,at91sam9260-adc";
205 reg = <0xfffb0000 0x100>;
206 interrupts = <20 4>;
207 atmel,adc-use-external-triggers;
208 atmel,adc-channels-used = <0xff>;
209 atmel,adc-vref = <3300>;
210 atmel,adc-num-channels = <8>;
211 atmel,adc-startup-time = <40>;
212 atmel,adc-channel-base = <0x30>;
213 atmel,adc-drdy-mask = <0x10000>;
214 atmel,adc-status-register = <0x1c>;
215 atmel,adc-trigger-register = <0x08>;
216
217 trigger@0 {
218 trigger-name = "external-rising";
219 trigger-value = <0x1>;
220 trigger-external;
221 };
222 trigger@1 {
223 trigger-name = "external-falling";
224 trigger-value = <0x2>;
225 trigger-external;
226 };
227
228 trigger@2 {
229 trigger-name = "external-any";
230 trigger-value = <0x3>;
231 trigger-external;
232 };
233
234 trigger@3 {
235 trigger-name = "continuous";
236 trigger-value = <0x6>;
237 };
238 };
203 }; 239 };
204 240
205 nand0: nand@40000000 { 241 nand0: nand@40000000 {
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
new file mode 100644
index 000000000000..cb84de791b5a
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -0,0 +1,221 @@
1/*
2 * at91sam9n12.dtsi - Device Tree include file for AT91SAM9N12 SoC
3 *
4 * Copyright (C) 2012 Atmel,
5 * 2012 Hong Xu <hong.xu@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9
10/include/ "skeleton.dtsi"
11
12/ {
13 model = "Atmel AT91SAM9N12 SoC";
14 compatible = "atmel,at91sam9n12";
15 interrupt-parent = <&aic>;
16
17 aliases {
18 serial0 = &dbgu;
19 serial1 = &usart0;
20 serial2 = &usart1;
21 serial3 = &usart2;
22 serial4 = &usart3;
23 gpio0 = &pioA;
24 gpio1 = &pioB;
25 gpio2 = &pioC;
26 gpio3 = &pioD;
27 tcb0 = &tcb0;
28 tcb1 = &tcb1;
29 };
30 cpus {
31 cpu@0 {
32 compatible = "arm,arm926ejs";
33 };
34 };
35
36 memory {
37 reg = <0x20000000 0x10000000>;
38 };
39
40 ahb {
41 compatible = "simple-bus";
42 #address-cells = <1>;
43 #size-cells = <1>;
44 ranges;
45
46 apb {
47 compatible = "simple-bus";
48 #address-cells = <1>;
49 #size-cells = <1>;
50 ranges;
51
52 aic: interrupt-controller@fffff000 {
53 #interrupt-cells = <2>;
54 compatible = "atmel,at91rm9200-aic";
55 interrupt-controller;
56 reg = <0xfffff000 0x200>;
57 };
58
59 ramc0: ramc@ffffe800 {
60 compatible = "atmel,at91sam9g45-ddramc";
61 reg = <0xffffe800 0x200>;
62 };
63
64 pmc: pmc@fffffc00 {
65 compatible = "atmel,at91rm9200-pmc";
66 reg = <0xfffffc00 0x100>;
67 };
68
69 rstc@fffffe00 {
70 compatible = "atmel,at91sam9g45-rstc";
71 reg = <0xfffffe00 0x10>;
72 };
73
74 pit: timer@fffffe30 {
75 compatible = "atmel,at91sam9260-pit";
76 reg = <0xfffffe30 0xf>;
77 interrupts = <1 4>;
78 };
79
80 shdwc@fffffe10 {
81 compatible = "atmel,at91sam9x5-shdwc";
82 reg = <0xfffffe10 0x10>;
83 };
84
85 tcb0: timer@f8008000 {
86 compatible = "atmel,at91sam9x5-tcb";
87 reg = <0xf8008000 0x100>;
88 interrupts = <17 4>;
89 };
90
91 tcb1: timer@f800c000 {
92 compatible = "atmel,at91sam9x5-tcb";
93 reg = <0xf800c000 0x100>;
94 interrupts = <17 4>;
95 };
96
97 dma: dma-controller@ffffec00 {
98 compatible = "atmel,at91sam9g45-dma";
99 reg = <0xffffec00 0x200>;
100 interrupts = <20 4>;
101 };
102
103 pioA: gpio@fffff400 {
104 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
105 reg = <0xfffff400 0x100>;
106 interrupts = <2 4>;
107 #gpio-cells = <2>;
108 gpio-controller;
109 interrupt-controller;
110 };
111
112 pioB: gpio@fffff600 {
113 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
114 reg = <0xfffff600 0x100>;
115 interrupts = <2 4>;
116 #gpio-cells = <2>;
117 gpio-controller;
118 interrupt-controller;
119 };
120
121 pioC: gpio@fffff800 {
122 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
123 reg = <0xfffff800 0x100>;
124 interrupts = <3 4>;
125 #gpio-cells = <2>;
126 gpio-controller;
127 interrupt-controller;
128 };
129
130 pioD: gpio@fffffa00 {
131 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
132 reg = <0xfffffa00 0x100>;
133 interrupts = <3 4>;
134 #gpio-cells = <2>;
135 gpio-controller;
136 interrupt-controller;
137 };
138
139 dbgu: serial@fffff200 {
140 compatible = "atmel,at91sam9260-usart";
141 reg = <0xfffff200 0x200>;
142 interrupts = <1 4>;
143 status = "disabled";
144 };
145
146 usart0: serial@f801c000 {
147 compatible = "atmel,at91sam9260-usart";
148 reg = <0xf801c000 0x4000>;
149 interrupts = <5 4>;
150 atmel,use-dma-rx;
151 atmel,use-dma-tx;
152 status = "disabled";
153 };
154
155 usart1: serial@f8020000 {
156 compatible = "atmel,at91sam9260-usart";
157 reg = <0xf8020000 0x4000>;
158 interrupts = <6 4>;
159 atmel,use-dma-rx;
160 atmel,use-dma-tx;
161 status = "disabled";
162 };
163
164 usart2: serial@f8024000 {
165 compatible = "atmel,at91sam9260-usart";
166 reg = <0xf8024000 0x4000>;
167 interrupts = <7 4>;
168 atmel,use-dma-rx;
169 atmel,use-dma-tx;
170 status = "disabled";
171 };
172
173 usart3: serial@f8028000 {
174 compatible = "atmel,at91sam9260-usart";
175 reg = <0xf8028000 0x4000>;
176 interrupts = <8 4>;
177 atmel,use-dma-rx;
178 atmel,use-dma-tx;
179 status = "disabled";
180 };
181 };
182
183 nand0: nand@40000000 {
184 compatible = "atmel,at91rm9200-nand";
185 #address-cells = <1>;
186 #size-cells = <1>;
187 reg = < 0x40000000 0x10000000
188 0xffffe000 0x00000600
189 0xffffe600 0x00000200
190 0x00100000 0x00100000
191 >;
192 atmel,nand-addr-offset = <21>;
193 atmel,nand-cmd-offset = <22>;
194 gpios = <&pioD 5 0
195 &pioD 4 0
196 0
197 >;
198 status = "disabled";
199 };
200
201 usb0: ohci@00500000 {
202 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
203 reg = <0x00500000 0x00100000>;
204 interrupts = <22 4>;
205 status = "disabled";
206 };
207 };
208
209 i2c@0 {
210 compatible = "i2c-gpio";
211 gpios = <&pioA 30 0 /* sda */
212 &pioA 31 0 /* scl */
213 >;
214 i2c-gpio,sda-open-drain;
215 i2c-gpio,scl-open-drain;
216 i2c-gpio,delay-us = <2>; /* ~100 kHz */
217 #address-cells = <1>;
218 #size-cells = <0>;
219 status = "disabled";
220 };
221};
diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts
new file mode 100644
index 000000000000..f4e43e38f3a1
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9n12ek.dts
@@ -0,0 +1,84 @@
1/*
2 * at91sam9n12ek.dts - Device Tree file for AT91SAM9N12-EK board
3 *
4 * Copyright (C) 2012 Atmel,
5 * 2012 Hong Xu <hong.xu@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/dts-v1/;
10/include/ "at91sam9n12.dtsi"
11
12/ {
13 model = "Atmel AT91SAM9N12-EK";
14 compatible = "atmel,at91sam9n12ek", "atmel,at91sam9n12", "atmel,at91sam9";
15
16 chosen {
17 bootargs = "mem=128M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2";
18 };
19
20 memory {
21 reg = <0x20000000 0x10000000>;
22 };
23
24 clocks {
25 #address-cells = <1>;
26 #size-cells = <1>;
27 ranges;
28
29 main_clock: clock@0 {
30 compatible = "atmel,osc", "fixed-clock";
31 clock-frequency = <16000000>;
32 };
33 };
34
35 ahb {
36 apb {
37 dbgu: serial@fffff200 {
38 status = "okay";
39 };
40 };
41
42 nand0: nand@40000000 {
43 nand-bus-width = <8>;
44 nand-ecc-mode = "soft";
45 nand-on-flash-bbt;
46 status = "okay";
47 };
48 };
49
50 leds {
51 compatible = "gpio-leds";
52
53 d8 {
54 label = "d8";
55 gpios = <&pioB 4 1>;
56 linux,default-trigger = "mmc0";
57 };
58
59 d9 {
60 label = "d6";
61 gpios = <&pioB 5 1>;
62 linux,default-trigger = "nand-disk";
63 };
64
65 d10 {
66 label = "d7";
67 gpios = <&pioB 6 0>;
68 linux,default-trigger = "heartbeat";
69 };
70 };
71
72 gpio_keys {
73 compatible = "gpio-keys";
74 #address-cells = <1>;
75 #size-cells = <0>;
76
77 enter {
78 label = "Enter";
79 gpios = <&pioB 4 1>;
80 linux,code = <28>;
81 gpio-key,wakeup;
82 };
83 };
84};
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index 70ab3a4e026f..6b3ef4339ae7 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -54,7 +54,6 @@
54 #interrupt-cells = <2>; 54 #interrupt-cells = <2>;
55 compatible = "atmel,at91rm9200-aic"; 55 compatible = "atmel,at91rm9200-aic";
56 interrupt-controller; 56 interrupt-controller;
57 interrupt-parent;
58 reg = <0xfffff000 0x200>; 57 reg = <0xfffff000 0x200>;
59 }; 58 };
60 59
@@ -191,6 +190,44 @@
191 interrupts = <27 4>; 190 interrupts = <27 4>;
192 status = "disabled"; 191 status = "disabled";
193 }; 192 };
193
194 adc0: adc@f804c000 {
195 compatible = "atmel,at91sam9260-adc";
196 reg = <0xf804c000 0x100>;
197 interrupts = <19 4>;
198 atmel,adc-use-external;
199 atmel,adc-channels-used = <0xffff>;
200 atmel,adc-vref = <3300>;
201 atmel,adc-num-channels = <12>;
202 atmel,adc-startup-time = <40>;
203 atmel,adc-channel-base = <0x50>;
204 atmel,adc-drdy-mask = <0x1000000>;
205 atmel,adc-status-register = <0x30>;
206 atmel,adc-trigger-register = <0xc0>;
207
208 trigger@0 {
209 trigger-name = "external-rising";
210 trigger-value = <0x1>;
211 trigger-external;
212 };
213
214 trigger@1 {
215 trigger-name = "external-falling";
216 trigger-value = <0x2>;
217 trigger-external;
218 };
219
220 trigger@2 {
221 trigger-name = "external-any";
222 trigger-value = <0x3>;
223 trigger-external;
224 };
225
226 trigger@3 {
227 trigger-name = "continuous";
228 trigger-value = <0x6>;
229 };
230 };
194 }; 231 };
195 232
196 nand0: nand@40000000 { 233 nand0: nand@40000000 {
diff --git a/arch/arm/boot/dts/db8500.dtsi b/arch/arm/boot/dts/db8500.dtsi
index d73dce645667..881bc3987844 100644
--- a/arch/arm/boot/dts/db8500.dtsi
+++ b/arch/arm/boot/dts/db8500.dtsi
@@ -24,7 +24,6 @@
24 #interrupt-cells = <3>; 24 #interrupt-cells = <3>;
25 #address-cells = <1>; 25 #address-cells = <1>;
26 interrupt-controller; 26 interrupt-controller;
27 interrupt-parent;
28 reg = <0xa0411000 0x1000>, 27 reg = <0xa0411000 0x1000>,
29 <0xa0410100 0x100>; 28 <0xa0410100 0x100>;
30 }; 29 };
@@ -56,83 +55,101 @@
56 55
57 gpio0: gpio@8012e000 { 56 gpio0: gpio@8012e000 {
58 compatible = "stericsson,db8500-gpio", 57 compatible = "stericsson,db8500-gpio",
59 "stmicroelectronics,nomadik-gpio"; 58 "st,nomadik-gpio";
60 reg = <0x8012e000 0x80>; 59 reg = <0x8012e000 0x80>;
61 interrupts = <0 119 0x4>; 60 interrupts = <0 119 0x4>;
62 supports-sleepmode; 61 supports-sleepmode;
63 gpio-controller; 62 gpio-controller;
63 #gpio-cells = <2>;
64 gpio-bank = <0>;
64 }; 65 };
65 66
66 gpio1: gpio@8012e080 { 67 gpio1: gpio@8012e080 {
67 compatible = "stericsson,db8500-gpio", 68 compatible = "stericsson,db8500-gpio",
68 "stmicroelectronics,nomadik-gpio"; 69 "st,nomadik-gpio";
69 reg = <0x8012e080 0x80>; 70 reg = <0x8012e080 0x80>;
70 interrupts = <0 120 0x4>; 71 interrupts = <0 120 0x4>;
71 supports-sleepmode; 72 supports-sleepmode;
72 gpio-controller; 73 gpio-controller;
74 #gpio-cells = <2>;
75 gpio-bank = <1>;
73 }; 76 };
74 77
75 gpio2: gpio@8000e000 { 78 gpio2: gpio@8000e000 {
76 compatible = "stericsson,db8500-gpio", 79 compatible = "stericsson,db8500-gpio",
77 "stmicroelectronics,nomadik-gpio"; 80 "st,nomadik-gpio";
78 reg = <0x8000e000 0x80>; 81 reg = <0x8000e000 0x80>;
79 interrupts = <0 121 0x4>; 82 interrupts = <0 121 0x4>;
80 supports-sleepmode; 83 supports-sleepmode;
81 gpio-controller; 84 gpio-controller;
85 #gpio-cells = <2>;
86 gpio-bank = <2>;
82 }; 87 };
83 88
84 gpio3: gpio@8000e080 { 89 gpio3: gpio@8000e080 {
85 compatible = "stericsson,db8500-gpio", 90 compatible = "stericsson,db8500-gpio",
86 "stmicroelectronics,nomadik-gpio"; 91 "st,nomadik-gpio";
87 reg = <0x8000e080 0x80>; 92 reg = <0x8000e080 0x80>;
88 interrupts = <0 122 0x4>; 93 interrupts = <0 122 0x4>;
89 supports-sleepmode; 94 supports-sleepmode;
90 gpio-controller; 95 gpio-controller;
96 #gpio-cells = <2>;
97 gpio-bank = <3>;
91 }; 98 };
92 99
93 gpio4: gpio@8000e100 { 100 gpio4: gpio@8000e100 {
94 compatible = "stericsson,db8500-gpio", 101 compatible = "stericsson,db8500-gpio",
95 "stmicroelectronics,nomadik-gpio"; 102 "st,nomadik-gpio";
96 reg = <0x8000e100 0x80>; 103 reg = <0x8000e100 0x80>;
97 interrupts = <0 123 0x4>; 104 interrupts = <0 123 0x4>;
98 supports-sleepmode; 105 supports-sleepmode;
99 gpio-controller; 106 gpio-controller;
107 #gpio-cells = <2>;
108 gpio-bank = <4>;
100 }; 109 };
101 110
102 gpio5: gpio@8000e180 { 111 gpio5: gpio@8000e180 {
103 compatible = "stericsson,db8500-gpio", 112 compatible = "stericsson,db8500-gpio",
104 "stmicroelectronics,nomadik-gpio"; 113 "st,nomadik-gpio";
105 reg = <0x8000e180 0x80>; 114 reg = <0x8000e180 0x80>;
106 interrupts = <0 124 0x4>; 115 interrupts = <0 124 0x4>;
107 supports-sleepmode; 116 supports-sleepmode;
108 gpio-controller; 117 gpio-controller;
118 #gpio-cells = <2>;
119 gpio-bank = <5>;
109 }; 120 };
110 121
111 gpio6: gpio@8011e000 { 122 gpio6: gpio@8011e000 {
112 compatible = "stericsson,db8500-gpio", 123 compatible = "stericsson,db8500-gpio",
113 "stmicroelectronics,nomadik-gpio"; 124 "st,nomadik-gpio";
114 reg = <0x8011e000 0x80>; 125 reg = <0x8011e000 0x80>;
115 interrupts = <0 125 0x4>; 126 interrupts = <0 125 0x4>;
116 supports-sleepmode; 127 supports-sleepmode;
117 gpio-controller; 128 gpio-controller;
129 #gpio-cells = <2>;
130 gpio-bank = <6>;
118 }; 131 };
119 132
120 gpio7: gpio@8011e080 { 133 gpio7: gpio@8011e080 {
121 compatible = "stericsson,db8500-gpio", 134 compatible = "stericsson,db8500-gpio",
122 "stmicroelectronics,nomadik-gpio"; 135 "st,nomadik-gpio";
123 reg = <0x8011e080 0x80>; 136 reg = <0x8011e080 0x80>;
124 interrupts = <0 126 0x4>; 137 interrupts = <0 126 0x4>;
125 supports-sleepmode; 138 supports-sleepmode;
126 gpio-controller; 139 gpio-controller;
140 #gpio-cells = <2>;
141 gpio-bank = <7>;
127 }; 142 };
128 143
129 gpio8: gpio@a03fe000 { 144 gpio8: gpio@a03fe000 {
130 compatible = "stericsson,db8500-gpio", 145 compatible = "stericsson,db8500-gpio",
131 "stmicroelectronics,nomadik-gpio"; 146 "st,nomadik-gpio";
132 reg = <0xa03fe000 0x80>; 147 reg = <0xa03fe000 0x80>;
133 interrupts = <0 127 0x4>; 148 interrupts = <0 127 0x4>;
134 supports-sleepmode; 149 supports-sleepmode;
135 gpio-controller; 150 gpio-controller;
151 #gpio-cells = <2>;
152 gpio-bank = <8>;
136 }; 153 };
137 154
138 usb@a03e0000 { 155 usb@a03e0000 {
@@ -154,7 +171,13 @@
154 reg = <0x80157000 0x1000>; 171 reg = <0x80157000 0x1000>;
155 interrupts = <46 47>; 172 interrupts = <46 47>;
156 #address-cells = <1>; 173 #address-cells = <1>;
157 #size-cells = <0>; 174 #size-cells = <1>;
175 ranges;
176
177 prcmu-timer-4@80157450 {
178 compatible = "stericsson,db8500-prcmu-timer-4";
179 reg = <0x80157450 0xC>;
180 };
158 181
159 ab8500@5 { 182 ab8500@5 {
160 compatible = "stericsson,ab8500"; 183 compatible = "stericsson,ab8500";
@@ -164,7 +187,7 @@
164 }; 187 };
165 188
166 i2c@80004000 { 189 i2c@80004000 {
167 compatible = "stericsson,db8500-i2c", "stmicroelectronics,nomadik-i2c"; 190 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c";
168 reg = <0x80004000 0x1000>; 191 reg = <0x80004000 0x1000>;
169 interrupts = <0 21 0x4>; 192 interrupts = <0 21 0x4>;
170 #address-cells = <1>; 193 #address-cells = <1>;
@@ -172,7 +195,7 @@
172 }; 195 };
173 196
174 i2c@80122000 { 197 i2c@80122000 {
175 compatible = "stericsson,db8500-i2c", "stmicroelectronics,nomadik-i2c"; 198 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c";
176 reg = <0x80122000 0x1000>; 199 reg = <0x80122000 0x1000>;
177 interrupts = <0 22 0x4>; 200 interrupts = <0 22 0x4>;
178 #address-cells = <1>; 201 #address-cells = <1>;
@@ -180,7 +203,7 @@
180 }; 203 };
181 204
182 i2c@80128000 { 205 i2c@80128000 {
183 compatible = "stericsson,db8500-i2c", "stmicroelectronics,nomadik-i2c"; 206 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c";
184 reg = <0x80128000 0x1000>; 207 reg = <0x80128000 0x1000>;
185 interrupts = <0 55 0x4>; 208 interrupts = <0 55 0x4>;
186 #address-cells = <1>; 209 #address-cells = <1>;
@@ -188,7 +211,7 @@
188 }; 211 };
189 212
190 i2c@80110000 { 213 i2c@80110000 {
191 compatible = "stericsson,db8500-i2c", "stmicroelectronics,nomadik-i2c"; 214 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c";
192 reg = <0x80110000 0x1000>; 215 reg = <0x80110000 0x1000>;
193 interrupts = <0 12 0x4>; 216 interrupts = <0 12 0x4>;
194 #address-cells = <1>; 217 #address-cells = <1>;
@@ -196,7 +219,7 @@
196 }; 219 };
197 220
198 i2c@8012a000 { 221 i2c@8012a000 {
199 compatible = "stericsson,db8500-i2c", "stmicroelectronics,nomadik-i2c"; 222 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c";
200 reg = <0x8012a000 0x1000>; 223 reg = <0x8012a000 0x1000>;
201 interrupts = <0 51 0x4>; 224 interrupts = <0 51 0x4>;
202 #address-cells = <1>; 225 #address-cells = <1>;
@@ -271,5 +294,14 @@
271 interrupts = <0 100 0x4>; 294 interrupts = <0 100 0x4>;
272 status = "disabled"; 295 status = "disabled";
273 }; 296 };
297
298 external-bus@50000000 {
299 compatible = "simple-bus";
300 reg = <0x50000000 0x4000000>;
301 #address-cells = <1>;
302 #size-cells = <1>;
303 ranges = <0 0x50000000 0x4000000>;
304 status = "disabled";
305 };
274 }; 306 };
275}; 307};
diff --git a/arch/arm/boot/dts/emev2-kzm9d.dts b/arch/arm/boot/dts/emev2-kzm9d.dts
new file mode 100644
index 000000000000..297e3baba71c
--- /dev/null
+++ b/arch/arm/boot/dts/emev2-kzm9d.dts
@@ -0,0 +1,26 @@
1/*
2 * Device Tree Source for the KZM9D board
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10/dts-v1/;
11
12/include/ "emev2.dtsi"
13
14/ {
15 model = "EMEV2 KZM9D Board";
16 compatible = "renesas,kzm9d", "renesas,emev2";
17
18 memory {
19 device_type = "memory";
20 reg = <0x40000000 0x8000000>;
21 };
22
23 chosen {
24 bootargs = "console=ttyS1,115200n81";
25 };
26};
diff --git a/arch/arm/boot/dts/emev2.dtsi b/arch/arm/boot/dts/emev2.dtsi
new file mode 100644
index 000000000000..eb504a6c0f4a
--- /dev/null
+++ b/arch/arm/boot/dts/emev2.dtsi
@@ -0,0 +1,63 @@
1/*
2 * Device Tree Source for the EMEV2 SoC
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11/include/ "skeleton.dtsi"
12
13/ {
14 compatible = "renesas,emev2";
15 interrupt-parent = <&gic>;
16
17 cpus {
18 cpu@0 {
19 compatible = "arm,cortex-a9";
20 };
21 cpu@1 {
22 compatible = "arm,cortex-a9";
23 };
24 };
25
26 gic: interrupt-controller@e0020000 {
27 compatible = "arm,cortex-a9-gic";
28 interrupt-controller;
29 #interrupt-cells = <3>;
30 reg = <0xe0028000 0x1000>,
31 <0xe0020000 0x0100>;
32 };
33
34 sti@e0180000 {
35 compatible = "renesas,em-sti";
36 reg = <0xe0180000 0x54>;
37 interrupts = <0 125 0>;
38 };
39
40 uart@e1020000 {
41 compatible = "renesas,em-uart";
42 reg = <0xe1020000 0x38>;
43 interrupts = <0 8 0>;
44 };
45
46 uart@e1030000 {
47 compatible = "renesas,em-uart";
48 reg = <0xe1030000 0x38>;
49 interrupts = <0 9 0>;
50 };
51
52 uart@e1040000 {
53 compatible = "renesas,em-uart";
54 reg = <0xe1040000 0x38>;
55 interrupts = <0 10 0>;
56 };
57
58 uart@e1050000 {
59 compatible = "renesas,em-uart";
60 reg = <0xe1050000 0x38>;
61 interrupts = <0 11 0>;
62 };
63};
diff --git a/arch/arm/boot/dts/ethernut5.dts b/arch/arm/boot/dts/ethernut5.dts
new file mode 100644
index 000000000000..1ea9d34460a4
--- /dev/null
+++ b/arch/arm/boot/dts/ethernut5.dts
@@ -0,0 +1,84 @@
1/*
2 * ethernut5.dts - Device Tree file for Ethernut 5 board
3 *
4 * Copyright (C) 2012 egnite GmbH <info@egnite.de>
5 *
6 * Licensed under GPLv2.
7 */
8/dts-v1/;
9/include/ "at91sam9260.dtsi"
10
11/ {
12 model = "Ethernut 5";
13 compatible = "egnite,ethernut5", "atmel,at91sam9260", "atmel,at91sam9";
14
15 chosen {
16 bootargs = "console=ttyS0,115200 root=/dev/mtdblock0 rw rootfstype=jffs2";
17 };
18
19 memory {
20 reg = <0x20000000 0x08000000>;
21 };
22
23 ahb {
24 apb {
25 dbgu: serial@fffff200 {
26 status = "okay";
27 };
28
29 usart0: serial@fffb0000 {
30 status = "okay";
31 };
32
33 usart1: serial@fffb4000 {
34 status = "okay";
35 };
36
37 macb0: ethernet@fffc4000 {
38 phy-mode = "rmii";
39 status = "okay";
40 };
41
42 usb1: gadget@fffa4000 {
43 atmel,vbus-gpio = <&pioC 5 0>;
44 status = "okay";
45 };
46 };
47
48 nand0: nand@40000000 {
49 nand-bus-width = <8>;
50 nand-ecc-mode = "soft";
51 nand-on-flash-bbt;
52 status = "okay";
53
54 gpios = <0
55 &pioC 14 0
56 0
57 >;
58
59 root@0 {
60 label = "root";
61 reg = <0x0 0x08000000>;
62 };
63
64 data@20000 {
65 label = "data";
66 reg = <0x08000000 0x38000000>;
67 };
68 };
69
70 usb0: ohci@00500000 {
71 num-ports = <2>;
72 status = "okay";
73 };
74 };
75
76 i2c@0 {
77 status = "okay";
78
79 pcf8563@50 {
80 compatible = "nxp,pcf8563";
81 reg = <0x51>;
82 };
83 };
84};
diff --git a/arch/arm/boot/dts/highbank.dts b/arch/arm/boot/dts/highbank.dts
index 37c0ff9c8b90..83e72294aefb 100644
--- a/arch/arm/boot/dts/highbank.dts
+++ b/arch/arm/boot/dts/highbank.dts
@@ -89,7 +89,6 @@
89 #size-cells = <0>; 89 #size-cells = <0>;
90 #address-cells = <1>; 90 #address-cells = <1>;
91 interrupt-controller; 91 interrupt-controller;
92 interrupt-parent;
93 reg = <0xfff11000 0x1000>, 92 reg = <0xfff11000 0x1000>,
94 <0xfff10100 0x100>; 93 <0xfff10100 0x100>;
95 }; 94 };
diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts
new file mode 100644
index 000000000000..dc09a735b04a
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-dns320.dts
@@ -0,0 +1,64 @@
1/dts-v1/;
2
3/include/ "kirkwood.dtsi"
4
5/ {
6 model = "D-Link DNS-320 NAS (Rev A1)";
7 compatible = "dlink,dns-320-a1", "dlink,dns-320", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x8000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200n8 earlyprintk";
16 };
17
18 ocp@f1000000 {
19 serial@12000 {
20 clock-frequency = <166666667>;
21 status = "okay";
22 };
23
24 serial@12100 {
25 clock-frequency = <166666667>;
26 status = "okay";
27 };
28
29 nand@3000000 {
30 status = "okay";
31
32 partition@0 {
33 label = "u-boot";
34 reg = <0x0000000 0x100000>;
35 read-only;
36 };
37
38 partition@100000 {
39 label = "uImage";
40 reg = <0x0100000 0x500000>;
41 };
42
43 partition@600000 {
44 label = "ramdisk";
45 reg = <0x0600000 0x500000>;
46 };
47
48 partition@b00000 {
49 label = "image";
50 reg = <0x0b00000 0x6600000>;
51 };
52
53 partition@7100000 {
54 label = "mini firmware";
55 reg = <0x7100000 0xa00000>;
56 };
57
58 partition@7b00000 {
59 label = "config";
60 reg = <0x7b00000 0x500000>;
61 };
62 };
63 };
64};
diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts
new file mode 100644
index 000000000000..c2a5562525d2
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-dns325.dts
@@ -0,0 +1,59 @@
1/dts-v1/;
2
3/include/ "kirkwood.dtsi"
4
5/ {
6 model = "D-Link DNS-325 NAS (Rev A1)";
7 compatible = "dlink,dns-325-a1", "dlink,dns-325", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x10000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200n8 earlyprintk";
16 };
17
18 ocp@f1000000 {
19 serial@12000 {
20 clock-frequency = <200000000>;
21 status = "okay";
22 };
23
24 nand@3000000 {
25 status = "okay";
26
27 partition@0 {
28 label = "u-boot";
29 reg = <0x0000000 0x100000>;
30 read-only;
31 };
32
33 partition@100000 {
34 label = "uImage";
35 reg = <0x0100000 0x500000>;
36 };
37
38 partition@600000 {
39 label = "ramdisk";
40 reg = <0x0600000 0x500000>;
41 };
42
43 partition@b00000 {
44 label = "image";
45 reg = <0x0b00000 0x6600000>;
46 };
47
48 partition@7100000 {
49 label = "mini firmware";
50 reg = <0x7100000 0xa00000>;
51 };
52
53 partition@7b00000 {
54 label = "config";
55 reg = <0x7b00000 0x500000>;
56 };
57 };
58 };
59};
diff --git a/arch/arm/boot/dts/kirkwood-ib62x0.dts b/arch/arm/boot/dts/kirkwood-ib62x0.dts
new file mode 100644
index 000000000000..ada0f0c23085
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-ib62x0.dts
@@ -0,0 +1,44 @@
1/dts-v1/;
2
3/include/ "kirkwood.dtsi"
4
5/ {
6 model = "RaidSonic ICY BOX IB-NAS62x0 (Rev B)";
7 compatible = "raidsonic,ib-nas6210-b", "raidsonic,ib-nas6220-b", "raidsonic,ib-nas6210", "raidsonic,ib-nas6220", "raidsonic,ib-nas62x0", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x10000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200n8 earlyprintk";
16 };
17
18 ocp@f1000000 {
19 serial@12000 {
20 clock-frequency = <200000000>;
21 status = "okay";
22 };
23
24 nand@3000000 {
25 status = "okay";
26
27 partition@0 {
28 label = "u-boot";
29 reg = <0x0000000 0x100000>;
30 };
31
32 partition@100000 {
33 label = "uImage";
34 reg = <0x0100000 0x600000>;
35 };
36
37 partition@700000 {
38 label = "root";
39 reg = <0x0700000 0xf900000>;
40 };
41
42 };
43 };
44};
diff --git a/arch/arm/boot/dts/kirkwood-iconnect.dts b/arch/arm/boot/dts/kirkwood-iconnect.dts
new file mode 100644
index 000000000000..1ba75d4adecc
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-iconnect.dts
@@ -0,0 +1,26 @@
1/dts-v1/;
2
3/include/ "kirkwood.dtsi"
4
5/ {
6 model = "Iomega Iconnect";
7 compatible = "iom,iconnect-1.1", "iom,iconnect", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
8
9 memory {
10 device_type = "memory";
11 reg = <0x00000000 0x10000000>;
12 };
13
14 chosen {
15 bootargs = "console=ttyS0,115200n8 earlyprintk mtdparts=orion_nand:0xc0000@0x0(uboot),0x20000@0xa0000(env),0x300000@0x100000(zImage),0x300000@0x540000(initrd),0x1f400000@0x980000(boot)";
16 linux,initrd-start = <0x4500040>;
17 linux,initrd-end = <0x4800000>;
18 };
19
20 ocp@f1000000 {
21 serial@12000 {
22 clock-frequency = <200000000>;
23 status = "ok";
24 };
25 };
26};
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index 3474ef890945..926528b81baa 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -5,7 +5,7 @@
5 5
6 ocp@f1000000 { 6 ocp@f1000000 {
7 compatible = "simple-bus"; 7 compatible = "simple-bus";
8 ranges = <0 0xf1000000 0x1000000>; 8 ranges = <0 0xf1000000 0x4000000>;
9 #address-cells = <1>; 9 #address-cells = <1>;
10 #size-cells = <1>; 10 #size-cells = <1>;
11 11
@@ -32,5 +32,18 @@
32 reg = <0x10300 0x20>; 32 reg = <0x10300 0x20>;
33 interrupts = <53>; 33 interrupts = <53>;
34 }; 34 };
35
36 nand@3000000 {
37 #address-cells = <1>;
38 #size-cells = <1>;
39 cle = <0>;
40 ale = <1>;
41 bank-width = <1>;
42 compatible = "mrvl,orion-nand";
43 reg = <0x3000000 0x400>;
44 chip-delay = <25>;
45 /* set partition map and/or chip-delay in board dts */
46 status = "disabled";
47 };
35 }; 48 };
36}; 49};
diff --git a/arch/arm/boot/dts/kizbox.dts b/arch/arm/boot/dts/kizbox.dts
new file mode 100644
index 000000000000..e8814fe0e277
--- /dev/null
+++ b/arch/arm/boot/dts/kizbox.dts
@@ -0,0 +1,138 @@
1/*
2 * kizbox.dts - Device Tree file for Overkiz Kizbox board
3 *
4 * Copyright (C) 2012 Boris BREZILLON <linux-arm@overkiz.com>
5 *
6 * Licensed under GPLv2.
7 */
8/dts-v1/;
9/include/ "at91sam9g20.dtsi"
10
11/ {
12
13 model = "Overkiz kizbox";
14 compatible = "overkiz,kizbox", "atmel,at91sam9g20", "atmel,at91sam9";
15
16 chosen {
17 bootargs = "panic=5 ubi.mtd=1 rootfstype=ubifs root=ubi0:root";
18 };
19
20 memory {
21 reg = <0x20000000 0x2000000>;
22 };
23
24 clocks {
25 #address-cells = <1>;
26 #size-cells = <1>;
27 ranges;
28
29 main_clock: clock@0 {
30 compatible = "atmel,osc", "fixed-clock";
31 clock-frequency = <18432000>;
32 };
33 };
34
35 ahb {
36 apb {
37 dbgu: serial@fffff200 {
38 status = "okay";
39 };
40
41 usart0: serial@fffb0000 {
42 status = "okay";
43 };
44
45 usart1: serial@fffb4000 {
46 status = "okay";
47 };
48
49 macb0: ethernet@fffc4000 {
50 phy-mode = "mii";
51 status = "okay";
52 };
53
54 };
55
56 nand0: nand@40000000 {
57 nand-bus-width = <8>;
58 nand-ecc-mode = "soft";
59 status = "okay";
60
61 bootloaderkernel@0 {
62 label = "bootloader-kernel";
63 reg = <0x0 0xc0000>;
64 };
65
66 ubi@c0000 {
67 label = "ubi";
68 reg = <0xc0000 0x7f40000>;
69 };
70
71 };
72
73 usb0: ohci@00500000 {
74 num-ports = <1>;
75 status = "okay";
76 };
77 };
78
79 i2c@0 {
80 status = "okay";
81
82 pcf8563@51 {
83 /* nxp pcf8563 rtc */
84 compatible = "nxp,pcf8563";
85 reg = <0x51>;
86 };
87
88 };
89
90 leds {
91 compatible = "gpio-leds";
92
93 led1g {
94 label = "led1:green";
95 gpios = <&pioB 0 1>;
96 linux,default-trigger = "none";
97 };
98
99 led1r {
100 label = "led1:red";
101 gpios = <&pioB 1 1>;
102 linux,default-trigger = "none";
103 };
104
105 led2g {
106 label = "led2:green";
107 gpios = <&pioB 2 1>;
108 linux,default-trigger = "none";
109 default-state = "on";
110 };
111
112 led2r {
113 label = "led2:red";
114 gpios = <&pioB 3 1>;
115 linux,default-trigger = "none";
116 };
117 };
118
119 gpio_keys {
120 compatible = "gpio-keys";
121 #address-cells = <1>;
122 #size-cells = <0>;
123
124 reset {
125 label = "reset";
126 gpios = <&pioB 30 1>;
127 linux,code = <0x100>;
128 gpio-key,wakeup;
129 };
130
131 mode {
132 label = "mode";
133 gpios = <&pioB 31 1>;
134 linux,code = <0x101>;
135 gpio-key,wakeup;
136 };
137 };
138}; \ No newline at end of file
diff --git a/arch/arm/boot/dts/lpc32xx.dtsi b/arch/arm/boot/dts/lpc32xx.dtsi
new file mode 100644
index 000000000000..2d696866f71c
--- /dev/null
+++ b/arch/arm/boot/dts/lpc32xx.dtsi
@@ -0,0 +1,292 @@
1/*
2 * NXP LPC32xx SoC
3 *
4 * Copyright 2012 Roland Stigge <stigge@antcom.de>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/include/ "skeleton.dtsi"
15
16/ {
17 compatible = "nxp,lpc3220";
18 interrupt-parent = <&mic>;
19
20 cpus {
21 cpu@0 {
22 compatible = "arm,arm926ejs";
23 };
24 };
25
26 ahb {
27 #address-cells = <1>;
28 #size-cells = <1>;
29 compatible = "simple-bus";
30 ranges = <0x20000000 0x20000000 0x30000000>;
31
32 /*
33 * Enable either SLC or MLC
34 */
35 slc: flash@20020000 {
36 compatible = "nxp,lpc3220-slc";
37 reg = <0x20020000 0x1000>;
38 status = "disable";
39 };
40
41 mlc: flash@200B0000 {
42 compatible = "nxp,lpc3220-mlc";
43 reg = <0x200B0000 0x1000>;
44 status = "disable";
45 };
46
47 dma@31000000 {
48 compatible = "arm,pl080", "arm,primecell";
49 reg = <0x31000000 0x1000>;
50 interrupts = <0x1c 0>;
51 };
52
53 /*
54 * Enable either ohci or usbd (gadget)!
55 */
56 ohci@31020000 {
57 compatible = "nxp,ohci-nxp", "usb-ohci";
58 reg = <0x31020000 0x300>;
59 interrupts = <0x3b 0>;
60 status = "disable";
61 };
62
63 usbd@31020000 {
64 compatible = "nxp,lpc3220-udc";
65 reg = <0x31020000 0x300>;
66 interrupts = <0x3d 0>, <0x3e 0>, <0x3c 0>, <0x3a 0>;
67 status = "disable";
68 };
69
70 clcd@31040000 {
71 compatible = "arm,pl110", "arm,primecell";
72 reg = <0x31040000 0x1000>;
73 interrupts = <0x0e 0>;
74 status = "disable";
75 };
76
77 mac: ethernet@31060000 {
78 compatible = "nxp,lpc-eth";
79 reg = <0x31060000 0x1000>;
80 interrupts = <0x1d 0>;
81 };
82
83 apb {
84 #address-cells = <1>;
85 #size-cells = <1>;
86 compatible = "simple-bus";
87 ranges = <0x20000000 0x20000000 0x30000000>;
88
89 ssp0: ssp@20084000 {
90 compatible = "arm,pl022", "arm,primecell";
91 reg = <0x20084000 0x1000>;
92 interrupts = <0x14 0>;
93 };
94
95 spi1: spi@20088000 {
96 compatible = "nxp,lpc3220-spi";
97 reg = <0x20088000 0x1000>;
98 };
99
100 ssp1: ssp@2008c000 {
101 compatible = "arm,pl022", "arm,primecell";
102 reg = <0x2008c000 0x1000>;
103 interrupts = <0x15 0>;
104 };
105
106 spi2: spi@20090000 {
107 compatible = "nxp,lpc3220-spi";
108 reg = <0x20090000 0x1000>;
109 };
110
111 i2s0: i2s@20094000 {
112 compatible = "nxp,lpc3220-i2s";
113 reg = <0x20094000 0x1000>;
114 };
115
116 sd@20098000 {
117 compatible = "arm,pl180", "arm,primecell";
118 reg = <0x20098000 0x1000>;
119 interrupts = <0x0f 0>, <0x0d 0>;
120 };
121
122 i2s1: i2s@2009C000 {
123 compatible = "nxp,lpc3220-i2s";
124 reg = <0x2009C000 0x1000>;
125 };
126
127 uart3: serial@40080000 {
128 compatible = "nxp,serial";
129 reg = <0x40080000 0x1000>;
130 };
131
132 uart4: serial@40088000 {
133 compatible = "nxp,serial";
134 reg = <0x40088000 0x1000>;
135 };
136
137 uart5: serial@40090000 {
138 compatible = "nxp,serial";
139 reg = <0x40090000 0x1000>;
140 };
141
142 uart6: serial@40098000 {
143 compatible = "nxp,serial";
144 reg = <0x40098000 0x1000>;
145 };
146
147 i2c1: i2c@400A0000 {
148 compatible = "nxp,pnx-i2c";
149 reg = <0x400A0000 0x100>;
150 interrupts = <0x33 0>;
151 #address-cells = <1>;
152 #size-cells = <0>;
153 pnx,timeout = <0x64>;
154 };
155
156 i2c2: i2c@400A8000 {
157 compatible = "nxp,pnx-i2c";
158 reg = <0x400A8000 0x100>;
159 interrupts = <0x32 0>;
160 #address-cells = <1>;
161 #size-cells = <0>;
162 pnx,timeout = <0x64>;
163 };
164
165 i2cusb: i2c@31020300 {
166 compatible = "nxp,pnx-i2c";
167 reg = <0x31020300 0x100>;
168 interrupts = <0x3f 0>;
169 #address-cells = <1>;
170 #size-cells = <0>;
171 pnx,timeout = <0x64>;
172 };
173 };
174
175 fab {
176 #address-cells = <1>;
177 #size-cells = <1>;
178 compatible = "simple-bus";
179 ranges = <0x20000000 0x20000000 0x30000000>;
180
181 /*
182 * MIC Interrupt controller includes:
183 * MIC @40008000
184 * SIC1 @4000C000
185 * SIC2 @40010000
186 */
187 mic: interrupt-controller@40008000 {
188 compatible = "nxp,lpc3220-mic";
189 interrupt-controller;
190 reg = <0x40008000 0xC000>;
191 #interrupt-cells = <2>;
192 };
193
194 uart1: serial@40014000 {
195 compatible = "nxp,serial";
196 reg = <0x40014000 0x1000>;
197 };
198
199 uart2: serial@40018000 {
200 compatible = "nxp,serial";
201 reg = <0x40018000 0x1000>;
202 };
203
204 uart7: serial@4001C000 {
205 compatible = "nxp,serial";
206 reg = <0x4001C000 0x1000>;
207 };
208
209 rtc@40024000 {
210 compatible = "nxp,lpc3220-rtc";
211 reg = <0x40024000 0x1000>;
212 interrupts = <0x34 0>;
213 };
214
215 gpio: gpio@40028000 {
216 compatible = "nxp,lpc3220-gpio";
217 reg = <0x40028000 0x1000>;
218 /* create a private address space for enumeration */
219 #address-cells = <1>;
220 #size-cells = <0>;
221
222 gpio_p0: gpio-bank@0 {
223 gpio-controller;
224 #gpio-cells = <2>;
225 reg = <0>;
226 };
227
228 gpio_p1: gpio-bank@1 {
229 gpio-controller;
230 #gpio-cells = <2>;
231 reg = <1>;
232 };
233
234 gpio_p2: gpio-bank@2 {
235 gpio-controller;
236 #gpio-cells = <2>;
237 reg = <2>;
238 };
239
240 gpio_p3: gpio-bank@3 {
241 gpio-controller;
242 #gpio-cells = <2>;
243 reg = <3>;
244 };
245
246 gpi_p3: gpio-bank@4 {
247 gpio-controller;
248 #gpio-cells = <2>;
249 reg = <4>;
250 };
251
252 gpo_p3: gpio-bank@5 {
253 gpio-controller;
254 #gpio-cells = <2>;
255 reg = <5>;
256 };
257 };
258
259 watchdog@4003C000 {
260 compatible = "nxp,pnx4008-wdt";
261 reg = <0x4003C000 0x1000>;
262 };
263
264 /*
265 * TSC vs. ADC: Since those two share the same
266 * hardware, you need to choose from one of the
267 * following two and do 'status = "okay";' for one of
268 * them
269 */
270
271 adc@40048000 {
272 compatible = "nxp,lpc3220-adc";
273 reg = <0x40048000 0x1000>;
274 interrupts = <0x27 0>;
275 status = "disable";
276 };
277
278 tsc@40048000 {
279 compatible = "nxp,lpc3220-tsc";
280 reg = <0x40048000 0x1000>;
281 interrupts = <0x27 0>;
282 status = "disable";
283 };
284
285 key@40050000 {
286 compatible = "nxp,lpc3220-key";
287 reg = <0x40050000 0x1000>;
288 };
289
290 };
291 };
292};
diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts
new file mode 100644
index 000000000000..153a4b2d12b5
--- /dev/null
+++ b/arch/arm/boot/dts/mmp2-brownstone.dts
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2012 Marvell Technology Group Ltd.
3 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9
10/dts-v1/;
11/include/ "mmp2.dtsi"
12
13/ {
14 model = "Marvell MMP2 Aspenite Development Board";
15 compatible = "mrvl,mmp2-brownstone", "mrvl,mmp2";
16
17 chosen {
18 bootargs = "console=ttyS2,38400 root=/dev/nfs nfsroot=192.168.1.100:/nfsroot/ ip=192.168.1.101:192.168.1.100::255.255.255.0::eth0:on";
19 };
20
21 memory {
22 reg = <0x00000000 0x04000000>;
23 };
24
25 soc {
26 apb@d4000000 {
27 uart3: uart@d4018000 {
28 status = "okay";
29 };
30 twsi1: i2c@d4011000 {
31 status = "okay";
32 };
33 rtc: rtc@d4010000 {
34 status = "okay";
35 };
36 };
37 };
38};
diff --git a/arch/arm/boot/dts/mmp2.dtsi b/arch/arm/boot/dts/mmp2.dtsi
new file mode 100644
index 000000000000..80f74e256408
--- /dev/null
+++ b/arch/arm/boot/dts/mmp2.dtsi
@@ -0,0 +1,220 @@
1/*
2 * Copyright (C) 2012 Marvell Technology Group Ltd.
3 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9
10/include/ "skeleton.dtsi"
11
12/ {
13 aliases {
14 serial0 = &uart1;
15 serial1 = &uart2;
16 serial2 = &uart3;
17 serial3 = &uart4;
18 i2c0 = &twsi1;
19 i2c1 = &twsi2;
20 };
21
22 soc {
23 #address-cells = <1>;
24 #size-cells = <1>;
25 compatible = "simple-bus";
26 interrupt-parent = <&intc>;
27 ranges;
28
29 axi@d4200000 { /* AXI */
30 compatible = "mrvl,axi-bus", "simple-bus";
31 #address-cells = <1>;
32 #size-cells = <1>;
33 reg = <0xd4200000 0x00200000>;
34 ranges;
35
36 intc: interrupt-controller@d4282000 {
37 compatible = "mrvl,mmp2-intc";
38 interrupt-controller;
39 #interrupt-cells = <1>;
40 reg = <0xd4282000 0x1000>;
41 mrvl,intc-nr-irqs = <64>;
42 };
43
44 intcmux4@d4282150 {
45 compatible = "mrvl,mmp2-mux-intc";
46 interrupts = <4>;
47 interrupt-controller;
48 #interrupt-cells = <1>;
49 reg = <0x150 0x4>, <0x168 0x4>;
50 reg-names = "mux status", "mux mask";
51 mrvl,intc-nr-irqs = <2>;
52 };
53
54 intcmux5: interrupt-controller@d4282154 {
55 compatible = "mrvl,mmp2-mux-intc";
56 interrupts = <5>;
57 interrupt-controller;
58 #interrupt-cells = <1>;
59 reg = <0x154 0x4>, <0x16c 0x4>;
60 reg-names = "mux status", "mux mask";
61 mrvl,intc-nr-irqs = <2>;
62 mrvl,clr-mfp-irq = <1>;
63 };
64
65 intcmux9: interrupt-controller@d4282180 {
66 compatible = "mrvl,mmp2-mux-intc";
67 interrupts = <9>;
68 interrupt-controller;
69 #interrupt-cells = <1>;
70 reg = <0x180 0x4>, <0x17c 0x4>;
71 reg-names = "mux status", "mux mask";
72 mrvl,intc-nr-irqs = <3>;
73 };
74
75 intcmux17: interrupt-controller@d4282158 {
76 compatible = "mrvl,mmp2-mux-intc";
77 interrupts = <17>;
78 interrupt-controller;
79 #interrupt-cells = <1>;
80 reg = <0x158 0x4>, <0x170 0x4>;
81 reg-names = "mux status", "mux mask";
82 mrvl,intc-nr-irqs = <5>;
83 };
84
85 intcmux35: interrupt-controller@d428215c {
86 compatible = "mrvl,mmp2-mux-intc";
87 interrupts = <35>;
88 interrupt-controller;
89 #interrupt-cells = <1>;
90 reg = <0x15c 0x4>, <0x174 0x4>;
91 reg-names = "mux status", "mux mask";
92 mrvl,intc-nr-irqs = <15>;
93 };
94
95 intcmux51: interrupt-controller@d4282160 {
96 compatible = "mrvl,mmp2-mux-intc";
97 interrupts = <51>;
98 interrupt-controller;
99 #interrupt-cells = <1>;
100 reg = <0x160 0x4>, <0x178 0x4>;
101 reg-names = "mux status", "mux mask";
102 mrvl,intc-nr-irqs = <2>;
103 };
104
105 intcmux55: interrupt-controller@d4282188 {
106 compatible = "mrvl,mmp2-mux-intc";
107 interrupts = <55>;
108 interrupt-controller;
109 #interrupt-cells = <1>;
110 reg = <0x188 0x4>, <0x184 0x4>;
111 reg-names = "mux status", "mux mask";
112 mrvl,intc-nr-irqs = <2>;
113 };
114 };
115
116 apb@d4000000 { /* APB */
117 compatible = "mrvl,apb-bus", "simple-bus";
118 #address-cells = <1>;
119 #size-cells = <1>;
120 reg = <0xd4000000 0x00200000>;
121 ranges;
122
123 timer0: timer@d4014000 {
124 compatible = "mrvl,mmp-timer";
125 reg = <0xd4014000 0x100>;
126 interrupts = <13>;
127 };
128
129 uart1: uart@d4030000 {
130 compatible = "mrvl,mmp-uart";
131 reg = <0xd4030000 0x1000>;
132 interrupts = <27>;
133 status = "disabled";
134 };
135
136 uart2: uart@d4017000 {
137 compatible = "mrvl,mmp-uart";
138 reg = <0xd4017000 0x1000>;
139 interrupts = <28>;
140 status = "disabled";
141 };
142
143 uart3: uart@d4018000 {
144 compatible = "mrvl,mmp-uart";
145 reg = <0xd4018000 0x1000>;
146 interrupts = <24>;
147 status = "disabled";
148 };
149
150 uart4: uart@d4016000 {
151 compatible = "mrvl,mmp-uart";
152 reg = <0xd4016000 0x1000>;
153 interrupts = <46>;
154 status = "disabled";
155 };
156
157 gpio@d4019000 {
158 compatible = "mrvl,mmp-gpio";
159 #address-cells = <1>;
160 #size-cells = <1>;
161 reg = <0xd4019000 0x1000>;
162 gpio-controller;
163 #gpio-cells = <2>;
164 interrupts = <49>;
165 interrupt-names = "gpio_mux";
166 interrupt-controller;
167 #interrupt-cells = <1>;
168 ranges;
169
170 gcb0: gpio@d4019000 {
171 reg = <0xd4019000 0x4>;
172 };
173
174 gcb1: gpio@d4019004 {
175 reg = <0xd4019004 0x4>;
176 };
177
178 gcb2: gpio@d4019008 {
179 reg = <0xd4019008 0x4>;
180 };
181
182 gcb3: gpio@d4019100 {
183 reg = <0xd4019100 0x4>;
184 };
185
186 gcb4: gpio@d4019104 {
187 reg = <0xd4019104 0x4>;
188 };
189
190 gcb5: gpio@d4019108 {
191 reg = <0xd4019108 0x4>;
192 };
193 };
194
195 twsi1: i2c@d4011000 {
196 compatible = "mrvl,mmp-twsi";
197 reg = <0xd4011000 0x1000>;
198 interrupts = <7>;
199 mrvl,i2c-fast-mode;
200 status = "disabled";
201 };
202
203 twsi2: i2c@d4025000 {
204 compatible = "mrvl,mmp-twsi";
205 reg = <0xd4025000 0x1000>;
206 interrupts = <58>;
207 status = "disabled";
208 };
209
210 rtc: rtc@d4010000 {
211 compatible = "mrvl,mmp-rtc";
212 reg = <0xd4010000 0x1000>;
213 interrupts = <1 0>;
214 interrupt-names = "rtc 1Hz", "rtc alarm";
215 interrupt-parent = <&intcmux5>;
216 status = "disabled";
217 };
218 };
219 };
220};
diff --git a/arch/arm/boot/dts/msm8660-surf.dts b/arch/arm/boot/dts/msm8660-surf.dts
index 15ded0deaa79..45bc4bb04e57 100644
--- a/arch/arm/boot/dts/msm8660-surf.dts
+++ b/arch/arm/boot/dts/msm8660-surf.dts
@@ -10,7 +10,7 @@
10 intc: interrupt-controller@02080000 { 10 intc: interrupt-controller@02080000 {
11 compatible = "qcom,msm-8660-qgic"; 11 compatible = "qcom,msm-8660-qgic";
12 interrupt-controller; 12 interrupt-controller;
13 #interrupt-cells = <1>; 13 #interrupt-cells = <3>;
14 reg = < 0x02080000 0x1000 >, 14 reg = < 0x02080000 0x1000 >,
15 < 0x02081000 0x1000 >; 15 < 0x02081000 0x1000 >;
16 }; 16 };
@@ -19,6 +19,6 @@
19 compatible = "qcom,msm-hsuart", "qcom,msm-uart"; 19 compatible = "qcom,msm-hsuart", "qcom,msm-uart";
20 reg = <0x19c40000 0x1000>, 20 reg = <0x19c40000 0x1000>,
21 <0x19c00000 0x1000>; 21 <0x19c00000 0x1000>;
22 interrupts = <195>; 22 interrupts = <0 195 0x0>;
23 }; 23 };
24}; 24};
diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
index 9f72cd4cf308..8c756be4d7ad 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -18,3 +18,52 @@
18 reg = <0x80000000 0x20000000>; /* 512 MB */ 18 reg = <0x80000000 0x20000000>; /* 512 MB */
19 }; 19 };
20}; 20};
21
22&i2c1 {
23 clock-frequency = <2600000>;
24
25 twl: twl@48 {
26 reg = <0x48>;
27 interrupts = <7>; /* SYS_NIRQ cascaded to intc */
28 interrupt-parent = <&intc>;
29
30 vsim: regulator@10 {
31 compatible = "ti,twl4030-vsim";
32 regulator-min-microvolt = <1800000>;
33 regulator-max-microvolt = <3000000>;
34 };
35 };
36};
37
38/include/ "twl4030.dtsi"
39
40&i2c2 {
41 clock-frequency = <400000>;
42};
43
44&i2c3 {
45 clock-frequency = <100000>;
46
47 /*
48 * Display monitor features are burnt in the EEPROM
49 * as EDID data.
50 */
51 eeprom@50 {
52 compatible = "ti,eeprom";
53 reg = <0x50>;
54 };
55};
56
57&mmc1 {
58 vmmc-supply = <&vmmc1>;
59 vmmc_aux-supply = <&vsim>;
60 ti,bus-width = <8>;
61};
62
63&mmc2 {
64 status = "disable";
65};
66
67&mmc3 {
68 status = "disable";
69};
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index c6121357c1eb..99474fa5fac4 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -69,6 +69,60 @@
69 reg = <0x48200000 0x1000>; 69 reg = <0x48200000 0x1000>;
70 }; 70 };
71 71
72 gpio1: gpio@48310000 {
73 compatible = "ti,omap3-gpio";
74 ti,hwmods = "gpio1";
75 gpio-controller;
76 #gpio-cells = <2>;
77 interrupt-controller;
78 #interrupt-cells = <1>;
79 };
80
81 gpio2: gpio@49050000 {
82 compatible = "ti,omap3-gpio";
83 ti,hwmods = "gpio2";
84 gpio-controller;
85 #gpio-cells = <2>;
86 interrupt-controller;
87 #interrupt-cells = <1>;
88 };
89
90 gpio3: gpio@49052000 {
91 compatible = "ti,omap3-gpio";
92 ti,hwmods = "gpio3";
93 gpio-controller;
94 #gpio-cells = <2>;
95 interrupt-controller;
96 #interrupt-cells = <1>;
97 };
98
99 gpio4: gpio@49054000 {
100 compatible = "ti,omap3-gpio";
101 ti,hwmods = "gpio4";
102 gpio-controller;
103 #gpio-cells = <2>;
104 interrupt-controller;
105 #interrupt-cells = <1>;
106 };
107
108 gpio5: gpio@49056000 {
109 compatible = "ti,omap3-gpio";
110 ti,hwmods = "gpio5";
111 gpio-controller;
112 #gpio-cells = <2>;
113 interrupt-controller;
114 #interrupt-cells = <1>;
115 };
116
117 gpio6: gpio@49058000 {
118 compatible = "ti,omap3-gpio";
119 ti,hwmods = "gpio6";
120 gpio-controller;
121 #gpio-cells = <2>;
122 interrupt-controller;
123 #interrupt-cells = <1>;
124 };
125
72 uart1: serial@4806a000 { 126 uart1: serial@4806a000 {
73 compatible = "ti,omap3-uart"; 127 compatible = "ti,omap3-uart";
74 ti,hwmods = "uart1"; 128 ti,hwmods = "uart1";
@@ -113,5 +167,53 @@
113 #size-cells = <0>; 167 #size-cells = <0>;
114 ti,hwmods = "i2c3"; 168 ti,hwmods = "i2c3";
115 }; 169 };
170
171 mcspi1: spi@48098000 {
172 compatible = "ti,omap2-mcspi";
173 #address-cells = <1>;
174 #size-cells = <0>;
175 ti,hwmods = "mcspi1";
176 ti,spi-num-cs = <4>;
177 };
178
179 mcspi2: spi@4809a000 {
180 compatible = "ti,omap2-mcspi";
181 #address-cells = <1>;
182 #size-cells = <0>;
183 ti,hwmods = "mcspi2";
184 ti,spi-num-cs = <2>;
185 };
186
187 mcspi3: spi@480b8000 {
188 compatible = "ti,omap2-mcspi";
189 #address-cells = <1>;
190 #size-cells = <0>;
191 ti,hwmods = "mcspi3";
192 ti,spi-num-cs = <2>;
193 };
194
195 mcspi4: spi@480ba000 {
196 compatible = "ti,omap2-mcspi";
197 #address-cells = <1>;
198 #size-cells = <0>;
199 ti,hwmods = "mcspi4";
200 ti,spi-num-cs = <1>;
201 };
202
203 mmc1: mmc@4809c000 {
204 compatible = "ti,omap3-hsmmc";
205 ti,hwmods = "mmc1";
206 ti,dual-volt;
207 };
208
209 mmc2: mmc@480b4000 {
210 compatible = "ti,omap3-hsmmc";
211 ti,hwmods = "mmc2";
212 };
213
214 mmc3: mmc@480ad000 {
215 compatible = "ti,omap3-hsmmc";
216 ti,hwmods = "mmc3";
217 };
116 }; 218 };
117}; 219};
diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index 9755ad5917f8..e671361bc791 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -17,4 +17,75 @@
17 device_type = "memory"; 17 device_type = "memory";
18 reg = <0x80000000 0x40000000>; /* 1 GB */ 18 reg = <0x80000000 0x40000000>; /* 1 GB */
19 }; 19 };
20
21 leds {
22 compatible = "gpio-leds";
23 heartbeat {
24 label = "pandaboard::status1";
25 gpios = <&gpio1 7 0>;
26 linux,default-trigger = "heartbeat";
27 };
28
29 mmc {
30 label = "pandaboard::status2";
31 gpios = <&gpio1 8 0>;
32 linux,default-trigger = "mmc0";
33 };
34 };
35};
36
37&i2c1 {
38 clock-frequency = <400000>;
39
40 twl: twl@48 {
41 reg = <0x48>;
42 /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
43 interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
44 interrupt-parent = <&gic>;
45 };
46};
47
48/include/ "twl6030.dtsi"
49
50&i2c2 {
51 clock-frequency = <400000>;
52};
53
54&i2c3 {
55 clock-frequency = <100000>;
56
57 /*
58 * Display monitor features are burnt in their EEPROM as EDID data.
59 * The EEPROM is connected as I2C slave device.
60 */
61 eeprom@50 {
62 compatible = "ti,eeprom";
63 reg = <0x50>;
64 };
65};
66
67&i2c4 {
68 clock-frequency = <400000>;
69};
70
71&mmc1 {
72 vmmc-supply = <&vmmc>;
73 ti,bus-width = <8>;
74};
75
76&mmc2 {
77 status = "disable";
78};
79
80&mmc3 {
81 status = "disable";
82};
83
84&mmc4 {
85 status = "disable";
86};
87
88&mmc5 {
89 ti,non-removable;
90 ti,bus-width = <4>;
20}; 91};
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 63c6b2b2bf42..e5eeb6f9c6e6 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -17,4 +17,144 @@
17 device_type = "memory"; 17 device_type = "memory";
18 reg = <0x80000000 0x40000000>; /* 1 GB */ 18 reg = <0x80000000 0x40000000>; /* 1 GB */
19 }; 19 };
20
21 vdd_eth: fixedregulator@0 {
22 compatible = "regulator-fixed";
23 regulator-name = "VDD_ETH";
24 regulator-min-microvolt = <3300000>;
25 regulator-max-microvolt = <3300000>;
26 gpio = <&gpio2 16 0>; /* gpio line 48 */
27 enable-active-high;
28 regulator-boot-on;
29 };
30
31 leds {
32 compatible = "gpio-leds";
33 debug0 {
34 label = "omap4:green:debug0";
35 gpios = <&gpio2 29 0>; /* 61 */
36 };
37
38 debug1 {
39 label = "omap4:green:debug1";
40 gpios = <&gpio1 30 0>; /* 30 */
41 };
42
43 debug2 {
44 label = "omap4:green:debug2";
45 gpios = <&gpio1 7 0>; /* 7 */
46 };
47
48 debug3 {
49 label = "omap4:green:debug3";
50 gpios = <&gpio1 8 0>; /* 8 */
51 };
52
53 debug4 {
54 label = "omap4:green:debug4";
55 gpios = <&gpio2 18 0>; /* 50 */
56 };
57
58 user1 {
59 label = "omap4:blue:user";
60 gpios = <&gpio6 9 0>; /* 169 */
61 };
62
63 user2 {
64 label = "omap4:red:user";
65 gpios = <&gpio6 10 0>; /* 170 */
66 };
67
68 user3 {
69 label = "omap4:green:user";
70 gpios = <&gpio5 11 0>; /* 139 */
71 };
72 };
73};
74
75&i2c1 {
76 clock-frequency = <400000>;
77
78 twl: twl@48 {
79 reg = <0x48>;
80 /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
81 interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
82 interrupt-parent = <&gic>;
83 };
84};
85
86/include/ "twl6030.dtsi"
87
88&i2c2 {
89 clock-frequency = <400000>;
90};
91
92&i2c3 {
93 clock-frequency = <400000>;
94
95 /*
96 * Temperature Sensor
97 * http://www.ti.com/lit/ds/symlink/tmp105.pdf
98 */
99 tmp105@48 {
100 compatible = "ti,tmp105";
101 reg = <0x48>;
102 };
103
104 /*
105 * Ambient Light Sensor
106 * http://www.rohm.com/products/databook/sensor/pdf/bh1780gli-e.pdf
107 */
108 bh1780@29 {
109 compatible = "rohm,bh1780";
110 reg = <0x29>;
111 };
112};
113
114&i2c4 {
115 clock-frequency = <400000>;
116
117 /*
118 * 3-Axis Digital Compass
119 * http://www.sparkfun.com/datasheets/Sensors/Magneto/HMC5843.pdf
120 */
121 hmc5843@1e {
122 compatible = "honeywell,hmc5843";
123 reg = <0x1e>;
124 };
125};
126
127&mcspi1 {
128 eth@0 {
129 compatible = "ks8851";
130 spi-max-frequency = <24000000>;
131 reg = <0>;
132 interrupt-parent = <&gpio2>;
133 interrupts = <2>; /* gpio line 34 */
134 vdd-supply = <&vdd_eth>;
135 };
136};
137
138&mmc1 {
139 vmmc-supply = <&vmmc>;
140 ti,bus-width = <8>;
141};
142
143&mmc2 {
144 vmmc-supply = <&vaux1>;
145 ti,bus-width = <8>;
146 ti,non-removable;
147};
148
149&mmc3 {
150 status = "disable";
151};
152
153&mmc4 {
154 status = "disable";
155};
156
157&mmc5 {
158 ti,bus-width = <4>;
159 ti,non-removable;
20}; 160};
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 3d35559e77bc..359c4979c8aa 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -104,6 +104,60 @@
104 <0x48240100 0x0100>; 104 <0x48240100 0x0100>;
105 }; 105 };
106 106
107 gpio1: gpio@4a310000 {
108 compatible = "ti,omap4-gpio";
109 ti,hwmods = "gpio1";
110 gpio-controller;
111 #gpio-cells = <2>;
112 interrupt-controller;
113 #interrupt-cells = <1>;
114 };
115
116 gpio2: gpio@48055000 {
117 compatible = "ti,omap4-gpio";
118 ti,hwmods = "gpio2";
119 gpio-controller;
120 #gpio-cells = <2>;
121 interrupt-controller;
122 #interrupt-cells = <1>;
123 };
124
125 gpio3: gpio@48057000 {
126 compatible = "ti,omap4-gpio";
127 ti,hwmods = "gpio3";
128 gpio-controller;
129 #gpio-cells = <2>;
130 interrupt-controller;
131 #interrupt-cells = <1>;
132 };
133
134 gpio4: gpio@48059000 {
135 compatible = "ti,omap4-gpio";
136 ti,hwmods = "gpio4";
137 gpio-controller;
138 #gpio-cells = <2>;
139 interrupt-controller;
140 #interrupt-cells = <1>;
141 };
142
143 gpio5: gpio@4805b000 {
144 compatible = "ti,omap4-gpio";
145 ti,hwmods = "gpio5";
146 gpio-controller;
147 #gpio-cells = <2>;
148 interrupt-controller;
149 #interrupt-cells = <1>;
150 };
151
152 gpio6: gpio@4805d000 {
153 compatible = "ti,omap4-gpio";
154 ti,hwmods = "gpio6";
155 gpio-controller;
156 #gpio-cells = <2>;
157 interrupt-controller;
158 #interrupt-cells = <1>;
159 };
160
107 uart1: serial@4806a000 { 161 uart1: serial@4806a000 {
108 compatible = "ti,omap4-uart"; 162 compatible = "ti,omap4-uart";
109 ti,hwmods = "uart1"; 163 ti,hwmods = "uart1";
@@ -155,5 +209,68 @@
155 #size-cells = <0>; 209 #size-cells = <0>;
156 ti,hwmods = "i2c4"; 210 ti,hwmods = "i2c4";
157 }; 211 };
212
213 mcspi1: spi@48098000 {
214 compatible = "ti,omap4-mcspi";
215 #address-cells = <1>;
216 #size-cells = <0>;
217 ti,hwmods = "mcspi1";
218 ti,spi-num-cs = <4>;
219 };
220
221 mcspi2: spi@4809a000 {
222 compatible = "ti,omap4-mcspi";
223 #address-cells = <1>;
224 #size-cells = <0>;
225 ti,hwmods = "mcspi2";
226 ti,spi-num-cs = <2>;
227 };
228
229 mcspi3: spi@480b8000 {
230 compatible = "ti,omap4-mcspi";
231 #address-cells = <1>;
232 #size-cells = <0>;
233 ti,hwmods = "mcspi3";
234 ti,spi-num-cs = <2>;
235 };
236
237 mcspi4: spi@480ba000 {
238 compatible = "ti,omap4-mcspi";
239 #address-cells = <1>;
240 #size-cells = <0>;
241 ti,hwmods = "mcspi4";
242 ti,spi-num-cs = <1>;
243 };
244
245 mmc1: mmc@4809c000 {
246 compatible = "ti,omap4-hsmmc";
247 ti,hwmods = "mmc1";
248 ti,dual-volt;
249 ti,needs-special-reset;
250 };
251
252 mmc2: mmc@480b4000 {
253 compatible = "ti,omap4-hsmmc";
254 ti,hwmods = "mmc2";
255 ti,needs-special-reset;
256 };
257
258 mmc3: mmc@480ad000 {
259 compatible = "ti,omap4-hsmmc";
260 ti,hwmods = "mmc3";
261 ti,needs-special-reset;
262 };
263
264 mmc4: mmc@480d1000 {
265 compatible = "ti,omap4-hsmmc";
266 ti,hwmods = "mmc4";
267 ti,needs-special-reset;
268 };
269
270 mmc5: mmc@480d5000 {
271 compatible = "ti,omap4-hsmmc";
272 ti,hwmods = "mmc5";
273 ti,needs-special-reset;
274 };
158 }; 275 };
159}; 276};
diff --git a/arch/arm/boot/dts/phy3250.dts b/arch/arm/boot/dts/phy3250.dts
new file mode 100644
index 000000000000..0167e86314c0
--- /dev/null
+++ b/arch/arm/boot/dts/phy3250.dts
@@ -0,0 +1,145 @@
1/*
2 * PHYTEC phyCORE-LPC3250 board
3 *
4 * Copyright 2012 Roland Stigge <stigge@antcom.de>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/dts-v1/;
15/include/ "lpc32xx.dtsi"
16
17/ {
18 model = "PHYTEC phyCORE-LPC3250 board based on NXP LPC3250";
19 compatible = "phytec,phy3250", "nxp,lpc3250";
20 #address-cells = <1>;
21 #size-cells = <1>;
22
23 memory {
24 device_type = "memory";
25 reg = <0 0x4000000>;
26 };
27
28 ahb {
29 mac: ethernet@31060000 {
30 phy-mode = "rmii";
31 use-iram;
32 };
33
34 /* Here, choose exactly one from: ohci, usbd */
35 ohci@31020000 {
36 transceiver = <&isp1301>;
37 status = "okay";
38 };
39
40/*
41 usbd@31020000 {
42 transceiver = <&isp1301>;
43 status = "okay";
44 };
45*/
46
47 clcd@31040000 {
48 status = "okay";
49 };
50
51 /* 64MB Flash via SLC NAND controller */
52 slc: flash@20020000 {
53 status = "okay";
54 #address-cells = <1>;
55 #size-cells = <1>;
56
57 mtd0@00000000 {
58 label = "phy3250-boot";
59 reg = <0x00000000 0x00064000>;
60 read-only;
61 };
62
63 mtd1@00064000 {
64 label = "phy3250-uboot";
65 reg = <0x00064000 0x00190000>;
66 read-only;
67 };
68
69 mtd2@001f4000 {
70 label = "phy3250-ubt-prms";
71 reg = <0x001f4000 0x00010000>;
72 };
73
74 mtd3@00204000 {
75 label = "phy3250-kernel";
76 reg = <0x00204000 0x00400000>;
77 };
78
79 mtd4@00604000 {
80 label = "phy3250-rootfs";
81 reg = <0x00604000 0x039fc000>;
82 };
83 };
84
85 apb {
86 i2c1: i2c@400A0000 {
87 clock-frequency = <100000>;
88
89 pcf8563: rtc@51 {
90 compatible = "nxp,pcf8563";
91 reg = <0x51>;
92 };
93
94 uda1380: uda1380@18 {
95 compatible = "nxp,uda1380";
96 reg = <0x18>;
97 power-gpio = <&gpio 0x59 0>;
98 reset-gpio = <&gpio 0x51 0>;
99 dac-clk = "wspll";
100 };
101 };
102
103 i2c2: i2c@400A8000 {
104 clock-frequency = <100000>;
105 };
106
107 i2cusb: i2c@31020300 {
108 clock-frequency = <100000>;
109
110 isp1301: usb-transceiver@2c {
111 compatible = "nxp,isp1301";
112 reg = <0x2c>;
113 };
114 };
115
116 ssp0: ssp@20084000 {
117 eeprom: at25@0 {
118 compatible = "atmel,at25";
119 };
120 };
121 };
122
123 fab {
124 tsc@40048000 {
125 status = "okay";
126 };
127 };
128 };
129
130 leds {
131 compatible = "gpio-leds";
132
133 led0 {
134 gpios = <&gpo_p3 1 1>; /* GPO_P3 1, GPIO 80, active low */
135 linux,default-trigger = "heartbeat";
136 default-state = "off";
137 };
138
139 led1 {
140 gpios = <&gpo_p3 14 1>; /* GPO_P3 14, GPIO 93, active low */
141 linux,default-trigger = "timer";
142 default-state = "off";
143 };
144 };
145};
diff --git a/arch/arm/boot/dts/pxa168.dtsi b/arch/arm/boot/dts/pxa168.dtsi
index d32d5128f225..31a718696080 100644
--- a/arch/arm/boot/dts/pxa168.dtsi
+++ b/arch/arm/boot/dts/pxa168.dtsi
@@ -18,13 +18,6 @@
18 i2c1 = &twsi2; 18 i2c1 = &twsi2;
19 }; 19 };
20 20
21 intc: intc-interrupt-controller@d4282000 {
22 compatible = "mrvl,mmp-intc", "mrvl,intc";
23 interrupt-controller;
24 #interrupt-cells = <1>;
25 reg = <0xd4282000 0x1000>;
26 };
27
28 soc { 21 soc {
29 #address-cells = <1>; 22 #address-cells = <1>;
30 #size-cells = <1>; 23 #size-cells = <1>;
@@ -32,6 +25,23 @@
32 interrupt-parent = <&intc>; 25 interrupt-parent = <&intc>;
33 ranges; 26 ranges;
34 27
28 axi@d4200000 { /* AXI */
29 compatible = "mrvl,axi-bus", "simple-bus";
30 #address-cells = <1>;
31 #size-cells = <1>;
32 reg = <0xd4200000 0x00200000>;
33 ranges;
34
35 intc: interrupt-controller@d4282000 {
36 compatible = "mrvl,mmp-intc";
37 interrupt-controller;
38 #interrupt-cells = <1>;
39 reg = <0xd4282000 0x1000>;
40 mrvl,intc-nr-irqs = <64>;
41 };
42
43 };
44
35 apb@d4000000 { /* APB */ 45 apb@d4000000 { /* APB */
36 compatible = "mrvl,apb-bus", "simple-bus"; 46 compatible = "mrvl,apb-bus", "simple-bus";
37 #address-cells = <1>; 47 #address-cells = <1>;
@@ -39,40 +49,65 @@
39 reg = <0xd4000000 0x00200000>; 49 reg = <0xd4000000 0x00200000>;
40 ranges; 50 ranges;
41 51
52 timer0: timer@d4014000 {
53 compatible = "mrvl,mmp-timer";
54 reg = <0xd4014000 0x100>;
55 interrupts = <13>;
56 };
57
42 uart1: uart@d4017000 { 58 uart1: uart@d4017000 {
43 compatible = "mrvl,mmp-uart", "mrvl,pxa-uart"; 59 compatible = "mrvl,mmp-uart";
44 reg = <0xd4017000 0x1000>; 60 reg = <0xd4017000 0x1000>;
45 interrupts = <27>; 61 interrupts = <27>;
46 status = "disabled"; 62 status = "disabled";
47 }; 63 };
48 64
49 uart2: uart@d4018000 { 65 uart2: uart@d4018000 {
50 compatible = "mrvl,mmp-uart", "mrvl,pxa-uart"; 66 compatible = "mrvl,mmp-uart";
51 reg = <0xd4018000 0x1000>; 67 reg = <0xd4018000 0x1000>;
52 interrupts = <28>; 68 interrupts = <28>;
53 status = "disabled"; 69 status = "disabled";
54 }; 70 };
55 71
56 uart3: uart@d4026000 { 72 uart3: uart@d4026000 {
57 compatible = "mrvl,mmp-uart", "mrvl,pxa-uart"; 73 compatible = "mrvl,mmp-uart";
58 reg = <0xd4026000 0x1000>; 74 reg = <0xd4026000 0x1000>;
59 interrupts = <29>; 75 interrupts = <29>;
60 status = "disabled"; 76 status = "disabled";
61 }; 77 };
62 78
63 gpio: gpio@d4019000 { 79 gpio@d4019000 {
64 compatible = "mrvl,mmp-gpio", "mrvl,pxa-gpio"; 80 compatible = "mrvl,mmp-gpio";
81 #address-cells = <1>;
82 #size-cells = <1>;
65 reg = <0xd4019000 0x1000>; 83 reg = <0xd4019000 0x1000>;
84 gpio-controller;
85 #gpio-cells = <2>;
66 interrupts = <49>; 86 interrupts = <49>;
67 interrupt-names = "gpio_mux"; 87 interrupt-names = "gpio_mux";
68 gpio-controller;
69 #gpio-cells = <1>;
70 interrupt-controller; 88 interrupt-controller;
71 #interrupt-cells = <1>; 89 #interrupt-cells = <1>;
90 ranges;
91
92 gcb0: gpio@d4019000 {
93 reg = <0xd4019000 0x4>;
94 };
95
96 gcb1: gpio@d4019004 {
97 reg = <0xd4019004 0x4>;
98 };
99
100 gcb2: gpio@d4019008 {
101 reg = <0xd4019008 0x4>;
102 };
103
104 gcb3: gpio@d4019100 {
105 reg = <0xd4019100 0x4>;
106 };
72 }; 107 };
73 108
74 twsi1: i2c@d4011000 { 109 twsi1: i2c@d4011000 {
75 compatible = "mrvl,mmp-twsi", "mrvl,pxa-i2c"; 110 compatible = "mrvl,mmp-twsi";
76 reg = <0xd4011000 0x1000>; 111 reg = <0xd4011000 0x1000>;
77 interrupts = <7>; 112 interrupts = <7>;
78 mrvl,i2c-fast-mode; 113 mrvl,i2c-fast-mode;
@@ -80,7 +115,7 @@
80 }; 115 };
81 116
82 twsi2: i2c@d4025000 { 117 twsi2: i2c@d4025000 {
83 compatible = "mrvl,mmp-twsi", "mrvl,pxa-i2c"; 118 compatible = "mrvl,mmp-twsi";
84 reg = <0xd4025000 0x1000>; 119 reg = <0xd4025000 0x1000>;
85 interrupts = <58>; 120 interrupts = <58>;
86 status = "disabled"; 121 status = "disabled";
diff --git a/arch/arm/boot/dts/pxa910-dkb.dts b/arch/arm/boot/dts/pxa910-dkb.dts
new file mode 100644
index 000000000000..e92be5a474e7
--- /dev/null
+++ b/arch/arm/boot/dts/pxa910-dkb.dts
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2012 Marvell Technology Group Ltd.
3 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9
10/dts-v1/;
11/include/ "pxa910.dtsi"
12
13/ {
14 model = "Marvell PXA910 DKB Development Board";
15 compatible = "mrvl,pxa910-dkb", "mrvl,pxa910";
16
17 chosen {
18 bootargs = "console=ttyS0,115200 root=/dev/nfs nfsroot=192.168.1.100:/nfsroot/ ip=192.168.1.101:192.168.1.100::255.255.255.0::eth0:on";
19 };
20
21 memory {
22 reg = <0x00000000 0x10000000>;
23 };
24
25 soc {
26 apb@d4000000 {
27 uart1: uart@d4017000 {
28 status = "okay";
29 };
30 twsi1: i2c@d4011000 {
31 status = "okay";
32 };
33 rtc: rtc@d4010000 {
34 status = "okay";
35 };
36 };
37 };
38};
diff --git a/arch/arm/boot/dts/pxa910.dtsi b/arch/arm/boot/dts/pxa910.dtsi
new file mode 100644
index 000000000000..aebf32de73b4
--- /dev/null
+++ b/arch/arm/boot/dts/pxa910.dtsi
@@ -0,0 +1,140 @@
1/*
2 * Copyright (C) 2012 Marvell Technology Group Ltd.
3 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9
10/include/ "skeleton.dtsi"
11
12/ {
13 aliases {
14 serial0 = &uart1;
15 serial1 = &uart2;
16 serial2 = &uart3;
17 i2c0 = &twsi1;
18 i2c1 = &twsi2;
19 };
20
21 soc {
22 #address-cells = <1>;
23 #size-cells = <1>;
24 compatible = "simple-bus";
25 interrupt-parent = <&intc>;
26 ranges;
27
28 axi@d4200000 { /* AXI */
29 compatible = "mrvl,axi-bus", "simple-bus";
30 #address-cells = <1>;
31 #size-cells = <1>;
32 reg = <0xd4200000 0x00200000>;
33 ranges;
34
35 intc: interrupt-controller@d4282000 {
36 compatible = "mrvl,mmp-intc";
37 interrupt-controller;
38 #interrupt-cells = <1>;
39 reg = <0xd4282000 0x1000>;
40 mrvl,intc-nr-irqs = <64>;
41 };
42
43 };
44
45 apb@d4000000 { /* APB */
46 compatible = "mrvl,apb-bus", "simple-bus";
47 #address-cells = <1>;
48 #size-cells = <1>;
49 reg = <0xd4000000 0x00200000>;
50 ranges;
51
52 timer0: timer@d4014000 {
53 compatible = "mrvl,mmp-timer";
54 reg = <0xd4014000 0x100>;
55 interrupts = <13>;
56 };
57
58 timer1: timer@d4016000 {
59 compatible = "mrvl,mmp-timer";
60 reg = <0xd4016000 0x100>;
61 interrupts = <29>;
62 status = "disabled";
63 };
64
65 uart1: uart@d4017000 {
66 compatible = "mrvl,mmp-uart";
67 reg = <0xd4017000 0x1000>;
68 interrupts = <27>;
69 status = "disabled";
70 };
71
72 uart2: uart@d4018000 {
73 compatible = "mrvl,mmp-uart";
74 reg = <0xd4018000 0x1000>;
75 interrupts = <28>;
76 status = "disabled";
77 };
78
79 uart3: uart@d4036000 {
80 compatible = "mrvl,mmp-uart";
81 reg = <0xd4036000 0x1000>;
82 interrupts = <59>;
83 status = "disabled";
84 };
85
86 gpio@d4019000 {
87 compatible = "mrvl,mmp-gpio";
88 #address-cells = <1>;
89 #size-cells = <1>;
90 reg = <0xd4019000 0x1000>;
91 gpio-controller;
92 #gpio-cells = <2>;
93 interrupts = <49>;
94 interrupt-names = "gpio_mux";
95 interrupt-controller;
96 #interrupt-cells = <1>;
97 ranges;
98
99 gcb0: gpio@d4019000 {
100 reg = <0xd4019000 0x4>;
101 };
102
103 gcb1: gpio@d4019004 {
104 reg = <0xd4019004 0x4>;
105 };
106
107 gcb2: gpio@d4019008 {
108 reg = <0xd4019008 0x4>;
109 };
110
111 gcb3: gpio@d4019100 {
112 reg = <0xd4019100 0x4>;
113 };
114 };
115
116 twsi1: i2c@d4011000 {
117 compatible = "mrvl,mmp-twsi";
118 reg = <0xd4011000 0x1000>;
119 interrupts = <7>;
120 mrvl,i2c-fast-mode;
121 status = "disabled";
122 };
123
124 twsi2: i2c@d4037000 {
125 compatible = "mrvl,mmp-twsi";
126 reg = <0xd4037000 0x1000>;
127 interrupts = <54>;
128 status = "disabled";
129 };
130
131 rtc: rtc@d4010000 {
132 compatible = "mrvl,mmp-rtc";
133 reg = <0xd4010000 0x1000>;
134 interrupts = <5 6>;
135 interrupt-names = "rtc 1Hz", "rtc alarm";
136 status = "disabled";
137 };
138 };
139 };
140};
diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
new file mode 100644
index 000000000000..a7505a95a3b7
--- /dev/null
+++ b/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
@@ -0,0 +1,22 @@
1/*
2 * Device Tree Source for the armadillo 800 eva board
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11/dts-v1/;
12/include/ "skeleton.dtsi"
13
14/ {
15 model = "armadillo 800 eva";
16 compatible = "renesas,armadillo800eva";
17
18 memory {
19 device_type = "memory";
20 reg = <0x40000000 0x20000000>;
21 };
22};
diff --git a/arch/arm/boot/dts/sh7372.dtsi b/arch/arm/boot/dts/sh7372.dtsi
new file mode 100644
index 000000000000..677fc603f8b3
--- /dev/null
+++ b/arch/arm/boot/dts/sh7372.dtsi
@@ -0,0 +1,21 @@
1/*
2 * Device Tree Source for the sh7372 SoC
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11/include/ "skeleton.dtsi"
12
13/ {
14 compatible = "renesas,sh7372";
15
16 cpus {
17 cpu@0 {
18 compatible = "arm,cortex-a8";
19 };
20 };
21};
diff --git a/arch/arm/boot/dts/sh73a0-kzm9g.dts b/arch/arm/boot/dts/sh73a0-kzm9g.dts
new file mode 100644
index 000000000000..bcb911951978
--- /dev/null
+++ b/arch/arm/boot/dts/sh73a0-kzm9g.dts
@@ -0,0 +1,22 @@
1/*
2 * Device Tree Source for the KZM-A9-GT board
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11/dts-v1/;
12/include/ "skeleton.dtsi"
13
14/ {
15 model = "KZM-A9-GT";
16 compatible = "renesas,kzm9g", "renesas,sh73a0";
17
18 memory {
19 device_type = "memory";
20 reg = <0x41000000 0x1e800000>;
21 };
22};
diff --git a/arch/arm/boot/dts/snowball.dts b/arch/arm/boot/dts/snowball.dts
index 359c6d679156..d99dc04f0d91 100644
--- a/arch/arm/boot/dts/snowball.dts
+++ b/arch/arm/boot/dts/snowball.dts
@@ -30,35 +30,35 @@
30 wakeup = <1>; 30 wakeup = <1>;
31 linux,code = <2>; 31 linux,code = <2>;
32 label = "userpb"; 32 label = "userpb";
33 gpios = <&gpio1 0>; 33 gpios = <&gpio1 0 0>;
34 }; 34 };
35 button@2 { 35 button@2 {
36 debounce_interval = <50>; 36 debounce_interval = <50>;
37 wakeup = <1>; 37 wakeup = <1>;
38 linux,code = <3>; 38 linux,code = <3>;
39 label = "userpb"; 39 label = "extkb1";
40 gpios = <&gpio4 23>; 40 gpios = <&gpio4 23 0>;
41 }; 41 };
42 button@3 { 42 button@3 {
43 debounce_interval = <50>; 43 debounce_interval = <50>;
44 wakeup = <1>; 44 wakeup = <1>;
45 linux,code = <4>; 45 linux,code = <4>;
46 label = "userpb"; 46 label = "extkb2";
47 gpios = <&gpio4 23>; 47 gpios = <&gpio4 24 0>;
48 }; 48 };
49 button@4 { 49 button@4 {
50 debounce_interval = <50>; 50 debounce_interval = <50>;
51 wakeup = <1>; 51 wakeup = <1>;
52 linux,code = <5>; 52 linux,code = <5>;
53 label = "userpb"; 53 label = "extkb3";
54 gpios = <&gpio5 1>; 54 gpios = <&gpio5 1 0>;
55 }; 55 };
56 button@5 { 56 button@5 {
57 debounce_interval = <50>; 57 debounce_interval = <50>;
58 wakeup = <1>; 58 wakeup = <1>;
59 linux,code = <6>; 59 linux,code = <6>;
60 label = "userpb"; 60 label = "extkb4";
61 gpios = <&gpio5 2>; 61 gpios = <&gpio5 2 0>;
62 }; 62 };
63 }; 63 };
64 64
@@ -73,17 +73,19 @@
73 soc-u9500 { 73 soc-u9500 {
74 74
75 external-bus@50000000 { 75 external-bus@50000000 {
76 compatible = "simple-bus"; 76 status = "okay";
77 reg = <0x50000000 0x10000000>; 77
78 #address-cells = <1>; 78 ethernet@0 {
79 #size-cells = <1>; 79 compatible = "smsc,lan9115";
80 ranges; 80 reg = <0 0x10000>;
81 81 interrupts = <12 0x1>;
82 ethernet@50000000 {
83 compatible = "smsc,9111";
84 reg = <0x50000000 0x10000>;
85 interrupts = <12>;
86 interrupt-parent = <&gpio4>; 82 interrupt-parent = <&gpio4>;
83
84 reg-shift = <1>;
85 reg-io-width = <2>;
86 smsc,force-internal-phy;
87 smsc,irq-active-high;
88 smsc,irq-push-pull;
87 }; 89 };
88 }; 90 };
89 91
diff --git a/arch/arm/boot/dts/spear300-evb.dts b/arch/arm/boot/dts/spear300-evb.dts
new file mode 100644
index 000000000000..910e264b87c0
--- /dev/null
+++ b/arch/arm/boot/dts/spear300-evb.dts
@@ -0,0 +1,221 @@
1/*
2 * DTS file for SPEAr300 Evaluation Baord
3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/dts-v1/;
15/include/ "spear300.dtsi"
16
17/ {
18 model = "ST SPEAr300 Evaluation Board";
19 compatible = "st,spear300-evb", "st,spear300";
20 #address-cells = <1>;
21 #size-cells = <1>;
22
23 memory {
24 reg = <0 0x40000000>;
25 };
26
27 ahb {
28 pinmux@99000000 {
29 st,pinmux-mode = <2>;
30 pinctrl-names = "default";
31 pinctrl-0 = <&state_default>;
32
33 state_default: pinmux {
34 i2c0 {
35 st,pins = "i2c0_grp";
36 st,function = "i2c0";
37 };
38 ssp0 {
39 st,pins = "ssp0_grp";
40 st,function = "ssp0";
41 };
42 mii0 {
43 st,pins = "mii0_grp";
44 st,function = "mii0";
45 };
46 uart0 {
47 st,pins = "uart0_grp";
48 st,function = "uart0";
49 };
50 clcd {
51 st,pins = "clcd_pfmode_grp";
52 st,function = "clcd";
53 };
54 sdhci {
55 st,pins = "sdhci_4bit_grp";
56 st,function = "sdhci";
57 };
58 gpio1 {
59 st,pins = "gpio1_4_to_7_grp",
60 "gpio1_0_to_3_grp";
61 st,function = "gpio1";
62 };
63 };
64 };
65
66 clcd@60000000 {
67 status = "okay";
68 };
69
70 dma@fc400000 {
71 status = "okay";
72 };
73
74 fsmc: flash@94000000 {
75 status = "okay";
76 };
77
78 gmac: eth@e0800000 {
79 status = "okay";
80 };
81
82 sdhci@70000000 {
83 int-gpio = <&gpio1 0 0>;
84 power-gpio = <&gpio1 2 1>;
85 status = "okay";
86 };
87
88 smi: flash@fc000000 {
89 status = "okay";
90 };
91
92 spi0: spi@d0100000 {
93 status = "okay";
94 };
95
96 ehci@e1800000 {
97 status = "okay";
98 };
99
100 ohci@e1900000 {
101 status = "okay";
102 };
103
104 ohci@e2100000 {
105 status = "okay";
106 };
107
108 apb {
109 gpio0: gpio@fc980000 {
110 status = "okay";
111 };
112
113 gpio1: gpio@a9000000 {
114 status = "okay";
115 };
116
117 i2c0: i2c@d0180000 {
118 status = "okay";
119 };
120
121 kbd@a0000000 {
122 linux,keymap = < 0x00000001
123 0x00010002
124 0x00020003
125 0x00030004
126 0x00040005
127 0x00050006
128 0x00060007
129 0x00070008
130 0x00080009
131 0x0100000a
132 0x0101000c
133 0x0102000d
134 0x0103000e
135 0x0104000f
136 0x01050010
137 0x01060011
138 0x01070012
139 0x01080013
140 0x02000014
141 0x02010015
142 0x02020016
143 0x02030017
144 0x02040018
145 0x02050019
146 0x0206001a
147 0x0207001b
148 0x0208001c
149 0x0300001d
150 0x0301001e
151 0x0302001f
152 0x03030020
153 0x03040021
154 0x03050022
155 0x03060023
156 0x03070024
157 0x03080025
158 0x04000026
159 0x04010027
160 0x04020028
161 0x04030029
162 0x0404002a
163 0x0405002b
164 0x0406002c
165 0x0407002d
166 0x0408002e
167 0x0500002f
168 0x05010030
169 0x05020031
170 0x05030032
171 0x05040033
172 0x05050034
173 0x05060035
174 0x05070036
175 0x05080037
176 0x06000038
177 0x06010039
178 0x0602003a
179 0x0603003b
180 0x0604003c
181 0x0605003d
182 0x0606003e
183 0x0607003f
184 0x06080040
185 0x07000041
186 0x07010042
187 0x07020043
188 0x07030044
189 0x07040045
190 0x07050046
191 0x07060047
192 0x07070048
193 0x07080049
194 0x0800004a
195 0x0801004b
196 0x0802004c
197 0x0803004d
198 0x0804004e
199 0x0805004f
200 0x08060050
201 0x08070051
202 0x08080052 >;
203 autorepeat;
204 st,mode = <0>;
205 status = "okay";
206 };
207
208 rtc@fc900000 {
209 status = "okay";
210 };
211
212 serial@d0000000 {
213 status = "okay";
214 };
215
216 wdt@fc880000 {
217 status = "okay";
218 };
219 };
220 };
221};
diff --git a/arch/arm/boot/dts/spear300.dtsi b/arch/arm/boot/dts/spear300.dtsi
new file mode 100644
index 000000000000..01c5e358fdb2
--- /dev/null
+++ b/arch/arm/boot/dts/spear300.dtsi
@@ -0,0 +1,77 @@
1/*
2 * DTS file for SPEAr300 SoC
3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/include/ "spear3xx.dtsi"
15
16/ {
17 ahb {
18 #address-cells = <1>;
19 #size-cells = <1>;
20 compatible = "simple-bus";
21 ranges = <0x60000000 0x60000000 0x50000000
22 0xd0000000 0xd0000000 0x30000000>;
23
24 pinmux@99000000 {
25 compatible = "st,spear300-pinmux";
26 reg = <0x99000000 0x1000>;
27 };
28
29 clcd@60000000 {
30 compatible = "arm,clcd-pl110", "arm,primecell";
31 reg = <0x60000000 0x1000>;
32 interrupts = <30>;
33 status = "disabled";
34 };
35
36 fsmc: flash@94000000 {
37 compatible = "st,spear600-fsmc-nand";
38 #address-cells = <1>;
39 #size-cells = <1>;
40 reg = <0x94000000 0x1000 /* FSMC Register */
41 0x80000000 0x0010>; /* NAND Base */
42 reg-names = "fsmc_regs", "nand_data";
43 st,ale-off = <0x20000>;
44 st,cle-off = <0x10000>;
45 status = "disabled";
46 };
47
48 sdhci@70000000 {
49 compatible = "st,sdhci-spear";
50 reg = <0x70000000 0x100>;
51 interrupts = <1>;
52 status = "disabled";
53 };
54
55 apb {
56 #address-cells = <1>;
57 #size-cells = <1>;
58 compatible = "simple-bus";
59 ranges = <0xa0000000 0xa0000000 0x10000000
60 0xd0000000 0xd0000000 0x30000000>;
61
62 gpio1: gpio@a9000000 {
63 #gpio-cells = <2>;
64 compatible = "arm,pl061", "arm,primecell";
65 gpio-controller;
66 reg = <0xa9000000 0x1000>;
67 status = "disabled";
68 };
69
70 kbd@a0000000 {
71 compatible = "st,spear300-kbd";
72 reg = <0xa0000000 0x1000>;
73 status = "disabled";
74 };
75 };
76 };
77};
diff --git a/arch/arm/boot/dts/spear310-evb.dts b/arch/arm/boot/dts/spear310-evb.dts
new file mode 100644
index 000000000000..6d95317100ad
--- /dev/null
+++ b/arch/arm/boot/dts/spear310-evb.dts
@@ -0,0 +1,172 @@
1/*
2 * DTS file for SPEAr310 Evaluation Baord
3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/dts-v1/;
15/include/ "spear310.dtsi"
16
17/ {
18 model = "ST SPEAr310 Evaluation Board";
19 compatible = "st,spear310-evb", "st,spear310";
20 #address-cells = <1>;
21 #size-cells = <1>;
22
23 memory {
24 reg = <0 0x40000000>;
25 };
26
27 ahb {
28 pinmux@b4000000 {
29 pinctrl-names = "default";
30 pinctrl-0 = <&state_default>;
31
32 state_default: pinmux {
33 gpio0 {
34 st,pins = "gpio0_pin0_grp",
35 "gpio0_pin1_grp",
36 "gpio0_pin2_grp",
37 "gpio0_pin3_grp",
38 "gpio0_pin4_grp",
39 "gpio0_pin5_grp";
40 st,function = "gpio0";
41 };
42 i2c0 {
43 st,pins = "i2c0_grp";
44 st,function = "i2c0";
45 };
46 mii0 {
47 st,pins = "mii0_grp";
48 st,function = "mii0";
49 };
50 ssp0 {
51 st,pins = "ssp0_grp";
52 st,function = "ssp0";
53 };
54 uart0 {
55 st,pins = "uart0_grp";
56 st,function = "uart0";
57 };
58 emi {
59 st,pins = "emi_cs_0_to_5_grp";
60 st,function = "emi";
61 };
62 fsmc {
63 st,pins = "fsmc_grp";
64 st,function = "fsmc";
65 };
66 uart1 {
67 st,pins = "uart1_grp";
68 st,function = "uart1";
69 };
70 uart2 {
71 st,pins = "uart2_grp";
72 st,function = "uart2";
73 };
74 uart3 {
75 st,pins = "uart3_grp";
76 st,function = "uart3";
77 };
78 uart4 {
79 st,pins = "uart4_grp";
80 st,function = "uart4";
81 };
82 uart5 {
83 st,pins = "uart5_grp";
84 st,function = "uart5";
85 };
86 };
87 };
88
89 dma@fc400000 {
90 status = "okay";
91 };
92
93 fsmc: flash@44000000 {
94 status = "okay";
95 };
96
97 gmac: eth@e0800000 {
98 status = "okay";
99 };
100
101 smi: flash@fc000000 {
102 status = "okay";
103 clock-rate=<50000000>;
104
105 flash@f8000000 {
106 label = "m25p64";
107 reg = <0xf8000000 0x800000>;
108 #address-cells = <1>;
109 #size-cells = <1>;
110 st,smi-fast-mode;
111 };
112 };
113
114 spi0: spi@d0100000 {
115 status = "okay";
116 };
117
118 ehci@e1800000 {
119 status = "okay";
120 };
121
122 ohci@e1900000 {
123 status = "okay";
124 };
125
126 ohci@e2100000 {
127 status = "okay";
128 };
129
130 apb {
131 gpio0: gpio@fc980000 {
132 status = "okay";
133 };
134
135 i2c0: i2c@d0180000 {
136 status = "okay";
137 };
138
139 rtc@fc900000 {
140 status = "okay";
141 };
142
143 serial@d0000000 {
144 status = "okay";
145 };
146
147 serial@b2000000 {
148 status = "okay";
149 };
150
151 serial@b2080000 {
152 status = "okay";
153 };
154
155 serial@b2100000 {
156 status = "okay";
157 };
158
159 serial@b2180000 {
160 status = "okay";
161 };
162
163 serial@b2200000 {
164 status = "okay";
165 };
166
167 wdt@fc880000 {
168 status = "okay";
169 };
170 };
171 };
172};
diff --git a/arch/arm/boot/dts/spear310.dtsi b/arch/arm/boot/dts/spear310.dtsi
new file mode 100644
index 000000000000..e47081c494d9
--- /dev/null
+++ b/arch/arm/boot/dts/spear310.dtsi
@@ -0,0 +1,80 @@
1/*
2 * DTS file for SPEAr310 SoC
3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/include/ "spear3xx.dtsi"
15
16/ {
17 ahb {
18 #address-cells = <1>;
19 #size-cells = <1>;
20 compatible = "simple-bus";
21 ranges = <0x40000000 0x40000000 0x10000000
22 0xb0000000 0xb0000000 0x10000000
23 0xd0000000 0xd0000000 0x30000000>;
24
25 pinmux@b4000000 {
26 compatible = "st,spear310-pinmux";
27 reg = <0xb4000000 0x1000>;
28 };
29
30 fsmc: flash@44000000 {
31 compatible = "st,spear600-fsmc-nand";
32 #address-cells = <1>;
33 #size-cells = <1>;
34 reg = <0x44000000 0x1000 /* FSMC Register */
35 0x40000000 0x0010>; /* NAND Base */
36 reg-names = "fsmc_regs", "nand_data";
37 st,ale-off = <0x10000>;
38 st,cle-off = <0x20000>;
39 status = "disabled";
40 };
41
42 apb {
43 #address-cells = <1>;
44 #size-cells = <1>;
45 compatible = "simple-bus";
46 ranges = <0xb0000000 0xb0000000 0x10000000
47 0xd0000000 0xd0000000 0x30000000>;
48
49 serial@b2000000 {
50 compatible = "arm,pl011", "arm,primecell";
51 reg = <0xb2000000 0x1000>;
52 status = "disabled";
53 };
54
55 serial@b2080000 {
56 compatible = "arm,pl011", "arm,primecell";
57 reg = <0xb2080000 0x1000>;
58 status = "disabled";
59 };
60
61 serial@b2100000 {
62 compatible = "arm,pl011", "arm,primecell";
63 reg = <0xb2100000 0x1000>;
64 status = "disabled";
65 };
66
67 serial@b2180000 {
68 compatible = "arm,pl011", "arm,primecell";
69 reg = <0xb2180000 0x1000>;
70 status = "disabled";
71 };
72
73 serial@b2200000 {
74 compatible = "arm,pl011", "arm,primecell";
75 reg = <0xb2200000 0x1000>;
76 status = "disabled";
77 };
78 };
79 };
80};
diff --git a/arch/arm/boot/dts/spear320-evb.dts b/arch/arm/boot/dts/spear320-evb.dts
new file mode 100644
index 000000000000..0c6463b71a37
--- /dev/null
+++ b/arch/arm/boot/dts/spear320-evb.dts
@@ -0,0 +1,173 @@
1/*
2 * DTS file for SPEAr320 Evaluation Baord
3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/dts-v1/;
15/include/ "spear320.dtsi"
16
17/ {
18 model = "ST SPEAr300 Evaluation Board";
19 compatible = "st,spear300-evb", "st,spear300";
20 #address-cells = <1>;
21 #size-cells = <1>;
22
23 memory {
24 reg = <0 0x40000000>;
25 };
26
27 ahb {
28 pinmux@b3000000 {
29 st,pinmux-mode = <3>;
30 pinctrl-names = "default";
31 pinctrl-0 = <&state_default>;
32
33 state_default: pinmux {
34 i2c0 {
35 st,pins = "i2c0_grp";
36 st,function = "i2c0";
37 };
38 mii0 {
39 st,pins = "mii0_grp";
40 st,function = "mii0";
41 };
42 ssp0 {
43 st,pins = "ssp0_grp";
44 st,function = "ssp0";
45 };
46 uart0 {
47 st,pins = "uart0_grp";
48 st,function = "uart0";
49 };
50 sdhci {
51 st,pins = "sdhci_cd_51_grp";
52 st,function = "sdhci";
53 };
54 i2s {
55 st,pins = "i2s_grp";
56 st,function = "i2s";
57 };
58 uart1 {
59 st,pins = "uart1_grp";
60 st,function = "uart1";
61 };
62 uart2 {
63 st,pins = "uart2_grp";
64 st,function = "uart2";
65 };
66 can0 {
67 st,pins = "can0_grp";
68 st,function = "can0";
69 };
70 can1 {
71 st,pins = "can1_grp";
72 st,function = "can1";
73 };
74 mii2 {
75 st,pins = "mii2_grp";
76 st,function = "mii2";
77 };
78 pwm0_1 {
79 st,pins = "pwm0_1_pin_14_15_grp";
80 st,function = "pwm0_1";
81 };
82 pwm2 {
83 st,pins = "pwm2_pin_13_grp";
84 st,function = "pwm2";
85 };
86 };
87 };
88
89 clcd@90000000 {
90 status = "okay";
91 };
92
93 dma@fc400000 {
94 status = "okay";
95 };
96
97 fsmc: flash@4c000000 {
98 status = "okay";
99 };
100
101 gmac: eth@e0800000 {
102 status = "okay";
103 };
104
105 sdhci@70000000 {
106 power-gpio = <&gpio0 2 1>;
107 power_always_enb;
108 status = "okay";
109 };
110
111 smi: flash@fc000000 {
112 status = "okay";
113 };
114
115 spi0: spi@d0100000 {
116 status = "okay";
117 };
118
119 spi1: spi@a5000000 {
120 status = "okay";
121 };
122
123 spi2: spi@a6000000 {
124 status = "okay";
125 };
126
127 ehci@e1800000 {
128 status = "okay";
129 };
130
131 ohci@e1900000 {
132 status = "okay";
133 };
134
135 ohci@e2100000 {
136 status = "okay";
137 };
138
139 apb {
140 gpio0: gpio@fc980000 {
141 status = "okay";
142 };
143
144 i2c0: i2c@d0180000 {
145 status = "okay";
146 };
147
148 i2c1: i2c@a7000000 {
149 status = "okay";
150 };
151
152 rtc@fc900000 {
153 status = "okay";
154 };
155
156 serial@d0000000 {
157 status = "okay";
158 };
159
160 serial@a3000000 {
161 status = "okay";
162 };
163
164 serial@a4000000 {
165 status = "okay";
166 };
167
168 wdt@fc880000 {
169 status = "okay";
170 };
171 };
172 };
173};
diff --git a/arch/arm/boot/dts/spear320.dtsi b/arch/arm/boot/dts/spear320.dtsi
new file mode 100644
index 000000000000..5372ca399b1f
--- /dev/null
+++ b/arch/arm/boot/dts/spear320.dtsi
@@ -0,0 +1,95 @@
1/*
2 * DTS file for SPEAr320 SoC
3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/include/ "spear3xx.dtsi"
15
16/ {
17 ahb {
18 #address-cells = <1>;
19 #size-cells = <1>;
20 compatible = "simple-bus";
21 ranges = <0x40000000 0x40000000 0x80000000
22 0xd0000000 0xd0000000 0x30000000>;
23
24 pinmux@b3000000 {
25 compatible = "st,spear320-pinmux";
26 reg = <0xb3000000 0x1000>;
27 };
28
29 clcd@90000000 {
30 compatible = "arm,clcd-pl110", "arm,primecell";
31 reg = <0x90000000 0x1000>;
32 interrupts = <33>;
33 status = "disabled";
34 };
35
36 fsmc: flash@4c000000 {
37 compatible = "st,spear600-fsmc-nand";
38 #address-cells = <1>;
39 #size-cells = <1>;
40 reg = <0x4c000000 0x1000 /* FSMC Register */
41 0x50000000 0x0010>; /* NAND Base */
42 reg-names = "fsmc_regs", "nand_data";
43 st,ale-off = <0x20000>;
44 st,cle-off = <0x10000>;
45 status = "disabled";
46 };
47
48 sdhci@70000000 {
49 compatible = "st,sdhci-spear";
50 reg = <0x70000000 0x100>;
51 interrupts = <29>;
52 status = "disabled";
53 };
54
55 spi1: spi@a5000000 {
56 compatible = "arm,pl022", "arm,primecell";
57 reg = <0xa5000000 0x1000>;
58 status = "disabled";
59 };
60
61 spi2: spi@a6000000 {
62 compatible = "arm,pl022", "arm,primecell";
63 reg = <0xa6000000 0x1000>;
64 status = "disabled";
65 };
66
67 apb {
68 #address-cells = <1>;
69 #size-cells = <1>;
70 compatible = "simple-bus";
71 ranges = <0xa0000000 0xa0000000 0x10000000
72 0xd0000000 0xd0000000 0x30000000>;
73
74 i2c1: i2c@a7000000 {
75 #address-cells = <1>;
76 #size-cells = <0>;
77 compatible = "snps,designware-i2c";
78 reg = <0xa7000000 0x1000>;
79 status = "disabled";
80 };
81
82 serial@a3000000 {
83 compatible = "arm,pl011", "arm,primecell";
84 reg = <0xa3000000 0x1000>;
85 status = "disabled";
86 };
87
88 serial@a4000000 {
89 compatible = "arm,pl011", "arm,primecell";
90 reg = <0xa4000000 0x1000>;
91 status = "disabled";
92 };
93 };
94 };
95};
diff --git a/arch/arm/boot/dts/spear3xx.dtsi b/arch/arm/boot/dts/spear3xx.dtsi
new file mode 100644
index 000000000000..0ae7c8e86311
--- /dev/null
+++ b/arch/arm/boot/dts/spear3xx.dtsi
@@ -0,0 +1,144 @@
1/*
2 * DTS file for all SPEAr3xx SoCs
3 *
4 * Copyright 2012 Viresh Kumar <viresh.kumar@st.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/include/ "skeleton.dtsi"
15
16/ {
17 interrupt-parent = <&vic>;
18
19 cpus {
20 cpu@0 {
21 compatible = "arm,arm926ejs";
22 };
23 };
24
25 memory {
26 device_type = "memory";
27 reg = <0 0x40000000>;
28 };
29
30 ahb {
31 #address-cells = <1>;
32 #size-cells = <1>;
33 compatible = "simple-bus";
34 ranges = <0xd0000000 0xd0000000 0x30000000>;
35
36 vic: interrupt-controller@f1100000 {
37 compatible = "arm,pl190-vic";
38 interrupt-controller;
39 reg = <0xf1100000 0x1000>;
40 #interrupt-cells = <1>;
41 };
42
43 dma@fc400000 {
44 compatible = "arm,pl080", "arm,primecell";
45 reg = <0xfc400000 0x1000>;
46 interrupt-parent = <&vic>;
47 interrupts = <8>;
48 status = "disabled";
49 };
50
51 gmac: eth@e0800000 {
52 compatible = "st,spear600-gmac";
53 reg = <0xe0800000 0x8000>;
54 interrupts = <23 22>;
55 interrupt-names = "macirq", "eth_wake_irq";
56 status = "disabled";
57 };
58
59 smi: flash@fc000000 {
60 compatible = "st,spear600-smi";
61 #address-cells = <1>;
62 #size-cells = <1>;
63 reg = <0xfc000000 0x1000>;
64 interrupts = <9>;
65 status = "disabled";
66 };
67
68 spi0: spi@d0100000 {
69 compatible = "arm,pl022", "arm,primecell";
70 reg = <0xd0100000 0x1000>;
71 interrupts = <20>;
72 status = "disabled";
73 };
74
75 ehci@e1800000 {
76 compatible = "st,spear600-ehci", "usb-ehci";
77 reg = <0xe1800000 0x1000>;
78 interrupts = <26>;
79 status = "disabled";
80 };
81
82 ohci@e1900000 {
83 compatible = "st,spear600-ohci", "usb-ohci";
84 reg = <0xe1900000 0x1000>;
85 interrupts = <25>;
86 status = "disabled";
87 };
88
89 ohci@e2100000 {
90 compatible = "st,spear600-ohci", "usb-ohci";
91 reg = <0xe2100000 0x1000>;
92 interrupts = <27>;
93 status = "disabled";
94 };
95
96 apb {
97 #address-cells = <1>;
98 #size-cells = <1>;
99 compatible = "simple-bus";
100 ranges = <0xd0000000 0xd0000000 0x30000000>;
101
102 gpio0: gpio@fc980000 {
103 compatible = "arm,pl061", "arm,primecell";
104 reg = <0xfc980000 0x1000>;
105 interrupts = <11>;
106 gpio-controller;
107 #gpio-cells = <2>;
108 interrupt-controller;
109 #interrupt-cells = <2>;
110 status = "disabled";
111 };
112
113 i2c0: i2c@d0180000 {
114 #address-cells = <1>;
115 #size-cells = <0>;
116 compatible = "snps,designware-i2c";
117 reg = <0xd0180000 0x1000>;
118 interrupts = <21>;
119 status = "disabled";
120 };
121
122 rtc@fc900000 {
123 compatible = "st,spear-rtc";
124 reg = <0xfc900000 0x1000>;
125 interrupts = <10>;
126 status = "disabled";
127 };
128
129 serial@d0000000 {
130 compatible = "arm,pl011", "arm,primecell";
131 reg = <0xd0000000 0x1000>;
132 interrupts = <19>;
133 status = "disabled";
134 };
135
136 wdt@fc880000 {
137 compatible = "arm,sp805", "arm,primecell";
138 reg = <0xfc880000 0x1000>;
139 interrupts = <12>;
140 status = "disabled";
141 };
142 };
143 };
144};
diff --git a/arch/arm/boot/dts/spear600-evb.dts b/arch/arm/boot/dts/spear600-evb.dts
index 636292e18c90..790a7a8a5ccd 100644
--- a/arch/arm/boot/dts/spear600-evb.dts
+++ b/arch/arm/boot/dts/spear600-evb.dts
@@ -24,6 +24,10 @@
24 }; 24 };
25 25
26 ahb { 26 ahb {
27 dma@fc400000 {
28 status = "okay";
29 };
30
27 gmac: ethernet@e0800000 { 31 gmac: ethernet@e0800000 {
28 phy-mode = "gmii"; 32 phy-mode = "gmii";
29 status = "okay"; 33 status = "okay";
diff --git a/arch/arm/boot/dts/spear600.dtsi b/arch/arm/boot/dts/spear600.dtsi
index ebe0885a2b98..d777e3a6f178 100644
--- a/arch/arm/boot/dts/spear600.dtsi
+++ b/arch/arm/boot/dts/spear600.dtsi
@@ -45,6 +45,14 @@
45 #interrupt-cells = <1>; 45 #interrupt-cells = <1>;
46 }; 46 };
47 47
48 dma@fc400000 {
49 compatible = "arm,pl080", "arm,primecell";
50 reg = <0xfc400000 0x1000>;
51 interrupt-parent = <&vic1>;
52 interrupts = <10>;
53 status = "disabled";
54 };
55
48 gmac: ethernet@e0800000 { 56 gmac: ethernet@e0800000 {
49 compatible = "st,spear600-gmac"; 57 compatible = "st,spear600-gmac";
50 reg = <0xe0800000 0x8000>; 58 reg = <0xe0800000 0x8000>;
diff --git a/arch/arm/boot/dts/tegra-cardhu.dts b/arch/arm/boot/dts/tegra-cardhu.dts
index ac3fb7558459..0a9f34a2c3aa 100644
--- a/arch/arm/boot/dts/tegra-cardhu.dts
+++ b/arch/arm/boot/dts/tegra-cardhu.dts
@@ -10,6 +10,50 @@
10 reg = < 0x80000000 0x40000000 >; 10 reg = < 0x80000000 0x40000000 >;
11 }; 11 };
12 12
13 pinmux@70000000 {
14 pinctrl-names = "default";
15 pinctrl-0 = <&state_default>;
16
17 state_default: pinmux {
18 sdmmc1_clk_pz0 {
19 nvidia,pins = "sdmmc1_clk_pz0";
20 nvidia,function = "sdmmc1";
21 nvidia,pull = <0>;
22 nvidia,tristate = <0>;
23 };
24 sdmmc1_cmd_pz1 {
25 nvidia,pins = "sdmmc1_cmd_pz1",
26 "sdmmc1_dat0_py7",
27 "sdmmc1_dat1_py6",
28 "sdmmc1_dat2_py5",
29 "sdmmc1_dat3_py4";
30 nvidia,function = "sdmmc1";
31 nvidia,pull = <2>;
32 nvidia,tristate = <0>;
33 };
34 sdmmc4_clk_pcc4 {
35 nvidia,pins = "sdmmc4_clk_pcc4",
36 "sdmmc4_rst_n_pcc3";
37 nvidia,function = "sdmmc4";
38 nvidia,pull = <0>;
39 nvidia,tristate = <0>;
40 };
41 sdmmc4_dat0_paa0 {
42 nvidia,pins = "sdmmc4_dat0_paa0",
43 "sdmmc4_dat1_paa1",
44 "sdmmc4_dat2_paa2",
45 "sdmmc4_dat3_paa3",
46 "sdmmc4_dat4_paa4",
47 "sdmmc4_dat5_paa5",
48 "sdmmc4_dat6_paa6",
49 "sdmmc4_dat7_paa7";
50 nvidia,function = "sdmmc4";
51 nvidia,pull = <2>;
52 nvidia,tristate = <0>;
53 };
54 };
55 };
56
13 serial@70006000 { 57 serial@70006000 {
14 clock-frequency = < 408000000 >; 58 clock-frequency = < 408000000 >;
15 }; 59 };
diff --git a/arch/arm/boot/dts/tegra-harmony.dts b/arch/arm/boot/dts/tegra-harmony.dts
index 6e8447dc0202..1a0b1f182944 100644
--- a/arch/arm/boot/dts/tegra-harmony.dts
+++ b/arch/arm/boot/dts/tegra-harmony.dts
@@ -10,6 +10,230 @@
10 reg = < 0x00000000 0x40000000 >; 10 reg = < 0x00000000 0x40000000 >;
11 }; 11 };
12 12
13 pinmux@70000000 {
14 pinctrl-names = "default";
15 pinctrl-0 = <&state_default>;
16
17 state_default: pinmux {
18 ata {
19 nvidia,pins = "ata";
20 nvidia,function = "ide";
21 };
22 atb {
23 nvidia,pins = "atb", "gma", "gme";
24 nvidia,function = "sdio4";
25 };
26 atc {
27 nvidia,pins = "atc";
28 nvidia,function = "nand";
29 };
30 atd {
31 nvidia,pins = "atd", "ate", "gmb", "gmd", "gpu",
32 "spia", "spib", "spic";
33 nvidia,function = "gmi";
34 };
35 cdev1 {
36 nvidia,pins = "cdev1";
37 nvidia,function = "plla_out";
38 };
39 cdev2 {
40 nvidia,pins = "cdev2";
41 nvidia,function = "pllp_out4";
42 };
43 crtp {
44 nvidia,pins = "crtp";
45 nvidia,function = "crt";
46 };
47 csus {
48 nvidia,pins = "csus";
49 nvidia,function = "vi_sensor_clk";
50 };
51 dap1 {
52 nvidia,pins = "dap1";
53 nvidia,function = "dap1";
54 };
55 dap2 {
56 nvidia,pins = "dap2";
57 nvidia,function = "dap2";
58 };
59 dap3 {
60 nvidia,pins = "dap3";
61 nvidia,function = "dap3";
62 };
63 dap4 {
64 nvidia,pins = "dap4";
65 nvidia,function = "dap4";
66 };
67 ddc {
68 nvidia,pins = "ddc";
69 nvidia,function = "i2c2";
70 };
71 dta {
72 nvidia,pins = "dta", "dtd";
73 nvidia,function = "sdio2";
74 };
75 dtb {
76 nvidia,pins = "dtb", "dtc", "dte";
77 nvidia,function = "rsvd1";
78 };
79 dtf {
80 nvidia,pins = "dtf";
81 nvidia,function = "i2c3";
82 };
83 gmc {
84 nvidia,pins = "gmc";
85 nvidia,function = "uartd";
86 };
87 gpu7 {
88 nvidia,pins = "gpu7";
89 nvidia,function = "rtck";
90 };
91 gpv {
92 nvidia,pins = "gpv", "slxa", "slxk";
93 nvidia,function = "pcie";
94 };
95 hdint {
96 nvidia,pins = "hdint", "pta";
97 nvidia,function = "hdmi";
98 };
99 i2cp {
100 nvidia,pins = "i2cp";
101 nvidia,function = "i2cp";
102 };
103 irrx {
104 nvidia,pins = "irrx", "irtx";
105 nvidia,function = "uarta";
106 };
107 kbca {
108 nvidia,pins = "kbca", "kbcb", "kbcc", "kbcd",
109 "kbce", "kbcf";
110 nvidia,function = "kbc";
111 };
112 lcsn {
113 nvidia,pins = "lcsn", "ld0", "ld1", "ld2",
114 "ld3", "ld4", "ld5", "ld6", "ld7",
115 "ld8", "ld9", "ld10", "ld11", "ld12",
116 "ld13", "ld14", "ld15", "ld16", "ld17",
117 "ldc", "ldi", "lhp0", "lhp1", "lhp2",
118 "lhs", "lm0", "lm1", "lpp", "lpw0",
119 "lpw1", "lpw2", "lsc0", "lsc1", "lsck",
120 "lsda", "lsdi", "lspi", "lvp0", "lvp1",
121 "lvs";
122 nvidia,function = "displaya";
123 };
124 owc {
125 nvidia,pins = "owc", "spdi", "spdo", "uac";
126 nvidia,function = "rsvd2";
127 };
128 pmc {
129 nvidia,pins = "pmc";
130 nvidia,function = "pwr_on";
131 };
132 rm {
133 nvidia,pins = "rm";
134 nvidia,function = "i2c1";
135 };
136 sdb {
137 nvidia,pins = "sdb", "sdc", "sdd";
138 nvidia,function = "pwm";
139 };
140 sdio1 {
141 nvidia,pins = "sdio1";
142 nvidia,function = "sdio1";
143 };
144 slxc {
145 nvidia,pins = "slxc", "slxd";
146 nvidia,function = "spdif";
147 };
148 spid {
149 nvidia,pins = "spid", "spie", "spif";
150 nvidia,function = "spi1";
151 };
152 spig {
153 nvidia,pins = "spig", "spih";
154 nvidia,function = "spi2_alt";
155 };
156 uaa {
157 nvidia,pins = "uaa", "uab", "uda";
158 nvidia,function = "ulpi";
159 };
160 uad {
161 nvidia,pins = "uad";
162 nvidia,function = "irda";
163 };
164 uca {
165 nvidia,pins = "uca", "ucb";
166 nvidia,function = "uartc";
167 };
168 conf_ata {
169 nvidia,pins = "ata", "atb", "atc", "atd", "ate",
170 "cdev1", "dap1", "dtb", "gma", "gmb",
171 "gmc", "gmd", "gme", "gpu7", "gpv",
172 "i2cp", "pta", "rm", "slxa", "slxk",
173 "spia", "spib";
174 nvidia,pull = <0>;
175 nvidia,tristate = <0>;
176 };
177 conf_cdev2 {
178 nvidia,pins = "cdev2", "csus", "spid", "spif";
179 nvidia,pull = <1>;
180 nvidia,tristate = <1>;
181 };
182 conf_ck32 {
183 nvidia,pins = "ck32", "ddrc", "pmca", "pmcb",
184 "pmcc", "pmcd", "pmce", "xm2c", "xm2d";
185 nvidia,pull = <0>;
186 };
187 conf_crtp {
188 nvidia,pins = "crtp", "dap2", "dap3", "dap4",
189 "dtc", "dte", "dtf", "gpu", "sdio1",
190 "slxc", "slxd", "spdi", "spdo", "spig",
191 "uac", "uda";
192 nvidia,pull = <0>;
193 nvidia,tristate = <1>;
194 };
195 conf_ddc {
196 nvidia,pins = "ddc", "dta", "dtd", "kbca",
197 "kbcb", "kbcc", "kbcd", "kbce", "kbcf",
198 "sdc";
199 nvidia,pull = <2>;
200 nvidia,tristate = <0>;
201 };
202 conf_hdint {
203 nvidia,pins = "hdint", "lcsn", "ldc", "lm1",
204 "lpw1", "lsc1", "lsck", "lsda", "lsdi",
205 "lvp0", "owc", "sdb";
206 nvidia,tristate = <1>;
207 };
208 conf_irrx {
209 nvidia,pins = "irrx", "irtx", "sdd", "spic",
210 "spie", "spih", "uaa", "uab", "uad",
211 "uca", "ucb";
212 nvidia,pull = <2>;
213 nvidia,tristate = <1>;
214 };
215 conf_lc {
216 nvidia,pins = "lc", "ls";
217 nvidia,pull = <2>;
218 };
219 conf_ld0 {
220 nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4",
221 "ld5", "ld6", "ld7", "ld8", "ld9",
222 "ld10", "ld11", "ld12", "ld13", "ld14",
223 "ld15", "ld16", "ld17", "ldi", "lhp0",
224 "lhp1", "lhp2", "lhs", "lm0", "lpp",
225 "lpw0", "lpw2", "lsc0", "lspi", "lvp1",
226 "lvs", "pmc";
227 nvidia,tristate = <0>;
228 };
229 conf_ld17_0 {
230 nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
231 "ld23_22";
232 nvidia,pull = <1>;
233 };
234 };
235 };
236
13 pmc@7000f400 { 237 pmc@7000f400 {
14 nvidia,invert-interrupt; 238 nvidia,invert-interrupt;
15 }; 239 };
diff --git a/arch/arm/boot/dts/tegra-paz00.dts b/arch/arm/boot/dts/tegra-paz00.dts
index 6c02abb469d4..10943fb2561c 100644
--- a/arch/arm/boot/dts/tegra-paz00.dts
+++ b/arch/arm/boot/dts/tegra-paz00.dts
@@ -10,6 +10,226 @@
10 reg = <0x00000000 0x20000000>; 10 reg = <0x00000000 0x20000000>;
11 }; 11 };
12 12
13 pinmux@70000000 {
14 pinctrl-names = "default";
15 pinctrl-0 = <&state_default>;
16
17 state_default: pinmux {
18 ata {
19 nvidia,pins = "ata", "atc", "atd", "ate",
20 "dap2", "gmb", "gmc", "gmd", "spia",
21 "spib", "spic", "spid", "spie";
22 nvidia,function = "gmi";
23 };
24 atb {
25 nvidia,pins = "atb", "gma", "gme";
26 nvidia,function = "sdio4";
27 };
28 cdev1 {
29 nvidia,pins = "cdev1";
30 nvidia,function = "plla_out";
31 };
32 cdev2 {
33 nvidia,pins = "cdev2";
34 nvidia,function = "pllp_out4";
35 };
36 crtp {
37 nvidia,pins = "crtp";
38 nvidia,function = "crt";
39 };
40 csus {
41 nvidia,pins = "csus";
42 nvidia,function = "pllc_out1";
43 };
44 dap1 {
45 nvidia,pins = "dap1";
46 nvidia,function = "dap1";
47 };
48 dap3 {
49 nvidia,pins = "dap3";
50 nvidia,function = "dap3";
51 };
52 dap4 {
53 nvidia,pins = "dap4";
54 nvidia,function = "dap4";
55 };
56 ddc {
57 nvidia,pins = "ddc";
58 nvidia,function = "i2c2";
59 };
60 dta {
61 nvidia,pins = "dta", "dtb", "dtc", "dtd", "dte";
62 nvidia,function = "rsvd1";
63 };
64 dtf {
65 nvidia,pins = "dtf";
66 nvidia,function = "i2c3";
67 };
68 gpu {
69 nvidia,pins = "gpu", "sdb", "sdd";
70 nvidia,function = "pwm";
71 };
72 gpu7 {
73 nvidia,pins = "gpu7";
74 nvidia,function = "rtck";
75 };
76 gpv {
77 nvidia,pins = "gpv", "slxa", "slxk";
78 nvidia,function = "pcie";
79 };
80 hdint {
81 nvidia,pins = "hdint", "pta";
82 nvidia,function = "hdmi";
83 };
84 i2cp {
85 nvidia,pins = "i2cp";
86 nvidia,function = "i2cp";
87 };
88 irrx {
89 nvidia,pins = "irrx", "irtx";
90 nvidia,function = "uarta";
91 };
92 kbca {
93 nvidia,pins = "kbca", "kbcc", "kbce", "kbcf";
94 nvidia,function = "kbc";
95 };
96 kbcb {
97 nvidia,pins = "kbcb", "kbcd";
98 nvidia,function = "sdio2";
99 };
100 lcsn {
101 nvidia,pins = "lcsn", "ld0", "ld1", "ld2",
102 "ld3", "ld4", "ld5", "ld6", "ld7",
103 "ld8", "ld9", "ld10", "ld11", "ld12",
104 "ld13", "ld14", "ld15", "ld16", "ld17",
105 "ldc", "ldi", "lhp0", "lhp1", "lhp2",
106 "lhs", "lm0", "lm1", "lpp", "lpw0",
107 "lpw1", "lpw2", "lsc0", "lsc1", "lsck",
108 "lsda", "lsdi", "lspi", "lvp0", "lvp1",
109 "lvs";
110 nvidia,function = "displaya";
111 };
112 owc {
113 nvidia,pins = "owc";
114 nvidia,function = "owr";
115 };
116 pmc {
117 nvidia,pins = "pmc";
118 nvidia,function = "pwr_on";
119 };
120 rm {
121 nvidia,pins = "rm";
122 nvidia,function = "i2c1";
123 };
124 sdc {
125 nvidia,pins = "sdc";
126 nvidia,function = "twc";
127 };
128 sdio1 {
129 nvidia,pins = "sdio1";
130 nvidia,function = "sdio1";
131 };
132 slxc {
133 nvidia,pins = "slxc", "slxd";
134 nvidia,function = "spi4";
135 };
136 spdi {
137 nvidia,pins = "spdi", "spdo";
138 nvidia,function = "rsvd2";
139 };
140 spif {
141 nvidia,pins = "spif", "uac";
142 nvidia,function = "rsvd4";
143 };
144 spig {
145 nvidia,pins = "spig", "spih";
146 nvidia,function = "spi2_alt";
147 };
148 uaa {
149 nvidia,pins = "uaa", "uab", "uda";
150 nvidia,function = "ulpi";
151 };
152 uad {
153 nvidia,pins = "uad";
154 nvidia,function = "spdif";
155 };
156 uca {
157 nvidia,pins = "uca", "ucb";
158 nvidia,function = "uartc";
159 };
160 conf_ata {
161 nvidia,pins = "ata", "atb", "atc", "atd", "ate",
162 "cdev1", "dap1", "dap2", "dtf", "gma",
163 "gmb", "gmc", "gmd", "gme", "gpu",
164 "gpu7", "gpv", "i2cp", "pta", "rm",
165 "sdio1", "slxk", "spdo", "uac", "uda";
166 nvidia,pull = <0>;
167 nvidia,tristate = <0>;
168 };
169 conf_cdev2 {
170 nvidia,pins = "cdev2";
171 nvidia,pull = <1>;
172 nvidia,tristate = <0>;
173 };
174 conf_ck32 {
175 nvidia,pins = "ck32", "ddrc", "pmca", "pmcb",
176 "pmcc", "pmcd", "pmce", "xm2c", "xm2d";
177 nvidia,pull = <0>;
178 };
179 conf_crtp {
180 nvidia,pins = "crtp", "dap3", "dap4", "dtb",
181 "dtc", "dte", "slxa", "slxc", "slxd",
182 "spdi";
183 nvidia,pull = <0>;
184 nvidia,tristate = <1>;
185 };
186 conf_csus {
187 nvidia,pins = "csus", "spia", "spib", "spid",
188 "spif";
189 nvidia,pull = <1>;
190 nvidia,tristate = <1>;
191 };
192 conf_ddc {
193 nvidia,pins = "ddc", "irrx", "irtx", "kbca",
194 "kbcb", "kbcc", "kbcd", "kbce", "kbcf",
195 "spic", "spig", "uaa", "uab";
196 nvidia,pull = <2>;
197 nvidia,tristate = <0>;
198 };
199 conf_dta {
200 nvidia,pins = "dta", "dtd", "owc", "sdc", "sdd",
201 "spie", "spih", "uad", "uca", "ucb";
202 nvidia,pull = <2>;
203 nvidia,tristate = <1>;
204 };
205 conf_hdint {
206 nvidia,pins = "hdint", "ld0", "ld1", "ld2",
207 "ld3", "ld4", "ld5", "ld6", "ld7",
208 "ld8", "ld9", "ld10", "ld11", "ld12",
209 "ld13", "ld14", "ld15", "ld16", "ld17",
210 "ldc", "ldi", "lhs", "lsc0", "lspi",
211 "lvs", "pmc";
212 nvidia,tristate = <0>;
213 };
214 conf_lc {
215 nvidia,pins = "lc", "ls";
216 nvidia,pull = <2>;
217 };
218 conf_lcsn {
219 nvidia,pins = "lcsn", "lhp0", "lhp1", "lhp2",
220 "lm0", "lm1", "lpp", "lpw0", "lpw1",
221 "lpw2", "lsc1", "lsck", "lsda", "lsdi",
222 "lvp0", "lvp1", "sdb";
223 nvidia,tristate = <1>;
224 };
225 conf_ld17_0 {
226 nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
227 "ld23_22";
228 nvidia,pull = <1>;
229 };
230 };
231 };
232
13 i2c@7000c000 { 233 i2c@7000c000 {
14 clock-frequency = <400000>; 234 clock-frequency = <400000>;
15 235
diff --git a/arch/arm/boot/dts/tegra-seaboard.dts b/arch/arm/boot/dts/tegra-seaboard.dts
index dbf1c5a171c2..ec33116f5df9 100644
--- a/arch/arm/boot/dts/tegra-seaboard.dts
+++ b/arch/arm/boot/dts/tegra-seaboard.dts
@@ -11,6 +11,249 @@
11 reg = < 0x00000000 0x40000000 >; 11 reg = < 0x00000000 0x40000000 >;
12 }; 12 };
13 13
14 pinmux@70000000 {
15 pinctrl-names = "default";
16 pinctrl-0 = <&state_default>;
17
18 state_default: pinmux {
19 ata {
20 nvidia,pins = "ata";
21 nvidia,function = "ide";
22 };
23 atb {
24 nvidia,pins = "atb", "gma", "gme";
25 nvidia,function = "sdio4";
26 };
27 atc {
28 nvidia,pins = "atc";
29 nvidia,function = "nand";
30 };
31 atd {
32 nvidia,pins = "atd", "ate", "gmb", "spia",
33 "spib", "spic";
34 nvidia,function = "gmi";
35 };
36 cdev1 {
37 nvidia,pins = "cdev1";
38 nvidia,function = "plla_out";
39 };
40 cdev2 {
41 nvidia,pins = "cdev2";
42 nvidia,function = "pllp_out4";
43 };
44 crtp {
45 nvidia,pins = "crtp", "lm1";
46 nvidia,function = "crt";
47 };
48 csus {
49 nvidia,pins = "csus";
50 nvidia,function = "vi_sensor_clk";
51 };
52 dap1 {
53 nvidia,pins = "dap1";
54 nvidia,function = "dap1";
55 };
56 dap2 {
57 nvidia,pins = "dap2";
58 nvidia,function = "dap2";
59 };
60 dap3 {
61 nvidia,pins = "dap3";
62 nvidia,function = "dap3";
63 };
64 dap4 {
65 nvidia,pins = "dap4";
66 nvidia,function = "dap4";
67 };
68 ddc {
69 nvidia,pins = "ddc", "owc", "spdi", "spdo",
70 "uac";
71 nvidia,function = "rsvd2";
72 };
73 dta {
74 nvidia,pins = "dta", "dtb", "dtc", "dtd", "dte";
75 nvidia,function = "vi";
76 };
77 dtf {
78 nvidia,pins = "dtf";
79 nvidia,function = "i2c3";
80 };
81 gmc {
82 nvidia,pins = "gmc";
83 nvidia,function = "uartd";
84 };
85 gmd {
86 nvidia,pins = "gmd";
87 nvidia,function = "sflash";
88 };
89 gpu {
90 nvidia,pins = "gpu";
91 nvidia,function = "pwm";
92 };
93 gpu7 {
94 nvidia,pins = "gpu7";
95 nvidia,function = "rtck";
96 };
97 gpv {
98 nvidia,pins = "gpv", "slxa", "slxk";
99 nvidia,function = "pcie";
100 };
101 hdint {
102 nvidia,pins = "hdint", "lpw0", "lpw2", "lsc1",
103 "lsck", "lsda", "pta";
104 nvidia,function = "hdmi";
105 };
106 i2cp {
107 nvidia,pins = "i2cp";
108 nvidia,function = "i2cp";
109 };
110 irrx {
111 nvidia,pins = "irrx", "irtx";
112 nvidia,function = "uartb";
113 };
114 kbca {
115 nvidia,pins = "kbca", "kbcb", "kbcc", "kbcd",
116 "kbce", "kbcf";
117 nvidia,function = "kbc";
118 };
119 lcsn {
120 nvidia,pins = "lcsn", "ldc", "lm0", "lpw1",
121 "lsdi", "lvp0";
122 nvidia,function = "rsvd4";
123 };
124 ld0 {
125 nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4",
126 "ld5", "ld6", "ld7", "ld8", "ld9",
127 "ld10", "ld11", "ld12", "ld13", "ld14",
128 "ld15", "ld16", "ld17", "ldi", "lhp0",
129 "lhp1", "lhp2", "lhs", "lpp", "lsc0",
130 "lspi", "lvp1", "lvs";
131 nvidia,function = "displaya";
132 };
133 pmc {
134 nvidia,pins = "pmc";
135 nvidia,function = "pwr_on";
136 };
137 rm {
138 nvidia,pins = "rm";
139 nvidia,function = "i2c1";
140 };
141 sdb {
142 nvidia,pins = "sdb", "sdc", "sdd";
143 nvidia,function = "sdio3";
144 };
145 sdio1 {
146 nvidia,pins = "sdio1";
147 nvidia,function = "sdio1";
148 };
149 slxc {
150 nvidia,pins = "slxc", "slxd";
151 nvidia,function = "spdif";
152 };
153 spid {
154 nvidia,pins = "spid", "spie", "spif";
155 nvidia,function = "spi1";
156 };
157 spig {
158 nvidia,pins = "spig", "spih";
159 nvidia,function = "spi2_alt";
160 };
161 uaa {
162 nvidia,pins = "uaa", "uab", "uda";
163 nvidia,function = "ulpi";
164 };
165 uad {
166 nvidia,pins = "uad";
167 nvidia,function = "irda";
168 };
169 uca {
170 nvidia,pins = "uca", "ucb";
171 nvidia,function = "uartc";
172 };
173 conf_ata {
174 nvidia,pins = "ata", "atb", "atc", "atd",
175 "cdev1", "cdev2", "dap1", "dap2",
176 "dap4", "dtf", "gma", "gmc", "gmd",
177 "gme", "gpu", "gpu7", "i2cp", "irrx",
178 "irtx", "pta", "rm", "sdc", "sdd",
179 "slxd", "slxk", "spdi", "spdo", "uac",
180 "uad", "uca", "ucb", "uda";
181 nvidia,pull = <0>;
182 nvidia,tristate = <0>;
183 };
184 conf_ate {
185 nvidia,pins = "ate", "csus", "dap3", "ddc",
186 "gpv", "owc", "slxc", "spib", "spid",
187 "spie";
188 nvidia,pull = <0>;
189 nvidia,tristate = <1>;
190 };
191 conf_ck32 {
192 nvidia,pins = "ck32", "ddrc", "pmca", "pmcb",
193 "pmcc", "pmcd", "pmce", "xm2c", "xm2d";
194 nvidia,pull = <0>;
195 };
196 conf_crtp {
197 nvidia,pins = "crtp", "gmb", "slxa", "spia",
198 "spig", "spih";
199 nvidia,pull = <2>;
200 nvidia,tristate = <1>;
201 };
202 conf_dta {
203 nvidia,pins = "dta", "dtb", "dtc", "dtd";
204 nvidia,pull = <1>;
205 nvidia,tristate = <0>;
206 };
207 conf_dte {
208 nvidia,pins = "dte", "spif";
209 nvidia,pull = <1>;
210 nvidia,tristate = <1>;
211 };
212 conf_hdint {
213 nvidia,pins = "hdint", "lcsn", "ldc", "lm1",
214 "lpw1", "lsc1", "lsck", "lsda", "lsdi",
215 "lvp0";
216 nvidia,tristate = <1>;
217 };
218 conf_kbca {
219 nvidia,pins = "kbca", "kbcb", "kbcc", "kbcd",
220 "kbce", "kbcf", "sdio1", "spic", "uaa",
221 "uab";
222 nvidia,pull = <2>;
223 nvidia,tristate = <0>;
224 };
225 conf_lc {
226 nvidia,pins = "lc", "ls";
227 nvidia,pull = <2>;
228 };
229 conf_ld0 {
230 nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4",
231 "ld5", "ld6", "ld7", "ld8", "ld9",
232 "ld10", "ld11", "ld12", "ld13", "ld14",
233 "ld15", "ld16", "ld17", "ldi", "lhp0",
234 "lhp1", "lhp2", "lhs", "lm0", "lpp",
235 "lpw0", "lpw2", "lsc0", "lspi", "lvp1",
236 "lvs", "pmc", "sdb";
237 nvidia,tristate = <0>;
238 };
239 conf_ld17_0 {
240 nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
241 "ld23_22";
242 nvidia,pull = <1>;
243 };
244 drive_sdio1 {
245 nvidia,pins = "drive_sdio1";
246 nvidia,high-speed-mode = <0>;
247 nvidia,schmitt = <0>;
248 nvidia,low-power-mode = <3>;
249 nvidia,pull-down-strength = <31>;
250 nvidia,pull-up-strength = <31>;
251 nvidia,slew-rate-rising = <3>;
252 nvidia,slew-rate-falling = <3>;
253 };
254 };
255 };
256
14 i2c@7000c000 { 257 i2c@7000c000 {
15 clock-frequency = <400000>; 258 clock-frequency = <400000>;
16 259
diff --git a/arch/arm/boot/dts/tegra-trimslice.dts b/arch/arm/boot/dts/tegra-trimslice.dts
index 252476867b54..98efd5b0d7f9 100644
--- a/arch/arm/boot/dts/tegra-trimslice.dts
+++ b/arch/arm/boot/dts/tegra-trimslice.dts
@@ -10,6 +10,236 @@
10 reg = < 0x00000000 0x40000000 >; 10 reg = < 0x00000000 0x40000000 >;
11 }; 11 };
12 12
13 pinmux@70000000 {
14 pinctrl-names = "default";
15 pinctrl-0 = <&state_default>;
16
17 state_default: pinmux {
18 ata {
19 nvidia,pins = "ata";
20 nvidia,function = "ide";
21 };
22 atb {
23 nvidia,pins = "atb", "gma";
24 nvidia,function = "sdio4";
25 };
26 atc {
27 nvidia,pins = "atc", "gmb";
28 nvidia,function = "nand";
29 };
30 atd {
31 nvidia,pins = "atd", "ate", "gme", "pta";
32 nvidia,function = "gmi";
33 };
34 cdev1 {
35 nvidia,pins = "cdev1";
36 nvidia,function = "plla_out";
37 };
38 cdev2 {
39 nvidia,pins = "cdev2";
40 nvidia,function = "pllp_out4";
41 };
42 crtp {
43 nvidia,pins = "crtp";
44 nvidia,function = "crt";
45 };
46 csus {
47 nvidia,pins = "csus";
48 nvidia,function = "vi_sensor_clk";
49 };
50 dap1 {
51 nvidia,pins = "dap1";
52 nvidia,function = "dap1";
53 };
54 dap2 {
55 nvidia,pins = "dap2";
56 nvidia,function = "dap2";
57 };
58 dap3 {
59 nvidia,pins = "dap3";
60 nvidia,function = "dap3";
61 };
62 dap4 {
63 nvidia,pins = "dap4";
64 nvidia,function = "dap4";
65 };
66 ddc {
67 nvidia,pins = "ddc";
68 nvidia,function = "i2c2";
69 };
70 dta {
71 nvidia,pins = "dta", "dtb", "dtc", "dtd", "dte";
72 nvidia,function = "vi";
73 };
74 dtf {
75 nvidia,pins = "dtf";
76 nvidia,function = "i2c3";
77 };
78 gmc {
79 nvidia,pins = "gmc", "gmd";
80 nvidia,function = "sflash";
81 };
82 gpu {
83 nvidia,pins = "gpu";
84 nvidia,function = "uarta";
85 };
86 gpu7 {
87 nvidia,pins = "gpu7";
88 nvidia,function = "rtck";
89 };
90 gpv {
91 nvidia,pins = "gpv", "slxa", "slxk";
92 nvidia,function = "pcie";
93 };
94 hdint {
95 nvidia,pins = "hdint";
96 nvidia,function = "hdmi";
97 };
98 i2cp {
99 nvidia,pins = "i2cp";
100 nvidia,function = "i2cp";
101 };
102 irrx {
103 nvidia,pins = "irrx", "irtx";
104 nvidia,function = "uartb";
105 };
106 kbca {
107 nvidia,pins = "kbca", "kbcb", "kbcc", "kbcd",
108 "kbce", "kbcf";
109 nvidia,function = "kbc";
110 };
111 lcsn {
112 nvidia,pins = "lcsn", "ld0", "ld1", "ld2",
113 "ld3", "ld4", "ld5", "ld6", "ld7",
114 "ld8", "ld9", "ld10", "ld11", "ld12",
115 "ld13", "ld14", "ld15", "ld16", "ld17",
116 "ldc", "ldi", "lhp0", "lhp1", "lhp2",
117 "lhs", "lm0", "lm1", "lpp", "lpw0",
118 "lpw1", "lpw2", "lsc0", "lsc1", "lsck",
119 "lsda", "lsdi", "lspi", "lvp0", "lvp1",
120 "lvs";
121 nvidia,function = "displaya";
122 };
123 owc {
124 nvidia,pins = "owc", "uac";
125 nvidia,function = "rsvd2";
126 };
127 pmc {
128 nvidia,pins = "pmc";
129 nvidia,function = "pwr_on";
130 };
131 rm {
132 nvidia,pins = "rm";
133 nvidia,function = "i2c1";
134 };
135 sdb {
136 nvidia,pins = "sdb", "sdc", "sdd";
137 nvidia,function = "pwm";
138 };
139 sdio1 {
140 nvidia,pins = "sdio1";
141 nvidia,function = "sdio1";
142 };
143 slxc {
144 nvidia,pins = "slxc", "slxd";
145 nvidia,function = "sdio3";
146 };
147 spdi {
148 nvidia,pins = "spdi", "spdo";
149 nvidia,function = "spdif";
150 };
151 spia {
152 nvidia,pins = "spia", "spib", "spic";
153 nvidia,function = "spi2";
154 };
155 spid {
156 nvidia,pins = "spid", "spie", "spif";
157 nvidia,function = "spi1";
158 };
159 spig {
160 nvidia,pins = "spig", "spih";
161 nvidia,function = "spi2_alt";
162 };
163 uaa {
164 nvidia,pins = "uaa", "uab", "uda";
165 nvidia,function = "ulpi";
166 };
167 uad {
168 nvidia,pins = "uad";
169 nvidia,function = "irda";
170 };
171 uca {
172 nvidia,pins = "uca", "ucb";
173 nvidia,function = "uartc";
174 };
175 conf_ata {
176 nvidia,pins = "ata", "atc", "atd", "ate",
177 "crtp", "dap2", "dap3", "dap4", "dta",
178 "dtb", "dtc", "dtd", "dte", "gmb",
179 "gme", "i2cp", "pta", "slxc", "slxd",
180 "spdi", "spdo", "uda";
181 nvidia,pull = <0>;
182 nvidia,tristate = <1>;
183 };
184 conf_atb {
185 nvidia,pins = "atb", "cdev1", "dap1", "gma",
186 "gmc", "gmd", "gpu", "gpu7", "gpv",
187 "sdio1", "slxa", "slxk", "uac";
188 nvidia,pull = <0>;
189 nvidia,tristate = <0>;
190 };
191 conf_cdev2 {
192 nvidia,pins = "cdev2", "csus", "spia", "spib",
193 "spid", "spif";
194 nvidia,pull = <1>;
195 nvidia,tristate = <1>;
196 };
197 conf_ck32 {
198 nvidia,pins = "ck32", "ddrc", "pmca", "pmcb",
199 "pmcc", "pmcd", "pmce", "xm2c", "xm2d";
200 nvidia,pull = <0>;
201 };
202 conf_ddc {
203 nvidia,pins = "ddc", "dtf", "rm", "sdc", "sdd";
204 nvidia,pull = <2>;
205 nvidia,tristate = <0>;
206 };
207 conf_hdint {
208 nvidia,pins = "hdint", "lcsn", "ldc", "lm1",
209 "lpw1", "lsc1", "lsck", "lsda", "lsdi",
210 "lvp0", "pmc";
211 nvidia,tristate = <1>;
212 };
213 conf_irrx {
214 nvidia,pins = "irrx", "irtx", "kbca", "kbcb",
215 "kbcc", "kbcd", "kbce", "kbcf", "owc",
216 "spic", "spie", "spig", "spih", "uaa",
217 "uab", "uad", "uca", "ucb";
218 nvidia,pull = <2>;
219 nvidia,tristate = <1>;
220 };
221 conf_lc {
222 nvidia,pins = "lc", "ls";
223 nvidia,pull = <2>;
224 };
225 conf_ld0 {
226 nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4",
227 "ld5", "ld6", "ld7", "ld8", "ld9",
228 "ld10", "ld11", "ld12", "ld13", "ld14",
229 "ld15", "ld16", "ld17", "ldi", "lhp0",
230 "lhp1", "lhp2", "lhs", "lm0", "lpp",
231 "lpw0", "lpw2", "lsc0", "lspi", "lvp1",
232 "lvs", "sdb";
233 nvidia,tristate = <0>;
234 };
235 conf_ld17_0 {
236 nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
237 "ld23_22";
238 nvidia,pull = <1>;
239 };
240 };
241 };
242
13 i2c@7000c000 { 243 i2c@7000c000 {
14 clock-frequency = <400000>; 244 clock-frequency = <400000>;
15 }; 245 };
diff --git a/arch/arm/boot/dts/tegra-ventana.dts b/arch/arm/boot/dts/tegra-ventana.dts
index 2dcff8728e90..71eb2e50a668 100644
--- a/arch/arm/boot/dts/tegra-ventana.dts
+++ b/arch/arm/boot/dts/tegra-ventana.dts
@@ -10,6 +10,236 @@
10 reg = < 0x00000000 0x40000000 >; 10 reg = < 0x00000000 0x40000000 >;
11 }; 11 };
12 12
13 pinmux@70000000 {
14 pinctrl-names = "default";
15 pinctrl-0 = <&state_default>;
16
17 state_default: pinmux {
18 ata {
19 nvidia,pins = "ata";
20 nvidia,function = "ide";
21 };
22 atb {
23 nvidia,pins = "atb", "gma", "gme";
24 nvidia,function = "sdio4";
25 };
26 atc {
27 nvidia,pins = "atc";
28 nvidia,function = "nand";
29 };
30 atd {
31 nvidia,pins = "atd", "ate", "gmb", "spia",
32 "spib", "spic";
33 nvidia,function = "gmi";
34 };
35 cdev1 {
36 nvidia,pins = "cdev1";
37 nvidia,function = "plla_out";
38 };
39 cdev2 {
40 nvidia,pins = "cdev2";
41 nvidia,function = "pllp_out4";
42 };
43 crtp {
44 nvidia,pins = "crtp", "lm1";
45 nvidia,function = "crt";
46 };
47 csus {
48 nvidia,pins = "csus";
49 nvidia,function = "vi_sensor_clk";
50 };
51 dap1 {
52 nvidia,pins = "dap1";
53 nvidia,function = "dap1";
54 };
55 dap2 {
56 nvidia,pins = "dap2";
57 nvidia,function = "dap2";
58 };
59 dap3 {
60 nvidia,pins = "dap3";
61 nvidia,function = "dap3";
62 };
63 dap4 {
64 nvidia,pins = "dap4";
65 nvidia,function = "dap4";
66 };
67 ddc {
68 nvidia,pins = "ddc", "owc", "spdi", "spdo",
69 "uac";
70 nvidia,function = "rsvd2";
71 };
72 dta {
73 nvidia,pins = "dta", "dtb", "dtc", "dtd", "dte";
74 nvidia,function = "vi";
75 };
76 dtf {
77 nvidia,pins = "dtf";
78 nvidia,function = "i2c3";
79 };
80 gmc {
81 nvidia,pins = "gmc";
82 nvidia,function = "uartd";
83 };
84 gmd {
85 nvidia,pins = "gmd";
86 nvidia,function = "sflash";
87 };
88 gpu {
89 nvidia,pins = "gpu";
90 nvidia,function = "pwm";
91 };
92 gpu7 {
93 nvidia,pins = "gpu7";
94 nvidia,function = "rtck";
95 };
96 gpv {
97 nvidia,pins = "gpv", "slxa", "slxk";
98 nvidia,function = "pcie";
99 };
100 hdint {
101 nvidia,pins = "hdint", "pta";
102 nvidia,function = "hdmi";
103 };
104 i2cp {
105 nvidia,pins = "i2cp";
106 nvidia,function = "i2cp";
107 };
108 irrx {
109 nvidia,pins = "irrx", "irtx";
110 nvidia,function = "uartb";
111 };
112 kbca {
113 nvidia,pins = "kbca", "kbcb", "kbcc", "kbcd",
114 "kbce", "kbcf";
115 nvidia,function = "kbc";
116 };
117 lcsn {
118 nvidia,pins = "lcsn", "ldc", "lm0", "lpw1",
119 "lsdi", "lvp0";
120 nvidia,function = "rsvd4";
121 };
122 ld0 {
123 nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4",
124 "ld5", "ld6", "ld7", "ld8", "ld9",
125 "ld10", "ld11", "ld12", "ld13", "ld14",
126 "ld15", "ld16", "ld17", "ldi", "lhp0",
127 "lhp1", "lhp2", "lhs", "lpp", "lpw0",
128 "lpw2", "lsc0", "lsc1", "lsck", "lsda",
129 "lspi", "lvp1", "lvs";
130 nvidia,function = "displaya";
131 };
132 pmc {
133 nvidia,pins = "pmc";
134 nvidia,function = "pwr_on";
135 };
136 rm {
137 nvidia,pins = "rm";
138 nvidia,function = "i2c1";
139 };
140 sdb {
141 nvidia,pins = "sdb", "sdc", "sdd", "slxc";
142 nvidia,function = "sdio3";
143 };
144 sdio1 {
145 nvidia,pins = "sdio1";
146 nvidia,function = "sdio1";
147 };
148 slxd {
149 nvidia,pins = "slxd";
150 nvidia,function = "spdif";
151 };
152 spid {
153 nvidia,pins = "spid", "spie", "spif";
154 nvidia,function = "spi1";
155 };
156 spig {
157 nvidia,pins = "spig", "spih";
158 nvidia,function = "spi2_alt";
159 };
160 uaa {
161 nvidia,pins = "uaa", "uab", "uda";
162 nvidia,function = "ulpi";
163 };
164 uad {
165 nvidia,pins = "uad";
166 nvidia,function = "irda";
167 };
168 uca {
169 nvidia,pins = "uca", "ucb";
170 nvidia,function = "uartc";
171 };
172 conf_ata {
173 nvidia,pins = "ata", "atb", "atc", "atd",
174 "cdev1", "cdev2", "dap1", "dap2",
175 "dap4", "ddc", "dtf", "gma", "gmc",
176 "gme", "gpu", "gpu7", "i2cp", "irrx",
177 "irtx", "pta", "rm", "sdc", "sdd",
178 "slxc", "slxd", "slxk", "spdi", "spdo",
179 "uac", "uad", "uca", "ucb", "uda";
180 nvidia,pull = <0>;
181 nvidia,tristate = <0>;
182 };
183 conf_ate {
184 nvidia,pins = "ate", "csus", "dap3", "gmd",
185 "gpv", "owc", "spia", "spib", "spic",
186 "spid", "spie", "spig";
187 nvidia,pull = <0>;
188 nvidia,tristate = <1>;
189 };
190 conf_ck32 {
191 nvidia,pins = "ck32", "ddrc", "pmca", "pmcb",
192 "pmcc", "pmcd", "pmce", "xm2c", "xm2d";
193 nvidia,pull = <0>;
194 };
195 conf_crtp {
196 nvidia,pins = "crtp", "gmb", "slxa", "spih";
197 nvidia,pull = <2>;
198 nvidia,tristate = <1>;
199 };
200 conf_dta {
201 nvidia,pins = "dta", "dtb", "dtc", "dtd";
202 nvidia,pull = <1>;
203 nvidia,tristate = <0>;
204 };
205 conf_dte {
206 nvidia,pins = "dte", "spif";
207 nvidia,pull = <1>;
208 nvidia,tristate = <1>;
209 };
210 conf_hdint {
211 nvidia,pins = "hdint", "lcsn", "ldc", "lm1",
212 "lpw1", "lsck", "lsda", "lsdi", "lvp0";
213 nvidia,tristate = <1>;
214 };
215 conf_kbca {
216 nvidia,pins = "kbca", "kbcb", "kbcc", "kbcd",
217 "kbce", "kbcf", "sdio1", "uaa", "uab";
218 nvidia,pull = <2>;
219 nvidia,tristate = <0>;
220 };
221 conf_lc {
222 nvidia,pins = "lc", "ls";
223 nvidia,pull = <2>;
224 };
225 conf_ld0 {
226 nvidia,pins = "ld0", "ld1", "ld2", "ld3", "ld4",
227 "ld5", "ld6", "ld7", "ld8", "ld9",
228 "ld10", "ld11", "ld12", "ld13", "ld14",
229 "ld15", "ld16", "ld17", "ldi", "lhp0",
230 "lhp1", "lhp2", "lhs", "lm0", "lpp",
231 "lpw0", "lpw2", "lsc0", "lsc1", "lspi",
232 "lvp1", "lvs", "pmc", "sdb";
233 nvidia,tristate = <0>;
234 };
235 conf_ld17_0 {
236 nvidia,pins = "ld17_0", "ld19_18", "ld21_20",
237 "ld23_22";
238 nvidia,pull = <1>;
239 };
240 };
241 };
242
13 i2c@7000c000 { 243 i2c@7000c000 {
14 clock-frequency = <400000>; 244 clock-frequency = <400000>;
15 245
diff --git a/arch/arm/boot/dts/tny_a9260.dts b/arch/arm/boot/dts/tny_a9260.dts
new file mode 100644
index 000000000000..367a16dcd5ef
--- /dev/null
+++ b/arch/arm/boot/dts/tny_a9260.dts
@@ -0,0 +1,15 @@
1/*
2 * tny_a9260.dts - Device Tree file for Caloa TNY A9260 board
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8/dts-v1/;
9/include/ "at91sam9260.dtsi"
10/include/ "tny_a9260_common.dtsi"
11
12/ {
13 model = "Calao TNY A9260";
14 compatible = "calao,tny-a9260", "atmel,at91sam9260", "atmel,at91sam9";
15};
diff --git a/arch/arm/boot/dts/tny_a9260_common.dtsi b/arch/arm/boot/dts/tny_a9260_common.dtsi
new file mode 100644
index 000000000000..0e6d3de2e09e
--- /dev/null
+++ b/arch/arm/boot/dts/tny_a9260_common.dtsi
@@ -0,0 +1,83 @@
1/*
2 * tny_a9260_common.dtsi - Device Tree file for Caloa TNY A926x board
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8
9/ {
10 chosen {
11 bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock6 rw rootfstype=ubifs";
12 };
13
14 memory {
15 reg = <0x20000000 0x4000000>;
16 };
17
18 clocks {
19 #address-cells = <1>;
20 #size-cells = <1>;
21 ranges;
22
23 main_clock: clock@0 {
24 compatible = "atmel,osc", "fixed-clock";
25 clock-frequency = <12000000>;
26 };
27 };
28
29 ahb {
30 apb {
31 dbgu: serial@fffff200 {
32 status = "okay";
33 };
34 };
35
36 nand0: nand@40000000 {
37 nand-bus-width = <8>;
38 nand-ecc-mode = "soft";
39 nand-on-flash-bbt;
40 status = "okay";
41
42 at91bootstrap@0 {
43 label = "at91bootstrap";
44 reg = <0x0 0x20000>;
45 };
46
47 barebox@20000 {
48 label = "barebox";
49 reg = <0x20000 0x40000>;
50 };
51
52 bareboxenv@60000 {
53 label = "bareboxenv";
54 reg = <0x60000 0x20000>;
55 };
56
57 bareboxenv2@80000 {
58 label = "bareboxenv2";
59 reg = <0x80000 0x20000>;
60 };
61
62 oftree@80000 {
63 label = "oftree";
64 reg = <0xa0000 0x20000>;
65 };
66
67 kernel@a0000 {
68 label = "kernel";
69 reg = <0xc0000 0x400000>;
70 };
71
72 rootfs@4a0000 {
73 label = "rootfs";
74 reg = <0x4c0000 0x7800000>;
75 };
76
77 data@7ca0000 {
78 label = "data";
79 reg = <0x7cc0000 0x8340000>;
80 };
81 };
82 };
83};
diff --git a/arch/arm/boot/dts/tny_a9263.dts b/arch/arm/boot/dts/tny_a9263.dts
new file mode 100644
index 000000000000..dee9c571306b
--- /dev/null
+++ b/arch/arm/boot/dts/tny_a9263.dts
@@ -0,0 +1,97 @@
1/*
2 * usb_a9263.dts - Device Tree file for Caloa USB A9293 board
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2 only
7 */
8/dts-v1/;
9/include/ "at91sam9263.dtsi"
10
11/ {
12 model = "Calao TNY A9263";
13 compatible = "atmel,tny-a9263", "atmel,at91sam9263", "atmel,at91sam9";
14
15 chosen {
16 bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock5 rw rootfstype=ubifs";
17 };
18
19 memory {
20 reg = <0x20000000 0x4000000>;
21 };
22
23 clocks {
24 #address-cells = <1>;
25 #size-cells = <1>;
26 ranges;
27
28 main_clock: clock@0 {
29 compatible = "atmel,osc", "fixed-clock";
30 clock-frequency = <12000000>;
31 };
32 };
33
34 ahb {
35 apb {
36 dbgu: serial@ffffee00 {
37 status = "okay";
38 };
39
40 usb1: gadget@fff78000 {
41 atmel,vbus-gpio = <&pioB 11 0>;
42 status = "okay";
43 };
44 };
45
46 nand0: nand@40000000 {
47 nand-bus-width = <8>;
48 nand-ecc-mode = "soft";
49 nand-on-flash-bbt;
50 status = "okay";
51
52 at91bootstrap@0 {
53 label = "at91bootstrap";
54 reg = <0x0 0x20000>;
55 };
56
57 barebox@20000 {
58 label = "barebox";
59 reg = <0x20000 0x40000>;
60 };
61
62 bareboxenv@60000 {
63 label = "bareboxenv";
64 reg = <0x60000 0x20000>;
65 };
66
67 bareboxenv2@80000 {
68 label = "bareboxenv2";
69 reg = <0x80000 0x20000>;
70 };
71
72 oftree@80000 {
73 label = "oftree";
74 reg = <0xa0000 0x20000>;
75 };
76
77 kernel@a0000 {
78 label = "kernel";
79 reg = <0xc0000 0x400000>;
80 };
81
82 rootfs@4a0000 {
83 label = "rootfs";
84 reg = <0x4c0000 0x7800000>;
85 };
86
87 data@7ca0000 {
88 label = "data";
89 reg = <0x7cc0000 0x8340000>;
90 };
91 };
92 };
93
94 i2c@0 {
95 status = "okay";
96 };
97};
diff --git a/arch/arm/boot/dts/tny_a9g20.dts b/arch/arm/boot/dts/tny_a9g20.dts
new file mode 100644
index 000000000000..e1ab64c72dba
--- /dev/null
+++ b/arch/arm/boot/dts/tny_a9g20.dts
@@ -0,0 +1,15 @@
1/*
2 * tny_a9g20.dts - Device Tree file for Caloa TNY A9G20 board
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8/dts-v1/;
9/include/ "at91sam9g20.dtsi"
10/include/ "tny_a9260_common.dtsi"
11
12/ {
13 model = "Calao TNY A9G20";
14 compatible = "calao,tny-a9g20", "atmel,at91sam9g20", "atmel,at91sam9";
15};
diff --git a/arch/arm/boot/dts/twl4030.dtsi b/arch/arm/boot/dts/twl4030.dtsi
new file mode 100644
index 000000000000..22f4d1394ed3
--- /dev/null
+++ b/arch/arm/boot/dts/twl4030.dtsi
@@ -0,0 +1,47 @@
1/*
2 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9/*
10 * Integrated Power Management Chip
11 */
12&twl {
13 compatible = "ti,twl4030";
14 interrupt-controller;
15 #interrupt-cells = <1>;
16
17 rtc {
18 compatible = "ti,twl4030-rtc";
19 interrupts = <11>;
20 };
21
22 vdac: regulator@0 {
23 compatible = "ti,twl4030-vdac";
24 regulator-min-microvolt = <1800000>;
25 regulator-max-microvolt = <1800000>;
26 };
27
28 vpll2: regulator@1 {
29 compatible = "ti,twl4030-vpll2";
30 regulator-min-microvolt = <1800000>;
31 regulator-max-microvolt = <1800000>;
32 };
33
34 vmmc1: regulator@2 {
35 compatible = "ti,twl4030-vmmc1";
36 regulator-min-microvolt = <1850000>;
37 regulator-max-microvolt = <3150000>;
38 };
39
40 twl_gpio: gpio {
41 compatible = "ti,twl4030-gpio";
42 gpio-controller;
43 #gpio-cells = <2>;
44 interrupt-controller;
45 #interrupt-cells = <1>;
46 };
47};
diff --git a/arch/arm/boot/dts/twl6030.dtsi b/arch/arm/boot/dts/twl6030.dtsi
new file mode 100644
index 000000000000..3b2f3510d7eb
--- /dev/null
+++ b/arch/arm/boot/dts/twl6030.dtsi
@@ -0,0 +1,86 @@
1/*
2 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9/*
10 * Integrated Power Management Chip
11 * http://www.ti.com/lit/ds/symlink/twl6030.pdf
12 */
13&twl {
14 compatible = "ti,twl6030";
15 interrupt-controller;
16 #interrupt-cells = <1>;
17
18 rtc {
19 compatible = "ti,twl4030-rtc";
20 interrupts = <11>;
21 };
22
23 vaux1: regulator@0 {
24 compatible = "ti,twl6030-vaux1";
25 regulator-min-microvolt = <1000000>;
26 regulator-max-microvolt = <3000000>;
27 };
28
29 vaux2: regulator@1 {
30 compatible = "ti,twl6030-vaux2";
31 regulator-min-microvolt = <1200000>;
32 regulator-max-microvolt = <2800000>;
33 };
34
35 vaux3: regulator@2 {
36 compatible = "ti,twl6030-vaux3";
37 regulator-min-microvolt = <1000000>;
38 regulator-max-microvolt = <3000000>;
39 };
40
41 vmmc: regulator@3 {
42 compatible = "ti,twl6030-vmmc";
43 regulator-min-microvolt = <1200000>;
44 regulator-max-microvolt = <3000000>;
45 };
46
47 vpp: regulator@4 {
48 compatible = "ti,twl6030-vpp";
49 regulator-min-microvolt = <1800000>;
50 regulator-max-microvolt = <2500000>;
51 };
52
53 vusim: regulator@5 {
54 compatible = "ti,twl6030-vusim";
55 regulator-min-microvolt = <1200000>;
56 regulator-max-microvolt = <2900000>;
57 };
58
59 vdac: regulator@6 {
60 compatible = "ti,twl6030-vdac";
61 };
62
63 vana: regulator@7 {
64 compatible = "ti,twl6030-vana";
65 };
66
67 vcxio: regulator@8 {
68 compatible = "ti,twl6030-vcxio";
69 };
70
71 vusb: regulator@9 {
72 compatible = "ti,twl6030-vusb";
73 };
74
75 v1v8: regulator@10 {
76 compatible = "ti,twl6030-v1v8";
77 };
78
79 v2v1: regulator@11 {
80 compatible = "ti,twl6030-v2v1";
81 };
82
83 clk32kg: regulator@12 {
84 compatible = "ti,twl6030-clk32kg";
85 };
86};
diff --git a/arch/arm/boot/dts/usb_a9260.dts b/arch/arm/boot/dts/usb_a9260.dts
new file mode 100644
index 000000000000..296216058c11
--- /dev/null
+++ b/arch/arm/boot/dts/usb_a9260.dts
@@ -0,0 +1,23 @@
1/*
2 * usb_a9260.dts - Device Tree file for Caloa USB A9260 board
3 *
4 * Copyright (C) 2011-2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2 or later.
7 */
8/dts-v1/;
9/include/ "at91sam9260.dtsi"
10/include/ "usb_a9260_common.dtsi"
11
12/ {
13 model = "Calao USB A9260";
14 compatible = "calao,usb-a9260", "atmel,at91sam9260", "atmel,at91sam9";
15
16 chosen {
17 bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock5 rw rootfstype=ubifs";
18 };
19
20 memory {
21 reg = <0x20000000 0x4000000>;
22 };
23};
diff --git a/arch/arm/boot/dts/usb_a9260_common.dtsi b/arch/arm/boot/dts/usb_a9260_common.dtsi
new file mode 100644
index 000000000000..e70d229baef5
--- /dev/null
+++ b/arch/arm/boot/dts/usb_a9260_common.dtsi
@@ -0,0 +1,117 @@
1/*
2 * usb_a926x.dts - Device Tree file for Caloa USB A926x board
3 *
4 * Copyright (C) 2011-2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9/ {
10 clocks {
11 #address-cells = <1>;
12 #size-cells = <1>;
13 ranges;
14
15 main_clock: clock@0 {
16 compatible = "atmel,osc", "fixed-clock";
17 clock-frequency = <12000000>;
18 };
19 };
20
21 ahb {
22 apb {
23 dbgu: serial@fffff200 {
24 status = "okay";
25 };
26
27 macb0: ethernet@fffc4000 {
28 phy-mode = "rmii";
29 status = "okay";
30 };
31
32 usb1: gadget@fffa4000 {
33 atmel,vbus-gpio = <&pioC 5 0>;
34 status = "okay";
35 };
36 };
37
38 nand0: nand@40000000 {
39 nand-bus-width = <8>;
40 nand-ecc-mode = "soft";
41 nand-on-flash-bbt;
42 status = "okay";
43
44 at91bootstrap@0 {
45 label = "at91bootstrap";
46 reg = <0x0 0x20000>;
47 };
48
49 barebox@20000 {
50 label = "barebox";
51 reg = <0x20000 0x40000>;
52 };
53
54 bareboxenv@60000 {
55 label = "bareboxenv";
56 reg = <0x60000 0x20000>;
57 };
58
59 bareboxenv2@80000 {
60 label = "bareboxenv2";
61 reg = <0x80000 0x20000>;
62 };
63
64 oftree@80000 {
65 label = "oftree";
66 reg = <0xa0000 0x20000>;
67 };
68
69 kernel@a0000 {
70 label = "kernel";
71 reg = <0xc0000 0x400000>;
72 };
73
74 rootfs@4a0000 {
75 label = "rootfs";
76 reg = <0x4c0000 0x7800000>;
77 };
78
79 data@7ca0000 {
80 label = "data";
81 reg = <0x7cc0000 0x8340000>;
82 };
83 };
84
85 usb0: ohci@00500000 {
86 num-ports = <2>;
87 status = "okay";
88 };
89 };
90
91 leds {
92 compatible = "gpio-leds";
93
94 user_led {
95 label = "user_led";
96 gpios = <&pioB 21 1>;
97 linux,default-trigger = "heartbeat";
98 };
99 };
100
101 gpio_keys {
102 compatible = "gpio-keys";
103 #address-cells = <1>;
104 #size-cells = <0>;
105
106 user_pb {
107 label = "user_pb";
108 gpios = <&pioB 10 1>;
109 linux,code = <28>;
110 gpio-key,wakeup;
111 };
112 };
113
114 i2c@0 {
115 status = "okay";
116 };
117};
diff --git a/arch/arm/boot/dts/usb_a9263.dts b/arch/arm/boot/dts/usb_a9263.dts
new file mode 100644
index 000000000000..6fe05ccb6203
--- /dev/null
+++ b/arch/arm/boot/dts/usb_a9263.dts
@@ -0,0 +1,131 @@
1/*
2 * usb_a9263.dts - Device Tree file for Caloa USB A9293 board
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2 only
7 */
8/dts-v1/;
9/include/ "at91sam9263.dtsi"
10
11/ {
12 model = "Calao USB A9263";
13 compatible = "atmel,usb-a9263", "atmel,at91sam9263", "atmel,at91sam9";
14
15 chosen {
16 bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock5 rw rootfstype=ubifs";
17 };
18
19 memory {
20 reg = <0x20000000 0x4000000>;
21 };
22
23 clocks {
24 #address-cells = <1>;
25 #size-cells = <1>;
26 ranges;
27
28 main_clock: clock@0 {
29 compatible = "atmel,osc", "fixed-clock";
30 clock-frequency = <12000000>;
31 };
32 };
33
34 ahb {
35 apb {
36 dbgu: serial@ffffee00 {
37 status = "okay";
38 };
39
40 macb0: ethernet@fffbc000 {
41 phy-mode = "rmii";
42 status = "okay";
43 };
44
45 usb1: gadget@fff78000 {
46 atmel,vbus-gpio = <&pioB 11 0>;
47 status = "okay";
48 };
49
50 };
51
52 nand0: nand@40000000 {
53 nand-bus-width = <8>;
54 nand-ecc-mode = "soft";
55 nand-on-flash-bbt;
56 status = "okay";
57
58 at91bootstrap@0 {
59 label = "at91bootstrap";
60 reg = <0x0 0x20000>;
61 };
62
63 barebox@20000 {
64 label = "barebox";
65 reg = <0x20000 0x40000>;
66 };
67
68 bareboxenv@60000 {
69 label = "bareboxenv";
70 reg = <0x60000 0x20000>;
71 };
72
73 bareboxenv2@80000 {
74 label = "bareboxenv2";
75 reg = <0x80000 0x20000>;
76 };
77
78 oftree@80000 {
79 label = "oftree";
80 reg = <0xa0000 0x20000>;
81 };
82
83 kernel@a0000 {
84 label = "kernel";
85 reg = <0xc0000 0x400000>;
86 };
87
88 rootfs@4a0000 {
89 label = "rootfs";
90 reg = <0x4c0000 0x7800000>;
91 };
92
93 data@7ca0000 {
94 label = "data";
95 reg = <0x7cc0000 0x8340000>;
96 };
97 };
98
99 usb0: ohci@00a00000 {
100 num-ports = <2>;
101 status = "okay";
102 };
103 };
104
105 leds {
106 compatible = "gpio-leds";
107
108 user_led {
109 label = "user_led";
110 gpios = <&pioB 21 0>;
111 linux,default-trigger = "heartbeat";
112 };
113 };
114
115 gpio_keys {
116 compatible = "gpio-keys";
117 #address-cells = <1>;
118 #size-cells = <0>;
119
120 user_pb {
121 label = "user_pb";
122 gpios = <&pioB 10 1>;
123 linux,code = <28>;
124 gpio-key,wakeup;
125 };
126 };
127
128 i2c@0 {
129 status = "okay";
130 };
131};
diff --git a/arch/arm/boot/dts/usb_a9g20.dts b/arch/arm/boot/dts/usb_a9g20.dts
index 7c2399c532e5..2dacb16ce4ae 100644
--- a/arch/arm/boot/dts/usb_a9g20.dts
+++ b/arch/arm/boot/dts/usb_a9g20.dts
@@ -7,6 +7,7 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9/include/ "at91sam9g20.dtsi" 9/include/ "at91sam9g20.dtsi"
10/include/ "usb_a9260_common.dtsi"
10 11
11/ { 12/ {
12 model = "Calao USB A9G20"; 13 model = "Calao USB A9G20";
@@ -20,108 +21,7 @@
20 reg = <0x20000000 0x4000000>; 21 reg = <0x20000000 0x4000000>;
21 }; 22 };
22 23
23 clocks {
24 #address-cells = <1>;
25 #size-cells = <1>;
26 ranges;
27
28 main_clock: clock@0 {
29 compatible = "atmel,osc", "fixed-clock";
30 clock-frequency = <12000000>;
31 };
32 };
33
34 ahb {
35 apb {
36 dbgu: serial@fffff200 {
37 status = "okay";
38 };
39
40 macb0: ethernet@fffc4000 {
41 phy-mode = "rmii";
42 status = "okay";
43 };
44
45 usb1: gadget@fffa4000 {
46 atmel,vbus-gpio = <&pioC 5 0>;
47 status = "okay";
48 };
49 };
50
51 nand0: nand@40000000 {
52 nand-bus-width = <8>;
53 nand-ecc-mode = "soft";
54 nand-on-flash-bbt;
55 status = "okay";
56
57 at91bootstrap@0 {
58 label = "at91bootstrap";
59 reg = <0x0 0x20000>;
60 };
61
62 barebox@20000 {
63 label = "barebox";
64 reg = <0x20000 0x40000>;
65 };
66
67 bareboxenv@60000 {
68 label = "bareboxenv";
69 reg = <0x60000 0x20000>;
70 };
71
72 bareboxenv2@80000 {
73 label = "bareboxenv2";
74 reg = <0x80000 0x20000>;
75 };
76
77 kernel@a0000 {
78 label = "kernel";
79 reg = <0xa0000 0x400000>;
80 };
81
82 rootfs@4a0000 {
83 label = "rootfs";
84 reg = <0x4a0000 0x7800000>;
85 };
86
87 data@7ca0000 {
88 label = "data";
89 reg = <0x7ca0000 0x8360000>;
90 };
91 };
92
93 usb0: ohci@00500000 {
94 num-ports = <2>;
95 status = "okay";
96 };
97 };
98
99 leds {
100 compatible = "gpio-leds";
101
102 user_led {
103 label = "user_led";
104 gpios = <&pioB 21 1>;
105 linux,default-trigger = "heartbeat";
106 };
107 };
108
109 gpio_keys {
110 compatible = "gpio-keys";
111 #address-cells = <1>;
112 #size-cells = <0>;
113
114 user_pb {
115 label = "user_pb";
116 gpios = <&pioB 10 1>;
117 linux,code = <28>;
118 gpio-key,wakeup;
119 };
120 };
121
122 i2c@0 { 24 i2c@0 {
123 status = "okay";
124
125 rv3029c2@56 { 25 rv3029c2@56 {
126 compatible = "rv3029c2"; 26 compatible = "rv3029c2";
127 reg = <0x56>; 27 reg = <0x56>;
diff --git a/arch/arm/boot/dts/versatile-ab.dts b/arch/arm/boot/dts/versatile-ab.dts
index 0b32925f2147..e2fe3195c0d1 100644
--- a/arch/arm/boot/dts/versatile-ab.dts
+++ b/arch/arm/boot/dts/versatile-ab.dts
@@ -173,7 +173,7 @@
173 mmc@5000 { 173 mmc@5000 {
174 compatible = "arm,primecell"; 174 compatible = "arm,primecell";
175 reg = < 0x5000 0x1000>; 175 reg = < 0x5000 0x1000>;
176 interrupts = <22>; 176 interrupts = <22 34>;
177 }; 177 };
178 kmi@6000 { 178 kmi@6000 {
179 compatible = "arm,pl050", "arm,primecell"; 179 compatible = "arm,pl050", "arm,primecell";
diff --git a/arch/arm/boot/dts/versatile-pb.dts b/arch/arm/boot/dts/versatile-pb.dts
index 166461073b78..7e8175269064 100644
--- a/arch/arm/boot/dts/versatile-pb.dts
+++ b/arch/arm/boot/dts/versatile-pb.dts
@@ -41,7 +41,7 @@
41 mmc@b000 { 41 mmc@b000 {
42 compatible = "arm,primecell"; 42 compatible = "arm,primecell";
43 reg = <0xb000 0x1000>; 43 reg = <0xb000 0x1000>;
44 interrupts = <23>; 44 interrupts = <23 34>;
45 }; 45 };
46 }; 46 };
47 }; 47 };
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index 215816f1775f..e8a4e58f1b82 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -11,7 +11,5 @@ obj-$(CONFIG_DMABOUNCE) += dmabounce.o
11obj-$(CONFIG_SHARP_LOCOMO) += locomo.o 11obj-$(CONFIG_SHARP_LOCOMO) += locomo.o
12obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o 12obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o
13obj-$(CONFIG_SHARP_SCOOP) += scoop.o 13obj-$(CONFIG_SHARP_SCOOP) += scoop.o
14obj-$(CONFIG_ARCH_IXP2000) += uengine.o
15obj-$(CONFIG_ARCH_IXP23XX) += uengine.o
16obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o 14obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o
17obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o 15obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o
diff --git a/arch/arm/common/it8152.c b/arch/arm/common/it8152.c
index dcb13494ca0d..c4110d1b1f2d 100644
--- a/arch/arm/common/it8152.c
+++ b/arch/arm/common/it8152.c
@@ -222,7 +222,7 @@ static int it8152_pci_write_config(struct pci_bus *bus,
222 return PCIBIOS_SUCCESSFUL; 222 return PCIBIOS_SUCCESSFUL;
223} 223}
224 224
225static struct pci_ops it8152_ops = { 225struct pci_ops it8152_ops = {
226 .read = it8152_pci_read_config, 226 .read = it8152_pci_read_config,
227 .write = it8152_pci_write_config, 227 .write = it8152_pci_write_config,
228}; 228};
@@ -346,9 +346,4 @@ void pcibios_set_master(struct pci_dev *dev)
346} 346}
347 347
348 348
349struct pci_bus * __init it8152_pci_scan_bus(int nr, struct pci_sys_data *sys)
350{
351 return pci_scan_root_bus(NULL, nr, &it8152_ops, sys, &sys->resources);
352}
353
354EXPORT_SYMBOL(dma_set_coherent_mask); 349EXPORT_SYMBOL(dma_set_coherent_mask);
diff --git a/arch/arm/common/uengine.c b/arch/arm/common/uengine.c
deleted file mode 100644
index bef408f3d76c..000000000000
--- a/arch/arm/common/uengine.c
+++ /dev/null
@@ -1,507 +0,0 @@
1/*
2 * Generic library functions for the microengines found on the Intel
3 * IXP2000 series of network processors.
4 *
5 * Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org>
6 * Dedicated to Marija Kulikova.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as
10 * published by the Free Software Foundation; either version 2.1 of the
11 * License, or (at your option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/slab.h>
17#include <linux/module.h>
18#include <linux/string.h>
19#include <linux/io.h>
20#include <mach/hardware.h>
21#include <asm/hardware/uengine.h>
22
23#if defined(CONFIG_ARCH_IXP2000)
24#define IXP_UENGINE_CSR_VIRT_BASE IXP2000_UENGINE_CSR_VIRT_BASE
25#define IXP_PRODUCT_ID IXP2000_PRODUCT_ID
26#define IXP_MISC_CONTROL IXP2000_MISC_CONTROL
27#define IXP_RESET1 IXP2000_RESET1
28#else
29#if defined(CONFIG_ARCH_IXP23XX)
30#define IXP_UENGINE_CSR_VIRT_BASE IXP23XX_UENGINE_CSR_VIRT_BASE
31#define IXP_PRODUCT_ID IXP23XX_PRODUCT_ID
32#define IXP_MISC_CONTROL IXP23XX_MISC_CONTROL
33#define IXP_RESET1 IXP23XX_RESET1
34#else
35#error unknown platform
36#endif
37#endif
38
39#define USTORE_ADDRESS 0x000
40#define USTORE_DATA_LOWER 0x004
41#define USTORE_DATA_UPPER 0x008
42#define CTX_ENABLES 0x018
43#define CC_ENABLE 0x01c
44#define CSR_CTX_POINTER 0x020
45#define INDIRECT_CTX_STS 0x040
46#define ACTIVE_CTX_STS 0x044
47#define INDIRECT_CTX_SIG_EVENTS 0x048
48#define INDIRECT_CTX_WAKEUP_EVENTS 0x050
49#define NN_PUT 0x080
50#define NN_GET 0x084
51#define TIMESTAMP_LOW 0x0c0
52#define TIMESTAMP_HIGH 0x0c4
53#define T_INDEX_BYTE_INDEX 0x0f4
54#define LOCAL_CSR_STATUS 0x180
55
56u32 ixp2000_uengine_mask;
57
58static void *ixp2000_uengine_csr_area(int uengine)
59{
60 return ((void *)IXP_UENGINE_CSR_VIRT_BASE) + (uengine << 10);
61}
62
63/*
64 * LOCAL_CSR_STATUS=1 after a read or write to a microengine's CSR
65 * space means that the microengine we tried to access was also trying
66 * to access its own CSR space on the same clock cycle as we did. When
67 * this happens, we lose the arbitration process by default, and the
68 * read or write we tried to do was not actually performed, so we try
69 * again until it succeeds.
70 */
71u32 ixp2000_uengine_csr_read(int uengine, int offset)
72{
73 void *uebase;
74 u32 *local_csr_status;
75 u32 *reg;
76 u32 value;
77
78 uebase = ixp2000_uengine_csr_area(uengine);
79
80 local_csr_status = (u32 *)(uebase + LOCAL_CSR_STATUS);
81 reg = (u32 *)(uebase + offset);
82 do {
83 value = ixp2000_reg_read(reg);
84 } while (ixp2000_reg_read(local_csr_status) & 1);
85
86 return value;
87}
88EXPORT_SYMBOL(ixp2000_uengine_csr_read);
89
90void ixp2000_uengine_csr_write(int uengine, int offset, u32 value)
91{
92 void *uebase;
93 u32 *local_csr_status;
94 u32 *reg;
95
96 uebase = ixp2000_uengine_csr_area(uengine);
97
98 local_csr_status = (u32 *)(uebase + LOCAL_CSR_STATUS);
99 reg = (u32 *)(uebase + offset);
100 do {
101 ixp2000_reg_write(reg, value);
102 } while (ixp2000_reg_read(local_csr_status) & 1);
103}
104EXPORT_SYMBOL(ixp2000_uengine_csr_write);
105
106void ixp2000_uengine_reset(u32 uengine_mask)
107{
108 u32 value;
109
110 value = ixp2000_reg_read(IXP_RESET1) & ~ixp2000_uengine_mask;
111
112 uengine_mask &= ixp2000_uengine_mask;
113 ixp2000_reg_wrb(IXP_RESET1, value | uengine_mask);
114 ixp2000_reg_wrb(IXP_RESET1, value);
115}
116EXPORT_SYMBOL(ixp2000_uengine_reset);
117
118void ixp2000_uengine_set_mode(int uengine, u32 mode)
119{
120 /*
121 * CTL_STR_PAR_EN: unconditionally enable parity checking on
122 * control store.
123 */
124 mode |= 0x10000000;
125 ixp2000_uengine_csr_write(uengine, CTX_ENABLES, mode);
126
127 /*
128 * Enable updating of condition codes.
129 */
130 ixp2000_uengine_csr_write(uengine, CC_ENABLE, 0x00002000);
131
132 /*
133 * Initialise other per-microengine registers.
134 */
135 ixp2000_uengine_csr_write(uengine, NN_PUT, 0x00);
136 ixp2000_uengine_csr_write(uengine, NN_GET, 0x00);
137 ixp2000_uengine_csr_write(uengine, T_INDEX_BYTE_INDEX, 0);
138}
139EXPORT_SYMBOL(ixp2000_uengine_set_mode);
140
141static int make_even_parity(u32 x)
142{
143 return hweight32(x) & 1;
144}
145
146static void ustore_write(int uengine, u64 insn)
147{
148 /*
149 * Generate even parity for top and bottom 20 bits.
150 */
151 insn |= (u64)make_even_parity((insn >> 20) & 0x000fffff) << 41;
152 insn |= (u64)make_even_parity(insn & 0x000fffff) << 40;
153
154 /*
155 * Write to microstore. The second write auto-increments
156 * the USTORE_ADDRESS index register.
157 */
158 ixp2000_uengine_csr_write(uengine, USTORE_DATA_LOWER, (u32)insn);
159 ixp2000_uengine_csr_write(uengine, USTORE_DATA_UPPER, (u32)(insn >> 32));
160}
161
162void ixp2000_uengine_load_microcode(int uengine, u8 *ucode, int insns)
163{
164 int i;
165
166 /*
167 * Start writing to microstore at address 0.
168 */
169 ixp2000_uengine_csr_write(uengine, USTORE_ADDRESS, 0x80000000);
170 for (i = 0; i < insns; i++) {
171 u64 insn;
172
173 insn = (((u64)ucode[0]) << 32) |
174 (((u64)ucode[1]) << 24) |
175 (((u64)ucode[2]) << 16) |
176 (((u64)ucode[3]) << 8) |
177 ((u64)ucode[4]);
178 ucode += 5;
179
180 ustore_write(uengine, insn);
181 }
182
183 /*
184 * Pad with a few NOPs at the end (to avoid the microengine
185 * aborting as it prefetches beyond the last instruction), unless
186 * we run off the end of the instruction store first, at which
187 * point the address register will wrap back to zero.
188 */
189 for (i = 0; i < 4; i++) {
190 u32 addr;
191
192 addr = ixp2000_uengine_csr_read(uengine, USTORE_ADDRESS);
193 if (addr == 0x80000000)
194 break;
195 ustore_write(uengine, 0xf0000c0300ULL);
196 }
197
198 /*
199 * End programming.
200 */
201 ixp2000_uengine_csr_write(uengine, USTORE_ADDRESS, 0x00000000);
202}
203EXPORT_SYMBOL(ixp2000_uengine_load_microcode);
204
205void ixp2000_uengine_init_context(int uengine, int context, int pc)
206{
207 /*
208 * Select the right context for indirect access.
209 */
210 ixp2000_uengine_csr_write(uengine, CSR_CTX_POINTER, context);
211
212 /*
213 * Initialise signal masks to immediately go to Ready state.
214 */
215 ixp2000_uengine_csr_write(uengine, INDIRECT_CTX_SIG_EVENTS, 1);
216 ixp2000_uengine_csr_write(uengine, INDIRECT_CTX_WAKEUP_EVENTS, 1);
217
218 /*
219 * Set program counter.
220 */
221 ixp2000_uengine_csr_write(uengine, INDIRECT_CTX_STS, pc);
222}
223EXPORT_SYMBOL(ixp2000_uengine_init_context);
224
225void ixp2000_uengine_start_contexts(int uengine, u8 ctx_mask)
226{
227 u32 mask;
228
229 /*
230 * Enable the specified context to go to Executing state.
231 */
232 mask = ixp2000_uengine_csr_read(uengine, CTX_ENABLES);
233 mask |= ctx_mask << 8;
234 ixp2000_uengine_csr_write(uengine, CTX_ENABLES, mask);
235}
236EXPORT_SYMBOL(ixp2000_uengine_start_contexts);
237
238void ixp2000_uengine_stop_contexts(int uengine, u8 ctx_mask)
239{
240 u32 mask;
241
242 /*
243 * Disable the Ready->Executing transition. Note that this
244 * does not stop the context until it voluntarily yields.
245 */
246 mask = ixp2000_uengine_csr_read(uengine, CTX_ENABLES);
247 mask &= ~(ctx_mask << 8);
248 ixp2000_uengine_csr_write(uengine, CTX_ENABLES, mask);
249}
250EXPORT_SYMBOL(ixp2000_uengine_stop_contexts);
251
252static int check_ixp_type(struct ixp2000_uengine_code *c)
253{
254 u32 product_id;
255 u32 rev;
256
257 product_id = ixp2000_reg_read(IXP_PRODUCT_ID);
258 if (((product_id >> 16) & 0x1f) != 0)
259 return 0;
260
261 switch ((product_id >> 8) & 0xff) {
262#ifdef CONFIG_ARCH_IXP2000
263 case 0: /* IXP2800 */
264 if (!(c->cpu_model_bitmask & 4))
265 return 0;
266 break;
267
268 case 1: /* IXP2850 */
269 if (!(c->cpu_model_bitmask & 8))
270 return 0;
271 break;
272
273 case 2: /* IXP2400 */
274 if (!(c->cpu_model_bitmask & 2))
275 return 0;
276 break;
277#endif
278
279#ifdef CONFIG_ARCH_IXP23XX
280 case 4: /* IXP23xx */
281 if (!(c->cpu_model_bitmask & 0x3f0))
282 return 0;
283 break;
284#endif
285
286 default:
287 return 0;
288 }
289
290 rev = product_id & 0xff;
291 if (rev < c->cpu_min_revision || rev > c->cpu_max_revision)
292 return 0;
293
294 return 1;
295}
296
297static void generate_ucode(u8 *ucode, u32 *gpr_a, u32 *gpr_b)
298{
299 int offset;
300 int i;
301
302 offset = 0;
303
304 for (i = 0; i < 128; i++) {
305 u8 b3;
306 u8 b2;
307 u8 b1;
308 u8 b0;
309
310 b3 = (gpr_a[i] >> 24) & 0xff;
311 b2 = (gpr_a[i] >> 16) & 0xff;
312 b1 = (gpr_a[i] >> 8) & 0xff;
313 b0 = gpr_a[i] & 0xff;
314
315 /* immed[@ai, (b1 << 8) | b0] */
316 /* 11110000 0000VVVV VVVV11VV VVVVVV00 1IIIIIII */
317 ucode[offset++] = 0xf0;
318 ucode[offset++] = (b1 >> 4);
319 ucode[offset++] = (b1 << 4) | 0x0c | (b0 >> 6);
320 ucode[offset++] = (b0 << 2);
321 ucode[offset++] = 0x80 | i;
322
323 /* immed_w1[@ai, (b3 << 8) | b2] */
324 /* 11110100 0100VVVV VVVV11VV VVVVVV00 1IIIIIII */
325 ucode[offset++] = 0xf4;
326 ucode[offset++] = 0x40 | (b3 >> 4);
327 ucode[offset++] = (b3 << 4) | 0x0c | (b2 >> 6);
328 ucode[offset++] = (b2 << 2);
329 ucode[offset++] = 0x80 | i;
330 }
331
332 for (i = 0; i < 128; i++) {
333 u8 b3;
334 u8 b2;
335 u8 b1;
336 u8 b0;
337
338 b3 = (gpr_b[i] >> 24) & 0xff;
339 b2 = (gpr_b[i] >> 16) & 0xff;
340 b1 = (gpr_b[i] >> 8) & 0xff;
341 b0 = gpr_b[i] & 0xff;
342
343 /* immed[@bi, (b1 << 8) | b0] */
344 /* 11110000 0000VVVV VVVV001I IIIIII11 VVVVVVVV */
345 ucode[offset++] = 0xf0;
346 ucode[offset++] = (b1 >> 4);
347 ucode[offset++] = (b1 << 4) | 0x02 | (i >> 6);
348 ucode[offset++] = (i << 2) | 0x03;
349 ucode[offset++] = b0;
350
351 /* immed_w1[@bi, (b3 << 8) | b2] */
352 /* 11110100 0100VVVV VVVV001I IIIIII11 VVVVVVVV */
353 ucode[offset++] = 0xf4;
354 ucode[offset++] = 0x40 | (b3 >> 4);
355 ucode[offset++] = (b3 << 4) | 0x02 | (i >> 6);
356 ucode[offset++] = (i << 2) | 0x03;
357 ucode[offset++] = b2;
358 }
359
360 /* ctx_arb[kill] */
361 ucode[offset++] = 0xe0;
362 ucode[offset++] = 0x00;
363 ucode[offset++] = 0x01;
364 ucode[offset++] = 0x00;
365 ucode[offset++] = 0x00;
366}
367
368static int set_initial_registers(int uengine, struct ixp2000_uengine_code *c)
369{
370 int per_ctx_regs;
371 u32 *gpr_a;
372 u32 *gpr_b;
373 u8 *ucode;
374 int i;
375
376 gpr_a = kzalloc(128 * sizeof(u32), GFP_KERNEL);
377 gpr_b = kzalloc(128 * sizeof(u32), GFP_KERNEL);
378 ucode = kmalloc(513 * 5, GFP_KERNEL);
379 if (gpr_a == NULL || gpr_b == NULL || ucode == NULL) {
380 kfree(ucode);
381 kfree(gpr_b);
382 kfree(gpr_a);
383 return 1;
384 }
385
386 per_ctx_regs = 16;
387 if (c->uengine_parameters & IXP2000_UENGINE_4_CONTEXTS)
388 per_ctx_regs = 32;
389
390 for (i = 0; i < 256; i++) {
391 struct ixp2000_reg_value *r = c->initial_reg_values + i;
392 u32 *bank;
393 int inc;
394 int j;
395
396 if (r->reg == -1)
397 break;
398
399 bank = (r->reg & 0x400) ? gpr_b : gpr_a;
400 inc = (r->reg & 0x80) ? 128 : per_ctx_regs;
401
402 j = r->reg & 0x7f;
403 while (j < 128) {
404 bank[j] = r->value;
405 j += inc;
406 }
407 }
408
409 generate_ucode(ucode, gpr_a, gpr_b);
410 ixp2000_uengine_load_microcode(uengine, ucode, 513);
411 ixp2000_uengine_init_context(uengine, 0, 0);
412 ixp2000_uengine_start_contexts(uengine, 0x01);
413 for (i = 0; i < 100; i++) {
414 u32 status;
415
416 status = ixp2000_uengine_csr_read(uengine, ACTIVE_CTX_STS);
417 if (!(status & 0x80000000))
418 break;
419 }
420 ixp2000_uengine_stop_contexts(uengine, 0x01);
421
422 kfree(ucode);
423 kfree(gpr_b);
424 kfree(gpr_a);
425
426 return !!(i == 100);
427}
428
429int ixp2000_uengine_load(int uengine, struct ixp2000_uengine_code *c)
430{
431 int ctx;
432
433 if (!check_ixp_type(c))
434 return 1;
435
436 if (!(ixp2000_uengine_mask & (1 << uengine)))
437 return 1;
438
439 ixp2000_uengine_reset(1 << uengine);
440 ixp2000_uengine_set_mode(uengine, c->uengine_parameters);
441 if (set_initial_registers(uengine, c))
442 return 1;
443 ixp2000_uengine_load_microcode(uengine, c->insns, c->num_insns);
444
445 for (ctx = 0; ctx < 8; ctx++)
446 ixp2000_uengine_init_context(uengine, ctx, 0);
447
448 return 0;
449}
450EXPORT_SYMBOL(ixp2000_uengine_load);
451
452
453static int __init ixp2000_uengine_init(void)
454{
455 int uengine;
456 u32 value;
457
458 /*
459 * Determine number of microengines present.
460 */
461 switch ((ixp2000_reg_read(IXP_PRODUCT_ID) >> 8) & 0x1fff) {
462#ifdef CONFIG_ARCH_IXP2000
463 case 0: /* IXP2800 */
464 case 1: /* IXP2850 */
465 ixp2000_uengine_mask = 0x00ff00ff;
466 break;
467
468 case 2: /* IXP2400 */
469 ixp2000_uengine_mask = 0x000f000f;
470 break;
471#endif
472
473#ifdef CONFIG_ARCH_IXP23XX
474 case 4: /* IXP23xx */
475 ixp2000_uengine_mask = (*IXP23XX_EXP_CFG_FUSE >> 8) & 0xf;
476 break;
477#endif
478
479 default:
480 printk(KERN_INFO "Detected unknown IXP2000 model (%.8x)\n",
481 (unsigned int)ixp2000_reg_read(IXP_PRODUCT_ID));
482 ixp2000_uengine_mask = 0x00000000;
483 break;
484 }
485
486 /*
487 * Reset microengines.
488 */
489 ixp2000_uengine_reset(ixp2000_uengine_mask);
490
491 /*
492 * Synchronise timestamp counters across all microengines.
493 */
494 value = ixp2000_reg_read(IXP_MISC_CONTROL);
495 ixp2000_reg_wrb(IXP_MISC_CONTROL, value & ~0x80);
496 for (uengine = 0; uengine < 32; uengine++) {
497 if (ixp2000_uengine_mask & (1 << uengine)) {
498 ixp2000_uengine_csr_write(uengine, TIMESTAMP_LOW, 0);
499 ixp2000_uengine_csr_write(uengine, TIMESTAMP_HIGH, 0);
500 }
501 }
502 ixp2000_reg_wrb(IXP_MISC_CONTROL, value | 0x80);
503
504 return 0;
505}
506
507subsys_initcall(ixp2000_uengine_init);
diff --git a/arch/arm/common/via82c505.c b/arch/arm/common/via82c505.c
index 1171a5010aea..6cb362e56d29 100644
--- a/arch/arm/common/via82c505.c
+++ b/arch/arm/common/via82c505.c
@@ -51,7 +51,7 @@ via82c505_write_config(struct pci_bus *bus, unsigned int devfn, int where,
51 return PCIBIOS_SUCCESSFUL; 51 return PCIBIOS_SUCCESSFUL;
52} 52}
53 53
54static struct pci_ops via82c505_ops = { 54struct pci_ops via82c505_ops = {
55 .read = via82c505_read_config, 55 .read = via82c505_read_config,
56 .write = via82c505_write_config, 56 .write = via82c505_write_config,
57}; 57};
@@ -81,12 +81,3 @@ int __init via82c505_setup(int nr, struct pci_sys_data *sys)
81{ 81{
82 return (nr == 0); 82 return (nr == 0);
83} 83}
84
85struct pci_bus * __init via82c505_scan_bus(int nr, struct pci_sys_data *sysdata)
86{
87 if (nr == 0)
88 return pci_scan_root_bus(NULL, 0, &via82c505_ops, sysdata,
89 &sysdata->resources);
90
91 return NULL;
92}
diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
index 7a66311f3066..e0d538803cc3 100644
--- a/arch/arm/common/vic.c
+++ b/arch/arm/common/vic.c
@@ -39,6 +39,7 @@
39 * struct vic_device - VIC PM device 39 * struct vic_device - VIC PM device
40 * @irq: The IRQ number for the base of the VIC. 40 * @irq: The IRQ number for the base of the VIC.
41 * @base: The register base for the VIC. 41 * @base: The register base for the VIC.
42 * @valid_sources: A bitmask of valid interrupts
42 * @resume_sources: A bitmask of interrupts for resume. 43 * @resume_sources: A bitmask of interrupts for resume.
43 * @resume_irqs: The IRQs enabled for resume. 44 * @resume_irqs: The IRQs enabled for resume.
44 * @int_select: Save for VIC_INT_SELECT. 45 * @int_select: Save for VIC_INT_SELECT.
@@ -50,6 +51,7 @@
50struct vic_device { 51struct vic_device {
51 void __iomem *base; 52 void __iomem *base;
52 int irq; 53 int irq;
54 u32 valid_sources;
53 u32 resume_sources; 55 u32 resume_sources;
54 u32 resume_irqs; 56 u32 resume_irqs;
55 u32 int_select; 57 u32 int_select;
@@ -164,10 +166,32 @@ static int __init vic_pm_init(void)
164late_initcall(vic_pm_init); 166late_initcall(vic_pm_init);
165#endif /* CONFIG_PM */ 167#endif /* CONFIG_PM */
166 168
169static struct irq_chip vic_chip;
170
171static int vic_irqdomain_map(struct irq_domain *d, unsigned int irq,
172 irq_hw_number_t hwirq)
173{
174 struct vic_device *v = d->host_data;
175
176 /* Skip invalid IRQs, only register handlers for the real ones */
177 if (!(v->valid_sources & (1 << hwirq)))
178 return -ENOTSUPP;
179 irq_set_chip_and_handler(irq, &vic_chip, handle_level_irq);
180 irq_set_chip_data(irq, v->base);
181 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
182 return 0;
183}
184
185static struct irq_domain_ops vic_irqdomain_ops = {
186 .map = vic_irqdomain_map,
187 .xlate = irq_domain_xlate_onetwocell,
188};
189
167/** 190/**
168 * vic_register() - Register a VIC. 191 * vic_register() - Register a VIC.
169 * @base: The base address of the VIC. 192 * @base: The base address of the VIC.
170 * @irq: The base IRQ for the VIC. 193 * @irq: The base IRQ for the VIC.
194 * @valid_sources: bitmask of valid interrupts
171 * @resume_sources: bitmask of interrupts allowed for resume sources. 195 * @resume_sources: bitmask of interrupts allowed for resume sources.
172 * @node: The device tree node associated with the VIC. 196 * @node: The device tree node associated with the VIC.
173 * 197 *
@@ -178,7 +202,8 @@ late_initcall(vic_pm_init);
178 * This also configures the IRQ domain for the VIC. 202 * This also configures the IRQ domain for the VIC.
179 */ 203 */
180static void __init vic_register(void __iomem *base, unsigned int irq, 204static void __init vic_register(void __iomem *base, unsigned int irq,
181 u32 resume_sources, struct device_node *node) 205 u32 valid_sources, u32 resume_sources,
206 struct device_node *node)
182{ 207{
183 struct vic_device *v; 208 struct vic_device *v;
184 209
@@ -189,11 +214,12 @@ static void __init vic_register(void __iomem *base, unsigned int irq,
189 214
190 v = &vic_devices[vic_id]; 215 v = &vic_devices[vic_id];
191 v->base = base; 216 v->base = base;
217 v->valid_sources = valid_sources;
192 v->resume_sources = resume_sources; 218 v->resume_sources = resume_sources;
193 v->irq = irq; 219 v->irq = irq;
194 vic_id++; 220 vic_id++;
195 v->domain = irq_domain_add_legacy(node, 32, irq, 0, 221 v->domain = irq_domain_add_legacy(node, fls(valid_sources), irq, 0,
196 &irq_domain_simple_ops, v); 222 &vic_irqdomain_ops, v);
197} 223}
198 224
199static void vic_ack_irq(struct irq_data *d) 225static void vic_ack_irq(struct irq_data *d)
@@ -287,23 +313,6 @@ static void __init vic_clear_interrupts(void __iomem *base)
287 } 313 }
288} 314}
289 315
290static void __init vic_set_irq_sources(void __iomem *base,
291 unsigned int irq_start, u32 vic_sources)
292{
293 unsigned int i;
294
295 for (i = 0; i < 32; i++) {
296 if (vic_sources & (1 << i)) {
297 unsigned int irq = irq_start + i;
298
299 irq_set_chip_and_handler(irq, &vic_chip,
300 handle_level_irq);
301 irq_set_chip_data(irq, base);
302 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
303 }
304 }
305}
306
307/* 316/*
308 * The PL190 cell from ARM has been modified by ST to handle 64 interrupts. 317 * The PL190 cell from ARM has been modified by ST to handle 64 interrupts.
309 * The original cell has 32 interrupts, while the modified one has 64, 318 * The original cell has 32 interrupts, while the modified one has 64,
@@ -338,8 +347,7 @@ static void __init vic_init_st(void __iomem *base, unsigned int irq_start,
338 writel(32, base + VIC_PL190_DEF_VECT_ADDR); 347 writel(32, base + VIC_PL190_DEF_VECT_ADDR);
339 } 348 }
340 349
341 vic_set_irq_sources(base, irq_start, vic_sources); 350 vic_register(base, irq_start, vic_sources, 0, node);
342 vic_register(base, irq_start, 0, node);
343} 351}
344 352
345void __init __vic_init(void __iomem *base, unsigned int irq_start, 353void __init __vic_init(void __iomem *base, unsigned int irq_start,
@@ -379,9 +387,7 @@ void __init __vic_init(void __iomem *base, unsigned int irq_start,
379 387
380 vic_init2(base); 388 vic_init2(base);
381 389
382 vic_set_irq_sources(base, irq_start, vic_sources); 390 vic_register(base, irq_start, vic_sources, resume_sources, node);
383
384 vic_register(base, irq_start, resume_sources, node);
385} 391}
386 392
387/** 393/**
@@ -427,19 +433,18 @@ int __init vic_of_init(struct device_node *node, struct device_node *parent)
427 433
428/* 434/*
429 * Handle each interrupt in a single VIC. Returns non-zero if we've 435 * Handle each interrupt in a single VIC. Returns non-zero if we've
430 * handled at least one interrupt. This does a single read of the 436 * handled at least one interrupt. This reads the status register
431 * status register and handles all interrupts in order from LSB first. 437 * before handling each interrupt, which is necessary given that
438 * handle_IRQ may briefly re-enable interrupts for soft IRQ handling.
432 */ 439 */
433static int handle_one_vic(struct vic_device *vic, struct pt_regs *regs) 440static int handle_one_vic(struct vic_device *vic, struct pt_regs *regs)
434{ 441{
435 u32 stat, irq; 442 u32 stat, irq;
436 int handled = 0; 443 int handled = 0;
437 444
438 stat = readl_relaxed(vic->base + VIC_IRQ_STATUS); 445 while ((stat = readl_relaxed(vic->base + VIC_IRQ_STATUS))) {
439 while (stat) {
440 irq = ffs(stat) - 1; 446 irq = ffs(stat) - 1;
441 handle_IRQ(irq_find_mapping(vic->domain, irq), regs); 447 handle_IRQ(irq_find_mapping(vic->domain, irq), regs);
442 stat &= ~(1 << irq);
443 handled = 1; 448 handled = 1;
444 } 449 }
445 450
diff --git a/arch/arm/configs/armadillo800eva_defconfig b/arch/arm/configs/armadillo800eva_defconfig
new file mode 100644
index 000000000000..ddc9fe6a78ac
--- /dev/null
+++ b/arch/arm/configs/armadillo800eva_defconfig
@@ -0,0 +1,142 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=16
6# CONFIG_UTS_NS is not set
7# CONFIG_IPC_NS is not set
8# CONFIG_USER_NS is not set
9# CONFIG_PID_NS is not set
10CONFIG_SYSFS_DEPRECATED=y
11CONFIG_SYSFS_DEPRECATED_V2=y
12CONFIG_CC_OPTIMIZE_FOR_SIZE=y
13CONFIG_SLAB=y
14CONFIG_MODULES=y
15CONFIG_MODULE_UNLOAD=y
16CONFIG_MODULE_FORCE_UNLOAD=y
17# CONFIG_BLK_DEV_BSG is not set
18# CONFIG_IOSCHED_DEADLINE is not set
19# CONFIG_IOSCHED_CFQ is not set
20CONFIG_ARCH_SHMOBILE=y
21CONFIG_ARCH_R8A7740=y
22CONFIG_MACH_ARMADILLO800EVA=y
23# CONFIG_SH_TIMER_TMU is not set
24# CONFIG_ARM_THUMB is not set
25CONFIG_CPU_BPREDICT_DISABLE=y
26# CONFIG_CACHE_L2X0 is not set
27CONFIG_ARM_ERRATA_430973=y
28CONFIG_ARM_ERRATA_458693=y
29CONFIG_ARM_ERRATA_460075=y
30CONFIG_ARM_ERRATA_720789=y
31CONFIG_ARM_ERRATA_743622=y
32CONFIG_ARM_ERRATA_751472=y
33CONFIG_ARM_ERRATA_754322=y
34CONFIG_AEABI=y
35# CONFIG_OABI_COMPAT is not set
36CONFIG_FORCE_MAX_ZONEORDER=13
37CONFIG_ZBOOT_ROM_TEXT=0x0
38CONFIG_ZBOOT_ROM_BSS=0x0
39CONFIG_CMDLINE="console=tty0 console=ttySC1,115200 earlyprintk=sh-sci.1,115200 ignore_loglevel root=/dev/nfs ip=dhcp nfsroot=,rsize=4096,wsize=4096"
40CONFIG_CMDLINE_FORCE=y
41CONFIG_KEXEC=y
42# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
43# CONFIG_SUSPEND is not set
44CONFIG_NET=y
45CONFIG_PACKET=y
46CONFIG_UNIX=y
47CONFIG_INET=y
48CONFIG_IP_PNP=y
49CONFIG_IP_PNP_DHCP=y
50# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
51# CONFIG_INET_XFRM_MODE_TUNNEL is not set
52# CONFIG_INET_XFRM_MODE_BEET is not set
53# CONFIG_INET_LRO is not set
54# CONFIG_INET_DIAG is not set
55# CONFIG_IPV6 is not set
56# CONFIG_WIRELESS is not set
57CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
58CONFIG_SCSI=y
59CONFIG_BLK_DEV_SD=y
60CONFIG_MD=y
61CONFIG_BLK_DEV_DM=y
62CONFIG_NETDEVICES=y
63# CONFIG_NET_VENDOR_BROADCOM is not set
64# CONFIG_NET_VENDOR_CHELSIO is not set
65# CONFIG_NET_VENDOR_CIRRUS is not set
66# CONFIG_NET_VENDOR_FARADAY is not set
67# CONFIG_NET_VENDOR_INTEL is not set
68# CONFIG_NET_VENDOR_MARVELL is not set
69# CONFIG_NET_VENDOR_MICREL is not set
70# CONFIG_NET_VENDOR_NATSEMI is not set
71CONFIG_SH_ETH=y
72# CONFIG_NET_VENDOR_SEEQ is not set
73# CONFIG_NET_VENDOR_SMSC is not set
74# CONFIG_NET_VENDOR_STMICRO is not set
75# CONFIG_WLAN is not set
76# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
77CONFIG_INPUT_EVDEV=y
78# CONFIG_KEYBOARD_ATKBD is not set
79CONFIG_KEYBOARD_GPIO=y
80# CONFIG_INPUT_MOUSE is not set
81CONFIG_INPUT_TOUCHSCREEN=y
82CONFIG_TOUCHSCREEN_ST1232=y
83# CONFIG_SERIO is not set
84# CONFIG_LEGACY_PTYS is not set
85CONFIG_SERIAL_SH_SCI=y
86CONFIG_SERIAL_SH_SCI_NR_UARTS=8
87CONFIG_SERIAL_SH_SCI_CONSOLE=y
88# CONFIG_HW_RANDOM is not set
89CONFIG_I2C=y
90CONFIG_I2C_SH_MOBILE=y
91# CONFIG_HWMON is not set
92CONFIG_FB=y
93CONFIG_FB_MODE_HELPERS=y
94CONFIG_FB_SH_MOBILE_LCDC=y
95CONFIG_LCD_CLASS_DEVICE=y
96CONFIG_FRAMEBUFFER_CONSOLE=y
97CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
98CONFIG_LOGO=y
99# CONFIG_LOGO_LINUX_MONO is not set
100# CONFIG_LOGO_LINUX_VGA16 is not set
101CONFIG_SOUND=y
102CONFIG_SND=y
103# CONFIG_SND_SUPPORT_OLD_API is not set
104# CONFIG_SND_VERBOSE_PROCFS is not set
105# CONFIG_SND_DRIVERS is not set
106# CONFIG_SND_ARM is not set
107CONFIG_SND_SOC=y
108CONFIG_SND_SOC_SH4_FSI=y
109# CONFIG_HID_SUPPORT is not set
110CONFIG_USB=y
111# CONFIG_USB_DEVICE_CLASS is not set
112CONFIG_USB_RENESAS_USBHS=y
113CONFIG_USB_GADGET=y
114CONFIG_USB_RENESAS_USBHS_UDC=y
115CONFIG_USB_ETH=m
116CONFIG_MMC=y
117CONFIG_MMC_SDHI=y
118CONFIG_MMC_SH_MMCIF=y
119CONFIG_UIO=y
120CONFIG_UIO_PDRV_GENIRQ=y
121# CONFIG_DNOTIFY is not set
122CONFIG_MSDOS_FS=y
123CONFIG_VFAT_FS=y
124CONFIG_TMPFS=y
125# CONFIG_MISC_FILESYSTEMS is not set
126CONFIG_NFS_FS=y
127CONFIG_NFS_V3=y
128CONFIG_NFS_V3_ACL=y
129CONFIG_NFS_V4=y
130CONFIG_NFS_V4_1=y
131CONFIG_ROOT_NFS=y
132CONFIG_NLS_CODEPAGE_437=y
133CONFIG_NLS_ISO8859_1=y
134# CONFIG_ENABLE_WARN_DEPRECATED is not set
135# CONFIG_ENABLE_MUST_CHECK is not set
136# CONFIG_ARM_UNWIND is not set
137CONFIG_CRYPTO=y
138CONFIG_CRYPTO_CBC=y
139CONFIG_CRYPTO_MD5=y
140CONFIG_CRYPTO_DES=y
141CONFIG_CRYPTO_ANSI_CPRNG=y
142CONFIG_XZ_DEC=y
diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
new file mode 100644
index 000000000000..67bc571ed0c3
--- /dev/null
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -0,0 +1,196 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y
7CONFIG_CC_OPTIMIZE_FOR_SIZE=y
8CONFIG_KALLSYMS_ALL=y
9CONFIG_EMBEDDED=y
10CONFIG_SLAB=y
11CONFIG_MODULES=y
12CONFIG_MODULE_UNLOAD=y
13# CONFIG_LBDAF is not set
14# CONFIG_BLK_DEV_BSG is not set
15# CONFIG_IOSCHED_DEADLINE is not set
16# CONFIG_IOSCHED_CFQ is not set
17CONFIG_ARCH_AT91=y
18CONFIG_SOC_AT91SAM9260=y
19CONFIG_SOC_AT91SAM9263=y
20CONFIG_SOC_AT91SAM9G45=y
21CONFIG_SOC_AT91SAM9X5=y
22CONFIG_MACH_AT91SAM_DT=y
23CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
24CONFIG_AT91_TIMER_HZ=128
25CONFIG_AEABI=y
26# CONFIG_OABI_COMPAT is not set
27CONFIG_LEDS=y
28CONFIG_LEDS_CPU=y
29CONFIG_UACCESS_WITH_MEMCPY=y
30CONFIG_ZBOOT_ROM_TEXT=0x0
31CONFIG_ZBOOT_ROM_BSS=0x0
32CONFIG_ARM_APPENDED_DTB=y
33CONFIG_ARM_ATAG_DTB_COMPAT=y
34CONFIG_CMDLINE="mem=128M console=ttyS0,115200 initrd=0x21100000,25165824 root=/dev/ram0 rw"
35CONFIG_KEXEC=y
36CONFIG_AUTO_ZRELADDR=y
37# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
38CONFIG_NET=y
39CONFIG_PACKET=y
40CONFIG_UNIX=y
41CONFIG_INET=y
42CONFIG_IP_MULTICAST=y
43CONFIG_IP_PNP=y
44# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
45# CONFIG_INET_XFRM_MODE_TUNNEL is not set
46# CONFIG_INET_XFRM_MODE_BEET is not set
47# CONFIG_INET_DIAG is not set
48CONFIG_IPV6=y
49# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
50# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
51# CONFIG_INET6_XFRM_MODE_BEET is not set
52CONFIG_IPV6_SIT_6RD=y
53# CONFIG_WIRELESS is not set
54CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
55CONFIG_DEVTMPFS=y
56CONFIG_DEVTMPFS_MOUNT=y
57# CONFIG_STANDALONE is not set
58# CONFIG_PREVENT_FIRMWARE_BUILD is not set
59CONFIG_MTD=y
60CONFIG_MTD_CMDLINE_PARTS=y
61CONFIG_MTD_CHAR=y
62CONFIG_MTD_BLOCK=y
63CONFIG_MTD_NAND=y
64CONFIG_MTD_NAND_ATMEL=y
65CONFIG_MTD_UBI=y
66CONFIG_MTD_UBI_GLUEBI=y
67CONFIG_PROC_DEVICETREE=y
68CONFIG_BLK_DEV_LOOP=y
69CONFIG_BLK_DEV_RAM=y
70CONFIG_BLK_DEV_RAM_COUNT=4
71CONFIG_BLK_DEV_RAM_SIZE=8192
72CONFIG_ATMEL_PWM=y
73CONFIG_ATMEL_TCLIB=y
74CONFIG_EEPROM_93CX6=m
75CONFIG_SCSI=y
76CONFIG_BLK_DEV_SD=y
77CONFIG_SCSI_MULTI_LUN=y
78# CONFIG_SCSI_LOWLEVEL is not set
79CONFIG_NETDEVICES=y
80CONFIG_MII=y
81CONFIG_MACB=y
82# CONFIG_NET_VENDOR_BROADCOM is not set
83# CONFIG_NET_VENDOR_CHELSIO is not set
84# CONFIG_NET_VENDOR_FARADAY is not set
85# CONFIG_NET_VENDOR_INTEL is not set
86# CONFIG_NET_VENDOR_MARVELL is not set
87# CONFIG_NET_VENDOR_MICREL is not set
88# CONFIG_NET_VENDOR_NATSEMI is not set
89# CONFIG_NET_VENDOR_SEEQ is not set
90# CONFIG_NET_VENDOR_SMSC is not set
91# CONFIG_NET_VENDOR_STMICRO is not set
92CONFIG_DAVICOM_PHY=y
93CONFIG_MICREL_PHY=y
94# CONFIG_WLAN is not set
95CONFIG_INPUT_POLLDEV=y
96# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
97CONFIG_INPUT_MOUSEDEV_SCREEN_X=480
98CONFIG_INPUT_MOUSEDEV_SCREEN_Y=272
99CONFIG_INPUT_JOYDEV=y
100CONFIG_INPUT_EVDEV=y
101# CONFIG_KEYBOARD_ATKBD is not set
102CONFIG_KEYBOARD_GPIO=y
103# CONFIG_INPUT_MOUSE is not set
104CONFIG_INPUT_TOUCHSCREEN=y
105# CONFIG_SERIO is not set
106CONFIG_LEGACY_PTY_COUNT=4
107CONFIG_SERIAL_ATMEL=y
108CONFIG_SERIAL_ATMEL_CONSOLE=y
109CONFIG_HW_RANDOM=y
110CONFIG_I2C=y
111CONFIG_I2C_GPIO=y
112CONFIG_SPI=y
113CONFIG_SPI_ATMEL=y
114# CONFIG_HWMON is not set
115CONFIG_WATCHDOG=y
116CONFIG_AT91SAM9X_WATCHDOG=y
117CONFIG_SSB=m
118CONFIG_FB=y
119CONFIG_FB_MODE_HELPERS=y
120CONFIG_FB_ATMEL=y
121CONFIG_BACKLIGHT_LCD_SUPPORT=y
122# CONFIG_LCD_CLASS_DEVICE is not set
123CONFIG_BACKLIGHT_CLASS_DEVICE=y
124CONFIG_BACKLIGHT_ATMEL_LCDC=y
125# CONFIG_BACKLIGHT_GENERIC is not set
126CONFIG_FRAMEBUFFER_CONSOLE=y
127CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
128CONFIG_FONTS=y
129CONFIG_FONT_8x8=y
130CONFIG_FONT_ACORN_8x8=y
131CONFIG_FONT_MINI_4x6=y
132CONFIG_LOGO=y
133# CONFIG_HID_SUPPORT is not set
134CONFIG_USB=y
135CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
136CONFIG_USB_DEVICEFS=y
137# CONFIG_USB_DEVICE_CLASS is not set
138CONFIG_USB_EHCI_HCD=y
139CONFIG_USB_OHCI_HCD=y
140CONFIG_USB_ACM=y
141CONFIG_USB_STORAGE=y
142CONFIG_USB_SERIAL=y
143CONFIG_USB_SERIAL_GENERIC=y
144CONFIG_USB_SERIAL_FTDI_SIO=y
145CONFIG_USB_SERIAL_PL2303=y
146CONFIG_USB_GADGET=y
147CONFIG_USB_AT91=m
148CONFIG_USB_ATMEL_USBA=m
149CONFIG_USB_ETH=m
150CONFIG_USB_GADGETFS=m
151CONFIG_USB_CDC_COMPOSITE=m
152CONFIG_USB_G_ACM_MS=m
153CONFIG_USB_G_MULTI=m
154CONFIG_USB_G_MULTI_CDC=y
155CONFIG_MMC=y
156CONFIG_MMC_ATMELMCI=y
157CONFIG_NEW_LEDS=y
158CONFIG_LEDS_CLASS=y
159CONFIG_LEDS_GPIO=y
160CONFIG_LEDS_TRIGGERS=y
161CONFIG_LEDS_TRIGGER_TIMER=y
162CONFIG_LEDS_TRIGGER_HEARTBEAT=y
163CONFIG_LEDS_TRIGGER_GPIO=y
164CONFIG_RTC_CLASS=y
165CONFIG_RTC_DRV_AT91RM9200=y
166CONFIG_RTC_DRV_AT91SAM9=y
167CONFIG_DMADEVICES=y
168# CONFIG_IOMMU_SUPPORT is not set
169CONFIG_EXT2_FS=y
170CONFIG_FANOTIFY=y
171CONFIG_VFAT_FS=y
172CONFIG_TMPFS=y
173CONFIG_NFS_FS=y
174CONFIG_NFS_V3=y
175CONFIG_ROOT_NFS=y
176CONFIG_NLS_CODEPAGE_437=y
177CONFIG_NLS_CODEPAGE_850=y
178CONFIG_NLS_ISO8859_1=y
179CONFIG_STRIP_ASM_SYMS=y
180CONFIG_DEBUG_FS=y
181# CONFIG_SCHED_DEBUG is not set
182# CONFIG_DEBUG_BUGVERBOSE is not set
183# CONFIG_FTRACE is not set
184CONFIG_DEBUG_USER=y
185CONFIG_CRYPTO=y
186CONFIG_CRYPTO_ECB=y
187CONFIG_CRYPTO_AES=y
188CONFIG_CRYPTO_ARC4=y
189# CONFIG_CRYPTO_ANSI_CPRNG is not set
190CONFIG_CRYPTO_USER_API_HASH=m
191CONFIG_CRYPTO_USER_API_SKCIPHER=m
192# CONFIG_CRYPTO_HW is not set
193CONFIG_CRC_CCITT=m
194CONFIG_CRC_ITU_T=m
195CONFIG_CRC7=m
196CONFIG_AVERAGE=y
diff --git a/arch/arm/configs/at91rm9200_defconfig b/arch/arm/configs/at91rm9200_defconfig
index bbe4e1a1f5d8..d54e2acd3ab1 100644
--- a/arch/arm/configs/at91rm9200_defconfig
+++ b/arch/arm/configs/at91rm9200_defconfig
@@ -14,6 +14,7 @@ CONFIG_MODULE_SRCVERSION_ALL=y
14# CONFIG_BLK_DEV_BSG is not set 14# CONFIG_BLK_DEV_BSG is not set
15# CONFIG_IOSCHED_CFQ is not set 15# CONFIG_IOSCHED_CFQ is not set
16CONFIG_ARCH_AT91=y 16CONFIG_ARCH_AT91=y
17CONFIG_ARCH_AT91RM9200=y
17CONFIG_MACH_ONEARM=y 18CONFIG_MACH_ONEARM=y
18CONFIG_ARCH_AT91RM9200DK=y 19CONFIG_ARCH_AT91RM9200DK=y
19CONFIG_MACH_AT91RM9200EK=y 20CONFIG_MACH_AT91RM9200EK=y
diff --git a/arch/arm/configs/bcmring_defconfig b/arch/arm/configs/bcmring_defconfig
index 795374d48f81..9e6a8fe13164 100644
--- a/arch/arm/configs/bcmring_defconfig
+++ b/arch/arm/configs/bcmring_defconfig
@@ -11,7 +11,7 @@ CONFIG_KALLSYMS_EXTRA_PASS=y
11# CONFIG_TIMERFD is not set 11# CONFIG_TIMERFD is not set
12# CONFIG_EVENTFD is not set 12# CONFIG_EVENTFD is not set
13# CONFIG_AIO is not set 13# CONFIG_AIO is not set
14CONFIG_PERF_COUNTERS=y 14CONFIG_PERF_EVENTS=y
15# CONFIG_VM_EVENT_COUNTERS is not set 15# CONFIG_VM_EVENT_COUNTERS is not set
16# CONFIG_SLUB_DEBUG is not set 16# CONFIG_SLUB_DEBUG is not set
17# CONFIG_COMPAT_BRK is not set 17# CONFIG_COMPAT_BRK is not set
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig
index b5ac644e12af..09a02963cf58 100644
--- a/arch/arm/configs/imx_v4_v5_defconfig
+++ b/arch/arm/configs/imx_v4_v5_defconfig
@@ -92,6 +92,7 @@ CONFIG_INPUT_EVDEV=y
92# CONFIG_INPUT_MOUSE is not set 92# CONFIG_INPUT_MOUSE is not set
93CONFIG_INPUT_TOUCHSCREEN=y 93CONFIG_INPUT_TOUCHSCREEN=y
94CONFIG_TOUCHSCREEN_ADS7846=m 94CONFIG_TOUCHSCREEN_ADS7846=m
95CONFIG_TOUCHSCREEN_MC13783=m
95# CONFIG_SERIO is not set 96# CONFIG_SERIO is not set
96# CONFIG_LEGACY_PTYS is not set 97# CONFIG_LEGACY_PTYS is not set
97CONFIG_SERIAL_8250=m 98CONFIG_SERIAL_8250=m
@@ -107,11 +108,13 @@ CONFIG_SPI_SPIDEV=y
107CONFIG_W1=y 108CONFIG_W1=y
108CONFIG_W1_MASTER_MXC=y 109CONFIG_W1_MASTER_MXC=y
109CONFIG_W1_SLAVE_THERM=y 110CONFIG_W1_SLAVE_THERM=y
110# CONFIG_HWMON is not set 111CONFIG_HWMON=m
112CONFIG_SENSORS_MC13783_ADC=m
111CONFIG_WATCHDOG=y 113CONFIG_WATCHDOG=y
112CONFIG_IMX2_WDT=y 114CONFIG_IMX2_WDT=y
113CONFIG_MFD_MC13XXX=y 115CONFIG_MFD_MC13XXX=y
114CONFIG_REGULATOR=y 116CONFIG_REGULATOR=y
117CONFIG_REGULATOR_FIXED_VOLTAGE=y
115CONFIG_REGULATOR_MC13783=y 118CONFIG_REGULATOR_MC13783=y
116CONFIG_REGULATOR_MC13892=y 119CONFIG_REGULATOR_MC13892=y
117CONFIG_FB=y 120CONFIG_FB=y
diff --git a/arch/arm/configs/ixp2000_defconfig b/arch/arm/configs/ixp2000_defconfig
deleted file mode 100644
index 8405aded97a3..000000000000
--- a/arch/arm/configs/ixp2000_defconfig
+++ /dev/null
@@ -1,99 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y
3CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y
6CONFIG_EXPERT=y
7# CONFIG_HOTPLUG is not set
8CONFIG_SLAB=y
9CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y
11CONFIG_ARCH_IXP2000=y
12CONFIG_ARCH_ENP2611=y
13CONFIG_ARCH_IXDP2400=y
14CONFIG_ARCH_IXDP2800=y
15CONFIG_ARCH_IXDP2401=y
16CONFIG_ARCH_IXDP2801=y
17# CONFIG_IXP2000_SUPPORT_BROKEN_PCI_IO is not set
18# CONFIG_ARM_THUMB is not set
19CONFIG_CPU_BIG_ENDIAN=y
20CONFIG_ZBOOT_ROM_TEXT=0x0
21CONFIG_ZBOOT_ROM_BSS=0x0
22CONFIG_CMDLINE="console=ttyS0,57600 root=/dev/nfs ip=bootp mem=64M@0x0"
23CONFIG_FPE_NWFPE=y
24CONFIG_FPE_NWFPE_XP=y
25CONFIG_NET=y
26CONFIG_PACKET=y
27CONFIG_UNIX=y
28CONFIG_INET=y
29CONFIG_IP_PNP=y
30CONFIG_IP_PNP_DHCP=y
31CONFIG_IP_PNP_BOOTP=y
32CONFIG_SYN_COOKIES=y
33CONFIG_IPV6=y
34# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
35# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
36# CONFIG_INET6_XFRM_MODE_BEET is not set
37# CONFIG_IPV6_SIT is not set
38# CONFIG_PREVENT_FIRMWARE_BUILD is not set
39CONFIG_MTD=y
40CONFIG_MTD_PARTITIONS=y
41CONFIG_MTD_REDBOOT_PARTS=y
42CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y
43CONFIG_MTD_REDBOOT_PARTS_READONLY=y
44CONFIG_MTD_CHAR=y
45CONFIG_MTD_BLOCK=y
46CONFIG_MTD_CFI=y
47CONFIG_MTD_CFI_INTELEXT=y
48CONFIG_MTD_COMPLEX_MAPPINGS=y
49CONFIG_MTD_IXP2000=y
50CONFIG_BLK_DEV_LOOP=y
51CONFIG_BLK_DEV_NBD=y
52CONFIG_BLK_DEV_RAM=y
53CONFIG_BLK_DEV_RAM_SIZE=8192
54CONFIG_EEPROM_LEGACY=y
55CONFIG_NETDEVICES=y
56CONFIG_DUMMY=y
57CONFIG_NET_ETHERNET=y
58CONFIG_NET_PCI=y
59CONFIG_CS89x0=y
60CONFIG_E100=y
61CONFIG_ENP2611_MSF_NET=y
62CONFIG_WAN=y
63CONFIG_HDLC=y
64CONFIG_HDLC_RAW=y
65CONFIG_HDLC_CISCO=y
66CONFIG_HDLC_FR=y
67CONFIG_HDLC_PPP=y
68CONFIG_DLCI=y
69# CONFIG_INPUT_KEYBOARD is not set
70# CONFIG_INPUT_MOUSE is not set
71# CONFIG_SERIO is not set
72# CONFIG_VT is not set
73CONFIG_SERIAL_8250=y
74CONFIG_SERIAL_8250_CONSOLE=y
75CONFIG_SERIAL_8250_NR_UARTS=3
76# CONFIG_HW_RANDOM is not set
77CONFIG_I2C=y
78CONFIG_I2C_CHARDEV=y
79CONFIG_I2C_IXP2000=y
80CONFIG_WATCHDOG=y
81CONFIG_IXP2000_WATCHDOG=y
82CONFIG_EXT2_FS=y
83CONFIG_EXT2_FS_XATTR=y
84CONFIG_EXT2_FS_POSIX_ACL=y
85CONFIG_EXT3_FS=y
86CONFIG_EXT3_FS_POSIX_ACL=y
87CONFIG_INOTIFY=y
88CONFIG_TMPFS=y
89CONFIG_JFFS2_FS=y
90CONFIG_NFS_FS=y
91CONFIG_NFS_V3=y
92CONFIG_ROOT_NFS=y
93CONFIG_PARTITION_ADVANCED=y
94CONFIG_MAGIC_SYSRQ=y
95CONFIG_DEBUG_KERNEL=y
96CONFIG_DEBUG_MUTEXES=y
97CONFIG_DEBUG_USER=y
98CONFIG_DEBUG_ERRORS=y
99CONFIG_DEBUG_LL=y
diff --git a/arch/arm/configs/ixp23xx_defconfig b/arch/arm/configs/ixp23xx_defconfig
deleted file mode 100644
index 688717612e91..000000000000
--- a/arch/arm/configs/ixp23xx_defconfig
+++ /dev/null
@@ -1,105 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y
3CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y
6CONFIG_EXPERT=y
7CONFIG_SLAB=y
8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y
10CONFIG_ARCH_IXP23XX=y
11CONFIG_MACH_ESPRESSO=y
12CONFIG_MACH_IXDP2351=y
13CONFIG_MACH_ROADRUNNER=y
14# CONFIG_ARM_THUMB is not set
15CONFIG_CPU_BIG_ENDIAN=y
16CONFIG_ZBOOT_ROM_TEXT=0x0
17CONFIG_ZBOOT_ROM_BSS=0x0
18CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp"
19CONFIG_FPE_NWFPE=y
20CONFIG_FPE_NWFPE_XP=y
21CONFIG_NET=y
22CONFIG_PACKET=y
23CONFIG_UNIX=y
24CONFIG_INET=y
25CONFIG_IP_PNP=y
26CONFIG_IP_PNP_DHCP=y
27CONFIG_IP_PNP_BOOTP=y
28CONFIG_SYN_COOKIES=y
29CONFIG_IPV6=y
30# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
31# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
32# CONFIG_INET6_XFRM_MODE_BEET is not set
33# CONFIG_IPV6_SIT is not set
34# CONFIG_PREVENT_FIRMWARE_BUILD is not set
35# CONFIG_FW_LOADER is not set
36CONFIG_MTD=y
37CONFIG_MTD_PARTITIONS=y
38CONFIG_MTD_REDBOOT_PARTS=y
39CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y
40CONFIG_MTD_REDBOOT_PARTS_READONLY=y
41CONFIG_MTD_CHAR=y
42CONFIG_MTD_BLOCK=y
43CONFIG_MTD_CFI=y
44CONFIG_MTD_CFI_INTELEXT=y
45CONFIG_MTD_COMPLEX_MAPPINGS=y
46CONFIG_MTD_PHYSMAP=y
47CONFIG_BLK_DEV_LOOP=y
48CONFIG_BLK_DEV_NBD=y
49CONFIG_BLK_DEV_RAM=y
50CONFIG_BLK_DEV_RAM_SIZE=8192
51CONFIG_EEPROM_LEGACY=y
52CONFIG_IDE=y
53CONFIG_BLK_DEV_SIIMAGE=y
54CONFIG_SCSI=y
55CONFIG_BLK_DEV_SD=y
56CONFIG_NETDEVICES=y
57CONFIG_DUMMY=y
58CONFIG_NET_ETHERNET=y
59CONFIG_NET_PCI=y
60CONFIG_E100=y
61CONFIG_E1000=y
62CONFIG_WAN=y
63CONFIG_HDLC=y
64CONFIG_HDLC_RAW=y
65CONFIG_HDLC_CISCO=y
66CONFIG_HDLC_FR=y
67CONFIG_HDLC_PPP=y
68CONFIG_DLCI=y
69# CONFIG_INPUT_KEYBOARD is not set
70# CONFIG_INPUT_MOUSE is not set
71# CONFIG_SERIO is not set
72# CONFIG_VT is not set
73CONFIG_SERIAL_8250=y
74CONFIG_SERIAL_8250_CONSOLE=y
75# CONFIG_HW_RANDOM is not set
76CONFIG_I2C=y
77CONFIG_I2C_CHARDEV=y
78CONFIG_WATCHDOG=y
79# CONFIG_USB_HID is not set
80CONFIG_USB=y
81CONFIG_USB_MON=y
82CONFIG_USB_EHCI_HCD=y
83CONFIG_USB_OHCI_HCD=y
84CONFIG_USB_UHCI_HCD=y
85CONFIG_USB_STORAGE=y
86CONFIG_EXT2_FS=y
87CONFIG_EXT2_FS_XATTR=y
88CONFIG_EXT2_FS_POSIX_ACL=y
89CONFIG_EXT3_FS=y
90CONFIG_EXT3_FS_POSIX_ACL=y
91CONFIG_INOTIFY=y
92CONFIG_MSDOS_FS=y
93CONFIG_TMPFS=y
94CONFIG_JFFS2_FS=y
95CONFIG_NFS_FS=y
96CONFIG_NFS_V3=y
97CONFIG_ROOT_NFS=y
98CONFIG_PARTITION_ADVANCED=y
99CONFIG_NLS_CODEPAGE_437=y
100CONFIG_MAGIC_SYSRQ=y
101CONFIG_DEBUG_KERNEL=y
102CONFIG_DEBUG_MUTEXES=y
103CONFIG_DEBUG_USER=y
104CONFIG_DEBUG_ERRORS=y
105CONFIG_DEBUG_LL=y
diff --git a/arch/arm/configs/kzm9g_defconfig b/arch/arm/configs/kzm9g_defconfig
new file mode 100644
index 000000000000..e3ebc20ed0a7
--- /dev/null
+++ b/arch/arm/configs/kzm9g_defconfig
@@ -0,0 +1,139 @@
1# CONFIG_ARM_PATCH_PHYS_VIRT is not set
2CONFIG_EXPERIMENTAL=y
3# CONFIG_LOCALVERSION_AUTO is not set
4CONFIG_SYSVIPC=y
5CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=16
8CONFIG_NAMESPACES=y
9# CONFIG_UTS_NS is not set
10# CONFIG_IPC_NS is not set
11# CONFIG_USER_NS is not set
12# CONFIG_PID_NS is not set
13# CONFIG_NET_NS is not set
14CONFIG_CC_OPTIMIZE_FOR_SIZE=y
15CONFIG_SYSCTL_SYSCALL=y
16CONFIG_EMBEDDED=y
17CONFIG_SLAB=y
18CONFIG_MODULES=y
19CONFIG_MODULE_FORCE_LOAD=y
20CONFIG_MODULE_UNLOAD=y
21# CONFIG_BLK_DEV_BSG is not set
22# CONFIG_IOSCHED_DEADLINE is not set
23# CONFIG_IOSCHED_CFQ is not set
24CONFIG_ARCH_SHMOBILE=y
25CONFIG_KEYBOARD_GPIO_POLLED=y
26CONFIG_ARCH_SH73A0=y
27CONFIG_MACH_KZM9G=y
28CONFIG_MEMORY_START=0x41000000
29CONFIG_MEMORY_SIZE=0x1f000000
30CONFIG_ARM_ERRATA_743622=y
31CONFIG_ARM_ERRATA_754322=y
32CONFIG_NO_HZ=y
33CONFIG_HIGH_RES_TIMERS=y
34CONFIG_SMP=y
35CONFIG_SCHED_MC=y
36CONFIG_PREEMPT=y
37CONFIG_AEABI=y
38# CONFIG_OABI_COMPAT is not set
39CONFIG_HIGHMEM=y
40CONFIG_ZBOOT_ROM_TEXT=0x0
41CONFIG_ZBOOT_ROM_BSS=0x0
42CONFIG_CMDLINE="console=tty0 console=ttySC4,115200 root=/dev/nfs ip=dhcp ignore_loglevel earlyprintk=sh-sci.4,115200"
43CONFIG_KEXEC=y
44CONFIG_VFP=y
45CONFIG_NEON=y
46# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
47CONFIG_PM_RUNTIME=y
48CONFIG_NET=y
49CONFIG_PACKET=y
50CONFIG_UNIX=y
51CONFIG_INET=y
52CONFIG_IP_PNP=y
53CONFIG_IP_PNP_DHCP=y
54# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
55# CONFIG_INET_XFRM_MODE_TUNNEL is not set
56# CONFIG_INET_XFRM_MODE_BEET is not set
57# CONFIG_INET_LRO is not set
58# CONFIG_INET_DIAG is not set
59# CONFIG_IPV6 is not set
60CONFIG_IRDA=y
61CONFIG_SH_IRDA=y
62# CONFIG_WIRELESS is not set
63CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
64CONFIG_SCSI=y
65CONFIG_BLK_DEV_SD=y
66CONFIG_NETDEVICES=y
67CONFIG_SMSC911X=y
68# CONFIG_WLAN is not set
69CONFIG_INPUT_SPARSEKMAP=y
70# CONFIG_INPUT_MOUSEDEV is not set
71CONFIG_INPUT_EVDEV=y
72# CONFIG_KEYBOARD_ATKBD is not set
73# CONFIG_INPUT_MOUSE is not set
74CONFIG_INPUT_TOUCHSCREEN=y
75CONFIG_TOUCHSCREEN_ST1232=y
76# CONFIG_LEGACY_PTYS is not set
77CONFIG_SERIAL_SH_SCI=y
78CONFIG_SERIAL_SH_SCI_NR_UARTS=9
79CONFIG_SERIAL_SH_SCI_CONSOLE=y
80# CONFIG_HW_RANDOM is not set
81CONFIG_I2C_CHARDEV=y
82CONFIG_I2C_SH_MOBILE=y
83CONFIG_GPIO_PCF857X=y
84# CONFIG_HWMON is not set
85CONFIG_FB=y
86CONFIG_FB_SH_MOBILE_LCDC=y
87CONFIG_FRAMEBUFFER_CONSOLE=y
88CONFIG_LOGO=y
89CONFIG_FB_SH_MOBILE_MERAM=y
90CONFIG_SOUND=y
91CONFIG_SND=y
92# CONFIG_SND_SUPPORT_OLD_API is not set
93# CONFIG_SND_VERBOSE_PROCFS is not set
94# CONFIG_SND_DRIVERS is not set
95# CONFIG_SND_ARM is not set
96# CONFIG_SND_USB is not set
97CONFIG_SND_SOC=y
98CONFIG_SND_SOC_SH4_FSI=y
99# CONFIG_HID_SUPPORT is not set
100CONFIG_USB=y
101CONFIG_USB_DEVICEFS=y
102CONFIG_USB_R8A66597_HCD=y
103CONFIG_USB_STORAGE=y
104CONFIG_MMC=y
105# CONFIG_MMC_BLOCK_BOUNCE is not set
106CONFIG_MMC_SDHI=y
107CONFIG_MMC_SH_MMCIF=y
108CONFIG_NEW_LEDS=y
109CONFIG_LEDS_CLASS=y
110CONFIG_RTC_CLASS=y
111CONFIG_DMADEVICES=y
112CONFIG_SH_DMAE=y
113CONFIG_ASYNC_TX_DMA=y
114CONFIG_STAGING=y
115# CONFIG_DNOTIFY is not set
116# CONFIG_INOTIFY_USER is not set
117CONFIG_VFAT_FS=y
118CONFIG_TMPFS=y
119# CONFIG_MISC_FILESYSTEMS is not set
120CONFIG_NFS_FS=y
121CONFIG_NFS_V3=y
122CONFIG_NFS_V3_ACL=y
123CONFIG_NFS_V4=y
124CONFIG_NFS_V4_1=y
125CONFIG_ROOT_NFS=y
126CONFIG_NLS_CODEPAGE_437=y
127CONFIG_NLS_ISO8859_1=y
128# CONFIG_ENABLE_WARN_DEPRECATED is not set
129# CONFIG_ENABLE_MUST_CHECK is not set
130# CONFIG_SCHED_DEBUG is not set
131# CONFIG_DEBUG_PREEMPT is not set
132# CONFIG_DEBUG_BUGVERBOSE is not set
133# CONFIG_FTRACE is not set
134# CONFIG_ARM_UNWIND is not set
135CONFIG_CRYPTO=y
136CONFIG_CRYPTO_CBC=y
137CONFIG_CRYPTO_MD5=y
138CONFIG_CRYPTO_DES=y
139CONFIG_CRC16=y
diff --git a/arch/arm/configs/lpc32xx_defconfig b/arch/arm/configs/lpc32xx_defconfig
index fb2088171ca9..4fa60547494a 100644
--- a/arch/arm/configs/lpc32xx_defconfig
+++ b/arch/arm/configs/lpc32xx_defconfig
@@ -2,7 +2,7 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y 3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=16
6CONFIG_SYSFS_DEPRECATED=y 6CONFIG_SYSFS_DEPRECATED=y
7CONFIG_SYSFS_DEPRECATED_V2=y 7CONFIG_SYSFS_DEPRECATED_V2=y
8CONFIG_BLK_DEV_INITRD=y 8CONFIG_BLK_DEV_INITRD=y
@@ -10,6 +10,7 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
10CONFIG_SYSCTL_SYSCALL=y 10CONFIG_SYSCTL_SYSCALL=y
11CONFIG_EMBEDDED=y 11CONFIG_EMBEDDED=y
12CONFIG_SLAB=y 12CONFIG_SLAB=y
13CONFIG_JUMP_LABEL=y
13CONFIG_MODULES=y 14CONFIG_MODULES=y
14CONFIG_MODULE_UNLOAD=y 15CONFIG_MODULE_UNLOAD=y
15# CONFIG_BLK_DEV_BSG is not set 16# CONFIG_BLK_DEV_BSG is not set
@@ -21,6 +22,8 @@ CONFIG_PREEMPT=y
21CONFIG_AEABI=y 22CONFIG_AEABI=y
22CONFIG_ZBOOT_ROM_TEXT=0x0 23CONFIG_ZBOOT_ROM_TEXT=0x0
23CONFIG_ZBOOT_ROM_BSS=0x0 24CONFIG_ZBOOT_ROM_BSS=0x0
25CONFIG_ARM_APPENDED_DTB=y
26CONFIG_ARM_ATAG_DTB_COMPAT=y
24CONFIG_CMDLINE="console=ttyS0,115200n81 root=/dev/ram0" 27CONFIG_CMDLINE="console=ttyS0,115200n81 root=/dev/ram0"
25CONFIG_CPU_IDLE=y 28CONFIG_CPU_IDLE=y
26CONFIG_FPE_NWFPE=y 29CONFIG_FPE_NWFPE=y
@@ -40,7 +43,8 @@ CONFIG_IP_PNP_BOOTP=y
40# CONFIG_INET_XFRM_MODE_BEET is not set 43# CONFIG_INET_XFRM_MODE_BEET is not set
41# CONFIG_INET_LRO is not set 44# CONFIG_INET_LRO is not set
42# CONFIG_INET_DIAG is not set 45# CONFIG_INET_DIAG is not set
43# CONFIG_IPV6 is not set 46CONFIG_IPV6=y
47CONFIG_IPV6_PRIVACY=y
44# CONFIG_WIRELESS is not set 48# CONFIG_WIRELESS is not set
45CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 49CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
46# CONFIG_FW_LOADER is not set 50# CONFIG_FW_LOADER is not set
@@ -55,13 +59,24 @@ CONFIG_BLK_DEV_CRYPTOLOOP=y
55CONFIG_BLK_DEV_RAM=y 59CONFIG_BLK_DEV_RAM=y
56CONFIG_BLK_DEV_RAM_COUNT=1 60CONFIG_BLK_DEV_RAM_COUNT=1
57CONFIG_BLK_DEV_RAM_SIZE=16384 61CONFIG_BLK_DEV_RAM_SIZE=16384
58CONFIG_MISC_DEVICES=y
59CONFIG_EEPROM_AT25=y 62CONFIG_EEPROM_AT25=y
60CONFIG_SCSI=y 63CONFIG_SCSI=y
61CONFIG_BLK_DEV_SD=y 64CONFIG_BLK_DEV_SD=y
62CONFIG_NETDEVICES=y 65CONFIG_NETDEVICES=y
63CONFIG_MII=y 66CONFIG_MII=y
64CONFIG_PHYLIB=y 67# CONFIG_NET_VENDOR_BROADCOM is not set
68# CONFIG_NET_VENDOR_CHELSIO is not set
69# CONFIG_NET_VENDOR_CIRRUS is not set
70# CONFIG_NET_VENDOR_FARADAY is not set
71# CONFIG_NET_VENDOR_INTEL is not set
72# CONFIG_NET_VENDOR_MARVELL is not set
73# CONFIG_NET_VENDOR_MICREL is not set
74# CONFIG_NET_VENDOR_MICROCHIP is not set
75# CONFIG_NET_VENDOR_NATSEMI is not set
76CONFIG_LPC_ENET=y
77# CONFIG_NET_VENDOR_SEEQ is not set
78# CONFIG_NET_VENDOR_SMSC is not set
79# CONFIG_NET_VENDOR_STMICRO is not set
65CONFIG_SMSC_PHY=y 80CONFIG_SMSC_PHY=y
66# CONFIG_WLAN is not set 81# CONFIG_WLAN is not set
67# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 82# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
@@ -97,16 +112,22 @@ CONFIG_SND_SEQUENCER=y
97CONFIG_SND_MIXER_OSS=y 112CONFIG_SND_MIXER_OSS=y
98CONFIG_SND_PCM_OSS=y 113CONFIG_SND_PCM_OSS=y
99CONFIG_SND_SEQUENCER_OSS=y 114CONFIG_SND_SEQUENCER_OSS=y
100CONFIG_SND_DYNAMIC_MINORS=y 115# CONFIG_SND_SUPPORT_OLD_API is not set
101# CONFIG_SND_VERBOSE_PROCFS is not set 116# CONFIG_SND_VERBOSE_PROCFS is not set
117CONFIG_SND_DEBUG=y
118CONFIG_SND_DEBUG_VERBOSE=y
102# CONFIG_SND_DRIVERS is not set 119# CONFIG_SND_DRIVERS is not set
103# CONFIG_SND_ARM is not set 120# CONFIG_SND_ARM is not set
104# CONFIG_SND_SPI is not set 121# CONFIG_SND_SPI is not set
105CONFIG_SND_SOC=y 122CONFIG_SND_SOC=y
106# CONFIG_HID_SUPPORT is not set 123# CONFIG_HID_SUPPORT is not set
107CONFIG_USB=y 124CONFIG_USB=y
125CONFIG_USB_OHCI_HCD=y
108CONFIG_USB_STORAGE=y 126CONFIG_USB_STORAGE=y
109CONFIG_USB_LIBUSUAL=y 127CONFIG_USB_GADGET=y
128CONFIG_USB_LPC32XX=y
129CONFIG_USB_MASS_STORAGE=m
130CONFIG_USB_G_SERIAL=m
110CONFIG_MMC=y 131CONFIG_MMC=y
111# CONFIG_MMC_BLOCK_BOUNCE is not set 132# CONFIG_MMC_BLOCK_BOUNCE is not set
112CONFIG_MMC_ARMMMCI=y 133CONFIG_MMC_ARMMMCI=y
@@ -114,10 +135,21 @@ CONFIG_NEW_LEDS=y
114CONFIG_LEDS_CLASS=y 135CONFIG_LEDS_CLASS=y
115CONFIG_LEDS_GPIO=y 136CONFIG_LEDS_GPIO=y
116CONFIG_LEDS_TRIGGERS=y 137CONFIG_LEDS_TRIGGERS=y
138CONFIG_LEDS_TRIGGER_TIMER=y
117CONFIG_LEDS_TRIGGER_HEARTBEAT=y 139CONFIG_LEDS_TRIGGER_HEARTBEAT=y
140CONFIG_LEDS_TRIGGER_BACKLIGHT=y
141CONFIG_LEDS_TRIGGER_GPIO=y
142CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
118CONFIG_RTC_CLASS=y 143CONFIG_RTC_CLASS=y
119CONFIG_RTC_INTF_DEV_UIE_EMUL=y 144CONFIG_RTC_INTF_DEV_UIE_EMUL=y
145CONFIG_RTC_DRV_DS1374=y
146CONFIG_RTC_DRV_PCF8563=y
120CONFIG_RTC_DRV_LPC32XX=y 147CONFIG_RTC_DRV_LPC32XX=y
148CONFIG_DMADEVICES=y
149CONFIG_AMBA_PL08X=y
150CONFIG_STAGING=y
151CONFIG_IIO=y
152CONFIG_LPC32XX_ADC=y
121CONFIG_EXT2_FS=y 153CONFIG_EXT2_FS=y
122CONFIG_AUTOFS4_FS=y 154CONFIG_AUTOFS4_FS=y
123CONFIG_MSDOS_FS=y 155CONFIG_MSDOS_FS=y
diff --git a/arch/arm/configs/mini2440_defconfig b/arch/arm/configs/mini2440_defconfig
index 42da9183acc8..082175c54e7c 100644
--- a/arch/arm/configs/mini2440_defconfig
+++ b/arch/arm/configs/mini2440_defconfig
@@ -14,6 +14,8 @@ CONFIG_MODULE_FORCE_UNLOAD=y
14# CONFIG_BLK_DEV_BSG is not set 14# CONFIG_BLK_DEV_BSG is not set
15CONFIG_BLK_DEV_INTEGRITY=y 15CONFIG_BLK_DEV_INTEGRITY=y
16CONFIG_ARCH_S3C24XX=y 16CONFIG_ARCH_S3C24XX=y
17# CONFIG_CPU_S3C2410 is not set
18CONFIG_CPU_S3C2440=y
17CONFIG_S3C_ADC=y 19CONFIG_S3C_ADC=y
18CONFIG_S3C24XX_PWM=y 20CONFIG_S3C24XX_PWM=y
19CONFIG_MACH_MINI2440=y 21CONFIG_MACH_MINI2440=y
diff --git a/arch/arm/configs/nhk8815_defconfig b/arch/arm/configs/nhk8815_defconfig
index 37207d1bf44b..bf123c5384d4 100644
--- a/arch/arm/configs/nhk8815_defconfig
+++ b/arch/arm/configs/nhk8815_defconfig
@@ -97,6 +97,7 @@ CONFIG_I2C=y
97CONFIG_I2C_CHARDEV=y 97CONFIG_I2C_CHARDEV=y
98CONFIG_I2C_GPIO=y 98CONFIG_I2C_GPIO=y
99CONFIG_DEBUG_GPIO=y 99CONFIG_DEBUG_GPIO=y
100CONFIG_PINCTRL_NOMADIK=y
100# CONFIG_HWMON is not set 101# CONFIG_HWMON is not set
101# CONFIG_VGA_CONSOLE is not set 102# CONFIG_VGA_CONSOLE is not set
102CONFIG_RTC_CLASS=y 103CONFIG_RTC_CLASS=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index d5f00d7eb075..9854ff4279e0 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -98,6 +98,7 @@ CONFIG_LIBERTAS_USB=m
98CONFIG_LIBERTAS_SDIO=m 98CONFIG_LIBERTAS_SDIO=m
99CONFIG_LIBERTAS_DEBUG=y 99CONFIG_LIBERTAS_DEBUG=y
100CONFIG_USB_USBNET=y 100CONFIG_USB_USBNET=y
101CONFIG_USB_NET_SMSC95XX=y
101CONFIG_USB_ALI_M5632=y 102CONFIG_USB_ALI_M5632=y
102CONFIG_USB_AN2720=y 103CONFIG_USB_AN2720=y
103CONFIG_USB_EPSON2888=y 104CONFIG_USB_EPSON2888=y
@@ -175,6 +176,7 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
175CONFIG_USB_DEVICEFS=y 176CONFIG_USB_DEVICEFS=y
176CONFIG_USB_SUSPEND=y 177CONFIG_USB_SUSPEND=y
177CONFIG_USB_MON=y 178CONFIG_USB_MON=y
179CONFIG_USB_EHCI_HCD=y
178CONFIG_USB_WDM=y 180CONFIG_USB_WDM=y
179CONFIG_USB_STORAGE=y 181CONFIG_USB_STORAGE=y
180CONFIG_USB_LIBUSUAL=y 182CONFIG_USB_LIBUSUAL=y
diff --git a/arch/arm/configs/rpc_defconfig b/arch/arm/configs/rpc_defconfig
index af278f7a2246..00515ef9782d 100644
--- a/arch/arm/configs/rpc_defconfig
+++ b/arch/arm/configs/rpc_defconfig
@@ -8,8 +8,6 @@ CONFIG_MODULES=y
8CONFIG_MODULE_UNLOAD=y 8CONFIG_MODULE_UNLOAD=y
9# CONFIG_BLK_DEV_BSG is not set 9# CONFIG_BLK_DEV_BSG is not set
10CONFIG_ARCH_RPC=y 10CONFIG_ARCH_RPC=y
11CONFIG_CPU_ARM610=y
12CONFIG_CPU_ARM710=y
13CONFIG_CPU_SA110=y 11CONFIG_CPU_SA110=y
14CONFIG_ZBOOT_ROM_TEXT=0x0 12CONFIG_ZBOOT_ROM_TEXT=0x0
15CONFIG_ZBOOT_ROM_BSS=0x0 13CONFIG_ZBOOT_ROM_BSS=0x0
diff --git a/arch/arm/configs/spear3xx_defconfig b/arch/arm/configs/spear3xx_defconfig
index fea7e1f026a3..7ed42912d69a 100644
--- a/arch/arm/configs/spear3xx_defconfig
+++ b/arch/arm/configs/spear3xx_defconfig
@@ -2,33 +2,67 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_BSD_PROCESS_ACCT=y 3CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5CONFIG_KALLSYMS_EXTRA_PASS=y
6CONFIG_MODULES=y 5CONFIG_MODULES=y
7CONFIG_MODULE_UNLOAD=y 6CONFIG_MODULE_UNLOAD=y
8CONFIG_MODVERSIONS=y 7CONFIG_MODVERSIONS=y
8CONFIG_PARTITION_ADVANCED=y
9CONFIG_PLAT_SPEAR=y 9CONFIG_PLAT_SPEAR=y
10CONFIG_BOARD_SPEAR300_EVB=y 10CONFIG_MACH_SPEAR300=y
11CONFIG_BOARD_SPEAR310_EVB=y 11CONFIG_MACH_SPEAR310=y
12CONFIG_BOARD_SPEAR320_EVB=y 12CONFIG_MACH_SPEAR320=y
13CONFIG_BINFMT_MISC=y 13CONFIG_BINFMT_MISC=y
14CONFIG_NET=y
14CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 15CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
16CONFIG_MTD=y
17CONFIG_MTD_NAND=y
18CONFIG_MTD_NAND_FSMC=y
15CONFIG_BLK_DEV_RAM=y 19CONFIG_BLK_DEV_RAM=y
16CONFIG_BLK_DEV_RAM_SIZE=16384 20CONFIG_BLK_DEV_RAM_SIZE=16384
21CONFIG_NETDEVICES=y
22# CONFIG_NET_VENDOR_BROADCOM is not set
23# CONFIG_NET_VENDOR_CIRRUS is not set
24# CONFIG_NET_VENDOR_FARADAY is not set
25# CONFIG_NET_VENDOR_INTEL is not set
26# CONFIG_NET_VENDOR_MICREL is not set
27# CONFIG_NET_VENDOR_NATSEMI is not set
28# CONFIG_NET_VENDOR_SEEQ is not set
29# CONFIG_NET_VENDOR_SMSC is not set
30CONFIG_STMMAC_ETH=y
31# CONFIG_WLAN is not set
17CONFIG_INPUT_FF_MEMLESS=y 32CONFIG_INPUT_FF_MEMLESS=y
18# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 33# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
19# CONFIG_INPUT_KEYBOARD is not set 34# CONFIG_KEYBOARD_ATKBD is not set
35CONFIG_KEYBOARD_SPEAR=y
20# CONFIG_INPUT_MOUSE is not set 36# CONFIG_INPUT_MOUSE is not set
37# CONFIG_LEGACY_PTYS is not set
21CONFIG_SERIAL_AMBA_PL011=y 38CONFIG_SERIAL_AMBA_PL011=y
22CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 39CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
23# CONFIG_LEGACY_PTYS is not set
24# CONFIG_HW_RANDOM is not set 40# CONFIG_HW_RANDOM is not set
25CONFIG_RAW_DRIVER=y 41CONFIG_RAW_DRIVER=y
26CONFIG_MAX_RAW_DEVS=8192 42CONFIG_MAX_RAW_DEVS=8192
43CONFIG_I2C=y
44CONFIG_I2C_DESIGNWARE_PLATFORM=y
45CONFIG_SPI=y
46CONFIG_SPI_PL022=y
27CONFIG_GPIO_SYSFS=y 47CONFIG_GPIO_SYSFS=y
28CONFIG_GPIO_PL061=y 48CONFIG_GPIO_PL061=y
29# CONFIG_HWMON is not set 49# CONFIG_HWMON is not set
50CONFIG_WATCHDOG=y
51CONFIG_ARM_SP805_WATCHDOG=y
52CONFIG_FB=y
53CONFIG_FB_ARMCLCD=y
30# CONFIG_HID_SUPPORT is not set 54# CONFIG_HID_SUPPORT is not set
31# CONFIG_USB_SUPPORT is not set 55CONFIG_USB=y
56# CONFIG_USB_DEVICE_CLASS is not set
57CONFIG_USB_EHCI_HCD=y
58CONFIG_USB_OHCI_HCD=y
59CONFIG_MMC=y
60CONFIG_MMC_SDHCI=y
61CONFIG_MMC_SDHCI_SPEAR=y
62CONFIG_RTC_CLASS=y
63CONFIG_DMADEVICES=y
64CONFIG_AMBA_PL08X=y
65CONFIG_DMATEST=m
32CONFIG_EXT2_FS=y 66CONFIG_EXT2_FS=y
33CONFIG_EXT2_FS_XATTR=y 67CONFIG_EXT2_FS_XATTR=y
34CONFIG_EXT2_FS_SECURITY=y 68CONFIG_EXT2_FS_SECURITY=y
@@ -39,8 +73,6 @@ CONFIG_MSDOS_FS=m
39CONFIG_VFAT_FS=m 73CONFIG_VFAT_FS=m
40CONFIG_FAT_DEFAULT_IOCHARSET="ascii" 74CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
41CONFIG_TMPFS=y 75CONFIG_TMPFS=y
42CONFIG_PARTITION_ADVANCED=y
43CONFIG_NLS=y
44CONFIG_NLS_DEFAULT="utf8" 76CONFIG_NLS_DEFAULT="utf8"
45CONFIG_NLS_CODEPAGE_437=y 77CONFIG_NLS_CODEPAGE_437=y
46CONFIG_NLS_ASCII=m 78CONFIG_NLS_ASCII=m
@@ -48,6 +80,4 @@ CONFIG_MAGIC_SYSRQ=y
48CONFIG_DEBUG_FS=y 80CONFIG_DEBUG_FS=y
49CONFIG_DEBUG_KERNEL=y 81CONFIG_DEBUG_KERNEL=y
50CONFIG_DEBUG_SPINLOCK=y 82CONFIG_DEBUG_SPINLOCK=y
51CONFIG_DEBUG_SPINLOCK_SLEEP=y
52CONFIG_DEBUG_INFO=y 83CONFIG_DEBUG_INFO=y
53# CONFIG_CRC32 is not set
diff --git a/arch/arm/configs/spear6xx_defconfig b/arch/arm/configs/spear6xx_defconfig
index cef2e836afd2..cf94bc73a0e0 100644
--- a/arch/arm/configs/spear6xx_defconfig
+++ b/arch/arm/configs/spear6xx_defconfig
@@ -2,29 +2,58 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_BSD_PROCESS_ACCT=y 3CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5CONFIG_KALLSYMS_EXTRA_PASS=y
6CONFIG_MODULES=y 5CONFIG_MODULES=y
7CONFIG_MODULE_UNLOAD=y 6CONFIG_MODULE_UNLOAD=y
8CONFIG_MODVERSIONS=y 7CONFIG_MODVERSIONS=y
8CONFIG_PARTITION_ADVANCED=y
9CONFIG_PLAT_SPEAR=y 9CONFIG_PLAT_SPEAR=y
10CONFIG_ARCH_SPEAR6XX=y 10CONFIG_ARCH_SPEAR6XX=y
11CONFIG_BOARD_SPEAR600_EVB=y 11CONFIG_BOARD_SPEAR600_DT=y
12CONFIG_BINFMT_MISC=y 12CONFIG_BINFMT_MISC=y
13CONFIG_NET=y
13CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 14CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
15CONFIG_MTD=y
16CONFIG_MTD_NAND=y
17CONFIG_MTD_NAND_FSMC=y
14CONFIG_BLK_DEV_RAM=y 18CONFIG_BLK_DEV_RAM=y
15CONFIG_BLK_DEV_RAM_SIZE=16384 19CONFIG_BLK_DEV_RAM_SIZE=16384
20CONFIG_NETDEVICES=y
21# CONFIG_NET_VENDOR_BROADCOM is not set
22# CONFIG_NET_VENDOR_CIRRUS is not set
23# CONFIG_NET_VENDOR_FARADAY is not set
24# CONFIG_NET_VENDOR_INTEL is not set
25# CONFIG_NET_VENDOR_MICREL is not set
26# CONFIG_NET_VENDOR_NATSEMI is not set
27# CONFIG_NET_VENDOR_SEEQ is not set
28# CONFIG_NET_VENDOR_SMSC is not set
29CONFIG_STMMAC_ETH=y
30# CONFIG_WLAN is not set
16CONFIG_INPUT_FF_MEMLESS=y 31CONFIG_INPUT_FF_MEMLESS=y
17# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 32# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
33# CONFIG_INPUT_KEYBOARD is not set
34# CONFIG_INPUT_MOUSE is not set
35# CONFIG_LEGACY_PTYS is not set
18CONFIG_SERIAL_AMBA_PL011=y 36CONFIG_SERIAL_AMBA_PL011=y
19CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 37CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
20# CONFIG_LEGACY_PTYS is not set
21CONFIG_RAW_DRIVER=y 38CONFIG_RAW_DRIVER=y
22CONFIG_MAX_RAW_DEVS=8192 39CONFIG_MAX_RAW_DEVS=8192
40CONFIG_I2C=y
41CONFIG_I2C_DESIGNWARE_PLATFORM=y
42CONFIG_SPI=y
43CONFIG_SPI_PL022=y
23CONFIG_GPIO_SYSFS=y 44CONFIG_GPIO_SYSFS=y
24CONFIG_GPIO_PL061=y 45CONFIG_GPIO_PL061=y
25# CONFIG_HWMON is not set 46# CONFIG_HWMON is not set
47CONFIG_WATCHDOG=y
48CONFIG_ARM_SP805_WATCHDOG=y
26# CONFIG_HID_SUPPORT is not set 49# CONFIG_HID_SUPPORT is not set
27# CONFIG_USB_SUPPORT is not set 50CONFIG_USB=y
51CONFIG_USB_EHCI_HCD=y
52CONFIG_USB_OHCI_HCD=y
53CONFIG_RTC_CLASS=y
54CONFIG_DMADEVICES=y
55CONFIG_AMBA_PL08X=y
56CONFIG_DMATEST=m
28CONFIG_EXT2_FS=y 57CONFIG_EXT2_FS=y
29CONFIG_EXT2_FS_XATTR=y 58CONFIG_EXT2_FS_XATTR=y
30CONFIG_EXT2_FS_SECURITY=y 59CONFIG_EXT2_FS_SECURITY=y
@@ -35,8 +64,6 @@ CONFIG_MSDOS_FS=m
35CONFIG_VFAT_FS=m 64CONFIG_VFAT_FS=m
36CONFIG_FAT_DEFAULT_IOCHARSET="ascii" 65CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
37CONFIG_TMPFS=y 66CONFIG_TMPFS=y
38CONFIG_PARTITION_ADVANCED=y
39CONFIG_NLS=y
40CONFIG_NLS_DEFAULT="utf8" 67CONFIG_NLS_DEFAULT="utf8"
41CONFIG_NLS_CODEPAGE_437=y 68CONFIG_NLS_CODEPAGE_437=y
42CONFIG_NLS_ASCII=m 69CONFIG_NLS_ASCII=m
@@ -44,6 +71,4 @@ CONFIG_MAGIC_SYSRQ=y
44CONFIG_DEBUG_FS=y 71CONFIG_DEBUG_FS=y
45CONFIG_DEBUG_KERNEL=y 72CONFIG_DEBUG_KERNEL=y
46CONFIG_DEBUG_SPINLOCK=y 73CONFIG_DEBUG_SPINLOCK=y
47CONFIG_DEBUG_SPINLOCK_SLEEP=y
48CONFIG_DEBUG_INFO=y 74CONFIG_DEBUG_INFO=y
49# CONFIG_CRC32 is not set
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index 889d73ac1ae1..7e84f453e8a6 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -8,8 +8,6 @@ CONFIG_MODULE_UNLOAD=y
8# CONFIG_LBDAF is not set 8# CONFIG_LBDAF is not set
9# CONFIG_BLK_DEV_BSG is not set 9# CONFIG_BLK_DEV_BSG is not set
10CONFIG_ARCH_U8500=y 10CONFIG_ARCH_U8500=y
11CONFIG_UX500_SOC_DB5500=y
12CONFIG_UX500_SOC_DB8500=y
13CONFIG_MACH_HREFV60=y 11CONFIG_MACH_HREFV60=y
14CONFIG_MACH_SNOWBALL=y 12CONFIG_MACH_SNOWBALL=y
15CONFIG_MACH_U5500=y 13CONFIG_MACH_U5500=y
@@ -39,7 +37,6 @@ CONFIG_CAIF=y
39CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 37CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
40CONFIG_BLK_DEV_RAM=y 38CONFIG_BLK_DEV_RAM=y
41CONFIG_BLK_DEV_RAM_SIZE=65536 39CONFIG_BLK_DEV_RAM_SIZE=65536
42CONFIG_MISC_DEVICES=y
43CONFIG_AB8500_PWM=y 40CONFIG_AB8500_PWM=y
44CONFIG_SENSORS_BH1780=y 41CONFIG_SENSORS_BH1780=y
45CONFIG_NETDEVICES=y 42CONFIG_NETDEVICES=y
@@ -65,16 +62,18 @@ CONFIG_SERIAL_AMBA_PL011=y
65CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 62CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
66CONFIG_HW_RANDOM=y 63CONFIG_HW_RANDOM=y
67CONFIG_HW_RANDOM_NOMADIK=y 64CONFIG_HW_RANDOM_NOMADIK=y
68CONFIG_I2C=y
69CONFIG_I2C_NOMADIK=y
70CONFIG_SPI=y 65CONFIG_SPI=y
71CONFIG_SPI_PL022=y 66CONFIG_SPI_PL022=y
72CONFIG_GPIO_STMPE=y 67CONFIG_GPIO_STMPE=y
73CONFIG_GPIO_TC3589X=y 68CONFIG_GPIO_TC3589X=y
69CONFIG_POWER_SUPPLY=y
70CONFIG_AB8500_BM=y
71CONFIG_AB8500_BATTERY_THERM_ON_BATCTRL=y
74CONFIG_MFD_STMPE=y 72CONFIG_MFD_STMPE=y
75CONFIG_MFD_TC3589X=y 73CONFIG_MFD_TC3589X=y
76CONFIG_AB5500_CORE=y 74CONFIG_AB5500_CORE=y
77CONFIG_AB8500_CORE=y 75CONFIG_AB8500_CORE=y
76CONFIG_REGULATOR=y
78CONFIG_REGULATOR_AB8500=y 77CONFIG_REGULATOR_AB8500=y
79# CONFIG_HID_SUPPORT is not set 78# CONFIG_HID_SUPPORT is not set
80CONFIG_USB_GADGET=y 79CONFIG_USB_GADGET=y
diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h
new file mode 100644
index 000000000000..ed2e95d46e29
--- /dev/null
+++ b/arch/arm/include/asm/arch_timer.h
@@ -0,0 +1,19 @@
1#ifndef __ASMARM_ARCH_TIMER_H
2#define __ASMARM_ARCH_TIMER_H
3
4#ifdef CONFIG_ARM_ARCH_TIMER
5int arch_timer_of_register(void);
6int arch_timer_sched_clock_init(void);
7#else
8static inline int arch_timer_of_register(void)
9{
10 return -ENXIO;
11}
12
13static inline int arch_timer_sched_clock_init(void)
14{
15 return -ENXIO;
16}
17#endif
18
19#endif
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index d5d8d5c72682..004c1bc95d2b 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -101,7 +101,7 @@ struct cpu_cache_fns {
101 void (*flush_user_range)(unsigned long, unsigned long, unsigned int); 101 void (*flush_user_range)(unsigned long, unsigned long, unsigned int);
102 102
103 void (*coherent_kern_range)(unsigned long, unsigned long); 103 void (*coherent_kern_range)(unsigned long, unsigned long);
104 void (*coherent_user_range)(unsigned long, unsigned long); 104 int (*coherent_user_range)(unsigned long, unsigned long);
105 void (*flush_kern_dcache_area)(void *, size_t); 105 void (*flush_kern_dcache_area)(void *, size_t);
106 106
107 void (*dma_map_area)(const void *, size_t, int); 107 void (*dma_map_area)(const void *, size_t, int);
@@ -142,7 +142,7 @@ extern void __cpuc_flush_kern_all(void);
142extern void __cpuc_flush_user_all(void); 142extern void __cpuc_flush_user_all(void);
143extern void __cpuc_flush_user_range(unsigned long, unsigned long, unsigned int); 143extern void __cpuc_flush_user_range(unsigned long, unsigned long, unsigned int);
144extern void __cpuc_coherent_kern_range(unsigned long, unsigned long); 144extern void __cpuc_coherent_kern_range(unsigned long, unsigned long);
145extern void __cpuc_coherent_user_range(unsigned long, unsigned long); 145extern int __cpuc_coherent_user_range(unsigned long, unsigned long);
146extern void __cpuc_flush_dcache_area(void *, size_t); 146extern void __cpuc_flush_dcache_area(void *, size_t);
147 147
148/* 148/*
@@ -249,7 +249,7 @@ extern void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr
249 * Harvard caches are synchronised for the user space address range. 249 * Harvard caches are synchronised for the user space address range.
250 * This is used for the ARM private sys_cacheflush system call. 250 * This is used for the ARM private sys_cacheflush system call.
251 */ 251 */
252#define flush_cache_user_range(vma,start,end) \ 252#define flush_cache_user_range(start,end) \
253 __cpuc_coherent_user_range((start) & PAGE_MASK, PAGE_ALIGN(end)) 253 __cpuc_coherent_user_range((start) & PAGE_MASK, PAGE_ALIGN(end))
254 254
255/* 255/*
diff --git a/arch/arm/include/asm/cmpxchg.h b/arch/arm/include/asm/cmpxchg.h
index d41d7cbf0ada..7eb18c1d8d6c 100644
--- a/arch/arm/include/asm/cmpxchg.h
+++ b/arch/arm/include/asm/cmpxchg.h
@@ -229,66 +229,19 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
229 (unsigned long)(n), \ 229 (unsigned long)(n), \
230 sizeof(*(ptr)))) 230 sizeof(*(ptr))))
231 231
232#ifndef CONFIG_CPU_V6 /* min ARCH >= ARMv6K */ 232#define cmpxchg64(ptr, o, n) \
233 233 ((__typeof__(*(ptr)))atomic64_cmpxchg(container_of((ptr), \
234/* 234 atomic64_t, \
235 * Note : ARMv7-M (currently unsupported by Linux) does not support 235 counter), \
236 * ldrexd/strexd. If ARMv7-M is ever supported by the Linux kernel, it should 236 (unsigned long)(o), \
237 * not be allowed to use __cmpxchg64. 237 (unsigned long)(n)))
238 */ 238
239static inline unsigned long long __cmpxchg64(volatile void *ptr, 239#define cmpxchg64_local(ptr, o, n) \
240 unsigned long long old, 240 ((__typeof__(*(ptr)))local64_cmpxchg(container_of((ptr), \
241 unsigned long long new) 241 local64_t, \
242{ 242 a), \
243 register unsigned long long oldval asm("r0"); 243 (unsigned long)(o), \
244 register unsigned long long __old asm("r2") = old; 244 (unsigned long)(n)))
245 register unsigned long long __new asm("r4") = new;
246 unsigned long res;
247
248 do {
249 asm volatile(
250 " @ __cmpxchg8\n"
251 " ldrexd %1, %H1, [%2]\n"
252 " mov %0, #0\n"
253 " teq %1, %3\n"
254 " teqeq %H1, %H3\n"
255 " strexdeq %0, %4, %H4, [%2]\n"
256 : "=&r" (res), "=&r" (oldval)
257 : "r" (ptr), "Ir" (__old), "r" (__new)
258 : "memory", "cc");
259 } while (res);
260
261 return oldval;
262}
263
264static inline unsigned long long __cmpxchg64_mb(volatile void *ptr,
265 unsigned long long old,
266 unsigned long long new)
267{
268 unsigned long long ret;
269
270 smp_mb();
271 ret = __cmpxchg64(ptr, old, new);
272 smp_mb();
273
274 return ret;
275}
276
277#define cmpxchg64(ptr,o,n) \
278 ((__typeof__(*(ptr)))__cmpxchg64_mb((ptr), \
279 (unsigned long long)(o), \
280 (unsigned long long)(n)))
281
282#define cmpxchg64_local(ptr,o,n) \
283 ((__typeof__(*(ptr)))__cmpxchg64((ptr), \
284 (unsigned long long)(o), \
285 (unsigned long long)(n)))
286
287#else /* min ARCH = ARMv6 */
288
289#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
290
291#endif
292 245
293#endif /* __LINUX_ARM_ARCH__ >= 6 */ 246#endif /* __LINUX_ARM_ARCH__ >= 6 */
294 247
diff --git a/arch/arm/include/asm/cpu.h b/arch/arm/include/asm/cpu.h
index 793968173bef..d797223b39d5 100644
--- a/arch/arm/include/asm/cpu.h
+++ b/arch/arm/include/asm/cpu.h
@@ -16,7 +16,6 @@
16struct cpuinfo_arm { 16struct cpuinfo_arm {
17 struct cpu cpu; 17 struct cpu cpu;
18#ifdef CONFIG_SMP 18#ifdef CONFIG_SMP
19 struct task_struct *idle;
20 unsigned int loops_per_jiffy; 19 unsigned int loops_per_jiffy;
21#endif 20#endif
22}; 21};
diff --git a/arch/arm/include/asm/glue-df.h b/arch/arm/include/asm/glue-df.h
index 354d571e8bcc..8cacbcda76da 100644
--- a/arch/arm/include/asm/glue-df.h
+++ b/arch/arm/include/asm/glue-df.h
@@ -31,14 +31,6 @@
31#undef CPU_DABORT_HANDLER 31#undef CPU_DABORT_HANDLER
32#undef MULTI_DABORT 32#undef MULTI_DABORT
33 33
34#if defined(CONFIG_CPU_ARM610)
35# ifdef CPU_DABORT_HANDLER
36# define MULTI_DABORT 1
37# else
38# define CPU_DABORT_HANDLER cpu_arm6_data_abort
39# endif
40#endif
41
42#if defined(CONFIG_CPU_ARM710) 34#if defined(CONFIG_CPU_ARM710)
43# ifdef CPU_DABORT_HANDLER 35# ifdef CPU_DABORT_HANDLER
44# define MULTI_DABORT 1 36# define MULTI_DABORT 1
diff --git a/arch/arm/include/asm/glue-proc.h b/arch/arm/include/asm/glue-proc.h
index e2be7f142668..ac1dd54724b6 100644
--- a/arch/arm/include/asm/glue-proc.h
+++ b/arch/arm/include/asm/glue-proc.h
@@ -23,15 +23,6 @@
23 * CPU_NAME - the prefix for CPU related functions 23 * CPU_NAME - the prefix for CPU related functions
24 */ 24 */
25 25
26#ifdef CONFIG_CPU_ARM610
27# ifdef CPU_NAME
28# undef MULTI_CPU
29# define MULTI_CPU
30# else
31# define CPU_NAME cpu_arm6
32# endif
33#endif
34
35#ifdef CONFIG_CPU_ARM7TDMI 26#ifdef CONFIG_CPU_ARM7TDMI
36# ifdef CPU_NAME 27# ifdef CPU_NAME
37# undef MULTI_CPU 28# undef MULTI_CPU
@@ -41,15 +32,6 @@
41# endif 32# endif
42#endif 33#endif
43 34
44#ifdef CONFIG_CPU_ARM710
45# ifdef CPU_NAME
46# undef MULTI_CPU
47# define MULTI_CPU
48# else
49# define CPU_NAME cpu_arm7
50# endif
51#endif
52
53#ifdef CONFIG_CPU_ARM720T 35#ifdef CONFIG_CPU_ARM720T
54# ifdef CPU_NAME 36# ifdef CPU_NAME
55# undef MULTI_CPU 37# undef MULTI_CPU
diff --git a/arch/arm/include/asm/hardware/cs89712.h b/arch/arm/include/asm/hardware/cs89712.h
deleted file mode 100644
index f75626933e94..000000000000
--- a/arch/arm/include/asm/hardware/cs89712.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * arch/arm/include/asm/hardware/cs89712.h
3 *
4 * This file contains the hardware definitions of the CS89712
5 * additional internal registers.
6 *
7 * Copyright (C) 2001 Thomas Gleixner autronix automation <gleixner@autronix.de>
8 *
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24#ifndef __ASM_HARDWARE_CS89712_H
25#define __ASM_HARDWARE_CS89712_H
26
27/*
28* CS89712 additional registers
29*/
30
31#define PCDR 0x0002 /* Port C Data register ---------------------------- */
32#define PCDDR 0x0042 /* Port C Data Direction register ------------------ */
33#define SDCONF 0x2300 /* SDRAM Configuration register ---------------------*/
34#define SDRFPR 0x2340 /* SDRAM Refresh period register --------------------*/
35
36#define SDCONF_ACTIVE (1 << 10)
37#define SDCONF_CLKCTL (1 << 9)
38#define SDCONF_WIDTH_4 (0 << 7)
39#define SDCONF_WIDTH_8 (1 << 7)
40#define SDCONF_WIDTH_16 (2 << 7)
41#define SDCONF_WIDTH_32 (3 << 7)
42#define SDCONF_SIZE_16 (0 << 5)
43#define SDCONF_SIZE_64 (1 << 5)
44#define SDCONF_SIZE_128 (2 << 5)
45#define SDCONF_SIZE_256 (3 << 5)
46#define SDCONF_CASLAT_2 (2)
47#define SDCONF_CASLAT_3 (3)
48
49#endif /* __ASM_HARDWARE_CS89712_H */
diff --git a/arch/arm/include/asm/hardware/ep7211.h b/arch/arm/include/asm/hardware/ep7211.h
deleted file mode 100644
index 654d5f625c49..000000000000
--- a/arch/arm/include/asm/hardware/ep7211.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * arch/arm/include/asm/hardware/ep7211.h
3 *
4 * This file contains the hardware definitions of the EP7211 internal
5 * registers.
6 *
7 * Copyright (C) 2001 Blue Mug, Inc. All Rights Reserved.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23#ifndef __ASM_HARDWARE_EP7211_H
24#define __ASM_HARDWARE_EP7211_H
25
26#include <asm/hardware/clps7111.h>
27
28/*
29 * define EP7211_BASE to be the base address of the region
30 * you want to access.
31 */
32
33#define EP7211_PHYS_BASE (0x80000000)
34
35/*
36 * XXX miket@bluemug.com: need to introduce EP7211 registers (those not
37 * present in 7212) here.
38 */
39
40#endif /* __ASM_HARDWARE_EP7211_H */
diff --git a/arch/arm/include/asm/hardware/ep7212.h b/arch/arm/include/asm/hardware/ep7212.h
deleted file mode 100644
index 3b43bbeaf1db..000000000000
--- a/arch/arm/include/asm/hardware/ep7212.h
+++ /dev/null
@@ -1,83 +0,0 @@
1/*
2 * arch/arm/include/asm/hardware/ep7212.h
3 *
4 * This file contains the hardware definitions of the EP7212 internal
5 * registers.
6 *
7 * Copyright (C) 2000 Deep Blue Solutions Ltd.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23#ifndef __ASM_HARDWARE_EP7212_H
24#define __ASM_HARDWARE_EP7212_H
25
26/*
27 * define EP7212_BASE to be the base address of the region
28 * you want to access.
29 */
30
31#define EP7212_PHYS_BASE (0x80000000)
32
33#ifndef __ASSEMBLY__
34#define ep_readl(off) __raw_readl(EP7212_BASE + (off))
35#define ep_writel(val,off) __raw_writel(val, EP7212_BASE + (off))
36#endif
37
38/*
39 * These registers are specific to the EP7212 only
40 */
41#define DAIR 0x2000
42#define DAIR0 0x2040
43#define DAIDR1 0x2080
44#define DAIDR2 0x20c0
45#define DAISR 0x2100
46#define SYSCON3 0x2200
47#define INTSR3 0x2240
48#define INTMR3 0x2280
49#define LEDFLSH 0x22c0
50
51#define DAIR_DAIEN (1 << 16)
52#define DAIR_ECS (1 << 17)
53#define DAIR_LCTM (1 << 19)
54#define DAIR_LCRM (1 << 20)
55#define DAIR_RCTM (1 << 21)
56#define DAIR_RCRM (1 << 22)
57#define DAIR_LBM (1 << 23)
58
59#define DAIDR2_FIFOEN (1 << 15)
60#define DAIDR2_FIFOLEFT (0x0d << 16)
61#define DAIDR2_FIFORIGHT (0x11 << 16)
62
63#define DAISR_RCTS (1 << 0)
64#define DAISR_RCRS (1 << 1)
65#define DAISR_LCTS (1 << 2)
66#define DAISR_LCRS (1 << 3)
67#define DAISR_RCTU (1 << 4)
68#define DAISR_RCRO (1 << 5)
69#define DAISR_LCTU (1 << 6)
70#define DAISR_LCRO (1 << 7)
71#define DAISR_RCNF (1 << 8)
72#define DAISR_RCNE (1 << 9)
73#define DAISR_LCNF (1 << 10)
74#define DAISR_LCNE (1 << 11)
75#define DAISR_FIFO (1 << 12)
76
77#define SYSCON3_ADCCON (1 << 0)
78#define SYSCON3_DAISEL (1 << 3)
79#define SYSCON3_ADCCKNSEN (1 << 4)
80#define SYSCON3_FASTWAKE (1 << 8)
81#define SYSCON3_DAIEN (1 << 9)
82
83#endif /* __ASM_HARDWARE_EP7212_H */
diff --git a/arch/arm/include/asm/hardware/it8152.h b/arch/arm/include/asm/hardware/it8152.h
index 73f84fa4f366..d36a73d7c0e8 100644
--- a/arch/arm/include/asm/hardware/it8152.h
+++ b/arch/arm/include/asm/hardware/it8152.h
@@ -110,6 +110,6 @@ extern void it8152_irq_demux(unsigned int irq, struct irq_desc *desc);
110extern void it8152_init_irq(void); 110extern void it8152_init_irq(void);
111extern int it8152_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); 111extern int it8152_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
112extern int it8152_pci_setup(int nr, struct pci_sys_data *sys); 112extern int it8152_pci_setup(int nr, struct pci_sys_data *sys);
113extern struct pci_bus *it8152_pci_scan_bus(int nr, struct pci_sys_data *sys); 113extern struct pci_ops it8152_ops;
114 114
115#endif /* __ASM_HARDWARE_IT8152_H */ 115#endif /* __ASM_HARDWARE_IT8152_H */
diff --git a/arch/arm/include/asm/hardware/uengine.h b/arch/arm/include/asm/hardware/uengine.h
deleted file mode 100644
index b442d65c6593..000000000000
--- a/arch/arm/include/asm/hardware/uengine.h
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * Generic library functions for the microengines found on the Intel
3 * IXP2000 series of network processors.
4 *
5 * Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org>
6 * Dedicated to Marija Kulikova.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as
10 * published by the Free Software Foundation; either version 2.1 of the
11 * License, or (at your option) any later version.
12 */
13
14#ifndef __IXP2000_UENGINE_H
15#define __IXP2000_UENGINE_H
16
17extern u32 ixp2000_uengine_mask;
18
19struct ixp2000_uengine_code
20{
21 u32 cpu_model_bitmask;
22 u8 cpu_min_revision;
23 u8 cpu_max_revision;
24
25 u32 uengine_parameters;
26
27 struct ixp2000_reg_value {
28 int reg;
29 u32 value;
30 } *initial_reg_values;
31
32 int num_insns;
33 u8 *insns;
34};
35
36u32 ixp2000_uengine_csr_read(int uengine, int offset);
37void ixp2000_uengine_csr_write(int uengine, int offset, u32 value);
38void ixp2000_uengine_reset(u32 uengine_mask);
39void ixp2000_uengine_set_mode(int uengine, u32 mode);
40void ixp2000_uengine_load_microcode(int uengine, u8 *ucode, int insns);
41void ixp2000_uengine_init_context(int uengine, int context, int pc);
42void ixp2000_uengine_start_contexts(int uengine, u8 ctx_mask);
43void ixp2000_uengine_stop_contexts(int uengine, u8 ctx_mask);
44int ixp2000_uengine_load(int uengine, struct ixp2000_uengine_code *c);
45
46#define IXP2000_UENGINE_8_CONTEXTS 0x00000000
47#define IXP2000_UENGINE_4_CONTEXTS 0x80000000
48#define IXP2000_UENGINE_PRN_UPDATE_EVERY 0x40000000
49#define IXP2000_UENGINE_PRN_UPDATE_ON_ACCESS 0x00000000
50#define IXP2000_UENGINE_NN_FROM_SELF 0x00100000
51#define IXP2000_UENGINE_NN_FROM_PREVIOUS 0x00000000
52#define IXP2000_UENGINE_ASSERT_EMPTY_AT_3 0x000c0000
53#define IXP2000_UENGINE_ASSERT_EMPTY_AT_2 0x00080000
54#define IXP2000_UENGINE_ASSERT_EMPTY_AT_1 0x00040000
55#define IXP2000_UENGINE_ASSERT_EMPTY_AT_0 0x00000000
56#define IXP2000_UENGINE_LM_ADDR1_GLOBAL 0x00020000
57#define IXP2000_UENGINE_LM_ADDR1_PER_CONTEXT 0x00000000
58#define IXP2000_UENGINE_LM_ADDR0_GLOBAL 0x00010000
59#define IXP2000_UENGINE_LM_ADDR0_PER_CONTEXT 0x00000000
60
61
62#endif
diff --git a/arch/arm/include/asm/jump_label.h b/arch/arm/include/asm/jump_label.h
index 5c5ca2ea62b0..bfc198c75913 100644
--- a/arch/arm/include/asm/jump_label.h
+++ b/arch/arm/include/asm/jump_label.h
@@ -14,7 +14,7 @@
14#define JUMP_LABEL_NOP "nop" 14#define JUMP_LABEL_NOP "nop"
15#endif 15#endif
16 16
17static __always_inline bool arch_static_branch(struct jump_label_key *key) 17static __always_inline bool arch_static_branch(struct static_key *key)
18{ 18{
19 asm goto("1:\n\t" 19 asm goto("1:\n\t"
20 JUMP_LABEL_NOP "\n\t" 20 JUMP_LABEL_NOP "\n\t"
diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h
index d943b7d20f11..26c511fddf8f 100644
--- a/arch/arm/include/asm/mach/pci.h
+++ b/arch/arm/include/asm/mach/pci.h
@@ -12,13 +12,14 @@
12#define __ASM_MACH_PCI_H 12#define __ASM_MACH_PCI_H
13 13
14struct pci_sys_data; 14struct pci_sys_data;
15struct pci_ops;
15struct pci_bus; 16struct pci_bus;
16 17
17struct hw_pci { 18struct hw_pci {
18#ifdef CONFIG_PCI_DOMAINS 19#ifdef CONFIG_PCI_DOMAINS
19 int domain; 20 int domain;
20#endif 21#endif
21 struct list_head buses; 22 struct pci_ops *ops;
22 int nr_controllers; 23 int nr_controllers;
23 int (*setup)(int nr, struct pci_sys_data *); 24 int (*setup)(int nr, struct pci_sys_data *);
24 struct pci_bus *(*scan)(int nr, struct pci_sys_data *); 25 struct pci_bus *(*scan)(int nr, struct pci_sys_data *);
@@ -45,16 +46,10 @@ struct pci_sys_data {
45 u8 (*swizzle)(struct pci_dev *, u8 *); 46 u8 (*swizzle)(struct pci_dev *, u8 *);
46 /* IRQ mapping */ 47 /* IRQ mapping */
47 int (*map_irq)(const struct pci_dev *, u8, u8); 48 int (*map_irq)(const struct pci_dev *, u8, u8);
48 struct hw_pci *hw;
49 void *private_data; /* platform controller private data */ 49 void *private_data; /* platform controller private data */
50}; 50};
51 51
52/* 52/*
53 * This is the standard PCI-PCI bridge swizzling algorithm.
54 */
55#define pci_std_swizzle pci_common_swizzle
56
57/*
58 * Call this with your hw_pci struct to initialise the PCI system. 53 * Call this with your hw_pci struct to initialise the PCI system.
59 */ 54 */
60void pci_common_init(struct hw_pci *); 55void pci_common_init(struct hw_pci *);
@@ -62,22 +57,22 @@ void pci_common_init(struct hw_pci *);
62/* 57/*
63 * PCI controllers 58 * PCI controllers
64 */ 59 */
60extern struct pci_ops iop3xx_ops;
65extern int iop3xx_pci_setup(int nr, struct pci_sys_data *); 61extern int iop3xx_pci_setup(int nr, struct pci_sys_data *);
66extern struct pci_bus *iop3xx_pci_scan_bus(int nr, struct pci_sys_data *);
67extern void iop3xx_pci_preinit(void); 62extern void iop3xx_pci_preinit(void);
68extern void iop3xx_pci_preinit_cond(void); 63extern void iop3xx_pci_preinit_cond(void);
69 64
65extern struct pci_ops dc21285_ops;
70extern int dc21285_setup(int nr, struct pci_sys_data *); 66extern int dc21285_setup(int nr, struct pci_sys_data *);
71extern struct pci_bus *dc21285_scan_bus(int nr, struct pci_sys_data *);
72extern void dc21285_preinit(void); 67extern void dc21285_preinit(void);
73extern void dc21285_postinit(void); 68extern void dc21285_postinit(void);
74 69
70extern struct pci_ops via82c505_ops;
75extern int via82c505_setup(int nr, struct pci_sys_data *); 71extern int via82c505_setup(int nr, struct pci_sys_data *);
76extern struct pci_bus *via82c505_scan_bus(int nr, struct pci_sys_data *);
77extern void via82c505_init(void *sysdata); 72extern void via82c505_init(void *sysdata);
78 73
74extern struct pci_ops pci_v3_ops;
79extern int pci_v3_setup(int nr, struct pci_sys_data *); 75extern int pci_v3_setup(int nr, struct pci_sys_data *);
80extern struct pci_bus *pci_v3_scan_bus(int nr, struct pci_sys_data *);
81extern void pci_v3_preinit(void); 76extern void pci_v3_preinit(void);
82extern void pci_v3_postinit(void); 77extern void pci_v3_postinit(void);
83 78
diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h
index f73c908b7fa0..6ca945f534ab 100644
--- a/arch/arm/include/asm/mach/time.h
+++ b/arch/arm/include/asm/mach/time.h
@@ -42,4 +42,9 @@ struct sys_timer {
42 42
43extern void timer_tick(void); 43extern void timer_tick(void);
44 44
45struct timespec;
46typedef void (*clock_access_fn)(struct timespec *);
47extern int register_persistent_clock(clock_access_fn read_boot,
48 clock_access_fn read_persistent);
49
45#endif 50#endif
diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h
index b8e580a297e4..14965658a923 100644
--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -34,11 +34,4 @@ typedef struct {
34 34
35#endif 35#endif
36 36
37/*
38 * switch_mm() may do a full cache flush over the context switch,
39 * so enable interrupts over the context switch to avoid high
40 * latency.
41 */
42#define __ARCH_WANT_INTERRUPTS_ON_CTXSW
43
44#endif 37#endif
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h
index a0b3cac0547c..0306bc642c0d 100644
--- a/arch/arm/include/asm/mmu_context.h
+++ b/arch/arm/include/asm/mmu_context.h
@@ -43,45 +43,104 @@ void __check_kvm_seq(struct mm_struct *mm);
43#define ASID_FIRST_VERSION (1 << ASID_BITS) 43#define ASID_FIRST_VERSION (1 << ASID_BITS)
44 44
45extern unsigned int cpu_last_asid; 45extern unsigned int cpu_last_asid;
46#ifdef CONFIG_SMP
47DECLARE_PER_CPU(struct mm_struct *, current_mm);
48#endif
49 46
50void __init_new_context(struct task_struct *tsk, struct mm_struct *mm); 47void __init_new_context(struct task_struct *tsk, struct mm_struct *mm);
51void __new_context(struct mm_struct *mm); 48void __new_context(struct mm_struct *mm);
49void cpu_set_reserved_ttbr0(void);
52 50
53static inline void check_context(struct mm_struct *mm) 51static inline void switch_new_context(struct mm_struct *mm)
54{ 52{
55 /* 53 unsigned long flags;
56 * This code is executed with interrupts enabled. Therefore, 54
57 * mm->context.id cannot be updated to the latest ASID version 55 __new_context(mm);
58 * on a different CPU (and condition below not triggered) 56
59 * without first getting an IPI to reset the context. The 57 local_irq_save(flags);
60 * alternative is to take a read_lock on mm->context.id_lock 58 cpu_switch_mm(mm->pgd, mm);
61 * (after changing its type to rwlock_t). 59 local_irq_restore(flags);
62 */ 60}
63 if (unlikely((mm->context.id ^ cpu_last_asid) >> ASID_BITS))
64 __new_context(mm);
65 61
62static inline void check_and_switch_context(struct mm_struct *mm,
63 struct task_struct *tsk)
64{
66 if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq)) 65 if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq))
67 __check_kvm_seq(mm); 66 __check_kvm_seq(mm);
67
68 /*
69 * Required during context switch to avoid speculative page table
70 * walking with the wrong TTBR.
71 */
72 cpu_set_reserved_ttbr0();
73
74 if (!((mm->context.id ^ cpu_last_asid) >> ASID_BITS))
75 /*
76 * The ASID is from the current generation, just switch to the
77 * new pgd. This condition is only true for calls from
78 * context_switch() and interrupts are already disabled.
79 */
80 cpu_switch_mm(mm->pgd, mm);
81 else if (irqs_disabled())
82 /*
83 * Defer the new ASID allocation until after the context
84 * switch critical region since __new_context() cannot be
85 * called with interrupts disabled (it sends IPIs).
86 */
87 set_ti_thread_flag(task_thread_info(tsk), TIF_SWITCH_MM);
88 else
89 /*
90 * That is a direct call to switch_mm() or activate_mm() with
91 * interrupts enabled and a new context.
92 */
93 switch_new_context(mm);
68} 94}
69 95
70#define init_new_context(tsk,mm) (__init_new_context(tsk,mm),0) 96#define init_new_context(tsk,mm) (__init_new_context(tsk,mm),0)
71 97
72#else 98#define finish_arch_post_lock_switch \
73 99 finish_arch_post_lock_switch
74static inline void check_context(struct mm_struct *mm) 100static inline void finish_arch_post_lock_switch(void)
75{ 101{
102 if (test_and_clear_thread_flag(TIF_SWITCH_MM))
103 switch_new_context(current->mm);
104}
105
106#else /* !CONFIG_CPU_HAS_ASID */
107
76#ifdef CONFIG_MMU 108#ifdef CONFIG_MMU
109
110static inline void check_and_switch_context(struct mm_struct *mm,
111 struct task_struct *tsk)
112{
77 if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq)) 113 if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq))
78 __check_kvm_seq(mm); 114 __check_kvm_seq(mm);
79#endif 115
116 if (irqs_disabled())
117 /*
118 * cpu_switch_mm() needs to flush the VIVT caches. To avoid
119 * high interrupt latencies, defer the call and continue
120 * running with the old mm. Since we only support UP systems
121 * on non-ASID CPUs, the old mm will remain valid until the
122 * finish_arch_post_lock_switch() call.
123 */
124 set_ti_thread_flag(task_thread_info(tsk), TIF_SWITCH_MM);
125 else
126 cpu_switch_mm(mm->pgd, mm);
80} 127}
81 128
129#define finish_arch_post_lock_switch \
130 finish_arch_post_lock_switch
131static inline void finish_arch_post_lock_switch(void)
132{
133 if (test_and_clear_thread_flag(TIF_SWITCH_MM)) {
134 struct mm_struct *mm = current->mm;
135 cpu_switch_mm(mm->pgd, mm);
136 }
137}
138
139#endif /* CONFIG_MMU */
140
82#define init_new_context(tsk,mm) 0 141#define init_new_context(tsk,mm) 0
83 142
84#endif 143#endif /* CONFIG_CPU_HAS_ASID */
85 144
86#define destroy_context(mm) do { } while(0) 145#define destroy_context(mm) do { } while(0)
87 146
@@ -119,12 +178,7 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
119 __flush_icache_all(); 178 __flush_icache_all();
120#endif 179#endif
121 if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next) { 180 if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next) {
122#ifdef CONFIG_SMP 181 check_and_switch_context(next, tsk);
123 struct mm_struct **crt_mm = &per_cpu(current_mm, cpu);
124 *crt_mm = next;
125#endif
126 check_context(next);
127 cpu_switch_mm(next->pgd, next);
128 if (cache_is_vivt()) 182 if (cache_is_vivt())
129 cpumask_clear_cpu(cpu, mm_cpumask(prev)); 183 cpumask_clear_cpu(cpu, mm_cpumask(prev));
130 } 184 }
diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h
index 5838361c48b3..ecf901902e44 100644
--- a/arch/arm/include/asm/page.h
+++ b/arch/arm/include/asm/page.h
@@ -34,7 +34,6 @@
34 * processor(s) we're building for. 34 * processor(s) we're building for.
35 * 35 *
36 * We have the following to choose from: 36 * We have the following to choose from:
37 * v3 - ARMv3
38 * v4wt - ARMv4 with writethrough cache, without minicache 37 * v4wt - ARMv4 with writethrough cache, without minicache
39 * v4wb - ARMv4 with writeback cache, without minicache 38 * v4wb - ARMv4 with writeback cache, without minicache
40 * v4_mc - ARMv4 with minicache 39 * v4_mc - ARMv4 with minicache
@@ -44,14 +43,6 @@
44#undef _USER 43#undef _USER
45#undef MULTI_USER 44#undef MULTI_USER
46 45
47#ifdef CONFIG_CPU_COPY_V3
48# ifdef _USER
49# define MULTI_USER 1
50# else
51# define _USER v3
52# endif
53#endif
54
55#ifdef CONFIG_CPU_COPY_V4WT 46#ifdef CONFIG_CPU_COPY_V4WT
56# ifdef _USER 47# ifdef _USER
57# define MULTI_USER 1 48# define MULTI_USER 1
diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h
index 759af70f9a0a..b24903549d1c 100644
--- a/arch/arm/include/asm/pgtable-3level.h
+++ b/arch/arm/include/asm/pgtable-3level.h
@@ -69,8 +69,6 @@
69 */ 69 */
70#define L_PTE_PRESENT (_AT(pteval_t, 3) << 0) /* Valid */ 70#define L_PTE_PRESENT (_AT(pteval_t, 3) << 0) /* Valid */
71#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */ 71#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */
72#define L_PTE_BUFFERABLE (_AT(pteval_t, 1) << 2) /* AttrIndx[0] */
73#define L_PTE_CACHEABLE (_AT(pteval_t, 1) << 3) /* AttrIndx[1] */
74#define L_PTE_USER (_AT(pteval_t, 1) << 6) /* AP[1] */ 72#define L_PTE_USER (_AT(pteval_t, 1) << 6) /* AP[1] */
75#define L_PTE_RDONLY (_AT(pteval_t, 1) << 7) /* AP[2] */ 73#define L_PTE_RDONLY (_AT(pteval_t, 1) << 7) /* AP[2] */
76#define L_PTE_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */ 74#define L_PTE_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h
index 5ac8d3d3e025..d7038fa22343 100644
--- a/arch/arm/include/asm/processor.h
+++ b/arch/arm/include/asm/processor.h
@@ -88,8 +88,6 @@ unsigned long get_wchan(struct task_struct *p);
88#define cpu_relax() barrier() 88#define cpu_relax() barrier()
89#endif 89#endif
90 90
91void cpu_idle_wait(void);
92
93/* 91/*
94 * Create a new kernel thread 92 * Create a new kernel thread
95 */ 93 */
diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
index 451808ba1211..355ece523f41 100644
--- a/arch/arm/include/asm/ptrace.h
+++ b/arch/arm/include/asm/ptrace.h
@@ -249,6 +249,11 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
249 return regs->ARM_sp; 249 return regs->ARM_sp;
250} 250}
251 251
252static inline unsigned long user_stack_pointer(struct pt_regs *regs)
253{
254 return regs->ARM_sp;
255}
256
252#endif /* __KERNEL__ */ 257#endif /* __KERNEL__ */
253 258
254#endif /* __ASSEMBLY__ */ 259#endif /* __ASSEMBLY__ */
diff --git a/arch/arm/include/asm/syscall.h b/arch/arm/include/asm/syscall.h
new file mode 100644
index 000000000000..c334a23ddf75
--- /dev/null
+++ b/arch/arm/include/asm/syscall.h
@@ -0,0 +1,93 @@
1/*
2 * Access to user system call parameters and results
3 *
4 * See asm-generic/syscall.h for descriptions of what we must do here.
5 */
6
7#ifndef _ASM_ARM_SYSCALL_H
8#define _ASM_ARM_SYSCALL_H
9
10#include <linux/err.h>
11
12extern const unsigned long sys_call_table[];
13
14static inline int syscall_get_nr(struct task_struct *task,
15 struct pt_regs *regs)
16{
17 return task_thread_info(task)->syscall;
18}
19
20static inline void syscall_rollback(struct task_struct *task,
21 struct pt_regs *regs)
22{
23 regs->ARM_r0 = regs->ARM_ORIG_r0;
24}
25
26static inline long syscall_get_error(struct task_struct *task,
27 struct pt_regs *regs)
28{
29 unsigned long error = regs->ARM_r0;
30 return IS_ERR_VALUE(error) ? error : 0;
31}
32
33static inline long syscall_get_return_value(struct task_struct *task,
34 struct pt_regs *regs)
35{
36 return regs->ARM_r0;
37}
38
39static inline void syscall_set_return_value(struct task_struct *task,
40 struct pt_regs *regs,
41 int error, long val)
42{
43 regs->ARM_r0 = (long) error ? error : val;
44}
45
46#define SYSCALL_MAX_ARGS 7
47
48static inline void syscall_get_arguments(struct task_struct *task,
49 struct pt_regs *regs,
50 unsigned int i, unsigned int n,
51 unsigned long *args)
52{
53 if (i + n > SYSCALL_MAX_ARGS) {
54 unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i;
55 unsigned int n_bad = n + i - SYSCALL_MAX_ARGS;
56 pr_warning("%s called with max args %d, handling only %d\n",
57 __func__, i + n, SYSCALL_MAX_ARGS);
58 memset(args_bad, 0, n_bad * sizeof(args[0]));
59 n = SYSCALL_MAX_ARGS - i;
60 }
61
62 if (i == 0) {
63 args[0] = regs->ARM_ORIG_r0;
64 args++;
65 i++;
66 n--;
67 }
68
69 memcpy(args, &regs->ARM_r0 + i, n * sizeof(args[0]));
70}
71
72static inline void syscall_set_arguments(struct task_struct *task,
73 struct pt_regs *regs,
74 unsigned int i, unsigned int n,
75 const unsigned long *args)
76{
77 if (i + n > SYSCALL_MAX_ARGS) {
78 pr_warning("%s called with max args %d, handling only %d\n",
79 __func__, i + n, SYSCALL_MAX_ARGS);
80 n = SYSCALL_MAX_ARGS - i;
81 }
82
83 if (i == 0) {
84 regs->ARM_ORIG_r0 = args[0];
85 args++;
86 i++;
87 n--;
88 }
89
90 memcpy(&regs->ARM_r0 + i, args, n * sizeof(args[0]));
91}
92
93#endif /* _ASM_ARM_SYSCALL_H */
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index d4c24d412a8d..68388eb4946b 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -118,6 +118,13 @@ extern void iwmmxt_task_switch(struct thread_info *);
118extern void vfp_sync_hwstate(struct thread_info *); 118extern void vfp_sync_hwstate(struct thread_info *);
119extern void vfp_flush_hwstate(struct thread_info *); 119extern void vfp_flush_hwstate(struct thread_info *);
120 120
121struct user_vfp;
122struct user_vfp_exc;
123
124extern int vfp_preserve_user_clear_hwstate(struct user_vfp __user *,
125 struct user_vfp_exc __user *);
126extern int vfp_restore_user_hwstate(struct user_vfp __user *,
127 struct user_vfp_exc __user *);
121#endif 128#endif
122 129
123/* 130/*
@@ -146,6 +153,7 @@ extern void vfp_flush_hwstate(struct thread_info *);
146#define TIF_MEMDIE 18 /* is terminating due to OOM killer */ 153#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
147#define TIF_RESTORE_SIGMASK 20 154#define TIF_RESTORE_SIGMASK 20
148#define TIF_SECCOMP 21 155#define TIF_SECCOMP 21
156#define TIF_SWITCH_MM 22 /* deferred switch_mm */
149 157
150#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 158#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
151#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 159#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h
index 85fe61e73202..6e924d3a77eb 100644
--- a/arch/arm/include/asm/tlbflush.h
+++ b/arch/arm/include/asm/tlbflush.h
@@ -65,21 +65,6 @@
65#define MULTI_TLB 1 65#define MULTI_TLB 1
66#endif 66#endif
67 67
68#define v3_tlb_flags (TLB_V3_FULL | TLB_V3_PAGE)
69
70#ifdef CONFIG_CPU_TLB_V3
71# define v3_possible_flags v3_tlb_flags
72# define v3_always_flags v3_tlb_flags
73# ifdef _TLB
74# define MULTI_TLB 1
75# else
76# define _TLB v3
77# endif
78#else
79# define v3_possible_flags 0
80# define v3_always_flags (-1UL)
81#endif
82
83#define v4_tlb_flags (TLB_V4_U_FULL | TLB_V4_U_PAGE) 68#define v4_tlb_flags (TLB_V4_U_FULL | TLB_V4_U_PAGE)
84 69
85#ifdef CONFIG_CPU_TLB_V4WT 70#ifdef CONFIG_CPU_TLB_V4WT
@@ -298,8 +283,7 @@ extern struct cpu_tlb_fns cpu_tlb;
298 * implemented the "%?" method, but this has been discontinued due to too 283 * implemented the "%?" method, but this has been discontinued due to too
299 * many people getting it wrong. 284 * many people getting it wrong.
300 */ 285 */
301#define possible_tlb_flags (v3_possible_flags | \ 286#define possible_tlb_flags (v4_possible_flags | \
302 v4_possible_flags | \
303 v4wbi_possible_flags | \ 287 v4wbi_possible_flags | \
304 fr_possible_flags | \ 288 fr_possible_flags | \
305 v4wb_possible_flags | \ 289 v4wb_possible_flags | \
@@ -307,8 +291,7 @@ extern struct cpu_tlb_fns cpu_tlb;
307 v6wbi_possible_flags | \ 291 v6wbi_possible_flags | \
308 v7wbi_possible_flags) 292 v7wbi_possible_flags)
309 293
310#define always_tlb_flags (v3_always_flags & \ 294#define always_tlb_flags (v4_always_flags & \
311 v4_always_flags & \
312 v4wbi_always_flags & \ 295 v4wbi_always_flags & \
313 fr_always_flags & \ 296 fr_always_flags & \
314 v4wb_always_flags & \ 297 v4wb_always_flags & \
diff --git a/arch/arm/include/asm/tls.h b/arch/arm/include/asm/tls.h
index 60843eb0f61c..73409e6c0251 100644
--- a/arch/arm/include/asm/tls.h
+++ b/arch/arm/include/asm/tls.h
@@ -7,6 +7,8 @@
7 7
8 .macro set_tls_v6k, tp, tmp1, tmp2 8 .macro set_tls_v6k, tp, tmp1, tmp2
9 mcr p15, 0, \tp, c13, c0, 3 @ set TLS register 9 mcr p15, 0, \tp, c13, c0, 3 @ set TLS register
10 mov \tmp1, #0
11 mcr p15, 0, \tmp1, c13, c0, 2 @ clear user r/w TLS register
10 .endm 12 .endm
11 13
12 .macro set_tls_v6, tp, tmp1, tmp2 14 .macro set_tls_v6, tp, tmp1, tmp2
@@ -15,6 +17,8 @@
15 mov \tmp2, #0xffff0fff 17 mov \tmp2, #0xffff0fff
16 tst \tmp1, #HWCAP_TLS @ hardware TLS available? 18 tst \tmp1, #HWCAP_TLS @ hardware TLS available?
17 mcrne p15, 0, \tp, c13, c0, 3 @ yes, set TLS register 19 mcrne p15, 0, \tp, c13, c0, 3 @ yes, set TLS register
20 movne \tmp1, #0
21 mcrne p15, 0, \tmp1, c13, c0, 2 @ clear user r/w TLS register
18 streq \tp, [\tmp2, #-15] @ set TLS value at 0xffff0ff0 22 streq \tp, [\tmp2, #-15] @ set TLS value at 0xffff0ff0
19 .endm 23 .endm
20 24
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 7b787d642af4..7ad2d5cf7008 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -34,6 +34,7 @@ obj-$(CONFIG_ARM_CPU_SUSPEND) += sleep.o suspend.o
34obj-$(CONFIG_SMP) += smp.o smp_tlb.o 34obj-$(CONFIG_SMP) += smp.o smp_tlb.o
35obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o 35obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o
36obj-$(CONFIG_HAVE_ARM_TWD) += smp_twd.o 36obj-$(CONFIG_HAVE_ARM_TWD) += smp_twd.o
37obj-$(CONFIG_ARM_ARCH_TIMER) += arch_timer.o
37obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o insn.o 38obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o insn.o
38obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o insn.o 39obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o insn.o
39obj-$(CONFIG_JUMP_LABEL) += jump_label.o insn.o patch.o 40obj-$(CONFIG_JUMP_LABEL) += jump_label.o insn.o patch.o
@@ -81,4 +82,4 @@ head-y := head$(MMUEXT).o
81obj-$(CONFIG_DEBUG_LL) += debug.o 82obj-$(CONFIG_DEBUG_LL) += debug.o
82obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 83obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
83 84
84extra-y := $(head-y) init_task.o vmlinux.lds 85extra-y := $(head-y) vmlinux.lds
diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
new file mode 100644
index 000000000000..dd58035621f7
--- /dev/null
+++ b/arch/arm/kernel/arch_timer.c
@@ -0,0 +1,350 @@
1/*
2 * linux/arch/arm/kernel/arch_timer.c
3 *
4 * Copyright (C) 2011 ARM Ltd.
5 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#include <linux/init.h>
12#include <linux/kernel.h>
13#include <linux/delay.h>
14#include <linux/device.h>
15#include <linux/smp.h>
16#include <linux/cpu.h>
17#include <linux/jiffies.h>
18#include <linux/clockchips.h>
19#include <linux/interrupt.h>
20#include <linux/of_irq.h>
21#include <linux/io.h>
22
23#include <asm/cputype.h>
24#include <asm/localtimer.h>
25#include <asm/arch_timer.h>
26#include <asm/system_info.h>
27#include <asm/sched_clock.h>
28
29static unsigned long arch_timer_rate;
30static int arch_timer_ppi;
31static int arch_timer_ppi2;
32
33static struct clock_event_device __percpu **arch_timer_evt;
34
35/*
36 * Architected system timer support.
37 */
38
39#define ARCH_TIMER_CTRL_ENABLE (1 << 0)
40#define ARCH_TIMER_CTRL_IT_MASK (1 << 1)
41#define ARCH_TIMER_CTRL_IT_STAT (1 << 2)
42
43#define ARCH_TIMER_REG_CTRL 0
44#define ARCH_TIMER_REG_FREQ 1
45#define ARCH_TIMER_REG_TVAL 2
46
47static void arch_timer_reg_write(int reg, u32 val)
48{
49 switch (reg) {
50 case ARCH_TIMER_REG_CTRL:
51 asm volatile("mcr p15, 0, %0, c14, c2, 1" : : "r" (val));
52 break;
53 case ARCH_TIMER_REG_TVAL:
54 asm volatile("mcr p15, 0, %0, c14, c2, 0" : : "r" (val));
55 break;
56 }
57
58 isb();
59}
60
61static u32 arch_timer_reg_read(int reg)
62{
63 u32 val;
64
65 switch (reg) {
66 case ARCH_TIMER_REG_CTRL:
67 asm volatile("mrc p15, 0, %0, c14, c2, 1" : "=r" (val));
68 break;
69 case ARCH_TIMER_REG_FREQ:
70 asm volatile("mrc p15, 0, %0, c14, c0, 0" : "=r" (val));
71 break;
72 case ARCH_TIMER_REG_TVAL:
73 asm volatile("mrc p15, 0, %0, c14, c2, 0" : "=r" (val));
74 break;
75 default:
76 BUG();
77 }
78
79 return val;
80}
81
82static irqreturn_t arch_timer_handler(int irq, void *dev_id)
83{
84 struct clock_event_device *evt = *(struct clock_event_device **)dev_id;
85 unsigned long ctrl;
86
87 ctrl = arch_timer_reg_read(ARCH_TIMER_REG_CTRL);
88 if (ctrl & ARCH_TIMER_CTRL_IT_STAT) {
89 ctrl |= ARCH_TIMER_CTRL_IT_MASK;
90 arch_timer_reg_write(ARCH_TIMER_REG_CTRL, ctrl);
91 evt->event_handler(evt);
92 return IRQ_HANDLED;
93 }
94
95 return IRQ_NONE;
96}
97
98static void arch_timer_disable(void)
99{
100 unsigned long ctrl;
101
102 ctrl = arch_timer_reg_read(ARCH_TIMER_REG_CTRL);
103 ctrl &= ~ARCH_TIMER_CTRL_ENABLE;
104 arch_timer_reg_write(ARCH_TIMER_REG_CTRL, ctrl);
105}
106
107static void arch_timer_set_mode(enum clock_event_mode mode,
108 struct clock_event_device *clk)
109{
110 switch (mode) {
111 case CLOCK_EVT_MODE_UNUSED:
112 case CLOCK_EVT_MODE_SHUTDOWN:
113 arch_timer_disable();
114 break;
115 default:
116 break;
117 }
118}
119
120static int arch_timer_set_next_event(unsigned long evt,
121 struct clock_event_device *unused)
122{
123 unsigned long ctrl;
124
125 ctrl = arch_timer_reg_read(ARCH_TIMER_REG_CTRL);
126 ctrl |= ARCH_TIMER_CTRL_ENABLE;
127 ctrl &= ~ARCH_TIMER_CTRL_IT_MASK;
128
129 arch_timer_reg_write(ARCH_TIMER_REG_TVAL, evt);
130 arch_timer_reg_write(ARCH_TIMER_REG_CTRL, ctrl);
131
132 return 0;
133}
134
135static int __cpuinit arch_timer_setup(struct clock_event_device *clk)
136{
137 /* Be safe... */
138 arch_timer_disable();
139
140 clk->features = CLOCK_EVT_FEAT_ONESHOT;
141 clk->name = "arch_sys_timer";
142 clk->rating = 450;
143 clk->set_mode = arch_timer_set_mode;
144 clk->set_next_event = arch_timer_set_next_event;
145 clk->irq = arch_timer_ppi;
146
147 clockevents_config_and_register(clk, arch_timer_rate,
148 0xf, 0x7fffffff);
149
150 *__this_cpu_ptr(arch_timer_evt) = clk;
151
152 enable_percpu_irq(clk->irq, 0);
153 if (arch_timer_ppi2)
154 enable_percpu_irq(arch_timer_ppi2, 0);
155
156 return 0;
157}
158
159/* Is the optional system timer available? */
160static int local_timer_is_architected(void)
161{
162 return (cpu_architecture() >= CPU_ARCH_ARMv7) &&
163 ((read_cpuid_ext(CPUID_EXT_PFR1) >> 16) & 0xf) == 1;
164}
165
166static int arch_timer_available(void)
167{
168 unsigned long freq;
169
170 if (!local_timer_is_architected())
171 return -ENXIO;
172
173 if (arch_timer_rate == 0) {
174 arch_timer_reg_write(ARCH_TIMER_REG_CTRL, 0);
175 freq = arch_timer_reg_read(ARCH_TIMER_REG_FREQ);
176
177 /* Check the timer frequency. */
178 if (freq == 0) {
179 pr_warn("Architected timer frequency not available\n");
180 return -EINVAL;
181 }
182
183 arch_timer_rate = freq;
184 }
185
186 pr_info_once("Architected local timer running at %lu.%02luMHz.\n",
187 arch_timer_rate / 1000000, (arch_timer_rate / 10000) % 100);
188 return 0;
189}
190
191static inline cycle_t arch_counter_get_cntpct(void)
192{
193 u32 cvall, cvalh;
194
195 asm volatile("mrrc p15, 0, %0, %1, c14" : "=r" (cvall), "=r" (cvalh));
196
197 return ((cycle_t) cvalh << 32) | cvall;
198}
199
200static inline cycle_t arch_counter_get_cntvct(void)
201{
202 u32 cvall, cvalh;
203
204 asm volatile("mrrc p15, 1, %0, %1, c14" : "=r" (cvall), "=r" (cvalh));
205
206 return ((cycle_t) cvalh << 32) | cvall;
207}
208
209static u32 notrace arch_counter_get_cntvct32(void)
210{
211 cycle_t cntvct = arch_counter_get_cntvct();
212
213 /*
214 * The sched_clock infrastructure only knows about counters
215 * with at most 32bits. Forget about the upper 24 bits for the
216 * time being...
217 */
218 return (u32)(cntvct & (u32)~0);
219}
220
221static cycle_t arch_counter_read(struct clocksource *cs)
222{
223 return arch_counter_get_cntpct();
224}
225
226static struct clocksource clocksource_counter = {
227 .name = "arch_sys_counter",
228 .rating = 400,
229 .read = arch_counter_read,
230 .mask = CLOCKSOURCE_MASK(56),
231 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
232};
233
234static void __cpuinit arch_timer_stop(struct clock_event_device *clk)
235{
236 pr_debug("arch_timer_teardown disable IRQ%d cpu #%d\n",
237 clk->irq, smp_processor_id());
238 disable_percpu_irq(clk->irq);
239 if (arch_timer_ppi2)
240 disable_percpu_irq(arch_timer_ppi2);
241 arch_timer_set_mode(CLOCK_EVT_MODE_UNUSED, clk);
242}
243
244static struct local_timer_ops arch_timer_ops __cpuinitdata = {
245 .setup = arch_timer_setup,
246 .stop = arch_timer_stop,
247};
248
249static struct clock_event_device arch_timer_global_evt;
250
251static int __init arch_timer_register(void)
252{
253 int err;
254
255 err = arch_timer_available();
256 if (err)
257 return err;
258
259 arch_timer_evt = alloc_percpu(struct clock_event_device *);
260 if (!arch_timer_evt)
261 return -ENOMEM;
262
263 clocksource_register_hz(&clocksource_counter, arch_timer_rate);
264
265 err = request_percpu_irq(arch_timer_ppi, arch_timer_handler,
266 "arch_timer", arch_timer_evt);
267 if (err) {
268 pr_err("arch_timer: can't register interrupt %d (%d)\n",
269 arch_timer_ppi, err);
270 goto out_free;
271 }
272
273 if (arch_timer_ppi2) {
274 err = request_percpu_irq(arch_timer_ppi2, arch_timer_handler,
275 "arch_timer", arch_timer_evt);
276 if (err) {
277 pr_err("arch_timer: can't register interrupt %d (%d)\n",
278 arch_timer_ppi2, err);
279 arch_timer_ppi2 = 0;
280 goto out_free_irq;
281 }
282 }
283
284 err = local_timer_register(&arch_timer_ops);
285 if (err) {
286 /*
287 * We couldn't register as a local timer (could be
288 * because we're on a UP platform, or because some
289 * other local timer is already present...). Try as a
290 * global timer instead.
291 */
292 arch_timer_global_evt.cpumask = cpumask_of(0);
293 err = arch_timer_setup(&arch_timer_global_evt);
294 }
295
296 if (err)
297 goto out_free_irq;
298
299 return 0;
300
301out_free_irq:
302 free_percpu_irq(arch_timer_ppi, arch_timer_evt);
303 if (arch_timer_ppi2)
304 free_percpu_irq(arch_timer_ppi2, arch_timer_evt);
305
306out_free:
307 free_percpu(arch_timer_evt);
308
309 return err;
310}
311
312static const struct of_device_id arch_timer_of_match[] __initconst = {
313 { .compatible = "arm,armv7-timer", },
314 {},
315};
316
317int __init arch_timer_of_register(void)
318{
319 struct device_node *np;
320 u32 freq;
321
322 np = of_find_matching_node(NULL, arch_timer_of_match);
323 if (!np) {
324 pr_err("arch_timer: can't find DT node\n");
325 return -ENODEV;
326 }
327
328 /* Try to determine the frequency from the device tree or CNTFRQ */
329 if (!of_property_read_u32(np, "clock-frequency", &freq))
330 arch_timer_rate = freq;
331
332 arch_timer_ppi = irq_of_parse_and_map(np, 0);
333 arch_timer_ppi2 = irq_of_parse_and_map(np, 1);
334 pr_info("arch_timer: found %s irqs %d %d\n",
335 np->name, arch_timer_ppi, arch_timer_ppi2);
336
337 return arch_timer_register();
338}
339
340int __init arch_timer_sched_clock_init(void)
341{
342 int err;
343
344 err = arch_timer_available();
345 if (err)
346 return err;
347
348 setup_sched_clock(arch_counter_get_cntvct32, 32, arch_timer_rate);
349 return 0;
350}
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index ede5f7741c42..25552508c3fd 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -374,16 +374,29 @@ EXPORT_SYMBOL(pcibios_fixup_bus);
374#endif 374#endif
375 375
376/* 376/*
377 * Swizzle the device pin each time we cross a bridge. 377 * Swizzle the device pin each time we cross a bridge. If a platform does
378 * This might update pin and returns the slot number. 378 * not provide a swizzle function, we perform the standard PCI swizzling.
379 *
380 * The default swizzling walks up the bus tree one level at a time, applying
381 * the standard swizzle function at each step, stopping when it finds the PCI
382 * root bus. This will return the slot number of the bridge device on the
383 * root bus and the interrupt pin on that device which should correspond
384 * with the downstream device interrupt.
385 *
386 * Platforms may override this, in which case the slot and pin returned
387 * depend entirely on the platform code. However, please note that the
388 * PCI standard swizzle is implemented on plug-in cards and Cardbus based
389 * PCI extenders, so it can not be ignored.
379 */ 390 */
380static u8 __devinit pcibios_swizzle(struct pci_dev *dev, u8 *pin) 391static u8 __devinit pcibios_swizzle(struct pci_dev *dev, u8 *pin)
381{ 392{
382 struct pci_sys_data *sys = dev->sysdata; 393 struct pci_sys_data *sys = dev->sysdata;
383 int slot = 0, oldpin = *pin; 394 int slot, oldpin = *pin;
384 395
385 if (sys->swizzle) 396 if (sys->swizzle)
386 slot = sys->swizzle(dev, pin); 397 slot = sys->swizzle(dev, pin);
398 else
399 slot = pci_common_swizzle(dev, pin);
387 400
388 if (debug_pci) 401 if (debug_pci)
389 printk("PCI: %s swizzling pin %d => pin %d slot %d\n", 402 printk("PCI: %s swizzling pin %d => pin %d slot %d\n",
@@ -410,7 +423,7 @@ static int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
410 return irq; 423 return irq;
411} 424}
412 425
413static void __init pcibios_init_hw(struct hw_pci *hw) 426static void __init pcibios_init_hw(struct hw_pci *hw, struct list_head *head)
414{ 427{
415 struct pci_sys_data *sys = NULL; 428 struct pci_sys_data *sys = NULL;
416 int ret; 429 int ret;
@@ -424,7 +437,6 @@ static void __init pcibios_init_hw(struct hw_pci *hw)
424#ifdef CONFIG_PCI_DOMAINS 437#ifdef CONFIG_PCI_DOMAINS
425 sys->domain = hw->domain; 438 sys->domain = hw->domain;
426#endif 439#endif
427 sys->hw = hw;
428 sys->busnr = busnr; 440 sys->busnr = busnr;
429 sys->swizzle = hw->swizzle; 441 sys->swizzle = hw->swizzle;
430 sys->map_irq = hw->map_irq; 442 sys->map_irq = hw->map_irq;
@@ -440,14 +452,18 @@ static void __init pcibios_init_hw(struct hw_pci *hw)
440 &iomem_resource, sys->mem_offset); 452 &iomem_resource, sys->mem_offset);
441 } 453 }
442 454
443 sys->bus = hw->scan(nr, sys); 455 if (hw->scan)
456 sys->bus = hw->scan(nr, sys);
457 else
458 sys->bus = pci_scan_root_bus(NULL, sys->busnr,
459 hw->ops, sys, &sys->resources);
444 460
445 if (!sys->bus) 461 if (!sys->bus)
446 panic("PCI: unable to scan bus!"); 462 panic("PCI: unable to scan bus!");
447 463
448 busnr = sys->bus->subordinate + 1; 464 busnr = sys->bus->subordinate + 1;
449 465
450 list_add(&sys->node, &hw->buses); 466 list_add(&sys->node, head);
451 } else { 467 } else {
452 kfree(sys); 468 kfree(sys);
453 if (ret < 0) 469 if (ret < 0)
@@ -459,19 +475,18 @@ static void __init pcibios_init_hw(struct hw_pci *hw)
459void __init pci_common_init(struct hw_pci *hw) 475void __init pci_common_init(struct hw_pci *hw)
460{ 476{
461 struct pci_sys_data *sys; 477 struct pci_sys_data *sys;
462 478 LIST_HEAD(head);
463 INIT_LIST_HEAD(&hw->buses);
464 479
465 pci_add_flags(PCI_REASSIGN_ALL_RSRC); 480 pci_add_flags(PCI_REASSIGN_ALL_RSRC);
466 if (hw->preinit) 481 if (hw->preinit)
467 hw->preinit(); 482 hw->preinit();
468 pcibios_init_hw(hw); 483 pcibios_init_hw(hw, &head);
469 if (hw->postinit) 484 if (hw->postinit)
470 hw->postinit(); 485 hw->postinit();
471 486
472 pci_fixup_irqs(pcibios_swizzle, pcibios_map_irq); 487 pci_fixup_irqs(pcibios_swizzle, pcibios_map_irq);
473 488
474 list_for_each_entry(sys, &hw->buses, node) { 489 list_for_each_entry(sys, &head, node) {
475 struct pci_bus *bus = sys->bus; 490 struct pci_bus *bus = sys->bus;
476 491
477 if (!pci_has_flag(PCI_PROBE_ONLY)) { 492 if (!pci_has_flag(PCI_PROBE_ONLY)) {
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 7fd3ad048da9..437f0c426517 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -556,10 +556,6 @@ call_fpe:
556#endif 556#endif
557 tst r0, #0x08000000 @ only CDP/CPRT/LDC/STC have bit 27 557 tst r0, #0x08000000 @ only CDP/CPRT/LDC/STC have bit 27
558 tstne r0, #0x04000000 @ bit 26 set on both ARM and Thumb-2 558 tstne r0, #0x04000000 @ bit 26 set on both ARM and Thumb-2
559#if defined(CONFIG_CPU_ARM610) || defined(CONFIG_CPU_ARM710)
560 and r8, r0, #0x0f000000 @ mask out op-code bits
561 teqne r8, #0x0f000000 @ SWI (ARM6/7 bug)?
562#endif
563 moveq pc, lr 559 moveq pc, lr
564 get_thread_info r10 @ get current thread 560 get_thread_info r10 @ get current thread
565 and r8, r0, #0x00000f00 @ mask out CP number 561 and r8, r0, #0x00000f00 @ mask out CP number
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 54ee265dd819..7bd2d3cb8957 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -335,20 +335,6 @@ ENDPROC(ftrace_stub)
335 *----------------------------------------------------------------------------- 335 *-----------------------------------------------------------------------------
336 */ 336 */
337 337
338 /* If we're optimising for StrongARM the resulting code won't
339 run on an ARM7 and we can save a couple of instructions.
340 --pb */
341#ifdef CONFIG_CPU_ARM710
342#define A710(code...) code
343.Larm710bug:
344 ldmia sp, {r0 - lr}^ @ Get calling r0 - lr
345 mov r0, r0
346 add sp, sp, #S_FRAME_SIZE
347 subs pc, lr, #4
348#else
349#define A710(code...)
350#endif
351
352 .align 5 338 .align 5
353ENTRY(vector_swi) 339ENTRY(vector_swi)
354 sub sp, sp, #S_FRAME_SIZE 340 sub sp, sp, #S_FRAME_SIZE
@@ -379,9 +365,6 @@ ENTRY(vector_swi)
379 ldreq r10, [lr, #-4] @ get SWI instruction 365 ldreq r10, [lr, #-4] @ get SWI instruction
380#else 366#else
381 ldr r10, [lr, #-4] @ get SWI instruction 367 ldr r10, [lr, #-4] @ get SWI instruction
382 A710( and ip, r10, #0x0f000000 @ check for SWI )
383 A710( teq ip, #0x0f000000 )
384 A710( bne .Larm710bug )
385#endif 368#endif
386#ifdef CONFIG_CPU_ENDIAN_BE8 369#ifdef CONFIG_CPU_ENDIAN_BE8
387 rev r10, r10 @ little endian instruction 370 rev r10, r10 @ little endian instruction
@@ -392,26 +375,15 @@ ENTRY(vector_swi)
392 /* 375 /*
393 * Pure EABI user space always put syscall number into scno (r7). 376 * Pure EABI user space always put syscall number into scno (r7).
394 */ 377 */
395 A710( ldr ip, [lr, #-4] @ get SWI instruction )
396 A710( and ip, ip, #0x0f000000 @ check for SWI )
397 A710( teq ip, #0x0f000000 )
398 A710( bne .Larm710bug )
399
400#elif defined(CONFIG_ARM_THUMB) 378#elif defined(CONFIG_ARM_THUMB)
401
402 /* Legacy ABI only, possibly thumb mode. */ 379 /* Legacy ABI only, possibly thumb mode. */
403 tst r8, #PSR_T_BIT @ this is SPSR from save_user_regs 380 tst r8, #PSR_T_BIT @ this is SPSR from save_user_regs
404 addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in 381 addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in
405 ldreq scno, [lr, #-4] 382 ldreq scno, [lr, #-4]
406 383
407#else 384#else
408
409 /* Legacy ABI only. */ 385 /* Legacy ABI only. */
410 ldr scno, [lr, #-4] @ get SWI instruction 386 ldr scno, [lr, #-4] @ get SWI instruction
411 A710( and ip, scno, #0x0f000000 @ check for SWI )
412 A710( teq ip, #0x0f000000 )
413 A710( bne .Larm710bug )
414
415#endif 387#endif
416 388
417#ifdef CONFIG_ALIGNMENT_TRAP 389#ifdef CONFIG_ALIGNMENT_TRAP
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 3bf0c7f8b043..835898e7d704 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -277,10 +277,6 @@ __create_page_tables:
277 mov r3, r3, lsl #PMD_ORDER 277 mov r3, r3, lsl #PMD_ORDER
278 278
279 add r0, r4, r3 279 add r0, r4, r3
280 rsb r3, r3, #0x4000 @ PTRS_PER_PGD*sizeof(long)
281 cmp r3, #0x0800 @ limit to 512MB
282 movhi r3, #0x0800
283 add r6, r0, r3
284 mov r3, r7, lsr #SECTION_SHIFT 280 mov r3, r7, lsr #SECTION_SHIFT
285 ldr r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags 281 ldr r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags
286 orr r3, r7, r3, lsl #SECTION_SHIFT 282 orr r3, r7, r3, lsl #SECTION_SHIFT
@@ -289,13 +285,10 @@ __create_page_tables:
289#else 285#else
290 orr r3, r3, #PMD_SECT_XN 286 orr r3, r3, #PMD_SECT_XN
291#endif 287#endif
2921: str r3, [r0], #4 288 str r3, [r0], #4
293#ifdef CONFIG_ARM_LPAE 289#ifdef CONFIG_ARM_LPAE
294 str r7, [r0], #4 290 str r7, [r0], #4
295#endif 291#endif
296 add r3, r3, #1 << SECTION_SHIFT
297 cmp r0, r6
298 blo 1b
299 292
300#else /* CONFIG_DEBUG_ICEDCC || CONFIG_DEBUG_SEMIHOSTING */ 293#else /* CONFIG_DEBUG_ICEDCC || CONFIG_DEBUG_SEMIHOSTING */
301 /* we don't need any serial debugging mappings */ 294 /* we don't need any serial debugging mappings */
diff --git a/arch/arm/kernel/init_task.c b/arch/arm/kernel/init_task.c
deleted file mode 100644
index e7cbb50dc356..000000000000
--- a/arch/arm/kernel/init_task.c
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * linux/arch/arm/kernel/init_task.c
3 */
4#include <linux/mm.h>
5#include <linux/module.h>
6#include <linux/fs.h>
7#include <linux/sched.h>
8#include <linux/init.h>
9#include <linux/init_task.h>
10#include <linux/mqueue.h>
11#include <linux/uaccess.h>
12
13#include <asm/pgtable.h>
14
15static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
17/*
18 * Initial thread structure.
19 *
20 * We need to make sure that this is 8192-byte aligned due to the
21 * way process stacks are handled. This is done by making sure
22 * the linker maps this in the .text segment right after head.S,
23 * and making head.S ensure the proper alignment.
24 *
25 * The things we do for performance..
26 */
27union thread_union init_thread_union __init_task_data =
28 { INIT_THREAD_INFO(init_task) };
29
30/*
31 * Initial task structure.
32 *
33 * All other task structs will be allocated on slabs in fork.c
34 */
35struct task_struct init_task = INIT_TASK(init_task);
36
37EXPORT_SYMBOL(init_task);
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 71ccdbfed662..8349d4e97e2b 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -155,10 +155,10 @@ static bool migrate_one_irq(struct irq_desc *desc)
155 } 155 }
156 156
157 c = irq_data_get_irq_chip(d); 157 c = irq_data_get_irq_chip(d);
158 if (c->irq_set_affinity) 158 if (!c->irq_set_affinity)
159 c->irq_set_affinity(d, affinity, true);
160 else
161 pr_debug("IRQ%u: unable to set affinity\n", d->irq); 159 pr_debug("IRQ%u: unable to set affinity\n", d->irq);
160 else if (c->irq_set_affinity(d, affinity, true) == IRQ_SET_MASK_OK && ret)
161 cpumask_copy(d->affinity, affinity);
162 162
163 return ret; 163 return ret;
164} 164}
diff --git a/arch/arm/kernel/perf_event_v6.c b/arch/arm/kernel/perf_event_v6.c
index b78af0cc6ef3..ab627a740fa3 100644
--- a/arch/arm/kernel/perf_event_v6.c
+++ b/arch/arm/kernel/perf_event_v6.c
@@ -489,8 +489,6 @@ armv6pmu_handle_irq(int irq_num,
489 */ 489 */
490 armv6_pmcr_write(pmcr); 490 armv6_pmcr_write(pmcr);
491 491
492 perf_sample_data_init(&data, 0);
493
494 cpuc = &__get_cpu_var(cpu_hw_events); 492 cpuc = &__get_cpu_var(cpu_hw_events);
495 for (idx = 0; idx < cpu_pmu->num_events; ++idx) { 493 for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
496 struct perf_event *event = cpuc->events[idx]; 494 struct perf_event *event = cpuc->events[idx];
@@ -509,7 +507,7 @@ armv6pmu_handle_irq(int irq_num,
509 507
510 hwc = &event->hw; 508 hwc = &event->hw;
511 armpmu_event_update(event, hwc, idx); 509 armpmu_event_update(event, hwc, idx);
512 data.period = event->hw.last_period; 510 perf_sample_data_init(&data, 0, hwc->last_period);
513 if (!armpmu_event_set_period(event, hwc, idx)) 511 if (!armpmu_event_set_period(event, hwc, idx))
514 continue; 512 continue;
515 513
diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c
index 00755d82e2f2..d3c536068162 100644
--- a/arch/arm/kernel/perf_event_v7.c
+++ b/arch/arm/kernel/perf_event_v7.c
@@ -1077,8 +1077,6 @@ static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)
1077 */ 1077 */
1078 regs = get_irq_regs(); 1078 regs = get_irq_regs();
1079 1079
1080 perf_sample_data_init(&data, 0);
1081
1082 cpuc = &__get_cpu_var(cpu_hw_events); 1080 cpuc = &__get_cpu_var(cpu_hw_events);
1083 for (idx = 0; idx < cpu_pmu->num_events; ++idx) { 1081 for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
1084 struct perf_event *event = cpuc->events[idx]; 1082 struct perf_event *event = cpuc->events[idx];
@@ -1097,7 +1095,7 @@ static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)
1097 1095
1098 hwc = &event->hw; 1096 hwc = &event->hw;
1099 armpmu_event_update(event, hwc, idx); 1097 armpmu_event_update(event, hwc, idx);
1100 data.period = event->hw.last_period; 1098 perf_sample_data_init(&data, 0, hwc->last_period);
1101 if (!armpmu_event_set_period(event, hwc, idx)) 1099 if (!armpmu_event_set_period(event, hwc, idx))
1102 continue; 1100 continue;
1103 1101
diff --git a/arch/arm/kernel/perf_event_xscale.c b/arch/arm/kernel/perf_event_xscale.c
index 71a21e6712f5..e34e7254e652 100644
--- a/arch/arm/kernel/perf_event_xscale.c
+++ b/arch/arm/kernel/perf_event_xscale.c
@@ -248,8 +248,6 @@ xscale1pmu_handle_irq(int irq_num, void *dev)
248 248
249 regs = get_irq_regs(); 249 regs = get_irq_regs();
250 250
251 perf_sample_data_init(&data, 0);
252
253 cpuc = &__get_cpu_var(cpu_hw_events); 251 cpuc = &__get_cpu_var(cpu_hw_events);
254 for (idx = 0; idx < cpu_pmu->num_events; ++idx) { 252 for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
255 struct perf_event *event = cpuc->events[idx]; 253 struct perf_event *event = cpuc->events[idx];
@@ -263,7 +261,7 @@ xscale1pmu_handle_irq(int irq_num, void *dev)
263 261
264 hwc = &event->hw; 262 hwc = &event->hw;
265 armpmu_event_update(event, hwc, idx); 263 armpmu_event_update(event, hwc, idx);
266 data.period = event->hw.last_period; 264 perf_sample_data_init(&data, 0, hwc->last_period);
267 if (!armpmu_event_set_period(event, hwc, idx)) 265 if (!armpmu_event_set_period(event, hwc, idx))
268 continue; 266 continue;
269 267
@@ -588,8 +586,6 @@ xscale2pmu_handle_irq(int irq_num, void *dev)
588 586
589 regs = get_irq_regs(); 587 regs = get_irq_regs();
590 588
591 perf_sample_data_init(&data, 0);
592
593 cpuc = &__get_cpu_var(cpu_hw_events); 589 cpuc = &__get_cpu_var(cpu_hw_events);
594 for (idx = 0; idx < cpu_pmu->num_events; ++idx) { 590 for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
595 struct perf_event *event = cpuc->events[idx]; 591 struct perf_event *event = cpuc->events[idx];
@@ -603,7 +599,7 @@ xscale2pmu_handle_irq(int irq_num, void *dev)
603 599
604 hwc = &event->hw; 600 hwc = &event->hw;
605 armpmu_event_update(event, hwc, idx); 601 armpmu_event_update(event, hwc, idx);
606 data.period = event->hw.last_period; 602 perf_sample_data_init(&data, 0, hwc->last_period);
607 if (!armpmu_event_set_period(event, hwc, idx)) 603 if (!armpmu_event_set_period(event, hwc, idx))
608 continue; 604 continue;
609 605
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 2b7b017a20cd..19c95ea65b2f 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -157,26 +157,6 @@ EXPORT_SYMBOL(pm_power_off);
157void (*arm_pm_restart)(char str, const char *cmd) = null_restart; 157void (*arm_pm_restart)(char str, const char *cmd) = null_restart;
158EXPORT_SYMBOL_GPL(arm_pm_restart); 158EXPORT_SYMBOL_GPL(arm_pm_restart);
159 159
160static void do_nothing(void *unused)
161{
162}
163
164/*
165 * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
166 * pm_idle and update to new pm_idle value. Required while changing pm_idle
167 * handler on SMP systems.
168 *
169 * Caller must have changed pm_idle to the new value before the call. Old
170 * pm_idle value will not be used by any CPU after the return of this function.
171 */
172void cpu_idle_wait(void)
173{
174 smp_mb();
175 /* kick all the CPUs so that they exit out of pm_idle */
176 smp_call_function(do_nothing, NULL, 1);
177}
178EXPORT_SYMBOL_GPL(cpu_idle_wait);
179
180/* 160/*
181 * This is our default idle handler. 161 * This is our default idle handler.
182 */ 162 */
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 80abafb9bf33..14e38261cd31 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -24,6 +24,7 @@
24#include <linux/hw_breakpoint.h> 24#include <linux/hw_breakpoint.h>
25#include <linux/regset.h> 25#include <linux/regset.h>
26#include <linux/audit.h> 26#include <linux/audit.h>
27#include <linux/tracehook.h>
27 28
28#include <asm/pgtable.h> 29#include <asm/pgtable.h>
29#include <asm/traps.h> 30#include <asm/traps.h>
@@ -906,49 +907,33 @@ long arch_ptrace(struct task_struct *child, long request,
906 return ret; 907 return ret;
907} 908}
908 909
909#ifdef __ARMEB__
910#define AUDIT_ARCH_NR AUDIT_ARCH_ARMEB
911#else
912#define AUDIT_ARCH_NR AUDIT_ARCH_ARM
913#endif
914
915asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno) 910asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno)
916{ 911{
917 unsigned long ip; 912 unsigned long ip;
918 913
919 /* 914 if (why)
920 * Save IP. IP is used to denote syscall entry/exit:
921 * IP = 0 -> entry, = 1 -> exit
922 */
923 ip = regs->ARM_ip;
924 regs->ARM_ip = why;
925
926 if (!ip)
927 audit_syscall_exit(regs); 915 audit_syscall_exit(regs);
928 else 916 else
929 audit_syscall_entry(AUDIT_ARCH_NR, scno, regs->ARM_r0, 917 audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0,
930 regs->ARM_r1, regs->ARM_r2, regs->ARM_r3); 918 regs->ARM_r1, regs->ARM_r2, regs->ARM_r3);
931 919
932 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 920 if (!test_thread_flag(TIF_SYSCALL_TRACE))
933 return scno; 921 return scno;
934 if (!(current->ptrace & PT_PTRACED))
935 return scno;
936 922
937 current_thread_info()->syscall = scno; 923 current_thread_info()->syscall = scno;
938 924
939 /* the 0x80 provides a way for the tracing parent to distinguish
940 between a syscall stop and SIGTRAP delivery */
941 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
942 ? 0x80 : 0));
943 /* 925 /*
944 * this isn't the same as continuing with a signal, but it will do 926 * IP is used to denote syscall entry/exit:
945 * for normal use. strace only continues with a signal if the 927 * IP = 0 -> entry, =1 -> exit
946 * stopping signal is not SIGTRAP. -brl
947 */ 928 */
948 if (current->exit_code) { 929 ip = regs->ARM_ip;
949 send_sig(current->exit_code, current, 1); 930 regs->ARM_ip = why;
950 current->exit_code = 0; 931
951 } 932 if (why)
933 tracehook_report_syscall_exit(regs, 0);
934 else if (tracehook_report_syscall_entry(regs))
935 current_thread_info()->syscall = -1;
936
952 regs->ARM_ip = ip; 937 regs->ARM_ip = ip;
953 938
954 return current_thread_info()->syscall; 939 return current_thread_info()->syscall;
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index b91411371ae1..ebfac782593f 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -523,7 +523,21 @@ int __init arm_add_memory(phys_addr_t start, unsigned long size)
523 */ 523 */
524 size -= start & ~PAGE_MASK; 524 size -= start & ~PAGE_MASK;
525 bank->start = PAGE_ALIGN(start); 525 bank->start = PAGE_ALIGN(start);
526 bank->size = size & PAGE_MASK; 526
527#ifndef CONFIG_LPAE
528 if (bank->start + size < bank->start) {
529 printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in "
530 "32-bit physical address space\n", (long long)start);
531 /*
532 * To ensure bank->start + bank->size is representable in
533 * 32 bits, we use ULONG_MAX as the upper limit rather than 4GB.
534 * This means we lose a page after masking.
535 */
536 size = ULONG_MAX - bank->start;
537 }
538#endif
539
540 bank->size = size & PAGE_MASK;
527 541
528 /* 542 /*
529 * Check whether this memory region has non-zero size or 543 * Check whether this memory region has non-zero size or
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 7cb532fc8aa4..73d9a420850d 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -180,44 +180,23 @@ static int restore_iwmmxt_context(struct iwmmxt_sigframe *frame)
180 180
181static int preserve_vfp_context(struct vfp_sigframe __user *frame) 181static int preserve_vfp_context(struct vfp_sigframe __user *frame)
182{ 182{
183 struct thread_info *thread = current_thread_info();
184 struct vfp_hard_struct *h = &thread->vfpstate.hard;
185 const unsigned long magic = VFP_MAGIC; 183 const unsigned long magic = VFP_MAGIC;
186 const unsigned long size = VFP_STORAGE_SIZE; 184 const unsigned long size = VFP_STORAGE_SIZE;
187 int err = 0; 185 int err = 0;
188 186
189 vfp_sync_hwstate(thread);
190 __put_user_error(magic, &frame->magic, err); 187 __put_user_error(magic, &frame->magic, err);
191 __put_user_error(size, &frame->size, err); 188 __put_user_error(size, &frame->size, err);
192 189
193 /* 190 if (err)
194 * Copy the floating point registers. There can be unused 191 return -EFAULT;
195 * registers see asm/hwcap.h for details.
196 */
197 err |= __copy_to_user(&frame->ufp.fpregs, &h->fpregs,
198 sizeof(h->fpregs));
199 /*
200 * Copy the status and control register.
201 */
202 __put_user_error(h->fpscr, &frame->ufp.fpscr, err);
203
204 /*
205 * Copy the exception registers.
206 */
207 __put_user_error(h->fpexc, &frame->ufp_exc.fpexc, err);
208 __put_user_error(h->fpinst, &frame->ufp_exc.fpinst, err);
209 __put_user_error(h->fpinst2, &frame->ufp_exc.fpinst2, err);
210 192
211 return err ? -EFAULT : 0; 193 return vfp_preserve_user_clear_hwstate(&frame->ufp, &frame->ufp_exc);
212} 194}
213 195
214static int restore_vfp_context(struct vfp_sigframe __user *frame) 196static int restore_vfp_context(struct vfp_sigframe __user *frame)
215{ 197{
216 struct thread_info *thread = current_thread_info();
217 struct vfp_hard_struct *h = &thread->vfpstate.hard;
218 unsigned long magic; 198 unsigned long magic;
219 unsigned long size; 199 unsigned long size;
220 unsigned long fpexc;
221 int err = 0; 200 int err = 0;
222 201
223 __get_user_error(magic, &frame->magic, err); 202 __get_user_error(magic, &frame->magic, err);
@@ -228,33 +207,7 @@ static int restore_vfp_context(struct vfp_sigframe __user *frame)
228 if (magic != VFP_MAGIC || size != VFP_STORAGE_SIZE) 207 if (magic != VFP_MAGIC || size != VFP_STORAGE_SIZE)
229 return -EINVAL; 208 return -EINVAL;
230 209
231 vfp_flush_hwstate(thread); 210 return vfp_restore_user_hwstate(&frame->ufp, &frame->ufp_exc);
232
233 /*
234 * Copy the floating point registers. There can be unused
235 * registers see asm/hwcap.h for details.
236 */
237 err |= __copy_from_user(&h->fpregs, &frame->ufp.fpregs,
238 sizeof(h->fpregs));
239 /*
240 * Copy the status and control register.
241 */
242 __get_user_error(h->fpscr, &frame->ufp.fpscr, err);
243
244 /*
245 * Sanitise and restore the exception registers.
246 */
247 __get_user_error(fpexc, &frame->ufp_exc.fpexc, err);
248 /* Ensure the VFP is enabled. */
249 fpexc |= FPEXC_EN;
250 /* Ensure FPINST2 is invalid and the exception flag is cleared. */
251 fpexc &= ~(FPEXC_EX | FPEXC_FP2V);
252 h->fpexc = fpexc;
253
254 __get_user_error(h->fpinst, &frame->ufp_exc.fpinst, err);
255 __get_user_error(h->fpinst2, &frame->ufp_exc.fpinst2, err);
256
257 return err ? -EFAULT : 0;
258} 211}
259 212
260#endif 213#endif
@@ -636,6 +589,8 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
636 */ 589 */
637 block_sigmask(ka, sig); 590 block_sigmask(ka, sig);
638 591
592 tracehook_signal_handler(sig, info, ka, regs, 0);
593
639 return 0; 594 return 0;
640} 595}
641 596
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index addbbe8028c2..b735521a4a54 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -60,32 +60,11 @@ enum ipi_msg_type {
60 60
61static DECLARE_COMPLETION(cpu_running); 61static DECLARE_COMPLETION(cpu_running);
62 62
63int __cpuinit __cpu_up(unsigned int cpu) 63int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
64{ 64{
65 struct cpuinfo_arm *ci = &per_cpu(cpu_data, cpu);
66 struct task_struct *idle = ci->idle;
67 int ret; 65 int ret;
68 66
69 /* 67 /*
70 * Spawn a new process manually, if not already done.
71 * Grab a pointer to its task struct so we can mess with it
72 */
73 if (!idle) {
74 idle = fork_idle(cpu);
75 if (IS_ERR(idle)) {
76 printk(KERN_ERR "CPU%u: fork() failed\n", cpu);
77 return PTR_ERR(idle);
78 }
79 ci->idle = idle;
80 } else {
81 /*
82 * Since this idle thread is being re-used, call
83 * init_idle() to reinitialize the thread structure.
84 */
85 init_idle(idle, cpu);
86 }
87
88 /*
89 * We need to tell the secondary core where to find 68 * We need to tell the secondary core where to find
90 * its stack and the page tables. 69 * its stack and the page tables.
91 */ 70 */
@@ -251,8 +230,6 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
251 struct mm_struct *mm = &init_mm; 230 struct mm_struct *mm = &init_mm;
252 unsigned int cpu = smp_processor_id(); 231 unsigned int cpu = smp_processor_id();
253 232
254 printk("CPU%u: Booted secondary processor\n", cpu);
255
256 /* 233 /*
257 * All kernel threads share the same mm context; grab a 234 * All kernel threads share the same mm context; grab a
258 * reference and switch to it. 235 * reference and switch to it.
@@ -264,6 +241,8 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
264 enter_lazy_tlb(mm, current); 241 enter_lazy_tlb(mm, current);
265 local_flush_tlb_all(); 242 local_flush_tlb_all();
266 243
244 printk("CPU%u: Booted secondary processor\n", cpu);
245
267 cpu_init(); 246 cpu_init();
268 preempt_disable(); 247 preempt_disable();
269 trace_hardirqs_off(); 248 trace_hardirqs_off();
@@ -318,9 +297,6 @@ void __init smp_cpus_done(unsigned int max_cpus)
318 297
319void __init smp_prepare_boot_cpu(void) 298void __init smp_prepare_boot_cpu(void)
320{ 299{
321 unsigned int cpu = smp_processor_id();
322
323 per_cpu(cpu_data, cpu).idle = current;
324} 300}
325 301
326void __init smp_prepare_cpus(unsigned int max_cpus) 302void __init smp_prepare_cpus(unsigned int max_cpus)
@@ -454,6 +430,9 @@ static struct local_timer_ops *lt_ops;
454#ifdef CONFIG_LOCAL_TIMERS 430#ifdef CONFIG_LOCAL_TIMERS
455int local_timer_register(struct local_timer_ops *ops) 431int local_timer_register(struct local_timer_ops *ops)
456{ 432{
433 if (!is_smp() || !setup_max_cpus)
434 return -ENXIO;
435
457 if (lt_ops) 436 if (lt_ops)
458 return -EBUSY; 437 return -EBUSY;
459 438
@@ -510,10 +489,6 @@ static void ipi_cpu_stop(unsigned int cpu)
510 local_fiq_disable(); 489 local_fiq_disable();
511 local_irq_disable(); 490 local_irq_disable();
512 491
513#ifdef CONFIG_HOTPLUG_CPU
514 platform_cpu_kill(cpu);
515#endif
516
517 while (1) 492 while (1)
518 cpu_relax(); 493 cpu_relax();
519} 494}
@@ -576,17 +551,25 @@ void smp_send_reschedule(int cpu)
576 smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); 551 smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE);
577} 552}
578 553
554#ifdef CONFIG_HOTPLUG_CPU
555static void smp_kill_cpus(cpumask_t *mask)
556{
557 unsigned int cpu;
558 for_each_cpu(cpu, mask)
559 platform_cpu_kill(cpu);
560}
561#else
562static void smp_kill_cpus(cpumask_t *mask) { }
563#endif
564
579void smp_send_stop(void) 565void smp_send_stop(void)
580{ 566{
581 unsigned long timeout; 567 unsigned long timeout;
568 struct cpumask mask;
582 569
583 if (num_online_cpus() > 1) { 570 cpumask_copy(&mask, cpu_online_mask);
584 struct cpumask mask; 571 cpumask_clear_cpu(smp_processor_id(), &mask);
585 cpumask_copy(&mask, cpu_online_mask); 572 smp_cross_call(&mask, IPI_CPU_STOP);
586 cpumask_clear_cpu(smp_processor_id(), &mask);
587
588 smp_cross_call(&mask, IPI_CPU_STOP);
589 }
590 573
591 /* Wait up to one second for other CPUs to stop */ 574 /* Wait up to one second for other CPUs to stop */
592 timeout = USEC_PER_SEC; 575 timeout = USEC_PER_SEC;
@@ -595,6 +578,8 @@ void smp_send_stop(void)
595 578
596 if (num_online_cpus() > 1) 579 if (num_online_cpus() > 1)
597 pr_warning("SMP: failed to stop secondary CPUs\n"); 580 pr_warning("SMP: failed to stop secondary CPUs\n");
581
582 smp_kill_cpus(&mask);
598} 583}
599 584
600/* 585/*
diff --git a/arch/arm/kernel/smp_scu.c b/arch/arm/kernel/smp_scu.c
index 8f5dd7963356..b9f015e843d8 100644
--- a/arch/arm/kernel/smp_scu.c
+++ b/arch/arm/kernel/smp_scu.c
@@ -11,6 +11,7 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/io.h> 12#include <linux/io.h>
13 13
14#include <asm/smp_plat.h>
14#include <asm/smp_scu.h> 15#include <asm/smp_scu.h>
15#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
16#include <asm/cputype.h> 17#include <asm/cputype.h>
@@ -74,7 +75,7 @@ void scu_enable(void __iomem *scu_base)
74int scu_power_mode(void __iomem *scu_base, unsigned int mode) 75int scu_power_mode(void __iomem *scu_base, unsigned int mode)
75{ 76{
76 unsigned int val; 77 unsigned int val;
77 int cpu = smp_processor_id(); 78 int cpu = cpu_logical_map(smp_processor_id());
78 79
79 if (mode > 3 || mode == 1 || cpu > 3) 80 if (mode > 3 || mode == 1 || cpu > 3)
80 return -EINVAL; 81 return -EINVAL;
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index d2b177905cdb..76cbb055dd05 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -115,7 +115,7 @@ int kernel_execve(const char *filename,
115 "Ir" (THREAD_START_SP - sizeof(regs)), 115 "Ir" (THREAD_START_SP - sizeof(regs)),
116 "r" (&regs), 116 "r" (&regs),
117 "Ir" (sizeof(regs)) 117 "Ir" (sizeof(regs))
118 : "r0", "r1", "r2", "r3", "ip", "lr", "memory"); 118 : "r0", "r1", "r2", "r3", "r8", "r9", "ip", "lr", "memory");
119 119
120 out: 120 out:
121 return ret; 121 return ret;
diff --git a/arch/arm/kernel/thumbee.c b/arch/arm/kernel/thumbee.c
index aab899764053..7b8403b76666 100644
--- a/arch/arm/kernel/thumbee.c
+++ b/arch/arm/kernel/thumbee.c
@@ -20,6 +20,7 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/init.h> 21#include <linux/init.h>
22 22
23#include <asm/cputype.h>
23#include <asm/system_info.h> 24#include <asm/system_info.h>
24#include <asm/thread_notify.h> 25#include <asm/thread_notify.h>
25 26
@@ -67,8 +68,7 @@ static int __init thumbee_init(void)
67 if (cpu_arch < CPU_ARCH_ARMv7) 68 if (cpu_arch < CPU_ARCH_ARMv7)
68 return 0; 69 return 0;
69 70
70 /* processor feature register 0 */ 71 pfr0 = read_cpuid_ext(CPUID_EXT_PFR0);
71 asm("mrc p15, 0, %0, c0, c1, 0\n" : "=r" (pfr0));
72 if ((pfr0 & 0x0000f000) != 0x00001000) 72 if ((pfr0 & 0x0000f000) != 0x00001000)
73 return 0; 73 return 0;
74 74
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index fe31b22f18fd..af2afb019672 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -110,6 +110,42 @@ void timer_tick(void)
110} 110}
111#endif 111#endif
112 112
113static void dummy_clock_access(struct timespec *ts)
114{
115 ts->tv_sec = 0;
116 ts->tv_nsec = 0;
117}
118
119static clock_access_fn __read_persistent_clock = dummy_clock_access;
120static clock_access_fn __read_boot_clock = dummy_clock_access;;
121
122void read_persistent_clock(struct timespec *ts)
123{
124 __read_persistent_clock(ts);
125}
126
127void read_boot_clock(struct timespec *ts)
128{
129 __read_boot_clock(ts);
130}
131
132int __init register_persistent_clock(clock_access_fn read_boot,
133 clock_access_fn read_persistent)
134{
135 /* Only allow the clockaccess functions to be registered once */
136 if (__read_persistent_clock == dummy_clock_access &&
137 __read_boot_clock == dummy_clock_access) {
138 if (read_boot)
139 __read_boot_clock = read_boot;
140 if (read_persistent)
141 __read_persistent_clock = read_persistent;
142
143 return 0;
144 }
145
146 return -EINVAL;
147}
148
113#if defined(CONFIG_PM) && !defined(CONFIG_GENERIC_CLOCKEVENTS) 149#if defined(CONFIG_PM) && !defined(CONFIG_GENERIC_CLOCKEVENTS)
114static int timer_suspend(void) 150static int timer_suspend(void)
115{ 151{
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 778454750a6c..3647170e9a16 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -479,14 +479,14 @@ static int bad_syscall(int n, struct pt_regs *regs)
479 return regs->ARM_r0; 479 return regs->ARM_r0;
480} 480}
481 481
482static inline void 482static inline int
483do_cache_op(unsigned long start, unsigned long end, int flags) 483do_cache_op(unsigned long start, unsigned long end, int flags)
484{ 484{
485 struct mm_struct *mm = current->active_mm; 485 struct mm_struct *mm = current->active_mm;
486 struct vm_area_struct *vma; 486 struct vm_area_struct *vma;
487 487
488 if (end < start || flags) 488 if (end < start || flags)
489 return; 489 return -EINVAL;
490 490
491 down_read(&mm->mmap_sem); 491 down_read(&mm->mmap_sem);
492 vma = find_vma(mm, start); 492 vma = find_vma(mm, start);
@@ -496,9 +496,11 @@ do_cache_op(unsigned long start, unsigned long end, int flags)
496 if (end > vma->vm_end) 496 if (end > vma->vm_end)
497 end = vma->vm_end; 497 end = vma->vm_end;
498 498
499 flush_cache_user_range(vma, start, end); 499 up_read(&mm->mmap_sem);
500 return flush_cache_user_range(start, end);
500 } 501 }
501 up_read(&mm->mmap_sem); 502 up_read(&mm->mmap_sem);
503 return -EINVAL;
502} 504}
503 505
504/* 506/*
@@ -544,8 +546,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
544 * the specified region). 546 * the specified region).
545 */ 547 */
546 case NR(cacheflush): 548 case NR(cacheflush):
547 do_cache_op(regs->ARM_r0, regs->ARM_r1, regs->ARM_r2); 549 return do_cache_op(regs->ARM_r0, regs->ARM_r1, regs->ARM_r2);
548 return 0;
549 550
550 case NR(usr26): 551 case NR(usr26):
551 if (!(elf_hwcap & HWCAP_26BIT)) 552 if (!(elf_hwcap & HWCAP_26BIT))
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 0ade0acc1ed9..992769ae2599 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -17,30 +17,13 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \
17 call_with_stack.o 17 call_with_stack.o
18 18
19mmu-y := clear_user.o copy_page.o getuser.o putuser.o 19mmu-y := clear_user.o copy_page.o getuser.o putuser.o
20 20mmu-y += copy_from_user.o copy_to_user.o
21# the code in uaccess.S is not preemption safe and
22# probably faster on ARMv3 only
23ifeq ($(CONFIG_PREEMPT),y)
24 mmu-y += copy_from_user.o copy_to_user.o
25else
26ifneq ($(CONFIG_CPU_32v3),y)
27 mmu-y += copy_from_user.o copy_to_user.o
28else
29 mmu-y += uaccess.o
30endif
31endif
32 21
33# using lib_ here won't override already available weak symbols 22# using lib_ here won't override already available weak symbols
34obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o 23obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o
35 24
36lib-$(CONFIG_MMU) += $(mmu-y) 25lib-$(CONFIG_MMU) += $(mmu-y)
37 26lib-y += io-readsw-armv4.o io-writesw-armv4.o
38ifeq ($(CONFIG_CPU_32v3),y)
39 lib-y += io-readsw-armv3.o io-writesw-armv3.o
40else
41 lib-y += io-readsw-armv4.o io-writesw-armv4.o
42endif
43
44lib-$(CONFIG_ARCH_RPC) += ecard.o io-acorn.o floppydma.o 27lib-$(CONFIG_ARCH_RPC) += ecard.o io-acorn.o floppydma.o
45lib-$(CONFIG_ARCH_SHARK) += io-shark.o 28lib-$(CONFIG_ARCH_SHARK) += io-shark.o
46 29
diff --git a/arch/arm/lib/io-readsw-armv3.S b/arch/arm/lib/io-readsw-armv3.S
deleted file mode 100644
index 88487c8c4f23..000000000000
--- a/arch/arm/lib/io-readsw-armv3.S
+++ /dev/null
@@ -1,106 +0,0 @@
1/*
2 * linux/arch/arm/lib/io-readsw-armv3.S
3 *
4 * Copyright (C) 1995-2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12
13.Linsw_bad_alignment:
14 adr r0, .Linsw_bad_align_msg
15 mov r2, lr
16 b panic
17.Linsw_bad_align_msg:
18 .asciz "insw: bad buffer alignment (0x%p, lr=0x%08lX)\n"
19 .align
20
21.Linsw_align: tst r1, #1
22 bne .Linsw_bad_alignment
23
24 ldr r3, [r0]
25 strb r3, [r1], #1
26 mov r3, r3, lsr #8
27 strb r3, [r1], #1
28
29 subs r2, r2, #1
30 moveq pc, lr
31
32ENTRY(__raw_readsw)
33 teq r2, #0 @ do we have to check for the zero len?
34 moveq pc, lr
35 tst r1, #3
36 bne .Linsw_align
37
38.Linsw_aligned: mov ip, #0xff
39 orr ip, ip, ip, lsl #8
40 stmfd sp!, {r4, r5, r6, lr}
41
42 subs r2, r2, #8
43 bmi .Lno_insw_8
44
45.Linsw_8_lp: ldr r3, [r0]
46 and r3, r3, ip
47 ldr r4, [r0]
48 orr r3, r3, r4, lsl #16
49
50 ldr r4, [r0]
51 and r4, r4, ip
52 ldr r5, [r0]
53 orr r4, r4, r5, lsl #16
54
55 ldr r5, [r0]
56 and r5, r5, ip
57 ldr r6, [r0]
58 orr r5, r5, r6, lsl #16
59
60 ldr r6, [r0]
61 and r6, r6, ip
62 ldr lr, [r0]
63 orr r6, r6, lr, lsl #16
64
65 stmia r1!, {r3 - r6}
66
67 subs r2, r2, #8
68 bpl .Linsw_8_lp
69
70 tst r2, #7
71 ldmeqfd sp!, {r4, r5, r6, pc}
72
73.Lno_insw_8: tst r2, #4
74 beq .Lno_insw_4
75
76 ldr r3, [r0]
77 and r3, r3, ip
78 ldr r4, [r0]
79 orr r3, r3, r4, lsl #16
80
81 ldr r4, [r0]
82 and r4, r4, ip
83 ldr r5, [r0]
84 orr r4, r4, r5, lsl #16
85
86 stmia r1!, {r3, r4}
87
88.Lno_insw_4: tst r2, #2
89 beq .Lno_insw_2
90
91 ldr r3, [r0]
92 and r3, r3, ip
93 ldr r4, [r0]
94 orr r3, r3, r4, lsl #16
95
96 str r3, [r1], #4
97
98.Lno_insw_2: tst r2, #1
99 ldrne r3, [r0]
100 strneb r3, [r1], #1
101 movne r3, r3, lsr #8
102 strneb r3, [r1]
103
104 ldmfd sp!, {r4, r5, r6, pc}
105
106
diff --git a/arch/arm/lib/io-writesw-armv3.S b/arch/arm/lib/io-writesw-armv3.S
deleted file mode 100644
index 49b800419e32..000000000000
--- a/arch/arm/lib/io-writesw-armv3.S
+++ /dev/null
@@ -1,126 +0,0 @@
1/*
2 * linux/arch/arm/lib/io-writesw-armv3.S
3 *
4 * Copyright (C) 1995-2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12
13.Loutsw_bad_alignment:
14 adr r0, .Loutsw_bad_align_msg
15 mov r2, lr
16 b panic
17.Loutsw_bad_align_msg:
18 .asciz "outsw: bad buffer alignment (0x%p, lr=0x%08lX)\n"
19 .align
20
21.Loutsw_align: tst r1, #1
22 bne .Loutsw_bad_alignment
23
24 add r1, r1, #2
25
26 ldr r3, [r1, #-4]
27 mov r3, r3, lsr #16
28 orr r3, r3, r3, lsl #16
29 str r3, [r0]
30 subs r2, r2, #1
31 moveq pc, lr
32
33ENTRY(__raw_writesw)
34 teq r2, #0 @ do we have to check for the zero len?
35 moveq pc, lr
36 tst r1, #3
37 bne .Loutsw_align
38
39 stmfd sp!, {r4, r5, r6, lr}
40
41 subs r2, r2, #8
42 bmi .Lno_outsw_8
43
44.Loutsw_8_lp: ldmia r1!, {r3, r4, r5, r6}
45
46 mov ip, r3, lsl #16
47 orr ip, ip, ip, lsr #16
48 str ip, [r0]
49
50 mov ip, r3, lsr #16
51 orr ip, ip, ip, lsl #16
52 str ip, [r0]
53
54 mov ip, r4, lsl #16
55 orr ip, ip, ip, lsr #16
56 str ip, [r0]
57
58 mov ip, r4, lsr #16
59 orr ip, ip, ip, lsl #16
60 str ip, [r0]
61
62 mov ip, r5, lsl #16
63 orr ip, ip, ip, lsr #16
64 str ip, [r0]
65
66 mov ip, r5, lsr #16
67 orr ip, ip, ip, lsl #16
68 str ip, [r0]
69
70 mov ip, r6, lsl #16
71 orr ip, ip, ip, lsr #16
72 str ip, [r0]
73
74 mov ip, r6, lsr #16
75 orr ip, ip, ip, lsl #16
76 str ip, [r0]
77
78 subs r2, r2, #8
79 bpl .Loutsw_8_lp
80
81 tst r2, #7
82 ldmeqfd sp!, {r4, r5, r6, pc}
83
84.Lno_outsw_8: tst r2, #4
85 beq .Lno_outsw_4
86
87 ldmia r1!, {r3, r4}
88
89 mov ip, r3, lsl #16
90 orr ip, ip, ip, lsr #16
91 str ip, [r0]
92
93 mov ip, r3, lsr #16
94 orr ip, ip, ip, lsl #16
95 str ip, [r0]
96
97 mov ip, r4, lsl #16
98 orr ip, ip, ip, lsr #16
99 str ip, [r0]
100
101 mov ip, r4, lsr #16
102 orr ip, ip, ip, lsl #16
103 str ip, [r0]
104
105.Lno_outsw_4: tst r2, #2
106 beq .Lno_outsw_2
107
108 ldr r3, [r1], #4
109
110 mov ip, r3, lsl #16
111 orr ip, ip, ip, lsr #16
112 str ip, [r0]
113
114 mov ip, r3, lsr #16
115 orr ip, ip, ip, lsl #16
116 str ip, [r0]
117
118.Lno_outsw_2: tst r2, #1
119
120 ldrne r3, [r1]
121
122 movne ip, r3, lsl #16
123 orrne ip, ip, ip, lsr #16
124 strne ip, [r0]
125
126 ldmfd sp!, {r4, r5, r6, pc}
diff --git a/arch/arm/lib/uaccess.S b/arch/arm/lib/uaccess.S
deleted file mode 100644
index 5c908b1cb8ed..000000000000
--- a/arch/arm/lib/uaccess.S
+++ /dev/null
@@ -1,564 +0,0 @@
1/*
2 * linux/arch/arm/lib/uaccess.S
3 *
4 * Copyright (C) 1995, 1996,1997,1998 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Routines to block copy data to/from user memory
11 * These are highly optimised both for the 4k page size
12 * and for various alignments.
13 */
14#include <linux/linkage.h>
15#include <asm/assembler.h>
16#include <asm/errno.h>
17#include <asm/domain.h>
18
19 .text
20
21#define PAGE_SHIFT 12
22
23/* Prototype: int __copy_to_user(void *to, const char *from, size_t n)
24 * Purpose : copy a block to user memory from kernel memory
25 * Params : to - user memory
26 * : from - kernel memory
27 * : n - number of bytes to copy
28 * Returns : Number of bytes NOT copied.
29 */
30
31.Lc2u_dest_not_aligned:
32 rsb ip, ip, #4
33 cmp ip, #2
34 ldrb r3, [r1], #1
35USER( TUSER( strb) r3, [r0], #1) @ May fault
36 ldrgeb r3, [r1], #1
37USER( TUSER( strgeb) r3, [r0], #1) @ May fault
38 ldrgtb r3, [r1], #1
39USER( TUSER( strgtb) r3, [r0], #1) @ May fault
40 sub r2, r2, ip
41 b .Lc2u_dest_aligned
42
43ENTRY(__copy_to_user)
44 stmfd sp!, {r2, r4 - r7, lr}
45 cmp r2, #4
46 blt .Lc2u_not_enough
47 ands ip, r0, #3
48 bne .Lc2u_dest_not_aligned
49.Lc2u_dest_aligned:
50
51 ands ip, r1, #3
52 bne .Lc2u_src_not_aligned
53/*
54 * Seeing as there has to be at least 8 bytes to copy, we can
55 * copy one word, and force a user-mode page fault...
56 */
57
58.Lc2u_0fupi: subs r2, r2, #4
59 addmi ip, r2, #4
60 bmi .Lc2u_0nowords
61 ldr r3, [r1], #4
62USER( TUSER( str) r3, [r0], #4) @ May fault
63 mov ip, r0, lsl #32 - PAGE_SHIFT @ On each page, use a ld/st??t instruction
64 rsb ip, ip, #0
65 movs ip, ip, lsr #32 - PAGE_SHIFT
66 beq .Lc2u_0fupi
67/*
68 * ip = max no. of bytes to copy before needing another "strt" insn
69 */
70 cmp r2, ip
71 movlt ip, r2
72 sub r2, r2, ip
73 subs ip, ip, #32
74 blt .Lc2u_0rem8lp
75
76.Lc2u_0cpy8lp: ldmia r1!, {r3 - r6}
77 stmia r0!, {r3 - r6} @ Shouldnt fault
78 ldmia r1!, {r3 - r6}
79 subs ip, ip, #32
80 stmia r0!, {r3 - r6} @ Shouldnt fault
81 bpl .Lc2u_0cpy8lp
82
83.Lc2u_0rem8lp: cmn ip, #16
84 ldmgeia r1!, {r3 - r6}
85 stmgeia r0!, {r3 - r6} @ Shouldnt fault
86 tst ip, #8
87 ldmneia r1!, {r3 - r4}
88 stmneia r0!, {r3 - r4} @ Shouldnt fault
89 tst ip, #4
90 ldrne r3, [r1], #4
91 TUSER( strne) r3, [r0], #4 @ Shouldnt fault
92 ands ip, ip, #3
93 beq .Lc2u_0fupi
94.Lc2u_0nowords: teq ip, #0
95 beq .Lc2u_finished
96.Lc2u_nowords: cmp ip, #2
97 ldrb r3, [r1], #1
98USER( TUSER( strb) r3, [r0], #1) @ May fault
99 ldrgeb r3, [r1], #1
100USER( TUSER( strgeb) r3, [r0], #1) @ May fault
101 ldrgtb r3, [r1], #1
102USER( TUSER( strgtb) r3, [r0], #1) @ May fault
103 b .Lc2u_finished
104
105.Lc2u_not_enough:
106 movs ip, r2
107 bne .Lc2u_nowords
108.Lc2u_finished: mov r0, #0
109 ldmfd sp!, {r2, r4 - r7, pc}
110
111.Lc2u_src_not_aligned:
112 bic r1, r1, #3
113 ldr r7, [r1], #4
114 cmp ip, #2
115 bgt .Lc2u_3fupi
116 beq .Lc2u_2fupi
117.Lc2u_1fupi: subs r2, r2, #4
118 addmi ip, r2, #4
119 bmi .Lc2u_1nowords
120 mov r3, r7, pull #8
121 ldr r7, [r1], #4
122 orr r3, r3, r7, push #24
123USER( TUSER( str) r3, [r0], #4) @ May fault
124 mov ip, r0, lsl #32 - PAGE_SHIFT
125 rsb ip, ip, #0
126 movs ip, ip, lsr #32 - PAGE_SHIFT
127 beq .Lc2u_1fupi
128 cmp r2, ip
129 movlt ip, r2
130 sub r2, r2, ip
131 subs ip, ip, #16
132 blt .Lc2u_1rem8lp
133
134.Lc2u_1cpy8lp: mov r3, r7, pull #8
135 ldmia r1!, {r4 - r7}
136 subs ip, ip, #16
137 orr r3, r3, r4, push #24
138 mov r4, r4, pull #8
139 orr r4, r4, r5, push #24
140 mov r5, r5, pull #8
141 orr r5, r5, r6, push #24
142 mov r6, r6, pull #8
143 orr r6, r6, r7, push #24
144 stmia r0!, {r3 - r6} @ Shouldnt fault
145 bpl .Lc2u_1cpy8lp
146
147.Lc2u_1rem8lp: tst ip, #8
148 movne r3, r7, pull #8
149 ldmneia r1!, {r4, r7}
150 orrne r3, r3, r4, push #24
151 movne r4, r4, pull #8
152 orrne r4, r4, r7, push #24
153 stmneia r0!, {r3 - r4} @ Shouldnt fault
154 tst ip, #4
155 movne r3, r7, pull #8
156 ldrne r7, [r1], #4
157 orrne r3, r3, r7, push #24
158 TUSER( strne) r3, [r0], #4 @ Shouldnt fault
159 ands ip, ip, #3
160 beq .Lc2u_1fupi
161.Lc2u_1nowords: mov r3, r7, get_byte_1
162 teq ip, #0
163 beq .Lc2u_finished
164 cmp ip, #2
165USER( TUSER( strb) r3, [r0], #1) @ May fault
166 movge r3, r7, get_byte_2
167USER( TUSER( strgeb) r3, [r0], #1) @ May fault
168 movgt r3, r7, get_byte_3
169USER( TUSER( strgtb) r3, [r0], #1) @ May fault
170 b .Lc2u_finished
171
172.Lc2u_2fupi: subs r2, r2, #4
173 addmi ip, r2, #4
174 bmi .Lc2u_2nowords
175 mov r3, r7, pull #16
176 ldr r7, [r1], #4
177 orr r3, r3, r7, push #16
178USER( TUSER( str) r3, [r0], #4) @ May fault
179 mov ip, r0, lsl #32 - PAGE_SHIFT
180 rsb ip, ip, #0
181 movs ip, ip, lsr #32 - PAGE_SHIFT
182 beq .Lc2u_2fupi
183 cmp r2, ip
184 movlt ip, r2
185 sub r2, r2, ip
186 subs ip, ip, #16
187 blt .Lc2u_2rem8lp
188
189.Lc2u_2cpy8lp: mov r3, r7, pull #16
190 ldmia r1!, {r4 - r7}
191 subs ip, ip, #16
192 orr r3, r3, r4, push #16
193 mov r4, r4, pull #16
194 orr r4, r4, r5, push #16
195 mov r5, r5, pull #16
196 orr r5, r5, r6, push #16
197 mov r6, r6, pull #16
198 orr r6, r6, r7, push #16
199 stmia r0!, {r3 - r6} @ Shouldnt fault
200 bpl .Lc2u_2cpy8lp
201
202.Lc2u_2rem8lp: tst ip, #8
203 movne r3, r7, pull #16
204 ldmneia r1!, {r4, r7}
205 orrne r3, r3, r4, push #16
206 movne r4, r4, pull #16
207 orrne r4, r4, r7, push #16
208 stmneia r0!, {r3 - r4} @ Shouldnt fault
209 tst ip, #4
210 movne r3, r7, pull #16
211 ldrne r7, [r1], #4
212 orrne r3, r3, r7, push #16
213 TUSER( strne) r3, [r0], #4 @ Shouldnt fault
214 ands ip, ip, #3
215 beq .Lc2u_2fupi
216.Lc2u_2nowords: mov r3, r7, get_byte_2
217 teq ip, #0
218 beq .Lc2u_finished
219 cmp ip, #2
220USER( TUSER( strb) r3, [r0], #1) @ May fault
221 movge r3, r7, get_byte_3
222USER( TUSER( strgeb) r3, [r0], #1) @ May fault
223 ldrgtb r3, [r1], #0
224USER( TUSER( strgtb) r3, [r0], #1) @ May fault
225 b .Lc2u_finished
226
227.Lc2u_3fupi: subs r2, r2, #4
228 addmi ip, r2, #4
229 bmi .Lc2u_3nowords
230 mov r3, r7, pull #24
231 ldr r7, [r1], #4
232 orr r3, r3, r7, push #8
233USER( TUSER( str) r3, [r0], #4) @ May fault
234 mov ip, r0, lsl #32 - PAGE_SHIFT
235 rsb ip, ip, #0
236 movs ip, ip, lsr #32 - PAGE_SHIFT
237 beq .Lc2u_3fupi
238 cmp r2, ip
239 movlt ip, r2
240 sub r2, r2, ip
241 subs ip, ip, #16
242 blt .Lc2u_3rem8lp
243
244.Lc2u_3cpy8lp: mov r3, r7, pull #24
245 ldmia r1!, {r4 - r7}
246 subs ip, ip, #16
247 orr r3, r3, r4, push #8
248 mov r4, r4, pull #24
249 orr r4, r4, r5, push #8
250 mov r5, r5, pull #24
251 orr r5, r5, r6, push #8
252 mov r6, r6, pull #24
253 orr r6, r6, r7, push #8
254 stmia r0!, {r3 - r6} @ Shouldnt fault
255 bpl .Lc2u_3cpy8lp
256
257.Lc2u_3rem8lp: tst ip, #8
258 movne r3, r7, pull #24
259 ldmneia r1!, {r4, r7}
260 orrne r3, r3, r4, push #8
261 movne r4, r4, pull #24
262 orrne r4, r4, r7, push #8
263 stmneia r0!, {r3 - r4} @ Shouldnt fault
264 tst ip, #4
265 movne r3, r7, pull #24
266 ldrne r7, [r1], #4
267 orrne r3, r3, r7, push #8
268 TUSER( strne) r3, [r0], #4 @ Shouldnt fault
269 ands ip, ip, #3
270 beq .Lc2u_3fupi
271.Lc2u_3nowords: mov r3, r7, get_byte_3
272 teq ip, #0
273 beq .Lc2u_finished
274 cmp ip, #2
275USER( TUSER( strb) r3, [r0], #1) @ May fault
276 ldrgeb r3, [r1], #1
277USER( TUSER( strgeb) r3, [r0], #1) @ May fault
278 ldrgtb r3, [r1], #0
279USER( TUSER( strgtb) r3, [r0], #1) @ May fault
280 b .Lc2u_finished
281ENDPROC(__copy_to_user)
282
283 .pushsection .fixup,"ax"
284 .align 0
2859001: ldmfd sp!, {r0, r4 - r7, pc}
286 .popsection
287
288/* Prototype: unsigned long __copy_from_user(void *to,const void *from,unsigned long n);
289 * Purpose : copy a block from user memory to kernel memory
290 * Params : to - kernel memory
291 * : from - user memory
292 * : n - number of bytes to copy
293 * Returns : Number of bytes NOT copied.
294 */
295.Lcfu_dest_not_aligned:
296 rsb ip, ip, #4
297 cmp ip, #2
298USER( TUSER( ldrb) r3, [r1], #1) @ May fault
299 strb r3, [r0], #1
300USER( TUSER( ldrgeb) r3, [r1], #1) @ May fault
301 strgeb r3, [r0], #1
302USER( TUSER( ldrgtb) r3, [r1], #1) @ May fault
303 strgtb r3, [r0], #1
304 sub r2, r2, ip
305 b .Lcfu_dest_aligned
306
307ENTRY(__copy_from_user)
308 stmfd sp!, {r0, r2, r4 - r7, lr}
309 cmp r2, #4
310 blt .Lcfu_not_enough
311 ands ip, r0, #3
312 bne .Lcfu_dest_not_aligned
313.Lcfu_dest_aligned:
314 ands ip, r1, #3
315 bne .Lcfu_src_not_aligned
316
317/*
318 * Seeing as there has to be at least 8 bytes to copy, we can
319 * copy one word, and force a user-mode page fault...
320 */
321
322.Lcfu_0fupi: subs r2, r2, #4
323 addmi ip, r2, #4
324 bmi .Lcfu_0nowords
325USER( TUSER( ldr) r3, [r1], #4)
326 str r3, [r0], #4
327 mov ip, r1, lsl #32 - PAGE_SHIFT @ On each page, use a ld/st??t instruction
328 rsb ip, ip, #0
329 movs ip, ip, lsr #32 - PAGE_SHIFT
330 beq .Lcfu_0fupi
331/*
332 * ip = max no. of bytes to copy before needing another "strt" insn
333 */
334 cmp r2, ip
335 movlt ip, r2
336 sub r2, r2, ip
337 subs ip, ip, #32
338 blt .Lcfu_0rem8lp
339
340.Lcfu_0cpy8lp: ldmia r1!, {r3 - r6} @ Shouldnt fault
341 stmia r0!, {r3 - r6}
342 ldmia r1!, {r3 - r6} @ Shouldnt fault
343 subs ip, ip, #32
344 stmia r0!, {r3 - r6}
345 bpl .Lcfu_0cpy8lp
346
347.Lcfu_0rem8lp: cmn ip, #16
348 ldmgeia r1!, {r3 - r6} @ Shouldnt fault
349 stmgeia r0!, {r3 - r6}
350 tst ip, #8
351 ldmneia r1!, {r3 - r4} @ Shouldnt fault
352 stmneia r0!, {r3 - r4}
353 tst ip, #4
354 TUSER( ldrne) r3, [r1], #4 @ Shouldnt fault
355 strne r3, [r0], #4
356 ands ip, ip, #3
357 beq .Lcfu_0fupi
358.Lcfu_0nowords: teq ip, #0
359 beq .Lcfu_finished
360.Lcfu_nowords: cmp ip, #2
361USER( TUSER( ldrb) r3, [r1], #1) @ May fault
362 strb r3, [r0], #1
363USER( TUSER( ldrgeb) r3, [r1], #1) @ May fault
364 strgeb r3, [r0], #1
365USER( TUSER( ldrgtb) r3, [r1], #1) @ May fault
366 strgtb r3, [r0], #1
367 b .Lcfu_finished
368
369.Lcfu_not_enough:
370 movs ip, r2
371 bne .Lcfu_nowords
372.Lcfu_finished: mov r0, #0
373 add sp, sp, #8
374 ldmfd sp!, {r4 - r7, pc}
375
376.Lcfu_src_not_aligned:
377 bic r1, r1, #3
378USER( TUSER( ldr) r7, [r1], #4) @ May fault
379 cmp ip, #2
380 bgt .Lcfu_3fupi
381 beq .Lcfu_2fupi
382.Lcfu_1fupi: subs r2, r2, #4
383 addmi ip, r2, #4
384 bmi .Lcfu_1nowords
385 mov r3, r7, pull #8
386USER( TUSER( ldr) r7, [r1], #4) @ May fault
387 orr r3, r3, r7, push #24
388 str r3, [r0], #4
389 mov ip, r1, lsl #32 - PAGE_SHIFT
390 rsb ip, ip, #0
391 movs ip, ip, lsr #32 - PAGE_SHIFT
392 beq .Lcfu_1fupi
393 cmp r2, ip
394 movlt ip, r2
395 sub r2, r2, ip
396 subs ip, ip, #16
397 blt .Lcfu_1rem8lp
398
399.Lcfu_1cpy8lp: mov r3, r7, pull #8
400 ldmia r1!, {r4 - r7} @ Shouldnt fault
401 subs ip, ip, #16
402 orr r3, r3, r4, push #24
403 mov r4, r4, pull #8
404 orr r4, r4, r5, push #24
405 mov r5, r5, pull #8
406 orr r5, r5, r6, push #24
407 mov r6, r6, pull #8
408 orr r6, r6, r7, push #24
409 stmia r0!, {r3 - r6}
410 bpl .Lcfu_1cpy8lp
411
412.Lcfu_1rem8lp: tst ip, #8
413 movne r3, r7, pull #8
414 ldmneia r1!, {r4, r7} @ Shouldnt fault
415 orrne r3, r3, r4, push #24
416 movne r4, r4, pull #8
417 orrne r4, r4, r7, push #24
418 stmneia r0!, {r3 - r4}
419 tst ip, #4
420 movne r3, r7, pull #8
421USER( TUSER( ldrne) r7, [r1], #4) @ May fault
422 orrne r3, r3, r7, push #24
423 strne r3, [r0], #4
424 ands ip, ip, #3
425 beq .Lcfu_1fupi
426.Lcfu_1nowords: mov r3, r7, get_byte_1
427 teq ip, #0
428 beq .Lcfu_finished
429 cmp ip, #2
430 strb r3, [r0], #1
431 movge r3, r7, get_byte_2
432 strgeb r3, [r0], #1
433 movgt r3, r7, get_byte_3
434 strgtb r3, [r0], #1
435 b .Lcfu_finished
436
437.Lcfu_2fupi: subs r2, r2, #4
438 addmi ip, r2, #4
439 bmi .Lcfu_2nowords
440 mov r3, r7, pull #16
441USER( TUSER( ldr) r7, [r1], #4) @ May fault
442 orr r3, r3, r7, push #16
443 str r3, [r0], #4
444 mov ip, r1, lsl #32 - PAGE_SHIFT
445 rsb ip, ip, #0
446 movs ip, ip, lsr #32 - PAGE_SHIFT
447 beq .Lcfu_2fupi
448 cmp r2, ip
449 movlt ip, r2
450 sub r2, r2, ip
451 subs ip, ip, #16
452 blt .Lcfu_2rem8lp
453
454
455.Lcfu_2cpy8lp: mov r3, r7, pull #16
456 ldmia r1!, {r4 - r7} @ Shouldnt fault
457 subs ip, ip, #16
458 orr r3, r3, r4, push #16
459 mov r4, r4, pull #16
460 orr r4, r4, r5, push #16
461 mov r5, r5, pull #16
462 orr r5, r5, r6, push #16
463 mov r6, r6, pull #16
464 orr r6, r6, r7, push #16
465 stmia r0!, {r3 - r6}
466 bpl .Lcfu_2cpy8lp
467
468.Lcfu_2rem8lp: tst ip, #8
469 movne r3, r7, pull #16
470 ldmneia r1!, {r4, r7} @ Shouldnt fault
471 orrne r3, r3, r4, push #16
472 movne r4, r4, pull #16
473 orrne r4, r4, r7, push #16
474 stmneia r0!, {r3 - r4}
475 tst ip, #4
476 movne r3, r7, pull #16
477USER( TUSER( ldrne) r7, [r1], #4) @ May fault
478 orrne r3, r3, r7, push #16
479 strne r3, [r0], #4
480 ands ip, ip, #3
481 beq .Lcfu_2fupi
482.Lcfu_2nowords: mov r3, r7, get_byte_2
483 teq ip, #0
484 beq .Lcfu_finished
485 cmp ip, #2
486 strb r3, [r0], #1
487 movge r3, r7, get_byte_3
488 strgeb r3, [r0], #1
489USER( TUSER( ldrgtb) r3, [r1], #0) @ May fault
490 strgtb r3, [r0], #1
491 b .Lcfu_finished
492
493.Lcfu_3fupi: subs r2, r2, #4
494 addmi ip, r2, #4
495 bmi .Lcfu_3nowords
496 mov r3, r7, pull #24
497USER( TUSER( ldr) r7, [r1], #4) @ May fault
498 orr r3, r3, r7, push #8
499 str r3, [r0], #4
500 mov ip, r1, lsl #32 - PAGE_SHIFT
501 rsb ip, ip, #0
502 movs ip, ip, lsr #32 - PAGE_SHIFT
503 beq .Lcfu_3fupi
504 cmp r2, ip
505 movlt ip, r2
506 sub r2, r2, ip
507 subs ip, ip, #16
508 blt .Lcfu_3rem8lp
509
510.Lcfu_3cpy8lp: mov r3, r7, pull #24
511 ldmia r1!, {r4 - r7} @ Shouldnt fault
512 orr r3, r3, r4, push #8
513 mov r4, r4, pull #24
514 orr r4, r4, r5, push #8
515 mov r5, r5, pull #24
516 orr r5, r5, r6, push #8
517 mov r6, r6, pull #24
518 orr r6, r6, r7, push #8
519 stmia r0!, {r3 - r6}
520 subs ip, ip, #16
521 bpl .Lcfu_3cpy8lp
522
523.Lcfu_3rem8lp: tst ip, #8
524 movne r3, r7, pull #24
525 ldmneia r1!, {r4, r7} @ Shouldnt fault
526 orrne r3, r3, r4, push #8
527 movne r4, r4, pull #24
528 orrne r4, r4, r7, push #8
529 stmneia r0!, {r3 - r4}
530 tst ip, #4
531 movne r3, r7, pull #24
532USER( TUSER( ldrne) r7, [r1], #4) @ May fault
533 orrne r3, r3, r7, push #8
534 strne r3, [r0], #4
535 ands ip, ip, #3
536 beq .Lcfu_3fupi
537.Lcfu_3nowords: mov r3, r7, get_byte_3
538 teq ip, #0
539 beq .Lcfu_finished
540 cmp ip, #2
541 strb r3, [r0], #1
542USER( TUSER( ldrgeb) r3, [r1], #1) @ May fault
543 strgeb r3, [r0], #1
544USER( TUSER( ldrgtb) r3, [r1], #1) @ May fault
545 strgtb r3, [r0], #1
546 b .Lcfu_finished
547ENDPROC(__copy_from_user)
548
549 .pushsection .fixup,"ax"
550 .align 0
551 /*
552 * We took an exception. r0 contains a pointer to
553 * the byte not copied.
554 */
5559001: ldr r2, [sp], #4 @ void *to
556 sub r2, r0, r2 @ bytes copied
557 ldr r1, [sp], #4 @ unsigned long count
558 subs r4, r1, r2 @ bytes left to copy
559 movne r1, r4
560 blne __memzero
561 mov r0, r4
562 ldmfd sp!, {r4 - r7, pc}
563 .popsection
564
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 45db05d8d94c..19505c0a3f01 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -9,15 +9,6 @@ config HAVE_AT91_DBGU0
9config HAVE_AT91_DBGU1 9config HAVE_AT91_DBGU1
10 bool 10 bool
11 11
12config HAVE_AT91_USART3
13 bool
14
15config HAVE_AT91_USART4
16 bool
17
18config HAVE_AT91_USART5
19 bool
20
21config AT91_SAM9_ALT_RESET 12config AT91_SAM9_ALT_RESET
22 bool 13 bool
23 default !ARCH_AT91X40 14 default !ARCH_AT91X40
@@ -26,87 +17,129 @@ config AT91_SAM9G45_RESET
26 bool 17 bool
27 default !ARCH_AT91X40 18 default !ARCH_AT91X40
28 19
20config SOC_AT91SAM9
21 bool
22 select GENERIC_CLOCKEVENTS
23 select CPU_ARM926T
24
29menu "Atmel AT91 System-on-Chip" 25menu "Atmel AT91 System-on-Chip"
30 26
31choice 27comment "Atmel AT91 Processor"
32 prompt "Atmel AT91 Processor"
33 28
34config ARCH_AT91RM9200 29config SOC_AT91SAM9
30 bool
31 select CPU_ARM926T
32 select AT91_SAM9_TIME
33 select AT91_SAM9_SMC
34
35config SOC_AT91RM9200
35 bool "AT91RM9200" 36 bool "AT91RM9200"
36 select CPU_ARM920T 37 select CPU_ARM920T
37 select GENERIC_CLOCKEVENTS 38 select GENERIC_CLOCKEVENTS
38 select HAVE_AT91_DBGU0 39 select HAVE_AT91_DBGU0
39 select HAVE_AT91_USART3
40 40
41config ARCH_AT91SAM9260 41config SOC_AT91SAM9260
42 bool "AT91SAM9260 or AT91SAM9XE" 42 bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20"
43 select CPU_ARM926T 43 select SOC_AT91SAM9
44 select GENERIC_CLOCKEVENTS
45 select HAVE_AT91_DBGU0 44 select HAVE_AT91_DBGU0
46 select HAVE_AT91_USART3
47 select HAVE_AT91_USART4
48 select HAVE_AT91_USART5
49 select HAVE_NET_MACB 45 select HAVE_NET_MACB
46 help
47 Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE
48 or AT91SAM9G20 SoC.
50 49
51config ARCH_AT91SAM9261 50config SOC_AT91SAM9261
52 bool "AT91SAM9261" 51 bool "AT91SAM9261 or AT91SAM9G10"
53 select CPU_ARM926T 52 select SOC_AT91SAM9
54 select GENERIC_CLOCKEVENTS
55 select HAVE_FB_ATMEL
56 select HAVE_AT91_DBGU0
57
58config ARCH_AT91SAM9G10
59 bool "AT91SAM9G10"
60 select CPU_ARM926T
61 select GENERIC_CLOCKEVENTS
62 select HAVE_AT91_DBGU0 53 select HAVE_AT91_DBGU0
63 select HAVE_FB_ATMEL 54 select HAVE_FB_ATMEL
55 help
56 Select this if you are using one of Atmel's AT91SAM9261 or AT91SAM9G10 SoC.
64 57
65config ARCH_AT91SAM9263 58config SOC_AT91SAM9263
66 bool "AT91SAM9263" 59 bool "AT91SAM9263"
67 select CPU_ARM926T 60 select SOC_AT91SAM9
68 select GENERIC_CLOCKEVENTS 61 select HAVE_AT91_DBGU1
69 select HAVE_FB_ATMEL 62 select HAVE_FB_ATMEL
70 select HAVE_NET_MACB 63 select HAVE_NET_MACB
71 select HAVE_AT91_DBGU1
72 64
73config ARCH_AT91SAM9RL 65config SOC_AT91SAM9RL
74 bool "AT91SAM9RL" 66 bool "AT91SAM9RL"
75 select CPU_ARM926T 67 select SOC_AT91SAM9
76 select GENERIC_CLOCKEVENTS
77 select HAVE_AT91_USART3
78 select HAVE_FB_ATMEL
79 select HAVE_AT91_DBGU0
80
81config ARCH_AT91SAM9G20
82 bool "AT91SAM9G20"
83 select CPU_ARM926T
84 select GENERIC_CLOCKEVENTS
85 select HAVE_AT91_DBGU0 68 select HAVE_AT91_DBGU0
86 select HAVE_AT91_USART3 69 select HAVE_FB_ATMEL
87 select HAVE_AT91_USART4
88 select HAVE_AT91_USART5
89 select HAVE_NET_MACB
90 70
91config ARCH_AT91SAM9G45 71config SOC_AT91SAM9G45
92 bool "AT91SAM9G45" 72 bool "AT91SAM9G45 or AT91SAM9M10 families"
93 select CPU_ARM926T 73 select SOC_AT91SAM9
94 select GENERIC_CLOCKEVENTS 74 select HAVE_AT91_DBGU1
95 select HAVE_AT91_USART3
96 select HAVE_FB_ATMEL 75 select HAVE_FB_ATMEL
97 select HAVE_NET_MACB 76 select HAVE_NET_MACB
98 select HAVE_AT91_DBGU1 77 help
78 Select this if you are using one of Atmel's AT91SAM9G45 family SoC.
79 This support covers AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11.
99 80
100config ARCH_AT91SAM9X5 81config SOC_AT91SAM9X5
101 bool "AT91SAM9x5 family" 82 bool "AT91SAM9x5 family"
102 select CPU_ARM926T 83 select SOC_AT91SAM9
103 select GENERIC_CLOCKEVENTS 84 select HAVE_AT91_DBGU0
104 select HAVE_FB_ATMEL 85 select HAVE_FB_ATMEL
105 select HAVE_NET_MACB 86 select HAVE_NET_MACB
87 help
88 Select this if you are using one of Atmel's AT91SAM9x5 family SoC.
89 This means that your SAM9 name finishes with a '5' (except if it is
90 AT91SAM9G45!).
91 This support covers AT91SAM9G15, AT91SAM9G25, AT91SAM9X25, AT91SAM9G35
92 and AT91SAM9X35.
93
94config SOC_AT91SAM9N12
95 bool "AT91SAM9N12 family"
96 select SOC_AT91SAM9
106 select HAVE_AT91_DBGU0 97 select HAVE_AT91_DBGU0
98 select HAVE_FB_ATMEL
99 help
100 Select this if you are using Atmel's AT91SAM9N12 SoC.
101
102choice
103 prompt "Atmel AT91 Processor Devices for non DT boards"
104
105config ARCH_AT91_NONE
106 bool "None"
107
108config ARCH_AT91RM9200
109 bool "AT91RM9200"
110 select SOC_AT91RM9200
111
112config ARCH_AT91SAM9260
113 bool "AT91SAM9260 or AT91SAM9XE"
114 select SOC_AT91SAM9260
115
116config ARCH_AT91SAM9261
117 bool "AT91SAM9261"
118 select SOC_AT91SAM9261
119
120config ARCH_AT91SAM9G10
121 bool "AT91SAM9G10"
122 select SOC_AT91SAM9261
123
124config ARCH_AT91SAM9263
125 bool "AT91SAM9263"
126 select SOC_AT91SAM9263
127
128config ARCH_AT91SAM9RL
129 bool "AT91SAM9RL"
130 select SOC_AT91SAM9RL
131
132config ARCH_AT91SAM9G20
133 bool "AT91SAM9G20"
134 select SOC_AT91SAM9260
135
136config ARCH_AT91SAM9G45
137 bool "AT91SAM9G45"
138 select SOC_AT91SAM9G45
107 139
108config ARCH_AT91X40 140config ARCH_AT91X40
109 bool "AT91x40" 141 bool "AT91x40"
142 depends on !MMU
110 select ARCH_USES_GETTIMEOFFSET 143 select ARCH_USES_GETTIMEOFFSET
111 144
112endchoice 145endchoice
@@ -364,6 +397,7 @@ config MACH_AT91SAM9G20EK_2MMC
364 Select this if you are using an Atmel AT91SAM9G20-EK Evaluation Kit 397 Select this if you are using an Atmel AT91SAM9G20-EK Evaluation Kit
365 with 2 SD/MMC Slots. This is the case for AT91SAM9G20-EK rev. C and 398 with 2 SD/MMC Slots. This is the case for AT91SAM9G20-EK rev. C and
366 onwards. 399 onwards.
400 <http://www.atmel.com/tools/SAM9G20-EK.aspx>
367 401
368config MACH_CPU9G20 402config MACH_CPU9G20
369 bool "Eukrea CPU9G20 board" 403 bool "Eukrea CPU9G20 board"
@@ -433,9 +467,10 @@ comment "AT91SAM9G45 Board Type"
433config MACH_AT91SAM9M10G45EK 467config MACH_AT91SAM9M10G45EK
434 bool "Atmel AT91SAM9M10G45-EK Evaluation Kits" 468 bool "Atmel AT91SAM9M10G45-EK Evaluation Kits"
435 help 469 help
436 Select this if you are using Atmel's AT91SAM9G45-EKES Evaluation Kit. 470 Select this if you are using Atmel's AT91SAM9M10G45-EK Evaluation Kit.
437 "ES" at the end of the name means that this board is an 471 Those boards can be populated with any SoC of AT91SAM9G45 or AT91SAM9M10
438 Engineering Sample. 472 families: AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11.
473 <http://www.atmel.com/tools/SAM9M10-G45-EK.aspx>
439 474
440endif 475endif
441 476
@@ -515,41 +550,6 @@ config AT91_TIMER_HZ
515 system clock (of at least several MHz), rounding is less of a 550 system clock (of at least several MHz), rounding is less of a
516 problem so it can be safer to use a decimal values like 100. 551 problem so it can be safer to use a decimal values like 100.
517 552
518choice
519 prompt "Select a UART for early kernel messages"
520
521config AT91_EARLY_DBGU0
522 bool "DBGU on rm9200, 9260/9g20, 9261/9g10 and 9rl"
523 depends on HAVE_AT91_DBGU0
524
525config AT91_EARLY_DBGU1
526 bool "DBGU on 9263 and 9g45"
527 depends on HAVE_AT91_DBGU1
528
529config AT91_EARLY_USART0
530 bool "USART0"
531
532config AT91_EARLY_USART1
533 bool "USART1"
534
535config AT91_EARLY_USART2
536 bool "USART2"
537 depends on ! ARCH_AT91X40
538
539config AT91_EARLY_USART3
540 bool "USART3"
541 depends on HAVE_AT91_USART3
542
543config AT91_EARLY_USART4
544 bool "USART4"
545 depends on HAVE_AT91_USART4
546
547config AT91_EARLY_USART5
548 bool "USART5"
549 depends on HAVE_AT91_USART5
550
551endchoice
552
553endmenu 553endmenu
554 554
555endif 555endif
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 8512e53bed93..3bb7a51efc9d 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -10,17 +10,26 @@ obj- :=
10obj-$(CONFIG_AT91_PMC_UNIT) += clock.o 10obj-$(CONFIG_AT91_PMC_UNIT) += clock.o
11obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o 11obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o
12obj-$(CONFIG_AT91_SAM9G45_RESET) += at91sam9g45_reset.o 12obj-$(CONFIG_AT91_SAM9G45_RESET) += at91sam9g45_reset.o
13obj-$(CONFIG_SOC_AT91SAM9) += at91sam926x_time.o sam9_smc.o
13 14
14# CPU-specific support 15# CPU-specific support
15obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200.o at91rm9200_time.o at91rm9200_devices.o 16obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o at91rm9200_time.o
16obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o 17obj-$(CONFIG_SOC_AT91SAM9260) += at91sam9260.o
17obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o sam9_smc.o 18obj-$(CONFIG_SOC_AT91SAM9261) += at91sam9261.o
18obj-$(CONFIG_ARCH_AT91SAM9G10) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o sam9_smc.o 19obj-$(CONFIG_SOC_AT91SAM9263) += at91sam9263.o
19obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o sam9_smc.o 20obj-$(CONFIG_SOC_AT91SAM9G45) += at91sam9g45.o
20obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o sam9_smc.o 21obj-$(CONFIG_SOC_AT91SAM9N12) += at91sam9n12.o
21obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o 22obj-$(CONFIG_SOC_AT91SAM9X5) += at91sam9x5.o
22obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45.o at91sam926x_time.o at91sam9g45_devices.o sam9_smc.o 23obj-$(CONFIG_SOC_AT91SAM9RL) += at91sam9rl.o
23obj-$(CONFIG_ARCH_AT91SAM9X5) += at91sam9x5.o at91sam926x_time.o sam9_smc.o 24
25obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200_devices.o
26obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260_devices.o
27obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261_devices.o
28obj-$(CONFIG_ARCH_AT91SAM9G10) += at91sam9261_devices.o
29obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263_devices.o
30obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl_devices.o
31obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260_devices.o
32obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45_devices.o
24obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o 33obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o
25 34
26# AT91RM9200 board-specific support 35# AT91RM9200 board-specific support
diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot
index 0da66ca4a4f8..9e84fe4f2aaa 100644
--- a/arch/arm/mach-at91/Makefile.boot
+++ b/arch/arm/mach-at91/Makefile.boot
@@ -14,9 +14,23 @@ initrd_phys-y := 0x20410000
14endif 14endif
15 15
16# Keep dtb files sorted alphabetically for each SoC 16# Keep dtb files sorted alphabetically for each SoC
17# sam9260
18dtb-$(CONFIG_MACH_AT91SAM_DT) += ethernut5.dtb
19dtb-$(CONFIG_MACH_AT91SAM_DT) += tny_a9260.dtb
20dtb-$(CONFIG_MACH_AT91SAM_DT) += usb_a9260.dtb
21# sam9263
22dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9263ek.dtb
23dtb-$(CONFIG_MACH_AT91SAM_DT) += tny_a9263.dtb
24dtb-$(CONFIG_MACH_AT91SAM_DT) += usb_a9263.dtb
17# sam9g20 25# sam9g20
26dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9g20ek.dtb
27dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9g20ek_2mmc.dtb
28dtb-$(CONFIG_MACH_AT91SAM_DT) += kizbox.dtb
29dtb-$(CONFIG_MACH_AT91SAM_DT) += tny_a9g20.dtb
18dtb-$(CONFIG_MACH_AT91SAM_DT) += usb_a9g20.dtb 30dtb-$(CONFIG_MACH_AT91SAM_DT) += usb_a9g20.dtb
19# sam9g45 31# sam9g45
20dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb 32dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9m10g45ek.dtb
33# sam9n12
34dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9n12ek.dtb
21# sam9x5 35# sam9x5
22dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9g25ek.dtb 36dtb-$(CONFIG_MACH_AT91SAM_DT) += at91sam9g25ek.dtb
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 364c19357e60..26917687fc30 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -26,15 +26,6 @@
26#include "clock.h" 26#include "clock.h"
27#include "sam9_smc.h" 27#include "sam9_smc.h"
28 28
29static struct map_desc at91rm9200_io_desc[] __initdata = {
30 {
31 .virtual = AT91_VA_BASE_EMAC,
32 .pfn = __phys_to_pfn(AT91RM9200_BASE_EMAC),
33 .length = SZ_16K,
34 .type = MT_DEVICE,
35 },
36};
37
38/* -------------------------------------------------------------------- 29/* --------------------------------------------------------------------
39 * Clocks 30 * Clocks
40 * -------------------------------------------------------------------- */ 31 * -------------------------------------------------------------------- */
@@ -258,18 +249,6 @@ static void __init at91rm9200_register_clocks(void)
258 clk_register(&pck3); 249 clk_register(&pck3);
259} 250}
260 251
261static struct clk_lookup console_clock_lookup;
262
263void __init at91rm9200_set_console_clock(int id)
264{
265 if (id >= ARRAY_SIZE(usart_clocks_lookups))
266 return;
267
268 console_clock_lookup.con_id = "usart";
269 console_clock_lookup.clk = usart_clocks_lookups[id].clk;
270 clkdev_add(&console_clock_lookup);
271}
272
273/* -------------------------------------------------------------------- 252/* --------------------------------------------------------------------
274 * GPIO 253 * GPIO
275 * -------------------------------------------------------------------- */ 254 * -------------------------------------------------------------------- */
@@ -315,7 +294,6 @@ static void __init at91rm9200_map_io(void)
315{ 294{
316 /* Map peripherals */ 295 /* Map peripherals */
317 at91_init_sram(0, AT91RM9200_SRAM_BASE, AT91RM9200_SRAM_SIZE); 296 at91_init_sram(0, AT91RM9200_SRAM_BASE, AT91RM9200_SRAM_SIZE);
318 iotable_init(at91rm9200_io_desc, ARRAY_SIZE(at91rm9200_io_desc));
319} 297}
320 298
321static void __init at91rm9200_ioremap_registers(void) 299static void __init at91rm9200_ioremap_registers(void)
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 99ce5c955e39..e6b7d0533dd7 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -140,8 +140,8 @@ static struct macb_platform_data eth_data;
140 140
141static struct resource eth_resources[] = { 141static struct resource eth_resources[] = {
142 [0] = { 142 [0] = {
143 .start = AT91_VA_BASE_EMAC, 143 .start = AT91RM9200_BASE_EMAC,
144 .end = AT91_VA_BASE_EMAC + SZ_16K - 1, 144 .end = AT91RM9200_BASE_EMAC + SZ_16K - 1,
145 .flags = IORESOURCE_MEM, 145 .flags = IORESOURCE_MEM,
146 }, 146 },
147 [1] = { 147 [1] = {
@@ -1152,14 +1152,6 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1152 at91_uarts[portnr] = pdev; 1152 at91_uarts[portnr] = pdev;
1153} 1153}
1154 1154
1155void __init at91_set_serial_console(unsigned portnr)
1156{
1157 if (portnr < ATMEL_MAX_UART) {
1158 atmel_default_console_device = at91_uarts[portnr];
1159 at91rm9200_set_console_clock(at91_uarts[portnr]->id);
1160 }
1161}
1162
1163void __init at91_add_device_serial(void) 1155void __init at91_add_device_serial(void)
1164{ 1156{
1165 int i; 1157 int i;
@@ -1168,14 +1160,9 @@ void __init at91_add_device_serial(void)
1168 if (at91_uarts[i]) 1160 if (at91_uarts[i])
1169 platform_device_register(at91_uarts[i]); 1161 platform_device_register(at91_uarts[i]);
1170 } 1162 }
1171
1172 if (!atmel_default_console_device)
1173 printk(KERN_INFO "AT91: No default serial console defined.\n");
1174} 1163}
1175#else 1164#else
1176void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
1177void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} 1165void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1178void __init at91_set_serial_console(unsigned portnr) {}
1179void __init at91_add_device_serial(void) {} 1166void __init at91_add_device_serial(void) {}
1180#endif 1167#endif
1181 1168
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c
index dd7f782b0b91..104ca40d8d18 100644
--- a/arch/arm/mach-at91/at91rm9200_time.c
+++ b/arch/arm/mach-at91/at91rm9200_time.c
@@ -23,6 +23,7 @@
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/clockchips.h> 25#include <linux/clockchips.h>
26#include <linux/export.h>
26 27
27#include <asm/mach/time.h> 28#include <asm/mach/time.h>
28 29
@@ -176,6 +177,7 @@ static struct clock_event_device clkevt = {
176}; 177};
177 178
178void __iomem *at91_st_base; 179void __iomem *at91_st_base;
180EXPORT_SYMBOL_GPL(at91_st_base);
179 181
180void __init at91rm9200_ioremap_st(u32 addr) 182void __init at91rm9200_ioremap_st(u32 addr)
181{ 183{
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 46f774233298..2b1e438ed878 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -55,6 +55,13 @@ static struct clk adc_clk = {
55 .pmc_mask = 1 << AT91SAM9260_ID_ADC, 55 .pmc_mask = 1 << AT91SAM9260_ID_ADC,
56 .type = CLK_TYPE_PERIPHERAL, 56 .type = CLK_TYPE_PERIPHERAL,
57}; 57};
58
59static struct clk adc_op_clk = {
60 .name = "adc_op_clk",
61 .type = CLK_TYPE_PERIPHERAL,
62 .rate_hz = 5000000,
63};
64
58static struct clk usart0_clk = { 65static struct clk usart0_clk = {
59 .name = "usart0_clk", 66 .name = "usart0_clk",
60 .pmc_mask = 1 << AT91SAM9260_ID_US0, 67 .pmc_mask = 1 << AT91SAM9260_ID_US0,
@@ -166,6 +173,7 @@ static struct clk *periph_clocks[] __initdata = {
166 &pioB_clk, 173 &pioB_clk,
167 &pioC_clk, 174 &pioC_clk,
168 &adc_clk, 175 &adc_clk,
176 &adc_op_clk,
169 &usart0_clk, 177 &usart0_clk,
170 &usart1_clk, 178 &usart1_clk,
171 &usart2_clk, 179 &usart2_clk,
@@ -268,18 +276,6 @@ static void __init at91sam9260_register_clocks(void)
268 clk_register(&pck1); 276 clk_register(&pck1);
269} 277}
270 278
271static struct clk_lookup console_clock_lookup;
272
273void __init at91sam9260_set_console_clock(int id)
274{
275 if (id >= ARRAY_SIZE(usart_clocks_lookups))
276 return;
277
278 console_clock_lookup.con_id = "usart";
279 console_clock_lookup.clk = usart_clocks_lookups[id].clk;
280 clkdev_add(&console_clock_lookup);
281}
282
283/* -------------------------------------------------------------------- 279/* --------------------------------------------------------------------
284 * GPIO 280 * GPIO
285 * -------------------------------------------------------------------- */ 281 * -------------------------------------------------------------------- */
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 5652dde4bbe2..0ded951f785a 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -17,12 +17,15 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/i2c-gpio.h> 18#include <linux/i2c-gpio.h>
19 19
20#include <linux/platform_data/at91_adc.h>
21
20#include <mach/board.h> 22#include <mach/board.h>
21#include <mach/cpu.h> 23#include <mach/cpu.h>
22#include <mach/at91sam9260.h> 24#include <mach/at91sam9260.h>
23#include <mach/at91sam9260_matrix.h> 25#include <mach/at91sam9260_matrix.h>
24#include <mach/at91_matrix.h> 26#include <mach/at91_matrix.h>
25#include <mach/at91sam9_smc.h> 27#include <mach/at91sam9_smc.h>
28#include <mach/at91_adc.h>
26 29
27#include "generic.h" 30#include "generic.h"
28 31
@@ -702,25 +705,8 @@ static struct platform_device at91sam9260_tcb1_device = {
702 .num_resources = ARRAY_SIZE(tcb1_resources), 705 .num_resources = ARRAY_SIZE(tcb1_resources),
703}; 706};
704 707
705#if defined(CONFIG_OF)
706static struct of_device_id tcb_ids[] = {
707 { .compatible = "atmel,at91rm9200-tcb" },
708 { /*sentinel*/ }
709};
710#endif
711
712static void __init at91_add_device_tc(void) 708static void __init at91_add_device_tc(void)
713{ 709{
714#if defined(CONFIG_OF)
715 struct device_node *np;
716
717 np = of_find_matching_node(NULL, tcb_ids);
718 if (np) {
719 of_node_put(np);
720 return;
721 }
722#endif
723
724 platform_device_register(&at91sam9260_tcb0_device); 710 platform_device_register(&at91sam9260_tcb0_device);
725 platform_device_register(&at91sam9260_tcb1_device); 711 platform_device_register(&at91sam9260_tcb1_device);
726} 712}
@@ -1229,14 +1215,6 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1229 at91_uarts[portnr] = pdev; 1215 at91_uarts[portnr] = pdev;
1230} 1216}
1231 1217
1232void __init at91_set_serial_console(unsigned portnr)
1233{
1234 if (portnr < ATMEL_MAX_UART) {
1235 atmel_default_console_device = at91_uarts[portnr];
1236 at91sam9260_set_console_clock(at91_uarts[portnr]->id);
1237 }
1238}
1239
1240void __init at91_add_device_serial(void) 1218void __init at91_add_device_serial(void)
1241{ 1219{
1242 int i; 1220 int i;
@@ -1245,13 +1223,9 @@ void __init at91_add_device_serial(void)
1245 if (at91_uarts[i]) 1223 if (at91_uarts[i])
1246 platform_device_register(at91_uarts[i]); 1224 platform_device_register(at91_uarts[i]);
1247 } 1225 }
1248
1249 if (!atmel_default_console_device)
1250 printk(KERN_INFO "AT91: No default serial console defined.\n");
1251} 1226}
1252#else 1227#else
1253void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} 1228void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1254void __init at91_set_serial_console(unsigned portnr) {}
1255void __init at91_add_device_serial(void) {} 1229void __init at91_add_device_serial(void) {}
1256#endif 1230#endif
1257 1231
@@ -1369,6 +1343,93 @@ void __init at91_add_device_cf(struct at91_cf_data *data)
1369void __init at91_add_device_cf(struct at91_cf_data * data) {} 1343void __init at91_add_device_cf(struct at91_cf_data * data) {}
1370#endif 1344#endif
1371 1345
1346/* --------------------------------------------------------------------
1347 * ADCs
1348 * -------------------------------------------------------------------- */
1349
1350#if IS_ENABLED(CONFIG_AT91_ADC)
1351static struct at91_adc_data adc_data;
1352
1353static struct resource adc_resources[] = {
1354 [0] = {
1355 .start = AT91SAM9260_BASE_ADC,
1356 .end = AT91SAM9260_BASE_ADC + SZ_16K - 1,
1357 .flags = IORESOURCE_MEM,
1358 },
1359 [1] = {
1360 .start = AT91SAM9260_ID_ADC,
1361 .end = AT91SAM9260_ID_ADC,
1362 .flags = IORESOURCE_IRQ,
1363 },
1364};
1365
1366static struct platform_device at91_adc_device = {
1367 .name = "at91_adc",
1368 .id = -1,
1369 .dev = {
1370 .platform_data = &adc_data,
1371 },
1372 .resource = adc_resources,
1373 .num_resources = ARRAY_SIZE(adc_resources),
1374};
1375
1376static struct at91_adc_trigger at91_adc_triggers[] = {
1377 [0] = {
1378 .name = "timer-counter-0",
1379 .value = AT91_ADC_TRGSEL_TC0 | AT91_ADC_TRGEN,
1380 },
1381 [1] = {
1382 .name = "timer-counter-1",
1383 .value = AT91_ADC_TRGSEL_TC1 | AT91_ADC_TRGEN,
1384 },
1385 [2] = {
1386 .name = "timer-counter-2",
1387 .value = AT91_ADC_TRGSEL_TC2 | AT91_ADC_TRGEN,
1388 },
1389 [3] = {
1390 .name = "external",
1391 .value = AT91_ADC_TRGSEL_EXTERNAL | AT91_ADC_TRGEN,
1392 .is_external = true,
1393 },
1394};
1395
1396static struct at91_adc_reg_desc at91_adc_register_g20 = {
1397 .channel_base = AT91_ADC_CHR(0),
1398 .drdy_mask = AT91_ADC_DRDY,
1399 .status_register = AT91_ADC_SR,
1400 .trigger_register = AT91_ADC_MR,
1401};
1402
1403void __init at91_add_device_adc(struct at91_adc_data *data)
1404{
1405 if (!data)
1406 return;
1407
1408 if (test_bit(0, &data->channels_used))
1409 at91_set_A_periph(AT91_PIN_PC0, 0);
1410 if (test_bit(1, &data->channels_used))
1411 at91_set_A_periph(AT91_PIN_PC1, 0);
1412 if (test_bit(2, &data->channels_used))
1413 at91_set_A_periph(AT91_PIN_PC2, 0);
1414 if (test_bit(3, &data->channels_used))
1415 at91_set_A_periph(AT91_PIN_PC3, 0);
1416
1417 if (data->use_external_triggers)
1418 at91_set_A_periph(AT91_PIN_PA22, 0);
1419
1420 data->num_channels = 4;
1421 data->startup_time = 10;
1422 data->registers = &at91_adc_register_g20;
1423 data->trigger_number = 4;
1424 data->trigger_list = at91_adc_triggers;
1425
1426 adc_data = *data;
1427 platform_device_register(&at91_adc_device);
1428}
1429#else
1430void __init at91_add_device_adc(struct at91_adc_data *data) {}
1431#endif
1432
1372/* -------------------------------------------------------------------- */ 1433/* -------------------------------------------------------------------- */
1373/* 1434/*
1374 * These devices are always present and don't need any board-specific 1435 * These devices are always present and don't need any board-specific
@@ -1376,6 +1437,9 @@ void __init at91_add_device_cf(struct at91_cf_data * data) {}
1376 */ 1437 */
1377static int __init at91_add_standard_devices(void) 1438static int __init at91_add_standard_devices(void)
1378{ 1439{
1440 if (of_have_populated_dt())
1441 return 0;
1442
1379 at91_add_device_rtt(); 1443 at91_add_device_rtt();
1380 at91_add_device_watchdog(); 1444 at91_add_device_watchdog();
1381 at91_add_device_tc(); 1445 at91_add_device_tc();
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 7de81e6222f1..c77d503d09d1 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -239,18 +239,6 @@ static void __init at91sam9261_register_clocks(void)
239 clk_register(&hck1); 239 clk_register(&hck1);
240} 240}
241 241
242static struct clk_lookup console_clock_lookup;
243
244void __init at91sam9261_set_console_clock(int id)
245{
246 if (id >= ARRAY_SIZE(usart_clocks_lookups))
247 return;
248
249 console_clock_lookup.con_id = "usart";
250 console_clock_lookup.clk = usart_clocks_lookups[id].clk;
251 clkdev_add(&console_clock_lookup);
252}
253
254/* -------------------------------------------------------------------- 242/* --------------------------------------------------------------------
255 * GPIO 243 * GPIO
256 * -------------------------------------------------------------------- */ 244 * -------------------------------------------------------------------- */
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 4db961a93085..9295e90b08ff 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -1051,14 +1051,6 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1051 at91_uarts[portnr] = pdev; 1051 at91_uarts[portnr] = pdev;
1052} 1052}
1053 1053
1054void __init at91_set_serial_console(unsigned portnr)
1055{
1056 if (portnr < ATMEL_MAX_UART) {
1057 atmel_default_console_device = at91_uarts[portnr];
1058 at91sam9261_set_console_clock(at91_uarts[portnr]->id);
1059 }
1060}
1061
1062void __init at91_add_device_serial(void) 1054void __init at91_add_device_serial(void)
1063{ 1055{
1064 int i; 1056 int i;
@@ -1067,13 +1059,9 @@ void __init at91_add_device_serial(void)
1067 if (at91_uarts[i]) 1059 if (at91_uarts[i])
1068 platform_device_register(at91_uarts[i]); 1060 platform_device_register(at91_uarts[i]);
1069 } 1061 }
1070
1071 if (!atmel_default_console_device)
1072 printk(KERN_INFO "AT91: No default serial console defined.\n");
1073} 1062}
1074#else 1063#else
1075void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} 1064void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1076void __init at91_set_serial_console(unsigned portnr) {}
1077void __init at91_add_device_serial(void) {} 1065void __init at91_add_device_serial(void) {}
1078#endif 1066#endif
1079 1067
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index ef301be66575..ed91c7e9f7c2 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -199,6 +199,16 @@ static struct clk_lookup periph_clocks_lookups[] = {
199 CLKDEV_CON_ID("pioC", &pioCDE_clk), 199 CLKDEV_CON_ID("pioC", &pioCDE_clk),
200 CLKDEV_CON_ID("pioD", &pioCDE_clk), 200 CLKDEV_CON_ID("pioD", &pioCDE_clk),
201 CLKDEV_CON_ID("pioE", &pioCDE_clk), 201 CLKDEV_CON_ID("pioE", &pioCDE_clk),
202 /* more usart lookup table for DT entries */
203 CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck),
204 CLKDEV_CON_DEV_ID("usart", "fff8c000.serial", &usart0_clk),
205 CLKDEV_CON_DEV_ID("usart", "fff90000.serial", &usart1_clk),
206 CLKDEV_CON_DEV_ID("usart", "fff94000.serial", &usart2_clk),
207 /* more tc lookup table for DT entries */
208 CLKDEV_CON_DEV_ID("t0_clk", "fff7c000.timer", &tcb_clk),
209 CLKDEV_CON_DEV_ID("hclk", "a00000.ohci", &ohci_clk),
210 CLKDEV_CON_DEV_ID("spi_clk", "fffa4000.spi", &spi0_clk),
211 CLKDEV_CON_DEV_ID("spi_clk", "fffa8000.spi", &spi1_clk),
202}; 212};
203 213
204static struct clk_lookup usart_clocks_lookups[] = { 214static struct clk_lookup usart_clocks_lookups[] = {
@@ -255,18 +265,6 @@ static void __init at91sam9263_register_clocks(void)
255 clk_register(&pck3); 265 clk_register(&pck3);
256} 266}
257 267
258static struct clk_lookup console_clock_lookup;
259
260void __init at91sam9263_set_console_clock(int id)
261{
262 if (id >= ARRAY_SIZE(usart_clocks_lookups))
263 return;
264
265 console_clock_lookup.con_id = "usart";
266 console_clock_lookup.clk = usart_clocks_lookups[id].clk;
267 clkdev_add(&console_clock_lookup);
268}
269
270/* -------------------------------------------------------------------- 268/* --------------------------------------------------------------------
271 * GPIO 269 * GPIO
272 * -------------------------------------------------------------------- */ 270 * -------------------------------------------------------------------- */
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index fe99206de880..175e0009eaa9 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -953,8 +953,25 @@ static struct platform_device at91sam9263_tcb_device = {
953 .num_resources = ARRAY_SIZE(tcb_resources), 953 .num_resources = ARRAY_SIZE(tcb_resources),
954}; 954};
955 955
956#if defined(CONFIG_OF)
957static struct of_device_id tcb_ids[] = {
958 { .compatible = "atmel,at91rm9200-tcb" },
959 { /*sentinel*/ }
960};
961#endif
962
956static void __init at91_add_device_tc(void) 963static void __init at91_add_device_tc(void)
957{ 964{
965#if defined(CONFIG_OF)
966 struct device_node *np;
967
968 np = of_find_matching_node(NULL, tcb_ids);
969 if (np) {
970 of_node_put(np);
971 return;
972 }
973#endif
974
958 platform_device_register(&at91sam9263_tcb_device); 975 platform_device_register(&at91sam9263_tcb_device);
959} 976}
960#else 977#else
@@ -1461,14 +1478,6 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1461 at91_uarts[portnr] = pdev; 1478 at91_uarts[portnr] = pdev;
1462} 1479}
1463 1480
1464void __init at91_set_serial_console(unsigned portnr)
1465{
1466 if (portnr < ATMEL_MAX_UART) {
1467 atmel_default_console_device = at91_uarts[portnr];
1468 at91sam9263_set_console_clock(at91_uarts[portnr]->id);
1469 }
1470}
1471
1472void __init at91_add_device_serial(void) 1481void __init at91_add_device_serial(void)
1473{ 1482{
1474 int i; 1483 int i;
@@ -1477,13 +1486,9 @@ void __init at91_add_device_serial(void)
1477 if (at91_uarts[i]) 1486 if (at91_uarts[i])
1478 platform_device_register(at91_uarts[i]); 1487 platform_device_register(at91_uarts[i]);
1479 } 1488 }
1480
1481 if (!atmel_default_console_device)
1482 printk(KERN_INFO "AT91: No default serial console defined.\n");
1483} 1489}
1484#else 1490#else
1485void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} 1491void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1486void __init at91_set_serial_console(unsigned portnr) {}
1487void __init at91_add_device_serial(void) {} 1492void __init at91_add_device_serial(void) {}
1488#endif 1493#endif
1489 1494
@@ -1495,6 +1500,9 @@ void __init at91_add_device_serial(void) {}
1495 */ 1500 */
1496static int __init at91_add_standard_devices(void) 1501static int __init at91_add_standard_devices(void)
1497{ 1502{
1503 if (of_have_populated_dt())
1504 return 0;
1505
1498 at91_add_device_rtt(); 1506 at91_add_device_rtt();
1499 at91_add_device_watchdog(); 1507 at91_add_device_watchdog();
1500 at91_add_device_tc(); 1508 at91_add_device_tc();
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index d222f8333dab..4792682d52b9 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -176,6 +176,12 @@ static struct clk vdec_clk = {
176 .type = CLK_TYPE_PERIPHERAL, 176 .type = CLK_TYPE_PERIPHERAL,
177}; 177};
178 178
179static struct clk adc_op_clk = {
180 .name = "adc_op_clk",
181 .type = CLK_TYPE_PERIPHERAL,
182 .rate_hz = 13200000,
183};
184
179static struct clk *periph_clocks[] __initdata = { 185static struct clk *periph_clocks[] __initdata = {
180 &pioA_clk, 186 &pioA_clk,
181 &pioB_clk, 187 &pioB_clk,
@@ -204,6 +210,7 @@ static struct clk *periph_clocks[] __initdata = {
204 &isi_clk, 210 &isi_clk,
205 &udphs_clk, 211 &udphs_clk,
206 &mmc1_clk, 212 &mmc1_clk,
213 &adc_op_clk,
207 // irq0 214 // irq0
208}; 215};
209 216
@@ -242,6 +249,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
242 CLKDEV_CON_ID("pioC", &pioC_clk), 249 CLKDEV_CON_ID("pioC", &pioC_clk),
243 CLKDEV_CON_ID("pioD", &pioDE_clk), 250 CLKDEV_CON_ID("pioD", &pioDE_clk),
244 CLKDEV_CON_ID("pioE", &pioDE_clk), 251 CLKDEV_CON_ID("pioE", &pioDE_clk),
252 /* Fake adc clock */
253 CLKDEV_CON_ID("adc_clk", &tsc_clk),
245}; 254};
246 255
247static struct clk_lookup usart_clocks_lookups[] = { 256static struct clk_lookup usart_clocks_lookups[] = {
@@ -288,18 +297,6 @@ static void __init at91sam9g45_register_clocks(void)
288 clk_register(&pck1); 297 clk_register(&pck1);
289} 298}
290 299
291static struct clk_lookup console_clock_lookup;
292
293void __init at91sam9g45_set_console_clock(int id)
294{
295 if (id >= ARRAY_SIZE(usart_clocks_lookups))
296 return;
297
298 console_clock_lookup.con_id = "usart";
299 console_clock_lookup.clk = usart_clocks_lookups[id].clk;
300 clkdev_add(&console_clock_lookup);
301}
302
303/* -------------------------------------------------------------------- 300/* --------------------------------------------------------------------
304 * GPIO 301 * GPIO
305 * -------------------------------------------------------------------- */ 302 * -------------------------------------------------------------------- */
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 6b008aee1dff..f6747246d649 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -19,9 +19,12 @@
19#include <linux/i2c-gpio.h> 19#include <linux/i2c-gpio.h>
20#include <linux/atmel-mci.h> 20#include <linux/atmel-mci.h>
21 21
22#include <linux/platform_data/at91_adc.h>
23
22#include <linux/fb.h> 24#include <linux/fb.h>
23#include <video/atmel_lcdc.h> 25#include <video/atmel_lcdc.h>
24 26
27#include <mach/at91_adc.h>
25#include <mach/board.h> 28#include <mach/board.h>
26#include <mach/at91sam9g45.h> 29#include <mach/at91sam9g45.h>
27#include <mach/at91sam9g45_matrix.h> 30#include <mach/at91sam9g45_matrix.h>
@@ -69,15 +72,7 @@ static struct platform_device at_hdmac_device = {
69 72
70void __init at91_add_device_hdmac(void) 73void __init at91_add_device_hdmac(void)
71{ 74{
72#if defined(CONFIG_OF) 75 platform_device_register(&at_hdmac_device);
73 struct device_node *of_node =
74 of_find_node_by_name(NULL, "dma-controller");
75
76 if (of_node)
77 of_node_put(of_node);
78 else
79#endif
80 platform_device_register(&at_hdmac_device);
81} 76}
82#else 77#else
83void __init at91_add_device_hdmac(void) {} 78void __init at91_add_device_hdmac(void) {}
@@ -1094,25 +1089,8 @@ static struct platform_device at91sam9g45_tcb1_device = {
1094 .num_resources = ARRAY_SIZE(tcb1_resources), 1089 .num_resources = ARRAY_SIZE(tcb1_resources),
1095}; 1090};
1096 1091
1097#if defined(CONFIG_OF)
1098static struct of_device_id tcb_ids[] = {
1099 { .compatible = "atmel,at91rm9200-tcb" },
1100 { /*sentinel*/ }
1101};
1102#endif
1103
1104static void __init at91_add_device_tc(void) 1092static void __init at91_add_device_tc(void)
1105{ 1093{
1106#if defined(CONFIG_OF)
1107 struct device_node *np;
1108
1109 np = of_find_matching_node(NULL, tcb_ids);
1110 if (np) {
1111 of_node_put(np);
1112 return;
1113 }
1114#endif
1115
1116 platform_device_register(&at91sam9g45_tcb0_device); 1094 platform_device_register(&at91sam9g45_tcb0_device);
1117 platform_device_register(&at91sam9g45_tcb1_device); 1095 platform_device_register(&at91sam9g45_tcb1_device);
1118} 1096}
@@ -1207,6 +1185,104 @@ void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {}
1207 1185
1208 1186
1209/* -------------------------------------------------------------------- 1187/* --------------------------------------------------------------------
1188 * ADC
1189 * -------------------------------------------------------------------- */
1190
1191#if IS_ENABLED(CONFIG_AT91_ADC)
1192static struct at91_adc_data adc_data;
1193
1194static struct resource adc_resources[] = {
1195 [0] = {
1196 .start = AT91SAM9G45_BASE_TSC,
1197 .end = AT91SAM9G45_BASE_TSC + SZ_16K - 1,
1198 .flags = IORESOURCE_MEM,
1199 },
1200 [1] = {
1201 .start = AT91SAM9G45_ID_TSC,
1202 .end = AT91SAM9G45_ID_TSC,
1203 .flags = IORESOURCE_IRQ,
1204 }
1205};
1206
1207static struct platform_device at91_adc_device = {
1208 .name = "at91_adc",
1209 .id = -1,
1210 .dev = {
1211 .platform_data = &adc_data,
1212 },
1213 .resource = adc_resources,
1214 .num_resources = ARRAY_SIZE(adc_resources),
1215};
1216
1217static struct at91_adc_trigger at91_adc_triggers[] = {
1218 [0] = {
1219 .name = "external-rising",
1220 .value = 1,
1221 .is_external = true,
1222 },
1223 [1] = {
1224 .name = "external-falling",
1225 .value = 2,
1226 .is_external = true,
1227 },
1228 [2] = {
1229 .name = "external-any",
1230 .value = 3,
1231 .is_external = true,
1232 },
1233 [3] = {
1234 .name = "continuous",
1235 .value = 6,
1236 .is_external = false,
1237 },
1238};
1239
1240static struct at91_adc_reg_desc at91_adc_register_g45 = {
1241 .channel_base = AT91_ADC_CHR(0),
1242 .drdy_mask = AT91_ADC_DRDY,
1243 .status_register = AT91_ADC_SR,
1244 .trigger_register = 0x08,
1245};
1246
1247void __init at91_add_device_adc(struct at91_adc_data *data)
1248{
1249 if (!data)
1250 return;
1251
1252 if (test_bit(0, &data->channels_used))
1253 at91_set_gpio_input(AT91_PIN_PD20, 0);
1254 if (test_bit(1, &data->channels_used))
1255 at91_set_gpio_input(AT91_PIN_PD21, 0);
1256 if (test_bit(2, &data->channels_used))
1257 at91_set_gpio_input(AT91_PIN_PD22, 0);
1258 if (test_bit(3, &data->channels_used))
1259 at91_set_gpio_input(AT91_PIN_PD23, 0);
1260 if (test_bit(4, &data->channels_used))
1261 at91_set_gpio_input(AT91_PIN_PD24, 0);
1262 if (test_bit(5, &data->channels_used))
1263 at91_set_gpio_input(AT91_PIN_PD25, 0);
1264 if (test_bit(6, &data->channels_used))
1265 at91_set_gpio_input(AT91_PIN_PD26, 0);
1266 if (test_bit(7, &data->channels_used))
1267 at91_set_gpio_input(AT91_PIN_PD27, 0);
1268
1269 if (data->use_external_triggers)
1270 at91_set_A_periph(AT91_PIN_PD28, 0);
1271
1272 data->num_channels = 8;
1273 data->startup_time = 40;
1274 data->registers = &at91_adc_register_g45;
1275 data->trigger_number = 4;
1276 data->trigger_list = at91_adc_triggers;
1277
1278 adc_data = *data;
1279 platform_device_register(&at91_adc_device);
1280}
1281#else
1282void __init at91_add_device_adc(struct at91_adc_data *data) {}
1283#endif
1284
1285/* --------------------------------------------------------------------
1210 * RTT 1286 * RTT
1211 * -------------------------------------------------------------------- */ 1287 * -------------------------------------------------------------------- */
1212 1288
@@ -1741,14 +1817,6 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1741 at91_uarts[portnr] = pdev; 1817 at91_uarts[portnr] = pdev;
1742} 1818}
1743 1819
1744void __init at91_set_serial_console(unsigned portnr)
1745{
1746 if (portnr < ATMEL_MAX_UART) {
1747 atmel_default_console_device = at91_uarts[portnr];
1748 at91sam9g45_set_console_clock(at91_uarts[portnr]->id);
1749 }
1750}
1751
1752void __init at91_add_device_serial(void) 1820void __init at91_add_device_serial(void)
1753{ 1821{
1754 int i; 1822 int i;
@@ -1757,13 +1825,9 @@ void __init at91_add_device_serial(void)
1757 if (at91_uarts[i]) 1825 if (at91_uarts[i])
1758 platform_device_register(at91_uarts[i]); 1826 platform_device_register(at91_uarts[i]);
1759 } 1827 }
1760
1761 if (!atmel_default_console_device)
1762 printk(KERN_INFO "AT91: No default serial console defined.\n");
1763} 1828}
1764#else 1829#else
1765void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} 1830void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1766void __init at91_set_serial_console(unsigned portnr) {}
1767void __init at91_add_device_serial(void) {} 1831void __init at91_add_device_serial(void) {}
1768#endif 1832#endif
1769 1833
@@ -1775,6 +1839,9 @@ void __init at91_add_device_serial(void) {}
1775 */ 1839 */
1776static int __init at91_add_standard_devices(void) 1840static int __init at91_add_standard_devices(void)
1777{ 1841{
1842 if (of_have_populated_dt())
1843 return 0;
1844
1778 at91_add_device_hdmac(); 1845 at91_add_device_hdmac();
1779 at91_add_device_rtc(); 1846 at91_add_device_rtc();
1780 at91_add_device_rtt(); 1847 at91_add_device_rtt();
diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c
new file mode 100644
index 000000000000..08494664ab78
--- /dev/null
+++ b/arch/arm/mach-at91/at91sam9n12.c
@@ -0,0 +1,233 @@
1/*
2 * SoC specific setup code for the AT91SAM9N12
3 *
4 * Copyright (C) 2012 Atmel Corporation.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <linux/module.h>
10#include <linux/dma-mapping.h>
11
12#include <asm/irq.h>
13#include <asm/mach/arch.h>
14#include <asm/mach/map.h>
15#include <mach/at91sam9n12.h>
16#include <mach/at91_pmc.h>
17#include <mach/cpu.h>
18#include <mach/board.h>
19
20#include "soc.h"
21#include "generic.h"
22#include "clock.h"
23#include "sam9_smc.h"
24
25/* --------------------------------------------------------------------
26 * Clocks
27 * -------------------------------------------------------------------- */
28
29/*
30 * The peripheral clocks.
31 */
32static struct clk pioAB_clk = {
33 .name = "pioAB_clk",
34 .pmc_mask = 1 << AT91SAM9N12_ID_PIOAB,
35 .type = CLK_TYPE_PERIPHERAL,
36};
37static struct clk pioCD_clk = {
38 .name = "pioCD_clk",
39 .pmc_mask = 1 << AT91SAM9N12_ID_PIOCD,
40 .type = CLK_TYPE_PERIPHERAL,
41};
42static struct clk usart0_clk = {
43 .name = "usart0_clk",
44 .pmc_mask = 1 << AT91SAM9N12_ID_USART0,
45 .type = CLK_TYPE_PERIPHERAL,
46};
47static struct clk usart1_clk = {
48 .name = "usart1_clk",
49 .pmc_mask = 1 << AT91SAM9N12_ID_USART1,
50 .type = CLK_TYPE_PERIPHERAL,
51};
52static struct clk usart2_clk = {
53 .name = "usart2_clk",
54 .pmc_mask = 1 << AT91SAM9N12_ID_USART2,
55 .type = CLK_TYPE_PERIPHERAL,
56};
57static struct clk usart3_clk = {
58 .name = "usart3_clk",
59 .pmc_mask = 1 << AT91SAM9N12_ID_USART3,
60 .type = CLK_TYPE_PERIPHERAL,
61};
62static struct clk twi0_clk = {
63 .name = "twi0_clk",
64 .pmc_mask = 1 << AT91SAM9N12_ID_TWI0,
65 .type = CLK_TYPE_PERIPHERAL,
66};
67static struct clk twi1_clk = {
68 .name = "twi1_clk",
69 .pmc_mask = 1 << AT91SAM9N12_ID_TWI1,
70 .type = CLK_TYPE_PERIPHERAL,
71};
72static struct clk mmc_clk = {
73 .name = "mci_clk",
74 .pmc_mask = 1 << AT91SAM9N12_ID_MCI,
75 .type = CLK_TYPE_PERIPHERAL,
76};
77static struct clk spi0_clk = {
78 .name = "spi0_clk",
79 .pmc_mask = 1 << AT91SAM9N12_ID_SPI0,
80 .type = CLK_TYPE_PERIPHERAL,
81};
82static struct clk spi1_clk = {
83 .name = "spi1_clk",
84 .pmc_mask = 1 << AT91SAM9N12_ID_SPI1,
85 .type = CLK_TYPE_PERIPHERAL,
86};
87static struct clk uart0_clk = {
88 .name = "uart0_clk",
89 .pmc_mask = 1 << AT91SAM9N12_ID_UART0,
90 .type = CLK_TYPE_PERIPHERAL,
91};
92static struct clk uart1_clk = {
93 .name = "uart1_clk",
94 .pmc_mask = 1 << AT91SAM9N12_ID_UART1,
95 .type = CLK_TYPE_PERIPHERAL,
96};
97static struct clk tcb_clk = {
98 .name = "tcb_clk",
99 .pmc_mask = 1 << AT91SAM9N12_ID_TCB,
100 .type = CLK_TYPE_PERIPHERAL,
101};
102static struct clk pwm_clk = {
103 .name = "pwm_clk",
104 .pmc_mask = 1 << AT91SAM9N12_ID_PWM,
105 .type = CLK_TYPE_PERIPHERAL,
106};
107static struct clk adc_clk = {
108 .name = "adc_clk",
109 .pmc_mask = 1 << AT91SAM9N12_ID_ADC,
110 .type = CLK_TYPE_PERIPHERAL,
111};
112static struct clk dma_clk = {
113 .name = "dma_clk",
114 .pmc_mask = 1 << AT91SAM9N12_ID_DMA,
115 .type = CLK_TYPE_PERIPHERAL,
116};
117static struct clk uhp_clk = {
118 .name = "uhp",
119 .pmc_mask = 1 << AT91SAM9N12_ID_UHP,
120 .type = CLK_TYPE_PERIPHERAL,
121};
122static struct clk udp_clk = {
123 .name = "udp_clk",
124 .pmc_mask = 1 << AT91SAM9N12_ID_UDP,
125 .type = CLK_TYPE_PERIPHERAL,
126};
127static struct clk lcdc_clk = {
128 .name = "lcdc_clk",
129 .pmc_mask = 1 << AT91SAM9N12_ID_LCDC,
130 .type = CLK_TYPE_PERIPHERAL,
131};
132static struct clk ssc_clk = {
133 .name = "ssc_clk",
134 .pmc_mask = 1 << AT91SAM9N12_ID_SSC,
135 .type = CLK_TYPE_PERIPHERAL,
136};
137
138static struct clk *periph_clocks[] __initdata = {
139 &pioAB_clk,
140 &pioCD_clk,
141 &usart0_clk,
142 &usart1_clk,
143 &usart2_clk,
144 &usart3_clk,
145 &twi0_clk,
146 &twi1_clk,
147 &mmc_clk,
148 &spi0_clk,
149 &spi1_clk,
150 &lcdc_clk,
151 &uart0_clk,
152 &uart1_clk,
153 &tcb_clk,
154 &pwm_clk,
155 &adc_clk,
156 &dma_clk,
157 &uhp_clk,
158 &udp_clk,
159 &ssc_clk,
160};
161
162static struct clk_lookup periph_clocks_lookups[] = {
163 /* lookup table for DT entries */
164 CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
165 CLKDEV_CON_DEV_ID("usart", "f801c000.serial", &usart0_clk),
166 CLKDEV_CON_DEV_ID("usart", "f8020000.serial", &usart1_clk),
167 CLKDEV_CON_DEV_ID("usart", "f8024000.serial", &usart2_clk),
168 CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk),
169 CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb_clk),
170 CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb_clk),
171 CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma_clk),
172 CLKDEV_CON_ID("pioA", &pioAB_clk),
173 CLKDEV_CON_ID("pioB", &pioAB_clk),
174 CLKDEV_CON_ID("pioC", &pioCD_clk),
175 CLKDEV_CON_ID("pioD", &pioCD_clk),
176 /* additional fake clock for macb_hclk */
177 CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &uhp_clk),
178 CLKDEV_CON_DEV_ID("ohci_clk", "500000.ohci", &uhp_clk),
179};
180
181/*
182 * The two programmable clocks.
183 * You must configure pin multiplexing to bring these signals out.
184 */
185static struct clk pck0 = {
186 .name = "pck0",
187 .pmc_mask = AT91_PMC_PCK0,
188 .type = CLK_TYPE_PROGRAMMABLE,
189 .id = 0,
190};
191static struct clk pck1 = {
192 .name = "pck1",
193 .pmc_mask = AT91_PMC_PCK1,
194 .type = CLK_TYPE_PROGRAMMABLE,
195 .id = 1,
196};
197
198static void __init at91sam9n12_register_clocks(void)
199{
200 int i;
201
202 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
203 clk_register(periph_clocks[i]);
204 clk_register(&pck0);
205 clk_register(&pck1);
206
207 clkdev_add_table(periph_clocks_lookups,
208 ARRAY_SIZE(periph_clocks_lookups));
209
210}
211
212/* --------------------------------------------------------------------
213 * AT91SAM9N12 processor initialization
214 * -------------------------------------------------------------------- */
215
216static void __init at91sam9n12_map_io(void)
217{
218 at91_init_sram(0, AT91SAM9N12_SRAM_BASE, AT91SAM9N12_SRAM_SIZE);
219}
220
221void __init at91sam9n12_initialize(void)
222{
223 at91_extern_irq = (1 << AT91SAM9N12_ID_IRQ0);
224
225 /* Register GPIO subsystem (using DT) */
226 at91_gpio_init(NULL, 0);
227}
228
229struct at91_init_soc __initdata at91sam9n12_soc = {
230 .map_io = at91sam9n12_map_io,
231 .register_clocks = at91sam9n12_register_clocks,
232 .init = at91sam9n12_initialize,
233};
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index d9f2774f385e..e420085a57ef 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -232,18 +232,6 @@ static void __init at91sam9rl_register_clocks(void)
232 clk_register(&pck1); 232 clk_register(&pck1);
233} 233}
234 234
235static struct clk_lookup console_clock_lookup;
236
237void __init at91sam9rl_set_console_clock(int id)
238{
239 if (id >= ARRAY_SIZE(usart_clocks_lookups))
240 return;
241
242 console_clock_lookup.con_id = "usart";
243 console_clock_lookup.clk = usart_clocks_lookups[id].clk;
244 clkdev_add(&console_clock_lookup);
245}
246
247/* -------------------------------------------------------------------- 235/* --------------------------------------------------------------------
248 * GPIO 236 * GPIO
249 * -------------------------------------------------------------------- */ 237 * -------------------------------------------------------------------- */
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index fe4ae22e8561..9c0b1481a9a7 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -1192,14 +1192,6 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1192 at91_uarts[portnr] = pdev; 1192 at91_uarts[portnr] = pdev;
1193} 1193}
1194 1194
1195void __init at91_set_serial_console(unsigned portnr)
1196{
1197 if (portnr < ATMEL_MAX_UART) {
1198 atmel_default_console_device = at91_uarts[portnr];
1199 at91sam9rl_set_console_clock(at91_uarts[portnr]->id);
1200 }
1201}
1202
1203void __init at91_add_device_serial(void) 1195void __init at91_add_device_serial(void)
1204{ 1196{
1205 int i; 1197 int i;
@@ -1208,13 +1200,9 @@ void __init at91_add_device_serial(void)
1208 if (at91_uarts[i]) 1200 if (at91_uarts[i])
1209 platform_device_register(at91_uarts[i]); 1201 platform_device_register(at91_uarts[i]);
1210 } 1202 }
1211
1212 if (!atmel_default_console_device)
1213 printk(KERN_INFO "AT91: No default serial console defined.\n");
1214} 1203}
1215#else 1204#else
1216void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} 1205void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1217void __init at91_set_serial_console(unsigned portnr) {}
1218void __init at91_add_device_serial(void) {} 1206void __init at91_add_device_serial(void) {}
1219#endif 1207#endif
1220 1208
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index 13c8cae60462..1b144b4d3ce1 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -120,6 +120,11 @@ static struct clk adc_clk = {
120 .pmc_mask = 1 << AT91SAM9X5_ID_ADC, 120 .pmc_mask = 1 << AT91SAM9X5_ID_ADC,
121 .type = CLK_TYPE_PERIPHERAL, 121 .type = CLK_TYPE_PERIPHERAL,
122}; 122};
123static struct clk adc_op_clk = {
124 .name = "adc_op_clk",
125 .type = CLK_TYPE_PERIPHERAL,
126 .rate_hz = 5000000,
127};
123static struct clk dma0_clk = { 128static struct clk dma0_clk = {
124 .name = "dma0_clk", 129 .name = "dma0_clk",
125 .pmc_mask = 1 << AT91SAM9X5_ID_DMA0, 130 .pmc_mask = 1 << AT91SAM9X5_ID_DMA0,
@@ -205,6 +210,7 @@ static struct clk *periph_clocks[] __initdata = {
205 &tcb0_clk, 210 &tcb0_clk,
206 &pwm_clk, 211 &pwm_clk,
207 &adc_clk, 212 &adc_clk,
213 &adc_op_clk,
208 &dma0_clk, 214 &dma0_clk,
209 &dma1_clk, 215 &dma1_clk,
210 &uhphs_clk, 216 &uhphs_clk,
diff --git a/arch/arm/mach-at91/board-1arm.c b/arch/arm/mach-at91/board-1arm.c
index 2628384aaae1..271f994314a4 100644
--- a/arch/arm/mach-at91/board-1arm.c
+++ b/arch/arm/mach-at91/board-1arm.c
@@ -47,20 +47,6 @@ static void __init onearm_init_early(void)
47 47
48 /* Initialize processor: 18.432 MHz crystal */ 48 /* Initialize processor: 18.432 MHz crystal */
49 at91_initialize(18432000); 49 at91_initialize(18432000);
50
51 /* DBGU on ttyS0. (Rx & Tx only) */
52 at91_register_uart(0, 0, 0);
53
54 /* USART0 on ttyS1 (Rx, Tx, CTS, RTS) */
55 at91_register_uart(AT91RM9200_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
56
57 /* USART1 on ttyS2 (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
58 at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS
59 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
60 | ATMEL_UART_RI);
61
62 /* set serial console to ttyS0 (ie, DBGU) */
63 at91_set_serial_console(0);
64} 50}
65 51
66static struct macb_platform_data __initdata onearm_eth_data = { 52static struct macb_platform_data __initdata onearm_eth_data = {
@@ -82,6 +68,16 @@ static struct at91_udc_data __initdata onearm_udc_data = {
82static void __init onearm_board_init(void) 68static void __init onearm_board_init(void)
83{ 69{
84 /* Serial */ 70 /* Serial */
71 /* DBGU on ttyS0. (Rx & Tx only) */
72 at91_register_uart(0, 0, 0);
73
74 /* USART0 on ttyS1 (Rx, Tx, CTS, RTS) */
75 at91_register_uart(AT91RM9200_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
76
77 /* USART1 on ttyS2 (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
78 at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS
79 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
80 | ATMEL_UART_RI);
85 at91_add_device_serial(); 81 at91_add_device_serial();
86 /* Ethernet */ 82 /* Ethernet */
87 at91_add_device_eth(&onearm_eth_data); 83 at91_add_device_eth(&onearm_eth_data);
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
index 161efbaa1029..b7d8aa7b81e6 100644
--- a/arch/arm/mach-at91/board-afeb-9260v1.c
+++ b/arch/arm/mach-at91/board-afeb-9260v1.c
@@ -52,22 +52,6 @@ static void __init afeb9260_init_early(void)
52{ 52{
53 /* Initialize processor: 18.432 MHz crystal */ 53 /* Initialize processor: 18.432 MHz crystal */
54 at91_initialize(18432000); 54 at91_initialize(18432000);
55
56 /* DBGU on ttyS0. (Rx & Tx only) */
57 at91_register_uart(0, 0, 0);
58
59 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
60 at91_register_uart(AT91SAM9260_ID_US0, 1,
61 ATMEL_UART_CTS | ATMEL_UART_RTS
62 | ATMEL_UART_DTR | ATMEL_UART_DSR
63 | ATMEL_UART_DCD | ATMEL_UART_RI);
64
65 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
66 at91_register_uart(AT91SAM9260_ID_US1, 2,
67 ATMEL_UART_CTS | ATMEL_UART_RTS);
68
69 /* set serial console to ttyS0 (ie, DBGU) */
70 at91_set_serial_console(0);
71} 55}
72 56
73/* 57/*
@@ -183,6 +167,18 @@ static struct at91_cf_data afeb9260_cf_data = {
183static void __init afeb9260_board_init(void) 167static void __init afeb9260_board_init(void)
184{ 168{
185 /* Serial */ 169 /* Serial */
170 /* DBGU on ttyS0. (Rx & Tx only) */
171 at91_register_uart(0, 0, 0);
172
173 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
174 at91_register_uart(AT91SAM9260_ID_US0, 1,
175 ATMEL_UART_CTS | ATMEL_UART_RTS
176 | ATMEL_UART_DTR | ATMEL_UART_DSR
177 | ATMEL_UART_DCD | ATMEL_UART_RI);
178
179 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
180 at91_register_uart(AT91SAM9260_ID_US1, 2,
181 ATMEL_UART_CTS | ATMEL_UART_RTS);
186 at91_add_device_serial(); 182 at91_add_device_serial();
187 /* USB Host */ 183 /* USB Host */
188 at91_add_device_usbh(&afeb9260_usbh_data); 184 at91_add_device_usbh(&afeb9260_usbh_data);
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c
index c6d44ee0c77e..29d3ef0a50fb 100644
--- a/arch/arm/mach-at91/board-cam60.c
+++ b/arch/arm/mach-at91/board-cam60.c
@@ -49,12 +49,6 @@ static void __init cam60_init_early(void)
49{ 49{
50 /* Initialize processor: 10 MHz crystal */ 50 /* Initialize processor: 10 MHz crystal */
51 at91_initialize(10000000); 51 at91_initialize(10000000);
52
53 /* DBGU on ttyS0. (Rx & Tx only) */
54 at91_register_uart(0, 0, 0);
55
56 /* set serial console to ttyS0 (ie, DBGU) */
57 at91_set_serial_console(0);
58} 52}
59 53
60/* 54/*
@@ -175,6 +169,8 @@ static void __init cam60_add_device_nand(void)
175static void __init cam60_board_init(void) 169static void __init cam60_board_init(void)
176{ 170{
177 /* Serial */ 171 /* Serial */
172 /* DBGU on ttyS0. (Rx & Tx only) */
173 at91_register_uart(0, 0, 0);
178 at91_add_device_serial(); 174 at91_add_device_serial();
179 /* SPI */ 175 /* SPI */
180 at91_add_device_spi(cam60_spi_devices, ARRAY_SIZE(cam60_spi_devices)); 176 at91_add_device_spi(cam60_spi_devices, ARRAY_SIZE(cam60_spi_devices));
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index 59d9cf997537..44328a6d4609 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -44,17 +44,6 @@ static void __init carmeva_init_early(void)
44{ 44{
45 /* Initialize processor: 20.000 MHz crystal */ 45 /* Initialize processor: 20.000 MHz crystal */
46 at91_initialize(20000000); 46 at91_initialize(20000000);
47
48 /* DBGU on ttyS0. (Rx & Tx only) */
49 at91_register_uart(0, 0, 0);
50
51 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
52 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
53 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
54 | ATMEL_UART_RI);
55
56 /* set serial console to ttyS0 (ie, DBGU) */
57 at91_set_serial_console(0);
58} 47}
59 48
60static struct macb_platform_data __initdata carmeva_eth_data = { 49static struct macb_platform_data __initdata carmeva_eth_data = {
@@ -139,6 +128,13 @@ static struct gpio_led carmeva_leds[] = {
139static void __init carmeva_board_init(void) 128static void __init carmeva_board_init(void)
140{ 129{
141 /* Serial */ 130 /* Serial */
131 /* DBGU on ttyS0. (Rx & Tx only) */
132 at91_register_uart(0, 0, 0);
133
134 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
135 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
136 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
137 | ATMEL_UART_RI);
142 at91_add_device_serial(); 138 at91_add_device_serial();
143 /* Ethernet */ 139 /* Ethernet */
144 at91_add_device_eth(&carmeva_eth_data); 140 at91_add_device_eth(&carmeva_eth_data);
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c
index 5f3680e7c883..69951ec7dbf3 100644
--- a/arch/arm/mach-at91/board-cpu9krea.c
+++ b/arch/arm/mach-at91/board-cpu9krea.c
@@ -52,34 +52,6 @@ static void __init cpu9krea_init_early(void)
52{ 52{
53 /* Initialize processor: 18.432 MHz crystal */ 53 /* Initialize processor: 18.432 MHz crystal */
54 at91_initialize(18432000); 54 at91_initialize(18432000);
55
56 /* DGBU on ttyS0. (Rx & Tx only) */
57 at91_register_uart(0, 0, 0);
58
59 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
60 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS |
61 ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DSR |
62 ATMEL_UART_DCD | ATMEL_UART_RI);
63
64 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
65 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS |
66 ATMEL_UART_RTS);
67
68 /* USART2 on ttyS3. (Rx, Tx, RTS, CTS) */
69 at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS |
70 ATMEL_UART_RTS);
71
72 /* USART3 on ttyS4. (Rx, Tx) */
73 at91_register_uart(AT91SAM9260_ID_US3, 4, 0);
74
75 /* USART4 on ttyS5. (Rx, Tx) */
76 at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
77
78 /* USART5 on ttyS6. (Rx, Tx) */
79 at91_register_uart(AT91SAM9260_ID_US5, 6, 0);
80
81 /* set serial console to ttyS0 (ie, DBGU) */
82 at91_set_serial_console(0);
83} 55}
84 56
85/* 57/*
@@ -352,6 +324,30 @@ static void __init cpu9krea_board_init(void)
352 /* NOR */ 324 /* NOR */
353 cpu9krea_add_device_nor(); 325 cpu9krea_add_device_nor();
354 /* Serial */ 326 /* Serial */
327 /* DGBU on ttyS0. (Rx & Tx only) */
328 at91_register_uart(0, 0, 0);
329
330 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
331 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS |
332 ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DSR |
333 ATMEL_UART_DCD | ATMEL_UART_RI);
334
335 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
336 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS |
337 ATMEL_UART_RTS);
338
339 /* USART2 on ttyS3. (Rx, Tx, RTS, CTS) */
340 at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS |
341 ATMEL_UART_RTS);
342
343 /* USART3 on ttyS4. (Rx, Tx) */
344 at91_register_uart(AT91SAM9260_ID_US3, 4, 0);
345
346 /* USART4 on ttyS5. (Rx, Tx) */
347 at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
348
349 /* USART5 on ttyS6. (Rx, Tx) */
350 at91_register_uart(AT91SAM9260_ID_US5, 6, 0);
355 at91_add_device_serial(); 351 at91_add_device_serial();
356 /* USB Host */ 352 /* USB Host */
357 at91_add_device_usbh(&cpu9krea_usbh_data); 353 at91_add_device_usbh(&cpu9krea_usbh_data);
diff --git a/arch/arm/mach-at91/board-cpuat91.c b/arch/arm/mach-at91/board-cpuat91.c
index e094cc81fe25..895cf2dba612 100644
--- a/arch/arm/mach-at91/board-cpuat91.c
+++ b/arch/arm/mach-at91/board-cpuat91.c
@@ -59,28 +59,6 @@ static void __init cpuat91_init_early(void)
59 59
60 /* Initialize processor: 18.432 MHz crystal */ 60 /* Initialize processor: 18.432 MHz crystal */
61 at91_initialize(18432000); 61 at91_initialize(18432000);
62
63 /* DBGU on ttyS0. (Rx & Tx only) */
64 at91_register_uart(0, 0, 0);
65
66 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */
67 at91_register_uart(AT91RM9200_ID_US0, 1, ATMEL_UART_CTS |
68 ATMEL_UART_RTS);
69
70 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
71 at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS |
72 ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DSR |
73 ATMEL_UART_DCD | ATMEL_UART_RI);
74
75 /* USART2 on ttyS3 (Rx, Tx) */
76 at91_register_uart(AT91RM9200_ID_US2, 3, 0);
77
78 /* USART3 on ttyS4 (Rx, Tx, CTS, RTS) */
79 at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_CTS |
80 ATMEL_UART_RTS);
81
82 /* set serial console to ttyS0 (ie, DBGU) */
83 at91_set_serial_console(0);
84} 62}
85 63
86static struct macb_platform_data __initdata cpuat91_eth_data = { 64static struct macb_platform_data __initdata cpuat91_eth_data = {
@@ -161,6 +139,24 @@ static struct platform_device *platform_devices[] __initdata = {
161static void __init cpuat91_board_init(void) 139static void __init cpuat91_board_init(void)
162{ 140{
163 /* Serial */ 141 /* Serial */
142 /* DBGU on ttyS0. (Rx & Tx only) */
143 at91_register_uart(0, 0, 0);
144
145 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */
146 at91_register_uart(AT91RM9200_ID_US0, 1, ATMEL_UART_CTS |
147 ATMEL_UART_RTS);
148
149 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
150 at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS |
151 ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DSR |
152 ATMEL_UART_DCD | ATMEL_UART_RI);
153
154 /* USART2 on ttyS3 (Rx, Tx) */
155 at91_register_uart(AT91RM9200_ID_US2, 3, 0);
156
157 /* USART3 on ttyS4 (Rx, Tx, CTS, RTS) */
158 at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_CTS |
159 ATMEL_UART_RTS);
164 at91_add_device_serial(); 160 at91_add_device_serial();
165 /* LEDs. */ 161 /* LEDs. */
166 at91_gpio_leds(cpuat91_leds, ARRAY_SIZE(cpuat91_leds)); 162 at91_gpio_leds(cpuat91_leds, ARRAY_SIZE(cpuat91_leds));
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index 1a1547b1ce4e..cd813361cd26 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -47,15 +47,6 @@ static void __init csb337_init_early(void)
47{ 47{
48 /* Initialize processor: 3.6864 MHz crystal */ 48 /* Initialize processor: 3.6864 MHz crystal */
49 at91_initialize(3686400); 49 at91_initialize(3686400);
50
51 /* Setup the LEDs */
52 at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
53
54 /* DBGU on ttyS0 */
55 at91_register_uart(0, 0, 0);
56
57 /* make console=ttyS0 the default */
58 at91_set_serial_console(0);
59} 50}
60 51
61static struct macb_platform_data __initdata csb337_eth_data = { 52static struct macb_platform_data __initdata csb337_eth_data = {
@@ -228,7 +219,11 @@ static struct gpio_led csb_leds[] = {
228 219
229static void __init csb337_board_init(void) 220static void __init csb337_board_init(void)
230{ 221{
222 /* Setup the LEDs */
223 at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
231 /* Serial */ 224 /* Serial */
225 /* DBGU on ttyS0 */
226 at91_register_uart(0, 0, 0);
232 at91_add_device_serial(); 227 at91_add_device_serial();
233 /* Ethernet */ 228 /* Ethernet */
234 at91_add_device_eth(&csb337_eth_data); 229 at91_add_device_eth(&csb337_eth_data);
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index f650bf39455d..7c8b05a57d7f 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -44,12 +44,6 @@ static void __init csb637_init_early(void)
44{ 44{
45 /* Initialize processor: 3.6864 MHz crystal */ 45 /* Initialize processor: 3.6864 MHz crystal */
46 at91_initialize(3686400); 46 at91_initialize(3686400);
47
48 /* DBGU on ttyS0. (Rx & Tx only) */
49 at91_register_uart(0, 0, 0);
50
51 /* make console=ttyS0 (ie, DBGU) the default */
52 at91_set_serial_console(0);
53} 47}
54 48
55static struct macb_platform_data __initdata csb637_eth_data = { 49static struct macb_platform_data __initdata csb637_eth_data = {
@@ -118,6 +112,8 @@ static void __init csb637_board_init(void)
118 /* LED(s) */ 112 /* LED(s) */
119 at91_gpio_leds(csb_leds, ARRAY_SIZE(csb_leds)); 113 at91_gpio_leds(csb_leds, ARRAY_SIZE(csb_leds));
120 /* Serial */ 114 /* Serial */
115 /* DBGU on ttyS0. (Rx & Tx only) */
116 at91_register_uart(0, 0, 0);
121 at91_add_device_serial(); 117 at91_add_device_serial();
122 /* Ethernet */ 118 /* Ethernet */
123 at91_add_device_eth(&csb637_eth_data); 119 at91_add_device_eth(&csb637_eth_data);
diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c
index c18d4d307801..a1fce05aa7a5 100644
--- a/arch/arm/mach-at91/board-dt.c
+++ b/arch/arm/mach-at91/board-dt.c
@@ -1,10 +1,6 @@
1/* 1/*
2 * Setup code for AT91SAM Evaluation Kits with Device Tree support 2 * Setup code for AT91SAM Evaluation Kits with Device Tree support
3 * 3 *
4 * Covers: * AT91SAM9G45-EKES board
5 * * AT91SAM9M10-EKES board
6 * * AT91SAM9M10G45-EK board
7 *
8 * Copyright (C) 2011 Atmel, 4 * Copyright (C) 2011 Atmel,
9 * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> 5 * 2011 Nicolas Ferre <nicolas.ferre@atmel.com>
10 * 6 *
@@ -49,9 +45,7 @@ static void __init at91_dt_device_init(void)
49} 45}
50 46
51static const char *at91_dt_board_compat[] __initdata = { 47static const char *at91_dt_board_compat[] __initdata = {
52 "atmel,at91sam9m10g45ek", 48 "atmel,at91sam9",
53 "atmel,at91sam9x5ek",
54 "calao,usb-a9g20",
55 NULL 49 NULL
56}; 50};
57 51
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index d302ca3eeb64..bd1017297989 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -44,20 +44,6 @@ static void __init eb9200_init_early(void)
44{ 44{
45 /* Initialize processor: 18.432 MHz crystal */ 45 /* Initialize processor: 18.432 MHz crystal */
46 at91_initialize(18432000); 46 at91_initialize(18432000);
47
48 /* DBGU on ttyS0. (Rx & Tx only) */
49 at91_register_uart(0, 0, 0);
50
51 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
52 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
53 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
54 | ATMEL_UART_RI);
55
56 /* USART2 on ttyS2. (Rx, Tx) - IRDA */
57 at91_register_uart(AT91RM9200_ID_US2, 2, 0);
58
59 /* set serial console to ttyS0 (ie, DBGU) */
60 at91_set_serial_console(0);
61} 47}
62 48
63static struct macb_platform_data __initdata eb9200_eth_data = { 49static struct macb_platform_data __initdata eb9200_eth_data = {
@@ -101,6 +87,16 @@ static struct i2c_board_info __initdata eb9200_i2c_devices[] = {
101static void __init eb9200_board_init(void) 87static void __init eb9200_board_init(void)
102{ 88{
103 /* Serial */ 89 /* Serial */
90 /* DBGU on ttyS0. (Rx & Tx only) */
91 at91_register_uart(0, 0, 0);
92
93 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
94 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
95 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
96 | ATMEL_UART_RI);
97
98 /* USART2 on ttyS2. (Rx, Tx) - IRDA */
99 at91_register_uart(AT91RM9200_ID_US2, 2, 0);
104 at91_add_device_serial(); 100 at91_add_device_serial();
105 /* Ethernet */ 101 /* Ethernet */
106 at91_add_device_eth(&eb9200_eth_data); 102 at91_add_device_eth(&eb9200_eth_data);
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c
index 69966ce4d776..89cc3726a9ce 100644
--- a/arch/arm/mach-at91/board-ecbat91.c
+++ b/arch/arm/mach-at91/board-ecbat91.c
@@ -50,18 +50,6 @@ static void __init ecb_at91init_early(void)
50 50
51 /* Initialize processor: 18.432 MHz crystal */ 51 /* Initialize processor: 18.432 MHz crystal */
52 at91_initialize(18432000); 52 at91_initialize(18432000);
53
54 /* Setup the LEDs */
55 at91_init_leds(AT91_PIN_PC7, AT91_PIN_PC7);
56
57 /* DBGU on ttyS0. (Rx & Tx only) */
58 at91_register_uart(0, 0, 0);
59
60 /* USART0 on ttyS1. (Rx & Tx only) */
61 at91_register_uart(AT91RM9200_ID_US0, 1, 0);
62
63 /* set serial console to ttyS0 (ie, DBGU) */
64 at91_set_serial_console(0);
65} 53}
66 54
67static struct macb_platform_data __initdata ecb_at91eth_data = { 55static struct macb_platform_data __initdata ecb_at91eth_data = {
@@ -151,7 +139,15 @@ static struct spi_board_info __initdata ecb_at91spi_devices[] = {
151 139
152static void __init ecb_at91board_init(void) 140static void __init ecb_at91board_init(void)
153{ 141{
142 /* Setup the LEDs */
143 at91_init_leds(AT91_PIN_PC7, AT91_PIN_PC7);
144
154 /* Serial */ 145 /* Serial */
146 /* DBGU on ttyS0. (Rx & Tx only) */
147 at91_register_uart(0, 0, 0);
148
149 /* USART0 on ttyS1. (Rx & Tx only) */
150 at91_register_uart(AT91RM9200_ID_US0, 1, 0);
155 at91_add_device_serial(); 151 at91_add_device_serial();
156 152
157 /* Ethernet */ 153 /* Ethernet */
diff --git a/arch/arm/mach-at91/board-eco920.c b/arch/arm/mach-at91/board-eco920.c
index f23aabef8551..558546cf63f4 100644
--- a/arch/arm/mach-at91/board-eco920.c
+++ b/arch/arm/mach-at91/board-eco920.c
@@ -37,15 +37,6 @@ static void __init eco920_init_early(void)
37 at91rm9200_set_type(ARCH_REVISON_9200_PQFP); 37 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
38 38
39 at91_initialize(18432000); 39 at91_initialize(18432000);
40
41 /* Setup the LEDs */
42 at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
43
44 /* DBGU on ttyS0. (Rx & Tx only */
45 at91_register_uart(0, 0, 0);
46
47 /* set serial console to ttyS0 (ie, DBGU) */
48 at91_set_serial_console(0);
49} 40}
50 41
51static struct macb_platform_data __initdata eco920_eth_data = { 42static struct macb_platform_data __initdata eco920_eth_data = {
@@ -103,6 +94,10 @@ static struct spi_board_info eco920_spi_devices[] = {
103 94
104static void __init eco920_board_init(void) 95static void __init eco920_board_init(void)
105{ 96{
97 /* Setup the LEDs */
98 at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
99 /* DBGU on ttyS0. (Rx & Tx only */
100 at91_register_uart(0, 0, 0);
106 at91_add_device_serial(); 101 at91_add_device_serial();
107 at91_add_device_eth(&eco920_eth_data); 102 at91_add_device_eth(&eco920_eth_data);
108 at91_add_device_usbh(&eco920_usbh_data); 103 at91_add_device_usbh(&eco920_usbh_data);
diff --git a/arch/arm/mach-at91/board-flexibity.c b/arch/arm/mach-at91/board-flexibity.c
index 1815152001f7..47658f78105d 100644
--- a/arch/arm/mach-at91/board-flexibity.c
+++ b/arch/arm/mach-at91/board-flexibity.c
@@ -41,12 +41,6 @@ static void __init flexibity_init_early(void)
41{ 41{
42 /* Initialize processor: 18.432 MHz crystal */ 42 /* Initialize processor: 18.432 MHz crystal */
43 at91_initialize(18432000); 43 at91_initialize(18432000);
44
45 /* DBGU on ttyS0. (Rx & Tx only) */
46 at91_register_uart(0, 0, 0);
47
48 /* set serial console to ttyS0 (ie, DBGU) */
49 at91_set_serial_console(0);
50} 44}
51 45
52/* USB Host port */ 46/* USB Host port */
@@ -143,6 +137,8 @@ static struct gpio_led flexibity_leds[] = {
143static void __init flexibity_board_init(void) 137static void __init flexibity_board_init(void)
144{ 138{
145 /* Serial */ 139 /* Serial */
140 /* DBGU on ttyS0. (Rx & Tx only) */
141 at91_register_uart(0, 0, 0);
146 at91_add_device_serial(); 142 at91_add_device_serial();
147 /* USB Host */ 143 /* USB Host */
148 at91_add_device_usbh(&flexibity_usbh_data); 144 at91_add_device_usbh(&flexibity_usbh_data);
diff --git a/arch/arm/mach-at91/board-foxg20.c b/arch/arm/mach-at91/board-foxg20.c
index caf017f0f4ee..33411e6ecb1f 100644
--- a/arch/arm/mach-at91/board-foxg20.c
+++ b/arch/arm/mach-at91/board-foxg20.c
@@ -61,44 +61,6 @@ static void __init foxg20_init_early(void)
61{ 61{
62 /* Initialize processor: 18.432 MHz crystal */ 62 /* Initialize processor: 18.432 MHz crystal */
63 at91_initialize(18432000); 63 at91_initialize(18432000);
64
65 /* DBGU on ttyS0. (Rx & Tx only) */
66 at91_register_uart(0, 0, 0);
67
68 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
69 at91_register_uart(AT91SAM9260_ID_US0, 1,
70 ATMEL_UART_CTS
71 | ATMEL_UART_RTS
72 | ATMEL_UART_DTR
73 | ATMEL_UART_DSR
74 | ATMEL_UART_DCD
75 | ATMEL_UART_RI);
76
77 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
78 at91_register_uart(AT91SAM9260_ID_US1, 2,
79 ATMEL_UART_CTS
80 | ATMEL_UART_RTS);
81
82 /* USART2 on ttyS3. (Rx & Tx only) */
83 at91_register_uart(AT91SAM9260_ID_US2, 3, 0);
84
85 /* USART3 on ttyS4. (Rx, Tx, RTS, CTS) */
86 at91_register_uart(AT91SAM9260_ID_US3, 4,
87 ATMEL_UART_CTS
88 | ATMEL_UART_RTS);
89
90 /* USART4 on ttyS5. (Rx & Tx only) */
91 at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
92
93 /* USART5 on ttyS6. (Rx & Tx only) */
94 at91_register_uart(AT91SAM9260_ID_US5, 6, 0);
95
96 /* set serial console to ttyS0 (ie, DBGU) */
97 at91_set_serial_console(0);
98
99 /* Set the internal pull-up resistor on DRXD */
100 at91_set_A_periph(AT91_PIN_PB14, 1);
101
102} 64}
103 65
104/* 66/*
@@ -241,6 +203,39 @@ static struct i2c_board_info __initdata foxg20_i2c_devices[] = {
241static void __init foxg20_board_init(void) 203static void __init foxg20_board_init(void)
242{ 204{
243 /* Serial */ 205 /* Serial */
206 /* DBGU on ttyS0. (Rx & Tx only) */
207 at91_register_uart(0, 0, 0);
208
209 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
210 at91_register_uart(AT91SAM9260_ID_US0, 1,
211 ATMEL_UART_CTS
212 | ATMEL_UART_RTS
213 | ATMEL_UART_DTR
214 | ATMEL_UART_DSR
215 | ATMEL_UART_DCD
216 | ATMEL_UART_RI);
217
218 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
219 at91_register_uart(AT91SAM9260_ID_US1, 2,
220 ATMEL_UART_CTS
221 | ATMEL_UART_RTS);
222
223 /* USART2 on ttyS3. (Rx & Tx only) */
224 at91_register_uart(AT91SAM9260_ID_US2, 3, 0);
225
226 /* USART3 on ttyS4. (Rx, Tx, RTS, CTS) */
227 at91_register_uart(AT91SAM9260_ID_US3, 4,
228 ATMEL_UART_CTS
229 | ATMEL_UART_RTS);
230
231 /* USART4 on ttyS5. (Rx & Tx only) */
232 at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
233
234 /* USART5 on ttyS6. (Rx & Tx only) */
235 at91_register_uart(AT91SAM9260_ID_US5, 6, 0);
236
237 /* Set the internal pull-up resistor on DRXD */
238 at91_set_A_periph(AT91_PIN_PB14, 1);
244 at91_add_device_serial(); 239 at91_add_device_serial();
245 /* USB Host */ 240 /* USB Host */
246 at91_add_device_usbh(&foxg20_usbh_data); 241 at91_add_device_usbh(&foxg20_usbh_data);
diff --git a/arch/arm/mach-at91/board-gsia18s.c b/arch/arm/mach-at91/board-gsia18s.c
index 230e71969fb7..3e0dfa643a86 100644
--- a/arch/arm/mach-at91/board-gsia18s.c
+++ b/arch/arm/mach-at91/board-gsia18s.c
@@ -41,38 +41,6 @@
41static void __init gsia18s_init_early(void) 41static void __init gsia18s_init_early(void)
42{ 42{
43 stamp9g20_init_early(); 43 stamp9g20_init_early();
44
45 /*
46 * USART0 on ttyS1 (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI).
47 * Used for Internal Analog Modem.
48 */
49 at91_register_uart(AT91SAM9260_ID_US0, 1,
50 ATMEL_UART_CTS | ATMEL_UART_RTS |
51 ATMEL_UART_DTR | ATMEL_UART_DSR |
52 ATMEL_UART_DCD | ATMEL_UART_RI);
53 /*
54 * USART1 on ttyS2 (Rx, Tx, CTS, RTS).
55 * Used for GPS or WiFi or Data stream.
56 */
57 at91_register_uart(AT91SAM9260_ID_US1, 2,
58 ATMEL_UART_CTS | ATMEL_UART_RTS);
59 /*
60 * USART2 on ttyS3 (Rx, Tx, CTS, RTS).
61 * Used for External Modem.
62 */
63 at91_register_uart(AT91SAM9260_ID_US2, 3,
64 ATMEL_UART_CTS | ATMEL_UART_RTS);
65 /*
66 * USART3 on ttyS4 (Rx, Tx, RTS).
67 * Used for RS-485.
68 */
69 at91_register_uart(AT91SAM9260_ID_US3, 4, ATMEL_UART_RTS);
70
71 /*
72 * USART4 on ttyS5 (Rx, Tx).
73 * Used for TRX433 Radio Module.
74 */
75 at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
76} 44}
77 45
78/* 46/*
@@ -558,6 +526,37 @@ static int __init gsia18s_power_off_init(void)
558 526
559static void __init gsia18s_board_init(void) 527static void __init gsia18s_board_init(void)
560{ 528{
529 /*
530 * USART0 on ttyS1 (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI).
531 * Used for Internal Analog Modem.
532 */
533 at91_register_uart(AT91SAM9260_ID_US0, 1,
534 ATMEL_UART_CTS | ATMEL_UART_RTS |
535 ATMEL_UART_DTR | ATMEL_UART_DSR |
536 ATMEL_UART_DCD | ATMEL_UART_RI);
537 /*
538 * USART1 on ttyS2 (Rx, Tx, CTS, RTS).
539 * Used for GPS or WiFi or Data stream.
540 */
541 at91_register_uart(AT91SAM9260_ID_US1, 2,
542 ATMEL_UART_CTS | ATMEL_UART_RTS);
543 /*
544 * USART2 on ttyS3 (Rx, Tx, CTS, RTS).
545 * Used for External Modem.
546 */
547 at91_register_uart(AT91SAM9260_ID_US2, 3,
548 ATMEL_UART_CTS | ATMEL_UART_RTS);
549 /*
550 * USART3 on ttyS4 (Rx, Tx, RTS).
551 * Used for RS-485.
552 */
553 at91_register_uart(AT91SAM9260_ID_US3, 4, ATMEL_UART_RTS);
554
555 /*
556 * USART4 on ttyS5 (Rx, Tx).
557 * Used for TRX433 Radio Module.
558 */
559 at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
561 stamp9g20_board_init(); 560 stamp9g20_board_init();
562 at91_add_device_usbh(&usbh_data); 561 at91_add_device_usbh(&usbh_data);
563 at91_add_device_udc(&udc_data); 562 at91_add_device_udc(&udc_data);
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c
index efde1b2327c8..f260657f32bc 100644
--- a/arch/arm/mach-at91/board-kafa.c
+++ b/arch/arm/mach-at91/board-kafa.c
@@ -47,18 +47,6 @@ static void __init kafa_init_early(void)
47 47
48 /* Initialize processor: 18.432 MHz crystal */ 48 /* Initialize processor: 18.432 MHz crystal */
49 at91_initialize(18432000); 49 at91_initialize(18432000);
50
51 /* Set up the LEDs */
52 at91_init_leds(AT91_PIN_PB4, AT91_PIN_PB4);
53
54 /* DBGU on ttyS0. (Rx & Tx only) */
55 at91_register_uart(0, 0, 0);
56
57 /* USART0 on ttyS1 (Rx, Tx, CTS, RTS) */
58 at91_register_uart(AT91RM9200_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
59
60 /* set serial console to ttyS0 (ie, DBGU) */
61 at91_set_serial_console(0);
62} 50}
63 51
64static struct macb_platform_data __initdata kafa_eth_data = { 52static struct macb_platform_data __initdata kafa_eth_data = {
@@ -79,7 +67,15 @@ static struct at91_udc_data __initdata kafa_udc_data = {
79 67
80static void __init kafa_board_init(void) 68static void __init kafa_board_init(void)
81{ 69{
70 /* Set up the LEDs */
71 at91_init_leds(AT91_PIN_PB4, AT91_PIN_PB4);
72
82 /* Serial */ 73 /* Serial */
74 /* DBGU on ttyS0. (Rx & Tx only) */
75 at91_register_uart(0, 0, 0);
76
77 /* USART0 on ttyS1 (Rx, Tx, CTS, RTS) */
78 at91_register_uart(AT91RM9200_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
83 at91_add_device_serial(); 79 at91_add_device_serial();
84 /* Ethernet */ 80 /* Ethernet */
85 at91_add_device_eth(&kafa_eth_data); 81 at91_add_device_eth(&kafa_eth_data);
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index 59b92aab9bcf..ba39db5482b9 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -50,24 +50,6 @@ static void __init kb9202_init_early(void)
50 50
51 /* Initialize processor: 10 MHz crystal */ 51 /* Initialize processor: 10 MHz crystal */
52 at91_initialize(10000000); 52 at91_initialize(10000000);
53
54 /* Set up the LEDs */
55 at91_init_leds(AT91_PIN_PC19, AT91_PIN_PC18);
56
57 /* DBGU on ttyS0. (Rx & Tx only) */
58 at91_register_uart(0, 0, 0);
59
60 /* USART0 on ttyS1 (Rx & Tx only) */
61 at91_register_uart(AT91RM9200_ID_US0, 1, 0);
62
63 /* USART1 on ttyS2 (Rx & Tx only) - IRDA (optional) */
64 at91_register_uart(AT91RM9200_ID_US1, 2, 0);
65
66 /* USART3 on ttyS3 (Rx, Tx, CTS, RTS) - RS485 (optional) */
67 at91_register_uart(AT91RM9200_ID_US3, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
68
69 /* set serial console to ttyS0 (ie, DBGU) */
70 at91_set_serial_console(0);
71} 53}
72 54
73static struct macb_platform_data __initdata kb9202_eth_data = { 55static struct macb_platform_data __initdata kb9202_eth_data = {
@@ -115,7 +97,21 @@ static struct atmel_nand_data __initdata kb9202_nand_data = {
115 97
116static void __init kb9202_board_init(void) 98static void __init kb9202_board_init(void)
117{ 99{
100 /* Set up the LEDs */
101 at91_init_leds(AT91_PIN_PC19, AT91_PIN_PC18);
102
118 /* Serial */ 103 /* Serial */
104 /* DBGU on ttyS0. (Rx & Tx only) */
105 at91_register_uart(0, 0, 0);
106
107 /* USART0 on ttyS1 (Rx & Tx only) */
108 at91_register_uart(AT91RM9200_ID_US0, 1, 0);
109
110 /* USART1 on ttyS2 (Rx & Tx only) - IRDA (optional) */
111 at91_register_uart(AT91RM9200_ID_US1, 2, 0);
112
113 /* USART3 on ttyS3 (Rx, Tx, CTS, RTS) - RS485 (optional) */
114 at91_register_uart(AT91RM9200_ID_US3, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
119 at91_add_device_serial(); 115 at91_add_device_serial();
120 /* Ethernet */ 116 /* Ethernet */
121 at91_add_device_eth(&kb9202_eth_data); 117 at91_add_device_eth(&kb9202_eth_data);
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c
index 57d5f6a4726a..d2f4cc161766 100644
--- a/arch/arm/mach-at91/board-neocore926.c
+++ b/arch/arm/mach-at91/board-neocore926.c
@@ -55,15 +55,6 @@ static void __init neocore926_init_early(void)
55{ 55{
56 /* Initialize processor: 20 MHz crystal */ 56 /* Initialize processor: 20 MHz crystal */
57 at91_initialize(20000000); 57 at91_initialize(20000000);
58
59 /* DBGU on ttyS0. (Rx & Tx only) */
60 at91_register_uart(0, 0, 0);
61
62 /* USART0 on ttyS1. (Rx, Tx, RTS, CTS) */
63 at91_register_uart(AT91SAM9263_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
64
65 /* set serial console to ttyS0 (ie, DBGU) */
66 at91_set_serial_console(0);
67} 58}
68 59
69/* 60/*
@@ -341,6 +332,11 @@ static struct ac97c_platform_data neocore926_ac97_data = {
341static void __init neocore926_board_init(void) 332static void __init neocore926_board_init(void)
342{ 333{
343 /* Serial */ 334 /* Serial */
335 /* DBGU on ttyS0. (Rx & Tx only) */
336 at91_register_uart(0, 0, 0);
337
338 /* USART0 on ttyS1. (Rx, Tx, RTS, CTS) */
339 at91_register_uart(AT91SAM9263_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
344 at91_add_device_serial(); 340 at91_add_device_serial();
345 341
346 /* USB Host */ 342 /* USB Host */
diff --git a/arch/arm/mach-at91/board-pcontrol-g20.c b/arch/arm/mach-at91/board-pcontrol-g20.c
index b4a12fc184c8..7fe638342421 100644
--- a/arch/arm/mach-at91/board-pcontrol-g20.c
+++ b/arch/arm/mach-at91/board-pcontrol-g20.c
@@ -40,17 +40,6 @@
40static void __init pcontrol_g20_init_early(void) 40static void __init pcontrol_g20_init_early(void)
41{ 41{
42 stamp9g20_init_early(); 42 stamp9g20_init_early();
43
44 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) piggyback A2 */
45 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS
46 | ATMEL_UART_RTS);
47
48 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) isolated RS485 X5 */
49 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS
50 | ATMEL_UART_RTS);
51
52 /* USART2 on ttyS3. (Rx, Tx) 9bit-Bus Multidrop-mode X4 */
53 at91_register_uart(AT91SAM9260_ID_US4, 3, 0);
54} 43}
55 44
56static struct sam9_smc_config __initdata pcontrol_smc_config[2] = { { 45static struct sam9_smc_config __initdata pcontrol_smc_config[2] = { {
@@ -199,6 +188,16 @@ static struct spi_board_info pcontrol_g20_spi_devices[] = {
199 188
200static void __init pcontrol_g20_board_init(void) 189static void __init pcontrol_g20_board_init(void)
201{ 190{
191 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) piggyback A2 */
192 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS
193 | ATMEL_UART_RTS);
194
195 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) isolated RS485 X5 */
196 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS
197 | ATMEL_UART_RTS);
198
199 /* USART2 on ttyS3. (Rx, Tx) 9bit-Bus Multidrop-mode X4 */
200 at91_register_uart(AT91SAM9260_ID_US4, 3, 0);
202 stamp9g20_board_init(); 201 stamp9g20_board_init();
203 at91_add_device_usbh(&usbh_data); 202 at91_add_device_usbh(&usbh_data);
204 at91_add_device_eth(&macb_data); 203 at91_add_device_eth(&macb_data);
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index 59e35dd14863..b45c0a5d5ca7 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -48,17 +48,6 @@ static void __init picotux200_init_early(void)
48{ 48{
49 /* Initialize processor: 18.432 MHz crystal */ 49 /* Initialize processor: 18.432 MHz crystal */
50 at91_initialize(18432000); 50 at91_initialize(18432000);
51
52 /* DBGU on ttyS0. (Rx & Tx only) */
53 at91_register_uart(0, 0, 0);
54
55 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
56 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
57 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
58 | ATMEL_UART_RI);
59
60 /* set serial console to ttyS0 (ie, DBGU) */
61 at91_set_serial_console(0);
62} 51}
63 52
64static struct macb_platform_data __initdata picotux200_eth_data = { 53static struct macb_platform_data __initdata picotux200_eth_data = {
@@ -106,6 +95,13 @@ static struct platform_device picotux200_flash = {
106static void __init picotux200_board_init(void) 95static void __init picotux200_board_init(void)
107{ 96{
108 /* Serial */ 97 /* Serial */
98 /* DBGU on ttyS0. (Rx & Tx only) */
99 at91_register_uart(0, 0, 0);
100
101 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
102 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
103 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
104 | ATMEL_UART_RI);
109 at91_add_device_serial(); 105 at91_add_device_serial();
110 /* Ethernet */ 106 /* Ethernet */
111 at91_add_device_eth(&picotux200_eth_data); 107 at91_add_device_eth(&picotux200_eth_data);
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
index b6ed5ed7081a..0c61bf0d272c 100644
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -52,24 +52,6 @@ static void __init ek_init_early(void)
52{ 52{
53 /* Initialize processor: 12.000 MHz crystal */ 53 /* Initialize processor: 12.000 MHz crystal */
54 at91_initialize(12000000); 54 at91_initialize(12000000);
55
56 /* DBGU on ttyS0. (Rx & Tx only) */
57 at91_register_uart(0, 0, 0);
58
59 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
60 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
61 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
62 | ATMEL_UART_RI);
63
64 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */
65 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
66
67 /* USART2 on ttyS3. (Rx, Tx, CTS, RTS) */
68 at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
69
70 /* set serial console to ttyS1 (ie, USART0) */
71 at91_set_serial_console(1);
72
73} 55}
74 56
75/* 57/*
@@ -235,6 +217,19 @@ static struct gpio_led ek_leds[] = {
235static void __init ek_board_init(void) 217static void __init ek_board_init(void)
236{ 218{
237 /* Serial */ 219 /* Serial */
220 /* DBGU on ttyS0. (Rx & Tx only) */
221 at91_register_uart(0, 0, 0);
222
223 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
224 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
225 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
226 | ATMEL_UART_RI);
227
228 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */
229 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
230
231 /* USART2 on ttyS3. (Rx, Tx, CTS, RTS) */
232 at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
238 at91_add_device_serial(); 233 at91_add_device_serial();
239 /* USB Host */ 234 /* USB Host */
240 at91_add_device_usbh(&ek_usbh_data); 235 at91_add_device_usbh(&ek_usbh_data);
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c
index 01332aa538b2..afd7a4713766 100644
--- a/arch/arm/mach-at91/board-rm9200dk.c
+++ b/arch/arm/mach-at91/board-rm9200dk.c
@@ -50,20 +50,6 @@ static void __init dk_init_early(void)
50{ 50{
51 /* Initialize processor: 18.432 MHz crystal */ 51 /* Initialize processor: 18.432 MHz crystal */
52 at91_initialize(18432000); 52 at91_initialize(18432000);
53
54 /* Setup the LEDs */
55 at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2);
56
57 /* DBGU on ttyS0. (Rx & Tx only) */
58 at91_register_uart(0, 0, 0);
59
60 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
61 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
62 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
63 | ATMEL_UART_RI);
64
65 /* set serial console to ttyS0 (ie, DBGU) */
66 at91_set_serial_console(0);
67} 53}
68 54
69static struct macb_platform_data __initdata dk_eth_data = { 55static struct macb_platform_data __initdata dk_eth_data = {
@@ -190,7 +176,17 @@ static struct gpio_led dk_leds[] = {
190 176
191static void __init dk_board_init(void) 177static void __init dk_board_init(void)
192{ 178{
179 /* Setup the LEDs */
180 at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2);
181
193 /* Serial */ 182 /* Serial */
183 /* DBGU on ttyS0. (Rx & Tx only) */
184 at91_register_uart(0, 0, 0);
185
186 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
187 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
188 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
189 | ATMEL_UART_RI);
194 at91_add_device_serial(); 190 at91_add_device_serial();
195 /* Ethernet */ 191 /* Ethernet */
196 at91_add_device_eth(&dk_eth_data); 192 at91_add_device_eth(&dk_eth_data);
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c
index 11cbaa8946fe..2b15b8adec4c 100644
--- a/arch/arm/mach-at91/board-rm9200ek.c
+++ b/arch/arm/mach-at91/board-rm9200ek.c
@@ -50,20 +50,6 @@ static void __init ek_init_early(void)
50{ 50{
51 /* Initialize processor: 18.432 MHz crystal */ 51 /* Initialize processor: 18.432 MHz crystal */
52 at91_initialize(18432000); 52 at91_initialize(18432000);
53
54 /* Setup the LEDs */
55 at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2);
56
57 /* DBGU on ttyS0. (Rx & Tx only) */
58 at91_register_uart(0, 0, 0);
59
60 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
61 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
62 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
63 | ATMEL_UART_RI);
64
65 /* set serial console to ttyS0 (ie, DBGU) */
66 at91_set_serial_console(0);
67} 53}
68 54
69static struct macb_platform_data __initdata ek_eth_data = { 55static struct macb_platform_data __initdata ek_eth_data = {
@@ -117,7 +103,7 @@ static struct i2c_board_info __initdata ek_i2c_devices[] = {
117}; 103};
118 104
119#define EK_FLASH_BASE AT91_CHIPSELECT_0 105#define EK_FLASH_BASE AT91_CHIPSELECT_0
120#define EK_FLASH_SIZE SZ_2M 106#define EK_FLASH_SIZE SZ_8M
121 107
122static struct physmap_flash_data ek_flash_data = { 108static struct physmap_flash_data ek_flash_data = {
123 .width = 2, 109 .width = 2,
@@ -161,7 +147,17 @@ static struct gpio_led ek_leds[] = {
161 147
162static void __init ek_board_init(void) 148static void __init ek_board_init(void)
163{ 149{
150 /* Setup the LEDs */
151 at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2);
152
164 /* Serial */ 153 /* Serial */
154 /* DBGU on ttyS0. (Rx & Tx only) */
155 at91_register_uart(0, 0, 0);
156
157 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
158 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
159 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
160 | ATMEL_UART_RI);
165 at91_add_device_serial(); 161 at91_add_device_serial();
166 /* Ethernet */ 162 /* Ethernet */
167 at91_add_device_eth(&ek_eth_data); 163 at91_add_device_eth(&ek_eth_data);
diff --git a/arch/arm/mach-at91/board-rsi-ews.c b/arch/arm/mach-at91/board-rsi-ews.c
index af0750fafa29..24ab9be7510f 100644
--- a/arch/arm/mach-at91/board-rsi-ews.c
+++ b/arch/arm/mach-at91/board-rsi-ews.c
@@ -35,26 +35,6 @@ static void __init rsi_ews_init_early(void)
35{ 35{
36 /* Initialize processor: 18.432 MHz crystal */ 36 /* Initialize processor: 18.432 MHz crystal */
37 at91_initialize(18432000); 37 at91_initialize(18432000);
38
39 /* Setup the LEDs */
40 at91_init_leds(AT91_PIN_PB6, AT91_PIN_PB9);
41
42 /* DBGU on ttyS0. (Rx & Tx only) */
43 /* This one is for debugging */
44 at91_register_uart(0, 0, 0);
45
46 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
47 /* Dialin/-out modem interface */
48 at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS
49 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
50 | ATMEL_UART_RI);
51
52 /* USART3 on ttyS4. (Rx, Tx, RTS) */
53 /* RS485 communication */
54 at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_RTS);
55
56 /* set serial console to ttyS0 (ie, DBGU) */
57 at91_set_serial_console(0);
58} 38}
59 39
60/* 40/*
@@ -204,7 +184,23 @@ static struct platform_device rsiews_nor_flash = {
204 */ 184 */
205static void __init rsi_ews_board_init(void) 185static void __init rsi_ews_board_init(void)
206{ 186{
187 /* Setup the LEDs */
188 at91_init_leds(AT91_PIN_PB6, AT91_PIN_PB9);
189
207 /* Serial */ 190 /* Serial */
191 /* DBGU on ttyS0. (Rx & Tx only) */
192 /* This one is for debugging */
193 at91_register_uart(0, 0, 0);
194
195 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
196 /* Dialin/-out modem interface */
197 at91_register_uart(AT91RM9200_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS
198 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
199 | ATMEL_UART_RI);
200
201 /* USART3 on ttyS4. (Rx, Tx, RTS) */
202 /* RS485 communication */
203 at91_register_uart(AT91RM9200_ID_US3, 4, ATMEL_UART_RTS);
208 at91_add_device_serial(); 204 at91_add_device_serial();
209 at91_set_gpio_output(AT91_PIN_PA21, 0); 205 at91_set_gpio_output(AT91_PIN_PA21, 0);
210 /* Ethernet */ 206 /* Ethernet */
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index e8b116b6cba6..cdd21f2595d2 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -48,23 +48,6 @@ static void __init ek_init_early(void)
48{ 48{
49 /* Initialize processor: 18.432 MHz crystal */ 49 /* Initialize processor: 18.432 MHz crystal */
50 at91_initialize(18432000); 50 at91_initialize(18432000);
51
52 /* Setup the LEDs */
53 at91_init_leds(AT91_PIN_PA9, AT91_PIN_PA6);
54
55 /* DBGU on ttyS0. (Rx & Tx only) */
56 at91_register_uart(0, 0, 0);
57
58 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
59 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
60 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
61 | ATMEL_UART_RI);
62
63 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */
64 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
65
66 /* set serial console to ttyS0 (ie, DBGU) */
67 at91_set_serial_console(0);
68} 51}
69 52
70/* 53/*
@@ -184,7 +167,20 @@ static struct at91_mmc_data __initdata ek_mmc_data = {
184 167
185static void __init ek_board_init(void) 168static void __init ek_board_init(void)
186{ 169{
170 /* Setup the LEDs */
171 at91_init_leds(AT91_PIN_PA9, AT91_PIN_PA6);
172
187 /* Serial */ 173 /* Serial */
174 /* DBGU on ttyS0. (Rx & Tx only) */
175 at91_register_uart(0, 0, 0);
176
177 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
178 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
179 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
180 | ATMEL_UART_RI);
181
182 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */
183 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
188 at91_add_device_serial(); 184 at91_add_device_serial();
189 /* USB Host */ 185 /* USB Host */
190 at91_add_device_usbh(&ek_usbh_data); 186 at91_add_device_usbh(&ek_usbh_data);
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index d5aec55b0eb4..7b3c3913551a 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -54,20 +54,6 @@ static void __init ek_init_early(void)
54{ 54{
55 /* Initialize processor: 18.432 MHz crystal */ 55 /* Initialize processor: 18.432 MHz crystal */
56 at91_initialize(18432000); 56 at91_initialize(18432000);
57
58 /* DBGU on ttyS0. (Rx & Tx only) */
59 at91_register_uart(0, 0, 0);
60
61 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
62 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
63 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
64 | ATMEL_UART_RI);
65
66 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
67 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
68
69 /* set serial console to ttyS0 (ie, DBGU) */
70 at91_set_serial_console(0);
71} 57}
72 58
73/* 59/*
@@ -320,6 +306,16 @@ static void __init ek_add_device_buttons(void) {}
320static void __init ek_board_init(void) 306static void __init ek_board_init(void)
321{ 307{
322 /* Serial */ 308 /* Serial */
309 /* DBGU on ttyS0. (Rx & Tx only) */
310 at91_register_uart(0, 0, 0);
311
312 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
313 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
314 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
315 | ATMEL_UART_RI);
316
317 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
318 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
323 at91_add_device_serial(); 319 at91_add_device_serial();
324 /* USB Host */ 320 /* USB Host */
325 at91_add_device_usbh(&ek_usbh_data); 321 at91_add_device_usbh(&ek_usbh_data);
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index c3f994462864..2736453821b0 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -58,15 +58,6 @@ static void __init ek_init_early(void)
58{ 58{
59 /* Initialize processor: 18.432 MHz crystal */ 59 /* Initialize processor: 18.432 MHz crystal */
60 at91_initialize(18432000); 60 at91_initialize(18432000);
61
62 /* Setup the LEDs */
63 at91_init_leds(AT91_PIN_PA13, AT91_PIN_PA14);
64
65 /* DBGU on ttyS0. (Rx & Tx only) */
66 at91_register_uart(0, 0, 0);
67
68 /* set serial console to ttyS0 (ie, DBGU) */
69 at91_set_serial_console(0);
70} 61}
71 62
72/* 63/*
@@ -85,8 +76,6 @@ static struct resource dm9000_resource[] = {
85 .flags = IORESOURCE_MEM 76 .flags = IORESOURCE_MEM
86 }, 77 },
87 [2] = { 78 [2] = {
88 .start = AT91_PIN_PC11,
89 .end = AT91_PIN_PC11,
90 .flags = IORESOURCE_IRQ 79 .flags = IORESOURCE_IRQ
91 | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE, 80 | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE,
92 } 81 }
@@ -130,6 +119,8 @@ static struct sam9_smc_config __initdata dm9000_smc_config = {
130 119
131static void __init ek_add_device_dm9000(void) 120static void __init ek_add_device_dm9000(void)
132{ 121{
122 struct resource *r = &dm9000_resource[2];
123
133 /* Configure chip-select 2 (DM9000) */ 124 /* Configure chip-select 2 (DM9000) */
134 sam9_smc_configure(0, 2, &dm9000_smc_config); 125 sam9_smc_configure(0, 2, &dm9000_smc_config);
135 126
@@ -139,6 +130,7 @@ static void __init ek_add_device_dm9000(void)
139 /* Configure Interrupt pin as input, no pull-up */ 130 /* Configure Interrupt pin as input, no pull-up */
140 at91_set_gpio_input(AT91_PIN_PC11, 0); 131 at91_set_gpio_input(AT91_PIN_PC11, 0);
141 132
133 r->start = r->end = gpio_to_irq(AT91_PIN_PC11);
142 platform_device_register(&dm9000_device); 134 platform_device_register(&dm9000_device);
143} 135}
144#else 136#else
@@ -576,7 +568,12 @@ static struct gpio_led ek_leds[] = {
576 568
577static void __init ek_board_init(void) 569static void __init ek_board_init(void)
578{ 570{
571 /* Setup the LEDs */
572 at91_init_leds(AT91_PIN_PA13, AT91_PIN_PA14);
573
579 /* Serial */ 574 /* Serial */
575 /* DBGU on ttyS0. (Rx & Tx only) */
576 at91_register_uart(0, 0, 0);
580 at91_add_device_serial(); 577 at91_add_device_serial();
581 /* USB Host */ 578 /* USB Host */
582 at91_add_device_usbh(&ek_usbh_data); 579 at91_add_device_usbh(&ek_usbh_data);
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 2ffe50f3a9e9..983cb98d2465 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -57,15 +57,6 @@ static void __init ek_init_early(void)
57{ 57{
58 /* Initialize processor: 16.367 MHz crystal */ 58 /* Initialize processor: 16.367 MHz crystal */
59 at91_initialize(16367660); 59 at91_initialize(16367660);
60
61 /* DBGU on ttyS0. (Rx & Tx only) */
62 at91_register_uart(0, 0, 0);
63
64 /* USART0 on ttyS1. (Rx, Tx, RTS, CTS) */
65 at91_register_uart(AT91SAM9263_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
66
67 /* set serial console to ttyS0 (ie, DBGU) */
68 at91_set_serial_console(0);
69} 60}
70 61
71/* 62/*
@@ -412,6 +403,11 @@ static struct at91_can_data ek_can_data = {
412static void __init ek_board_init(void) 403static void __init ek_board_init(void)
413{ 404{
414 /* Serial */ 405 /* Serial */
406 /* DBGU on ttyS0. (Rx & Tx only) */
407 at91_register_uart(0, 0, 0);
408
409 /* USART0 on ttyS1. (Rx, Tx, RTS, CTS) */
410 at91_register_uart(AT91SAM9263_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
415 at91_add_device_serial(); 411 at91_add_device_serial();
416 /* USB Host */ 412 /* USB Host */
417 at91_add_device_usbh(&ek_usbh_data); 413 at91_add_device_usbh(&ek_usbh_data);
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index 8923ec9f5831..6860d3451100 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -32,6 +32,8 @@
32#include <linux/regulator/fixed.h> 32#include <linux/regulator/fixed.h>
33#include <linux/regulator/consumer.h> 33#include <linux/regulator/consumer.h>
34 34
35#include <linux/platform_data/at91_adc.h>
36
35#include <mach/hardware.h> 37#include <mach/hardware.h>
36#include <asm/setup.h> 38#include <asm/setup.h>
37#include <asm/mach-types.h> 39#include <asm/mach-types.h>
@@ -65,20 +67,6 @@ static void __init ek_init_early(void)
65{ 67{
66 /* Initialize processor: 18.432 MHz crystal */ 68 /* Initialize processor: 18.432 MHz crystal */
67 at91_initialize(18432000); 69 at91_initialize(18432000);
68
69 /* DBGU on ttyS0. (Rx & Tx only) */
70 at91_register_uart(0, 0, 0);
71
72 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
73 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
74 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
75 | ATMEL_UART_RI);
76
77 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
78 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
79
80 /* set serial console to ttyS0 (ie, DBGU) */
81 at91_set_serial_console(0);
82} 70}
83 71
84/* 72/*
@@ -318,6 +306,16 @@ static void __init ek_add_device_buttons(void)
318static void __init ek_add_device_buttons(void) {} 306static void __init ek_add_device_buttons(void) {}
319#endif 307#endif
320 308
309/*
310 * ADCs
311 */
312
313static struct at91_adc_data ek_adc_data = {
314 .channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3),
315 .use_external_triggers = true,
316 .vref = 3300,
317};
318
321#if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE) 319#if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE)
322static struct regulator_consumer_supply ek_audio_consumer_supplies[] = { 320static struct regulator_consumer_supply ek_audio_consumer_supplies[] = {
323 REGULATOR_SUPPLY("AVDD", "0-001b"), 321 REGULATOR_SUPPLY("AVDD", "0-001b"),
@@ -372,6 +370,16 @@ static struct i2c_board_info __initdata ek_i2c_devices[] = {
372static void __init ek_board_init(void) 370static void __init ek_board_init(void)
373{ 371{
374 /* Serial */ 372 /* Serial */
373 /* DBGU on ttyS0. (Rx & Tx only) */
374 at91_register_uart(0, 0, 0);
375
376 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
377 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
378 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
379 | ATMEL_UART_RI);
380
381 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
382 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
375 at91_add_device_serial(); 383 at91_add_device_serial();
376 /* USB Host */ 384 /* USB Host */
377 at91_add_device_usbh(&ek_usbh_data); 385 at91_add_device_usbh(&ek_usbh_data);
@@ -393,6 +401,8 @@ static void __init ek_board_init(void)
393 ek_add_device_gpio_leds(); 401 ek_add_device_gpio_leds();
394 /* Push Buttons */ 402 /* Push Buttons */
395 ek_add_device_buttons(); 403 ek_add_device_buttons();
404 /* ADCs */
405 at91_add_device_adc(&ek_adc_data);
396 /* PCK0 provides MCLK to the WM8731 */ 406 /* PCK0 provides MCLK to the WM8731 */
397 at91_set_B_periph(AT91_PIN_PC1, 0); 407 at91_set_B_periph(AT91_PIN_PC1, 0);
398 /* SSC (for WM8731) */ 408 /* SSC (for WM8731) */
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index c88e908ddd82..63163dc7df46 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -27,6 +27,8 @@
27#include <linux/atmel-mci.h> 27#include <linux/atmel-mci.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29 29
30#include <linux/platform_data/at91_adc.h>
31
30#include <mach/hardware.h> 32#include <mach/hardware.h>
31#include <video/atmel_lcdc.h> 33#include <video/atmel_lcdc.h>
32#include <media/soc_camera.h> 34#include <media/soc_camera.h>
@@ -53,16 +55,6 @@ static void __init ek_init_early(void)
53{ 55{
54 /* Initialize processor: 12.000 MHz crystal */ 56 /* Initialize processor: 12.000 MHz crystal */
55 at91_initialize(12000000); 57 at91_initialize(12000000);
56
57 /* DGBU on ttyS0. (Rx & Tx only) */
58 at91_register_uart(0, 0, 0);
59
60 /* USART0 not connected on the -EK board */
61 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
62 at91_register_uart(AT91SAM9G45_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
63
64 /* set serial console to ttyS0 (ie, DBGU) */
65 at91_set_serial_console(0);
66} 58}
67 59
68/* 60/*
@@ -315,6 +307,14 @@ static struct at91_tsadcc_data ek_tsadcc_data = {
315 .ts_sample_hold_time = 0x0a, 307 .ts_sample_hold_time = 0x0a,
316}; 308};
317 309
310/*
311 * ADCs
312 */
313static struct at91_adc_data ek_adc_data = {
314 .channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7),
315 .use_external_triggers = true,
316 .vref = 3300,
317};
318 318
319/* 319/*
320 * GPIO Buttons 320 * GPIO Buttons
@@ -457,6 +457,12 @@ static struct platform_device *devices[] __initdata = {
457static void __init ek_board_init(void) 457static void __init ek_board_init(void)
458{ 458{
459 /* Serial */ 459 /* Serial */
460 /* DGBU on ttyS0. (Rx & Tx only) */
461 at91_register_uart(0, 0, 0);
462
463 /* USART0 not connected on the -EK board */
464 /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */
465 at91_register_uart(AT91SAM9G45_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
460 at91_add_device_serial(); 466 at91_add_device_serial();
461 /* USB HS Host */ 467 /* USB HS Host */
462 at91_add_device_usbh_ohci(&ek_usbh_hs_data); 468 at91_add_device_usbh_ohci(&ek_usbh_hs_data);
@@ -480,6 +486,8 @@ static void __init ek_board_init(void)
480 at91_add_device_lcdc(&ek_lcdc_data); 486 at91_add_device_lcdc(&ek_lcdc_data);
481 /* Touch Screen */ 487 /* Touch Screen */
482 at91_add_device_tsadcc(&ek_tsadcc_data); 488 at91_add_device_tsadcc(&ek_tsadcc_data);
489 /* ADC */
490 at91_add_device_adc(&ek_adc_data);
483 /* Push Buttons */ 491 /* Push Buttons */
484 ek_add_device_buttons(); 492 ek_add_device_buttons();
485 /* AC97 */ 493 /* AC97 */
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index b109ce2ba864..be3239f13daa 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -42,15 +42,6 @@ static void __init ek_init_early(void)
42{ 42{
43 /* Initialize processor: 12.000 MHz crystal */ 43 /* Initialize processor: 12.000 MHz crystal */
44 at91_initialize(12000000); 44 at91_initialize(12000000);
45
46 /* DBGU on ttyS0. (Rx & Tx only) */
47 at91_register_uart(0, 0, 0);
48
49 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */
50 at91_register_uart(AT91SAM9RL_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
51
52 /* set serial console to ttyS0 (ie, DBGU) */
53 at91_set_serial_console(0);
54} 45}
55 46
56/* 47/*
@@ -296,6 +287,11 @@ static void __init ek_add_device_buttons(void) {}
296static void __init ek_board_init(void) 287static void __init ek_board_init(void)
297{ 288{
298 /* Serial */ 289 /* Serial */
290 /* DBGU on ttyS0. (Rx & Tx only) */
291 at91_register_uart(0, 0, 0);
292
293 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */
294 at91_register_uart(AT91SAM9RL_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS);
299 at91_add_device_serial(); 295 at91_add_device_serial();
300 /* USB HS */ 296 /* USB HS */
301 at91_add_device_usba(&ek_usba_udc_data); 297 at91_add_device_usba(&ek_usba_udc_data);
diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c
index ebc9d01ce742..9d446f1bb45f 100644
--- a/arch/arm/mach-at91/board-snapper9260.c
+++ b/arch/arm/mach-at91/board-snapper9260.c
@@ -43,16 +43,6 @@
43static void __init snapper9260_init_early(void) 43static void __init snapper9260_init_early(void)
44{ 44{
45 at91_initialize(18432000); 45 at91_initialize(18432000);
46
47 /* Debug on ttyS0 */
48 at91_register_uart(0, 0, 0);
49 at91_set_serial_console(0);
50
51 at91_register_uart(AT91SAM9260_ID_US0, 1,
52 ATMEL_UART_CTS | ATMEL_UART_RTS);
53 at91_register_uart(AT91SAM9260_ID_US1, 2,
54 ATMEL_UART_CTS | ATMEL_UART_RTS);
55 at91_register_uart(AT91SAM9260_ID_US2, 3, 0);
56} 46}
57 47
58static struct at91_usbh_data __initdata snapper9260_usbh_data = { 48static struct at91_usbh_data __initdata snapper9260_usbh_data = {
@@ -168,6 +158,14 @@ static void __init snapper9260_board_init(void)
168 snapper9260_i2c_isl1208.irq = gpio_to_irq(AT91_PIN_PA31); 158 snapper9260_i2c_isl1208.irq = gpio_to_irq(AT91_PIN_PA31);
169 i2c_register_board_info(0, &snapper9260_i2c_isl1208, 1); 159 i2c_register_board_info(0, &snapper9260_i2c_isl1208, 1);
170 160
161 /* Debug on ttyS0 */
162 at91_register_uart(0, 0, 0);
163
164 at91_register_uart(AT91SAM9260_ID_US0, 1,
165 ATMEL_UART_CTS | ATMEL_UART_RTS);
166 at91_register_uart(AT91SAM9260_ID_US1, 2,
167 ATMEL_UART_CTS | ATMEL_UART_RTS);
168 at91_register_uart(AT91SAM9260_ID_US2, 3, 0);
171 at91_add_device_serial(); 169 at91_add_device_serial();
172 at91_add_device_usbh(&snapper9260_usbh_data); 170 at91_add_device_usbh(&snapper9260_usbh_data);
173 at91_add_device_udc(&snapper9260_udc_data); 171 at91_add_device_udc(&snapper9260_udc_data);
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c
index 7640049410a0..ee86f9d7ee72 100644
--- a/arch/arm/mach-at91/board-stamp9g20.c
+++ b/arch/arm/mach-at91/board-stamp9g20.c
@@ -36,44 +36,6 @@ void __init stamp9g20_init_early(void)
36{ 36{
37 /* Initialize processor: 18.432 MHz crystal */ 37 /* Initialize processor: 18.432 MHz crystal */
38 at91_initialize(18432000); 38 at91_initialize(18432000);
39
40 /* DGBU on ttyS0. (Rx & Tx only) */
41 at91_register_uart(0, 0, 0);
42
43 /* set serial console to ttyS0 (ie, DBGU) */
44 at91_set_serial_console(0);
45}
46
47static void __init stamp9g20evb_init_early(void)
48{
49 stamp9g20_init_early();
50
51 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
52 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
53 | ATMEL_UART_DTR | ATMEL_UART_DSR
54 | ATMEL_UART_DCD | ATMEL_UART_RI);
55}
56
57static void __init portuxg20_init_early(void)
58{
59 stamp9g20_init_early();
60
61 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
62 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
63 | ATMEL_UART_DTR | ATMEL_UART_DSR
64 | ATMEL_UART_DCD | ATMEL_UART_RI);
65
66 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */
67 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
68
69 /* USART2 on ttyS3. (Rx, Tx, CTS, RTS) */
70 at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
71
72 /* USART4 on ttyS5. (Rx, Tx only) */
73 at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
74
75 /* USART5 on ttyS6. (Rx, Tx only) */
76 at91_register_uart(AT91SAM9260_ID_US5, 6, 0);
77} 39}
78 40
79/* 41/*
@@ -254,6 +216,8 @@ void add_w1(void)
254void __init stamp9g20_board_init(void) 216void __init stamp9g20_board_init(void)
255{ 217{
256 /* Serial */ 218 /* Serial */
219 /* DGBU on ttyS0. (Rx & Tx only) */
220 at91_register_uart(0, 0, 0);
257 at91_add_device_serial(); 221 at91_add_device_serial();
258 /* NAND */ 222 /* NAND */
259 add_device_nand(); 223 add_device_nand();
@@ -269,6 +233,22 @@ void __init stamp9g20_board_init(void)
269 233
270static void __init portuxg20_board_init(void) 234static void __init portuxg20_board_init(void)
271{ 235{
236 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
237 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
238 | ATMEL_UART_DTR | ATMEL_UART_DSR
239 | ATMEL_UART_DCD | ATMEL_UART_RI);
240
241 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */
242 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
243
244 /* USART2 on ttyS3. (Rx, Tx, CTS, RTS) */
245 at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
246
247 /* USART4 on ttyS5. (Rx, Tx only) */
248 at91_register_uart(AT91SAM9260_ID_US4, 5, 0);
249
250 /* USART5 on ttyS6. (Rx, Tx only) */
251 at91_register_uart(AT91SAM9260_ID_US5, 6, 0);
272 stamp9g20_board_init(); 252 stamp9g20_board_init();
273 /* USB Host */ 253 /* USB Host */
274 at91_add_device_usbh(&usbh_data); 254 at91_add_device_usbh(&usbh_data);
@@ -286,6 +266,10 @@ static void __init portuxg20_board_init(void)
286 266
287static void __init stamp9g20evb_board_init(void) 267static void __init stamp9g20evb_board_init(void)
288{ 268{
269 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
270 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
271 | ATMEL_UART_DTR | ATMEL_UART_DSR
272 | ATMEL_UART_DCD | ATMEL_UART_RI);
289 stamp9g20_board_init(); 273 stamp9g20_board_init();
290 /* USB Host */ 274 /* USB Host */
291 at91_add_device_usbh(&usbh_data); 275 at91_add_device_usbh(&usbh_data);
@@ -303,7 +287,7 @@ MACHINE_START(PORTUXG20, "taskit PortuxG20")
303 /* Maintainer: taskit GmbH */ 287 /* Maintainer: taskit GmbH */
304 .timer = &at91sam926x_timer, 288 .timer = &at91sam926x_timer,
305 .map_io = at91_map_io, 289 .map_io = at91_map_io,
306 .init_early = portuxg20_init_early, 290 .init_early = stamp9g20_init_early,
307 .init_irq = at91_init_irq_default, 291 .init_irq = at91_init_irq_default,
308 .init_machine = portuxg20_board_init, 292 .init_machine = portuxg20_board_init,
309MACHINE_END 293MACHINE_END
@@ -312,7 +296,7 @@ MACHINE_START(STAMP9G20, "taskit Stamp9G20")
312 /* Maintainer: taskit GmbH */ 296 /* Maintainer: taskit GmbH */
313 .timer = &at91sam926x_timer, 297 .timer = &at91sam926x_timer,
314 .map_io = at91_map_io, 298 .map_io = at91_map_io,
315 .init_early = stamp9g20evb_init_early, 299 .init_early = stamp9g20_init_early,
316 .init_irq = at91_init_irq_default, 300 .init_irq = at91_init_irq_default,
317 .init_machine = stamp9g20evb_board_init, 301 .init_machine = stamp9g20evb_board_init,
318MACHINE_END 302MACHINE_END
diff --git a/arch/arm/mach-at91/board-usb-a926x.c b/arch/arm/mach-at91/board-usb-a926x.c
index b7483a3d0980..95393fcaf199 100644
--- a/arch/arm/mach-at91/board-usb-a926x.c
+++ b/arch/arm/mach-at91/board-usb-a926x.c
@@ -53,12 +53,6 @@ static void __init ek_init_early(void)
53{ 53{
54 /* Initialize processor: 12.00 MHz crystal */ 54 /* Initialize processor: 12.00 MHz crystal */
55 at91_initialize(12000000); 55 at91_initialize(12000000);
56
57 /* DBGU on ttyS0. (Rx & Tx only) */
58 at91_register_uart(0, 0, 0);
59
60 /* set serial console to ttyS0 (ie, DBGU) */
61 at91_set_serial_console(0);
62} 56}
63 57
64/* 58/*
@@ -178,6 +172,10 @@ static struct mtd_partition __initdata ek_nand_partition[] = {
178 .offset = MTDPART_OFS_NXTBLK, 172 .offset = MTDPART_OFS_NXTBLK,
179 .size = SZ_128K, 173 .size = SZ_128K,
180 }, { 174 }, {
175 .name = "oftree",
176 .offset = MTDPART_OFS_NXTBLK,
177 .size = SZ_128K,
178 }, {
181 .name = "kernel", 179 .name = "kernel",
182 .offset = MTDPART_OFS_NXTBLK, 180 .offset = MTDPART_OFS_NXTBLK,
183 .size = 4 * SZ_1M, 181 .size = 4 * SZ_1M,
@@ -325,6 +323,8 @@ static void __init ek_add_device_leds(void)
325static void __init ek_board_init(void) 323static void __init ek_board_init(void)
326{ 324{
327 /* Serial */ 325 /* Serial */
326 /* DBGU on ttyS0. (Rx & Tx only) */
327 at91_register_uart(0, 0, 0);
328 at91_add_device_serial(); 328 at91_add_device_serial();
329 /* USB Host */ 329 /* USB Host */
330 at91_add_device_usbh(&ek_usbh_data); 330 at91_add_device_usbh(&ek_usbh_data);
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index 38dd279d30b2..d56665ea4b55 100644
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -58,26 +58,6 @@ static void __init yl9200_init_early(void)
58 58
59 /* Initialize processor: 18.432 MHz crystal */ 59 /* Initialize processor: 18.432 MHz crystal */
60 at91_initialize(18432000); 60 at91_initialize(18432000);
61
62 /* Setup the LEDs D2=PB17 (timer), D3=PB16 (cpu) */
63 at91_init_leds(AT91_PIN_PB16, AT91_PIN_PB17);
64
65 /* DBGU on ttyS0. (Rx & Tx only) */
66 at91_register_uart(0, 0, 0);
67
68 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
69 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
70 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
71 | ATMEL_UART_RI);
72
73 /* USART0 on ttyS2. (Rx & Tx only to JP3) */
74 at91_register_uart(AT91RM9200_ID_US0, 2, 0);
75
76 /* USART3 on ttyS3. (Rx, Tx, RTS - RS485 interface) */
77 at91_register_uart(AT91RM9200_ID_US3, 3, ATMEL_UART_RTS);
78
79 /* set serial console to ttyS0 (ie, DBGU) */
80 at91_set_serial_console(0);
81} 61}
82 62
83/* 63/*
@@ -560,7 +540,23 @@ void __init yl9200_add_device_video(void) {}
560 540
561static void __init yl9200_board_init(void) 541static void __init yl9200_board_init(void)
562{ 542{
543 /* Setup the LEDs D2=PB17 (timer), D3=PB16 (cpu) */
544 at91_init_leds(AT91_PIN_PB16, AT91_PIN_PB17);
545
563 /* Serial */ 546 /* Serial */
547 /* DBGU on ttyS0. (Rx & Tx only) */
548 at91_register_uart(0, 0, 0);
549
550 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
551 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
552 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
553 | ATMEL_UART_RI);
554
555 /* USART0 on ttyS2. (Rx & Tx only to JP3) */
556 at91_register_uart(AT91RM9200_ID_US0, 2, 0);
557
558 /* USART3 on ttyS3. (Rx, Tx, RTS - RS485 interface) */
559 at91_register_uart(AT91RM9200_ID_US3, 3, ATMEL_UART_RTS);
564 at91_add_device_serial(); 560 at91_add_device_serial();
565 /* Ethernet */ 561 /* Ethernet */
566 at91_add_device_eth(&yl9200_eth_data); 562 at91_add_device_eth(&yl9200_eth_data);
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index a0f4d7424cdc..de2ec6b8fea7 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -35,6 +35,7 @@
35#include "generic.h" 35#include "generic.h"
36 36
37void __iomem *at91_pmc_base; 37void __iomem *at91_pmc_base;
38EXPORT_SYMBOL_GPL(at91_pmc_base);
38 39
39/* 40/*
40 * There's a lot more which can be done with clocks, including cpufreq 41 * There's a lot more which can be done with clocks, including cpufreq
@@ -57,13 +58,15 @@ void __iomem *at91_pmc_base;
57 58
58#define cpu_has_800M_plla() ( cpu_is_at91sam9g20() \ 59#define cpu_has_800M_plla() ( cpu_is_at91sam9g20() \
59 || cpu_is_at91sam9g45() \ 60 || cpu_is_at91sam9g45() \
60 || cpu_is_at91sam9x5()) 61 || cpu_is_at91sam9x5() \
62 || cpu_is_at91sam9n12())
61 63
62#define cpu_has_300M_plla() (cpu_is_at91sam9g10()) 64#define cpu_has_300M_plla() (cpu_is_at91sam9g10())
63 65
64#define cpu_has_pllb() (!(cpu_is_at91sam9rl() \ 66#define cpu_has_pllb() (!(cpu_is_at91sam9rl() \
65 || cpu_is_at91sam9g45() \ 67 || cpu_is_at91sam9g45() \
66 || cpu_is_at91sam9x5())) 68 || cpu_is_at91sam9x5() \
69 || cpu_is_at91sam9n12()))
67 70
68#define cpu_has_upll() (cpu_is_at91sam9g45() \ 71#define cpu_has_upll() (cpu_is_at91sam9g45() \
69 || cpu_is_at91sam9x5()) 72 || cpu_is_at91sam9x5())
@@ -77,12 +80,15 @@ void __iomem *at91_pmc_base;
77 || cpu_is_at91sam9x5())) 80 || cpu_is_at91sam9x5()))
78 81
79#define cpu_has_plladiv2() (cpu_is_at91sam9g45() \ 82#define cpu_has_plladiv2() (cpu_is_at91sam9g45() \
80 || cpu_is_at91sam9x5()) 83 || cpu_is_at91sam9x5() \
84 || cpu_is_at91sam9n12())
81 85
82#define cpu_has_mdiv3() (cpu_is_at91sam9g45() \ 86#define cpu_has_mdiv3() (cpu_is_at91sam9g45() \
83 || cpu_is_at91sam9x5()) 87 || cpu_is_at91sam9x5() \
88 || cpu_is_at91sam9n12())
84 89
85#define cpu_has_alt_prescaler() (cpu_is_at91sam9x5()) 90#define cpu_has_alt_prescaler() (cpu_is_at91sam9x5() \
91 || cpu_is_at91sam9n12())
86 92
87static LIST_HEAD(clocks); 93static LIST_HEAD(clocks);
88static DEFINE_SPINLOCK(clk_lock); 94static DEFINE_SPINLOCK(clk_lock);
diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c
index ece1f9aefb47..0c6381516a5a 100644
--- a/arch/arm/mach-at91/cpuidle.c
+++ b/arch/arm/mach-at91/cpuidle.c
@@ -21,6 +21,7 @@
21#include <linux/export.h> 21#include <linux/export.h>
22#include <asm/proc-fns.h> 22#include <asm/proc-fns.h>
23#include <asm/cpuidle.h> 23#include <asm/cpuidle.h>
24#include <mach/cpu.h>
24 25
25#include "pm.h" 26#include "pm.h"
26 27
@@ -33,7 +34,12 @@ static int at91_enter_idle(struct cpuidle_device *dev,
33 struct cpuidle_driver *drv, 34 struct cpuidle_driver *drv,
34 int index) 35 int index)
35{ 36{
36 at91_standby(); 37 if (cpu_is_at91rm9200())
38 at91rm9200_standby();
39 else if (cpu_is_at91sam9g45())
40 at91sam9g45_standby();
41 else
42 at91sam9_standby();
37 43
38 return index; 44 return index;
39} 45}
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index dd9b346c451d..0a60bf837037 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -40,17 +40,6 @@ extern struct sys_timer at91sam926x_timer;
40extern struct sys_timer at91x40_timer; 40extern struct sys_timer at91x40_timer;
41 41
42 /* Clocks */ 42 /* Clocks */
43/*
44 * function to specify the clock of the default console. As we do not
45 * use the device/driver bus, the dev_name is not intialize. So we need
46 * to link the clock to a specific con_id only "usart"
47 */
48extern void __init at91rm9200_set_console_clock(int id);
49extern void __init at91sam9260_set_console_clock(int id);
50extern void __init at91sam9261_set_console_clock(int id);
51extern void __init at91sam9263_set_console_clock(int id);
52extern void __init at91sam9rl_set_console_clock(int id);
53extern void __init at91sam9g45_set_console_clock(int id);
54#ifdef CONFIG_AT91_PMC_UNIT 43#ifdef CONFIG_AT91_PMC_UNIT
55extern int __init at91_clock_init(unsigned long main_clock); 44extern int __init at91_clock_init(unsigned long main_clock);
56extern int __init at91_dt_clock_init(void); 45extern int __init at91_dt_clock_init(void);
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h
index 36604782a78f..ea2c57a86ca6 100644
--- a/arch/arm/mach-at91/include/mach/at91_pmc.h
+++ b/arch/arm/mach-at91/include/mach/at91_pmc.h
@@ -25,7 +25,7 @@ extern void __iomem *at91_pmc_base;
25#define at91_pmc_write(field, value) \ 25#define at91_pmc_write(field, value) \
26 __raw_writel(value, at91_pmc_base + field) 26 __raw_writel(value, at91_pmc_base + field)
27#else 27#else
28.extern at91_aic_base 28.extern at91_pmc_base
29#endif 29#endif
30 30
31#define AT91_PMC_SCER 0x00 /* System Clock Enable Register */ 31#define AT91_PMC_SCER 0x00 /* System Clock Enable Register */
diff --git a/arch/arm/mach-at91/include/mach/at91rm9200.h b/arch/arm/mach-at91/include/mach/at91rm9200.h
index 603e6aac2a4f..e67317c67761 100644
--- a/arch/arm/mach-at91/include/mach/at91rm9200.h
+++ b/arch/arm/mach-at91/include/mach/at91rm9200.h
@@ -88,11 +88,6 @@
88#define AT91RM9200_BASE_RTC 0xfffffe00 /* Real-Time Clock */ 88#define AT91RM9200_BASE_RTC 0xfffffe00 /* Real-Time Clock */
89#define AT91RM9200_BASE_MC 0xffffff00 /* Memory Controllers */ 89#define AT91RM9200_BASE_MC 0xffffff00 /* Memory Controllers */
90 90
91#define AT91_USART0 AT91RM9200_BASE_US0
92#define AT91_USART1 AT91RM9200_BASE_US1
93#define AT91_USART2 AT91RM9200_BASE_US2
94#define AT91_USART3 AT91RM9200_BASE_US3
95
96/* 91/*
97 * Internal Memory. 92 * Internal Memory.
98 */ 93 */
diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h
index 08ae9afd00fe..416c7b6c56d3 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9260.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9260.h
@@ -95,13 +95,6 @@
95#define AT91SAM9260_BASE_WDT 0xfffffd40 95#define AT91SAM9260_BASE_WDT 0xfffffd40
96#define AT91SAM9260_BASE_GPBR 0xfffffd50 96#define AT91SAM9260_BASE_GPBR 0xfffffd50
97 97
98#define AT91_USART0 AT91SAM9260_BASE_US0
99#define AT91_USART1 AT91SAM9260_BASE_US1
100#define AT91_USART2 AT91SAM9260_BASE_US2
101#define AT91_USART3 AT91SAM9260_BASE_US3
102#define AT91_USART4 AT91SAM9260_BASE_US4
103#define AT91_USART5 AT91SAM9260_BASE_US5
104
105 98
106/* 99/*
107 * Internal Memory. 100 * Internal Memory.
diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h
index 44fbdc12ee62..a041406d06ee 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9261.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9261.h
@@ -79,10 +79,6 @@
79#define AT91SAM9261_BASE_WDT 0xfffffd40 79#define AT91SAM9261_BASE_WDT 0xfffffd40
80#define AT91SAM9261_BASE_GPBR 0xfffffd50 80#define AT91SAM9261_BASE_GPBR 0xfffffd50
81 81
82#define AT91_USART0 AT91SAM9261_BASE_US0
83#define AT91_USART1 AT91SAM9261_BASE_US1
84#define AT91_USART2 AT91SAM9261_BASE_US2
85
86 82
87/* 83/*
88 * Internal Memory. 84 * Internal Memory.
diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h
index d96cbb2e03c4..d201029d60b3 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9263.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9263.h
@@ -95,10 +95,6 @@
95#define AT91SAM9263_BASE_RTT1 0xfffffd50 95#define AT91SAM9263_BASE_RTT1 0xfffffd50
96#define AT91SAM9263_BASE_GPBR 0xfffffd60 96#define AT91SAM9263_BASE_GPBR 0xfffffd60
97 97
98#define AT91_USART0 AT91SAM9263_BASE_US0
99#define AT91_USART1 AT91SAM9263_BASE_US1
100#define AT91_USART2 AT91SAM9263_BASE_US2
101
102#define AT91_SMC AT91_SMC0 98#define AT91_SMC AT91_SMC0
103 99
104/* 100/*
diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h
index d052abcff852..3a4da24d5911 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9g45.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h
@@ -106,11 +106,6 @@
106#define AT91SAM9G45_BASE_RTC 0xfffffdb0 106#define AT91SAM9G45_BASE_RTC 0xfffffdb0
107#define AT91SAM9G45_BASE_GPBR 0xfffffd60 107#define AT91SAM9G45_BASE_GPBR 0xfffffd60
108 108
109#define AT91_USART0 AT91SAM9G45_BASE_US0
110#define AT91_USART1 AT91SAM9G45_BASE_US1
111#define AT91_USART2 AT91SAM9G45_BASE_US2
112#define AT91_USART3 AT91SAM9G45_BASE_US3
113
114/* 109/*
115 * Internal Memory. 110 * Internal Memory.
116 */ 111 */
diff --git a/arch/arm/mach-at91/include/mach/at91sam9n12.h b/arch/arm/mach-at91/include/mach/at91sam9n12.h
new file mode 100644
index 000000000000..d374b87c0459
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91sam9n12.h
@@ -0,0 +1,60 @@
1/*
2 * SoC specific header file for the AT91SAM9N12
3 *
4 * Copyright (C) 2012 Atmel Corporation
5 *
6 * Common definitions, based on AT91SAM9N12 SoC datasheet
7 *
8 * Licensed under GPLv2 or later
9 */
10
11#ifndef _AT91SAM9N12_H_
12#define _AT91SAM9N12_H_
13
14/*
15 * Peripheral identifiers/interrupts.
16 */
17#define AT91SAM9N12_ID_PIOAB 2 /* Parallel I/O Controller A and B */
18#define AT91SAM9N12_ID_PIOCD 3 /* Parallel I/O Controller C and D */
19#define AT91SAM9N12_ID_FUSE 4 /* FUSE Controller */
20#define AT91SAM9N12_ID_USART0 5 /* USART 0 */
21#define AT91SAM9N12_ID_USART1 6 /* USART 1 */
22#define AT91SAM9N12_ID_USART2 7 /* USART 2 */
23#define AT91SAM9N12_ID_USART3 8 /* USART 3 */
24#define AT91SAM9N12_ID_TWI0 9 /* Two-Wire Interface 0 */
25#define AT91SAM9N12_ID_TWI1 10 /* Two-Wire Interface 1 */
26#define AT91SAM9N12_ID_MCI 12 /* High Speed Multimedia Card Interface */
27#define AT91SAM9N12_ID_SPI0 13 /* Serial Peripheral Interface 0 */
28#define AT91SAM9N12_ID_SPI1 14 /* Serial Peripheral Interface 1 */
29#define AT91SAM9N12_ID_UART0 15 /* UART 0 */
30#define AT91SAM9N12_ID_UART1 16 /* UART 1 */
31#define AT91SAM9N12_ID_TCB 17 /* Timer Counter 0, 1, 2, 3, 4 and 5 */
32#define AT91SAM9N12_ID_PWM 18 /* Pulse Width Modulation Controller */
33#define AT91SAM9N12_ID_ADC 19 /* ADC Controller */
34#define AT91SAM9N12_ID_DMA 20 /* DMA Controller */
35#define AT91SAM9N12_ID_UHP 22 /* USB Host High Speed */
36#define AT91SAM9N12_ID_UDP 23 /* USB Device High Speed */
37#define AT91SAM9N12_ID_LCDC 25 /* LCD Controller */
38#define AT91SAM9N12_ID_ISI 25 /* Image Sensor Interface */
39#define AT91SAM9N12_ID_SSC 28 /* Synchronous Serial Controller */
40#define AT91SAM9N12_ID_TRNG 30 /* TRNG */
41#define AT91SAM9N12_ID_IRQ0 31 /* Advanced Interrupt Controller */
42
43/*
44 * User Peripheral physical base addresses.
45 */
46#define AT91SAM9N12_BASE_USART0 0xf801c000
47#define AT91SAM9N12_BASE_USART1 0xf8020000
48#define AT91SAM9N12_BASE_USART2 0xf8024000
49#define AT91SAM9N12_BASE_USART3 0xf8028000
50
51/*
52 * Internal Memory.
53 */
54#define AT91SAM9N12_SRAM_BASE 0x00300000 /* Internal SRAM base address */
55#define AT91SAM9N12_SRAM_SIZE SZ_32K /* Internal SRAM size (32Kb) */
56
57#define AT91SAM9N12_ROM_BASE 0x00100000 /* Internal ROM base address */
58#define AT91SAM9N12_ROM_SIZE SZ_128K /* Internal ROM size (128Kb) */
59
60#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9n12_matrix.h b/arch/arm/mach-at91/include/mach/at91sam9n12_matrix.h
new file mode 100644
index 000000000000..40060cd62fa9
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91sam9n12_matrix.h
@@ -0,0 +1,53 @@
1/*
2 * Matrix-centric header file for the AT91SAM9N12
3 *
4 * Copyright (C) 2012 Atmel Corporation.
5 *
6 * Only EBI related registers.
7 * Write Protect register definitions may be useful.
8 *
9 * Licensed under GPLv2 or later.
10 */
11
12#ifndef _AT91SAM9N12_MATRIX_H_
13#define _AT91SAM9N12_MATRIX_H_
14
15#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x118) /* EBI Chip Select Assignment Register */
16#define AT91_MATRIX_EBI_CS1A (1 << 1) /* Chip Select 1 Assignment */
17#define AT91_MATRIX_EBI_CS1A_SMC (0 << 1)
18#define AT91_MATRIX_EBI_CS1A_SDRAMC (1 << 1)
19#define AT91_MATRIX_EBI_CS3A (1 << 3) /* Chip Select 3 Assignment */
20#define AT91_MATRIX_EBI_CS3A_SMC (0 << 3)
21#define AT91_MATRIX_EBI_CS3A_SMC_NANDFLASH (1 << 3)
22#define AT91_MATRIX_EBI_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */
23#define AT91_MATRIX_EBI_DBPU_ON (0 << 8)
24#define AT91_MATRIX_EBI_DBPU_OFF (1 << 8)
25#define AT91_MATRIX_EBI_VDDIOMSEL (1 << 16) /* Memory voltage selection */
26#define AT91_MATRIX_EBI_VDDIOMSEL_1_8V (0 << 16)
27#define AT91_MATRIX_EBI_VDDIOMSEL_3_3V (1 << 16)
28#define AT91_MATRIX_EBI_EBI_IOSR (1 << 17) /* EBI I/O slew rate selection */
29#define AT91_MATRIX_EBI_EBI_IOSR_REDUCED (0 << 17)
30#define AT91_MATRIX_EBI_EBI_IOSR_NORMAL (1 << 17)
31#define AT91_MATRIX_EBI_DDR_IOSR (1 << 18) /* DDR2 dedicated port I/O slew rate selection */
32#define AT91_MATRIX_EBI_DDR_IOSR_REDUCED (0 << 18)
33#define AT91_MATRIX_EBI_DDR_IOSR_NORMAL (1 << 18)
34#define AT91_MATRIX_NFD0_SELECT (1 << 24) /* NAND Flash Data Bus Selection */
35#define AT91_MATRIX_NFD0_ON_D0 (0 << 24)
36#define AT91_MATRIX_NFD0_ON_D16 (1 << 24)
37#define AT91_MATRIX_DDR_MP_EN (1 << 25) /* DDR Multi-port Enable */
38#define AT91_MATRIX_MP_OFF (0 << 25)
39#define AT91_MATRIX_MP_ON (1 << 25)
40
41#define AT91_MATRIX_WPMR (AT91_MATRIX + 0x1E4) /* Write Protect Mode Register */
42#define AT91_MATRIX_WPMR_WPEN (1 << 0) /* Write Protect ENable */
43#define AT91_MATRIX_WPMR_WP_WPDIS (0 << 0)
44#define AT91_MATRIX_WPMR_WP_WPEN (1 << 0)
45#define AT91_MATRIX_WPMR_WPKEY (0xFFFFFF << 8) /* Write Protect KEY */
46
47#define AT91_MATRIX_WPSR (AT91_MATRIX + 0x1E8) /* Write Protect Status Register */
48#define AT91_MATRIX_WPSR_WPVS (1 << 0) /* Write Protect Violation Status */
49#define AT91_MATRIX_WPSR_NO_WPV (0 << 0)
50#define AT91_MATRIX_WPSR_WPV (1 << 0)
51#define AT91_MATRIX_WPSR_WPVSRC (0xFFFF << 8) /* Write Protect Violation Source */
52
53#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h
index e0073eb10144..a15db56d33fa 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9rl.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h
@@ -89,11 +89,6 @@
89#define AT91SAM9RL_BASE_GPBR 0xfffffd60 89#define AT91SAM9RL_BASE_GPBR 0xfffffd60
90#define AT91SAM9RL_BASE_RTC 0xfffffe00 90#define AT91SAM9RL_BASE_RTC 0xfffffe00
91 91
92#define AT91_USART0 AT91SAM9RL_BASE_US0
93#define AT91_USART1 AT91SAM9RL_BASE_US1
94#define AT91_USART2 AT91SAM9RL_BASE_US2
95#define AT91_USART3 AT91SAM9RL_BASE_US3
96
97 92
98/* 93/*
99 * Internal Memory. 94 * Internal Memory.
diff --git a/arch/arm/mach-at91/include/mach/at91sam9x5.h b/arch/arm/mach-at91/include/mach/at91sam9x5.h
index 88e43d534cdf..c75ee19b58d3 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9x5.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9x5.h
@@ -55,14 +55,6 @@
55#define AT91SAM9X5_BASE_USART2 0xf8024000 55#define AT91SAM9X5_BASE_USART2 0xf8024000
56 56
57/* 57/*
58 * Base addresses for early serial code (uncompress.h)
59 */
60#define AT91_DBGU AT91_BASE_DBGU0
61#define AT91_USART0 AT91SAM9X5_BASE_USART0
62#define AT91_USART1 AT91SAM9X5_BASE_USART1
63#define AT91_USART2 AT91SAM9X5_BASE_USART2
64
65/*
66 * Internal Memory. 58 * Internal Memory.
67 */ 59 */
68#define AT91SAM9X5_SRAM_BASE 0x00300000 /* Internal SRAM base address */ 60#define AT91SAM9X5_SRAM_BASE 0x00300000 /* Internal SRAM base address */
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index 49a821192c65..369afc2ffc5b 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -121,7 +121,6 @@ extern void __init at91_add_device_spi(struct spi_board_info *devices, int nr_de
121#define ATMEL_UART_RI 0x20 121#define ATMEL_UART_RI 0x20
122 122
123extern void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins); 123extern void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins);
124extern void __init at91_set_serial_console(unsigned portnr);
125 124
126extern struct platform_device *atmel_default_console_device; 125extern struct platform_device *atmel_default_console_device;
127 126
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h
index 0118c3338552..b6504c19d55c 100644
--- a/arch/arm/mach-at91/include/mach/cpu.h
+++ b/arch/arm/mach-at91/include/mach/cpu.h
@@ -25,6 +25,7 @@
25#define ARCH_ID_AT91SAM9G45MRL 0x819b05a2 /* aka 9G45-ES2 & non ES lots */ 25#define ARCH_ID_AT91SAM9G45MRL 0x819b05a2 /* aka 9G45-ES2 & non ES lots */
26#define ARCH_ID_AT91SAM9G45ES 0x819b05a1 /* 9G45-ES (Engineering Sample) */ 26#define ARCH_ID_AT91SAM9G45ES 0x819b05a1 /* 9G45-ES (Engineering Sample) */
27#define ARCH_ID_AT91SAM9X5 0x819a05a0 27#define ARCH_ID_AT91SAM9X5 0x819a05a0
28#define ARCH_ID_AT91SAM9N12 0x819a07a0
28 29
29#define ARCH_ID_AT91SAM9XE128 0x329973a0 30#define ARCH_ID_AT91SAM9XE128 0x329973a0
30#define ARCH_ID_AT91SAM9XE256 0x329a93a0 31#define ARCH_ID_AT91SAM9XE256 0x329a93a0
@@ -54,6 +55,7 @@
54#define ARCH_REVISON_9200_BGA (0 << 0) 55#define ARCH_REVISON_9200_BGA (0 << 0)
55#define ARCH_REVISON_9200_PQFP (1 << 0) 56#define ARCH_REVISON_9200_PQFP (1 << 0)
56 57
58#ifndef __ASSEMBLY__
57enum at91_soc_type { 59enum at91_soc_type {
58 /* 920T */ 60 /* 920T */
59 AT91_SOC_RM9200, 61 AT91_SOC_RM9200,
@@ -70,6 +72,9 @@ enum at91_soc_type {
70 /* SAM9X5 */ 72 /* SAM9X5 */
71 AT91_SOC_SAM9X5, 73 AT91_SOC_SAM9X5,
72 74
75 /* SAM9N12 */
76 AT91_SOC_SAM9N12,
77
73 /* Unknown type */ 78 /* Unknown type */
74 AT91_SOC_NONE 79 AT91_SOC_NONE
75}; 80};
@@ -106,7 +111,7 @@ static inline int at91_soc_is_detected(void)
106 return at91_soc_initdata.type != AT91_SOC_NONE; 111 return at91_soc_initdata.type != AT91_SOC_NONE;
107} 112}
108 113
109#ifdef CONFIG_ARCH_AT91RM9200 114#ifdef CONFIG_SOC_AT91RM9200
110#define cpu_is_at91rm9200() (at91_soc_initdata.type == AT91_SOC_RM9200) 115#define cpu_is_at91rm9200() (at91_soc_initdata.type == AT91_SOC_RM9200)
111#define cpu_is_at91rm9200_bga() (at91_soc_initdata.subtype == AT91_SOC_RM9200_BGA) 116#define cpu_is_at91rm9200_bga() (at91_soc_initdata.subtype == AT91_SOC_RM9200_BGA)
112#define cpu_is_at91rm9200_pqfp() (at91_soc_initdata.subtype == AT91_SOC_RM9200_PQFP) 117#define cpu_is_at91rm9200_pqfp() (at91_soc_initdata.subtype == AT91_SOC_RM9200_PQFP)
@@ -116,45 +121,37 @@ static inline int at91_soc_is_detected(void)
116#define cpu_is_at91rm9200_pqfp() (0) 121#define cpu_is_at91rm9200_pqfp() (0)
117#endif 122#endif
118 123
119#ifdef CONFIG_ARCH_AT91SAM9260 124#ifdef CONFIG_SOC_AT91SAM9260
120#define cpu_is_at91sam9xe() (at91_soc_initdata.subtype == AT91_SOC_SAM9XE) 125#define cpu_is_at91sam9xe() (at91_soc_initdata.subtype == AT91_SOC_SAM9XE)
121#define cpu_is_at91sam9260() (at91_soc_initdata.type == AT91_SOC_SAM9260) 126#define cpu_is_at91sam9260() (at91_soc_initdata.type == AT91_SOC_SAM9260)
127#define cpu_is_at91sam9g20() (at91_soc_initdata.type == AT91_SOC_SAM9G20)
122#else 128#else
123#define cpu_is_at91sam9xe() (0) 129#define cpu_is_at91sam9xe() (0)
124#define cpu_is_at91sam9260() (0) 130#define cpu_is_at91sam9260() (0)
125#endif
126
127#ifdef CONFIG_ARCH_AT91SAM9G20
128#define cpu_is_at91sam9g20() (at91_soc_initdata.type == AT91_SOC_SAM9G20)
129#else
130#define cpu_is_at91sam9g20() (0) 131#define cpu_is_at91sam9g20() (0)
131#endif 132#endif
132 133
133#ifdef CONFIG_ARCH_AT91SAM9261 134#ifdef CONFIG_SOC_AT91SAM9261
134#define cpu_is_at91sam9261() (at91_soc_initdata.type == AT91_SOC_SAM9261) 135#define cpu_is_at91sam9261() (at91_soc_initdata.type == AT91_SOC_SAM9261)
135#else
136#define cpu_is_at91sam9261() (0)
137#endif
138
139#ifdef CONFIG_ARCH_AT91SAM9G10
140#define cpu_is_at91sam9g10() (at91_soc_initdata.type == AT91_SOC_SAM9G10) 136#define cpu_is_at91sam9g10() (at91_soc_initdata.type == AT91_SOC_SAM9G10)
141#else 137#else
138#define cpu_is_at91sam9261() (0)
142#define cpu_is_at91sam9g10() (0) 139#define cpu_is_at91sam9g10() (0)
143#endif 140#endif
144 141
145#ifdef CONFIG_ARCH_AT91SAM9263 142#ifdef CONFIG_SOC_AT91SAM9263
146#define cpu_is_at91sam9263() (at91_soc_initdata.type == AT91_SOC_SAM9263) 143#define cpu_is_at91sam9263() (at91_soc_initdata.type == AT91_SOC_SAM9263)
147#else 144#else
148#define cpu_is_at91sam9263() (0) 145#define cpu_is_at91sam9263() (0)
149#endif 146#endif
150 147
151#ifdef CONFIG_ARCH_AT91SAM9RL 148#ifdef CONFIG_SOC_AT91SAM9RL
152#define cpu_is_at91sam9rl() (at91_soc_initdata.type == AT91_SOC_SAM9RL) 149#define cpu_is_at91sam9rl() (at91_soc_initdata.type == AT91_SOC_SAM9RL)
153#else 150#else
154#define cpu_is_at91sam9rl() (0) 151#define cpu_is_at91sam9rl() (0)
155#endif 152#endif
156 153
157#ifdef CONFIG_ARCH_AT91SAM9G45 154#ifdef CONFIG_SOC_AT91SAM9G45
158#define cpu_is_at91sam9g45() (at91_soc_initdata.type == AT91_SOC_SAM9G45) 155#define cpu_is_at91sam9g45() (at91_soc_initdata.type == AT91_SOC_SAM9G45)
159#define cpu_is_at91sam9g45es() (at91_soc_initdata.subtype == AT91_SOC_SAM9G45ES) 156#define cpu_is_at91sam9g45es() (at91_soc_initdata.subtype == AT91_SOC_SAM9G45ES)
160#define cpu_is_at91sam9m10() (at91_soc_initdata.subtype == AT91_SOC_SAM9M10) 157#define cpu_is_at91sam9m10() (at91_soc_initdata.subtype == AT91_SOC_SAM9M10)
@@ -168,7 +165,7 @@ static inline int at91_soc_is_detected(void)
168#define cpu_is_at91sam9m11() (0) 165#define cpu_is_at91sam9m11() (0)
169#endif 166#endif
170 167
171#ifdef CONFIG_ARCH_AT91SAM9X5 168#ifdef CONFIG_SOC_AT91SAM9X5
172#define cpu_is_at91sam9x5() (at91_soc_initdata.type == AT91_SOC_SAM9X5) 169#define cpu_is_at91sam9x5() (at91_soc_initdata.type == AT91_SOC_SAM9X5)
173#define cpu_is_at91sam9g15() (at91_soc_initdata.subtype == AT91_SOC_SAM9G15) 170#define cpu_is_at91sam9g15() (at91_soc_initdata.subtype == AT91_SOC_SAM9G15)
174#define cpu_is_at91sam9g35() (at91_soc_initdata.subtype == AT91_SOC_SAM9G35) 171#define cpu_is_at91sam9g35() (at91_soc_initdata.subtype == AT91_SOC_SAM9G35)
@@ -184,10 +181,17 @@ static inline int at91_soc_is_detected(void)
184#define cpu_is_at91sam9x25() (0) 181#define cpu_is_at91sam9x25() (0)
185#endif 182#endif
186 183
184#ifdef CONFIG_SOC_AT91SAM9N12
185#define cpu_is_at91sam9n12() (at91_soc_initdata.type == AT91_SOC_SAM9N12)
186#else
187#define cpu_is_at91sam9n12() (0)
188#endif
189
187/* 190/*
188 * Since this is ARM, we will never run on any AVR32 CPU. But these 191 * Since this is ARM, we will never run on any AVR32 CPU. But these
189 * definitions may reduce clutter in common drivers. 192 * definitions may reduce clutter in common drivers.
190 */ 193 */
191#define cpu_is_at32ap7000() (0) 194#define cpu_is_at32ap7000() (0)
195#endif /* __ASSEMBLY__ */
192 196
193#endif /* __MACH_CPU_H__ */ 197#endif /* __MACH_CPU_H__ */
diff --git a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h
index e9e29a6c3868..09242b67d277 100644
--- a/arch/arm/mach-at91/include/mach/hardware.h
+++ b/arch/arm/mach-at91/include/mach/hardware.h
@@ -22,27 +22,18 @@
22/* 9263, 9g45 */ 22/* 9263, 9g45 */
23#define AT91_BASE_DBGU1 0xffffee00 23#define AT91_BASE_DBGU1 0xffffee00
24 24
25#if defined(CONFIG_ARCH_AT91RM9200) 25#if defined(CONFIG_ARCH_AT91X40)
26#include <mach/at91x40.h>
27#else
26#include <mach/at91rm9200.h> 28#include <mach/at91rm9200.h>
27#elif defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9G20)
28#include <mach/at91sam9260.h> 29#include <mach/at91sam9260.h>
29#elif defined(CONFIG_ARCH_AT91SAM9261) || defined(CONFIG_ARCH_AT91SAM9G10)
30#include <mach/at91sam9261.h> 30#include <mach/at91sam9261.h>
31#elif defined(CONFIG_ARCH_AT91SAM9263)
32#include <mach/at91sam9263.h> 31#include <mach/at91sam9263.h>
33#elif defined(CONFIG_ARCH_AT91SAM9RL)
34#include <mach/at91sam9rl.h> 32#include <mach/at91sam9rl.h>
35#elif defined(CONFIG_ARCH_AT91SAM9G45)
36#include <mach/at91sam9g45.h> 33#include <mach/at91sam9g45.h>
37#elif defined(CONFIG_ARCH_AT91SAM9X5)
38#include <mach/at91sam9x5.h> 34#include <mach/at91sam9x5.h>
39#elif defined(CONFIG_ARCH_AT91X40) 35#include <mach/at91sam9n12.h>
40#include <mach/at91x40.h>
41#else
42#error "Unsupported AT91 processor"
43#endif
44 36
45#if !defined(CONFIG_ARCH_AT91X40)
46/* 37/*
47 * On all at91 except rm9200 and x40 have the System Controller starts 38 * On all at91 except rm9200 and x40 have the System Controller starts
48 * at address 0xffffc000 and has a size of 16KiB. 39 * at address 0xffffc000 and has a size of 16KiB.
@@ -94,7 +85,6 @@
94 * Virtual to Physical Address mapping for IO devices. 85 * Virtual to Physical Address mapping for IO devices.
95 */ 86 */
96#define AT91_VA_BASE_SYS AT91_IO_P2V(AT91_BASE_SYS) 87#define AT91_VA_BASE_SYS AT91_IO_P2V(AT91_BASE_SYS)
97#define AT91_VA_BASE_EMAC AT91_IO_P2V(AT91RM9200_BASE_EMAC)
98 88
99 /* Internal SRAM is mapped below the IO devices */ 89 /* Internal SRAM is mapped below the IO devices */
100#define AT91_SRAM_MAX SZ_1M 90#define AT91_SRAM_MAX SZ_1M
diff --git a/arch/arm/mach-at91/include/mach/uncompress.h b/arch/arm/mach-at91/include/mach/uncompress.h
index 4218647c1fcd..6f6118d1576a 100644
--- a/arch/arm/mach-at91/include/mach/uncompress.h
+++ b/arch/arm/mach-at91/include/mach/uncompress.h
@@ -1,7 +1,8 @@
1/* 1/*
2 * arch/arm/mach-at91/include/mach/uncompress.h 2 * arch/arm/mach-at91/include/mach/uncompress.h
3 * 3 *
4 * Copyright (C) 2003 SAN People 4 * Copyright (C) 2003 SAN People
5 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -25,22 +26,147 @@
25#include <linux/atmel_serial.h> 26#include <linux/atmel_serial.h>
26#include <mach/hardware.h> 27#include <mach/hardware.h>
27 28
28#if defined(CONFIG_AT91_EARLY_DBGU0) 29#include <mach/at91_dbgu.h>
29#define UART_OFFSET AT91_BASE_DBGU0 30#include <mach/cpu.h>
30#elif defined(CONFIG_AT91_EARLY_DBGU1) 31
31#define UART_OFFSET AT91_BASE_DBGU1 32void __iomem *at91_uart;
32#elif defined(CONFIG_AT91_EARLY_USART0) 33
33#define UART_OFFSET AT91_USART0 34#if !defined(CONFIG_ARCH_AT91X40)
34#elif defined(CONFIG_AT91_EARLY_USART1) 35static const u32 uarts_rm9200[] = {
35#define UART_OFFSET AT91_USART1 36 AT91_BASE_DBGU0,
36#elif defined(CONFIG_AT91_EARLY_USART2) 37 AT91RM9200_BASE_US0,
37#define UART_OFFSET AT91_USART2 38 AT91RM9200_BASE_US1,
38#elif defined(CONFIG_AT91_EARLY_USART3) 39 AT91RM9200_BASE_US2,
39#define UART_OFFSET AT91_USART3 40 AT91RM9200_BASE_US3,
40#elif defined(CONFIG_AT91_EARLY_USART4) 41 0,
41#define UART_OFFSET AT91_USART4 42};
42#elif defined(CONFIG_AT91_EARLY_USART5) 43
43#define UART_OFFSET AT91_USART5 44static const u32 uarts_sam9260[] = {
45 AT91_BASE_DBGU0,
46 AT91SAM9260_BASE_US0,
47 AT91SAM9260_BASE_US1,
48 AT91SAM9260_BASE_US2,
49 AT91SAM9260_BASE_US3,
50 AT91SAM9260_BASE_US4,
51 AT91SAM9260_BASE_US5,
52 0,
53};
54
55static const u32 uarts_sam9261[] = {
56 AT91_BASE_DBGU0,
57 AT91SAM9261_BASE_US0,
58 AT91SAM9261_BASE_US1,
59 AT91SAM9261_BASE_US2,
60 0,
61};
62
63static const u32 uarts_sam9263[] = {
64 AT91_BASE_DBGU1,
65 AT91SAM9263_BASE_US0,
66 AT91SAM9263_BASE_US1,
67 AT91SAM9263_BASE_US2,
68 0,
69};
70
71static const u32 uarts_sam9g45[] = {
72 AT91_BASE_DBGU1,
73 AT91SAM9G45_BASE_US0,
74 AT91SAM9G45_BASE_US1,
75 AT91SAM9G45_BASE_US2,
76 AT91SAM9G45_BASE_US3,
77 0,
78};
79
80static const u32 uarts_sam9rl[] = {
81 AT91_BASE_DBGU0,
82 AT91SAM9RL_BASE_US0,
83 AT91SAM9RL_BASE_US1,
84 AT91SAM9RL_BASE_US2,
85 AT91SAM9RL_BASE_US3,
86 0,
87};
88
89static const u32 uarts_sam9x5[] = {
90 AT91_BASE_DBGU0,
91 AT91SAM9X5_BASE_USART0,
92 AT91SAM9X5_BASE_USART1,
93 AT91SAM9X5_BASE_USART2,
94 0,
95};
96
97static inline const u32* decomp_soc_detect(u32 dbgu_base)
98{
99 u32 cidr, socid;
100
101 cidr = __raw_readl(dbgu_base + AT91_DBGU_CIDR);
102 socid = cidr & ~AT91_CIDR_VERSION;
103
104 switch (socid) {
105 case ARCH_ID_AT91RM9200:
106 return uarts_rm9200;
107
108 case ARCH_ID_AT91SAM9G20:
109 case ARCH_ID_AT91SAM9260:
110 return uarts_sam9260;
111
112 case ARCH_ID_AT91SAM9261:
113 return uarts_sam9261;
114
115 case ARCH_ID_AT91SAM9263:
116 return uarts_sam9263;
117
118 case ARCH_ID_AT91SAM9G45:
119 return uarts_sam9g45;
120
121 case ARCH_ID_AT91SAM9RL64:
122 return uarts_sam9rl;
123
124 case ARCH_ID_AT91SAM9X5:
125 return uarts_sam9x5;
126 }
127
128 /* at91sam9g10 */
129 if ((cidr & ~AT91_CIDR_EXT) == ARCH_ID_AT91SAM9G10) {
130 return uarts_sam9261;
131 }
132 /* at91sam9xe */
133 else if ((cidr & AT91_CIDR_ARCH) == ARCH_FAMILY_AT91SAM9XE) {
134 return uarts_sam9260;
135 }
136
137 return NULL;
138}
139
140static inline void arch_decomp_setup(void)
141{
142 int i = 0;
143 const u32* usarts;
144
145 usarts = decomp_soc_detect(AT91_BASE_DBGU0);
146
147 if (!usarts)
148 usarts = decomp_soc_detect(AT91_BASE_DBGU1);
149 if (!usarts) {
150 at91_uart = NULL;
151 return;
152 }
153
154 do {
155 /* physical address */
156 at91_uart = (void __iomem *)usarts[i];
157
158 if (__raw_readl(at91_uart + ATMEL_US_BRGR))
159 return;
160 i++;
161 } while (usarts[i]);
162
163 at91_uart = NULL;
164}
165#else
166static inline void arch_decomp_setup(void)
167{
168 at91_uart = NULL;
169}
44#endif 170#endif
45 171
46/* 172/*
@@ -52,28 +178,24 @@
52 */ 178 */
53static void putc(int c) 179static void putc(int c)
54{ 180{
55#ifdef UART_OFFSET 181 if (!at91_uart)
56 void __iomem *sys = (void __iomem *) UART_OFFSET; /* physical address */ 182 return;
57 183
58 while (!(__raw_readl(sys + ATMEL_US_CSR) & ATMEL_US_TXRDY)) 184 while (!(__raw_readl(at91_uart + ATMEL_US_CSR) & ATMEL_US_TXRDY))
59 barrier(); 185 barrier();
60 __raw_writel(c, sys + ATMEL_US_THR); 186 __raw_writel(c, at91_uart + ATMEL_US_THR);
61#endif
62} 187}
63 188
64static inline void flush(void) 189static inline void flush(void)
65{ 190{
66#ifdef UART_OFFSET 191 if (!at91_uart)
67 void __iomem *sys = (void __iomem *) UART_OFFSET; /* physical address */ 192 return;
68 193
69 /* wait for transmission to complete */ 194 /* wait for transmission to complete */
70 while (!(__raw_readl(sys + ATMEL_US_CSR) & ATMEL_US_TXEMPTY)) 195 while (!(__raw_readl(at91_uart + ATMEL_US_CSR) & ATMEL_US_TXEMPTY))
71 barrier(); 196 barrier();
72#endif
73} 197}
74 198
75#define arch_decomp_setup()
76
77#define arch_decomp_wdog() 199#define arch_decomp_wdog()
78 200
79#endif 201#endif
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index f630250c6b87..1bfaad628731 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -261,7 +261,12 @@ static int at91_pm_enter(suspend_state_t state)
261 * For ARM 926 based chips, this requirement is weaker 261 * For ARM 926 based chips, this requirement is weaker
262 * as at91sam9 can access a RAM in self-refresh mode. 262 * as at91sam9 can access a RAM in self-refresh mode.
263 */ 263 */
264 at91_standby(); 264 if (cpu_is_at91rm9200())
265 at91rm9200_standby();
266 else if (cpu_is_at91sam9g45())
267 at91sam9g45_standby();
268 else
269 at91sam9_standby();
265 break; 270 break;
266 271
267 case PM_SUSPEND_ON: 272 case PM_SUSPEND_ON:
@@ -307,10 +312,9 @@ static int __init at91_pm_init(void)
307 312
308 pr_info("AT91: Power Management%s\n", (slow_clock ? " (with slow clock mode)" : "")); 313 pr_info("AT91: Power Management%s\n", (slow_clock ? " (with slow clock mode)" : ""));
309 314
310#ifdef CONFIG_ARCH_AT91RM9200
311 /* AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. */ 315 /* AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. */
312 at91_ramc_write(0, AT91RM9200_SDRAMC_LPR, 0); 316 if (cpu_is_at91rm9200())
313#endif 317 at91_ramc_write(0, AT91RM9200_SDRAMC_LPR, 0);
314 318
315 suspend_set_ops(&at91_pm_ops); 319 suspend_set_ops(&at91_pm_ops);
316 320
diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h
index 89f56f3a802e..38f467c6b710 100644
--- a/arch/arm/mach-at91/pm.h
+++ b/arch/arm/mach-at91/pm.h
@@ -12,7 +12,6 @@
12#define __ARCH_ARM_MACH_AT91_PM 12#define __ARCH_ARM_MACH_AT91_PM
13 13
14#include <mach/at91_ramc.h> 14#include <mach/at91_ramc.h>
15#ifdef CONFIG_ARCH_AT91RM9200
16#include <mach/at91rm9200_sdramc.h> 15#include <mach/at91rm9200_sdramc.h>
17 16
18/* 17/*
@@ -43,10 +42,6 @@ static inline void at91rm9200_standby(void)
43 "r" (lpr)); 42 "r" (lpr));
44} 43}
45 44
46#define at91_standby at91rm9200_standby
47
48#elif defined(CONFIG_ARCH_AT91SAM9G45)
49
50/* We manage both DDRAM/SDRAM controllers, we need more than one value to 45/* We manage both DDRAM/SDRAM controllers, we need more than one value to
51 * remember. 46 * remember.
52 */ 47 */
@@ -75,11 +70,7 @@ static inline void at91sam9g45_standby(void)
75 at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1); 70 at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1);
76} 71}
77 72
78#define at91_standby at91sam9g45_standby 73#ifdef CONFIG_SOC_AT91SAM9263
79
80#else
81
82#ifdef CONFIG_ARCH_AT91SAM9263
83/* 74/*
84 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use; 75 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use;
85 * handle those cases both here and in the Suspend-To-RAM support. 76 * handle those cases both here and in the Suspend-To-RAM support.
@@ -102,8 +93,4 @@ static inline void at91sam9_standby(void)
102 at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr); 93 at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr);
103} 94}
104 95
105#define at91_standby at91sam9_standby
106
107#endif
108
109#endif 96#endif
diff --git a/arch/arm/mach-at91/pm_slowclock.S b/arch/arm/mach-at91/pm_slowclock.S
index db5452123f17..098c28ddf025 100644
--- a/arch/arm/mach-at91/pm_slowclock.S
+++ b/arch/arm/mach-at91/pm_slowclock.S
@@ -18,7 +18,7 @@
18#include <mach/at91_ramc.h> 18#include <mach/at91_ramc.h>
19 19
20 20
21#ifdef CONFIG_ARCH_AT91SAM9263 21#ifdef CONFIG_SOC_AT91SAM9263
22/* 22/*
23 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use; 23 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use;
24 * handle those cases both here and in the Suspend-To-RAM support. 24 * handle those cases both here and in the Suspend-To-RAM support.
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 97cc04dc8073..944bffb08991 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -54,6 +54,7 @@ void __init at91_init_interrupts(unsigned int *priority)
54} 54}
55 55
56void __iomem *at91_ramc_base[2]; 56void __iomem *at91_ramc_base[2];
57EXPORT_SYMBOL_GPL(at91_ramc_base);
57 58
58void __init at91_ioremap_ramc(int id, u32 addr, u32 size) 59void __init at91_ioremap_ramc(int id, u32 addr, u32 size)
59{ 60{
@@ -142,6 +143,11 @@ static void __init soc_detect(u32 dbgu_base)
142 at91_soc_initdata.type = AT91_SOC_SAM9X5; 143 at91_soc_initdata.type = AT91_SOC_SAM9X5;
143 at91_boot_soc = at91sam9x5_soc; 144 at91_boot_soc = at91sam9x5_soc;
144 break; 145 break;
146
147 case ARCH_ID_AT91SAM9N12:
148 at91_soc_initdata.type = AT91_SOC_SAM9N12;
149 at91_boot_soc = at91sam9n12_soc;
150 break;
145 } 151 }
146 152
147 /* at91sam9g10 */ 153 /* at91sam9g10 */
@@ -209,6 +215,7 @@ static const char *soc_name[] = {
209 [AT91_SOC_SAM9G45] = "at91sam9g45", 215 [AT91_SOC_SAM9G45] = "at91sam9g45",
210 [AT91_SOC_SAM9RL] = "at91sam9rl", 216 [AT91_SOC_SAM9RL] = "at91sam9rl",
211 [AT91_SOC_SAM9X5] = "at91sam9x5", 217 [AT91_SOC_SAM9X5] = "at91sam9x5",
218 [AT91_SOC_SAM9N12] = "at91sam9n12",
212 [AT91_SOC_NONE] = "Unknown" 219 [AT91_SOC_NONE] = "Unknown"
213}; 220};
214 221
@@ -292,6 +299,7 @@ void __init at91_ioremap_rstc(u32 base_addr)
292} 299}
293 300
294void __iomem *at91_matrix_base; 301void __iomem *at91_matrix_base;
302EXPORT_SYMBOL_GPL(at91_matrix_base);
295 303
296void __init at91_ioremap_matrix(u32 base_addr) 304void __init at91_ioremap_matrix(u32 base_addr)
297{ 305{
diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h
index 5db4aa45404a..a9cfeb153719 100644
--- a/arch/arm/mach-at91/soc.h
+++ b/arch/arm/mach-at91/soc.h
@@ -20,36 +20,41 @@ extern struct at91_init_soc at91sam9263_soc;
20extern struct at91_init_soc at91sam9g45_soc; 20extern struct at91_init_soc at91sam9g45_soc;
21extern struct at91_init_soc at91sam9rl_soc; 21extern struct at91_init_soc at91sam9rl_soc;
22extern struct at91_init_soc at91sam9x5_soc; 22extern struct at91_init_soc at91sam9x5_soc;
23extern struct at91_init_soc at91sam9n12_soc;
23 24
24static inline int at91_soc_is_enabled(void) 25static inline int at91_soc_is_enabled(void)
25{ 26{
26 return at91_boot_soc.init != NULL; 27 return at91_boot_soc.init != NULL;
27} 28}
28 29
29#if !defined(CONFIG_ARCH_AT91RM9200) 30#if !defined(CONFIG_SOC_AT91RM9200)
30#define at91rm9200_soc at91_boot_soc 31#define at91rm9200_soc at91_boot_soc
31#endif 32#endif
32 33
33#if !(defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9G20)) 34#if !defined(CONFIG_SOC_AT91SAM9260)
34#define at91sam9260_soc at91_boot_soc 35#define at91sam9260_soc at91_boot_soc
35#endif 36#endif
36 37
37#if !(defined(CONFIG_ARCH_AT91SAM9261) || defined(CONFIG_ARCH_AT91SAM9G10)) 38#if !defined(CONFIG_SOC_AT91SAM9261)
38#define at91sam9261_soc at91_boot_soc 39#define at91sam9261_soc at91_boot_soc
39#endif 40#endif
40 41
41#if !defined(CONFIG_ARCH_AT91SAM9263) 42#if !defined(CONFIG_SOC_AT91SAM9263)
42#define at91sam9263_soc at91_boot_soc 43#define at91sam9263_soc at91_boot_soc
43#endif 44#endif
44 45
45#if !defined(CONFIG_ARCH_AT91SAM9G45) 46#if !defined(CONFIG_SOC_AT91SAM9G45)
46#define at91sam9g45_soc at91_boot_soc 47#define at91sam9g45_soc at91_boot_soc
47#endif 48#endif
48 49
49#if !defined(CONFIG_ARCH_AT91SAM9RL) 50#if !defined(CONFIG_SOC_AT91SAM9RL)
50#define at91sam9rl_soc at91_boot_soc 51#define at91sam9rl_soc at91_boot_soc
51#endif 52#endif
52 53
53#if !defined(CONFIG_ARCH_AT91SAM9X5) 54#if !defined(CONFIG_SOC_AT91SAM9X5)
54#define at91sam9x5_soc at91_boot_soc 55#define at91sam9x5_soc at91_boot_soc
55#endif 56#endif
57
58#if !defined(CONFIG_SOC_AT91SAM9N12)
59#define at91sam9n12_soc at91_boot_soc
60#endif
diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c
index 22e4e0a28ad1..adbfb1994582 100644
--- a/arch/arm/mach-bcmring/core.c
+++ b/arch/arm/mach-bcmring/core.c
@@ -52,8 +52,8 @@
52#include <mach/csp/chipcHw_inline.h> 52#include <mach/csp/chipcHw_inline.h>
53#include <mach/csp/tmrHw_reg.h> 53#include <mach/csp/tmrHw_reg.h>
54 54
55static AMBA_APB_DEVICE(uartA, "uarta", MM_ADDR_IO_UARTA, { IRQ_UARTA }, NULL); 55static AMBA_APB_DEVICE(uartA, "uartA", 0, MM_ADDR_IO_UARTA, {IRQ_UARTA}, NULL);
56static AMBA_APB_DEVICE(uartB, "uartb", MM_ADDR_IO_UARTB, { IRQ_UARTB }, NULL); 56static AMBA_APB_DEVICE(uartB, "uartB", 0, MM_ADDR_IO_UARTB, {IRQ_UARTB}, NULL);
57 57
58static struct clk pll1_clk = { 58static struct clk pll1_clk = {
59 .name = "PLL1", 59 .name = "PLL1",
diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig
index eb34bd1251d4..ea036d621581 100644
--- a/arch/arm/mach-clps711x/Kconfig
+++ b/arch/arm/mach-clps711x/Kconfig
@@ -1,6 +1,6 @@
1if ARCH_CLPS711X 1if ARCH_CLPS711X
2 2
3menu "CLPS711X/EP721X Implementations" 3menu "CLPS711X/EP721X/EP731X Implementations"
4 4
5config ARCH_AUTCPU12 5config ARCH_AUTCPU12
6 bool "AUTCPU12" 6 bool "AUTCPU12"
@@ -45,26 +45,13 @@ config ARCH_P720T
45config ARCH_FORTUNET 45config ARCH_FORTUNET
46 bool "FORTUNET" 46 bool "FORTUNET"
47 47
48# XXX Maybe these should indicate register compatibility
49# instead of being mutually exclusive.
50config ARCH_EP7211
51 bool
52 depends on ARCH_EDB7211
53 default y
54
55config ARCH_EP7212
56 bool
57 depends on ARCH_P720T || ARCH_CEIVA
58 default y
59
60config EP72XX_ROM_BOOT 48config EP72XX_ROM_BOOT
61 bool "EP72xx ROM boot" 49 bool "EP721x/EP731x ROM boot"
62 depends on ARCH_EP7211 || ARCH_EP7212 50 help
63 ---help---
64 If you say Y here, your CLPS711x-based kernel will use the bootstrap 51 If you say Y here, your CLPS711x-based kernel will use the bootstrap
65 mode memory map instead of the normal memory map. 52 mode memory map instead of the normal memory map.
66 53
67 Processors derived from the Cirrus CLPS-711X core support two boot 54 Processors derived from the Cirrus CLPS711X core support two boot
68 modes. Normal mode boots from the external memory device at CS0. 55 modes. Normal mode boots from the external memory device at CS0.
69 Bootstrap mode rearranges parts of the memory map, placing an 56 Bootstrap mode rearranges parts of the memory map, placing an
70 internal 128 byte bootstrap ROM at CS0. This option performs the 57 internal 128 byte bootstrap ROM at CS0. This option performs the
diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c
index 3c5b5bbf24e5..c965fd8eb31a 100644
--- a/arch/arm/mach-clps711x/common.c
+++ b/arch/arm/mach-clps711x/common.c
@@ -36,7 +36,6 @@
36#include <asm/page.h> 36#include <asm/page.h>
37#include <asm/mach/map.h> 37#include <asm/mach/map.h>
38#include <asm/mach/time.h> 38#include <asm/mach/time.h>
39#include <asm/hardware/clps7111.h>
40#include <asm/system_misc.h> 39#include <asm/system_misc.h>
41 40
42/* 41/*
@@ -44,8 +43,8 @@
44 */ 43 */
45static struct map_desc clps711x_io_desc[] __initdata = { 44static struct map_desc clps711x_io_desc[] __initdata = {
46 { 45 {
47 .virtual = CLPS7111_VIRT_BASE, 46 .virtual = (unsigned long)CLPS711X_VIRT_BASE,
48 .pfn = __phys_to_pfn(CLPS7111_PHYS_BASE), 47 .pfn = __phys_to_pfn(CLPS711X_PHYS_BASE),
49 .length = SZ_1M, 48 .length = SZ_1M,
50 .type = MT_DEVICE 49 .type = MT_DEVICE
51 } 50 }
@@ -67,12 +66,6 @@ static void int1_mask(struct irq_data *d)
67 66
68static void int1_ack(struct irq_data *d) 67static void int1_ack(struct irq_data *d)
69{ 68{
70 u32 intmr1;
71
72 intmr1 = clps_readl(INTMR1);
73 intmr1 &= ~(1 << d->irq);
74 clps_writel(intmr1, INTMR1);
75
76 switch (d->irq) { 69 switch (d->irq) {
77 case IRQ_CSINT: clps_writel(0, COEOI); break; 70 case IRQ_CSINT: clps_writel(0, COEOI); break;
78 case IRQ_TC1OI: clps_writel(0, TC1EOI); break; 71 case IRQ_TC1OI: clps_writel(0, TC1EOI); break;
@@ -109,12 +102,6 @@ static void int2_mask(struct irq_data *d)
109 102
110static void int2_ack(struct irq_data *d) 103static void int2_ack(struct irq_data *d)
111{ 104{
112 u32 intmr2;
113
114 intmr2 = clps_readl(INTMR2);
115 intmr2 &= ~(1 << (d->irq - 16));
116 clps_writel(intmr2, INTMR2);
117
118 switch (d->irq) { 105 switch (d->irq) {
119 case IRQ_KBDINT: clps_writel(0, KBDEOI); break; 106 case IRQ_KBDINT: clps_writel(0, KBDEOI); break;
120 } 107 }
diff --git a/arch/arm/include/asm/hardware/clps7111.h b/arch/arm/mach-clps711x/include/mach/clps711x.h
index 44477225aed6..1dd806f2847e 100644
--- a/arch/arm/include/asm/hardware/clps7111.h
+++ b/arch/arm/mach-clps711x/include/mach/clps711x.h
@@ -1,8 +1,6 @@
1/* 1/*
2 * arch/arm/include/asm/hardware/clps7111.h 2 * This file contains the hardware definitions of the Cirrus Logic
3 * 3 * ARM7 CLPS711X internal registers.
4 * This file contains the hardware definitions of the CLPS7111 internal
5 * registers.
6 * 4 *
7 * Copyright (C) 2000 Deep Blue Solutions Ltd. 5 * Copyright (C) 2000 Deep Blue Solutions Ltd.
8 * 6 *
@@ -20,25 +18,18 @@
20 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */ 20 */
23#ifndef __ASM_HARDWARE_CLPS7111_H 21#ifndef __MACH_CLPS711X_H
24#define __ASM_HARDWARE_CLPS7111_H 22#define __MACH_CLPS711X_H
25
26#define CLPS7111_PHYS_BASE (0x80000000)
27 23
28#ifndef __ASSEMBLY__ 24#define CLPS711X_PHYS_BASE (0x80000000)
29#define clps_readb(off) __raw_readb(CLPS7111_BASE + (off))
30#define clps_readw(off) __raw_readw(CLPS7111_BASE + (off))
31#define clps_readl(off) __raw_readl(CLPS7111_BASE + (off))
32#define clps_writeb(val,off) __raw_writeb(val, CLPS7111_BASE + (off))
33#define clps_writew(val,off) __raw_writew(val, CLPS7111_BASE + (off))
34#define clps_writel(val,off) __raw_writel(val, CLPS7111_BASE + (off))
35#endif
36 25
37#define PADR (0x0000) 26#define PADR (0x0000)
38#define PBDR (0x0001) 27#define PBDR (0x0001)
28#define PCDR (0x0002)
39#define PDDR (0x0003) 29#define PDDR (0x0003)
40#define PADDR (0x0040) 30#define PADDR (0x0040)
41#define PBDDR (0x0041) 31#define PBDDR (0x0041)
32#define PCDDR (0x0042)
42#define PDDDR (0x0043) 33#define PDDDR (0x0043)
43#define PEDR (0x0080) 34#define PEDR (0x0080)
44#define PEDDR (0x00c0) 35#define PEDDR (0x00c0)
@@ -50,7 +41,7 @@
50#define INTSR1 (0x0240) 41#define INTSR1 (0x0240)
51#define INTMR1 (0x0280) 42#define INTMR1 (0x0280)
52#define LCDCON (0x02c0) 43#define LCDCON (0x02c0)
53#define TC1D (0x0300) 44#define TC1D (0x0300)
54#define TC2D (0x0340) 45#define TC2D (0x0340)
55#define RTCDR (0x0380) 46#define RTCDR (0x0380)
56#define RTCMR (0x03c0) 47#define RTCMR (0x03c0)
@@ -85,6 +76,26 @@
85#define SS2POP (0x16c0) 76#define SS2POP (0x16c0)
86#define KBDEOI (0x1700) 77#define KBDEOI (0x1700)
87 78
79#define DAIR (0x2000)
80#define DAIR0 (0x2040)
81#define DAIDR1 (0x2080)
82#define DAIDR2 (0x20c0)
83#define DAISR (0x2100)
84#define SYSCON3 (0x2200)
85#define INTSR3 (0x2240)
86#define INTMR3 (0x2280)
87#define LEDFLSH (0x22c0)
88#define SDCONF (0x2300)
89#define SDRFPR (0x2340)
90#define UNIQID (0x2440)
91#define DAI64FS (0x2600)
92#define PLLW (0x2610)
93#define PLLR (0xa5a8)
94#define RANDID0 (0x2700)
95#define RANDID1 (0x2704)
96#define RANDID2 (0x2708)
97#define RANDID3 (0x270c)
98
88/* common bits: SYSCON1 / SYSCON2 */ 99/* common bits: SYSCON1 / SYSCON2 */
89#define SYSCON_UARTEN (1 << 8) 100#define SYSCON_UARTEN (1 << 8)
90 101
@@ -131,6 +142,8 @@
131#define SYSFLG1_CTXFF (1 << 25) 142#define SYSFLG1_CTXFF (1 << 25)
132#define SYSFLG1_SSIBUSY (1 << 26) 143#define SYSFLG1_SSIBUSY (1 << 26)
133#define SYSFLG1_ID (1 << 29) 144#define SYSFLG1_ID (1 << 29)
145#define SYSFLG1_VERID(x) (((x) >> 30) & 3)
146#define SYSFLG1_VERID_MASK (3 << 30)
134 147
135#define SYSFLG2_SSRXOF (1 << 0) 148#define SYSFLG2_SSRXOF (1 << 0)
136#define SYSFLG2_RESVAL (1 << 1) 149#define SYSFLG2_RESVAL (1 << 1)
@@ -178,7 +191,88 @@
178#define UBRLCR_WRDLEN8 (3 << 17) 191#define UBRLCR_WRDLEN8 (3 << 17)
179#define UBRLCR_WRDLEN_MASK (3 << 17) 192#define UBRLCR_WRDLEN_MASK (3 << 17)
180 193
194#define SYNCIO_FRMLEN(x) (((x) & 0x3f) << 7)
195#define SYNCIO_CFGLEN(x) ((x) & 0x7f)
181#define SYNCIO_SMCKEN (1 << 13) 196#define SYNCIO_SMCKEN (1 << 13)
182#define SYNCIO_TXFRMEN (1 << 14) 197#define SYNCIO_TXFRMEN (1 << 14)
183 198
184#endif /* __ASM_HARDWARE_CLPS7111_H */ 199#define DAIR_RESERVED (0x0404)
200#define DAIR_DAIEN (1 << 16)
201#define DAIR_ECS (1 << 17)
202#define DAIR_LCTM (1 << 19)
203#define DAIR_LCRM (1 << 20)
204#define DAIR_RCTM (1 << 21)
205#define DAIR_RCRM (1 << 22)
206#define DAIR_LBM (1 << 23)
207
208#define DAIDR2_FIFOEN (1 << 15)
209#define DAIDR2_FIFOLEFT (0x0d << 16)
210#define DAIDR2_FIFORIGHT (0x11 << 16)
211
212#define DAISR_RCTS (1 << 0)
213#define DAISR_RCRS (1 << 1)
214#define DAISR_LCTS (1 << 2)
215#define DAISR_LCRS (1 << 3)
216#define DAISR_RCTU (1 << 4)
217#define DAISR_RCRO (1 << 5)
218#define DAISR_LCTU (1 << 6)
219#define DAISR_LCRO (1 << 7)
220#define DAISR_RCNF (1 << 8)
221#define DAISR_RCNE (1 << 9)
222#define DAISR_LCNF (1 << 10)
223#define DAISR_LCNE (1 << 11)
224#define DAISR_FIFO (1 << 12)
225
226#define DAI64FS_I2SF64 (1 << 0)
227#define DAI64FS_AUDIOCLKEN (1 << 1)
228#define DAI64FS_AUDIOCLKSRC (1 << 2)
229#define DAI64FS_MCLK256EN (1 << 3)
230#define DAI64FS_LOOPBACK (1 << 5)
231
232#define SYSCON3_ADCCON (1 << 0)
233#define SYSCON3_CLKCTL0 (1 << 1)
234#define SYSCON3_CLKCTL1 (1 << 2)
235#define SYSCON3_DAISEL (1 << 3)
236#define SYSCON3_ADCCKNSEN (1 << 4)
237#define SYSCON3_VERSN(x) (((x) >> 5) & 7)
238#define SYSCON3_VERSN_MASK (7 << 5)
239#define SYSCON3_FASTWAKE (1 << 8)
240#define SYSCON3_DAIEN (1 << 9)
241#define SYSCON3_128FS SYSCON3_DAIEN
242#define SYSCON3_ENPD67 (1 << 10)
243
244#define SDCONF_ACTIVE (1 << 10)
245#define SDCONF_CLKCTL (1 << 9)
246#define SDCONF_WIDTH_4 (0 << 7)
247#define SDCONF_WIDTH_8 (1 << 7)
248#define SDCONF_WIDTH_16 (2 << 7)
249#define SDCONF_WIDTH_32 (3 << 7)
250#define SDCONF_SIZE_16 (0 << 5)
251#define SDCONF_SIZE_64 (1 << 5)
252#define SDCONF_SIZE_128 (2 << 5)
253#define SDCONF_SIZE_256 (3 << 5)
254#define SDCONF_CASLAT_2 (2)
255#define SDCONF_CASLAT_3 (3)
256
257#define MEMCFG_BUS_WIDTH_32 (1)
258#define MEMCFG_BUS_WIDTH_16 (0)
259#define MEMCFG_BUS_WIDTH_8 (3)
260
261#define MEMCFG_WAITSTATE_8_3 (0 << 2)
262#define MEMCFG_WAITSTATE_7_3 (1 << 2)
263#define MEMCFG_WAITSTATE_6_3 (2 << 2)
264#define MEMCFG_WAITSTATE_5_3 (3 << 2)
265#define MEMCFG_WAITSTATE_4_2 (4 << 2)
266#define MEMCFG_WAITSTATE_3_2 (5 << 2)
267#define MEMCFG_WAITSTATE_2_2 (6 << 2)
268#define MEMCFG_WAITSTATE_1_2 (7 << 2)
269#define MEMCFG_WAITSTATE_8_1 (8 << 2)
270#define MEMCFG_WAITSTATE_7_1 (9 << 2)
271#define MEMCFG_WAITSTATE_6_1 (10 << 2)
272#define MEMCFG_WAITSTATE_5_1 (11 << 2)
273#define MEMCFG_WAITSTATE_4_0 (12 << 2)
274#define MEMCFG_WAITSTATE_3_0 (13 << 2)
275#define MEMCFG_WAITSTATE_2_0 (14 << 2)
276#define MEMCFG_WAITSTATE_1_0 (15 << 2)
277
278#endif /* __MACH_CLPS711X_H */
diff --git a/arch/arm/mach-clps711x/include/mach/debug-macro.S b/arch/arm/mach-clps711x/include/mach/debug-macro.S
index b802e8a51831..118b3d930573 100644
--- a/arch/arm/mach-clps711x/include/mach/debug-macro.S
+++ b/arch/arm/mach-clps711x/include/mach/debug-macro.S
@@ -12,7 +12,6 @@
12*/ 12*/
13 13
14#include <mach/hardware.h> 14#include <mach/hardware.h>
15#include <asm/hardware/clps7111.h>
16 15
17 .macro addruart, rp, rv, tmp 16 .macro addruart, rp, rv, tmp
18#ifndef CONFIG_DEBUG_CLPS711X_UART2 17#ifndef CONFIG_DEBUG_CLPS711X_UART2
@@ -20,8 +19,8 @@
20#else 19#else
21 mov \rp, #0x1000 @ UART2 20 mov \rp, #0x1000 @ UART2
22#endif 21#endif
23 orr \rv, \rp, #CLPS7111_VIRT_BASE 22 orr \rv, \rp, #CLPS711X_VIRT_BASE
24 orr \rp, \rp, #CLPS7111_PHYS_BASE 23 orr \rp, \rp, #CLPS711X_PHYS_BASE
25 .endm 24 .endm
26 25
27 .macro senduart,rd,rx 26 .macro senduart,rd,rx
diff --git a/arch/arm/mach-clps711x/include/mach/entry-macro.S b/arch/arm/mach-clps711x/include/mach/entry-macro.S
index 125af59d7a29..56e5c2c23504 100644
--- a/arch/arm/mach-clps711x/include/mach/entry-macro.S
+++ b/arch/arm/mach-clps711x/include/mach/entry-macro.S
@@ -8,7 +8,6 @@
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10#include <mach/hardware.h> 10#include <mach/hardware.h>
11#include <asm/hardware/clps7111.h>
12 11
13 .macro get_irqnr_preamble, base, tmp 12 .macro get_irqnr_preamble, base, tmp
14 .endm 13 .endm
@@ -18,7 +17,7 @@
18#endif 17#endif
19 18
20 .macro get_irqnr_and_base, irqnr, stat, base, mask 19 .macro get_irqnr_and_base, irqnr, stat, base, mask
21 mov \base, #CLPS7111_BASE 20 mov \base, #CLPS711X_VIRT_BASE
22 ldr \stat, [\base, #INTSR1] 21 ldr \stat, [\base, #INTSR1]
23 ldr \mask, [\base, #INTMR1] 22 ldr \mask, [\base, #INTMR1]
24 mov \irqnr, #4 23 mov \irqnr, #4
diff --git a/arch/arm/mach-clps711x/include/mach/hardware.h b/arch/arm/mach-clps711x/include/mach/hardware.h
index d0b7d870be9c..13a64fcd7dd1 100644
--- a/arch/arm/mach-clps711x/include/mach/hardware.h
+++ b/arch/arm/mach-clps711x/include/mach/hardware.h
@@ -19,12 +19,21 @@
19 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22#ifndef __ASM_ARCH_HARDWARE_H 22#ifndef __MACH_HARDWARE_H
23#define __ASM_ARCH_HARDWARE_H 23#define __MACH_HARDWARE_H
24 24
25#include <mach/clps711x.h>
25 26
26#define CLPS7111_VIRT_BASE 0xff000000 27#define CLPS711X_VIRT_BASE IOMEM(0xff000000)
27#define CLPS7111_BASE CLPS7111_VIRT_BASE 28
29#ifndef __ASSEMBLY__
30#define clps_readb(off) readb(CLPS711X_VIRT_BASE + (off))
31#define clps_readw(off) readw(CLPS711X_VIRT_BASE + (off))
32#define clps_readl(off) readl(CLPS711X_VIRT_BASE + (off))
33#define clps_writeb(val,off) writeb(val, CLPS711X_VIRT_BASE + (off))
34#define clps_writew(val,off) writew(val, CLPS711X_VIRT_BASE + (off))
35#define clps_writel(val,off) writel(val, CLPS711X_VIRT_BASE + (off))
36#endif
28 37
29/* 38/*
30 * The physical addresses that the external chip select signals map to is 39 * The physical addresses that the external chip select signals map to is
@@ -52,46 +61,11 @@
52#define CS7_PHYS_BASE (0x00000000) 61#define CS7_PHYS_BASE (0x00000000)
53#endif 62#endif
54 63
55#if defined (CONFIG_ARCH_EP7211)
56
57#define EP7211_VIRT_BASE CLPS7111_VIRT_BASE
58#define EP7211_BASE CLPS7111_VIRT_BASE
59#include <asm/hardware/ep7211.h>
60
61#elif defined (CONFIG_ARCH_EP7212)
62
63#define EP7212_VIRT_BASE CLPS7111_VIRT_BASE
64#define EP7212_BASE CLPS7111_VIRT_BASE
65#include <asm/hardware/ep7212.h>
66
67#endif
68
69#define SYSPLD_VIRT_BASE 0xfe000000 64#define SYSPLD_VIRT_BASE 0xfe000000
70#define SYSPLD_BASE SYSPLD_VIRT_BASE 65#define SYSPLD_BASE SYSPLD_VIRT_BASE
71 66
72#if defined (CONFIG_ARCH_AUTCPU12)
73
74#define CS89712_VIRT_BASE CLPS7111_VIRT_BASE
75#define CS89712_BASE CLPS7111_VIRT_BASE
76
77#include <asm/hardware/clps7111.h>
78#include <asm/hardware/ep7212.h>
79#include <asm/hardware/cs89712.h>
80
81#endif
82
83
84#if defined (CONFIG_ARCH_CDB89712) 67#if defined (CONFIG_ARCH_CDB89712)
85 68
86#include <asm/hardware/clps7111.h>
87#include <asm/hardware/ep7212.h>
88#include <asm/hardware/cs89712.h>
89
90/* static cdb89712_map_io() areas */
91#define REGISTER_START 0x80000000
92#define REGISTER_SIZE 0x4000
93#define REGISTER_BASE 0xff000000
94
95#define ETHER_START 0x20000000 69#define ETHER_START 0x20000000
96#define ETHER_SIZE 0x1000 70#define ETHER_SIZE 0x1000
97#define ETHER_BASE 0xfe000000 71#define ETHER_BASE 0xfe000000
@@ -154,13 +128,6 @@
154 128
155#if defined (CONFIG_ARCH_CEIVA) 129#if defined (CONFIG_ARCH_CEIVA)
156 130
157#define CEIVA_VIRT_BASE CLPS7111_VIRT_BASE
158#define CEIVA_BASE CLPS7111_VIRT_BASE
159
160#include <asm/hardware/clps7111.h>
161#include <asm/hardware/ep7212.h>
162
163
164/* 131/*
165 * The two flash banks are wired to chip selects 0 and 1. This is the mapping 132 * The two flash banks are wired to chip selects 0 and 1. This is the mapping
166 * for them. 133 * for them.
diff --git a/arch/arm/mach-clps711x/include/mach/irqs.h b/arch/arm/mach-clps711x/include/mach/irqs.h
index 30b7e97285a4..14d215f8ca81 100644
--- a/arch/arm/mach-clps711x/include/mach/irqs.h
+++ b/arch/arm/mach-clps711x/include/mach/irqs.h
@@ -35,7 +35,6 @@
35#define IRQ_SSEOTI 15 35#define IRQ_SSEOTI 15
36 36
37#define INT1_IRQS (0x0000fff0) 37#define INT1_IRQS (0x0000fff0)
38#define INT1_ACK_IRQS (0x00004f10)
39 38
40/* 39/*
41 * Interrupts from INTSR2 40 * Interrupts from INTSR2
@@ -47,7 +46,5 @@
47#define IRQ_URXINT2 (16+13) /* bit 13 */ 46#define IRQ_URXINT2 (16+13) /* bit 13 */
48 47
49#define INT2_IRQS (0x30070000) 48#define INT2_IRQS (0x30070000)
50#define INT2_ACK_IRQS (0x00010000)
51
52#define NR_IRQS 30
53 49
50#define NR_IRQS 30
diff --git a/arch/arm/mach-clps711x/include/mach/time.h b/arch/arm/mach-clps711x/include/mach/time.h
deleted file mode 100644
index 61fef9129c6a..000000000000
--- a/arch/arm/mach-clps711x/include/mach/time.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/time.h
3 *
4 * Copyright (C) 2000 Deep Blue Solutions Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <asm/leds.h>
21#include <asm/hardware/clps7111.h>
22
23extern void clps711x_setup_timer(void);
24
25/*
26 * IRQ handler for the timer
27 */
28static irqreturn_t
29p720t_timer_interrupt(int irq, void *dev_id)
30{
31 struct pt_regs *regs = get_irq_regs();
32 do_leds();
33 xtime_update(1);
34#ifndef CONFIG_SMP
35 update_process_times(user_mode(regs));
36#endif
37 do_profile(regs);
38 return IRQ_HANDLED;
39}
40
41/*
42 * Set up timer interrupt, and return the current time in seconds.
43 */
44void __init time_init(void)
45{
46 clps711x_setup_timer();
47 timer_irq.handler = p720t_timer_interrupt;
48 setup_irq(IRQ_TC2OI, &timer_irq);
49}
diff --git a/arch/arm/mach-clps711x/include/mach/uncompress.h b/arch/arm/mach-clps711x/include/mach/uncompress.h
index 35ed731b9f16..7b28d6a47690 100644
--- a/arch/arm/mach-clps711x/include/mach/uncompress.h
+++ b/arch/arm/mach-clps711x/include/mach/uncompress.h
@@ -17,14 +17,7 @@
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20#include <mach/hardware.h> 20#include <mach/clps711x.h>
21#include <asm/hardware/clps7111.h>
22
23#undef CLPS7111_BASE
24#define CLPS7111_BASE CLPS7111_PHYS_BASE
25
26#define __raw_readl(p) (*(unsigned long *)(p))
27#define __raw_writel(v,p) (*(unsigned long *)(p) = (v))
28 21
29#ifdef CONFIG_DEBUG_CLPS711X_UART2 22#ifdef CONFIG_DEBUG_CLPS711X_UART2
30#define SYSFLGx SYSFLG2 23#define SYSFLGx SYSFLG2
@@ -34,19 +27,25 @@
34#define UARTDRx UARTDR1 27#define UARTDRx UARTDR1
35#endif 28#endif
36 29
30#define phys_reg(x) (*(volatile u32 *)(CLPS711X_PHYS_BASE + (x)))
31
37/* 32/*
33 * The following code assumes the serial port has already been
34 * initialized by the bootloader. If you didn't setup a port in
35 * your bootloader then nothing will appear (which might be desired).
36 *
38 * This does not append a newline 37 * This does not append a newline
39 */ 38 */
40static inline void putc(int c) 39static inline void putc(int c)
41{ 40{
42 while (clps_readl(SYSFLGx) & SYSFLG_UTXFF) 41 while (phys_reg(SYSFLGx) & SYSFLG_UTXFF)
43 barrier(); 42 barrier();
44 clps_writel(c, UARTDRx); 43 phys_reg(UARTDRx) = c;
45} 44}
46 45
47static inline void flush(void) 46static inline void flush(void)
48{ 47{
49 while (clps_readl(SYSFLGx) & SYSFLG_UBUSY) 48 while (phys_reg(SYSFLGx) & SYSFLG_UBUSY)
50 barrier(); 49 barrier();
51} 50}
52 51
diff --git a/arch/arm/mach-clps711x/p720t-leds.c b/arch/arm/mach-clps711x/p720t-leds.c
index dd9a6cdbeb02..bbc449fbe14a 100644
--- a/arch/arm/mach-clps711x/p720t-leds.c
+++ b/arch/arm/mach-clps711x/p720t-leds.c
@@ -27,9 +27,6 @@
27#include <asm/leds.h> 27#include <asm/leds.h>
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29 29
30#include <asm/hardware/clps7111.h>
31#include <asm/hardware/ep7212.h>
32
33static void p720t_leds_event(led_event_t ledevt) 30static void p720t_leds_event(led_event_t ledevt)
34{ 31{
35 unsigned long flags; 32 unsigned long flags;
diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c
index 79d001f831e0..311328314163 100644
--- a/arch/arm/mach-cns3xxx/pcie.c
+++ b/arch/arm/mach-cns3xxx/pcie.c
@@ -166,12 +166,6 @@ static struct pci_ops cns3xxx_pcie_ops = {
166 .write = cns3xxx_pci_write_config, 166 .write = cns3xxx_pci_write_config,
167}; 167};
168 168
169static struct pci_bus *cns3xxx_pci_scan_bus(int nr, struct pci_sys_data *sys)
170{
171 return pci_scan_root_bus(NULL, sys->busnr, &cns3xxx_pcie_ops, sys,
172 &sys->resources);
173}
174
175static int cns3xxx_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 169static int cns3xxx_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
176{ 170{
177 struct cns3xxx_pcie *cnspci = pdev_to_cnspci(dev); 171 struct cns3xxx_pcie *cnspci = pdev_to_cnspci(dev);
@@ -221,10 +215,9 @@ static struct cns3xxx_pcie cns3xxx_pcie[] = {
221 .irqs = { IRQ_CNS3XXX_PCIE0_RC, IRQ_CNS3XXX_PCIE0_DEVICE, }, 215 .irqs = { IRQ_CNS3XXX_PCIE0_RC, IRQ_CNS3XXX_PCIE0_DEVICE, },
222 .hw_pci = { 216 .hw_pci = {
223 .domain = 0, 217 .domain = 0,
224 .swizzle = pci_std_swizzle,
225 .nr_controllers = 1, 218 .nr_controllers = 1,
219 .ops = &cns3xxx_pcie_ops,
226 .setup = cns3xxx_pci_setup, 220 .setup = cns3xxx_pci_setup,
227 .scan = cns3xxx_pci_scan_bus,
228 .map_irq = cns3xxx_pcie_map_irq, 221 .map_irq = cns3xxx_pcie_map_irq,
229 }, 222 },
230 }, 223 },
@@ -264,10 +257,9 @@ static struct cns3xxx_pcie cns3xxx_pcie[] = {
264 .irqs = { IRQ_CNS3XXX_PCIE1_RC, IRQ_CNS3XXX_PCIE1_DEVICE, }, 257 .irqs = { IRQ_CNS3XXX_PCIE1_RC, IRQ_CNS3XXX_PCIE1_DEVICE, },
265 .hw_pci = { 258 .hw_pci = {
266 .domain = 1, 259 .domain = 1,
267 .swizzle = pci_std_swizzle,
268 .nr_controllers = 1, 260 .nr_controllers = 1,
261 .ops = &cns3xxx_pcie_ops,
269 .setup = cns3xxx_pci_setup, 262 .setup = cns3xxx_pci_setup,
270 .scan = cns3xxx_pci_scan_bus,
271 .map_irq = cns3xxx_pcie_map_irq, 263 .map_irq = cns3xxx_pcie_map_irq,
272 }, 264 },
273 }, 265 },
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index a70de24d1cbc..09f61073c8d9 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -284,7 +284,7 @@ static struct platform_device da850_evm_nandflash_device = {
284 .resource = da850_evm_nandflash_resource, 284 .resource = da850_evm_nandflash_resource,
285}; 285};
286 286
287static struct platform_device *da850_evm_devices[] __initdata = { 287static struct platform_device *da850_evm_devices[] = {
288 &da850_evm_nandflash_device, 288 &da850_evm_nandflash_device,
289 &da850_evm_norflash_device, 289 &da850_evm_norflash_device,
290}; 290};
diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h
index 3e519dad5bb9..8db0fc6809dd 100644
--- a/arch/arm/mach-davinci/davinci.h
+++ b/arch/arm/mach-davinci/davinci.h
@@ -72,7 +72,7 @@ void davinci_map_sysmod(void);
72/* DM355 function declarations */ 72/* DM355 function declarations */
73void __init dm355_init(void); 73void __init dm355_init(void);
74void dm355_init_spi0(unsigned chipselect_mask, 74void dm355_init_spi0(unsigned chipselect_mask,
75 struct spi_board_info *info, unsigned len); 75 const struct spi_board_info *info, unsigned len);
76void __init dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata); 76void __init dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata);
77void dm355_set_vpfe_config(struct vpfe_config *cfg); 77void dm355_set_vpfe_config(struct vpfe_config *cfg);
78 78
@@ -83,7 +83,7 @@ void __init dm365_init_vc(struct snd_platform_data *pdata);
83void __init dm365_init_ks(struct davinci_ks_platform_data *pdata); 83void __init dm365_init_ks(struct davinci_ks_platform_data *pdata);
84void __init dm365_init_rtc(void); 84void __init dm365_init_rtc(void);
85void dm365_init_spi0(unsigned chipselect_mask, 85void dm365_init_spi0(unsigned chipselect_mask,
86 struct spi_board_info *info, unsigned len); 86 const struct spi_board_info *info, unsigned len);
87void dm365_set_vpfe_config(struct vpfe_config *cfg); 87void dm365_set_vpfe_config(struct vpfe_config *cfg);
88 88
89/* DM644x function declarations */ 89/* DM644x function declarations */
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 42dbf3dc11ab..d1624a315c9a 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -831,7 +831,7 @@ static struct platform_device da8xx_spi_device[] = {
831 }, 831 },
832}; 832};
833 833
834int __init da8xx_register_spi(int instance, struct spi_board_info *info, 834int __init da8xx_register_spi(int instance, const struct spi_board_info *info,
835 unsigned len) 835 unsigned len)
836{ 836{
837 int ret; 837 int ret;
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index fd3d09aa6cde..678cd99b7336 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -424,7 +424,7 @@ static struct platform_device dm355_spi0_device = {
424}; 424};
425 425
426void __init dm355_init_spi0(unsigned chipselect_mask, 426void __init dm355_init_spi0(unsigned chipselect_mask,
427 struct spi_board_info *info, unsigned len) 427 const struct spi_board_info *info, unsigned len)
428{ 428{
429 /* for now, assume we need MISO */ 429 /* for now, assume we need MISO */
430 davinci_cfg_reg(DM355_SPI0_SDI); 430 davinci_cfg_reg(DM355_SPI0_SDI);
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 1a2e953082b3..a50d49de1883 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -676,7 +676,7 @@ static struct platform_device dm365_spi0_device = {
676}; 676};
677 677
678void __init dm365_init_spi0(unsigned chipselect_mask, 678void __init dm365_init_spi0(unsigned chipselect_mask,
679 struct spi_board_info *info, unsigned len) 679 const struct spi_board_info *info, unsigned len)
680{ 680{
681 davinci_cfg_reg(DM365_SPI0_SCLK); 681 davinci_cfg_reg(DM365_SPI0_SCLK);
682 davinci_cfg_reg(DM365_SPI0_SDI); 682 davinci_cfg_reg(DM365_SPI0_SDI);
diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
index fd33919c95d4..95ce019c9b98 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/mach-davinci/dma.c
@@ -557,9 +557,9 @@ static int reserve_contiguous_slots(int ctlr, unsigned int id,
557 if (i == edma_cc[ctlr]->num_slots) 557 if (i == edma_cc[ctlr]->num_slots)
558 stop_slot = i; 558 stop_slot = i;
559 559
560 for (j = start_slot; j < stop_slot; j++) 560 j = start_slot;
561 if (test_bit(j, tmp_inuse)) 561 for_each_set_bit_from(j, tmp_inuse, stop_slot)
562 clear_bit(j, edma_cc[ctlr]->edma_inuse); 562 clear_bit(j, edma_cc[ctlr]->edma_inuse);
563 563
564 if (count) 564 if (count)
565 return -EBUSY; 565 return -EBUSY;
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index ee3461d7ec1b..a2f1f274f189 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -76,7 +76,8 @@ void __init da850_init(void);
76int da830_register_edma(struct edma_rsv_info *rsv); 76int da830_register_edma(struct edma_rsv_info *rsv);
77int da850_register_edma(struct edma_rsv_info *rsv[2]); 77int da850_register_edma(struct edma_rsv_info *rsv[2]);
78int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata); 78int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata);
79int da8xx_register_spi(int instance, struct spi_board_info *info, unsigned len); 79int da8xx_register_spi(int instance,
80 const struct spi_board_info *info, unsigned len);
80int da8xx_register_watchdog(void); 81int da8xx_register_watchdog(void);
81int da8xx_register_usb20(unsigned mA, unsigned potpgt); 82int da8xx_register_usb20(unsigned mA, unsigned potpgt);
82int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata); 83int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata);
diff --git a/arch/arm/mach-davinci/include/mach/psc.h b/arch/arm/mach-davinci/include/mach/psc.h
index 8bc3fc256171..405318e35bf6 100644
--- a/arch/arm/mach-davinci/include/mach/psc.h
+++ b/arch/arm/mach-davinci/include/mach/psc.h
@@ -246,7 +246,7 @@
246#define MDSTAT_STATE_MASK 0x3f 246#define MDSTAT_STATE_MASK 0x3f
247#define PDSTAT_STATE_MASK 0x1f 247#define PDSTAT_STATE_MASK 0x1f
248#define MDCTL_FORCE BIT(31) 248#define MDCTL_FORCE BIT(31)
249#define PDCTL_NEXT BIT(1) 249#define PDCTL_NEXT BIT(0)
250#define PDCTL_EPCGOOD BIT(8) 250#define PDCTL_EPCGOOD BIT(8)
251 251
252#ifndef __ASSEMBLER__ 252#ifndef __ASSEMBLER__
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index bda7aca04ca0..42ab1e7c4ecc 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -181,7 +181,7 @@ static int get_tclk(void)
181 return 166666667; 181 return 166666667;
182} 182}
183 183
184static void dove_timer_init(void) 184static void __init dove_timer_init(void)
185{ 185{
186 orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR, 186 orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
187 IRQ_DOVE_BRIDGE, get_tclk()); 187 IRQ_DOVE_BRIDGE, get_tclk());
diff --git a/arch/arm/mach-dove/mpp.c b/arch/arm/mach-dove/mpp.c
index 51e0e411c9cb..7f70afc26f91 100644
--- a/arch/arm/mach-dove/mpp.c
+++ b/arch/arm/mach-dove/mpp.c
@@ -56,7 +56,7 @@ static void dove_mpp_gpio_mode(int start, int end, int gpio_mode)
56 56
57/* Dump all the extra MPP registers. The platform code will dump the 57/* Dump all the extra MPP registers. The platform code will dump the
58 registers for pins 0-23. */ 58 registers for pins 0-23. */
59static void dove_mpp_dump_regs(void) 59static void __init dove_mpp_dump_regs(void)
60{ 60{
61 pr_debug("PMU_CTRL4_CTRL: %08x\n", 61 pr_debug("PMU_CTRL4_CTRL: %08x\n",
62 readl(DOVE_MPP_CTRL4_VIRT_BASE)); 62 readl(DOVE_MPP_CTRL4_VIRT_BASE));
@@ -67,7 +67,7 @@ static void dove_mpp_dump_regs(void)
67 pr_debug("MPP_GENERAL: %08x\n", readl(DOVE_MPP_GENERAL_VIRT_BASE)); 67 pr_debug("MPP_GENERAL: %08x\n", readl(DOVE_MPP_GENERAL_VIRT_BASE));
68} 68}
69 69
70static void dove_mpp_cfg_nfc(int sel) 70static void __init dove_mpp_cfg_nfc(int sel)
71{ 71{
72 u32 mpp_gen_cfg = readl(DOVE_MPP_GENERAL_VIRT_BASE); 72 u32 mpp_gen_cfg = readl(DOVE_MPP_GENERAL_VIRT_BASE);
73 73
@@ -78,7 +78,7 @@ static void dove_mpp_cfg_nfc(int sel)
78 dove_mpp_gpio_mode(64, 71, GPIO_OUTPUT_OK); 78 dove_mpp_gpio_mode(64, 71, GPIO_OUTPUT_OK);
79} 79}
80 80
81static void dove_mpp_cfg_au1(int sel) 81static void __init dove_mpp_cfg_au1(int sel)
82{ 82{
83 u32 mpp_ctrl4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 83 u32 mpp_ctrl4 = readl(DOVE_MPP_CTRL4_VIRT_BASE);
84 u32 ssp_ctrl1 = readl(DOVE_SSP_CTRL_STATUS_1); 84 u32 ssp_ctrl1 = readl(DOVE_SSP_CTRL_STATUS_1);
@@ -118,7 +118,7 @@ static void dove_mpp_cfg_au1(int sel)
118 118
119/* Configure the group registers, enabling GPIO if sel indicates the 119/* Configure the group registers, enabling GPIO if sel indicates the
120 pin is to be used for GPIO */ 120 pin is to be used for GPIO */
121static void dove_mpp_conf_grp(unsigned int *mpp_grp_list) 121static void __init dove_mpp_conf_grp(unsigned int *mpp_grp_list)
122{ 122{
123 u32 mpp_ctrl4 = readl(DOVE_MPP_CTRL4_VIRT_BASE); 123 u32 mpp_ctrl4 = readl(DOVE_MPP_CTRL4_VIRT_BASE);
124 int gpio_mode; 124 int gpio_mode;
diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c
index 48a032005ea3..47921b0cdc65 100644
--- a/arch/arm/mach-dove/pcie.c
+++ b/arch/arm/mach-dove/pcie.c
@@ -43,6 +43,7 @@ static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys)
43 return 0; 43 return 0;
44 44
45 pp = &pcie_port[nr]; 45 pp = &pcie_port[nr];
46 sys->private_data = pp;
46 pp->root_bus_nr = sys->busnr; 47 pp->root_bus_nr = sys->busnr;
47 48
48 /* 49 /*
@@ -93,19 +94,6 @@ static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys)
93 return 1; 94 return 1;
94} 95}
95 96
96static struct pcie_port *bus_to_port(int bus)
97{
98 int i;
99
100 for (i = num_pcie_ports - 1; i >= 0; i--) {
101 int rbus = pcie_port[i].root_bus_nr;
102 if (rbus != -1 && rbus <= bus)
103 break;
104 }
105
106 return i >= 0 ? pcie_port + i : NULL;
107}
108
109static int pcie_valid_config(struct pcie_port *pp, int bus, int dev) 97static int pcie_valid_config(struct pcie_port *pp, int bus, int dev)
110{ 98{
111 /* 99 /*
@@ -121,7 +109,8 @@ static int pcie_valid_config(struct pcie_port *pp, int bus, int dev)
121static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, 109static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
122 int size, u32 *val) 110 int size, u32 *val)
123{ 111{
124 struct pcie_port *pp = bus_to_port(bus->number); 112 struct pci_sys_data *sys = bus->sysdata;
113 struct pcie_port *pp = sys->private_data;
125 unsigned long flags; 114 unsigned long flags;
126 int ret; 115 int ret;
127 116
@@ -140,7 +129,8 @@ static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
140static int pcie_wr_conf(struct pci_bus *bus, u32 devfn, 129static int pcie_wr_conf(struct pci_bus *bus, u32 devfn,
141 int where, int size, u32 val) 130 int where, int size, u32 val)
142{ 131{
143 struct pcie_port *pp = bus_to_port(bus->number); 132 struct pci_sys_data *sys = bus->sysdata;
133 struct pcie_port *pp = sys->private_data;
144 unsigned long flags; 134 unsigned long flags;
145 int ret; 135 int ret;
146 136
@@ -194,14 +184,14 @@ dove_pcie_scan_bus(int nr, struct pci_sys_data *sys)
194 184
195static int __init dove_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 185static int __init dove_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
196{ 186{
197 struct pcie_port *pp = bus_to_port(dev->bus->number); 187 struct pci_sys_data *sys = dev->sysdata;
188 struct pcie_port *pp = sys->private_data;
198 189
199 return pp->index ? IRQ_DOVE_PCIE1 : IRQ_DOVE_PCIE0; 190 return pp->index ? IRQ_DOVE_PCIE1 : IRQ_DOVE_PCIE0;
200} 191}
201 192
202static struct hw_pci dove_pci __initdata = { 193static struct hw_pci dove_pci __initdata = {
203 .nr_controllers = 2, 194 .nr_controllers = 2,
204 .swizzle = pci_std_swizzle,
205 .setup = dove_pcie_setup, 195 .setup = dove_pcie_setup,
206 .scan = dove_pcie_scan_bus, 196 .scan = dove_pcie_scan_bus,
207 .map_irq = dove_pcie_map_irq, 197 .map_irq = dove_pcie_map_irq,
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig
index 97a249395b5a..fe3c1fa5462b 100644
--- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -2,6 +2,11 @@ if ARCH_EP93XX
2 2
3menu "Cirrus EP93xx Implementation Options" 3menu "Cirrus EP93xx Implementation Options"
4 4
5config EP93XX_SOC_COMMON
6 bool
7 default y
8 select LEDS_GPIO_REGISTER
9
5config CRUNCH 10config CRUNCH
6 bool "Support for MaverickCrunch" 11 bool "Support for MaverickCrunch"
7 help 12 help
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 8d2589588713..66b1494f23a6 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -241,11 +241,7 @@ unsigned int ep93xx_chip_revision(void)
241 * EP93xx GPIO 241 * EP93xx GPIO
242 *************************************************************************/ 242 *************************************************************************/
243static struct resource ep93xx_gpio_resource[] = { 243static struct resource ep93xx_gpio_resource[] = {
244 { 244 DEFINE_RES_MEM(EP93XX_GPIO_PHYS_BASE, 0xcc),
245 .start = EP93XX_GPIO_PHYS_BASE,
246 .end = EP93XX_GPIO_PHYS_BASE + 0xcc - 1,
247 .flags = IORESOURCE_MEM,
248 },
249}; 245};
250 246
251static struct platform_device ep93xx_gpio_device = { 247static struct platform_device ep93xx_gpio_device = {
@@ -288,11 +284,7 @@ static AMBA_APB_DEVICE(uart3, "apb:uart3", 0x00041010, EP93XX_UART3_PHYS_BASE,
288 { IRQ_EP93XX_UART3 }, &ep93xx_uart_data); 284 { IRQ_EP93XX_UART3 }, &ep93xx_uart_data);
289 285
290static struct resource ep93xx_rtc_resource[] = { 286static struct resource ep93xx_rtc_resource[] = {
291 { 287 DEFINE_RES_MEM(EP93XX_RTC_PHYS_BASE, 0x10c),
292 .start = EP93XX_RTC_PHYS_BASE,
293 .end = EP93XX_RTC_PHYS_BASE + 0x10c - 1,
294 .flags = IORESOURCE_MEM,
295 },
296}; 288};
297 289
298static struct platform_device ep93xx_rtc_device = { 290static struct platform_device ep93xx_rtc_device = {
@@ -304,16 +296,8 @@ static struct platform_device ep93xx_rtc_device = {
304 296
305 297
306static struct resource ep93xx_ohci_resources[] = { 298static struct resource ep93xx_ohci_resources[] = {
307 [0] = { 299 DEFINE_RES_MEM(EP93XX_USB_PHYS_BASE, 0x1000),
308 .start = EP93XX_USB_PHYS_BASE, 300 DEFINE_RES_IRQ(IRQ_EP93XX_USB),
309 .end = EP93XX_USB_PHYS_BASE + 0x0fff,
310 .flags = IORESOURCE_MEM,
311 },
312 [1] = {
313 .start = IRQ_EP93XX_USB,
314 .end = IRQ_EP93XX_USB,
315 .flags = IORESOURCE_IRQ,
316 },
317}; 301};
318 302
319 303
@@ -372,15 +356,8 @@ void __init ep93xx_register_flash(unsigned int width,
372static struct ep93xx_eth_data ep93xx_eth_data; 356static struct ep93xx_eth_data ep93xx_eth_data;
373 357
374static struct resource ep93xx_eth_resource[] = { 358static struct resource ep93xx_eth_resource[] = {
375 { 359 DEFINE_RES_MEM(EP93XX_ETHERNET_PHYS_BASE, 0x10000),
376 .start = EP93XX_ETHERNET_PHYS_BASE, 360 DEFINE_RES_IRQ(IRQ_EP93XX_ETHERNET),
377 .end = EP93XX_ETHERNET_PHYS_BASE + 0xffff,
378 .flags = IORESOURCE_MEM,
379 }, {
380 .start = IRQ_EP93XX_ETHERNET,
381 .end = IRQ_EP93XX_ETHERNET,
382 .flags = IORESOURCE_IRQ,
383 }
384}; 361};
385 362
386static u64 ep93xx_eth_dma_mask = DMA_BIT_MASK(32); 363static u64 ep93xx_eth_dma_mask = DMA_BIT_MASK(32);
@@ -461,16 +438,8 @@ void __init ep93xx_register_i2c(struct i2c_gpio_platform_data *data,
461static struct ep93xx_spi_info ep93xx_spi_master_data; 438static struct ep93xx_spi_info ep93xx_spi_master_data;
462 439
463static struct resource ep93xx_spi_resources[] = { 440static struct resource ep93xx_spi_resources[] = {
464 { 441 DEFINE_RES_MEM(EP93XX_SPI_PHYS_BASE, 0x18),
465 .start = EP93XX_SPI_PHYS_BASE, 442 DEFINE_RES_IRQ(IRQ_EP93XX_SSP),
466 .end = EP93XX_SPI_PHYS_BASE + 0x18 - 1,
467 .flags = IORESOURCE_MEM,
468 },
469 {
470 .start = IRQ_EP93XX_SSP,
471 .end = IRQ_EP93XX_SSP,
472 .flags = IORESOURCE_IRQ,
473 },
474}; 443};
475 444
476static u64 ep93xx_spi_dma_mask = DMA_BIT_MASK(32); 445static u64 ep93xx_spi_dma_mask = DMA_BIT_MASK(32);
@@ -513,7 +482,7 @@ void __init ep93xx_register_spi(struct ep93xx_spi_info *info,
513/************************************************************************* 482/*************************************************************************
514 * EP93xx LEDs 483 * EP93xx LEDs
515 *************************************************************************/ 484 *************************************************************************/
516static struct gpio_led ep93xx_led_pins[] = { 485static const struct gpio_led ep93xx_led_pins[] __initconst = {
517 { 486 {
518 .name = "platform:grled", 487 .name = "platform:grled",
519 .gpio = EP93XX_GPIO_LINE_GRLED, 488 .gpio = EP93XX_GPIO_LINE_GRLED,
@@ -523,29 +492,16 @@ static struct gpio_led ep93xx_led_pins[] = {
523 }, 492 },
524}; 493};
525 494
526static struct gpio_led_platform_data ep93xx_led_data = { 495static const struct gpio_led_platform_data ep93xx_led_data __initconst = {
527 .num_leds = ARRAY_SIZE(ep93xx_led_pins), 496 .num_leds = ARRAY_SIZE(ep93xx_led_pins),
528 .leds = ep93xx_led_pins, 497 .leds = ep93xx_led_pins,
529}; 498};
530 499
531static struct platform_device ep93xx_leds = {
532 .name = "leds-gpio",
533 .id = -1,
534 .dev = {
535 .platform_data = &ep93xx_led_data,
536 },
537};
538
539
540/************************************************************************* 500/*************************************************************************
541 * EP93xx pwm peripheral handling 501 * EP93xx pwm peripheral handling
542 *************************************************************************/ 502 *************************************************************************/
543static struct resource ep93xx_pwm0_resource[] = { 503static struct resource ep93xx_pwm0_resource[] = {
544 { 504 DEFINE_RES_MEM(EP93XX_PWM_PHYS_BASE, 0x10),
545 .start = EP93XX_PWM_PHYS_BASE,
546 .end = EP93XX_PWM_PHYS_BASE + 0x10 - 1,
547 .flags = IORESOURCE_MEM,
548 },
549}; 505};
550 506
551static struct platform_device ep93xx_pwm0_device = { 507static struct platform_device ep93xx_pwm0_device = {
@@ -556,11 +512,7 @@ static struct platform_device ep93xx_pwm0_device = {
556}; 512};
557 513
558static struct resource ep93xx_pwm1_resource[] = { 514static struct resource ep93xx_pwm1_resource[] = {
559 { 515 DEFINE_RES_MEM(EP93XX_PWM_PHYS_BASE + 0x20, 0x10),
560 .start = EP93XX_PWM_PHYS_BASE + 0x20,
561 .end = EP93XX_PWM_PHYS_BASE + 0x30 - 1,
562 .flags = IORESOURCE_MEM,
563 },
564}; 516};
565 517
566static struct platform_device ep93xx_pwm1_device = { 518static struct platform_device ep93xx_pwm1_device = {
@@ -628,11 +580,7 @@ EXPORT_SYMBOL(ep93xx_pwm_release_gpio);
628static struct ep93xxfb_mach_info ep93xxfb_data; 580static struct ep93xxfb_mach_info ep93xxfb_data;
629 581
630static struct resource ep93xx_fb_resource[] = { 582static struct resource ep93xx_fb_resource[] = {
631 { 583 DEFINE_RES_MEM(EP93XX_RASTER_PHYS_BASE, 0x800),
632 .start = EP93XX_RASTER_PHYS_BASE,
633 .end = EP93XX_RASTER_PHYS_BASE + 0x800 - 1,
634 .flags = IORESOURCE_MEM,
635 },
636}; 584};
637 585
638static struct platform_device ep93xx_fb_device = { 586static struct platform_device ep93xx_fb_device = {
@@ -680,15 +628,8 @@ void __init ep93xx_register_fb(struct ep93xxfb_mach_info *data)
680static struct ep93xx_keypad_platform_data ep93xx_keypad_data; 628static struct ep93xx_keypad_platform_data ep93xx_keypad_data;
681 629
682static struct resource ep93xx_keypad_resource[] = { 630static struct resource ep93xx_keypad_resource[] = {
683 { 631 DEFINE_RES_MEM(EP93XX_KEY_MATRIX_PHYS_BASE, 0x0c),
684 .start = EP93XX_KEY_MATRIX_PHYS_BASE, 632 DEFINE_RES_IRQ(IRQ_EP93XX_KEY),
685 .end = EP93XX_KEY_MATRIX_PHYS_BASE + 0x0c - 1,
686 .flags = IORESOURCE_MEM,
687 }, {
688 .start = IRQ_EP93XX_KEY,
689 .end = IRQ_EP93XX_KEY,
690 .flags = IORESOURCE_IRQ,
691 },
692}; 633};
693 634
694static struct platform_device ep93xx_keypad_device = { 635static struct platform_device ep93xx_keypad_device = {
@@ -761,11 +702,7 @@ EXPORT_SYMBOL(ep93xx_keypad_release_gpio);
761 * EP93xx I2S audio peripheral handling 702 * EP93xx I2S audio peripheral handling
762 *************************************************************************/ 703 *************************************************************************/
763static struct resource ep93xx_i2s_resource[] = { 704static struct resource ep93xx_i2s_resource[] = {
764 { 705 DEFINE_RES_MEM(EP93XX_I2S_PHYS_BASE, 0x100),
765 .start = EP93XX_I2S_PHYS_BASE,
766 .end = EP93XX_I2S_PHYS_BASE + 0x100 - 1,
767 .flags = IORESOURCE_MEM,
768 },
769}; 706};
770 707
771static struct platform_device ep93xx_i2s_device = { 708static struct platform_device ep93xx_i2s_device = {
@@ -824,16 +761,8 @@ EXPORT_SYMBOL(ep93xx_i2s_release);
824 * EP93xx AC97 audio peripheral handling 761 * EP93xx AC97 audio peripheral handling
825 *************************************************************************/ 762 *************************************************************************/
826static struct resource ep93xx_ac97_resources[] = { 763static struct resource ep93xx_ac97_resources[] = {
827 { 764 DEFINE_RES_MEM(EP93XX_AAC_PHYS_BASE, 0xac),
828 .start = EP93XX_AAC_PHYS_BASE, 765 DEFINE_RES_IRQ(IRQ_EP93XX_AACINTR),
829 .end = EP93XX_AAC_PHYS_BASE + 0xac - 1,
830 .flags = IORESOURCE_MEM,
831 },
832 {
833 .start = IRQ_EP93XX_AACINTR,
834 .end = IRQ_EP93XX_AACINTR,
835 .flags = IORESOURCE_IRQ,
836 },
837}; 766};
838 767
839static struct platform_device ep93xx_ac97_device = { 768static struct platform_device ep93xx_ac97_device = {
@@ -889,8 +818,9 @@ void __init ep93xx_init_devices(void)
889 818
890 platform_device_register(&ep93xx_rtc_device); 819 platform_device_register(&ep93xx_rtc_device);
891 platform_device_register(&ep93xx_ohci_device); 820 platform_device_register(&ep93xx_ohci_device);
892 platform_device_register(&ep93xx_leds);
893 platform_device_register(&ep93xx_wdt_device); 821 platform_device_register(&ep93xx_wdt_device);
822
823 gpio_led_register_device(-1, &ep93xx_led_data);
894} 824}
895 825
896void ep93xx_restart(char mode, const char *cmd) 826void ep93xx_restart(char mode, const char *cmd)
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 0491ceef1cda..15b05b89cc39 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -200,6 +200,7 @@ config MACH_SMDKV310
200 select S3C_DEV_HSMMC2 200 select S3C_DEV_HSMMC2
201 select S3C_DEV_HSMMC3 201 select S3C_DEV_HSMMC3
202 select SAMSUNG_DEV_BACKLIGHT 202 select SAMSUNG_DEV_BACKLIGHT
203 select EXYNOS_DEV_DRM
203 select EXYNOS4_DEV_AHCI 204 select EXYNOS4_DEV_AHCI
204 select SAMSUNG_DEV_KEYPAD 205 select SAMSUNG_DEV_KEYPAD
205 select EXYNOS4_DEV_DMA 206 select EXYNOS4_DEV_DMA
@@ -232,6 +233,9 @@ config MACH_ARMLEX4210
232config MACH_UNIVERSAL_C210 233config MACH_UNIVERSAL_C210
233 bool "Mobile UNIVERSAL_C210 Board" 234 bool "Mobile UNIVERSAL_C210 Board"
234 select CPU_EXYNOS4210 235 select CPU_EXYNOS4210
236 select S5P_HRT
237 select CLKSRC_MMIO
238 select HAVE_SCHED_CLOCK
235 select S5P_GPIO_INT 239 select S5P_GPIO_INT
236 select S5P_DEV_FIMC0 240 select S5P_DEV_FIMC0
237 select S5P_DEV_FIMC1 241 select S5P_DEV_FIMC1
@@ -247,11 +251,13 @@ config MACH_UNIVERSAL_C210
247 select S3C_DEV_I2C1 251 select S3C_DEV_I2C1
248 select S3C_DEV_I2C3 252 select S3C_DEV_I2C3
249 select S3C_DEV_I2C5 253 select S3C_DEV_I2C5
254 select S3C_DEV_USB_HSOTG
250 select S5P_DEV_I2C_HDMIPHY 255 select S5P_DEV_I2C_HDMIPHY
251 select S5P_DEV_MFC 256 select S5P_DEV_MFC
252 select S5P_DEV_ONENAND 257 select S5P_DEV_ONENAND
253 select S5P_DEV_TV 258 select S5P_DEV_TV
254 select EXYNOS4_DEV_DMA 259 select EXYNOS4_DEV_DMA
260 select EXYNOS_DEV_DRM
255 select EXYNOS4_SETUP_FIMD0 261 select EXYNOS4_SETUP_FIMD0
256 select EXYNOS4_SETUP_I2C1 262 select EXYNOS4_SETUP_I2C1
257 select EXYNOS4_SETUP_I2C3 263 select EXYNOS4_SETUP_I2C3
@@ -259,6 +265,7 @@ config MACH_UNIVERSAL_C210
259 select EXYNOS4_SETUP_SDHCI 265 select EXYNOS4_SETUP_SDHCI
260 select EXYNOS4_SETUP_FIMC 266 select EXYNOS4_SETUP_FIMC
261 select S5P_SETUP_MIPIPHY 267 select S5P_SETUP_MIPIPHY
268 select EXYNOS4_SETUP_USB_PHY
262 help 269 help
263 Machine support for Samsung Mobile Universal S5PC210 Reference 270 Machine support for Samsung Mobile Universal S5PC210 Reference
264 Board. 271 Board.
@@ -277,6 +284,7 @@ config MACH_NURI
277 select S3C_DEV_I2C3 284 select S3C_DEV_I2C3
278 select S3C_DEV_I2C5 285 select S3C_DEV_I2C5
279 select S3C_DEV_I2C6 286 select S3C_DEV_I2C6
287 select S3C_DEV_USB_HSOTG
280 select S5P_DEV_CSIS0 288 select S5P_DEV_CSIS0
281 select S5P_DEV_JPEG 289 select S5P_DEV_JPEG
282 select S5P_DEV_FIMC0 290 select S5P_DEV_FIMC0
@@ -288,6 +296,7 @@ config MACH_NURI
288 select S5P_DEV_USB_EHCI 296 select S5P_DEV_USB_EHCI
289 select S5P_SETUP_MIPIPHY 297 select S5P_SETUP_MIPIPHY
290 select EXYNOS4_DEV_DMA 298 select EXYNOS4_DEV_DMA
299 select EXYNOS_DEV_DRM
291 select EXYNOS4_SETUP_FIMC 300 select EXYNOS4_SETUP_FIMC
292 select EXYNOS4_SETUP_FIMD0 301 select EXYNOS4_SETUP_FIMD0
293 select EXYNOS4_SETUP_I2C1 302 select EXYNOS4_SETUP_I2C1
@@ -322,6 +331,7 @@ config MACH_ORIGEN
322 select S5P_DEV_USB_EHCI 331 select S5P_DEV_USB_EHCI
323 select SAMSUNG_DEV_BACKLIGHT 332 select SAMSUNG_DEV_BACKLIGHT
324 select SAMSUNG_DEV_PWM 333 select SAMSUNG_DEV_PWM
334 select EXYNOS_DEV_DRM
325 select EXYNOS4_DEV_DMA 335 select EXYNOS4_DEV_DMA
326 select EXYNOS4_DEV_USB_OHCI 336 select EXYNOS4_DEV_USB_OHCI
327 select EXYNOS4_SETUP_FIMD0 337 select EXYNOS4_SETUP_FIMD0
@@ -342,6 +352,11 @@ config MACH_SMDK4212
342 select S3C_DEV_I2C7 352 select S3C_DEV_I2C7
343 select S3C_DEV_RTC 353 select S3C_DEV_RTC
344 select S3C_DEV_WDT 354 select S3C_DEV_WDT
355 select S5P_DEV_FIMC0
356 select S5P_DEV_FIMC1
357 select S5P_DEV_FIMC2
358 select S5P_DEV_FIMC3
359 select S5P_DEV_MFC
345 select SAMSUNG_DEV_BACKLIGHT 360 select SAMSUNG_DEV_BACKLIGHT
346 select SAMSUNG_DEV_KEYPAD 361 select SAMSUNG_DEV_KEYPAD
347 select SAMSUNG_DEV_PWM 362 select SAMSUNG_DEV_PWM
@@ -368,6 +383,7 @@ comment "Flattened Device Tree based board for EXYNOS SoCs"
368 383
369config MACH_EXYNOS4_DT 384config MACH_EXYNOS4_DT
370 bool "Samsung Exynos4 Machine using device tree" 385 bool "Samsung Exynos4 Machine using device tree"
386 depends on ARCH_EXYNOS4
371 select CPU_EXYNOS4210 387 select CPU_EXYNOS4210
372 select USE_OF 388 select USE_OF
373 select ARM_AMBA 389 select ARM_AMBA
@@ -380,6 +396,7 @@ config MACH_EXYNOS4_DT
380 396
381config MACH_EXYNOS5_DT 397config MACH_EXYNOS5_DT
382 bool "SAMSUNG EXYNOS5 Machine using device tree" 398 bool "SAMSUNG EXYNOS5 Machine using device tree"
399 depends on ARCH_EXYNOS5
383 select SOC_EXYNOS5250 400 select SOC_EXYNOS5250
384 select USE_OF 401 select USE_OF
385 select ARM_AMBA 402 select ARM_AMBA
diff --git a/arch/arm/mach-exynos/clock-exynos4.c b/arch/arm/mach-exynos/clock-exynos4.c
index df54c2a92225..6efd1e5919fd 100644
--- a/arch/arm/mach-exynos/clock-exynos4.c
+++ b/arch/arm/mach-exynos/clock-exynos4.c
@@ -497,25 +497,25 @@ static struct clk exynos4_init_clocks_off[] = {
497 .ctrlbit = (1 << 3), 497 .ctrlbit = (1 << 3),
498 }, { 498 }, {
499 .name = "hsmmc", 499 .name = "hsmmc",
500 .devname = "s3c-sdhci.0", 500 .devname = "exynos4-sdhci.0",
501 .parent = &exynos4_clk_aclk_133.clk, 501 .parent = &exynos4_clk_aclk_133.clk,
502 .enable = exynos4_clk_ip_fsys_ctrl, 502 .enable = exynos4_clk_ip_fsys_ctrl,
503 .ctrlbit = (1 << 5), 503 .ctrlbit = (1 << 5),
504 }, { 504 }, {
505 .name = "hsmmc", 505 .name = "hsmmc",
506 .devname = "s3c-sdhci.1", 506 .devname = "exynos4-sdhci.1",
507 .parent = &exynos4_clk_aclk_133.clk, 507 .parent = &exynos4_clk_aclk_133.clk,
508 .enable = exynos4_clk_ip_fsys_ctrl, 508 .enable = exynos4_clk_ip_fsys_ctrl,
509 .ctrlbit = (1 << 6), 509 .ctrlbit = (1 << 6),
510 }, { 510 }, {
511 .name = "hsmmc", 511 .name = "hsmmc",
512 .devname = "s3c-sdhci.2", 512 .devname = "exynos4-sdhci.2",
513 .parent = &exynos4_clk_aclk_133.clk, 513 .parent = &exynos4_clk_aclk_133.clk,
514 .enable = exynos4_clk_ip_fsys_ctrl, 514 .enable = exynos4_clk_ip_fsys_ctrl,
515 .ctrlbit = (1 << 7), 515 .ctrlbit = (1 << 7),
516 }, { 516 }, {
517 .name = "hsmmc", 517 .name = "hsmmc",
518 .devname = "s3c-sdhci.3", 518 .devname = "exynos4-sdhci.3",
519 .parent = &exynos4_clk_aclk_133.clk, 519 .parent = &exynos4_clk_aclk_133.clk,
520 .enable = exynos4_clk_ip_fsys_ctrl, 520 .enable = exynos4_clk_ip_fsys_ctrl,
521 .ctrlbit = (1 << 8), 521 .ctrlbit = (1 << 8),
@@ -1202,7 +1202,7 @@ static struct clksrc_clk exynos4_clk_sclk_uart3 = {
1202static struct clksrc_clk exynos4_clk_sclk_mmc0 = { 1202static struct clksrc_clk exynos4_clk_sclk_mmc0 = {
1203 .clk = { 1203 .clk = {
1204 .name = "sclk_mmc", 1204 .name = "sclk_mmc",
1205 .devname = "s3c-sdhci.0", 1205 .devname = "exynos4-sdhci.0",
1206 .parent = &exynos4_clk_dout_mmc0.clk, 1206 .parent = &exynos4_clk_dout_mmc0.clk,
1207 .enable = exynos4_clksrc_mask_fsys_ctrl, 1207 .enable = exynos4_clksrc_mask_fsys_ctrl,
1208 .ctrlbit = (1 << 0), 1208 .ctrlbit = (1 << 0),
@@ -1213,7 +1213,7 @@ static struct clksrc_clk exynos4_clk_sclk_mmc0 = {
1213static struct clksrc_clk exynos4_clk_sclk_mmc1 = { 1213static struct clksrc_clk exynos4_clk_sclk_mmc1 = {
1214 .clk = { 1214 .clk = {
1215 .name = "sclk_mmc", 1215 .name = "sclk_mmc",
1216 .devname = "s3c-sdhci.1", 1216 .devname = "exynos4-sdhci.1",
1217 .parent = &exynos4_clk_dout_mmc1.clk, 1217 .parent = &exynos4_clk_dout_mmc1.clk,
1218 .enable = exynos4_clksrc_mask_fsys_ctrl, 1218 .enable = exynos4_clksrc_mask_fsys_ctrl,
1219 .ctrlbit = (1 << 4), 1219 .ctrlbit = (1 << 4),
@@ -1224,7 +1224,7 @@ static struct clksrc_clk exynos4_clk_sclk_mmc1 = {
1224static struct clksrc_clk exynos4_clk_sclk_mmc2 = { 1224static struct clksrc_clk exynos4_clk_sclk_mmc2 = {
1225 .clk = { 1225 .clk = {
1226 .name = "sclk_mmc", 1226 .name = "sclk_mmc",
1227 .devname = "s3c-sdhci.2", 1227 .devname = "exynos4-sdhci.2",
1228 .parent = &exynos4_clk_dout_mmc2.clk, 1228 .parent = &exynos4_clk_dout_mmc2.clk,
1229 .enable = exynos4_clksrc_mask_fsys_ctrl, 1229 .enable = exynos4_clksrc_mask_fsys_ctrl,
1230 .ctrlbit = (1 << 8), 1230 .ctrlbit = (1 << 8),
@@ -1235,7 +1235,7 @@ static struct clksrc_clk exynos4_clk_sclk_mmc2 = {
1235static struct clksrc_clk exynos4_clk_sclk_mmc3 = { 1235static struct clksrc_clk exynos4_clk_sclk_mmc3 = {
1236 .clk = { 1236 .clk = {
1237 .name = "sclk_mmc", 1237 .name = "sclk_mmc",
1238 .devname = "s3c-sdhci.3", 1238 .devname = "exynos4-sdhci.3",
1239 .parent = &exynos4_clk_dout_mmc3.clk, 1239 .parent = &exynos4_clk_dout_mmc3.clk,
1240 .enable = exynos4_clksrc_mask_fsys_ctrl, 1240 .enable = exynos4_clksrc_mask_fsys_ctrl,
1241 .ctrlbit = (1 << 12), 1241 .ctrlbit = (1 << 12),
@@ -1340,10 +1340,10 @@ static struct clk_lookup exynos4_clk_lookup[] = {
1340 CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos4_clk_sclk_uart1.clk), 1340 CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos4_clk_sclk_uart1.clk),
1341 CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos4_clk_sclk_uart2.clk), 1341 CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos4_clk_sclk_uart2.clk),
1342 CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos4_clk_sclk_uart3.clk), 1342 CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos4_clk_sclk_uart3.clk),
1343 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &exynos4_clk_sclk_mmc0.clk), 1343 CLKDEV_INIT("exynos4-sdhci.0", "mmc_busclk.2", &exynos4_clk_sclk_mmc0.clk),
1344 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &exynos4_clk_sclk_mmc1.clk), 1344 CLKDEV_INIT("exynos4-sdhci.1", "mmc_busclk.2", &exynos4_clk_sclk_mmc1.clk),
1345 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &exynos4_clk_sclk_mmc2.clk), 1345 CLKDEV_INIT("exynos4-sdhci.2", "mmc_busclk.2", &exynos4_clk_sclk_mmc2.clk),
1346 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &exynos4_clk_sclk_mmc3.clk), 1346 CLKDEV_INIT("exynos4-sdhci.3", "mmc_busclk.2", &exynos4_clk_sclk_mmc3.clk),
1347 CLKDEV_INIT("exynos4-fb.0", "lcd", &exynos4_clk_fimd0), 1347 CLKDEV_INIT("exynos4-fb.0", "lcd", &exynos4_clk_fimd0),
1348 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0), 1348 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0),
1349 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1), 1349 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1),
diff --git a/arch/arm/mach-exynos/clock-exynos5.c b/arch/arm/mach-exynos/clock-exynos5.c
index d013982d0f8e..7ac6ff4c46bd 100644
--- a/arch/arm/mach-exynos/clock-exynos5.c
+++ b/arch/arm/mach-exynos/clock-exynos5.c
@@ -455,25 +455,25 @@ static struct clk exynos5_init_clocks_off[] = {
455 .ctrlbit = (1 << 20), 455 .ctrlbit = (1 << 20),
456 }, { 456 }, {
457 .name = "hsmmc", 457 .name = "hsmmc",
458 .devname = "s3c-sdhci.0", 458 .devname = "exynos4-sdhci.0",
459 .parent = &exynos5_clk_aclk_200.clk, 459 .parent = &exynos5_clk_aclk_200.clk,
460 .enable = exynos5_clk_ip_fsys_ctrl, 460 .enable = exynos5_clk_ip_fsys_ctrl,
461 .ctrlbit = (1 << 12), 461 .ctrlbit = (1 << 12),
462 }, { 462 }, {
463 .name = "hsmmc", 463 .name = "hsmmc",
464 .devname = "s3c-sdhci.1", 464 .devname = "exynos4-sdhci.1",
465 .parent = &exynos5_clk_aclk_200.clk, 465 .parent = &exynos5_clk_aclk_200.clk,
466 .enable = exynos5_clk_ip_fsys_ctrl, 466 .enable = exynos5_clk_ip_fsys_ctrl,
467 .ctrlbit = (1 << 13), 467 .ctrlbit = (1 << 13),
468 }, { 468 }, {
469 .name = "hsmmc", 469 .name = "hsmmc",
470 .devname = "s3c-sdhci.2", 470 .devname = "exynos4-sdhci.2",
471 .parent = &exynos5_clk_aclk_200.clk, 471 .parent = &exynos5_clk_aclk_200.clk,
472 .enable = exynos5_clk_ip_fsys_ctrl, 472 .enable = exynos5_clk_ip_fsys_ctrl,
473 .ctrlbit = (1 << 14), 473 .ctrlbit = (1 << 14),
474 }, { 474 }, {
475 .name = "hsmmc", 475 .name = "hsmmc",
476 .devname = "s3c-sdhci.3", 476 .devname = "exynos4-sdhci.3",
477 .parent = &exynos5_clk_aclk_200.clk, 477 .parent = &exynos5_clk_aclk_200.clk,
478 .enable = exynos5_clk_ip_fsys_ctrl, 478 .enable = exynos5_clk_ip_fsys_ctrl,
479 .ctrlbit = (1 << 15), 479 .ctrlbit = (1 << 15),
@@ -678,7 +678,7 @@ static struct clk exynos5_clk_pdma1 = {
678 .name = "dma", 678 .name = "dma",
679 .devname = "dma-pl330.1", 679 .devname = "dma-pl330.1",
680 .enable = exynos5_clk_ip_fsys_ctrl, 680 .enable = exynos5_clk_ip_fsys_ctrl,
681 .ctrlbit = (1 << 1), 681 .ctrlbit = (1 << 2),
682}; 682};
683 683
684static struct clk exynos5_clk_mdma1 = { 684static struct clk exynos5_clk_mdma1 = {
@@ -813,7 +813,7 @@ static struct clksrc_clk exynos5_clk_sclk_uart3 = {
813static struct clksrc_clk exynos5_clk_sclk_mmc0 = { 813static struct clksrc_clk exynos5_clk_sclk_mmc0 = {
814 .clk = { 814 .clk = {
815 .name = "sclk_mmc", 815 .name = "sclk_mmc",
816 .devname = "s3c-sdhci.0", 816 .devname = "exynos4-sdhci.0",
817 .parent = &exynos5_clk_dout_mmc0.clk, 817 .parent = &exynos5_clk_dout_mmc0.clk,
818 .enable = exynos5_clksrc_mask_fsys_ctrl, 818 .enable = exynos5_clksrc_mask_fsys_ctrl,
819 .ctrlbit = (1 << 0), 819 .ctrlbit = (1 << 0),
@@ -824,7 +824,7 @@ static struct clksrc_clk exynos5_clk_sclk_mmc0 = {
824static struct clksrc_clk exynos5_clk_sclk_mmc1 = { 824static struct clksrc_clk exynos5_clk_sclk_mmc1 = {
825 .clk = { 825 .clk = {
826 .name = "sclk_mmc", 826 .name = "sclk_mmc",
827 .devname = "s3c-sdhci.1", 827 .devname = "exynos4-sdhci.1",
828 .parent = &exynos5_clk_dout_mmc1.clk, 828 .parent = &exynos5_clk_dout_mmc1.clk,
829 .enable = exynos5_clksrc_mask_fsys_ctrl, 829 .enable = exynos5_clksrc_mask_fsys_ctrl,
830 .ctrlbit = (1 << 4), 830 .ctrlbit = (1 << 4),
@@ -835,7 +835,7 @@ static struct clksrc_clk exynos5_clk_sclk_mmc1 = {
835static struct clksrc_clk exynos5_clk_sclk_mmc2 = { 835static struct clksrc_clk exynos5_clk_sclk_mmc2 = {
836 .clk = { 836 .clk = {
837 .name = "sclk_mmc", 837 .name = "sclk_mmc",
838 .devname = "s3c-sdhci.2", 838 .devname = "exynos4-sdhci.2",
839 .parent = &exynos5_clk_dout_mmc2.clk, 839 .parent = &exynos5_clk_dout_mmc2.clk,
840 .enable = exynos5_clksrc_mask_fsys_ctrl, 840 .enable = exynos5_clksrc_mask_fsys_ctrl,
841 .ctrlbit = (1 << 8), 841 .ctrlbit = (1 << 8),
@@ -846,7 +846,7 @@ static struct clksrc_clk exynos5_clk_sclk_mmc2 = {
846static struct clksrc_clk exynos5_clk_sclk_mmc3 = { 846static struct clksrc_clk exynos5_clk_sclk_mmc3 = {
847 .clk = { 847 .clk = {
848 .name = "sclk_mmc", 848 .name = "sclk_mmc",
849 .devname = "s3c-sdhci.3", 849 .devname = "exynos4-sdhci.3",
850 .parent = &exynos5_clk_dout_mmc3.clk, 850 .parent = &exynos5_clk_dout_mmc3.clk,
851 .enable = exynos5_clksrc_mask_fsys_ctrl, 851 .enable = exynos5_clksrc_mask_fsys_ctrl,
852 .ctrlbit = (1 << 12), 852 .ctrlbit = (1 << 12),
@@ -990,10 +990,10 @@ static struct clk_lookup exynos5_clk_lookup[] = {
990 CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos5_clk_sclk_uart1.clk), 990 CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos5_clk_sclk_uart1.clk),
991 CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos5_clk_sclk_uart2.clk), 991 CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos5_clk_sclk_uart2.clk),
992 CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos5_clk_sclk_uart3.clk), 992 CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos5_clk_sclk_uart3.clk),
993 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &exynos5_clk_sclk_mmc0.clk), 993 CLKDEV_INIT("exynos4-sdhci.0", "mmc_busclk.2", &exynos5_clk_sclk_mmc0.clk),
994 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &exynos5_clk_sclk_mmc1.clk), 994 CLKDEV_INIT("exynos4-sdhci.1", "mmc_busclk.2", &exynos5_clk_sclk_mmc1.clk),
995 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &exynos5_clk_sclk_mmc2.clk), 995 CLKDEV_INIT("exynos4-sdhci.2", "mmc_busclk.2", &exynos5_clk_sclk_mmc2.clk),
996 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &exynos5_clk_sclk_mmc3.clk), 996 CLKDEV_INIT("exynos4-sdhci.3", "mmc_busclk.2", &exynos5_clk_sclk_mmc3.clk),
997 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos5_clk_pdma0), 997 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos5_clk_pdma0),
998 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos5_clk_pdma1), 998 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos5_clk_pdma1),
999 CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos5_clk_mdma1), 999 CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos5_clk_mdma1),
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 8614aab47cc0..5ccd6e80a607 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -326,6 +326,11 @@ static void __init exynos4_map_io(void)
326 s3c_fimc_setname(2, "exynos4-fimc"); 326 s3c_fimc_setname(2, "exynos4-fimc");
327 s3c_fimc_setname(3, "exynos4-fimc"); 327 s3c_fimc_setname(3, "exynos4-fimc");
328 328
329 s3c_sdhci_setname(0, "exynos4-sdhci");
330 s3c_sdhci_setname(1, "exynos4-sdhci");
331 s3c_sdhci_setname(2, "exynos4-sdhci");
332 s3c_sdhci_setname(3, "exynos4-sdhci");
333
329 /* The I2C bus controllers are directly compatible with s3c2440 */ 334 /* The I2C bus controllers are directly compatible with s3c2440 */
330 s3c_i2c0_setname("s3c2440-i2c"); 335 s3c_i2c0_setname("s3c2440-i2c");
331 s3c_i2c1_setname("s3c2440-i2c"); 336 s3c_i2c1_setname("s3c2440-i2c");
@@ -344,6 +349,11 @@ static void __init exynos5_map_io(void)
344 s3c_device_i2c0.resource[1].start = EXYNOS5_IRQ_IIC; 349 s3c_device_i2c0.resource[1].start = EXYNOS5_IRQ_IIC;
345 s3c_device_i2c0.resource[1].end = EXYNOS5_IRQ_IIC; 350 s3c_device_i2c0.resource[1].end = EXYNOS5_IRQ_IIC;
346 351
352 s3c_sdhci_setname(0, "exynos4-sdhci");
353 s3c_sdhci_setname(1, "exynos4-sdhci");
354 s3c_sdhci_setname(2, "exynos4-sdhci");
355 s3c_sdhci_setname(3, "exynos4-sdhci");
356
347 /* The I2C bus controllers are directly compatible with s3c2440 */ 357 /* The I2C bus controllers are directly compatible with s3c2440 */
348 s3c_i2c0_setname("s3c2440-i2c"); 358 s3c_i2c0_setname("s3c2440-i2c");
349 s3c_i2c1_setname("s3c2440-i2c"); 359 s3c_i2c1_setname("s3c2440-i2c");
@@ -537,7 +547,9 @@ void __init exynos5_init_irq(void)
537{ 547{
538 int irq; 548 int irq;
539 549
540 gic_init(0, IRQ_PPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU); 550#ifdef CONFIG_OF
551 of_irq_init(exynos4_dt_irq_match);
552#endif
541 553
542 for (irq = 0; irq < EXYNOS5_MAX_COMBINER_NR; irq++) { 554 for (irq = 0; irq < EXYNOS5_MAX_COMBINER_NR; irq++) {
543 combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq), 555 combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index 33ab4e7558af..26dac2893b8e 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -20,6 +20,7 @@
20#include <asm/smp_scu.h> 20#include <asm/smp_scu.h>
21#include <asm/suspend.h> 21#include <asm/suspend.h>
22#include <asm/unified.h> 22#include <asm/unified.h>
23#include <asm/cpuidle.h>
23#include <mach/regs-pmu.h> 24#include <mach/regs-pmu.h>
24#include <mach/pmu.h> 25#include <mach/pmu.h>
25 26
@@ -34,22 +35,12 @@
34 35
35#define S5P_CHECK_AFTR 0xFCBA0D10 36#define S5P_CHECK_AFTR 0xFCBA0D10
36 37
37static int exynos4_enter_idle(struct cpuidle_device *dev,
38 struct cpuidle_driver *drv,
39 int index);
40static int exynos4_enter_lowpower(struct cpuidle_device *dev, 38static int exynos4_enter_lowpower(struct cpuidle_device *dev,
41 struct cpuidle_driver *drv, 39 struct cpuidle_driver *drv,
42 int index); 40 int index);
43 41
44static struct cpuidle_state exynos4_cpuidle_set[] __initdata = { 42static struct cpuidle_state exynos4_cpuidle_set[] __initdata = {
45 [0] = { 43 [0] = ARM_CPUIDLE_WFI_STATE,
46 .enter = exynos4_enter_idle,
47 .exit_latency = 1,
48 .target_residency = 100000,
49 .flags = CPUIDLE_FLAG_TIME_VALID,
50 .name = "C0",
51 .desc = "ARM clock gating(WFI)",
52 },
53 [1] = { 44 [1] = {
54 .enter = exynos4_enter_lowpower, 45 .enter = exynos4_enter_lowpower,
55 .exit_latency = 300, 46 .exit_latency = 300,
@@ -63,8 +54,9 @@ static struct cpuidle_state exynos4_cpuidle_set[] __initdata = {
63static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device); 54static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device);
64 55
65static struct cpuidle_driver exynos4_idle_driver = { 56static struct cpuidle_driver exynos4_idle_driver = {
66 .name = "exynos4_idle", 57 .name = "exynos4_idle",
67 .owner = THIS_MODULE, 58 .owner = THIS_MODULE,
59 .en_core_tk_irqen = 1,
68}; 60};
69 61
70/* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */ 62/* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */
@@ -103,13 +95,8 @@ static int exynos4_enter_core0_aftr(struct cpuidle_device *dev,
103 struct cpuidle_driver *drv, 95 struct cpuidle_driver *drv,
104 int index) 96 int index)
105{ 97{
106 struct timeval before, after;
107 int idle_time;
108 unsigned long tmp; 98 unsigned long tmp;
109 99
110 local_irq_disable();
111 do_gettimeofday(&before);
112
113 exynos4_set_wakeupmask(); 100 exynos4_set_wakeupmask();
114 101
115 /* Set value of power down register for aftr mode */ 102 /* Set value of power down register for aftr mode */
@@ -150,34 +137,6 @@ static int exynos4_enter_core0_aftr(struct cpuidle_device *dev,
150 /* Clear wakeup state register */ 137 /* Clear wakeup state register */
151 __raw_writel(0x0, S5P_WAKEUP_STAT); 138 __raw_writel(0x0, S5P_WAKEUP_STAT);
152 139
153 do_gettimeofday(&after);
154
155 local_irq_enable();
156 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
157 (after.tv_usec - before.tv_usec);
158
159 dev->last_residency = idle_time;
160 return index;
161}
162
163static int exynos4_enter_idle(struct cpuidle_device *dev,
164 struct cpuidle_driver *drv,
165 int index)
166{
167 struct timeval before, after;
168 int idle_time;
169
170 local_irq_disable();
171 do_gettimeofday(&before);
172
173 cpu_do_idle();
174
175 do_gettimeofday(&after);
176 local_irq_enable();
177 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
178 (after.tv_usec - before.tv_usec);
179
180 dev->last_residency = idle_time;
181 return index; 140 return index;
182} 141}
183 142
@@ -192,7 +151,7 @@ static int exynos4_enter_lowpower(struct cpuidle_device *dev,
192 new_index = drv->safe_state_index; 151 new_index = drv->safe_state_index;
193 152
194 if (new_index == 0) 153 if (new_index == 0)
195 return exynos4_enter_idle(dev, drv, new_index); 154 return arm_cpuidle_simple_enter(dev, drv, new_index);
196 else 155 else
197 return exynos4_enter_core0_aftr(dev, drv, new_index); 156 return exynos4_enter_core0_aftr(dev, drv, new_index);
198} 157}
diff --git a/arch/arm/mach-exynos/dev-ahci.c b/arch/arm/mach-exynos/dev-ahci.c
index 50ce5b0adcf1..ce1aad3eeeb9 100644
--- a/arch/arm/mach-exynos/dev-ahci.c
+++ b/arch/arm/mach-exynos/dev-ahci.c
@@ -236,16 +236,8 @@ static struct ahci_platform_data exynos4_ahci_pdata = {
236}; 236};
237 237
238static struct resource exynos4_ahci_resource[] = { 238static struct resource exynos4_ahci_resource[] = {
239 [0] = { 239 [0] = DEFINE_RES_MEM(EXYNOS4_PA_SATA, SZ_64K),
240 .start = EXYNOS4_PA_SATA, 240 [1] = DEFINE_RES_IRQ(EXYNOS4_IRQ_SATA),
241 .end = EXYNOS4_PA_SATA + SZ_64K - 1,
242 .flags = IORESOURCE_MEM,
243 },
244 [1] = {
245 .start = EXYNOS4_IRQ_SATA,
246 .end = EXYNOS4_IRQ_SATA,
247 .flags = IORESOURCE_IRQ,
248 },
249}; 241};
250 242
251static u64 exynos4_ahci_dmamask = DMA_BIT_MASK(32); 243static u64 exynos4_ahci_dmamask = DMA_BIT_MASK(32);
diff --git a/arch/arm/mach-exynos/dev-audio.c b/arch/arm/mach-exynos/dev-audio.c
index 7199e1ae79b4..b33a5b67b547 100644
--- a/arch/arm/mach-exynos/dev-audio.c
+++ b/arch/arm/mach-exynos/dev-audio.c
@@ -62,26 +62,10 @@ static struct s3c_audio_pdata i2sv5_pdata = {
62}; 62};
63 63
64static struct resource exynos4_i2s0_resource[] = { 64static struct resource exynos4_i2s0_resource[] = {
65 [0] = { 65 [0] = DEFINE_RES_MEM(EXYNOS4_PA_I2S0, SZ_256),
66 .start = EXYNOS4_PA_I2S0, 66 [1] = DEFINE_RES_DMA(DMACH_I2S0_TX),
67 .end = EXYNOS4_PA_I2S0 + 0x100 - 1, 67 [2] = DEFINE_RES_DMA(DMACH_I2S0_RX),
68 .flags = IORESOURCE_MEM, 68 [3] = DEFINE_RES_DMA(DMACH_I2S0S_TX),
69 },
70 [1] = {
71 .start = DMACH_I2S0_TX,
72 .end = DMACH_I2S0_TX,
73 .flags = IORESOURCE_DMA,
74 },
75 [2] = {
76 .start = DMACH_I2S0_RX,
77 .end = DMACH_I2S0_RX,
78 .flags = IORESOURCE_DMA,
79 },
80 [3] = {
81 .start = DMACH_I2S0S_TX,
82 .end = DMACH_I2S0S_TX,
83 .flags = IORESOURCE_DMA,
84 },
85}; 69};
86 70
87struct platform_device exynos4_device_i2s0 = { 71struct platform_device exynos4_device_i2s0 = {
@@ -110,21 +94,9 @@ static struct s3c_audio_pdata i2sv3_pdata = {
110}; 94};
111 95
112static struct resource exynos4_i2s1_resource[] = { 96static struct resource exynos4_i2s1_resource[] = {
113 [0] = { 97 [0] = DEFINE_RES_MEM(EXYNOS4_PA_I2S1, SZ_256),
114 .start = EXYNOS4_PA_I2S1, 98 [1] = DEFINE_RES_DMA(DMACH_I2S1_TX),
115 .end = EXYNOS4_PA_I2S1 + 0x100 - 1, 99 [2] = DEFINE_RES_DMA(DMACH_I2S1_RX),
116 .flags = IORESOURCE_MEM,
117 },
118 [1] = {
119 .start = DMACH_I2S1_TX,
120 .end = DMACH_I2S1_TX,
121 .flags = IORESOURCE_DMA,
122 },
123 [2] = {
124 .start = DMACH_I2S1_RX,
125 .end = DMACH_I2S1_RX,
126 .flags = IORESOURCE_DMA,
127 },
128}; 100};
129 101
130struct platform_device exynos4_device_i2s1 = { 102struct platform_device exynos4_device_i2s1 = {
@@ -138,21 +110,9 @@ struct platform_device exynos4_device_i2s1 = {
138}; 110};
139 111
140static struct resource exynos4_i2s2_resource[] = { 112static struct resource exynos4_i2s2_resource[] = {
141 [0] = { 113 [0] = DEFINE_RES_MEM(EXYNOS4_PA_I2S2, SZ_256),
142 .start = EXYNOS4_PA_I2S2, 114 [1] = DEFINE_RES_DMA(DMACH_I2S2_TX),
143 .end = EXYNOS4_PA_I2S2 + 0x100 - 1, 115 [2] = DEFINE_RES_DMA(DMACH_I2S2_RX),
144 .flags = IORESOURCE_MEM,
145 },
146 [1] = {
147 .start = DMACH_I2S2_TX,
148 .end = DMACH_I2S2_TX,
149 .flags = IORESOURCE_DMA,
150 },
151 [2] = {
152 .start = DMACH_I2S2_RX,
153 .end = DMACH_I2S2_RX,
154 .flags = IORESOURCE_DMA,
155 },
156}; 116};
157 117
158struct platform_device exynos4_device_i2s2 = { 118struct platform_device exynos4_device_i2s2 = {
@@ -192,21 +152,9 @@ static struct s3c_audio_pdata s3c_pcm_pdata = {
192}; 152};
193 153
194static struct resource exynos4_pcm0_resource[] = { 154static struct resource exynos4_pcm0_resource[] = {
195 [0] = { 155 [0] = DEFINE_RES_MEM(EXYNOS4_PA_PCM0, SZ_256),
196 .start = EXYNOS4_PA_PCM0, 156 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX),
197 .end = EXYNOS4_PA_PCM0 + 0x100 - 1, 157 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX),
198 .flags = IORESOURCE_MEM,
199 },
200 [1] = {
201 .start = DMACH_PCM0_TX,
202 .end = DMACH_PCM0_TX,
203 .flags = IORESOURCE_DMA,
204 },
205 [2] = {
206 .start = DMACH_PCM0_RX,
207 .end = DMACH_PCM0_RX,
208 .flags = IORESOURCE_DMA,
209 },
210}; 158};
211 159
212struct platform_device exynos4_device_pcm0 = { 160struct platform_device exynos4_device_pcm0 = {
@@ -220,21 +168,9 @@ struct platform_device exynos4_device_pcm0 = {
220}; 168};
221 169
222static struct resource exynos4_pcm1_resource[] = { 170static struct resource exynos4_pcm1_resource[] = {
223 [0] = { 171 [0] = DEFINE_RES_MEM(EXYNOS4_PA_PCM1, SZ_256),
224 .start = EXYNOS4_PA_PCM1, 172 [1] = DEFINE_RES_DMA(DMACH_PCM1_TX),
225 .end = EXYNOS4_PA_PCM1 + 0x100 - 1, 173 [2] = DEFINE_RES_DMA(DMACH_PCM1_RX),
226 .flags = IORESOURCE_MEM,
227 },
228 [1] = {
229 .start = DMACH_PCM1_TX,
230 .end = DMACH_PCM1_TX,
231 .flags = IORESOURCE_DMA,
232 },
233 [2] = {
234 .start = DMACH_PCM1_RX,
235 .end = DMACH_PCM1_RX,
236 .flags = IORESOURCE_DMA,
237 },
238}; 174};
239 175
240struct platform_device exynos4_device_pcm1 = { 176struct platform_device exynos4_device_pcm1 = {
@@ -248,21 +184,9 @@ struct platform_device exynos4_device_pcm1 = {
248}; 184};
249 185
250static struct resource exynos4_pcm2_resource[] = { 186static struct resource exynos4_pcm2_resource[] = {
251 [0] = { 187 [0] = DEFINE_RES_MEM(EXYNOS4_PA_PCM2, SZ_256),
252 .start = EXYNOS4_PA_PCM2, 188 [1] = DEFINE_RES_DMA(DMACH_PCM2_TX),
253 .end = EXYNOS4_PA_PCM2 + 0x100 - 1, 189 [2] = DEFINE_RES_DMA(DMACH_PCM2_RX),
254 .flags = IORESOURCE_MEM,
255 },
256 [1] = {
257 .start = DMACH_PCM2_TX,
258 .end = DMACH_PCM2_TX,
259 .flags = IORESOURCE_DMA,
260 },
261 [2] = {
262 .start = DMACH_PCM2_RX,
263 .end = DMACH_PCM2_RX,
264 .flags = IORESOURCE_DMA,
265 },
266}; 190};
267 191
268struct platform_device exynos4_device_pcm2 = { 192struct platform_device exynos4_device_pcm2 = {
@@ -283,31 +207,11 @@ static int exynos4_ac97_cfg_gpio(struct platform_device *pdev)
283} 207}
284 208
285static struct resource exynos4_ac97_resource[] = { 209static struct resource exynos4_ac97_resource[] = {
286 [0] = { 210 [0] = DEFINE_RES_MEM(EXYNOS4_PA_AC97, SZ_256),
287 .start = EXYNOS4_PA_AC97, 211 [1] = DEFINE_RES_DMA(DMACH_AC97_PCMOUT),
288 .end = EXYNOS4_PA_AC97 + 0x100 - 1, 212 [2] = DEFINE_RES_DMA(DMACH_AC97_PCMIN),
289 .flags = IORESOURCE_MEM, 213 [3] = DEFINE_RES_DMA(DMACH_AC97_MICIN),
290 }, 214 [4] = DEFINE_RES_IRQ(EXYNOS4_IRQ_AC97),
291 [1] = {
292 .start = DMACH_AC97_PCMOUT,
293 .end = DMACH_AC97_PCMOUT,
294 .flags = IORESOURCE_DMA,
295 },
296 [2] = {
297 .start = DMACH_AC97_PCMIN,
298 .end = DMACH_AC97_PCMIN,
299 .flags = IORESOURCE_DMA,
300 },
301 [3] = {
302 .start = DMACH_AC97_MICIN,
303 .end = DMACH_AC97_MICIN,
304 .flags = IORESOURCE_DMA,
305 },
306 [4] = {
307 .start = EXYNOS4_IRQ_AC97,
308 .end = EXYNOS4_IRQ_AC97,
309 .flags = IORESOURCE_IRQ,
310 },
311}; 215};
312 216
313static struct s3c_audio_pdata s3c_ac97_pdata = { 217static struct s3c_audio_pdata s3c_ac97_pdata = {
@@ -338,16 +242,8 @@ static int exynos4_spdif_cfg_gpio(struct platform_device *pdev)
338} 242}
339 243
340static struct resource exynos4_spdif_resource[] = { 244static struct resource exynos4_spdif_resource[] = {
341 [0] = { 245 [0] = DEFINE_RES_MEM(EXYNOS4_PA_SPDIF, SZ_256),
342 .start = EXYNOS4_PA_SPDIF, 246 [1] = DEFINE_RES_DMA(DMACH_SPDIF),
343 .end = EXYNOS4_PA_SPDIF + 0x100 - 1,
344 .flags = IORESOURCE_MEM,
345 },
346 [1] = {
347 .start = DMACH_SPDIF,
348 .end = DMACH_SPDIF,
349 .flags = IORESOURCE_DMA,
350 },
351}; 247};
352 248
353static struct s3c_audio_pdata samsung_spdif_pdata = { 249static struct s3c_audio_pdata samsung_spdif_pdata = {
diff --git a/arch/arm/mach-exynos/dev-dwmci.c b/arch/arm/mach-exynos/dev-dwmci.c
index b025db4bf602..79035018fb74 100644
--- a/arch/arm/mach-exynos/dev-dwmci.c
+++ b/arch/arm/mach-exynos/dev-dwmci.c
@@ -16,6 +16,7 @@
16#include <linux/dma-mapping.h> 16#include <linux/dma-mapping.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/ioport.h>
19#include <linux/mmc/dw_mmc.h> 20#include <linux/mmc/dw_mmc.h>
20 21
21#include <plat/devs.h> 22#include <plat/devs.h>
@@ -33,16 +34,8 @@ static int exynos4_dwmci_init(u32 slot_id, irq_handler_t handler, void *data)
33} 34}
34 35
35static struct resource exynos4_dwmci_resource[] = { 36static struct resource exynos4_dwmci_resource[] = {
36 [0] = { 37 [0] = DEFINE_RES_MEM(EXYNOS4_PA_DWMCI, SZ_4K),
37 .start = EXYNOS4_PA_DWMCI, 38 [1] = DEFINE_RES_IRQ(EXYNOS4_IRQ_DWMCI),
38 .end = EXYNOS4_PA_DWMCI + SZ_4K - 1,
39 .flags = IORESOURCE_MEM,
40 },
41 [1] = {
42 .start = IRQ_DWMCI,
43 .end = IRQ_DWMCI,
44 .flags = IORESOURCE_IRQ,
45 }
46}; 39};
47 40
48static struct dw_mci_board exynos4_dwci_pdata = { 41static struct dw_mci_board exynos4_dwci_pdata = {
diff --git a/arch/arm/mach-exynos/include/mach/irqs.h b/arch/arm/mach-exynos/include/mach/irqs.h
index 9bee8535d9e0..c02dae7bf4a3 100644
--- a/arch/arm/mach-exynos/include/mach/irqs.h
+++ b/arch/arm/mach-exynos/include/mach/irqs.h
@@ -189,6 +189,7 @@
189#define IRQ_IIC7 EXYNOS4_IRQ_IIC7 189#define IRQ_IIC7 EXYNOS4_IRQ_IIC7
190 190
191#define IRQ_USB_HOST EXYNOS4_IRQ_USB_HOST 191#define IRQ_USB_HOST EXYNOS4_IRQ_USB_HOST
192#define IRQ_OTG EXYNOS4_IRQ_USB_HSOTG
192 193
193#define IRQ_HSMMC0 EXYNOS4_IRQ_HSMMC0 194#define IRQ_HSMMC0 EXYNOS4_IRQ_HSMMC0
194#define IRQ_HSMMC1 EXYNOS4_IRQ_HSMMC1 195#define IRQ_HSMMC1 EXYNOS4_IRQ_HSMMC1
@@ -212,6 +213,8 @@
212#define IRQ_MFC EXYNOS4_IRQ_MFC 213#define IRQ_MFC EXYNOS4_IRQ_MFC
213#define IRQ_SDO EXYNOS4_IRQ_SDO 214#define IRQ_SDO EXYNOS4_IRQ_SDO
214 215
216#define IRQ_I2S0 EXYNOS4_IRQ_I2S0
217
215#define IRQ_ADC EXYNOS4_IRQ_ADC0 218#define IRQ_ADC EXYNOS4_IRQ_ADC0
216#define IRQ_TC EXYNOS4_IRQ_PEN0 219#define IRQ_TC EXYNOS4_IRQ_PEN0
217 220
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index 024d38ff1718..e009a66477f4 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -89,6 +89,10 @@
89#define EXYNOS4_PA_MDMA1 0x12840000 89#define EXYNOS4_PA_MDMA1 0x12840000
90#define EXYNOS4_PA_PDMA0 0x12680000 90#define EXYNOS4_PA_PDMA0 0x12680000
91#define EXYNOS4_PA_PDMA1 0x12690000 91#define EXYNOS4_PA_PDMA1 0x12690000
92#define EXYNOS5_PA_MDMA0 0x10800000
93#define EXYNOS5_PA_MDMA1 0x11C10000
94#define EXYNOS5_PA_PDMA0 0x121A0000
95#define EXYNOS5_PA_PDMA1 0x121B0000
92 96
93#define EXYNOS4_PA_SYSMMU_MDMA 0x10A40000 97#define EXYNOS4_PA_SYSMMU_MDMA 0x10A40000
94#define EXYNOS4_PA_SYSMMU_SSS 0x10A50000 98#define EXYNOS4_PA_SYSMMU_SSS 0x10A50000
@@ -126,6 +130,9 @@
126#define EXYNOS4_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000)) 130#define EXYNOS4_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000))
127#define EXYNOS4_PA_DWMCI 0x12550000 131#define EXYNOS4_PA_DWMCI 0x12550000
128 132
133#define EXYNOS4_PA_HSOTG 0x12480000
134#define EXYNOS4_PA_USB_HSPHY 0x125B0000
135
129#define EXYNOS4_PA_SATA 0x12560000 136#define EXYNOS4_PA_SATA 0x12560000
130#define EXYNOS4_PA_SATAPHY 0x125D0000 137#define EXYNOS4_PA_SATAPHY 0x125D0000
131#define EXYNOS4_PA_SATAPHY_CTRL 0x126B0000 138#define EXYNOS4_PA_SATAPHY_CTRL 0x126B0000
@@ -182,6 +189,7 @@
182#define S3C_PA_SPI0 EXYNOS4_PA_SPI0 189#define S3C_PA_SPI0 EXYNOS4_PA_SPI0
183#define S3C_PA_SPI1 EXYNOS4_PA_SPI1 190#define S3C_PA_SPI1 EXYNOS4_PA_SPI1
184#define S3C_PA_SPI2 EXYNOS4_PA_SPI2 191#define S3C_PA_SPI2 EXYNOS4_PA_SPI2
192#define S3C_PA_USB_HSOTG EXYNOS4_PA_HSOTG
185 193
186#define S5P_PA_EHCI EXYNOS4_PA_EHCI 194#define S5P_PA_EHCI EXYNOS4_PA_EHCI
187#define S5P_PA_FIMC0 EXYNOS4_PA_FIMC0 195#define S5P_PA_FIMC0 EXYNOS4_PA_FIMC0
diff --git a/arch/arm/mach-exynos/include/mach/regs-clock.h b/arch/arm/mach-exynos/include/mach/regs-clock.h
index e141c1fd68d8..d9578a58ae7f 100644
--- a/arch/arm/mach-exynos/include/mach/regs-clock.h
+++ b/arch/arm/mach-exynos/include/mach/regs-clock.h
@@ -255,9 +255,15 @@
255 255
256/* For EXYNOS5250 */ 256/* For EXYNOS5250 */
257 257
258#define EXYNOS5_APLL_LOCK EXYNOS_CLKREG(0x00000)
258#define EXYNOS5_APLL_CON0 EXYNOS_CLKREG(0x00100) 259#define EXYNOS5_APLL_CON0 EXYNOS_CLKREG(0x00100)
259#define EXYNOS5_CLKSRC_CPU EXYNOS_CLKREG(0x00200) 260#define EXYNOS5_CLKSRC_CPU EXYNOS_CLKREG(0x00200)
261#define EXYNOS5_CLKMUX_STATCPU EXYNOS_CLKREG(0x00400)
260#define EXYNOS5_CLKDIV_CPU0 EXYNOS_CLKREG(0x00500) 262#define EXYNOS5_CLKDIV_CPU0 EXYNOS_CLKREG(0x00500)
263#define EXYNOS5_CLKDIV_CPU1 EXYNOS_CLKREG(0x00504)
264#define EXYNOS5_CLKDIV_STATCPU0 EXYNOS_CLKREG(0x00600)
265#define EXYNOS5_CLKDIV_STATCPU1 EXYNOS_CLKREG(0x00604)
266
261#define EXYNOS5_MPLL_CON0 EXYNOS_CLKREG(0x04100) 267#define EXYNOS5_MPLL_CON0 EXYNOS_CLKREG(0x04100)
262#define EXYNOS5_CLKSRC_CORE1 EXYNOS_CLKREG(0x04204) 268#define EXYNOS5_CLKSRC_CORE1 EXYNOS_CLKREG(0x04204)
263 269
diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h b/arch/arm/mach-exynos/include/mach/regs-pmu.h
index 4c53f38b5a9e..d457d052a420 100644
--- a/arch/arm/mach-exynos/include/mach/regs-pmu.h
+++ b/arch/arm/mach-exynos/include/mach/regs-pmu.h
@@ -163,6 +163,9 @@
163#define S5P_CHECK_SLEEP 0x00000BAD 163#define S5P_CHECK_SLEEP 0x00000BAD
164 164
165/* Only for EXYNOS4210 */ 165/* Only for EXYNOS4210 */
166#define S5P_USBDEVICE_PHY_CONTROL S5P_PMUREG(0x0704)
167#define S5P_USBDEVICE_PHY_ENABLE (1 << 0)
168
166#define S5P_USBHOST_PHY_CONTROL S5P_PMUREG(0x0708) 169#define S5P_USBHOST_PHY_CONTROL S5P_PMUREG(0x0708)
167#define S5P_USBHOST_PHY_ENABLE (1 << 0) 170#define S5P_USBHOST_PHY_ENABLE (1 << 0)
168 171
diff --git a/arch/arm/mach-exynos/mach-armlex4210.c b/arch/arm/mach-exynos/mach-armlex4210.c
index d726fcd3acf9..fed7116418eb 100644
--- a/arch/arm/mach-exynos/mach-armlex4210.c
+++ b/arch/arm/mach-exynos/mach-armlex4210.c
@@ -77,7 +77,6 @@ static struct s3c2410_uartcfg armlex4210_uartcfgs[] __initdata = {
77 77
78static struct s3c_sdhci_platdata armlex4210_hsmmc0_pdata __initdata = { 78static struct s3c_sdhci_platdata armlex4210_hsmmc0_pdata __initdata = {
79 .cd_type = S3C_SDHCI_CD_PERMANENT, 79 .cd_type = S3C_SDHCI_CD_PERMANENT,
80 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
81#ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT 80#ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
82 .max_width = 8, 81 .max_width = 8,
83 .host_caps = MMC_CAP_8_BIT_DATA, 82 .host_caps = MMC_CAP_8_BIT_DATA,
@@ -88,13 +87,11 @@ static struct s3c_sdhci_platdata armlex4210_hsmmc2_pdata __initdata = {
88 .cd_type = S3C_SDHCI_CD_GPIO, 87 .cd_type = S3C_SDHCI_CD_GPIO,
89 .ext_cd_gpio = EXYNOS4_GPX2(5), 88 .ext_cd_gpio = EXYNOS4_GPX2(5),
90 .ext_cd_gpio_invert = 1, 89 .ext_cd_gpio_invert = 1,
91 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
92 .max_width = 4, 90 .max_width = 4,
93}; 91};
94 92
95static struct s3c_sdhci_platdata armlex4210_hsmmc3_pdata __initdata = { 93static struct s3c_sdhci_platdata armlex4210_hsmmc3_pdata __initdata = {
96 .cd_type = S3C_SDHCI_CD_PERMANENT, 94 .cd_type = S3C_SDHCI_CD_PERMANENT,
97 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
98 .max_width = 4, 95 .max_width = 4,
99}; 96};
100 97
@@ -121,16 +118,9 @@ static void __init armlex4210_wlan_init(void)
121} 118}
122 119
123static struct resource armlex4210_smsc911x_resources[] = { 120static struct resource armlex4210_smsc911x_resources[] = {
124 [0] = { 121 [0] = DEFINE_RES_MEM(EXYNOS4_PA_SROM_BANK(3), SZ_64K),
125 .start = EXYNOS4_PA_SROM_BANK(3), 122 [1] = DEFINE_RES_NAMED(IRQ_EINT(27), 1, NULL, IORESOURCE_IRQ \
126 .end = EXYNOS4_PA_SROM_BANK(3) + SZ_64K - 1, 123 | IRQF_TRIGGER_HIGH),
127 .flags = IORESOURCE_MEM,
128 },
129 [1] = {
130 .start = IRQ_EINT(27),
131 .end = IRQ_EINT(27),
132 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
133 },
134}; 124};
135 125
136static struct smsc911x_platform_config smsc9215_config = { 126static struct smsc911x_platform_config smsc9215_config = {
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c
index 0d26f50081ad..4711c8920e37 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -45,7 +45,7 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
45 "exynos4210-uart.3", NULL), 45 "exynos4210-uart.3", NULL),
46 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL), 46 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
47 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL), 47 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
48 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.2", NULL), 48 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
49 {}, 49 {},
50}; 50};
51 51
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c
index b3982c867c9c..6c31f2ad765d 100644
--- a/arch/arm/mach-exynos/mach-nuri.c
+++ b/arch/arm/mach-exynos/mach-nuri.c
@@ -25,6 +25,8 @@
25#include <linux/mmc/host.h> 25#include <linux/mmc/host.h>
26#include <linux/fb.h> 26#include <linux/fb.h>
27#include <linux/pwm_backlight.h> 27#include <linux/pwm_backlight.h>
28#include <linux/platform_data/s3c-hsotg.h>
29#include <drm/exynos_drm.h>
28 30
29#include <video/platform_lcd.h> 31#include <video/platform_lcd.h>
30#include <media/m5mols.h> 32#include <media/m5mols.h>
@@ -112,8 +114,8 @@ static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = {
112 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA | 114 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
113 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | 115 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
114 MMC_CAP_ERASE), 116 MMC_CAP_ERASE),
117 .host_caps2 = MMC_CAP2_BROKEN_VOLTAGE,
115 .cd_type = S3C_SDHCI_CD_PERMANENT, 118 .cd_type = S3C_SDHCI_CD_PERMANENT,
116 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
117}; 119};
118 120
119static struct regulator_consumer_supply emmc_supplies[] = { 121static struct regulator_consumer_supply emmc_supplies[] = {
@@ -154,7 +156,6 @@ static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = {
154 .ext_cd_gpio = EXYNOS4_GPX3(3), /* XEINT_27 */ 156 .ext_cd_gpio = EXYNOS4_GPX3(3), /* XEINT_27 */
155 .ext_cd_gpio_invert = 1, 157 .ext_cd_gpio_invert = 1,
156 .cd_type = S3C_SDHCI_CD_GPIO, 158 .cd_type = S3C_SDHCI_CD_GPIO,
157 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
158}; 159};
159 160
160/* WLAN */ 161/* WLAN */
@@ -163,7 +164,6 @@ static struct s3c_sdhci_platdata nuri_hsmmc3_data __initdata = {
163 .host_caps = MMC_CAP_4_BIT_DATA | 164 .host_caps = MMC_CAP_4_BIT_DATA |
164 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED, 165 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
165 .cd_type = S3C_SDHCI_CD_EXTERNAL, 166 .cd_type = S3C_SDHCI_CD_EXTERNAL,
166 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
167}; 167};
168 168
169static void __init nuri_sdhci_init(void) 169static void __init nuri_sdhci_init(void)
@@ -212,6 +212,29 @@ static struct platform_device nuri_gpio_keys = {
212 }, 212 },
213}; 213};
214 214
215#ifdef CONFIG_DRM_EXYNOS
216static struct exynos_drm_fimd_pdata drm_fimd_pdata = {
217 .panel = {
218 .timing = {
219 .xres = 1024,
220 .yres = 600,
221 .hsync_len = 40,
222 .left_margin = 79,
223 .right_margin = 200,
224 .vsync_len = 10,
225 .upper_margin = 10,
226 .lower_margin = 11,
227 .refresh = 60,
228 },
229 },
230 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
231 VIDCON0_CLKSEL_LCD,
232 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
233 .default_win = 3,
234 .bpp = 32,
235};
236
237#else
215/* Frame Buffer */ 238/* Frame Buffer */
216static struct s3c_fb_pd_win nuri_fb_win0 = { 239static struct s3c_fb_pd_win nuri_fb_win0 = {
217 .win_mode = { 240 .win_mode = {
@@ -238,6 +261,7 @@ static struct s3c_fb_platdata nuri_fb_pdata __initdata = {
238 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, 261 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
239 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp, 262 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
240}; 263};
264#endif
241 265
242static void nuri_lcd_power_on(struct plat_lcd_data *pd, unsigned int power) 266static void nuri_lcd_power_on(struct plat_lcd_data *pd, unsigned int power)
243{ 267{
@@ -307,49 +331,7 @@ static struct i2c_board_info i2c1_devs[] __initdata = {
307}; 331};
308 332
309/* TSP */ 333/* TSP */
310static u8 mxt_init_vals[] = {
311 /* MXT_GEN_COMMAND(6) */
312 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
313 /* MXT_GEN_POWER(7) */
314 0x20, 0xff, 0x32,
315 /* MXT_GEN_ACQUIRE(8) */
316 0x0a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x23,
317 /* MXT_TOUCH_MULTI(9) */
318 0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00,
319 0x00, 0x01, 0x01, 0x0e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x00,
320 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
321 0x00,
322 /* MXT_TOUCH_KEYARRAY(15) */
323 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
324 0x00,
325 /* MXT_SPT_GPIOPWM(19) */
326 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
327 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
328 /* MXT_PROCI_GRIPFACE(20) */
329 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x28, 0x04,
330 0x0f, 0x0a,
331 /* MXT_PROCG_NOISE(22) */
332 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x23, 0x00,
333 0x00, 0x05, 0x0f, 0x19, 0x23, 0x2d, 0x03,
334 /* MXT_TOUCH_PROXIMITY(23) */
335 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
336 0x00, 0x00, 0x00, 0x00, 0x00,
337 /* MXT_PROCI_ONETOUCH(24) */
338 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
339 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
340 /* MXT_SPT_SELFTEST(25) */
341 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
342 0x00, 0x00, 0x00, 0x00,
343 /* MXT_PROCI_TWOTOUCH(27) */
344 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
345 /* MXT_SPT_CTECONFIG(28) */
346 0x00, 0x00, 0x02, 0x08, 0x10, 0x00,
347};
348
349static struct mxt_platform_data mxt_platform_data = { 334static struct mxt_platform_data mxt_platform_data = {
350 .config = mxt_init_vals,
351 .config_length = ARRAY_SIZE(mxt_init_vals),
352
353 .x_line = 18, 335 .x_line = 18,
354 .y_line = 11, 336 .y_line = 11,
355 .x_size = 1024, 337 .x_size = 1024,
@@ -392,6 +374,7 @@ static struct regulator_consumer_supply __initdata max8997_ldo1_[] = {
392 REGULATOR_SUPPLY("vdd", "s5p-adc"), /* Used by CPU's ADC drv */ 374 REGULATOR_SUPPLY("vdd", "s5p-adc"), /* Used by CPU's ADC drv */
393}; 375};
394static struct regulator_consumer_supply __initdata max8997_ldo3_[] = { 376static struct regulator_consumer_supply __initdata max8997_ldo3_[] = {
377 REGULATOR_SUPPLY("vusb_d", "s3c-hsotg"), /* USB */
395 REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */ 378 REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */
396}; 379};
397static struct regulator_consumer_supply __initdata max8997_ldo4_[] = { 380static struct regulator_consumer_supply __initdata max8997_ldo4_[] = {
@@ -407,7 +390,7 @@ static struct regulator_consumer_supply __initdata max8997_ldo7_[] = {
407 REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */ 390 REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */
408}; 391};
409static struct regulator_consumer_supply __initdata max8997_ldo8_[] = { 392static struct regulator_consumer_supply __initdata max8997_ldo8_[] = {
410 REGULATOR_SUPPLY("vusb_d", NULL), /* Used by CPU */ 393 REGULATOR_SUPPLY("vusb_a", "s3c-hsotg"), /* USB */
411 REGULATOR_SUPPLY("vdac", NULL), /* Used by CPU */ 394 REGULATOR_SUPPLY("vdac", NULL), /* Used by CPU */
412}; 395};
413static struct regulator_consumer_supply __initdata max8997_ldo11_[] = { 396static struct regulator_consumer_supply __initdata max8997_ldo11_[] = {
@@ -571,7 +554,7 @@ static struct regulator_init_data __initdata max8997_ldo7_data = {
571 554
572static struct regulator_init_data __initdata max8997_ldo8_data = { 555static struct regulator_init_data __initdata max8997_ldo8_data = {
573 .constraints = { 556 .constraints = {
574 .name = "VUSB/VDAC_3.3V_C210", 557 .name = "VUSB+VDAC_3.3V_C210",
575 .min_uV = 3300000, 558 .min_uV = 3300000,
576 .max_uV = 3300000, 559 .max_uV = 3300000,
577 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 560 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
@@ -863,6 +846,7 @@ static struct regulator_init_data __initdata max8997_esafeout1_data = {
863 .constraints = { 846 .constraints = {
864 .name = "SAFEOUT1", 847 .name = "SAFEOUT1",
865 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 848 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
849 .always_on = 1,
866 .state_mem = { 850 .state_mem = {
867 .disabled = 1, 851 .disabled = 1,
868 }, 852 },
@@ -1120,6 +1104,9 @@ static void __init nuri_ehci_init(void)
1120 s5p_ehci_set_platdata(pdata); 1104 s5p_ehci_set_platdata(pdata);
1121} 1105}
1122 1106
1107/* USB OTG */
1108static struct s3c_hsotg_plat nuri_hsotg_pdata;
1109
1123/* CAMERA */ 1110/* CAMERA */
1124static struct regulator_consumer_supply cam_vt_cam15_supply = 1111static struct regulator_consumer_supply cam_vt_cam15_supply =
1125 REGULATOR_SUPPLY("vdd_core", "6-003c"); 1112 REGULATOR_SUPPLY("vdd_core", "6-003c");
@@ -1332,6 +1319,7 @@ static struct platform_device *nuri_devices[] __initdata = {
1332 &s5p_device_mfc_l, 1319 &s5p_device_mfc_l,
1333 &s5p_device_mfc_r, 1320 &s5p_device_mfc_r,
1334 &s5p_device_fimc_md, 1321 &s5p_device_fimc_md,
1322 &s3c_device_usb_hsotg,
1335 1323
1336 /* NURI Devices */ 1324 /* NURI Devices */
1337 &nuri_gpio_keys, 1325 &nuri_gpio_keys,
@@ -1343,10 +1331,14 @@ static struct platform_device *nuri_devices[] __initdata = {
1343 &cam_vdda_fixed_rdev, 1331 &cam_vdda_fixed_rdev,
1344 &cam_8m_12v_fixed_rdev, 1332 &cam_8m_12v_fixed_rdev,
1345 &exynos4_bus_devfreq, 1333 &exynos4_bus_devfreq,
1334#ifdef CONFIG_DRM_EXYNOS
1335 &exynos_device_drm,
1336#endif
1346}; 1337};
1347 1338
1348static void __init nuri_map_io(void) 1339static void __init nuri_map_io(void)
1349{ 1340{
1341 clk_xusbxti.rate = 24000000;
1350 exynos_init_io(NULL, 0); 1342 exynos_init_io(NULL, 0);
1351 s3c24xx_init_clocks(24000000); 1343 s3c24xx_init_clocks(24000000);
1352 s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs)); 1344 s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs));
@@ -1374,12 +1366,17 @@ static void __init nuri_machine_init(void)
1374 i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs)); 1366 i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs));
1375 s3c_i2c6_set_platdata(&nuri_i2c6_platdata); 1367 s3c_i2c6_set_platdata(&nuri_i2c6_platdata);
1376 1368
1369#ifdef CONFIG_DRM_EXYNOS
1370 s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata;
1371 exynos4_fimd0_gpio_setup_24bpp();
1372#else
1377 s5p_fimd0_set_platdata(&nuri_fb_pdata); 1373 s5p_fimd0_set_platdata(&nuri_fb_pdata);
1374#endif
1378 1375
1379 nuri_camera_init(); 1376 nuri_camera_init();
1380 1377
1381 nuri_ehci_init(); 1378 nuri_ehci_init();
1382 clk_xusbxti.rate = 24000000; 1379 s3c_hsotg_set_platdata(&nuri_hsotg_pdata);
1383 1380
1384 /* Last */ 1381 /* Last */
1385 platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices)); 1382 platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
diff --git a/arch/arm/mach-exynos/mach-origen.c b/arch/arm/mach-exynos/mach-origen.c
index 878d4c99142d..26124a38bcbd 100644
--- a/arch/arm/mach-exynos/mach-origen.c
+++ b/arch/arm/mach-exynos/mach-origen.c
@@ -45,6 +45,7 @@
45#include <mach/ohci.h> 45#include <mach/ohci.h>
46#include <mach/map.h> 46#include <mach/map.h>
47 47
48#include <drm/exynos_drm.h>
48#include "common.h" 49#include "common.h"
49 50
50/* Following are default values for UCON, ULCON and UFCON UART registers */ 51/* Following are default values for UCON, ULCON and UFCON UART registers */
@@ -472,12 +473,10 @@ static struct i2c_board_info i2c0_devs[] __initdata = {
472 473
473static struct s3c_sdhci_platdata origen_hsmmc0_pdata __initdata = { 474static struct s3c_sdhci_platdata origen_hsmmc0_pdata __initdata = {
474 .cd_type = S3C_SDHCI_CD_INTERNAL, 475 .cd_type = S3C_SDHCI_CD_INTERNAL,
475 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
476}; 476};
477 477
478static struct s3c_sdhci_platdata origen_hsmmc2_pdata __initdata = { 478static struct s3c_sdhci_platdata origen_hsmmc2_pdata __initdata = {
479 .cd_type = S3C_SDHCI_CD_INTERNAL, 479 .cd_type = S3C_SDHCI_CD_INTERNAL,
480 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
481}; 480};
482 481
483/* USB EHCI */ 482/* USB EHCI */
@@ -583,6 +582,27 @@ static struct platform_device origen_lcd_hv070wsa = {
583 .dev.platform_data = &origen_lcd_hv070wsa_data, 582 .dev.platform_data = &origen_lcd_hv070wsa_data,
584}; 583};
585 584
585#ifdef CONFIG_DRM_EXYNOS
586static struct exynos_drm_fimd_pdata drm_fimd_pdata = {
587 .panel = {
588 .timing = {
589 .left_margin = 64,
590 .right_margin = 16,
591 .upper_margin = 64,
592 .lower_margin = 16,
593 .hsync_len = 48,
594 .vsync_len = 3,
595 .xres = 1024,
596 .yres = 600,
597 },
598 },
599 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
600 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
601 VIDCON1_INV_VCLK,
602 .default_win = 0,
603 .bpp = 32,
604};
605#else
586static struct s3c_fb_pd_win origen_fb_win0 = { 606static struct s3c_fb_pd_win origen_fb_win0 = {
587 .win_mode = { 607 .win_mode = {
588 .left_margin = 64, 608 .left_margin = 64,
@@ -596,6 +616,8 @@ static struct s3c_fb_pd_win origen_fb_win0 = {
596 }, 616 },
597 .max_bpp = 32, 617 .max_bpp = 32,
598 .default_bpp = 24, 618 .default_bpp = 24,
619 .virtual_x = 1024,
620 .virtual_y = 2 * 600,
599}; 621};
600 622
601static struct s3c_fb_platdata origen_lcd_pdata __initdata = { 623static struct s3c_fb_platdata origen_lcd_pdata __initdata = {
@@ -605,9 +627,10 @@ static struct s3c_fb_platdata origen_lcd_pdata __initdata = {
605 VIDCON1_INV_VCLK, 627 VIDCON1_INV_VCLK,
606 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp, 628 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
607}; 629};
630#endif
608 631
609/* Bluetooth rfkill gpio platform data */ 632/* Bluetooth rfkill gpio platform data */
610struct rfkill_gpio_platform_data origen_bt_pdata = { 633static struct rfkill_gpio_platform_data origen_bt_pdata = {
611 .reset_gpio = EXYNOS4_GPX2(2), 634 .reset_gpio = EXYNOS4_GPX2(2),
612 .shutdown_gpio = -1, 635 .shutdown_gpio = -1,
613 .type = RFKILL_TYPE_BLUETOOTH, 636 .type = RFKILL_TYPE_BLUETOOTH,
@@ -644,6 +667,9 @@ static struct platform_device *origen_devices[] __initdata = {
644 &s5p_device_mfc_l, 667 &s5p_device_mfc_l,
645 &s5p_device_mfc_r, 668 &s5p_device_mfc_r,
646 &s5p_device_mixer, 669 &s5p_device_mixer,
670#ifdef CONFIG_DRM_EXYNOS
671 &exynos_device_drm,
672#endif
647 &exynos4_device_ohci, 673 &exynos4_device_ohci,
648 &origen_device_gpiokeys, 674 &origen_device_gpiokeys,
649 &origen_lcd_hv070wsa, 675 &origen_lcd_hv070wsa,
@@ -719,7 +745,12 @@ static void __init origen_machine_init(void)
719 s5p_tv_setup(); 745 s5p_tv_setup();
720 s5p_i2c_hdmiphy_set_platdata(NULL); 746 s5p_i2c_hdmiphy_set_platdata(NULL);
721 747
748#ifdef CONFIG_DRM_EXYNOS
749 s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata;
750 exynos4_fimd0_gpio_setup_24bpp();
751#else
722 s5p_fimd0_set_platdata(&origen_lcd_pdata); 752 s5p_fimd0_set_platdata(&origen_lcd_pdata);
753#endif
723 754
724 platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices)); 755 platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices));
725 756
diff --git a/arch/arm/mach-exynos/mach-smdk4x12.c b/arch/arm/mach-exynos/mach-smdk4x12.c
index d00e4f016a68..fe772d893cc9 100644
--- a/arch/arm/mach-exynos/mach-smdk4x12.c
+++ b/arch/arm/mach-exynos/mach-smdk4x12.c
@@ -31,6 +31,7 @@
31#include <plat/gpio-cfg.h> 31#include <plat/gpio-cfg.h>
32#include <plat/iic.h> 32#include <plat/iic.h>
33#include <plat/keypad.h> 33#include <plat/keypad.h>
34#include <plat/mfc.h>
34#include <plat/regs-serial.h> 35#include <plat/regs-serial.h>
35#include <plat/sdhci.h> 36#include <plat/sdhci.h>
36 37
@@ -85,7 +86,6 @@ static struct s3c2410_uartcfg smdk4x12_uartcfgs[] __initdata = {
85 86
86static struct s3c_sdhci_platdata smdk4x12_hsmmc2_pdata __initdata = { 87static struct s3c_sdhci_platdata smdk4x12_hsmmc2_pdata __initdata = {
87 .cd_type = S3C_SDHCI_CD_INTERNAL, 88 .cd_type = S3C_SDHCI_CD_INTERNAL,
88 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
89#ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT 89#ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
90 .max_width = 8, 90 .max_width = 8,
91 .host_caps = MMC_CAP_8_BIT_DATA, 91 .host_caps = MMC_CAP_8_BIT_DATA,
@@ -94,7 +94,6 @@ static struct s3c_sdhci_platdata smdk4x12_hsmmc2_pdata __initdata = {
94 94
95static struct s3c_sdhci_platdata smdk4x12_hsmmc3_pdata __initdata = { 95static struct s3c_sdhci_platdata smdk4x12_hsmmc3_pdata __initdata = {
96 .cd_type = S3C_SDHCI_CD_INTERNAL, 96 .cd_type = S3C_SDHCI_CD_INTERNAL,
97 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
98}; 97};
99 98
100static struct regulator_consumer_supply max8997_buck1 = 99static struct regulator_consumer_supply max8997_buck1 =
@@ -244,6 +243,14 @@ static struct platform_device *smdk4x12_devices[] __initdata = {
244 &s3c_device_i2c7, 243 &s3c_device_i2c7,
245 &s3c_device_rtc, 244 &s3c_device_rtc,
246 &s3c_device_wdt, 245 &s3c_device_wdt,
246 &s5p_device_fimc0,
247 &s5p_device_fimc1,
248 &s5p_device_fimc2,
249 &s5p_device_fimc3,
250 &s5p_device_fimc_md,
251 &s5p_device_mfc,
252 &s5p_device_mfc_l,
253 &s5p_device_mfc_r,
247 &samsung_device_keypad, 254 &samsung_device_keypad,
248}; 255};
249 256
@@ -256,6 +263,11 @@ static void __init smdk4x12_map_io(void)
256 s3c24xx_init_uarts(smdk4x12_uartcfgs, ARRAY_SIZE(smdk4x12_uartcfgs)); 263 s3c24xx_init_uarts(smdk4x12_uartcfgs, ARRAY_SIZE(smdk4x12_uartcfgs));
257} 264}
258 265
266static void __init smdk4x12_reserve(void)
267{
268 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
269}
270
259static void __init smdk4x12_machine_init(void) 271static void __init smdk4x12_machine_init(void)
260{ 272{
261 s3c_i2c0_set_platdata(NULL); 273 s3c_i2c0_set_platdata(NULL);
@@ -293,6 +305,7 @@ MACHINE_START(SMDK4212, "SMDK4212")
293 .init_machine = smdk4x12_machine_init, 305 .init_machine = smdk4x12_machine_init,
294 .timer = &exynos4_timer, 306 .timer = &exynos4_timer,
295 .restart = exynos4_restart, 307 .restart = exynos4_restart,
308 .reserve = &smdk4x12_reserve,
296MACHINE_END 309MACHINE_END
297 310
298MACHINE_START(SMDK4412, "SMDK4412") 311MACHINE_START(SMDK4412, "SMDK4412")
@@ -305,4 +318,5 @@ MACHINE_START(SMDK4412, "SMDK4412")
305 .init_machine = smdk4x12_machine_init, 318 .init_machine = smdk4x12_machine_init,
306 .timer = &exynos4_timer, 319 .timer = &exynos4_timer,
307 .restart = exynos4_restart, 320 .restart = exynos4_restart,
321 .reserve = &smdk4x12_reserve,
308MACHINE_END 322MACHINE_END
diff --git a/arch/arm/mach-exynos/mach-smdkv310.c b/arch/arm/mach-exynos/mach-smdkv310.c
index 83b91fa777c1..5af96064ca51 100644
--- a/arch/arm/mach-exynos/mach-smdkv310.c
+++ b/arch/arm/mach-exynos/mach-smdkv310.c
@@ -44,6 +44,7 @@
44#include <mach/map.h> 44#include <mach/map.h>
45#include <mach/ohci.h> 45#include <mach/ohci.h>
46 46
47#include <drm/exynos_drm.h>
47#include "common.h" 48#include "common.h"
48 49
49/* Following are default values for UCON, ULCON and UFCON UART registers */ 50/* Following are default values for UCON, ULCON and UFCON UART registers */
@@ -93,7 +94,6 @@ static struct s3c2410_uartcfg smdkv310_uartcfgs[] __initdata = {
93 94
94static struct s3c_sdhci_platdata smdkv310_hsmmc0_pdata __initdata = { 95static struct s3c_sdhci_platdata smdkv310_hsmmc0_pdata __initdata = {
95 .cd_type = S3C_SDHCI_CD_INTERNAL, 96 .cd_type = S3C_SDHCI_CD_INTERNAL,
96 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
97#ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT 97#ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
98 .max_width = 8, 98 .max_width = 8,
99 .host_caps = MMC_CAP_8_BIT_DATA, 99 .host_caps = MMC_CAP_8_BIT_DATA,
@@ -104,12 +104,10 @@ static struct s3c_sdhci_platdata smdkv310_hsmmc1_pdata __initdata = {
104 .cd_type = S3C_SDHCI_CD_GPIO, 104 .cd_type = S3C_SDHCI_CD_GPIO,
105 .ext_cd_gpio = EXYNOS4_GPK0(2), 105 .ext_cd_gpio = EXYNOS4_GPK0(2),
106 .ext_cd_gpio_invert = 1, 106 .ext_cd_gpio_invert = 1,
107 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
108}; 107};
109 108
110static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata = { 109static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata = {
111 .cd_type = S3C_SDHCI_CD_INTERNAL, 110 .cd_type = S3C_SDHCI_CD_INTERNAL,
112 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
113#ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT 111#ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
114 .max_width = 8, 112 .max_width = 8,
115 .host_caps = MMC_CAP_8_BIT_DATA, 113 .host_caps = MMC_CAP_8_BIT_DATA,
@@ -120,7 +118,6 @@ static struct s3c_sdhci_platdata smdkv310_hsmmc3_pdata __initdata = {
120 .cd_type = S3C_SDHCI_CD_GPIO, 118 .cd_type = S3C_SDHCI_CD_GPIO,
121 .ext_cd_gpio = EXYNOS4_GPK2(2), 119 .ext_cd_gpio = EXYNOS4_GPK2(2),
122 .ext_cd_gpio_invert = 1, 120 .ext_cd_gpio_invert = 1,
123 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
124}; 121};
125 122
126static void lcd_lte480wv_set_power(struct plat_lcd_data *pd, 123static void lcd_lte480wv_set_power(struct plat_lcd_data *pd,
@@ -160,6 +157,26 @@ static struct platform_device smdkv310_lcd_lte480wv = {
160 .dev.platform_data = &smdkv310_lcd_lte480wv_data, 157 .dev.platform_data = &smdkv310_lcd_lte480wv_data,
161}; 158};
162 159
160#ifdef CONFIG_DRM_EXYNOS
161static struct exynos_drm_fimd_pdata drm_fimd_pdata = {
162 .panel = {
163 .timing = {
164 .left_margin = 13,
165 .right_margin = 8,
166 .upper_margin = 7,
167 .lower_margin = 5,
168 .hsync_len = 3,
169 .vsync_len = 1,
170 .xres = 800,
171 .yres = 480,
172 },
173 },
174 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
175 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
176 .default_win = 0,
177 .bpp = 32,
178};
179#else
163static struct s3c_fb_pd_win smdkv310_fb_win0 = { 180static struct s3c_fb_pd_win smdkv310_fb_win0 = {
164 .win_mode = { 181 .win_mode = {
165 .left_margin = 13, 182 .left_margin = 13,
@@ -181,18 +198,12 @@ static struct s3c_fb_platdata smdkv310_lcd0_pdata __initdata = {
181 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, 198 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
182 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp, 199 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
183}; 200};
201#endif
184 202
185static struct resource smdkv310_smsc911x_resources[] = { 203static struct resource smdkv310_smsc911x_resources[] = {
186 [0] = { 204 [0] = DEFINE_RES_MEM(EXYNOS4_PA_SROM_BANK(1), SZ_64K),
187 .start = EXYNOS4_PA_SROM_BANK(1), 205 [1] = DEFINE_RES_NAMED(IRQ_EINT(5), 1, NULL, IORESOURCE_IRQ \
188 .end = EXYNOS4_PA_SROM_BANK(1) + SZ_64K - 1, 206 | IRQF_TRIGGER_LOW),
189 .flags = IORESOURCE_MEM,
190 },
191 [1] = {
192 .start = IRQ_EINT(5),
193 .end = IRQ_EINT(5),
194 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
195 },
196}; 207};
197 208
198static struct smsc911x_platform_config smsc9215_config = { 209static struct smsc911x_platform_config smsc9215_config = {
@@ -273,6 +284,9 @@ static struct platform_device *smdkv310_devices[] __initdata = {
273 &s5p_device_fimc_md, 284 &s5p_device_fimc_md,
274 &s5p_device_g2d, 285 &s5p_device_g2d,
275 &s5p_device_jpeg, 286 &s5p_device_jpeg,
287#ifdef CONFIG_DRM_EXYNOS
288 &exynos_device_drm,
289#endif
276 &exynos4_device_ac97, 290 &exynos4_device_ac97,
277 &exynos4_device_i2s0, 291 &exynos4_device_i2s0,
278 &exynos4_device_ohci, 292 &exynos4_device_ohci,
@@ -364,7 +378,12 @@ static void __init smdkv310_machine_init(void)
364 samsung_keypad_set_platdata(&smdkv310_keypad_data); 378 samsung_keypad_set_platdata(&smdkv310_keypad_data);
365 379
366 samsung_bl_set(&smdkv310_bl_gpio_info, &smdkv310_bl_data); 380 samsung_bl_set(&smdkv310_bl_gpio_info, &smdkv310_bl_data);
381#ifdef CONFIG_DRM_EXYNOS
382 s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata;
383 exynos4_fimd0_gpio_setup_24bpp();
384#else
367 s5p_fimd0_set_platdata(&smdkv310_lcd0_pdata); 385 s5p_fimd0_set_platdata(&smdkv310_lcd0_pdata);
386#endif
368 387
369 smdkv310_ehci_init(); 388 smdkv310_ehci_init();
370 smdkv310_ohci_init(); 389 smdkv310_ohci_init();
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 6bb9dbdd73fd..6b731b863275 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -23,12 +23,15 @@
23#include <linux/i2c-gpio.h> 23#include <linux/i2c-gpio.h>
24#include <linux/i2c/mcs.h> 24#include <linux/i2c/mcs.h>
25#include <linux/i2c/atmel_mxt_ts.h> 25#include <linux/i2c/atmel_mxt_ts.h>
26#include <linux/platform_data/s3c-hsotg.h>
27#include <drm/exynos_drm.h>
26 28
27#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
28#include <asm/hardware/gic.h> 30#include <asm/hardware/gic.h>
29#include <asm/mach-types.h> 31#include <asm/mach-types.h>
30 32
31#include <plat/regs-serial.h> 33#include <plat/regs-serial.h>
34#include <plat/clock.h>
32#include <plat/cpu.h> 35#include <plat/cpu.h>
33#include <plat/devs.h> 36#include <plat/devs.h>
34#include <plat/iic.h> 37#include <plat/iic.h>
@@ -39,6 +42,7 @@
39#include <plat/pd.h> 42#include <plat/pd.h>
40#include <plat/regs-fb-v4.h> 43#include <plat/regs-fb-v4.h>
41#include <plat/fimc-core.h> 44#include <plat/fimc-core.h>
45#include <plat/s5p-time.h>
42#include <plat/camport.h> 46#include <plat/camport.h>
43#include <plat/mipi_csis.h> 47#include <plat/mipi_csis.h>
44 48
@@ -203,6 +207,7 @@ static struct regulator_init_data lp3974_ldo2_data = {
203}; 207};
204 208
205static struct regulator_consumer_supply lp3974_ldo3_consumer[] = { 209static struct regulator_consumer_supply lp3974_ldo3_consumer[] = {
210 REGULATOR_SUPPLY("vusb_a", "s3c-hsotg"),
206 REGULATOR_SUPPLY("vdd", "exynos4-hdmi"), 211 REGULATOR_SUPPLY("vdd", "exynos4-hdmi"),
207 REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"), 212 REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"),
208 REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), 213 REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"),
@@ -288,6 +293,7 @@ static struct regulator_init_data lp3974_ldo7_data = {
288}; 293};
289 294
290static struct regulator_consumer_supply lp3974_ldo8_consumer[] = { 295static struct regulator_consumer_supply lp3974_ldo8_consumer[] = {
296 REGULATOR_SUPPLY("vusb_d", "s3c-hsotg"),
291 REGULATOR_SUPPLY("vdd33a_dac", "s5p-sdo"), 297 REGULATOR_SUPPLY("vdd33a_dac", "s5p-sdo"),
292}; 298};
293 299
@@ -484,7 +490,10 @@ static struct regulator_init_data lp3974_vichg_data = {
484static struct regulator_init_data lp3974_esafeout1_data = { 490static struct regulator_init_data lp3974_esafeout1_data = {
485 .constraints = { 491 .constraints = {
486 .name = "SAFEOUT1", 492 .name = "SAFEOUT1",
493 .min_uV = 4800000,
494 .max_uV = 4800000,
487 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 495 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
496 .always_on = 1,
488 .state_mem = { 497 .state_mem = {
489 .enabled = 1, 498 .enabled = 1,
490 }, 499 },
@@ -746,8 +755,8 @@ static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = {
746 .max_width = 8, 755 .max_width = 8,
747 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA | 756 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
748 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), 757 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
758 .host_caps2 = MMC_CAP2_BROKEN_VOLTAGE,
749 .cd_type = S3C_SDHCI_CD_PERMANENT, 759 .cd_type = S3C_SDHCI_CD_PERMANENT,
750 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
751}; 760};
752 761
753static struct regulator_consumer_supply mmc0_supplies[] = { 762static struct regulator_consumer_supply mmc0_supplies[] = {
@@ -787,7 +796,6 @@ static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata = {
787 .ext_cd_gpio = EXYNOS4_GPX3(4), /* XEINT_28 */ 796 .ext_cd_gpio = EXYNOS4_GPX3(4), /* XEINT_28 */
788 .ext_cd_gpio_invert = 1, 797 .ext_cd_gpio_invert = 1,
789 .cd_type = S3C_SDHCI_CD_GPIO, 798 .cd_type = S3C_SDHCI_CD_GPIO,
790 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
791}; 799};
792 800
793/* WiFi */ 801/* WiFi */
@@ -810,6 +818,29 @@ static struct i2c_board_info i2c1_devs[] __initdata = {
810 /* Gyro, To be updated */ 818 /* Gyro, To be updated */
811}; 819};
812 820
821#ifdef CONFIG_DRM_EXYNOS
822static struct exynos_drm_fimd_pdata drm_fimd_pdata = {
823 .panel = {
824 .timing = {
825 .left_margin = 16,
826 .right_margin = 16,
827 .upper_margin = 2,
828 .lower_margin = 28,
829 .hsync_len = 2,
830 .vsync_len = 1,
831 .xres = 480,
832 .yres = 800,
833 .refresh = 55,
834 },
835 },
836 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
837 VIDCON0_CLKSEL_LCD,
838 .vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_VDEN
839 | VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
840 .default_win = 3,
841 .bpp = 32,
842};
843#else
813/* Frame Buffer */ 844/* Frame Buffer */
814static struct s3c_fb_pd_win universal_fb_win0 = { 845static struct s3c_fb_pd_win universal_fb_win0 = {
815 .win_mode = { 846 .win_mode = {
@@ -837,6 +868,7 @@ static struct s3c_fb_platdata universal_lcd_pdata __initdata = {
837 | VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, 868 | VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
838 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp, 869 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
839}; 870};
871#endif
840 872
841static struct regulator_consumer_supply cam_vt_dio_supply = 873static struct regulator_consumer_supply cam_vt_dio_supply =
842 REGULATOR_SUPPLY("vdd_core", "0-003c"); 874 REGULATOR_SUPPLY("vdd_core", "0-003c");
@@ -991,6 +1023,9 @@ static struct gpio universal_camera_gpios[] = {
991 { GPIO_CAM_VGA_NSTBY, GPIOF_OUT_INIT_LOW, "CAM_VGA_NSTBY" }, 1023 { GPIO_CAM_VGA_NSTBY, GPIOF_OUT_INIT_LOW, "CAM_VGA_NSTBY" },
992}; 1024};
993 1025
1026/* USB OTG */
1027static struct s3c_hsotg_plat universal_hsotg_pdata;
1028
994static void __init universal_camera_init(void) 1029static void __init universal_camera_init(void)
995{ 1030{
996 s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata), 1031 s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
@@ -1046,6 +1081,10 @@ static struct platform_device *universal_devices[] __initdata = {
1046 &s5p_device_onenand, 1081 &s5p_device_onenand,
1047 &s5p_device_fimd0, 1082 &s5p_device_fimd0,
1048 &s5p_device_jpeg, 1083 &s5p_device_jpeg,
1084#ifdef CONFIG_DRM_EXYNOS
1085 &exynos_device_drm,
1086#endif
1087 &s3c_device_usb_hsotg,
1049 &s5p_device_mfc, 1088 &s5p_device_mfc,
1050 &s5p_device_mfc_l, 1089 &s5p_device_mfc_l,
1051 &s5p_device_mfc_r, 1090 &s5p_device_mfc_r,
@@ -1057,9 +1096,11 @@ static struct platform_device *universal_devices[] __initdata = {
1057 1096
1058static void __init universal_map_io(void) 1097static void __init universal_map_io(void)
1059{ 1098{
1099 clk_xusbxti.rate = 24000000;
1060 exynos_init_io(NULL, 0); 1100 exynos_init_io(NULL, 0);
1061 s3c24xx_init_clocks(24000000); 1101 s3c24xx_init_clocks(24000000);
1062 s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); 1102 s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
1103 s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
1063} 1104}
1064 1105
1065static void s5p_tv_setup(void) 1106static void s5p_tv_setup(void)
@@ -1091,12 +1132,18 @@ static void __init universal_machine_init(void)
1091 s5p_i2c_hdmiphy_set_platdata(NULL); 1132 s5p_i2c_hdmiphy_set_platdata(NULL);
1092 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs)); 1133 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
1093 1134
1135#ifdef CONFIG_DRM_EXYNOS
1136 s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata;
1137 exynos4_fimd0_gpio_setup_24bpp();
1138#else
1094 s5p_fimd0_set_platdata(&universal_lcd_pdata); 1139 s5p_fimd0_set_platdata(&universal_lcd_pdata);
1140#endif
1095 1141
1096 universal_touchkey_init(); 1142 universal_touchkey_init();
1097 i2c_register_board_info(I2C_GPIO_BUS_12, i2c_gpio12_devs, 1143 i2c_register_board_info(I2C_GPIO_BUS_12, i2c_gpio12_devs,
1098 ARRAY_SIZE(i2c_gpio12_devs)); 1144 ARRAY_SIZE(i2c_gpio12_devs));
1099 1145
1146 s3c_hsotg_set_platdata(&universal_hsotg_pdata);
1100 universal_camera_init(); 1147 universal_camera_init();
1101 1148
1102 /* Last */ 1149 /* Last */
@@ -1110,7 +1157,7 @@ MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
1110 .map_io = universal_map_io, 1157 .map_io = universal_map_io,
1111 .handle_irq = gic_handle_irq, 1158 .handle_irq = gic_handle_irq,
1112 .init_machine = universal_machine_init, 1159 .init_machine = universal_machine_init,
1113 .timer = &exynos4_timer, 1160 .timer = &s5p_timer,
1114 .reserve = &universal_reserve, 1161 .reserve = &universal_reserve,
1115 .restart = exynos4_restart, 1162 .restart = exynos4_restart,
1116MACHINE_END 1163MACHINE_END
diff --git a/arch/arm/mach-exynos/setup-usb-phy.c b/arch/arm/mach-exynos/setup-usb-phy.c
index 41743d21e8c6..1af0a7f44e00 100644
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ b/arch/arm/mach-exynos/setup-usb-phy.c
@@ -26,11 +26,71 @@ static int exynos4_usb_host_phy_is_on(void)
26 return (readl(EXYNOS4_PHYPWR) & PHY1_STD_ANALOG_POWERDOWN) ? 0 : 1; 26 return (readl(EXYNOS4_PHYPWR) & PHY1_STD_ANALOG_POWERDOWN) ? 0 : 1;
27} 27}
28 28
29static int exynos4_usb_phy1_init(struct platform_device *pdev) 29static void exynos4210_usb_phy_clkset(struct platform_device *pdev)
30{ 30{
31 struct clk *otg_clk;
32 struct clk *xusbxti_clk; 31 struct clk *xusbxti_clk;
33 u32 phyclk; 32 u32 phyclk;
33
34 /* set clock frequency for PLL */
35 phyclk = readl(EXYNOS4_PHYCLK) & ~CLKSEL_MASK;
36
37 xusbxti_clk = clk_get(&pdev->dev, "xusbxti");
38 if (xusbxti_clk && !IS_ERR(xusbxti_clk)) {
39 switch (clk_get_rate(xusbxti_clk)) {
40 case 12 * MHZ:
41 phyclk |= CLKSEL_12M;
42 break;
43 case 24 * MHZ:
44 phyclk |= CLKSEL_24M;
45 break;
46 default:
47 case 48 * MHZ:
48 /* default reference clock */
49 break;
50 }
51 clk_put(xusbxti_clk);
52 }
53
54 writel(phyclk, EXYNOS4_PHYCLK);
55}
56
57static int exynos4210_usb_phy0_init(struct platform_device *pdev)
58{
59 u32 rstcon;
60
61 writel(readl(S5P_USBDEVICE_PHY_CONTROL) | S5P_USBDEVICE_PHY_ENABLE,
62 S5P_USBDEVICE_PHY_CONTROL);
63
64 exynos4210_usb_phy_clkset(pdev);
65
66 /* set to normal PHY0 */
67 writel((readl(EXYNOS4_PHYPWR) & ~PHY0_NORMAL_MASK), EXYNOS4_PHYPWR);
68
69 /* reset PHY0 and Link */
70 rstcon = readl(EXYNOS4_RSTCON) | PHY0_SWRST_MASK;
71 writel(rstcon, EXYNOS4_RSTCON);
72 udelay(10);
73
74 rstcon &= ~PHY0_SWRST_MASK;
75 writel(rstcon, EXYNOS4_RSTCON);
76
77 return 0;
78}
79
80static int exynos4210_usb_phy0_exit(struct platform_device *pdev)
81{
82 writel((readl(EXYNOS4_PHYPWR) | PHY0_ANALOG_POWERDOWN |
83 PHY0_OTG_DISABLE), EXYNOS4_PHYPWR);
84
85 writel(readl(S5P_USBDEVICE_PHY_CONTROL) & ~S5P_USBDEVICE_PHY_ENABLE,
86 S5P_USBDEVICE_PHY_CONTROL);
87
88 return 0;
89}
90
91static int exynos4210_usb_phy1_init(struct platform_device *pdev)
92{
93 struct clk *otg_clk;
34 u32 rstcon; 94 u32 rstcon;
35 int err; 95 int err;
36 96
@@ -54,27 +114,7 @@ static int exynos4_usb_phy1_init(struct platform_device *pdev)
54 writel(readl(S5P_USBHOST_PHY_CONTROL) | S5P_USBHOST_PHY_ENABLE, 114 writel(readl(S5P_USBHOST_PHY_CONTROL) | S5P_USBHOST_PHY_ENABLE,
55 S5P_USBHOST_PHY_CONTROL); 115 S5P_USBHOST_PHY_CONTROL);
56 116
57 /* set clock frequency for PLL */ 117 exynos4210_usb_phy_clkset(pdev);
58 phyclk = readl(EXYNOS4_PHYCLK) & ~CLKSEL_MASK;
59
60 xusbxti_clk = clk_get(&pdev->dev, "xusbxti");
61 if (xusbxti_clk && !IS_ERR(xusbxti_clk)) {
62 switch (clk_get_rate(xusbxti_clk)) {
63 case 12 * MHZ:
64 phyclk |= CLKSEL_12M;
65 break;
66 case 24 * MHZ:
67 phyclk |= CLKSEL_24M;
68 break;
69 default:
70 case 48 * MHZ:
71 /* default reference clock */
72 break;
73 }
74 clk_put(xusbxti_clk);
75 }
76
77 writel(phyclk, EXYNOS4_PHYCLK);
78 118
79 /* floating prevention logic: disable */ 119 /* floating prevention logic: disable */
80 writel((readl(EXYNOS4_PHY1CON) | FPENABLEN), EXYNOS4_PHY1CON); 120 writel((readl(EXYNOS4_PHY1CON) | FPENABLEN), EXYNOS4_PHY1CON);
@@ -102,7 +142,7 @@ static int exynos4_usb_phy1_init(struct platform_device *pdev)
102 return 0; 142 return 0;
103} 143}
104 144
105static int exynos4_usb_phy1_exit(struct platform_device *pdev) 145static int exynos4210_usb_phy1_exit(struct platform_device *pdev)
106{ 146{
107 struct clk *otg_clk; 147 struct clk *otg_clk;
108 int err; 148 int err;
@@ -136,16 +176,20 @@ static int exynos4_usb_phy1_exit(struct platform_device *pdev)
136 176
137int s5p_usb_phy_init(struct platform_device *pdev, int type) 177int s5p_usb_phy_init(struct platform_device *pdev, int type)
138{ 178{
139 if (type == S5P_USB_PHY_HOST) 179 if (type == S5P_USB_PHY_DEVICE)
140 return exynos4_usb_phy1_init(pdev); 180 return exynos4210_usb_phy0_init(pdev);
181 else if (type == S5P_USB_PHY_HOST)
182 return exynos4210_usb_phy1_init(pdev);
141 183
142 return -EINVAL; 184 return -EINVAL;
143} 185}
144 186
145int s5p_usb_phy_exit(struct platform_device *pdev, int type) 187int s5p_usb_phy_exit(struct platform_device *pdev, int type)
146{ 188{
147 if (type == S5P_USB_PHY_HOST) 189 if (type == S5P_USB_PHY_DEVICE)
148 return exynos4_usb_phy1_exit(pdev); 190 return exynos4210_usb_phy0_exit(pdev);
191 else if (type == S5P_USB_PHY_HOST)
192 return exynos4210_usb_phy1_exit(pdev);
149 193
150 return -EINVAL; 194 return -EINVAL;
151} 195}
diff --git a/arch/arm/mach-footbridge/cats-pci.c b/arch/arm/mach-footbridge/cats-pci.c
index 32321f66dec4..5cec2567c9c5 100644
--- a/arch/arm/mach-footbridge/cats-pci.c
+++ b/arch/arm/mach-footbridge/cats-pci.c
@@ -16,6 +16,11 @@
16/* cats host-specific stuff */ 16/* cats host-specific stuff */
17static int irqmap_cats[] __initdata = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 }; 17static int irqmap_cats[] __initdata = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 };
18 18
19static u8 cats_no_swizzle(struct pci_dev *dev, u8 *pin)
20{
21 return 0;
22}
23
19static int __init cats_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 24static int __init cats_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
20{ 25{
21 if (dev->irq >= 255) 26 if (dev->irq >= 255)
@@ -39,11 +44,11 @@ static int __init cats_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
39 * cards being used (ie, pci-pci bridge based cards)? 44 * cards being used (ie, pci-pci bridge based cards)?
40 */ 45 */
41static struct hw_pci cats_pci __initdata = { 46static struct hw_pci cats_pci __initdata = {
42 .swizzle = NULL, 47 .swizzle = cats_no_swizzle,
43 .map_irq = cats_map_irq, 48 .map_irq = cats_map_irq,
44 .nr_controllers = 1, 49 .nr_controllers = 1,
50 .ops = &dc21285_ops,
45 .setup = dc21285_setup, 51 .setup = dc21285_setup,
46 .scan = dc21285_scan_bus,
47 .preinit = dc21285_preinit, 52 .preinit = dc21285_preinit,
48 .postinit = dc21285_postinit, 53 .postinit = dc21285_postinit,
49}; 54};
diff --git a/arch/arm/mach-footbridge/dc21285.c b/arch/arm/mach-footbridge/dc21285.c
index e17e11de4f5e..9d62e3381024 100644
--- a/arch/arm/mach-footbridge/dc21285.c
+++ b/arch/arm/mach-footbridge/dc21285.c
@@ -129,7 +129,7 @@ dc21285_write_config(struct pci_bus *bus, unsigned int devfn, int where,
129 return PCIBIOS_SUCCESSFUL; 129 return PCIBIOS_SUCCESSFUL;
130} 130}
131 131
132static struct pci_ops dc21285_ops = { 132struct pci_ops dc21285_ops = {
133 .read = dc21285_read_config, 133 .read = dc21285_read_config,
134 .write = dc21285_write_config, 134 .write = dc21285_write_config,
135}; 135};
@@ -284,11 +284,6 @@ int __init dc21285_setup(int nr, struct pci_sys_data *sys)
284 return 1; 284 return 1;
285} 285}
286 286
287struct pci_bus * __init dc21285_scan_bus(int nr, struct pci_sys_data *sys)
288{
289 return pci_scan_root_bus(NULL, 0, &dc21285_ops, sys, &sys->resources);
290}
291
292#define dc21285_request_irq(_a, _b, _c, _d, _e) \ 287#define dc21285_request_irq(_a, _b, _c, _d, _e) \
293 WARN_ON(request_irq(_a, _b, _c, _d, _e) < 0) 288 WARN_ON(request_irq(_a, _b, _c, _d, _e) < 0)
294 289
diff --git a/arch/arm/mach-footbridge/ebsa285-pci.c b/arch/arm/mach-footbridge/ebsa285-pci.c
index 511c673ffa9d..fd12d8a36dc5 100644
--- a/arch/arm/mach-footbridge/ebsa285-pci.c
+++ b/arch/arm/mach-footbridge/ebsa285-pci.c
@@ -29,11 +29,10 @@ static int __init ebsa285_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
29} 29}
30 30
31static struct hw_pci ebsa285_pci __initdata = { 31static struct hw_pci ebsa285_pci __initdata = {
32 .swizzle = pci_std_swizzle,
33 .map_irq = ebsa285_map_irq, 32 .map_irq = ebsa285_map_irq,
34 .nr_controllers = 1, 33 .nr_controllers = 1,
34 .ops = &dc21285_ops,
35 .setup = dc21285_setup, 35 .setup = dc21285_setup,
36 .scan = dc21285_scan_bus,
37 .preinit = dc21285_preinit, 36 .preinit = dc21285_preinit,
38 .postinit = dc21285_postinit, 37 .postinit = dc21285_postinit,
39}; 38};
diff --git a/arch/arm/mach-footbridge/netwinder-pci.c b/arch/arm/mach-footbridge/netwinder-pci.c
index 62187610e17e..0fba5134e4fe 100644
--- a/arch/arm/mach-footbridge/netwinder-pci.c
+++ b/arch/arm/mach-footbridge/netwinder-pci.c
@@ -43,11 +43,10 @@ static int __init netwinder_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
43} 43}
44 44
45static struct hw_pci netwinder_pci __initdata = { 45static struct hw_pci netwinder_pci __initdata = {
46 .swizzle = pci_std_swizzle,
47 .map_irq = netwinder_map_irq, 46 .map_irq = netwinder_map_irq,
48 .nr_controllers = 1, 47 .nr_controllers = 1,
48 .ops = &dc21285_ops,
49 .setup = dc21285_setup, 49 .setup = dc21285_setup,
50 .scan = dc21285_scan_bus,
51 .preinit = dc21285_preinit, 50 .preinit = dc21285_preinit,
52 .postinit = dc21285_postinit, 51 .postinit = dc21285_postinit,
53}; 52};
diff --git a/arch/arm/mach-footbridge/personal-pci.c b/arch/arm/mach-footbridge/personal-pci.c
index aeb651d914a6..5c9ee54613b2 100644
--- a/arch/arm/mach-footbridge/personal-pci.c
+++ b/arch/arm/mach-footbridge/personal-pci.c
@@ -41,8 +41,8 @@ static int __init personal_server_map_irq(const struct pci_dev *dev, u8 slot,
41static struct hw_pci personal_server_pci __initdata = { 41static struct hw_pci personal_server_pci __initdata = {
42 .map_irq = personal_server_map_irq, 42 .map_irq = personal_server_map_irq,
43 .nr_controllers = 1, 43 .nr_controllers = 1,
44 .ops = &dc21285_ops,
44 .setup = dc21285_setup, 45 .setup = dc21285_setup,
45 .scan = dc21285_scan_bus,
46 .preinit = dc21285_preinit, 46 .preinit = dc21285_preinit,
47 .postinit = dc21285_postinit, 47 .postinit = dc21285_postinit,
48}; 48};
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 7561eca131b0..7d6322ce5223 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -163,6 +163,7 @@ config MACH_EUKREA_CPUIMX25SD
163 select SOC_IMX25 163 select SOC_IMX25
164 select IMX_HAVE_PLATFORM_FLEXCAN 164 select IMX_HAVE_PLATFORM_FLEXCAN
165 select IMX_HAVE_PLATFORM_FSL_USB2_UDC 165 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
166 select IMX_HAVE_PLATFORM_IMX2_WDT
166 select IMX_HAVE_PLATFORM_IMXDI_RTC 167 select IMX_HAVE_PLATFORM_IMXDI_RTC
167 select IMX_HAVE_PLATFORM_IMX_FB 168 select IMX_HAVE_PLATFORM_IMX_FB
168 select IMX_HAVE_PLATFORM_IMX_I2C 169 select IMX_HAVE_PLATFORM_IMX_I2C
@@ -181,6 +182,7 @@ config MACH_EUKREA_MBIMXSD25_BASEBOARD
181 bool "Eukrea MBIMXSD development board" 182 bool "Eukrea MBIMXSD development board"
182 select IMX_HAVE_PLATFORM_GPIO_KEYS 183 select IMX_HAVE_PLATFORM_GPIO_KEYS
183 select IMX_HAVE_PLATFORM_IMX_SSI 184 select IMX_HAVE_PLATFORM_IMX_SSI
185 select IMX_HAVE_PLATFORM_SPI_IMX
184 select LEDS_GPIO_REGISTER 186 select LEDS_GPIO_REGISTER
185 help 187 help
186 This adds board specific devices that can be found on Eukrea's 188 This adds board specific devices that can be found on Eukrea's
@@ -571,8 +573,10 @@ config MACH_MX35_3DS
571 select MXC_DEBUG_BOARD 573 select MXC_DEBUG_BOARD
572 select IMX_HAVE_PLATFORM_FSL_USB2_UDC 574 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
573 select IMX_HAVE_PLATFORM_IMX2_WDT 575 select IMX_HAVE_PLATFORM_IMX2_WDT
576 select IMX_HAVE_PLATFORM_IMX_FB
574 select IMX_HAVE_PLATFORM_IMX_I2C 577 select IMX_HAVE_PLATFORM_IMX_I2C
575 select IMX_HAVE_PLATFORM_IMX_UART 578 select IMX_HAVE_PLATFORM_IMX_UART
579 select IMX_HAVE_PLATFORM_IPU_CORE
576 select IMX_HAVE_PLATFORM_MXC_EHCI 580 select IMX_HAVE_PLATFORM_MXC_EHCI
577 select IMX_HAVE_PLATFORM_MXC_NAND 581 select IMX_HAVE_PLATFORM_MXC_NAND
578 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 582 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
@@ -606,6 +610,7 @@ config MACH_EUKREA_MBIMXSD35_BASEBOARD
606 select IMX_HAVE_PLATFORM_GPIO_KEYS 610 select IMX_HAVE_PLATFORM_GPIO_KEYS
607 select IMX_HAVE_PLATFORM_IMX_SSI 611 select IMX_HAVE_PLATFORM_IMX_SSI
608 select IMX_HAVE_PLATFORM_IPU_CORE 612 select IMX_HAVE_PLATFORM_IPU_CORE
613 select IMX_HAVE_PLATFORM_SPI_IMX
609 select LEDS_GPIO_REGISTER 614 select LEDS_GPIO_REGISTER
610 help 615 help
611 This adds board specific devices that can be found on Eukrea's 616 This adds board specific devices that can be found on Eukrea's
@@ -682,42 +687,13 @@ config MACH_MX51_3DS
682 Include support for MX51PDK (3DS) platform. This includes specific 687 Include support for MX51PDK (3DS) platform. This includes specific
683 configurations for the board and its peripherals. 688 configurations for the board and its peripherals.
684 689
685config MACH_EUKREA_CPUIMX51
686 bool "Support Eukrea CPUIMX51 module"
687 select SOC_IMX51
688 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
689 select IMX_HAVE_PLATFORM_IMX_I2C
690 select IMX_HAVE_PLATFORM_IMX_UART
691 select IMX_HAVE_PLATFORM_MXC_EHCI
692 select IMX_HAVE_PLATFORM_MXC_NAND
693 select IMX_HAVE_PLATFORM_SPI_IMX
694 help
695 Include support for Eukrea CPUIMX51 platform. This includes
696 specific configurations for the module and its peripherals.
697
698choice
699 prompt "Baseboard"
700 depends on MACH_EUKREA_CPUIMX51
701 default MACH_EUKREA_MBIMX51_BASEBOARD
702
703config MACH_EUKREA_MBIMX51_BASEBOARD
704 prompt "Eukrea MBIMX51 development board"
705 bool
706 select IMX_HAVE_PLATFORM_IMX_KEYPAD
707 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
708 select LEDS_GPIO_REGISTER
709 help
710 This adds board specific devices that can be found on Eukrea's
711 MBIMX51 evaluation board.
712
713endchoice
714
715config MACH_EUKREA_CPUIMX51SD 690config MACH_EUKREA_CPUIMX51SD
716 bool "Support Eukrea CPUIMX51SD module" 691 bool "Support Eukrea CPUIMX51SD module"
717 select SOC_IMX51 692 select SOC_IMX51
718 select IMX_HAVE_PLATFORM_FSL_USB2_UDC 693 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
719 select IMX_HAVE_PLATFORM_IMX_I2C 694 select IMX_HAVE_PLATFORM_IMX_I2C
720 select IMX_HAVE_PLATFORM_IMX_UART 695 select IMX_HAVE_PLATFORM_IMX_UART
696 select IMX_HAVE_PLATFORM_IMX2_WDT
721 select IMX_HAVE_PLATFORM_MXC_EHCI 697 select IMX_HAVE_PLATFORM_MXC_EHCI
722 select IMX_HAVE_PLATFORM_MXC_NAND 698 select IMX_HAVE_PLATFORM_MXC_NAND
723 select IMX_HAVE_PLATFORM_SPI_IMX 699 select IMX_HAVE_PLATFORM_SPI_IMX
@@ -733,6 +709,7 @@ choice
733config MACH_EUKREA_MBIMXSD51_BASEBOARD 709config MACH_EUKREA_MBIMXSD51_BASEBOARD
734 prompt "Eukrea MBIMXSD development board" 710 prompt "Eukrea MBIMXSD development board"
735 bool 711 bool
712 select IMX_HAVE_PLATFORM_IMX_SSI
736 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 713 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
737 select LEDS_GPIO_REGISTER 714 select LEDS_GPIO_REGISTER
738 help 715 help
@@ -842,6 +819,8 @@ config SOC_IMX6Q
842 select HAVE_IMX_MMDC 819 select HAVE_IMX_MMDC
843 select HAVE_IMX_SRC 820 select HAVE_IMX_SRC
844 select HAVE_SMP 821 select HAVE_SMP
822 select PINCTRL
823 select PINCTRL_IMX6Q
845 select USE_OF 824 select USE_OF
846 825
847 help 826 help
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index ab939c5046c3..4937c070a57e 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -83,10 +83,8 @@ obj-$(CONFIG_MACH_MX53_EVK) += mach-mx53_evk.o
83obj-$(CONFIG_MACH_MX53_SMD) += mach-mx53_smd.o 83obj-$(CONFIG_MACH_MX53_SMD) += mach-mx53_smd.o
84obj-$(CONFIG_MACH_MX53_LOCO) += mach-mx53_loco.o 84obj-$(CONFIG_MACH_MX53_LOCO) += mach-mx53_loco.o
85obj-$(CONFIG_MACH_MX53_ARD) += mach-mx53_ard.o 85obj-$(CONFIG_MACH_MX53_ARD) += mach-mx53_ard.o
86obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += mach-cpuimx51.o
87obj-$(CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD) += eukrea_mbimx51-baseboard.o
88obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += mach-cpuimx51sd.o 86obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += mach-cpuimx51sd.o
89obj-$(CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD) += eukrea_mbimxsd-baseboard.o 87obj-$(CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD) += eukrea_mbimxsd51-baseboard.o
90obj-$(CONFIG_MX51_EFIKA_COMMON) += mx51_efika.o 88obj-$(CONFIG_MX51_EFIKA_COMMON) += mx51_efika.o
91obj-$(CONFIG_MACH_MX51_EFIKAMX) += mach-mx51_efikamx.o 89obj-$(CONFIG_MACH_MX51_EFIKAMX) += mach-mx51_efikamx.o
92obj-$(CONFIG_MACH_MX51_EFIKASB) += mach-mx51_efikasb.o 90obj-$(CONFIG_MACH_MX51_EFIKASB) += mach-mx51_efikasb.o
diff --git a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
index 5f2f91d1798b..b46cab0ced53 100644
--- a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
@@ -243,7 +243,7 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
243static void __maybe_unused ads7846_dev_init(void) 243static void __maybe_unused ads7846_dev_init(void)
244{ 244{
245 if (gpio_request(ADS7846_PENDOWN, "ADS7846 pendown") < 0) { 245 if (gpio_request(ADS7846_PENDOWN, "ADS7846 pendown") < 0) {
246 printk(KERN_ERR "can't get ads746 pen down GPIO\n"); 246 printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
247 return; 247 return;
248 } 248 }
249 gpio_direction_input(ADS7846_PENDOWN); 249 gpio_direction_input(ADS7846_PENDOWN);
diff --git a/arch/arm/mach-imx/eukrea_mbimx51-baseboard.c b/arch/arm/mach-imx/eukrea_mbimx51-baseboard.c
deleted file mode 100644
index a6a3ab8f1b1c..000000000000
--- a/arch/arm/mach-imx/eukrea_mbimx51-baseboard.c
+++ /dev/null
@@ -1,206 +0,0 @@
1/*
2 *
3 * Copyright (C) 2010 Eric Bénard <eric@eukrea.com>
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <linux/serial_8250.h>
16#include <linux/i2c.h>
17#include <linux/gpio.h>
18#include <linux/io.h>
19#include <linux/interrupt.h>
20#include <linux/irq.h>
21#include <linux/i2c/tsc2007.h>
22#include <linux/leds.h>
23
24#include <mach/common.h>
25#include <mach/hardware.h>
26#include <mach/iomux-mx51.h>
27
28#include <asm/mach/arch.h>
29
30#include "devices-imx51.h"
31
32#define MBIMX51_TSC2007_GPIO IMX_GPIO_NR(3, 30)
33#define MBIMX51_LED0 IMX_GPIO_NR(3, 5)
34#define MBIMX51_LED1 IMX_GPIO_NR(3, 6)
35#define MBIMX51_LED2 IMX_GPIO_NR(3, 7)
36#define MBIMX51_LED3 IMX_GPIO_NR(3, 8)
37
38static const struct gpio_led mbimx51_leds[] __initconst = {
39 {
40 .name = "led0",
41 .default_trigger = "heartbeat",
42 .active_low = 1,
43 .gpio = MBIMX51_LED0,
44 },
45 {
46 .name = "led1",
47 .default_trigger = "nand-disk",
48 .active_low = 1,
49 .gpio = MBIMX51_LED1,
50 },
51 {
52 .name = "led2",
53 .default_trigger = "mmc0",
54 .active_low = 1,
55 .gpio = MBIMX51_LED2,
56 },
57 {
58 .name = "led3",
59 .default_trigger = "default-on",
60 .active_low = 1,
61 .gpio = MBIMX51_LED3,
62 },
63};
64
65static const struct gpio_led_platform_data mbimx51_leds_info __initconst = {
66 .leds = mbimx51_leds,
67 .num_leds = ARRAY_SIZE(mbimx51_leds),
68};
69
70static iomux_v3_cfg_t mbimx51_pads[] = {
71 /* UART2 */
72 MX51_PAD_UART2_RXD__UART2_RXD,
73 MX51_PAD_UART2_TXD__UART2_TXD,
74
75 /* UART3 */
76 MX51_PAD_UART3_RXD__UART3_RXD,
77 MX51_PAD_UART3_TXD__UART3_TXD,
78 MX51_PAD_KEY_COL4__UART3_RTS,
79 MX51_PAD_KEY_COL5__UART3_CTS,
80
81 /* TSC2007 IRQ */
82 MX51_PAD_NANDF_D10__GPIO3_30,
83
84 /* LEDS */
85 MX51_PAD_DISPB2_SER_DIN__GPIO3_5,
86 MX51_PAD_DISPB2_SER_DIO__GPIO3_6,
87 MX51_PAD_DISPB2_SER_CLK__GPIO3_7,
88 MX51_PAD_DISPB2_SER_RS__GPIO3_8,
89
90 /* KPP */
91 MX51_PAD_KEY_ROW0__KEY_ROW0,
92 MX51_PAD_KEY_ROW1__KEY_ROW1,
93 MX51_PAD_KEY_ROW2__KEY_ROW2,
94 MX51_PAD_KEY_ROW3__KEY_ROW3,
95 MX51_PAD_KEY_COL0__KEY_COL0,
96 MX51_PAD_KEY_COL1__KEY_COL1,
97 MX51_PAD_KEY_COL2__KEY_COL2,
98 MX51_PAD_KEY_COL3__KEY_COL3,
99
100 /* SD 1 */
101 MX51_PAD_SD1_CMD__SD1_CMD,
102 MX51_PAD_SD1_CLK__SD1_CLK,
103 MX51_PAD_SD1_DATA0__SD1_DATA0,
104 MX51_PAD_SD1_DATA1__SD1_DATA1,
105 MX51_PAD_SD1_DATA2__SD1_DATA2,
106 MX51_PAD_SD1_DATA3__SD1_DATA3,
107
108 /* SD 2 */
109 MX51_PAD_SD2_CMD__SD2_CMD,
110 MX51_PAD_SD2_CLK__SD2_CLK,
111 MX51_PAD_SD2_DATA0__SD2_DATA0,
112 MX51_PAD_SD2_DATA1__SD2_DATA1,
113 MX51_PAD_SD2_DATA2__SD2_DATA2,
114 MX51_PAD_SD2_DATA3__SD2_DATA3,
115};
116
117static const struct imxuart_platform_data uart_pdata __initconst = {
118 .flags = IMXUART_HAVE_RTSCTS,
119};
120
121static int mbimx51_keymap[] = {
122 KEY(0, 0, KEY_1),
123 KEY(0, 1, KEY_2),
124 KEY(0, 2, KEY_3),
125 KEY(0, 3, KEY_UP),
126
127 KEY(1, 0, KEY_4),
128 KEY(1, 1, KEY_5),
129 KEY(1, 2, KEY_6),
130 KEY(1, 3, KEY_LEFT),
131
132 KEY(2, 0, KEY_7),
133 KEY(2, 1, KEY_8),
134 KEY(2, 2, KEY_9),
135 KEY(2, 3, KEY_RIGHT),
136
137 KEY(3, 0, KEY_0),
138 KEY(3, 1, KEY_DOWN),
139 KEY(3, 2, KEY_ESC),
140 KEY(3, 3, KEY_ENTER),
141};
142
143static const struct matrix_keymap_data mbimx51_map_data __initconst = {
144 .keymap = mbimx51_keymap,
145 .keymap_size = ARRAY_SIZE(mbimx51_keymap),
146};
147
148static int tsc2007_get_pendown_state(void)
149{
150 return !gpio_get_value(MBIMX51_TSC2007_GPIO);
151}
152
153struct tsc2007_platform_data tsc2007_data = {
154 .model = 2007,
155 .x_plate_ohms = 180,
156 .get_pendown_state = tsc2007_get_pendown_state,
157};
158
159static struct i2c_board_info mbimx51_i2c_devices[] = {
160 {
161 I2C_BOARD_INFO("tsc2007", 0x49),
162 .irq = IMX_GPIO_TO_IRQ(MBIMX51_TSC2007_GPIO),
163 .platform_data = &tsc2007_data,
164 }, {
165 I2C_BOARD_INFO("tlv320aic23", 0x1a),
166 },
167};
168
169/*
170 * baseboard initialization.
171 */
172void __init eukrea_mbimx51_baseboard_init(void)
173{
174 mxc_iomux_v3_setup_multiple_pads(mbimx51_pads,
175 ARRAY_SIZE(mbimx51_pads));
176
177 imx51_add_imx_uart(1, NULL);
178 imx51_add_imx_uart(2, &uart_pdata);
179
180 gpio_request(MBIMX51_LED0, "LED0");
181 gpio_direction_output(MBIMX51_LED0, 1);
182 gpio_free(MBIMX51_LED0);
183 gpio_request(MBIMX51_LED1, "LED1");
184 gpio_direction_output(MBIMX51_LED1, 1);
185 gpio_free(MBIMX51_LED1);
186 gpio_request(MBIMX51_LED2, "LED2");
187 gpio_direction_output(MBIMX51_LED2, 1);
188 gpio_free(MBIMX51_LED2);
189 gpio_request(MBIMX51_LED3, "LED3");
190 gpio_direction_output(MBIMX51_LED3, 1);
191 gpio_free(MBIMX51_LED3);
192
193 gpio_led_register_device(-1, &mbimx51_leds_info);
194
195 imx51_add_imx_keypad(&mbimx51_map_data);
196
197 gpio_request(MBIMX51_TSC2007_GPIO, "tsc2007_irq");
198 gpio_direction_input(MBIMX51_TSC2007_GPIO);
199 irq_set_irq_type(gpio_to_irq(MBIMX51_TSC2007_GPIO),
200 IRQF_TRIGGER_FALLING);
201 i2c_register_board_info(1, mbimx51_i2c_devices,
202 ARRAY_SIZE(mbimx51_i2c_devices));
203
204 imx51_add_sdhci_esdhc_imx(0, NULL);
205 imx51_add_sdhci_esdhc_imx(1, NULL);
206}
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
index 2cf603e11c4f..dfd2da87c2df 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
@@ -23,6 +23,7 @@
23#include <linux/leds.h> 23#include <linux/leds.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/input.h> 25#include <linux/input.h>
26#include <linux/spi/spi.h>
26#include <video/platform_lcd.h> 27#include <video/platform_lcd.h>
27 28
28#include <mach/hardware.h> 29#include <mach/hardware.h>
@@ -87,12 +88,22 @@ static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {
87 /* CAN */ 88 /* CAN */
88 MX25_PAD_GPIO_D__CAN2_RX, 89 MX25_PAD_GPIO_D__CAN2_RX,
89 MX25_PAD_GPIO_C__CAN2_TX, 90 MX25_PAD_GPIO_C__CAN2_TX,
91 /* SPI1 */
92 MX25_PAD_CSPI1_MOSI__CSPI1_MOSI,
93 MX25_PAD_CSPI1_MISO__CSPI1_MISO,
94 MX25_PAD_CSPI1_SS0__GPIO_1_16,
95 MX25_PAD_CSPI1_SS1__GPIO_1_17,
96 MX25_PAD_CSPI1_SCLK__CSPI1_SCLK,
97 MX25_PAD_CSPI1_RDY__GPIO_2_22,
90}; 98};
91 99
92#define GPIO_LED1 83 100#define GPIO_LED1 IMX_GPIO_NR(3, 19)
93#define GPIO_SWITCH1 82 101#define GPIO_SWITCH1 IMX_GPIO_NR(3, 18)
94#define GPIO_SD1CD 52 102#define GPIO_SD1CD IMX_GPIO_NR(2, 20)
95#define GPIO_LCDPWR 26 103#define GPIO_LCDPWR IMX_GPIO_NR(1, 26)
104#define GPIO_SPI1_SS0 IMX_GPIO_NR(1, 16)
105#define GPIO_SPI1_SS1 IMX_GPIO_NR(1, 17)
106#define GPIO_SPI1_IRQ IMX_GPIO_NR(2, 22)
96 107
97static struct imx_fb_videomode eukrea_mximxsd_modes[] = { 108static struct imx_fb_videomode eukrea_mximxsd_modes[] = {
98 { 109 {
@@ -228,6 +239,30 @@ static struct esdhc_platform_data sd1_pdata = {
228 .wp_type = ESDHC_WP_NONE, 239 .wp_type = ESDHC_WP_NONE,
229}; 240};
230 241
242static struct spi_board_info eukrea_mbimxsd25_spi_board_info[] __initdata = {
243 {
244 .modalias = "spidev",
245 .max_speed_hz = 20000000,
246 .bus_num = 0,
247 .chip_select = 0,
248 .mode = SPI_MODE_0,
249 },
250 {
251 .modalias = "spidev",
252 .max_speed_hz = 20000000,
253 .bus_num = 0,
254 .chip_select = 1,
255 .mode = SPI_MODE_0,
256 },
257};
258
259static int eukrea_mbimxsd25_spi_cs[] = {GPIO_SPI1_SS0, GPIO_SPI1_SS1};
260
261static const struct spi_imx_master eukrea_mbimxsd25_spi0_data __initconst = {
262 .chipselect = eukrea_mbimxsd25_spi_cs,
263 .num_chipselect = ARRAY_SIZE(eukrea_mbimxsd25_spi_cs),
264};
265
231/* 266/*
232 * system init for baseboard usage. Will be called by cpuimx25 init. 267 * system init for baseboard usage. Will be called by cpuimx25 init.
233 * 268 *
@@ -257,11 +292,17 @@ void __init eukrea_mbimxsd25_baseboard_init(void)
257 292
258 gpio_request(GPIO_LCDPWR, "LCDPWR"); 293 gpio_request(GPIO_LCDPWR, "LCDPWR");
259 gpio_direction_output(GPIO_LCDPWR, 1); 294 gpio_direction_output(GPIO_LCDPWR, 1);
260 gpio_free(GPIO_SWITCH1);
261 295
262 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, 296 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
263 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); 297 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices));
264 298
299 gpio_request(GPIO_SPI1_IRQ, "SPI1_IRQ");
300 gpio_direction_input(GPIO_SPI1_IRQ);
301 gpio_free(GPIO_SPI1_IRQ);
302 imx25_add_spi_imx0(&eukrea_mbimxsd25_spi0_data);
303 spi_register_board_info(eukrea_mbimxsd25_spi_board_info,
304 ARRAY_SIZE(eukrea_mbimxsd25_spi_board_info));
305
265 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 306 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
266 gpio_led_register_device(-1, &eukrea_mbimxsd_led_info); 307 gpio_led_register_device(-1, &eukrea_mbimxsd_led_info);
267 imx_add_gpio_keys(&eukrea_mbimxsd_button_data); 308 imx_add_gpio_keys(&eukrea_mbimxsd_button_data);
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
index fd8bf8a425a7..557f6c486053 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
@@ -27,6 +27,7 @@
27#include <linux/leds.h> 27#include <linux/leds.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/input.h> 29#include <linux/input.h>
30#include <linux/spi/spi.h>
30#include <video/platform_lcd.h> 31#include <video/platform_lcd.h>
31#include <linux/i2c.h> 32#include <linux/i2c.h>
32 33
@@ -158,12 +159,22 @@ static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {
158 MX35_PAD_SD1_DATA3__ESDHC1_DAT3, 159 MX35_PAD_SD1_DATA3__ESDHC1_DAT3,
159 /* SD1 CD */ 160 /* SD1 CD */
160 MX35_PAD_LD18__GPIO3_24, 161 MX35_PAD_LD18__GPIO3_24,
162 /* SPI */
163 MX35_PAD_CSPI1_MOSI__CSPI1_MOSI,
164 MX35_PAD_CSPI1_MISO__CSPI1_MISO,
165 MX35_PAD_CSPI1_SS0__GPIO1_18,
166 MX35_PAD_CSPI1_SS1__GPIO1_19,
167 MX35_PAD_CSPI1_SCLK__CSPI1_SCLK,
168 MX35_PAD_CSPI1_SPI_RDY__GPIO3_5,
161}; 169};
162 170
163#define GPIO_LED1 IMX_GPIO_NR(3, 29) 171#define GPIO_LED1 IMX_GPIO_NR(3, 29)
164#define GPIO_SWITCH1 IMX_GPIO_NR(3, 25) 172#define GPIO_SWITCH1 IMX_GPIO_NR(3, 25)
165#define GPIO_LCDPWR IMX_GPIO_NR(1, 4) 173#define GPIO_LCDPWR IMX_GPIO_NR(1, 4)
166#define GPIO_SD1CD IMX_GPIO_NR(3, 24) 174#define GPIO_SD1CD IMX_GPIO_NR(3, 24)
175#define GPIO_SPI1_SS0 IMX_GPIO_NR(1, 18)
176#define GPIO_SPI1_SS1 IMX_GPIO_NR(1, 19)
177#define GPIO_SPI1_IRQ IMX_GPIO_NR(3, 5)
167 178
168static void eukrea_mbimxsd_lcd_power_set(struct plat_lcd_data *pd, 179static void eukrea_mbimxsd_lcd_power_set(struct plat_lcd_data *pd,
169 unsigned int power) 180 unsigned int power)
@@ -239,6 +250,30 @@ static struct esdhc_platform_data sd1_pdata = {
239 .wp_type = ESDHC_WP_NONE, 250 .wp_type = ESDHC_WP_NONE,
240}; 251};
241 252
253static struct spi_board_info eukrea_mbimxsd35_spi_board_info[] __initdata = {
254 {
255 .modalias = "spidev",
256 .max_speed_hz = 20000000,
257 .bus_num = 0,
258 .chip_select = 0,
259 .mode = SPI_MODE_0,
260 },
261 {
262 .modalias = "spidev",
263 .max_speed_hz = 20000000,
264 .bus_num = 0,
265 .chip_select = 1,
266 .mode = SPI_MODE_0,
267 },
268};
269
270static int eukrea_mbimxsd35_spi_cs[] = {GPIO_SPI1_SS0, GPIO_SPI1_SS1};
271
272static const struct spi_imx_master eukrea_mbimxsd35_spi0_data __initconst = {
273 .chipselect = eukrea_mbimxsd35_spi_cs,
274 .num_chipselect = ARRAY_SIZE(eukrea_mbimxsd35_spi_cs),
275};
276
242/* 277/*
243 * system init for baseboard usage. Will be called by cpuimx35 init. 278 * system init for baseboard usage. Will be called by cpuimx35 init.
244 * 279 *
@@ -274,6 +309,13 @@ void __init eukrea_mbimxsd35_baseboard_init(void)
274 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, 309 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
275 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); 310 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices));
276 311
312 gpio_request(GPIO_SPI1_IRQ, "SPI1_IRQ");
313 gpio_direction_input(GPIO_SPI1_IRQ);
314 gpio_free(GPIO_SPI1_IRQ);
315 imx35_add_spi_imx0(&eukrea_mbimxsd35_spi0_data);
316 spi_register_board_info(eukrea_mbimxsd35_spi_board_info,
317 ARRAY_SIZE(eukrea_mbimxsd35_spi_board_info));
318
277 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 319 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
278 gpio_led_register_device(-1, &eukrea_mbimxsd_led_info); 320 gpio_led_register_device(-1, &eukrea_mbimxsd_led_info);
279 imx_add_gpio_keys(&eukrea_mbimxsd_button_data); 321 imx_add_gpio_keys(&eukrea_mbimxsd_button_data);
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c
index aaa592fdb9ce..96a24b73dc23 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd51-baseboard.c
@@ -28,6 +28,8 @@
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/input.h> 29#include <linux/input.h>
30#include <linux/i2c.h> 30#include <linux/i2c.h>
31#include <video/platform_lcd.h>
32#include <linux/backlight.h>
31 33
32#include <asm/mach-types.h> 34#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
@@ -40,7 +42,7 @@
40 42
41#include "devices-imx51.h" 43#include "devices-imx51.h"
42 44
43static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = { 45static iomux_v3_cfg_t eukrea_mbimxsd51_pads[] = {
44 /* LED */ 46 /* LED */
45 MX51_PAD_NANDF_D10__GPIO3_30, 47 MX51_PAD_NANDF_D10__GPIO3_30,
46 /* SWITCH */ 48 /* SWITCH */
@@ -66,12 +68,64 @@ static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {
66 NEW_PAD_CTRL(MX51_PAD_GPIO1_0__SD1_CD, PAD_CTL_PUS_22K_UP | 68 NEW_PAD_CTRL(MX51_PAD_GPIO1_0__SD1_CD, PAD_CTL_PUS_22K_UP |
67 PAD_CTL_PKE | PAD_CTL_SRE_FAST | 69 PAD_CTL_PKE | PAD_CTL_SRE_FAST |
68 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS), 70 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
71 /* SSI */
72 MX51_PAD_AUD3_BB_TXD__AUD3_TXD,
73 MX51_PAD_AUD3_BB_RXD__AUD3_RXD,
74 MX51_PAD_AUD3_BB_CK__AUD3_TXC,
75 MX51_PAD_AUD3_BB_FS__AUD3_TXFS,
76 /* LCD Backlight */
77 MX51_PAD_DI1_D1_CS__GPIO3_4,
78 /* LCD RST */
79 MX51_PAD_CSI1_D9__GPIO3_13,
69}; 80};
70 81
71#define GPIO_LED1 IMX_GPIO_NR(3, 30) 82#define GPIO_LED1 IMX_GPIO_NR(3, 30)
72#define GPIO_SWITCH1 IMX_GPIO_NR(3, 31) 83#define GPIO_SWITCH1 IMX_GPIO_NR(3, 31)
84#define GPIO_LCDRST IMX_GPIO_NR(3, 13)
85#define GPIO_LCDBL IMX_GPIO_NR(3, 4)
73 86
74static const struct gpio_led eukrea_mbimxsd_leds[] __initconst = { 87static void eukrea_mbimxsd51_lcd_power_set(struct plat_lcd_data *pd,
88 unsigned int power)
89{
90 if (power)
91 gpio_direction_output(GPIO_LCDRST, 1);
92 else
93 gpio_direction_output(GPIO_LCDRST, 0);
94}
95
96static struct plat_lcd_data eukrea_mbimxsd51_lcd_power_data = {
97 .set_power = eukrea_mbimxsd51_lcd_power_set,
98};
99
100static struct platform_device eukrea_mbimxsd51_lcd_powerdev = {
101 .name = "platform-lcd",
102 .dev.platform_data = &eukrea_mbimxsd51_lcd_power_data,
103};
104
105static void eukrea_mbimxsd51_bl_set_intensity(int intensity)
106{
107 if (intensity)
108 gpio_direction_output(GPIO_LCDBL, 1);
109 else
110 gpio_direction_output(GPIO_LCDBL, 0);
111}
112
113static struct generic_bl_info eukrea_mbimxsd51_bl_info = {
114 .name = "eukrea_mbimxsd51-bl",
115 .max_intensity = 0xff,
116 .default_intensity = 0xff,
117 .set_bl_intensity = eukrea_mbimxsd51_bl_set_intensity,
118};
119
120static struct platform_device eukrea_mbimxsd51_bl_dev = {
121 .name = "generic-bl",
122 .id = 1,
123 .dev = {
124 .platform_data = &eukrea_mbimxsd51_bl_info,
125 },
126};
127
128static const struct gpio_led eukrea_mbimxsd51_leds[] __initconst = {
75 { 129 {
76 .name = "led1", 130 .name = "led1",
77 .default_trigger = "heartbeat", 131 .default_trigger = "heartbeat",
@@ -81,12 +135,12 @@ static const struct gpio_led eukrea_mbimxsd_leds[] __initconst = {
81}; 135};
82 136
83static const struct gpio_led_platform_data 137static const struct gpio_led_platform_data
84 eukrea_mbimxsd_led_info __initconst = { 138 eukrea_mbimxsd51_led_info __initconst = {
85 .leds = eukrea_mbimxsd_leds, 139 .leds = eukrea_mbimxsd51_leds,
86 .num_leds = ARRAY_SIZE(eukrea_mbimxsd_leds), 140 .num_leds = ARRAY_SIZE(eukrea_mbimxsd51_leds),
87}; 141};
88 142
89static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = { 143static struct gpio_keys_button eukrea_mbimxsd51_gpio_buttons[] = {
90 { 144 {
91 .gpio = GPIO_SWITCH1, 145 .gpio = GPIO_SWITCH1,
92 .code = BTN_0, 146 .code = BTN_0,
@@ -97,21 +151,39 @@ static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = {
97}; 151};
98 152
99static const struct gpio_keys_platform_data 153static const struct gpio_keys_platform_data
100 eukrea_mbimxsd_button_data __initconst = { 154 eukrea_mbimxsd51_button_data __initconst = {
101 .buttons = eukrea_mbimxsd_gpio_buttons, 155 .buttons = eukrea_mbimxsd51_gpio_buttons,
102 .nbuttons = ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons), 156 .nbuttons = ARRAY_SIZE(eukrea_mbimxsd51_gpio_buttons),
103}; 157};
104 158
105static const struct imxuart_platform_data uart_pdata __initconst = { 159static const struct imxuart_platform_data uart_pdata __initconst = {
106 .flags = IMXUART_HAVE_RTSCTS, 160 .flags = IMXUART_HAVE_RTSCTS,
107}; 161};
108 162
109static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = { 163static struct i2c_board_info eukrea_mbimxsd51_i2c_devices[] = {
110 { 164 {
111 I2C_BOARD_INFO("tlv320aic23", 0x1a), 165 I2C_BOARD_INFO("tlv320aic23", 0x1a),
112 }, 166 },
113}; 167};
114 168
169static const
170struct imx_ssi_platform_data eukrea_mbimxsd51_ssi_pdata __initconst = {
171 .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE,
172};
173
174static int screen_type;
175
176static int __init eukrea_mbimxsd51_screen_type(char *options)
177{
178 if (!strcmp(options, "dvi"))
179 screen_type = 1;
180 else if (!strcmp(options, "tft"))
181 screen_type = 0;
182
183 return 0;
184}
185__setup("screen_type=", eukrea_mbimxsd51_screen_type);
186
115/* 187/*
116 * system init for baseboard usage. Will be called by cpuimx51sd init. 188 * system init for baseboard usage. Will be called by cpuimx51sd init.
117 * 189 *
@@ -120,8 +192,8 @@ static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = {
120 */ 192 */
121void __init eukrea_mbimxsd51_baseboard_init(void) 193void __init eukrea_mbimxsd51_baseboard_init(void)
122{ 194{
123 if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads, 195 if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd51_pads,
124 ARRAY_SIZE(eukrea_mbimxsd_pads))) 196 ARRAY_SIZE(eukrea_mbimxsd51_pads)))
125 printk(KERN_ERR "error setting mbimxsd pads !\n"); 197 printk(KERN_ERR "error setting mbimxsd pads !\n");
126 198
127 imx51_add_imx_uart(1, NULL); 199 imx51_add_imx_uart(1, NULL);
@@ -129,6 +201,8 @@ void __init eukrea_mbimxsd51_baseboard_init(void)
129 201
130 imx51_add_sdhci_esdhc_imx(0, NULL); 202 imx51_add_sdhci_esdhc_imx(0, NULL);
131 203
204 imx51_add_imx_ssi(0, &eukrea_mbimxsd51_ssi_pdata);
205
132 gpio_request(GPIO_LED1, "LED1"); 206 gpio_request(GPIO_LED1, "LED1");
133 gpio_direction_output(GPIO_LED1, 1); 207 gpio_direction_output(GPIO_LED1, 1);
134 gpio_free(GPIO_LED1); 208 gpio_free(GPIO_LED1);
@@ -137,9 +211,21 @@ void __init eukrea_mbimxsd51_baseboard_init(void)
137 gpio_direction_input(GPIO_SWITCH1); 211 gpio_direction_input(GPIO_SWITCH1);
138 gpio_free(GPIO_SWITCH1); 212 gpio_free(GPIO_SWITCH1);
139 213
140 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, 214 gpio_request(GPIO_LCDRST, "LCDRST");
141 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); 215 gpio_direction_output(GPIO_LCDRST, 0);
142 216 gpio_request(GPIO_LCDBL, "LCDBL");
143 gpio_led_register_device(-1, &eukrea_mbimxsd_led_info); 217 gpio_direction_output(GPIO_LCDBL, 0);
144 imx_add_gpio_keys(&eukrea_mbimxsd_button_data); 218 if (!screen_type) {
219 platform_device_register(&eukrea_mbimxsd51_bl_dev);
220 platform_device_register(&eukrea_mbimxsd51_lcd_powerdev);
221 } else {
222 gpio_free(GPIO_LCDRST);
223 gpio_free(GPIO_LCDBL);
224 }
225
226 i2c_register_board_info(0, eukrea_mbimxsd51_i2c_devices,
227 ARRAY_SIZE(eukrea_mbimxsd51_i2c_devices));
228
229 gpio_led_register_device(-1, &eukrea_mbimxsd51_led_info);
230 imx_add_gpio_keys(&eukrea_mbimxsd51_button_data);
145} 231}
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
index 861ceb8232d6..ed38d03c61f2 100644
--- a/arch/arm/mach-imx/imx27-dt.c
+++ b/arch/arm/mach-imx/imx27-dt.c
@@ -35,7 +35,7 @@ static const struct of_dev_auxdata imx27_auxdata_lookup[] __initconst = {
35static int __init imx27_avic_add_irq_domain(struct device_node *np, 35static int __init imx27_avic_add_irq_domain(struct device_node *np,
36 struct device_node *interrupt_parent) 36 struct device_node *interrupt_parent)
37{ 37{
38 irq_domain_add_simple(np, 0); 38 irq_domain_add_legacy(np, 64, 0, 0, &irq_domain_simple_ops, NULL);
39 return 0; 39 return 0;
40} 40}
41 41
@@ -44,7 +44,9 @@ static int __init imx27_gpio_add_irq_domain(struct device_node *np,
44{ 44{
45 static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; 45 static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS;
46 46
47 irq_domain_add_simple(np, gpio_irq_base); 47 gpio_irq_base -= 32;
48 irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops,
49 NULL);
48 50
49 return 0; 51 return 0;
50} 52}
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c
index 5cca573964f0..5f577fbda2c8 100644
--- a/arch/arm/mach-imx/imx51-dt.c
+++ b/arch/arm/mach-imx/imx51-dt.c
@@ -14,6 +14,7 @@
14#include <linux/irqdomain.h> 14#include <linux/irqdomain.h>
15#include <linux/of_irq.h> 15#include <linux/of_irq.h>
16#include <linux/of_platform.h> 16#include <linux/of_platform.h>
17#include <linux/pinctrl/machine.h>
17#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
18#include <asm/mach/time.h> 19#include <asm/mach/time.h>
19#include <mach/common.h> 20#include <mach/common.h>
@@ -81,6 +82,8 @@ static void __init imx51_dt_init(void)
81 82
82 of_irq_init(imx51_irq_match); 83 of_irq_init(imx51_irq_match);
83 84
85 pinctrl_provide_dummies();
86
84 node = of_find_matching_node(NULL, imx51_iomuxc_of_match); 87 node = of_find_matching_node(NULL, imx51_iomuxc_of_match);
85 if (node) { 88 if (node) {
86 of_id = of_match_node(imx51_iomuxc_of_match, node); 89 of_id = of_match_node(imx51_iomuxc_of_match, node);
diff --git a/arch/arm/mach-imx/imx53-dt.c b/arch/arm/mach-imx/imx53-dt.c
index 4172279b3900..574eca4b89a5 100644
--- a/arch/arm/mach-imx/imx53-dt.c
+++ b/arch/arm/mach-imx/imx53-dt.c
@@ -15,6 +15,7 @@
15#include <linux/irqdomain.h> 15#include <linux/irqdomain.h>
16#include <linux/of_irq.h> 16#include <linux/of_irq.h>
17#include <linux/of_platform.h> 17#include <linux/of_platform.h>
18#include <linux/pinctrl/machine.h>
18#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
19#include <asm/mach/time.h> 20#include <asm/mach/time.h>
20#include <mach/common.h> 21#include <mach/common.h>
@@ -88,6 +89,8 @@ static void __init imx53_dt_init(void)
88 89
89 of_irq_init(imx53_irq_match); 90 of_irq_init(imx53_irq_match);
90 91
92 pinctrl_provide_dummies();
93
91 node = of_find_matching_node(NULL, imx53_iomuxc_of_match); 94 node = of_find_matching_node(NULL, imx53_iomuxc_of_match);
92 if (node) { 95 if (node) {
93 of_id = of_match_node(imx53_iomuxc_of_match, node); 96 of_id = of_match_node(imx53_iomuxc_of_match, node);
diff --git a/arch/arm/mach-imx/mach-cpuimx35.c b/arch/arm/mach-imx/mach-cpuimx35.c
index 8ecc872b2547..c515f8ede1a1 100644
--- a/arch/arm/mach-imx/mach-cpuimx35.c
+++ b/arch/arm/mach-imx/mach-cpuimx35.c
@@ -194,7 +194,7 @@ static void __init eukrea_cpuimx35_timer_init(void)
194 mx35_clocks_init(); 194 mx35_clocks_init();
195} 195}
196 196
197struct sys_timer eukrea_cpuimx35_timer = { 197static struct sys_timer eukrea_cpuimx35_timer = {
198 .init = eukrea_cpuimx35_timer_init, 198 .init = eukrea_cpuimx35_timer_init,
199}; 199};
200 200
diff --git a/arch/arm/mach-imx/mach-cpuimx51.c b/arch/arm/mach-imx/mach-cpuimx51.c
deleted file mode 100644
index 944025da8333..000000000000
--- a/arch/arm/mach-imx/mach-cpuimx51.c
+++ /dev/null
@@ -1,301 +0,0 @@
1/*
2 *
3 * Copyright (C) 2010 Eric Bénard <eric@eukrea.com>
4 *
5 * based on board-mx51_babbage.c which is
6 * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
7 * Copyright (C) 2009-2010 Amit Kucheria <amit.kucheria@canonical.com>
8 *
9 * The code contained herein is licensed under the GNU General Public
10 * License. You may obtain a copy of the GNU General Public License
11 * Version 2 or later at the following locations:
12 *
13 * http://www.opensource.org/licenses/gpl-license.html
14 * http://www.gnu.org/copyleft/gpl.html
15 */
16
17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/serial_8250.h>
20#include <linux/i2c.h>
21#include <linux/gpio.h>
22#include <linux/delay.h>
23#include <linux/io.h>
24#include <linux/interrupt.h>
25
26#include <mach/eukrea-baseboards.h>
27#include <mach/common.h>
28#include <mach/hardware.h>
29#include <mach/iomux-mx51.h>
30
31#include <asm/setup.h>
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <asm/mach/time.h>
35
36#include "devices-imx51.h"
37
38#define CPUIMX51_USBH1_STP IMX_GPIO_NR(1, 27)
39#define CPUIMX51_QUARTA_GPIO IMX_GPIO_NR(3, 28)
40#define CPUIMX51_QUARTB_GPIO IMX_GPIO_NR(3, 25)
41#define CPUIMX51_QUARTC_GPIO IMX_GPIO_NR(3, 26)
42#define CPUIMX51_QUARTD_GPIO IMX_GPIO_NR(3, 27)
43#define CPUIMX51_QUART_XTAL 14745600
44#define CPUIMX51_QUART_REGSHIFT 17
45
46/* USB_CTRL_1 */
47#define MX51_USB_CTRL_1_OFFSET 0x10
48#define MX51_USB_CTRL_UH1_EXT_CLK_EN (1 << 25)
49
50#define MX51_USB_PLLDIV_12_MHZ 0x00
51#define MX51_USB_PLL_DIV_19_2_MHZ 0x01
52#define MX51_USB_PLL_DIV_24_MHZ 0x02
53
54static struct plat_serial8250_port serial_platform_data[] = {
55 {
56 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x400000),
57 .irq = IMX_GPIO_TO_IRQ(CPUIMX51_QUARTA_GPIO),
58 .irqflags = IRQF_TRIGGER_HIGH,
59 .uartclk = CPUIMX51_QUART_XTAL,
60 .regshift = CPUIMX51_QUART_REGSHIFT,
61 .iotype = UPIO_MEM,
62 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
63 }, {
64 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x800000),
65 .irq = IMX_GPIO_TO_IRQ(CPUIMX51_QUARTB_GPIO),
66 .irqflags = IRQF_TRIGGER_HIGH,
67 .uartclk = CPUIMX51_QUART_XTAL,
68 .regshift = CPUIMX51_QUART_REGSHIFT,
69 .iotype = UPIO_MEM,
70 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
71 }, {
72 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x1000000),
73 .irq = IMX_GPIO_TO_IRQ(CPUIMX51_QUARTC_GPIO),
74 .irqflags = IRQF_TRIGGER_HIGH,
75 .uartclk = CPUIMX51_QUART_XTAL,
76 .regshift = CPUIMX51_QUART_REGSHIFT,
77 .iotype = UPIO_MEM,
78 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
79 }, {
80 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x2000000),
81 .irq = IMX_GPIO_TO_IRQ(CPUIMX51_QUARTD_GPIO),
82 .irqflags = IRQF_TRIGGER_HIGH,
83 .uartclk = CPUIMX51_QUART_XTAL,
84 .regshift = CPUIMX51_QUART_REGSHIFT,
85 .iotype = UPIO_MEM,
86 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
87 }, {
88 }
89};
90
91static struct platform_device serial_device = {
92 .name = "serial8250",
93 .id = 0,
94 .dev = {
95 .platform_data = serial_platform_data,
96 },
97};
98
99static struct platform_device *devices[] __initdata = {
100 &serial_device,
101};
102
103static iomux_v3_cfg_t eukrea_cpuimx51_pads[] = {
104 /* UART1 */
105 MX51_PAD_UART1_RXD__UART1_RXD,
106 MX51_PAD_UART1_TXD__UART1_TXD,
107 MX51_PAD_UART1_RTS__UART1_RTS,
108 MX51_PAD_UART1_CTS__UART1_CTS,
109
110 /* I2C2 */
111 MX51_PAD_GPIO1_2__I2C2_SCL,
112 MX51_PAD_GPIO1_3__I2C2_SDA,
113 MX51_PAD_NANDF_D10__GPIO3_30,
114
115 /* QUART IRQ */
116 MX51_PAD_NANDF_D15__GPIO3_25,
117 MX51_PAD_NANDF_D14__GPIO3_26,
118 MX51_PAD_NANDF_D13__GPIO3_27,
119 MX51_PAD_NANDF_D12__GPIO3_28,
120
121 /* USB HOST1 */
122 MX51_PAD_USBH1_CLK__USBH1_CLK,
123 MX51_PAD_USBH1_DIR__USBH1_DIR,
124 MX51_PAD_USBH1_NXT__USBH1_NXT,
125 MX51_PAD_USBH1_DATA0__USBH1_DATA0,
126 MX51_PAD_USBH1_DATA1__USBH1_DATA1,
127 MX51_PAD_USBH1_DATA2__USBH1_DATA2,
128 MX51_PAD_USBH1_DATA3__USBH1_DATA3,
129 MX51_PAD_USBH1_DATA4__USBH1_DATA4,
130 MX51_PAD_USBH1_DATA5__USBH1_DATA5,
131 MX51_PAD_USBH1_DATA6__USBH1_DATA6,
132 MX51_PAD_USBH1_DATA7__USBH1_DATA7,
133 MX51_PAD_USBH1_STP__USBH1_STP,
134};
135
136static const struct mxc_nand_platform_data
137 eukrea_cpuimx51_nand_board_info __initconst = {
138 .width = 1,
139 .hw_ecc = 1,
140 .flash_bbt = 1,
141};
142
143static const struct imxuart_platform_data uart_pdata __initconst = {
144 .flags = IMXUART_HAVE_RTSCTS,
145};
146
147static const
148struct imxi2c_platform_data eukrea_cpuimx51_i2c_data __initconst = {
149 .bitrate = 100000,
150};
151
152static struct i2c_board_info eukrea_cpuimx51_i2c_devices[] = {
153 {
154 I2C_BOARD_INFO("pcf8563", 0x51),
155 },
156};
157
158/* This function is board specific as the bit mask for the plldiv will also
159be different for other Freescale SoCs, thus a common bitmask is not
160possible and cannot get place in /plat-mxc/ehci.c.*/
161static int initialize_otg_port(struct platform_device *pdev)
162{
163 u32 v;
164 void __iomem *usb_base;
165 void __iomem *usbother_base;
166
167 usb_base = ioremap(MX51_USB_OTG_BASE_ADDR, SZ_4K);
168 if (!usb_base)
169 return -ENOMEM;
170 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
171
172 /* Set the PHY clock to 19.2MHz */
173 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
174 v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK;
175 v |= MX51_USB_PLL_DIV_19_2_MHZ;
176 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
177 iounmap(usb_base);
178
179 mdelay(10);
180
181 return mx51_initialize_usb_hw(0, MXC_EHCI_INTERNAL_PHY);
182}
183
184static int initialize_usbh1_port(struct platform_device *pdev)
185{
186 u32 v;
187 void __iomem *usb_base;
188 void __iomem *usbother_base;
189
190 usb_base = ioremap(MX51_USB_OTG_BASE_ADDR, SZ_4K);
191 if (!usb_base)
192 return -ENOMEM;
193 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
194
195 /* The clock for the USBH1 ULPI port will come externally from the PHY. */
196 v = __raw_readl(usbother_base + MX51_USB_CTRL_1_OFFSET);
197 __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN, usbother_base + MX51_USB_CTRL_1_OFFSET);
198 iounmap(usb_base);
199
200 mdelay(10);
201
202 return mx51_initialize_usb_hw(1, MXC_EHCI_POWER_PINS_ENABLED |
203 MXC_EHCI_ITC_NO_THRESHOLD);
204}
205
206static const struct mxc_usbh_platform_data dr_utmi_config __initconst = {
207 .init = initialize_otg_port,
208 .portsc = MXC_EHCI_UTMI_16BIT,
209};
210
211static const struct fsl_usb2_platform_data usb_pdata __initconst = {
212 .operating_mode = FSL_USB2_DR_DEVICE,
213 .phy_mode = FSL_USB2_PHY_UTMI_WIDE,
214};
215
216static const struct mxc_usbh_platform_data usbh1_config __initconst = {
217 .init = initialize_usbh1_port,
218 .portsc = MXC_EHCI_MODE_ULPI,
219};
220
221static int otg_mode_host;
222
223static int __init eukrea_cpuimx51_otg_mode(char *options)
224{
225 if (!strcmp(options, "host"))
226 otg_mode_host = 1;
227 else if (!strcmp(options, "device"))
228 otg_mode_host = 0;
229 else
230 pr_info("otg_mode neither \"host\" nor \"device\". "
231 "Defaulting to device\n");
232 return 0;
233}
234__setup("otg_mode=", eukrea_cpuimx51_otg_mode);
235
236/*
237 * Board specific initialization.
238 */
239static void __init eukrea_cpuimx51_init(void)
240{
241 imx51_soc_init();
242
243 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51_pads,
244 ARRAY_SIZE(eukrea_cpuimx51_pads));
245
246 imx51_add_imx_uart(0, &uart_pdata);
247 imx51_add_mxc_nand(&eukrea_cpuimx51_nand_board_info);
248
249 gpio_request(CPUIMX51_QUARTA_GPIO, "quarta_irq");
250 gpio_direction_input(CPUIMX51_QUARTA_GPIO);
251 gpio_free(CPUIMX51_QUARTA_GPIO);
252 gpio_request(CPUIMX51_QUARTB_GPIO, "quartb_irq");
253 gpio_direction_input(CPUIMX51_QUARTB_GPIO);
254 gpio_free(CPUIMX51_QUARTB_GPIO);
255 gpio_request(CPUIMX51_QUARTC_GPIO, "quartc_irq");
256 gpio_direction_input(CPUIMX51_QUARTC_GPIO);
257 gpio_free(CPUIMX51_QUARTC_GPIO);
258 gpio_request(CPUIMX51_QUARTD_GPIO, "quartd_irq");
259 gpio_direction_input(CPUIMX51_QUARTD_GPIO);
260 gpio_free(CPUIMX51_QUARTD_GPIO);
261
262 imx51_add_fec(NULL);
263 platform_add_devices(devices, ARRAY_SIZE(devices));
264
265 imx51_add_imx_i2c(1, &eukrea_cpuimx51_i2c_data);
266 i2c_register_board_info(1, eukrea_cpuimx51_i2c_devices,
267 ARRAY_SIZE(eukrea_cpuimx51_i2c_devices));
268
269 if (otg_mode_host)
270 imx51_add_mxc_ehci_otg(&dr_utmi_config);
271 else {
272 initialize_otg_port(NULL);
273 imx51_add_fsl_usb2_udc(&usb_pdata);
274 }
275 imx51_add_mxc_ehci_hs(1, &usbh1_config);
276
277#ifdef CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD
278 eukrea_mbimx51_baseboard_init();
279#endif
280}
281
282static void __init eukrea_cpuimx51_timer_init(void)
283{
284 mx51_clocks_init(32768, 24000000, 22579200, 0);
285}
286
287static struct sys_timer mxc_timer = {
288 .init = eukrea_cpuimx51_timer_init,
289};
290
291MACHINE_START(EUKREA_CPUIMX51, "Eukrea CPUIMX51 Module")
292 /* Maintainer: Eric Bénard <eric@eukrea.com> */
293 .atag_offset = 0x100,
294 .map_io = mx51_map_io,
295 .init_early = imx51_init_early,
296 .init_irq = mx51_init_irq,
297 .handle_irq = imx51_handle_irq,
298 .timer = &mxc_timer,
299 .init_machine = eukrea_cpuimx51_init,
300 .restart = mxc_restart,
301MACHINE_END
diff --git a/arch/arm/mach-imx/mach-cpuimx51sd.c b/arch/arm/mach-imx/mach-cpuimx51sd.c
index 9fbe923c8b08..ce341a6874fc 100644
--- a/arch/arm/mach-imx/mach-cpuimx51sd.c
+++ b/arch/arm/mach-imx/mach-cpuimx51sd.c
@@ -41,11 +41,13 @@
41 41
42#define USBH1_RST IMX_GPIO_NR(2, 28) 42#define USBH1_RST IMX_GPIO_NR(2, 28)
43#define ETH_RST IMX_GPIO_NR(2, 31) 43#define ETH_RST IMX_GPIO_NR(2, 31)
44#define TSC2007_IRQGPIO IMX_GPIO_NR(3, 12) 44#define TSC2007_IRQGPIO_REV2 IMX_GPIO_NR(3, 12)
45#define TSC2007_IRQGPIO_REV3 IMX_GPIO_NR(4, 0)
45#define CAN_IRQGPIO IMX_GPIO_NR(1, 1) 46#define CAN_IRQGPIO IMX_GPIO_NR(1, 1)
46#define CAN_RST IMX_GPIO_NR(4, 15) 47#define CAN_RST IMX_GPIO_NR(4, 15)
47#define CAN_NCS IMX_GPIO_NR(4, 24) 48#define CAN_NCS IMX_GPIO_NR(4, 24)
48#define CAN_RXOBF IMX_GPIO_NR(1, 4) 49#define CAN_RXOBF_REV2 IMX_GPIO_NR(1, 4)
50#define CAN_RXOBF_REV3 IMX_GPIO_NR(3, 12)
49#define CAN_RX1BF IMX_GPIO_NR(1, 6) 51#define CAN_RX1BF IMX_GPIO_NR(1, 6)
50#define CAN_TXORTS IMX_GPIO_NR(1, 7) 52#define CAN_TXORTS IMX_GPIO_NR(1, 7)
51#define CAN_TX1RTS IMX_GPIO_NR(1, 8) 53#define CAN_TX1RTS IMX_GPIO_NR(1, 8)
@@ -90,6 +92,10 @@ static iomux_v3_cfg_t eukrea_cpuimx51sd_pads[] = {
90 MX51_PAD_I2C1_CLK__GPIO4_16, 92 MX51_PAD_I2C1_CLK__GPIO4_16,
91 MX51_PAD_I2C1_DAT__GPIO4_17, 93 MX51_PAD_I2C1_DAT__GPIO4_17,
92 94
95 /* I2C1 */
96 MX51_PAD_SD2_CMD__I2C1_SCL,
97 MX51_PAD_SD2_CLK__I2C1_SDA,
98
93 /* CAN */ 99 /* CAN */
94 MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI, 100 MX51_PAD_CSPI1_MOSI__ECSPI1_MOSI,
95 MX51_PAD_CSPI1_MISO__ECSPI1_MISO, 101 MX51_PAD_CSPI1_MISO__ECSPI1_MISO,
@@ -108,15 +114,27 @@ static iomux_v3_cfg_t eukrea_cpuimx51sd_pads[] = {
108 NEW_PAD_CTRL(MX51_PAD_GPIO_NAND__GPIO_NAND, PAD_CTL_PUS_22K_UP | 114 NEW_PAD_CTRL(MX51_PAD_GPIO_NAND__GPIO_NAND, PAD_CTL_PUS_22K_UP |
109 PAD_CTL_PKE | PAD_CTL_SRE_FAST | 115 PAD_CTL_PKE | PAD_CTL_SRE_FAST |
110 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS), 116 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
117 NEW_PAD_CTRL(MX51_PAD_NANDF_D8__GPIO4_0, PAD_CTL_PUS_22K_UP |
118 PAD_CTL_PKE | PAD_CTL_SRE_FAST |
119 PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
111}; 120};
112 121
113static const struct imxuart_platform_data uart_pdata __initconst = { 122static const struct imxuart_platform_data uart_pdata __initconst = {
114 .flags = IMXUART_HAVE_RTSCTS, 123 .flags = IMXUART_HAVE_RTSCTS,
115}; 124};
116 125
126static int tsc2007_get_pendown_state(void)
127{
128 if (mx51_revision() < IMX_CHIP_REVISION_3_0)
129 return !gpio_get_value(TSC2007_IRQGPIO_REV2);
130 else
131 return !gpio_get_value(TSC2007_IRQGPIO_REV3);
132}
133
117static struct tsc2007_platform_data tsc2007_info = { 134static struct tsc2007_platform_data tsc2007_info = {
118 .model = 2007, 135 .model = 2007,
119 .x_plate_ohms = 180, 136 .x_plate_ohms = 180,
137 .get_pendown_state = tsc2007_get_pendown_state,
120}; 138};
121 139
122static struct i2c_board_info eukrea_cpuimx51sd_i2c_devices[] = { 140static struct i2c_board_info eukrea_cpuimx51sd_i2c_devices[] = {
@@ -126,7 +144,6 @@ static struct i2c_board_info eukrea_cpuimx51sd_i2c_devices[] = {
126 I2C_BOARD_INFO("tsc2007", 0x49), 144 I2C_BOARD_INFO("tsc2007", 0x49),
127 .type = "tsc2007", 145 .type = "tsc2007",
128 .platform_data = &tsc2007_info, 146 .platform_data = &tsc2007_info,
129 .irq = IMX_GPIO_TO_IRQ(TSC2007_IRQGPIO),
130 }, 147 },
131}; 148};
132 149
@@ -255,10 +272,14 @@ static const struct spi_imx_master cpuimx51sd_ecspi1_pdata __initconst = {
255 .num_chipselect = ARRAY_SIZE(cpuimx51sd_spi1_cs), 272 .num_chipselect = ARRAY_SIZE(cpuimx51sd_spi1_cs),
256}; 273};
257 274
258static struct platform_device *platform_devices[] __initdata = { 275static struct platform_device *rev2_platform_devices[] __initdata = {
259 &hsi2c_gpio_device, 276 &hsi2c_gpio_device,
260}; 277};
261 278
279static const struct imxi2c_platform_data cpuimx51sd_i2c_data __initconst = {
280 .bitrate = 100000,
281};
282
262static void __init eukrea_cpuimx51sd_init(void) 283static void __init eukrea_cpuimx51sd_init(void)
263{ 284{
264 imx51_soc_init(); 285 imx51_soc_init();
@@ -272,6 +293,7 @@ static void __init eukrea_cpuimx51sd_init(void)
272 293
273 imx51_add_imx_uart(0, &uart_pdata); 294 imx51_add_imx_uart(0, &uart_pdata);
274 imx51_add_mxc_nand(&eukrea_cpuimx51sd_nand_board_info); 295 imx51_add_mxc_nand(&eukrea_cpuimx51sd_nand_board_info);
296 imx51_add_imx2_wdt(0, NULL);
275 297
276 gpio_request(ETH_RST, "eth_rst"); 298 gpio_request(ETH_RST, "eth_rst");
277 gpio_set_value(ETH_RST, 1); 299 gpio_set_value(ETH_RST, 1);
@@ -291,13 +313,25 @@ static void __init eukrea_cpuimx51sd_init(void)
291 spi_register_board_info(cpuimx51sd_spi_device, 313 spi_register_board_info(cpuimx51sd_spi_device,
292 ARRAY_SIZE(cpuimx51sd_spi_device)); 314 ARRAY_SIZE(cpuimx51sd_spi_device));
293 315
294 gpio_request(TSC2007_IRQGPIO, "tsc2007_irq"); 316 if (mx51_revision() < IMX_CHIP_REVISION_3_0) {
295 gpio_direction_input(TSC2007_IRQGPIO); 317 eukrea_cpuimx51sd_i2c_devices[1].irq =
296 gpio_free(TSC2007_IRQGPIO); 318 gpio_to_irq(TSC2007_IRQGPIO_REV2),
319 platform_add_devices(rev2_platform_devices,
320 ARRAY_SIZE(rev2_platform_devices));
321 gpio_request(TSC2007_IRQGPIO_REV2, "tsc2007_irq");
322 gpio_direction_input(TSC2007_IRQGPIO_REV2);
323 gpio_free(TSC2007_IRQGPIO_REV2);
324 } else {
325 eukrea_cpuimx51sd_i2c_devices[1].irq =
326 gpio_to_irq(TSC2007_IRQGPIO_REV3),
327 imx51_add_imx_i2c(0, &cpuimx51sd_i2c_data);
328 gpio_request(TSC2007_IRQGPIO_REV3, "tsc2007_irq");
329 gpio_direction_input(TSC2007_IRQGPIO_REV3);
330 gpio_free(TSC2007_IRQGPIO_REV3);
331 }
297 332
298 i2c_register_board_info(0, eukrea_cpuimx51sd_i2c_devices, 333 i2c_register_board_info(0, eukrea_cpuimx51sd_i2c_devices,
299 ARRAY_SIZE(eukrea_cpuimx51sd_i2c_devices)); 334 ARRAY_SIZE(eukrea_cpuimx51sd_i2c_devices));
300 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
301 335
302 if (otg_mode_host) 336 if (otg_mode_host)
303 imx51_add_mxc_ehci_otg(&dr_utmi_config); 337 imx51_add_mxc_ehci_otg(&dr_utmi_config);
diff --git a/arch/arm/mach-imx/mach-eukrea_cpuimx25.c b/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
index 76a97a598b9e..d1e04e676e33 100644
--- a/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
+++ b/arch/arm/mach-imx/mach-eukrea_cpuimx25.c
@@ -106,6 +106,7 @@ static const struct mxc_usbh_platform_data usbh2_pdata __initconst = {
106static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { 106static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
107 .operating_mode = FSL_USB2_DR_DEVICE, 107 .operating_mode = FSL_USB2_DR_DEVICE,
108 .phy_mode = FSL_USB2_PHY_UTMI, 108 .phy_mode = FSL_USB2_PHY_UTMI,
109 .workaround = FLS_USB2_WORKAROUND_ENGCM09152,
109}; 110};
110 111
111static int otg_mode_host; 112static int otg_mode_host;
@@ -135,6 +136,7 @@ static void __init eukrea_cpuimx25_init(void)
135 imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info); 136 imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info);
136 imx25_add_imxdi_rtc(NULL); 137 imx25_add_imxdi_rtc(NULL);
137 imx25_add_fec(&mx25_fec_pdata); 138 imx25_add_fec(&mx25_fec_pdata);
139 imx25_add_imx2_wdt(NULL);
138 140
139 i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices, 141 i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices,
140 ARRAY_SIZE(eukrea_cpuimx25_i2c_devices)); 142 ARRAY_SIZE(eukrea_cpuimx25_i2c_devices));
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
index f7b074f496f0..748ba2e311b5 100644
--- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
+++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
@@ -38,6 +38,7 @@
38#include <asm/mach-types.h> 38#include <asm/mach-types.h>
39#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
40#include <asm/mach/time.h> 40#include <asm/mach/time.h>
41#include <asm/system.h>
41#include <mach/common.h> 42#include <mach/common.h>
42#include <mach/iomux-mx27.h> 43#include <mach/iomux-mx27.h>
43 44
@@ -48,6 +49,14 @@
48#define OTG_PHY_CS_GPIO (GPIO_PORTF + 17) 49#define OTG_PHY_CS_GPIO (GPIO_PORTF + 17)
49#define SDHC1_IRQ IRQ_GPIOB(25) 50#define SDHC1_IRQ IRQ_GPIOB(25)
50 51
52#define MOTHERBOARD_BIT2 (GPIO_PORTD + 31)
53#define MOTHERBOARD_BIT1 (GPIO_PORTD + 30)
54#define MOTHERBOARD_BIT0 (GPIO_PORTD + 29)
55
56#define EXPBOARD_BIT2 (GPIO_PORTD + 25)
57#define EXPBOARD_BIT1 (GPIO_PORTD + 27)
58#define EXPBOARD_BIT0 (GPIO_PORTD + 28)
59
51static const int visstrim_m10_pins[] __initconst = { 60static const int visstrim_m10_pins[] __initconst = {
52 /* UART1 (console) */ 61 /* UART1 (console) */
53 PE12_PF_UART1_TXD, 62 PE12_PF_UART1_TXD,
@@ -119,6 +128,23 @@ static const int visstrim_m10_pins[] __initconst = {
119 PB19_PF_CSI_D7, 128 PB19_PF_CSI_D7,
120 PB20_PF_CSI_VSYNC, 129 PB20_PF_CSI_VSYNC,
121 PB21_PF_CSI_HSYNC, 130 PB21_PF_CSI_HSYNC,
131 /* mother board version */
132 MOTHERBOARD_BIT2 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
133 MOTHERBOARD_BIT1 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
134 MOTHERBOARD_BIT0 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
135 /* expansion board version */
136 EXPBOARD_BIT2 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
137 EXPBOARD_BIT1 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
138 EXPBOARD_BIT0 | GPIO_GPIO | GPIO_IN | GPIO_PUEN,
139};
140
141static struct gpio visstrim_m10_version_gpios[] = {
142 { EXPBOARD_BIT0, GPIOF_IN, "exp-version-0" },
143 { EXPBOARD_BIT1, GPIOF_IN, "exp-version-1" },
144 { EXPBOARD_BIT2, GPIOF_IN, "exp-version-2" },
145 { MOTHERBOARD_BIT0, GPIOF_IN, "mother-version-0" },
146 { MOTHERBOARD_BIT1, GPIOF_IN, "mother-version-1" },
147 { MOTHERBOARD_BIT2, GPIOF_IN, "mother-version-2" },
122}; 148};
123 149
124/* Camera */ 150/* Camera */
@@ -369,11 +395,40 @@ static const struct imx_ssi_platform_data visstrim_m10_ssi_pdata __initconst = {
369 .flags = IMX_SSI_DMA | IMX_SSI_SYN, 395 .flags = IMX_SSI_DMA | IMX_SSI_SYN,
370}; 396};
371 397
398static void __init visstrim_m10_revision(void)
399{
400 int exp_version = 0;
401 int mo_version = 0;
402 int ret;
403
404 ret = gpio_request_array(visstrim_m10_version_gpios,
405 ARRAY_SIZE(visstrim_m10_version_gpios));
406 if (ret) {
407 pr_err("Failed to request version gpios");
408 return;
409 }
410
411 /* Get expansion board version (negative logic) */
412 exp_version |= !gpio_get_value(EXPBOARD_BIT2) << 2;
413 exp_version |= !gpio_get_value(EXPBOARD_BIT1) << 1;
414 exp_version |= !gpio_get_value(EXPBOARD_BIT0);
415
416 /* Get mother board version (negative logic) */
417 mo_version |= !gpio_get_value(MOTHERBOARD_BIT2) << 2;
418 mo_version |= !gpio_get_value(MOTHERBOARD_BIT1) << 1;
419 mo_version |= !gpio_get_value(MOTHERBOARD_BIT0);
420
421 system_rev = 0x27000;
422 system_rev |= (mo_version << 4);
423 system_rev |= exp_version;
424}
425
372static void __init visstrim_m10_board_init(void) 426static void __init visstrim_m10_board_init(void)
373{ 427{
374 int ret; 428 int ret;
375 429
376 imx27_soc_init(); 430 imx27_soc_init();
431 visstrim_m10_revision();
377 432
378 ret = mxc_gpio_setup_multiple_pins(visstrim_m10_pins, 433 ret = mxc_gpio_setup_multiple_pins(visstrim_m10_pins,
379 ARRAY_SIZE(visstrim_m10_pins), "VISSTRIM_M10"); 434 ARRAY_SIZE(visstrim_m10_pins), "VISSTRIM_M10");
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index da6c1d9af768..3df360a52c17 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -19,6 +19,7 @@
19#include <linux/of_address.h> 19#include <linux/of_address.h>
20#include <linux/of_irq.h> 20#include <linux/of_irq.h>
21#include <linux/of_platform.h> 21#include <linux/of_platform.h>
22#include <linux/pinctrl/machine.h>
22#include <linux/phy.h> 23#include <linux/phy.h>
23#include <linux/micrel_phy.h> 24#include <linux/micrel_phy.h>
24#include <asm/smp_twd.h> 25#include <asm/smp_twd.h>
@@ -77,6 +78,12 @@ static int ksz9021rn_phy_fixup(struct phy_device *phydev)
77 78
78static void __init imx6q_init_machine(void) 79static void __init imx6q_init_machine(void)
79{ 80{
81 /*
82 * This should be removed when all imx6q boards have pinctrl
83 * states for devices defined in device tree.
84 */
85 pinctrl_provide_dummies();
86
80 if (of_machine_is_compatible("fsl,imx6q-sabrelite")) 87 if (of_machine_is_compatible("fsl,imx6q-sabrelite"))
81 phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK, 88 phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK,
82 ksz9021rn_phy_fixup); 89 ksz9021rn_phy_fixup);
diff --git a/arch/arm/mach-imx/mach-mx1ads.c b/arch/arm/mach-imx/mach-mx1ads.c
index 97046088ff1a..7274e7928136 100644
--- a/arch/arm/mach-imx/mach-mx1ads.c
+++ b/arch/arm/mach-imx/mach-mx1ads.c
@@ -134,7 +134,7 @@ static void __init mx1ads_timer_init(void)
134 mx1_clocks_init(32000); 134 mx1_clocks_init(32000);
135} 135}
136 136
137struct sys_timer mx1ads_timer = { 137static struct sys_timer mx1ads_timer = {
138 .init = mx1ads_timer_init, 138 .init = mx1ads_timer_init,
139}; 139};
140 140
diff --git a/arch/arm/mach-imx/mach-mx21ads.c b/arch/arm/mach-imx/mach-mx21ads.c
index e432d4acee1f..d14bbe949a4f 100644
--- a/arch/arm/mach-imx/mach-mx21ads.c
+++ b/arch/arm/mach-imx/mach-mx21ads.c
@@ -304,8 +304,7 @@ static void __init mx21ads_board_init(void)
304 imx21_add_mxc_nand(&mx21ads_nand_board_info); 304 imx21_add_mxc_nand(&mx21ads_nand_board_info);
305 305
306 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 306 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
307 platform_device_register_full( 307 platform_device_register_full(&mx21ads_cs8900_devinfo);
308 (struct platform_device_info *)&mx21ads_cs8900_devinfo);
309} 308}
310 309
311static void __init mx21ads_timer_init(void) 310static void __init mx21ads_timer_init(void)
diff --git a/arch/arm/mach-imx/mach-mx31lite.c b/arch/arm/mach-imx/mach-mx31lite.c
index 0abef5f13df5..686c60587980 100644
--- a/arch/arm/mach-imx/mach-mx31lite.c
+++ b/arch/arm/mach-imx/mach-mx31lite.c
@@ -283,7 +283,7 @@ static void __init mx31lite_timer_init(void)
283 mx31_clocks_init(26000000); 283 mx31_clocks_init(26000000);
284} 284}
285 285
286struct sys_timer mx31lite_timer = { 286static struct sys_timer mx31lite_timer = {
287 .init = mx31lite_timer_init, 287 .init = mx31lite_timer_init,
288}; 288};
289 289
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index f17a15f28316..1dfe3c7a7be1 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -580,7 +580,7 @@ static void __init mx31moboard_timer_init(void)
580 mx31_clocks_init(26000000); 580 mx31_clocks_init(26000000);
581} 581}
582 582
583struct sys_timer mx31moboard_timer = { 583static struct sys_timer mx31moboard_timer = {
584 .init = mx31moboard_timer_init, 584 .init = mx31moboard_timer_init,
585}; 585};
586 586
diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c
index 6ae51c6b95b7..86284bba46d3 100644
--- a/arch/arm/mach-imx/mach-mx35_3ds.c
+++ b/arch/arm/mach-imx/mach-mx35_3ds.c
@@ -34,6 +34,8 @@
34#include <linux/usb/otg.h> 34#include <linux/usb/otg.h>
35 35
36#include <linux/mtd/physmap.h> 36#include <linux/mtd/physmap.h>
37#include <linux/mfd/mc13892.h>
38#include <linux/regulator/machine.h>
37 39
38#include <asm/mach-types.h> 40#include <asm/mach-types.h>
39#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
@@ -253,6 +255,8 @@ static iomux_v3_cfg_t mx35pdk_pads[] = {
253 MX35_PAD_CSI_MCLK__IPU_CSI_MCLK, 255 MX35_PAD_CSI_MCLK__IPU_CSI_MCLK,
254 MX35_PAD_CSI_PIXCLK__IPU_CSI_PIXCLK, 256 MX35_PAD_CSI_PIXCLK__IPU_CSI_PIXCLK,
255 MX35_PAD_CSI_VSYNC__IPU_CSI_VSYNC, 257 MX35_PAD_CSI_VSYNC__IPU_CSI_VSYNC,
258 /*PMIC IRQ*/
259 MX35_PAD_GPIO2_0__GPIO2_0,
256}; 260};
257 261
258/* 262/*
@@ -317,6 +321,193 @@ static struct platform_device mx35_3ds_ov2640 = {
317 }, 321 },
318}; 322};
319 323
324static struct regulator_consumer_supply sw1_consumers[] = {
325 {
326 .supply = "cpu_vcc",
327 }
328};
329
330static struct regulator_consumer_supply vcam_consumers[] = {
331 /* sgtl5000 */
332 REGULATOR_SUPPLY("VDDA", "0-000a"),
333};
334
335static struct regulator_consumer_supply vaudio_consumers[] = {
336 REGULATOR_SUPPLY("cmos_vio", "soc-camera-pdrv.0"),
337};
338
339static struct regulator_init_data sw1_init = {
340 .constraints = {
341 .name = "SW1",
342 .min_uV = 600000,
343 .max_uV = 1375000,
344 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
345 .valid_modes_mask = 0,
346 .always_on = 1,
347 .boot_on = 1,
348 },
349 .num_consumer_supplies = ARRAY_SIZE(sw1_consumers),
350 .consumer_supplies = sw1_consumers,
351};
352
353static struct regulator_init_data sw2_init = {
354 .constraints = {
355 .name = "SW2",
356 .always_on = 1,
357 .boot_on = 1,
358 }
359};
360
361static struct regulator_init_data sw3_init = {
362 .constraints = {
363 .name = "SW3",
364 .always_on = 1,
365 .boot_on = 1,
366 }
367};
368
369static struct regulator_init_data sw4_init = {
370 .constraints = {
371 .name = "SW4",
372 .always_on = 1,
373 .boot_on = 1,
374 }
375};
376
377static struct regulator_init_data viohi_init = {
378 .constraints = {
379 .name = "VIOHI",
380 .boot_on = 1,
381 }
382};
383
384static struct regulator_init_data vusb_init = {
385 .constraints = {
386 .name = "VUSB",
387 .boot_on = 1,
388 }
389};
390
391static struct regulator_init_data vdig_init = {
392 .constraints = {
393 .name = "VDIG",
394 .boot_on = 1,
395 }
396};
397
398static struct regulator_init_data vpll_init = {
399 .constraints = {
400 .name = "VPLL",
401 .boot_on = 1,
402 }
403};
404
405static struct regulator_init_data vusb2_init = {
406 .constraints = {
407 .name = "VUSB2",
408 .boot_on = 1,
409 }
410};
411
412static struct regulator_init_data vvideo_init = {
413 .constraints = {
414 .name = "VVIDEO",
415 .boot_on = 1
416 }
417};
418
419static struct regulator_init_data vaudio_init = {
420 .constraints = {
421 .name = "VAUDIO",
422 .min_uV = 2300000,
423 .max_uV = 3000000,
424 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
425 .boot_on = 1
426 },
427 .num_consumer_supplies = ARRAY_SIZE(vaudio_consumers),
428 .consumer_supplies = vaudio_consumers,
429};
430
431static struct regulator_init_data vcam_init = {
432 .constraints = {
433 .name = "VCAM",
434 .min_uV = 2500000,
435 .max_uV = 3000000,
436 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
437 REGULATOR_CHANGE_MODE,
438 .valid_modes_mask = REGULATOR_MODE_FAST | REGULATOR_MODE_NORMAL,
439 .boot_on = 1
440 },
441 .num_consumer_supplies = ARRAY_SIZE(vcam_consumers),
442 .consumer_supplies = vcam_consumers,
443};
444
445static struct regulator_init_data vgen1_init = {
446 .constraints = {
447 .name = "VGEN1",
448 }
449};
450
451static struct regulator_init_data vgen2_init = {
452 .constraints = {
453 .name = "VGEN2",
454 .boot_on = 1,
455 }
456};
457
458static struct regulator_init_data vgen3_init = {
459 .constraints = {
460 .name = "VGEN3",
461 }
462};
463
464static struct mc13xxx_regulator_init_data mx35_3ds_regulators[] = {
465 { .id = MC13892_SW1, .init_data = &sw1_init },
466 { .id = MC13892_SW2, .init_data = &sw2_init },
467 { .id = MC13892_SW3, .init_data = &sw3_init },
468 { .id = MC13892_SW4, .init_data = &sw4_init },
469 { .id = MC13892_VIOHI, .init_data = &viohi_init },
470 { .id = MC13892_VPLL, .init_data = &vpll_init },
471 { .id = MC13892_VDIG, .init_data = &vdig_init },
472 { .id = MC13892_VUSB2, .init_data = &vusb2_init },
473 { .id = MC13892_VVIDEO, .init_data = &vvideo_init },
474 { .id = MC13892_VAUDIO, .init_data = &vaudio_init },
475 { .id = MC13892_VCAM, .init_data = &vcam_init },
476 { .id = MC13892_VGEN1, .init_data = &vgen1_init },
477 { .id = MC13892_VGEN2, .init_data = &vgen2_init },
478 { .id = MC13892_VGEN3, .init_data = &vgen3_init },
479 { .id = MC13892_VUSB, .init_data = &vusb_init },
480};
481
482static struct mc13xxx_platform_data mx35_3ds_mc13892_data = {
483 .flags = MC13XXX_USE_RTC | MC13XXX_USE_TOUCHSCREEN,
484 .regulators = {
485 .num_regulators = ARRAY_SIZE(mx35_3ds_regulators),
486 .regulators = mx35_3ds_regulators,
487 },
488};
489
490#define GPIO_PMIC_INT IMX_GPIO_NR(2, 0)
491
492static struct i2c_board_info mx35_3ds_i2c_mc13892 = {
493
494 I2C_BOARD_INFO("mc13892", 0x08),
495 .platform_data = &mx35_3ds_mc13892_data,
496 .irq = IMX_GPIO_TO_IRQ(GPIO_PMIC_INT),
497};
498
499static void __init imx35_3ds_init_mc13892(void)
500{
501 int ret = gpio_request_one(GPIO_PMIC_INT, GPIOF_DIR_IN, "pmic irq");
502
503 if (ret) {
504 pr_err("failed to get pmic irq: %d\n", ret);
505 return;
506 }
507
508 i2c_register_board_info(0, &mx35_3ds_i2c_mc13892, 1);
509}
510
320static int mx35_3ds_otg_init(struct platform_device *pdev) 511static int mx35_3ds_otg_init(struct platform_device *pdev)
321{ 512{
322 return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY); 513 return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERNAL_PHY);
@@ -412,6 +603,8 @@ static void __init mx35_3ds_init(void)
412 imx35_fb_pdev = imx35_add_mx3_sdc_fb(&mx3fb_pdata); 603 imx35_fb_pdev = imx35_add_mx3_sdc_fb(&mx3fb_pdata);
413 mx35_3ds_lcd.dev.parent = &imx35_fb_pdev->dev; 604 mx35_3ds_lcd.dev.parent = &imx35_fb_pdev->dev;
414 platform_device_register(&mx35_3ds_lcd); 605 platform_device_register(&mx35_3ds_lcd);
606
607 imx35_3ds_init_mc13892();
415} 608}
416 609
417static void __init mx35pdk_timer_init(void) 610static void __init mx35pdk_timer_init(void)
@@ -419,7 +612,7 @@ static void __init mx35pdk_timer_init(void)
419 mx35_clocks_init(); 612 mx35_clocks_init();
420} 613}
421 614
422struct sys_timer mx35pdk_timer = { 615static struct sys_timer mx35pdk_timer = {
423 .init = mx35pdk_timer_init, 616 .init = mx35pdk_timer_init,
424}; 617};
425 618
diff --git a/arch/arm/mach-imx/mach-mx51_efikamx.c b/arch/arm/mach-imx/mach-mx51_efikamx.c
index 586e9f822124..86e96ef11f9d 100644
--- a/arch/arm/mach-imx/mach-mx51_efikamx.c
+++ b/arch/arm/mach-imx/mach-mx51_efikamx.c
@@ -284,8 +284,7 @@ static struct sys_timer mx51_efikamx_timer = {
284 .init = mx51_efikamx_timer_init, 284 .init = mx51_efikamx_timer_init,
285}; 285};
286 286
287MACHINE_START(MX51_EFIKAMX, "Genesi EfikaMX nettop") 287MACHINE_START(MX51_EFIKAMX, "Genesi Efika MX (Smarttop)")
288 /* Maintainer: Amit Kucheria <amit.kucheria@linaro.org> */
289 .atag_offset = 0x100, 288 .atag_offset = 0x100,
290 .map_io = mx51_map_io, 289 .map_io = mx51_map_io,
291 .init_early = imx51_init_early, 290 .init_early = imx51_init_early,
diff --git a/arch/arm/mach-imx/mach-mx51_efikasb.c b/arch/arm/mach-imx/mach-mx51_efikasb.c
index 24aded9e109f..88f837a6cc76 100644
--- a/arch/arm/mach-imx/mach-mx51_efikasb.c
+++ b/arch/arm/mach-imx/mach-mx51_efikasb.c
@@ -280,7 +280,7 @@ static struct sys_timer mx51_efikasb_timer = {
280 .init = mx51_efikasb_timer_init, 280 .init = mx51_efikasb_timer_init,
281}; 281};
282 282
283MACHINE_START(MX51_EFIKASB, "Genesi Efika Smartbook") 283MACHINE_START(MX51_EFIKASB, "Genesi Efika MX (Smartbook)")
284 .atag_offset = 0x100, 284 .atag_offset = 0x100,
285 .map_io = mx51_map_io, 285 .map_io = mx51_map_io,
286 .init_early = imx51_init_early, 286 .init_early = imx51_init_early,
diff --git a/arch/arm/mach-imx/mach-pcm037.c b/arch/arm/mach-imx/mach-pcm037.c
index 5fddf94cc969..10c9795934a3 100644
--- a/arch/arm/mach-imx/mach-pcm037.c
+++ b/arch/arm/mach-imx/mach-pcm037.c
@@ -683,7 +683,7 @@ static void __init pcm037_timer_init(void)
683 mx31_clocks_init(26000000); 683 mx31_clocks_init(26000000);
684} 684}
685 685
686struct sys_timer pcm037_timer = { 686static struct sys_timer pcm037_timer = {
687 .init = pcm037_timer_init, 687 .init = pcm037_timer_init,
688}; 688};
689 689
diff --git a/arch/arm/mach-imx/mach-pcm043.c b/arch/arm/mach-imx/mach-pcm043.c
index 237474fcca23..73585f55cca0 100644
--- a/arch/arm/mach-imx/mach-pcm043.c
+++ b/arch/arm/mach-imx/mach-pcm043.c
@@ -399,7 +399,7 @@ static void __init pcm043_timer_init(void)
399 mx35_clocks_init(); 399 mx35_clocks_init();
400} 400}
401 401
402struct sys_timer pcm043_timer = { 402static struct sys_timer pcm043_timer = {
403 .init = pcm043_timer_init, 403 .init = pcm043_timer_init,
404}; 404};
405 405
diff --git a/arch/arm/mach-imx/mach-vpr200.c b/arch/arm/mach-imx/mach-vpr200.c
index 033257e553ef..add8c69c6c1a 100644
--- a/arch/arm/mach-imx/mach-vpr200.c
+++ b/arch/arm/mach-imx/mach-vpr200.c
@@ -310,7 +310,7 @@ static void __init vpr200_timer_init(void)
310 mx35_clocks_init(); 310 mx35_clocks_init();
311} 311}
312 312
313struct sys_timer vpr200_timer = { 313static struct sys_timer vpr200_timer = {
314 .init = vpr200_timer_init, 314 .init = vpr200_timer_init,
315}; 315};
316 316
diff --git a/arch/arm/mach-imx/mm-imx1.c b/arch/arm/mach-imx/mm-imx1.c
index 2bded591d5c2..fcafd3dafb8c 100644
--- a/arch/arm/mach-imx/mm-imx1.c
+++ b/arch/arm/mach-imx/mm-imx1.c
@@ -18,6 +18,7 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/pinctrl/machine.h>
21 22
22#include <asm/mach/map.h> 23#include <asm/mach/map.h>
23 24
@@ -58,4 +59,5 @@ void __init imx1_soc_init(void)
58 MX1_GPIO_INT_PORTC, 0); 59 MX1_GPIO_INT_PORTC, 0);
59 mxc_register_gpio("imx1-gpio", 3, MX1_GPIO4_BASE_ADDR, SZ_256, 60 mxc_register_gpio("imx1-gpio", 3, MX1_GPIO4_BASE_ADDR, SZ_256,
60 MX1_GPIO_INT_PORTD, 0); 61 MX1_GPIO_INT_PORTD, 0);
62 pinctrl_provide_dummies();
61} 63}
diff --git a/arch/arm/mach-imx/mm-imx21.c b/arch/arm/mach-imx/mm-imx21.c
index 14d540edfd1e..5f43905e5290 100644
--- a/arch/arm/mach-imx/mm-imx21.c
+++ b/arch/arm/mach-imx/mm-imx21.c
@@ -20,6 +20,7 @@
20 20
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/pinctrl/machine.h>
23#include <mach/hardware.h> 24#include <mach/hardware.h>
24#include <mach/common.h> 25#include <mach/common.h>
25#include <mach/devices-common.h> 26#include <mach/devices-common.h>
@@ -88,6 +89,7 @@ void __init imx21_soc_init(void)
88 mxc_register_gpio("imx21-gpio", 4, MX21_GPIO5_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0); 89 mxc_register_gpio("imx21-gpio", 4, MX21_GPIO5_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
89 mxc_register_gpio("imx21-gpio", 5, MX21_GPIO6_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0); 90 mxc_register_gpio("imx21-gpio", 5, MX21_GPIO6_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
90 91
92 pinctrl_provide_dummies();
91 imx_add_imx_dma(); 93 imx_add_imx_dma();
92 platform_device_register_simple("imx21-audmux", 0, imx21_audmux_res, 94 platform_device_register_simple("imx21-audmux", 0, imx21_audmux_res,
93 ARRAY_SIZE(imx21_audmux_res)); 95 ARRAY_SIZE(imx21_audmux_res));
diff --git a/arch/arm/mach-imx/mm-imx25.c b/arch/arm/mach-imx/mm-imx25.c
index 153b457acdc0..6ff37140a4f8 100644
--- a/arch/arm/mach-imx/mm-imx25.c
+++ b/arch/arm/mach-imx/mm-imx25.c
@@ -19,6 +19,7 @@
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/pinctrl/machine.h>
22 23
23#include <asm/pgtable.h> 24#include <asm/pgtable.h>
24#include <asm/mach/map.h> 25#include <asm/mach/map.h>
@@ -95,6 +96,7 @@ void __init imx25_soc_init(void)
95 mxc_register_gpio("imx31-gpio", 2, MX25_GPIO3_BASE_ADDR, SZ_16K, MX25_INT_GPIO3, 0); 96 mxc_register_gpio("imx31-gpio", 2, MX25_GPIO3_BASE_ADDR, SZ_16K, MX25_INT_GPIO3, 0);
96 mxc_register_gpio("imx31-gpio", 3, MX25_GPIO4_BASE_ADDR, SZ_16K, MX25_INT_GPIO4, 0); 97 mxc_register_gpio("imx31-gpio", 3, MX25_GPIO4_BASE_ADDR, SZ_16K, MX25_INT_GPIO4, 0);
97 98
99 pinctrl_provide_dummies();
98 /* i.mx25 has the i.mx35 type sdma */ 100 /* i.mx25 has the i.mx35 type sdma */
99 imx_add_imx_sdma("imx35-sdma", MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata); 101 imx_add_imx_sdma("imx35-sdma", MX25_SDMA_BASE_ADDR, MX25_INT_SDMA, &imx25_sdma_pdata);
100 /* i.mx25 has the i.mx31 type audmux */ 102 /* i.mx25 has the i.mx31 type audmux */
diff --git a/arch/arm/mach-imx/mm-imx27.c b/arch/arm/mach-imx/mm-imx27.c
index 8cb3f5e3e569..25662558e018 100644
--- a/arch/arm/mach-imx/mm-imx27.c
+++ b/arch/arm/mach-imx/mm-imx27.c
@@ -20,6 +20,7 @@
20 20
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/pinctrl/machine.h>
23#include <mach/hardware.h> 24#include <mach/hardware.h>
24#include <mach/common.h> 25#include <mach/common.h>
25#include <mach/devices-common.h> 26#include <mach/devices-common.h>
@@ -89,6 +90,7 @@ void __init imx27_soc_init(void)
89 mxc_register_gpio("imx21-gpio", 4, MX27_GPIO5_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0); 90 mxc_register_gpio("imx21-gpio", 4, MX27_GPIO5_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
90 mxc_register_gpio("imx21-gpio", 5, MX27_GPIO6_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0); 91 mxc_register_gpio("imx21-gpio", 5, MX27_GPIO6_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
91 92
93 pinctrl_provide_dummies();
92 imx_add_imx_dma(); 94 imx_add_imx_dma();
93 /* imx27 has the imx21 type audmux */ 95 /* imx27 has the imx21 type audmux */
94 platform_device_register_simple("imx21-audmux", 0, imx27_audmux_res, 96 platform_device_register_simple("imx21-audmux", 0, imx27_audmux_res,
diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
index 74127389e7ab..9128d15b1eb7 100644
--- a/arch/arm/mach-imx/mm-imx3.c
+++ b/arch/arm/mach-imx/mm-imx3.c
@@ -19,6 +19,7 @@
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/pinctrl/machine.h>
22 23
23#include <asm/pgtable.h> 24#include <asm/pgtable.h>
24#include <asm/system_misc.h> 25#include <asm/system_misc.h>
@@ -267,6 +268,7 @@ void __init imx35_soc_init(void)
267 mxc_register_gpio("imx31-gpio", 1, MX35_GPIO2_BASE_ADDR, SZ_16K, MX35_INT_GPIO2, 0); 268 mxc_register_gpio("imx31-gpio", 1, MX35_GPIO2_BASE_ADDR, SZ_16K, MX35_INT_GPIO2, 0);
268 mxc_register_gpio("imx31-gpio", 2, MX35_GPIO3_BASE_ADDR, SZ_16K, MX35_INT_GPIO3, 0); 269 mxc_register_gpio("imx31-gpio", 2, MX35_GPIO3_BASE_ADDR, SZ_16K, MX35_INT_GPIO3, 0);
269 270
271 pinctrl_provide_dummies();
270 if (to_version == 1) { 272 if (to_version == 1) {
271 strncpy(imx35_sdma_pdata.fw_name, "sdma-imx35-to1.bin", 273 strncpy(imx35_sdma_pdata.fw_name, "sdma-imx35-to1.bin",
272 strlen(imx35_sdma_pdata.fw_name)); 274 strlen(imx35_sdma_pdata.fw_name));
diff --git a/arch/arm/mach-imx/mm-imx5.c b/arch/arm/mach-imx/mm-imx5.c
index 05250aed61fb..ba91e6b31cf4 100644
--- a/arch/arm/mach-imx/mm-imx5.c
+++ b/arch/arm/mach-imx/mm-imx5.c
@@ -14,6 +14,7 @@
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/pinctrl/machine.h>
17 18
18#include <asm/system_misc.h> 19#include <asm/system_misc.h>
19#include <asm/mach/map.h> 20#include <asm/mach/map.h>
@@ -35,7 +36,7 @@ static void imx5_idle(void)
35 } 36 }
36 clk_enable(gpc_dvfs_clk); 37 clk_enable(gpc_dvfs_clk);
37 mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF); 38 mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF);
38 if (tzic_enable_wake() != 0) 39 if (!tzic_enable_wake())
39 cpu_do_idle(); 40 cpu_do_idle();
40 clk_disable(gpc_dvfs_clk); 41 clk_disable(gpc_dvfs_clk);
41} 42}
@@ -223,6 +224,7 @@ void __init imx53_soc_init(void)
223 mxc_register_gpio("imx31-gpio", 5, MX53_GPIO6_BASE_ADDR, SZ_16K, MX53_INT_GPIO6_LOW, MX53_INT_GPIO6_HIGH); 224 mxc_register_gpio("imx31-gpio", 5, MX53_GPIO6_BASE_ADDR, SZ_16K, MX53_INT_GPIO6_LOW, MX53_INT_GPIO6_HIGH);
224 mxc_register_gpio("imx31-gpio", 6, MX53_GPIO7_BASE_ADDR, SZ_16K, MX53_INT_GPIO7_LOW, MX53_INT_GPIO7_HIGH); 225 mxc_register_gpio("imx31-gpio", 6, MX53_GPIO7_BASE_ADDR, SZ_16K, MX53_INT_GPIO7_LOW, MX53_INT_GPIO7_HIGH);
225 226
227 pinctrl_provide_dummies();
226 /* i.mx53 has the i.mx35 type sdma */ 228 /* i.mx53 has the i.mx35 type sdma */
227 imx_add_imx_sdma("imx35-sdma", MX53_SDMA_BASE_ADDR, MX53_INT_SDMA, &imx53_sdma_pdata); 229 imx_add_imx_sdma("imx35-sdma", MX53_SDMA_BASE_ADDR, MX53_INT_SDMA, &imx53_sdma_pdata);
228 230
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 3e538da6cb1f..e428f3ab15c7 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -398,24 +398,16 @@ static int impd1_probe(struct lm_device *dev)
398 struct impd1_device *idev = impd1_devs + i; 398 struct impd1_device *idev = impd1_devs + i;
399 struct amba_device *d; 399 struct amba_device *d;
400 unsigned long pc_base; 400 unsigned long pc_base;
401 char devname[32];
401 402
402 pc_base = dev->resource.start + idev->offset; 403 pc_base = dev->resource.start + idev->offset;
403 404 snprintf(devname, 32, "lm%x:%5.5lx", dev->id, idev->offset >> 12);
404 d = amba_device_alloc(NULL, pc_base, SZ_4K); 405 d = amba_ahb_device_add(&dev->dev, devname, pc_base, SZ_4K,
405 if (!d) 406 dev->irq, dev->irq,
407 idev->platform_data, idev->id);
408 if (IS_ERR(d)) {
409 dev_err(&dev->dev, "unable to register device: %ld\n", PTR_ERR(d));
406 continue; 410 continue;
407
408 dev_set_name(&d->dev, "lm%x:%5.5lx", dev->id, idev->offset >> 12);
409 d->dev.parent = &dev->dev;
410 d->irq[0] = dev->irq;
411 d->irq[1] = dev->irq;
412 d->periphid = idev->id;
413 d->dev.platform_data = idev->platform_data;
414
415 ret = amba_device_add(d, &dev->resource);
416 if (ret) {
417 dev_err(&d->dev, "unable to register device: %d\n", ret);
418 amba_device_put(d);
419 } 411 }
420 } 412 }
421 413
diff --git a/arch/arm/mach-integrator/include/mach/entry-macro.S b/arch/arm/mach-integrator/include/mach/entry-macro.S
deleted file mode 100644
index 5cc7b85ad9df..000000000000
--- a/arch/arm/mach-integrator/include/mach/entry-macro.S
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * arch/arm/mach-integrator/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for Integrator platforms
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10#include <mach/hardware.h>
11#include <mach/platform.h>
12#include <mach/irqs.h>
13
14 .macro get_irqnr_preamble, base, tmp
15 .endm
16
17 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
18/* FIXME: should not be using soo many LDRs here */
19 ldr \base, =IO_ADDRESS(INTEGRATOR_IC_BASE)
20 mov \irqnr, #IRQ_PIC_START
21 ldr \irqstat, [\base, #IRQ_STATUS] @ get masked status
22 ldr \base, =IO_ADDRESS(INTEGRATOR_HDR_BASE)
23 teq \irqstat, #0
24 ldreq \irqstat, [\base, #(INTEGRATOR_HDR_IC_OFFSET+IRQ_STATUS)]
25 moveq \irqnr, #IRQ_CIC_START
26
271001: tst \irqstat, #15
28 bne 1002f
29 add \irqnr, \irqnr, #4
30 movs \irqstat, \irqstat, lsr #4
31 bne 1001b
321002: tst \irqstat, #1
33 bne 1003f
34 add \irqnr, \irqnr, #1
35 movs \irqstat, \irqstat, lsr #1
36 bne 1002b
371003: /* EQ will be set if no irqs pending */
38 .endm
39
diff --git a/arch/arm/mach-integrator/include/mach/irqs.h b/arch/arm/mach-integrator/include/mach/irqs.h
index a19a1a2fcf6b..7371018455d2 100644
--- a/arch/arm/mach-integrator/include/mach/irqs.h
+++ b/arch/arm/mach-integrator/include/mach/irqs.h
@@ -22,37 +22,37 @@
22/* 22/*
23 * Interrupt numbers 23 * Interrupt numbers
24 */ 24 */
25#define IRQ_PIC_START 0 25#define IRQ_PIC_START 1
26#define IRQ_SOFTINT 0 26#define IRQ_SOFTINT 1
27#define IRQ_UARTINT0 1 27#define IRQ_UARTINT0 2
28#define IRQ_UARTINT1 2 28#define IRQ_UARTINT1 3
29#define IRQ_KMIINT0 3 29#define IRQ_KMIINT0 4
30#define IRQ_KMIINT1 4 30#define IRQ_KMIINT1 5
31#define IRQ_TIMERINT0 5 31#define IRQ_TIMERINT0 6
32#define IRQ_TIMERINT1 6 32#define IRQ_TIMERINT1 7
33#define IRQ_TIMERINT2 7 33#define IRQ_TIMERINT2 8
34#define IRQ_RTCINT 8 34#define IRQ_RTCINT 9
35#define IRQ_AP_EXPINT0 9 35#define IRQ_AP_EXPINT0 10
36#define IRQ_AP_EXPINT1 10 36#define IRQ_AP_EXPINT1 11
37#define IRQ_AP_EXPINT2 11 37#define IRQ_AP_EXPINT2 12
38#define IRQ_AP_EXPINT3 12 38#define IRQ_AP_EXPINT3 13
39#define IRQ_AP_PCIINT0 13 39#define IRQ_AP_PCIINT0 14
40#define IRQ_AP_PCIINT1 14 40#define IRQ_AP_PCIINT1 15
41#define IRQ_AP_PCIINT2 15 41#define IRQ_AP_PCIINT2 16
42#define IRQ_AP_PCIINT3 16 42#define IRQ_AP_PCIINT3 17
43#define IRQ_AP_V3INT 17 43#define IRQ_AP_V3INT 18
44#define IRQ_AP_CPINT0 18 44#define IRQ_AP_CPINT0 19
45#define IRQ_AP_CPINT1 19 45#define IRQ_AP_CPINT1 20
46#define IRQ_AP_LBUSTIMEOUT 20 46#define IRQ_AP_LBUSTIMEOUT 21
47#define IRQ_AP_APCINT 21 47#define IRQ_AP_APCINT 22
48#define IRQ_CP_CLCDCINT 22 48#define IRQ_CP_CLCDCINT 23
49#define IRQ_CP_MMCIINT0 23 49#define IRQ_CP_MMCIINT0 24
50#define IRQ_CP_MMCIINT1 24 50#define IRQ_CP_MMCIINT1 25
51#define IRQ_CP_AACIINT 25 51#define IRQ_CP_AACIINT 26
52#define IRQ_CP_CPPLDINT 26 52#define IRQ_CP_CPPLDINT 27
53#define IRQ_CP_ETHINT 27 53#define IRQ_CP_ETHINT 28
54#define IRQ_CP_TSPENINT 28 54#define IRQ_CP_TSPENINT 29
55#define IRQ_PIC_END 31 55#define IRQ_PIC_END 29
56 56
57#define IRQ_CIC_START 32 57#define IRQ_CIC_START 32
58#define IRQ_CM_SOFTINT 32 58#define IRQ_CM_SOFTINT 32
@@ -80,4 +80,3 @@
80 80
81#define NR_IRQS_INTEGRATOR_AP 34 81#define NR_IRQS_INTEGRATOR_AP 34
82#define NR_IRQS_INTEGRATOR_CP 47 82#define NR_IRQS_INTEGRATOR_CP 47
83
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 871f148ffd72..c857501c5783 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -162,12 +162,6 @@ static void __init ap_map_io(void)
162 162
163#define INTEGRATOR_SC_VALID_INT 0x003fffff 163#define INTEGRATOR_SC_VALID_INT 0x003fffff
164 164
165static struct fpga_irq_data sc_irq_data = {
166 .base = VA_IC_BASE,
167 .irq_start = 0,
168 .chip.name = "SC",
169};
170
171static void __init ap_init_irq(void) 165static void __init ap_init_irq(void)
172{ 166{
173 /* Disable all interrupts initially. */ 167 /* Disable all interrupts initially. */
@@ -178,7 +172,8 @@ static void __init ap_init_irq(void)
178 writel(-1, VA_IC_BASE + IRQ_ENABLE_CLEAR); 172 writel(-1, VA_IC_BASE + IRQ_ENABLE_CLEAR);
179 writel(-1, VA_IC_BASE + FIQ_ENABLE_CLEAR); 173 writel(-1, VA_IC_BASE + FIQ_ENABLE_CLEAR);
180 174
181 fpga_irq_init(-1, INTEGRATOR_SC_VALID_INT, &sc_irq_data); 175 fpga_irq_init(VA_IC_BASE, "SC", IRQ_PIC_START,
176 -1, INTEGRATOR_SC_VALID_INT, NULL);
182} 177}
183 178
184#ifdef CONFIG_PM 179#ifdef CONFIG_PM
@@ -478,6 +473,7 @@ MACHINE_START(INTEGRATOR, "ARM-Integrator")
478 .nr_irqs = NR_IRQS_INTEGRATOR_AP, 473 .nr_irqs = NR_IRQS_INTEGRATOR_AP,
479 .init_early = integrator_init_early, 474 .init_early = integrator_init_early,
480 .init_irq = ap_init_irq, 475 .init_irq = ap_init_irq,
476 .handle_irq = fpga_handle_irq,
481 .timer = &ap_timer, 477 .timer = &ap_timer,
482 .init_machine = ap_init, 478 .init_machine = ap_init,
483 .restart = integrator_restart, 479 .restart = integrator_restart,
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 48a115a91d9d..a56c53608939 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -143,30 +143,14 @@ static void __init intcp_map_io(void)
143 iotable_init(intcp_io_desc, ARRAY_SIZE(intcp_io_desc)); 143 iotable_init(intcp_io_desc, ARRAY_SIZE(intcp_io_desc));
144} 144}
145 145
146static struct fpga_irq_data cic_irq_data = {
147 .base = INTCP_VA_CIC_BASE,
148 .irq_start = IRQ_CIC_START,
149 .chip.name = "CIC",
150};
151
152static struct fpga_irq_data pic_irq_data = {
153 .base = INTCP_VA_PIC_BASE,
154 .irq_start = IRQ_PIC_START,
155 .chip.name = "PIC",
156};
157
158static struct fpga_irq_data sic_irq_data = {
159 .base = INTCP_VA_SIC_BASE,
160 .irq_start = IRQ_SIC_START,
161 .chip.name = "SIC",
162};
163
164static void __init intcp_init_irq(void) 146static void __init intcp_init_irq(void)
165{ 147{
166 u32 pic_mask, sic_mask; 148 u32 pic_mask, cic_mask, sic_mask;
167 149
150 /* These masks are for the HW IRQ registers */
168 pic_mask = ~((~0u) << (11 - IRQ_PIC_START)); 151 pic_mask = ~((~0u) << (11 - IRQ_PIC_START));
169 pic_mask |= (~((~0u) << (29 - 22))) << 22; 152 pic_mask |= (~((~0u) << (29 - 22))) << 22;
153 cic_mask = ~((~0u) << (1 + IRQ_CIC_END - IRQ_CIC_START));
170 sic_mask = ~((~0u) << (1 + IRQ_SIC_END - IRQ_SIC_START)); 154 sic_mask = ~((~0u) << (1 + IRQ_SIC_END - IRQ_SIC_START));
171 155
172 /* 156 /*
@@ -179,12 +163,14 @@ static void __init intcp_init_irq(void)
179 writel(sic_mask, INTCP_VA_SIC_BASE + IRQ_ENABLE_CLEAR); 163 writel(sic_mask, INTCP_VA_SIC_BASE + IRQ_ENABLE_CLEAR);
180 writel(sic_mask, INTCP_VA_SIC_BASE + FIQ_ENABLE_CLEAR); 164 writel(sic_mask, INTCP_VA_SIC_BASE + FIQ_ENABLE_CLEAR);
181 165
182 fpga_irq_init(-1, pic_mask, &pic_irq_data); 166 fpga_irq_init(INTCP_VA_PIC_BASE, "PIC", IRQ_PIC_START,
167 -1, pic_mask, NULL);
183 168
184 fpga_irq_init(-1, ~((~0u) << (1 + IRQ_CIC_END - IRQ_CIC_START)), 169 fpga_irq_init(INTCP_VA_CIC_BASE, "CIC", IRQ_CIC_START,
185 &cic_irq_data); 170 -1, cic_mask, NULL);
186 171
187 fpga_irq_init(IRQ_CP_CPPLDINT, sic_mask, &sic_irq_data); 172 fpga_irq_init(INTCP_VA_SIC_BASE, "SIC", IRQ_SIC_START,
173 IRQ_CP_CPPLDINT, sic_mask, NULL);
188} 174}
189 175
190/* 176/*
@@ -467,6 +453,7 @@ MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
467 .nr_irqs = NR_IRQS_INTEGRATOR_CP, 453 .nr_irqs = NR_IRQS_INTEGRATOR_CP,
468 .init_early = intcp_init_early, 454 .init_early = intcp_init_early,
469 .init_irq = intcp_init_irq, 455 .init_irq = intcp_init_irq,
456 .handle_irq = fpga_handle_irq,
470 .timer = &cp_timer, 457 .timer = &cp_timer,
471 .init_machine = intcp_init, 458 .init_machine = intcp_init,
472 .restart = integrator_restart, 459 .restart = integrator_restart,
diff --git a/arch/arm/mach-integrator/pci.c b/arch/arm/mach-integrator/pci.c
index f1ca9c122861..6c1667e728f5 100644
--- a/arch/arm/mach-integrator/pci.c
+++ b/arch/arm/mach-integrator/pci.c
@@ -70,21 +70,10 @@
70 */ 70 */
71static u8 __init integrator_swizzle(struct pci_dev *dev, u8 *pinp) 71static u8 __init integrator_swizzle(struct pci_dev *dev, u8 *pinp)
72{ 72{
73 int pin = *pinp; 73 if (*pinp == 0)
74 *pinp = 1;
74 75
75 if (pin == 0) 76 return pci_common_swizzle(dev, pinp);
76 pin = 1;
77
78 while (dev->bus->self) {
79 pin = pci_swizzle_interrupt_pin(dev, pin);
80 /*
81 * move up the chain of bridges, swizzling as we go.
82 */
83 dev = dev->bus->self;
84 }
85 *pinp = pin;
86
87 return PCI_SLOT(dev->devfn);
88} 77}
89 78
90static int irq_tab[4] __initdata = { 79static int irq_tab[4] __initdata = {
@@ -109,7 +98,7 @@ static struct hw_pci integrator_pci __initdata = {
109 .map_irq = integrator_map_irq, 98 .map_irq = integrator_map_irq,
110 .setup = pci_v3_setup, 99 .setup = pci_v3_setup,
111 .nr_controllers = 1, 100 .nr_controllers = 1,
112 .scan = pci_v3_scan_bus, 101 .ops = &pci_v3_ops,
113 .preinit = pci_v3_preinit, 102 .preinit = pci_v3_preinit,
114 .postinit = pci_v3_postinit, 103 .postinit = pci_v3_postinit,
115}; 104};
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index 67e6f9a9d1a0..b866880e82ac 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -340,7 +340,7 @@ static int v3_write_config(struct pci_bus *bus, unsigned int devfn, int where,
340 return PCIBIOS_SUCCESSFUL; 340 return PCIBIOS_SUCCESSFUL;
341} 341}
342 342
343static struct pci_ops pci_v3_ops = { 343struct pci_ops pci_v3_ops = {
344 .read = v3_read_config, 344 .read = v3_read_config,
345 .write = v3_write_config, 345 .write = v3_write_config,
346}; 346};
@@ -488,12 +488,6 @@ int __init pci_v3_setup(int nr, struct pci_sys_data *sys)
488 return ret; 488 return ret;
489} 489}
490 490
491struct pci_bus * __init pci_v3_scan_bus(int nr, struct pci_sys_data *sys)
492{
493 return pci_scan_root_bus(NULL, sys->busnr, &pci_v3_ops, sys,
494 &sys->resources);
495}
496
497/* 491/*
498 * V3_LB_BASE? - local bus address 492 * V3_LB_BASE? - local bus address
499 * V3_LB_MAP? - pci bus address 493 * V3_LB_MAP? - pci bus address
diff --git a/arch/arm/mach-iop13xx/iq81340mc.c b/arch/arm/mach-iop13xx/iq81340mc.c
index 5c96b73e6964..e3f3e7daa79e 100644
--- a/arch/arm/mach-iop13xx/iq81340mc.c
+++ b/arch/arm/mach-iop13xx/iq81340mc.c
@@ -54,7 +54,6 @@ iq81340mc_pcix_map_irq(const struct pci_dev *dev, u8 idsel, u8 pin)
54} 54}
55 55
56static struct hw_pci iq81340mc_pci __initdata = { 56static struct hw_pci iq81340mc_pci __initdata = {
57 .swizzle = pci_std_swizzle,
58 .nr_controllers = 0, 57 .nr_controllers = 0,
59 .setup = iop13xx_pci_setup, 58 .setup = iop13xx_pci_setup,
60 .map_irq = iq81340mc_pcix_map_irq, 59 .map_irq = iq81340mc_pcix_map_irq,
diff --git a/arch/arm/mach-iop13xx/iq81340sc.c b/arch/arm/mach-iop13xx/iq81340sc.c
index aa4dd750135a..060cddde2fd4 100644
--- a/arch/arm/mach-iop13xx/iq81340sc.c
+++ b/arch/arm/mach-iop13xx/iq81340sc.c
@@ -56,7 +56,6 @@ iq81340sc_atux_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)
56} 56}
57 57
58static struct hw_pci iq81340sc_pci __initdata = { 58static struct hw_pci iq81340sc_pci __initdata = {
59 .swizzle = pci_std_swizzle,
60 .nr_controllers = 0, 59 .nr_controllers = 0,
61 .setup = iop13xx_pci_setup, 60 .setup = iop13xx_pci_setup,
62 .scan = iop13xx_scan_bus, 61 .scan = iop13xx_scan_bus,
diff --git a/arch/arm/mach-iop32x/em7210.c b/arch/arm/mach-iop32x/em7210.c
index 24069e03fdc1..9f369f09c29d 100644
--- a/arch/arm/mach-iop32x/em7210.c
+++ b/arch/arm/mach-iop32x/em7210.c
@@ -103,11 +103,10 @@ em7210_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
103} 103}
104 104
105static struct hw_pci em7210_pci __initdata = { 105static struct hw_pci em7210_pci __initdata = {
106 .swizzle = pci_std_swizzle,
107 .nr_controllers = 1, 106 .nr_controllers = 1,
107 .ops = &iop3xx_ops,
108 .setup = iop3xx_pci_setup, 108 .setup = iop3xx_pci_setup,
109 .preinit = iop3xx_pci_preinit, 109 .preinit = iop3xx_pci_preinit,
110 .scan = iop3xx_pci_scan_bus,
111 .map_irq = em7210_pci_map_irq, 110 .map_irq = em7210_pci_map_irq,
112}; 111};
113 112
diff --git a/arch/arm/mach-iop32x/glantank.c b/arch/arm/mach-iop32x/glantank.c
index 204e1d1cd766..c15a100ba779 100644
--- a/arch/arm/mach-iop32x/glantank.c
+++ b/arch/arm/mach-iop32x/glantank.c
@@ -96,11 +96,10 @@ glantank_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
96} 96}
97 97
98static struct hw_pci glantank_pci __initdata = { 98static struct hw_pci glantank_pci __initdata = {
99 .swizzle = pci_std_swizzle,
100 .nr_controllers = 1, 99 .nr_controllers = 1,
100 .ops = &iop3xx_ops,
101 .setup = iop3xx_pci_setup, 101 .setup = iop3xx_pci_setup,
102 .preinit = iop3xx_pci_preinit, 102 .preinit = iop3xx_pci_preinit,
103 .scan = iop3xx_pci_scan_bus,
104 .map_irq = glantank_pci_map_irq, 103 .map_irq = glantank_pci_map_irq,
105}; 104};
106 105
diff --git a/arch/arm/mach-iop32x/iq31244.c b/arch/arm/mach-iop32x/iq31244.c
index 3eb642af1cdc..ddd1c7ecfe57 100644
--- a/arch/arm/mach-iop32x/iq31244.c
+++ b/arch/arm/mach-iop32x/iq31244.c
@@ -130,11 +130,10 @@ ep80219_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
130} 130}
131 131
132static struct hw_pci ep80219_pci __initdata = { 132static struct hw_pci ep80219_pci __initdata = {
133 .swizzle = pci_std_swizzle,
134 .nr_controllers = 1, 133 .nr_controllers = 1,
134 .ops = &iop3xx_ops,
135 .setup = iop3xx_pci_setup, 135 .setup = iop3xx_pci_setup,
136 .preinit = iop3xx_pci_preinit, 136 .preinit = iop3xx_pci_preinit,
137 .scan = iop3xx_pci_scan_bus,
138 .map_irq = ep80219_pci_map_irq, 137 .map_irq = ep80219_pci_map_irq,
139}; 138};
140 139
@@ -166,11 +165,10 @@ iq31244_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
166} 165}
167 166
168static struct hw_pci iq31244_pci __initdata = { 167static struct hw_pci iq31244_pci __initdata = {
169 .swizzle = pci_std_swizzle,
170 .nr_controllers = 1, 168 .nr_controllers = 1,
169 .ops = &iop3xx_ops,
171 .setup = iop3xx_pci_setup, 170 .setup = iop3xx_pci_setup,
172 .preinit = iop3xx_pci_preinit, 171 .preinit = iop3xx_pci_preinit,
173 .scan = iop3xx_pci_scan_bus,
174 .map_irq = iq31244_pci_map_irq, 172 .map_irq = iq31244_pci_map_irq,
175}; 173};
176 174
diff --git a/arch/arm/mach-iop32x/iq80321.c b/arch/arm/mach-iop32x/iq80321.c
index 2ec724b58a2c..bf155e6a3b45 100644
--- a/arch/arm/mach-iop32x/iq80321.c
+++ b/arch/arm/mach-iop32x/iq80321.c
@@ -101,11 +101,10 @@ iq80321_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
101} 101}
102 102
103static struct hw_pci iq80321_pci __initdata = { 103static struct hw_pci iq80321_pci __initdata = {
104 .swizzle = pci_std_swizzle,
105 .nr_controllers = 1, 104 .nr_controllers = 1,
105 .ops = &iop3xx_ops,
106 .setup = iop3xx_pci_setup, 106 .setup = iop3xx_pci_setup,
107 .preinit = iop3xx_pci_preinit_cond, 107 .preinit = iop3xx_pci_preinit_cond,
108 .scan = iop3xx_pci_scan_bus,
109 .map_irq = iq80321_pci_map_irq, 108 .map_irq = iq80321_pci_map_irq,
110}; 109};
111 110
diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c
index 6b6d55912444..5a7ae91e8849 100644
--- a/arch/arm/mach-iop32x/n2100.c
+++ b/arch/arm/mach-iop32x/n2100.c
@@ -114,11 +114,10 @@ n2100_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
114} 114}
115 115
116static struct hw_pci n2100_pci __initdata = { 116static struct hw_pci n2100_pci __initdata = {
117 .swizzle = pci_std_swizzle,
118 .nr_controllers = 1, 117 .nr_controllers = 1,
118 .ops = &iop3xx_ops,
119 .setup = iop3xx_pci_setup, 119 .setup = iop3xx_pci_setup,
120 .preinit = iop3xx_pci_preinit, 120 .preinit = iop3xx_pci_preinit,
121 .scan = iop3xx_pci_scan_bus,
122 .map_irq = n2100_pci_map_irq, 121 .map_irq = n2100_pci_map_irq,
123}; 122};
124 123
diff --git a/arch/arm/mach-iop33x/iq80331.c b/arch/arm/mach-iop33x/iq80331.c
index abce934f3816..e74a7debe793 100644
--- a/arch/arm/mach-iop33x/iq80331.c
+++ b/arch/arm/mach-iop33x/iq80331.c
@@ -84,11 +84,10 @@ iq80331_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
84} 84}
85 85
86static struct hw_pci iq80331_pci __initdata = { 86static struct hw_pci iq80331_pci __initdata = {
87 .swizzle = pci_std_swizzle,
88 .nr_controllers = 1, 87 .nr_controllers = 1,
88 .ops = &iop3xx_ops,
89 .setup = iop3xx_pci_setup, 89 .setup = iop3xx_pci_setup,
90 .preinit = iop3xx_pci_preinit_cond, 90 .preinit = iop3xx_pci_preinit_cond,
91 .scan = iop3xx_pci_scan_bus,
92 .map_irq = iq80331_pci_map_irq, 91 .map_irq = iq80331_pci_map_irq,
93}; 92};
94 93
diff --git a/arch/arm/mach-iop33x/iq80332.c b/arch/arm/mach-iop33x/iq80332.c
index 7513559e25bb..e2f5beece6e8 100644
--- a/arch/arm/mach-iop33x/iq80332.c
+++ b/arch/arm/mach-iop33x/iq80332.c
@@ -84,11 +84,10 @@ iq80332_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
84} 84}
85 85
86static struct hw_pci iq80332_pci __initdata = { 86static struct hw_pci iq80332_pci __initdata = {
87 .swizzle = pci_std_swizzle,
88 .nr_controllers = 1, 87 .nr_controllers = 1,
88 .ops = &iop3xx_ops,
89 .setup = iop3xx_pci_setup, 89 .setup = iop3xx_pci_setup,
90 .preinit = iop3xx_pci_preinit_cond, 90 .preinit = iop3xx_pci_preinit_cond,
91 .scan = iop3xx_pci_scan_bus,
92 .map_irq = iq80332_pci_map_irq, 91 .map_irq = iq80332_pci_map_irq,
93}; 92};
94 93
diff --git a/arch/arm/mach-ixp2000/Kconfig b/arch/arm/mach-ixp2000/Kconfig
deleted file mode 100644
index 08d2707f6ca8..000000000000
--- a/arch/arm/mach-ixp2000/Kconfig
+++ /dev/null
@@ -1,72 +0,0 @@
1
2if ARCH_IXP2000
3
4config ARCH_SUPPORTS_BIG_ENDIAN
5 bool
6 default y
7
8menu "Intel IXP2400/2800 Implementation Options"
9
10comment "IXP2400/2800 Platforms"
11
12config ARCH_ENP2611
13 bool "Support Radisys ENP-2611"
14 help
15 Say 'Y' here if you want your kernel to support the Radisys
16 ENP2611 PCI network processing card. For more information on
17 this card, see <file:Documentation/arm/IXP2000>.
18
19config ARCH_IXDP2400
20 bool "Support Intel IXDP2400"
21 help
22 Say 'Y' here if you want your kernel to support the Intel
23 IXDP2400 reference platform. For more information on
24 this platform, see <file:Documentation/arm/IXP2000>.
25
26config ARCH_IXDP2800
27 bool "Support Intel IXDP2800"
28 help
29 Say 'Y' here if you want your kernel to support the Intel
30 IXDP2800 reference platform. For more information on
31 this platform, see <file:Documentation/arm/IXP2000>.
32
33config ARCH_IXDP2X00
34 bool
35 depends on ARCH_IXDP2400 || ARCH_IXDP2800
36 default y
37
38config ARCH_IXDP2401
39 bool "Support Intel IXDP2401"
40 help
41 Say 'Y' here if you want your kernel to support the Intel
42 IXDP2401 reference platform. For more information on
43 this platform, see <file:Documentation/arm/IXP2000>.
44
45config ARCH_IXDP2801
46 bool "Support Intel IXDP2801 and IXDP28x5"
47 help
48 Say 'Y' here if you want your kernel to support the Intel
49 IXDP2801/2805/2855 reference platforms. For more information on
50 this platform, see <file:Documentation/arm/IXP2000>.
51
52config MACH_IXDP28X5
53 bool
54 depends on ARCH_IXDP2801
55 default y
56
57config ARCH_IXDP2X01
58 bool
59 depends on ARCH_IXDP2401 || ARCH_IXDP2801
60 default y
61
62config IXP2000_SUPPORT_BROKEN_PCI_IO
63 bool "Support broken PCI I/O on older IXP2000s"
64 default y
65 help
66 Say 'N' here if you only intend to run your kernel on an
67 IXP2000 B0 or later model and do not need the PCI I/O
68 byteswap workaround. Say 'Y' otherwise.
69
70endmenu
71
72endif
diff --git a/arch/arm/mach-ixp2000/Makefile b/arch/arm/mach-ixp2000/Makefile
deleted file mode 100644
index 1e6139d42a92..000000000000
--- a/arch/arm/mach-ixp2000/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4obj-y := core.o pci.o
5obj-m :=
6obj-n :=
7obj- :=
8
9obj-$(CONFIG_ARCH_ENP2611) += enp2611.o
10obj-$(CONFIG_ARCH_IXDP2400) += ixdp2400.o
11obj-$(CONFIG_ARCH_IXDP2800) += ixdp2800.o
12obj-$(CONFIG_ARCH_IXDP2X00) += ixdp2x00.o
13obj-$(CONFIG_ARCH_IXDP2X01) += ixdp2x01.o
14
diff --git a/arch/arm/mach-ixp2000/Makefile.boot b/arch/arm/mach-ixp2000/Makefile.boot
deleted file mode 100644
index 9c7af91d93da..000000000000
--- a/arch/arm/mach-ixp2000/Makefile.boot
+++ /dev/null
@@ -1,3 +0,0 @@
1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100
3
diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c
deleted file mode 100644
index f214cdff01cb..000000000000
--- a/arch/arm/mach-ixp2000/core.c
+++ /dev/null
@@ -1,520 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/core.c
3 *
4 * Common routines used by all IXP2400/2800 based platforms.
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2004 (C) MontaVista Software, Inc.
9 *
10 * Based on work Copyright (C) 2002-2003 Intel Corporation
11 *
12 * This file is licensed under the terms of the GNU General Public
13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied.
15 */
16#include <linux/gpio.h>
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/spinlock.h>
20#include <linux/sched.h>
21#include <linux/interrupt.h>
22#include <linux/irq.h>
23#include <linux/serial.h>
24#include <linux/tty.h>
25#include <linux/bitops.h>
26#include <linux/serial_8250.h>
27#include <linux/mm.h>
28#include <linux/export.h>
29
30#include <asm/types.h>
31#include <asm/setup.h>
32#include <asm/memory.h>
33#include <mach/hardware.h>
34#include <asm/irq.h>
35#include <asm/tlbflush.h>
36#include <asm/pgtable.h>
37
38#include <asm/mach/map.h>
39#include <asm/mach/time.h>
40#include <asm/mach/irq.h>
41
42#include <mach/gpio-ixp2000.h>
43
44static DEFINE_SPINLOCK(ixp2000_slowport_lock);
45static unsigned long ixp2000_slowport_irq_flags;
46
47/*************************************************************************
48 * Slowport access routines
49 *************************************************************************/
50void ixp2000_acquire_slowport(struct slowport_cfg *new_cfg, struct slowport_cfg *old_cfg)
51{
52 spin_lock_irqsave(&ixp2000_slowport_lock, ixp2000_slowport_irq_flags);
53
54 old_cfg->CCR = *IXP2000_SLOWPORT_CCR;
55 old_cfg->WTC = *IXP2000_SLOWPORT_WTC2;
56 old_cfg->RTC = *IXP2000_SLOWPORT_RTC2;
57 old_cfg->PCR = *IXP2000_SLOWPORT_PCR;
58 old_cfg->ADC = *IXP2000_SLOWPORT_ADC;
59
60 ixp2000_reg_write(IXP2000_SLOWPORT_CCR, new_cfg->CCR);
61 ixp2000_reg_write(IXP2000_SLOWPORT_WTC2, new_cfg->WTC);
62 ixp2000_reg_write(IXP2000_SLOWPORT_RTC2, new_cfg->RTC);
63 ixp2000_reg_write(IXP2000_SLOWPORT_PCR, new_cfg->PCR);
64 ixp2000_reg_wrb(IXP2000_SLOWPORT_ADC, new_cfg->ADC);
65}
66
67void ixp2000_release_slowport(struct slowport_cfg *old_cfg)
68{
69 ixp2000_reg_write(IXP2000_SLOWPORT_CCR, old_cfg->CCR);
70 ixp2000_reg_write(IXP2000_SLOWPORT_WTC2, old_cfg->WTC);
71 ixp2000_reg_write(IXP2000_SLOWPORT_RTC2, old_cfg->RTC);
72 ixp2000_reg_write(IXP2000_SLOWPORT_PCR, old_cfg->PCR);
73 ixp2000_reg_wrb(IXP2000_SLOWPORT_ADC, old_cfg->ADC);
74
75 spin_unlock_irqrestore(&ixp2000_slowport_lock,
76 ixp2000_slowport_irq_flags);
77}
78
79/*************************************************************************
80 * Chip specific mappings shared by all IXP2000 systems
81 *************************************************************************/
82static struct map_desc ixp2000_io_desc[] __initdata = {
83 {
84 .virtual = IXP2000_CAP_VIRT_BASE,
85 .pfn = __phys_to_pfn(IXP2000_CAP_PHYS_BASE),
86 .length = IXP2000_CAP_SIZE,
87 .type = MT_DEVICE,
88 }, {
89 .virtual = IXP2000_INTCTL_VIRT_BASE,
90 .pfn = __phys_to_pfn(IXP2000_INTCTL_PHYS_BASE),
91 .length = IXP2000_INTCTL_SIZE,
92 .type = MT_DEVICE,
93 }, {
94 .virtual = IXP2000_PCI_CREG_VIRT_BASE,
95 .pfn = __phys_to_pfn(IXP2000_PCI_CREG_PHYS_BASE),
96 .length = IXP2000_PCI_CREG_SIZE,
97 .type = MT_DEVICE,
98 }, {
99 .virtual = IXP2000_PCI_CSR_VIRT_BASE,
100 .pfn = __phys_to_pfn(IXP2000_PCI_CSR_PHYS_BASE),
101 .length = IXP2000_PCI_CSR_SIZE,
102 .type = MT_DEVICE,
103 }, {
104 .virtual = IXP2000_MSF_VIRT_BASE,
105 .pfn = __phys_to_pfn(IXP2000_MSF_PHYS_BASE),
106 .length = IXP2000_MSF_SIZE,
107 .type = MT_DEVICE,
108 }, {
109 .virtual = IXP2000_SCRATCH_RING_VIRT_BASE,
110 .pfn = __phys_to_pfn(IXP2000_SCRATCH_RING_PHYS_BASE),
111 .length = IXP2000_SCRATCH_RING_SIZE,
112 .type = MT_DEVICE,
113 }, {
114 .virtual = IXP2000_SRAM0_VIRT_BASE,
115 .pfn = __phys_to_pfn(IXP2000_SRAM0_PHYS_BASE),
116 .length = IXP2000_SRAM0_SIZE,
117 .type = MT_DEVICE,
118 }, {
119 .virtual = IXP2000_PCI_IO_VIRT_BASE,
120 .pfn = __phys_to_pfn(IXP2000_PCI_IO_PHYS_BASE),
121 .length = IXP2000_PCI_IO_SIZE,
122 .type = MT_DEVICE,
123 }, {
124 .virtual = IXP2000_PCI_CFG0_VIRT_BASE,
125 .pfn = __phys_to_pfn(IXP2000_PCI_CFG0_PHYS_BASE),
126 .length = IXP2000_PCI_CFG0_SIZE,
127 .type = MT_DEVICE,
128 }, {
129 .virtual = IXP2000_PCI_CFG1_VIRT_BASE,
130 .pfn = __phys_to_pfn(IXP2000_PCI_CFG1_PHYS_BASE),
131 .length = IXP2000_PCI_CFG1_SIZE,
132 .type = MT_DEVICE,
133 }
134};
135
136void __init ixp2000_map_io(void)
137{
138 iotable_init(ixp2000_io_desc, ARRAY_SIZE(ixp2000_io_desc));
139
140 /* Set slowport to 8-bit mode. */
141 ixp2000_reg_wrb(IXP2000_SLOWPORT_FRM, 1);
142}
143
144
145/*************************************************************************
146 * Serial port support for IXP2000
147 *************************************************************************/
148static struct plat_serial8250_port ixp2000_serial_port[] = {
149 {
150 .mapbase = IXP2000_UART_PHYS_BASE,
151 .membase = (char *)(IXP2000_UART_VIRT_BASE + 3),
152 .irq = IRQ_IXP2000_UART,
153 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
154 .iotype = UPIO_MEM,
155 .regshift = 2,
156 .uartclk = 50000000,
157 },
158 { },
159};
160
161static struct resource ixp2000_uart_resource = {
162 .start = IXP2000_UART_PHYS_BASE,
163 .end = IXP2000_UART_PHYS_BASE + 0x1f,
164 .flags = IORESOURCE_MEM,
165};
166
167static struct platform_device ixp2000_serial_device = {
168 .name = "serial8250",
169 .id = PLAT8250_DEV_PLATFORM,
170 .dev = {
171 .platform_data = ixp2000_serial_port,
172 },
173 .num_resources = 1,
174 .resource = &ixp2000_uart_resource,
175};
176
177void __init ixp2000_uart_init(void)
178{
179 platform_device_register(&ixp2000_serial_device);
180}
181
182
183/*************************************************************************
184 * Timer-tick functions for IXP2000
185 *************************************************************************/
186static unsigned ticks_per_jiffy;
187static unsigned ticks_per_usec;
188static unsigned next_jiffy_time;
189static volatile unsigned long *missing_jiffy_timer_csr;
190
191unsigned long ixp2000_gettimeoffset (void)
192{
193 unsigned long offset;
194
195 offset = next_jiffy_time - *missing_jiffy_timer_csr;
196
197 return offset / ticks_per_usec;
198}
199
200static irqreturn_t ixp2000_timer_interrupt(int irq, void *dev_id)
201{
202 /* clear timer 1 */
203 ixp2000_reg_wrb(IXP2000_T1_CLR, 1);
204
205 while ((signed long)(next_jiffy_time - *missing_jiffy_timer_csr)
206 >= ticks_per_jiffy) {
207 timer_tick();
208 next_jiffy_time -= ticks_per_jiffy;
209 }
210
211 return IRQ_HANDLED;
212}
213
214static struct irqaction ixp2000_timer_irq = {
215 .name = "IXP2000 Timer Tick",
216 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
217 .handler = ixp2000_timer_interrupt,
218};
219
220void __init ixp2000_init_time(unsigned long tick_rate)
221{
222 ticks_per_jiffy = (tick_rate + HZ/2) / HZ;
223 ticks_per_usec = tick_rate / 1000000;
224
225 /*
226 * We use timer 1 as our timer interrupt.
227 */
228 ixp2000_reg_write(IXP2000_T1_CLR, 0);
229 ixp2000_reg_write(IXP2000_T1_CLD, ticks_per_jiffy - 1);
230 ixp2000_reg_write(IXP2000_T1_CTL, (1 << 7));
231
232 /*
233 * We use a second timer as a monotonic counter for tracking
234 * missed jiffies. The IXP2000 has four timers, but if we're
235 * on an A-step IXP2800, timer 2 and 3 don't work, so on those
236 * chips we use timer 4. Timer 4 is the only timer that can
237 * be used for the watchdog, so we use timer 2 if we're on a
238 * non-buggy chip.
239 */
240 if ((*IXP2000_PRODUCT_ID & 0x001ffef0) == 0x00000000) {
241 printk(KERN_INFO "Enabling IXP2800 erratum #25 workaround\n");
242
243 ixp2000_reg_write(IXP2000_T4_CLR, 0);
244 ixp2000_reg_write(IXP2000_T4_CLD, -1);
245 ixp2000_reg_wrb(IXP2000_T4_CTL, (1 << 7));
246 missing_jiffy_timer_csr = IXP2000_T4_CSR;
247 } else {
248 ixp2000_reg_write(IXP2000_T2_CLR, 0);
249 ixp2000_reg_write(IXP2000_T2_CLD, -1);
250 ixp2000_reg_wrb(IXP2000_T2_CTL, (1 << 7));
251 missing_jiffy_timer_csr = IXP2000_T2_CSR;
252 }
253 next_jiffy_time = 0xffffffff;
254
255 /* register for interrupt */
256 setup_irq(IRQ_IXP2000_TIMER1, &ixp2000_timer_irq);
257}
258
259/*************************************************************************
260 * GPIO helpers
261 *************************************************************************/
262static unsigned long GPIO_IRQ_falling_edge;
263static unsigned long GPIO_IRQ_rising_edge;
264static unsigned long GPIO_IRQ_level_low;
265static unsigned long GPIO_IRQ_level_high;
266
267static void update_gpio_int_csrs(void)
268{
269 ixp2000_reg_write(IXP2000_GPIO_FEDR, GPIO_IRQ_falling_edge);
270 ixp2000_reg_write(IXP2000_GPIO_REDR, GPIO_IRQ_rising_edge);
271 ixp2000_reg_write(IXP2000_GPIO_LSLR, GPIO_IRQ_level_low);
272 ixp2000_reg_wrb(IXP2000_GPIO_LSHR, GPIO_IRQ_level_high);
273}
274
275void gpio_line_config(int line, int direction)
276{
277 unsigned long flags;
278
279 local_irq_save(flags);
280 if (direction == GPIO_OUT) {
281 /* if it's an output, it ain't an interrupt anymore */
282 GPIO_IRQ_falling_edge &= ~(1 << line);
283 GPIO_IRQ_rising_edge &= ~(1 << line);
284 GPIO_IRQ_level_low &= ~(1 << line);
285 GPIO_IRQ_level_high &= ~(1 << line);
286 update_gpio_int_csrs();
287
288 ixp2000_reg_wrb(IXP2000_GPIO_PDSR, 1 << line);
289 } else if (direction == GPIO_IN) {
290 ixp2000_reg_wrb(IXP2000_GPIO_PDCR, 1 << line);
291 }
292 local_irq_restore(flags);
293}
294EXPORT_SYMBOL(gpio_line_config);
295
296
297/*************************************************************************
298 * IRQ handling IXP2000
299 *************************************************************************/
300static void ixp2000_GPIO_irq_handler(unsigned int irq, struct irq_desc *desc)
301{
302 int i;
303 unsigned long status = *IXP2000_GPIO_INST;
304
305 for (i = 0; i <= 7; i++) {
306 if (status & (1<<i)) {
307 generic_handle_irq(i + IRQ_IXP2000_GPIO0);
308 }
309 }
310}
311
312static int ixp2000_GPIO_irq_type(struct irq_data *d, unsigned int type)
313{
314 int line = d->irq - IRQ_IXP2000_GPIO0;
315
316 /*
317 * First, configure this GPIO line as an input.
318 */
319 ixp2000_reg_write(IXP2000_GPIO_PDCR, 1 << line);
320
321 /*
322 * Then, set the proper trigger type.
323 */
324 if (type & IRQ_TYPE_EDGE_FALLING)
325 GPIO_IRQ_falling_edge |= 1 << line;
326 else
327 GPIO_IRQ_falling_edge &= ~(1 << line);
328 if (type & IRQ_TYPE_EDGE_RISING)
329 GPIO_IRQ_rising_edge |= 1 << line;
330 else
331 GPIO_IRQ_rising_edge &= ~(1 << line);
332 if (type & IRQ_TYPE_LEVEL_LOW)
333 GPIO_IRQ_level_low |= 1 << line;
334 else
335 GPIO_IRQ_level_low &= ~(1 << line);
336 if (type & IRQ_TYPE_LEVEL_HIGH)
337 GPIO_IRQ_level_high |= 1 << line;
338 else
339 GPIO_IRQ_level_high &= ~(1 << line);
340 update_gpio_int_csrs();
341
342 return 0;
343}
344
345static void ixp2000_GPIO_irq_mask_ack(struct irq_data *d)
346{
347 unsigned int irq = d->irq;
348
349 ixp2000_reg_write(IXP2000_GPIO_INCR, (1 << (irq - IRQ_IXP2000_GPIO0)));
350
351 ixp2000_reg_write(IXP2000_GPIO_EDSR, (1 << (irq - IRQ_IXP2000_GPIO0)));
352 ixp2000_reg_write(IXP2000_GPIO_LDSR, (1 << (irq - IRQ_IXP2000_GPIO0)));
353 ixp2000_reg_wrb(IXP2000_GPIO_INST, (1 << (irq - IRQ_IXP2000_GPIO0)));
354}
355
356static void ixp2000_GPIO_irq_mask(struct irq_data *d)
357{
358 unsigned int irq = d->irq;
359
360 ixp2000_reg_wrb(IXP2000_GPIO_INCR, (1 << (irq - IRQ_IXP2000_GPIO0)));
361}
362
363static void ixp2000_GPIO_irq_unmask(struct irq_data *d)
364{
365 unsigned int irq = d->irq;
366
367 ixp2000_reg_write(IXP2000_GPIO_INSR, (1 << (irq - IRQ_IXP2000_GPIO0)));
368}
369
370static struct irq_chip ixp2000_GPIO_irq_chip = {
371 .irq_ack = ixp2000_GPIO_irq_mask_ack,
372 .irq_mask = ixp2000_GPIO_irq_mask,
373 .irq_unmask = ixp2000_GPIO_irq_unmask,
374 .irq_set_type = ixp2000_GPIO_irq_type,
375};
376
377static void ixp2000_pci_irq_mask(struct irq_data *d)
378{
379 unsigned long temp = *IXP2000_PCI_XSCALE_INT_ENABLE;
380 if (d->irq == IRQ_IXP2000_PCIA)
381 ixp2000_reg_wrb(IXP2000_PCI_XSCALE_INT_ENABLE, (temp & ~(1 << 26)));
382 else if (d->irq == IRQ_IXP2000_PCIB)
383 ixp2000_reg_wrb(IXP2000_PCI_XSCALE_INT_ENABLE, (temp & ~(1 << 27)));
384}
385
386static void ixp2000_pci_irq_unmask(struct irq_data *d)
387{
388 unsigned long temp = *IXP2000_PCI_XSCALE_INT_ENABLE;
389 if (d->irq == IRQ_IXP2000_PCIA)
390 ixp2000_reg_write(IXP2000_PCI_XSCALE_INT_ENABLE, (temp | (1 << 26)));
391 else if (d->irq == IRQ_IXP2000_PCIB)
392 ixp2000_reg_write(IXP2000_PCI_XSCALE_INT_ENABLE, (temp | (1 << 27)));
393}
394
395/*
396 * Error interrupts. These are used extensively by the microengine drivers
397 */
398static void ixp2000_err_irq_handler(unsigned int irq, struct irq_desc *desc)
399{
400 int i;
401 unsigned long status = *IXP2000_IRQ_ERR_STATUS;
402
403 for(i = 31; i >= 0; i--) {
404 if(status & (1 << i)) {
405 generic_handle_irq(IRQ_IXP2000_DRAM0_MIN_ERR + i);
406 }
407 }
408}
409
410static void ixp2000_err_irq_mask(struct irq_data *d)
411{
412 ixp2000_reg_write(IXP2000_IRQ_ERR_ENABLE_CLR,
413 (1 << (d->irq - IRQ_IXP2000_DRAM0_MIN_ERR)));
414}
415
416static void ixp2000_err_irq_unmask(struct irq_data *d)
417{
418 ixp2000_reg_write(IXP2000_IRQ_ERR_ENABLE_SET,
419 (1 << (d->irq - IRQ_IXP2000_DRAM0_MIN_ERR)));
420}
421
422static struct irq_chip ixp2000_err_irq_chip = {
423 .irq_ack = ixp2000_err_irq_mask,
424 .irq_mask = ixp2000_err_irq_mask,
425 .irq_unmask = ixp2000_err_irq_unmask
426};
427
428static struct irq_chip ixp2000_pci_irq_chip = {
429 .irq_ack = ixp2000_pci_irq_mask,
430 .irq_mask = ixp2000_pci_irq_mask,
431 .irq_unmask = ixp2000_pci_irq_unmask
432};
433
434static void ixp2000_irq_mask(struct irq_data *d)
435{
436 ixp2000_reg_wrb(IXP2000_IRQ_ENABLE_CLR, (1 << d->irq));
437}
438
439static void ixp2000_irq_unmask(struct irq_data *d)
440{
441 ixp2000_reg_write(IXP2000_IRQ_ENABLE_SET, (1 << d->irq));
442}
443
444static struct irq_chip ixp2000_irq_chip = {
445 .irq_ack = ixp2000_irq_mask,
446 .irq_mask = ixp2000_irq_mask,
447 .irq_unmask = ixp2000_irq_unmask
448};
449
450void __init ixp2000_init_irq(void)
451{
452 int irq;
453
454 /*
455 * Mask all sources
456 */
457 ixp2000_reg_write(IXP2000_IRQ_ENABLE_CLR, 0xffffffff);
458 ixp2000_reg_write(IXP2000_FIQ_ENABLE_CLR, 0xffffffff);
459
460 /* clear all GPIO edge/level detects */
461 ixp2000_reg_write(IXP2000_GPIO_REDR, 0);
462 ixp2000_reg_write(IXP2000_GPIO_FEDR, 0);
463 ixp2000_reg_write(IXP2000_GPIO_LSHR, 0);
464 ixp2000_reg_write(IXP2000_GPIO_LSLR, 0);
465 ixp2000_reg_write(IXP2000_GPIO_INCR, -1);
466
467 /* clear PCI interrupt sources */
468 ixp2000_reg_wrb(IXP2000_PCI_XSCALE_INT_ENABLE, 0);
469
470 /*
471 * Certain bits in the IRQ status register of the
472 * IXP2000 are reserved. Instead of trying to map
473 * things non 1:1 from bit position to IRQ number,
474 * we mark the reserved IRQs as invalid. This makes
475 * our mask/unmask code much simpler.
476 */
477 for (irq = IRQ_IXP2000_SOFT_INT; irq <= IRQ_IXP2000_THDB3; irq++) {
478 if ((1 << irq) & IXP2000_VALID_IRQ_MASK) {
479 irq_set_chip_and_handler(irq, &ixp2000_irq_chip,
480 handle_level_irq);
481 set_irq_flags(irq, IRQF_VALID);
482 } else set_irq_flags(irq, 0);
483 }
484
485 for (irq = IRQ_IXP2000_DRAM0_MIN_ERR; irq <= IRQ_IXP2000_SP_INT; irq++) {
486 if((1 << (irq - IRQ_IXP2000_DRAM0_MIN_ERR)) &
487 IXP2000_VALID_ERR_IRQ_MASK) {
488 irq_set_chip_and_handler(irq, &ixp2000_err_irq_chip,
489 handle_level_irq);
490 set_irq_flags(irq, IRQF_VALID);
491 }
492 else
493 set_irq_flags(irq, 0);
494 }
495 irq_set_chained_handler(IRQ_IXP2000_ERRSUM, ixp2000_err_irq_handler);
496
497 for (irq = IRQ_IXP2000_GPIO0; irq <= IRQ_IXP2000_GPIO7; irq++) {
498 irq_set_chip_and_handler(irq, &ixp2000_GPIO_irq_chip,
499 handle_level_irq);
500 set_irq_flags(irq, IRQF_VALID);
501 }
502 irq_set_chained_handler(IRQ_IXP2000_GPIO, ixp2000_GPIO_irq_handler);
503
504 /*
505 * Enable PCI irqs. The actual PCI[AB] decoding is done in
506 * entry-macro.S, so we don't need a chained handler for the
507 * PCI interrupt source.
508 */
509 ixp2000_reg_write(IXP2000_IRQ_ENABLE_SET, (1 << IRQ_IXP2000_PCI));
510 for (irq = IRQ_IXP2000_PCIA; irq <= IRQ_IXP2000_PCIB; irq++) {
511 irq_set_chip_and_handler(irq, &ixp2000_pci_irq_chip,
512 handle_level_irq);
513 set_irq_flags(irq, IRQF_VALID);
514 }
515}
516
517void ixp2000_restart(char mode, const char *cmd)
518{
519 ixp2000_reg_wrb(IXP2000_RESET0, RSTALL);
520}
diff --git a/arch/arm/mach-ixp2000/enp2611.c b/arch/arm/mach-ixp2000/enp2611.c
deleted file mode 100644
index 4867f408617c..000000000000
--- a/arch/arm/mach-ixp2000/enp2611.c
+++ /dev/null
@@ -1,265 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/enp2611.c
3 *
4 * Radisys ENP-2611 support.
5 *
6 * Created 2004 by Lennert Buytenhek from the ixdp2x01 code. The
7 * original version carries the following notices:
8 *
9 * Original Author: Andrzej Mialkowski <andrzej.mialkowski@intel.com>
10 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
11 *
12 * Copyright (C) 2002-2003 Intel Corp.
13 * Copyright (C) 2003-2004 MontaVista Software, Inc.
14 *
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 */
20
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/mm.h>
24#include <linux/sched.h>
25#include <linux/interrupt.h>
26#include <linux/bitops.h>
27#include <linux/pci.h>
28#include <linux/ioport.h>
29#include <linux/delay.h>
30#include <linux/serial.h>
31#include <linux/tty.h>
32#include <linux/serial_core.h>
33#include <linux/platform_device.h>
34#include <linux/io.h>
35
36#include <asm/irq.h>
37#include <asm/pgtable.h>
38#include <asm/page.h>
39#include <mach/hardware.h>
40#include <asm/mach-types.h>
41
42#include <asm/mach/pci.h>
43#include <asm/mach/map.h>
44#include <asm/mach/irq.h>
45#include <asm/mach/time.h>
46#include <asm/mach/arch.h>
47#include <asm/mach/flash.h>
48
49/*************************************************************************
50 * ENP-2611 timer tick configuration
51 *************************************************************************/
52static void __init enp2611_timer_init(void)
53{
54 ixp2000_init_time(50 * 1000 * 1000);
55}
56
57static struct sys_timer enp2611_timer = {
58 .init = enp2611_timer_init,
59 .offset = ixp2000_gettimeoffset,
60};
61
62
63/*************************************************************************
64 * ENP-2611 I/O
65 *************************************************************************/
66static struct map_desc enp2611_io_desc[] __initdata = {
67 {
68 .virtual = ENP2611_CALEB_VIRT_BASE,
69 .pfn = __phys_to_pfn(ENP2611_CALEB_PHYS_BASE),
70 .length = ENP2611_CALEB_SIZE,
71 .type = MT_DEVICE,
72 }, {
73 .virtual = ENP2611_PM3386_0_VIRT_BASE,
74 .pfn = __phys_to_pfn(ENP2611_PM3386_0_PHYS_BASE),
75 .length = ENP2611_PM3386_0_SIZE,
76 .type = MT_DEVICE,
77 }, {
78 .virtual = ENP2611_PM3386_1_VIRT_BASE,
79 .pfn = __phys_to_pfn(ENP2611_PM3386_1_PHYS_BASE),
80 .length = ENP2611_PM3386_1_SIZE,
81 .type = MT_DEVICE,
82 }
83};
84
85void __init enp2611_map_io(void)
86{
87 ixp2000_map_io();
88 iotable_init(enp2611_io_desc, ARRAY_SIZE(enp2611_io_desc));
89}
90
91
92/*************************************************************************
93 * ENP-2611 PCI
94 *************************************************************************/
95static int enp2611_pci_setup(int nr, struct pci_sys_data *sys)
96{
97 sys->mem_offset = 0xe0000000;
98 ixp2000_pci_setup(nr, sys);
99 return 1;
100}
101
102static void __init enp2611_pci_preinit(void)
103{
104 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00100000);
105 ixp2000_pci_preinit();
106 pcibios_setup("firmware");
107}
108
109static inline int enp2611_pci_valid_device(struct pci_bus *bus,
110 unsigned int devfn)
111{
112 /* The 82559 ethernet controller appears at both PCI:1:0:0 and
113 * PCI:1:2:0, so let's pretend the second one isn't there.
114 */
115 if (bus->number == 0x01 && devfn == 0x10)
116 return 0;
117
118 return 1;
119}
120
121static int enp2611_pci_read_config(struct pci_bus *bus, unsigned int devfn,
122 int where, int size, u32 *value)
123{
124 if (enp2611_pci_valid_device(bus, devfn))
125 return ixp2000_pci_read_config(bus, devfn, where, size, value);
126
127 return PCIBIOS_DEVICE_NOT_FOUND;
128}
129
130static int enp2611_pci_write_config(struct pci_bus *bus, unsigned int devfn,
131 int where, int size, u32 value)
132{
133 if (enp2611_pci_valid_device(bus, devfn))
134 return ixp2000_pci_write_config(bus, devfn, where, size, value);
135
136 return PCIBIOS_DEVICE_NOT_FOUND;
137}
138
139static struct pci_ops enp2611_pci_ops = {
140 .read = enp2611_pci_read_config,
141 .write = enp2611_pci_write_config
142};
143
144static struct pci_bus * __init enp2611_pci_scan_bus(int nr,
145 struct pci_sys_data *sys)
146{
147 return pci_scan_root_bus(NULL, sys->busnr, &enp2611_pci_ops, sys,
148 &sys->resources);
149}
150
151static int __init enp2611_pci_map_irq(const struct pci_dev *dev, u8 slot,
152 u8 pin)
153{
154 int irq;
155
156 if (dev->bus->number == 0 && PCI_SLOT(dev->devfn) == 0) {
157 /* IXP2400. */
158 irq = IRQ_IXP2000_PCIA;
159 } else if (dev->bus->number == 0 && PCI_SLOT(dev->devfn) == 1) {
160 /* 21555 non-transparent bridge. */
161 irq = IRQ_IXP2000_PCIB;
162 } else if (dev->bus->number == 0 && PCI_SLOT(dev->devfn) == 4) {
163 /* PCI2050B transparent bridge. */
164 irq = -1;
165 } else if (dev->bus->number == 1 && PCI_SLOT(dev->devfn) == 0) {
166 /* 82559 ethernet. */
167 irq = IRQ_IXP2000_PCIA;
168 } else if (dev->bus->number == 1 && PCI_SLOT(dev->devfn) == 1) {
169 /* SPI-3 option board. */
170 irq = IRQ_IXP2000_PCIB;
171 } else {
172 printk(KERN_ERR "enp2611_pci_map_irq() called for unknown "
173 "device PCI:%d:%d:%d\n", dev->bus->number,
174 PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
175 irq = -1;
176 }
177
178 return irq;
179}
180
181struct hw_pci enp2611_pci __initdata = {
182 .nr_controllers = 1,
183 .setup = enp2611_pci_setup,
184 .preinit = enp2611_pci_preinit,
185 .scan = enp2611_pci_scan_bus,
186 .map_irq = enp2611_pci_map_irq,
187};
188
189int __init enp2611_pci_init(void)
190{
191 if (machine_is_enp2611())
192 pci_common_init(&enp2611_pci);
193
194 return 0;
195}
196
197subsys_initcall(enp2611_pci_init);
198
199
200/*************************************************************************
201 * ENP-2611 Machine Initialization
202 *************************************************************************/
203static struct flash_platform_data enp2611_flash_platform_data = {
204 .map_name = "cfi_probe",
205 .width = 1,
206};
207
208static struct ixp2000_flash_data enp2611_flash_data = {
209 .platform_data = &enp2611_flash_platform_data,
210 .nr_banks = 1
211};
212
213static struct resource enp2611_flash_resource = {
214 .start = 0xc4000000,
215 .end = 0xc4000000 + 0x00ffffff,
216 .flags = IORESOURCE_MEM,
217};
218
219static struct platform_device enp2611_flash = {
220 .name = "IXP2000-Flash",
221 .id = 0,
222 .dev = {
223 .platform_data = &enp2611_flash_data,
224 },
225 .num_resources = 1,
226 .resource = &enp2611_flash_resource,
227};
228
229static struct ixp2000_i2c_pins enp2611_i2c_gpio_pins = {
230 .sda_pin = ENP2611_GPIO_SDA,
231 .scl_pin = ENP2611_GPIO_SCL,
232};
233
234static struct platform_device enp2611_i2c_controller = {
235 .name = "IXP2000-I2C",
236 .id = 0,
237 .dev = {
238 .platform_data = &enp2611_i2c_gpio_pins
239 },
240 .num_resources = 0
241};
242
243static struct platform_device *enp2611_devices[] __initdata = {
244 &enp2611_flash,
245 &enp2611_i2c_controller
246};
247
248static void __init enp2611_init_machine(void)
249{
250 platform_add_devices(enp2611_devices, ARRAY_SIZE(enp2611_devices));
251 ixp2000_uart_init();
252}
253
254
255MACHINE_START(ENP2611, "Radisys ENP-2611 PCI network processor board")
256 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
257 .atag_offset = 0x100,
258 .map_io = enp2611_map_io,
259 .init_irq = ixp2000_init_irq,
260 .timer = &enp2611_timer,
261 .init_machine = enp2611_init_machine,
262 .restart = ixp2000_restart,
263MACHINE_END
264
265
diff --git a/arch/arm/mach-ixp2000/include/mach/debug-macro.S b/arch/arm/mach-ixp2000/include/mach/debug-macro.S
deleted file mode 100644
index bdd3ccdc2890..000000000000
--- a/arch/arm/mach-ixp2000/include/mach/debug-macro.S
+++ /dev/null
@@ -1,25 +0,0 @@
1/* arch/arm/mach-ixp2000/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14 .macro addruart, rp, rv, tmp
15 mov \rp, #0x00030000
16#ifdef __ARMEB__
17 orr \rp, \rp, #0x00000003
18#endif
19 orr \rv, \rp, #0xfe000000 @ virtual base
20 orr \rv, \rv, #0x00f00000
21 orr \rp, \rp, #0xc0000000 @ Physical base
22 .endm
23
24#define UART_SHIFT 2
25#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-ixp2000/include/mach/enp2611.h b/arch/arm/mach-ixp2000/include/mach/enp2611.h
deleted file mode 100644
index 9ce3690061d5..000000000000
--- a/arch/arm/mach-ixp2000/include/mach/enp2611.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/enp2611.h
3 *
4 * Register and other defines for Radisys ENP-2611
5 *
6 * Created 2004 by Lennert Buytenhek from the ixdp2x01 code. The
7 * original version carries the following notices:
8 *
9 * Original Author: Naeem Afzal <naeem.m.afzal@intel.com>
10 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
11 *
12 * Copyright (C) 2002 Intel Corp.
13 * Copyright (C) 2003-2004 MontaVista Software, Inc.
14 *
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 */
20
21#ifndef __ENP2611_H
22#define __ENP2611_H
23
24#define ENP2611_CALEB_PHYS_BASE 0xc5000000
25#define ENP2611_CALEB_VIRT_BASE 0xfe000000
26#define ENP2611_CALEB_SIZE 0x00100000
27
28#define ENP2611_PM3386_0_PHYS_BASE 0xc6000000
29#define ENP2611_PM3386_0_VIRT_BASE 0xfe100000
30#define ENP2611_PM3386_0_SIZE 0x00100000
31
32#define ENP2611_PM3386_1_PHYS_BASE 0xc6400000
33#define ENP2611_PM3386_1_VIRT_BASE 0xfe200000
34#define ENP2611_PM3386_1_SIZE 0x00100000
35
36#define ENP2611_GPIO_SCL 7
37#define ENP2611_GPIO_SDA 6
38
39#define IRQ_ENP2611_THERMAL IRQ_IXP2000_GPIO4
40#define IRQ_ENP2611_OPTION_BOARD IRQ_IXP2000_GPIO3
41#define IRQ_ENP2611_CALEB IRQ_IXP2000_GPIO2
42#define IRQ_ENP2611_PM3386_1 IRQ_IXP2000_GPIO1
43#define IRQ_ENP2611_PM3386_0 IRQ_IXP2000_GPIO0
44
45
46#endif
diff --git a/arch/arm/mach-ixp2000/include/mach/entry-macro.S b/arch/arm/mach-ixp2000/include/mach/entry-macro.S
deleted file mode 100644
index c4444dff9202..000000000000
--- a/arch/arm/mach-ixp2000/include/mach/entry-macro.S
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for IXP2000-based platforms
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10#include <mach/irqs.h>
11
12 .macro get_irqnr_preamble, base, tmp
13 .endm
14
15 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
16
17 mov \irqnr, #0x0 @clear out irqnr as default
18 mov \base, #0xfe000000
19 orr \base, \base, #0x00e00000
20 orr \base, \base, #0x08
21 ldr \irqstat, [\base] @ get interrupts
22
23 cmp \irqstat, #0
24 beq 1001f
25
26 clz \irqnr, \irqstat
27 mov \base, #31
28 subs \irqnr, \base, \irqnr
29
30 /*
31 * We handle PCIA and PCIB here so we don't have an
32 * extra layer of code just to check these two bits.
33 */
34 cmp \irqnr, #IRQ_IXP2000_PCI
35 bne 1001f
36
37 mov \base, #0xfe000000
38 orr \base, \base, #0x00c00000
39 orr \base, \base, #0x00000100
40 orr \base, \base, #0x00000058
41 ldr \irqstat, [\base]
42
43 mov \tmp, #(1<<26)
44 tst \irqstat, \tmp
45 movne \irqnr, #IRQ_IXP2000_PCIA
46 bne 1001f
47
48 mov \tmp, #(1<<27)
49 tst \irqstat, \tmp
50 movne \irqnr, #IRQ_IXP2000_PCIB
51
521001:
53 .endm
54
diff --git a/arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h b/arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h
deleted file mode 100644
index af836c76c3f1..000000000000
--- a/arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/gpio.h
3 *
4 * Copyright (C) 2002 Intel Corporation.
5 *
6 * This program is free software, you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11/*
12 * IXP2000 GPIO in/out, edge/level detection for IRQs:
13 * IRQs are generated on Falling-edge, Rising-Edge, Level-low, Level-High
14 * or both Falling-edge and Rising-edge.
15 * This must be called *before* the corresponding IRQ is registerd.
16 * Use this instead of directly setting the GPIO registers.
17 * GPIOs may also be used as GPIOs (e.g. for emulating i2c/smb)
18 */
19#ifndef __ASM_ARCH_GPIO_H
20#define __ASM_ARCH_GPIO_H
21
22#ifndef __ASSEMBLY__
23
24#define GPIO_IN 0
25#define GPIO_OUT 1
26
27#define IXP2000_GPIO_LOW 0
28#define IXP2000_GPIO_HIGH 1
29
30extern void gpio_line_config(int line, int direction);
31
32static inline int gpio_line_get(int line)
33{
34 return (((*IXP2000_GPIO_PLR) >> line) & 1);
35}
36
37static inline void gpio_line_set(int line, int value)
38{
39 if (value == IXP2000_GPIO_HIGH) {
40 ixp2000_reg_write(IXP2000_GPIO_POSR, 1 << line);
41 } else if (value == IXP2000_GPIO_LOW) {
42 ixp2000_reg_write(IXP2000_GPIO_POCR, 1 << line);
43 }
44}
45
46#endif /* !__ASSEMBLY__ */
47
48#endif /* ASM_ARCH_IXP2000_GPIO_H_ */
diff --git a/arch/arm/mach-ixp2000/include/mach/hardware.h b/arch/arm/mach-ixp2000/include/mach/hardware.h
deleted file mode 100644
index cdaf1db84003..000000000000
--- a/arch/arm/mach-ixp2000/include/mach/hardware.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/hardware.h
3 *
4 * Hardware definitions for IXP2400/2800 based systems
5 *
6 * Original Author: Naeem M Afzal <naeem.m.afzal@intel.com>
7 *
8 * Maintainer: Deepak Saxena <dsaxena@mvista.com>
9 *
10 * Copyright (C) 2001-2002 Intel Corp.
11 * Copyright (C) 2003-2004 MontaVista Software, Inc.
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 */
18
19#ifndef __ASM_ARCH_HARDWARE_H__
20#define __ASM_ARCH_HARDWARE_H__
21
22#include "ixp2000-regs.h" /* Chipset Registers */
23
24/*
25 * Platform helper functions
26 */
27#include "platform.h"
28
29/*
30 * Platform-specific bits
31 */
32#include "enp2611.h" /* ENP-2611 */
33#include "ixdp2x00.h" /* IXDP2400/2800 */
34#include "ixdp2x01.h" /* IXDP2401/2801 */
35
36#endif /* _ASM_ARCH_HARDWARE_H__ */
diff --git a/arch/arm/mach-ixp2000/include/mach/io.h b/arch/arm/mach-ixp2000/include/mach/io.h
deleted file mode 100644
index f6552d6f35ab..000000000000
--- a/arch/arm/mach-ixp2000/include/mach/io.h
+++ /dev/null
@@ -1,133 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/io.h
3 *
4 * Original Author: Naeem M Afzal <naeem.m.afzal@intel.com>
5 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
6 *
7 * Copyright (C) 2002 Intel Corp.
8 * Copyrgiht (C) 2003-2004 MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef __ASM_ARM_ARCH_IO_H
16#define __ASM_ARM_ARCH_IO_H
17
18#include <mach/hardware.h>
19
20#define IO_SPACE_LIMIT 0xffffffff
21
22/*
23 * The A? revisions of the IXP2000s assert byte lanes for PCI I/O
24 * transactions the other way round (MEM transactions don't have this
25 * issue), so if we want to support those models, we need to override
26 * the standard I/O functions.
27 *
28 * B0 and later have a bit that can be set to 1 to get the proper
29 * behavior for I/O transactions, which then allows us to use the
30 * standard I/O functions. This is what we do if the user does not
31 * explicitly ask for support for pre-B0.
32 */
33#ifdef CONFIG_IXP2000_SUPPORT_BROKEN_PCI_IO
34#define ___io(p) ((void __iomem *)((p)+IXP2000_PCI_IO_VIRT_BASE))
35
36#define alignb(addr) (void __iomem *)((unsigned long)(addr) ^ 3)
37#define alignw(addr) (void __iomem *)((unsigned long)(addr) ^ 2)
38
39#define outb(v,p) __raw_writeb((v),alignb(___io(p)))
40#define outw(v,p) __raw_writew((v),alignw(___io(p)))
41#define outl(v,p) __raw_writel((v),___io(p))
42
43#define inb(p) ({ unsigned int __v = __raw_readb(alignb(___io(p))); __v; })
44#define inw(p) \
45 ({ unsigned int __v = (__raw_readw(alignw(___io(p)))); __v; })
46#define inl(p) \
47 ({ unsigned int __v = (__raw_readl(___io(p))); __v; })
48
49#define outsb(p,d,l) __raw_writesb(alignb(___io(p)),d,l)
50#define outsw(p,d,l) __raw_writesw(alignw(___io(p)),d,l)
51#define outsl(p,d,l) __raw_writesl(___io(p),d,l)
52
53#define insb(p,d,l) __raw_readsb(alignb(___io(p)),d,l)
54#define insw(p,d,l) __raw_readsw(alignw(___io(p)),d,l)
55#define insl(p,d,l) __raw_readsl(___io(p),d,l)
56
57#define __is_io_address(p) ((((unsigned long)(p)) & ~(IXP2000_PCI_IO_SIZE - 1)) == IXP2000_PCI_IO_VIRT_BASE)
58
59#define ioread8(p) \
60 ({ \
61 unsigned int __v; \
62 \
63 if (__is_io_address(p)) { \
64 __v = __raw_readb(alignb(p)); \
65 } else { \
66 __v = __raw_readb(p); \
67 } \
68 \
69 __v; \
70 }) \
71
72#define ioread16(p) \
73 ({ \
74 unsigned int __v; \
75 \
76 if (__is_io_address(p)) { \
77 __v = __raw_readw(alignw(p)); \
78 } else { \
79 __v = le16_to_cpu(__raw_readw(p)); \
80 } \
81 \
82 __v; \
83 })
84
85#define ioread32(p) \
86 ({ \
87 unsigned int __v; \
88 \
89 if (__is_io_address(p)) { \
90 __v = __raw_readl(p); \
91 } else { \
92 __v = le32_to_cpu(__raw_readl(p)); \
93 } \
94 \
95 __v; \
96 })
97
98#define iowrite8(v,p) \
99 ({ \
100 if (__is_io_address(p)) { \
101 __raw_writeb((v), alignb(p)); \
102 } else { \
103 __raw_writeb((v), p); \
104 } \
105 })
106
107#define iowrite16(v,p) \
108 ({ \
109 if (__is_io_address(p)) { \
110 __raw_writew((v), alignw(p)); \
111 } else { \
112 __raw_writew(cpu_to_le16(v), p); \
113 } \
114 })
115
116#define iowrite32(v,p) \
117 ({ \
118 if (__is_io_address(p)) { \
119 __raw_writel((v), p); \
120 } else { \
121 __raw_writel(cpu_to_le32(v), p); \
122 } \
123 })
124
125#define ioport_map(port, nr) ___io(port)
126
127#define ioport_unmap(addr)
128#else
129#define __io(p) ((void __iomem *)((p)+IXP2000_PCI_IO_VIRT_BASE))
130#endif
131
132
133#endif
diff --git a/arch/arm/mach-ixp2000/include/mach/irqs.h b/arch/arm/mach-ixp2000/include/mach/irqs.h
deleted file mode 100644
index bee96bcafdca..000000000000
--- a/arch/arm/mach-ixp2000/include/mach/irqs.h
+++ /dev/null
@@ -1,207 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/irqs.h
3 *
4 * Original Author: Naeem Afzal <naeem.m.afzal@intel.com>
5 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
6 *
7 * Copyright (C) 2002 Intel Corp.
8 * Copyright (C) 2003-2004 MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef _IRQS_H
16#define _IRQS_H
17
18/*
19 * Do NOT add #ifdef MACHINE_FOO in here.
20 * Simpy add your machine IRQs here and increase NR_IRQS if needed to
21 * hold your machine's IRQ table.
22 */
23
24/*
25 * Some interrupt numbers go unused b/c the IRQ mask/ummask/status
26 * register has those bit reserved. We just mark those interrupts
27 * as invalid and this allows us to do mask/unmask with a single
28 * shift operation instead of having to map the IRQ number to
29 * a HW IRQ number.
30 */
31#define IRQ_IXP2000_SOFT_INT 0 /* soft interrupt */
32#define IRQ_IXP2000_ERRSUM 1 /* OR of all bits in ErrorStatus reg*/
33#define IRQ_IXP2000_UART 2
34#define IRQ_IXP2000_GPIO 3
35#define IRQ_IXP2000_TIMER1 4
36#define IRQ_IXP2000_TIMER2 5
37#define IRQ_IXP2000_TIMER3 6
38#define IRQ_IXP2000_TIMER4 7
39#define IRQ_IXP2000_PMU 8
40#define IRQ_IXP2000_SPF 9 /* Slow port framer IRQ */
41#define IRQ_IXP2000_DMA1 10
42#define IRQ_IXP2000_DMA2 11
43#define IRQ_IXP2000_DMA3 12
44#define IRQ_IXP2000_PCI_DOORBELL 13
45#define IRQ_IXP2000_ME_ATTN 14
46#define IRQ_IXP2000_PCI 15 /* PCI INTA or INTB */
47#define IRQ_IXP2000_THDA0 16 /* thread 0-31A */
48#define IRQ_IXP2000_THDA1 17 /* thread 32-63A, IXP2800 only */
49#define IRQ_IXP2000_THDA2 18 /* thread 64-95A */
50#define IRQ_IXP2000_THDA3 19 /* thread 96-127A, IXP2800 only */
51#define IRQ_IXP2000_THDB0 24 /* thread 0-31B */
52#define IRQ_IXP2000_THDB1 25 /* thread 32-63B, IXP2800 only */
53#define IRQ_IXP2000_THDB2 26 /* thread 64-95B */
54#define IRQ_IXP2000_THDB3 27 /* thread 96-127B, IXP2800 only */
55
56/* define generic GPIOs */
57#define IRQ_IXP2000_GPIO0 32
58#define IRQ_IXP2000_GPIO1 33
59#define IRQ_IXP2000_GPIO2 34
60#define IRQ_IXP2000_GPIO3 35
61#define IRQ_IXP2000_GPIO4 36
62#define IRQ_IXP2000_GPIO5 37
63#define IRQ_IXP2000_GPIO6 38
64#define IRQ_IXP2000_GPIO7 39
65
66/* split off the 2 PCI sources */
67#define IRQ_IXP2000_PCIA 40
68#define IRQ_IXP2000_PCIB 41
69
70/* Int sources from IRQ_ERROR_STATUS */
71#define IRQ_IXP2000_DRAM0_MIN_ERR 42
72#define IRQ_IXP2000_DRAM0_MAJ_ERR 43
73#define IRQ_IXP2000_DRAM1_MIN_ERR 44
74#define IRQ_IXP2000_DRAM1_MAJ_ERR 45
75#define IRQ_IXP2000_DRAM2_MIN_ERR 46
76#define IRQ_IXP2000_DRAM2_MAJ_ERR 47
77/* 48-57 reserved */
78#define IRQ_IXP2000_SRAM0_ERR 58
79#define IRQ_IXP2000_SRAM1_ERR 59
80#define IRQ_IXP2000_SRAM2_ERR 60
81#define IRQ_IXP2000_SRAM3_ERR 61
82/* 62-65 reserved */
83#define IRQ_IXP2000_MEDIA_ERR 66
84#define IRQ_IXP2000_PCI_ERR 67
85#define IRQ_IXP2000_SP_INT 68
86
87#define NR_IXP2000_IRQS 69
88
89#define IXP2000_BOARD_IRQ(x) (NR_IXP2000_IRQS + (x))
90
91#define IXP2000_BOARD_IRQ_MASK(irq) (1 << (irq - NR_IXP2000_IRQS))
92
93#define IXP2000_ERR_IRQ_MASK(irq) ( 1 << (irq - IRQ_IXP2000_DRAM0_MIN_ERR))
94#define IXP2000_VALID_ERR_IRQ_MASK (\
95 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM0_MIN_ERR) | \
96 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM0_MAJ_ERR) | \
97 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM1_MIN_ERR) | \
98 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM1_MAJ_ERR) | \
99 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM2_MIN_ERR) | \
100 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM2_MAJ_ERR) | \
101 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_SRAM0_ERR) | \
102 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_SRAM1_ERR) | \
103 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_SRAM2_ERR) | \
104 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_SRAM3_ERR) | \
105 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_MEDIA_ERR) | \
106 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_PCI_ERR) | \
107 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_SP_INT) )
108
109/*
110 * This allows for all the on-chip sources plus up to 32 CPLD based
111 * IRQs. Should be more than enough.
112 */
113#define IXP2000_BOARD_IRQS 32
114#define NR_IRQS (NR_IXP2000_IRQS + IXP2000_BOARD_IRQS)
115
116
117/*
118 * IXDP2400 specific IRQs
119 */
120#define IRQ_IXDP2400_INGRESS_NPU IXP2000_BOARD_IRQ(0)
121#define IRQ_IXDP2400_ENET IXP2000_BOARD_IRQ(1)
122#define IRQ_IXDP2400_MEDIA_PCI IXP2000_BOARD_IRQ(2)
123#define IRQ_IXDP2400_MEDIA_SP IXP2000_BOARD_IRQ(3)
124#define IRQ_IXDP2400_SF_PCI IXP2000_BOARD_IRQ(4)
125#define IRQ_IXDP2400_SF_SP IXP2000_BOARD_IRQ(5)
126#define IRQ_IXDP2400_PMC IXP2000_BOARD_IRQ(6)
127#define IRQ_IXDP2400_TVM IXP2000_BOARD_IRQ(7)
128
129#define NR_IXDP2400_IRQS ((IRQ_IXDP2400_TVM)+1)
130#define IXDP2400_NR_IRQS NR_IXDP2400_IRQS - NR_IXP2000_IRQS
131
132/* IXDP2800 specific IRQs */
133#define IRQ_IXDP2800_EGRESS_ENET IXP2000_BOARD_IRQ(0)
134#define IRQ_IXDP2800_INGRESS_NPU IXP2000_BOARD_IRQ(1)
135#define IRQ_IXDP2800_PMC IXP2000_BOARD_IRQ(2)
136#define IRQ_IXDP2800_FABRIC_PCI IXP2000_BOARD_IRQ(3)
137#define IRQ_IXDP2800_FABRIC IXP2000_BOARD_IRQ(4)
138#define IRQ_IXDP2800_MEDIA IXP2000_BOARD_IRQ(5)
139
140#define NR_IXDP2800_IRQS ((IRQ_IXDP2800_MEDIA)+1)
141#define IXDP2800_NR_IRQS NR_IXDP2800_IRQS - NR_IXP2000_IRQS
142
143/*
144 * IRQs on both IXDP2x01 boards
145 */
146#define IRQ_IXDP2X01_SPCI_DB_0 IXP2000_BOARD_IRQ(2)
147#define IRQ_IXDP2X01_SPCI_DB_1 IXP2000_BOARD_IRQ(3)
148#define IRQ_IXDP2X01_SPCI_PMC_INTA IXP2000_BOARD_IRQ(4)
149#define IRQ_IXDP2X01_SPCI_PMC_INTB IXP2000_BOARD_IRQ(5)
150#define IRQ_IXDP2X01_SPCI_PMC_INTC IXP2000_BOARD_IRQ(6)
151#define IRQ_IXDP2X01_SPCI_PMC_INTD IXP2000_BOARD_IRQ(7)
152#define IRQ_IXDP2X01_SPCI_FIC_INT IXP2000_BOARD_IRQ(8)
153#define IRQ_IXDP2X01_IPMI_FROM IXP2000_BOARD_IRQ(16)
154#define IRQ_IXDP2X01_125US IXP2000_BOARD_IRQ(17)
155#define IRQ_IXDP2X01_DB_0_ADD IXP2000_BOARD_IRQ(18)
156#define IRQ_IXDP2X01_DB_1_ADD IXP2000_BOARD_IRQ(19)
157#define IRQ_IXDP2X01_UART1 IXP2000_BOARD_IRQ(21)
158#define IRQ_IXDP2X01_UART2 IXP2000_BOARD_IRQ(22)
159#define IRQ_IXDP2X01_FIC_ADD_INT IXP2000_BOARD_IRQ(24)
160#define IRQ_IXDP2X01_CS8900 IXP2000_BOARD_IRQ(25)
161#define IRQ_IXDP2X01_BBSRAM IXP2000_BOARD_IRQ(26)
162
163#define IXDP2X01_VALID_IRQ_MASK ( \
164 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_SPCI_DB_0) | \
165 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_SPCI_DB_1) | \
166 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_SPCI_PMC_INTA) | \
167 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_SPCI_PMC_INTB) | \
168 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_SPCI_PMC_INTC) | \
169 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_SPCI_PMC_INTD) | \
170 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_SPCI_FIC_INT) | \
171 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_IPMI_FROM) | \
172 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_125US) | \
173 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_DB_0_ADD) | \
174 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_DB_1_ADD) | \
175 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_UART1) | \
176 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_UART2) | \
177 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_FIC_ADD_INT) | \
178 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_CS8900) | \
179 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2X01_BBSRAM) )
180
181/*
182 * IXDP2401 specific IRQs
183 */
184#define IRQ_IXDP2401_INTA_82546 IXP2000_BOARD_IRQ(0)
185#define IRQ_IXDP2401_INTB_82546 IXP2000_BOARD_IRQ(1)
186
187#define IXDP2401_VALID_IRQ_MASK ( \
188 IXDP2X01_VALID_IRQ_MASK | \
189 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2401_INTA_82546) |\
190 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2401_INTB_82546))
191
192/*
193 * IXDP2801-specific IRQs
194 */
195#define IRQ_IXDP2801_RIV IXP2000_BOARD_IRQ(0)
196#define IRQ_IXDP2801_CNFG_MEDIA IXP2000_BOARD_IRQ(27)
197#define IRQ_IXDP2801_CLOCK_REF IXP2000_BOARD_IRQ(28)
198
199#define IXDP2801_VALID_IRQ_MASK ( \
200 IXDP2X01_VALID_IRQ_MASK | \
201 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2801_RIV) |\
202 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2801_CNFG_MEDIA) |\
203 IXP2000_BOARD_IRQ_MASK(IRQ_IXDP2801_CLOCK_REF))
204
205#define NR_IXDP2X01_IRQS ((IRQ_IXDP2801_CLOCK_REF) + 1)
206
207#endif /*_IRQS_H*/
diff --git a/arch/arm/mach-ixp2000/include/mach/ixdp2x00.h b/arch/arm/mach-ixp2000/include/mach/ixdp2x00.h
deleted file mode 100644
index 5df8479d9481..000000000000
--- a/arch/arm/mach-ixp2000/include/mach/ixdp2x00.h
+++ /dev/null
@@ -1,92 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/ixdp2x00.h
3 *
4 * Register and other defines for IXDP2[48]00 platforms
5 *
6 * Original Author: Naeem Afzal <naeem.m.afzal@intel.com>
7 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
8 *
9 * Copyright (C) 2002 Intel Corp.
10 * Copyright (C) 2003-2004 MontaVista Software, Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17#ifndef _IXDP2X00_H_
18#define _IXDP2X00_H_
19
20/*
21 * On board CPLD memory map
22 */
23#define IXDP2X00_PHYS_CPLD_BASE 0xc7000000
24#define IXDP2X00_VIRT_CPLD_BASE 0xfe000000
25#define IXDP2X00_CPLD_SIZE 0x00100000
26
27
28#define IXDP2X00_CPLD_REG(x) \
29 (volatile unsigned long *)(IXDP2X00_VIRT_CPLD_BASE | x)
30
31/*
32 * IXDP2400 CPLD registers
33 */
34#define IXDP2400_CPLD_SYSLED IXDP2X00_CPLD_REG(0x0)
35#define IXDP2400_CPLD_DISP_DATA IXDP2X00_CPLD_REG(0x4)
36#define IXDP2400_CPLD_CLOCK_SPEED IXDP2X00_CPLD_REG(0x8)
37#define IXDP2400_CPLD_INT_STAT IXDP2X00_CPLD_REG(0xc)
38#define IXDP2400_CPLD_REV IXDP2X00_CPLD_REG(0x10)
39#define IXDP2400_CPLD_SYS_CLK_M IXDP2X00_CPLD_REG(0x14)
40#define IXDP2400_CPLD_SYS_CLK_N IXDP2X00_CPLD_REG(0x18)
41#define IXDP2400_CPLD_INT_MASK IXDP2X00_CPLD_REG(0x48)
42
43/*
44 * IXDP2800 CPLD registers
45 */
46#define IXDP2800_CPLD_INT_STAT IXDP2X00_CPLD_REG(0x0)
47#define IXDP2800_CPLD_INT_MASK IXDP2X00_CPLD_REG(0x140)
48
49
50#define IXDP2X00_GPIO_I2C_ENABLE 0x02
51#define IXDP2X00_GPIO_SCL 0x07
52#define IXDP2X00_GPIO_SDA 0x06
53
54/*
55 * PCI devfns for on-board devices. We need these to be able to
56 * properly translate IRQs and for device removal.
57 */
58#define IXDP2400_SLAVE_ENET_DEVFN 0x18 /* Bus 1 */
59#define IXDP2400_MASTER_ENET_DEVFN 0x20 /* Bus 1 */
60#define IXDP2400_MEDIA_DEVFN 0x28 /* Bus 1 */
61#define IXDP2400_SWITCH_FABRIC_DEVFN 0x30 /* Bus 1 */
62
63#define IXDP2800_SLAVE_ENET_DEVFN 0x20 /* Bus 1 */
64#define IXDP2800_MASTER_ENET_DEVFN 0x18 /* Bus 1 */
65#define IXDP2800_SWITCH_FABRIC_DEVFN 0x30 /* Bus 1 */
66
67#define IXDP2X00_P2P_DEVFN 0x20 /* Bus 0 */
68#define IXDP2X00_21555_DEVFN 0x30 /* Bus 0 */
69#define IXDP2X00_SLAVE_NPU_DEVFN 0x28 /* Bus 1 */
70#define IXDP2X00_PMC_DEVFN 0x38 /* Bus 1 */
71#define IXDP2X00_MASTER_NPU_DEVFN 0x38 /* Bus 1 */
72
73#ifndef __ASSEMBLY__
74/*
75 * The master NPU is always PCI master.
76 */
77static inline unsigned int ixdp2x00_master_npu(void)
78{
79 return !!ixp2000_is_pcimaster();
80}
81
82/*
83 * Helper functions used by ixdp2400 and ixdp2800 specific code
84 */
85void ixdp2x00_init_irq(volatile unsigned long*, volatile unsigned long *, unsigned long);
86void ixdp2x00_slave_pci_postinit(void);
87void ixdp2x00_init_machine(void);
88void ixdp2x00_map_io(void);
89
90#endif
91
92#endif /*_IXDP2X00_H_ */
diff --git a/arch/arm/mach-ixp2000/include/mach/ixdp2x01.h b/arch/arm/mach-ixp2000/include/mach/ixdp2x01.h
deleted file mode 100644
index 4c1f04083e54..000000000000
--- a/arch/arm/mach-ixp2000/include/mach/ixdp2x01.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/ixdp2x01.h
3 *
4 * Platform definitions for IXDP2X01 && IXDP2801 systems
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2004 (c) MontaVista Software, Inc.
9 *
10 * Based on original code Copyright (c) 2002-2003 Intel Corporation
11 *
12 * This file is licensed under the terms of the GNU General Public
13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied.
15 */
16
17#ifndef __IXDP2X01_H__
18#define __IXDP2X01_H__
19
20#define IXDP2X01_PHYS_CPLD_BASE 0xc6024000
21#define IXDP2X01_VIRT_CPLD_BASE 0xfe000000
22#define IXDP2X01_CPLD_REGION_SIZE 0x00100000
23
24#define IXDP2X01_CPLD_VIRT_REG(reg) (volatile unsigned long*)(IXDP2X01_VIRT_CPLD_BASE | reg)
25#define IXDP2X01_CPLD_PHYS_REG(reg) (IXDP2X01_PHYS_CPLD_BASE | reg)
26
27#define IXDP2X01_UART1_VIRT_BASE IXDP2X01_CPLD_VIRT_REG(0x40)
28#define IXDP2X01_UART1_PHYS_BASE IXDP2X01_CPLD_PHYS_REG(0x40)
29
30#define IXDP2X01_UART2_VIRT_BASE IXDP2X01_CPLD_VIRT_REG(0x60)
31#define IXDP2X01_UART2_PHYS_BASE IXDP2X01_CPLD_PHYS_REG(0x60)
32
33#define IXDP2X01_CS8900_VIRT_BASE IXDP2X01_CPLD_VIRT_REG(0x80)
34#define IXDP2X01_CS8900_VIRT_END (IXDP2X01_CS8900_VIRT_BASE + 16)
35
36#define IXDP2X01_CPLD_RESET_REG IXDP2X01_CPLD_VIRT_REG(0x00)
37#define IXDP2X01_INT_MASK_SET_REG IXDP2X01_CPLD_VIRT_REG(0x08)
38#define IXDP2X01_INT_STAT_REG IXDP2X01_CPLD_VIRT_REG(0x0C)
39#define IXDP2X01_INT_RAW_REG IXDP2X01_CPLD_VIRT_REG(0x10)
40#define IXDP2X01_INT_MASK_CLR_REG IXDP2X01_INT_RAW_REG
41#define IXDP2X01_INT_SIM_REG IXDP2X01_CPLD_VIRT_REG(0x14)
42
43#define IXDP2X01_CPLD_FLASH_REG IXDP2X01_CPLD_VIRT_REG(0x20)
44
45#define IXDP2X01_CPLD_FLASH_INTERN 0x8000
46#define IXDP2X01_CPLD_FLASH_BANK_MASK 0xF
47#define IXDP2X01_FLASH_WINDOW_BITS 25
48#define IXDP2X01_FLASH_WINDOW_SIZE (1 << IXDP2X01_FLASH_WINDOW_BITS)
49#define IXDP2X01_FLASH_WINDOW_MASK (IXDP2X01_FLASH_WINDOW_SIZE - 1)
50
51#define IXDP2X01_UART_CLK 1843200
52
53#define IXDP2X01_GPIO_I2C_ENABLE 0x02
54#define IXDP2X01_GPIO_SCL 0x07
55#define IXDP2X01_GPIO_SDA 0x06
56
57#endif /* __IXDP2x01_H__ */
diff --git a/arch/arm/mach-ixp2000/include/mach/ixp2000-regs.h b/arch/arm/mach-ixp2000/include/mach/ixp2000-regs.h
deleted file mode 100644
index 822f63f2f4a2..000000000000
--- a/arch/arm/mach-ixp2000/include/mach/ixp2000-regs.h
+++ /dev/null
@@ -1,451 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/ixp2000-regs.h
3 *
4 * Chipset register definitions for IXP2400/2800 based systems.
5 *
6 * Original Author: Naeem Afzal <naeem.m.afzal@intel.com>
7 *
8 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
9 *
10 * Copyright (C) 2002 Intel Corp.
11 * Copyright (C) 2003-2004 MontaVista Software, Inc.
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 */
18#ifndef _IXP2000_REGS_H_
19#define _IXP2000_REGS_H_
20
21/*
22 * IXP2000 linux memory map:
23 *
24 * virt phys size
25 * fb000000 db000000 16M PCI CFG1
26 * fc000000 da000000 16M PCI CFG0
27 * fd000000 d8000000 16M PCI I/O
28 * fe[0-7]00000 8M per-platform mappings
29 * fe900000 80000000 1M SRAM #0 (first MB)
30 * fea00000 cb400000 1M SCRATCH ring get/put
31 * feb00000 c8000000 1M MSF
32 * fec00000 df000000 1M PCI CSRs
33 * fed00000 de000000 1M PCI CREG
34 * fee00000 d6000000 1M INTCTL
35 * fef00000 c0000000 1M CAP
36 */
37
38/*
39 * Static I/O regions.
40 *
41 * Most of the registers are clumped in 4K regions spread throughout
42 * the 0xc0000000 -> 0xc0100000 address range, but we just map in
43 * the whole range using a single 1 MB section instead of small
44 * 4K pages.
45 *
46 * CAP stands for CSR Access Proxy.
47 *
48 * If you change the virtual address of this mapping, please propagate
49 * the change to arch/arm/kernel/debug.S, which hardcodes the virtual
50 * address of the UART located in this region.
51 */
52
53#define IXP2000_CAP_PHYS_BASE 0xc0000000
54#define IXP2000_CAP_VIRT_BASE 0xfef00000
55#define IXP2000_CAP_SIZE 0x00100000
56
57/*
58 * Addresses for specific on-chip peripherals.
59 */
60#define IXP2000_SLOWPORT_CSR_VIRT_BASE 0xfef80000
61#define IXP2000_GLOBAL_REG_VIRT_BASE 0xfef04000
62#define IXP2000_UART_PHYS_BASE 0xc0030000
63#define IXP2000_UART_VIRT_BASE 0xfef30000
64#define IXP2000_TIMER_VIRT_BASE 0xfef20000
65#define IXP2000_UENGINE_CSR_VIRT_BASE 0xfef18000
66#define IXP2000_GPIO_VIRT_BASE 0xfef10000
67
68/*
69 * Devices outside of the 0xc0000000 -> 0xc0100000 range. The virtual
70 * addresses of the INTCTL and PCI_CSR mappings are hardcoded in
71 * entry-macro.S, so if you ever change these please propagate
72 * the change.
73 */
74#define IXP2000_INTCTL_PHYS_BASE 0xd6000000
75#define IXP2000_INTCTL_VIRT_BASE 0xfee00000
76#define IXP2000_INTCTL_SIZE 0x00100000
77
78#define IXP2000_PCI_CREG_PHYS_BASE 0xde000000
79#define IXP2000_PCI_CREG_VIRT_BASE 0xfed00000
80#define IXP2000_PCI_CREG_SIZE 0x00100000
81
82#define IXP2000_PCI_CSR_PHYS_BASE 0xdf000000
83#define IXP2000_PCI_CSR_VIRT_BASE 0xfec00000
84#define IXP2000_PCI_CSR_SIZE 0x00100000
85
86#define IXP2000_MSF_PHYS_BASE 0xc8000000
87#define IXP2000_MSF_VIRT_BASE 0xfeb00000
88#define IXP2000_MSF_SIZE 0x00100000
89
90#define IXP2000_SCRATCH_RING_PHYS_BASE 0xcb400000
91#define IXP2000_SCRATCH_RING_VIRT_BASE 0xfea00000
92#define IXP2000_SCRATCH_RING_SIZE 0x00100000
93
94#define IXP2000_SRAM0_PHYS_BASE 0x80000000
95#define IXP2000_SRAM0_VIRT_BASE 0xfe900000
96#define IXP2000_SRAM0_SIZE 0x00100000
97
98#define IXP2000_PCI_IO_PHYS_BASE 0xd8000000
99#define IXP2000_PCI_IO_VIRT_BASE 0xfd000000
100#define IXP2000_PCI_IO_SIZE 0x01000000
101
102#define IXP2000_PCI_CFG0_PHYS_BASE 0xda000000
103#define IXP2000_PCI_CFG0_VIRT_BASE 0xfc000000
104#define IXP2000_PCI_CFG0_SIZE 0x01000000
105
106#define IXP2000_PCI_CFG1_PHYS_BASE 0xdb000000
107#define IXP2000_PCI_CFG1_VIRT_BASE 0xfb000000
108#define IXP2000_PCI_CFG1_SIZE 0x01000000
109
110/*
111 * Timers
112 */
113#define IXP2000_TIMER_REG(x) ((volatile unsigned long*)(IXP2000_TIMER_VIRT_BASE | (x)))
114/* Timer control */
115#define IXP2000_T1_CTL IXP2000_TIMER_REG(0x00)
116#define IXP2000_T2_CTL IXP2000_TIMER_REG(0x04)
117#define IXP2000_T3_CTL IXP2000_TIMER_REG(0x08)
118#define IXP2000_T4_CTL IXP2000_TIMER_REG(0x0c)
119/* Store initial value */
120#define IXP2000_T1_CLD IXP2000_TIMER_REG(0x10)
121#define IXP2000_T2_CLD IXP2000_TIMER_REG(0x14)
122#define IXP2000_T3_CLD IXP2000_TIMER_REG(0x18)
123#define IXP2000_T4_CLD IXP2000_TIMER_REG(0x1c)
124/* Read current value */
125#define IXP2000_T1_CSR IXP2000_TIMER_REG(0x20)
126#define IXP2000_T2_CSR IXP2000_TIMER_REG(0x24)
127#define IXP2000_T3_CSR IXP2000_TIMER_REG(0x28)
128#define IXP2000_T4_CSR IXP2000_TIMER_REG(0x2c)
129/* Clear associated timer interrupt */
130#define IXP2000_T1_CLR IXP2000_TIMER_REG(0x30)
131#define IXP2000_T2_CLR IXP2000_TIMER_REG(0x34)
132#define IXP2000_T3_CLR IXP2000_TIMER_REG(0x38)
133#define IXP2000_T4_CLR IXP2000_TIMER_REG(0x3c)
134/* Timer watchdog enable for T4 */
135#define IXP2000_TWDE IXP2000_TIMER_REG(0x40)
136
137#define WDT_ENABLE 0x00000001
138#define TIMER_DIVIDER_256 0x00000008
139#define TIMER_ENABLE 0x00000080
140#define IRQ_MASK_TIMER1 (1 << 4)
141
142/*
143 * Interrupt controller registers
144 */
145#define IXP2000_INTCTL_REG(x) (volatile unsigned long*)(IXP2000_INTCTL_VIRT_BASE | (x))
146#define IXP2000_IRQ_STATUS IXP2000_INTCTL_REG(0x08)
147#define IXP2000_IRQ_ENABLE IXP2000_INTCTL_REG(0x10)
148#define IXP2000_IRQ_ENABLE_SET IXP2000_INTCTL_REG(0x10)
149#define IXP2000_IRQ_ENABLE_CLR IXP2000_INTCTL_REG(0x18)
150#define IXP2000_FIQ_ENABLE_CLR IXP2000_INTCTL_REG(0x14)
151#define IXP2000_IRQ_ERR_STATUS IXP2000_INTCTL_REG(0x24)
152#define IXP2000_IRQ_ERR_ENABLE_SET IXP2000_INTCTL_REG(0x2c)
153#define IXP2000_FIQ_ERR_ENABLE_CLR IXP2000_INTCTL_REG(0x30)
154#define IXP2000_IRQ_ERR_ENABLE_CLR IXP2000_INTCTL_REG(0x34)
155#define IXP2000_IRQ_THD_RAW_STATUS_A_0 IXP2000_INTCTL_REG(0x60)
156#define IXP2000_IRQ_THD_RAW_STATUS_A_1 IXP2000_INTCTL_REG(0x64)
157#define IXP2000_IRQ_THD_RAW_STATUS_A_2 IXP2000_INTCTL_REG(0x68)
158#define IXP2000_IRQ_THD_RAW_STATUS_A_3 IXP2000_INTCTL_REG(0x6c)
159#define IXP2000_IRQ_THD_RAW_STATUS_B_0 IXP2000_INTCTL_REG(0x80)
160#define IXP2000_IRQ_THD_RAW_STATUS_B_1 IXP2000_INTCTL_REG(0x84)
161#define IXP2000_IRQ_THD_RAW_STATUS_B_2 IXP2000_INTCTL_REG(0x88)
162#define IXP2000_IRQ_THD_RAW_STATUS_B_3 IXP2000_INTCTL_REG(0x8c)
163#define IXP2000_IRQ_THD_STATUS_A_0 IXP2000_INTCTL_REG(0xe0)
164#define IXP2000_IRQ_THD_STATUS_A_1 IXP2000_INTCTL_REG(0xe4)
165#define IXP2000_IRQ_THD_STATUS_A_2 IXP2000_INTCTL_REG(0xe8)
166#define IXP2000_IRQ_THD_STATUS_A_3 IXP2000_INTCTL_REG(0xec)
167#define IXP2000_IRQ_THD_STATUS_B_0 IXP2000_INTCTL_REG(0x100)
168#define IXP2000_IRQ_THD_STATUS_B_1 IXP2000_INTCTL_REG(0x104)
169#define IXP2000_IRQ_THD_STATUS_B_2 IXP2000_INTCTL_REG(0x108)
170#define IXP2000_IRQ_THD_STATUS_B_3 IXP2000_INTCTL_REG(0x10c)
171#define IXP2000_IRQ_THD_ENABLE_SET_A_0 IXP2000_INTCTL_REG(0x160)
172#define IXP2000_IRQ_THD_ENABLE_SET_A_1 IXP2000_INTCTL_REG(0x164)
173#define IXP2000_IRQ_THD_ENABLE_SET_A_2 IXP2000_INTCTL_REG(0x168)
174#define IXP2000_IRQ_THD_ENABLE_SET_A_3 IXP2000_INTCTL_REG(0x16c)
175#define IXP2000_IRQ_THD_ENABLE_SET_B_0 IXP2000_INTCTL_REG(0x180)
176#define IXP2000_IRQ_THD_ENABLE_SET_B_1 IXP2000_INTCTL_REG(0x184)
177#define IXP2000_IRQ_THD_ENABLE_SET_B_2 IXP2000_INTCTL_REG(0x188)
178#define IXP2000_IRQ_THD_ENABLE_SET_B_3 IXP2000_INTCTL_REG(0x18c)
179#define IXP2000_IRQ_THD_ENABLE_CLEAR_A_0 IXP2000_INTCTL_REG(0x1e0)
180#define IXP2000_IRQ_THD_ENABLE_CLEAR_A_1 IXP2000_INTCTL_REG(0x1e4)
181#define IXP2000_IRQ_THD_ENABLE_CLEAR_A_2 IXP2000_INTCTL_REG(0x1e8)
182#define IXP2000_IRQ_THD_ENABLE_CLEAR_A_3 IXP2000_INTCTL_REG(0x1ec)
183#define IXP2000_IRQ_THD_ENABLE_CLEAR_B_0 IXP2000_INTCTL_REG(0x200)
184#define IXP2000_IRQ_THD_ENABLE_CLEAR_B_1 IXP2000_INTCTL_REG(0x204)
185#define IXP2000_IRQ_THD_ENABLE_CLEAR_B_2 IXP2000_INTCTL_REG(0x208)
186#define IXP2000_IRQ_THD_ENABLE_CLEAR_B_3 IXP2000_INTCTL_REG(0x20c)
187
188/*
189 * Mask of valid IRQs in the 32-bit IRQ register. We use
190 * this to mark certain IRQs as being invalid.
191 */
192#define IXP2000_VALID_IRQ_MASK 0x0f0fffff
193
194/*
195 * PCI config register access from core
196 */
197#define IXP2000_PCI_CREG(x) (volatile unsigned long*)(IXP2000_PCI_CREG_VIRT_BASE | (x))
198#define IXP2000_PCI_CMDSTAT IXP2000_PCI_CREG(0x04)
199#define IXP2000_PCI_CSR_BAR IXP2000_PCI_CREG(0x10)
200#define IXP2000_PCI_SRAM_BAR IXP2000_PCI_CREG(0x14)
201#define IXP2000_PCI_SDRAM_BAR IXP2000_PCI_CREG(0x18)
202
203/*
204 * PCI CSRs
205 */
206#define IXP2000_PCI_CSR(x) (volatile unsigned long*)(IXP2000_PCI_CSR_VIRT_BASE | (x))
207
208/*
209 * PCI outbound interrupts
210 */
211#define IXP2000_PCI_OUT_INT_STATUS IXP2000_PCI_CSR(0x30)
212#define IXP2000_PCI_OUT_INT_MASK IXP2000_PCI_CSR(0x34)
213/*
214 * PCI communications
215 */
216#define IXP2000_PCI_MAILBOX0 IXP2000_PCI_CSR(0x50)
217#define IXP2000_PCI_MAILBOX1 IXP2000_PCI_CSR(0x54)
218#define IXP2000_PCI_MAILBOX2 IXP2000_PCI_CSR(0x58)
219#define IXP2000_PCI_MAILBOX3 IXP2000_PCI_CSR(0x5C)
220#define IXP2000_XSCALE_DOORBELL IXP2000_PCI_CSR(0x60)
221#define IXP2000_XSCALE_DOORBELL_SETUP IXP2000_PCI_CSR(0x64)
222#define IXP2000_PCI_DOORBELL IXP2000_PCI_CSR(0x70)
223#define IXP2000_PCI_DOORBELL_SETUP IXP2000_PCI_CSR(0x74)
224
225/*
226 * DMA engines
227 */
228#define IXP2000_PCI_CH1_BYTE_CNT IXP2000_PCI_CSR(0x80)
229#define IXP2000_PCI_CH1_ADDR IXP2000_PCI_CSR(0x84)
230#define IXP2000_PCI_CH1_DRAM_ADDR IXP2000_PCI_CSR(0x88)
231#define IXP2000_PCI_CH1_DESC_PTR IXP2000_PCI_CSR(0x8C)
232#define IXP2000_PCI_CH1_CNTRL IXP2000_PCI_CSR(0x90)
233#define IXP2000_PCI_CH1_ME_PARAM IXP2000_PCI_CSR(0x94)
234#define IXP2000_PCI_CH2_BYTE_CNT IXP2000_PCI_CSR(0xA0)
235#define IXP2000_PCI_CH2_ADDR IXP2000_PCI_CSR(0xA4)
236#define IXP2000_PCI_CH2_DRAM_ADDR IXP2000_PCI_CSR(0xA8)
237#define IXP2000_PCI_CH2_DESC_PTR IXP2000_PCI_CSR(0xAC)
238#define IXP2000_PCI_CH2_CNTRL IXP2000_PCI_CSR(0xB0)
239#define IXP2000_PCI_CH2_ME_PARAM IXP2000_PCI_CSR(0xB4)
240#define IXP2000_PCI_CH3_BYTE_CNT IXP2000_PCI_CSR(0xC0)
241#define IXP2000_PCI_CH3_ADDR IXP2000_PCI_CSR(0xC4)
242#define IXP2000_PCI_CH3_DRAM_ADDR IXP2000_PCI_CSR(0xC8)
243#define IXP2000_PCI_CH3_DESC_PTR IXP2000_PCI_CSR(0xCC)
244#define IXP2000_PCI_CH3_CNTRL IXP2000_PCI_CSR(0xD0)
245#define IXP2000_PCI_CH3_ME_PARAM IXP2000_PCI_CSR(0xD4)
246#define IXP2000_DMA_INF_MODE IXP2000_PCI_CSR(0xE0)
247/*
248 * Size masks for BARs
249 */
250#define IXP2000_PCI_SRAM_BASE_ADDR_MASK IXP2000_PCI_CSR(0xFC)
251#define IXP2000_PCI_DRAM_BASE_ADDR_MASK IXP2000_PCI_CSR(0x100)
252/*
253 * Control and uEngine related
254 */
255#define IXP2000_PCI_CONTROL IXP2000_PCI_CSR(0x13C)
256#define IXP2000_PCI_ADDR_EXT IXP2000_PCI_CSR(0x140)
257#define IXP2000_PCI_ME_PUSH_STATUS IXP2000_PCI_CSR(0x148)
258#define IXP2000_PCI_ME_PUSH_EN IXP2000_PCI_CSR(0x14C)
259#define IXP2000_PCI_ERR_STATUS IXP2000_PCI_CSR(0x150)
260#define IXP2000_PCI_ERR_ENABLE IXP2000_PCI_CSR(0x154)
261/*
262 * Inbound PCI interrupt control
263 */
264#define IXP2000_PCI_XSCALE_INT_STATUS IXP2000_PCI_CSR(0x158)
265#define IXP2000_PCI_XSCALE_INT_ENABLE IXP2000_PCI_CSR(0x15C)
266
267#define IXP2000_PCICNTL_PNR (1<<17) /* PCI not Reset bit of PCI_CONTROL */
268#define IXP2000_PCICNTL_PCF (1<<28) /* PCI Central function bit */
269#define IXP2000_XSCALE_INT (1<<1) /* Interrupt from XScale to PCI */
270
271/* These are from the IRQ register in the PCI ISR register */
272#define PCI_CONTROL_BE_DEO (1 << 22) /* Big Endian Data Enable Out */
273#define PCI_CONTROL_BE_DEI (1 << 21) /* Big Endian Data Enable In */
274#define PCI_CONTROL_BE_BEO (1 << 20) /* Big Endian Byte Enable Out */
275#define PCI_CONTROL_BE_BEI (1 << 19) /* Big Endian Byte Enable In */
276#define PCI_CONTROL_IEE (1 << 17) /* I/O cycle Endian swap Enable */
277
278#define IXP2000_PCI_RST_REL (1 << 2)
279#define CFG_RST_DIR (*IXP2000_PCI_CONTROL & IXP2000_PCICNTL_PCF)
280#define CFG_PCI_BOOT_HOST (1 << 2)
281#define CFG_BOOT_PROM (1 << 1)
282
283/*
284 * SlowPort CSRs
285 *
286 * The slowport is used to access things like flash, SONET framer control
287 * ports, slave microprocessors, CPLDs, and others of chip memory mapped
288 * peripherals.
289 */
290#define SLOWPORT_CSR(x) (volatile unsigned long*)(IXP2000_SLOWPORT_CSR_VIRT_BASE | (x))
291
292#define IXP2000_SLOWPORT_CCR SLOWPORT_CSR(0x00)
293#define IXP2000_SLOWPORT_WTC1 SLOWPORT_CSR(0x04)
294#define IXP2000_SLOWPORT_WTC2 SLOWPORT_CSR(0x08)
295#define IXP2000_SLOWPORT_RTC1 SLOWPORT_CSR(0x0c)
296#define IXP2000_SLOWPORT_RTC2 SLOWPORT_CSR(0x10)
297#define IXP2000_SLOWPORT_FSR SLOWPORT_CSR(0x14)
298#define IXP2000_SLOWPORT_PCR SLOWPORT_CSR(0x18)
299#define IXP2000_SLOWPORT_ADC SLOWPORT_CSR(0x1C)
300#define IXP2000_SLOWPORT_FAC SLOWPORT_CSR(0x20)
301#define IXP2000_SLOWPORT_FRM SLOWPORT_CSR(0x24)
302#define IXP2000_SLOWPORT_FIN SLOWPORT_CSR(0x28)
303
304/*
305 * CCR values.
306 * The CCR configures the clock division for the slowport interface.
307 */
308#define SLOWPORT_CCR_DIV_1 0x00
309#define SLOWPORT_CCR_DIV_2 0x01
310#define SLOWPORT_CCR_DIV_4 0x02
311#define SLOWPORT_CCR_DIV_6 0x03
312#define SLOWPORT_CCR_DIV_8 0x04
313#define SLOWPORT_CCR_DIV_10 0x05
314#define SLOWPORT_CCR_DIV_12 0x06
315#define SLOWPORT_CCR_DIV_14 0x07
316#define SLOWPORT_CCR_DIV_16 0x08
317#define SLOWPORT_CCR_DIV_18 0x09
318#define SLOWPORT_CCR_DIV_20 0x0a
319#define SLOWPORT_CCR_DIV_22 0x0b
320#define SLOWPORT_CCR_DIV_24 0x0c
321#define SLOWPORT_CCR_DIV_26 0x0d
322#define SLOWPORT_CCR_DIV_28 0x0e
323#define SLOWPORT_CCR_DIV_30 0x0f
324
325/*
326 * PCR values. PCR configure the mode of the interface.
327 */
328#define SLOWPORT_MODE_FLASH 0x00
329#define SLOWPORT_MODE_LUCENT 0x01
330#define SLOWPORT_MODE_PMC_SIERRA 0x02
331#define SLOWPORT_MODE_INTEL_UP 0x03
332#define SLOWPORT_MODE_MOTOROLA_UP 0x04
333
334/*
335 * ADC values. Defines data and address bus widths.
336 */
337#define SLOWPORT_ADDR_WIDTH_8 0x00
338#define SLOWPORT_ADDR_WIDTH_16 0x01
339#define SLOWPORT_ADDR_WIDTH_24 0x02
340#define SLOWPORT_ADDR_WIDTH_32 0x03
341#define SLOWPORT_DATA_WIDTH_8 0x00
342#define SLOWPORT_DATA_WIDTH_16 0x10
343#define SLOWPORT_DATA_WIDTH_24 0x20
344#define SLOWPORT_DATA_WIDTH_32 0x30
345
346/*
347 * Masks and shifts for various fields in the WTC and RTC registers.
348 */
349#define SLOWPORT_WRTC_MASK_HD 0x0003
350#define SLOWPORT_WRTC_MASK_PW 0x003c
351#define SLOWPORT_WRTC_MASK_SU 0x03c0
352
353#define SLOWPORT_WRTC_SHIFT_HD 0x00
354#define SLOWPORT_WRTC_SHIFT_SU 0x02
355#define SLOWPORT_WRTC_SHFIT_PW 0x06
356
357
358/*
359 * GPIO registers & GPIO interface.
360 */
361#define IXP2000_GPIO_REG(x) ((volatile unsigned long*)(IXP2000_GPIO_VIRT_BASE+(x)))
362#define IXP2000_GPIO_PLR IXP2000_GPIO_REG(0x00)
363#define IXP2000_GPIO_PDPR IXP2000_GPIO_REG(0x04)
364#define IXP2000_GPIO_PDSR IXP2000_GPIO_REG(0x08)
365#define IXP2000_GPIO_PDCR IXP2000_GPIO_REG(0x0c)
366#define IXP2000_GPIO_POPR IXP2000_GPIO_REG(0x10)
367#define IXP2000_GPIO_POSR IXP2000_GPIO_REG(0x14)
368#define IXP2000_GPIO_POCR IXP2000_GPIO_REG(0x18)
369#define IXP2000_GPIO_REDR IXP2000_GPIO_REG(0x1c)
370#define IXP2000_GPIO_FEDR IXP2000_GPIO_REG(0x20)
371#define IXP2000_GPIO_EDSR IXP2000_GPIO_REG(0x24)
372#define IXP2000_GPIO_LSHR IXP2000_GPIO_REG(0x28)
373#define IXP2000_GPIO_LSLR IXP2000_GPIO_REG(0x2c)
374#define IXP2000_GPIO_LDSR IXP2000_GPIO_REG(0x30)
375#define IXP2000_GPIO_INER IXP2000_GPIO_REG(0x34)
376#define IXP2000_GPIO_INSR IXP2000_GPIO_REG(0x38)
377#define IXP2000_GPIO_INCR IXP2000_GPIO_REG(0x3c)
378#define IXP2000_GPIO_INST IXP2000_GPIO_REG(0x40)
379
380/*
381 * "Global" registers...whatever that's supposed to mean.
382 */
383#define GLOBAL_REG_BASE (IXP2000_GLOBAL_REG_VIRT_BASE + 0x0a00)
384#define GLOBAL_REG(x) (volatile unsigned long*)(GLOBAL_REG_BASE | (x))
385
386#define IXP2000_MAJ_PROD_TYPE_MASK 0x001F0000
387#define IXP2000_MAJ_PROD_TYPE_IXP2000 0x00000000
388#define IXP2000_MIN_PROD_TYPE_MASK 0x0000FF00
389#define IXP2000_MIN_PROD_TYPE_IXP2400 0x00000200
390#define IXP2000_MIN_PROD_TYPE_IXP2850 0x00000100
391#define IXP2000_MIN_PROD_TYPE_IXP2800 0x00000000
392#define IXP2000_MAJ_REV_MASK 0x000000F0
393#define IXP2000_MIN_REV_MASK 0x0000000F
394#define IXP2000_PROD_ID_MASK 0xFFFFFFFF
395
396#define IXP2000_PRODUCT_ID GLOBAL_REG(0x00)
397#define IXP2000_MISC_CONTROL GLOBAL_REG(0x04)
398#define IXP2000_MSF_CLK_CNTRL GLOBAL_REG(0x08)
399#define IXP2000_RESET0 GLOBAL_REG(0x0c)
400#define IXP2000_RESET1 GLOBAL_REG(0x10)
401#define IXP2000_CCR GLOBAL_REG(0x14)
402#define IXP2000_STRAP_OPTIONS GLOBAL_REG(0x18)
403
404#define RSTALL (1 << 16)
405#define WDT_RESET_ENABLE 0x01000000
406
407
408/*
409 * MSF registers. The IXP2400 and IXP2800 have somewhat different MSF
410 * units, but the registers that differ between the two don't overlap,
411 * so we can have one register list for both.
412 */
413#define IXP2000_MSF_REG(x) ((volatile unsigned long*)(IXP2000_MSF_VIRT_BASE + (x)))
414#define IXP2000_MSF_RX_CONTROL IXP2000_MSF_REG(0x0000)
415#define IXP2000_MSF_TX_CONTROL IXP2000_MSF_REG(0x0004)
416#define IXP2000_MSF_INTERRUPT_STATUS IXP2000_MSF_REG(0x0008)
417#define IXP2000_MSF_INTERRUPT_ENABLE IXP2000_MSF_REG(0x000c)
418#define IXP2000_MSF_CSIX_TYPE_MAP IXP2000_MSF_REG(0x0010)
419#define IXP2000_MSF_FC_EGRESS_STATUS IXP2000_MSF_REG(0x0014)
420#define IXP2000_MSF_FC_INGRESS_STATUS IXP2000_MSF_REG(0x0018)
421#define IXP2000_MSF_HWM_CONTROL IXP2000_MSF_REG(0x0024)
422#define IXP2000_MSF_FC_STATUS_OVERRIDE IXP2000_MSF_REG(0x0028)
423#define IXP2000_MSF_CLOCK_CONTROL IXP2000_MSF_REG(0x002c)
424#define IXP2000_MSF_RX_PORT_MAP IXP2000_MSF_REG(0x0040)
425#define IXP2000_MSF_RBUF_ELEMENT_DONE IXP2000_MSF_REG(0x0044)
426#define IXP2000_MSF_RX_MPHY_POLL_LIMIT IXP2000_MSF_REG(0x0048)
427#define IXP2000_MSF_RX_CALENDAR_LENGTH IXP2000_MSF_REG(0x0048)
428#define IXP2000_MSF_RX_THREAD_FREELIST_TIMEOUT_0 IXP2000_MSF_REG(0x0050)
429#define IXP2000_MSF_RX_THREAD_FREELIST_TIMEOUT_1 IXP2000_MSF_REG(0x0054)
430#define IXP2000_MSF_RX_THREAD_FREELIST_TIMEOUT_2 IXP2000_MSF_REG(0x0058)
431#define IXP2000_MSF_TX_SEQUENCE_0 IXP2000_MSF_REG(0x0060)
432#define IXP2000_MSF_TX_SEQUENCE_1 IXP2000_MSF_REG(0x0064)
433#define IXP2000_MSF_TX_SEQUENCE_2 IXP2000_MSF_REG(0x0068)
434#define IXP2000_MSF_TX_MPHY_POLL_LIMIT IXP2000_MSF_REG(0x0070)
435#define IXP2000_MSF_TX_CALENDAR_LENGTH IXP2000_MSF_REG(0x0070)
436#define IXP2000_MSF_RX_UP_CONTROL_0 IXP2000_MSF_REG(0x0080)
437#define IXP2000_MSF_RX_UP_CONTROL_1 IXP2000_MSF_REG(0x0084)
438#define IXP2000_MSF_RX_UP_CONTROL_2 IXP2000_MSF_REG(0x0088)
439#define IXP2000_MSF_RX_UP_CONTROL_3 IXP2000_MSF_REG(0x008c)
440#define IXP2000_MSF_TX_UP_CONTROL_0 IXP2000_MSF_REG(0x0090)
441#define IXP2000_MSF_TX_UP_CONTROL_1 IXP2000_MSF_REG(0x0094)
442#define IXP2000_MSF_TX_UP_CONTROL_2 IXP2000_MSF_REG(0x0098)
443#define IXP2000_MSF_TX_UP_CONTROL_3 IXP2000_MSF_REG(0x009c)
444#define IXP2000_MSF_TRAIN_DATA IXP2000_MSF_REG(0x00a0)
445#define IXP2000_MSF_TRAIN_CALENDAR IXP2000_MSF_REG(0x00a4)
446#define IXP2000_MSF_TRAIN_FLOW_CONTROL IXP2000_MSF_REG(0x00a8)
447#define IXP2000_MSF_TX_CALENDAR_0 IXP2000_MSF_REG(0x1000)
448#define IXP2000_MSF_RX_PORT_CALENDAR_STATUS IXP2000_MSF_REG(0x1400)
449
450
451#endif /* _IXP2000_H_ */
diff --git a/arch/arm/mach-ixp2000/include/mach/memory.h b/arch/arm/mach-ixp2000/include/mach/memory.h
deleted file mode 100644
index 5f0c4fd4076a..000000000000
--- a/arch/arm/mach-ixp2000/include/mach/memory.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/memory.h
3 *
4 * Copyright (c) 2002 Intel Corp.
5 * Copyright (c) 2003-2004 MontaVista Software, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef __ASM_ARCH_MEMORY_H
14#define __ASM_ARCH_MEMORY_H
15
16#define PLAT_PHYS_OFFSET UL(0x00000000)
17
18#include <mach/ixp2000-regs.h>
19
20#define IXP2000_PCI_SDRAM_OFFSET (*IXP2000_PCI_SDRAM_BAR & 0xfffffff0)
21
22#define __phys_to_bus(x) ((x) + (IXP2000_PCI_SDRAM_OFFSET - PHYS_OFFSET))
23#define __bus_to_phys(x) ((x) - (IXP2000_PCI_SDRAM_OFFSET - PHYS_OFFSET))
24
25#define __virt_to_bus(v) __phys_to_bus(__virt_to_phys(v))
26#define __bus_to_virt(b) __phys_to_virt(__bus_to_phys(b))
27#define __pfn_to_bus(p) __phys_to_bus(__pfn_to_phys(p))
28#define __bus_to_pfn(b) __phys_to_pfn(__bus_to_phys(b))
29
30#endif
31
diff --git a/arch/arm/mach-ixp2000/include/mach/platform.h b/arch/arm/mach-ixp2000/include/mach/platform.h
deleted file mode 100644
index bb0f8dcf9ee1..000000000000
--- a/arch/arm/mach-ixp2000/include/mach/platform.h
+++ /dev/null
@@ -1,153 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/platform.h
3 *
4 * Various bits of code used by platform-level code.
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2004 (c) MontaVista Software, Inc.
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13 */
14
15
16#ifndef __ASSEMBLY__
17
18static inline unsigned long ixp2000_reg_read(volatile void *reg)
19{
20 return *((volatile unsigned long *)reg);
21}
22
23static inline void ixp2000_reg_write(volatile void *reg, unsigned long val)
24{
25 *((volatile unsigned long *)reg) = val;
26}
27
28/*
29 * On the IXP2400, we can't use XCB=000 due to chip bugs. We use
30 * XCB=101 instead, but that makes all I/O accesses bufferable. This
31 * is not a problem in general, but we do have to be slightly more
32 * careful because I/O writes are no longer automatically flushed out
33 * of the write buffer.
34 *
35 * In cases where we want to make sure that a write has been flushed
36 * out of the write buffer before we proceed, for example when masking
37 * a device interrupt before re-enabling IRQs in CPSR, we can use this
38 * function, ixp2000_reg_wrb, which performs a write, a readback, and
39 * issues a dummy instruction dependent on the value of the readback
40 * (mov rX, rX) to make sure that the readback has completed before we
41 * continue.
42 */
43static inline void ixp2000_reg_wrb(volatile void *reg, unsigned long val)
44{
45 unsigned long dummy;
46
47 *((volatile unsigned long *)reg) = val;
48
49 dummy = *((volatile unsigned long *)reg);
50 __asm__ __volatile__("mov %0, %0" : "+r" (dummy));
51}
52
53/*
54 * Boards may multiplex different devices on the 2nd channel of
55 * the slowport interface that each need different configuration
56 * settings. For example, the IXDP2400 uses channel 2 on the interface
57 * to access the CPLD, the switch fabric card, and the media card. Each
58 * one needs a different mode so drivers must save/restore the mode
59 * before and after each operation.
60 *
61 * acquire_slowport(&your_config);
62 * ...
63 * do slowport operations
64 * ...
65 * release_slowport();
66 *
67 * Note that while you have the slowport, you are holding a spinlock,
68 * so your code should be written as if you explicitly acquired a lock.
69 *
70 * The configuration only affects device 2 on the slowport, so the
71 * MTD map driver does not acquire/release the slowport.
72 */
73struct slowport_cfg {
74 unsigned long CCR; /* Clock divide */
75 unsigned long WTC; /* Write Timing Control */
76 unsigned long RTC; /* Read Timing Control */
77 unsigned long PCR; /* Protocol Control Register */
78 unsigned long ADC; /* Address/Data Width Control */
79};
80
81
82void ixp2000_acquire_slowport(struct slowport_cfg *, struct slowport_cfg *);
83void ixp2000_release_slowport(struct slowport_cfg *);
84
85/*
86 * IXP2400 A0/A1 and IXP2800 A0/A1/A2 have broken slowport that requires
87 * tweaking of addresses in the MTD driver.
88 */
89static inline unsigned ixp2000_has_broken_slowport(void)
90{
91 unsigned long id = *IXP2000_PRODUCT_ID;
92 unsigned long id_prod = id & (IXP2000_MAJ_PROD_TYPE_MASK |
93 IXP2000_MIN_PROD_TYPE_MASK);
94 return (((id_prod ==
95 /* fixed in IXP2400-B0 */
96 (IXP2000_MAJ_PROD_TYPE_IXP2000 |
97 IXP2000_MIN_PROD_TYPE_IXP2400)) &&
98 ((id & IXP2000_MAJ_REV_MASK) == 0)) ||
99 ((id_prod ==
100 /* fixed in IXP2800-B0 */
101 (IXP2000_MAJ_PROD_TYPE_IXP2000 |
102 IXP2000_MIN_PROD_TYPE_IXP2800)) &&
103 ((id & IXP2000_MAJ_REV_MASK) == 0)) ||
104 ((id_prod ==
105 /* fixed in IXP2850-B0 */
106 (IXP2000_MAJ_PROD_TYPE_IXP2000 |
107 IXP2000_MIN_PROD_TYPE_IXP2850)) &&
108 ((id & IXP2000_MAJ_REV_MASK) == 0)));
109}
110
111static inline unsigned int ixp2000_has_flash(void)
112{
113 return ((*IXP2000_STRAP_OPTIONS) & (CFG_BOOT_PROM));
114}
115
116static inline unsigned int ixp2000_is_pcimaster(void)
117{
118 return ((*IXP2000_STRAP_OPTIONS) & (CFG_PCI_BOOT_HOST));
119}
120
121void ixp2000_map_io(void);
122void ixp2000_uart_init(void);
123void ixp2000_init_irq(void);
124void ixp2000_init_time(unsigned long);
125void ixp2000_restart(char, const char *);
126unsigned long ixp2000_gettimeoffset(void);
127
128struct pci_sys_data;
129
130u32 *ixp2000_pci_config_addr(unsigned int bus, unsigned int devfn, int where);
131void ixp2000_pci_preinit(void);
132int ixp2000_pci_setup(int, struct pci_sys_data*);
133struct pci_bus* ixp2000_pci_scan_bus(int, struct pci_sys_data*);
134int ixp2000_pci_read_config(struct pci_bus*, unsigned int, int, int, u32 *);
135int ixp2000_pci_write_config(struct pci_bus*, unsigned int, int, int, u32);
136
137/*
138 * Several of the IXP2000 systems have banked flash so we need to extend the
139 * flash_platform_data structure with some private pointers
140 */
141struct ixp2000_flash_data {
142 struct flash_platform_data *platform_data;
143 int nr_banks;
144 unsigned long (*bank_setup)(unsigned long);
145};
146
147struct ixp2000_i2c_pins {
148 unsigned long sda_pin;
149 unsigned long scl_pin;
150};
151
152
153#endif /* !__ASSEMBLY__ */
diff --git a/arch/arm/mach-ixp2000/include/mach/timex.h b/arch/arm/mach-ixp2000/include/mach/timex.h
deleted file mode 100644
index 835e659f93d4..000000000000
--- a/arch/arm/mach-ixp2000/include/mach/timex.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/timex.h
3 *
4 * IXP2000 architecture timex specifications
5 */
6
7
8/*
9 * Default clock is 50MHz APB, but platform code can override this
10 */
11#define CLOCK_TICK_RATE 50000000
12
13
diff --git a/arch/arm/mach-ixp2000/include/mach/uncompress.h b/arch/arm/mach-ixp2000/include/mach/uncompress.h
deleted file mode 100644
index ce363087df78..000000000000
--- a/arch/arm/mach-ixp2000/include/mach/uncompress.h
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/include/mach/uncompress.h
3 *
4 *
5 * Original Author: Naeem Afzal <naeem.m.afzal@intel.com>
6 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2002 Intel Corp.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 */
16
17#include <linux/serial_reg.h>
18
19#define UART_BASE 0xc0030000
20
21#define PHYS(x) ((volatile unsigned long *)(UART_BASE + x))
22
23#define UARTDR PHYS(0x00) /* Transmit reg dlab=0 */
24#define UARTDLL PHYS(0x00) /* Divisor Latch reg dlab=1*/
25#define UARTDLM PHYS(0x04) /* Divisor Latch reg dlab=1*/
26#define UARTIER PHYS(0x04) /* Interrupt enable reg */
27#define UARTFCR PHYS(0x08) /* FIFO control reg dlab =0*/
28#define UARTLCR PHYS(0x0c) /* Control reg */
29#define UARTSR PHYS(0x14) /* Status reg */
30
31
32static inline void putc(int c)
33{
34 int j = 0x1000;
35
36 while (--j && !(*UARTSR & UART_LSR_THRE))
37 barrier();
38
39 *UARTDR = c;
40}
41
42static inline void flush(void)
43{
44}
45
46#define arch_decomp_setup()
47#define arch_decomp_wdog()
diff --git a/arch/arm/mach-ixp2000/ixdp2400.c b/arch/arm/mach-ixp2000/ixdp2400.c
deleted file mode 100644
index 915ad49e3b8f..000000000000
--- a/arch/arm/mach-ixp2000/ixdp2400.c
+++ /dev/null
@@ -1,180 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/ixdp2400.c
3 *
4 * IXDP2400 platform support
5 *
6 * Original Author: Naeem Afzal <naeem.m.afzal@intel.com>
7 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
8 *
9 * Copyright (C) 2002 Intel Corp.
10 * Copyright (C) 2003-2004 MontaVista Software, Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/mm.h>
20#include <linux/sched.h>
21#include <linux/interrupt.h>
22#include <linux/device.h>
23#include <linux/bitops.h>
24#include <linux/pci.h>
25#include <linux/ioport.h>
26#include <linux/delay.h>
27#include <linux/io.h>
28
29#include <asm/irq.h>
30#include <asm/pgtable.h>
31#include <asm/page.h>
32#include <mach/hardware.h>
33#include <asm/mach-types.h>
34
35#include <asm/mach/pci.h>
36#include <asm/mach/map.h>
37#include <asm/mach/irq.h>
38#include <asm/mach/time.h>
39#include <asm/mach/flash.h>
40#include <asm/mach/arch.h>
41
42/*************************************************************************
43 * IXDP2400 timer tick
44 *************************************************************************/
45static void __init ixdp2400_timer_init(void)
46{
47 int numerator, denominator;
48 int denom_array[] = {2, 4, 8, 16, 1, 2, 4, 8};
49
50 numerator = (*(IXDP2400_CPLD_SYS_CLK_M) & 0xFF) *2;
51 denominator = denom_array[(*(IXDP2400_CPLD_SYS_CLK_N) & 0x7)];
52
53 ixp2000_init_time(((3125000 * numerator) / (denominator)) / 2);
54}
55
56static struct sys_timer ixdp2400_timer = {
57 .init = ixdp2400_timer_init,
58 .offset = ixp2000_gettimeoffset,
59};
60
61/*************************************************************************
62 * IXDP2400 PCI
63 *************************************************************************/
64void __init ixdp2400_pci_preinit(void)
65{
66 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00100000);
67 ixp2000_pci_preinit();
68 pcibios_setup("firmware");
69}
70
71int ixdp2400_pci_setup(int nr, struct pci_sys_data *sys)
72{
73 sys->mem_offset = 0xe0000000;
74
75 ixp2000_pci_setup(nr, sys);
76
77 return 1;
78}
79
80static int __init ixdp2400_pci_map_irq(const struct pci_dev *dev, u8 slot,
81 u8 pin)
82{
83 if (ixdp2x00_master_npu()) {
84
85 /*
86 * Root bus devices. Slave NPU is only one with interrupt.
87 * Everything else, we just return -1 b/c nothing else
88 * on the root bus has interrupts.
89 */
90 if(!dev->bus->self) {
91 if(dev->devfn == IXDP2X00_SLAVE_NPU_DEVFN )
92 return IRQ_IXDP2400_INGRESS_NPU;
93
94 return -1;
95 }
96
97 /*
98 * Bridge behind the PMC slot.
99 * NOTE: Only INTA from the PMC slot is routed. VERY BAD.
100 */
101 if(dev->bus->self->devfn == IXDP2X00_PMC_DEVFN &&
102 dev->bus->parent->self->devfn == IXDP2X00_P2P_DEVFN &&
103 !dev->bus->parent->self->bus->parent)
104 return IRQ_IXDP2400_PMC;
105
106 /*
107 * Device behind the first bridge
108 */
109 if(dev->bus->self->devfn == IXDP2X00_P2P_DEVFN) {
110 switch(dev->devfn) {
111 case IXDP2400_MASTER_ENET_DEVFN:
112 return IRQ_IXDP2400_ENET;
113
114 case IXDP2400_MEDIA_DEVFN:
115 return IRQ_IXDP2400_MEDIA_PCI;
116
117 case IXDP2400_SWITCH_FABRIC_DEVFN:
118 return IRQ_IXDP2400_SF_PCI;
119
120 case IXDP2X00_PMC_DEVFN:
121 return IRQ_IXDP2400_PMC;
122 }
123 }
124
125 return -1;
126 } else return IRQ_IXP2000_PCIB; /* Slave NIC interrupt */
127}
128
129
130static void ixdp2400_pci_postinit(void)
131{
132 struct pci_dev *dev;
133
134 if (ixdp2x00_master_npu()) {
135 dev = pci_get_bus_and_slot(1, IXDP2400_SLAVE_ENET_DEVFN);
136 pci_stop_and_remove_bus_device(dev);
137 pci_dev_put(dev);
138 } else {
139 dev = pci_get_bus_and_slot(1, IXDP2400_MASTER_ENET_DEVFN);
140 pci_stop_and_remove_bus_device(dev);
141 pci_dev_put(dev);
142
143 ixdp2x00_slave_pci_postinit();
144 }
145}
146
147static struct hw_pci ixdp2400_pci __initdata = {
148 .nr_controllers = 1,
149 .setup = ixdp2400_pci_setup,
150 .preinit = ixdp2400_pci_preinit,
151 .postinit = ixdp2400_pci_postinit,
152 .scan = ixp2000_pci_scan_bus,
153 .map_irq = ixdp2400_pci_map_irq,
154};
155
156int __init ixdp2400_pci_init(void)
157{
158 if (machine_is_ixdp2400())
159 pci_common_init(&ixdp2400_pci);
160
161 return 0;
162}
163
164subsys_initcall(ixdp2400_pci_init);
165
166void __init ixdp2400_init_irq(void)
167{
168 ixdp2x00_init_irq(IXDP2400_CPLD_INT_STAT, IXDP2400_CPLD_INT_MASK, IXDP2400_NR_IRQS);
169}
170
171MACHINE_START(IXDP2400, "Intel IXDP2400 Development Platform")
172 /* Maintainer: MontaVista Software, Inc. */
173 .atag_offset = 0x100,
174 .map_io = ixdp2x00_map_io,
175 .init_irq = ixdp2400_init_irq,
176 .timer = &ixdp2400_timer,
177 .init_machine = ixdp2x00_init_machine,
178 .restart = ixp2000_restart,
179MACHINE_END
180
diff --git a/arch/arm/mach-ixp2000/ixdp2800.c b/arch/arm/mach-ixp2000/ixdp2800.c
deleted file mode 100644
index a9f1819ea049..000000000000
--- a/arch/arm/mach-ixp2000/ixdp2800.c
+++ /dev/null
@@ -1,295 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/ixdp2800.c
3 *
4 * IXDP2800 platform support
5 *
6 * Original Author: Jeffrey Daly <jeffrey.daly@intel.com>
7 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
8 *
9 * Copyright (C) 2002 Intel Corp.
10 * Copyright (C) 2003-2004 MontaVista Software, Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/mm.h>
20#include <linux/sched.h>
21#include <linux/interrupt.h>
22#include <linux/device.h>
23#include <linux/bitops.h>
24#include <linux/pci.h>
25#include <linux/ioport.h>
26#include <linux/delay.h>
27#include <linux/io.h>
28
29#include <asm/irq.h>
30#include <asm/pgtable.h>
31#include <asm/page.h>
32#include <mach/hardware.h>
33#include <asm/mach-types.h>
34
35#include <asm/mach/pci.h>
36#include <asm/mach/map.h>
37#include <asm/mach/irq.h>
38#include <asm/mach/time.h>
39#include <asm/mach/flash.h>
40#include <asm/mach/arch.h>
41
42/*************************************************************************
43 * IXDP2800 timer tick
44 *************************************************************************/
45
46static void __init ixdp2800_timer_init(void)
47{
48 ixp2000_init_time(50000000);
49}
50
51static struct sys_timer ixdp2800_timer = {
52 .init = ixdp2800_timer_init,
53 .offset = ixp2000_gettimeoffset,
54};
55
56/*************************************************************************
57 * IXDP2800 PCI
58 *************************************************************************/
59static void __init ixdp2800_slave_disable_pci_master(void)
60{
61 *IXP2000_PCI_CMDSTAT &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
62}
63
64static void __init ixdp2800_master_wait_for_slave(void)
65{
66 volatile u32 *addr;
67
68 printk(KERN_INFO "IXDP2800: waiting for slave NPU to configure "
69 "its BAR sizes\n");
70
71 addr = ixp2000_pci_config_addr(0, IXDP2X00_SLAVE_NPU_DEVFN,
72 PCI_BASE_ADDRESS_1);
73 do {
74 *addr = 0xffffffff;
75 cpu_relax();
76 } while (*addr != 0xfe000008);
77
78 addr = ixp2000_pci_config_addr(0, IXDP2X00_SLAVE_NPU_DEVFN,
79 PCI_BASE_ADDRESS_2);
80 do {
81 *addr = 0xffffffff;
82 cpu_relax();
83 } while (*addr != 0xc0000008);
84
85 /*
86 * Configure the slave's SDRAM BAR by hand.
87 */
88 *addr = 0x40000008;
89}
90
91static void __init ixdp2800_slave_wait_for_master_enable(void)
92{
93 printk(KERN_INFO "IXDP2800: waiting for master NPU to enable us\n");
94
95 while ((*IXP2000_PCI_CMDSTAT & PCI_COMMAND_MASTER) == 0)
96 cpu_relax();
97}
98
99void __init ixdp2800_pci_preinit(void)
100{
101 printk("ixdp2x00_pci_preinit called\n");
102
103 *IXP2000_PCI_ADDR_EXT = 0x0001e000;
104
105 if (!ixdp2x00_master_npu())
106 ixdp2800_slave_disable_pci_master();
107
108 *IXP2000_PCI_SRAM_BASE_ADDR_MASK = (0x2000000 - 1) & ~0x3ffff;
109 *IXP2000_PCI_DRAM_BASE_ADDR_MASK = (0x40000000 - 1) & ~0xfffff;
110
111 ixp2000_pci_preinit();
112
113 if (ixdp2x00_master_npu()) {
114 /*
115 * Wait until the slave set its SRAM/SDRAM BAR sizes
116 * correctly before we proceed to scan and enumerate
117 * the bus.
118 */
119 ixdp2800_master_wait_for_slave();
120
121 /*
122 * We configure the SDRAM BARs by hand because they
123 * are 1G and fall outside of the regular allocated
124 * PCI address space.
125 */
126 *IXP2000_PCI_SDRAM_BAR = 0x00000008;
127 } else {
128 /*
129 * Wait for the master to complete scanning the bus
130 * and assigning resources before we proceed to scan
131 * the bus ourselves. Set pci=firmware to honor the
132 * master's resource assignment.
133 */
134 ixdp2800_slave_wait_for_master_enable();
135 pcibios_setup("firmware");
136 }
137}
138
139/*
140 * We assign the SDRAM BARs for the two IXP2800 CPUs by hand, outside
141 * of the regular PCI window, because there's only 512M of outbound PCI
142 * memory window on each IXP, while we need 1G for each of the BARs.
143 */
144static void __devinit ixp2800_pci_fixup(struct pci_dev *dev)
145{
146 if (machine_is_ixdp2800()) {
147 dev->resource[2].start = 0;
148 dev->resource[2].end = 0;
149 dev->resource[2].flags = 0;
150 }
151}
152DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IXP2800, ixp2800_pci_fixup);
153
154static int __init ixdp2800_pci_setup(int nr, struct pci_sys_data *sys)
155{
156 sys->mem_offset = 0x00000000;
157
158 ixp2000_pci_setup(nr, sys);
159
160 return 1;
161}
162
163static int __init ixdp2800_pci_map_irq(const struct pci_dev *dev, u8 slot,
164 u8 pin)
165{
166 if (ixdp2x00_master_npu()) {
167
168 /*
169 * Root bus devices. Slave NPU is only one with interrupt.
170 * Everything else, we just return -1 which is invalid.
171 */
172 if(!dev->bus->self) {
173 if(dev->devfn == IXDP2X00_SLAVE_NPU_DEVFN )
174 return IRQ_IXDP2800_INGRESS_NPU;
175
176 return -1;
177 }
178
179 /*
180 * Bridge behind the PMC slot.
181 */
182 if(dev->bus->self->devfn == IXDP2X00_PMC_DEVFN &&
183 dev->bus->parent->self->devfn == IXDP2X00_P2P_DEVFN &&
184 !dev->bus->parent->self->bus->parent)
185 return IRQ_IXDP2800_PMC;
186
187 /*
188 * Device behind the first bridge
189 */
190 if(dev->bus->self->devfn == IXDP2X00_P2P_DEVFN) {
191 switch(dev->devfn) {
192 case IXDP2X00_PMC_DEVFN:
193 return IRQ_IXDP2800_PMC;
194
195 case IXDP2800_MASTER_ENET_DEVFN:
196 return IRQ_IXDP2800_EGRESS_ENET;
197
198 case IXDP2800_SWITCH_FABRIC_DEVFN:
199 return IRQ_IXDP2800_FABRIC;
200 }
201 }
202
203 return -1;
204 } else return IRQ_IXP2000_PCIB; /* Slave NIC interrupt */
205}
206
207static void __init ixdp2800_master_enable_slave(void)
208{
209 volatile u32 *addr;
210
211 printk(KERN_INFO "IXDP2800: enabling slave NPU\n");
212
213 addr = (volatile u32 *)ixp2000_pci_config_addr(0,
214 IXDP2X00_SLAVE_NPU_DEVFN,
215 PCI_COMMAND);
216
217 *addr |= PCI_COMMAND_MASTER;
218}
219
220static void __init ixdp2800_master_wait_for_slave_bus_scan(void)
221{
222 volatile u32 *addr;
223
224 printk(KERN_INFO "IXDP2800: waiting for slave to finish bus scan\n");
225
226 addr = (volatile u32 *)ixp2000_pci_config_addr(0,
227 IXDP2X00_SLAVE_NPU_DEVFN,
228 PCI_COMMAND);
229 while ((*addr & PCI_COMMAND_MEMORY) == 0)
230 cpu_relax();
231}
232
233static void __init ixdp2800_slave_signal_bus_scan_completion(void)
234{
235 printk(KERN_INFO "IXDP2800: bus scan done, signaling master\n");
236 *IXP2000_PCI_CMDSTAT |= PCI_COMMAND_MEMORY;
237}
238
239static void __init ixdp2800_pci_postinit(void)
240{
241 if (!ixdp2x00_master_npu()) {
242 ixdp2x00_slave_pci_postinit();
243 ixdp2800_slave_signal_bus_scan_completion();
244 }
245}
246
247struct __initdata hw_pci ixdp2800_pci __initdata = {
248 .nr_controllers = 1,
249 .setup = ixdp2800_pci_setup,
250 .preinit = ixdp2800_pci_preinit,
251 .postinit = ixdp2800_pci_postinit,
252 .scan = ixp2000_pci_scan_bus,
253 .map_irq = ixdp2800_pci_map_irq,
254};
255
256int __init ixdp2800_pci_init(void)
257{
258 if (machine_is_ixdp2800()) {
259 struct pci_dev *dev;
260
261 pci_common_init(&ixdp2800_pci);
262 if (ixdp2x00_master_npu()) {
263 dev = pci_get_bus_and_slot(1, IXDP2800_SLAVE_ENET_DEVFN);
264 pci_stop_and_remove_bus_device(dev);
265 pci_dev_put(dev);
266
267 ixdp2800_master_enable_slave();
268 ixdp2800_master_wait_for_slave_bus_scan();
269 } else {
270 dev = pci_get_bus_and_slot(1, IXDP2800_MASTER_ENET_DEVFN);
271 pci_stop_and_remove_bus_device(dev);
272 pci_dev_put(dev);
273 }
274 }
275
276 return 0;
277}
278
279subsys_initcall(ixdp2800_pci_init);
280
281void __init ixdp2800_init_irq(void)
282{
283 ixdp2x00_init_irq(IXDP2800_CPLD_INT_STAT, IXDP2800_CPLD_INT_MASK, IXDP2800_NR_IRQS);
284}
285
286MACHINE_START(IXDP2800, "Intel IXDP2800 Development Platform")
287 /* Maintainer: MontaVista Software, Inc. */
288 .atag_offset = 0x100,
289 .map_io = ixdp2x00_map_io,
290 .init_irq = ixdp2800_init_irq,
291 .timer = &ixdp2800_timer,
292 .init_machine = ixdp2x00_init_machine,
293 .restart = ixp2000_restart,
294MACHINE_END
295
diff --git a/arch/arm/mach-ixp2000/ixdp2x00.c b/arch/arm/mach-ixp2000/ixdp2x00.c
deleted file mode 100644
index 421e38dc0fac..000000000000
--- a/arch/arm/mach-ixp2000/ixdp2x00.c
+++ /dev/null
@@ -1,306 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/ixdp2x00.c
3 *
4 * Code common to IXDP2400 and IXDP2800 platforms.
5 *
6 * Original Author: Naeem Afzal <naeem.m.afzal@intel.com>
7 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
8 *
9 * Copyright (C) 2002 Intel Corp.
10 * Copyright (C) 2003-2004 MontaVista Software, Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17#include <linux/gpio.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/mm.h>
21#include <linux/sched.h>
22#include <linux/interrupt.h>
23#include <linux/platform_device.h>
24#include <linux/bitops.h>
25#include <linux/pci.h>
26#include <linux/ioport.h>
27#include <linux/delay.h>
28#include <linux/io.h>
29
30#include <asm/irq.h>
31#include <asm/pgtable.h>
32#include <asm/page.h>
33#include <mach/hardware.h>
34#include <asm/mach-types.h>
35
36#include <asm/mach/pci.h>
37#include <asm/mach/map.h>
38#include <asm/mach/irq.h>
39#include <asm/mach/time.h>
40#include <asm/mach/flash.h>
41#include <asm/mach/arch.h>
42
43#include <mach/gpio-ixp2000.h>
44
45/*************************************************************************
46 * IXDP2x00 IRQ Initialization
47 *************************************************************************/
48static volatile unsigned long *board_irq_mask;
49static volatile unsigned long *board_irq_stat;
50static unsigned long board_irq_count;
51
52#ifdef CONFIG_ARCH_IXDP2400
53/*
54 * Slowport configuration for accessing CPLD registers on IXDP2x00
55 */
56static struct slowport_cfg slowport_cpld_cfg = {
57 .CCR = SLOWPORT_CCR_DIV_2,
58 .WTC = 0x00000070,
59 .RTC = 0x00000070,
60 .PCR = SLOWPORT_MODE_FLASH,
61 .ADC = SLOWPORT_ADDR_WIDTH_24 | SLOWPORT_DATA_WIDTH_8
62};
63#endif
64
65static void ixdp2x00_irq_mask(struct irq_data *d)
66{
67 unsigned long dummy;
68 static struct slowport_cfg old_cfg;
69
70 /*
71 * This is ugly in common code but really don't know
72 * of a better way to handle it. :(
73 */
74#ifdef CONFIG_ARCH_IXDP2400
75 if (machine_is_ixdp2400())
76 ixp2000_acquire_slowport(&slowport_cpld_cfg, &old_cfg);
77#endif
78
79 dummy = *board_irq_mask;
80 dummy |= IXP2000_BOARD_IRQ_MASK(d->irq);
81 ixp2000_reg_wrb(board_irq_mask, dummy);
82
83#ifdef CONFIG_ARCH_IXDP2400
84 if (machine_is_ixdp2400())
85 ixp2000_release_slowport(&old_cfg);
86#endif
87}
88
89static void ixdp2x00_irq_unmask(struct irq_data *d)
90{
91 unsigned long dummy;
92 static struct slowport_cfg old_cfg;
93
94#ifdef CONFIG_ARCH_IXDP2400
95 if (machine_is_ixdp2400())
96 ixp2000_acquire_slowport(&slowport_cpld_cfg, &old_cfg);
97#endif
98
99 dummy = *board_irq_mask;
100 dummy &= ~IXP2000_BOARD_IRQ_MASK(d->irq);
101 ixp2000_reg_wrb(board_irq_mask, dummy);
102
103 if (machine_is_ixdp2400())
104 ixp2000_release_slowport(&old_cfg);
105}
106
107static void ixdp2x00_irq_handler(unsigned int irq, struct irq_desc *desc)
108{
109 volatile u32 ex_interrupt = 0;
110 static struct slowport_cfg old_cfg;
111 int i;
112
113 desc->irq_data.chip->irq_mask(&desc->irq_data);
114
115#ifdef CONFIG_ARCH_IXDP2400
116 if (machine_is_ixdp2400())
117 ixp2000_acquire_slowport(&slowport_cpld_cfg, &old_cfg);
118#endif
119 ex_interrupt = *board_irq_stat & 0xff;
120 if (machine_is_ixdp2400())
121 ixp2000_release_slowport(&old_cfg);
122
123 if(!ex_interrupt) {
124 printk(KERN_ERR "Spurious IXDP2x00 CPLD interrupt!\n");
125 return;
126 }
127
128 for(i = 0; i < board_irq_count; i++) {
129 if(ex_interrupt & (1 << i)) {
130 int cpld_irq = IXP2000_BOARD_IRQ(0) + i;
131 generic_handle_irq(cpld_irq);
132 }
133 }
134
135 desc->irq_data.chip->irq_unmask(&desc->irq_data);
136}
137
138static struct irq_chip ixdp2x00_cpld_irq_chip = {
139 .irq_ack = ixdp2x00_irq_mask,
140 .irq_mask = ixdp2x00_irq_mask,
141 .irq_unmask = ixdp2x00_irq_unmask
142};
143
144void __init ixdp2x00_init_irq(volatile unsigned long *stat_reg, volatile unsigned long *mask_reg, unsigned long nr_of_irqs)
145{
146 unsigned int irq;
147
148 ixp2000_init_irq();
149
150 if (!ixdp2x00_master_npu())
151 return;
152
153 board_irq_stat = stat_reg;
154 board_irq_mask = mask_reg;
155 board_irq_count = nr_of_irqs;
156
157 *board_irq_mask = 0xffffffff;
158
159 for(irq = IXP2000_BOARD_IRQ(0); irq < IXP2000_BOARD_IRQ(board_irq_count); irq++) {
160 irq_set_chip_and_handler(irq, &ixdp2x00_cpld_irq_chip,
161 handle_level_irq);
162 set_irq_flags(irq, IRQF_VALID);
163 }
164
165 /* Hook into PCI interrupt */
166 irq_set_chained_handler(IRQ_IXP2000_PCIB, ixdp2x00_irq_handler);
167}
168
169/*************************************************************************
170 * IXDP2x00 memory map
171 *************************************************************************/
172static struct map_desc ixdp2x00_io_desc __initdata = {
173 .virtual = IXDP2X00_VIRT_CPLD_BASE,
174 .pfn = __phys_to_pfn(IXDP2X00_PHYS_CPLD_BASE),
175 .length = IXDP2X00_CPLD_SIZE,
176 .type = MT_DEVICE
177};
178
179void __init ixdp2x00_map_io(void)
180{
181 ixp2000_map_io();
182
183 iotable_init(&ixdp2x00_io_desc, 1);
184}
185
186/*************************************************************************
187 * IXDP2x00-common PCI init
188 *
189 * The IXDP2[48]00 has a horrid PCI bus layout. Basically the board
190 * contains two NPUs (ingress and egress) connected over PCI, both running
191 * instances of the kernel. So far so good. Peers on the PCI bus running
192 * Linux is a common design in telecom systems. The problem is that instead
193 * of all the devices being controlled by a single host, different
194 * devices are controlled by different NPUs on the same bus, leading to
195 * multiple hosts on the bus. The exact bus layout looks like:
196 *
197 * Bus 0
198 * Master NPU <-------------------+-------------------> Slave NPU
199 * |
200 * |
201 * P2P
202 * |
203 *
204 * Bus 1 |
205 * <--+------+---------+---------+------+-->
206 * | | | | |
207 * | | | | |
208 * ... Dev PMC Media Eth0 Eth1 ...
209 *
210 * The master controls all but Eth1, which is controlled by the
211 * slave. What this means is that the both the master and the slave
212 * have to scan the bus, but only one of them can enumerate the bus.
213 * In addition, after the bus is scanned, each kernel must remove
214 * the device(s) it does not control from the PCI dev list otherwise
215 * a driver on each NPU will try to manage it and we will have horrible
216 * conflicts. Oh..and the slave NPU needs to see the master NPU
217 * for Intel's drivers to work properly. Closed source drivers...
218 *
219 * The way we deal with this is fairly simple but ugly:
220 *
221 * 1) Let master scan and enumerate the bus completely.
222 * 2) Master deletes Eth1 from device list.
223 * 3) Slave scans bus and then deletes all but Eth1 (Eth0 on slave)
224 * from device list.
225 * 4) Find HW designers and LART them.
226 *
227 * The boards also do not do normal PCI IRQ routing, or any sort of
228 * sensical swizzling, so we just need to check where on the bus a
229 * device sits and figure out to which CPLD pin the interrupt is routed.
230 * See ixdp2[48]00.c files.
231 *
232 *************************************************************************/
233void ixdp2x00_slave_pci_postinit(void)
234{
235 struct pci_dev *dev;
236
237 /*
238 * Remove PMC device is there is one
239 */
240 if((dev = pci_get_bus_and_slot(1, IXDP2X00_PMC_DEVFN))) {
241 pci_stop_and_remove_bus_device(dev);
242 pci_dev_put(dev);
243 }
244
245 dev = pci_get_bus_and_slot(0, IXDP2X00_21555_DEVFN);
246 pci_stop_and_remove_bus_device(dev);
247 pci_dev_put(dev);
248}
249
250/**************************************************************************
251 * IXDP2x00 Machine Setup
252 *************************************************************************/
253static struct flash_platform_data ixdp2x00_platform_data = {
254 .map_name = "cfi_probe",
255 .width = 1,
256};
257
258static struct ixp2000_flash_data ixdp2x00_flash_data = {
259 .platform_data = &ixdp2x00_platform_data,
260 .nr_banks = 1
261};
262
263static struct resource ixdp2x00_flash_resource = {
264 .start = 0xc4000000,
265 .end = 0xc4000000 + 0x00ffffff,
266 .flags = IORESOURCE_MEM,
267};
268
269static struct platform_device ixdp2x00_flash = {
270 .name = "IXP2000-Flash",
271 .id = 0,
272 .dev = {
273 .platform_data = &ixdp2x00_flash_data,
274 },
275 .num_resources = 1,
276 .resource = &ixdp2x00_flash_resource,
277};
278
279static struct ixp2000_i2c_pins ixdp2x00_i2c_gpio_pins = {
280 .sda_pin = IXDP2X00_GPIO_SDA,
281 .scl_pin = IXDP2X00_GPIO_SCL,
282};
283
284static struct platform_device ixdp2x00_i2c_controller = {
285 .name = "IXP2000-I2C",
286 .id = 0,
287 .dev = {
288 .platform_data = &ixdp2x00_i2c_gpio_pins,
289 },
290 .num_resources = 0
291};
292
293static struct platform_device *ixdp2x00_devices[] __initdata = {
294 &ixdp2x00_flash,
295 &ixdp2x00_i2c_controller
296};
297
298void __init ixdp2x00_init_machine(void)
299{
300 gpio_line_set(IXDP2X00_GPIO_I2C_ENABLE, 1);
301 gpio_line_config(IXDP2X00_GPIO_I2C_ENABLE, GPIO_OUT);
302
303 platform_add_devices(ixdp2x00_devices, ARRAY_SIZE(ixdp2x00_devices));
304 ixp2000_uart_init();
305}
306
diff --git a/arch/arm/mach-ixp2000/ixdp2x01.c b/arch/arm/mach-ixp2000/ixdp2x01.c
deleted file mode 100644
index 5196c39cdba4..000000000000
--- a/arch/arm/mach-ixp2000/ixdp2x01.c
+++ /dev/null
@@ -1,483 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/ixdp2x01.c
3 *
4 * Code common to Intel IXDP2401 and IXDP2801 platforms
5 *
6 * Original Author: Andrzej Mialkowski <andrzej.mialkowski@intel.com>
7 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
8 *
9 * Copyright (C) 2002-2003 Intel Corp.
10 * Copyright (C) 2003-2004 MontaVista Software, Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/mm.h>
21#include <linux/sched.h>
22#include <linux/interrupt.h>
23#include <linux/bitops.h>
24#include <linux/pci.h>
25#include <linux/ioport.h>
26#include <linux/delay.h>
27#include <linux/serial.h>
28#include <linux/tty.h>
29#include <linux/serial_core.h>
30#include <linux/platform_device.h>
31#include <linux/serial_8250.h>
32#include <linux/io.h>
33
34#include <asm/irq.h>
35#include <asm/pgtable.h>
36#include <asm/page.h>
37#include <mach/hardware.h>
38#include <asm/mach-types.h>
39
40#include <asm/mach/pci.h>
41#include <asm/mach/map.h>
42#include <asm/mach/irq.h>
43#include <asm/mach/time.h>
44#include <asm/mach/arch.h>
45#include <asm/mach/flash.h>
46
47/*************************************************************************
48 * IXDP2x01 IRQ Handling
49 *************************************************************************/
50static void ixdp2x01_irq_mask(struct irq_data *d)
51{
52 ixp2000_reg_wrb(IXDP2X01_INT_MASK_SET_REG,
53 IXP2000_BOARD_IRQ_MASK(d->irq));
54}
55
56static void ixdp2x01_irq_unmask(struct irq_data *d)
57{
58 ixp2000_reg_write(IXDP2X01_INT_MASK_CLR_REG,
59 IXP2000_BOARD_IRQ_MASK(d->irq));
60}
61
62static u32 valid_irq_mask;
63
64static void ixdp2x01_irq_handler(unsigned int irq, struct irq_desc *desc)
65{
66 u32 ex_interrupt;
67 int i;
68
69 desc->irq_data.chip->irq_mask(&desc->irq_data);
70
71 ex_interrupt = *IXDP2X01_INT_STAT_REG & valid_irq_mask;
72
73 if (!ex_interrupt) {
74 printk(KERN_ERR "Spurious IXDP2X01 CPLD interrupt!\n");
75 return;
76 }
77
78 for (i = 0; i < IXP2000_BOARD_IRQS; i++) {
79 if (ex_interrupt & (1 << i)) {
80 int cpld_irq = IXP2000_BOARD_IRQ(0) + i;
81 generic_handle_irq(cpld_irq);
82 }
83 }
84
85 desc->irq_data.chip->irq_unmask(&desc->irq_data);
86}
87
88static struct irq_chip ixdp2x01_irq_chip = {
89 .irq_mask = ixdp2x01_irq_mask,
90 .irq_ack = ixdp2x01_irq_mask,
91 .irq_unmask = ixdp2x01_irq_unmask
92};
93
94/*
95 * We only do anything if we are the master NPU on the board.
96 * The slave NPU only has the ethernet chip going directly to
97 * the PCIB interrupt input.
98 */
99void __init ixdp2x01_init_irq(void)
100{
101 int irq = 0;
102
103 /* initialize chip specific interrupts */
104 ixp2000_init_irq();
105
106 if (machine_is_ixdp2401())
107 valid_irq_mask = IXDP2401_VALID_IRQ_MASK;
108 else
109 valid_irq_mask = IXDP2801_VALID_IRQ_MASK;
110
111 /* Mask all interrupts from CPLD, disable simulation */
112 ixp2000_reg_write(IXDP2X01_INT_MASK_SET_REG, 0xffffffff);
113 ixp2000_reg_wrb(IXDP2X01_INT_SIM_REG, 0);
114
115 for (irq = NR_IXP2000_IRQS; irq < NR_IXDP2X01_IRQS; irq++) {
116 if (irq & valid_irq_mask) {
117 irq_set_chip_and_handler(irq, &ixdp2x01_irq_chip,
118 handle_level_irq);
119 set_irq_flags(irq, IRQF_VALID);
120 } else {
121 set_irq_flags(irq, 0);
122 }
123 }
124
125 /* Hook into PCI interrupts */
126 irq_set_chained_handler(IRQ_IXP2000_PCIB, ixdp2x01_irq_handler);
127}
128
129
130/*************************************************************************
131 * IXDP2x01 memory map
132 *************************************************************************/
133static struct map_desc ixdp2x01_io_desc __initdata = {
134 .virtual = IXDP2X01_VIRT_CPLD_BASE,
135 .pfn = __phys_to_pfn(IXDP2X01_PHYS_CPLD_BASE),
136 .length = IXDP2X01_CPLD_REGION_SIZE,
137 .type = MT_DEVICE
138};
139
140static void __init ixdp2x01_map_io(void)
141{
142 ixp2000_map_io();
143 iotable_init(&ixdp2x01_io_desc, 1);
144}
145
146
147/*************************************************************************
148 * IXDP2x01 serial ports
149 *************************************************************************/
150static struct plat_serial8250_port ixdp2x01_serial_port1[] = {
151 {
152 .mapbase = (unsigned long)IXDP2X01_UART1_PHYS_BASE,
153 .membase = (char *)IXDP2X01_UART1_VIRT_BASE,
154 .irq = IRQ_IXDP2X01_UART1,
155 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
156 .iotype = UPIO_MEM32,
157 .regshift = 2,
158 .uartclk = IXDP2X01_UART_CLK,
159 },
160 { }
161};
162
163static struct resource ixdp2x01_uart_resource1 = {
164 .start = IXDP2X01_UART1_PHYS_BASE,
165 .end = IXDP2X01_UART1_PHYS_BASE + 0xffff,
166 .flags = IORESOURCE_MEM,
167};
168
169static struct platform_device ixdp2x01_serial_device1 = {
170 .name = "serial8250",
171 .id = PLAT8250_DEV_PLATFORM1,
172 .dev = {
173 .platform_data = ixdp2x01_serial_port1,
174 },
175 .num_resources = 1,
176 .resource = &ixdp2x01_uart_resource1,
177};
178
179static struct plat_serial8250_port ixdp2x01_serial_port2[] = {
180 {
181 .mapbase = (unsigned long)IXDP2X01_UART2_PHYS_BASE,
182 .membase = (char *)IXDP2X01_UART2_VIRT_BASE,
183 .irq = IRQ_IXDP2X01_UART2,
184 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
185 .iotype = UPIO_MEM32,
186 .regshift = 2,
187 .uartclk = IXDP2X01_UART_CLK,
188 },
189 { }
190};
191
192static struct resource ixdp2x01_uart_resource2 = {
193 .start = IXDP2X01_UART2_PHYS_BASE,
194 .end = IXDP2X01_UART2_PHYS_BASE + 0xffff,
195 .flags = IORESOURCE_MEM,
196};
197
198static struct platform_device ixdp2x01_serial_device2 = {
199 .name = "serial8250",
200 .id = PLAT8250_DEV_PLATFORM2,
201 .dev = {
202 .platform_data = ixdp2x01_serial_port2,
203 },
204 .num_resources = 1,
205 .resource = &ixdp2x01_uart_resource2,
206};
207
208static void ixdp2x01_uart_init(void)
209{
210 platform_device_register(&ixdp2x01_serial_device1);
211 platform_device_register(&ixdp2x01_serial_device2);
212}
213
214
215/*************************************************************************
216 * IXDP2x01 timer tick configuration
217 *************************************************************************/
218static unsigned int ixdp2x01_clock;
219
220static int __init ixdp2x01_clock_setup(char *str)
221{
222 ixdp2x01_clock = simple_strtoul(str, NULL, 10);
223
224 return 1;
225}
226
227__setup("ixdp2x01_clock=", ixdp2x01_clock_setup);
228
229static void __init ixdp2x01_timer_init(void)
230{
231 if (!ixdp2x01_clock)
232 ixdp2x01_clock = 50000000;
233
234 ixp2000_init_time(ixdp2x01_clock);
235}
236
237static struct sys_timer ixdp2x01_timer = {
238 .init = ixdp2x01_timer_init,
239 .offset = ixp2000_gettimeoffset,
240};
241
242/*************************************************************************
243 * IXDP2x01 PCI
244 *************************************************************************/
245void __init ixdp2x01_pci_preinit(void)
246{
247 ixp2000_reg_write(IXP2000_PCI_ADDR_EXT, 0x00000000);
248 ixp2000_pci_preinit();
249 pcibios_setup("firmware");
250}
251
252#define DEVPIN(dev, pin) ((pin) | ((dev) << 3))
253
254static int __init ixdp2x01_pci_map_irq(const struct pci_dev *dev, u8 slot,
255 u8 pin)
256{
257 u8 bus = dev->bus->number;
258 u32 devpin = DEVPIN(PCI_SLOT(dev->devfn), pin);
259 struct pci_bus *tmp_bus = dev->bus;
260
261 /* Primary bus, no interrupts here */
262 if (bus == 0) {
263 return -1;
264 }
265
266 /* Lookup first leaf in bus tree */
267 while ((tmp_bus->parent != NULL) && (tmp_bus->parent->parent != NULL)) {
268 tmp_bus = tmp_bus->parent;
269 }
270
271 /* Select between known bridges */
272 switch (tmp_bus->self->devfn | (tmp_bus->self->bus->number << 8)) {
273 /* Device is located after first MB bridge */
274 case 0x0008:
275 if (tmp_bus == dev->bus) {
276 /* Device is located directly after first MB bridge */
277 switch (devpin) {
278 case DEVPIN(1, 1): /* Onboard 82546 ch 0 */
279 if (machine_is_ixdp2401())
280 return IRQ_IXDP2401_INTA_82546;
281 return -1;
282 case DEVPIN(1, 2): /* Onboard 82546 ch 1 */
283 if (machine_is_ixdp2401())
284 return IRQ_IXDP2401_INTB_82546;
285 return -1;
286 case DEVPIN(0, 1): /* PMC INTA# */
287 return IRQ_IXDP2X01_SPCI_PMC_INTA;
288 case DEVPIN(0, 2): /* PMC INTB# */
289 return IRQ_IXDP2X01_SPCI_PMC_INTB;
290 case DEVPIN(0, 3): /* PMC INTC# */
291 return IRQ_IXDP2X01_SPCI_PMC_INTC;
292 case DEVPIN(0, 4): /* PMC INTD# */
293 return IRQ_IXDP2X01_SPCI_PMC_INTD;
294 }
295 }
296 break;
297 case 0x0010:
298 if (tmp_bus == dev->bus) {
299 /* Device is located directly after second MB bridge */
300 /* Secondary bus of second bridge */
301 switch (devpin) {
302 case DEVPIN(0, 1): /* DB#0 */
303 return IRQ_IXDP2X01_SPCI_DB_0;
304 case DEVPIN(1, 1): /* DB#1 */
305 return IRQ_IXDP2X01_SPCI_DB_1;
306 }
307 } else {
308 /* Device is located indirectly after second MB bridge */
309 /* Not supported now */
310 }
311 break;
312 }
313
314 return -1;
315}
316
317
318static int ixdp2x01_pci_setup(int nr, struct pci_sys_data *sys)
319{
320 sys->mem_offset = 0xe0000000;
321
322 if (machine_is_ixdp2801() || machine_is_ixdp28x5())
323 sys->mem_offset -= ((*IXP2000_PCI_ADDR_EXT & 0xE000) << 16);
324
325 return ixp2000_pci_setup(nr, sys);
326}
327
328struct hw_pci ixdp2x01_pci __initdata = {
329 .nr_controllers = 1,
330 .setup = ixdp2x01_pci_setup,
331 .preinit = ixdp2x01_pci_preinit,
332 .scan = ixp2000_pci_scan_bus,
333 .map_irq = ixdp2x01_pci_map_irq,
334};
335
336int __init ixdp2x01_pci_init(void)
337{
338 if (machine_is_ixdp2401() || machine_is_ixdp2801() ||\
339 machine_is_ixdp28x5())
340 pci_common_init(&ixdp2x01_pci);
341
342 return 0;
343}
344
345subsys_initcall(ixdp2x01_pci_init);
346
347/*************************************************************************
348 * IXDP2x01 Machine Initialization
349 *************************************************************************/
350static struct flash_platform_data ixdp2x01_flash_platform_data = {
351 .map_name = "cfi_probe",
352 .width = 1,
353};
354
355static unsigned long ixdp2x01_flash_bank_setup(unsigned long ofs)
356{
357 ixp2000_reg_wrb(IXDP2X01_CPLD_FLASH_REG,
358 ((ofs >> IXDP2X01_FLASH_WINDOW_BITS) | IXDP2X01_CPLD_FLASH_INTERN));
359 return (ofs & IXDP2X01_FLASH_WINDOW_MASK);
360}
361
362static struct ixp2000_flash_data ixdp2x01_flash_data = {
363 .platform_data = &ixdp2x01_flash_platform_data,
364 .bank_setup = ixdp2x01_flash_bank_setup
365};
366
367static struct resource ixdp2x01_flash_resource = {
368 .start = 0xc4000000,
369 .end = 0xc4000000 + 0x01ffffff,
370 .flags = IORESOURCE_MEM,
371};
372
373static struct platform_device ixdp2x01_flash = {
374 .name = "IXP2000-Flash",
375 .id = 0,
376 .dev = {
377 .platform_data = &ixdp2x01_flash_data,
378 },
379 .num_resources = 1,
380 .resource = &ixdp2x01_flash_resource,
381};
382
383static struct ixp2000_i2c_pins ixdp2x01_i2c_gpio_pins = {
384 .sda_pin = IXDP2X01_GPIO_SDA,
385 .scl_pin = IXDP2X01_GPIO_SCL,
386};
387
388static struct platform_device ixdp2x01_i2c_controller = {
389 .name = "IXP2000-I2C",
390 .id = 0,
391 .dev = {
392 .platform_data = &ixdp2x01_i2c_gpio_pins,
393 },
394 .num_resources = 0
395};
396
397static struct platform_device *ixdp2x01_devices[] __initdata = {
398 &ixdp2x01_flash,
399 &ixdp2x01_i2c_controller
400};
401
402static void __init ixdp2x01_init_machine(void)
403{
404 ixp2000_reg_wrb(IXDP2X01_CPLD_FLASH_REG,
405 (IXDP2X01_CPLD_FLASH_BANK_MASK | IXDP2X01_CPLD_FLASH_INTERN));
406
407 ixdp2x01_flash_data.nr_banks =
408 ((*IXDP2X01_CPLD_FLASH_REG & IXDP2X01_CPLD_FLASH_BANK_MASK) + 1);
409
410 platform_add_devices(ixdp2x01_devices, ARRAY_SIZE(ixdp2x01_devices));
411 ixp2000_uart_init();
412 ixdp2x01_uart_init();
413}
414
415static void ixdp2401_restart(char mode, const char *cmd)
416{
417 /*
418 * Reset flash banking register so that we are pointing at
419 * RedBoot bank.
420 */
421 ixp2000_reg_write(IXDP2X01_CPLD_FLASH_REG,
422 ((0 >> IXDP2X01_FLASH_WINDOW_BITS)
423 | IXDP2X01_CPLD_FLASH_INTERN));
424 ixp2000_reg_wrb(IXDP2X01_CPLD_RESET_REG, 0xffffffff);
425
426 ixp2000_restart(mode, cmd);
427}
428
429static void ixdp280x_restart(char mode, const char *cmd)
430{
431 /*
432 * On IXDP2801 we need to write this magic sequence to the CPLD
433 * to cause a complete reset of the CPU and all external devices
434 * and move the flash bank register back to 0.
435 */
436 unsigned long reset_reg = *IXDP2X01_CPLD_RESET_REG;
437
438 reset_reg = 0x55AA0000 | (reset_reg & 0x0000FFFF);
439 ixp2000_reg_write(IXDP2X01_CPLD_RESET_REG, reset_reg);
440 ixp2000_reg_wrb(IXDP2X01_CPLD_RESET_REG, 0x80000000);
441
442 ixp2000_restart(mode, cmd);
443}
444
445#ifdef CONFIG_ARCH_IXDP2401
446MACHINE_START(IXDP2401, "Intel IXDP2401 Development Platform")
447 /* Maintainer: MontaVista Software, Inc. */
448 .atag_offset = 0x100,
449 .map_io = ixdp2x01_map_io,
450 .init_irq = ixdp2x01_init_irq,
451 .timer = &ixdp2x01_timer,
452 .init_machine = ixdp2x01_init_machine,
453 .restart = ixdp2401_restart,
454MACHINE_END
455#endif
456
457#ifdef CONFIG_ARCH_IXDP2801
458MACHINE_START(IXDP2801, "Intel IXDP2801 Development Platform")
459 /* Maintainer: MontaVista Software, Inc. */
460 .atag_offset = 0x100,
461 .map_io = ixdp2x01_map_io,
462 .init_irq = ixdp2x01_init_irq,
463 .timer = &ixdp2x01_timer,
464 .init_machine = ixdp2x01_init_machine,
465 .restart = ixdp280x_restart,
466MACHINE_END
467
468/*
469 * IXDP28x5 is basically an IXDP2801 with a different CPU but Intel
470 * changed the machine ID in the bootloader
471 */
472MACHINE_START(IXDP28X5, "Intel IXDP2805/2855 Development Platform")
473 /* Maintainer: MontaVista Software, Inc. */
474 .atag_offset = 0x100,
475 .map_io = ixdp2x01_map_io,
476 .init_irq = ixdp2x01_init_irq,
477 .timer = &ixdp2x01_timer,
478 .init_machine = ixdp2x01_init_machine,
479 .restart = ixdp280x_restart,
480MACHINE_END
481#endif
482
483
diff --git a/arch/arm/mach-ixp2000/pci.c b/arch/arm/mach-ixp2000/pci.c
deleted file mode 100644
index 9c02de932fac..000000000000
--- a/arch/arm/mach-ixp2000/pci.c
+++ /dev/null
@@ -1,252 +0,0 @@
1/*
2 * arch/arm/mach-ixp2000/pci.c
3 *
4 * PCI routines for IXDP2400/IXDP2800 boards
5 *
6 * Original Author: Naeem Afzal <naeem.m.afzal@intel.com>
7 * Maintained by: Deepak Saxena <dsaxena@plexity.net>
8 *
9 * Copyright 2002 Intel Corp.
10 * Copyright (C) 2003-2004 MontaVista Software, Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17
18#include <linux/sched.h>
19#include <linux/kernel.h>
20#include <linux/pci.h>
21#include <linux/interrupt.h>
22#include <linux/mm.h>
23#include <linux/init.h>
24#include <linux/ioport.h>
25#include <linux/delay.h>
26#include <linux/io.h>
27
28#include <asm/irq.h>
29#include <mach/hardware.h>
30
31#include <asm/mach/pci.h>
32
33static volatile int pci_master_aborts = 0;
34
35static int clear_master_aborts(void);
36
37u32 *
38ixp2000_pci_config_addr(unsigned int bus_nr, unsigned int devfn, int where)
39{
40 u32 *paddress;
41
42 if (PCI_SLOT(devfn) > 7)
43 return 0;
44
45 /* Must be dword aligned */
46 where &= ~3;
47
48 /*
49 * For top bus, generate type 0, else type 1
50 */
51 if (!bus_nr) {
52 /* only bits[23:16] are used for IDSEL */
53 paddress = (u32 *) (IXP2000_PCI_CFG0_VIRT_BASE
54 | (1 << (PCI_SLOT(devfn) + 16))
55 | (PCI_FUNC(devfn) << 8) | where);
56 } else {
57 paddress = (u32 *) (IXP2000_PCI_CFG1_VIRT_BASE
58 | (bus_nr << 16)
59 | (PCI_SLOT(devfn) << 11)
60 | (PCI_FUNC(devfn) << 8) | where);
61 }
62
63 return paddress;
64}
65
66/*
67 * Mask table, bits to mask for quantity of size 1, 2 or 4 bytes.
68 * 0 and 3 are not valid indexes...
69 */
70static u32 bytemask[] = {
71 /*0*/ 0,
72 /*1*/ 0xff,
73 /*2*/ 0xffff,
74 /*3*/ 0,
75 /*4*/ 0xffffffff,
76};
77
78
79int ixp2000_pci_read_config(struct pci_bus *bus, unsigned int devfn, int where,
80 int size, u32 *value)
81{
82 u32 n;
83 u32 *addr;
84
85 n = where % 4;
86
87 addr = ixp2000_pci_config_addr(bus->number, devfn, where);
88 if (!addr)
89 return PCIBIOS_DEVICE_NOT_FOUND;
90
91 pci_master_aborts = 0;
92 *value = (*addr >> (8*n)) & bytemask[size];
93 if (pci_master_aborts) {
94 pci_master_aborts = 0;
95 *value = 0xffffffff;
96 return PCIBIOS_DEVICE_NOT_FOUND;
97 }
98
99 return PCIBIOS_SUCCESSFUL;
100}
101
102/*
103 * We don't do error checks by calling clear_master_aborts() b/c the
104 * assumption is that the caller did a read first to make sure a device
105 * exists.
106 */
107int ixp2000_pci_write_config(struct pci_bus *bus, unsigned int devfn, int where,
108 int size, u32 value)
109{
110 u32 mask;
111 u32 *addr;
112 u32 temp;
113
114 mask = ~(bytemask[size] << ((where % 0x4) * 8));
115 addr = ixp2000_pci_config_addr(bus->number, devfn, where);
116 if (!addr)
117 return PCIBIOS_DEVICE_NOT_FOUND;
118 temp = (u32) (value) << ((where % 0x4) * 8);
119 *addr = (*addr & mask) | temp;
120
121 clear_master_aborts();
122
123 return PCIBIOS_SUCCESSFUL;
124}
125
126
127static struct pci_ops ixp2000_pci_ops = {
128 .read = ixp2000_pci_read_config,
129 .write = ixp2000_pci_write_config
130};
131
132struct pci_bus *ixp2000_pci_scan_bus(int nr, struct pci_sys_data *sysdata)
133{
134 return pci_scan_root_bus(NULL, sysdata->busnr, &ixp2000_pci_ops,
135 sysdata, &sysdata->resources);
136}
137
138
139int ixp2000_pci_abort_handler(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
140{
141
142 volatile u32 temp;
143 unsigned long flags;
144
145 pci_master_aborts = 1;
146
147 local_irq_save(flags);
148 temp = *(IXP2000_PCI_CONTROL);
149 if (temp & ((1 << 8) | (1 << 5))) {
150 ixp2000_reg_wrb(IXP2000_PCI_CONTROL, temp);
151 }
152
153 temp = *(IXP2000_PCI_CMDSTAT);
154 if (temp & (1 << 29)) {
155 while (temp & (1 << 29)) {
156 ixp2000_reg_write(IXP2000_PCI_CMDSTAT, temp);
157 temp = *(IXP2000_PCI_CMDSTAT);
158 }
159 }
160 local_irq_restore(flags);
161
162 /*
163 * If it was an imprecise abort, then we need to correct the
164 * return address to be _after_ the instruction.
165 */
166 if (fsr & (1 << 10))
167 regs->ARM_pc += 4;
168
169 return 0;
170}
171
172int
173clear_master_aborts(void)
174{
175 volatile u32 temp;
176 unsigned long flags;
177
178 local_irq_save(flags);
179 temp = *(IXP2000_PCI_CONTROL);
180 if (temp & ((1 << 8) | (1 << 5))) {
181 ixp2000_reg_wrb(IXP2000_PCI_CONTROL, temp);
182 }
183
184 temp = *(IXP2000_PCI_CMDSTAT);
185 if (temp & (1 << 29)) {
186 while (temp & (1 << 29)) {
187 ixp2000_reg_write(IXP2000_PCI_CMDSTAT, temp);
188 temp = *(IXP2000_PCI_CMDSTAT);
189 }
190 }
191 local_irq_restore(flags);
192
193 return 0;
194}
195
196void __init
197ixp2000_pci_preinit(void)
198{
199 pci_set_flags(0);
200
201 pcibios_min_io = 0;
202 pcibios_min_mem = 0;
203
204#ifndef CONFIG_IXP2000_SUPPORT_BROKEN_PCI_IO
205 /*
206 * Configure the PCI unit to properly byteswap I/O transactions,
207 * and verify that it worked.
208 */
209 ixp2000_reg_write(IXP2000_PCI_CONTROL,
210 (*IXP2000_PCI_CONTROL | PCI_CONTROL_IEE));
211
212 if ((*IXP2000_PCI_CONTROL & PCI_CONTROL_IEE) == 0)
213 panic("IXP2000: PCI I/O is broken on this ixp model, and "
214 "the needed workaround has not been configured in");
215#endif
216
217 hook_fault_code(16+6, ixp2000_pci_abort_handler, SIGBUS, 0,
218 "PCI config cycle to non-existent device");
219}
220
221
222/*
223 * IXP2000 systems often have large resource requirements, so we just
224 * use our own resource space.
225 */
226static struct resource ixp2000_pci_mem_space = {
227 .start = 0xe0000000,
228 .end = 0xffffffff,
229 .flags = IORESOURCE_MEM,
230 .name = "PCI Mem Space"
231};
232
233static struct resource ixp2000_pci_io_space = {
234 .start = 0x00010000,
235 .end = 0x0001ffff,
236 .flags = IORESOURCE_IO,
237 .name = "PCI I/O Space"
238};
239
240int ixp2000_pci_setup(int nr, struct pci_sys_data *sys)
241{
242 if (nr >= 1)
243 return 0;
244
245 pci_add_resource_offset(&sys->resources,
246 &ixp2000_pci_io_space, sys->io_offset);
247 pci_add_resource_offset(&sys->resources,
248 &ixp2000_pci_mem_space, sys->mem_offset);
249
250 return 1;
251}
252
diff --git a/arch/arm/mach-ixp23xx/Kconfig b/arch/arm/mach-ixp23xx/Kconfig
deleted file mode 100644
index 982670ec3866..000000000000
--- a/arch/arm/mach-ixp23xx/Kconfig
+++ /dev/null
@@ -1,25 +0,0 @@
1if ARCH_IXP23XX
2
3config ARCH_SUPPORTS_BIG_ENDIAN
4 bool
5 default y
6
7menu "Intel IXP23xx Implementation Options"
8
9comment "IXP23xx Platforms"
10
11config MACH_ESPRESSO
12 bool "Support IP Fabrics Double Espresso platform"
13 help
14
15config MACH_IXDP2351
16 bool "Support Intel IXDP2351 platform"
17 help
18
19config MACH_ROADRUNNER
20 bool "Support ADI RoadRunner platform"
21 help
22
23endmenu
24
25endif
diff --git a/arch/arm/mach-ixp23xx/Makefile b/arch/arm/mach-ixp23xx/Makefile
deleted file mode 100644
index 288b371b6d03..000000000000
--- a/arch/arm/mach-ixp23xx/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4obj-y := core.o pci.o
5obj-m :=
6obj-n :=
7obj- :=
8
9obj-$(CONFIG_MACH_ESPRESSO) += espresso.o
10obj-$(CONFIG_MACH_IXDP2351) += ixdp2351.o
11obj-$(CONFIG_MACH_ROADRUNNER) += roadrunner.o
diff --git a/arch/arm/mach-ixp23xx/Makefile.boot b/arch/arm/mach-ixp23xx/Makefile.boot
deleted file mode 100644
index 44fb4a717c3f..000000000000
--- a/arch/arm/mach-ixp23xx/Makefile.boot
+++ /dev/null
@@ -1,2 +0,0 @@
1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100
diff --git a/arch/arm/mach-ixp23xx/core.c b/arch/arm/mach-ixp23xx/core.c
deleted file mode 100644
index d34542425990..000000000000
--- a/arch/arm/mach-ixp23xx/core.c
+++ /dev/null
@@ -1,455 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/core.c
3 *
4 * Core routines for IXP23xx chips
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2005 (c) MontaVista Software, Inc.
9 *
10 * Based on 2.4 code Copyright 2004 (c) Intel Corporation
11 *
12 * This file is licensed under the terms of the GNU General Public
13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied.
15 */
16
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/spinlock.h>
20#include <linux/sched.h>
21#include <linux/interrupt.h>
22#include <linux/serial.h>
23#include <linux/tty.h>
24#include <linux/bitops.h>
25#include <linux/serial_8250.h>
26#include <linux/serial_core.h>
27#include <linux/device.h>
28#include <linux/mm.h>
29#include <linux/time.h>
30#include <linux/timex.h>
31
32#include <asm/types.h>
33#include <asm/setup.h>
34#include <asm/memory.h>
35#include <mach/hardware.h>
36#include <asm/irq.h>
37#include <asm/tlbflush.h>
38#include <asm/pgtable.h>
39#include <asm/system_misc.h>
40
41#include <asm/mach/map.h>
42#include <asm/mach/time.h>
43#include <asm/mach/irq.h>
44#include <asm/mach/arch.h>
45
46
47/*************************************************************************
48 * Chip specific mappings shared by all IXP23xx systems
49 *************************************************************************/
50static struct map_desc ixp23xx_io_desc[] __initdata = {
51 { /* XSI-CPP CSRs */
52 .virtual = IXP23XX_XSI2CPP_CSR_VIRT,
53 .pfn = __phys_to_pfn(IXP23XX_XSI2CPP_CSR_PHYS),
54 .length = IXP23XX_XSI2CPP_CSR_SIZE,
55 .type = MT_DEVICE,
56 }, { /* Expansion Bus Config */
57 .virtual = IXP23XX_EXP_CFG_VIRT,
58 .pfn = __phys_to_pfn(IXP23XX_EXP_CFG_PHYS),
59 .length = IXP23XX_EXP_CFG_SIZE,
60 .type = MT_DEVICE,
61 }, { /* UART, Interrupt ctrl, GPIO, timers, NPEs, MACS,.... */
62 .virtual = IXP23XX_PERIPHERAL_VIRT,
63 .pfn = __phys_to_pfn(IXP23XX_PERIPHERAL_PHYS),
64 .length = IXP23XX_PERIPHERAL_SIZE,
65 .type = MT_DEVICE,
66 }, { /* CAP CSRs */
67 .virtual = IXP23XX_CAP_CSR_VIRT,
68 .pfn = __phys_to_pfn(IXP23XX_CAP_CSR_PHYS),
69 .length = IXP23XX_CAP_CSR_SIZE,
70 .type = MT_DEVICE,
71 }, { /* MSF CSRs */
72 .virtual = IXP23XX_MSF_CSR_VIRT,
73 .pfn = __phys_to_pfn(IXP23XX_MSF_CSR_PHYS),
74 .length = IXP23XX_MSF_CSR_SIZE,
75 .type = MT_DEVICE,
76 }, { /* PCI I/O Space */
77 .virtual = IXP23XX_PCI_IO_VIRT,
78 .pfn = __phys_to_pfn(IXP23XX_PCI_IO_PHYS),
79 .length = IXP23XX_PCI_IO_SIZE,
80 .type = MT_DEVICE,
81 }, { /* PCI Config Space */
82 .virtual = IXP23XX_PCI_CFG_VIRT,
83 .pfn = __phys_to_pfn(IXP23XX_PCI_CFG_PHYS),
84 .length = IXP23XX_PCI_CFG_SIZE,
85 .type = MT_DEVICE,
86 }, { /* PCI local CFG CSRs */
87 .virtual = IXP23XX_PCI_CREG_VIRT,
88 .pfn = __phys_to_pfn(IXP23XX_PCI_CREG_PHYS),
89 .length = IXP23XX_PCI_CREG_SIZE,
90 .type = MT_DEVICE,
91 }, { /* PCI MEM Space */
92 .virtual = IXP23XX_PCI_MEM_VIRT,
93 .pfn = __phys_to_pfn(IXP23XX_PCI_MEM_PHYS),
94 .length = IXP23XX_PCI_MEM_SIZE,
95 .type = MT_DEVICE,
96 }
97};
98
99void __init ixp23xx_map_io(void)
100{
101 iotable_init(ixp23xx_io_desc, ARRAY_SIZE(ixp23xx_io_desc));
102}
103
104
105/***************************************************************************
106 * IXP23xx Interrupt Handling
107 ***************************************************************************/
108enum ixp23xx_irq_type {
109 IXP23XX_IRQ_LEVEL, IXP23XX_IRQ_EDGE
110};
111
112static void ixp23xx_config_irq(unsigned int, enum ixp23xx_irq_type);
113
114static int ixp23xx_irq_set_type(struct irq_data *d, unsigned int type)
115{
116 int line = d->irq - IRQ_IXP23XX_GPIO6 + 6;
117 u32 int_style;
118 enum ixp23xx_irq_type irq_type;
119 volatile u32 *int_reg;
120
121 /*
122 * Only GPIOs 6-15 are wired to interrupts on IXP23xx
123 */
124 if (line < 6 || line > 15)
125 return -EINVAL;
126
127 switch (type) {
128 case IRQ_TYPE_EDGE_BOTH:
129 int_style = IXP23XX_GPIO_STYLE_TRANSITIONAL;
130 irq_type = IXP23XX_IRQ_EDGE;
131 break;
132 case IRQ_TYPE_EDGE_RISING:
133 int_style = IXP23XX_GPIO_STYLE_RISING_EDGE;
134 irq_type = IXP23XX_IRQ_EDGE;
135 break;
136 case IRQ_TYPE_EDGE_FALLING:
137 int_style = IXP23XX_GPIO_STYLE_FALLING_EDGE;
138 irq_type = IXP23XX_IRQ_EDGE;
139 break;
140 case IRQ_TYPE_LEVEL_HIGH:
141 int_style = IXP23XX_GPIO_STYLE_ACTIVE_HIGH;
142 irq_type = IXP23XX_IRQ_LEVEL;
143 break;
144 case IRQ_TYPE_LEVEL_LOW:
145 int_style = IXP23XX_GPIO_STYLE_ACTIVE_LOW;
146 irq_type = IXP23XX_IRQ_LEVEL;
147 break;
148 default:
149 return -EINVAL;
150 }
151
152 ixp23xx_config_irq(d->irq, irq_type);
153
154 if (line >= 8) { /* pins 8-15 */
155 line -= 8;
156 int_reg = (volatile u32 *)IXP23XX_GPIO_GPIT2R;
157 } else { /* pins 0-7 */
158 int_reg = (volatile u32 *)IXP23XX_GPIO_GPIT1R;
159 }
160
161 /*
162 * Clear pending interrupts
163 */
164 *IXP23XX_GPIO_GPISR = (1 << line);
165
166 /* Clear the style for the appropriate pin */
167 *int_reg &= ~(IXP23XX_GPIO_STYLE_MASK <<
168 (line * IXP23XX_GPIO_STYLE_SIZE));
169
170 /* Set the new style */
171 *int_reg |= (int_style << (line * IXP23XX_GPIO_STYLE_SIZE));
172
173 return 0;
174}
175
176static void ixp23xx_irq_mask(struct irq_data *d)
177{
178 volatile unsigned long *intr_reg;
179 unsigned int irq = d->irq;
180
181 if (irq >= 56)
182 irq += 8;
183
184 intr_reg = IXP23XX_INTR_EN1 + (irq / 32);
185 *intr_reg &= ~(1 << (irq % 32));
186}
187
188static void ixp23xx_irq_ack(struct irq_data *d)
189{
190 int line = d->irq - IRQ_IXP23XX_GPIO6 + 6;
191
192 if ((line < 6) || (line > 15))
193 return;
194
195 *IXP23XX_GPIO_GPISR = (1 << line);
196}
197
198/*
199 * Level triggered interrupts on GPIO lines can only be cleared when the
200 * interrupt condition disappears.
201 */
202static void ixp23xx_irq_level_unmask(struct irq_data *d)
203{
204 volatile unsigned long *intr_reg;
205 unsigned int irq = d->irq;
206
207 ixp23xx_irq_ack(d);
208
209 if (irq >= 56)
210 irq += 8;
211
212 intr_reg = IXP23XX_INTR_EN1 + (irq / 32);
213 *intr_reg |= (1 << (irq % 32));
214}
215
216static void ixp23xx_irq_edge_unmask(struct irq_data *d)
217{
218 volatile unsigned long *intr_reg;
219 unsigned int irq = d->irq;
220
221 if (irq >= 56)
222 irq += 8;
223
224 intr_reg = IXP23XX_INTR_EN1 + (irq / 32);
225 *intr_reg |= (1 << (irq % 32));
226}
227
228static struct irq_chip ixp23xx_irq_level_chip = {
229 .irq_ack = ixp23xx_irq_mask,
230 .irq_mask = ixp23xx_irq_mask,
231 .irq_unmask = ixp23xx_irq_level_unmask,
232 .irq_set_type = ixp23xx_irq_set_type
233};
234
235static struct irq_chip ixp23xx_irq_edge_chip = {
236 .irq_ack = ixp23xx_irq_ack,
237 .irq_mask = ixp23xx_irq_mask,
238 .irq_unmask = ixp23xx_irq_edge_unmask,
239 .irq_set_type = ixp23xx_irq_set_type
240};
241
242static void ixp23xx_pci_irq_mask(struct irq_data *d)
243{
244 unsigned int irq = d->irq;
245
246 *IXP23XX_PCI_XSCALE_INT_ENABLE &= ~(1 << (IRQ_IXP23XX_INTA + 27 - irq));
247}
248
249static void ixp23xx_pci_irq_unmask(struct irq_data *d)
250{
251 unsigned int irq = d->irq;
252
253 *IXP23XX_PCI_XSCALE_INT_ENABLE |= (1 << (IRQ_IXP23XX_INTA + 27 - irq));
254}
255
256/*
257 * TODO: Should this just be done at ASM level?
258 */
259static void pci_handler(unsigned int irq, struct irq_desc *desc)
260{
261 u32 pci_interrupt;
262 unsigned int irqno;
263
264 pci_interrupt = *IXP23XX_PCI_XSCALE_INT_STATUS;
265
266 desc->irq_data.chip->irq_ack(&desc->irq_data);
267
268 /* See which PCI_INTA, or PCI_INTB interrupted */
269 if (pci_interrupt & (1 << 26)) {
270 irqno = IRQ_IXP23XX_INTB;
271 } else if (pci_interrupt & (1 << 27)) {
272 irqno = IRQ_IXP23XX_INTA;
273 } else {
274 BUG();
275 }
276
277 generic_handle_irq(irqno);
278
279 desc->irq_data.chip->irq_unmask(&desc->irq_data);
280}
281
282static struct irq_chip ixp23xx_pci_irq_chip = {
283 .irq_ack = ixp23xx_pci_irq_mask,
284 .irq_mask = ixp23xx_pci_irq_mask,
285 .irq_unmask = ixp23xx_pci_irq_unmask
286};
287
288static void ixp23xx_config_irq(unsigned int irq, enum ixp23xx_irq_type type)
289{
290 switch (type) {
291 case IXP23XX_IRQ_LEVEL:
292 irq_set_chip_and_handler(irq, &ixp23xx_irq_level_chip,
293 handle_level_irq);
294 break;
295 case IXP23XX_IRQ_EDGE:
296 irq_set_chip_and_handler(irq, &ixp23xx_irq_edge_chip,
297 handle_edge_irq);
298 break;
299 }
300 set_irq_flags(irq, IRQF_VALID);
301}
302
303void __init ixp23xx_init_irq(void)
304{
305 int irq;
306
307 /* Route everything to IRQ */
308 *IXP23XX_INTR_SEL1 = 0x0;
309 *IXP23XX_INTR_SEL2 = 0x0;
310 *IXP23XX_INTR_SEL3 = 0x0;
311 *IXP23XX_INTR_SEL4 = 0x0;
312
313 /* Mask all sources */
314 *IXP23XX_INTR_EN1 = 0x0;
315 *IXP23XX_INTR_EN2 = 0x0;
316 *IXP23XX_INTR_EN3 = 0x0;
317 *IXP23XX_INTR_EN4 = 0x0;
318
319 /*
320 * Configure all IRQs for level-sensitive operation
321 */
322 for (irq = 0; irq <= NUM_IXP23XX_RAW_IRQS; irq++) {
323 ixp23xx_config_irq(irq, IXP23XX_IRQ_LEVEL);
324 }
325
326 for (irq = IRQ_IXP23XX_INTA; irq <= IRQ_IXP23XX_INTB; irq++) {
327 irq_set_chip_and_handler(irq, &ixp23xx_pci_irq_chip,
328 handle_level_irq);
329 set_irq_flags(irq, IRQF_VALID);
330 }
331
332 irq_set_chained_handler(IRQ_IXP23XX_PCI_INT_RPH, pci_handler);
333}
334
335
336/*************************************************************************
337 * Timer-tick functions for IXP23xx
338 *************************************************************************/
339#define CLOCK_TICKS_PER_USEC (CLOCK_TICK_RATE / USEC_PER_SEC)
340
341static unsigned long next_jiffy_time;
342
343static unsigned long
344ixp23xx_gettimeoffset(void)
345{
346 unsigned long elapsed;
347
348 elapsed = *IXP23XX_TIMER_CONT - (next_jiffy_time - LATCH);
349
350 return elapsed / CLOCK_TICKS_PER_USEC;
351}
352
353static irqreturn_t
354ixp23xx_timer_interrupt(int irq, void *dev_id)
355{
356 /* Clear Pending Interrupt by writing '1' to it */
357 *IXP23XX_TIMER_STATUS = IXP23XX_TIMER1_INT_PEND;
358 while ((signed long)(*IXP23XX_TIMER_CONT - next_jiffy_time) >= LATCH) {
359 timer_tick();
360 next_jiffy_time += LATCH;
361 }
362
363 return IRQ_HANDLED;
364}
365
366static struct irqaction ixp23xx_timer_irq = {
367 .name = "IXP23xx Timer Tick",
368 .handler = ixp23xx_timer_interrupt,
369 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
370};
371
372void __init ixp23xx_init_timer(void)
373{
374 /* Clear Pending Interrupt by writing '1' to it */
375 *IXP23XX_TIMER_STATUS = IXP23XX_TIMER1_INT_PEND;
376
377 /* Setup the Timer counter value */
378 *IXP23XX_TIMER1_RELOAD =
379 (LATCH & ~IXP23XX_TIMER_RELOAD_MASK) | IXP23XX_TIMER_ENABLE;
380
381 *IXP23XX_TIMER_CONT = 0;
382 next_jiffy_time = LATCH;
383
384 /* Connect the interrupt handler and enable the interrupt */
385 setup_irq(IRQ_IXP23XX_TIMER1, &ixp23xx_timer_irq);
386}
387
388struct sys_timer ixp23xx_timer = {
389 .init = ixp23xx_init_timer,
390 .offset = ixp23xx_gettimeoffset,
391};
392
393
394/*************************************************************************
395 * IXP23xx Platform Initialization
396 *************************************************************************/
397static struct resource ixp23xx_uart_resources[] = {
398 {
399 .start = IXP23XX_UART1_PHYS,
400 .end = IXP23XX_UART1_PHYS + 0x0fff,
401 .flags = IORESOURCE_MEM
402 }, {
403 .start = IXP23XX_UART2_PHYS,
404 .end = IXP23XX_UART2_PHYS + 0x0fff,
405 .flags = IORESOURCE_MEM
406 }
407};
408
409static struct plat_serial8250_port ixp23xx_uart_data[] = {
410 {
411 .mapbase = IXP23XX_UART1_PHYS,
412 .membase = (char *)(IXP23XX_UART1_VIRT + 3),
413 .irq = IRQ_IXP23XX_UART1,
414 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
415 .iotype = UPIO_MEM,
416 .regshift = 2,
417 .uartclk = IXP23XX_UART_XTAL,
418 }, {
419 .mapbase = IXP23XX_UART2_PHYS,
420 .membase = (char *)(IXP23XX_UART2_VIRT + 3),
421 .irq = IRQ_IXP23XX_UART2,
422 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
423 .iotype = UPIO_MEM,
424 .regshift = 2,
425 .uartclk = IXP23XX_UART_XTAL,
426 },
427 { },
428};
429
430static struct platform_device ixp23xx_uart = {
431 .name = "serial8250",
432 .id = 0,
433 .dev.platform_data = ixp23xx_uart_data,
434 .num_resources = 2,
435 .resource = ixp23xx_uart_resources,
436};
437
438static struct platform_device *ixp23xx_devices[] __initdata = {
439 &ixp23xx_uart,
440};
441
442void __init ixp23xx_sys_init(void)
443{
444 /* by default, the idle code is disabled */
445 disable_hlt();
446
447 *IXP23XX_EXP_UNIT_FUSE |= 0xf;
448 platform_add_devices(ixp23xx_devices, ARRAY_SIZE(ixp23xx_devices));
449}
450
451void ixp23xx_restart(char mode, const char *cmd)
452{
453 /* Use on-chip reset capability */
454 *IXP23XX_RESET0 |= IXP23XX_RST_ALL;
455}
diff --git a/arch/arm/mach-ixp23xx/espresso.c b/arch/arm/mach-ixp23xx/espresso.c
deleted file mode 100644
index d142d45dea12..000000000000
--- a/arch/arm/mach-ixp23xx/espresso.c
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/espresso.c
3 *
4 * Double Espresso-specific routines
5 *
6 * Author: Lennert Buytenhek <buytenh@wantstofly.org>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/spinlock.h>
16#include <linux/sched.h>
17#include <linux/interrupt.h>
18#include <linux/serial.h>
19#include <linux/tty.h>
20#include <linux/bitops.h>
21#include <linux/ioport.h>
22#include <linux/serial_8250.h>
23#include <linux/serial_core.h>
24#include <linux/device.h>
25#include <linux/mm.h>
26#include <linux/pci.h>
27#include <linux/mtd/physmap.h>
28
29#include <asm/types.h>
30#include <asm/setup.h>
31#include <asm/memory.h>
32#include <mach/hardware.h>
33#include <asm/mach-types.h>
34#include <asm/irq.h>
35#include <asm/tlbflush.h>
36#include <asm/pgtable.h>
37
38#include <asm/mach/map.h>
39#include <asm/mach/irq.h>
40#include <asm/mach/arch.h>
41#include <asm/mach/pci.h>
42
43static int __init espresso_pci_init(void)
44{
45 if (machine_is_espresso())
46 ixp23xx_pci_slave_init();
47
48 return 0;
49};
50subsys_initcall(espresso_pci_init);
51
52static struct physmap_flash_data espresso_flash_data = {
53 .width = 2,
54};
55
56static struct resource espresso_flash_resource = {
57 .start = 0x90000000,
58 .end = 0x91ffffff,
59 .flags = IORESOURCE_MEM,
60};
61
62static struct platform_device espresso_flash = {
63 .name = "physmap-flash",
64 .id = 0,
65 .dev = {
66 .platform_data = &espresso_flash_data,
67 },
68 .num_resources = 1,
69 .resource = &espresso_flash_resource,
70};
71
72static void __init espresso_init(void)
73{
74 platform_device_register(&espresso_flash);
75
76 /*
77 * Mark flash as writeable.
78 */
79 IXP23XX_EXP_CS0[0] |= IXP23XX_FLASH_WRITABLE;
80 IXP23XX_EXP_CS0[1] |= IXP23XX_FLASH_WRITABLE;
81
82 ixp23xx_sys_init();
83}
84
85MACHINE_START(ESPRESSO, "IP Fabrics Double Espresso")
86 /* Maintainer: Lennert Buytenhek */
87 .map_io = ixp23xx_map_io,
88 .init_irq = ixp23xx_init_irq,
89 .timer = &ixp23xx_timer,
90 .atag_offset = 0x100,
91 .init_machine = espresso_init,
92 .restart = ixp23xx_restart,
93MACHINE_END
diff --git a/arch/arm/mach-ixp23xx/include/mach/debug-macro.S b/arch/arm/mach-ixp23xx/include/mach/debug-macro.S
deleted file mode 100644
index 5ff524c13744..000000000000
--- a/arch/arm/mach-ixp23xx/include/mach/debug-macro.S
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/debug-macro.S
3 *
4 * Debugging macro include header
5 *
6 * Copyright (C) 1994-1999 Russell King
7 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#include <mach/ixp23xx.h>
14
15 .macro addruart, rp, rv, tmp
16 ldr \rp, =IXP23XX_PERIPHERAL_PHYS @ physical
17 ldr \rv, =IXP23XX_PERIPHERAL_VIRT @ virtual
18#ifdef __ARMEB__
19 orr \rp, \rp, #0x00000003
20 orr \rv, \rv, #0x00000003
21#endif
22 .endm
23
24#define UART_SHIFT 2
25#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-ixp23xx/include/mach/entry-macro.S b/arch/arm/mach-ixp23xx/include/mach/entry-macro.S
deleted file mode 100644
index 3fd2cb984e42..000000000000
--- a/arch/arm/mach-ixp23xx/include/mach/entry-macro.S
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/entry-macro.S
3 */
4
5 .macro get_irqnr_preamble, base, tmp
6 .endm
7
8 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
9 ldr \irqnr, =(IXP23XX_INTC_VIRT + IXP23XX_INTR_IRQ_ENC_ST_OFFSET)
10 ldr \irqnr, [\irqnr] @ get interrupt number
11 cmp \irqnr, #0x0 @ spurious interrupt ?
12 movne \irqnr, \irqnr, lsr #2 @ skip unwanted low order bits
13 subne \irqnr, \irqnr, #1 @ convert to 0 based
14
15#if 0
16 cmp \irqnr, #IRQ_IXP23XX_PCI_INT_RPH
17 bne 1001f
18 mov \irqnr, #IRQ_IXP23XX_INTA
19
20 ldr \irqnr, =0xf5000030
21
22 mov \tmp, #(1<<26)
23 tst \irqnr, \tmp
24 movne \irqnr, #IRQ_IXP23XX_INTB
25
26 mov \tmp, #(1<<27)
27 tst \irqnr, \tmp
28 movne \irqnr, #IRQ_IXP23XX_INTA
291001:
30#endif
31 .endm
diff --git a/arch/arm/mach-ixp23xx/include/mach/hardware.h b/arch/arm/mach-ixp23xx/include/mach/hardware.h
deleted file mode 100644
index 60e55fa10238..000000000000
--- a/arch/arm/mach-ixp23xx/include/mach/hardware.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/hardware.h
3 *
4 * Copyright (C) 2002-2004 Intel Corporation.
5 * Copyricht (C) 2005 MontaVista Software, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * Hardware definitions for IXP23XX based systems
12 */
13
14#ifndef __ASM_ARCH_HARDWARE_H
15#define __ASM_ARCH_HARDWARE_H
16
17/* PCI IO info */
18
19#include "ixp23xx.h"
20
21/*
22 * Platform helper functions
23 */
24#include "platform.h"
25
26/*
27 * Platform-specific headers
28 */
29#include "ixdp2351.h"
30
31
32#endif
diff --git a/arch/arm/mach-ixp23xx/include/mach/io.h b/arch/arm/mach-ixp23xx/include/mach/io.h
deleted file mode 100644
index a7aceb55c130..000000000000
--- a/arch/arm/mach-ixp23xx/include/mach/io.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/io.h
3 *
4 * Original Author: Naeem M Afzal <naeem.m.afzal@intel.com>
5 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
6 *
7 * Copyright (C) 2003-2005 Intel Corp.
8 * Copyright (C) 2005 MontaVista Software, Inc
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef __ASM_ARCH_IO_H
16#define __ASM_ARCH_IO_H
17
18#define IO_SPACE_LIMIT 0xffffffff
19
20#define __io(p) ((void __iomem*)((p) + IXP23XX_PCI_IO_VIRT))
21
22#endif
diff --git a/arch/arm/mach-ixp23xx/include/mach/irqs.h b/arch/arm/mach-ixp23xx/include/mach/irqs.h
deleted file mode 100644
index 3af33a04b8a2..000000000000
--- a/arch/arm/mach-ixp23xx/include/mach/irqs.h
+++ /dev/null
@@ -1,223 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/irqs.h
3 *
4 * IRQ definitions for IXP23XX based systems
5 *
6 * Author: Naeem Afzal <naeem.m.afzal@intel.com>
7 *
8 * Copyright (C) 2003-2004 Intel Corporation.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef __ASM_ARCH_IRQS_H
16#define __ASM_ARCH_IRQS_H
17
18#define NR_IXP23XX_IRQS IRQ_IXP23XX_INTB+1
19#define IRQ_IXP23XX_EXTIRQS NR_IXP23XX_IRQS
20
21
22#define IRQ_IXP23XX_DBG0 0 /* Debug/Execution/MBox */
23#define IRQ_IXP23XX_DBG1 1 /* Debug/Execution/MBox */
24#define IRQ_IXP23XX_NPE_TRG 2 /* npe_trigger */
25#define IRQ_IXP23XX_TIMER1 3 /* Timer[0] */
26#define IRQ_IXP23XX_TIMER2 4 /* Timer[1] */
27#define IRQ_IXP23XX_TIMESTAMP 5 /* Timer[2], Time-stamp */
28#define IRQ_IXP23XX_WDOG 6 /* Time[3], Watchdog Timer */
29#define IRQ_IXP23XX_PCI_DBELL 7 /* PCI Doorbell */
30#define IRQ_IXP23XX_PCI_DMA1 8 /* PCI DMA Channel 1 */
31#define IRQ_IXP23XX_PCI_DMA2 9 /* PCI DMA Channel 2 */
32#define IRQ_IXP23XX_PCI_DMA3 10 /* PCI DMA Channel 3 */
33#define IRQ_IXP23XX_PCI_INT_RPH 11 /* pcxg_pci_int_rph */
34#define IRQ_IXP23XX_CPP_PMU 12 /* xpxg_pm_int_rpl */
35#define IRQ_IXP23XX_SWINT0 13 /* S/W Interrupt0 */
36#define IRQ_IXP23XX_SWINT1 14 /* S/W Interrupt1 */
37#define IRQ_IXP23XX_UART2 15 /* UART1 Interrupt */
38#define IRQ_IXP23XX_UART1 16 /* UART0 Interrupt */
39#define IRQ_IXP23XX_XSI_PMU_ROLLOVER 17 /* AHB Performance M. Unit counter rollover */
40#define IRQ_IXP23XX_XSI_AHB_PM0 18 /* intr_pm_o */
41#define IRQ_IXP23XX_XSI_AHB_ECE0 19 /* intr_ece_o */
42#define IRQ_IXP23XX_XSI_AHB_GASKET 20 /* gas_intr_o */
43#define IRQ_IXP23XX_XSI_CPP 21 /* xsi2cpp_int */
44#define IRQ_IXP23XX_CPP_XSI 22 /* cpp2xsi_int */
45#define IRQ_IXP23XX_ME_ATTN0 23 /* ME_ATTN */
46#define IRQ_IXP23XX_ME_ATTN1 24 /* ME_ATTN */
47#define IRQ_IXP23XX_ME_ATTN2 25 /* ME_ATTN */
48#define IRQ_IXP23XX_ME_ATTN3 26 /* ME_ATTN */
49#define IRQ_IXP23XX_PCI_ERR_RPH 27 /* PCXG_PCI_ERR_RPH */
50#define IRQ_IXP23XX_D0XG_ECC_CORR 28 /* D0XG_DRAM_ECC_CORR */
51#define IRQ_IXP23XX_D0XG_ECC_UNCORR 29 /* D0XG_DRAM_ECC_UNCORR */
52#define IRQ_IXP23XX_SRAM_ERR1 30 /* SRAM1_ERR */
53#define IRQ_IXP23XX_SRAM_ERR0 31 /* SRAM0_ERR */
54#define IRQ_IXP23XX_MEDIA_ERR 32 /* MEDIA_ERR */
55#define IRQ_IXP23XX_STH_DRAM_ECC_MAJ 33 /* STH_DRAM0_ECC_MAJ */
56#define IRQ_IXP23XX_GPIO6 34 /* GPIO0 interrupts */
57#define IRQ_IXP23XX_GPIO7 35 /* GPIO1 interrupts */
58#define IRQ_IXP23XX_GPIO8 36 /* GPIO2 interrupts */
59#define IRQ_IXP23XX_GPIO9 37 /* GPIO3 interrupts */
60#define IRQ_IXP23XX_GPIO10 38 /* GPIO4 interrupts */
61#define IRQ_IXP23XX_GPIO11 39 /* GPIO5 interrupts */
62#define IRQ_IXP23XX_GPIO12 40 /* GPIO6 interrupts */
63#define IRQ_IXP23XX_GPIO13 41 /* GPIO7 interrupts */
64#define IRQ_IXP23XX_GPIO14 42 /* GPIO8 interrupts */
65#define IRQ_IXP23XX_GPIO15 43 /* GPIO9 interrupts */
66#define IRQ_IXP23XX_SHAC_RING0 44 /* SHAC Ring Full */
67#define IRQ_IXP23XX_SHAC_RING1 45 /* SHAC Ring Full */
68#define IRQ_IXP23XX_SHAC_RING2 46 /* SHAC Ring Full */
69#define IRQ_IXP23XX_SHAC_RING3 47 /* SHAC Ring Full */
70#define IRQ_IXP23XX_SHAC_RING4 48 /* SHAC Ring Full */
71#define IRQ_IXP23XX_SHAC_RING5 49 /* SHAC Ring Full */
72#define IRQ_IXP23XX_SHAC_RING6 50 /* SHAC RING Full */
73#define IRQ_IXP23XX_SHAC_RING7 51 /* SHAC Ring Full */
74#define IRQ_IXP23XX_SHAC_RING8 52 /* SHAC Ring Full */
75#define IRQ_IXP23XX_SHAC_RING9 53 /* SHAC Ring Full */
76#define IRQ_IXP23XX_SHAC_RING10 54 /* SHAC Ring Full */
77#define IRQ_IXP23XX_SHAC_RING11 55 /* SHAC Ring Full */
78#define IRQ_IXP23XX_ME_THREAD_A0_ME0 56 /* ME_THREAD_A */
79#define IRQ_IXP23XX_ME_THREAD_A1_ME0 57 /* ME_THREAD_A */
80#define IRQ_IXP23XX_ME_THREAD_A2_ME0 58 /* ME_THREAD_A */
81#define IRQ_IXP23XX_ME_THREAD_A3_ME0 59 /* ME_THREAD_A */
82#define IRQ_IXP23XX_ME_THREAD_A4_ME0 60 /* ME_THREAD_A */
83#define IRQ_IXP23XX_ME_THREAD_A5_ME0 61 /* ME_THREAD_A */
84#define IRQ_IXP23XX_ME_THREAD_A6_ME0 62 /* ME_THREAD_A */
85#define IRQ_IXP23XX_ME_THREAD_A7_ME0 63 /* ME_THREAD_A */
86#define IRQ_IXP23XX_ME_THREAD_A8_ME1 64 /* ME_THREAD_A */
87#define IRQ_IXP23XX_ME_THREAD_A9_ME1 65 /* ME_THREAD_A */
88#define IRQ_IXP23XX_ME_THREAD_A10_ME1 66 /* ME_THREAD_A */
89#define IRQ_IXP23XX_ME_THREAD_A11_ME1 67 /* ME_THREAD_A */
90#define IRQ_IXP23XX_ME_THREAD_A12_ME1 68 /* ME_THREAD_A */
91#define IRQ_IXP23XX_ME_THREAD_A13_ME1 69 /* ME_THREAD_A */
92#define IRQ_IXP23XX_ME_THREAD_A14_ME1 70 /* ME_THREAD_A */
93#define IRQ_IXP23XX_ME_THREAD_A15_ME1 71 /* ME_THREAD_A */
94#define IRQ_IXP23XX_ME_THREAD_A16_ME2 72 /* ME_THREAD_A */
95#define IRQ_IXP23XX_ME_THREAD_A17_ME2 73 /* ME_THREAD_A */
96#define IRQ_IXP23XX_ME_THREAD_A18_ME2 74 /* ME_THREAD_A */
97#define IRQ_IXP23XX_ME_THREAD_A19_ME2 75 /* ME_THREAD_A */
98#define IRQ_IXP23XX_ME_THREAD_A20_ME2 76 /* ME_THREAD_A */
99#define IRQ_IXP23XX_ME_THREAD_A21_ME2 77 /* ME_THREAD_A */
100#define IRQ_IXP23XX_ME_THREAD_A22_ME2 78 /* ME_THREAD_A */
101#define IRQ_IXP23XX_ME_THREAD_A23_ME2 79 /* ME_THREAD_A */
102#define IRQ_IXP23XX_ME_THREAD_A24_ME3 80 /* ME_THREAD_A */
103#define IRQ_IXP23XX_ME_THREAD_A25_ME3 81 /* ME_THREAD_A */
104#define IRQ_IXP23XX_ME_THREAD_A26_ME3 82 /* ME_THREAD_A */
105#define IRQ_IXP23XX_ME_THREAD_A27_ME3 83 /* ME_THREAD_A */
106#define IRQ_IXP23XX_ME_THREAD_A28_ME3 84 /* ME_THREAD_A */
107#define IRQ_IXP23XX_ME_THREAD_A29_ME3 85 /* ME_THREAD_A */
108#define IRQ_IXP23XX_ME_THREAD_A30_ME3 86 /* ME_THREAD_A */
109#define IRQ_IXP23XX_ME_THREAD_A31_ME3 87 /* ME_THREAD_A */
110#define IRQ_IXP23XX_ME_THREAD_B0_ME0 88 /* ME_THREAD_B */
111#define IRQ_IXP23XX_ME_THREAD_B1_ME0 89 /* ME_THREAD_B */
112#define IRQ_IXP23XX_ME_THREAD_B2_ME0 90 /* ME_THREAD_B */
113#define IRQ_IXP23XX_ME_THREAD_B3_ME0 91 /* ME_THREAD_B */
114#define IRQ_IXP23XX_ME_THREAD_B4_ME0 92 /* ME_THREAD_B */
115#define IRQ_IXP23XX_ME_THREAD_B5_ME0 93 /* ME_THREAD_B */
116#define IRQ_IXP23XX_ME_THREAD_B6_ME0 94 /* ME_THREAD_B */
117#define IRQ_IXP23XX_ME_THREAD_B7_ME0 95 /* ME_THREAD_B */
118#define IRQ_IXP23XX_ME_THREAD_B8_ME1 96 /* ME_THREAD_B */
119#define IRQ_IXP23XX_ME_THREAD_B9_ME1 97 /* ME_THREAD_B */
120#define IRQ_IXP23XX_ME_THREAD_B10_ME1 98 /* ME_THREAD_B */
121#define IRQ_IXP23XX_ME_THREAD_B11_ME1 99 /* ME_THREAD_B */
122#define IRQ_IXP23XX_ME_THREAD_B12_ME1 100 /* ME_THREAD_B */
123#define IRQ_IXP23XX_ME_THREAD_B13_ME1 101 /* ME_THREAD_B */
124#define IRQ_IXP23XX_ME_THREAD_B14_ME1 102 /* ME_THREAD_B */
125#define IRQ_IXP23XX_ME_THREAD_B15_ME1 103 /* ME_THREAD_B */
126#define IRQ_IXP23XX_ME_THREAD_B16_ME2 104 /* ME_THREAD_B */
127#define IRQ_IXP23XX_ME_THREAD_B17_ME2 105 /* ME_THREAD_B */
128#define IRQ_IXP23XX_ME_THREAD_B18_ME2 106 /* ME_THREAD_B */
129#define IRQ_IXP23XX_ME_THREAD_B19_ME2 107 /* ME_THREAD_B */
130#define IRQ_IXP23XX_ME_THREAD_B20_ME2 108 /* ME_THREAD_B */
131#define IRQ_IXP23XX_ME_THREAD_B21_ME2 109 /* ME_THREAD_B */
132#define IRQ_IXP23XX_ME_THREAD_B22_ME2 110 /* ME_THREAD_B */
133#define IRQ_IXP23XX_ME_THREAD_B23_ME2 111 /* ME_THREAD_B */
134#define IRQ_IXP23XX_ME_THREAD_B24_ME3 112 /* ME_THREAD_B */
135#define IRQ_IXP23XX_ME_THREAD_B25_ME3 113 /* ME_THREAD_B */
136#define IRQ_IXP23XX_ME_THREAD_B26_ME3 114 /* ME_THREAD_B */
137#define IRQ_IXP23XX_ME_THREAD_B27_ME3 115 /* ME_THREAD_B */
138#define IRQ_IXP23XX_ME_THREAD_B28_ME3 116 /* ME_THREAD_B */
139#define IRQ_IXP23XX_ME_THREAD_B29_ME3 117 /* ME_THREAD_B */
140#define IRQ_IXP23XX_ME_THREAD_B30_ME3 118 /* ME_THREAD_B */
141#define IRQ_IXP23XX_ME_THREAD_B31_ME3 119 /* ME_THREAD_B */
142
143#define NUM_IXP23XX_RAW_IRQS 120
144
145#define IRQ_IXP23XX_INTA 120 /* Indirect pcxg_pci_int_rph */
146#define IRQ_IXP23XX_INTB 121 /* Indirect pcxg_pci_int_rph */
147
148#define NR_IXP23XX_IRQ (IRQ_IXP23XX_INTB + 1)
149
150/*
151 * We default to 32 per-board IRQs. Increase this number if you need
152 * more, but keep it realistic.
153 */
154#define NR_IXP23XX_MACH_IRQS 32
155
156#define NR_IRQS (NR_IXP23XX_IRQS + NR_IXP23XX_MACH_IRQS)
157
158#define IXP23XX_MACH_IRQ(irq) (NR_IXP23XX_IRQ + (irq))
159
160
161/*
162 * IXDP2351-specific interrupts
163 */
164
165/*
166 * External PCI interrupts signaled through INTB
167 *
168 */
169#define IXDP2351_INTB_IRQ_BASE 0
170#define IRQ_IXDP2351_INTA_82546 IXP23XX_MACH_IRQ(0)
171#define IRQ_IXDP2351_INTB_82546 IXP23XX_MACH_IRQ(1)
172#define IRQ_IXDP2351_SPCI_DB_0 IXP23XX_MACH_IRQ(2)
173#define IRQ_IXDP2351_SPCI_DB_1 IXP23XX_MACH_IRQ(3)
174#define IRQ_IXDP2351_SPCI_PMC_INTA IXP23XX_MACH_IRQ(4)
175#define IRQ_IXDP2351_SPCI_PMC_INTB IXP23XX_MACH_IRQ(5)
176#define IRQ_IXDP2351_SPCI_PMC_INTC IXP23XX_MACH_IRQ(6)
177#define IRQ_IXDP2351_SPCI_PMC_INTD IXP23XX_MACH_IRQ(7)
178#define IRQ_IXDP2351_SPCI_FIC IXP23XX_MACH_IRQ(8)
179
180#define IXDP2351_INTB_IRQ_BIT(irq) (irq - IXP23XX_MACH_IRQ(0))
181#define IXDP2351_INTB_IRQ_MASK(irq) (1 << IXDP2351_INTB_IRQ_BIT(irq))
182#define IXDP2351_INTB_IRQ_VALID 0x01FF
183#define IXDP2351_INTB_IRQ_NUM 16
184
185/*
186 * Other external interrupts signaled through INTA
187 */
188#define IXDP2351_INTA_IRQ_BASE 16
189#define IRQ_IXDP2351_IPMI_FROM IXP23XX_MACH_IRQ(16)
190#define IRQ_IXDP2351_125US IXP23XX_MACH_IRQ(17)
191#define IRQ_IXDP2351_DB_0_ADD IXP23XX_MACH_IRQ(18)
192#define IRQ_IXDP2351_DB_1_ADD IXP23XX_MACH_IRQ(19)
193#define IRQ_IXDP2351_DEBUG1 IXP23XX_MACH_IRQ(20)
194#define IRQ_IXDP2351_ADD_UART IXP23XX_MACH_IRQ(21)
195#define IRQ_IXDP2351_FIC_ADD IXP23XX_MACH_IRQ(24)
196#define IRQ_IXDP2351_CS8900 IXP23XX_MACH_IRQ(25)
197#define IRQ_IXDP2351_BBSRAM IXP23XX_MACH_IRQ(26)
198#define IRQ_IXDP2351_CONFIG_MEDIA IXP23XX_MACH_IRQ(27)
199#define IRQ_IXDP2351_CLOCK_REF IXP23XX_MACH_IRQ(28)
200#define IRQ_IXDP2351_A10_NP IXP23XX_MACH_IRQ(29)
201#define IRQ_IXDP2351_A11_NP IXP23XX_MACH_IRQ(30)
202#define IRQ_IXDP2351_DEBUG_NP IXP23XX_MACH_IRQ(31)
203
204#define IXDP2351_INTA_IRQ_BIT(irq) (irq - IXP23XX_MACH_IRQ(16))
205#define IXDP2351_INTA_IRQ_MASK(irq) (1 << IXDP2351_INTA_IRQ_BIT(irq))
206#define IXDP2351_INTA_IRQ_VALID 0xFF3F
207#define IXDP2351_INTA_IRQ_NUM 16
208
209
210/*
211 * ADI RoadRunner IRQs
212 */
213#define IRQ_ROADRUNNER_PCI_INTA IRQ_IXP23XX_INTA
214#define IRQ_ROADRUNNER_PCI_INTB IRQ_IXP23XX_INTB
215#define IRQ_ROADRUNNER_PCI_INTC IRQ_IXP23XX_GPIO11
216#define IRQ_ROADRUNNER_PCI_INTD IRQ_IXP23XX_GPIO12
217
218/*
219 * Put new board definitions here
220 */
221
222
223#endif
diff --git a/arch/arm/mach-ixp23xx/include/mach/ixdp2351.h b/arch/arm/mach-ixp23xx/include/mach/ixdp2351.h
deleted file mode 100644
index 663951027de5..000000000000
--- a/arch/arm/mach-ixp23xx/include/mach/ixdp2351.h
+++ /dev/null
@@ -1,89 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/ixdp2351.h
3 *
4 * Register and other defines for IXDP2351
5 *
6 * Copyright (c) 2002-2004 Intel Corp.
7 * Copytight (c) 2005 MontaVista Software, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14
15#ifndef __ASM_ARCH_IXDP2351_H
16#define __ASM_ARCH_IXDP2351_H
17
18/*
19 * NP module memory map
20 */
21#define IXDP2351_NP_PHYS_BASE (IXP23XX_EXP_BUS_CS4_BASE)
22#define IXDP2351_NP_PHYS_SIZE 0x00100000
23#define IXDP2351_NP_VIRT_BASE 0xeff00000
24
25#define IXDP2351_VIRT_CS8900_BASE (IXDP2351_NP_VIRT_BASE)
26#define IXDP2351_VIRT_CS8900_END (IXDP2351_VIRT_CS8900_BASE + 16)
27
28#define IXDP2351_VIRT_NP_CPLD_BASE (IXP23XX_EXP_BUS_CS4_BASE_VIRT + 0x00010000)
29
30#define IXDP2351_NP_CPLD_REG(reg) ((volatile u16 *)(IXDP2351_VIRT_NP_CPLD_BASE + reg))
31
32#define IXDP2351_NP_CPLD_RESET1_REG IXDP2351_NP_CPLD_REG(0x00)
33#define IXDP2351_NP_CPLD_LED_REG IXDP2351_NP_CPLD_REG(0x02)
34#define IXDP2351_NP_CPLD_VERSION_REG IXDP2351_NP_CPLD_REG(0x04)
35
36/*
37 * Base board module memory map
38 */
39
40#define IXDP2351_BB_BASE_PHYS (IXP23XX_EXP_BUS_CS5_BASE)
41#define IXDP2351_BB_SIZE 0x01000000
42#define IXDP2351_BB_BASE_VIRT (0xee000000)
43
44#define IXDP2351_BB_AREA_BASE(offset) (IXDP2351_BB_BASE_VIRT + offset)
45
46#define IXDP2351_VIRT_NVRAM_BASE IXDP2351_BB_AREA_BASE(0x0)
47#define IXDP2351_NVRAM_SIZE (0x20000)
48
49#define IXDP2351_VIRT_MB_IXF1104_BASE IXDP2351_BB_AREA_BASE(0x00020000)
50#define IXDP2351_VIRT_ADD_UART_BASE IXDP2351_BB_AREA_BASE(0x000240C0)
51#define IXDP2351_VIRT_FIC_BASE IXDP2351_BB_AREA_BASE(0x00200000)
52#define IXDP2351_VIRT_DB0_BASE IXDP2351_BB_AREA_BASE(0x00400000)
53#define IXDP2351_VIRT_DB1_BASE IXDP2351_BB_AREA_BASE(0x00600000)
54#define IXDP2351_VIRT_CPLD_BASE IXDP2351_BB_AREA_BASE(0x00024000)
55
56/*
57 * On board CPLD registers
58 */
59#define IXDP2351_CPLD_BB_REG(reg) ((volatile u16 *)(IXDP2351_VIRT_CPLD_BASE + reg))
60
61#define IXDP2351_CPLD_RESET0_REG IXDP2351_CPLD_BB_REG(0x00)
62#define IXDP2351_CPLD_RESET1_REG IXDP2351_CPLD_BB_REG(0x04)
63
64#define IXDP2351_CPLD_RESET1_MAGIC 0x55AA
65#define IXDP2351_CPLD_RESET1_ENABLE 0x8000
66
67#define IXDP2351_CPLD_FPGA_CONFIG_REG IXDP2351_CPLD_BB_REG(0x08)
68#define IXDP2351_CPLD_INTB_MASK_SET_REG IXDP2351_CPLD_BB_REG(0x10)
69#define IXDP2351_CPLD_INTA_MASK_SET_REG IXDP2351_CPLD_BB_REG(0x14)
70#define IXDP2351_CPLD_INTB_STAT_REG IXDP2351_CPLD_BB_REG(0x18)
71#define IXDP2351_CPLD_INTA_STAT_REG IXDP2351_CPLD_BB_REG(0x1C)
72#define IXDP2351_CPLD_INTB_RAW_REG IXDP2351_CPLD_BB_REG(0x20) /* read */
73#define IXDP2351_CPLD_INTA_RAW_REG IXDP2351_CPLD_BB_REG(0x24) /* read */
74#define IXDP2351_CPLD_INTB_MASK_CLR_REG IXDP2351_CPLD_INTB_RAW_REG /* write */
75#define IXDP2351_CPLD_INTA_MASK_CLR_REG IXDP2351_CPLD_INTA_RAW_REG /* write */
76#define IXDP2351_CPLD_INTB_SIM_REG IXDP2351_CPLD_BB_REG(0x28)
77#define IXDP2351_CPLD_INTA_SIM_REG IXDP2351_CPLD_BB_REG(0x2C)
78 /* Interrupt bits are defined in irqs.h */
79#define IXDP2351_CPLD_BB_GBE0_REG IXDP2351_CPLD_BB_REG(0x30)
80#define IXDP2351_CPLD_BB_GBE1_REG IXDP2351_CPLD_BB_REG(0x34)
81
82/* #define IXDP2351_CPLD_BB_MISC_REG IXDP2351_CPLD_REG(0x1C) */
83/* #define IXDP2351_CPLD_BB_MISC_REV_MASK 0xFF */
84/* #define IXDP2351_CPLD_BB_GDXCS0_REG IXDP2351_CPLD_REG(0x24) */
85/* #define IXDP2351_CPLD_BB_GDXCS1_REG IXDP2351_CPLD_REG(0x28) */
86/* #define IXDP2351_CPLD_BB_CLOCK_REG IXDP2351_CPLD_REG(0x04) */
87
88
89#endif
diff --git a/arch/arm/mach-ixp23xx/include/mach/ixp23xx.h b/arch/arm/mach-ixp23xx/include/mach/ixp23xx.h
deleted file mode 100644
index 6d02481b1d6d..000000000000
--- a/arch/arm/mach-ixp23xx/include/mach/ixp23xx.h
+++ /dev/null
@@ -1,298 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/ixp23xx.h
3 *
4 * Register definitions for IXP23XX
5 *
6 * Copyright (C) 2003-2005 Intel Corporation.
7 * Copyright (C) 2005 MontaVista Software, Inc.
8 *
9 * Maintainer: Deepak Saxena <dsaxena@plexity.net>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#ifndef __ASM_ARCH_IXP23XX_H
17#define __ASM_ARCH_IXP23XX_H
18
19/*
20 * IXP2300 linux memory map:
21 *
22 * virt phys size
23 * fffd0000 a0000000 64K XSI2CPP_CSR
24 * fffc0000 c4000000 4K EXP_CFG
25 * fff00000 c8000000 64K PERIPHERAL
26 * fe000000 1c0000000 16M CAP_CSR
27 * fd000000 1c8000000 16M MSF_CSR
28 * fb000000 16M ---
29 * fa000000 1d8000000 32M PCI_IO
30 * f8000000 1da000000 32M PCI_CFG
31 * f6000000 1de000000 32M PCI_CREG
32 * f4000000 32M ---
33 * f0000000 1e0000000 64M PCI_MEM
34 * e[c-f]000000 per-platform mappings
35 */
36
37
38/****************************************************************************
39 * Static mappings.
40 ****************************************************************************/
41#define IXP23XX_XSI2CPP_CSR_PHYS 0xa0000000
42#define IXP23XX_XSI2CPP_CSR_VIRT 0xfffd0000
43#define IXP23XX_XSI2CPP_CSR_SIZE 0x00010000
44
45#define IXP23XX_EXP_CFG_PHYS 0xc4000000
46#define IXP23XX_EXP_CFG_VIRT 0xfffc0000
47#define IXP23XX_EXP_CFG_SIZE 0x00001000
48
49#define IXP23XX_PERIPHERAL_PHYS 0xc8000000
50#define IXP23XX_PERIPHERAL_VIRT 0xfff00000
51#define IXP23XX_PERIPHERAL_SIZE 0x00010000
52
53#define IXP23XX_CAP_CSR_PHYS 0x1c0000000ULL
54#define IXP23XX_CAP_CSR_VIRT 0xfe000000
55#define IXP23XX_CAP_CSR_SIZE 0x01000000
56
57#define IXP23XX_MSF_CSR_PHYS 0x1c8000000ULL
58#define IXP23XX_MSF_CSR_VIRT 0xfd000000
59#define IXP23XX_MSF_CSR_SIZE 0x01000000
60
61#define IXP23XX_PCI_IO_PHYS 0x1d8000000ULL
62#define IXP23XX_PCI_IO_VIRT 0xfa000000
63#define IXP23XX_PCI_IO_SIZE 0x02000000
64
65#define IXP23XX_PCI_CFG_PHYS 0x1da000000ULL
66#define IXP23XX_PCI_CFG_VIRT 0xf8000000
67#define IXP23XX_PCI_CFG_SIZE 0x02000000
68#define IXP23XX_PCI_CFG0_VIRT IXP23XX_PCI_CFG_VIRT
69#define IXP23XX_PCI_CFG1_VIRT (IXP23XX_PCI_CFG_VIRT + 0x01000000)
70
71#define IXP23XX_PCI_CREG_PHYS 0x1de000000ULL
72#define IXP23XX_PCI_CREG_VIRT 0xf6000000
73#define IXP23XX_PCI_CREG_SIZE 0x02000000
74#define IXP23XX_PCI_CSR_VIRT (IXP23XX_PCI_CREG_VIRT + 0x01000000)
75
76#define IXP23XX_PCI_MEM_START 0xe0000000
77#define IXP23XX_PCI_MEM_PHYS 0x1e0000000ULL
78#define IXP23XX_PCI_MEM_VIRT 0xf0000000
79#define IXP23XX_PCI_MEM_SIZE 0x04000000
80
81
82/****************************************************************************
83 * XSI2CPP CSRs.
84 ****************************************************************************/
85#define IXP23XX_XSI2CPP_REG(x) ((volatile unsigned long *)(IXP23XX_XSI2CPP_CSR_VIRT + (x)))
86#define IXP23XX_CPP2XSI_CURR_XFER_REG3 IXP23XX_XSI2CPP_REG(0xf8)
87#define IXP23XX_CPP2XSI_ADDR_31 (1 << 19)
88#define IXP23XX_CPP2XSI_PSH_OFF (1 << 20)
89#define IXP23XX_CPP2XSI_COH_OFF (1 << 21)
90
91
92/****************************************************************************
93 * Expansion Bus Config.
94 ****************************************************************************/
95#define IXP23XX_EXP_CFG_REG(x) ((volatile unsigned long *)(IXP23XX_EXP_CFG_VIRT + (x)))
96#define IXP23XX_EXP_CS0 IXP23XX_EXP_CFG_REG(0x00)
97#define IXP23XX_EXP_CS1 IXP23XX_EXP_CFG_REG(0x04)
98#define IXP23XX_EXP_CS2 IXP23XX_EXP_CFG_REG(0x08)
99#define IXP23XX_EXP_CS3 IXP23XX_EXP_CFG_REG(0x0c)
100#define IXP23XX_EXP_CS4 IXP23XX_EXP_CFG_REG(0x10)
101#define IXP23XX_EXP_CS5 IXP23XX_EXP_CFG_REG(0x14)
102#define IXP23XX_EXP_CS6 IXP23XX_EXP_CFG_REG(0x18)
103#define IXP23XX_EXP_CS7 IXP23XX_EXP_CFG_REG(0x1c)
104#define IXP23XX_FLASH_WRITABLE (0x2)
105#define IXP23XX_FLASH_BUS8 (0x1)
106
107#define IXP23XX_EXP_CFG0 IXP23XX_EXP_CFG_REG(0x20)
108#define IXP23XX_EXP_CFG1 IXP23XX_EXP_CFG_REG(0x24)
109#define IXP23XX_EXP_CFG0_MEM_MAP (1 << 31)
110#define IXP23XX_EXP_CFG0_XSCALE_SPEED_SEL (3 << 22)
111#define IXP23XX_EXP_CFG0_XSCALE_SPEED_EN (1 << 21)
112#define IXP23XX_EXP_CFG0_CPP_SPEED_SEL (3 << 19)
113#define IXP23XX_EXP_CFG0_CPP_SPEED_EN (1 << 18)
114#define IXP23XX_EXP_CFG0_PCI_SWIN (3 << 16)
115#define IXP23XX_EXP_CFG0_PCI_DWIN (3 << 14)
116#define IXP23XX_EXP_CFG0_PCI33_MODE (1 << 13)
117#define IXP23XX_EXP_CFG0_QDR_SPEED_SEL (1 << 12)
118#define IXP23XX_EXP_CFG0_CPP_DIV_SEL (1 << 5)
119#define IXP23XX_EXP_CFG0_XSI_NOT_PRES (1 << 4)
120#define IXP23XX_EXP_CFG0_PROM_BOOT (1 << 3)
121#define IXP23XX_EXP_CFG0_PCI_ARB (1 << 2)
122#define IXP23XX_EXP_CFG0_PCI_HOST (1 << 1)
123#define IXP23XX_EXP_CFG0_FLASH_WIDTH (1 << 0)
124
125#define IXP23XX_EXP_UNIT_FUSE IXP23XX_EXP_CFG_REG(0x28)
126#define IXP23XX_EXP_MSF_MUX IXP23XX_EXP_CFG_REG(0x30)
127#define IXP23XX_EXP_CFG_FUSE IXP23XX_EXP_CFG_REG(0x34)
128
129#define IXP23XX_EXP_BUS_PHYS 0x90000000
130#define IXP23XX_EXP_BUS_WINDOW_SIZE 0x01000000
131
132#define IXP23XX_EXP_BUS_CS0_BASE (IXP23XX_EXP_BUS_PHYS + 0x00000000)
133#define IXP23XX_EXP_BUS_CS1_BASE (IXP23XX_EXP_BUS_PHYS + 0x01000000)
134#define IXP23XX_EXP_BUS_CS2_BASE (IXP23XX_EXP_BUS_PHYS + 0x02000000)
135#define IXP23XX_EXP_BUS_CS3_BASE (IXP23XX_EXP_BUS_PHYS + 0x03000000)
136#define IXP23XX_EXP_BUS_CS4_BASE (IXP23XX_EXP_BUS_PHYS + 0x04000000)
137#define IXP23XX_EXP_BUS_CS5_BASE (IXP23XX_EXP_BUS_PHYS + 0x05000000)
138#define IXP23XX_EXP_BUS_CS6_BASE (IXP23XX_EXP_BUS_PHYS + 0x06000000)
139#define IXP23XX_EXP_BUS_CS7_BASE (IXP23XX_EXP_BUS_PHYS + 0x07000000)
140
141
142/****************************************************************************
143 * Peripherals.
144 ****************************************************************************/
145#define IXP23XX_UART1_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x0000)
146#define IXP23XX_UART2_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x1000)
147#define IXP23XX_PMU_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x2000)
148#define IXP23XX_INTC_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x3000)
149#define IXP23XX_GPIO_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x4000)
150#define IXP23XX_TIMER_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x5000)
151#define IXP23XX_NPE0_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x6000)
152#define IXP23XX_DSR_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x7000)
153#define IXP23XX_NPE1_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x8000)
154#define IXP23XX_ETH0_VIRT (IXP23XX_PERIPHERAL_VIRT + 0x9000)
155#define IXP23XX_ETH1_VIRT (IXP23XX_PERIPHERAL_VIRT + 0xA000)
156#define IXP23XX_GIG0_VIRT (IXP23XX_PERIPHERAL_VIRT + 0xB000)
157#define IXP23XX_GIG1_VIRT (IXP23XX_PERIPHERAL_VIRT + 0xC000)
158#define IXP23XX_DDRS_VIRT (IXP23XX_PERIPHERAL_VIRT + 0xD000)
159
160#define IXP23XX_UART1_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x0000)
161#define IXP23XX_UART2_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x1000)
162#define IXP23XX_PMU_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x2000)
163#define IXP23XX_INTC_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x3000)
164#define IXP23XX_GPIO_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x4000)
165#define IXP23XX_TIMER_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x5000)
166#define IXP23XX_NPE0_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x6000)
167#define IXP23XX_DSR_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x7000)
168#define IXP23XX_NPE1_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x8000)
169#define IXP23XX_ETH0_PHYS (IXP23XX_PERIPHERAL_PHYS + 0x9000)
170#define IXP23XX_ETH1_PHYS (IXP23XX_PERIPHERAL_PHYS + 0xA000)
171#define IXP23XX_GIG0_PHYS (IXP23XX_PERIPHERAL_PHYS + 0xB000)
172#define IXP23XX_GIG1_PHYS (IXP23XX_PERIPHERAL_PHYS + 0xC000)
173#define IXP23XX_DDRS_PHYS (IXP23XX_PERIPHERAL_PHYS + 0xD000)
174
175
176/****************************************************************************
177 * Interrupt controller.
178 ****************************************************************************/
179#define IXP23XX_INTC_REG(x) ((volatile unsigned long *)(IXP23XX_INTC_VIRT + (x)))
180#define IXP23XX_INTR_ST1 IXP23XX_INTC_REG(0x00)
181#define IXP23XX_INTR_ST2 IXP23XX_INTC_REG(0x04)
182#define IXP23XX_INTR_ST3 IXP23XX_INTC_REG(0x08)
183#define IXP23XX_INTR_ST4 IXP23XX_INTC_REG(0x0c)
184#define IXP23XX_INTR_EN1 IXP23XX_INTC_REG(0x10)
185#define IXP23XX_INTR_EN2 IXP23XX_INTC_REG(0x14)
186#define IXP23XX_INTR_EN3 IXP23XX_INTC_REG(0x18)
187#define IXP23XX_INTR_EN4 IXP23XX_INTC_REG(0x1c)
188#define IXP23XX_INTR_SEL1 IXP23XX_INTC_REG(0x20)
189#define IXP23XX_INTR_SEL2 IXP23XX_INTC_REG(0x24)
190#define IXP23XX_INTR_SEL3 IXP23XX_INTC_REG(0x28)
191#define IXP23XX_INTR_SEL4 IXP23XX_INTC_REG(0x2c)
192#define IXP23XX_INTR_IRQ_ST1 IXP23XX_INTC_REG(0x30)
193#define IXP23XX_INTR_IRQ_ST2 IXP23XX_INTC_REG(0x34)
194#define IXP23XX_INTR_IRQ_ST3 IXP23XX_INTC_REG(0x38)
195#define IXP23XX_INTR_IRQ_ST4 IXP23XX_INTC_REG(0x3c)
196#define IXP23XX_INTR_IRQ_ENC_ST_OFFSET 0x54
197
198
199/****************************************************************************
200 * GPIO.
201 ****************************************************************************/
202#define IXP23XX_GPIO_REG(x) ((volatile unsigned long *)(IXP23XX_GPIO_VIRT + (x)))
203#define IXP23XX_GPIO_GPOUTR IXP23XX_GPIO_REG(0x00)
204#define IXP23XX_GPIO_GPOER IXP23XX_GPIO_REG(0x04)
205#define IXP23XX_GPIO_GPINR IXP23XX_GPIO_REG(0x08)
206#define IXP23XX_GPIO_GPISR IXP23XX_GPIO_REG(0x0c)
207#define IXP23XX_GPIO_GPIT1R IXP23XX_GPIO_REG(0x10)
208#define IXP23XX_GPIO_GPIT2R IXP23XX_GPIO_REG(0x14)
209#define IXP23XX_GPIO_GPCLKR IXP23XX_GPIO_REG(0x18)
210#define IXP23XX_GPIO_GPDBSELR IXP23XX_GPIO_REG(0x1c)
211
212#define IXP23XX_GPIO_STYLE_MASK 0x7
213#define IXP23XX_GPIO_STYLE_ACTIVE_HIGH 0x0
214#define IXP23XX_GPIO_STYLE_ACTIVE_LOW 0x1
215#define IXP23XX_GPIO_STYLE_RISING_EDGE 0x2
216#define IXP23XX_GPIO_STYLE_FALLING_EDGE 0x3
217#define IXP23XX_GPIO_STYLE_TRANSITIONAL 0x4
218
219#define IXP23XX_GPIO_STYLE_SIZE 3
220
221
222/****************************************************************************
223 * Timer.
224 ****************************************************************************/
225#define IXP23XX_TIMER_REG(x) ((volatile unsigned long *)(IXP23XX_TIMER_VIRT + (x)))
226#define IXP23XX_TIMER_CONT IXP23XX_TIMER_REG(0x00)
227#define IXP23XX_TIMER1_TIMESTAMP IXP23XX_TIMER_REG(0x04)
228#define IXP23XX_TIMER1_RELOAD IXP23XX_TIMER_REG(0x08)
229#define IXP23XX_TIMER2_TIMESTAMP IXP23XX_TIMER_REG(0x0c)
230#define IXP23XX_TIMER2_RELOAD IXP23XX_TIMER_REG(0x10)
231#define IXP23XX_TIMER_WDOG IXP23XX_TIMER_REG(0x14)
232#define IXP23XX_TIMER_WDOG_EN IXP23XX_TIMER_REG(0x18)
233#define IXP23XX_TIMER_WDOG_KEY IXP23XX_TIMER_REG(0x1c)
234#define IXP23XX_TIMER_WDOG_KEY_MAGIC 0x482e
235#define IXP23XX_TIMER_STATUS IXP23XX_TIMER_REG(0x20)
236#define IXP23XX_TIMER_SOFT_RESET IXP23XX_TIMER_REG(0x24)
237#define IXP23XX_TIMER_SOFT_RESET_EN IXP23XX_TIMER_REG(0x28)
238
239#define IXP23XX_TIMER_ENABLE (1 << 0)
240#define IXP23XX_TIMER_ONE_SHOT (1 << 1)
241/* Low order bits of reload value ignored */
242#define IXP23XX_TIMER_RELOAD_MASK (0x3)
243#define IXP23XX_TIMER_DISABLED (0x0)
244#define IXP23XX_TIMER1_INT_PEND (1 << 0)
245#define IXP23XX_TIMER2_INT_PEND (1 << 1)
246#define IXP23XX_TIMER_STATUS_TS_PEND (1 << 2)
247#define IXP23XX_TIMER_STATUS_WDOG_PEND (1 << 3)
248#define IXP23XX_TIMER_STATUS_WARM_RESET (1 << 4)
249
250
251/****************************************************************************
252 * CAP CSRs.
253 ****************************************************************************/
254#define IXP23XX_GLOBAL_REG(x) ((volatile unsigned long *)(IXP23XX_CAP_CSR_VIRT + 0x4a00 + (x)))
255#define IXP23XX_PRODUCT_ID IXP23XX_GLOBAL_REG(0x00)
256#define IXP23XX_MISC_CONTROL IXP23XX_GLOBAL_REG(0x04)
257#define IXP23XX_MSF_CLK_CNTRL IXP23XX_GLOBAL_REG(0x08)
258#define IXP23XX_RESET0 IXP23XX_GLOBAL_REG(0x0c)
259#define IXP23XX_RESET1 IXP23XX_GLOBAL_REG(0x10)
260#define IXP23XX_STRAP_OPTIONS IXP23XX_GLOBAL_REG(0x18)
261
262#define IXP23XX_ENABLE_WATCHDOG (1 << 24)
263#define IXP23XX_SHPC_INIT_COMP (1 << 21)
264#define IXP23XX_RST_ALL (1 << 16)
265#define IXP23XX_RESET_PCI (1 << 2)
266#define IXP23XX_PCI_UNIT_RESET (1 << 1)
267#define IXP23XX_XSCALE_RESET (1 << 0)
268
269#define IXP23XX_UENGINE_CSR_VIRT_BASE (IXP23XX_CAP_CSR_VIRT + 0x18000)
270
271
272/****************************************************************************
273 * PCI CSRs.
274 ****************************************************************************/
275#define IXP23XX_PCI_CREG(x) ((volatile unsigned long *)(IXP23XX_PCI_CREG_VIRT + (x)))
276#define IXP23XX_PCI_CMDSTAT IXP23XX_PCI_CREG(0x04)
277#define IXP23XX_PCI_SRAM_BAR IXP23XX_PCI_CREG(0x14)
278#define IXP23XX_PCI_SDRAM_BAR IXP23XX_PCI_CREG(0x18)
279
280
281#define IXP23XX_PCI_CSR(x) ((volatile unsigned long *)(IXP23XX_PCI_CREG_VIRT + 0x01000000 + (x)))
282#define IXP23XX_PCI_OUT_INT_STATUS IXP23XX_PCI_CSR(0x0030)
283#define IXP23XX_PCI_OUT_INT_MASK IXP23XX_PCI_CSR(0x0034)
284#define IXP23XX_PCI_SRAM_BASE_ADDR_MASK IXP23XX_PCI_CSR(0x00fc)
285#define IXP23XX_PCI_DRAM_BASE_ADDR_MASK IXP23XX_PCI_CSR(0x0100)
286#define IXP23XX_PCI_CONTROL IXP23XX_PCI_CSR(0x013c)
287#define IXP23XX_PCI_ADDR_EXT IXP23XX_PCI_CSR(0x0140)
288#define IXP23XX_PCI_ME_PUSH_STATUS IXP23XX_PCI_CSR(0x0148)
289#define IXP23XX_PCI_ME_PUSH_EN IXP23XX_PCI_CSR(0x014c)
290#define IXP23XX_PCI_ERR_STATUS IXP23XX_PCI_CSR(0x0150)
291#define IXP23XX_PCI_ERROR_STATUS IXP23XX_PCI_CSR(0x0150)
292#define IXP23XX_PCI_ERR_ENABLE IXP23XX_PCI_CSR(0x0154)
293#define IXP23XX_PCI_XSCALE_INT_STATUS IXP23XX_PCI_CSR(0x0158)
294#define IXP23XX_PCI_XSCALE_INT_ENABLE IXP23XX_PCI_CSR(0x015c)
295#define IXP23XX_PCI_CPP_ADDR_BITS IXP23XX_PCI_CSR(0x0160)
296
297
298#endif
diff --git a/arch/arm/mach-ixp23xx/include/mach/memory.h b/arch/arm/mach-ixp23xx/include/mach/memory.h
deleted file mode 100644
index 6cf0704e946a..000000000000
--- a/arch/arm/mach-ixp23xx/include/mach/memory.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/memory.h
3 *
4 * Copyright (c) 2003-2004 Intel Corp.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#ifndef __ASM_ARCH_MEMORY_H
13#define __ASM_ARCH_MEMORY_H
14
15#include <mach/hardware.h>
16
17/*
18 * Physical DRAM offset.
19 */
20#define PLAT_PHYS_OFFSET (0x00000000)
21
22#define IXP23XX_PCI_SDRAM_OFFSET (*((volatile int *)IXP23XX_PCI_SDRAM_BAR) & 0xfffffff0)
23
24#define __phys_to_bus(x) ((x) + (IXP23XX_PCI_SDRAM_OFFSET - PHYS_OFFSET))
25#define __bus_to_phys(x) ((x) - (IXP23XX_PCI_SDRAM_OFFSET - PHYS_OFFSET))
26
27#define __virt_to_bus(v) __phys_to_bus(__virt_to_phys(v))
28#define __bus_to_virt(b) __phys_to_virt(__bus_to_phys(b))
29#define __pfn_to_bus(p) __phys_to_bus(__pfn_to_phys(p))
30#define __bus_to_pfn(b) __phys_to_pfn(__bus_to_phys(b))
31
32#define arch_is_coherent() 1
33
34#endif
diff --git a/arch/arm/mach-ixp23xx/include/mach/platform.h b/arch/arm/mach-ixp23xx/include/mach/platform.h
deleted file mode 100644
index 50de558e722e..000000000000
--- a/arch/arm/mach-ixp23xx/include/mach/platform.h
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/platform.h
3 *
4 * Various bits of code used by platform-level code.
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2005 (c) MontaVista Software, Inc.
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
13 */
14
15#ifndef __ASSEMBLY__
16
17static inline unsigned long ixp2000_reg_read(volatile void *reg)
18{
19 return *((volatile unsigned long *)reg);
20}
21
22static inline void ixp2000_reg_write(volatile void *reg, unsigned long val)
23{
24 *((volatile unsigned long *)reg) = val;
25}
26
27static inline void ixp2000_reg_wrb(volatile void *reg, unsigned long val)
28{
29 *((volatile unsigned long *)reg) = val;
30}
31
32struct pci_sys_data;
33
34void ixp23xx_map_io(void);
35void ixp23xx_init_irq(void);
36void ixp23xx_sys_init(void);
37void ixp23xx_restart(char, const char *);
38int ixp23xx_pci_setup(int, struct pci_sys_data *);
39void ixp23xx_pci_preinit(void);
40struct pci_bus *ixp23xx_pci_scan_bus(int, struct pci_sys_data*);
41void ixp23xx_pci_slave_init(void);
42
43extern struct sys_timer ixp23xx_timer;
44
45#define IXP23XX_UART_XTAL 14745600
46
47#ifndef __ASSEMBLY__
48/*
49 * Is system memory on the XSI or CPP bus?
50 */
51static inline unsigned ixp23xx_cpp_boot(void)
52{
53 return (*IXP23XX_EXP_CFG0 & IXP23XX_EXP_CFG0_XSI_NOT_PRES);
54}
55#endif
56
57
58#endif
diff --git a/arch/arm/mach-ixp23xx/include/mach/time.h b/arch/arm/mach-ixp23xx/include/mach/time.h
deleted file mode 100644
index b61dafc884ac..000000000000
--- a/arch/arm/mach-ixp23xx/include/mach/time.h
+++ /dev/null
@@ -1,3 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/time.h
3 */
diff --git a/arch/arm/mach-ixp23xx/include/mach/timex.h b/arch/arm/mach-ixp23xx/include/mach/timex.h
deleted file mode 100644
index e341e9cf9c37..000000000000
--- a/arch/arm/mach-ixp23xx/include/mach/timex.h
+++ /dev/null
@@ -1,7 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/timex.h
3 *
4 * XScale architecture timex specifications
5 */
6
7#define CLOCK_TICK_RATE 75000000
diff --git a/arch/arm/mach-ixp23xx/include/mach/uncompress.h b/arch/arm/mach-ixp23xx/include/mach/uncompress.h
deleted file mode 100644
index 8b4c358d2c04..000000000000
--- a/arch/arm/mach-ixp23xx/include/mach/uncompress.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/include/mach/uncompress.h
3 *
4 * Copyright (C) 2002-2004 Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARCH_UNCOMPRESS_H
12#define __ASM_ARCH_UNCOMPRESS_H
13
14#include <mach/ixp23xx.h>
15#include <linux/serial_reg.h>
16
17#define UART_BASE ((volatile u32 *)IXP23XX_UART1_PHYS)
18
19static inline void putc(char c)
20{
21 int j;
22
23 for (j = 0; j < 0x1000; j++) {
24 if (UART_BASE[UART_LSR] & UART_LSR_THRE)
25 break;
26 barrier();
27 }
28
29 UART_BASE[UART_TX] = c;
30}
31
32static inline void flush(void)
33{
34}
35
36#define arch_decomp_setup()
37#define arch_decomp_wdog()
38
39
40#endif
diff --git a/arch/arm/mach-ixp23xx/ixdp2351.c b/arch/arm/mach-ixp23xx/ixdp2351.c
deleted file mode 100644
index b0e07db5ceaf..000000000000
--- a/arch/arm/mach-ixp23xx/ixdp2351.c
+++ /dev/null
@@ -1,347 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/ixdp2351.c
3 *
4 * IXDP2351 board-specific routines
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2005 (c) MontaVista Software, Inc.
9 *
10 * Based on 2.4 code Copyright 2004 (c) Intel Corporation
11 *
12 * This file is licensed under the terms of the GNU General Public
13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied.
15 */
16
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/spinlock.h>
20#include <linux/sched.h>
21#include <linux/interrupt.h>
22#include <linux/irq.h>
23#include <linux/serial.h>
24#include <linux/tty.h>
25#include <linux/bitops.h>
26#include <linux/ioport.h>
27#include <linux/serial_8250.h>
28#include <linux/serial_core.h>
29#include <linux/device.h>
30#include <linux/mm.h>
31#include <linux/pci.h>
32#include <linux/mtd/physmap.h>
33
34#include <asm/types.h>
35#include <asm/setup.h>
36#include <asm/memory.h>
37#include <mach/hardware.h>
38#include <asm/mach-types.h>
39#include <asm/tlbflush.h>
40#include <asm/pgtable.h>
41
42#include <asm/mach/map.h>
43#include <asm/mach/irq.h>
44#include <asm/mach/arch.h>
45#include <asm/mach/pci.h>
46
47/*
48 * IXDP2351 Interrupt Handling
49 */
50static void ixdp2351_inta_mask(struct irq_data *d)
51{
52 *IXDP2351_CPLD_INTA_MASK_SET_REG = IXDP2351_INTA_IRQ_MASK(d->irq);
53}
54
55static void ixdp2351_inta_unmask(struct irq_data *d)
56{
57 *IXDP2351_CPLD_INTA_MASK_CLR_REG = IXDP2351_INTA_IRQ_MASK(d->irq);
58}
59
60static void ixdp2351_inta_handler(unsigned int irq, struct irq_desc *desc)
61{
62 u16 ex_interrupt =
63 *IXDP2351_CPLD_INTA_STAT_REG & IXDP2351_INTA_IRQ_VALID;
64 int i;
65
66 desc->irq_data.chip->irq_mask(&desc->irq_data);
67
68 for (i = 0; i < IXDP2351_INTA_IRQ_NUM; i++) {
69 if (ex_interrupt & (1 << i)) {
70 int cpld_irq =
71 IXP23XX_MACH_IRQ(IXDP2351_INTA_IRQ_BASE + i);
72 generic_handle_irq(cpld_irq);
73 }
74 }
75
76 desc->irq_data.chip->irq_unmask(&desc->irq_data);
77}
78
79static struct irq_chip ixdp2351_inta_chip = {
80 .irq_ack = ixdp2351_inta_mask,
81 .irq_mask = ixdp2351_inta_mask,
82 .irq_unmask = ixdp2351_inta_unmask
83};
84
85static void ixdp2351_intb_mask(struct irq_data *d)
86{
87 *IXDP2351_CPLD_INTB_MASK_SET_REG = IXDP2351_INTB_IRQ_MASK(d->irq);
88}
89
90static void ixdp2351_intb_unmask(struct irq_data *d)
91{
92 *IXDP2351_CPLD_INTB_MASK_CLR_REG = IXDP2351_INTB_IRQ_MASK(d->irq);
93}
94
95static void ixdp2351_intb_handler(unsigned int irq, struct irq_desc *desc)
96{
97 u16 ex_interrupt =
98 *IXDP2351_CPLD_INTB_STAT_REG & IXDP2351_INTB_IRQ_VALID;
99 int i;
100
101 desc->irq_data.chip->irq_ack(&desc->irq_data);
102
103 for (i = 0; i < IXDP2351_INTB_IRQ_NUM; i++) {
104 if (ex_interrupt & (1 << i)) {
105 int cpld_irq =
106 IXP23XX_MACH_IRQ(IXDP2351_INTB_IRQ_BASE + i);
107 generic_handle_irq(cpld_irq);
108 }
109 }
110
111 desc->irq_data.chip->irq_unmask(&desc->irq_data);
112}
113
114static struct irq_chip ixdp2351_intb_chip = {
115 .irq_ack = ixdp2351_intb_mask,
116 .irq_mask = ixdp2351_intb_mask,
117 .irq_unmask = ixdp2351_intb_unmask
118};
119
120void __init ixdp2351_init_irq(void)
121{
122 int irq;
123
124 /* Mask all interrupts from CPLD, disable simulation */
125 *IXDP2351_CPLD_INTA_MASK_SET_REG = (u16) -1;
126 *IXDP2351_CPLD_INTB_MASK_SET_REG = (u16) -1;
127 *IXDP2351_CPLD_INTA_SIM_REG = 0;
128 *IXDP2351_CPLD_INTB_SIM_REG = 0;
129
130 ixp23xx_init_irq();
131
132 for (irq = IXP23XX_MACH_IRQ(IXDP2351_INTA_IRQ_BASE);
133 irq <
134 IXP23XX_MACH_IRQ(IXDP2351_INTA_IRQ_BASE + IXDP2351_INTA_IRQ_NUM);
135 irq++) {
136 if (IXDP2351_INTA_IRQ_MASK(irq) & IXDP2351_INTA_IRQ_VALID) {
137 set_irq_flags(irq, IRQF_VALID);
138 irq_set_chip_and_handler(irq, &ixdp2351_inta_chip,
139 handle_level_irq);
140 }
141 }
142
143 for (irq = IXP23XX_MACH_IRQ(IXDP2351_INTB_IRQ_BASE);
144 irq <
145 IXP23XX_MACH_IRQ(IXDP2351_INTB_IRQ_BASE + IXDP2351_INTB_IRQ_NUM);
146 irq++) {
147 if (IXDP2351_INTB_IRQ_MASK(irq) & IXDP2351_INTB_IRQ_VALID) {
148 set_irq_flags(irq, IRQF_VALID);
149 irq_set_chip_and_handler(irq, &ixdp2351_intb_chip,
150 handle_level_irq);
151 }
152 }
153
154 irq_set_chained_handler(IRQ_IXP23XX_INTA, ixdp2351_inta_handler);
155 irq_set_chained_handler(IRQ_IXP23XX_INTB, ixdp2351_intb_handler);
156}
157
158/*
159 * IXDP2351 PCI
160 */
161
162/*
163 * This board does not do normal PCI IRQ routing, or any
164 * sort of swizzling, so we just need to check where on the
165 * bus the device is and figure out what CPLD pin it is
166 * being routed to.
167 */
168#define DEVPIN(dev, pin) ((pin) | ((dev) << 3))
169
170static int __init ixdp2351_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
171{
172 u8 bus = dev->bus->number;
173 u32 devpin = DEVPIN(PCI_SLOT(dev->devfn), pin);
174 struct pci_bus *tmp_bus = dev->bus;
175
176 /* Primary bus, no interrupts here */
177 if (!bus)
178 return -1;
179
180 /* Lookup first leaf in bus tree */
181 while ((tmp_bus->parent != NULL) && (tmp_bus->parent->parent != NULL))
182 tmp_bus = tmp_bus->parent;
183
184 /* Select between known bridges */
185 switch (tmp_bus->self->devfn | (tmp_bus->self->bus->number << 8)) {
186 /* Device is located after first bridge */
187 case 0x0008:
188 if (tmp_bus == dev->bus) {
189 /* Device is located directy after first bridge */
190 switch (devpin) {
191 /* Onboard 82546 */
192 case DEVPIN(1, 1): /* Onboard 82546 ch 0 */
193 return IRQ_IXDP2351_INTA_82546;
194 case DEVPIN(1, 2): /* Onboard 82546 ch 1 */
195 return IRQ_IXDP2351_INTB_82546;
196 /* PMC SLOT */
197 case DEVPIN(0, 1): /* PMCP INTA# */
198 case DEVPIN(2, 4): /* PMCS INTD# */
199 return IRQ_IXDP2351_SPCI_PMC_INTA;
200 case DEVPIN(0, 2): /* PMCP INTB# */
201 case DEVPIN(2, 1): /* PMCS INTA# */
202 return IRQ_IXDP2351_SPCI_PMC_INTB;
203 case DEVPIN(0, 3): /* PMCP INTC# */
204 case DEVPIN(2, 2): /* PMCS INTB# */
205 return IRQ_IXDP2351_SPCI_PMC_INTC;
206 case DEVPIN(0, 4): /* PMCP INTD# */
207 case DEVPIN(2, 3): /* PMCS INTC# */
208 return IRQ_IXDP2351_SPCI_PMC_INTD;
209 }
210 } else {
211 /* Device is located indirectly after first bridge */
212 /* Not supported now */
213 return -1;
214 }
215 break;
216 case 0x0010:
217 if (tmp_bus == dev->bus) {
218 /* Device is located directy after second bridge */
219 /* Secondary bus of second bridge */
220 switch (devpin) {
221 case DEVPIN(0, 1): /* DB#0 */
222 case DEVPIN(0, 2):
223 case DEVPIN(0, 3):
224 case DEVPIN(0, 4):
225 return IRQ_IXDP2351_SPCI_DB_0;
226 case DEVPIN(1, 1): /* DB#1 */
227 case DEVPIN(1, 2):
228 case DEVPIN(1, 3):
229 case DEVPIN(1, 4):
230 return IRQ_IXDP2351_SPCI_DB_1;
231 case DEVPIN(2, 1): /* FIC1 */
232 case DEVPIN(2, 2):
233 case DEVPIN(2, 3):
234 case DEVPIN(2, 4):
235 case DEVPIN(3, 1): /* FIC2 */
236 case DEVPIN(3, 2):
237 case DEVPIN(3, 3):
238 case DEVPIN(3, 4):
239 return IRQ_IXDP2351_SPCI_FIC;
240 }
241 } else {
242 /* Device is located indirectly after second bridge */
243 /* Not supported now */
244 return -1;
245 }
246 break;
247 }
248
249 return -1;
250}
251
252struct hw_pci ixdp2351_pci __initdata = {
253 .nr_controllers = 1,
254 .preinit = ixp23xx_pci_preinit,
255 .setup = ixp23xx_pci_setup,
256 .scan = ixp23xx_pci_scan_bus,
257 .map_irq = ixdp2351_map_irq,
258};
259
260int __init ixdp2351_pci_init(void)
261{
262 if (machine_is_ixdp2351())
263 pci_common_init(&ixdp2351_pci);
264
265 return 0;
266}
267
268subsys_initcall(ixdp2351_pci_init);
269
270/*
271 * IXDP2351 Static Mapped I/O
272 */
273static struct map_desc ixdp2351_io_desc[] __initdata = {
274 {
275 .virtual = IXDP2351_NP_VIRT_BASE,
276 .pfn = __phys_to_pfn((u64)IXDP2351_NP_PHYS_BASE),
277 .length = IXDP2351_NP_PHYS_SIZE,
278 .type = MT_DEVICE
279 }, {
280 .virtual = IXDP2351_BB_BASE_VIRT,
281 .pfn = __phys_to_pfn((u64)IXDP2351_BB_BASE_PHYS),
282 .length = IXDP2351_BB_SIZE,
283 .type = MT_DEVICE
284 }
285};
286
287static void __init ixdp2351_map_io(void)
288{
289 ixp23xx_map_io();
290 iotable_init(ixdp2351_io_desc, ARRAY_SIZE(ixdp2351_io_desc));
291}
292
293static struct physmap_flash_data ixdp2351_flash_data = {
294 .width = 1,
295};
296
297static struct resource ixdp2351_flash_resource = {
298 .start = 0x90000000,
299 .end = 0x93ffffff,
300 .flags = IORESOURCE_MEM,
301};
302
303static struct platform_device ixdp2351_flash = {
304 .name = "physmap-flash",
305 .id = 0,
306 .dev = {
307 .platform_data = &ixdp2351_flash_data,
308 },
309 .num_resources = 1,
310 .resource = &ixdp2351_flash_resource,
311};
312
313static void __init ixdp2351_init(void)
314{
315 platform_device_register(&ixdp2351_flash);
316
317 /*
318 * Mark flash as writeable
319 */
320 IXP23XX_EXP_CS0[0] |= IXP23XX_FLASH_WRITABLE;
321 IXP23XX_EXP_CS0[1] |= IXP23XX_FLASH_WRITABLE;
322 IXP23XX_EXP_CS0[2] |= IXP23XX_FLASH_WRITABLE;
323 IXP23XX_EXP_CS0[3] |= IXP23XX_FLASH_WRITABLE;
324
325 ixp23xx_sys_init();
326}
327
328static void ixdp2351_restart(char mode, const char *cmd)
329{
330 /* First try machine specific support */
331
332 *IXDP2351_CPLD_RESET1_REG = IXDP2351_CPLD_RESET1_MAGIC;
333 (void) *IXDP2351_CPLD_RESET1_REG;
334 *IXDP2351_CPLD_RESET1_REG = IXDP2351_CPLD_RESET1_ENABLE;
335
336 ixp23xx_restart(mode, cmd);
337}
338
339MACHINE_START(IXDP2351, "Intel IXDP2351 Development Platform")
340 /* Maintainer: MontaVista Software, Inc. */
341 .map_io = ixdp2351_map_io,
342 .init_irq = ixdp2351_init_irq,
343 .timer = &ixp23xx_timer,
344 .atag_offset = 0x100,
345 .init_machine = ixdp2351_init,
346 .restart = ixdp2351_restart,
347MACHINE_END
diff --git a/arch/arm/mach-ixp23xx/pci.c b/arch/arm/mach-ixp23xx/pci.c
deleted file mode 100644
index 911f5a58e006..000000000000
--- a/arch/arm/mach-ixp23xx/pci.c
+++ /dev/null
@@ -1,294 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/pci.c
3 *
4 * PCI routines for IXP23XX based systems
5 *
6 * Copyright (c) 2005 MontaVista Software, Inc.
7 *
8 * based on original code:
9 *
10 * Author: Naeem Afzal <naeem.m.afzal@intel.com>
11 * Copyright 2002-2005 Intel Corp.
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 */
18
19#include <linux/sched.h>
20#include <linux/kernel.h>
21#include <linux/pci.h>
22#include <linux/interrupt.h>
23#include <linux/mm.h>
24#include <linux/init.h>
25#include <linux/ioport.h>
26#include <linux/delay.h>
27#include <linux/io.h>
28
29#include <asm/irq.h>
30#include <asm/sizes.h>
31#include <asm/mach/pci.h>
32#include <mach/hardware.h>
33
34extern int (*external_fault) (unsigned long, struct pt_regs *);
35
36static volatile int pci_master_aborts = 0;
37
38#ifdef DEBUG
39#define DBG(x...) printk(x)
40#else
41#define DBG(x...)
42#endif
43
44int clear_master_aborts(void);
45
46static u32
47*ixp23xx_pci_config_addr(unsigned int bus_nr, unsigned int devfn, int where)
48{
49 u32 *paddress;
50
51 /*
52 * Must be dword aligned
53 */
54 where &= ~3;
55
56 /*
57 * For top bus, generate type 0, else type 1
58 */
59 if (!bus_nr) {
60 if (PCI_SLOT(devfn) >= 8)
61 return 0;
62
63 paddress = (u32 *) (IXP23XX_PCI_CFG0_VIRT
64 | (1 << (PCI_SLOT(devfn) + 16))
65 | (PCI_FUNC(devfn) << 8) | where);
66 } else {
67 paddress = (u32 *) (IXP23XX_PCI_CFG1_VIRT
68 | (bus_nr << 16)
69 | (PCI_SLOT(devfn) << 11)
70 | (PCI_FUNC(devfn) << 8) | where);
71 }
72
73 return paddress;
74}
75
76/*
77 * Mask table, bits to mask for quantity of size 1, 2 or 4 bytes.
78 * 0 and 3 are not valid indexes...
79 */
80static u32 bytemask[] = {
81 /*0*/ 0,
82 /*1*/ 0xff,
83 /*2*/ 0xffff,
84 /*3*/ 0,
85 /*4*/ 0xffffffff,
86};
87
88static int ixp23xx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
89 int where, int size, u32 *value)
90{
91 u32 n;
92 u32 *addr;
93
94 n = where % 4;
95
96 DBG("In config_read(%d) %d from dev %d:%d:%d\n", size, where,
97 bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
98
99 addr = ixp23xx_pci_config_addr(bus->number, devfn, where);
100 if (!addr)
101 return PCIBIOS_DEVICE_NOT_FOUND;
102
103 pci_master_aborts = 0;
104 *value = (*addr >> (8*n)) & bytemask[size];
105 if (pci_master_aborts) {
106 pci_master_aborts = 0;
107 *value = 0xffffffff;
108 return PCIBIOS_DEVICE_NOT_FOUND;
109 }
110
111 return PCIBIOS_SUCCESSFUL;
112}
113
114/*
115 * We don't do error checking on the address for writes.
116 * It's assumed that the user checked for the device existing first
117 * by doing a read first.
118 */
119static int ixp23xx_pci_write_config(struct pci_bus *bus, unsigned int devfn,
120 int where, int size, u32 value)
121{
122 u32 mask;
123 u32 *addr;
124 u32 temp;
125
126 mask = ~(bytemask[size] << ((where % 0x4) * 8));
127 addr = ixp23xx_pci_config_addr(bus->number, devfn, where);
128 if (!addr)
129 return PCIBIOS_DEVICE_NOT_FOUND;
130 temp = (u32) (value) << ((where % 0x4) * 8);
131 *addr = (*addr & mask) | temp;
132
133 clear_master_aborts();
134
135 return PCIBIOS_SUCCESSFUL;
136}
137
138struct pci_ops ixp23xx_pci_ops = {
139 .read = ixp23xx_pci_read_config,
140 .write = ixp23xx_pci_write_config,
141};
142
143struct pci_bus *ixp23xx_pci_scan_bus(int nr, struct pci_sys_data *sysdata)
144{
145 return pci_scan_root_bus(NULL, sysdata->busnr, &ixp23xx_pci_ops,
146 sysdata, &sysdata->resources);
147}
148
149int ixp23xx_pci_abort_handler(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
150{
151 volatile unsigned long temp;
152 unsigned long flags;
153
154 pci_master_aborts = 1;
155
156 local_irq_save(flags);
157 temp = *IXP23XX_PCI_CONTROL;
158
159 /*
160 * master abort and cmd tgt err
161 */
162 if (temp & ((1 << 8) | (1 << 5)))
163 *IXP23XX_PCI_CONTROL = temp;
164
165 temp = *IXP23XX_PCI_CMDSTAT;
166
167 if (temp & (1 << 29))
168 *IXP23XX_PCI_CMDSTAT = temp;
169 local_irq_restore(flags);
170
171 /*
172 * If it was an imprecise abort, then we need to correct the
173 * return address to be _after_ the instruction.
174 */
175 if (fsr & (1 << 10))
176 regs->ARM_pc += 4;
177
178 return 0;
179}
180
181int clear_master_aborts(void)
182{
183 volatile u32 temp;
184
185 temp = *IXP23XX_PCI_CONTROL;
186
187 /*
188 * master abort and cmd tgt err
189 */
190 if (temp & ((1 << 8) | (1 << 5)))
191 *IXP23XX_PCI_CONTROL = temp;
192
193 temp = *IXP23XX_PCI_CMDSTAT;
194
195 if (temp & (1 << 29))
196 *IXP23XX_PCI_CMDSTAT = temp;
197
198 return 0;
199}
200
201static void __init ixp23xx_pci_common_init(void)
202{
203#ifdef __ARMEB__
204 *IXP23XX_PCI_CONTROL |= 0x20000; /* set I/O swapping */
205#endif
206 /*
207 * ADDR_31 needs to be clear for PCI memory access to CPP memory
208 */
209 *IXP23XX_CPP2XSI_CURR_XFER_REG3 &= ~IXP23XX_CPP2XSI_ADDR_31;
210 *IXP23XX_CPP2XSI_CURR_XFER_REG3 |= IXP23XX_CPP2XSI_PSH_OFF;
211
212 /*
213 * Select correct memory for PCI inbound transactions
214 */
215 if (ixp23xx_cpp_boot()) {
216 *IXP23XX_PCI_CPP_ADDR_BITS &= ~(1 << 1);
217 } else {
218 *IXP23XX_PCI_CPP_ADDR_BITS |= (1 << 1);
219
220 /*
221 * Enable coherency on A2 silicon.
222 */
223 if (arch_is_coherent())
224 *IXP23XX_CPP2XSI_CURR_XFER_REG3 &= ~IXP23XX_CPP2XSI_COH_OFF;
225 }
226}
227
228void __init ixp23xx_pci_preinit(void)
229{
230 pcibios_min_io = 0;
231 pcibios_min_mem = 0xe0000000;
232
233 pci_set_flags(0);
234
235 ixp23xx_pci_common_init();
236
237 hook_fault_code(16+6, ixp23xx_pci_abort_handler, SIGBUS, 0,
238 "PCI config cycle to non-existent device");
239
240 *IXP23XX_PCI_ADDR_EXT = 0x0000e000;
241}
242
243/*
244 * Prevent PCI layer from seeing the inbound host-bridge resources
245 */
246static void __devinit pci_fixup_ixp23xx(struct pci_dev *dev)
247{
248 int i;
249
250 dev->class &= 0xff;
251 dev->class |= PCI_CLASS_BRIDGE_HOST << 8;
252 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
253 dev->resource[i].start = 0;
254 dev->resource[i].end = 0;
255 dev->resource[i].flags = 0;
256 }
257}
258DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9002, pci_fixup_ixp23xx);
259
260/*
261 * IXP2300 systems often have large resource requirements, so we just
262 * use our own resource space.
263 */
264static struct resource ixp23xx_pci_mem_space = {
265 .start = IXP23XX_PCI_MEM_START,
266 .end = IXP23XX_PCI_MEM_START + IXP23XX_PCI_MEM_SIZE - 1,
267 .flags = IORESOURCE_MEM,
268 .name = "PCI Mem Space"
269};
270
271static struct resource ixp23xx_pci_io_space = {
272 .start = 0x00000100,
273 .end = 0x01ffffff,
274 .flags = IORESOURCE_IO,
275 .name = "PCI I/O Space"
276};
277
278int ixp23xx_pci_setup(int nr, struct pci_sys_data *sys)
279{
280 if (nr >= 1)
281 return 0;
282
283 pci_add_resource_offset(&sys->resources,
284 &ixp23xx_pci_io_space, sys->io_offset);
285 pci_add_resource_offset(&sys->resources,
286 &ixp23xx_pci_mem_space, sys->mem_offset);
287
288 return 1;
289}
290
291void __init ixp23xx_pci_slave_init(void)
292{
293 ixp23xx_pci_common_init();
294}
diff --git a/arch/arm/mach-ixp23xx/roadrunner.c b/arch/arm/mach-ixp23xx/roadrunner.c
deleted file mode 100644
index eaaa3fa9fd05..000000000000
--- a/arch/arm/mach-ixp23xx/roadrunner.c
+++ /dev/null
@@ -1,180 +0,0 @@
1/*
2 * arch/arm/mach-ixp23xx/roadrunner.c
3 *
4 * RoadRunner board-specific routines
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2005 (c) MontaVista Software, Inc.
9 *
10 * Based on 2.4 code Copyright 2005 (c) ADI Engineering Corporation
11 *
12 * This file is licensed under the terms of the GNU General Public
13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied.
15 */
16
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/spinlock.h>
20#include <linux/sched.h>
21#include <linux/interrupt.h>
22#include <linux/serial.h>
23#include <linux/tty.h>
24#include <linux/bitops.h>
25#include <linux/ioport.h>
26#include <linux/serial_8250.h>
27#include <linux/serial_core.h>
28#include <linux/device.h>
29#include <linux/mm.h>
30#include <linux/pci.h>
31#include <linux/mtd/physmap.h>
32
33#include <asm/types.h>
34#include <asm/setup.h>
35#include <asm/memory.h>
36#include <mach/hardware.h>
37#include <asm/mach-types.h>
38#include <asm/irq.h>
39#include <asm/tlbflush.h>
40#include <asm/pgtable.h>
41
42#include <asm/mach/map.h>
43#include <asm/mach/irq.h>
44#include <asm/mach/arch.h>
45#include <asm/mach/pci.h>
46
47/*
48 * Interrupt mapping
49 */
50#define INTA IRQ_ROADRUNNER_PCI_INTA
51#define INTB IRQ_ROADRUNNER_PCI_INTB
52#define INTC IRQ_ROADRUNNER_PCI_INTC
53#define INTD IRQ_ROADRUNNER_PCI_INTD
54
55#define INTC_PIN IXP23XX_GPIO_PIN_11
56#define INTD_PIN IXP23XX_GPIO_PIN_12
57
58static int __init roadrunner_map_irq(const struct pci_dev *dev, u8 idsel,
59 u8 pin)
60{
61 static int pci_card_slot_irq[] = {INTB, INTC, INTD, INTA};
62 static int pmc_card_slot_irq[] = {INTA, INTB, INTC, INTD};
63 static int usb_irq[] = {INTB, INTC, INTD, -1};
64 static int mini_pci_1_irq[] = {INTB, INTC, -1, -1};
65 static int mini_pci_2_irq[] = {INTC, INTD, -1, -1};
66
67 switch(dev->bus->number) {
68 case 0:
69 switch(dev->devfn) {
70 case 0x0: // PCI-PCI bridge
71 break;
72 case 0x8: // PCI Card Slot
73 return pci_card_slot_irq[pin - 1];
74 case 0x10: // PMC Slot
75 return pmc_card_slot_irq[pin - 1];
76 case 0x18: // PMC Slot Secondary Agent
77 break;
78 case 0x20: // IXP Processor
79 break;
80 default:
81 return NO_IRQ;
82 }
83 break;
84
85 case 1:
86 switch(dev->devfn) {
87 case 0x0: // IDE Controller
88 return (pin == 1) ? INTC : -1;
89 case 0x8: // USB fun 0
90 case 0x9: // USB fun 1
91 case 0xa: // USB fun 2
92 return usb_irq[pin - 1];
93 case 0x10: // Mini PCI 1
94 return mini_pci_1_irq[pin-1];
95 case 0x18: // Mini PCI 2
96 return mini_pci_2_irq[pin-1];
97 case 0x20: // MEM slot
98 return (pin == 1) ? INTA : -1;
99 default:
100 return NO_IRQ;
101 }
102 break;
103
104 default:
105 return NO_IRQ;
106 }
107
108 return NO_IRQ;
109}
110
111static void __init roadrunner_pci_preinit(void)
112{
113 irq_set_irq_type(IRQ_ROADRUNNER_PCI_INTC, IRQ_TYPE_LEVEL_LOW);
114 irq_set_irq_type(IRQ_ROADRUNNER_PCI_INTD, IRQ_TYPE_LEVEL_LOW);
115
116 ixp23xx_pci_preinit();
117}
118
119static struct hw_pci roadrunner_pci __initdata = {
120 .nr_controllers = 1,
121 .preinit = roadrunner_pci_preinit,
122 .setup = ixp23xx_pci_setup,
123 .scan = ixp23xx_pci_scan_bus,
124 .map_irq = roadrunner_map_irq,
125};
126
127static int __init roadrunner_pci_init(void)
128{
129 if (machine_is_roadrunner())
130 pci_common_init(&roadrunner_pci);
131
132 return 0;
133};
134
135subsys_initcall(roadrunner_pci_init);
136
137static struct physmap_flash_data roadrunner_flash_data = {
138 .width = 2,
139};
140
141static struct resource roadrunner_flash_resource = {
142 .start = 0x90000000,
143 .end = 0x93ffffff,
144 .flags = IORESOURCE_MEM,
145};
146
147static struct platform_device roadrunner_flash = {
148 .name = "physmap-flash",
149 .id = 0,
150 .dev = {
151 .platform_data = &roadrunner_flash_data,
152 },
153 .num_resources = 1,
154 .resource = &roadrunner_flash_resource,
155};
156
157static void __init roadrunner_init(void)
158{
159 platform_device_register(&roadrunner_flash);
160
161 /*
162 * Mark flash as writeable
163 */
164 IXP23XX_EXP_CS0[0] |= IXP23XX_FLASH_WRITABLE;
165 IXP23XX_EXP_CS0[1] |= IXP23XX_FLASH_WRITABLE;
166 IXP23XX_EXP_CS0[2] |= IXP23XX_FLASH_WRITABLE;
167 IXP23XX_EXP_CS0[3] |= IXP23XX_FLASH_WRITABLE;
168
169 ixp23xx_sys_init();
170}
171
172MACHINE_START(ROADRUNNER, "ADI Engineering RoadRunner Development Platform")
173 /* Maintainer: Deepak Saxena */
174 .map_io = ixp23xx_map_io,
175 .init_irq = ixp23xx_init_irq,
176 .timer = &ixp23xx_timer,
177 .atag_offset = 0x100,
178 .init_machine = roadrunner_init,
179 .restart = ixp23xx_restart,
180MACHINE_END
diff --git a/arch/arm/mach-ixp4xx/avila-pci.c b/arch/arm/mach-ixp4xx/avila-pci.c
index 8fea0a3c5246..548c7d43ade6 100644
--- a/arch/arm/mach-ixp4xx/avila-pci.c
+++ b/arch/arm/mach-ixp4xx/avila-pci.c
@@ -65,10 +65,9 @@ static int __init avila_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
65 65
66struct hw_pci avila_pci __initdata = { 66struct hw_pci avila_pci __initdata = {
67 .nr_controllers = 1, 67 .nr_controllers = 1,
68 .ops = &ixp4xx_ops,
68 .preinit = avila_pci_preinit, 69 .preinit = avila_pci_preinit,
69 .swizzle = pci_std_swizzle,
70 .setup = ixp4xx_setup, 70 .setup = ixp4xx_setup,
71 .scan = ixp4xx_scan_bus,
72 .map_irq = avila_map_irq, 71 .map_irq = avila_map_irq,
73}; 72};
74 73
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index d5719eb42591..1694f01ce2b6 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -480,12 +480,6 @@ int ixp4xx_setup(int nr, struct pci_sys_data *sys)
480 return 1; 480 return 1;
481} 481}
482 482
483struct pci_bus * __devinit ixp4xx_scan_bus(int nr, struct pci_sys_data *sys)
484{
485 return pci_scan_root_bus(NULL, sys->busnr, &ixp4xx_ops, sys,
486 &sys->resources);
487}
488
489int dma_set_coherent_mask(struct device *dev, u64 mask) 483int dma_set_coherent_mask(struct device *dev, u64 mask)
490{ 484{
491 if (mask >= SZ_64M - 1) 485 if (mask >= SZ_64M - 1)
diff --git a/arch/arm/mach-ixp4xx/coyote-pci.c b/arch/arm/mach-ixp4xx/coyote-pci.c
index 71f5c9c60fc3..5d14ce2aee6d 100644
--- a/arch/arm/mach-ixp4xx/coyote-pci.c
+++ b/arch/arm/mach-ixp4xx/coyote-pci.c
@@ -48,10 +48,9 @@ static int __init coyote_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
48 48
49struct hw_pci coyote_pci __initdata = { 49struct hw_pci coyote_pci __initdata = {
50 .nr_controllers = 1, 50 .nr_controllers = 1,
51 .ops = &ixp4xx_ops,
51 .preinit = coyote_pci_preinit, 52 .preinit = coyote_pci_preinit,
52 .swizzle = pci_std_swizzle,
53 .setup = ixp4xx_setup, 53 .setup = ixp4xx_setup,
54 .scan = ixp4xx_scan_bus,
55 .map_irq = coyote_map_irq, 54 .map_irq = coyote_map_irq,
56}; 55};
57 56
diff --git a/arch/arm/mach-ixp4xx/dsmg600-pci.c b/arch/arm/mach-ixp4xx/dsmg600-pci.c
index 0532510b5e8c..8dca76937723 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-pci.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-pci.c
@@ -62,10 +62,9 @@ static int __init dsmg600_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
62 62
63struct hw_pci __initdata dsmg600_pci = { 63struct hw_pci __initdata dsmg600_pci = {
64 .nr_controllers = 1, 64 .nr_controllers = 1,
65 .ops = &ixp4xx_ops,
65 .preinit = dsmg600_pci_preinit, 66 .preinit = dsmg600_pci_preinit,
66 .swizzle = pci_std_swizzle,
67 .setup = ixp4xx_setup, 67 .setup = ixp4xx_setup,
68 .scan = ixp4xx_scan_bus,
69 .map_irq = dsmg600_map_irq, 68 .map_irq = dsmg600_map_irq,
70}; 69};
71 70
diff --git a/arch/arm/mach-ixp4xx/fsg-pci.c b/arch/arm/mach-ixp4xx/fsg-pci.c
index d2ac803328f7..fd4a8625b4ae 100644
--- a/arch/arm/mach-ixp4xx/fsg-pci.c
+++ b/arch/arm/mach-ixp4xx/fsg-pci.c
@@ -59,10 +59,9 @@ static int __init fsg_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
59 59
60struct hw_pci fsg_pci __initdata = { 60struct hw_pci fsg_pci __initdata = {
61 .nr_controllers = 1, 61 .nr_controllers = 1,
62 .ops = &ixp4xx_ops,
62 .preinit = fsg_pci_preinit, 63 .preinit = fsg_pci_preinit,
63 .swizzle = pci_std_swizzle,
64 .setup = ixp4xx_setup, 64 .setup = ixp4xx_setup,
65 .scan = ixp4xx_scan_bus,
66 .map_irq = fsg_map_irq, 65 .map_irq = fsg_map_irq,
67}; 66};
68 67
diff --git a/arch/arm/mach-ixp4xx/gateway7001-pci.c b/arch/arm/mach-ixp4xx/gateway7001-pci.c
index 76581fb467c4..d9d6cc089707 100644
--- a/arch/arm/mach-ixp4xx/gateway7001-pci.c
+++ b/arch/arm/mach-ixp4xx/gateway7001-pci.c
@@ -47,10 +47,9 @@ static int __init gateway7001_map_irq(const struct pci_dev *dev, u8 slot,
47 47
48struct hw_pci gateway7001_pci __initdata = { 48struct hw_pci gateway7001_pci __initdata = {
49 .nr_controllers = 1, 49 .nr_controllers = 1,
50 .ops = &ixp4xx_ops,
50 .preinit = gateway7001_pci_preinit, 51 .preinit = gateway7001_pci_preinit,
51 .swizzle = pci_std_swizzle,
52 .setup = ixp4xx_setup, 52 .setup = ixp4xx_setup,
53 .scan = ixp4xx_scan_bus,
54 .map_irq = gateway7001_map_irq, 53 .map_irq = gateway7001_map_irq,
55}; 54};
56 55
diff --git a/arch/arm/mach-ixp4xx/goramo_mlr.c b/arch/arm/mach-ixp4xx/goramo_mlr.c
index 46bb924962ee..b800a031207c 100644
--- a/arch/arm/mach-ixp4xx/goramo_mlr.c
+++ b/arch/arm/mach-ixp4xx/goramo_mlr.c
@@ -473,11 +473,10 @@ static int __init gmlr_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
473 473
474static struct hw_pci gmlr_hw_pci __initdata = { 474static struct hw_pci gmlr_hw_pci __initdata = {
475 .nr_controllers = 1, 475 .nr_controllers = 1,
476 .ops = &ixp4xx_ops,
476 .preinit = gmlr_pci_preinit, 477 .preinit = gmlr_pci_preinit,
477 .postinit = gmlr_pci_postinit, 478 .postinit = gmlr_pci_postinit,
478 .swizzle = pci_std_swizzle,
479 .setup = ixp4xx_setup, 479 .setup = ixp4xx_setup,
480 .scan = ixp4xx_scan_bus,
481 .map_irq = gmlr_map_irq, 480 .map_irq = gmlr_map_irq,
482}; 481};
483 482
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-pci.c b/arch/arm/mach-ixp4xx/gtwx5715-pci.c
index d68fc068c38d..551d114c9e14 100644
--- a/arch/arm/mach-ixp4xx/gtwx5715-pci.c
+++ b/arch/arm/mach-ixp4xx/gtwx5715-pci.c
@@ -67,10 +67,9 @@ static int __init gtwx5715_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
67 67
68struct hw_pci gtwx5715_pci __initdata = { 68struct hw_pci gtwx5715_pci __initdata = {
69 .nr_controllers = 1, 69 .nr_controllers = 1,
70 .ops = &ixp4xx_ops,
70 .preinit = gtwx5715_pci_preinit, 71 .preinit = gtwx5715_pci_preinit,
71 .swizzle = pci_std_swizzle,
72 .setup = ixp4xx_setup, 72 .setup = ixp4xx_setup,
73 .scan = ixp4xx_scan_bus,
74 .map_irq = gtwx5715_map_irq, 73 .map_irq = gtwx5715_map_irq,
75}; 74};
76 75
diff --git a/arch/arm/mach-ixp4xx/include/mach/ixp46x_ts.h b/arch/arm/mach-ixp4xx/include/mach/ixp46x_ts.h
index 292d55ed2113..cf03614d250d 100644
--- a/arch/arm/mach-ixp4xx/include/mach/ixp46x_ts.h
+++ b/arch/arm/mach-ixp4xx/include/mach/ixp46x_ts.h
@@ -75,4 +75,7 @@ struct ixp46x_ts_regs {
75#define TX_SNAPSHOT_LOCKED (1<<0) 75#define TX_SNAPSHOT_LOCKED (1<<0)
76#define RX_SNAPSHOT_LOCKED (1<<1) 76#define RX_SNAPSHOT_LOCKED (1<<1)
77 77
78/* The ptp_ixp46x module will set this variable */
79extern int ixp46x_phc_index;
80
78#endif 81#endif
diff --git a/arch/arm/mach-ixp4xx/include/mach/platform.h b/arch/arm/mach-ixp4xx/include/mach/platform.h
index b66bedc64de1..5bce94aacca9 100644
--- a/arch/arm/mach-ixp4xx/include/mach/platform.h
+++ b/arch/arm/mach-ixp4xx/include/mach/platform.h
@@ -130,7 +130,7 @@ extern void ixp4xx_restart(char, const char *);
130extern void ixp4xx_pci_preinit(void); 130extern void ixp4xx_pci_preinit(void);
131struct pci_sys_data; 131struct pci_sys_data;
132extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); 132extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
133extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); 133extern struct pci_ops ixp4xx_ops;
134 134
135/* 135/*
136 * GPIO-functions 136 * GPIO-functions
diff --git a/arch/arm/mach-ixp4xx/ixdp425-pci.c b/arch/arm/mach-ixp4xx/ixdp425-pci.c
index fffd8c5e40bf..318424dd3c50 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-pci.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c
@@ -60,10 +60,9 @@ static int __init ixdp425_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
60 60
61struct hw_pci ixdp425_pci __initdata = { 61struct hw_pci ixdp425_pci __initdata = {
62 .nr_controllers = 1, 62 .nr_controllers = 1,
63 .ops = &ixp4xx_ops,
63 .preinit = ixdp425_pci_preinit, 64 .preinit = ixdp425_pci_preinit,
64 .swizzle = pci_std_swizzle,
65 .setup = ixp4xx_setup, 65 .setup = ixp4xx_setup,
66 .scan = ixp4xx_scan_bus,
67 .map_irq = ixdp425_map_irq, 66 .map_irq = ixdp425_map_irq,
68}; 67};
69 68
diff --git a/arch/arm/mach-ixp4xx/ixdpg425-pci.c b/arch/arm/mach-ixp4xx/ixdpg425-pci.c
index 34efe75015ec..1f8717ba13dc 100644
--- a/arch/arm/mach-ixp4xx/ixdpg425-pci.c
+++ b/arch/arm/mach-ixp4xx/ixdpg425-pci.c
@@ -42,10 +42,9 @@ static int __init ixdpg425_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
42 42
43struct hw_pci ixdpg425_pci __initdata = { 43struct hw_pci ixdpg425_pci __initdata = {
44 .nr_controllers = 1, 44 .nr_controllers = 1,
45 .ops = &ixp4xx_ops,
45 .preinit = ixdpg425_pci_preinit, 46 .preinit = ixdpg425_pci_preinit,
46 .swizzle = pci_std_swizzle,
47 .setup = ixp4xx_setup, 47 .setup = ixp4xx_setup,
48 .scan = ixp4xx_scan_bus,
49 .map_irq = ixdpg425_map_irq, 48 .map_irq = ixdpg425_map_irq,
50}; 49};
51 50
diff --git a/arch/arm/mach-ixp4xx/miccpt-pci.c b/arch/arm/mach-ixp4xx/miccpt-pci.c
index ca0bae7fca90..d114ccd2017c 100644
--- a/arch/arm/mach-ixp4xx/miccpt-pci.c
+++ b/arch/arm/mach-ixp4xx/miccpt-pci.c
@@ -61,10 +61,9 @@ static int __init miccpt_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
61 61
62struct hw_pci miccpt_pci __initdata = { 62struct hw_pci miccpt_pci __initdata = {
63 .nr_controllers = 1, 63 .nr_controllers = 1,
64 .ops = &ixp4xx_ops,
64 .preinit = miccpt_pci_preinit, 65 .preinit = miccpt_pci_preinit,
65 .swizzle = pci_std_swizzle,
66 .setup = ixp4xx_setup, 66 .setup = ixp4xx_setup,
67 .scan = ixp4xx_scan_bus,
68 .map_irq = miccpt_map_irq, 67 .map_irq = miccpt_map_irq,
69}; 68};
70 69
diff --git a/arch/arm/mach-ixp4xx/nas100d-pci.c b/arch/arm/mach-ixp4xx/nas100d-pci.c
index 5434ccf553eb..8f0eba0a6800 100644
--- a/arch/arm/mach-ixp4xx/nas100d-pci.c
+++ b/arch/arm/mach-ixp4xx/nas100d-pci.c
@@ -58,10 +58,9 @@ static int __init nas100d_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
58 58
59struct hw_pci __initdata nas100d_pci = { 59struct hw_pci __initdata nas100d_pci = {
60 .nr_controllers = 1, 60 .nr_controllers = 1,
61 .ops = &ixp4xx_ops,
61 .preinit = nas100d_pci_preinit, 62 .preinit = nas100d_pci_preinit,
62 .swizzle = pci_std_swizzle,
63 .setup = ixp4xx_setup, 63 .setup = ixp4xx_setup,
64 .scan = ixp4xx_scan_bus,
65 .map_irq = nas100d_map_irq, 64 .map_irq = nas100d_map_irq,
66}; 65};
67 66
diff --git a/arch/arm/mach-ixp4xx/nslu2-pci.c b/arch/arm/mach-ixp4xx/nslu2-pci.c
index b57160535e47..032defe111aa 100644
--- a/arch/arm/mach-ixp4xx/nslu2-pci.c
+++ b/arch/arm/mach-ixp4xx/nslu2-pci.c
@@ -54,10 +54,9 @@ static int __init nslu2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
54 54
55struct hw_pci __initdata nslu2_pci = { 55struct hw_pci __initdata nslu2_pci = {
56 .nr_controllers = 1, 56 .nr_controllers = 1,
57 .ops = &ixp4xx_ops,
57 .preinit = nslu2_pci_preinit, 58 .preinit = nslu2_pci_preinit,
58 .swizzle = pci_std_swizzle,
59 .setup = ixp4xx_setup, 59 .setup = ixp4xx_setup,
60 .scan = ixp4xx_scan_bus,
61 .map_irq = nslu2_map_irq, 60 .map_irq = nslu2_map_irq,
62}; 61};
63 62
diff --git a/arch/arm/mach-ixp4xx/vulcan-pci.c b/arch/arm/mach-ixp4xx/vulcan-pci.c
index 0bc3f34c282f..a4220fa5e0c3 100644
--- a/arch/arm/mach-ixp4xx/vulcan-pci.c
+++ b/arch/arm/mach-ixp4xx/vulcan-pci.c
@@ -56,10 +56,9 @@ static int __init vulcan_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
56 56
57struct hw_pci vulcan_pci __initdata = { 57struct hw_pci vulcan_pci __initdata = {
58 .nr_controllers = 1, 58 .nr_controllers = 1,
59 .ops = &ixp4xx_ops,
59 .preinit = vulcan_pci_preinit, 60 .preinit = vulcan_pci_preinit,
60 .swizzle = pci_std_swizzle,
61 .setup = ixp4xx_setup, 61 .setup = ixp4xx_setup,
62 .scan = ixp4xx_scan_bus,
63 .map_irq = vulcan_map_irq, 62 .map_irq = vulcan_map_irq,
64}; 63};
65 64
diff --git a/arch/arm/mach-ixp4xx/wg302v2-pci.c b/arch/arm/mach-ixp4xx/wg302v2-pci.c
index f27dfcfe811b..c92e5b82af36 100644
--- a/arch/arm/mach-ixp4xx/wg302v2-pci.c
+++ b/arch/arm/mach-ixp4xx/wg302v2-pci.c
@@ -46,10 +46,9 @@ static int __init wg302v2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
46 46
47struct hw_pci wg302v2_pci __initdata = { 47struct hw_pci wg302v2_pci __initdata = {
48 .nr_controllers = 1, 48 .nr_controllers = 1,
49 .ops = &ixp4xx_ops,
49 .preinit = wg302v2_pci_preinit, 50 .preinit = wg302v2_pci_preinit,
50 .swizzle = pci_std_swizzle,
51 .setup = ixp4xx_setup, 51 .setup = ixp4xx_setup,
52 .scan = ixp4xx_scan_bus,
53 .map_irq = wg302v2_map_irq, 52 .map_irq = wg302v2_map_irq,
54}; 53};
55 54
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 90ceab761929..199764fe0fb0 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -58,6 +58,28 @@ config MACH_DREAMPLUG_DT
58 Say 'Y' here if you want your kernel to support the 58 Say 'Y' here if you want your kernel to support the
59 Marvell DreamPlug (Flattened Device Tree). 59 Marvell DreamPlug (Flattened Device Tree).
60 60
61config MACH_ICONNECT_DT
62 bool "Iomega Iconnect (Flattened Device Tree)"
63 select ARCH_KIRKWOOD_DT
64 help
65 Say 'Y' here to enable Iomega Iconnect support.
66
67config MACH_DLINK_KIRKWOOD_DT
68 bool "D-Link Kirkwood-based NAS (Flattened Device Tree)"
69 select ARCH_KIRKWOOD_DT
70 help
71 Say 'Y' here if you want your kernel to support the
72 Kirkwood-based D-Link NASes such as DNS-320 & DNS-325,
73 using Flattened Device Tree.
74
75config MACH_IB62X0_DT
76 bool "RaidSonic IB-NAS6210, IB-NAS6220 (Flattened Device Tree)"
77 select ARCH_KIRKWOOD_DT
78 help
79 Say 'Y' here if you want your kernel to support the
80 RaidSonic IB-NAS6210 & IB-NAS6220 devices, using
81 Flattened Device Tree.
82
61config MACH_TS219 83config MACH_TS219
62 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS" 84 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
63 help 85 help
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index e299a9576bf0..d2b05907b10e 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -22,3 +22,6 @@ obj-$(CONFIG_MACH_T5325) += t5325-setup.o
22obj-$(CONFIG_CPU_IDLE) += cpuidle.o 22obj-$(CONFIG_CPU_IDLE) += cpuidle.o
23obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o 23obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
24obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o 24obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
25obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
26obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o
27obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o
diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
index 16f938522304..02edbdf5b065 100644
--- a/arch/arm/mach-kirkwood/Makefile.boot
+++ b/arch/arm/mach-kirkwood/Makefile.boot
@@ -3,3 +3,7 @@ params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4 4
5dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb 5dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
6dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns320.dtb
7dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns325.dtb
8dtb-$(CONFIG_MACH_ICONNECT_DT) += kirkwood-iconnect.dtb
9dtb-$(CONFIG_MACH_IB62X0_DT) += kirkwood-ib62x0.dtb
diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
new file mode 100644
index 000000000000..58c2d68f9443
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-dnskw.c
@@ -0,0 +1,275 @@
1/*
2 * Copyright 2012 (C), Jamie Lentin <jm@lentin.co.uk>
3 *
4 * arch/arm/mach-kirkwood/board-dnskw.c
5 *
6 * D-link DNS-320 & DNS-325 NAS Init for drivers not converted to
7 * flattened device tree yet.
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/i2c.h>
18#include <linux/ata_platform.h>
19#include <linux/mv643xx_eth.h>
20#include <linux/of.h>
21#include <linux/gpio.h>
22#include <linux/input.h>
23#include <linux/gpio_keys.h>
24#include <linux/gpio-fan.h>
25#include <linux/leds.h>
26#include <asm/mach-types.h>
27#include <asm/mach/arch.h>
28#include <asm/mach/map.h>
29#include <mach/kirkwood.h>
30#include <mach/bridge-regs.h>
31#include "common.h"
32#include "mpp.h"
33
34static struct mv643xx_eth_platform_data dnskw_ge00_data = {
35 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
36};
37
38static struct mv_sata_platform_data dnskw_sata_data = {
39 .n_ports = 2,
40};
41
42static unsigned int dnskw_mpp_config[] __initdata = {
43 MPP13_UART1_TXD, /* Custom ... */
44 MPP14_UART1_RXD, /* ... Controller (DNS-320 only) */
45 MPP20_SATA1_ACTn, /* LED: White Right HDD */
46 MPP21_SATA0_ACTn, /* LED: White Left HDD */
47 MPP24_GPIO,
48 MPP25_GPIO,
49 MPP26_GPIO, /* LED: Power */
50 MPP27_GPIO, /* LED: Red Right HDD */
51 MPP28_GPIO, /* LED: Red Left HDD */
52 MPP29_GPIO, /* LED: Red USB (DNS-325 only) */
53 MPP30_GPIO,
54 MPP31_GPIO,
55 MPP32_GPIO,
56 MPP33_GPO,
57 MPP34_GPIO, /* Button: Front power */
58 MPP35_GPIO, /* LED: Red USB (DNS-320 only) */
59 MPP36_GPIO, /* Power: Turn off board */
60 MPP37_GPIO, /* Power: Turn back on after power failure */
61 MPP38_GPIO,
62 MPP39_GPIO, /* Power: SATA0 */
63 MPP40_GPIO, /* Power: SATA1 */
64 MPP41_GPIO, /* SATA0 present */
65 MPP42_GPIO, /* SATA1 present */
66 MPP43_GPIO, /* LED: White USB */
67 MPP44_GPIO, /* Fan: Tachometer Pin */
68 MPP45_GPIO, /* Fan: high speed */
69 MPP46_GPIO, /* Fan: low speed */
70 MPP47_GPIO, /* Button: Back unmount */
71 MPP48_GPIO, /* Button: Back reset */
72 MPP49_GPIO, /* Temp Alarm (DNS-325) Pin of U5 (DNS-320) */
73 0
74};
75
76static struct gpio_led dns325_led_pins[] = {
77 {
78 .name = "dns325:white:power",
79 .gpio = 26,
80 .active_low = 1,
81 .default_trigger = "default-on",
82 },
83 {
84 .name = "dns325:white:usb",
85 .gpio = 43,
86 .active_low = 1,
87 },
88 {
89 .name = "dns325:red:l_hdd",
90 .gpio = 28,
91 .active_low = 1,
92 },
93 {
94 .name = "dns325:red:r_hdd",
95 .gpio = 27,
96 .active_low = 1,
97 },
98 {
99 .name = "dns325:red:usb",
100 .gpio = 29,
101 .active_low = 1,
102 },
103};
104
105static struct gpio_led_platform_data dns325_led_data = {
106 .num_leds = ARRAY_SIZE(dns325_led_pins),
107 .leds = dns325_led_pins,
108};
109
110static struct platform_device dns325_led_device = {
111 .name = "leds-gpio",
112 .id = -1,
113 .dev = {
114 .platform_data = &dns325_led_data,
115 },
116};
117
118static struct gpio_led dns320_led_pins[] = {
119 {
120 .name = "dns320:blue:power",
121 .gpio = 26,
122 .active_low = 1,
123 .default_trigger = "default-on",
124 },
125 {
126 .name = "dns320:blue:usb",
127 .gpio = 43,
128 .active_low = 1,
129 },
130 {
131 .name = "dns320:orange:l_hdd",
132 .gpio = 28,
133 .active_low = 1,
134 },
135 {
136 .name = "dns320:orange:r_hdd",
137 .gpio = 27,
138 .active_low = 1,
139 },
140 {
141 .name = "dns320:orange:usb",
142 .gpio = 35,
143 .active_low = 1,
144 },
145};
146
147static struct gpio_led_platform_data dns320_led_data = {
148 .num_leds = ARRAY_SIZE(dns320_led_pins),
149 .leds = dns320_led_pins,
150};
151
152static struct platform_device dns320_led_device = {
153 .name = "leds-gpio",
154 .id = -1,
155 .dev = {
156 .platform_data = &dns320_led_data,
157 },
158};
159
160static struct i2c_board_info dns325_i2c_board_info[] __initdata = {
161 {
162 I2C_BOARD_INFO("lm75", 0x48),
163 },
164 /* Something at 0x0c also */
165};
166
167static struct gpio_keys_button dnskw_button_pins[] = {
168 {
169 .code = KEY_POWER,
170 .gpio = 34,
171 .desc = "Power button",
172 .active_low = 1,
173 },
174 {
175 .code = KEY_EJECTCD,
176 .gpio = 47,
177 .desc = "USB unmount button",
178 .active_low = 1,
179 },
180 {
181 .code = KEY_RESTART,
182 .gpio = 48,
183 .desc = "Reset button",
184 .active_low = 1,
185 },
186};
187
188static struct gpio_keys_platform_data dnskw_button_data = {
189 .buttons = dnskw_button_pins,
190 .nbuttons = ARRAY_SIZE(dnskw_button_pins),
191};
192
193static struct platform_device dnskw_button_device = {
194 .name = "gpio-keys",
195 .id = -1,
196 .num_resources = 0,
197 .dev = {
198 .platform_data = &dnskw_button_data,
199 }
200};
201
202/* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */
203static struct gpio_fan_speed dnskw_fan_speed[] = {
204 { 0, 0 },
205 { 3000, 1 },
206 { 6000, 2 },
207};
208static unsigned dnskw_fan_pins[] = {46, 45};
209
210static struct gpio_fan_platform_data dnskw_fan_data = {
211 .num_ctrl = ARRAY_SIZE(dnskw_fan_pins),
212 .ctrl = dnskw_fan_pins,
213 .num_speed = ARRAY_SIZE(dnskw_fan_speed),
214 .speed = dnskw_fan_speed,
215};
216
217static struct platform_device dnskw_fan_device = {
218 .name = "gpio-fan",
219 .id = -1,
220 .dev = {
221 .platform_data = &dnskw_fan_data,
222 },
223};
224
225static void dnskw_power_off(void)
226{
227 gpio_set_value(36, 1);
228}
229
230/* Register any GPIO for output and set the value */
231static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
232{
233 if (gpio_request(gpio, name) == 0 &&
234 gpio_direction_output(gpio, 0) == 0) {
235 gpio_set_value(gpio, def);
236 if (gpio_export(gpio, 0) != 0)
237 pr_err("dnskw: Failed to export GPIO %s\n", name);
238 } else
239 pr_err("dnskw: Failed to register %s\n", name);
240}
241
242void __init dnskw_init(void)
243{
244 kirkwood_mpp_conf(dnskw_mpp_config);
245
246 kirkwood_ehci_init();
247 kirkwood_ge00_init(&dnskw_ge00_data);
248 kirkwood_sata_init(&dnskw_sata_data);
249 kirkwood_i2c_init();
250
251 platform_device_register(&dnskw_button_device);
252 platform_device_register(&dnskw_fan_device);
253
254 if (of_machine_is_compatible("dlink,dns-325")) {
255 i2c_register_board_info(0, dns325_i2c_board_info,
256 ARRAY_SIZE(dns325_i2c_board_info));
257 platform_device_register(&dns325_led_device);
258
259 } else if (of_machine_is_compatible("dlink,dns-320"))
260 platform_device_register(&dns320_led_device);
261
262 /* Register power-off GPIO. */
263 if (gpio_request(36, "dnskw:power:off") == 0
264 && gpio_direction_output(36, 0) == 0)
265 pm_power_off = dnskw_power_off;
266 else
267 pr_err("dnskw: failed to configure power-off GPIO\n");
268
269 /* Ensure power is supplied to both HDDs */
270 dnskw_gpio_register(39, "dnskw:power:sata0", 1);
271 dnskw_gpio_register(40, "dnskw:power:sata1", 1);
272
273 /* Set NAS to turn back on after a power failure */
274 dnskw_gpio_register(37, "dnskw:power:recover", 1);
275}
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 1c672d9e6656..10d1969b9e3a 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -14,6 +14,7 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/of_platform.h> 16#include <linux/of_platform.h>
17#include <linux/kexec.h>
17#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
18#include <asm/mach/map.h> 19#include <asm/mach/map.h>
19#include <mach/bridge-regs.h> 20#include <mach/bridge-regs.h>
@@ -55,11 +56,24 @@ static void __init kirkwood_dt_init(void)
55 if (of_machine_is_compatible("globalscale,dreamplug")) 56 if (of_machine_is_compatible("globalscale,dreamplug"))
56 dreamplug_init(); 57 dreamplug_init();
57 58
59 if (of_machine_is_compatible("dlink,dns-kirkwood"))
60 dnskw_init();
61
62 if (of_machine_is_compatible("iom,iconnect"))
63 iconnect_init();
64
65 if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
66 ib62x0_init();
67
58 of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL); 68 of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
59} 69}
60 70
61static const char *kirkwood_dt_board_compat[] = { 71static const char *kirkwood_dt_board_compat[] = {
62 "globalscale,dreamplug", 72 "globalscale,dreamplug",
73 "dlink,dns-320",
74 "dlink,dns-325",
75 "iom,iconnect",
76 "raidsonic,ib-nas62x0",
63 NULL 77 NULL
64}; 78};
65 79
diff --git a/arch/arm/mach-kirkwood/board-ib62x0.c b/arch/arm/mach-kirkwood/board-ib62x0.c
new file mode 100644
index 000000000000..eddf1df8891f
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-ib62x0.c
@@ -0,0 +1,143 @@
1/*
2 * Copyright 2012 (C), Simon Baatz <gmbnomis@gmail.com>
3 *
4 * arch/arm/mach-kirkwood/board-ib62x0.c
5 *
6 * RaidSonic ICY BOX IB-NAS6210 & IB-NAS6220 init for drivers not
7 * converted to flattened device tree yet.
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/mtd/partitions.h>
18#include <linux/ata_platform.h>
19#include <linux/mv643xx_eth.h>
20#include <linux/gpio.h>
21#include <linux/gpio_keys.h>
22#include <linux/input.h>
23#include <linux/leds.h>
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26#include <mach/kirkwood.h>
27#include "common.h"
28#include "mpp.h"
29
30#define IB62X0_GPIO_POWER_OFF 24
31
32static struct mv643xx_eth_platform_data ib62x0_ge00_data = {
33 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
34};
35
36static struct mv_sata_platform_data ib62x0_sata_data = {
37 .n_ports = 2,
38};
39
40static unsigned int ib62x0_mpp_config[] __initdata = {
41 MPP0_NF_IO2,
42 MPP1_NF_IO3,
43 MPP2_NF_IO4,
44 MPP3_NF_IO5,
45 MPP4_NF_IO6,
46 MPP5_NF_IO7,
47 MPP18_NF_IO0,
48 MPP19_NF_IO1,
49 MPP22_GPIO, /* OS LED red */
50 MPP24_GPIO, /* Power off device */
51 MPP25_GPIO, /* OS LED green */
52 MPP27_GPIO, /* USB transfer LED */
53 MPP28_GPIO, /* Reset button */
54 MPP29_GPIO, /* USB Copy button */
55 0
56};
57
58static struct gpio_led ib62x0_led_pins[] = {
59 {
60 .name = "ib62x0:green:os",
61 .default_trigger = "default-on",
62 .gpio = 25,
63 .active_low = 0,
64 },
65 {
66 .name = "ib62x0:red:os",
67 .default_trigger = "none",
68 .gpio = 22,
69 .active_low = 0,
70 },
71 {
72 .name = "ib62x0:red:usb_copy",
73 .default_trigger = "none",
74 .gpio = 27,
75 .active_low = 0,
76 },
77};
78
79static struct gpio_led_platform_data ib62x0_led_data = {
80 .leds = ib62x0_led_pins,
81 .num_leds = ARRAY_SIZE(ib62x0_led_pins),
82};
83
84static struct platform_device ib62x0_led_device = {
85 .name = "leds-gpio",
86 .id = -1,
87 .dev = {
88 .platform_data = &ib62x0_led_data,
89 }
90};
91
92static struct gpio_keys_button ib62x0_button_pins[] = {
93 {
94 .code = KEY_COPY,
95 .gpio = 29,
96 .desc = "USB Copy",
97 .active_low = 1,
98 },
99 {
100 .code = KEY_RESTART,
101 .gpio = 28,
102 .desc = "Reset",
103 .active_low = 1,
104 },
105};
106
107static struct gpio_keys_platform_data ib62x0_button_data = {
108 .buttons = ib62x0_button_pins,
109 .nbuttons = ARRAY_SIZE(ib62x0_button_pins),
110};
111
112static struct platform_device ib62x0_button_device = {
113 .name = "gpio-keys",
114 .id = -1,
115 .num_resources = 0,
116 .dev = {
117 .platform_data = &ib62x0_button_data,
118 }
119};
120
121static void ib62x0_power_off(void)
122{
123 gpio_set_value(IB62X0_GPIO_POWER_OFF, 1);
124}
125
126void __init ib62x0_init(void)
127{
128 /*
129 * Basic setup. Needs to be called early.
130 */
131 kirkwood_mpp_conf(ib62x0_mpp_config);
132
133 kirkwood_ehci_init();
134 kirkwood_ge00_init(&ib62x0_ge00_data);
135 kirkwood_sata_init(&ib62x0_sata_data);
136 platform_device_register(&ib62x0_led_device);
137 platform_device_register(&ib62x0_button_device);
138 if (gpio_request(IB62X0_GPIO_POWER_OFF, "ib62x0:power:off") == 0 &&
139 gpio_direction_output(IB62X0_GPIO_POWER_OFF, 0) == 0)
140 pm_power_off = ib62x0_power_off;
141 else
142 pr_err("board-ib62x0: failed to configure power-off GPIO\n");
143}
diff --git a/arch/arm/mach-kirkwood/board-iconnect.c b/arch/arm/mach-kirkwood/board-iconnect.c
new file mode 100644
index 000000000000..2222c5739519
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-iconnect.c
@@ -0,0 +1,165 @@
1/*
2 * arch/arm/mach-kirkwood/board-iconnect.c
3 *
4 * Iomega i-connect Board Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/of.h>
15#include <linux/of_address.h>
16#include <linux/of_fdt.h>
17#include <linux/of_irq.h>
18#include <linux/of_platform.h>
19#include <linux/mtd/partitions.h>
20#include <linux/mv643xx_eth.h>
21#include <linux/gpio.h>
22#include <linux/leds.h>
23#include <linux/spi/flash.h>
24#include <linux/spi/spi.h>
25#include <linux/spi/orion_spi.h>
26#include <linux/i2c.h>
27#include <linux/input.h>
28#include <linux/gpio_keys.h>
29#include <asm/mach/arch.h>
30#include <mach/kirkwood.h>
31#include "common.h"
32#include "mpp.h"
33
34static struct mv643xx_eth_platform_data iconnect_ge00_data = {
35 .phy_addr = MV643XX_ETH_PHY_ADDR(11),
36};
37
38static struct gpio_led iconnect_led_pins[] = {
39 {
40 .name = "led_level",
41 .gpio = 41,
42 .default_trigger = "default-on",
43 }, {
44 .name = "power:blue",
45 .gpio = 42,
46 .default_trigger = "timer",
47 }, {
48 .name = "power:red",
49 .gpio = 43,
50 }, {
51 .name = "usb1:blue",
52 .gpio = 44,
53 }, {
54 .name = "usb2:blue",
55 .gpio = 45,
56 }, {
57 .name = "usb3:blue",
58 .gpio = 46,
59 }, {
60 .name = "usb4:blue",
61 .gpio = 47,
62 }, {
63 .name = "otb:blue",
64 .gpio = 48,
65 },
66};
67
68static struct gpio_led_platform_data iconnect_led_data = {
69 .leds = iconnect_led_pins,
70 .num_leds = ARRAY_SIZE(iconnect_led_pins),
71 .gpio_blink_set = orion_gpio_led_blink_set,
72};
73
74static struct platform_device iconnect_leds = {
75 .name = "leds-gpio",
76 .id = -1,
77 .dev = {
78 .platform_data = &iconnect_led_data,
79 }
80};
81
82static unsigned int iconnect_mpp_config[] __initdata = {
83 MPP12_GPIO,
84 MPP35_GPIO,
85 MPP41_GPIO,
86 MPP42_GPIO,
87 MPP43_GPIO,
88 MPP44_GPIO,
89 MPP45_GPIO,
90 MPP46_GPIO,
91 MPP47_GPIO,
92 MPP48_GPIO,
93 0
94};
95
96static struct i2c_board_info __initdata iconnect_board_info[] = {
97 {
98 I2C_BOARD_INFO("lm63", 0x4c),
99 },
100};
101
102static struct mtd_partition iconnect_nand_parts[] = {
103 {
104 .name = "flash",
105 .offset = 0,
106 .size = MTDPART_SIZ_FULL,
107 },
108};
109
110/* yikes... theses are the original input buttons */
111/* but I'm not convinced by the sw event choices */
112static struct gpio_keys_button iconnect_buttons[] = {
113 {
114 .type = EV_SW,
115 .code = SW_LID,
116 .gpio = 12,
117 .desc = "Reset Button",
118 .active_low = 1,
119 .debounce_interval = 100,
120 }, {
121 .type = EV_SW,
122 .code = SW_TABLET_MODE,
123 .gpio = 35,
124 .desc = "OTB Button",
125 .active_low = 1,
126 .debounce_interval = 100,
127 },
128};
129
130static struct gpio_keys_platform_data iconnect_button_data = {
131 .buttons = iconnect_buttons,
132 .nbuttons = ARRAY_SIZE(iconnect_buttons),
133};
134
135static struct platform_device iconnect_button_device = {
136 .name = "gpio-keys",
137 .id = -1,
138 .num_resources = 0,
139 .dev = {
140 .platform_data = &iconnect_button_data,
141 },
142};
143
144void __init iconnect_init(void)
145{
146 kirkwood_mpp_conf(iconnect_mpp_config);
147 kirkwood_nand_init(ARRAY_AND_SIZE(iconnect_nand_parts), 25);
148 kirkwood_i2c_init();
149 i2c_register_board_info(0, iconnect_board_info,
150 ARRAY_SIZE(iconnect_board_info));
151
152 kirkwood_ehci_init();
153 kirkwood_ge00_init(&iconnect_ge00_data);
154
155 platform_device_register(&iconnect_button_device);
156 platform_device_register(&iconnect_leds);
157}
158
159static int __init iconnect_pci_init(void)
160{
161 if (of_machine_is_compatible("iom,iconnect"))
162 kirkwood_pcie_init(KW_PCIE0);
163 return 0;
164}
165subsys_initcall(iconnect_pci_init);
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index a02cae881f2f..3ad037385a5e 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -15,6 +15,7 @@
15#include <linux/ata_platform.h> 15#include <linux/ata_platform.h>
16#include <linux/mtd/nand.h> 16#include <linux/mtd/nand.h>
17#include <linux/dma-mapping.h> 17#include <linux/dma-mapping.h>
18#include <linux/of.h>
18#include <net/dsa.h> 19#include <net/dsa.h>
19#include <asm/page.h> 20#include <asm/page.h>
20#include <asm/timex.h> 21#include <asm/timex.h>
@@ -482,6 +483,9 @@ static int __init kirkwood_clock_gate(void)
482 unsigned int curr = readl(CLOCK_GATING_CTRL); 483 unsigned int curr = readl(CLOCK_GATING_CTRL);
483 u32 dev, rev; 484 u32 dev, rev;
484 485
486#ifdef CONFIG_OF
487 struct device_node *np;
488#endif
485 kirkwood_pcie_id(&dev, &rev); 489 kirkwood_pcie_id(&dev, &rev);
486 printk(KERN_DEBUG "Gating clock of unused units\n"); 490 printk(KERN_DEBUG "Gating clock of unused units\n");
487 printk(KERN_DEBUG "before: 0x%08x\n", curr); 491 printk(KERN_DEBUG "before: 0x%08x\n", curr);
@@ -489,6 +493,14 @@ static int __init kirkwood_clock_gate(void)
489 /* Make sure those units are accessible */ 493 /* Make sure those units are accessible */
490 writel(curr | CGC_SATA0 | CGC_SATA1 | CGC_PEX0 | CGC_PEX1, CLOCK_GATING_CTRL); 494 writel(curr | CGC_SATA0 | CGC_SATA1 | CGC_PEX0 | CGC_PEX1, CLOCK_GATING_CTRL);
491 495
496#ifdef CONFIG_OF
497 np = of_find_compatible_node(NULL, NULL, "mrvl,orion-nand");
498 if (np && of_device_is_available(np)) {
499 kirkwood_clk_ctrl |= CGC_RUNIT;
500 of_node_put(np);
501 }
502#endif
503
492 /* For SATA: first shutdown the phy */ 504 /* For SATA: first shutdown the phy */
493 if (!(kirkwood_clk_ctrl & CGC_SATA0)) { 505 if (!(kirkwood_clk_ctrl & CGC_SATA0)) {
494 /* Disable PLL and IVREF */ 506 /* Disable PLL and IVREF */
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index fa8e7689c436..a34c41a5172e 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -58,6 +58,24 @@ void dreamplug_init(void);
58static inline void dreamplug_init(void) {}; 58static inline void dreamplug_init(void) {};
59#endif 59#endif
60 60
61#ifdef CONFIG_MACH_DLINK_KIRKWOOD_DT
62void dnskw_init(void);
63#else
64static inline void dnskw_init(void) {};
65#endif
66
67#ifdef CONFIG_MACH_ICONNECT_DT
68void iconnect_init(void);
69#else
70static inline void iconnect_init(void) {};
71#endif
72
73#ifdef CONFIG_MACH_IB62X0_DT
74void ib62x0_init(void);
75#else
76static inline void ib62x0_init(void) {};
77#endif
78
61/* early init functions not converted to fdt yet */ 79/* early init functions not converted to fdt yet */
62char *kirkwood_id(void); 80char *kirkwood_id(void);
63void kirkwood_l2_init(void); 81void kirkwood_l2_init(void);
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c
index f56a0118c1bb..de373176ee67 100644
--- a/arch/arm/mach-kirkwood/pcie.c
+++ b/arch/arm/mach-kirkwood/pcie.c
@@ -44,12 +44,6 @@ struct pcie_port {
44static int pcie_port_map[2]; 44static int pcie_port_map[2];
45static int num_pcie_ports; 45static int num_pcie_ports;
46 46
47static inline struct pcie_port *bus_to_port(struct pci_bus *bus)
48{
49 struct pci_sys_data *sys = bus->sysdata;
50 return sys->private_data;
51}
52
53static int pcie_valid_config(struct pcie_port *pp, int bus, int dev) 47static int pcie_valid_config(struct pcie_port *pp, int bus, int dev)
54{ 48{
55 /* 49 /*
@@ -79,7 +73,8 @@ static int pcie_valid_config(struct pcie_port *pp, int bus, int dev)
79static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, 73static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
80 int size, u32 *val) 74 int size, u32 *val)
81{ 75{
82 struct pcie_port *pp = bus_to_port(bus); 76 struct pci_sys_data *sys = bus->sysdata;
77 struct pcie_port *pp = sys->private_data;
83 unsigned long flags; 78 unsigned long flags;
84 int ret; 79 int ret;
85 80
@@ -98,7 +93,8 @@ static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
98static int pcie_wr_conf(struct pci_bus *bus, u32 devfn, 93static int pcie_wr_conf(struct pci_bus *bus, u32 devfn,
99 int where, int size, u32 val) 94 int where, int size, u32 val)
100{ 95{
101 struct pcie_port *pp = bus_to_port(bus); 96 struct pci_sys_data *sys = bus->sysdata;
97 struct pcie_port *pp = sys->private_data;
102 unsigned long flags; 98 unsigned long flags;
103 int ret; 99 int ret;
104 100
@@ -248,13 +244,13 @@ kirkwood_pcie_scan_bus(int nr, struct pci_sys_data *sys)
248static int __init kirkwood_pcie_map_irq(const struct pci_dev *dev, u8 slot, 244static int __init kirkwood_pcie_map_irq(const struct pci_dev *dev, u8 slot,
249 u8 pin) 245 u8 pin)
250{ 246{
251 struct pcie_port *pp = bus_to_port(dev->bus); 247 struct pci_sys_data *sys = dev->sysdata;
248 struct pcie_port *pp = sys->private_data;
252 249
253 return pp->irq; 250 return pp->irq;
254} 251}
255 252
256static struct hw_pci kirkwood_pci __initdata = { 253static struct hw_pci kirkwood_pci __initdata = {
257 .swizzle = pci_std_swizzle,
258 .setup = kirkwood_pcie_setup, 254 .setup = kirkwood_pcie_setup,
259 .scan = kirkwood_pcie_scan_bus, 255 .scan = kirkwood_pcie_scan_bus,
260 .map_irq = kirkwood_pcie_map_irq, 256 .map_irq = kirkwood_pcie_map_irq,
diff --git a/arch/arm/mach-ks8695/pci.c b/arch/arm/mach-ks8695/pci.c
index acc701435817..bb18193b4bac 100644
--- a/arch/arm/mach-ks8695/pci.c
+++ b/arch/arm/mach-ks8695/pci.c
@@ -141,12 +141,6 @@ static struct pci_ops ks8695_pci_ops = {
141 .write = ks8695_pci_writeconfig, 141 .write = ks8695_pci_writeconfig,
142}; 142};
143 143
144static struct pci_bus* __init ks8695_pci_scan_bus(int nr, struct pci_sys_data *sys)
145{
146 return pci_scan_root_bus(NULL, sys->busnr, &ks8695_pci_ops, sys,
147 &sys->resources);
148}
149
150static struct resource pci_mem = { 144static struct resource pci_mem = {
151 .name = "PCI Memory space", 145 .name = "PCI Memory space",
152 .start = KS8695_PCIMEM_PA, 146 .start = KS8695_PCIMEM_PA,
@@ -302,11 +296,10 @@ static void ks8695_show_pciregs(void)
302 296
303static struct hw_pci ks8695_pci __initdata = { 297static struct hw_pci ks8695_pci __initdata = {
304 .nr_controllers = 1, 298 .nr_controllers = 1,
299 .ops = &ks8695_pci_ops,
305 .preinit = ks8695_pci_preinit, 300 .preinit = ks8695_pci_preinit,
306 .setup = ks8695_pci_setup, 301 .setup = ks8695_pci_setup,
307 .scan = ks8695_pci_scan_bus,
308 .postinit = NULL, 302 .postinit = NULL,
309 .swizzle = pci_std_swizzle,
310 .map_irq = NULL, 303 .map_irq = NULL,
311}; 304};
312 305
diff --git a/arch/arm/mach-lpc32xx/Kconfig b/arch/arm/mach-lpc32xx/Kconfig
index 75946ac89ee9..e0b3eee83834 100644
--- a/arch/arm/mach-lpc32xx/Kconfig
+++ b/arch/arm/mach-lpc32xx/Kconfig
@@ -29,30 +29,4 @@ config ARCH_LPC32XX_UART6_SELECT
29 29
30endmenu 30endmenu
31 31
32menu "LPC32XX chip components"
33
34config ARCH_LPC32XX_IRAM_FOR_NET
35 bool "Use IRAM for network buffers"
36 default y
37 help
38 Say Y here to use the LPC internal fast IRAM (i.e. 256KB SRAM) as
39 network buffer. If the total combined required buffer sizes is
40 larger than the size of IRAM, then SDRAM will be used instead.
41
42 This can be enabled safely if the IRAM is not intended for other
43 uses.
44
45config ARCH_LPC32XX_MII_SUPPORT
46 bool "Check to enable MII support or leave disabled for RMII support"
47 help
48 Say Y here to enable MII support, or N for RMII support. Regardless of
49 which support is selected, the ethernet interface driver needs to be
50 selected in the device driver networking section.
51
52 The PHY3250 reference board uses RMII, so users of this board should
53 say N.
54
55endmenu
56
57endif 32endif
58
diff --git a/arch/arm/mach-lpc32xx/clock.c b/arch/arm/mach-lpc32xx/clock.c
index 2fc24ca12054..f6a3ffec1f4b 100644
--- a/arch/arm/mach-lpc32xx/clock.c
+++ b/arch/arm/mach-lpc32xx/clock.c
@@ -1095,49 +1095,42 @@ struct clk *clk_get_parent(struct clk *clk)
1095} 1095}
1096EXPORT_SYMBOL(clk_get_parent); 1096EXPORT_SYMBOL(clk_get_parent);
1097 1097
1098#define _REGISTER_CLOCK(d, n, c) \
1099 { \
1100 .dev_id = (d), \
1101 .con_id = (n), \
1102 .clk = &(c), \
1103 },
1104
1105static struct clk_lookup lookups[] = { 1098static struct clk_lookup lookups[] = {
1106 _REGISTER_CLOCK(NULL, "osc_32KHz", osc_32KHz) 1099 CLKDEV_INIT(NULL, "osc_32KHz", &osc_32KHz),
1107 _REGISTER_CLOCK(NULL, "osc_pll397", osc_pll397) 1100 CLKDEV_INIT(NULL, "osc_pll397", &osc_pll397),
1108 _REGISTER_CLOCK(NULL, "osc_main", osc_main) 1101 CLKDEV_INIT(NULL, "osc_main", &osc_main),
1109 _REGISTER_CLOCK(NULL, "sys_ck", clk_sys) 1102 CLKDEV_INIT(NULL, "sys_ck", &clk_sys),
1110 _REGISTER_CLOCK(NULL, "arm_pll_ck", clk_armpll) 1103 CLKDEV_INIT(NULL, "arm_pll_ck", &clk_armpll),
1111 _REGISTER_CLOCK(NULL, "ck_pll5", clk_usbpll) 1104 CLKDEV_INIT(NULL, "ck_pll5", &clk_usbpll),
1112 _REGISTER_CLOCK(NULL, "hclk_ck", clk_hclk) 1105 CLKDEV_INIT(NULL, "hclk_ck", &clk_hclk),
1113 _REGISTER_CLOCK(NULL, "pclk_ck", clk_pclk) 1106 CLKDEV_INIT(NULL, "pclk_ck", &clk_pclk),
1114 _REGISTER_CLOCK(NULL, "timer0_ck", clk_timer0) 1107 CLKDEV_INIT(NULL, "timer0_ck", &clk_timer0),
1115 _REGISTER_CLOCK(NULL, "timer1_ck", clk_timer1) 1108 CLKDEV_INIT(NULL, "timer1_ck", &clk_timer1),
1116 _REGISTER_CLOCK(NULL, "timer2_ck", clk_timer2) 1109 CLKDEV_INIT(NULL, "timer2_ck", &clk_timer2),
1117 _REGISTER_CLOCK(NULL, "timer3_ck", clk_timer3) 1110 CLKDEV_INIT(NULL, "timer3_ck", &clk_timer3),
1118 _REGISTER_CLOCK(NULL, "vfp9_ck", clk_vfp9) 1111 CLKDEV_INIT(NULL, "vfp9_ck", &clk_vfp9),
1119 _REGISTER_CLOCK(NULL, "clk_dmac", clk_dma) 1112 CLKDEV_INIT("pl08xdmac", NULL, &clk_dma),
1120 _REGISTER_CLOCK("pnx4008-watchdog", NULL, clk_wdt) 1113 CLKDEV_INIT("4003c000.watchdog", NULL, &clk_wdt),
1121 _REGISTER_CLOCK(NULL, "uart3_ck", clk_uart3) 1114 CLKDEV_INIT(NULL, "uart3_ck", &clk_uart3),
1122 _REGISTER_CLOCK(NULL, "uart4_ck", clk_uart4) 1115 CLKDEV_INIT(NULL, "uart4_ck", &clk_uart4),
1123 _REGISTER_CLOCK(NULL, "uart5_ck", clk_uart5) 1116 CLKDEV_INIT(NULL, "uart5_ck", &clk_uart5),
1124 _REGISTER_CLOCK(NULL, "uart6_ck", clk_uart6) 1117 CLKDEV_INIT(NULL, "uart6_ck", &clk_uart6),
1125 _REGISTER_CLOCK("pnx-i2c.0", NULL, clk_i2c0) 1118 CLKDEV_INIT("400a0000.i2c", NULL, &clk_i2c0),
1126 _REGISTER_CLOCK("pnx-i2c.1", NULL, clk_i2c1) 1119 CLKDEV_INIT("400a8000.i2c", NULL, &clk_i2c1),
1127 _REGISTER_CLOCK("pnx-i2c.2", NULL, clk_i2c2) 1120 CLKDEV_INIT("31020300.i2c", NULL, &clk_i2c2),
1128 _REGISTER_CLOCK("dev:ssp0", NULL, clk_ssp0) 1121 CLKDEV_INIT("dev:ssp0", NULL, &clk_ssp0),
1129 _REGISTER_CLOCK("dev:ssp1", NULL, clk_ssp1) 1122 CLKDEV_INIT("dev:ssp1", NULL, &clk_ssp1),
1130 _REGISTER_CLOCK("lpc32xx_keys.0", NULL, clk_kscan) 1123 CLKDEV_INIT("lpc32xx_keys.0", NULL, &clk_kscan),
1131 _REGISTER_CLOCK("lpc32xx-nand.0", "nand_ck", clk_nand) 1124 CLKDEV_INIT("lpc32xx-nand.0", "nand_ck", &clk_nand),
1132 _REGISTER_CLOCK("lpc32xx-adc", NULL, clk_adc) 1125 CLKDEV_INIT("40048000.adc", NULL, &clk_adc),
1133 _REGISTER_CLOCK(NULL, "i2s0_ck", clk_i2s0) 1126 CLKDEV_INIT(NULL, "i2s0_ck", &clk_i2s0),
1134 _REGISTER_CLOCK(NULL, "i2s1_ck", clk_i2s1) 1127 CLKDEV_INIT(NULL, "i2s1_ck", &clk_i2s1),
1135 _REGISTER_CLOCK("ts-lpc32xx", NULL, clk_tsc) 1128 CLKDEV_INIT("40048000.tsc", NULL, &clk_tsc),
1136 _REGISTER_CLOCK("dev:mmc0", NULL, clk_mmc) 1129 CLKDEV_INIT("20098000.sd", NULL, &clk_mmc),
1137 _REGISTER_CLOCK("lpc-eth.0", NULL, clk_net) 1130 CLKDEV_INIT("31060000.ethernet", NULL, &clk_net),
1138 _REGISTER_CLOCK("dev:clcd", NULL, clk_lcd) 1131 CLKDEV_INIT("dev:clcd", NULL, &clk_lcd),
1139 _REGISTER_CLOCK("lpc32xx_udc", "ck_usbd", clk_usbd) 1132 CLKDEV_INIT("31020000.usbd", "ck_usbd", &clk_usbd),
1140 _REGISTER_CLOCK("lpc32xx_rtc", NULL, clk_rtc) 1133 CLKDEV_INIT("lpc32xx_rtc", NULL, &clk_rtc),
1141}; 1134};
1142 1135
1143static int __init clk_init(void) 1136static int __init clk_init(void)
diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c
index bbbf063a74c2..5c96057b6d78 100644
--- a/arch/arm/mach-lpc32xx/common.c
+++ b/arch/arm/mach-lpc32xx/common.c
@@ -27,186 +27,11 @@
27 27
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29 29
30#include <mach/i2c.h>
31#include <mach/hardware.h> 30#include <mach/hardware.h>
32#include <mach/platform.h> 31#include <mach/platform.h>
33#include "common.h" 32#include "common.h"
34 33
35/* 34/*
36 * Watchdog timer
37 */
38static struct resource watchdog_resources[] = {
39 [0] = {
40 .start = LPC32XX_WDTIM_BASE,
41 .end = LPC32XX_WDTIM_BASE + SZ_4K - 1,
42 .flags = IORESOURCE_MEM,
43 },
44};
45
46struct platform_device lpc32xx_watchdog_device = {
47 .name = "pnx4008-watchdog",
48 .id = -1,
49 .num_resources = ARRAY_SIZE(watchdog_resources),
50 .resource = watchdog_resources,
51};
52
53/*
54 * I2C busses
55 */
56static struct i2c_pnx_data i2c0_data = {
57 .name = I2C_CHIP_NAME "1",
58 .base = LPC32XX_I2C1_BASE,
59 .irq = IRQ_LPC32XX_I2C_1,
60};
61
62static struct i2c_pnx_data i2c1_data = {
63 .name = I2C_CHIP_NAME "2",
64 .base = LPC32XX_I2C2_BASE,
65 .irq = IRQ_LPC32XX_I2C_2,
66};
67
68static struct i2c_pnx_data i2c2_data = {
69 .name = "USB-I2C",
70 .base = LPC32XX_OTG_I2C_BASE,
71 .irq = IRQ_LPC32XX_USB_I2C,
72};
73
74struct platform_device lpc32xx_i2c0_device = {
75 .name = "pnx-i2c",
76 .id = 0,
77 .dev = {
78 .platform_data = &i2c0_data,
79 },
80};
81
82struct platform_device lpc32xx_i2c1_device = {
83 .name = "pnx-i2c",
84 .id = 1,
85 .dev = {
86 .platform_data = &i2c1_data,
87 },
88};
89
90struct platform_device lpc32xx_i2c2_device = {
91 .name = "pnx-i2c",
92 .id = 2,
93 .dev = {
94 .platform_data = &i2c2_data,
95 },
96};
97
98/* TSC (Touch Screen Controller) */
99
100static struct resource lpc32xx_tsc_resources[] = {
101 {
102 .start = LPC32XX_ADC_BASE,
103 .end = LPC32XX_ADC_BASE + SZ_4K - 1,
104 .flags = IORESOURCE_MEM,
105 }, {
106 .start = IRQ_LPC32XX_TS_IRQ,
107 .end = IRQ_LPC32XX_TS_IRQ,
108 .flags = IORESOURCE_IRQ,
109 },
110};
111
112struct platform_device lpc32xx_tsc_device = {
113 .name = "ts-lpc32xx",
114 .id = -1,
115 .num_resources = ARRAY_SIZE(lpc32xx_tsc_resources),
116 .resource = lpc32xx_tsc_resources,
117};
118
119/* RTC */
120
121static struct resource lpc32xx_rtc_resources[] = {
122 {
123 .start = LPC32XX_RTC_BASE,
124 .end = LPC32XX_RTC_BASE + SZ_4K - 1,
125 .flags = IORESOURCE_MEM,
126 },{
127 .start = IRQ_LPC32XX_RTC,
128 .end = IRQ_LPC32XX_RTC,
129 .flags = IORESOURCE_IRQ,
130 },
131};
132
133struct platform_device lpc32xx_rtc_device = {
134 .name = "rtc-lpc32xx",
135 .id = -1,
136 .num_resources = ARRAY_SIZE(lpc32xx_rtc_resources),
137 .resource = lpc32xx_rtc_resources,
138};
139
140/*
141 * ADC support
142 */
143static struct resource adc_resources[] = {
144 {
145 .start = LPC32XX_ADC_BASE,
146 .end = LPC32XX_ADC_BASE + SZ_4K - 1,
147 .flags = IORESOURCE_MEM,
148 }, {
149 .start = IRQ_LPC32XX_TS_IRQ,
150 .end = IRQ_LPC32XX_TS_IRQ,
151 .flags = IORESOURCE_IRQ,
152 },
153};
154
155struct platform_device lpc32xx_adc_device = {
156 .name = "lpc32xx-adc",
157 .id = -1,
158 .num_resources = ARRAY_SIZE(adc_resources),
159 .resource = adc_resources,
160};
161
162/*
163 * USB support
164 */
165/* The dmamask must be set for OHCI to work */
166static u64 ohci_dmamask = ~(u32) 0;
167static struct resource ohci_resources[] = {
168 {
169 .start = IO_ADDRESS(LPC32XX_USB_BASE),
170 .end = IO_ADDRESS(LPC32XX_USB_BASE + 0x100 - 1),
171 .flags = IORESOURCE_MEM,
172 }, {
173 .start = IRQ_LPC32XX_USB_HOST,
174 .flags = IORESOURCE_IRQ,
175 },
176};
177struct platform_device lpc32xx_ohci_device = {
178 .name = "usb-ohci",
179 .id = -1,
180 .dev = {
181 .dma_mask = &ohci_dmamask,
182 .coherent_dma_mask = 0xFFFFFFFF,
183 },
184 .num_resources = ARRAY_SIZE(ohci_resources),
185 .resource = ohci_resources,
186};
187
188/*
189 * Network Support
190 */
191static struct resource net_resources[] = {
192 [0] = DEFINE_RES_MEM(LPC32XX_ETHERNET_BASE, SZ_4K),
193 [1] = DEFINE_RES_MEM(LPC32XX_IRAM_BASE, SZ_128K),
194 [2] = DEFINE_RES_IRQ(IRQ_LPC32XX_ETHERNET),
195};
196
197static u64 lpc32xx_mac_dma_mask = 0xffffffffUL;
198struct platform_device lpc32xx_net_device = {
199 .name = "lpc-eth",
200 .id = 0,
201 .dev = {
202 .dma_mask = &lpc32xx_mac_dma_mask,
203 .coherent_dma_mask = 0xffffffffUL,
204 },
205 .num_resources = ARRAY_SIZE(net_resources),
206 .resource = net_resources,
207};
208
209/*
210 * Returns the unique ID for the device 35 * Returns the unique ID for the device
211 */ 36 */
212void lpc32xx_get_uid(u32 devid[4]) 37void lpc32xx_get_uid(u32 devid[4])
@@ -398,3 +223,16 @@ void lpc23xx_restart(char mode, const char *cmd)
398 while (1) 223 while (1)
399 ; 224 ;
400} 225}
226
227static int __init lpc32xx_display_uid(void)
228{
229 u32 uid[4];
230
231 lpc32xx_get_uid(uid);
232
233 printk(KERN_INFO "LPC32XX unique ID: %08x%08x%08x%08x\n",
234 uid[3], uid[2], uid[1], uid[0]);
235
236 return 1;
237}
238arch_initcall(lpc32xx_display_uid);
diff --git a/arch/arm/mach-lpc32xx/common.h b/arch/arm/mach-lpc32xx/common.h
index 68e45e8c9486..afeac3b1fae6 100644
--- a/arch/arm/mach-lpc32xx/common.h
+++ b/arch/arm/mach-lpc32xx/common.h
@@ -23,26 +23,12 @@
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24 24
25/* 25/*
26 * Arch specific platform device structures
27 */
28extern struct platform_device lpc32xx_watchdog_device;
29extern struct platform_device lpc32xx_i2c0_device;
30extern struct platform_device lpc32xx_i2c1_device;
31extern struct platform_device lpc32xx_i2c2_device;
32extern struct platform_device lpc32xx_tsc_device;
33extern struct platform_device lpc32xx_adc_device;
34extern struct platform_device lpc32xx_rtc_device;
35extern struct platform_device lpc32xx_ohci_device;
36extern struct platform_device lpc32xx_net_device;
37
38/*
39 * Other arch specific structures and functions 26 * Other arch specific structures and functions
40 */ 27 */
41extern struct sys_timer lpc32xx_timer; 28extern struct sys_timer lpc32xx_timer;
42extern void __init lpc32xx_init_irq(void); 29extern void __init lpc32xx_init_irq(void);
43extern void __init lpc32xx_map_io(void); 30extern void __init lpc32xx_map_io(void);
44extern void __init lpc32xx_serial_init(void); 31extern void __init lpc32xx_serial_init(void);
45extern void __init lpc32xx_gpio_init(void);
46extern void lpc23xx_restart(char, const char *); 32extern void lpc23xx_restart(char, const char *);
47 33
48 34
diff --git a/arch/arm/mach-lpc32xx/include/mach/i2c.h b/arch/arm/mach-lpc32xx/include/mach/i2c.h
deleted file mode 100644
index 034dc9286bcc..000000000000
--- a/arch/arm/mach-lpc32xx/include/mach/i2c.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * PNX4008-specific tweaks for I2C IP3204 block
3 *
4 * Author: Vitaly Wool <vwool@ru.mvista.com>
5 *
6 * 2005 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#ifndef __ASM_ARCH_I2C_H
13#define __ASM_ARCH_I2C_H
14
15enum {
16 mstatus_tdi = 0x00000001,
17 mstatus_afi = 0x00000002,
18 mstatus_nai = 0x00000004,
19 mstatus_drmi = 0x00000008,
20 mstatus_active = 0x00000020,
21 mstatus_scl = 0x00000040,
22 mstatus_sda = 0x00000080,
23 mstatus_rff = 0x00000100,
24 mstatus_rfe = 0x00000200,
25 mstatus_tff = 0x00000400,
26 mstatus_tfe = 0x00000800,
27};
28
29enum {
30 mcntrl_tdie = 0x00000001,
31 mcntrl_afie = 0x00000002,
32 mcntrl_naie = 0x00000004,
33 mcntrl_drmie = 0x00000008,
34 mcntrl_daie = 0x00000020,
35 mcntrl_rffie = 0x00000040,
36 mcntrl_tffie = 0x00000080,
37 mcntrl_reset = 0x00000100,
38 mcntrl_cdbmode = 0x00000400,
39};
40
41enum {
42 rw_bit = 1 << 0,
43 start_bit = 1 << 8,
44 stop_bit = 1 << 9,
45};
46
47#define I2C_REG_RX(a) ((a)->ioaddr) /* Rx FIFO reg (RO) */
48#define I2C_REG_TX(a) ((a)->ioaddr) /* Tx FIFO reg (WO) */
49#define I2C_REG_STS(a) ((a)->ioaddr + 0x04) /* Status reg (RO) */
50#define I2C_REG_CTL(a) ((a)->ioaddr + 0x08) /* Ctl reg */
51#define I2C_REG_CKL(a) ((a)->ioaddr + 0x0c) /* Clock divider low */
52#define I2C_REG_CKH(a) ((a)->ioaddr + 0x10) /* Clock divider high */
53#define I2C_REG_ADR(a) ((a)->ioaddr + 0x14) /* I2C address */
54#define I2C_REG_RFL(a) ((a)->ioaddr + 0x18) /* Rx FIFO level (RO) */
55#define I2C_REG_TFL(a) ((a)->ioaddr + 0x1c) /* Tx FIFO level (RO) */
56#define I2C_REG_RXB(a) ((a)->ioaddr + 0x20) /* Num of bytes Rx-ed (RO) */
57#define I2C_REG_TXB(a) ((a)->ioaddr + 0x24) /* Num of bytes Tx-ed (RO) */
58#define I2C_REG_TXS(a) ((a)->ioaddr + 0x28) /* Tx slave FIFO (RO) */
59#define I2C_REG_STFL(a) ((a)->ioaddr + 0x2c) /* Tx slave FIFO level (RO) */
60
61#define I2C_CHIP_NAME "PNX4008-I2C"
62
63#endif /* __ASM_ARCH_I2C_H */
diff --git a/arch/arm/mach-lpc32xx/irq.c b/arch/arm/mach-lpc32xx/irq.c
index d080cb1123dd..5b1cc35e6fba 100644
--- a/arch/arm/mach-lpc32xx/irq.c
+++ b/arch/arm/mach-lpc32xx/irq.c
@@ -22,6 +22,11 @@
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/of.h>
26#include <linux/of_address.h>
27#include <linux/of_irq.h>
28#include <linux/irqdomain.h>
29#include <linux/module.h>
25 30
26#include <mach/irqs.h> 31#include <mach/irqs.h>
27#include <mach/hardware.h> 32#include <mach/hardware.h>
@@ -44,6 +49,9 @@
44#define SIC1_ATR_DEFAULT 0x00026000 49#define SIC1_ATR_DEFAULT 0x00026000
45#define SIC2_ATR_DEFAULT 0x00000000 50#define SIC2_ATR_DEFAULT 0x00000000
46 51
52static struct irq_domain *lpc32xx_mic_domain;
53static struct device_node *lpc32xx_mic_np;
54
47struct lpc32xx_event_group_regs { 55struct lpc32xx_event_group_regs {
48 void __iomem *enab_reg; 56 void __iomem *enab_reg;
49 void __iomem *edge_reg; 57 void __iomem *edge_reg;
@@ -203,7 +211,7 @@ static void lpc32xx_mask_irq(struct irq_data *d)
203{ 211{
204 unsigned int reg, ctrl, mask; 212 unsigned int reg, ctrl, mask;
205 213
206 get_controller(d->irq, &ctrl, &mask); 214 get_controller(d->hwirq, &ctrl, &mask);
207 215
208 reg = __raw_readl(LPC32XX_INTC_MASK(ctrl)) & ~mask; 216 reg = __raw_readl(LPC32XX_INTC_MASK(ctrl)) & ~mask;
209 __raw_writel(reg, LPC32XX_INTC_MASK(ctrl)); 217 __raw_writel(reg, LPC32XX_INTC_MASK(ctrl));
@@ -213,7 +221,7 @@ static void lpc32xx_unmask_irq(struct irq_data *d)
213{ 221{
214 unsigned int reg, ctrl, mask; 222 unsigned int reg, ctrl, mask;
215 223
216 get_controller(d->irq, &ctrl, &mask); 224 get_controller(d->hwirq, &ctrl, &mask);
217 225
218 reg = __raw_readl(LPC32XX_INTC_MASK(ctrl)) | mask; 226 reg = __raw_readl(LPC32XX_INTC_MASK(ctrl)) | mask;
219 __raw_writel(reg, LPC32XX_INTC_MASK(ctrl)); 227 __raw_writel(reg, LPC32XX_INTC_MASK(ctrl));
@@ -223,14 +231,14 @@ static void lpc32xx_ack_irq(struct irq_data *d)
223{ 231{
224 unsigned int ctrl, mask; 232 unsigned int ctrl, mask;
225 233
226 get_controller(d->irq, &ctrl, &mask); 234 get_controller(d->hwirq, &ctrl, &mask);
227 235
228 __raw_writel(mask, LPC32XX_INTC_RAW_STAT(ctrl)); 236 __raw_writel(mask, LPC32XX_INTC_RAW_STAT(ctrl));
229 237
230 /* Also need to clear pending wake event */ 238 /* Also need to clear pending wake event */
231 if (lpc32xx_events[d->irq].mask != 0) 239 if (lpc32xx_events[d->hwirq].mask != 0)
232 __raw_writel(lpc32xx_events[d->irq].mask, 240 __raw_writel(lpc32xx_events[d->hwirq].mask,
233 lpc32xx_events[d->irq].event_group->rawstat_reg); 241 lpc32xx_events[d->hwirq].event_group->rawstat_reg);
234} 242}
235 243
236static void __lpc32xx_set_irq_type(unsigned int irq, int use_high_level, 244static void __lpc32xx_set_irq_type(unsigned int irq, int use_high_level,
@@ -274,22 +282,22 @@ static int lpc32xx_set_irq_type(struct irq_data *d, unsigned int type)
274 switch (type) { 282 switch (type) {
275 case IRQ_TYPE_EDGE_RISING: 283 case IRQ_TYPE_EDGE_RISING:
276 /* Rising edge sensitive */ 284 /* Rising edge sensitive */
277 __lpc32xx_set_irq_type(d->irq, 1, 1); 285 __lpc32xx_set_irq_type(d->hwirq, 1, 1);
278 break; 286 break;
279 287
280 case IRQ_TYPE_EDGE_FALLING: 288 case IRQ_TYPE_EDGE_FALLING:
281 /* Falling edge sensitive */ 289 /* Falling edge sensitive */
282 __lpc32xx_set_irq_type(d->irq, 0, 1); 290 __lpc32xx_set_irq_type(d->hwirq, 0, 1);
283 break; 291 break;
284 292
285 case IRQ_TYPE_LEVEL_LOW: 293 case IRQ_TYPE_LEVEL_LOW:
286 /* Low level sensitive */ 294 /* Low level sensitive */
287 __lpc32xx_set_irq_type(d->irq, 0, 0); 295 __lpc32xx_set_irq_type(d->hwirq, 0, 0);
288 break; 296 break;
289 297
290 case IRQ_TYPE_LEVEL_HIGH: 298 case IRQ_TYPE_LEVEL_HIGH:
291 /* High level sensitive */ 299 /* High level sensitive */
292 __lpc32xx_set_irq_type(d->irq, 1, 0); 300 __lpc32xx_set_irq_type(d->hwirq, 1, 0);
293 break; 301 break;
294 302
295 /* Other modes are not supported */ 303 /* Other modes are not supported */
@@ -298,7 +306,7 @@ static int lpc32xx_set_irq_type(struct irq_data *d, unsigned int type)
298 } 306 }
299 307
300 /* Ok to use the level handler for all types */ 308 /* Ok to use the level handler for all types */
301 irq_set_handler(d->irq, handle_level_irq); 309 irq_set_handler(d->hwirq, handle_level_irq);
302 310
303 return 0; 311 return 0;
304} 312}
@@ -307,33 +315,33 @@ static int lpc32xx_irq_wake(struct irq_data *d, unsigned int state)
307{ 315{
308 unsigned long eventreg; 316 unsigned long eventreg;
309 317
310 if (lpc32xx_events[d->irq].mask != 0) { 318 if (lpc32xx_events[d->hwirq].mask != 0) {
311 eventreg = __raw_readl(lpc32xx_events[d->irq]. 319 eventreg = __raw_readl(lpc32xx_events[d->hwirq].
312 event_group->enab_reg); 320 event_group->enab_reg);
313 321
314 if (state) 322 if (state)
315 eventreg |= lpc32xx_events[d->irq].mask; 323 eventreg |= lpc32xx_events[d->hwirq].mask;
316 else { 324 else {
317 eventreg &= ~lpc32xx_events[d->irq].mask; 325 eventreg &= ~lpc32xx_events[d->hwirq].mask;
318 326
319 /* 327 /*
320 * When disabling the wakeup, clear the latched 328 * When disabling the wakeup, clear the latched
321 * event 329 * event
322 */ 330 */
323 __raw_writel(lpc32xx_events[d->irq].mask, 331 __raw_writel(lpc32xx_events[d->hwirq].mask,
324 lpc32xx_events[d->irq]. 332 lpc32xx_events[d->hwirq].
325 event_group->rawstat_reg); 333 event_group->rawstat_reg);
326 } 334 }
327 335
328 __raw_writel(eventreg, 336 __raw_writel(eventreg,
329 lpc32xx_events[d->irq].event_group->enab_reg); 337 lpc32xx_events[d->hwirq].event_group->enab_reg);
330 338
331 return 0; 339 return 0;
332 } 340 }
333 341
334 /* Clear event */ 342 /* Clear event */
335 __raw_writel(lpc32xx_events[d->irq].mask, 343 __raw_writel(lpc32xx_events[d->hwirq].mask,
336 lpc32xx_events[d->irq].event_group->rawstat_reg); 344 lpc32xx_events[d->hwirq].event_group->rawstat_reg);
337 345
338 return -ENODEV; 346 return -ENODEV;
339} 347}
@@ -353,6 +361,7 @@ static void __init lpc32xx_set_default_mappings(unsigned int apr,
353} 361}
354 362
355static struct irq_chip lpc32xx_irq_chip = { 363static struct irq_chip lpc32xx_irq_chip = {
364 .name = "MIC",
356 .irq_ack = lpc32xx_ack_irq, 365 .irq_ack = lpc32xx_ack_irq,
357 .irq_mask = lpc32xx_mask_irq, 366 .irq_mask = lpc32xx_mask_irq,
358 .irq_unmask = lpc32xx_unmask_irq, 367 .irq_unmask = lpc32xx_unmask_irq,
@@ -386,9 +395,23 @@ static void lpc32xx_sic2_handler(unsigned int irq, struct irq_desc *desc)
386 } 395 }
387} 396}
388 397
398static int __init __lpc32xx_mic_of_init(struct device_node *node,
399 struct device_node *parent)
400{
401 lpc32xx_mic_np = node;
402
403 return 0;
404}
405
406static const struct of_device_id mic_of_match[] __initconst = {
407 { .compatible = "nxp,lpc3220-mic", .data = __lpc32xx_mic_of_init },
408 { }
409};
410
389void __init lpc32xx_init_irq(void) 411void __init lpc32xx_init_irq(void)
390{ 412{
391 unsigned int i; 413 unsigned int i;
414 int irq_base;
392 415
393 /* Setup MIC */ 416 /* Setup MIC */
394 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_MIC_BASE)); 417 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_MIC_BASE));
@@ -448,4 +471,19 @@ void __init lpc32xx_init_irq(void)
448 LPC32XX_CLKPWR_PIN_RS); 471 LPC32XX_CLKPWR_PIN_RS);
449 __raw_writel(__raw_readl(LPC32XX_CLKPWR_INT_RS), 472 __raw_writel(__raw_readl(LPC32XX_CLKPWR_INT_RS),
450 LPC32XX_CLKPWR_INT_RS); 473 LPC32XX_CLKPWR_INT_RS);
474
475 of_irq_init(mic_of_match);
476
477 irq_base = irq_alloc_descs(-1, 0, NR_IRQS, 0);
478 if (irq_base < 0) {
479 pr_warn("Cannot allocate irq_descs, assuming pre-allocated\n");
480 irq_base = 0;
481 }
482
483 lpc32xx_mic_domain = irq_domain_add_legacy(lpc32xx_mic_np, NR_IRQS,
484 irq_base, 0,
485 &irq_domain_simple_ops,
486 NULL);
487 if (!lpc32xx_mic_domain)
488 panic("Unable to add MIC irq domain\n");
451} 489}
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
index 7f7401ec7487..540106cdb9ec 100644
--- a/arch/arm/mach-lpc32xx/phy3250.c
+++ b/arch/arm/mach-lpc32xx/phy3250.c
@@ -1,8 +1,9 @@
1/* 1/*
2 * arch/arm/mach-lpc32xx/phy3250.c 2 * Platform support for LPC32xx SoC
3 * 3 *
4 * Author: Kevin Wells <kevin.wells@nxp.com> 4 * Author: Kevin Wells <kevin.wells@nxp.com>
5 * 5 *
6 * Copyright (C) 2012 Roland Stigge <stigge@antcom.de>
6 * Copyright (C) 2010 NXP Semiconductors 7 * Copyright (C) 2010 NXP Semiconductors
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -25,11 +26,16 @@
25#include <linux/device.h> 26#include <linux/device.h>
26#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
27#include <linux/spi/eeprom.h> 28#include <linux/spi/eeprom.h>
28#include <linux/leds.h>
29#include <linux/gpio.h> 29#include <linux/gpio.h>
30#include <linux/amba/bus.h> 30#include <linux/amba/bus.h>
31#include <linux/amba/clcd.h> 31#include <linux/amba/clcd.h>
32#include <linux/amba/pl022.h> 32#include <linux/amba/pl022.h>
33#include <linux/of.h>
34#include <linux/of_address.h>
35#include <linux/of_irq.h>
36#include <linux/of_platform.h>
37#include <linux/clk.h>
38#include <linux/amba/pl08x.h>
33 39
34#include <asm/setup.h> 40#include <asm/setup.h>
35#include <asm/mach-types.h> 41#include <asm/mach-types.h>
@@ -47,7 +53,6 @@
47#define SPI0_CS_GPIO LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5) 53#define SPI0_CS_GPIO LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5)
48#define LCD_POWER_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 0) 54#define LCD_POWER_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 0)
49#define BKL_POWER_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 4) 55#define BKL_POWER_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 4)
50#define LED_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 1)
51 56
52/* 57/*
53 * AMBA LCD controller 58 * AMBA LCD controller
@@ -150,9 +155,6 @@ static struct clcd_board lpc32xx_clcd_data = {
150 .remove = lpc32xx_clcd_remove, 155 .remove = lpc32xx_clcd_remove,
151}; 156};
152 157
153static AMBA_AHB_DEVICE(lpc32xx_clcd, "dev:clcd", 0,
154 LPC32XX_LCD_BASE, { IRQ_LPC32XX_LCD }, &lpc32xx_clcd_data);
155
156/* 158/*
157 * AMBA SSP (SPI) 159 * AMBA SSP (SPI)
158 */ 160 */
@@ -180,8 +182,11 @@ static struct pl022_ssp_controller lpc32xx_ssp0_data = {
180 .enable_dma = 0, 182 .enable_dma = 0,
181}; 183};
182 184
183static AMBA_APB_DEVICE(lpc32xx_ssp0, "dev:ssp0", 0, 185static struct pl022_ssp_controller lpc32xx_ssp1_data = {
184 LPC32XX_SSP0_BASE, { IRQ_LPC32XX_SSP0 }, &lpc32xx_ssp0_data); 186 .bus_id = 1,
187 .num_chipselect = 1,
188 .enable_dma = 0,
189};
185 190
186/* AT25 driver registration */ 191/* AT25 driver registration */
187static int __init phy3250_spi_board_register(void) 192static int __init phy3250_spi_board_register(void)
@@ -221,73 +226,20 @@ static int __init phy3250_spi_board_register(void)
221} 226}
222arch_initcall(phy3250_spi_board_register); 227arch_initcall(phy3250_spi_board_register);
223 228
224static struct i2c_board_info __initdata phy3250_i2c_board_info[] = { 229static struct pl08x_platform_data pl08x_pd = {
225 {
226 I2C_BOARD_INFO("pcf8563", 0x51),
227 },
228};
229
230static struct gpio_led phy_leds[] = {
231 {
232 .name = "led0",
233 .gpio = LED_GPIO,
234 .active_low = 1,
235 .default_trigger = "heartbeat",
236 },
237};
238
239static struct gpio_led_platform_data led_data = {
240 .leds = phy_leds,
241 .num_leds = ARRAY_SIZE(phy_leds),
242};
243
244static struct platform_device lpc32xx_gpio_led_device = {
245 .name = "leds-gpio",
246 .id = -1,
247 .dev.platform_data = &led_data,
248}; 230};
249 231
250static struct platform_device *phy3250_devs[] __initdata = { 232static const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = {
251 &lpc32xx_rtc_device, 233 OF_DEV_AUXDATA("arm,pl022", 0x20084000, "dev:ssp0", &lpc32xx_ssp0_data),
252 &lpc32xx_tsc_device, 234 OF_DEV_AUXDATA("arm,pl022", 0x2008C000, "dev:ssp1", &lpc32xx_ssp1_data),
253 &lpc32xx_i2c0_device, 235 OF_DEV_AUXDATA("arm,pl110", 0x31040000, "dev:clcd", &lpc32xx_clcd_data),
254 &lpc32xx_i2c1_device, 236 OF_DEV_AUXDATA("arm,pl080", 0x31000000, "pl08xdmac", &pl08x_pd),
255 &lpc32xx_i2c2_device, 237 { }
256 &lpc32xx_watchdog_device,
257 &lpc32xx_gpio_led_device,
258 &lpc32xx_adc_device,
259 &lpc32xx_ohci_device,
260 &lpc32xx_net_device,
261}; 238};
262 239
263static struct amba_device *amba_devs[] __initdata = { 240static void __init lpc3250_machine_init(void)
264 &lpc32xx_clcd_device,
265 &lpc32xx_ssp0_device,
266};
267
268/*
269 * Board specific functions
270 */
271static void __init phy3250_board_init(void)
272{ 241{
273 u32 tmp; 242 u32 tmp;
274 int i;
275
276 lpc32xx_gpio_init();
277
278 /* Register GPIOs used on this board */
279 if (gpio_request(SPI0_CS_GPIO, "spi0 cs"))
280 printk(KERN_ERR "Error requesting gpio %u",
281 SPI0_CS_GPIO);
282 else if (gpio_direction_output(SPI0_CS_GPIO, 1))
283 printk(KERN_ERR "Error setting gpio %u to output",
284 SPI0_CS_GPIO);
285
286 /* Setup network interface for RMII mode */
287 tmp = __raw_readl(LPC32XX_CLKPWR_MACCLK_CTRL);
288 tmp &= ~LPC32XX_CLKPWR_MACCTRL_PINS_MSK;
289 tmp |= LPC32XX_CLKPWR_MACCTRL_USE_RMII_PINS;
290 __raw_writel(tmp, LPC32XX_CLKPWR_MACCLK_CTRL);
291 243
292 /* Setup SLC NAND controller muxing */ 244 /* Setup SLC NAND controller muxing */
293 __raw_writel(LPC32XX_CLKPWR_NANDCLK_SEL_SLC, 245 __raw_writel(LPC32XX_CLKPWR_NANDCLK_SEL_SLC,
@@ -300,6 +252,12 @@ static void __init phy3250_board_init(void)
300 tmp |= LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT16; 252 tmp |= LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT16;
301 __raw_writel(tmp, LPC32XX_CLKPWR_LCDCLK_CTRL); 253 __raw_writel(tmp, LPC32XX_CLKPWR_LCDCLK_CTRL);
302 254
255 /* Set up USB power */
256 tmp = __raw_readl(LPC32XX_CLKPWR_USB_CTRL);
257 tmp |= LPC32XX_CLKPWR_USBCTRL_HCLK_EN |
258 LPC32XX_CLKPWR_USBCTRL_USBI2C_EN;
259 __raw_writel(tmp, LPC32XX_CLKPWR_USB_CTRL);
260
303 /* Set up I2C pull levels */ 261 /* Set up I2C pull levels */
304 tmp = __raw_readl(LPC32XX_CLKPWR_I2C_CLK_CTRL); 262 tmp = __raw_readl(LPC32XX_CLKPWR_I2C_CLK_CTRL);
305 tmp |= LPC32XX_CLKPWR_I2CCLK_USBI2CHI_DRIVE | 263 tmp |= LPC32XX_CLKPWR_I2CCLK_USBI2CHI_DRIVE |
@@ -321,54 +279,51 @@ static void __init phy3250_board_init(void)
321 /* 279 /*
322 * AMBA peripheral clocks need to be enabled prior to AMBA device 280 * AMBA peripheral clocks need to be enabled prior to AMBA device
323 * detection or a data fault will occur, so enable the clocks 281 * detection or a data fault will occur, so enable the clocks
324 * here. However, we don't want to enable them if the peripheral 282 * here.
325 * isn't included in the image
326 */ 283 */
327#ifdef CONFIG_FB_ARMCLCD
328 tmp = __raw_readl(LPC32XX_CLKPWR_LCDCLK_CTRL); 284 tmp = __raw_readl(LPC32XX_CLKPWR_LCDCLK_CTRL);
329 __raw_writel((tmp | LPC32XX_CLKPWR_LCDCTRL_CLK_EN), 285 __raw_writel((tmp | LPC32XX_CLKPWR_LCDCTRL_CLK_EN),
330 LPC32XX_CLKPWR_LCDCLK_CTRL); 286 LPC32XX_CLKPWR_LCDCLK_CTRL);
331#endif 287
332#ifdef CONFIG_SPI_PL022
333 tmp = __raw_readl(LPC32XX_CLKPWR_SSP_CLK_CTRL); 288 tmp = __raw_readl(LPC32XX_CLKPWR_SSP_CLK_CTRL);
334 __raw_writel((tmp | LPC32XX_CLKPWR_SSPCTRL_SSPCLK0_EN), 289 __raw_writel((tmp | LPC32XX_CLKPWR_SSPCTRL_SSPCLK0_EN),
335 LPC32XX_CLKPWR_SSP_CLK_CTRL); 290 LPC32XX_CLKPWR_SSP_CLK_CTRL);
336#endif
337 291
338 platform_add_devices(phy3250_devs, ARRAY_SIZE(phy3250_devs)); 292 tmp = __raw_readl(LPC32XX_CLKPWR_DMA_CLK_CTRL);
339 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 293 __raw_writel((tmp | LPC32XX_CLKPWR_DMACLKCTRL_CLK_EN),
340 struct amba_device *d = amba_devs[i]; 294 LPC32XX_CLKPWR_DMA_CLK_CTRL);
341 amba_device_register(d, &iomem_resource);
342 }
343 295
344 /* Test clock needed for UDA1380 initial init */ 296 /* Test clock needed for UDA1380 initial init */
345 __raw_writel(LPC32XX_CLKPWR_TESTCLK2_SEL_MOSC | 297 __raw_writel(LPC32XX_CLKPWR_TESTCLK2_SEL_MOSC |
346 LPC32XX_CLKPWR_TESTCLK_TESTCLK2_EN, 298 LPC32XX_CLKPWR_TESTCLK_TESTCLK2_EN,
347 LPC32XX_CLKPWR_TEST_CLK_SEL); 299 LPC32XX_CLKPWR_TEST_CLK_SEL);
348 300
349 i2c_register_board_info(0, phy3250_i2c_board_info, 301 of_platform_populate(NULL, of_default_bus_match_table,
350 ARRAY_SIZE(phy3250_i2c_board_info)); 302 lpc32xx_auxdata_lookup, NULL);
351}
352
353static int __init lpc32xx_display_uid(void)
354{
355 u32 uid[4];
356
357 lpc32xx_get_uid(uid);
358
359 printk(KERN_INFO "LPC32XX unique ID: %08x%08x%08x%08x\n",
360 uid[3], uid[2], uid[1], uid[0]);
361 303
362 return 1; 304 /* Register GPIOs used on this board */
305 if (gpio_request(SPI0_CS_GPIO, "spi0 cs"))
306 printk(KERN_ERR "Error requesting gpio %u",
307 SPI0_CS_GPIO);
308 else if (gpio_direction_output(SPI0_CS_GPIO, 1))
309 printk(KERN_ERR "Error setting gpio %u to output",
310 SPI0_CS_GPIO);
363} 311}
364arch_initcall(lpc32xx_display_uid);
365 312
366MACHINE_START(PHY3250, "Phytec 3250 board with the LPC3250 Microcontroller") 313static char const *lpc32xx_dt_compat[] __initdata = {
367 /* Maintainer: Kevin Wells, NXP Semiconductors */ 314 "nxp,lpc3220",
315 "nxp,lpc3230",
316 "nxp,lpc3240",
317 "nxp,lpc3250",
318 NULL
319};
320
321DT_MACHINE_START(LPC32XX_DT, "LPC32XX SoC (Flattened Device Tree)")
368 .atag_offset = 0x100, 322 .atag_offset = 0x100,
369 .map_io = lpc32xx_map_io, 323 .map_io = lpc32xx_map_io,
370 .init_irq = lpc32xx_init_irq, 324 .init_irq = lpc32xx_init_irq,
371 .timer = &lpc32xx_timer, 325 .timer = &lpc32xx_timer,
372 .init_machine = phy3250_board_init, 326 .init_machine = lpc3250_machine_init,
327 .dt_compat = lpc32xx_dt_compat,
373 .restart = lpc23xx_restart, 328 .restart = lpc23xx_restart,
374MACHINE_END 329MACHINE_END
diff --git a/arch/arm/mach-mmp/Kconfig b/arch/arm/mach-mmp/Kconfig
index 5a90b9a3ab6e..7fddd01b85b9 100644
--- a/arch/arm/mach-mmp/Kconfig
+++ b/arch/arm/mach-mmp/Kconfig
@@ -2,16 +2,6 @@ if ARCH_MMP
2 2
3menu "Marvell PXA168/910/MMP2 Implmentations" 3menu "Marvell PXA168/910/MMP2 Implmentations"
4 4
5config MACH_MMP_DT
6 bool "Support MMP2 platforms from device tree"
7 select CPU_PXA168
8 select CPU_PXA910
9 select USE_OF
10 help
11 Include support for Marvell MMP2 based platforms using
12 the device tree. Needn't select any other machine while
13 MACH_MMP_DT is enabled.
14
15config MACH_ASPENITE 5config MACH_ASPENITE
16 bool "Marvell's PXA168 Aspenite Development Board" 6 bool "Marvell's PXA168 Aspenite Development Board"
17 select CPU_PXA168 7 select CPU_PXA168
@@ -94,6 +84,25 @@ config MACH_GPLUGD
94 Say 'Y' here if you want to support the Marvell PXA168-based 84 Say 'Y' here if you want to support the Marvell PXA168-based
95 GuruPlug Display (gplugD) Board 85 GuruPlug Display (gplugD) Board
96 86
87config MACH_MMP_DT
88 bool "Support MMP (ARMv5) platforms from device tree"
89 select CPU_PXA168
90 select CPU_PXA910
91 select USE_OF
92 help
93 Include support for Marvell MMP2 based platforms using
94 the device tree. Needn't select any other machine while
95 MACH_MMP_DT is enabled.
96
97config MACH_MMP2_DT
98 bool "Support MMP2 (ARMv7) platforms from device tree"
99 depends on !CPU_MOHAWK
100 select CPU_MMP2
101 select USE_OF
102 help
103 Include support for Marvell MMP2 based platforms using
104 the device tree.
105
97endmenu 106endmenu
98 107
99config CPU_PXA168 108config CPU_PXA168
@@ -113,4 +122,11 @@ config CPU_MMP2
113 select CPU_PJ4 122 select CPU_PJ4
114 help 123 help
115 Select code specific to MMP2. MMP2 is ARMv7 compatible. 124 Select code specific to MMP2. MMP2 is ARMv7 compatible.
125
126config USB_EHCI_MV_U2O
127 bool "EHCI support for PXA USB OTG controller"
128 depends on USB_EHCI_MV
129 help
130 Enables support for OTG controller which can be switched to host mode.
131
116endif 132endif
diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile
index 4fc0ff5dc96d..b786f7e6cd1f 100644
--- a/arch/arm/mach-mmp/Makefile
+++ b/arch/arm/mach-mmp/Makefile
@@ -2,12 +2,17 @@
2# Makefile for Marvell's PXA168 processors line 2# Makefile for Marvell's PXA168 processors line
3# 3#
4 4
5obj-y += common.o clock.o devices.o time.o 5obj-y += common.o clock.o devices.o time.o irq.o
6 6
7# SoC support 7# SoC support
8obj-$(CONFIG_CPU_PXA168) += pxa168.o irq-pxa168.o 8obj-$(CONFIG_CPU_PXA168) += pxa168.o
9obj-$(CONFIG_CPU_PXA910) += pxa910.o irq-pxa168.o 9obj-$(CONFIG_CPU_PXA910) += pxa910.o
10obj-$(CONFIG_CPU_MMP2) += mmp2.o irq-mmp2.o sram.o 10obj-$(CONFIG_CPU_MMP2) += mmp2.o sram.o
11
12ifeq ($(CONFIG_PM),y)
13obj-$(CONFIG_CPU_PXA910) += pm-pxa910.o
14obj-$(CONFIG_CPU_MMP2) += pm-mmp2.o
15endif
11 16
12# board support 17# board support
13obj-$(CONFIG_MACH_ASPENITE) += aspenite.o 18obj-$(CONFIG_MACH_ASPENITE) += aspenite.o
@@ -19,5 +24,6 @@ obj-$(CONFIG_MACH_BROWNSTONE) += brownstone.o
19obj-$(CONFIG_MACH_FLINT) += flint.o 24obj-$(CONFIG_MACH_FLINT) += flint.o
20obj-$(CONFIG_MACH_MARVELL_JASPER) += jasper.o 25obj-$(CONFIG_MACH_MARVELL_JASPER) += jasper.o
21obj-$(CONFIG_MACH_MMP_DT) += mmp-dt.o 26obj-$(CONFIG_MACH_MMP_DT) += mmp-dt.o
27obj-$(CONFIG_MACH_MMP2_DT) += mmp2-dt.o
22obj-$(CONFIG_MACH_TETON_BGA) += teton_bga.o 28obj-$(CONFIG_MACH_TETON_BGA) += teton_bga.o
23obj-$(CONFIG_MACH_GPLUGD) += gplugd.o 29obj-$(CONFIG_MACH_GPLUGD) += gplugd.o
diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index bf5d8e195c3e..223090b1444d 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -17,6 +17,7 @@
17#include <linux/mtd/partitions.h> 17#include <linux/mtd/partitions.h>
18#include <linux/mtd/nand.h> 18#include <linux/mtd/nand.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/platform_data/mv_usb.h>
20 21
21#include <asm/mach-types.h> 22#include <asm/mach-types.h>
22#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
@@ -221,6 +222,21 @@ static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = {
221 .debounce_interval = 30, 222 .debounce_interval = 30,
222}; 223};
223 224
225#if defined(CONFIG_USB_EHCI_MV)
226static char *pxa168_sph_clock_name[] = {
227 [0] = "PXA168-USBCLK",
228};
229
230static struct mv_usb_platform_data pxa168_sph_pdata = {
231 .clknum = 1,
232 .clkname = pxa168_sph_clock_name,
233 .mode = MV_USB_MODE_HOST,
234 .phy_init = pxa_usb_phy_init,
235 .phy_deinit = pxa_usb_phy_deinit,
236 .set_vbus = NULL,
237};
238#endif
239
224static void __init common_init(void) 240static void __init common_init(void)
225{ 241{
226 mfp_config(ARRAY_AND_SIZE(common_pin_config)); 242 mfp_config(ARRAY_AND_SIZE(common_pin_config));
@@ -236,6 +252,10 @@ static void __init common_init(void)
236 252
237 /* off-chip devices */ 253 /* off-chip devices */
238 platform_device_register(&smc91x_device); 254 platform_device_register(&smc91x_device);
255
256#if defined(CONFIG_USB_EHCI_MV)
257 pxa168_add_usb_host(&pxa168_sph_pdata);
258#endif
239} 259}
240 260
241MACHINE_START(ASPENITE, "PXA168-based Aspenite Development Platform") 261MACHINE_START(ASPENITE, "PXA168-based Aspenite Development Platform")
diff --git a/arch/arm/mach-mmp/devices.c b/arch/arm/mach-mmp/devices.c
index 191d9dea8731..dd2d8b103cc8 100644
--- a/arch/arm/mach-mmp/devices.c
+++ b/arch/arm/mach-mmp/devices.c
@@ -9,9 +9,13 @@
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/dma-mapping.h> 11#include <linux/dma-mapping.h>
12#include <linux/delay.h>
12 13
13#include <asm/irq.h> 14#include <asm/irq.h>
15#include <mach/irqs.h>
14#include <mach/devices.h> 16#include <mach/devices.h>
17#include <mach/cputype.h>
18#include <mach/regs-usb.h>
15 19
16int __init pxa_register_device(struct pxa_device_desc *desc, 20int __init pxa_register_device(struct pxa_device_desc *desc,
17 void *data, size_t size) 21 void *data, size_t size)
@@ -67,3 +71,281 @@ int __init pxa_register_device(struct pxa_device_desc *desc,
67 71
68 return platform_device_add(pdev); 72 return platform_device_add(pdev);
69} 73}
74
75#if defined(CONFIG_USB) || defined(CONFIG_USB_GADGET)
76
77/*****************************************************************************
78 * The registers read/write routines
79 *****************************************************************************/
80
81static unsigned int u2o_get(void __iomem *base, unsigned int offset)
82{
83 return readl_relaxed(base + offset);
84}
85
86static void u2o_set(void __iomem *base, unsigned int offset,
87 unsigned int value)
88{
89 u32 reg;
90
91 reg = readl_relaxed(base + offset);
92 reg |= value;
93 writel_relaxed(reg, base + offset);
94 readl_relaxed(base + offset);
95}
96
97static void u2o_clear(void __iomem *base, unsigned int offset,
98 unsigned int value)
99{
100 u32 reg;
101
102 reg = readl_relaxed(base + offset);
103 reg &= ~value;
104 writel_relaxed(reg, base + offset);
105 readl_relaxed(base + offset);
106}
107
108static void u2o_write(void __iomem *base, unsigned int offset,
109 unsigned int value)
110{
111 writel_relaxed(value, base + offset);
112 readl_relaxed(base + offset);
113}
114
115#if defined(CONFIG_USB_MV_UDC) || defined(CONFIG_USB_EHCI_MV)
116
117#if defined(CONFIG_CPU_PXA910) || defined(CONFIG_CPU_PXA168)
118
119static DEFINE_MUTEX(phy_lock);
120static int phy_init_cnt;
121
122static int usb_phy_init_internal(void __iomem *base)
123{
124 int loops;
125
126 pr_info("Init usb phy!!!\n");
127
128 /* Initialize the USB PHY power */
129 if (cpu_is_pxa910()) {
130 u2o_set(base, UTMI_CTRL, (1<<UTMI_CTRL_INPKT_DELAY_SOF_SHIFT)
131 | (1<<UTMI_CTRL_PU_REF_SHIFT));
132 }
133
134 u2o_set(base, UTMI_CTRL, 1<<UTMI_CTRL_PLL_PWR_UP_SHIFT);
135 u2o_set(base, UTMI_CTRL, 1<<UTMI_CTRL_PWR_UP_SHIFT);
136
137 /* UTMI_PLL settings */
138 u2o_clear(base, UTMI_PLL, UTMI_PLL_PLLVDD18_MASK
139 | UTMI_PLL_PLLVDD12_MASK | UTMI_PLL_PLLCALI12_MASK
140 | UTMI_PLL_FBDIV_MASK | UTMI_PLL_REFDIV_MASK
141 | UTMI_PLL_ICP_MASK | UTMI_PLL_KVCO_MASK);
142
143 u2o_set(base, UTMI_PLL, 0xee<<UTMI_PLL_FBDIV_SHIFT
144 | 0xb<<UTMI_PLL_REFDIV_SHIFT | 3<<UTMI_PLL_PLLVDD18_SHIFT
145 | 3<<UTMI_PLL_PLLVDD12_SHIFT | 3<<UTMI_PLL_PLLCALI12_SHIFT
146 | 1<<UTMI_PLL_ICP_SHIFT | 3<<UTMI_PLL_KVCO_SHIFT);
147
148 /* UTMI_TX */
149 u2o_clear(base, UTMI_TX, UTMI_TX_REG_EXT_FS_RCAL_EN_MASK
150 | UTMI_TX_TXVDD12_MASK | UTMI_TX_CK60_PHSEL_MASK
151 | UTMI_TX_IMPCAL_VTH_MASK | UTMI_TX_REG_EXT_FS_RCAL_MASK
152 | UTMI_TX_AMP_MASK);
153 u2o_set(base, UTMI_TX, 3<<UTMI_TX_TXVDD12_SHIFT
154 | 4<<UTMI_TX_CK60_PHSEL_SHIFT | 4<<UTMI_TX_IMPCAL_VTH_SHIFT
155 | 8<<UTMI_TX_REG_EXT_FS_RCAL_SHIFT | 3<<UTMI_TX_AMP_SHIFT);
156
157 /* UTMI_RX */
158 u2o_clear(base, UTMI_RX, UTMI_RX_SQ_THRESH_MASK
159 | UTMI_REG_SQ_LENGTH_MASK);
160 u2o_set(base, UTMI_RX, 7<<UTMI_RX_SQ_THRESH_SHIFT
161 | 2<<UTMI_REG_SQ_LENGTH_SHIFT);
162
163 /* UTMI_IVREF */
164 if (cpu_is_pxa168())
165 /* fixing Microsoft Altair board interface with NEC hub issue -
166 * Set UTMI_IVREF from 0x4a3 to 0x4bf */
167 u2o_write(base, UTMI_IVREF, 0x4bf);
168
169 /* toggle VCOCAL_START bit of UTMI_PLL */
170 udelay(200);
171 u2o_set(base, UTMI_PLL, VCOCAL_START);
172 udelay(40);
173 u2o_clear(base, UTMI_PLL, VCOCAL_START);
174
175 /* toggle REG_RCAL_START bit of UTMI_TX */
176 udelay(400);
177 u2o_set(base, UTMI_TX, REG_RCAL_START);
178 udelay(40);
179 u2o_clear(base, UTMI_TX, REG_RCAL_START);
180 udelay(400);
181
182 /* Make sure PHY PLL is ready */
183 loops = 0;
184 while ((u2o_get(base, UTMI_PLL) & PLL_READY) == 0) {
185 mdelay(1);
186 loops++;
187 if (loops > 100) {
188 printk(KERN_WARNING "calibrate timeout, UTMI_PLL %x\n",
189 u2o_get(base, UTMI_PLL));
190 break;
191 }
192 }
193
194 if (cpu_is_pxa168()) {
195 u2o_set(base, UTMI_RESERVE, 1 << 5);
196 /* Turn on UTMI PHY OTG extension */
197 u2o_write(base, UTMI_OTG_ADDON, 1);
198 }
199
200 return 0;
201}
202
203static int usb_phy_deinit_internal(void __iomem *base)
204{
205 pr_info("Deinit usb phy!!!\n");
206
207 if (cpu_is_pxa168())
208 u2o_clear(base, UTMI_OTG_ADDON, UTMI_OTG_ADDON_OTG_ON);
209
210 u2o_clear(base, UTMI_CTRL, UTMI_CTRL_RXBUF_PDWN);
211 u2o_clear(base, UTMI_CTRL, UTMI_CTRL_TXBUF_PDWN);
212 u2o_clear(base, UTMI_CTRL, UTMI_CTRL_USB_CLK_EN);
213 u2o_clear(base, UTMI_CTRL, 1<<UTMI_CTRL_PWR_UP_SHIFT);
214 u2o_clear(base, UTMI_CTRL, 1<<UTMI_CTRL_PLL_PWR_UP_SHIFT);
215
216 return 0;
217}
218
219int pxa_usb_phy_init(void __iomem *phy_reg)
220{
221 mutex_lock(&phy_lock);
222 if (phy_init_cnt++ == 0)
223 usb_phy_init_internal(phy_reg);
224 mutex_unlock(&phy_lock);
225 return 0;
226}
227
228void pxa_usb_phy_deinit(void __iomem *phy_reg)
229{
230 WARN_ON(phy_init_cnt == 0);
231
232 mutex_lock(&phy_lock);
233 if (--phy_init_cnt == 0)
234 usb_phy_deinit_internal(phy_reg);
235 mutex_unlock(&phy_lock);
236}
237#endif
238#endif
239#endif
240
241#ifdef CONFIG_USB_SUPPORT
242static u64 usb_dma_mask = ~(u32)0;
243
244#ifdef CONFIG_USB_MV_UDC
245struct resource pxa168_u2o_resources[] = {
246 /* regbase */
247 [0] = {
248 .start = PXA168_U2O_REGBASE + U2x_CAPREGS_OFFSET,
249 .end = PXA168_U2O_REGBASE + USB_REG_RANGE,
250 .flags = IORESOURCE_MEM,
251 .name = "capregs",
252 },
253 /* phybase */
254 [1] = {
255 .start = PXA168_U2O_PHYBASE,
256 .end = PXA168_U2O_PHYBASE + USB_PHY_RANGE,
257 .flags = IORESOURCE_MEM,
258 .name = "phyregs",
259 },
260 [2] = {
261 .start = IRQ_PXA168_USB1,
262 .end = IRQ_PXA168_USB1,
263 .flags = IORESOURCE_IRQ,
264 },
265};
266
267struct platform_device pxa168_device_u2o = {
268 .name = "mv-udc",
269 .id = -1,
270 .resource = pxa168_u2o_resources,
271 .num_resources = ARRAY_SIZE(pxa168_u2o_resources),
272 .dev = {
273 .dma_mask = &usb_dma_mask,
274 .coherent_dma_mask = 0xffffffff,
275 }
276};
277#endif /* CONFIG_USB_MV_UDC */
278
279#ifdef CONFIG_USB_EHCI_MV_U2O
280struct resource pxa168_u2oehci_resources[] = {
281 /* regbase */
282 [0] = {
283 .start = PXA168_U2O_REGBASE + U2x_CAPREGS_OFFSET,
284 .end = PXA168_U2O_REGBASE + USB_REG_RANGE,
285 .flags = IORESOURCE_MEM,
286 .name = "capregs",
287 },
288 /* phybase */
289 [1] = {
290 .start = PXA168_U2O_PHYBASE,
291 .end = PXA168_U2O_PHYBASE + USB_PHY_RANGE,
292 .flags = IORESOURCE_MEM,
293 .name = "phyregs",
294 },
295 [2] = {
296 .start = IRQ_PXA168_USB1,
297 .end = IRQ_PXA168_USB1,
298 .flags = IORESOURCE_IRQ,
299 },
300};
301
302struct platform_device pxa168_device_u2oehci = {
303 .name = "pxa-u2oehci",
304 .id = -1,
305 .dev = {
306 .dma_mask = &usb_dma_mask,
307 .coherent_dma_mask = 0xffffffff,
308 },
309
310 .num_resources = ARRAY_SIZE(pxa168_u2oehci_resources),
311 .resource = pxa168_u2oehci_resources,
312};
313#endif
314
315#if defined(CONFIG_USB_MV_OTG)
316struct resource pxa168_u2ootg_resources[] = {
317 /* regbase */
318 [0] = {
319 .start = PXA168_U2O_REGBASE + U2x_CAPREGS_OFFSET,
320 .end = PXA168_U2O_REGBASE + USB_REG_RANGE,
321 .flags = IORESOURCE_MEM,
322 .name = "capregs",
323 },
324 /* phybase */
325 [1] = {
326 .start = PXA168_U2O_PHYBASE,
327 .end = PXA168_U2O_PHYBASE + USB_PHY_RANGE,
328 .flags = IORESOURCE_MEM,
329 .name = "phyregs",
330 },
331 [2] = {
332 .start = IRQ_PXA168_USB1,
333 .end = IRQ_PXA168_USB1,
334 .flags = IORESOURCE_IRQ,
335 },
336};
337
338struct platform_device pxa168_device_u2ootg = {
339 .name = "mv-otg",
340 .id = -1,
341 .dev = {
342 .dma_mask = &usb_dma_mask,
343 .coherent_dma_mask = 0xffffffff,
344 },
345
346 .num_resources = ARRAY_SIZE(pxa168_u2ootg_resources),
347 .resource = pxa168_u2ootg_resources,
348};
349#endif /* CONFIG_USB_MV_OTG */
350
351#endif
diff --git a/arch/arm/mach-mmp/include/mach/addr-map.h b/arch/arm/mach-mmp/include/mach/addr-map.h
index b1ece08174e8..f88a44c0ef91 100644
--- a/arch/arm/mach-mmp/include/mach/addr-map.h
+++ b/arch/arm/mach-mmp/include/mach/addr-map.h
@@ -31,4 +31,16 @@
31#define SMC_CS1_PHYS_BASE 0x90000000 31#define SMC_CS1_PHYS_BASE 0x90000000
32#define SMC_CS1_PHYS_SIZE 0x10000000 32#define SMC_CS1_PHYS_SIZE 0x10000000
33 33
34#define APMU_VIRT_BASE (AXI_VIRT_BASE + 0x82800)
35#define APMU_REG(x) (APMU_VIRT_BASE + (x))
36
37#define APBC_VIRT_BASE (APB_VIRT_BASE + 0x015000)
38#define APBC_REG(x) (APBC_VIRT_BASE + (x))
39
40#define MPMU_VIRT_BASE (APB_VIRT_BASE + 0x50000)
41#define MPMU_REG(x) (MPMU_VIRT_BASE + (x))
42
43#define CIU_VIRT_BASE (AXI_VIRT_BASE + 0x82c00)
44#define CIU_REG(x) (CIU_VIRT_BASE + (x))
45
34#endif /* __ASM_MACH_ADDR_MAP_H */ 46#endif /* __ASM_MACH_ADDR_MAP_H */
diff --git a/arch/arm/mach-mmp/include/mach/devices.h b/arch/arm/mach-mmp/include/mach/devices.h
index d0ec7dae88e4..21217ef11b64 100644
--- a/arch/arm/mach-mmp/include/mach/devices.h
+++ b/arch/arm/mach-mmp/include/mach/devices.h
@@ -50,4 +50,7 @@ struct pxa_device_desc mmp2_device_##_name __initdata = { \
50} 50}
51 51
52extern int pxa_register_device(struct pxa_device_desc *, void *, size_t); 52extern int pxa_register_device(struct pxa_device_desc *, void *, size_t);
53extern int pxa_usb_phy_init(void __iomem *phy_reg);
54extern void pxa_usb_phy_deinit(void __iomem *phy_reg);
55
53#endif /* __MACH_DEVICE_H */ 56#endif /* __MACH_DEVICE_H */
diff --git a/arch/arm/mach-mmp/include/mach/entry-macro.S b/arch/arm/mach-mmp/include/mach/entry-macro.S
index 9cff9e7a2b26..bd152e24e6d7 100644
--- a/arch/arm/mach-mmp/include/mach/entry-macro.S
+++ b/arch/arm/mach-mmp/include/mach/entry-macro.S
@@ -6,13 +6,15 @@
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8 8
9#include <asm/irq.h>
9#include <mach/regs-icu.h> 10#include <mach/regs-icu.h>
10 11
11 .macro get_irqnr_preamble, base, tmp 12 .macro get_irqnr_preamble, base, tmp
12 mrc p15, 0, \tmp, c0, c0, 0 @ CPUID 13 mrc p15, 0, \tmp, c0, c0, 0 @ CPUID
13 and \tmp, \tmp, #0xff00 14 and \tmp, \tmp, #0xff00
14 cmp \tmp, #0x5800 15 cmp \tmp, #0x5800
15 ldr \base, =ICU_VIRT_BASE 16 ldr \base, =mmp_icu_base
17 ldr \base, [\base, #0]
16 addne \base, \base, #0x10c @ PJ1 AP INT SEL register 18 addne \base, \base, #0x10c @ PJ1 AP INT SEL register
17 addeq \base, \base, #0x104 @ PJ4 IRQ SEL register 19 addeq \base, \base, #0x104 @ PJ4 IRQ SEL register
18 .endm 20 .endm
diff --git a/arch/arm/mach-mmp/include/mach/irqs.h b/arch/arm/mach-mmp/include/mach/irqs.h
index d0e746626a3d..fb492a50a817 100644
--- a/arch/arm/mach-mmp/include/mach/irqs.h
+++ b/arch/arm/mach-mmp/include/mach/irqs.h
@@ -125,7 +125,7 @@
125#define IRQ_MMP2_RTC_MUX 5 125#define IRQ_MMP2_RTC_MUX 5
126#define IRQ_MMP2_TWSI1 7 126#define IRQ_MMP2_TWSI1 7
127#define IRQ_MMP2_GPU 8 127#define IRQ_MMP2_GPU 8
128#define IRQ_MMP2_KEYPAD 9 128#define IRQ_MMP2_KEYPAD_MUX 9
129#define IRQ_MMP2_ROTARY 10 129#define IRQ_MMP2_ROTARY 10
130#define IRQ_MMP2_TRACKBALL 11 130#define IRQ_MMP2_TRACKBALL 11
131#define IRQ_MMP2_ONEWIRE 12 131#define IRQ_MMP2_ONEWIRE 12
@@ -163,11 +163,11 @@
163#define IRQ_MMP2_DMA_FIQ 47 163#define IRQ_MMP2_DMA_FIQ 47
164#define IRQ_MMP2_DMA_RIQ 48 164#define IRQ_MMP2_DMA_RIQ 48
165#define IRQ_MMP2_GPIO 49 165#define IRQ_MMP2_GPIO 49
166#define IRQ_MMP2_SSP_MUX 51 166#define IRQ_MMP2_MIPI_HSI1_MUX 51
167#define IRQ_MMP2_MMC2 52 167#define IRQ_MMP2_MMC2 52
168#define IRQ_MMP2_MMC3 53 168#define IRQ_MMP2_MMC3 53
169#define IRQ_MMP2_MMC4 54 169#define IRQ_MMP2_MMC4 54
170#define IRQ_MMP2_MIPI_HSI 55 170#define IRQ_MMP2_MIPI_HSI0_MUX 55
171#define IRQ_MMP2_MSP 58 171#define IRQ_MMP2_MSP 58
172#define IRQ_MMP2_MIPI_SLIM_DMA 59 172#define IRQ_MMP2_MIPI_SLIM_DMA 59
173#define IRQ_MMP2_PJ4_FREQ_CHG 60 173#define IRQ_MMP2_PJ4_FREQ_CHG 60
@@ -186,8 +186,14 @@
186#define IRQ_MMP2_RTC_ALARM (IRQ_MMP2_RTC_BASE + 0) 186#define IRQ_MMP2_RTC_ALARM (IRQ_MMP2_RTC_BASE + 0)
187#define IRQ_MMP2_RTC (IRQ_MMP2_RTC_BASE + 1) 187#define IRQ_MMP2_RTC (IRQ_MMP2_RTC_BASE + 1)
188 188
189/* secondary interrupt of INT #9 */
190#define IRQ_MMP2_KEYPAD_BASE (IRQ_MMP2_RTC_BASE + 2)
191#define IRQ_MMP2_KPC (IRQ_MMP2_KEYPAD_BASE + 0)
192#define IRQ_MMP2_ROTORY (IRQ_MMP2_KEYPAD_BASE + 1)
193#define IRQ_MMP2_TBALL (IRQ_MMP2_KEYPAD_BASE + 2)
194
189/* secondary interrupt of INT #17 */ 195/* secondary interrupt of INT #17 */
190#define IRQ_MMP2_TWSI_BASE (IRQ_MMP2_RTC_BASE + 2) 196#define IRQ_MMP2_TWSI_BASE (IRQ_MMP2_KEYPAD_BASE + 3)
191#define IRQ_MMP2_TWSI2 (IRQ_MMP2_TWSI_BASE + 0) 197#define IRQ_MMP2_TWSI2 (IRQ_MMP2_TWSI_BASE + 0)
192#define IRQ_MMP2_TWSI3 (IRQ_MMP2_TWSI_BASE + 1) 198#define IRQ_MMP2_TWSI3 (IRQ_MMP2_TWSI_BASE + 1)
193#define IRQ_MMP2_TWSI4 (IRQ_MMP2_TWSI_BASE + 2) 199#define IRQ_MMP2_TWSI4 (IRQ_MMP2_TWSI_BASE + 2)
@@ -212,11 +218,16 @@
212#define IRQ_MMP2_COMMRX (IRQ_MMP2_MISC_BASE + 14) 218#define IRQ_MMP2_COMMRX (IRQ_MMP2_MISC_BASE + 14)
213 219
214/* secondary interrupt of INT #51 */ 220/* secondary interrupt of INT #51 */
215#define IRQ_MMP2_SSP_BASE (IRQ_MMP2_MISC_BASE + 15) 221#define IRQ_MMP2_MIPI_HSI1_BASE (IRQ_MMP2_MISC_BASE + 15)
216#define IRQ_MMP2_SSP1_SRDY (IRQ_MMP2_SSP_BASE + 0) 222#define IRQ_MMP2_HSI1_CAWAKE (IRQ_MMP2_MIPI_HSI1_BASE + 0)
217#define IRQ_MMP2_SSP3_SRDY (IRQ_MMP2_SSP_BASE + 1) 223#define IRQ_MMP2_MIPI_HSI_INT1 (IRQ_MMP2_MIPI_HSI1_BASE + 1)
224
225/* secondary interrupt of INT #55 */
226#define IRQ_MMP2_MIPI_HSI0_BASE (IRQ_MMP2_MIPI_HSI1_BASE + 2)
227#define IRQ_MMP2_HSI0_CAWAKE (IRQ_MMP2_MIPI_HSI0_BASE + 0)
228#define IRQ_MMP2_MIPI_HSI_INT0 (IRQ_MMP2_MIPI_HSI0_BASE + 1)
218 229
219#define IRQ_MMP2_MUX_END (IRQ_MMP2_SSP_BASE + 2) 230#define IRQ_MMP2_MUX_END (IRQ_MMP2_MIPI_HSI0_BASE + 2)
220 231
221#define IRQ_GPIO_START 128 232#define IRQ_GPIO_START 128
222#define MMP_NR_BUILTIN_GPIO 192 233#define MMP_NR_BUILTIN_GPIO 192
diff --git a/arch/arm/mach-mmp/include/mach/pm-mmp2.h b/arch/arm/mach-mmp/include/mach/pm-mmp2.h
new file mode 100644
index 000000000000..98bd66ce8006
--- /dev/null
+++ b/arch/arm/mach-mmp/include/mach/pm-mmp2.h
@@ -0,0 +1,61 @@
1/*
2 * MMP2 Power Management Routines
3 *
4 * This software program is licensed subject to the GNU General Public License
5 * (GPL).Version 2,June 1991, available at http://www.fsf.org/copyleft/gpl.html
6 *
7 * (C) Copyright 2010 Marvell International Ltd.
8 * All Rights Reserved
9 */
10
11#ifndef __MMP2_PM_H__
12#define __MMP2_PM_H__
13
14#include <mach/addr-map.h>
15
16#define APMU_PJ_IDLE_CFG APMU_REG(0x018)
17#define APMU_PJ_IDLE_CFG_PJ_IDLE (1 << 1)
18#define APMU_PJ_IDLE_CFG_PJ_PWRDWN (1 << 5)
19#define APMU_PJ_IDLE_CFG_PWR_SW(x) ((x) << 16)
20#define APMU_PJ_IDLE_CFG_L2_PWR_SW (1 << 19)
21#define APMU_PJ_IDLE_CFG_ISO_MODE_CNTRL_MASK (3 << 28)
22
23#define APMU_SRAM_PWR_DWN APMU_REG(0x08c)
24
25#define MPMU_SCCR MPMU_REG(0x038)
26#define MPMU_PCR_PJ MPMU_REG(0x1000)
27#define MPMU_PCR_PJ_AXISD (1 << 31)
28#define MPMU_PCR_PJ_SLPEN (1 << 29)
29#define MPMU_PCR_PJ_SPSD (1 << 28)
30#define MPMU_PCR_PJ_DDRCORSD (1 << 27)
31#define MPMU_PCR_PJ_APBSD (1 << 26)
32#define MPMU_PCR_PJ_INTCLR (1 << 24)
33#define MPMU_PCR_PJ_SLPWP0 (1 << 23)
34#define MPMU_PCR_PJ_SLPWP1 (1 << 22)
35#define MPMU_PCR_PJ_SLPWP2 (1 << 21)
36#define MPMU_PCR_PJ_SLPWP3 (1 << 20)
37#define MPMU_PCR_PJ_VCTCXOSD (1 << 19)
38#define MPMU_PCR_PJ_SLPWP4 (1 << 18)
39#define MPMU_PCR_PJ_SLPWP5 (1 << 17)
40#define MPMU_PCR_PJ_SLPWP6 (1 << 16)
41#define MPMU_PCR_PJ_SLPWP7 (1 << 15)
42
43#define MPMU_PLL2_CTRL1 MPMU_REG(0x0414)
44#define MPMU_CGR_PJ MPMU_REG(0x1024)
45#define MPMU_WUCRM_PJ MPMU_REG(0x104c)
46#define MPMU_WUCRM_PJ_WAKEUP(x) (1 << (x))
47#define MPMU_WUCRM_PJ_RTC_ALARM (1 << 17)
48
49enum {
50 POWER_MODE_ACTIVE = 0,
51 POWER_MODE_CORE_INTIDLE,
52 POWER_MODE_CORE_EXTIDLE,
53 POWER_MODE_APPS_IDLE,
54 POWER_MODE_APPS_SLEEP,
55 POWER_MODE_CHIP_SLEEP,
56 POWER_MODE_SYS_SLEEP,
57};
58
59extern void mmp2_pm_enter_lowpower_mode(int state);
60extern int mmp2_set_wake(struct irq_data *d, unsigned int on);
61#endif
diff --git a/arch/arm/mach-mmp/include/mach/pm-pxa910.h b/arch/arm/mach-mmp/include/mach/pm-pxa910.h
new file mode 100644
index 000000000000..8cac8ab5253d
--- /dev/null
+++ b/arch/arm/mach-mmp/include/mach/pm-pxa910.h
@@ -0,0 +1,77 @@
1/*
2 * PXA910 Power Management Routines
3 *
4 * This software program is licensed subject to the GNU General Public License
5 * (GPL).Version 2,June 1991, available at http://www.fsf.org/copyleft/gpl.html
6 *
7 * (C) Copyright 2009 Marvell International Ltd.
8 * All Rights Reserved
9 */
10
11#ifndef __PXA910_PM_H__
12#define __PXA910_PM_H__
13
14#define APMU_MOH_IDLE_CFG APMU_REG(0x0018)
15#define APMU_MOH_IDLE_CFG_MOH_IDLE (1 << 1)
16#define APMU_MOH_IDLE_CFG_MOH_PWRDWN (1 << 5)
17#define APMU_MOH_IDLE_CFG_MOH_SRAM_PWRDWN (1 << 6)
18#define APMU_MOH_IDLE_CFG_MOH_PWR_SW(x) (((x) & 0x3) << 16)
19#define APMU_MOH_IDLE_CFG_MOH_L2_PWR_SW(x) (((x) & 0x3) << 18)
20#define APMU_MOH_IDLE_CFG_MOH_DIS_MC_SW_REQ (1 << 21)
21#define APMU_MOH_IDLE_CFG_MOH_MC_WAKE_EN (1 << 20)
22
23#define APMU_SQU_CLK_GATE_CTRL APMU_REG(0x001c)
24#define APMU_MC_HW_SLP_TYPE APMU_REG(0x00b0)
25
26#define MPMU_FCCR MPMU_REG(0x0008)
27#define MPMU_APCR MPMU_REG(0x1000)
28#define MPMU_APCR_AXISD (1 << 31)
29#define MPMU_APCR_DSPSD (1 << 30)
30#define MPMU_APCR_SLPEN (1 << 29)
31#define MPMU_APCR_DTCMSD (1 << 28)
32#define MPMU_APCR_DDRCORSD (1 << 27)
33#define MPMU_APCR_APBSD (1 << 26)
34#define MPMU_APCR_BBSD (1 << 25)
35#define MPMU_APCR_SLPWP0 (1 << 23)
36#define MPMU_APCR_SLPWP1 (1 << 22)
37#define MPMU_APCR_SLPWP2 (1 << 21)
38#define MPMU_APCR_SLPWP3 (1 << 20)
39#define MPMU_APCR_VCTCXOSD (1 << 19)
40#define MPMU_APCR_SLPWP4 (1 << 18)
41#define MPMU_APCR_SLPWP5 (1 << 17)
42#define MPMU_APCR_SLPWP6 (1 << 16)
43#define MPMU_APCR_SLPWP7 (1 << 15)
44#define MPMU_APCR_MSASLPEN (1 << 14)
45#define MPMU_APCR_STBYEN (1 << 13)
46
47#define MPMU_AWUCRM MPMU_REG(0x104c)
48#define MPMU_AWUCRM_AP_ASYNC_INT (1 << 25)
49#define MPMU_AWUCRM_AP_FULL_IDLE (1 << 24)
50#define MPMU_AWUCRM_SDH1 (1 << 23)
51#define MPMU_AWUCRM_SDH2 (1 << 22)
52#define MPMU_AWUCRM_KEYPRESS (1 << 21)
53#define MPMU_AWUCRM_TRACKBALL (1 << 20)
54#define MPMU_AWUCRM_NEWROTARY (1 << 19)
55#define MPMU_AWUCRM_RTC_ALARM (1 << 17)
56#define MPMU_AWUCRM_AP2_TIMER_3 (1 << 13)
57#define MPMU_AWUCRM_AP2_TIMER_2 (1 << 12)
58#define MPMU_AWUCRM_AP2_TIMER_1 (1 << 11)
59#define MPMU_AWUCRM_AP1_TIMER_3 (1 << 10)
60#define MPMU_AWUCRM_AP1_TIMER_2 (1 << 9)
61#define MPMU_AWUCRM_AP1_TIMER_1 (1 << 8)
62#define MPMU_AWUCRM_WAKEUP(x) (1 << ((x) & 0x7))
63
64enum {
65 POWER_MODE_ACTIVE = 0,
66 POWER_MODE_CORE_INTIDLE,
67 POWER_MODE_CORE_EXTIDLE,
68 POWER_MODE_APPS_IDLE,
69 POWER_MODE_APPS_SLEEP,
70 POWER_MODE_SYS_SLEEP,
71 POWER_MODE_HIBERNATE,
72 POWER_MODE_UDR,
73};
74
75extern int pxa910_set_wake(struct irq_data *data, unsigned int on);
76
77#endif
diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h b/arch/arm/mach-mmp/include/mach/pxa168.h
index dc03d580a06d..09dcd6e2b6a8 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.h
@@ -16,6 +16,7 @@ extern void pxa168_clear_keypad_wakeup(void);
16#include <plat/pxa27x_keypad.h> 16#include <plat/pxa27x_keypad.h>
17#include <mach/cputype.h> 17#include <mach/cputype.h>
18#include <linux/pxa168_eth.h> 18#include <linux/pxa168_eth.h>
19#include <linux/platform_data/mv_usb.h>
19 20
20extern struct pxa_device_desc pxa168_device_uart1; 21extern struct pxa_device_desc pxa168_device_uart1;
21extern struct pxa_device_desc pxa168_device_uart2; 22extern struct pxa_device_desc pxa168_device_uart2;
@@ -36,12 +37,9 @@ extern struct pxa_device_desc pxa168_device_fb;
36extern struct pxa_device_desc pxa168_device_keypad; 37extern struct pxa_device_desc pxa168_device_keypad;
37extern struct pxa_device_desc pxa168_device_eth; 38extern struct pxa_device_desc pxa168_device_eth;
38 39
39struct pxa168_usb_pdata {
40 /* If NULL, default phy init routine for PXA168 would be called */
41 int (*phy_init)(void __iomem *usb_phy_reg_base);
42};
43/* pdata can be NULL */ 40/* pdata can be NULL */
44int __init pxa168_add_usb_host(struct pxa168_usb_pdata *pdata); 41extern int __init pxa168_add_usb_host(struct mv_usb_platform_data *pdata);
42
45 43
46extern struct platform_device pxa168_device_gpio; 44extern struct platform_device pxa168_device_gpio;
47 45
diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h b/arch/arm/mach-mmp/include/mach/pxa910.h
index e2e1f1e5e124..793634c837ef 100644
--- a/arch/arm/mach-mmp/include/mach/pxa910.h
+++ b/arch/arm/mach-mmp/include/mach/pxa910.h
@@ -20,6 +20,9 @@ extern struct pxa_device_desc pxa910_device_pwm2;
20extern struct pxa_device_desc pxa910_device_pwm3; 20extern struct pxa_device_desc pxa910_device_pwm3;
21extern struct pxa_device_desc pxa910_device_pwm4; 21extern struct pxa_device_desc pxa910_device_pwm4;
22extern struct pxa_device_desc pxa910_device_nand; 22extern struct pxa_device_desc pxa910_device_nand;
23extern struct platform_device pxa168_device_u2o;
24extern struct platform_device pxa168_device_u2ootg;
25extern struct platform_device pxa168_device_u2oehci;
23 26
24extern struct platform_device pxa910_device_gpio; 27extern struct platform_device pxa910_device_gpio;
25extern struct platform_device pxa910_device_rtc; 28extern struct platform_device pxa910_device_rtc;
diff --git a/arch/arm/mach-mmp/include/mach/regs-apbc.h b/arch/arm/mach-mmp/include/mach/regs-apbc.h
index 8a37fb003655..68b0c93ec6a1 100644
--- a/arch/arm/mach-mmp/include/mach/regs-apbc.h
+++ b/arch/arm/mach-mmp/include/mach/regs-apbc.h
@@ -13,9 +13,6 @@
13 13
14#include <mach/addr-map.h> 14#include <mach/addr-map.h>
15 15
16#define APBC_VIRT_BASE (APB_VIRT_BASE + 0x015000)
17#define APBC_REG(x) (APBC_VIRT_BASE + (x))
18
19/* 16/*
20 * APB clock register offsets for PXA168 17 * APB clock register offsets for PXA168
21 */ 18 */
diff --git a/arch/arm/mach-mmp/include/mach/regs-apmu.h b/arch/arm/mach-mmp/include/mach/regs-apmu.h
index 8447ac63e28f..7af8deb63e83 100644
--- a/arch/arm/mach-mmp/include/mach/regs-apmu.h
+++ b/arch/arm/mach-mmp/include/mach/regs-apmu.h
@@ -13,9 +13,6 @@
13 13
14#include <mach/addr-map.h> 14#include <mach/addr-map.h>
15 15
16#define APMU_VIRT_BASE (AXI_VIRT_BASE + 0x82800)
17#define APMU_REG(x) (APMU_VIRT_BASE + (x))
18
19/* Clock Reset Control */ 16/* Clock Reset Control */
20#define APMU_IRE APMU_REG(0x048) 17#define APMU_IRE APMU_REG(0x048)
21#define APMU_LCD APMU_REG(0x04c) 18#define APMU_LCD APMU_REG(0x04c)
diff --git a/arch/arm/mach-mmp/include/mach/regs-usb.h b/arch/arm/mach-mmp/include/mach/regs-usb.h
new file mode 100644
index 000000000000..b047bf487506
--- /dev/null
+++ b/arch/arm/mach-mmp/include/mach/regs-usb.h
@@ -0,0 +1,253 @@
1/*
2 * Copyright (C) 2011 Marvell International Ltd. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
9
10#ifndef __ASM_ARCH_REGS_USB_H
11#define __ASM_ARCH_REGS_USB_H
12
13#define PXA168_U2O_REGBASE (0xd4208000)
14#define PXA168_U2O_PHYBASE (0xd4207000)
15
16#define PXA168_U2H_REGBASE (0xd4209000)
17#define PXA168_U2H_PHYBASE (0xd4206000)
18
19#define MMP3_HSIC1_REGBASE (0xf0001000)
20#define MMP3_HSIC1_PHYBASE (0xf0001800)
21
22#define MMP3_HSIC2_REGBASE (0xf0002000)
23#define MMP3_HSIC2_PHYBASE (0xf0002800)
24
25#define MMP3_FSIC_REGBASE (0xf0003000)
26#define MMP3_FSIC_PHYBASE (0xf0003800)
27
28
29#define USB_REG_RANGE (0x1ff)
30#define USB_PHY_RANGE (0xff)
31
32/* registers */
33#define U2x_CAPREGS_OFFSET 0x100
34
35/* phy regs */
36#define UTMI_REVISION 0x0
37#define UTMI_CTRL 0x4
38#define UTMI_PLL 0x8
39#define UTMI_TX 0xc
40#define UTMI_RX 0x10
41#define UTMI_IVREF 0x14
42#define UTMI_T0 0x18
43#define UTMI_T1 0x1c
44#define UTMI_T2 0x20
45#define UTMI_T3 0x24
46#define UTMI_T4 0x28
47#define UTMI_T5 0x2c
48#define UTMI_RESERVE 0x30
49#define UTMI_USB_INT 0x34
50#define UTMI_DBG_CTL 0x38
51#define UTMI_OTG_ADDON 0x3c
52
53/* For UTMICTRL Register */
54#define UTMI_CTRL_USB_CLK_EN (1 << 31)
55/* pxa168 */
56#define UTMI_CTRL_SUSPEND_SET1 (1 << 30)
57#define UTMI_CTRL_SUSPEND_SET2 (1 << 29)
58#define UTMI_CTRL_RXBUF_PDWN (1 << 24)
59#define UTMI_CTRL_TXBUF_PDWN (1 << 11)
60
61#define UTMI_CTRL_INPKT_DELAY_SHIFT 30
62#define UTMI_CTRL_INPKT_DELAY_SOF_SHIFT 28
63#define UTMI_CTRL_PU_REF_SHIFT 20
64#define UTMI_CTRL_ARC_PULLDN_SHIFT 12
65#define UTMI_CTRL_PLL_PWR_UP_SHIFT 1
66#define UTMI_CTRL_PWR_UP_SHIFT 0
67
68/* For UTMI_PLL Register */
69#define UTMI_PLL_PLLCALI12_SHIFT 29
70#define UTMI_PLL_PLLCALI12_MASK (0x3 << 29)
71
72#define UTMI_PLL_PLLVDD18_SHIFT 27
73#define UTMI_PLL_PLLVDD18_MASK (0x3 << 27)
74
75#define UTMI_PLL_PLLVDD12_SHIFT 25
76#define UTMI_PLL_PLLVDD12_MASK (0x3 << 25)
77
78#define UTMI_PLL_CLK_BLK_EN_SHIFT 24
79#define CLK_BLK_EN (0x1 << 24)
80#define PLL_READY (0x1 << 23)
81#define KVCO_EXT (0x1 << 22)
82#define VCOCAL_START (0x1 << 21)
83
84#define UTMI_PLL_KVCO_SHIFT 15
85#define UTMI_PLL_KVCO_MASK (0x7 << 15)
86
87#define UTMI_PLL_ICP_SHIFT 12
88#define UTMI_PLL_ICP_MASK (0x7 << 12)
89
90#define UTMI_PLL_FBDIV_SHIFT 4
91#define UTMI_PLL_FBDIV_MASK (0xFF << 4)
92
93#define UTMI_PLL_REFDIV_SHIFT 0
94#define UTMI_PLL_REFDIV_MASK (0xF << 0)
95
96/* For UTMI_TX Register */
97#define UTMI_TX_REG_EXT_FS_RCAL_SHIFT 27
98#define UTMI_TX_REG_EXT_FS_RCAL_MASK (0xf << 27)
99
100#define UTMI_TX_REG_EXT_FS_RCAL_EN_SHIFT 26
101#define UTMI_TX_REG_EXT_FS_RCAL_EN_MASK (0x1 << 26)
102
103#define UTMI_TX_TXVDD12_SHIFT 22
104#define UTMI_TX_TXVDD12_MASK (0x3 << 22)
105
106#define UTMI_TX_CK60_PHSEL_SHIFT 17
107#define UTMI_TX_CK60_PHSEL_MASK (0xf << 17)
108
109#define UTMI_TX_IMPCAL_VTH_SHIFT 14
110#define UTMI_TX_IMPCAL_VTH_MASK (0x7 << 14)
111
112#define REG_RCAL_START (0x1 << 12)
113
114#define UTMI_TX_LOW_VDD_EN_SHIFT 11
115
116#define UTMI_TX_AMP_SHIFT 0
117#define UTMI_TX_AMP_MASK (0x7 << 0)
118
119/* For UTMI_RX Register */
120#define UTMI_REG_SQ_LENGTH_SHIFT 15
121#define UTMI_REG_SQ_LENGTH_MASK (0x3 << 15)
122
123#define UTMI_RX_SQ_THRESH_SHIFT 4
124#define UTMI_RX_SQ_THRESH_MASK (0xf << 4)
125
126#define UTMI_OTG_ADDON_OTG_ON (1 << 0)
127
128/* For MMP3 USB Phy */
129#define USB2_PLL_REG0 0x4
130#define USB2_PLL_REG1 0x8
131#define USB2_TX_REG0 0x10
132#define USB2_TX_REG1 0x14
133#define USB2_TX_REG2 0x18
134#define USB2_RX_REG0 0x20
135#define USB2_RX_REG1 0x24
136#define USB2_RX_REG2 0x28
137#define USB2_ANA_REG0 0x30
138#define USB2_ANA_REG1 0x34
139#define USB2_ANA_REG2 0x38
140#define USB2_DIG_REG0 0x3C
141#define USB2_DIG_REG1 0x40
142#define USB2_DIG_REG2 0x44
143#define USB2_DIG_REG3 0x48
144#define USB2_TEST_REG0 0x4C
145#define USB2_TEST_REG1 0x50
146#define USB2_TEST_REG2 0x54
147#define USB2_CHARGER_REG0 0x58
148#define USB2_OTG_REG0 0x5C
149#define USB2_PHY_MON0 0x60
150#define USB2_RESETVE_REG0 0x64
151#define USB2_ICID_REG0 0x78
152#define USB2_ICID_REG1 0x7C
153
154/* USB2_PLL_REG0 */
155/* This is for Ax stepping */
156#define USB2_PLL_FBDIV_SHIFT_MMP3 0
157#define USB2_PLL_FBDIV_MASK_MMP3 (0xFF << 0)
158
159#define USB2_PLL_REFDIV_SHIFT_MMP3 8
160#define USB2_PLL_REFDIV_MASK_MMP3 (0xF << 8)
161
162#define USB2_PLL_VDD12_SHIFT_MMP3 12
163#define USB2_PLL_VDD18_SHIFT_MMP3 14
164
165/* This is for B0 stepping */
166#define USB2_PLL_FBDIV_SHIFT_MMP3_B0 0
167#define USB2_PLL_REFDIV_SHIFT_MMP3_B0 9
168#define USB2_PLL_VDD18_SHIFT_MMP3_B0 14
169#define USB2_PLL_FBDIV_MASK_MMP3_B0 0x01FF
170#define USB2_PLL_REFDIV_MASK_MMP3_B0 0x3E00
171
172#define USB2_PLL_CAL12_SHIFT_MMP3 0
173#define USB2_PLL_CALI12_MASK_MMP3 (0x3 << 0)
174
175#define USB2_PLL_VCOCAL_START_SHIFT_MMP3 2
176
177#define USB2_PLL_KVCO_SHIFT_MMP3 4
178#define USB2_PLL_KVCO_MASK_MMP3 (0x7<<4)
179
180#define USB2_PLL_ICP_SHIFT_MMP3 8
181#define USB2_PLL_ICP_MASK_MMP3 (0x7<<8)
182
183#define USB2_PLL_LOCK_BYPASS_SHIFT_MMP3 12
184
185#define USB2_PLL_PU_PLL_SHIFT_MMP3 13
186#define USB2_PLL_PU_PLL_MASK (0x1 << 13)
187
188#define USB2_PLL_READY_MASK_MMP3 (0x1 << 15)
189
190/* USB2_TX_REG0 */
191#define USB2_TX_IMPCAL_VTH_SHIFT_MMP3 8
192#define USB2_TX_IMPCAL_VTH_MASK_MMP3 (0x7 << 8)
193
194#define USB2_TX_RCAL_START_SHIFT_MMP3 13
195
196/* USB2_TX_REG1 */
197#define USB2_TX_CK60_PHSEL_SHIFT_MMP3 0
198#define USB2_TX_CK60_PHSEL_MASK_MMP3 (0xf << 0)
199
200#define USB2_TX_AMP_SHIFT_MMP3 4
201#define USB2_TX_AMP_MASK_MMP3 (0x7 << 4)
202
203#define USB2_TX_VDD12_SHIFT_MMP3 8
204#define USB2_TX_VDD12_MASK_MMP3 (0x3 << 8)
205
206/* USB2_TX_REG2 */
207#define USB2_TX_DRV_SLEWRATE_SHIFT 10
208
209/* USB2_RX_REG0 */
210#define USB2_RX_SQ_THRESH_SHIFT_MMP3 4
211#define USB2_RX_SQ_THRESH_MASK_MMP3 (0xf << 4)
212
213#define USB2_RX_SQ_LENGTH_SHIFT_MMP3 10
214#define USB2_RX_SQ_LENGTH_MASK_MMP3 (0x3 << 10)
215
216/* USB2_ANA_REG1*/
217#define USB2_ANA_PU_ANA_SHIFT_MMP3 14
218
219/* USB2_OTG_REG0 */
220#define USB2_OTG_PU_OTG_SHIFT_MMP3 3
221
222/* fsic registers */
223#define FSIC_MISC 0x4
224#define FSIC_INT 0x28
225#define FSIC_CTRL 0x30
226
227/* HSIC registers */
228#define HSIC_PAD_CTRL 0x4
229
230#define HSIC_CTRL 0x8
231#define HSIC_CTRL_HSIC_ENABLE (1<<7)
232#define HSIC_CTRL_PLL_BYPASS (1<<4)
233
234#define TEST_GRP_0 0xc
235#define TEST_GRP_1 0x10
236
237#define HSIC_INT 0x14
238#define HSIC_INT_READY_INT_EN (1<<10)
239#define HSIC_INT_CONNECT_INT_EN (1<<9)
240#define HSIC_INT_CORE_INT_EN (1<<8)
241#define HSIC_INT_HS_READY (1<<2)
242#define HSIC_INT_CONNECT (1<<1)
243#define HSIC_INT_CORE (1<<0)
244
245#define HSIC_CONFIG 0x18
246#define USBHSIC_CTRL 0x20
247
248#define HSIC_USB_CTRL 0x28
249#define HSIC_USB_CTRL_CLKEN 1
250#define HSIC_USB_CLK_PHY 0x0
251#define HSIC_USB_CLK_PMU 0x1
252
253#endif /* __ASM_ARCH_PXA_U2O_H */
diff --git a/arch/arm/mach-mmp/irq-mmp2.c b/arch/arm/mach-mmp/irq-mmp2.c
deleted file mode 100644
index 7895d277421e..000000000000
--- a/arch/arm/mach-mmp/irq-mmp2.c
+++ /dev/null
@@ -1,158 +0,0 @@
1/*
2 * linux/arch/arm/mach-mmp/irq-mmp2.c
3 *
4 * Generic IRQ handling, GPIO IRQ demultiplexing, etc.
5 *
6 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
7 * Copyright: Marvell International Ltd.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/init.h>
15#include <linux/irq.h>
16#include <linux/io.h>
17
18#include <mach/irqs.h>
19#include <mach/regs-icu.h>
20#include <mach/mmp2.h>
21
22#include "common.h"
23
24static void icu_mask_irq(struct irq_data *d)
25{
26 uint32_t r = __raw_readl(ICU_INT_CONF(d->irq));
27
28 r &= ~ICU_INT_ROUTE_PJ4_IRQ;
29 __raw_writel(r, ICU_INT_CONF(d->irq));
30}
31
32static void icu_unmask_irq(struct irq_data *d)
33{
34 uint32_t r = __raw_readl(ICU_INT_CONF(d->irq));
35
36 r |= ICU_INT_ROUTE_PJ4_IRQ;
37 __raw_writel(r, ICU_INT_CONF(d->irq));
38}
39
40static struct irq_chip icu_irq_chip = {
41 .name = "icu_irq",
42 .irq_mask = icu_mask_irq,
43 .irq_mask_ack = icu_mask_irq,
44 .irq_unmask = icu_unmask_irq,
45};
46
47static void pmic_irq_ack(struct irq_data *d)
48{
49 if (d->irq == IRQ_MMP2_PMIC)
50 mmp2_clear_pmic_int();
51}
52
53#define SECOND_IRQ_MASK(_name_, irq_base, prefix) \
54static void _name_##_mask_irq(struct irq_data *d) \
55{ \
56 uint32_t r; \
57 r = __raw_readl(prefix##_MASK) | (1 << (d->irq - irq_base)); \
58 __raw_writel(r, prefix##_MASK); \
59}
60
61#define SECOND_IRQ_UNMASK(_name_, irq_base, prefix) \
62static void _name_##_unmask_irq(struct irq_data *d) \
63{ \
64 uint32_t r; \
65 r = __raw_readl(prefix##_MASK) & ~(1 << (d->irq - irq_base)); \
66 __raw_writel(r, prefix##_MASK); \
67}
68
69#define SECOND_IRQ_DEMUX(_name_, irq_base, prefix) \
70static void _name_##_irq_demux(unsigned int irq, struct irq_desc *desc) \
71{ \
72 unsigned long status, mask, n; \
73 mask = __raw_readl(prefix##_MASK); \
74 while (1) { \
75 status = __raw_readl(prefix##_STATUS) & ~mask; \
76 if (status == 0) \
77 break; \
78 n = find_first_bit(&status, BITS_PER_LONG); \
79 while (n < BITS_PER_LONG) { \
80 generic_handle_irq(irq_base + n); \
81 n = find_next_bit(&status, BITS_PER_LONG, n+1); \
82 } \
83 } \
84}
85
86#define SECOND_IRQ_CHIP(_name_, irq_base, prefix) \
87SECOND_IRQ_MASK(_name_, irq_base, prefix) \
88SECOND_IRQ_UNMASK(_name_, irq_base, prefix) \
89SECOND_IRQ_DEMUX(_name_, irq_base, prefix) \
90static struct irq_chip _name_##_irq_chip = { \
91 .name = #_name_, \
92 .irq_mask = _name_##_mask_irq, \
93 .irq_unmask = _name_##_unmask_irq, \
94}
95
96SECOND_IRQ_CHIP(pmic, IRQ_MMP2_PMIC_BASE, MMP2_ICU_INT4);
97SECOND_IRQ_CHIP(rtc, IRQ_MMP2_RTC_BASE, MMP2_ICU_INT5);
98SECOND_IRQ_CHIP(twsi, IRQ_MMP2_TWSI_BASE, MMP2_ICU_INT17);
99SECOND_IRQ_CHIP(misc, IRQ_MMP2_MISC_BASE, MMP2_ICU_INT35);
100SECOND_IRQ_CHIP(ssp, IRQ_MMP2_SSP_BASE, MMP2_ICU_INT51);
101
102static void init_mux_irq(struct irq_chip *chip, int start, int num)
103{
104 int irq;
105
106 for (irq = start; num > 0; irq++, num--) {
107 struct irq_data *d = irq_get_irq_data(irq);
108
109 /* mask and clear the IRQ */
110 chip->irq_mask(d);
111 if (chip->irq_ack)
112 chip->irq_ack(d);
113
114 irq_set_chip(irq, chip);
115 set_irq_flags(irq, IRQF_VALID);
116 irq_set_handler(irq, handle_level_irq);
117 }
118}
119
120void __init mmp2_init_icu(void)
121{
122 int irq;
123
124 for (irq = 0; irq < IRQ_MMP2_MUX_BASE; irq++) {
125 icu_mask_irq(irq_get_irq_data(irq));
126 irq_set_chip(irq, &icu_irq_chip);
127 set_irq_flags(irq, IRQF_VALID);
128
129 switch (irq) {
130 case IRQ_MMP2_PMIC_MUX:
131 case IRQ_MMP2_RTC_MUX:
132 case IRQ_MMP2_TWSI_MUX:
133 case IRQ_MMP2_MISC_MUX:
134 case IRQ_MMP2_SSP_MUX:
135 break;
136 default:
137 irq_set_handler(irq, handle_level_irq);
138 break;
139 }
140 }
141
142 /* NOTE: IRQ_MMP2_PMIC requires the PMIC MFPR register
143 * to be written to clear the interrupt
144 */
145 pmic_irq_chip.irq_ack = pmic_irq_ack;
146
147 init_mux_irq(&pmic_irq_chip, IRQ_MMP2_PMIC_BASE, 2);
148 init_mux_irq(&rtc_irq_chip, IRQ_MMP2_RTC_BASE, 2);
149 init_mux_irq(&twsi_irq_chip, IRQ_MMP2_TWSI_BASE, 5);
150 init_mux_irq(&misc_irq_chip, IRQ_MMP2_MISC_BASE, 15);
151 init_mux_irq(&ssp_irq_chip, IRQ_MMP2_SSP_BASE, 2);
152
153 irq_set_chained_handler(IRQ_MMP2_PMIC_MUX, pmic_irq_demux);
154 irq_set_chained_handler(IRQ_MMP2_RTC_MUX, rtc_irq_demux);
155 irq_set_chained_handler(IRQ_MMP2_TWSI_MUX, twsi_irq_demux);
156 irq_set_chained_handler(IRQ_MMP2_MISC_MUX, misc_irq_demux);
157 irq_set_chained_handler(IRQ_MMP2_SSP_MUX, ssp_irq_demux);
158}
diff --git a/arch/arm/mach-mmp/irq-pxa168.c b/arch/arm/mach-mmp/irq-pxa168.c
deleted file mode 100644
index 89706a0d08f1..000000000000
--- a/arch/arm/mach-mmp/irq-pxa168.c
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * linux/arch/arm/mach-mmp/irq.c
3 *
4 * Generic IRQ handling, GPIO IRQ demultiplexing, etc.
5 *
6 * Author: Bin Yang <bin.yang@marvell.com>
7 * Created: Sep 30, 2008
8 * Copyright: Marvell International Ltd.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/init.h>
16#include <linux/irq.h>
17#include <linux/io.h>
18
19#include <mach/regs-icu.h>
20
21#include "common.h"
22
23#define IRQ_ROUTE_TO_AP (ICU_INT_CONF_AP_INT | ICU_INT_CONF_IRQ)
24
25#define PRIORITY_DEFAULT 0x1
26#define PRIORITY_NONE 0x0 /* means IRQ disabled */
27
28static void icu_mask_irq(struct irq_data *d)
29{
30 __raw_writel(PRIORITY_NONE, ICU_INT_CONF(d->irq));
31}
32
33static void icu_unmask_irq(struct irq_data *d)
34{
35 __raw_writel(IRQ_ROUTE_TO_AP | PRIORITY_DEFAULT, ICU_INT_CONF(d->irq));
36}
37
38static struct irq_chip icu_irq_chip = {
39 .name = "icu_irq",
40 .irq_ack = icu_mask_irq,
41 .irq_mask = icu_mask_irq,
42 .irq_unmask = icu_unmask_irq,
43};
44
45void __init icu_init_irq(void)
46{
47 int irq;
48
49 for (irq = 0; irq < 64; irq++) {
50 icu_mask_irq(irq_get_irq_data(irq));
51 irq_set_chip_and_handler(irq, &icu_irq_chip, handle_level_irq);
52 set_irq_flags(irq, IRQF_VALID);
53 }
54}
diff --git a/arch/arm/mach-mmp/irq.c b/arch/arm/mach-mmp/irq.c
new file mode 100644
index 000000000000..fcfe0e3bd701
--- /dev/null
+++ b/arch/arm/mach-mmp/irq.c
@@ -0,0 +1,458 @@
1/*
2 * linux/arch/arm/mach-mmp/irq.c
3 *
4 * Generic IRQ handling, GPIO IRQ demultiplexing, etc.
5 * Copyright (C) 2008 - 2012 Marvell Technology Group Ltd.
6 *
7 * Author: Bin Yang <bin.yang@marvell.com>
8 * Haojian Zhuang <haojian.zhuang@gmail.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/module.h>
16#include <linux/init.h>
17#include <linux/irq.h>
18#include <linux/irqdomain.h>
19#include <linux/io.h>
20#include <linux/ioport.h>
21#include <linux/of_address.h>
22#include <linux/of_irq.h>
23
24#include <mach/irqs.h>
25
26#ifdef CONFIG_CPU_MMP2
27#include <mach/pm-mmp2.h>
28#endif
29#ifdef CONFIG_CPU_PXA910
30#include <mach/pm-pxa910.h>
31#endif
32
33#include "common.h"
34
35#define MAX_ICU_NR 16
36
37struct icu_chip_data {
38 int nr_irqs;
39 unsigned int virq_base;
40 unsigned int cascade_irq;
41 void __iomem *reg_status;
42 void __iomem *reg_mask;
43 unsigned int conf_enable;
44 unsigned int conf_disable;
45 unsigned int conf_mask;
46 unsigned int clr_mfp_irq_base;
47 unsigned int clr_mfp_hwirq;
48 struct irq_domain *domain;
49};
50
51struct mmp_intc_conf {
52 unsigned int conf_enable;
53 unsigned int conf_disable;
54 unsigned int conf_mask;
55};
56
57void __iomem *mmp_icu_base;
58static struct icu_chip_data icu_data[MAX_ICU_NR];
59static int max_icu_nr;
60
61extern void mmp2_clear_pmic_int(void);
62
63static void icu_mask_ack_irq(struct irq_data *d)
64{
65 struct irq_domain *domain = d->domain;
66 struct icu_chip_data *data = (struct icu_chip_data *)domain->host_data;
67 int hwirq;
68 u32 r;
69
70 hwirq = d->irq - data->virq_base;
71 if (data == &icu_data[0]) {
72 r = readl_relaxed(mmp_icu_base + (hwirq << 2));
73 r &= ~data->conf_mask;
74 r |= data->conf_disable;
75 writel_relaxed(r, mmp_icu_base + (hwirq << 2));
76 } else {
77#ifdef CONFIG_CPU_MMP2
78 if ((data->virq_base == data->clr_mfp_irq_base)
79 && (hwirq == data->clr_mfp_hwirq))
80 mmp2_clear_pmic_int();
81#endif
82 r = readl_relaxed(data->reg_mask) | (1 << hwirq);
83 writel_relaxed(r, data->reg_mask);
84 }
85}
86
87static void icu_mask_irq(struct irq_data *d)
88{
89 struct irq_domain *domain = d->domain;
90 struct icu_chip_data *data = (struct icu_chip_data *)domain->host_data;
91 int hwirq;
92 u32 r;
93
94 hwirq = d->irq - data->virq_base;
95 if (data == &icu_data[0]) {
96 r = readl_relaxed(mmp_icu_base + (hwirq << 2));
97 r &= ~data->conf_mask;
98 r |= data->conf_disable;
99 writel_relaxed(r, mmp_icu_base + (hwirq << 2));
100 } else {
101 r = readl_relaxed(data->reg_mask) | (1 << hwirq);
102 writel_relaxed(r, data->reg_mask);
103 }
104}
105
106static void icu_unmask_irq(struct irq_data *d)
107{
108 struct irq_domain *domain = d->domain;
109 struct icu_chip_data *data = (struct icu_chip_data *)domain->host_data;
110 int hwirq;
111 u32 r;
112
113 hwirq = d->irq - data->virq_base;
114 if (data == &icu_data[0]) {
115 r = readl_relaxed(mmp_icu_base + (hwirq << 2));
116 r &= ~data->conf_mask;
117 r |= data->conf_enable;
118 writel_relaxed(r, mmp_icu_base + (hwirq << 2));
119 } else {
120 r = readl_relaxed(data->reg_mask) & ~(1 << hwirq);
121 writel_relaxed(r, data->reg_mask);
122 }
123}
124
125static struct irq_chip icu_irq_chip = {
126 .name = "icu_irq",
127 .irq_mask = icu_mask_irq,
128 .irq_mask_ack = icu_mask_ack_irq,
129 .irq_unmask = icu_unmask_irq,
130};
131
132static void icu_mux_irq_demux(unsigned int irq, struct irq_desc *desc)
133{
134 struct irq_domain *domain;
135 struct icu_chip_data *data;
136 int i;
137 unsigned long mask, status, n;
138
139 for (i = 1; i < max_icu_nr; i++) {
140 if (irq == icu_data[i].cascade_irq) {
141 domain = icu_data[i].domain;
142 data = (struct icu_chip_data *)domain->host_data;
143 break;
144 }
145 }
146 if (i >= max_icu_nr) {
147 pr_err("Spurious irq %d in MMP INTC\n", irq);
148 return;
149 }
150
151 mask = readl_relaxed(data->reg_mask);
152 while (1) {
153 status = readl_relaxed(data->reg_status) & ~mask;
154 if (status == 0)
155 break;
156 n = find_first_bit(&status, BITS_PER_LONG);
157 while (n < BITS_PER_LONG) {
158 generic_handle_irq(icu_data[i].virq_base + n);
159 n = find_next_bit(&status, BITS_PER_LONG, n + 1);
160 }
161 }
162}
163
164static int mmp_irq_domain_map(struct irq_domain *d, unsigned int irq,
165 irq_hw_number_t hw)
166{
167 irq_set_chip_and_handler(irq, &icu_irq_chip, handle_level_irq);
168 set_irq_flags(irq, IRQF_VALID);
169 return 0;
170}
171
172static int mmp_irq_domain_xlate(struct irq_domain *d, struct device_node *node,
173 const u32 *intspec, unsigned int intsize,
174 unsigned long *out_hwirq,
175 unsigned int *out_type)
176{
177 *out_hwirq = intspec[0];
178 return 0;
179}
180
181const struct irq_domain_ops mmp_irq_domain_ops = {
182 .map = mmp_irq_domain_map,
183 .xlate = mmp_irq_domain_xlate,
184};
185
186static struct mmp_intc_conf mmp_conf = {
187 .conf_enable = 0x51,
188 .conf_disable = 0x0,
189 .conf_mask = 0x7f,
190};
191
192static struct mmp_intc_conf mmp2_conf = {
193 .conf_enable = 0x20,
194 .conf_disable = 0x0,
195 .conf_mask = 0x7f,
196};
197
198/* MMP (ARMv5) */
199void __init icu_init_irq(void)
200{
201 int irq;
202
203 max_icu_nr = 1;
204 mmp_icu_base = ioremap(0xd4282000, 0x1000);
205 icu_data[0].conf_enable = mmp_conf.conf_enable;
206 icu_data[0].conf_disable = mmp_conf.conf_disable;
207 icu_data[0].conf_mask = mmp_conf.conf_mask;
208 icu_data[0].nr_irqs = 64;
209 icu_data[0].virq_base = 0;
210 icu_data[0].domain = irq_domain_add_legacy(NULL, 64, 0, 0,
211 &irq_domain_simple_ops,
212 &icu_data[0]);
213 for (irq = 0; irq < 64; irq++) {
214 icu_mask_irq(irq_get_irq_data(irq));
215 irq_set_chip_and_handler(irq, &icu_irq_chip, handle_level_irq);
216 set_irq_flags(irq, IRQF_VALID);
217 }
218 irq_set_default_host(icu_data[0].domain);
219#ifdef CONFIG_CPU_PXA910
220 icu_irq_chip.irq_set_wake = pxa910_set_wake;
221#endif
222}
223
224/* MMP2 (ARMv7) */
225void __init mmp2_init_icu(void)
226{
227 int irq;
228
229 max_icu_nr = 8;
230 mmp_icu_base = ioremap(0xd4282000, 0x1000);
231 icu_data[0].conf_enable = mmp2_conf.conf_enable;
232 icu_data[0].conf_disable = mmp2_conf.conf_disable;
233 icu_data[0].conf_mask = mmp2_conf.conf_mask;
234 icu_data[0].nr_irqs = 64;
235 icu_data[0].virq_base = 0;
236 icu_data[0].domain = irq_domain_add_legacy(NULL, 64, 0, 0,
237 &irq_domain_simple_ops,
238 &icu_data[0]);
239 icu_data[1].reg_status = mmp_icu_base + 0x150;
240 icu_data[1].reg_mask = mmp_icu_base + 0x168;
241 icu_data[1].clr_mfp_irq_base = IRQ_MMP2_PMIC_BASE;
242 icu_data[1].clr_mfp_hwirq = IRQ_MMP2_PMIC - IRQ_MMP2_PMIC_BASE;
243 icu_data[1].nr_irqs = 2;
244 icu_data[1].virq_base = IRQ_MMP2_PMIC_BASE;
245 icu_data[1].domain = irq_domain_add_legacy(NULL, icu_data[1].nr_irqs,
246 icu_data[1].virq_base, 0,
247 &irq_domain_simple_ops,
248 &icu_data[1]);
249 icu_data[2].reg_status = mmp_icu_base + 0x154;
250 icu_data[2].reg_mask = mmp_icu_base + 0x16c;
251 icu_data[2].nr_irqs = 2;
252 icu_data[2].virq_base = IRQ_MMP2_RTC_BASE;
253 icu_data[2].domain = irq_domain_add_legacy(NULL, icu_data[2].nr_irqs,
254 icu_data[2].virq_base, 0,
255 &irq_domain_simple_ops,
256 &icu_data[2]);
257 icu_data[3].reg_status = mmp_icu_base + 0x180;
258 icu_data[3].reg_mask = mmp_icu_base + 0x17c;
259 icu_data[3].nr_irqs = 3;
260 icu_data[3].virq_base = IRQ_MMP2_KEYPAD_BASE;
261 icu_data[3].domain = irq_domain_add_legacy(NULL, icu_data[3].nr_irqs,
262 icu_data[3].virq_base, 0,
263 &irq_domain_simple_ops,
264 &icu_data[3]);
265 icu_data[4].reg_status = mmp_icu_base + 0x158;
266 icu_data[4].reg_mask = mmp_icu_base + 0x170;
267 icu_data[4].nr_irqs = 5;
268 icu_data[4].virq_base = IRQ_MMP2_TWSI_BASE;
269 icu_data[4].domain = irq_domain_add_legacy(NULL, icu_data[4].nr_irqs,
270 icu_data[4].virq_base, 0,
271 &irq_domain_simple_ops,
272 &icu_data[4]);
273 icu_data[5].reg_status = mmp_icu_base + 0x15c;
274 icu_data[5].reg_mask = mmp_icu_base + 0x174;
275 icu_data[5].nr_irqs = 15;
276 icu_data[5].virq_base = IRQ_MMP2_MISC_BASE;
277 icu_data[5].domain = irq_domain_add_legacy(NULL, icu_data[5].nr_irqs,
278 icu_data[5].virq_base, 0,
279 &irq_domain_simple_ops,
280 &icu_data[5]);
281 icu_data[6].reg_status = mmp_icu_base + 0x160;
282 icu_data[6].reg_mask = mmp_icu_base + 0x178;
283 icu_data[6].nr_irqs = 2;
284 icu_data[6].virq_base = IRQ_MMP2_MIPI_HSI1_BASE;
285 icu_data[6].domain = irq_domain_add_legacy(NULL, icu_data[6].nr_irqs,
286 icu_data[6].virq_base, 0,
287 &irq_domain_simple_ops,
288 &icu_data[6]);
289 icu_data[7].reg_status = mmp_icu_base + 0x188;
290 icu_data[7].reg_mask = mmp_icu_base + 0x184;
291 icu_data[7].nr_irqs = 2;
292 icu_data[7].virq_base = IRQ_MMP2_MIPI_HSI0_BASE;
293 icu_data[7].domain = irq_domain_add_legacy(NULL, icu_data[7].nr_irqs,
294 icu_data[7].virq_base, 0,
295 &irq_domain_simple_ops,
296 &icu_data[7]);
297 for (irq = 0; irq < IRQ_MMP2_MUX_END; irq++) {
298 icu_mask_irq(irq_get_irq_data(irq));
299 switch (irq) {
300 case IRQ_MMP2_PMIC_MUX:
301 case IRQ_MMP2_RTC_MUX:
302 case IRQ_MMP2_KEYPAD_MUX:
303 case IRQ_MMP2_TWSI_MUX:
304 case IRQ_MMP2_MISC_MUX:
305 case IRQ_MMP2_MIPI_HSI1_MUX:
306 case IRQ_MMP2_MIPI_HSI0_MUX:
307 irq_set_chip(irq, &icu_irq_chip);
308 irq_set_chained_handler(irq, icu_mux_irq_demux);
309 break;
310 default:
311 irq_set_chip_and_handler(irq, &icu_irq_chip,
312 handle_level_irq);
313 break;
314 }
315 set_irq_flags(irq, IRQF_VALID);
316 }
317 irq_set_default_host(icu_data[0].domain);
318#ifdef CONFIG_CPU_MMP2
319 icu_irq_chip.irq_set_wake = mmp2_set_wake;
320#endif
321}
322
323#ifdef CONFIG_OF
324static const struct of_device_id intc_ids[] __initconst = {
325 { .compatible = "mrvl,mmp-intc", .data = &mmp_conf },
326 { .compatible = "mrvl,mmp2-intc", .data = &mmp2_conf },
327 {}
328};
329
330static const struct of_device_id mmp_mux_irq_match[] __initconst = {
331 { .compatible = "mrvl,mmp2-mux-intc" },
332 {}
333};
334
335int __init mmp2_mux_init(struct device_node *parent)
336{
337 struct device_node *node;
338 const struct of_device_id *of_id;
339 struct resource res;
340 int i, irq_base, ret, irq;
341 u32 nr_irqs, mfp_irq;
342
343 node = parent;
344 max_icu_nr = 1;
345 for (i = 1; i < MAX_ICU_NR; i++) {
346 node = of_find_matching_node(node, mmp_mux_irq_match);
347 if (!node)
348 break;
349 of_id = of_match_node(&mmp_mux_irq_match[0], node);
350 ret = of_property_read_u32(node, "mrvl,intc-nr-irqs",
351 &nr_irqs);
352 if (ret) {
353 pr_err("Not found mrvl,intc-nr-irqs property\n");
354 ret = -EINVAL;
355 goto err;
356 }
357 ret = of_address_to_resource(node, 0, &res);
358 if (ret < 0) {
359 pr_err("Not found reg property\n");
360 ret = -EINVAL;
361 goto err;
362 }
363 icu_data[i].reg_status = mmp_icu_base + res.start;
364 ret = of_address_to_resource(node, 1, &res);
365 if (ret < 0) {
366 pr_err("Not found reg property\n");
367 ret = -EINVAL;
368 goto err;
369 }
370 icu_data[i].reg_mask = mmp_icu_base + res.start;
371 icu_data[i].cascade_irq = irq_of_parse_and_map(node, 0);
372 if (!icu_data[i].cascade_irq) {
373 ret = -EINVAL;
374 goto err;
375 }
376
377 irq_base = irq_alloc_descs(-1, 0, nr_irqs, 0);
378 if (irq_base < 0) {
379 pr_err("Failed to allocate IRQ numbers for mux intc\n");
380 ret = irq_base;
381 goto err;
382 }
383 if (!of_property_read_u32(node, "mrvl,clr-mfp-irq",
384 &mfp_irq)) {
385 icu_data[i].clr_mfp_irq_base = irq_base;
386 icu_data[i].clr_mfp_hwirq = mfp_irq;
387 }
388 irq_set_chained_handler(icu_data[i].cascade_irq,
389 icu_mux_irq_demux);
390 icu_data[i].nr_irqs = nr_irqs;
391 icu_data[i].virq_base = irq_base;
392 icu_data[i].domain = irq_domain_add_legacy(node, nr_irqs,
393 irq_base, 0,
394 &mmp_irq_domain_ops,
395 &icu_data[i]);
396 for (irq = irq_base; irq < irq_base + nr_irqs; irq++)
397 icu_mask_irq(irq_get_irq_data(irq));
398 }
399 max_icu_nr = i;
400 return 0;
401err:
402 of_node_put(node);
403 max_icu_nr = i;
404 return ret;
405}
406
407void __init mmp_dt_irq_init(void)
408{
409 struct device_node *node;
410 const struct of_device_id *of_id;
411 struct mmp_intc_conf *conf;
412 int nr_irqs, irq_base, ret, irq;
413
414 node = of_find_matching_node(NULL, intc_ids);
415 if (!node) {
416 pr_err("Failed to find interrupt controller in arch-mmp\n");
417 return;
418 }
419 of_id = of_match_node(intc_ids, node);
420 conf = of_id->data;
421
422 ret = of_property_read_u32(node, "mrvl,intc-nr-irqs", &nr_irqs);
423 if (ret) {
424 pr_err("Not found mrvl,intc-nr-irqs property\n");
425 return;
426 }
427
428 mmp_icu_base = of_iomap(node, 0);
429 if (!mmp_icu_base) {
430 pr_err("Failed to get interrupt controller register\n");
431 return;
432 }
433
434 irq_base = irq_alloc_descs(-1, 0, nr_irqs - NR_IRQS_LEGACY, 0);
435 if (irq_base < 0) {
436 pr_err("Failed to allocate IRQ numbers\n");
437 goto err;
438 } else if (irq_base != NR_IRQS_LEGACY) {
439 pr_err("ICU's irqbase should be started from 0\n");
440 goto err;
441 }
442 icu_data[0].conf_enable = conf->conf_enable;
443 icu_data[0].conf_disable = conf->conf_disable;
444 icu_data[0].conf_mask = conf->conf_mask;
445 icu_data[0].nr_irqs = nr_irqs;
446 icu_data[0].virq_base = 0;
447 icu_data[0].domain = irq_domain_add_legacy(node, nr_irqs, 0, 0,
448 &mmp_irq_domain_ops,
449 &icu_data[0]);
450 irq_set_default_host(icu_data[0].domain);
451 for (irq = 0; irq < nr_irqs; irq++)
452 icu_mask_irq(irq_get_irq_data(irq));
453 mmp2_mux_init(node);
454 return;
455err:
456 iounmap(mmp_icu_base);
457}
458#endif
diff --git a/arch/arm/mach-mmp/mmp-dt.c b/arch/arm/mach-mmp/mmp-dt.c
index 67075395e400..033cc31b3c72 100644
--- a/arch/arm/mach-mmp/mmp-dt.c
+++ b/arch/arm/mach-mmp/mmp-dt.c
@@ -14,14 +14,19 @@
14#include <linux/of_irq.h> 14#include <linux/of_irq.h>
15#include <linux/of_platform.h> 15#include <linux/of_platform.h>
16#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
17#include <asm/mach/time.h>
17#include <mach/irqs.h> 18#include <mach/irqs.h>
18 19
19#include "common.h" 20#include "common.h"
20 21
21extern struct sys_timer pxa168_timer; 22extern void __init mmp_dt_irq_init(void);
22extern void __init icu_init_irq(void); 23extern void __init mmp_dt_init_timer(void);
23 24
24static const struct of_dev_auxdata mmp_auxdata_lookup[] __initconst = { 25static struct sys_timer mmp_dt_timer = {
26 .init = mmp_dt_init_timer,
27};
28
29static const struct of_dev_auxdata pxa168_auxdata_lookup[] __initconst = {
25 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4017000, "pxa2xx-uart.0", NULL), 30 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4017000, "pxa2xx-uart.0", NULL),
26 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4018000, "pxa2xx-uart.1", NULL), 31 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4018000, "pxa2xx-uart.1", NULL),
27 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4026000, "pxa2xx-uart.2", NULL), 32 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4026000, "pxa2xx-uart.2", NULL),
@@ -32,44 +37,47 @@ static const struct of_dev_auxdata mmp_auxdata_lookup[] __initconst = {
32 {} 37 {}
33}; 38};
34 39
35static int __init mmp_intc_add_irq_domain(struct device_node *np, 40static const struct of_dev_auxdata pxa910_auxdata_lookup[] __initconst = {
36 struct device_node *parent) 41 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4017000, "pxa2xx-uart.0", NULL),
37{ 42 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4018000, "pxa2xx-uart.1", NULL),
38 irq_domain_add_simple(np, 0); 43 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4036000, "pxa2xx-uart.2", NULL),
39 return 0; 44 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL),
40} 45 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4037000, "pxa2xx-i2c.1", NULL),
41 46 OF_DEV_AUXDATA("mrvl,mmp-gpio", 0xd4019000, "pxa-gpio", NULL),
42static int __init mmp_gpio_add_irq_domain(struct device_node *np, 47 OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
43 struct device_node *parent)
44{
45 irq_domain_add_simple(np, IRQ_GPIO_START);
46 return 0;
47}
48
49static const struct of_device_id mmp_irq_match[] __initconst = {
50 { .compatible = "mrvl,mmp-intc", .data = mmp_intc_add_irq_domain, },
51 { .compatible = "mrvl,mmp-gpio", .data = mmp_gpio_add_irq_domain, },
52 {} 48 {}
53}; 49};
54 50
55static void __init mmp_dt_init(void) 51static void __init pxa168_dt_init(void)
56{ 52{
53 of_platform_populate(NULL, of_default_bus_match_table,
54 pxa168_auxdata_lookup, NULL);
55}
57 56
58 of_irq_init(mmp_irq_match); 57static void __init pxa910_dt_init(void)
59 58{
60 of_platform_populate(NULL, of_default_bus_match_table, 59 of_platform_populate(NULL, of_default_bus_match_table,
61 mmp_auxdata_lookup, NULL); 60 pxa910_auxdata_lookup, NULL);
62} 61}
63 62
64static const char *pxa168_dt_board_compat[] __initdata = { 63static const char *mmp_dt_board_compat[] __initdata = {
65 "mrvl,pxa168-aspenite", 64 "mrvl,pxa168-aspenite",
65 "mrvl,pxa910-dkb",
66 NULL, 66 NULL,
67}; 67};
68 68
69DT_MACHINE_START(PXA168_DT, "Marvell PXA168 (Device Tree Support)") 69DT_MACHINE_START(PXA168_DT, "Marvell PXA168 (Device Tree Support)")
70 .map_io = mmp_map_io, 70 .map_io = mmp_map_io,
71 .init_irq = icu_init_irq, 71 .init_irq = mmp_dt_irq_init,
72 .timer = &pxa168_timer, 72 .timer = &mmp_dt_timer,
73 .init_machine = mmp_dt_init, 73 .init_machine = pxa168_dt_init,
74 .dt_compat = pxa168_dt_board_compat, 74 .dt_compat = mmp_dt_board_compat,
75MACHINE_END
76
77DT_MACHINE_START(PXA910_DT, "Marvell PXA910 (Device Tree Support)")
78 .map_io = mmp_map_io,
79 .init_irq = mmp_dt_irq_init,
80 .timer = &mmp_dt_timer,
81 .init_machine = pxa910_dt_init,
82 .dt_compat = mmp_dt_board_compat,
75MACHINE_END 83MACHINE_END
diff --git a/arch/arm/mach-mmp/mmp2-dt.c b/arch/arm/mach-mmp/mmp2-dt.c
new file mode 100644
index 000000000000..535a5ed5977b
--- /dev/null
+++ b/arch/arm/mach-mmp/mmp2-dt.c
@@ -0,0 +1,60 @@
1/*
2 * linux/arch/arm/mach-mmp/mmp2-dt.c
3 *
4 * Copyright (C) 2012 Marvell Technology Group Ltd.
5 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * publishhed by the Free Software Foundation.
10 */
11
12#include <linux/io.h>
13#include <linux/irq.h>
14#include <linux/irqdomain.h>
15#include <linux/of_irq.h>
16#include <linux/of_platform.h>
17#include <asm/mach/arch.h>
18#include <asm/mach/time.h>
19#include <mach/irqs.h>
20#include <mach/regs-apbc.h>
21
22#include "common.h"
23
24extern void __init mmp_dt_irq_init(void);
25extern void __init mmp_dt_init_timer(void);
26
27static struct sys_timer mmp_dt_timer = {
28 .init = mmp_dt_init_timer,
29};
30
31static const struct of_dev_auxdata mmp2_auxdata_lookup[] __initconst = {
32 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4030000, "pxa2xx-uart.0", NULL),
33 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4017000, "pxa2xx-uart.1", NULL),
34 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4018000, "pxa2xx-uart.2", NULL),
35 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4016000, "pxa2xx-uart.3", NULL),
36 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL),
37 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL),
38 OF_DEV_AUXDATA("mrvl,mmp-gpio", 0xd4019000, "pxa-gpio", NULL),
39 OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
40 {}
41};
42
43static void __init mmp2_dt_init(void)
44{
45 of_platform_populate(NULL, of_default_bus_match_table,
46 mmp2_auxdata_lookup, NULL);
47}
48
49static const char *mmp2_dt_board_compat[] __initdata = {
50 "mrvl,mmp2-brownstone",
51 NULL,
52};
53
54DT_MACHINE_START(MMP2_DT, "Marvell MMP2 (Device Tree Support)")
55 .map_io = mmp_map_io,
56 .init_irq = mmp_dt_irq_init,
57 .timer = &mmp_dt_timer,
58 .init_machine = mmp2_dt_init,
59 .dt_compat = mmp2_dt_board_compat,
60MACHINE_END
diff --git a/arch/arm/mach-mmp/pm-mmp2.c b/arch/arm/mach-mmp/pm-mmp2.c
new file mode 100644
index 000000000000..461a191a32d2
--- /dev/null
+++ b/arch/arm/mach-mmp/pm-mmp2.c
@@ -0,0 +1,264 @@
1/*
2 * MMP2 Power Management Routines
3 *
4 * This software program is licensed subject to the GNU General Public License
5 * (GPL).Version 2,June 1991, available at http://www.fsf.org/copyleft/gpl.html
6 *
7 * (C) Copyright 2012 Marvell International Ltd.
8 * All Rights Reserved
9 */
10
11#include <linux/kernel.h>
12#include <linux/errno.h>
13#include <linux/err.h>
14#include <linux/time.h>
15#include <linux/delay.h>
16#include <linux/suspend.h>
17#include <linux/irq.h>
18#include <linux/io.h>
19#include <linux/interrupt.h>
20#include <asm/mach-types.h>
21#include <mach/hardware.h>
22#include <mach/cputype.h>
23#include <mach/addr-map.h>
24#include <mach/pm-mmp2.h>
25#include <mach/regs-icu.h>
26#include <mach/irqs.h>
27
28int mmp2_set_wake(struct irq_data *d, unsigned int on)
29{
30 int irq = d->irq;
31 struct irq_desc *desc = irq_to_desc(irq);
32 unsigned long data = 0;
33
34 if (unlikely(irq >= nr_irqs)) {
35 pr_err("IRQ nubmers are out of boundary!\n");
36 return -EINVAL;
37 }
38
39 if (on) {
40 if (desc->action)
41 desc->action->flags |= IRQF_NO_SUSPEND;
42 } else {
43 if (desc->action)
44 desc->action->flags &= ~IRQF_NO_SUSPEND;
45 }
46
47 /* enable wakeup sources */
48 switch (irq) {
49 case IRQ_MMP2_RTC:
50 case IRQ_MMP2_RTC_ALARM:
51 data = MPMU_WUCRM_PJ_WAKEUP(4) | MPMU_WUCRM_PJ_RTC_ALARM;
52 break;
53 case IRQ_MMP2_PMIC:
54 data = MPMU_WUCRM_PJ_WAKEUP(7);
55 break;
56 case IRQ_MMP2_MMC2:
57 /* mmc use WAKEUP2, same as GPIO wakeup source */
58 data = MPMU_WUCRM_PJ_WAKEUP(2);
59 break;
60 }
61 if (on) {
62 if (data) {
63 data |= __raw_readl(MPMU_WUCRM_PJ);
64 __raw_writel(data, MPMU_WUCRM_PJ);
65 }
66 } else {
67 if (data) {
68 data = ~data & __raw_readl(MPMU_WUCRM_PJ);
69 __raw_writel(data, MPMU_WUCRM_PJ);
70 }
71 }
72 return 0;
73}
74
75static void pm_scu_clk_disable(void)
76{
77 unsigned int val;
78
79 /* close AXI fabric clock gate */
80 __raw_writel(0x0, CIU_REG(0x64));
81 __raw_writel(0x0, CIU_REG(0x68));
82
83 /* close MCB master clock gate */
84 val = __raw_readl(CIU_REG(0x1c));
85 val |= 0xf0;
86 __raw_writel(val, CIU_REG(0x1c));
87
88 return ;
89}
90
91static void pm_scu_clk_enable(void)
92{
93 unsigned int val;
94
95 /* open AXI fabric clock gate */
96 __raw_writel(0x03003003, CIU_REG(0x64));
97 __raw_writel(0x00303030, CIU_REG(0x68));
98
99 /* open MCB master clock gate */
100 val = __raw_readl(CIU_REG(0x1c));
101 val &= ~(0xf0);
102 __raw_writel(val, CIU_REG(0x1c));
103
104 return ;
105}
106
107static void pm_mpmu_clk_disable(void)
108{
109 /*
110 * disable clocks in MPMU_CGR_PJ register
111 * except clock for APMU_PLL1, APMU_PLL1_2 and AP_26M
112 */
113 __raw_writel(0x0000a010, MPMU_CGR_PJ);
114}
115
116static void pm_mpmu_clk_enable(void)
117{
118 unsigned int val;
119
120 __raw_writel(0xdffefffe, MPMU_CGR_PJ);
121 val = __raw_readl(MPMU_PLL2_CTRL1);
122 val |= (1 << 29);
123 __raw_writel(val, MPMU_PLL2_CTRL1);
124
125 return ;
126}
127
128void mmp2_pm_enter_lowpower_mode(int state)
129{
130 uint32_t idle_cfg, apcr;
131
132 idle_cfg = __raw_readl(APMU_PJ_IDLE_CFG);
133 apcr = __raw_readl(MPMU_PCR_PJ);
134 apcr &= ~(MPMU_PCR_PJ_SLPEN | MPMU_PCR_PJ_DDRCORSD | MPMU_PCR_PJ_APBSD
135 | MPMU_PCR_PJ_AXISD | MPMU_PCR_PJ_VCTCXOSD | (1 << 13));
136 idle_cfg &= ~APMU_PJ_IDLE_CFG_PJ_IDLE;
137
138 switch (state) {
139 case POWER_MODE_SYS_SLEEP:
140 apcr |= MPMU_PCR_PJ_SLPEN; /* set the SLPEN bit */
141 apcr |= MPMU_PCR_PJ_VCTCXOSD; /* set VCTCXOSD */
142 /* fall through */
143 case POWER_MODE_CHIP_SLEEP:
144 apcr |= MPMU_PCR_PJ_SLPEN;
145 /* fall through */
146 case POWER_MODE_APPS_SLEEP:
147 apcr |= MPMU_PCR_PJ_APBSD; /* set APBSD */
148 /* fall through */
149 case POWER_MODE_APPS_IDLE:
150 apcr |= MPMU_PCR_PJ_AXISD; /* set AXISDD bit */
151 apcr |= MPMU_PCR_PJ_DDRCORSD; /* set DDRCORSD bit */
152 idle_cfg |= APMU_PJ_IDLE_CFG_PJ_PWRDWN; /* PJ power down */
153 apcr |= MPMU_PCR_PJ_SPSD;
154 /* fall through */
155 case POWER_MODE_CORE_EXTIDLE:
156 idle_cfg |= APMU_PJ_IDLE_CFG_PJ_IDLE; /* set the IDLE bit */
157 idle_cfg &= ~APMU_PJ_IDLE_CFG_ISO_MODE_CNTRL_MASK;
158 idle_cfg |= APMU_PJ_IDLE_CFG_PWR_SW(3)
159 | APMU_PJ_IDLE_CFG_L2_PWR_SW;
160 break;
161 case POWER_MODE_CORE_INTIDLE:
162 apcr &= ~MPMU_PCR_PJ_SPSD;
163 break;
164 }
165
166 /* set reserve bits */
167 apcr |= (1 << 30) | (1 << 25);
168
169 /* finally write the registers back */
170 __raw_writel(idle_cfg, APMU_PJ_IDLE_CFG);
171 __raw_writel(apcr, MPMU_PCR_PJ); /* 0xfe086000 */
172}
173
174static int mmp2_pm_enter(suspend_state_t state)
175{
176 int temp;
177
178 temp = __raw_readl(MMP2_ICU_INT4_MASK);
179 if (temp & (1 << 1)) {
180 printk(KERN_ERR "%s: PMIC interrupt is handling\n", __func__);
181 return -EAGAIN;
182 }
183
184 temp = __raw_readl(APMU_SRAM_PWR_DWN);
185 temp |= ((1 << 19) | (1 << 18));
186 __raw_writel(temp, APMU_SRAM_PWR_DWN);
187 pm_mpmu_clk_disable();
188 pm_scu_clk_disable();
189
190 printk(KERN_INFO "%s: before suspend\n", __func__);
191 cpu_do_idle();
192 printk(KERN_INFO "%s: after suspend\n", __func__);
193
194 pm_mpmu_clk_enable(); /* enable clocks in MPMU */
195 pm_scu_clk_enable(); /* enable clocks in SCU */
196
197 return 0;
198}
199
200/*
201 * Called after processes are frozen, but before we shut down devices.
202 */
203static int mmp2_pm_prepare(void)
204{
205 mmp2_pm_enter_lowpower_mode(POWER_MODE_SYS_SLEEP);
206
207 return 0;
208}
209
210/*
211 * Called after devices are re-setup, but before processes are thawed.
212 */
213static void mmp2_pm_finish(void)
214{
215 mmp2_pm_enter_lowpower_mode(POWER_MODE_CORE_INTIDLE);
216}
217
218static int mmp2_pm_valid(suspend_state_t state)
219{
220 return ((state == PM_SUSPEND_STANDBY) || (state == PM_SUSPEND_MEM));
221}
222
223/*
224 * Set to PM_DISK_FIRMWARE so we can quickly veto suspend-to-disk.
225 */
226static const struct platform_suspend_ops mmp2_pm_ops = {
227 .valid = mmp2_pm_valid,
228 .prepare = mmp2_pm_prepare,
229 .enter = mmp2_pm_enter,
230 .finish = mmp2_pm_finish,
231};
232
233static int __init mmp2_pm_init(void)
234{
235 uint32_t apcr;
236
237 if (!cpu_is_mmp2())
238 return -EIO;
239
240 suspend_set_ops(&mmp2_pm_ops);
241
242 /*
243 * Set bit 0, Slow clock Select 32K clock input instead of VCXO
244 * VCXO is chosen by default, which would be disabled in suspend
245 */
246 __raw_writel(0x5, MPMU_SCCR);
247
248 /*
249 * Clear bit 23 of CIU_CPU_CONF
250 * direct PJ4 to DDR access through Memory Controller slow queue
251 * fast queue has issue and cause lcd will flick
252 */
253 __raw_writel(__raw_readl(CIU_REG(0x8)) & ~(0x1 << 23), CIU_REG(0x8));
254
255 /* Clear default low power control bit */
256 apcr = __raw_readl(MPMU_PCR_PJ);
257 apcr &= ~(MPMU_PCR_PJ_SLPEN | MPMU_PCR_PJ_DDRCORSD
258 | MPMU_PCR_PJ_APBSD | MPMU_PCR_PJ_AXISD | 1 << 13);
259 __raw_writel(apcr, MPMU_PCR_PJ);
260
261 return 0;
262}
263
264late_initcall(mmp2_pm_init);
diff --git a/arch/arm/mach-mmp/pm-pxa910.c b/arch/arm/mach-mmp/pm-pxa910.c
new file mode 100644
index 000000000000..48981ca801a5
--- /dev/null
+++ b/arch/arm/mach-mmp/pm-pxa910.c
@@ -0,0 +1,285 @@
1/*
2 * PXA910 Power Management Routines
3 *
4 * This software program is licensed subject to the GNU General Public License
5 * (GPL).Version 2,June 1991, available at http://www.fsf.org/copyleft/gpl.html
6 *
7 * (C) Copyright 2009 Marvell International Ltd.
8 * All Rights Reserved
9 */
10
11#include <linux/kernel.h>
12#include <linux/errno.h>
13#include <linux/err.h>
14#include <linux/time.h>
15#include <linux/delay.h>
16#include <linux/suspend.h>
17#include <linux/interrupt.h>
18#include <linux/io.h>
19#include <linux/irq.h>
20#include <asm/mach-types.h>
21#include <mach/hardware.h>
22#include <mach/cputype.h>
23#include <mach/addr-map.h>
24#include <mach/pm-pxa910.h>
25#include <mach/regs-icu.h>
26#include <mach/irqs.h>
27
28int pxa910_set_wake(struct irq_data *data, unsigned int on)
29{
30 int irq = data->irq;
31 struct irq_desc *desc = irq_to_desc(data->irq);
32 uint32_t awucrm = 0, apcr = 0;
33
34 if (unlikely(irq >= nr_irqs)) {
35 pr_err("IRQ nubmers are out of boundary!\n");
36 return -EINVAL;
37 }
38
39 if (on) {
40 if (desc->action)
41 desc->action->flags |= IRQF_NO_SUSPEND;
42 } else {
43 if (desc->action)
44 desc->action->flags &= ~IRQF_NO_SUSPEND;
45 }
46
47 /* setting wakeup sources */
48 switch (irq) {
49 /* wakeup line 2 */
50 case IRQ_PXA910_AP_GPIO:
51 awucrm = MPMU_AWUCRM_WAKEUP(2);
52 apcr |= MPMU_APCR_SLPWP2;
53 break;
54 /* wakeup line 3 */
55 case IRQ_PXA910_KEYPAD:
56 awucrm = MPMU_AWUCRM_WAKEUP(3) | MPMU_AWUCRM_KEYPRESS;
57 apcr |= MPMU_APCR_SLPWP3;
58 break;
59 case IRQ_PXA910_ROTARY:
60 awucrm = MPMU_AWUCRM_WAKEUP(3) | MPMU_AWUCRM_NEWROTARY;
61 apcr |= MPMU_APCR_SLPWP3;
62 break;
63 case IRQ_PXA910_TRACKBALL:
64 awucrm = MPMU_AWUCRM_WAKEUP(3) | MPMU_AWUCRM_TRACKBALL;
65 apcr |= MPMU_APCR_SLPWP3;
66 break;
67 /* wakeup line 4 */
68 case IRQ_PXA910_AP1_TIMER1:
69 awucrm = MPMU_AWUCRM_WAKEUP(4) | MPMU_AWUCRM_AP1_TIMER_1;
70 apcr |= MPMU_APCR_SLPWP4;
71 break;
72 case IRQ_PXA910_AP1_TIMER2:
73 awucrm = MPMU_AWUCRM_WAKEUP(4) | MPMU_AWUCRM_AP1_TIMER_2;
74 apcr |= MPMU_APCR_SLPWP4;
75 break;
76 case IRQ_PXA910_AP1_TIMER3:
77 awucrm = MPMU_AWUCRM_WAKEUP(4) | MPMU_AWUCRM_AP1_TIMER_3;
78 apcr |= MPMU_APCR_SLPWP4;
79 break;
80 case IRQ_PXA910_AP2_TIMER1:
81 awucrm = MPMU_AWUCRM_WAKEUP(4) | MPMU_AWUCRM_AP2_TIMER_1;
82 apcr |= MPMU_APCR_SLPWP4;
83 break;
84 case IRQ_PXA910_AP2_TIMER2:
85 awucrm = MPMU_AWUCRM_WAKEUP(4) | MPMU_AWUCRM_AP2_TIMER_2;
86 apcr |= MPMU_APCR_SLPWP4;
87 break;
88 case IRQ_PXA910_AP2_TIMER3:
89 awucrm = MPMU_AWUCRM_WAKEUP(4) | MPMU_AWUCRM_AP2_TIMER_3;
90 apcr |= MPMU_APCR_SLPWP4;
91 break;
92 case IRQ_PXA910_RTC_ALARM:
93 awucrm = MPMU_AWUCRM_WAKEUP(4) | MPMU_AWUCRM_RTC_ALARM;
94 apcr |= MPMU_APCR_SLPWP4;
95 break;
96 /* wakeup line 5 */
97 case IRQ_PXA910_USB1:
98 case IRQ_PXA910_USB2:
99 awucrm = MPMU_AWUCRM_WAKEUP(5);
100 apcr |= MPMU_APCR_SLPWP5;
101 break;
102 /* wakeup line 6 */
103 case IRQ_PXA910_MMC:
104 awucrm = MPMU_AWUCRM_WAKEUP(6)
105 | MPMU_AWUCRM_SDH1
106 | MPMU_AWUCRM_SDH2;
107 apcr |= MPMU_APCR_SLPWP6;
108 break;
109 /* wakeup line 7 */
110 case IRQ_PXA910_PMIC_INT:
111 awucrm = MPMU_AWUCRM_WAKEUP(7);
112 apcr |= MPMU_APCR_SLPWP7;
113 break;
114 default:
115 if (irq >= IRQ_GPIO_START && irq < IRQ_BOARD_START) {
116 awucrm = MPMU_AWUCRM_WAKEUP(2);
117 apcr |= MPMU_APCR_SLPWP2;
118 } else
119 printk(KERN_ERR "Error: no defined wake up source irq: %d\n",
120 irq);
121 }
122
123 if (on) {
124 if (awucrm) {
125 awucrm |= __raw_readl(MPMU_AWUCRM);
126 __raw_writel(awucrm, MPMU_AWUCRM);
127 }
128 if (apcr) {
129 apcr = ~apcr & __raw_readl(MPMU_APCR);
130 __raw_writel(apcr, MPMU_APCR);
131 }
132 } else {
133 if (awucrm) {
134 awucrm = ~awucrm & __raw_readl(MPMU_AWUCRM);
135 __raw_writel(awucrm, MPMU_AWUCRM);
136 }
137 if (apcr) {
138 apcr |= __raw_readl(MPMU_APCR);
139 __raw_writel(apcr, MPMU_APCR);
140 }
141 }
142 return 0;
143}
144
145void pxa910_pm_enter_lowpower_mode(int state)
146{
147 uint32_t idle_cfg, apcr;
148
149 idle_cfg = __raw_readl(APMU_MOH_IDLE_CFG);
150 apcr = __raw_readl(MPMU_APCR);
151
152 apcr &= ~(MPMU_APCR_DDRCORSD | MPMU_APCR_APBSD | MPMU_APCR_AXISD
153 | MPMU_APCR_VCTCXOSD | MPMU_APCR_STBYEN);
154 idle_cfg &= ~(APMU_MOH_IDLE_CFG_MOH_IDLE
155 | APMU_MOH_IDLE_CFG_MOH_PWRDWN);
156
157 switch (state) {
158 case POWER_MODE_UDR:
159 /* only shutdown APB in UDR */
160 apcr |= MPMU_APCR_STBYEN | MPMU_APCR_APBSD;
161 /* fall through */
162 case POWER_MODE_SYS_SLEEP:
163 apcr |= MPMU_APCR_SLPEN; /* set the SLPEN bit */
164 apcr |= MPMU_APCR_VCTCXOSD; /* set VCTCXOSD */
165 /* fall through */
166 case POWER_MODE_APPS_SLEEP:
167 apcr |= MPMU_APCR_DDRCORSD; /* set DDRCORSD */
168 /* fall through */
169 case POWER_MODE_APPS_IDLE:
170 apcr |= MPMU_APCR_AXISD; /* set AXISDD bit */
171 /* fall through */
172 case POWER_MODE_CORE_EXTIDLE:
173 idle_cfg |= APMU_MOH_IDLE_CFG_MOH_IDLE;
174 idle_cfg |= APMU_MOH_IDLE_CFG_MOH_PWRDWN;
175 idle_cfg |= APMU_MOH_IDLE_CFG_MOH_PWR_SW(3)
176 | APMU_MOH_IDLE_CFG_MOH_L2_PWR_SW(3);
177 /* fall through */
178 case POWER_MODE_CORE_INTIDLE:
179 break;
180 }
181
182 /* program the memory controller hardware sleep type and auto wakeup */
183 idle_cfg |= APMU_MOH_IDLE_CFG_MOH_DIS_MC_SW_REQ;
184 idle_cfg |= APMU_MOH_IDLE_CFG_MOH_MC_WAKE_EN;
185 __raw_writel(0x0, APMU_MC_HW_SLP_TYPE); /* auto refresh */
186
187 /* set DSPSD, DTCMSD, BBSD, MSASLPEN */
188 apcr |= MPMU_APCR_DSPSD | MPMU_APCR_DTCMSD | MPMU_APCR_BBSD
189 | MPMU_APCR_MSASLPEN;
190
191 /*always set SLEPEN bit mainly for MSA*/
192 apcr |= MPMU_APCR_SLPEN;
193
194 /* finally write the registers back */
195 __raw_writel(idle_cfg, APMU_MOH_IDLE_CFG);
196 __raw_writel(apcr, MPMU_APCR);
197
198}
199
200static int pxa910_pm_enter(suspend_state_t state)
201{
202 unsigned int idle_cfg, reg = 0;
203
204 /*pmic thread not completed,exit;otherwise system can't be waked up*/
205 reg = __raw_readl(ICU_INT_CONF(IRQ_PXA910_PMIC_INT));
206 if ((reg & 0x3) == 0)
207 return -EAGAIN;
208
209 idle_cfg = __raw_readl(APMU_MOH_IDLE_CFG);
210 idle_cfg |= APMU_MOH_IDLE_CFG_MOH_PWRDWN
211 | APMU_MOH_IDLE_CFG_MOH_SRAM_PWRDWN;
212 __raw_writel(idle_cfg, APMU_MOH_IDLE_CFG);
213
214 /* disable L2 */
215 outer_disable();
216 /* wait for l2 idle */
217 while (!(readl(CIU_REG(0x8)) & (1 << 16)))
218 udelay(1);
219
220 cpu_do_idle();
221
222 /* enable L2 */
223 outer_resume();
224 /* wait for l2 idle */
225 while (!(readl(CIU_REG(0x8)) & (1 << 16)))
226 udelay(1);
227
228 idle_cfg = __raw_readl(APMU_MOH_IDLE_CFG);
229 idle_cfg &= ~(APMU_MOH_IDLE_CFG_MOH_PWRDWN
230 | APMU_MOH_IDLE_CFG_MOH_SRAM_PWRDWN);
231 __raw_writel(idle_cfg, APMU_MOH_IDLE_CFG);
232
233 return 0;
234}
235
236/*
237 * Called after processes are frozen, but before we shut down devices.
238 */
239static int pxa910_pm_prepare(void)
240{
241 pxa910_pm_enter_lowpower_mode(POWER_MODE_UDR);
242 return 0;
243}
244
245/*
246 * Called after devices are re-setup, but before processes are thawed.
247 */
248static void pxa910_pm_finish(void)
249{
250 pxa910_pm_enter_lowpower_mode(POWER_MODE_CORE_INTIDLE);
251}
252
253static int pxa910_pm_valid(suspend_state_t state)
254{
255 return ((state == PM_SUSPEND_STANDBY) || (state == PM_SUSPEND_MEM));
256}
257
258static const struct platform_suspend_ops pxa910_pm_ops = {
259 .valid = pxa910_pm_valid,
260 .prepare = pxa910_pm_prepare,
261 .enter = pxa910_pm_enter,
262 .finish = pxa910_pm_finish,
263};
264
265static int __init pxa910_pm_init(void)
266{
267 uint32_t awucrm = 0;
268
269 if (!cpu_is_pxa910())
270 return -EIO;
271
272 suspend_set_ops(&pxa910_pm_ops);
273
274 /* Set the following bits for MMP3 playback with VCTXO on */
275 __raw_writel(__raw_readl(APMU_SQU_CLK_GATE_CTRL) | (1 << 30),
276 APMU_SQU_CLK_GATE_CTRL);
277 __raw_writel(__raw_readl(MPMU_FCCR) | (1 << 28), MPMU_FCCR);
278
279 awucrm |= MPMU_AWUCRM_AP_ASYNC_INT | MPMU_AWUCRM_AP_FULL_IDLE;
280 __raw_writel(awucrm, MPMU_AWUCRM);
281
282 return 0;
283}
284
285late_initcall(pxa910_pm_init);
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index b24d2c32cba9..62d787c34475 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -14,6 +14,7 @@
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/clk.h> 15#include <linux/clk.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/platform_data/mv_usb.h>
17 18
18#include <asm/mach/time.h> 19#include <asm/mach/time.h>
19#include <asm/system_misc.h> 20#include <asm/system_misc.h>
@@ -27,6 +28,7 @@
27#include <mach/mfp.h> 28#include <mach/mfp.h>
28#include <linux/dma-mapping.h> 29#include <linux/dma-mapping.h>
29#include <mach/pxa168.h> 30#include <mach/pxa168.h>
31#include <mach/regs-usb.h>
30 32
31#include "common.h" 33#include "common.h"
32#include "clock.h" 34#include "clock.h"
@@ -93,7 +95,7 @@ static struct clk_lookup pxa168_clkregs[] = {
93 INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), 95 INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL),
94 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL), 96 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL),
95 INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"), 97 INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"),
96 INIT_CLKREG(&clk_usb, "pxa168-ehci", "PXA168-USBCLK"), 98 INIT_CLKREG(&clk_usb, NULL, "PXA168-USBCLK"),
97 INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL), 99 INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL),
98}; 100};
99 101
@@ -184,17 +186,17 @@ struct platform_device pxa168_device_gpio = {
184struct resource pxa168_usb_host_resources[] = { 186struct resource pxa168_usb_host_resources[] = {
185 /* USB Host conroller register base */ 187 /* USB Host conroller register base */
186 [0] = { 188 [0] = {
187 .start = 0xd4209000, 189 .start = PXA168_U2H_REGBASE + U2x_CAPREGS_OFFSET,
188 .end = 0xd4209000 + 0x200, 190 .end = PXA168_U2H_REGBASE + USB_REG_RANGE,
189 .flags = IORESOURCE_MEM, 191 .flags = IORESOURCE_MEM,
190 .name = "pxa168-usb-host", 192 .name = "capregs",
191 }, 193 },
192 /* USB PHY register base */ 194 /* USB PHY register base */
193 [1] = { 195 [1] = {
194 .start = 0xd4206000, 196 .start = PXA168_U2H_PHYBASE,
195 .end = 0xd4206000 + 0xff, 197 .end = PXA168_U2H_PHYBASE + USB_PHY_RANGE,
196 .flags = IORESOURCE_MEM, 198 .flags = IORESOURCE_MEM,
197 .name = "pxa168-usb-phy", 199 .name = "phyregs",
198 }, 200 },
199 [2] = { 201 [2] = {
200 .start = IRQ_PXA168_USB2, 202 .start = IRQ_PXA168_USB2,
@@ -205,7 +207,7 @@ struct resource pxa168_usb_host_resources[] = {
205 207
206static u64 pxa168_usb_host_dmamask = DMA_BIT_MASK(32); 208static u64 pxa168_usb_host_dmamask = DMA_BIT_MASK(32);
207struct platform_device pxa168_device_usb_host = { 209struct platform_device pxa168_device_usb_host = {
208 .name = "pxa168-ehci", 210 .name = "pxa-sph",
209 .id = -1, 211 .id = -1,
210 .dev = { 212 .dev = {
211 .dma_mask = &pxa168_usb_host_dmamask, 213 .dma_mask = &pxa168_usb_host_dmamask,
@@ -216,7 +218,7 @@ struct platform_device pxa168_device_usb_host = {
216 .resource = pxa168_usb_host_resources, 218 .resource = pxa168_usb_host_resources,
217}; 219};
218 220
219int __init pxa168_add_usb_host(struct pxa168_usb_pdata *pdata) 221int __init pxa168_add_usb_host(struct mv_usb_platform_data *pdata)
220{ 222{
221 pxa168_device_usb_host.dev.platform_data = pdata; 223 pxa168_device_usb_host.dev.platform_data = pdata;
222 return platform_device_register(&pxa168_device_usb_host); 224 return platform_device_register(&pxa168_device_usb_host);
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index 43f8bcc29b67..6da52e9f2bdc 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -109,7 +109,7 @@ static struct clk_lookup pxa910_clkregs[] = {
109 INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL), 109 INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL),
110 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), 110 INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
111 INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), 111 INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL),
112 INIT_CLKREG(&clk_u2o, "pxa-u2o", "U2OCLK"), 112 INIT_CLKREG(&clk_u2o, NULL, "U2OCLK"),
113 INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL), 113 INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL),
114}; 114};
115 115
diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c
index 71fc4ee4602c..936447c70977 100644
--- a/arch/arm/mach-mmp/time.c
+++ b/arch/arm/mach-mmp/time.c
@@ -25,6 +25,9 @@
25 25
26#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/irq.h> 27#include <linux/irq.h>
28#include <linux/of.h>
29#include <linux/of_address.h>
30#include <linux/of_irq.h>
28 31
29#include <asm/sched_clock.h> 32#include <asm/sched_clock.h>
30#include <mach/addr-map.h> 33#include <mach/addr-map.h>
@@ -41,6 +44,8 @@
41#define MAX_DELTA (0xfffffffe) 44#define MAX_DELTA (0xfffffffe)
42#define MIN_DELTA (16) 45#define MIN_DELTA (16)
43 46
47static void __iomem *mmp_timer_base = TIMERS_VIRT_BASE;
48
44/* 49/*
45 * FIXME: the timer needs some delay to stablize the counter capture 50 * FIXME: the timer needs some delay to stablize the counter capture
46 */ 51 */
@@ -48,12 +53,12 @@ static inline uint32_t timer_read(void)
48{ 53{
49 int delay = 100; 54 int delay = 100;
50 55
51 __raw_writel(1, TIMERS_VIRT_BASE + TMR_CVWR(1)); 56 __raw_writel(1, mmp_timer_base + TMR_CVWR(1));
52 57
53 while (delay--) 58 while (delay--)
54 cpu_relax(); 59 cpu_relax();
55 60
56 return __raw_readl(TIMERS_VIRT_BASE + TMR_CVWR(1)); 61 return __raw_readl(mmp_timer_base + TMR_CVWR(1));
57} 62}
58 63
59static u32 notrace mmp_read_sched_clock(void) 64static u32 notrace mmp_read_sched_clock(void)
@@ -68,12 +73,12 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
68 /* 73 /*
69 * Clear pending interrupt status. 74 * Clear pending interrupt status.
70 */ 75 */
71 __raw_writel(0x01, TIMERS_VIRT_BASE + TMR_ICR(0)); 76 __raw_writel(0x01, mmp_timer_base + TMR_ICR(0));
72 77
73 /* 78 /*
74 * Disable timer 0. 79 * Disable timer 0.
75 */ 80 */
76 __raw_writel(0x02, TIMERS_VIRT_BASE + TMR_CER); 81 __raw_writel(0x02, mmp_timer_base + TMR_CER);
77 82
78 c->event_handler(c); 83 c->event_handler(c);
79 84
@@ -90,23 +95,23 @@ static int timer_set_next_event(unsigned long delta,
90 /* 95 /*
91 * Disable timer 0. 96 * Disable timer 0.
92 */ 97 */
93 __raw_writel(0x02, TIMERS_VIRT_BASE + TMR_CER); 98 __raw_writel(0x02, mmp_timer_base + TMR_CER);
94 99
95 /* 100 /*
96 * Clear and enable timer match 0 interrupt. 101 * Clear and enable timer match 0 interrupt.
97 */ 102 */
98 __raw_writel(0x01, TIMERS_VIRT_BASE + TMR_ICR(0)); 103 __raw_writel(0x01, mmp_timer_base + TMR_ICR(0));
99 __raw_writel(0x01, TIMERS_VIRT_BASE + TMR_IER(0)); 104 __raw_writel(0x01, mmp_timer_base + TMR_IER(0));
100 105
101 /* 106 /*
102 * Setup new clockevent timer value. 107 * Setup new clockevent timer value.
103 */ 108 */
104 __raw_writel(delta - 1, TIMERS_VIRT_BASE + TMR_TN_MM(0, 0)); 109 __raw_writel(delta - 1, mmp_timer_base + TMR_TN_MM(0, 0));
105 110
106 /* 111 /*
107 * Enable timer 0. 112 * Enable timer 0.
108 */ 113 */
109 __raw_writel(0x03, TIMERS_VIRT_BASE + TMR_CER); 114 __raw_writel(0x03, mmp_timer_base + TMR_CER);
110 115
111 local_irq_restore(flags); 116 local_irq_restore(flags);
112 117
@@ -124,7 +129,7 @@ static void timer_set_mode(enum clock_event_mode mode,
124 case CLOCK_EVT_MODE_UNUSED: 129 case CLOCK_EVT_MODE_UNUSED:
125 case CLOCK_EVT_MODE_SHUTDOWN: 130 case CLOCK_EVT_MODE_SHUTDOWN:
126 /* disable the matching interrupt */ 131 /* disable the matching interrupt */
127 __raw_writel(0x00, TIMERS_VIRT_BASE + TMR_IER(0)); 132 __raw_writel(0x00, mmp_timer_base + TMR_IER(0));
128 break; 133 break;
129 case CLOCK_EVT_MODE_RESUME: 134 case CLOCK_EVT_MODE_RESUME:
130 case CLOCK_EVT_MODE_PERIODIC: 135 case CLOCK_EVT_MODE_PERIODIC:
@@ -157,27 +162,27 @@ static struct clocksource cksrc = {
157 162
158static void __init timer_config(void) 163static void __init timer_config(void)
159{ 164{
160 uint32_t ccr = __raw_readl(TIMERS_VIRT_BASE + TMR_CCR); 165 uint32_t ccr = __raw_readl(mmp_timer_base + TMR_CCR);
161 166
162 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_CER); /* disable */ 167 __raw_writel(0x0, mmp_timer_base + TMR_CER); /* disable */
163 168
164 ccr &= (cpu_is_mmp2()) ? (TMR_CCR_CS_0(0) | TMR_CCR_CS_1(0)) : 169 ccr &= (cpu_is_mmp2()) ? (TMR_CCR_CS_0(0) | TMR_CCR_CS_1(0)) :
165 (TMR_CCR_CS_0(3) | TMR_CCR_CS_1(3)); 170 (TMR_CCR_CS_0(3) | TMR_CCR_CS_1(3));
166 __raw_writel(ccr, TIMERS_VIRT_BASE + TMR_CCR); 171 __raw_writel(ccr, mmp_timer_base + TMR_CCR);
167 172
168 /* set timer 0 to periodic mode, and timer 1 to free-running mode */ 173 /* set timer 0 to periodic mode, and timer 1 to free-running mode */
169 __raw_writel(0x2, TIMERS_VIRT_BASE + TMR_CMR); 174 __raw_writel(0x2, mmp_timer_base + TMR_CMR);
170 175
171 __raw_writel(0x1, TIMERS_VIRT_BASE + TMR_PLCR(0)); /* periodic */ 176 __raw_writel(0x1, mmp_timer_base + TMR_PLCR(0)); /* periodic */
172 __raw_writel(0x7, TIMERS_VIRT_BASE + TMR_ICR(0)); /* clear status */ 177 __raw_writel(0x7, mmp_timer_base + TMR_ICR(0)); /* clear status */
173 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_IER(0)); 178 __raw_writel(0x0, mmp_timer_base + TMR_IER(0));
174 179
175 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_PLCR(1)); /* free-running */ 180 __raw_writel(0x0, mmp_timer_base + TMR_PLCR(1)); /* free-running */
176 __raw_writel(0x7, TIMERS_VIRT_BASE + TMR_ICR(1)); /* clear status */ 181 __raw_writel(0x7, mmp_timer_base + TMR_ICR(1)); /* clear status */
177 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_IER(1)); 182 __raw_writel(0x0, mmp_timer_base + TMR_IER(1));
178 183
179 /* enable timer 1 counter */ 184 /* enable timer 1 counter */
180 __raw_writel(0x2, TIMERS_VIRT_BASE + TMR_CER); 185 __raw_writel(0x2, mmp_timer_base + TMR_CER);
181} 186}
182 187
183static struct irqaction timer_irq = { 188static struct irqaction timer_irq = {
@@ -203,3 +208,37 @@ void __init timer_init(int irq)
203 clocksource_register_hz(&cksrc, CLOCK_TICK_RATE); 208 clocksource_register_hz(&cksrc, CLOCK_TICK_RATE);
204 clockevents_register_device(&ckevt); 209 clockevents_register_device(&ckevt);
205} 210}
211
212#ifdef CONFIG_OF
213static struct of_device_id mmp_timer_dt_ids[] = {
214 { .compatible = "mrvl,mmp-timer", },
215 {}
216};
217
218void __init mmp_dt_init_timer(void)
219{
220 struct device_node *np;
221 int irq, ret;
222
223 np = of_find_matching_node(NULL, mmp_timer_dt_ids);
224 if (!np) {
225 ret = -ENODEV;
226 goto out;
227 }
228
229 irq = irq_of_parse_and_map(np, 0);
230 if (!irq) {
231 ret = -EINVAL;
232 goto out;
233 }
234 mmp_timer_base = of_iomap(np, 0);
235 if (!mmp_timer_base) {
236 ret = -ENOMEM;
237 goto out;
238 }
239 timer_init(irq);
240 return;
241out:
242 pr_err("Failed to get timer from device tree with error:%d\n", ret);
243}
244#endif
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index 3fc9ed21f97d..7a7de2b12a62 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -17,6 +17,8 @@
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/i2c/pca953x.h> 18#include <linux/i2c/pca953x.h>
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/mfd/88pm860x.h>
21#include <linux/platform_data/mv_usb.h>
20 22
21#include <asm/mach-types.h> 23#include <asm/mach-types.h>
22#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
@@ -25,6 +27,7 @@
25#include <mach/mfp-pxa910.h> 27#include <mach/mfp-pxa910.h>
26#include <mach/pxa910.h> 28#include <mach/pxa910.h>
27#include <mach/irqs.h> 29#include <mach/irqs.h>
30#include <mach/regs-usb.h>
28 31
29#include "common.h" 32#include "common.h"
30 33
@@ -135,8 +138,18 @@ static struct pca953x_platform_data max7312_data[] = {
135 }, 138 },
136}; 139};
137 140
141static struct pm860x_platform_data ttc_dkb_pm8607_info = {
142 .irq_base = IRQ_BOARD_START,
143};
144
138static struct i2c_board_info ttc_dkb_i2c_info[] = { 145static struct i2c_board_info ttc_dkb_i2c_info[] = {
139 { 146 {
147 .type = "88PM860x",
148 .addr = 0x34,
149 .platform_data = &ttc_dkb_pm8607_info,
150 .irq = IRQ_PXA910_PMIC_INT,
151 },
152 {
140 .type = "max7312", 153 .type = "max7312",
141 .addr = 0x23, 154 .addr = 0x23,
142 .irq = MMP_GPIO_TO_IRQ(80), 155 .irq = MMP_GPIO_TO_IRQ(80),
@@ -144,6 +157,26 @@ static struct i2c_board_info ttc_dkb_i2c_info[] = {
144 }, 157 },
145}; 158};
146 159
160#ifdef CONFIG_USB_SUPPORT
161#if defined(CONFIG_USB_MV_UDC) || defined(CONFIG_USB_EHCI_MV_U2O)
162
163static char *pxa910_usb_clock_name[] = {
164 [0] = "U2OCLK",
165};
166
167static struct mv_usb_platform_data ttc_usb_pdata = {
168 .clknum = 1,
169 .clkname = pxa910_usb_clock_name,
170 .vbus = NULL,
171 .mode = MV_USB_MODE_OTG,
172 .otg_force_a_bus_req = 1,
173 .phy_init = pxa_usb_phy_init,
174 .phy_deinit = pxa_usb_phy_deinit,
175 .set_vbus = NULL,
176};
177#endif
178#endif
179
147static void __init ttc_dkb_init(void) 180static void __init ttc_dkb_init(void)
148{ 181{
149 mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config)); 182 mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));
@@ -154,6 +187,21 @@ static void __init ttc_dkb_init(void)
154 /* off-chip devices */ 187 /* off-chip devices */
155 pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info)); 188 pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
156 platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices)); 189 platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
190
191#ifdef CONFIG_USB_MV_UDC
192 pxa168_device_u2o.dev.platform_data = &ttc_usb_pdata;
193 platform_device_register(&pxa168_device_u2o);
194#endif
195
196#ifdef CONFIG_USB_EHCI_MV_U2O
197 pxa168_device_u2oehci.dev.platform_data = &ttc_usb_pdata;
198 platform_device_register(&pxa168_device_u2oehci);
199#endif
200
201#ifdef CONFIG_USB_MV_OTG
202 pxa168_device_u2ootg.dev.platform_data = &ttc_usb_pdata;
203 platform_device_register(&pxa168_device_u2ootg);
204#endif
157} 205}
158 206
159MACHINE_START(TTC_DKB, "PXA910-based TTC_DKB Development Platform") 207MACHINE_START(TTC_DKB, "PXA910-based TTC_DKB Development Platform")
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c
index 3698a370d636..26aac363a064 100644
--- a/arch/arm/mach-msm/board-halibut.c
+++ b/arch/arm/mach-msm/board-halibut.c
@@ -86,9 +86,6 @@ static void __init halibut_init(void)
86static void __init halibut_fixup(struct tag *tags, char **cmdline, 86static void __init halibut_fixup(struct tag *tags, char **cmdline,
87 struct meminfo *mi) 87 struct meminfo *mi)
88{ 88{
89 mi->nr_banks=1;
90 mi->bank[0].start = PHYS_OFFSET;
91 mi->bank[0].size = (101*1024*1024);
92} 89}
93 90
94static void __init halibut_map_io(void) 91static void __init halibut_map_io(void)
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index db81ed531031..75b3cfcada6d 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -17,7 +17,6 @@
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/gpio.h>
21#include <linux/platform_device.h> 20#include <linux/platform_device.h>
22#include <linux/delay.h> 21#include <linux/delay.h>
23#include <linux/io.h> 22#include <linux/io.h>
diff --git a/arch/arm/mach-msm/board-msm8x60.c b/arch/arm/mach-msm/board-msm8x60.c
index 962e71169750..fb3496a52ef4 100644
--- a/arch/arm/mach-msm/board-msm8x60.c
+++ b/arch/arm/mach-msm/board-msm8x60.c
@@ -17,6 +17,7 @@
17#include <linux/irqdomain.h> 17#include <linux/irqdomain.h>
18#include <linux/of.h> 18#include <linux/of.h>
19#include <linux/of_address.h> 19#include <linux/of_address.h>
20#include <linux/of_irq.h>
20#include <linux/of_platform.h> 21#include <linux/of_platform.h>
21#include <linux/memblock.h> 22#include <linux/memblock.h>
22 23
@@ -49,10 +50,22 @@ static void __init msm8x60_map_io(void)
49 msm_map_msm8x60_io(); 50 msm_map_msm8x60_io();
50} 51}
51 52
53#ifdef CONFIG_OF
54static struct of_device_id msm_dt_gic_match[] __initdata = {
55 { .compatible = "qcom,msm-8660-qgic", .data = gic_of_init },
56 {}
57};
58#endif
59
52static void __init msm8x60_init_irq(void) 60static void __init msm8x60_init_irq(void)
53{ 61{
54 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, 62 if (!of_have_populated_dt())
55 (void *)MSM_QGIC_CPU_BASE); 63 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
64 (void *)MSM_QGIC_CPU_BASE);
65#ifdef CONFIG_OF
66 else
67 of_irq_init(msm_dt_gic_match);
68#endif
56 69
57 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */ 70 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
58 writel(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4); 71 writel(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
@@ -73,16 +86,8 @@ static struct of_dev_auxdata msm_auxdata_lookup[] __initdata = {
73 {} 86 {}
74}; 87};
75 88
76static struct of_device_id msm_dt_gic_match[] __initdata = {
77 { .compatible = "qcom,msm-8660-qgic", },
78 {}
79};
80
81static void __init msm8x60_dt_init(void) 89static void __init msm8x60_dt_init(void)
82{ 90{
83 irq_domain_generate_simple(msm_dt_gic_match, MSM8X60_QGIC_DIST_PHYS,
84 GIC_SPI_START);
85
86 if (of_machine_is_compatible("qcom,msm8660-surf")) { 91 if (of_machine_is_compatible("qcom,msm8660-surf")) {
87 printk(KERN_INFO "Init surf UART registers\n"); 92 printk(KERN_INFO "Init surf UART registers\n");
88 msm8x60_init_uart12dm(); 93 msm8x60_init_uart12dm();
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 7e8909c978c3..fbaa4ed95a3c 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -17,7 +17,6 @@
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/gpio.h>
21#include <linux/platform_device.h> 20#include <linux/platform_device.h>
22#include <linux/delay.h> 21#include <linux/delay.h>
23#include <linux/usb/msm_hsusb.h> 22#include <linux/usb/msm_hsusb.h>
diff --git a/arch/arm/mach-msm/board-trout-panel.c b/arch/arm/mach-msm/board-trout-panel.c
index 25105c1027fe..89bf6b426699 100644
--- a/arch/arm/mach-msm/board-trout-panel.c
+++ b/arch/arm/mach-msm/board-trout-panel.c
@@ -12,6 +12,7 @@
12 12
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/mach-types.h> 14#include <asm/mach-types.h>
15#include <asm/system_info.h>
15 16
16#include <mach/msm_fb.h> 17#include <mach/msm_fb.h>
17#include <mach/vreg.h> 18#include <mach/vreg.h>
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index 5414f76ec0a9..d4060a37e23d 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -19,6 +19,7 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/clkdev.h> 20#include <linux/clkdev.h>
21 21
22#include <asm/system_info.h>
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24#include <asm/mach/map.h> 25#include <asm/mach/map.h>
diff --git a/arch/arm/mach-msm/include/mach/debug-macro.S b/arch/arm/mach-msm/include/mach/debug-macro.S
index 3ffd8668c9a5..0e05f88abcd5 100644
--- a/arch/arm/mach-msm/include/mach/debug-macro.S
+++ b/arch/arm/mach-msm/include/mach/debug-macro.S
@@ -30,8 +30,7 @@
30 @ Write the 1 character to UARTDM_TF 30 @ Write the 1 character to UARTDM_TF
31 str \rd, [\rx, #0x70] 31 str \rd, [\rx, #0x70]
32#else 32#else
33 teq \rx, #0 33 str \rd, [\rx, #0x0C]
34 strne \rd, [\rx, #0x0C]
35#endif 34#endif
36 .endm 35 .endm
37 36
diff --git a/arch/arm/mach-msm/proc_comm.c b/arch/arm/mach-msm/proc_comm.c
index 67e701c7f183..9980dc736e7b 100644
--- a/arch/arm/mach-msm/proc_comm.c
+++ b/arch/arm/mach-msm/proc_comm.c
@@ -121,7 +121,7 @@ int msm_proc_comm(unsigned cmd, unsigned *data1, unsigned *data2)
121 * and unknown state. This function should be called early to 121 * and unknown state. This function should be called early to
122 * wait on the ARM9. 122 * wait on the ARM9.
123 */ 123 */
124void __init proc_comm_boot_wait(void) 124void __devinit proc_comm_boot_wait(void)
125{ 125{
126 void __iomem *base = MSM_SHARED_RAM_BASE; 126 void __iomem *base = MSM_SHARED_RAM_BASE;
127 127
diff --git a/arch/arm/mach-msm/scm.c b/arch/arm/mach-msm/scm.c
index bafabb502580..c536fd6bf827 100644
--- a/arch/arm/mach-msm/scm.c
+++ b/arch/arm/mach-msm/scm.c
@@ -282,6 +282,9 @@ u32 scm_get_version(void)
282 __asmeq("%1", "r1") 282 __asmeq("%1", "r1")
283 __asmeq("%2", "r0") 283 __asmeq("%2", "r0")
284 __asmeq("%3", "r1") 284 __asmeq("%3", "r1")
285#ifdef REQUIRES_SEC
286 ".arch_extension sec\n"
287#endif
285 "smc #0 @ switch to secure world\n" 288 "smc #0 @ switch to secure world\n"
286 : "=r" (r0), "=r" (r1) 289 : "=r" (r0), "=r" (r1)
287 : "r" (r0), "r" (r1) 290 : "r" (r0), "r" (r1)
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c
index df3e38055a24..2e56e86b6d68 100644
--- a/arch/arm/mach-mv78xx0/pcie.c
+++ b/arch/arm/mach-mv78xx0/pcie.c
@@ -147,6 +147,7 @@ static int __init mv78xx0_pcie_setup(int nr, struct pci_sys_data *sys)
147 return 0; 147 return 0;
148 148
149 pp = &pcie_port[nr]; 149 pp = &pcie_port[nr];
150 sys->private_data = pp;
150 pp->root_bus_nr = sys->busnr; 151 pp->root_bus_nr = sys->busnr;
151 152
152 /* 153 /*
@@ -161,19 +162,6 @@ static int __init mv78xx0_pcie_setup(int nr, struct pci_sys_data *sys)
161 return 1; 162 return 1;
162} 163}
163 164
164static struct pcie_port *bus_to_port(int bus)
165{
166 int i;
167
168 for (i = num_pcie_ports - 1; i >= 0; i--) {
169 int rbus = pcie_port[i].root_bus_nr;
170 if (rbus != -1 && rbus <= bus)
171 break;
172 }
173
174 return i >= 0 ? pcie_port + i : NULL;
175}
176
177static int pcie_valid_config(struct pcie_port *pp, int bus, int dev) 165static int pcie_valid_config(struct pcie_port *pp, int bus, int dev)
178{ 166{
179 /* 167 /*
@@ -189,7 +177,8 @@ static int pcie_valid_config(struct pcie_port *pp, int bus, int dev)
189static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, 177static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
190 int size, u32 *val) 178 int size, u32 *val)
191{ 179{
192 struct pcie_port *pp = bus_to_port(bus->number); 180 struct pci_sys_data *sys = bus->sysdata;
181 struct pcie_port *pp = sys->private_data;
193 unsigned long flags; 182 unsigned long flags;
194 int ret; 183 int ret;
195 184
@@ -208,7 +197,8 @@ static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
208static int pcie_wr_conf(struct pci_bus *bus, u32 devfn, 197static int pcie_wr_conf(struct pci_bus *bus, u32 devfn,
209 int where, int size, u32 val) 198 int where, int size, u32 val)
210{ 199{
211 struct pcie_port *pp = bus_to_port(bus->number); 200 struct pci_sys_data *sys = bus->sysdata;
201 struct pcie_port *pp = sys->private_data;
212 unsigned long flags; 202 unsigned long flags;
213 int ret; 203 int ret;
214 204
@@ -263,7 +253,8 @@ mv78xx0_pcie_scan_bus(int nr, struct pci_sys_data *sys)
263static int __init mv78xx0_pcie_map_irq(const struct pci_dev *dev, u8 slot, 253static int __init mv78xx0_pcie_map_irq(const struct pci_dev *dev, u8 slot,
264 u8 pin) 254 u8 pin)
265{ 255{
266 struct pcie_port *pp = bus_to_port(dev->bus->number); 256 struct pci_sys_data *sys = dev->bus->sysdata;
257 struct pcie_port *pp = sys->private_data;
267 258
268 return IRQ_MV78XX0_PCIE_00 + (pp->maj << 2) + pp->min; 259 return IRQ_MV78XX0_PCIE_00 + (pp->maj << 2) + pp->min;
269} 260}
@@ -271,7 +262,6 @@ static int __init mv78xx0_pcie_map_irq(const struct pci_dev *dev, u8 slot,
271static struct hw_pci mv78xx0_pci __initdata = { 262static struct hw_pci mv78xx0_pci __initdata = {
272 .nr_controllers = 8, 263 .nr_controllers = 8,
273 .preinit = mv78xx0_pcie_preinit, 264 .preinit = mv78xx0_pcie_preinit,
274 .swizzle = pci_std_swizzle,
275 .setup = mv78xx0_pcie_setup, 265 .setup = mv78xx0_pcie_setup,
276 .scan = mv78xx0_pcie_scan_bus, 266 .scan = mv78xx0_pcie_scan_bus,
277 .map_irq = mv78xx0_pcie_map_irq, 267 .map_irq = mv78xx0_pcie_map_irq,
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index c57f9964a713..07d5383d68ee 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -9,11 +9,13 @@ config SOC_IMX23
9 bool 9 bool
10 select CPU_ARM926T 10 select CPU_ARM926T
11 select HAVE_PWM 11 select HAVE_PWM
12 select PINCTRL_IMX23
12 13
13config SOC_IMX28 14config SOC_IMX28
14 bool 15 bool
15 select CPU_ARM926T 16 select CPU_ARM926T
16 select HAVE_PWM 17 select HAVE_PWM
18 select PINCTRL_IMX28
17 19
18comment "MXS platforms:" 20comment "MXS platforms:"
19 21
diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h
index 4d1329d59287..9acdd6387047 100644
--- a/arch/arm/mach-mxs/devices-mx23.h
+++ b/arch/arm/mach-mxs/devices-mx23.h
@@ -11,10 +11,16 @@
11#include <mach/mx23.h> 11#include <mach/mx23.h>
12#include <mach/devices-common.h> 12#include <mach/devices-common.h>
13#include <mach/mxsfb.h> 13#include <mach/mxsfb.h>
14#include <linux/amba/bus.h>
14 15
15extern const struct amba_device mx23_duart_device __initconst; 16static inline int mx23_add_duart(void)
16#define mx23_add_duart() \ 17{
17 mxs_add_duart(&mx23_duart_device) 18 struct amba_device *d;
19
20 d = amba_ahb_device_add(NULL, "duart", MX23_DUART_BASE_ADDR, SZ_8K,
21 MX23_INT_DUART, 0, 0, 0);
22 return IS_ERR(d) ? PTR_ERR(d) : 0;
23}
18 24
19extern const struct mxs_auart_data mx23_auart_data[] __initconst; 25extern const struct mxs_auart_data mx23_auart_data[] __initconst;
20#define mx23_add_auart(id) mxs_add_auart(&mx23_auart_data[id]) 26#define mx23_add_auart(id) mxs_add_auart(&mx23_auart_data[id])
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index 9dbeae130842..84b2960df117 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -11,10 +11,16 @@
11#include <mach/mx28.h> 11#include <mach/mx28.h>
12#include <mach/devices-common.h> 12#include <mach/devices-common.h>
13#include <mach/mxsfb.h> 13#include <mach/mxsfb.h>
14#include <linux/amba/bus.h>
14 15
15extern const struct amba_device mx28_duart_device __initconst; 16static inline int mx28_add_duart(void)
16#define mx28_add_duart() \ 17{
17 mxs_add_duart(&mx28_duart_device) 18 struct amba_device *d;
19
20 d = amba_ahb_device_add(NULL, "duart", MX28_DUART_BASE_ADDR, SZ_8K,
21 MX28_INT_DUART, 0, 0, 0);
22 return IS_ERR(d) ? PTR_ERR(d) : 0;
23}
18 24
19extern const struct mxs_auart_data mx28_auart_data[] __initconst; 25extern const struct mxs_auart_data mx28_auart_data[] __initconst;
20#define mx28_add_auart(id) mxs_add_auart(&mx28_auart_data[id]) 26#define mx28_add_auart(id) mxs_add_auart(&mx28_auart_data[id])
diff --git a/arch/arm/mach-mxs/devices.c b/arch/arm/mach-mxs/devices.c
index 01faffec3064..cf50b5a66dda 100644
--- a/arch/arm/mach-mxs/devices.c
+++ b/arch/arm/mach-mxs/devices.c
@@ -75,22 +75,6 @@ err:
75 return pdev; 75 return pdev;
76} 76}
77 77
78int __init mxs_add_amba_device(const struct amba_device *dev)
79{
80 struct amba_device *adev = amba_device_alloc(dev->dev.init_name,
81 dev->res.start, resource_size(&dev->res));
82
83 if (!adev) {
84 pr_err("%s: failed to allocate memory", __func__);
85 return -ENOMEM;
86 }
87
88 adev->irq[0] = dev->irq[0];
89 adev->irq[1] = dev->irq[1];
90
91 return amba_device_add(adev, &iomem_resource);
92}
93
94struct device mxs_apbh_bus = { 78struct device mxs_apbh_bus = {
95 .init_name = "mxs_apbh", 79 .init_name = "mxs_apbh",
96 .parent = &platform_bus, 80 .parent = &platform_bus,
diff --git a/arch/arm/mach-mxs/devices/Makefile b/arch/arm/mach-mxs/devices/Makefile
index c8f5c9541a30..5f72d9787444 100644
--- a/arch/arm/mach-mxs/devices/Makefile
+++ b/arch/arm/mach-mxs/devices/Makefile
@@ -1,4 +1,3 @@
1obj-$(CONFIG_MXS_HAVE_AMBA_DUART) += amba-duart.o
2obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o 1obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o
3obj-y += platform-dma.o 2obj-y += platform-dma.o
4obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o 3obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o
diff --git a/arch/arm/mach-mxs/devices/amba-duart.c b/arch/arm/mach-mxs/devices/amba-duart.c
deleted file mode 100644
index a5479f766046..000000000000
--- a/arch/arm/mach-mxs/devices/amba-duart.c
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * Copyright (C) 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License version 2 as published by the
9 * Free Software Foundation.
10 */
11#include <asm/irq.h>
12#include <mach/mx23.h>
13#include <mach/mx28.h>
14#include <mach/devices-common.h>
15
16#define MXS_AMBA_DUART_DEVICE(name, soc) \
17const struct amba_device name##_device __initconst = { \
18 .dev = { \
19 .init_name = "duart", \
20 }, \
21 .res = { \
22 .start = soc ## _DUART_BASE_ADDR, \
23 .end = (soc ## _DUART_BASE_ADDR) + SZ_8K - 1, \
24 .flags = IORESOURCE_MEM, \
25 }, \
26 .irq = {soc ## _INT_DUART}, \
27}
28
29#ifdef CONFIG_SOC_IMX23
30MXS_AMBA_DUART_DEVICE(mx23_duart, MX23);
31#endif
32
33#ifdef CONFIG_SOC_IMX28
34MXS_AMBA_DUART_DEVICE(mx28_duart, MX28);
35#endif
36
37int __init mxs_add_duart(const struct amba_device *dev)
38{
39 return mxs_add_amba_device(dev);
40}
diff --git a/arch/arm/mach-mxs/include/mach/common.h b/arch/arm/mach-mxs/include/mach/common.h
index c50c3ea28a9d..8d88399b73ef 100644
--- a/arch/arm/mach-mxs/include/mach/common.h
+++ b/arch/arm/mach-mxs/include/mach/common.h
@@ -19,11 +19,13 @@ extern void mxs_timer_init(struct clk *, int);
19extern void mxs_restart(char, const char *); 19extern void mxs_restart(char, const char *);
20extern int mxs_saif_clkmux_select(unsigned int clkmux); 20extern int mxs_saif_clkmux_select(unsigned int clkmux);
21 21
22extern void mx23_soc_init(void);
22extern int mx23_register_gpios(void); 23extern int mx23_register_gpios(void);
23extern int mx23_clocks_init(void); 24extern int mx23_clocks_init(void);
24extern void mx23_map_io(void); 25extern void mx23_map_io(void);
25extern void mx23_init_irq(void); 26extern void mx23_init_irq(void);
26 27
28extern void mx28_soc_init(void);
27extern int mx28_register_gpios(void); 29extern int mx28_register_gpios(void);
28extern int mx28_clocks_init(void); 30extern int mx28_clocks_init(void);
29extern void mx28_map_io(void); 31extern void mx28_map_io(void);
diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h
index f2e383955d88..21e45a70d344 100644
--- a/arch/arm/mach-mxs/include/mach/devices-common.h
+++ b/arch/arm/mach-mxs/include/mach/devices-common.h
@@ -27,11 +27,6 @@ static inline struct platform_device *mxs_add_platform_device(
27 name, id, res, num_resources, data, size_data, 0); 27 name, id, res, num_resources, data, size_data, 0);
28} 28}
29 29
30int __init mxs_add_amba_device(const struct amba_device *dev);
31
32/* duart */
33int __init mxs_add_duart(const struct amba_device *dev);
34
35/* auart */ 30/* auart */
36struct mxs_auart_data { 31struct mxs_auart_data {
37 int id; 32 int id;
diff --git a/arch/arm/mach-mxs/mach-apx4devkit.c b/arch/arm/mach-mxs/mach-apx4devkit.c
index 48a7fab571a6..5e90b9dcdef8 100644
--- a/arch/arm/mach-mxs/mach-apx4devkit.c
+++ b/arch/arm/mach-mxs/mach-apx4devkit.c
@@ -207,6 +207,8 @@ static int apx4devkit_phy_fixup(struct phy_device *phy)
207 207
208static void __init apx4devkit_init(void) 208static void __init apx4devkit_init(void)
209{ 209{
210 mx28_soc_init();
211
210 mxs_iomux_setup_multiple_pads(apx4devkit_pads, 212 mxs_iomux_setup_multiple_pads(apx4devkit_pads,
211 ARRAY_SIZE(apx4devkit_pads)); 213 ARRAY_SIZE(apx4devkit_pads));
212 214
diff --git a/arch/arm/mach-mxs/mach-m28evk.c b/arch/arm/mach-mxs/mach-m28evk.c
index 06d79963611c..4c00c879b893 100644
--- a/arch/arm/mach-mxs/mach-m28evk.c
+++ b/arch/arm/mach-mxs/mach-m28evk.c
@@ -319,6 +319,8 @@ static struct mxs_mmc_platform_data m28evk_mmc_pdata[] __initdata = {
319 319
320static void __init m28evk_init(void) 320static void __init m28evk_init(void)
321{ 321{
322 mx28_soc_init();
323
322 mxs_iomux_setup_multiple_pads(m28evk_pads, ARRAY_SIZE(m28evk_pads)); 324 mxs_iomux_setup_multiple_pads(m28evk_pads, ARRAY_SIZE(m28evk_pads));
323 325
324 mx28_add_duart(); 326 mx28_add_duart();
diff --git a/arch/arm/mach-mxs/mach-mx23evk.c b/arch/arm/mach-mxs/mach-mx23evk.c
index 5ea1c57d2606..e7272a41939d 100644
--- a/arch/arm/mach-mxs/mach-mx23evk.c
+++ b/arch/arm/mach-mxs/mach-mx23evk.c
@@ -141,6 +141,8 @@ static void __init mx23evk_init(void)
141{ 141{
142 int ret; 142 int ret;
143 143
144 mx23_soc_init();
145
144 mxs_iomux_setup_multiple_pads(mx23evk_pads, ARRAY_SIZE(mx23evk_pads)); 146 mxs_iomux_setup_multiple_pads(mx23evk_pads, ARRAY_SIZE(mx23evk_pads));
145 147
146 mx23_add_duart(); 148 mx23_add_duart();
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
index e386c142f93c..da4610ebe9e6 100644
--- a/arch/arm/mach-mxs/mach-mx28evk.c
+++ b/arch/arm/mach-mxs/mach-mx28evk.c
@@ -413,6 +413,8 @@ static void __init mx28evk_init(void)
413{ 413{
414 int ret; 414 int ret;
415 415
416 mx28_soc_init();
417
416 mxs_iomux_setup_multiple_pads(mx28evk_pads, ARRAY_SIZE(mx28evk_pads)); 418 mxs_iomux_setup_multiple_pads(mx28evk_pads, ARRAY_SIZE(mx28evk_pads));
417 419
418 mx28_add_duart(); 420 mx28_add_duart();
diff --git a/arch/arm/mach-mxs/mach-stmp378x_devb.c b/arch/arm/mach-mxs/mach-stmp378x_devb.c
index a626c07b8713..6548965e4a76 100644
--- a/arch/arm/mach-mxs/mach-stmp378x_devb.c
+++ b/arch/arm/mach-mxs/mach-stmp378x_devb.c
@@ -85,6 +85,8 @@ static void __init stmp378x_dvb_init(void)
85{ 85{
86 int ret; 86 int ret;
87 87
88 mx23_soc_init();
89
88 mxs_iomux_setup_multiple_pads(stmp378x_dvb_pads, 90 mxs_iomux_setup_multiple_pads(stmp378x_dvb_pads,
89 ARRAY_SIZE(stmp378x_dvb_pads)); 91 ARRAY_SIZE(stmp378x_dvb_pads));
90 92
diff --git a/arch/arm/mach-mxs/mach-tx28.c b/arch/arm/mach-mxs/mach-tx28.c
index 2c0862e655ee..8837029de1a4 100644
--- a/arch/arm/mach-mxs/mach-tx28.c
+++ b/arch/arm/mach-mxs/mach-tx28.c
@@ -146,6 +146,8 @@ static struct mxs_mmc_platform_data tx28_mmc0_pdata __initdata = {
146 146
147static void __init tx28_stk5v3_init(void) 147static void __init tx28_stk5v3_init(void)
148{ 148{
149 mx28_soc_init();
150
149 mxs_iomux_setup_multiple_pads(tx28_stk5v3_pads, 151 mxs_iomux_setup_multiple_pads(tx28_stk5v3_pads,
150 ARRAY_SIZE(tx28_stk5v3_pads)); 152 ARRAY_SIZE(tx28_stk5v3_pads));
151 153
diff --git a/arch/arm/mach-mxs/mm.c b/arch/arm/mach-mxs/mm.c
index 50af5ceebf6d..67a384edcf5b 100644
--- a/arch/arm/mach-mxs/mm.c
+++ b/arch/arm/mach-mxs/mm.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/pinctrl/machine.h>
16 17
17#include <asm/mach/map.h> 18#include <asm/mach/map.h>
18 19
@@ -61,3 +62,13 @@ void __init mx28_init_irq(void)
61{ 62{
62 icoll_init_irq(); 63 icoll_init_irq();
63} 64}
65
66void __init mx23_soc_init(void)
67{
68 pinctrl_provide_dummies();
69}
70
71void __init mx28_soc_init(void)
72{
73 pinctrl_provide_dummies();
74}
diff --git a/arch/arm/mach-nomadik/Kconfig b/arch/arm/mach-nomadik/Kconfig
index 3c5e0f522e9c..365879b47c0e 100644
--- a/arch/arm/mach-nomadik/Kconfig
+++ b/arch/arm/mach-nomadik/Kconfig
@@ -15,6 +15,7 @@ config NOMADIK_8815
15config I2C_BITBANG_8815NHK 15config I2C_BITBANG_8815NHK
16 tristate "Driver for bit-bang busses found on the 8815 NHK" 16 tristate "Driver for bit-bang busses found on the 8815 NHK"
17 depends on I2C && MACH_NOMADIK_8815NHK 17 depends on I2C && MACH_NOMADIK_8815NHK
18 depends on PINCTRL_NOMADIK
18 select I2C_ALGOBIT 19 select I2C_ALGOBIT
19 default y 20 default y
20 21
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index dfab466ebd1d..cba3f7191cfc 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -132,6 +132,7 @@ config MACH_OMAP_PALMTT
132 132
133config MACH_SX1 133config MACH_SX1
134 bool "Siemens SX1" 134 bool "Siemens SX1"
135 select I2C
135 depends on ARCH_OMAP1 && ARCH_OMAP15XX 136 depends on ARCH_OMAP1 && ARCH_OMAP15XX
136 help 137 help
137 Support for the Siemens SX1 phone. To boot the kernel, 138 Support for the Siemens SX1 phone. To boot the kernel,
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index 9923f92b5450..398e9e53e189 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -12,6 +12,9 @@ endif
12 12
13obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o 13obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o
14 14
15# OCPI interconnect support for 1710, 1610 and 5912
16obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
17
15# Power Management 18# Power Management
16obj-$(CONFIG_PM) += pm.o sleep.o 19obj-$(CONFIG_PM) += pm.o sleep.o
17 20
@@ -28,13 +31,15 @@ usb-fs-$(CONFIG_USB) := usb.o
28obj-y += $(usb-fs-m) $(usb-fs-y) 31obj-y += $(usb-fs-m) $(usb-fs-y)
29 32
30# Specific board support 33# Specific board support
31obj-$(CONFIG_MACH_OMAP_H2) += board-h2.o board-h2-mmc.o 34obj-$(CONFIG_MACH_OMAP_H2) += board-h2.o board-h2-mmc.o \
35 board-nand.o
32obj-$(CONFIG_MACH_OMAP_INNOVATOR) += board-innovator.o 36obj-$(CONFIG_MACH_OMAP_INNOVATOR) += board-innovator.o
33obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o 37obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
34obj-$(CONFIG_MACH_OMAP_PERSEUS2) += board-perseus2.o 38obj-$(CONFIG_MACH_OMAP_PERSEUS2) += board-perseus2.o board-nand.o
35obj-$(CONFIG_MACH_OMAP_FSAMPLE) += board-fsample.o 39obj-$(CONFIG_MACH_OMAP_FSAMPLE) += board-fsample.o board-nand.o
36obj-$(CONFIG_MACH_OMAP_OSK) += board-osk.o 40obj-$(CONFIG_MACH_OMAP_OSK) += board-osk.o
37obj-$(CONFIG_MACH_OMAP_H3) += board-h3.o board-h3-mmc.o 41obj-$(CONFIG_MACH_OMAP_H3) += board-h3.o board-h3-mmc.o \
42 board-nand.o
38obj-$(CONFIG_MACH_VOICEBLUE) += board-voiceblue.o 43obj-$(CONFIG_MACH_VOICEBLUE) += board-voiceblue.o
39obj-$(CONFIG_MACH_OMAP_PALMTE) += board-palmte.o 44obj-$(CONFIG_MACH_OMAP_PALMTE) += board-palmte.o
40obj-$(CONFIG_MACH_OMAP_PALMZ71) += board-palmz71.o 45obj-$(CONFIG_MACH_OMAP_PALMZ71) += board-palmz71.o
diff --git a/arch/arm/mach-omap1/ams-delta-fiq.c b/arch/arm/mach-omap1/ams-delta-fiq.c
index fcce7ff37630..68e8e5654c0a 100644
--- a/arch/arm/mach-omap1/ams-delta-fiq.c
+++ b/arch/arm/mach-omap1/ams-delta-fiq.c
@@ -48,7 +48,7 @@ static irqreturn_t deferred_fiq(int irq, void *dev_id)
48 struct irq_chip *irq_chip = NULL; 48 struct irq_chip *irq_chip = NULL;
49 int gpio, irq_num, fiq_count; 49 int gpio, irq_num, fiq_count;
50 50
51 irq_desc = irq_to_desc(IH_GPIO_BASE); 51 irq_desc = irq_to_desc(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK));
52 if (irq_desc) 52 if (irq_desc)
53 irq_chip = irq_desc->irq_data.chip; 53 irq_chip = irq_desc->irq_data.chip;
54 54
@@ -102,7 +102,7 @@ void __init ams_delta_init_fiq(void)
102 } 102 }
103 103
104 retval = request_irq(INT_DEFERRED_FIQ, deferred_fiq, 104 retval = request_irq(INT_DEFERRED_FIQ, deferred_fiq,
105 IRQ_TYPE_EDGE_RISING, "deferred_fiq", 0); 105 IRQ_TYPE_EDGE_RISING, "deferred_fiq", NULL);
106 if (retval < 0) { 106 if (retval < 0) {
107 pr_err("Failed to get deferred_fiq IRQ, ret=%d\n", retval); 107 pr_err("Failed to get deferred_fiq IRQ, ret=%d\n", retval);
108 release_fiq(&fh); 108 release_fiq(&fh);
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index 80bd43c7f4ec..4a4afb371022 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -185,20 +185,6 @@ static struct platform_device nor_device = {
185 .resource = &nor_resource, 185 .resource = &nor_resource,
186}; 186};
187 187
188static void nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
189{
190 struct nand_chip *this = mtd->priv;
191 unsigned long mask;
192
193 if (cmd == NAND_CMD_NONE)
194 return;
195
196 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
197 if (ctrl & NAND_ALE)
198 mask |= 0x04;
199 writeb(cmd, (unsigned long)this->IO_ADDR_W | mask);
200}
201
202#define FSAMPLE_NAND_RB_GPIO_PIN 62 188#define FSAMPLE_NAND_RB_GPIO_PIN 62
203 189
204static int nand_dev_ready(struct mtd_info *mtd) 190static int nand_dev_ready(struct mtd_info *mtd)
@@ -216,7 +202,7 @@ static struct platform_nand_data nand_data = {
216 .part_probe_types = part_probes, 202 .part_probe_types = part_probes,
217 }, 203 },
218 .ctrl = { 204 .ctrl = {
219 .cmd_ctrl = nand_cmd_ctl, 205 .cmd_ctrl = omap1_nand_cmd_ctl,
220 .dev_ready = nand_dev_ready, 206 .dev_ready = nand_dev_ready,
221 }, 207 },
222}; 208};
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 553a2e535764..057ec13f0649 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -179,20 +179,6 @@ static struct mtd_partition h2_nand_partitions[] = {
179 }, 179 },
180}; 180};
181 181
182static void h2_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
183{
184 struct nand_chip *this = mtd->priv;
185 unsigned long mask;
186
187 if (cmd == NAND_CMD_NONE)
188 return;
189
190 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
191 if (ctrl & NAND_ALE)
192 mask |= 0x04;
193 writeb(cmd, (unsigned long)this->IO_ADDR_W | mask);
194}
195
196#define H2_NAND_RB_GPIO_PIN 62 182#define H2_NAND_RB_GPIO_PIN 62
197 183
198static int h2_nand_dev_ready(struct mtd_info *mtd) 184static int h2_nand_dev_ready(struct mtd_info *mtd)
@@ -212,9 +198,8 @@ static struct platform_nand_data h2_nand_platdata = {
212 .part_probe_types = h2_part_probes, 198 .part_probe_types = h2_part_probes,
213 }, 199 },
214 .ctrl = { 200 .ctrl = {
215 .cmd_ctrl = h2_nand_cmd_ctl, 201 .cmd_ctrl = omap1_nand_cmd_ctl,
216 .dev_ready = h2_nand_dev_ready, 202 .dev_ready = h2_nand_dev_ready,
217
218 }, 203 },
219}; 204};
220 205
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 4c19f4c06851..f6ddf8759657 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -181,20 +181,6 @@ static struct mtd_partition nand_partitions[] = {
181 }, 181 },
182}; 182};
183 183
184static void nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
185{
186 struct nand_chip *this = mtd->priv;
187 unsigned long mask;
188
189 if (cmd == NAND_CMD_NONE)
190 return;
191
192 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
193 if (ctrl & NAND_ALE)
194 mask |= 0x04;
195 writeb(cmd, (unsigned long)this->IO_ADDR_W | mask);
196}
197
198#define H3_NAND_RB_GPIO_PIN 10 184#define H3_NAND_RB_GPIO_PIN 10
199 185
200static int nand_dev_ready(struct mtd_info *mtd) 186static int nand_dev_ready(struct mtd_info *mtd)
@@ -214,7 +200,7 @@ static struct platform_nand_data nand_platdata = {
214 .part_probe_types = part_probes, 200 .part_probe_types = part_probes,
215 }, 201 },
216 .ctrl = { 202 .ctrl = {
217 .cmd_ctrl = nand_cmd_ctl, 203 .cmd_ctrl = omap1_nand_cmd_ctl,
218 .dev_ready = nand_dev_ready, 204 .dev_ready = nand_dev_ready,
219 205
220 }, 206 },
diff --git a/arch/arm/mach-omap1/board-nand.c b/arch/arm/mach-omap1/board-nand.c
new file mode 100644
index 000000000000..4d0835327d20
--- /dev/null
+++ b/arch/arm/mach-omap1/board-nand.c
@@ -0,0 +1,37 @@
1/*
2 * linux/arch/arm/mach-omap1/board-nand.c
3 *
4 * Common OMAP1 board NAND code
5 *
6 * Copyright (C) 2004, 2012 Texas Instruments, Inc.
7 * Copyright (C) 2002 MontaVista Software, Inc.
8 * Copyright (C) 2001 RidgeRun, Inc.
9 * Author: RidgeRun, Inc.
10 * Greg Lonnon (glonnon@ridgerun.com) or info@ridgerun.com
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16#include <linux/kernel.h>
17#include <linux/io.h>
18#include <linux/mtd/mtd.h>
19#include <linux/mtd/nand.h>
20
21#include "common.h"
22
23void omap1_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
24{
25 struct nand_chip *this = mtd->priv;
26 unsigned long mask;
27
28 if (cmd == NAND_CMD_NONE)
29 return;
30
31 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
32 if (ctrl & NAND_ALE)
33 mask |= 0x04;
34
35 writeb(cmd, this->IO_ADDR_W + mask);
36}
37
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index a2c5abcd7c84..61ed4f0247ce 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -289,10 +289,10 @@ palmz71_gpio_setup(int early)
289 gpio_direction_input(PALMZ71_USBDETECT_GPIO); 289 gpio_direction_input(PALMZ71_USBDETECT_GPIO);
290 if (request_irq(gpio_to_irq(PALMZ71_USBDETECT_GPIO), 290 if (request_irq(gpio_to_irq(PALMZ71_USBDETECT_GPIO),
291 palmz71_powercable, IRQF_SAMPLE_RANDOM, 291 palmz71_powercable, IRQF_SAMPLE_RANDOM,
292 "palmz71-cable", 0)) 292 "palmz71-cable", NULL))
293 printk(KERN_ERR 293 printk(KERN_ERR
294 "IRQ request for power cable failed!\n"); 294 "IRQ request for power cable failed!\n");
295 palmz71_powercable(gpio_to_irq(PALMZ71_USBDETECT_GPIO), 0); 295 palmz71_powercable(gpio_to_irq(PALMZ71_USBDETECT_GPIO), NULL);
296 } 296 }
297} 297}
298 298
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index 76d4ee05a814..a2c88890e767 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -143,20 +143,6 @@ static struct platform_device nor_device = {
143 .resource = &nor_resource, 143 .resource = &nor_resource,
144}; 144};
145 145
146static void nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
147{
148 struct nand_chip *this = mtd->priv;
149 unsigned long mask;
150
151 if (cmd == NAND_CMD_NONE)
152 return;
153
154 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
155 if (ctrl & NAND_ALE)
156 mask |= 0x04;
157 writeb(cmd, (unsigned long)this->IO_ADDR_W | mask);
158}
159
160#define P2_NAND_RB_GPIO_PIN 62 146#define P2_NAND_RB_GPIO_PIN 62
161 147
162static int nand_dev_ready(struct mtd_info *mtd) 148static int nand_dev_ready(struct mtd_info *mtd)
@@ -174,7 +160,7 @@ static struct platform_nand_data nand_data = {
174 .part_probe_types = part_probes, 160 .part_probe_types = part_probes,
175 }, 161 },
176 .ctrl = { 162 .ctrl = {
177 .cmd_ctrl = nand_cmd_ctl, 163 .cmd_ctrl = omap1_nand_cmd_ctl,
178 .dev_ready = nand_dev_ready, 164 .dev_ready = nand_dev_ready,
179 }, 165 },
180}; 166};
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 67382ddd8c83..a9ee06b6cb42 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -194,9 +194,8 @@ int omap1_select_table_rate(struct clk *clk, unsigned long rate)
194{ 194{
195 /* Find the highest supported frequency <= rate and switch to it */ 195 /* Find the highest supported frequency <= rate and switch to it */
196 struct mpu_rate * ptr; 196 struct mpu_rate * ptr;
197 unsigned long dpll1_rate, ref_rate; 197 unsigned long ref_rate;
198 198
199 dpll1_rate = ck_dpll1_p->rate;
200 ref_rate = ck_ref_p->rate; 199 ref_rate = ck_ref_p->rate;
201 200
202 for (ptr = omap1_rate_table; ptr->rate; ptr++) { 201 for (ptr = omap1_rate_table; ptr->rate; ptr++) {
diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h
index af658ad338ec..bb7779b57795 100644
--- a/arch/arm/mach-omap1/common.h
+++ b/arch/arm/mach-omap1/common.h
@@ -27,6 +27,7 @@
27#define __ARCH_ARM_MACH_OMAP1_COMMON_H 27#define __ARCH_ARM_MACH_OMAP1_COMMON_H
28 28
29#include <plat/common.h> 29#include <plat/common.h>
30#include <linux/mtd/mtd.h>
30 31
31#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) 32#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
32void omap7xx_map_io(void); 33void omap7xx_map_io(void);
@@ -56,8 +57,20 @@ void omap1_init_early(void);
56void omap1_init_irq(void); 57void omap1_init_irq(void);
57void omap1_restart(char, const char *); 58void omap1_restart(char, const char *);
58 59
60extern void __init omap_check_revision(void);
61
62extern void omap1_nand_cmd_ctl(struct mtd_info *mtd, int cmd,
63 unsigned int ctrl);
64
59extern struct sys_timer omap1_timer; 65extern struct sys_timer omap1_timer;
60extern bool omap_32k_timer_init(void); 66extern bool omap_32k_timer_init(void);
61extern void __init omap_init_consistent_dma_size(void); 67
68extern u32 omap_irq_flags;
69
70#ifdef CONFIG_ARCH_OMAP16XX
71extern int ocpi_enable(void);
72#else
73static inline int ocpi_enable(void) { return 0; }
74#endif
62 75
63#endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */ 76#endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index 76c67b3f9f61..29ec50fc688d 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -87,7 +87,7 @@ static void fpga_mask_ack_irq(struct irq_data *d)
87 fpga_ack_irq(d); 87 fpga_ack_irq(d);
88} 88}
89 89
90void innovator_fpga_IRQ_demux(unsigned int irq, struct irq_desc *desc) 90static void innovator_fpga_IRQ_demux(unsigned int irq, struct irq_desc *desc)
91{ 91{
92 u32 stat; 92 u32 stat;
93 int fpga_irq; 93 int fpga_irq;
diff --git a/arch/arm/mach-omap1/id.c b/arch/arm/mach-omap1/id.c
index 2b28e1da14b0..a1b846aacdaf 100644
--- a/arch/arm/mach-omap1/id.c
+++ b/arch/arm/mach-omap1/id.c
@@ -21,6 +21,8 @@
21 21
22#include <mach/hardware.h> 22#include <mach/hardware.h>
23 23
24#include "common.h"
25
24#define OMAP_DIE_ID_0 0xfffe1800 26#define OMAP_DIE_ID_0 0xfffe1800
25#define OMAP_DIE_ID_1 0xfffe1804 27#define OMAP_DIE_ID_1 0xfffe1804
26#define OMAP_PRODUCTION_ID_0 0xfffe2000 28#define OMAP_PRODUCTION_ID_0 0xfffe2000
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index d969a7203d14..71ce017bf5d8 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -18,13 +18,12 @@
18 18
19#include <plat/mux.h> 19#include <plat/mux.h>
20#include <plat/tc.h> 20#include <plat/tc.h>
21#include <plat/dma.h>
21 22
22#include "iomap.h" 23#include "iomap.h"
23#include "common.h" 24#include "common.h"
24#include "clock.h" 25#include "clock.h"
25 26
26extern void omap_check_revision(void);
27
28/* 27/*
29 * The machine specific code may provide the extra mapping besides the 28 * The machine specific code may provide the extra mapping besides the
30 * default mapping provided here. 29 * default mapping provided here.
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c
index 4448114fab72..6995fb6a3345 100644
--- a/arch/arm/mach-omap1/irq.c
+++ b/arch/arm/mach-omap1/irq.c
@@ -49,6 +49,8 @@
49 49
50#include <mach/hardware.h> 50#include <mach/hardware.h>
51 51
52#include "common.h"
53
52#define IRQ_BANK(irq) ((irq) >> 5) 54#define IRQ_BANK(irq) ((irq) >> 5)
53#define IRQ_BIT(irq) ((irq) & 0x1f) 55#define IRQ_BIT(irq) ((irq) & 0x1f)
54 56
diff --git a/arch/arm/mach-omap1/lcd_dma.c b/arch/arm/mach-omap1/lcd_dma.c
index 86ace9aaa663..5769c71815b2 100644
--- a/arch/arm/mach-omap1/lcd_dma.c
+++ b/arch/arm/mach-omap1/lcd_dma.c
@@ -57,7 +57,7 @@ static struct lcd_dma_info {
57 void *cb_data; 57 void *cb_data;
58 58
59 int active; 59 int active;
60 unsigned long addr, size; 60 unsigned long addr;
61 int rotate, data_type, xres, yres; 61 int rotate, data_type, xres, yres;
62 int vxres; 62 int vxres;
63 int mirror; 63 int mirror;
@@ -77,11 +77,6 @@ void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres,
77} 77}
78EXPORT_SYMBOL(omap_set_lcd_dma_b1); 78EXPORT_SYMBOL(omap_set_lcd_dma_b1);
79 79
80void omap_set_lcd_dma_src_port(int port)
81{
82 lcd_dma.src_port = port;
83}
84
85void omap_set_lcd_dma_ext_controller(int external) 80void omap_set_lcd_dma_ext_controller(int external)
86{ 81{
87 lcd_dma.ext_ctrl = external; 82 lcd_dma.ext_ctrl = external;
diff --git a/arch/arm/mach-omap1/mux.c b/arch/arm/mach-omap1/mux.c
index 087dba0df47e..e9cc52d4cb28 100644
--- a/arch/arm/mach-omap1/mux.c
+++ b/arch/arm/mach-omap1/mux.c
@@ -27,6 +27,7 @@
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/spinlock.h> 28#include <linux/spinlock.h>
29 29
30#include <mach/hardware.h>
30 31
31#include <plat/mux.h> 32#include <plat/mux.h>
32 33
diff --git a/arch/arm/plat-omap/ocpi.c b/arch/arm/mach-omap1/ocpi.c
index ebe0c73c8901..238170cab5b7 100644
--- a/arch/arm/plat-omap/ocpi.c
+++ b/arch/arm/mach-omap1/ocpi.c
@@ -4,6 +4,7 @@
4 * Minimal OCP bus support for omap16xx 4 * Minimal OCP bus support for omap16xx
5 * 5 *
6 * Copyright (C) 2003 - 2005 Nokia Corporation 6 * Copyright (C) 2003 - 2005 Nokia Corporation
7 * Copyright (C) 2012 Texas Instruments, Inc.
7 * Written by Tony Lindgren <tony@atomide.com> 8 * Written by Tony Lindgren <tony@atomide.com>
8 * 9 *
9 * Modified for clock framework by Paul Mundt <paul.mundt@nokia.com>. 10 * Modified for clock framework by Paul Mundt <paul.mundt@nokia.com>.
@@ -35,6 +36,8 @@
35 36
36#include <mach/hardware.h> 37#include <mach/hardware.h>
37 38
39#include "common.h"
40
38#define OCPI_BASE 0xfffec320 41#define OCPI_BASE 0xfffec320
39#define OCPI_FAULT (OCPI_BASE + 0x00) 42#define OCPI_FAULT (OCPI_BASE + 0x00)
40#define OCPI_CMD_FAULT (OCPI_BASE + 0x04) 43#define OCPI_CMD_FAULT (OCPI_BASE + 0x04)
@@ -64,7 +67,7 @@ int ocpi_enable(void)
64 /* Enable access for OHCI in OCPI */ 67 /* Enable access for OHCI in OCPI */
65 val = omap_readl(OCPI_PROT); 68 val = omap_readl(OCPI_PROT);
66 val &= ~0xff; 69 val &= ~0xff;
67 //val &= (1 << 0); /* Allow access only to EMIFS */ 70 /* val &= (1 << 0); Allow access only to EMIFS */
68 omap_writel(val, OCPI_PROT); 71 omap_writel(val, OCPI_PROT);
69 72
70 val = omap_readl(OCPI_SEC); 73 val = omap_readl(OCPI_SEC);
@@ -86,7 +89,7 @@ static int __init omap_ocpi_init(void)
86 89
87 clk_enable(ocpi_ck); 90 clk_enable(ocpi_ck);
88 ocpi_enable(); 91 ocpi_enable();
89 printk("OMAP OCPI interconnect driver loaded\n"); 92 pr_info("OMAP OCPI interconnect driver loaded\n");
90 93
91 return 0; 94 return 0;
92} 95}
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index f66c32912b22..b2560d32b3a0 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -569,11 +569,10 @@ static int omap_pm_read_proc(
569 569
570static void omap_pm_init_proc(void) 570static void omap_pm_init_proc(void)
571{ 571{
572 struct proc_dir_entry *entry; 572 /* XXX Appears to leak memory */
573 573 create_proc_read_entry("driver/omap_pm",
574 entry = create_proc_read_entry("driver/omap_pm", 574 S_IWUSR | S_IRUGO, NULL,
575 S_IWUSR | S_IRUGO, NULL, 575 omap_pm_read_proc, NULL);
576 omap_pm_read_proc, NULL);
577} 576}
578 577
579#endif /* DEBUG && CONFIG_PROC_FS */ 578#endif /* DEBUG && CONFIG_PROC_FS */
diff --git a/arch/arm/mach-omap1/reset.c b/arch/arm/mach-omap1/reset.c
index f255b153b863..b17709103866 100644
--- a/arch/arm/mach-omap1/reset.c
+++ b/arch/arm/mach-omap1/reset.c
@@ -8,6 +8,8 @@
8 8
9#include <mach/hardware.h> 9#include <mach/hardware.h>
10 10
11#include "common.h"
12
11void omap1_restart(char mode, const char *cmd) 13void omap1_restart(char mode, const char *cmd)
12{ 14{
13 /* 15 /*
diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c
index 6e90665a7c47..64c65bcb2d67 100644
--- a/arch/arm/mach-omap1/timer.c
+++ b/arch/arm/mach-omap1/timer.c
@@ -47,15 +47,14 @@ static int omap1_dm_timer_set_src(struct platform_device *pdev,
47 int n = (pdev->id - 1) << 1; 47 int n = (pdev->id - 1) << 1;
48 u32 l; 48 u32 l;
49 49
50 l = __raw_readl(MOD_CONF_CTRL_1) & ~(0x03 << n); 50 l = omap_readl(MOD_CONF_CTRL_1) & ~(0x03 << n);
51 l |= source << n; 51 l |= source << n;
52 __raw_writel(l, MOD_CONF_CTRL_1); 52 omap_writel(l, MOD_CONF_CTRL_1);
53 53
54 return 0; 54 return 0;
55} 55}
56 56
57 57static int __init omap1_dm_timer_init(void)
58int __init omap1_dm_timer_init(void)
59{ 58{
60 int i; 59 int i;
61 int ret; 60 int ret;
diff --git a/arch/arm/mach-omap1/usb.c b/arch/arm/mach-omap1/usb.c
index 19de03b074e3..e61afd922766 100644
--- a/arch/arm/mach-omap1/usb.c
+++ b/arch/arm/mach-omap1/usb.c
@@ -29,6 +29,8 @@
29#include <plat/mux.h> 29#include <plat/mux.h>
30#include <plat/usb.h> 30#include <plat/usb.h>
31 31
32#include "common.h"
33
32/* These routines should handle the standard chip-specific modes 34/* These routines should handle the standard chip-specific modes
33 * for usb0/1/2 ports, covering basic mux and transceiver setup. 35 * for usb0/1/2 ports, covering basic mux and transceiver setup.
34 * 36 *
@@ -138,6 +140,7 @@ static inline void ohci_device_init(struct omap_usb_config *pdata)
138 if (cpu_is_omap7xx()) 140 if (cpu_is_omap7xx())
139 ohci_resources[1].start = INT_7XX_USB_HHC_1; 141 ohci_resources[1].start = INT_7XX_USB_HHC_1;
140 pdata->ohci_device = &ohci_device; 142 pdata->ohci_device = &ohci_device;
143 pdata->ocpi_enable = &ocpi_enable;
141} 144}
142 145
143#else 146#else
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 8141b76283a6..964ee67a3b77 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -17,6 +17,7 @@ config ARCH_OMAP2PLUS_TYPICAL
17 select MENELAUS if ARCH_OMAP2 17 select MENELAUS if ARCH_OMAP2
18 select TWL4030_CORE if ARCH_OMAP3 || ARCH_OMAP4 18 select TWL4030_CORE if ARCH_OMAP3 || ARCH_OMAP4
19 select TWL4030_POWER if ARCH_OMAP3 || ARCH_OMAP4 19 select TWL4030_POWER if ARCH_OMAP3 || ARCH_OMAP4
20 select HIGHMEM
20 help 21 help
21 Compile a kernel suitable for booting most boards 22 Compile a kernel suitable for booting most boards
22 23
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 49f92bc1c311..385c083d24b2 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -4,7 +4,7 @@
4 4
5# Common support 5# Common support
6obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \ 6obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \
7 common.o gpio.o dma.o wd_timer.o display.o i2c.o 7 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o
8 8
9omap-2-3-common = irq.o sdrc.o 9omap-2-3-common = irq.o sdrc.o
10hwmod-common = omap_hwmod.o \ 10hwmod-common = omap_hwmod.o \
@@ -118,16 +118,18 @@ obj-$(CONFIG_ARCH_OMAP4) += $(powerdomain-common) \
118 powerdomains44xx_data.o 118 powerdomains44xx_data.o
119 119
120# PRCM clockdomain control 120# PRCM clockdomain control
121obj-$(CONFIG_ARCH_OMAP2) += clockdomain.o \ 121clockdomain-common += clockdomain.o \
122 clockdomains_common_data.o
123obj-$(CONFIG_ARCH_OMAP2) += $(clockdomain-common) \
122 clockdomain2xxx_3xxx.o \ 124 clockdomain2xxx_3xxx.o \
123 clockdomains2xxx_3xxx_data.o 125 clockdomains2xxx_3xxx_data.o
124obj-$(CONFIG_SOC_OMAP2420) += clockdomains2420_data.o 126obj-$(CONFIG_SOC_OMAP2420) += clockdomains2420_data.o
125obj-$(CONFIG_SOC_OMAP2430) += clockdomains2430_data.o 127obj-$(CONFIG_SOC_OMAP2430) += clockdomains2430_data.o
126obj-$(CONFIG_ARCH_OMAP3) += clockdomain.o \ 128obj-$(CONFIG_ARCH_OMAP3) += $(clockdomain-common) \
127 clockdomain2xxx_3xxx.o \ 129 clockdomain2xxx_3xxx.o \
128 clockdomains2xxx_3xxx_data.o \ 130 clockdomains2xxx_3xxx_data.o \
129 clockdomains3xxx_data.o 131 clockdomains3xxx_data.o
130obj-$(CONFIG_ARCH_OMAP4) += clockdomain.o \ 132obj-$(CONFIG_ARCH_OMAP4) += $(clockdomain-common) \
131 clockdomain44xx.o \ 133 clockdomain44xx.o \
132 clockdomains44xx_data.o 134 clockdomains44xx_data.o
133 135
@@ -187,6 +189,9 @@ ifneq ($(CONFIG_TIDSPBRIDGE),)
187obj-y += dsp.o 189obj-y += dsp.o
188endif 190endif
189 191
192# OMAP2420 MSDI controller integration support ("MMC")
193obj-$(CONFIG_SOC_OMAP2420) += msdi.o
194
190# Specific board support 195# Specific board support
191obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o 196obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
192obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o 197obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o
diff --git a/arch/arm/mach-omap2/am35xx-emac.c b/arch/arm/mach-omap2/am35xx-emac.c
index 1f97e7475206..447682c4e11c 100644
--- a/arch/arm/mach-omap2/am35xx-emac.c
+++ b/arch/arm/mach-omap2/am35xx-emac.c
@@ -39,26 +39,23 @@ static struct platform_device am35xx_emac_mdio_device = {
39 39
40static void am35xx_enable_emac_int(void) 40static void am35xx_enable_emac_int(void)
41{ 41{
42 u32 regval; 42 u32 v;
43 43
44 regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); 44 v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
45 regval = (regval | AM35XX_CPGMAC_C0_RX_PULSE_CLR | 45 v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR |
46 AM35XX_CPGMAC_C0_TX_PULSE_CLR | 46 AM35XX_CPGMAC_C0_MISC_PULSE_CLR | AM35XX_CPGMAC_C0_RX_THRESH_CLR);
47 AM35XX_CPGMAC_C0_MISC_PULSE_CLR | 47 omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR);
48 AM35XX_CPGMAC_C0_RX_THRESH_CLR); 48 omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */
49 omap_ctrl_writel(regval, AM35XX_CONTROL_LVL_INTR_CLEAR);
50 regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
51} 49}
52 50
53static void am35xx_disable_emac_int(void) 51static void am35xx_disable_emac_int(void)
54{ 52{
55 u32 regval; 53 u32 v;
56 54
57 regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); 55 v = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
58 regval = (regval | AM35XX_CPGMAC_C0_RX_PULSE_CLR | 56 v |= (AM35XX_CPGMAC_C0_RX_PULSE_CLR | AM35XX_CPGMAC_C0_TX_PULSE_CLR);
59 AM35XX_CPGMAC_C0_TX_PULSE_CLR); 57 omap_ctrl_writel(v, AM35XX_CONTROL_LVL_INTR_CLEAR);
60 omap_ctrl_writel(regval, AM35XX_CONTROL_LVL_INTR_CLEAR); 58 omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); /* OCP barrier */
61 regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR);
62} 59}
63 60
64static struct emac_platform_data am35xx_emac_pdata = { 61static struct emac_platform_data am35xx_emac_pdata = {
@@ -92,7 +89,7 @@ static struct platform_device am35xx_emac_device = {
92 89
93void __init am35xx_emac_init(unsigned long mdio_bus_freq, u8 rmii_en) 90void __init am35xx_emac_init(unsigned long mdio_bus_freq, u8 rmii_en)
94{ 91{
95 unsigned int regval; 92 u32 v;
96 int err; 93 int err;
97 94
98 am35xx_emac_pdata.rmii_en = rmii_en; 95 am35xx_emac_pdata.rmii_en = rmii_en;
@@ -110,8 +107,8 @@ void __init am35xx_emac_init(unsigned long mdio_bus_freq, u8 rmii_en)
110 return; 107 return;
111 } 108 }
112 109
113 regval = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); 110 v = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET);
114 regval = regval & (~(AM35XX_CPGMACSS_SW_RST)); 111 v &= ~AM35XX_CPGMACSS_SW_RST;
115 omap_ctrl_writel(regval, AM35XX_CONTROL_IP_SW_RESET); 112 omap_ctrl_writel(v, AM35XX_CONTROL_IP_SW_RESET);
116 regval = omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); 113 omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); /* OCP barrier */
117} 114}
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index da75f239873e..37abb0d49b51 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -37,7 +37,7 @@
37#include <plat/dma.h> 37#include <plat/dma.h>
38#include <plat/gpmc.h> 38#include <plat/gpmc.h>
39#include <video/omapdss.h> 39#include <video/omapdss.h>
40#include <video/omap-panel-dvi.h> 40#include <video/omap-panel-tfp410.h>
41 41
42#include <plat/gpmc-smc91x.h> 42#include <plat/gpmc-smc91x.h>
43 43
@@ -113,9 +113,6 @@ static struct gpio sdp3430_dss_gpios[] __initdata = {
113 {SDP3430_LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "LCD Backlight"}, 113 {SDP3430_LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "LCD Backlight"},
114}; 114};
115 115
116static int lcd_enabled;
117static int dvi_enabled;
118
119static void __init sdp3430_display_init(void) 116static void __init sdp3430_display_init(void)
120{ 117{
121 int r; 118 int r;
@@ -129,44 +126,18 @@ static void __init sdp3430_display_init(void)
129 126
130static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) 127static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev)
131{ 128{
132 if (dvi_enabled) {
133 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
134 return -EINVAL;
135 }
136
137 gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 1); 129 gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 1);
138 gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 1); 130 gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 1);
139 131
140 lcd_enabled = 1;
141
142 return 0; 132 return 0;
143} 133}
144 134
145static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev) 135static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev)
146{ 136{
147 lcd_enabled = 0;
148
149 gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 0); 137 gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 0);
150 gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 0); 138 gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 0);
151} 139}
152 140
153static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev)
154{
155 if (lcd_enabled) {
156 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
157 return -EINVAL;
158 }
159
160 dvi_enabled = 1;
161
162 return 0;
163}
164
165static void sdp3430_panel_disable_dvi(struct omap_dss_device *dssdev)
166{
167 dvi_enabled = 0;
168}
169
170static int sdp3430_panel_enable_tv(struct omap_dss_device *dssdev) 141static int sdp3430_panel_enable_tv(struct omap_dss_device *dssdev)
171{ 142{
172 return 0; 143 return 0;
@@ -186,15 +157,14 @@ static struct omap_dss_device sdp3430_lcd_device = {
186 .platform_disable = sdp3430_panel_disable_lcd, 157 .platform_disable = sdp3430_panel_disable_lcd,
187}; 158};
188 159
189static struct panel_dvi_platform_data dvi_panel = { 160static struct tfp410_platform_data dvi_panel = {
190 .platform_enable = sdp3430_panel_enable_dvi, 161 .power_down_gpio = -1,
191 .platform_disable = sdp3430_panel_disable_dvi,
192}; 162};
193 163
194static struct omap_dss_device sdp3430_dvi_device = { 164static struct omap_dss_device sdp3430_dvi_device = {
195 .name = "dvi", 165 .name = "dvi",
196 .type = OMAP_DISPLAY_TYPE_DPI, 166 .type = OMAP_DISPLAY_TYPE_DPI,
197 .driver_name = "dvi", 167 .driver_name = "tfp410",
198 .data = &dvi_panel, 168 .data = &dvi_panel,
199 .phy.dpi.data_lines = 24, 169 .phy.dpi.data_lines = 24,
200}; 170};
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index a39fc4bbd2b8..94af6cde2e36 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -20,6 +20,7 @@
20#include <linux/usb/otg.h> 20#include <linux/usb/otg.h>
21#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
22#include <linux/i2c/twl.h> 22#include <linux/i2c/twl.h>
23#include <linux/mfd/twl6040.h>
23#include <linux/gpio_keys.h> 24#include <linux/gpio_keys.h>
24#include <linux/regulator/machine.h> 25#include <linux/regulator/machine.h>
25#include <linux/regulator/fixed.h> 26#include <linux/regulator/fixed.h>
@@ -383,6 +384,11 @@ static struct platform_device sdp4430_dmic_codec = {
383 .id = -1, 384 .id = -1,
384}; 385};
385 386
387static struct platform_device sdp4430_hdmi_audio_codec = {
388 .name = "hdmi-audio-codec",
389 .id = -1,
390};
391
386static struct omap_abe_twl6040_data sdp4430_abe_audio_data = { 392static struct omap_abe_twl6040_data sdp4430_abe_audio_data = {
387 .card_name = "SDP4430", 393 .card_name = "SDP4430",
388 .has_hs = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT, 394 .has_hs = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
@@ -417,6 +423,7 @@ static struct platform_device *sdp4430_devices[] __initdata = {
417 &sdp4430_vbat, 423 &sdp4430_vbat,
418 &sdp4430_dmic_codec, 424 &sdp4430_dmic_codec,
419 &sdp4430_abe_audio, 425 &sdp4430_abe_audio,
426 &sdp4430_hdmi_audio_codec,
420}; 427};
421 428
422static struct omap_musb_board_data musb_board_data = { 429static struct omap_musb_board_data musb_board_data = {
@@ -488,50 +495,6 @@ static struct platform_device omap_vwlan_device = {
488 }, 495 },
489}; 496};
490 497
491static int omap4_twl6030_hsmmc_late_init(struct device *dev)
492{
493 int irq = 0;
494 struct platform_device *pdev = container_of(dev,
495 struct platform_device, dev);
496 struct omap_mmc_platform_data *pdata = dev->platform_data;
497
498 /* Setting MMC1 Card detect Irq */
499 if (pdev->id == 0) {
500 irq = twl6030_mmc_card_detect_config();
501 if (irq < 0) {
502 pr_err("Failed configuring MMC1 card detect\n");
503 return irq;
504 }
505 pdata->slots[0].card_detect_irq = irq;
506 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
507 }
508 return 0;
509}
510
511static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
512{
513 struct omap_mmc_platform_data *pdata;
514
515 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
516 if (!dev) {
517 pr_err("Failed %s\n", __func__);
518 return;
519 }
520 pdata = dev->platform_data;
521 pdata->init = omap4_twl6030_hsmmc_late_init;
522}
523
524static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
525{
526 struct omap2_hsmmc_info *c;
527
528 omap_hsmmc_init(controllers);
529 for (c = controllers; c->mmc; c++)
530 omap4_twl6030_hsmmc_set_late_init(&c->pdev->dev);
531
532 return 0;
533}
534
535static struct regulator_init_data sdp4430_vaux1 = { 498static struct regulator_init_data sdp4430_vaux1 = {
536 .constraints = { 499 .constraints = {
537 .min_uV = 1000000, 500 .min_uV = 1000000,
@@ -560,7 +523,7 @@ static struct regulator_init_data sdp4430_vusim = {
560 }, 523 },
561}; 524};
562 525
563static struct twl4030_codec_data twl6040_codec = { 526static struct twl6040_codec_data twl6040_codec = {
564 /* single-step ramp for headset and handsfree */ 527 /* single-step ramp for headset and handsfree */
565 .hs_left_step = 0x0f, 528 .hs_left_step = 0x0f,
566 .hs_right_step = 0x0f, 529 .hs_right_step = 0x0f,
@@ -568,7 +531,7 @@ static struct twl4030_codec_data twl6040_codec = {
568 .hf_right_step = 0x1d, 531 .hf_right_step = 0x1d,
569}; 532};
570 533
571static struct twl4030_vibra_data twl6040_vibra = { 534static struct twl6040_vibra_data twl6040_vibra = {
572 .vibldrv_res = 8, 535 .vibldrv_res = 8,
573 .vibrdrv_res = 3, 536 .vibrdrv_res = 3,
574 .viblmotor_res = 10, 537 .viblmotor_res = 10,
@@ -577,16 +540,14 @@ static struct twl4030_vibra_data twl6040_vibra = {
577 .vddvibr_uV = 0, /* fixed volt supply - VBAT */ 540 .vddvibr_uV = 0, /* fixed volt supply - VBAT */
578}; 541};
579 542
580static struct twl4030_audio_data twl6040_audio = { 543static struct twl6040_platform_data twl6040_data = {
581 .codec = &twl6040_codec, 544 .codec = &twl6040_codec,
582 .vibra = &twl6040_vibra, 545 .vibra = &twl6040_vibra,
583 .audpwron_gpio = 127, 546 .audpwron_gpio = 127,
584 .naudint_irq = OMAP44XX_IRQ_SYS_2N,
585 .irq_base = TWL6040_CODEC_IRQ_BASE, 547 .irq_base = TWL6040_CODEC_IRQ_BASE,
586}; 548};
587 549
588static struct twl4030_platform_data sdp4430_twldata = { 550static struct twl4030_platform_data sdp4430_twldata = {
589 .audio = &twl6040_audio,
590 /* Regulators */ 551 /* Regulators */
591 .vusim = &sdp4430_vusim, 552 .vusim = &sdp4430_vusim,
592 .vaux1 = &sdp4430_vaux1, 553 .vaux1 = &sdp4430_vaux1,
@@ -616,8 +577,11 @@ static int __init omap4_i2c_init(void)
616 TWL_COMMON_REGULATOR_VANA | 577 TWL_COMMON_REGULATOR_VANA |
617 TWL_COMMON_REGULATOR_VCXIO | 578 TWL_COMMON_REGULATOR_VCXIO |
618 TWL_COMMON_REGULATOR_VUSB | 579 TWL_COMMON_REGULATOR_VUSB |
619 TWL_COMMON_REGULATOR_CLK32KG); 580 TWL_COMMON_REGULATOR_CLK32KG |
620 omap4_pmic_init("twl6030", &sdp4430_twldata); 581 TWL_COMMON_REGULATOR_V1V8 |
582 TWL_COMMON_REGULATOR_V2V1);
583 omap4_pmic_init("twl6030", &sdp4430_twldata,
584 &twl6040_data, OMAP44XX_IRQ_SYS_2N);
621 omap_register_i2c_bus(2, 400, NULL, 0); 585 omap_register_i2c_bus(2, 400, NULL, 0);
622 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, 586 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
623 ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); 587 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
@@ -666,6 +630,10 @@ static struct nokia_dsi_panel_data dsi1_panel = {
666 .use_ext_te = false, 630 .use_ext_te = false,
667 .ext_te_gpio = 101, 631 .ext_te_gpio = 101,
668 .esd_interval = 0, 632 .esd_interval = 0,
633 .pin_config = {
634 .num_pins = 6,
635 .pins = { 0, 1, 2, 3, 4, 5 },
636 },
669}; 637};
670 638
671static struct omap_dss_device sdp4430_lcd_device = { 639static struct omap_dss_device sdp4430_lcd_device = {
@@ -674,13 +642,6 @@ static struct omap_dss_device sdp4430_lcd_device = {
674 .type = OMAP_DISPLAY_TYPE_DSI, 642 .type = OMAP_DISPLAY_TYPE_DSI,
675 .data = &dsi1_panel, 643 .data = &dsi1_panel,
676 .phy.dsi = { 644 .phy.dsi = {
677 .clk_lane = 1,
678 .clk_pol = 0,
679 .data1_lane = 2,
680 .data1_pol = 0,
681 .data2_lane = 3,
682 .data2_pol = 0,
683
684 .module = 0, 645 .module = 0,
685 }, 646 },
686 647
@@ -715,6 +676,10 @@ static struct nokia_dsi_panel_data dsi2_panel = {
715 .use_ext_te = false, 676 .use_ext_te = false,
716 .ext_te_gpio = 103, 677 .ext_te_gpio = 103,
717 .esd_interval = 0, 678 .esd_interval = 0,
679 .pin_config = {
680 .num_pins = 6,
681 .pins = { 0, 1, 2, 3, 4, 5 },
682 },
718}; 683};
719 684
720static struct omap_dss_device sdp4430_lcd2_device = { 685static struct omap_dss_device sdp4430_lcd2_device = {
@@ -723,12 +688,6 @@ static struct omap_dss_device sdp4430_lcd2_device = {
723 .type = OMAP_DISPLAY_TYPE_DSI, 688 .type = OMAP_DISPLAY_TYPE_DSI,
724 .data = &dsi2_panel, 689 .data = &dsi2_panel,
725 .phy.dsi = { 690 .phy.dsi = {
726 .clk_lane = 1,
727 .clk_pol = 0,
728 .data1_lane = 2,
729 .data1_pol = 0,
730 .data2_lane = 3,
731 .data2_pol = 0,
732 691
733 .module = 1, 692 .module = 1,
734 }, 693 },
@@ -758,21 +717,6 @@ static struct omap_dss_device sdp4430_lcd2_device = {
758 .channel = OMAP_DSS_CHANNEL_LCD2, 717 .channel = OMAP_DSS_CHANNEL_LCD2,
759}; 718};
760 719
761static void sdp4430_lcd_init(void)
762{
763 int r;
764
765 r = gpio_request_one(dsi1_panel.reset_gpio, GPIOF_DIR_OUT,
766 "lcd1_reset_gpio");
767 if (r)
768 pr_err("%s: Could not get lcd1_reset_gpio\n", __func__);
769
770 r = gpio_request_one(dsi2_panel.reset_gpio, GPIOF_DIR_OUT,
771 "lcd2_reset_gpio");
772 if (r)
773 pr_err("%s: Could not get lcd2_reset_gpio\n", __func__);
774}
775
776static struct omap_dss_hdmi_data sdp4430_hdmi_data = { 720static struct omap_dss_hdmi_data sdp4430_hdmi_data = {
777 .hpd_gpio = HDMI_GPIO_HPD, 721 .hpd_gpio = HDMI_GPIO_HPD,
778}; 722};
@@ -858,7 +802,6 @@ static void __init omap_4430sdp_display_init(void)
858 if (r) 802 if (r)
859 pr_err("%s: Could not get display_sel GPIO\n", __func__); 803 pr_err("%s: Could not get display_sel GPIO\n", __func__);
860 804
861 sdp4430_lcd_init();
862 sdp4430_picodlp_init(); 805 sdp4430_picodlp_init();
863 omap_display_init(&sdp4430_dss_data); 806 omap_display_init(&sdp4430_dss_data);
864 /* 807 /*
diff --git a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c
index c3851e8de28b..3b8a53c1f2a8 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -30,6 +30,7 @@
30#include "common.h" 30#include "common.h"
31#include <plat/usb.h> 31#include <plat/usb.h>
32 32
33#include "am35xx-emac.h"
33#include "mux.h" 34#include "mux.h"
34#include "control.h" 35#include "control.h"
35 36
@@ -90,6 +91,7 @@ static void __init am3517_crane_init(void)
90 } 91 }
91 92
92 usbhs_init(&usbhs_bdata); 93 usbhs_init(&usbhs_bdata);
94 am35xx_emac_init(AM35XX_DEFAULT_MDIO_FREQUENCY, 1);
93} 95}
94 96
95MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD") 97MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index 3645285a3e2b..99790eb646e8 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -37,7 +37,7 @@
37#include <plat/usb.h> 37#include <plat/usb.h>
38#include <video/omapdss.h> 38#include <video/omapdss.h>
39#include <video/omap-panel-generic-dpi.h> 39#include <video/omap-panel-generic-dpi.h>
40#include <video/omap-panel-dvi.h> 40#include <video/omap-panel-tfp410.h>
41 41
42#include "am35xx-emac.h" 42#include "am35xx-emac.h"
43#include "mux.h" 43#include "mux.h"
@@ -207,31 +207,14 @@ static struct omap_dss_device am3517_evm_tv_device = {
207 .platform_disable = am3517_evm_panel_disable_tv, 207 .platform_disable = am3517_evm_panel_disable_tv,
208}; 208};
209 209
210static int am3517_evm_panel_enable_dvi(struct omap_dss_device *dssdev) 210static struct tfp410_platform_data dvi_panel = {
211{ 211 .power_down_gpio = -1,
212 if (lcd_enabled) {
213 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
214 return -EINVAL;
215 }
216 dvi_enabled = 1;
217
218 return 0;
219}
220
221static void am3517_evm_panel_disable_dvi(struct omap_dss_device *dssdev)
222{
223 dvi_enabled = 0;
224}
225
226static struct panel_dvi_platform_data dvi_panel = {
227 .platform_enable = am3517_evm_panel_enable_dvi,
228 .platform_disable = am3517_evm_panel_disable_dvi,
229}; 212};
230 213
231static struct omap_dss_device am3517_evm_dvi_device = { 214static struct omap_dss_device am3517_evm_dvi_device = {
232 .type = OMAP_DISPLAY_TYPE_DPI, 215 .type = OMAP_DISPLAY_TYPE_DPI,
233 .name = "dvi", 216 .name = "dvi",
234 .driver_name = "dvi", 217 .driver_name = "tfp410",
235 .data = &dvi_panel, 218 .data = &dvi_panel,
236 .phy.dpi.data_lines = 24, 219 .phy.dpi.data_lines = 24,
237}; 220};
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 909a8b91b564..c03df142ea67 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -44,7 +44,7 @@
44#include <plat/usb.h> 44#include <plat/usb.h>
45#include <video/omapdss.h> 45#include <video/omapdss.h>
46#include <video/omap-panel-generic-dpi.h> 46#include <video/omap-panel-generic-dpi.h>
47#include <video/omap-panel-dvi.h> 47#include <video/omap-panel-tfp410.h>
48#include <plat/mcspi.h> 48#include <plat/mcspi.h>
49 49
50#include <mach/hardware.h> 50#include <mach/hardware.h>
@@ -218,25 +218,6 @@ static void cm_t35_panel_disable_lcd(struct omap_dss_device *dssdev)
218 gpio_set_value(CM_T35_LCD_EN_GPIO, 0); 218 gpio_set_value(CM_T35_LCD_EN_GPIO, 0);
219} 219}
220 220
221static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev)
222{
223 if (lcd_enabled) {
224 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
225 return -EINVAL;
226 }
227
228 gpio_set_value(CM_T35_DVI_EN_GPIO, 0);
229 dvi_enabled = 1;
230
231 return 0;
232}
233
234static void cm_t35_panel_disable_dvi(struct omap_dss_device *dssdev)
235{
236 gpio_set_value(CM_T35_DVI_EN_GPIO, 1);
237 dvi_enabled = 0;
238}
239
240static int cm_t35_panel_enable_tv(struct omap_dss_device *dssdev) 221static int cm_t35_panel_enable_tv(struct omap_dss_device *dssdev)
241{ 222{
242 return 0; 223 return 0;
@@ -260,15 +241,14 @@ static struct omap_dss_device cm_t35_lcd_device = {
260 .phy.dpi.data_lines = 18, 241 .phy.dpi.data_lines = 18,
261}; 242};
262 243
263static struct panel_dvi_platform_data dvi_panel = { 244static struct tfp410_platform_data dvi_panel = {
264 .platform_enable = cm_t35_panel_enable_dvi, 245 .power_down_gpio = CM_T35_DVI_EN_GPIO,
265 .platform_disable = cm_t35_panel_disable_dvi,
266}; 246};
267 247
268static struct omap_dss_device cm_t35_dvi_device = { 248static struct omap_dss_device cm_t35_dvi_device = {
269 .name = "dvi", 249 .name = "dvi",
270 .type = OMAP_DISPLAY_TYPE_DPI, 250 .type = OMAP_DISPLAY_TYPE_DPI,
271 .driver_name = "dvi", 251 .driver_name = "tfp410",
272 .data = &dvi_panel, 252 .data = &dvi_panel,
273 .phy.dpi.data_lines = 24, 253 .phy.dpi.data_lines = 24,
274}; 254};
@@ -316,7 +296,6 @@ static struct spi_board_info cm_t35_lcd_spi_board_info[] __initdata = {
316static struct gpio cm_t35_dss_gpios[] __initdata = { 296static struct gpio cm_t35_dss_gpios[] __initdata = {
317 { CM_T35_LCD_EN_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable" }, 297 { CM_T35_LCD_EN_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable" },
318 { CM_T35_LCD_BL_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable" }, 298 { CM_T35_LCD_BL_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable" },
319 { CM_T35_DVI_EN_GPIO, GPIOF_OUT_INIT_HIGH, "dvi enable" },
320}; 299};
321 300
322static void __init cm_t35_init_display(void) 301static void __init cm_t35_init_display(void)
@@ -335,7 +314,6 @@ static void __init cm_t35_init_display(void)
335 314
336 gpio_export(CM_T35_LCD_EN_GPIO, 0); 315 gpio_export(CM_T35_LCD_EN_GPIO, 0);
337 gpio_export(CM_T35_LCD_BL_GPIO, 0); 316 gpio_export(CM_T35_LCD_BL_GPIO, 0);
338 gpio_export(CM_T35_DVI_EN_GPIO, 0);
339 317
340 msleep(50); 318 msleep(50);
341 gpio_set_value(CM_T35_LCD_EN_GPIO, 1); 319 gpio_set_value(CM_T35_LCD_EN_GPIO, 1);
@@ -498,6 +476,10 @@ static struct twl4030_gpio_platform_data cm_t35_gpio_data = {
498 .setup = cm_t35_twl_gpio_setup, 476 .setup = cm_t35_twl_gpio_setup,
499}; 477};
500 478
479static struct twl4030_power_data cm_t35_power_data = {
480 .use_poweroff = true,
481};
482
501static struct twl4030_platform_data cm_t35_twldata = { 483static struct twl4030_platform_data cm_t35_twldata = {
502 /* platform_data for children goes here */ 484 /* platform_data for children goes here */
503 .keypad = &cm_t35_kp_data, 485 .keypad = &cm_t35_kp_data,
@@ -505,6 +487,7 @@ static struct twl4030_platform_data cm_t35_twldata = {
505 .vmmc1 = &cm_t35_vmmc1, 487 .vmmc1 = &cm_t35_vmmc1,
506 .vsim = &cm_t35_vsim, 488 .vsim = &cm_t35_vsim,
507 .vio = &cm_t35_vio, 489 .vio = &cm_t35_vio,
490 .power = &cm_t35_power_data,
508}; 491};
509 492
510static void __init cm_t35_init_i2c(void) 493static void __init cm_t35_init_i2c(void)
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index a2010f07de31..b063f0d2faa6 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -47,7 +47,7 @@
47#include <plat/usb.h> 47#include <plat/usb.h>
48#include <video/omapdss.h> 48#include <video/omapdss.h>
49#include <video/omap-panel-generic-dpi.h> 49#include <video/omap-panel-generic-dpi.h>
50#include <video/omap-panel-dvi.h> 50#include <video/omap-panel-tfp410.h>
51 51
52#include <plat/mcspi.h> 52#include <plat/mcspi.h>
53#include <linux/input/matrix_keypad.h> 53#include <linux/input/matrix_keypad.h>
@@ -118,19 +118,6 @@ static void devkit8000_panel_disable_lcd(struct omap_dss_device *dssdev)
118 gpio_set_value_cansleep(dssdev->reset_gpio, 0); 118 gpio_set_value_cansleep(dssdev->reset_gpio, 0);
119} 119}
120 120
121static int devkit8000_panel_enable_dvi(struct omap_dss_device *dssdev)
122{
123 if (gpio_is_valid(dssdev->reset_gpio))
124 gpio_set_value_cansleep(dssdev->reset_gpio, 1);
125 return 0;
126}
127
128static void devkit8000_panel_disable_dvi(struct omap_dss_device *dssdev)
129{
130 if (gpio_is_valid(dssdev->reset_gpio))
131 gpio_set_value_cansleep(dssdev->reset_gpio, 0);
132}
133
134static struct regulator_consumer_supply devkit8000_vmmc1_supply[] = { 121static struct regulator_consumer_supply devkit8000_vmmc1_supply[] = {
135 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), 122 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
136}; 123};
@@ -154,15 +141,14 @@ static struct omap_dss_device devkit8000_lcd_device = {
154 .phy.dpi.data_lines = 24, 141 .phy.dpi.data_lines = 24,
155}; 142};
156 143
157static struct panel_dvi_platform_data dvi_panel = { 144static struct tfp410_platform_data dvi_panel = {
158 .platform_enable = devkit8000_panel_enable_dvi, 145 .power_down_gpio = -1,
159 .platform_disable = devkit8000_panel_disable_dvi,
160}; 146};
161 147
162static struct omap_dss_device devkit8000_dvi_device = { 148static struct omap_dss_device devkit8000_dvi_device = {
163 .name = "dvi", 149 .name = "dvi",
164 .type = OMAP_DISPLAY_TYPE_DPI, 150 .type = OMAP_DISPLAY_TYPE_DPI,
165 .driver_name = "dvi", 151 .driver_name = "tfp410",
166 .data = &dvi_panel, 152 .data = &dvi_panel,
167 .phy.dpi.data_lines = 24, 153 .phy.dpi.data_lines = 24,
168}; 154};
@@ -244,13 +230,7 @@ static int devkit8000_twl_gpio_setup(struct device *dev,
244 } 230 }
245 231
246 /* gpio + 7 is "DVI_PD" (out, active low) */ 232 /* gpio + 7 is "DVI_PD" (out, active low) */
247 devkit8000_dvi_device.reset_gpio = gpio + 7; 233 dvi_panel.power_down_gpio = gpio + 7;
248 ret = gpio_request_one(devkit8000_dvi_device.reset_gpio,
249 GPIOF_OUT_INIT_LOW, "DVI PowerDown");
250 if (ret < 0) {
251 devkit8000_dvi_device.reset_gpio = -EINVAL;
252 printk(KERN_ERR "Failed to request GPIO for DVI PowerDown\n");
253 }
254 234
255 return 0; 235 return 0;
256} 236}
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c
index 0349fd2b68d8..70a81f900bb5 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -87,7 +87,7 @@ static struct omap_onenand_platform_data board_onenand_data = {
87 .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */ 87 .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */
88}; 88};
89 89
90static void 90void
91__init board_onenand_init(struct mtd_partition *onenand_parts, 91__init board_onenand_init(struct mtd_partition *onenand_parts,
92 u8 nr_parts, u8 cs) 92 u8 nr_parts, u8 cs)
93{ 93{
@@ -98,7 +98,7 @@ __init board_onenand_init(struct mtd_partition *onenand_parts,
98 gpmc_onenand_init(&board_onenand_data); 98 gpmc_onenand_init(&board_onenand_data);
99} 99}
100#else 100#else
101static void 101void
102__init board_onenand_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 cs) 102__init board_onenand_init(struct mtd_partition *nor_parts, u8 nr_parts, u8 cs)
103{ 103{
104} 104}
diff --git a/arch/arm/mach-omap2/board-flash.h b/arch/arm/mach-omap2/board-flash.h
index d25503a98417..c44b70d52021 100644
--- a/arch/arm/mach-omap2/board-flash.h
+++ b/arch/arm/mach-omap2/board-flash.h
@@ -47,3 +47,14 @@ static inline void board_nand_init(struct mtd_partition *nand_parts,
47{ 47{
48} 48}
49#endif 49#endif
50
51#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
52 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
53extern void board_onenand_init(struct mtd_partition *nand_parts,
54 u8 nr_parts, u8 cs);
55#else
56static inline void board_onenand_init(struct mtd_partition *nand_parts,
57 u8 nr_parts, u8 cs)
58{
59}
60#endif
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 74e1687b5170..7302ba7ff1b9 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -15,7 +15,6 @@
15#include <linux/of_irq.h> 15#include <linux/of_irq.h>
16#include <linux/of_platform.h> 16#include <linux/of_platform.h>
17#include <linux/irqdomain.h> 17#include <linux/irqdomain.h>
18#include <linux/i2c/twl.h>
19 18
20#include <mach/hardware.h> 19#include <mach/hardware.h>
21#include <asm/hardware/gic.h> 20#include <asm/hardware/gic.h>
@@ -95,22 +94,6 @@ MACHINE_END
95#endif 94#endif
96 95
97#ifdef CONFIG_ARCH_OMAP3 96#ifdef CONFIG_ARCH_OMAP3
98static struct twl4030_platform_data beagle_twldata = {
99 .irq_base = TWL4030_IRQ_BASE,
100 .irq_end = TWL4030_IRQ_END,
101};
102
103static void __init omap3_i2c_init(void)
104{
105 omap3_pmic_init("twl4030", &beagle_twldata);
106}
107
108static void __init omap3_init(void)
109{
110 omap3_i2c_init();
111 omap_generic_init();
112}
113
114static const char *omap3_boards_compat[] __initdata = { 97static const char *omap3_boards_compat[] __initdata = {
115 "ti,omap3", 98 "ti,omap3",
116 NULL, 99 NULL,
@@ -122,7 +105,7 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
122 .init_early = omap3430_init_early, 105 .init_early = omap3430_init_early,
123 .init_irq = omap_init_irq, 106 .init_irq = omap_init_irq,
124 .handle_irq = omap3_intc_handle_irq, 107 .handle_irq = omap3_intc_handle_irq,
125 .init_machine = omap3_init, 108 .init_machine = omap_generic_init,
126 .timer = &omap3_timer, 109 .timer = &omap3_timer,
127 .dt_compat = omap3_boards_compat, 110 .dt_compat = omap3_boards_compat,
128 .restart = omap_prcm_restart, 111 .restart = omap_prcm_restart,
@@ -130,22 +113,6 @@ MACHINE_END
130#endif 113#endif
131 114
132#ifdef CONFIG_ARCH_OMAP4 115#ifdef CONFIG_ARCH_OMAP4
133static struct twl4030_platform_data sdp4430_twldata = {
134 .irq_base = TWL6030_IRQ_BASE,
135 .irq_end = TWL6030_IRQ_END,
136};
137
138static void __init omap4_i2c_init(void)
139{
140 omap4_pmic_init("twl6030", &sdp4430_twldata);
141}
142
143static void __init omap4_init(void)
144{
145 omap4_i2c_init();
146 omap_generic_init();
147}
148
149static const char *omap4_boards_compat[] __initdata = { 116static const char *omap4_boards_compat[] __initdata = {
150 "ti,omap4", 117 "ti,omap4",
151 NULL, 118 NULL,
@@ -157,7 +124,7 @@ DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
157 .init_early = omap4430_init_early, 124 .init_early = omap4430_init_early,
158 .init_irq = omap_init_irq, 125 .init_irq = omap_init_irq,
159 .handle_irq = gic_handle_irq, 126 .handle_irq = gic_handle_irq,
160 .init_machine = omap4_init, 127 .init_machine = omap_generic_init,
161 .timer = &omap4_timer, 128 .timer = &omap4_timer,
162 .dt_compat = omap4_boards_compat, 129 .dt_compat = omap4_boards_compat,
163 .restart = omap_prcm_restart, 130 .restart = omap_prcm_restart,
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 930c0d380435..7a274098f67b 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -24,6 +24,8 @@
24#include <linux/i2c/twl.h> 24#include <linux/i2c/twl.h>
25#include <linux/mmc/host.h> 25#include <linux/mmc/host.h>
26 26
27#include <linux/mtd/nand.h>
28
27#include <asm/mach-types.h> 29#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
29 31
@@ -32,13 +34,15 @@
32#include <plat/gpmc.h> 34#include <plat/gpmc.h>
33#include <plat/usb.h> 35#include <plat/usb.h>
34#include <video/omapdss.h> 36#include <video/omapdss.h>
35#include <video/omap-panel-dvi.h> 37#include <video/omap-panel-tfp410.h>
36#include <plat/onenand.h> 38#include <plat/onenand.h>
37 39
38#include "mux.h" 40#include "mux.h"
39#include "hsmmc.h" 41#include "hsmmc.h"
40#include "sdram-numonyx-m65kxxxxam.h" 42#include "sdram-numonyx-m65kxxxxam.h"
41#include "common-board-devices.h" 43#include "common-board-devices.h"
44#include "board-flash.h"
45#include "control.h"
42 46
43#define IGEP2_SMSC911X_CS 5 47#define IGEP2_SMSC911X_CS 5
44#define IGEP2_SMSC911X_GPIO 176 48#define IGEP2_SMSC911X_GPIO 176
@@ -60,6 +64,10 @@
60#define IGEP3_GPIO_LED1_RED 16 64#define IGEP3_GPIO_LED1_RED 16
61#define IGEP3_GPIO_USBH_NRESET 183 65#define IGEP3_GPIO_USBH_NRESET 183
62 66
67#define IGEP_SYSBOOT_MASK 0x1f
68#define IGEP_SYSBOOT_NAND 0x0f
69#define IGEP_SYSBOOT_ONENAND 0x10
70
63/* 71/*
64 * IGEP2 Hardware Revision Table 72 * IGEP2 Hardware Revision Table
65 * 73 *
@@ -110,8 +118,10 @@ static void __init igep2_get_revision(void)
110 gpio_free(IGEP2_GPIO_LED1_RED); 118 gpio_free(IGEP2_GPIO_LED1_RED);
111} 119}
112 120
113#if defined(CONFIG_MTD_ONENAND_OMAP2) || \ 121#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
114 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) 122 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) || \
123 defined(CONFIG_MTD_NAND_OMAP2) || \
124 defined(CONFIG_MTD_NAND_OMAP2_MODULE)
115 125
116#define ONENAND_MAP 0x20000000 126#define ONENAND_MAP 0x20000000
117 127
@@ -123,7 +133,7 @@ static void __init igep2_get_revision(void)
123 * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048) 133 * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048)
124 */ 134 */
125 135
126static struct mtd_partition igep_onenand_partitions[] = { 136static struct mtd_partition igep_flash_partitions[] = {
127 { 137 {
128 .name = "X-Loader", 138 .name = "X-Loader",
129 .offset = 0, 139 .offset = 0,
@@ -151,50 +161,28 @@ static struct mtd_partition igep_onenand_partitions[] = {
151 }, 161 },
152}; 162};
153 163
154static struct omap_onenand_platform_data igep_onenand_data = { 164static inline u32 igep_get_sysboot_value(void)
155 .parts = igep_onenand_partitions, 165{
156 .nr_parts = ARRAY_SIZE(igep_onenand_partitions), 166 return omap_ctrl_readl(OMAP343X_CONTROL_STATUS) & IGEP_SYSBOOT_MASK;
157 .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */ 167}
158};
159
160static struct platform_device igep_onenand_device = {
161 .name = "omap2-onenand",
162 .id = -1,
163 .dev = {
164 .platform_data = &igep_onenand_data,
165 },
166};
167 168
168static void __init igep_flash_init(void) 169static void __init igep_flash_init(void)
169{ 170{
170 u8 cs = 0; 171 u32 mux;
171 u8 onenandcs = GPMC_CS_NUM + 1; 172 mux = igep_get_sysboot_value();
172 173
173 for (cs = 0; cs < GPMC_CS_NUM; cs++) { 174 if (mux == IGEP_SYSBOOT_NAND) {
174 u32 ret; 175 pr_info("IGEP: initializing NAND memory device\n");
175 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); 176 board_nand_init(igep_flash_partitions,
176 177 ARRAY_SIZE(igep_flash_partitions),
177 /* Check if NAND/oneNAND is configured */ 178 0, NAND_BUSWIDTH_16);
178 if ((ret & 0xC00) == 0x800) 179 } else if (mux == IGEP_SYSBOOT_ONENAND) {
179 /* NAND found */ 180 pr_info("IGEP: initializing OneNAND memory device\n");
180 pr_err("IGEP: Unsupported NAND found\n"); 181 board_onenand_init(igep_flash_partitions,
181 else { 182 ARRAY_SIZE(igep_flash_partitions), 0);
182 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); 183 } else {
183 if ((ret & 0x3F) == (ONENAND_MAP >> 24)) 184 pr_err("IGEP: Flash: unsupported sysboot sequence found\n");
184 /* ONENAND found */
185 onenandcs = cs;
186 }
187 }
188
189 if (onenandcs > GPMC_CS_NUM) {
190 pr_err("IGEP: Unable to find configuration in GPMC\n");
191 return;
192 } 185 }
193
194 igep_onenand_data.cs = onenandcs;
195
196 if (platform_device_register(&igep_onenand_device) < 0)
197 pr_err("IGEP: Unable to register OneNAND device\n");
198} 186}
199 187
200#else 188#else
@@ -444,28 +432,15 @@ static struct twl4030_gpio_platform_data igep_twl4030_gpio_pdata = {
444 .setup = igep_twl_gpio_setup, 432 .setup = igep_twl_gpio_setup,
445}; 433};
446 434
447static int igep2_enable_dvi(struct omap_dss_device *dssdev) 435static struct tfp410_platform_data dvi_panel = {
448{ 436 .i2c_bus_num = 3,
449 gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1); 437 .power_down_gpio = IGEP2_GPIO_DVI_PUP,
450
451 return 0;
452}
453
454static void igep2_disable_dvi(struct omap_dss_device *dssdev)
455{
456 gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0);
457}
458
459static struct panel_dvi_platform_data dvi_panel = {
460 .platform_enable = igep2_enable_dvi,
461 .platform_disable = igep2_disable_dvi,
462 .i2c_bus_num = 3,
463}; 438};
464 439
465static struct omap_dss_device igep2_dvi_device = { 440static struct omap_dss_device igep2_dvi_device = {
466 .type = OMAP_DISPLAY_TYPE_DPI, 441 .type = OMAP_DISPLAY_TYPE_DPI,
467 .name = "dvi", 442 .name = "dvi",
468 .driver_name = "dvi", 443 .driver_name = "tfp410",
469 .data = &dvi_panel, 444 .data = &dvi_panel,
470 .phy.dpi.data_lines = 24, 445 .phy.dpi.data_lines = 24,
471}; 446};
@@ -480,14 +455,6 @@ static struct omap_dss_board_info igep2_dss_data = {
480 .default_device = &igep2_dvi_device, 455 .default_device = &igep2_dvi_device,
481}; 456};
482 457
483static void __init igep2_display_init(void)
484{
485 int err = gpio_request_one(IGEP2_GPIO_DVI_PUP, GPIOF_OUT_INIT_HIGH,
486 "GPIO_DVI_PUP");
487 if (err)
488 pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n");
489}
490
491static struct platform_device *igep_devices[] __initdata = { 458static struct platform_device *igep_devices[] __initdata = {
492 &igep_vwlan_device, 459 &igep_vwlan_device,
493}; 460};
@@ -540,7 +507,10 @@ static void __init igep_i2c_init(void)
540{ 507{
541 int ret; 508 int ret;
542 509
543 omap3_pmic_get_config(&igep_twldata, TWL_COMMON_PDATA_USB, 0); 510 omap3_pmic_get_config(&igep_twldata, TWL_COMMON_PDATA_USB,
511 TWL_COMMON_REGULATOR_VPLL2);
512 igep_twldata.vpll2->constraints.apply_uV = true;
513 igep_twldata.vpll2->constraints.name = "VDVI";
544 514
545 if (machine_is_igep0020()) { 515 if (machine_is_igep0020()) {
546 /* 516 /*
@@ -554,10 +524,7 @@ static void __init igep_i2c_init(void)
554 524
555 igep_twldata.keypad = &igep2_keypad_pdata; 525 igep_twldata.keypad = &igep2_keypad_pdata;
556 /* Get common pmic data */ 526 /* Get common pmic data */
557 omap3_pmic_get_config(&igep_twldata, TWL_COMMON_PDATA_AUDIO, 527 omap3_pmic_get_config(&igep_twldata, TWL_COMMON_PDATA_AUDIO, 0);
558 TWL_COMMON_REGULATOR_VPLL2);
559 igep_twldata.vpll2->constraints.apply_uV = true;
560 igep_twldata.vpll2->constraints.name = "VDVI";
561 } 528 }
562 529
563 omap3_pmic_init("twl4030", &igep_twldata); 530 omap3_pmic_init("twl4030", &igep_twldata);
@@ -641,7 +608,7 @@ static struct regulator_consumer_supply dummy_supplies[] = {
641 608
642static void __init igep_init(void) 609static void __init igep_init(void)
643{ 610{
644 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); 611 regulator_register_fixed(1, dummy_supplies, ARRAY_SIZE(dummy_supplies));
645 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 612 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
646 613
647 /* Get IGEP2 hardware revision */ 614 /* Get IGEP2 hardware revision */
@@ -668,7 +635,6 @@ static void __init igep_init(void)
668 635
669 if (machine_is_igep0020()) { 636 if (machine_is_igep0020()) {
670 omap_display_init(&igep2_dss_data); 637 omap_display_init(&igep2_dss_data);
671 igep2_display_init();
672 igep2_init_smsc911x(); 638 igep2_init_smsc911x();
673 usbhs_init(&igep2_usbhs_bdata); 639 usbhs_init(&igep2_usbhs_bdata);
674 } else { 640 } else {
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 7be8d659d91d..2a7b9a9da1db 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -42,7 +42,7 @@
42#include <plat/board.h> 42#include <plat/board.h>
43#include "common.h" 43#include "common.h"
44#include <video/omapdss.h> 44#include <video/omapdss.h>
45#include <video/omap-panel-dvi.h> 45#include <video/omap-panel-tfp410.h>
46#include <plat/gpmc.h> 46#include <plat/gpmc.h>
47#include <plat/nand.h> 47#include <plat/nand.h>
48#include <plat/usb.h> 48#include <plat/usb.h>
@@ -83,11 +83,13 @@ static struct {
83 int usb_pwr_level; 83 int usb_pwr_level;
84 int reset_gpio; 84 int reset_gpio;
85 int usr_button_gpio; 85 int usr_button_gpio;
86 int mmc_caps;
86} beagle_config = { 87} beagle_config = {
87 .mmc1_gpio_wp = -EINVAL, 88 .mmc1_gpio_wp = -EINVAL,
88 .usb_pwr_level = GPIOF_OUT_INIT_LOW, 89 .usb_pwr_level = GPIOF_OUT_INIT_LOW,
89 .reset_gpio = 129, 90 .reset_gpio = 129,
90 .usr_button_gpio = 4, 91 .usr_button_gpio = 4,
92 .mmc_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
91}; 93};
92 94
93static struct gpio omap3_beagle_rev_gpios[] __initdata = { 95static struct gpio omap3_beagle_rev_gpios[] __initdata = {
@@ -145,10 +147,12 @@ static void __init omap3_beagle_init_rev(void)
145 printk(KERN_INFO "OMAP3 Beagle Rev: xM Ax/Bx\n"); 147 printk(KERN_INFO "OMAP3 Beagle Rev: xM Ax/Bx\n");
146 omap3_beagle_version = OMAP3BEAGLE_BOARD_XM; 148 omap3_beagle_version = OMAP3BEAGLE_BOARD_XM;
147 beagle_config.usb_pwr_level = GPIOF_OUT_INIT_HIGH; 149 beagle_config.usb_pwr_level = GPIOF_OUT_INIT_HIGH;
150 beagle_config.mmc_caps &= ~MMC_CAP_8_BIT_DATA;
148 break; 151 break;
149 case 2: 152 case 2:
150 printk(KERN_INFO "OMAP3 Beagle Rev: xM C\n"); 153 printk(KERN_INFO "OMAP3 Beagle Rev: xM C\n");
151 omap3_beagle_version = OMAP3BEAGLE_BOARD_XMC; 154 omap3_beagle_version = OMAP3BEAGLE_BOARD_XMC;
155 beagle_config.mmc_caps &= ~MMC_CAP_8_BIT_DATA;
152 break; 156 break;
153 default: 157 default:
154 printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev); 158 printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev);
@@ -189,33 +193,17 @@ static struct mtd_partition omap3beagle_nand_partitions[] = {
189 193
190/* DSS */ 194/* DSS */
191 195
192static int beagle_enable_dvi(struct omap_dss_device *dssdev) 196static struct tfp410_platform_data dvi_panel = {
193{
194 if (gpio_is_valid(dssdev->reset_gpio))
195 gpio_set_value(dssdev->reset_gpio, 1);
196
197 return 0;
198}
199
200static void beagle_disable_dvi(struct omap_dss_device *dssdev)
201{
202 if (gpio_is_valid(dssdev->reset_gpio))
203 gpio_set_value(dssdev->reset_gpio, 0);
204}
205
206static struct panel_dvi_platform_data dvi_panel = {
207 .platform_enable = beagle_enable_dvi,
208 .platform_disable = beagle_disable_dvi,
209 .i2c_bus_num = 3, 197 .i2c_bus_num = 3,
198 .power_down_gpio = -1,
210}; 199};
211 200
212static struct omap_dss_device beagle_dvi_device = { 201static struct omap_dss_device beagle_dvi_device = {
213 .type = OMAP_DISPLAY_TYPE_DPI, 202 .type = OMAP_DISPLAY_TYPE_DPI,
214 .name = "dvi", 203 .name = "dvi",
215 .driver_name = "dvi", 204 .driver_name = "tfp410",
216 .data = &dvi_panel, 205 .data = &dvi_panel,
217 .phy.dpi.data_lines = 24, 206 .phy.dpi.data_lines = 24,
218 .reset_gpio = -EINVAL,
219}; 207};
220 208
221static struct omap_dss_device beagle_tv_device = { 209static struct omap_dss_device beagle_tv_device = {
@@ -236,22 +224,12 @@ static struct omap_dss_board_info beagle_dss_data = {
236 .default_device = &beagle_dvi_device, 224 .default_device = &beagle_dvi_device,
237}; 225};
238 226
239static void __init beagle_display_init(void)
240{
241 int r;
242
243 r = gpio_request_one(beagle_dvi_device.reset_gpio, GPIOF_OUT_INIT_LOW,
244 "DVI reset");
245 if (r < 0)
246 printk(KERN_ERR "Unable to get DVI reset GPIO\n");
247}
248
249#include "sdram-micron-mt46h32m32lf-6.h" 227#include "sdram-micron-mt46h32m32lf-6.h"
250 228
251static struct omap2_hsmmc_info mmc[] = { 229static struct omap2_hsmmc_info mmc[] = {
252 { 230 {
253 .mmc = 1, 231 .mmc = 1,
254 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, 232 .caps = MMC_CAP_4_BIT_DATA,
255 .gpio_wp = -EINVAL, 233 .gpio_wp = -EINVAL,
256 .deferred = true, 234 .deferred = true,
257 }, 235 },
@@ -309,7 +287,7 @@ static int beagle_twl_gpio_setup(struct device *dev,
309 if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC")) 287 if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
310 pr_err("%s: unable to configure EHCI_nOC\n", __func__); 288 pr_err("%s: unable to configure EHCI_nOC\n", __func__);
311 } 289 }
312 beagle_dvi_device.reset_gpio = beagle_config.reset_gpio; 290 dvi_panel.power_down_gpio = beagle_config.reset_gpio;
313 291
314 gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level, 292 gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
315 "nEN_USB_PWR"); 293 "nEN_USB_PWR");
@@ -523,6 +501,7 @@ static void __init omap3_beagle_init(void)
523 501
524 if (beagle_config.mmc1_gpio_wp != -EINVAL) 502 if (beagle_config.mmc1_gpio_wp != -EINVAL)
525 omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT); 503 omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT);
504 mmc[0].caps = beagle_config.mmc_caps;
526 omap_hsmmc_init(mmc); 505 omap_hsmmc_init(mmc);
527 506
528 omap3_beagle_i2c_init(); 507 omap3_beagle_i2c_init();
@@ -552,7 +531,6 @@ static void __init omap3_beagle_init(void)
552 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 531 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
553 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); 532 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
554 533
555 beagle_display_init();
556 beagle_opp_init(); 534 beagle_opp_init();
557} 535}
558 536
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 49df12735b41..ace3c675e9c2 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -46,7 +46,7 @@
46#include "common.h" 46#include "common.h"
47#include <plat/mcspi.h> 47#include <plat/mcspi.h>
48#include <video/omapdss.h> 48#include <video/omapdss.h>
49#include <video/omap-panel-dvi.h> 49#include <video/omap-panel-tfp410.h>
50 50
51#include "mux.h" 51#include "mux.h"
52#include "sdram-micron-mt46h32m32lf-6.h" 52#include "sdram-micron-mt46h32m32lf-6.h"
@@ -219,35 +219,14 @@ static struct omap_dss_device omap3_evm_tv_device = {
219 .platform_disable = omap3_evm_disable_tv, 219 .platform_disable = omap3_evm_disable_tv,
220}; 220};
221 221
222static int omap3_evm_enable_dvi(struct omap_dss_device *dssdev) 222static struct tfp410_platform_data dvi_panel = {
223{ 223 .power_down_gpio = OMAP3EVM_DVI_PANEL_EN_GPIO,
224 if (lcd_enabled) {
225 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
226 return -EINVAL;
227 }
228
229 gpio_set_value_cansleep(OMAP3EVM_DVI_PANEL_EN_GPIO, 1);
230
231 dvi_enabled = 1;
232 return 0;
233}
234
235static void omap3_evm_disable_dvi(struct omap_dss_device *dssdev)
236{
237 gpio_set_value_cansleep(OMAP3EVM_DVI_PANEL_EN_GPIO, 0);
238
239 dvi_enabled = 0;
240}
241
242static struct panel_dvi_platform_data dvi_panel = {
243 .platform_enable = omap3_evm_enable_dvi,
244 .platform_disable = omap3_evm_disable_dvi,
245}; 224};
246 225
247static struct omap_dss_device omap3_evm_dvi_device = { 226static struct omap_dss_device omap3_evm_dvi_device = {
248 .name = "dvi", 227 .name = "dvi",
249 .type = OMAP_DISPLAY_TYPE_DPI, 228 .type = OMAP_DISPLAY_TYPE_DPI,
250 .driver_name = "dvi", 229 .driver_name = "tfp410",
251 .data = &dvi_panel, 230 .data = &dvi_panel,
252 .phy.dpi.data_lines = 24, 231 .phy.dpi.data_lines = 24,
253}; 232};
@@ -630,13 +609,13 @@ static struct regulator_consumer_supply dummy_supplies[] = {
630 609
631static void __init omap3_evm_init(void) 610static void __init omap3_evm_init(void)
632{ 611{
612 struct omap_board_mux *obm;
613
633 omap3_evm_get_revision(); 614 omap3_evm_get_revision();
634 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); 615 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
635 616
636 if (cpu_is_omap3630()) 617 obm = (cpu_is_omap3630()) ? omap36x_board_mux : omap35x_board_mux;
637 omap3_mux_init(omap36x_board_mux, OMAP_PACKAGE_CBB); 618 omap3_mux_init(obm, OMAP_PACKAGE_CBB);
638 else
639 omap3_mux_init(omap35x_board_mux, OMAP_PACKAGE_CBB);
640 619
641 omap_board_config = omap3_evm_config; 620 omap_board_config = omap3_evm_config;
642 omap_board_config_size = ARRAY_SIZE(omap3_evm_config); 621 omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index 9b3c141ff51b..c008bf8e1c36 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -4,8 +4,9 @@
4 * Copyright (C) 2010 Li-Pro.Net 4 * Copyright (C) 2010 Li-Pro.Net
5 * Stephan Linz <linz@li-pro.net> 5 * Stephan Linz <linz@li-pro.net>
6 * 6 *
7 * Copyright (C) 2010 Logic Product Development, Inc. 7 * Copyright (C) 2010-2012 Logic Product Development, Inc.
8 * Peter Barada <peter.barada@logicpd.com> 8 * Peter Barada <peter.barada@logicpd.com>
9 * Ashwin BIhari <ashwin.bihari@logicpd.com>
9 * 10 *
10 * Modified from Beagle, EVM, and RX51 11 * Modified from Beagle, EVM, and RX51
11 * 12 *
@@ -45,6 +46,7 @@
45#include <plat/gpmc-smsc911x.h> 46#include <plat/gpmc-smsc911x.h>
46#include <plat/gpmc.h> 47#include <plat/gpmc.h>
47#include <plat/sdrc.h> 48#include <plat/sdrc.h>
49#include <plat/usb.h>
48 50
49#define OMAP3LOGIC_SMSC911X_CS 1 51#define OMAP3LOGIC_SMSC911X_CS 1
50 52
@@ -85,6 +87,11 @@ static struct twl4030_gpio_platform_data omap3logic_gpio_data = {
85 | BIT(13) | BIT(15) | BIT(16) | BIT(17), 87 | BIT(13) | BIT(15) | BIT(16) | BIT(17),
86}; 88};
87 89
90static struct twl4030_usb_data omap3logic_usb_data = {
91 .usb_mode = T2_USB_MODE_ULPI,
92};
93
94
88static struct twl4030_platform_data omap3logic_twldata = { 95static struct twl4030_platform_data omap3logic_twldata = {
89 .irq_base = TWL4030_IRQ_BASE, 96 .irq_base = TWL4030_IRQ_BASE,
90 .irq_end = TWL4030_IRQ_END, 97 .irq_end = TWL4030_IRQ_END,
@@ -92,6 +99,7 @@ static struct twl4030_platform_data omap3logic_twldata = {
92 /* platform_data for children goes here */ 99 /* platform_data for children goes here */
93 .gpio = &omap3logic_gpio_data, 100 .gpio = &omap3logic_gpio_data,
94 .vmmc1 = &omap3logic_vmmc1, 101 .vmmc1 = &omap3logic_vmmc1,
102 .usb = &omap3logic_usb_data,
95}; 103};
96 104
97static int __init omap3logic_i2c_init(void) 105static int __init omap3logic_i2c_init(void)
@@ -185,6 +193,20 @@ static inline void __init board_smsc911x_init(void)
185 193
186#ifdef CONFIG_OMAP_MUX 194#ifdef CONFIG_OMAP_MUX
187static struct omap_board_mux board_mux[] __initdata = { 195static struct omap_board_mux board_mux[] __initdata = {
196 /* mUSB */
197 OMAP3_MUX(HSUSB0_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
198 OMAP3_MUX(HSUSB0_STP, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
199 OMAP3_MUX(HSUSB0_DIR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
200 OMAP3_MUX(HSUSB0_NXT, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
201 OMAP3_MUX(HSUSB0_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
202 OMAP3_MUX(HSUSB0_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
203 OMAP3_MUX(HSUSB0_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
204 OMAP3_MUX(HSUSB0_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
205 OMAP3_MUX(HSUSB0_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
206 OMAP3_MUX(HSUSB0_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
207 OMAP3_MUX(HSUSB0_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
208 OMAP3_MUX(HSUSB0_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
209
188 { .reg_offset = OMAP_MUX_TERMINATOR }, 210 { .reg_offset = OMAP_MUX_TERMINATOR },
189}; 211};
190#endif 212#endif
@@ -205,6 +227,8 @@ static void __init omap3logic_init(void)
205 board_mmc_init(); 227 board_mmc_init();
206 board_smsc911x_init(); 228 board_smsc911x_init();
207 229
230 usb_musb_init(NULL);
231
208 /* Ensure SDRC pins are mux'd for self-refresh */ 232 /* Ensure SDRC pins are mux'd for self-refresh */
209 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 233 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
210 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); 234 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index 4dffc95bddd2..4396bae91677 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -42,7 +42,7 @@
42#include <plat/usb.h> 42#include <plat/usb.h>
43#include <video/omapdss.h> 43#include <video/omapdss.h>
44#include <video/omap-panel-generic-dpi.h> 44#include <video/omap-panel-generic-dpi.h>
45#include <video/omap-panel-dvi.h> 45#include <video/omap-panel-tfp410.h>
46 46
47#include <plat/mcspi.h> 47#include <plat/mcspi.h>
48#include <linux/input/matrix_keypad.h> 48#include <linux/input/matrix_keypad.h>
@@ -92,9 +92,6 @@ static inline void __init omap3stalker_init_eth(void)
92#define LCD_PANEL_BKLIGHT_GPIO 210 92#define LCD_PANEL_BKLIGHT_GPIO 210
93#define ENABLE_VPLL2_DEV_GRP 0xE0 93#define ENABLE_VPLL2_DEV_GRP 0xE0
94 94
95static int lcd_enabled;
96static int dvi_enabled;
97
98static void __init omap3_stalker_display_init(void) 95static void __init omap3_stalker_display_init(void)
99{ 96{
100 return; 97 return;
@@ -122,32 +119,14 @@ static struct omap_dss_device omap3_stalker_tv_device = {
122 .platform_disable = omap3_stalker_disable_tv, 119 .platform_disable = omap3_stalker_disable_tv,
123}; 120};
124 121
125static int omap3_stalker_enable_dvi(struct omap_dss_device *dssdev) 122static struct tfp410_platform_data dvi_panel = {
126{ 123 .power_down_gpio = DSS_ENABLE_GPIO,
127 if (lcd_enabled) {
128 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
129 return -EINVAL;
130 }
131 gpio_set_value(DSS_ENABLE_GPIO, 1);
132 dvi_enabled = 1;
133 return 0;
134}
135
136static void omap3_stalker_disable_dvi(struct omap_dss_device *dssdev)
137{
138 gpio_set_value(DSS_ENABLE_GPIO, 0);
139 dvi_enabled = 0;
140}
141
142static struct panel_dvi_platform_data dvi_panel = {
143 .platform_enable = omap3_stalker_enable_dvi,
144 .platform_disable = omap3_stalker_disable_dvi,
145}; 124};
146 125
147static struct omap_dss_device omap3_stalker_dvi_device = { 126static struct omap_dss_device omap3_stalker_dvi_device = {
148 .name = "dvi", 127 .name = "dvi",
149 .type = OMAP_DISPLAY_TYPE_DPI, 128 .type = OMAP_DISPLAY_TYPE_DPI,
150 .driver_name = "dvi", 129 .driver_name = "tfp410",
151 .data = &dvi_panel, 130 .data = &dvi_panel,
152 .phy.dpi.data_lines = 24, 131 .phy.dpi.data_lines = 24,
153}; 132};
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index d8c0e89f0126..68b8fc9ff010 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -25,8 +25,10 @@
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <linux/usb/otg.h> 26#include <linux/usb/otg.h>
27#include <linux/i2c/twl.h> 27#include <linux/i2c/twl.h>
28#include <linux/mfd/twl6040.h>
28#include <linux/regulator/machine.h> 29#include <linux/regulator/machine.h>
29#include <linux/regulator/fixed.h> 30#include <linux/regulator/fixed.h>
31#include <linux/ti_wilink_st.h>
30#include <linux/wl12xx.h> 32#include <linux/wl12xx.h>
31#include <linux/platform_data/omap-abe-twl6040.h> 33#include <linux/platform_data/omap-abe-twl6040.h>
32 34
@@ -41,7 +43,7 @@
41#include "common.h" 43#include "common.h"
42#include <plat/usb.h> 44#include <plat/usb.h>
43#include <plat/mmc.h> 45#include <plat/mmc.h>
44#include <video/omap-panel-dvi.h> 46#include <video/omap-panel-tfp410.h>
45 47
46#include "hsmmc.h" 48#include "hsmmc.h"
47#include "control.h" 49#include "control.h"
@@ -57,12 +59,21 @@
57#define HDMI_GPIO_HPD 63 /* Hotplug detect */ 59#define HDMI_GPIO_HPD 63 /* Hotplug detect */
58 60
59/* wl127x BT, FM, GPS connectivity chip */ 61/* wl127x BT, FM, GPS connectivity chip */
60static int wl1271_gpios[] = {46, -1, -1}; 62static struct ti_st_plat_data wilink_platform_data = {
63 .nshutdown_gpio = 46,
64 .dev_name = "/dev/ttyO1",
65 .flow_cntrl = 1,
66 .baud_rate = 3000000,
67 .chip_enable = NULL,
68 .suspend = NULL,
69 .resume = NULL,
70};
71
61static struct platform_device wl1271_device = { 72static struct platform_device wl1271_device = {
62 .name = "kim", 73 .name = "kim",
63 .id = -1, 74 .id = -1,
64 .dev = { 75 .dev = {
65 .platform_data = &wl1271_gpios, 76 .platform_data = &wilink_platform_data,
66 }, 77 },
67}; 78};
68 79
@@ -116,6 +127,11 @@ static struct platform_device panda_abe_audio = {
116 }, 127 },
117}; 128};
118 129
130static struct platform_device panda_hdmi_audio_codec = {
131 .name = "hdmi-audio-codec",
132 .id = -1,
133};
134
119static struct platform_device btwilink_device = { 135static struct platform_device btwilink_device = {
120 .name = "btwilink", 136 .name = "btwilink",
121 .id = -1, 137 .id = -1,
@@ -125,6 +141,7 @@ static struct platform_device *panda_devices[] __initdata = {
125 &leds_gpio, 141 &leds_gpio,
126 &wl1271_device, 142 &wl1271_device,
127 &panda_abe_audio, 143 &panda_abe_audio,
144 &panda_hdmi_audio_codec,
128 &btwilink_device, 145 &btwilink_device,
129}; 146};
130 147
@@ -230,61 +247,12 @@ static struct platform_device omap_vwlan_device = {
230 }, 247 },
231}; 248};
232 249
233struct wl12xx_platform_data omap_panda_wlan_data __initdata = { 250static struct wl12xx_platform_data omap_panda_wlan_data __initdata = {
234 /* PANDA ref clock is 38.4 MHz */ 251 /* PANDA ref clock is 38.4 MHz */
235 .board_ref_clock = 2, 252 .board_ref_clock = 2,
236}; 253};
237 254
238static int omap4_twl6030_hsmmc_late_init(struct device *dev) 255static struct twl6040_codec_data twl6040_codec = {
239{
240 int irq = 0;
241 struct platform_device *pdev = container_of(dev,
242 struct platform_device, dev);
243 struct omap_mmc_platform_data *pdata = dev->platform_data;
244
245 if (!pdata) {
246 dev_err(dev, "%s: NULL platform data\n", __func__);
247 return -EINVAL;
248 }
249 /* Setting MMC1 Card detect Irq */
250 if (pdev->id == 0) {
251 irq = twl6030_mmc_card_detect_config();
252 if (irq < 0) {
253 dev_err(dev, "%s: Error card detect config(%d)\n",
254 __func__, irq);
255 return irq;
256 }
257 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
258 }
259 return 0;
260}
261
262static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
263{
264 struct omap_mmc_platform_data *pdata;
265
266 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
267 if (!dev) {
268 pr_err("Failed omap4_twl6030_hsmmc_set_late_init\n");
269 return;
270 }
271 pdata = dev->platform_data;
272
273 pdata->init = omap4_twl6030_hsmmc_late_init;
274}
275
276static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
277{
278 struct omap2_hsmmc_info *c;
279
280 omap_hsmmc_init(controllers);
281 for (c = controllers; c->mmc; c++)
282 omap4_twl6030_hsmmc_set_late_init(&c->pdev->dev);
283
284 return 0;
285}
286
287static struct twl4030_codec_data twl6040_codec = {
288 /* single-step ramp for headset and handsfree */ 256 /* single-step ramp for headset and handsfree */
289 .hs_left_step = 0x0f, 257 .hs_left_step = 0x0f,
290 .hs_right_step = 0x0f, 258 .hs_right_step = 0x0f,
@@ -292,17 +260,14 @@ static struct twl4030_codec_data twl6040_codec = {
292 .hf_right_step = 0x1d, 260 .hf_right_step = 0x1d,
293}; 261};
294 262
295static struct twl4030_audio_data twl6040_audio = { 263static struct twl6040_platform_data twl6040_data = {
296 .codec = &twl6040_codec, 264 .codec = &twl6040_codec,
297 .audpwron_gpio = 127, 265 .audpwron_gpio = 127,
298 .naudint_irq = OMAP44XX_IRQ_SYS_2N,
299 .irq_base = TWL6040_CODEC_IRQ_BASE, 266 .irq_base = TWL6040_CODEC_IRQ_BASE,
300}; 267};
301 268
302/* Panda board uses the common PMIC configuration */ 269/* Panda board uses the common PMIC configuration */
303static struct twl4030_platform_data omap4_panda_twldata = { 270static struct twl4030_platform_data omap4_panda_twldata;
304 .audio = &twl6040_audio,
305};
306 271
307/* 272/*
308 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM 273 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM
@@ -325,8 +290,11 @@ static int __init omap4_panda_i2c_init(void)
325 TWL_COMMON_REGULATOR_VANA | 290 TWL_COMMON_REGULATOR_VANA |
326 TWL_COMMON_REGULATOR_VCXIO | 291 TWL_COMMON_REGULATOR_VCXIO |
327 TWL_COMMON_REGULATOR_VUSB | 292 TWL_COMMON_REGULATOR_VUSB |
328 TWL_COMMON_REGULATOR_CLK32KG); 293 TWL_COMMON_REGULATOR_CLK32KG |
329 omap4_pmic_init("twl6030", &omap4_panda_twldata); 294 TWL_COMMON_REGULATOR_V1V8 |
295 TWL_COMMON_REGULATOR_V2V1);
296 omap4_pmic_init("twl6030", &omap4_panda_twldata,
297 &twl6040_data, OMAP44XX_IRQ_SYS_2N);
330 omap_register_i2c_bus(2, 400, NULL, 0); 298 omap_register_i2c_bus(2, 400, NULL, 0);
331 /* 299 /*
332 * Bus 3 is attached to the DVI port where devices like the pico DLP 300 * Bus 3 is attached to the DVI port where devices like the pico DLP
@@ -421,47 +389,22 @@ static struct omap_board_mux board_mux[] __initdata = {
421/* Display DVI */ 389/* Display DVI */
422#define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0 390#define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0
423 391
424static int omap4_panda_enable_dvi(struct omap_dss_device *dssdev)
425{
426 gpio_set_value(dssdev->reset_gpio, 1);
427 return 0;
428}
429
430static void omap4_panda_disable_dvi(struct omap_dss_device *dssdev)
431{
432 gpio_set_value(dssdev->reset_gpio, 0);
433}
434
435/* Using generic display panel */ 392/* Using generic display panel */
436static struct panel_dvi_platform_data omap4_dvi_panel = { 393static struct tfp410_platform_data omap4_dvi_panel = {
437 .platform_enable = omap4_panda_enable_dvi, 394 .i2c_bus_num = 3,
438 .platform_disable = omap4_panda_disable_dvi, 395 .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
439 .i2c_bus_num = 3,
440}; 396};
441 397
442struct omap_dss_device omap4_panda_dvi_device = { 398static struct omap_dss_device omap4_panda_dvi_device = {
443 .type = OMAP_DISPLAY_TYPE_DPI, 399 .type = OMAP_DISPLAY_TYPE_DPI,
444 .name = "dvi", 400 .name = "dvi",
445 .driver_name = "dvi", 401 .driver_name = "tfp410",
446 .data = &omap4_dvi_panel, 402 .data = &omap4_dvi_panel,
447 .phy.dpi.data_lines = 24, 403 .phy.dpi.data_lines = 24,
448 .reset_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO, 404 .reset_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
449 .channel = OMAP_DSS_CHANNEL_LCD2, 405 .channel = OMAP_DSS_CHANNEL_LCD2,
450}; 406};
451 407
452int __init omap4_panda_dvi_init(void)
453{
454 int r;
455
456 /* Requesting TFP410 DVI GPIO and disabling it, at bootup */
457 r = gpio_request_one(omap4_panda_dvi_device.reset_gpio,
458 GPIOF_OUT_INIT_LOW, "DVI PD");
459 if (r)
460 pr_err("Failed to get DVI powerdown GPIO\n");
461
462 return r;
463}
464
465static struct gpio panda_hdmi_gpios[] = { 408static struct gpio panda_hdmi_gpios[] = {
466 { HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ct_cp_hpd" }, 409 { HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ct_cp_hpd" },
467 { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" }, 410 { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" },
@@ -510,13 +453,8 @@ static struct omap_dss_board_info omap4_panda_dss_data = {
510 .default_device = &omap4_panda_dvi_device, 453 .default_device = &omap4_panda_dvi_device,
511}; 454};
512 455
513void __init omap4_panda_display_init(void) 456static void __init omap4_panda_display_init(void)
514{ 457{
515 int r;
516
517 r = omap4_panda_dvi_init();
518 if (r)
519 pr_err("error initializing panda DVI\n");
520 458
521 omap_display_init(&omap4_panda_dss_data); 459 omap_display_init(&omap4_panda_dss_data);
522 460
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 33aa3910b09e..5527c1979a16 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -46,7 +46,7 @@
46#include "common.h" 46#include "common.h"
47#include <video/omapdss.h> 47#include <video/omapdss.h>
48#include <video/omap-panel-generic-dpi.h> 48#include <video/omap-panel-generic-dpi.h>
49#include <video/omap-panel-dvi.h> 49#include <video/omap-panel-tfp410.h>
50#include <plat/gpmc.h> 50#include <plat/gpmc.h>
51#include <mach/hardware.h> 51#include <mach/hardware.h>
52#include <plat/nand.h> 52#include <plat/nand.h>
@@ -167,32 +167,15 @@ static void __init overo_display_init(void)
167 gpio_export(OVERO_GPIO_LCD_BL, 0); 167 gpio_export(OVERO_GPIO_LCD_BL, 0);
168} 168}
169 169
170static int overo_panel_enable_dvi(struct omap_dss_device *dssdev) 170static struct tfp410_platform_data dvi_panel = {
171{
172 if (lcd_enabled) {
173 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
174 return -EINVAL;
175 }
176 dvi_enabled = 1;
177
178 return 0;
179}
180
181static void overo_panel_disable_dvi(struct omap_dss_device *dssdev)
182{
183 dvi_enabled = 0;
184}
185
186static struct panel_dvi_platform_data dvi_panel = {
187 .platform_enable = overo_panel_enable_dvi,
188 .platform_disable = overo_panel_disable_dvi,
189 .i2c_bus_num = 3, 171 .i2c_bus_num = 3,
172 .power_down_gpio = -1,
190}; 173};
191 174
192static struct omap_dss_device overo_dvi_device = { 175static struct omap_dss_device overo_dvi_device = {
193 .name = "dvi", 176 .name = "dvi",
194 .type = OMAP_DISPLAY_TYPE_DPI, 177 .type = OMAP_DISPLAY_TYPE_DPI,
195 .driver_name = "dvi", 178 .driver_name = "tfp410",
196 .data = &dvi_panel, 179 .data = &dvi_panel,
197 .phy.dpi.data_lines = 24, 180 .phy.dpi.data_lines = 24,
198}; 181};
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index d87ee0612098..ff53deccecab 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -44,6 +44,7 @@
44#include <linux/leds-lp5523.h> 44#include <linux/leds-lp5523.h>
45 45
46#include <../drivers/staging/iio/light/tsl2563.h> 46#include <../drivers/staging/iio/light/tsl2563.h>
47#include <linux/lis3lv02d.h>
47 48
48#include "mux.h" 49#include "mux.h"
49#include "hsmmc.h" 50#include "hsmmc.h"
@@ -63,6 +64,9 @@
63#define RX51_TSC2005_RESET_GPIO 104 64#define RX51_TSC2005_RESET_GPIO 104
64#define RX51_TSC2005_IRQ_GPIO 100 65#define RX51_TSC2005_IRQ_GPIO 100
65 66
67#define LIS302_IRQ1_GPIO 181
68#define LIS302_IRQ2_GPIO 180 /* Not yet in use */
69
66/* list all spi devices here */ 70/* list all spi devices here */
67enum { 71enum {
68 RX51_SPI_WL1251, 72 RX51_SPI_WL1251,
@@ -73,6 +77,77 @@ enum {
73static struct wl12xx_platform_data wl1251_pdata; 77static struct wl12xx_platform_data wl1251_pdata;
74static struct tsc2005_platform_data tsc2005_pdata; 78static struct tsc2005_platform_data tsc2005_pdata;
75 79
80#if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
81static int lis302_setup(void)
82{
83 int err;
84 int irq1 = LIS302_IRQ1_GPIO;
85 int irq2 = LIS302_IRQ2_GPIO;
86
87 /* gpio for interrupt pin 1 */
88 err = gpio_request(irq1, "lis3lv02dl_irq1");
89 if (err) {
90 printk(KERN_ERR "lis3lv02dl: gpio request failed\n");
91 goto out;
92 }
93
94 /* gpio for interrupt pin 2 */
95 err = gpio_request(irq2, "lis3lv02dl_irq2");
96 if (err) {
97 gpio_free(irq1);
98 printk(KERN_ERR "lis3lv02dl: gpio request failed\n");
99 goto out;
100 }
101
102 gpio_direction_input(irq1);
103 gpio_direction_input(irq2);
104
105out:
106 return err;
107}
108
109static int lis302_release(void)
110{
111 gpio_free(LIS302_IRQ1_GPIO);
112 gpio_free(LIS302_IRQ2_GPIO);
113
114 return 0;
115}
116
117static struct lis3lv02d_platform_data rx51_lis3lv02d_data = {
118 .click_flags = LIS3_CLICK_SINGLE_X | LIS3_CLICK_SINGLE_Y |
119 LIS3_CLICK_SINGLE_Z,
120 /* Limits are 0.5g * value */
121 .click_thresh_x = 8,
122 .click_thresh_y = 8,
123 .click_thresh_z = 10,
124 /* Click must be longer than time limit */
125 .click_time_limit = 9,
126 /* Kind of debounce filter */
127 .click_latency = 50,
128
129 /* Limits for all axis. millig-value / 18 to get HW values */
130 .wakeup_flags = LIS3_WAKEUP_X_HI | LIS3_WAKEUP_Y_HI,
131 .wakeup_thresh = 800 / 18,
132 .wakeup_flags2 = LIS3_WAKEUP_Z_HI ,
133 .wakeup_thresh2 = 900 / 18,
134
135 .hipass_ctrl = LIS3_HIPASS1_DISABLE | LIS3_HIPASS2_DISABLE,
136
137 /* Interrupt line 2 for click detection, line 1 for thresholds */
138 .irq_cfg = LIS3_IRQ2_CLICK | LIS3_IRQ1_FF_WU_12,
139
140 .axis_x = LIS3_DEV_X,
141 .axis_y = LIS3_INV_DEV_Y,
142 .axis_z = LIS3_INV_DEV_Z,
143 .setup_resources = lis302_setup,
144 .release_resources = lis302_release,
145 .st_min_limits = {-32, 3, 3},
146 .st_max_limits = {-3, 32, 32},
147 .irq2 = OMAP_GPIO_IRQ(LIS302_IRQ2_GPIO),
148};
149#endif
150
76#if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE) 151#if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE)
77static struct tsl2563_platform_data rx51_tsl2563_platform_data = { 152static struct tsl2563_platform_data rx51_tsl2563_platform_data = {
78 .cover_comp_gain = 16, 153 .cover_comp_gain = 16,
@@ -872,11 +947,11 @@ static struct twl4030_power_data rx51_t2scripts_data __initdata = {
872 .resource_config = twl4030_rconfig, 947 .resource_config = twl4030_rconfig,
873}; 948};
874 949
875struct twl4030_vibra_data rx51_vibra_data __initdata = { 950static struct twl4030_vibra_data rx51_vibra_data __initdata = {
876 .coexist = 0, 951 .coexist = 0,
877}; 952};
878 953
879struct twl4030_audio_data rx51_audio_data __initdata = { 954static struct twl4030_audio_data rx51_audio_data __initdata = {
880 .audio_mclk = 26000000, 955 .audio_mclk = 26000000,
881 .vibra = &rx51_vibra_data, 956 .vibra = &rx51_vibra_data,
882}; 957};
@@ -950,6 +1025,16 @@ static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = {
950 } 1025 }
951}; 1026};
952 1027
1028static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_3[] = {
1029#if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
1030 {
1031 I2C_BOARD_INFO("lis3lv02d", 0x1d),
1032 .platform_data = &rx51_lis3lv02d_data,
1033 .irq = OMAP_GPIO_IRQ(LIS302_IRQ1_GPIO),
1034 },
1035#endif
1036};
1037
953static int __init rx51_i2c_init(void) 1038static int __init rx51_i2c_init(void)
954{ 1039{
955 if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) || 1040 if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) ||
@@ -971,7 +1056,8 @@ static int __init rx51_i2c_init(void)
971 omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata); 1056 omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata);
972 omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2, 1057 omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
973 ARRAY_SIZE(rx51_peripherals_i2c_board_info_2)); 1058 ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
974 omap_register_i2c_bus(3, 400, NULL, 0); 1059 omap_register_i2c_bus(3, 400, rx51_peripherals_i2c_board_info_3,
1060 ARRAY_SIZE(rx51_peripherals_i2c_board_info_3));
975 return 0; 1061 return 0;
976} 1062}
977 1063
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index 27f01f051dff..2da92a6ba40a 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -59,25 +59,24 @@ static struct platform_device leds_gpio = {
59}; 59};
60 60
61/* 61/*
62 * cpuidle C-states definition override from the default values. 62 * cpuidle C-states definition for rx51.
63 * The 'exit_latency' field is the sum of sleep and wake-up latencies. 63 *
64 */ 64 * The 'exit_latency' field is the sum of sleep
65static struct cpuidle_params rx51_cpuidle_params[] = { 65 * and wake-up latencies.
66 /* C1 */ 66
67 {110 + 162, 5 , 1}, 67 ---------------------------------------------
68 /* C2 */ 68 | state | exit_latency | target_residency |
69 {106 + 180, 309, 1}, 69 ---------------------------------------------
70 /* C3 */ 70 | C1 | 110 + 162 | 5 |
71 {107 + 410, 46057, 0}, 71 | C2 | 106 + 180 | 309 |
72 /* C4 */ 72 | C3 | 107 + 410 | 46057 |
73 {121 + 3374, 46057, 0}, 73 | C4 | 121 + 3374 | 46057 |
74 /* C5 */ 74 | C5 | 855 + 1146 | 46057 |
75 {855 + 1146, 46057, 1}, 75 | C6 | 7580 + 4134 | 484329 |
76 /* C6 */ 76 | C7 | 7505 + 15274 | 484329 |
77 {7580 + 4134, 484329, 0}, 77 ---------------------------------------------
78 /* C7 */ 78
79 {7505 + 15274, 484329, 1}, 79*/
80};
81 80
82extern void __init rx51_peripherals_init(void); 81extern void __init rx51_peripherals_init(void);
83 82
@@ -98,7 +97,6 @@ static void __init rx51_init(void)
98 struct omap_sdrc_params *sdrc_params; 97 struct omap_sdrc_params *sdrc_params;
99 98
100 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 99 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
101 omap3_pm_init_cpuidle(rx51_cpuidle_params);
102 omap_serial_init(); 100 omap_serial_init();
103 101
104 sdrc_params = nokia_get_sdram_timings(); 102 sdrc_params = nokia_get_sdram_timings();
diff --git a/arch/arm/mach-omap2/board-zoom-display.c b/arch/arm/mach-omap2/board-zoom-display.c
index a43a765dd092..28187f134fff 100644
--- a/arch/arm/mach-omap2/board-zoom-display.c
+++ b/arch/arm/mach-omap2/board-zoom-display.c
@@ -16,6 +16,7 @@
16#include <linux/spi/spi.h> 16#include <linux/spi/spi.h>
17#include <plat/mcspi.h> 17#include <plat/mcspi.h>
18#include <video/omapdss.h> 18#include <video/omapdss.h>
19#include <mach/board-zoom.h>
19 20
20#define LCD_PANEL_RESET_GPIO_PROD 96 21#define LCD_PANEL_RESET_GPIO_PROD 96
21#define LCD_PANEL_RESET_GPIO_PILOT 55 22#define LCD_PANEL_RESET_GPIO_PILOT 55
diff --git a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
index 7072e0d651b1..3d9d746b221a 100644
--- a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
+++ b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
@@ -165,83 +165,3 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
165 165
166 return 0; 166 return 0;
167} 167}
168
169#ifdef CONFIG_CPU_FREQ
170/*
171 * Walk PRCM rate table and fillout cpufreq freq_table
172 * XXX This should be replaced by an OPP layer in the near future
173 */
174static struct cpufreq_frequency_table *freq_table;
175
176void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
177{
178 const struct prcm_config *prcm;
179 int i = 0;
180 int tbl_sz = 0;
181
182 if (!cpu_is_omap24xx())
183 return;
184
185 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
186 if (!(prcm->flags & cpu_mask))
187 continue;
188 if (prcm->xtal_speed != sclk->rate)
189 continue;
190
191 /* don't put bypass rates in table */
192 if (prcm->dpll_speed == prcm->xtal_speed)
193 continue;
194
195 tbl_sz++;
196 }
197
198 /*
199 * XXX Ensure that we're doing what CPUFreq expects for this error
200 * case and the following one
201 */
202 if (tbl_sz == 0) {
203 pr_warning("%s: no matching entries in rate_table\n",
204 __func__);
205 return;
206 }
207
208 /* Include the CPUFREQ_TABLE_END terminator entry */
209 tbl_sz++;
210
211 freq_table = kzalloc(sizeof(struct cpufreq_frequency_table) * tbl_sz,
212 GFP_ATOMIC);
213 if (!freq_table) {
214 pr_err("%s: could not kzalloc frequency table\n", __func__);
215 return;
216 }
217
218 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
219 if (!(prcm->flags & cpu_mask))
220 continue;
221 if (prcm->xtal_speed != sclk->rate)
222 continue;
223
224 /* don't put bypass rates in table */
225 if (prcm->dpll_speed == prcm->xtal_speed)
226 continue;
227
228 freq_table[i].index = i;
229 freq_table[i].frequency = prcm->mpu_speed / 1000;
230 i++;
231 }
232
233 freq_table[i].index = i;
234 freq_table[i].frequency = CPUFREQ_TABLE_END;
235
236 *table = &freq_table[0];
237}
238
239void omap2_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table)
240{
241 if (!cpu_is_omap24xx())
242 return;
243
244 kfree(freq_table);
245}
246
247#endif
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index f57ed5baeccf..5c4e66542169 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -439,7 +439,7 @@ void omap2_clk_disable_unused(struct clk *clk)
439 clk->ops->disable(clk); 439 clk->ops->disable(clk);
440 } 440 }
441 if (clk->clkdm != NULL) 441 if (clk->clkdm != NULL)
442 pwrdm_clkdm_state_switch(clk->clkdm); 442 pwrdm_state_switch(clk->clkdm->pwrdm.ptr);
443} 443}
444#endif 444#endif
445 445
@@ -536,10 +536,5 @@ struct clk_functions omap2_clk_functions = {
536 .clk_set_rate = omap2_clk_set_rate, 536 .clk_set_rate = omap2_clk_set_rate,
537 .clk_set_parent = omap2_clk_set_parent, 537 .clk_set_parent = omap2_clk_set_parent,
538 .clk_disable_unused = omap2_clk_disable_unused, 538 .clk_disable_unused = omap2_clk_disable_unused,
539#ifdef CONFIG_CPU_FREQ
540 /* These will be removed when the OPP code is integrated */
541 .clk_init_cpufreq_table = omap2_clk_init_cpufreq_table,
542 .clk_exit_cpufreq_table = omap2_clk_exit_cpufreq_table,
543#endif
544}; 539};
545 540
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index b8c2a686481c..a1bb23a23351 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -146,14 +146,6 @@ extern const struct clksel_rate gpt_sys_rates[];
146extern const struct clksel_rate gfx_l3_rates[]; 146extern const struct clksel_rate gfx_l3_rates[];
147extern const struct clksel_rate dsp_ick_rates[]; 147extern const struct clksel_rate dsp_ick_rates[];
148 148
149#if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_CPU_FREQ)
150extern void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
151extern void omap2_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table);
152#else
153#define omap2_clk_init_cpufreq_table 0
154#define omap2_clk_exit_cpufreq_table 0
155#endif
156
157extern const struct clkops clkops_omap2_iclk_dflt_wait; 149extern const struct clkops clkops_omap2_iclk_dflt_wait;
158extern const struct clkops clkops_omap2_iclk_dflt; 150extern const struct clkops clkops_omap2_iclk_dflt;
159extern const struct clkops clkops_omap2_iclk_idle_only; 151extern const struct clkops clkops_omap2_iclk_idle_only;
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index f4a626f7c79e..4e1a3b0e8cc8 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP3 clock data 2 * OMAP3 clock data
3 * 3 *
4 * Copyright (C) 2007-2010 Texas Instruments, Inc. 4 * Copyright (C) 2007-2010, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2011 Nokia Corporation 5 * Copyright (C) 2007-2011 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley 7 * Written by Paul Walmsley
@@ -1640,6 +1640,7 @@ static struct clk hdq_fck = {
1640 .name = "hdq_fck", 1640 .name = "hdq_fck",
1641 .ops = &clkops_omap2_dflt_wait, 1641 .ops = &clkops_omap2_dflt_wait,
1642 .parent = &core_12m_fck, 1642 .parent = &core_12m_fck,
1643 .clkdm_name = "core_l4_clkdm",
1643 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1644 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1644 .enable_bit = OMAP3430_EN_HDQ_SHIFT, 1645 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
1645 .recalc = &followparent_recalc, 1646 .recalc = &followparent_recalc,
@@ -3294,8 +3295,8 @@ static struct omap_clk omap3xxx_clks[] = {
3294 CLK(NULL, "gfx_l3_ick", &gfx_l3_ick, CK_3430ES1), 3295 CLK(NULL, "gfx_l3_ick", &gfx_l3_ick, CK_3430ES1),
3295 CLK(NULL, "gfx_cg1_ck", &gfx_cg1_ck, CK_3430ES1), 3296 CLK(NULL, "gfx_cg1_ck", &gfx_cg1_ck, CK_3430ES1),
3296 CLK(NULL, "gfx_cg2_ck", &gfx_cg2_ck, CK_3430ES1), 3297 CLK(NULL, "gfx_cg2_ck", &gfx_cg2_ck, CK_3430ES1),
3297 CLK(NULL, "sgx_fck", &sgx_fck, CK_3430ES2PLUS | CK_3517 | CK_36XX), 3298 CLK(NULL, "sgx_fck", &sgx_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3298 CLK(NULL, "sgx_ick", &sgx_ick, CK_3430ES2PLUS | CK_3517 | CK_36XX), 3299 CLK(NULL, "sgx_ick", &sgx_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3299 CLK(NULL, "d2d_26m_fck", &d2d_26m_fck, CK_3430ES1), 3300 CLK(NULL, "d2d_26m_fck", &d2d_26m_fck, CK_3430ES1),
3300 CLK(NULL, "modem_fck", &modem_fck, CK_34XX | CK_36XX), 3301 CLK(NULL, "modem_fck", &modem_fck, CK_34XX | CK_36XX),
3301 CLK(NULL, "sad2d_ick", &sad2d_ick, CK_34XX | CK_36XX), 3302 CLK(NULL, "sad2d_ick", &sad2d_ick, CK_34XX | CK_36XX),
@@ -3419,7 +3420,7 @@ static struct omap_clk omap3xxx_clks[] = {
3419 CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX), 3420 CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX),
3420 CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX), 3421 CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX),
3421 CLK(NULL, "uart4_fck", &uart4_fck, CK_36XX), 3422 CLK(NULL, "uart4_fck", &uart4_fck, CK_36XX),
3422 CLK(NULL, "uart4_fck", &uart4_fck_am35xx, CK_3505 | CK_3517), 3423 CLK(NULL, "uart4_fck", &uart4_fck_am35xx, CK_AM35XX),
3423 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_3XXX), 3424 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_3XXX),
3424 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_3XXX), 3425 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_3XXX),
3425 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_3XXX), 3426 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_3XXX),
@@ -3513,21 +3514,9 @@ int __init omap3xxx_clk_init(void)
3513 struct omap_clk *c; 3514 struct omap_clk *c;
3514 u32 cpu_clkflg = 0; 3515 u32 cpu_clkflg = 0;
3515 3516
3516 /* 3517 if (cpu_is_omap3517()) {
3517 * 3505 must be tested before 3517, since 3517 returns true
3518 * for both AM3517 chips and AM3517 family chips, which
3519 * includes 3505. Unfortunately there's no obvious family
3520 * test for 3517/3505 :-(
3521 */
3522 if (cpu_is_omap3505()) {
3523 cpu_mask = RATE_IN_34XX;
3524 cpu_clkflg = CK_3505;
3525 } else if (cpu_is_omap3517()) {
3526 cpu_mask = RATE_IN_34XX;
3527 cpu_clkflg = CK_3517;
3528 } else if (cpu_is_omap3505()) {
3529 cpu_mask = RATE_IN_34XX; 3518 cpu_mask = RATE_IN_34XX;
3530 cpu_clkflg = CK_3505; 3519 cpu_clkflg = CK_AM35XX;
3531 } else if (cpu_is_omap3630()) { 3520 } else if (cpu_is_omap3630()) {
3532 cpu_mask = (RATE_IN_34XX | RATE_IN_36XX); 3521 cpu_mask = (RATE_IN_34XX | RATE_IN_36XX);
3533 cpu_clkflg = CK_36XX; 3522 cpu_clkflg = CK_36XX;
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index fa6ea65ad44b..2172f6603848 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -3355,17 +3355,6 @@ static struct omap_clk omap44xx_clks[] = {
3355 CLK(NULL, "auxclk5_ck", &auxclk5_ck, CK_443X), 3355 CLK(NULL, "auxclk5_ck", &auxclk5_ck, CK_443X),
3356 CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck, CK_443X), 3356 CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck, CK_443X),
3357 CLK(NULL, "gpmc_ck", &dummy_ck, CK_443X), 3357 CLK(NULL, "gpmc_ck", &dummy_ck, CK_443X),
3358 CLK(NULL, "gpt1_ick", &dummy_ck, CK_443X),
3359 CLK(NULL, "gpt2_ick", &dummy_ck, CK_443X),
3360 CLK(NULL, "gpt3_ick", &dummy_ck, CK_443X),
3361 CLK(NULL, "gpt4_ick", &dummy_ck, CK_443X),
3362 CLK(NULL, "gpt5_ick", &dummy_ck, CK_443X),
3363 CLK(NULL, "gpt6_ick", &dummy_ck, CK_443X),
3364 CLK(NULL, "gpt7_ick", &dummy_ck, CK_443X),
3365 CLK(NULL, "gpt8_ick", &dummy_ck, CK_443X),
3366 CLK(NULL, "gpt9_ick", &dummy_ck, CK_443X),
3367 CLK(NULL, "gpt10_ick", &dummy_ck, CK_443X),
3368 CLK(NULL, "gpt11_ick", &dummy_ck, CK_443X),
3369 CLK("omap_i2c.1", "ick", &dummy_ck, CK_443X), 3358 CLK("omap_i2c.1", "ick", &dummy_ck, CK_443X),
3370 CLK("omap_i2c.2", "ick", &dummy_ck, CK_443X), 3359 CLK("omap_i2c.2", "ick", &dummy_ck, CK_443X),
3371 CLK("omap_i2c.3", "ick", &dummy_ck, CK_443X), 3360 CLK("omap_i2c.3", "ick", &dummy_ck, CK_443X),
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index ad07689e1563..8664f5a8bfb6 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -840,7 +840,7 @@ void clkdm_allow_idle(struct clockdomain *clkdm)
840 spin_lock_irqsave(&clkdm->lock, flags); 840 spin_lock_irqsave(&clkdm->lock, flags);
841 clkdm->_flags |= _CLKDM_FLAG_HWSUP_ENABLED; 841 clkdm->_flags |= _CLKDM_FLAG_HWSUP_ENABLED;
842 arch_clkdm->clkdm_allow_idle(clkdm); 842 arch_clkdm->clkdm_allow_idle(clkdm);
843 pwrdm_clkdm_state_switch(clkdm); 843 pwrdm_state_switch(clkdm->pwrdm.ptr);
844 spin_unlock_irqrestore(&clkdm->lock, flags); 844 spin_unlock_irqrestore(&clkdm->lock, flags);
845} 845}
846 846
@@ -924,8 +924,7 @@ static int _clkdm_clk_hwmod_enable(struct clockdomain *clkdm)
924 924
925 spin_lock_irqsave(&clkdm->lock, flags); 925 spin_lock_irqsave(&clkdm->lock, flags);
926 arch_clkdm->clkdm_clk_enable(clkdm); 926 arch_clkdm->clkdm_clk_enable(clkdm);
927 pwrdm_wait_transition(clkdm->pwrdm.ptr); 927 pwrdm_state_switch(clkdm->pwrdm.ptr);
928 pwrdm_clkdm_state_switch(clkdm);
929 spin_unlock_irqrestore(&clkdm->lock, flags); 928 spin_unlock_irqrestore(&clkdm->lock, flags);
930 929
931 pr_debug("clockdomain: clkdm %s: enabled\n", clkdm->name); 930 pr_debug("clockdomain: clkdm %s: enabled\n", clkdm->name);
@@ -950,7 +949,7 @@ static int _clkdm_clk_hwmod_disable(struct clockdomain *clkdm)
950 949
951 spin_lock_irqsave(&clkdm->lock, flags); 950 spin_lock_irqsave(&clkdm->lock, flags);
952 arch_clkdm->clkdm_clk_disable(clkdm); 951 arch_clkdm->clkdm_clk_disable(clkdm);
953 pwrdm_clkdm_state_switch(clkdm); 952 pwrdm_state_switch(clkdm->pwrdm.ptr);
954 spin_unlock_irqrestore(&clkdm->lock, flags); 953 spin_unlock_irqrestore(&clkdm->lock, flags);
955 954
956 pr_debug("clockdomain: clkdm %s: disabled\n", clkdm->name); 955 pr_debug("clockdomain: clkdm %s: disabled\n", clkdm->name);
diff --git a/arch/arm/mach-omap2/clockdomain44xx.c b/arch/arm/mach-omap2/clockdomain44xx.c
index 935c7f03dab9..4f04dd11d655 100644
--- a/arch/arm/mach-omap2/clockdomain44xx.c
+++ b/arch/arm/mach-omap2/clockdomain44xx.c
@@ -51,6 +51,9 @@ static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm)
51 struct clkdm_dep *cd; 51 struct clkdm_dep *cd;
52 u32 mask = 0; 52 u32 mask = 0;
53 53
54 if (!clkdm->prcm_partition)
55 return 0;
56
54 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) { 57 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
55 if (!cd->clkdm) 58 if (!cd->clkdm)
56 continue; /* only happens if data is erroneous */ 59 continue; /* only happens if data is erroneous */
@@ -103,6 +106,9 @@ static int omap4_clkdm_clk_disable(struct clockdomain *clkdm)
103{ 106{
104 bool hwsup = false; 107 bool hwsup = false;
105 108
109 if (!clkdm->prcm_partition)
110 return 0;
111
106 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition, 112 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
107 clkdm->cm_inst, clkdm->clkdm_offs); 113 clkdm->cm_inst, clkdm->clkdm_offs);
108 114
diff --git a/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c b/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
index 0a6a04897d89..839145e1cfbe 100644
--- a/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
+++ b/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
@@ -89,13 +89,3 @@ struct clockdomain wkup_common_clkdm = {
89 .pwrdm = { .name = "wkup_pwrdm" }, 89 .pwrdm = { .name = "wkup_pwrdm" },
90 .dep_bit = OMAP_EN_WKUP_SHIFT, 90 .dep_bit = OMAP_EN_WKUP_SHIFT,
91}; 91};
92
93struct clockdomain prm_common_clkdm = {
94 .name = "prm_clkdm",
95 .pwrdm = { .name = "wkup_pwrdm" },
96};
97
98struct clockdomain cm_common_clkdm = {
99 .name = "cm_clkdm",
100 .pwrdm = { .name = "core_pwrdm" },
101};
diff --git a/arch/arm/mach-omap2/clockdomains3xxx_data.c b/arch/arm/mach-omap2/clockdomains3xxx_data.c
index b84e138d99c8..6038adb97710 100644
--- a/arch/arm/mach-omap2/clockdomains3xxx_data.c
+++ b/arch/arm/mach-omap2/clockdomains3xxx_data.c
@@ -53,9 +53,9 @@
53 * 3430ES2 PM_WKDEP_SGX: adds IVA2, removes CORE 53 * 3430ES2 PM_WKDEP_SGX: adds IVA2, removes CORE
54 */ 54 */
55static struct clkdm_dep gfx_sgx_3xxx_wkdeps[] = { 55static struct clkdm_dep gfx_sgx_3xxx_wkdeps[] = {
56 { .clkdm_name = "iva2_clkdm", }, 56 { .clkdm_name = "iva2_clkdm" },
57 { .clkdm_name = "mpu_clkdm", }, 57 { .clkdm_name = "mpu_clkdm" },
58 { .clkdm_name = "wkup_clkdm", }, 58 { .clkdm_name = "wkup_clkdm" },
59 { NULL }, 59 { NULL },
60}; 60};
61 61
diff --git a/arch/arm/mach-omap2/clockdomains44xx_data.c b/arch/arm/mach-omap2/clockdomains44xx_data.c
index bd7ed13515cc..c53425847493 100644
--- a/arch/arm/mach-omap2/clockdomains44xx_data.c
+++ b/arch/arm/mach-omap2/clockdomains44xx_data.c
@@ -430,6 +430,8 @@ static struct clockdomain *clockdomains_omap44xx[] __initdata = {
430 &l4_wkup_44xx_clkdm, 430 &l4_wkup_44xx_clkdm,
431 &emu_sys_44xx_clkdm, 431 &emu_sys_44xx_clkdm,
432 &l3_dma_44xx_clkdm, 432 &l3_dma_44xx_clkdm,
433 &prm_common_clkdm,
434 &cm_common_clkdm,
433 NULL 435 NULL
434}; 436};
435 437
diff --git a/arch/arm/mach-omap2/clockdomains_common_data.c b/arch/arm/mach-omap2/clockdomains_common_data.c
new file mode 100644
index 000000000000..615b1f04967d
--- /dev/null
+++ b/arch/arm/mach-omap2/clockdomains_common_data.c
@@ -0,0 +1,24 @@
1/*
2 * OMAP2+-common clockdomain data
3 *
4 * Copyright (C) 2008-2012 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 *
7 * Paul Walmsley, Jouni Högander
8 */
9
10#include <linux/kernel.h>
11#include <linux/io.h>
12
13#include "clockdomain.h"
14
15/* These are implicit clockdomains - they are never defined as such in TRM */
16struct clockdomain prm_common_clkdm = {
17 .name = "prm_clkdm",
18 .pwrdm = { .name = "wkup_pwrdm" },
19};
20
21struct clockdomain cm_common_clkdm = {
22 .name = "cm_clkdm",
23 .pwrdm = { .name = "core_pwrdm" },
24};
diff --git a/arch/arm/mach-omap2/cm-regbits-34xx.h b/arch/arm/mach-omap2/cm-regbits-34xx.h
index b91275908f33..8083a8cdc55f 100644
--- a/arch/arm/mach-omap2/cm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-34xx.h
@@ -79,7 +79,7 @@
79 79
80/* CM_CLKSEL1_PLL_IVA2 */ 80/* CM_CLKSEL1_PLL_IVA2 */
81#define OMAP3430_IVA2_CLK_SRC_SHIFT 19 81#define OMAP3430_IVA2_CLK_SRC_SHIFT 19
82#define OMAP3430_IVA2_CLK_SRC_MASK (0x3 << 19) 82#define OMAP3430_IVA2_CLK_SRC_MASK (0x7 << 19)
83#define OMAP3430_IVA2_DPLL_MULT_SHIFT 8 83#define OMAP3430_IVA2_DPLL_MULT_SHIFT 8
84#define OMAP3430_IVA2_DPLL_MULT_MASK (0x7ff << 8) 84#define OMAP3430_IVA2_DPLL_MULT_MASK (0x7ff << 8)
85#define OMAP3430_IVA2_DPLL_DIV_SHIFT 0 85#define OMAP3430_IVA2_DPLL_DIV_SHIFT 0
@@ -124,7 +124,7 @@
124 124
125/* CM_CLKSEL1_PLL_MPU */ 125/* CM_CLKSEL1_PLL_MPU */
126#define OMAP3430_MPU_CLK_SRC_SHIFT 19 126#define OMAP3430_MPU_CLK_SRC_SHIFT 19
127#define OMAP3430_MPU_CLK_SRC_MASK (0x3 << 19) 127#define OMAP3430_MPU_CLK_SRC_MASK (0x7 << 19)
128#define OMAP3430_MPU_DPLL_MULT_SHIFT 8 128#define OMAP3430_MPU_DPLL_MULT_SHIFT 8
129#define OMAP3430_MPU_DPLL_MULT_MASK (0x7ff << 8) 129#define OMAP3430_MPU_DPLL_MULT_MASK (0x7ff << 8)
130#define OMAP3430_MPU_DPLL_DIV_SHIFT 0 130#define OMAP3430_MPU_DPLL_DIV_SHIFT 0
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index bd8810c3753f..8c86d294b1a3 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -32,6 +32,7 @@
32#include "prcm44xx.h" 32#include "prcm44xx.h"
33#include "prm44xx.h" 33#include "prm44xx.h"
34#include "prcm_mpu44xx.h" 34#include "prcm_mpu44xx.h"
35#include "prcm-common.h"
35 36
36/* 37/*
37 * CLKCTRL_IDLEST_*: possible values for the CM_*_CLKCTRL.IDLEST bitfield: 38 * CLKCTRL_IDLEST_*: possible values for the CM_*_CLKCTRL.IDLEST bitfield:
@@ -49,14 +50,21 @@
49#define CLKCTRL_IDLEST_INTERFACE_IDLE 0x2 50#define CLKCTRL_IDLEST_INTERFACE_IDLE 0x2
50#define CLKCTRL_IDLEST_DISABLED 0x3 51#define CLKCTRL_IDLEST_DISABLED 0x3
51 52
52static u32 _cm_bases[OMAP4_MAX_PRCM_PARTITIONS] = { 53static void __iomem *_cm_bases[OMAP4_MAX_PRCM_PARTITIONS];
53 [OMAP4430_INVALID_PRCM_PARTITION] = 0, 54
54 [OMAP4430_PRM_PARTITION] = OMAP4430_PRM_BASE, 55/**
55 [OMAP4430_CM1_PARTITION] = OMAP4430_CM1_BASE, 56 * omap_cm_base_init - Populates the cm partitions
56 [OMAP4430_CM2_PARTITION] = OMAP4430_CM2_BASE, 57 *
57 [OMAP4430_SCRM_PARTITION] = 0, 58 * Populates the base addresses of the _cm_bases
58 [OMAP4430_PRCM_MPU_PARTITION] = OMAP4430_PRCM_MPU_BASE, 59 * array used for read/write of cm module registers.
59}; 60 */
61void omap_cm_base_init(void)
62{
63 _cm_bases[OMAP4430_PRM_PARTITION] = prm_base;
64 _cm_bases[OMAP4430_CM1_PARTITION] = cm_base;
65 _cm_bases[OMAP4430_CM2_PARTITION] = cm2_base;
66 _cm_bases[OMAP4430_PRCM_MPU_PARTITION] = prcm_mpu_base;
67}
60 68
61/* Private functions */ 69/* Private functions */
62 70
@@ -106,7 +114,7 @@ u32 omap4_cminst_read_inst_reg(u8 part, s16 inst, u16 idx)
106 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || 114 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
107 part == OMAP4430_INVALID_PRCM_PARTITION || 115 part == OMAP4430_INVALID_PRCM_PARTITION ||
108 !_cm_bases[part]); 116 !_cm_bases[part]);
109 return __raw_readl(OMAP2_L4_IO_ADDRESS(_cm_bases[part] + inst + idx)); 117 return __raw_readl(_cm_bases[part] + inst + idx);
110} 118}
111 119
112/* Write into a register in a CM instance */ 120/* Write into a register in a CM instance */
@@ -115,7 +123,7 @@ void omap4_cminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx)
115 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || 123 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
116 part == OMAP4430_INVALID_PRCM_PARTITION || 124 part == OMAP4430_INVALID_PRCM_PARTITION ||
117 !_cm_bases[part]); 125 !_cm_bases[part]);
118 __raw_writel(val, OMAP2_L4_IO_ADDRESS(_cm_bases[part] + inst + idx)); 126 __raw_writel(val, _cm_bases[part] + inst + idx);
119} 127}
120 128
121/* Read-modify-write a register in CM1. Caller must lock */ 129/* Read-modify-write a register in CM1. Caller must lock */
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
index 1549c11000d3..8a6953a34fe2 100644
--- a/arch/arm/mach-omap2/common.c
+++ b/arch/arm/mach-omap2/common.c
@@ -166,6 +166,7 @@ static struct omap_globals omap4_globals = {
166 .prm = OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE), 166 .prm = OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
167 .cm = OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE), 167 .cm = OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
168 .cm2 = OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE), 168 .cm2 = OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
169 .prcm_mpu = OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE),
169}; 170};
170 171
171void __init omap2_set_globals_443x(void) 172void __init omap2_set_globals_443x(void)
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 57da7f406e28..d6c9e6180318 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -27,6 +27,7 @@
27#ifndef __ASSEMBLER__ 27#ifndef __ASSEMBLER__
28 28
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/i2c/twl.h>
30#include <plat/common.h> 31#include <plat/common.h>
31#include <asm/proc-fns.h> 32#include <asm/proc-fns.h>
32 33
@@ -111,6 +112,7 @@ struct omap_globals {
111 void __iomem *prm; /* Power and Reset Management */ 112 void __iomem *prm; /* Power and Reset Management */
112 void __iomem *cm; /* Clock Management */ 113 void __iomem *cm; /* Clock Management */
113 void __iomem *cm2; 114 void __iomem *cm2;
115 void __iomem *prcm_mpu;
114}; 116};
115 117
116void omap2_set_globals_242x(void); 118void omap2_set_globals_242x(void);
@@ -134,8 +136,6 @@ void omap4_map_io(void);
134void ti81xx_map_io(void); 136void ti81xx_map_io(void);
135void omap_barriers_init(void); 137void omap_barriers_init(void);
136 138
137extern void __init omap_init_consistent_dma_size(void);
138
139/** 139/**
140 * omap_test_timeout - busy-loop, testing a condition 140 * omap_test_timeout - busy-loop, testing a condition
141 * @cond: condition to test until it evaluates to true 141 * @cond: condition to test until it evaluates to true
@@ -254,6 +254,8 @@ static inline u32 omap4_mpuss_read_prev_context_state(void)
254struct omap_sdrc_params; 254struct omap_sdrc_params;
255extern void omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0, 255extern void omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
256 struct omap_sdrc_params *sdrc_cs1); 256 struct omap_sdrc_params *sdrc_cs1);
257struct omap2_hsmmc_info;
258extern int omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers);
257 259
258#endif /* __ASSEMBLER__ */ 260#endif /* __ASSEMBLER__ */
259#endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */ 261#endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index 535866489ce3..207bc1c7759f 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -38,40 +38,44 @@
38 38
39#ifdef CONFIG_CPU_IDLE 39#ifdef CONFIG_CPU_IDLE
40 40
41/*
42 * The latencies/thresholds for various C states have
43 * to be configured from the respective board files.
44 * These are some default values (which might not provide
45 * the best power savings) used on boards which do not
46 * pass these details from the board file.
47 */
48static struct cpuidle_params cpuidle_params_table[] = {
49 /* C1 */
50 {2 + 2, 5, 1},
51 /* C2 */
52 {10 + 10, 30, 1},
53 /* C3 */
54 {50 + 50, 300, 1},
55 /* C4 */
56 {1500 + 1800, 4000, 1},
57 /* C5 */
58 {2500 + 7500, 12000, 1},
59 /* C6 */
60 {3000 + 8500, 15000, 1},
61 /* C7 */
62 {10000 + 30000, 300000, 1},
63};
64#define OMAP3_NUM_STATES ARRAY_SIZE(cpuidle_params_table)
65
66/* Mach specific information to be recorded in the C-state driver_data */ 41/* Mach specific information to be recorded in the C-state driver_data */
67struct omap3_idle_statedata { 42struct omap3_idle_statedata {
68 u32 mpu_state; 43 u32 mpu_state;
69 u32 core_state; 44 u32 core_state;
70 u8 valid;
71}; 45};
72struct omap3_idle_statedata omap3_idle_data[OMAP3_NUM_STATES];
73 46
74struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd; 47static struct omap3_idle_statedata omap3_idle_data[] = {
48 {
49 .mpu_state = PWRDM_POWER_ON,
50 .core_state = PWRDM_POWER_ON,
51 },
52 {
53 .mpu_state = PWRDM_POWER_ON,
54 .core_state = PWRDM_POWER_ON,
55 },
56 {
57 .mpu_state = PWRDM_POWER_RET,
58 .core_state = PWRDM_POWER_ON,
59 },
60 {
61 .mpu_state = PWRDM_POWER_OFF,
62 .core_state = PWRDM_POWER_ON,
63 },
64 {
65 .mpu_state = PWRDM_POWER_RET,
66 .core_state = PWRDM_POWER_RET,
67 },
68 {
69 .mpu_state = PWRDM_POWER_OFF,
70 .core_state = PWRDM_POWER_RET,
71 },
72 {
73 .mpu_state = PWRDM_POWER_OFF,
74 .core_state = PWRDM_POWER_OFF,
75 },
76};
77
78static struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd;
75 79
76static int _cpuidle_allow_idle(struct powerdomain *pwrdm, 80static int _cpuidle_allow_idle(struct powerdomain *pwrdm,
77 struct clockdomain *clkdm) 81 struct clockdomain *clkdm)
@@ -91,8 +95,7 @@ static int __omap3_enter_idle(struct cpuidle_device *dev,
91 struct cpuidle_driver *drv, 95 struct cpuidle_driver *drv,
92 int index) 96 int index)
93{ 97{
94 struct omap3_idle_statedata *cx = 98 struct omap3_idle_statedata *cx = &omap3_idle_data[index];
95 cpuidle_get_statedata(&dev->states_usage[index]);
96 u32 mpu_state = cx->mpu_state, core_state = cx->core_state; 99 u32 mpu_state = cx->mpu_state, core_state = cx->core_state;
97 100
98 local_fiq_disable(); 101 local_fiq_disable();
@@ -169,14 +172,12 @@ static inline int omap3_enter_idle(struct cpuidle_device *dev,
169 * if it satisfies the enable_off_mode condition. 172 * if it satisfies the enable_off_mode condition.
170 */ 173 */
171static int next_valid_state(struct cpuidle_device *dev, 174static int next_valid_state(struct cpuidle_device *dev,
172 struct cpuidle_driver *drv, 175 struct cpuidle_driver *drv, int index)
173 int index)
174{ 176{
175 struct cpuidle_state_usage *curr_usage = &dev->states_usage[index]; 177 struct omap3_idle_statedata *cx = &omap3_idle_data[index];
176 struct cpuidle_state *curr = &drv->states[index];
177 struct omap3_idle_statedata *cx = cpuidle_get_statedata(curr_usage);
178 u32 mpu_deepest_state = PWRDM_POWER_RET; 178 u32 mpu_deepest_state = PWRDM_POWER_RET;
179 u32 core_deepest_state = PWRDM_POWER_RET; 179 u32 core_deepest_state = PWRDM_POWER_RET;
180 int idx;
180 int next_index = -1; 181 int next_index = -1;
181 182
182 if (enable_off_mode) { 183 if (enable_off_mode) {
@@ -191,45 +192,29 @@ static int next_valid_state(struct cpuidle_device *dev,
191 } 192 }
192 193
193 /* Check if current state is valid */ 194 /* Check if current state is valid */
194 if ((cx->valid) && 195 if ((cx->mpu_state >= mpu_deepest_state) &&
195 (cx->mpu_state >= mpu_deepest_state) && 196 (cx->core_state >= core_deepest_state))
196 (cx->core_state >= core_deepest_state)) {
197 return index; 197 return index;
198 } else {
199 int idx = OMAP3_NUM_STATES - 1;
200
201 /* Reach the current state starting at highest C-state */
202 for (; idx >= 0; idx--) {
203 if (&drv->states[idx] == curr) {
204 next_index = idx;
205 break;
206 }
207 }
208
209 /* Should never hit this condition */
210 WARN_ON(next_index == -1);
211 198
212 /* 199 /*
213 * Drop to next valid state. 200 * Drop to next valid state.
214 * Start search from the next (lower) state. 201 * Start search from the next (lower) state.
215 */ 202 */
216 idx--; 203 for (idx = index - 1; idx >= 0; idx--) {
217 for (; idx >= 0; idx--) { 204 cx = &omap3_idle_data[idx];
218 cx = cpuidle_get_statedata(&dev->states_usage[idx]); 205 if ((cx->mpu_state >= mpu_deepest_state) &&
219 if ((cx->valid) && 206 (cx->core_state >= core_deepest_state)) {
220 (cx->mpu_state >= mpu_deepest_state) && 207 next_index = idx;
221 (cx->core_state >= core_deepest_state)) { 208 break;
222 next_index = idx;
223 break;
224 }
225 } 209 }
226 /*
227 * C1 is always valid.
228 * So, no need to check for 'next_index == -1' outside
229 * this loop.
230 */
231 } 210 }
232 211
212 /*
213 * C1 is always valid.
214 * So, no need to check for 'next_index == -1' outside
215 * this loop.
216 */
217
233 return next_index; 218 return next_index;
234} 219}
235 220
@@ -273,7 +258,7 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev,
273 * Prevent PER off if CORE is not in retention or off as this 258 * Prevent PER off if CORE is not in retention or off as this
274 * would disable PER wakeups completely. 259 * would disable PER wakeups completely.
275 */ 260 */
276 cx = cpuidle_get_statedata(&dev->states_usage[index]); 261 cx = &omap3_idle_data[index];
277 core_next_state = cx->core_state; 262 core_next_state = cx->core_state;
278 per_next_state = per_saved_state = pwrdm_read_next_pwrst(per_pd); 263 per_next_state = per_saved_state = pwrdm_read_next_pwrst(per_pd);
279 if ((per_next_state == PWRDM_POWER_OFF) && 264 if ((per_next_state == PWRDM_POWER_OFF) &&
@@ -298,57 +283,71 @@ select_state:
298 283
299DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev); 284DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev);
300 285
301void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params)
302{
303 int i;
304
305 if (!cpuidle_board_params)
306 return;
307
308 for (i = 0; i < OMAP3_NUM_STATES; i++) {
309 cpuidle_params_table[i].valid = cpuidle_board_params[i].valid;
310 cpuidle_params_table[i].exit_latency =
311 cpuidle_board_params[i].exit_latency;
312 cpuidle_params_table[i].target_residency =
313 cpuidle_board_params[i].target_residency;
314 }
315 return;
316}
317
318struct cpuidle_driver omap3_idle_driver = { 286struct cpuidle_driver omap3_idle_driver = {
319 .name = "omap3_idle", 287 .name = "omap3_idle",
320 .owner = THIS_MODULE, 288 .owner = THIS_MODULE,
289 .states = {
290 {
291 .enter = omap3_enter_idle,
292 .exit_latency = 2 + 2,
293 .target_residency = 5,
294 .flags = CPUIDLE_FLAG_TIME_VALID,
295 .name = "C1",
296 .desc = "MPU ON + CORE ON",
297 },
298 {
299 .enter = omap3_enter_idle_bm,
300 .exit_latency = 10 + 10,
301 .target_residency = 30,
302 .flags = CPUIDLE_FLAG_TIME_VALID,
303 .name = "C2",
304 .desc = "MPU ON + CORE ON",
305 },
306 {
307 .enter = omap3_enter_idle_bm,
308 .exit_latency = 50 + 50,
309 .target_residency = 300,
310 .flags = CPUIDLE_FLAG_TIME_VALID,
311 .name = "C3",
312 .desc = "MPU RET + CORE ON",
313 },
314 {
315 .enter = omap3_enter_idle_bm,
316 .exit_latency = 1500 + 1800,
317 .target_residency = 4000,
318 .flags = CPUIDLE_FLAG_TIME_VALID,
319 .name = "C4",
320 .desc = "MPU OFF + CORE ON",
321 },
322 {
323 .enter = omap3_enter_idle_bm,
324 .exit_latency = 2500 + 7500,
325 .target_residency = 12000,
326 .flags = CPUIDLE_FLAG_TIME_VALID,
327 .name = "C5",
328 .desc = "MPU RET + CORE RET",
329 },
330 {
331 .enter = omap3_enter_idle_bm,
332 .exit_latency = 3000 + 8500,
333 .target_residency = 15000,
334 .flags = CPUIDLE_FLAG_TIME_VALID,
335 .name = "C6",
336 .desc = "MPU OFF + CORE RET",
337 },
338 {
339 .enter = omap3_enter_idle_bm,
340 .exit_latency = 10000 + 30000,
341 .target_residency = 30000,
342 .flags = CPUIDLE_FLAG_TIME_VALID,
343 .name = "C7",
344 .desc = "MPU OFF + CORE OFF",
345 },
346 },
347 .state_count = ARRAY_SIZE(omap3_idle_data),
348 .safe_state_index = 0,
321}; 349};
322 350
323/* Helper to fill the C-state common data*/
324static inline void _fill_cstate(struct cpuidle_driver *drv,
325 int idx, const char *descr)
326{
327 struct cpuidle_state *state = &drv->states[idx];
328
329 state->exit_latency = cpuidle_params_table[idx].exit_latency;
330 state->target_residency = cpuidle_params_table[idx].target_residency;
331 state->flags = CPUIDLE_FLAG_TIME_VALID;
332 state->enter = omap3_enter_idle_bm;
333 sprintf(state->name, "C%d", idx + 1);
334 strncpy(state->desc, descr, CPUIDLE_DESC_LEN);
335
336}
337
338/* Helper to register the driver_data */
339static inline struct omap3_idle_statedata *_fill_cstate_usage(
340 struct cpuidle_device *dev,
341 int idx)
342{
343 struct omap3_idle_statedata *cx = &omap3_idle_data[idx];
344 struct cpuidle_state_usage *state_usage = &dev->states_usage[idx];
345
346 cx->valid = cpuidle_params_table[idx].valid;
347 cpuidle_set_statedata(state_usage, cx);
348
349 return cx;
350}
351
352/** 351/**
353 * omap3_idle_init - Init routine for OMAP3 idle 352 * omap3_idle_init - Init routine for OMAP3 idle
354 * 353 *
@@ -358,77 +357,20 @@ static inline struct omap3_idle_statedata *_fill_cstate_usage(
358int __init omap3_idle_init(void) 357int __init omap3_idle_init(void)
359{ 358{
360 struct cpuidle_device *dev; 359 struct cpuidle_device *dev;
361 struct cpuidle_driver *drv = &omap3_idle_driver;
362 struct omap3_idle_statedata *cx;
363 360
364 mpu_pd = pwrdm_lookup("mpu_pwrdm"); 361 mpu_pd = pwrdm_lookup("mpu_pwrdm");
365 core_pd = pwrdm_lookup("core_pwrdm"); 362 core_pd = pwrdm_lookup("core_pwrdm");
366 per_pd = pwrdm_lookup("per_pwrdm"); 363 per_pd = pwrdm_lookup("per_pwrdm");
367 cam_pd = pwrdm_lookup("cam_pwrdm"); 364 cam_pd = pwrdm_lookup("cam_pwrdm");
368 365
366 if (!mpu_pd || !core_pd || !per_pd || !cam_pd)
367 return -ENODEV;
369 368
370 drv->safe_state_index = -1;
371 dev = &per_cpu(omap3_idle_dev, smp_processor_id());
372
373 /* C1 . MPU WFI + Core active */
374 _fill_cstate(drv, 0, "MPU ON + CORE ON");
375 (&drv->states[0])->enter = omap3_enter_idle;
376 drv->safe_state_index = 0;
377 cx = _fill_cstate_usage(dev, 0);
378 cx->valid = 1; /* C1 is always valid */
379 cx->mpu_state = PWRDM_POWER_ON;
380 cx->core_state = PWRDM_POWER_ON;
381
382 /* C2 . MPU WFI + Core inactive */
383 _fill_cstate(drv, 1, "MPU ON + CORE ON");
384 cx = _fill_cstate_usage(dev, 1);
385 cx->mpu_state = PWRDM_POWER_ON;
386 cx->core_state = PWRDM_POWER_ON;
387
388 /* C3 . MPU CSWR + Core inactive */
389 _fill_cstate(drv, 2, "MPU RET + CORE ON");
390 cx = _fill_cstate_usage(dev, 2);
391 cx->mpu_state = PWRDM_POWER_RET;
392 cx->core_state = PWRDM_POWER_ON;
393
394 /* C4 . MPU OFF + Core inactive */
395 _fill_cstate(drv, 3, "MPU OFF + CORE ON");
396 cx = _fill_cstate_usage(dev, 3);
397 cx->mpu_state = PWRDM_POWER_OFF;
398 cx->core_state = PWRDM_POWER_ON;
399
400 /* C5 . MPU RET + Core RET */
401 _fill_cstate(drv, 4, "MPU RET + CORE RET");
402 cx = _fill_cstate_usage(dev, 4);
403 cx->mpu_state = PWRDM_POWER_RET;
404 cx->core_state = PWRDM_POWER_RET;
405
406 /* C6 . MPU OFF + Core RET */
407 _fill_cstate(drv, 5, "MPU OFF + CORE RET");
408 cx = _fill_cstate_usage(dev, 5);
409 cx->mpu_state = PWRDM_POWER_OFF;
410 cx->core_state = PWRDM_POWER_RET;
411
412 /* C7 . MPU OFF + Core OFF */
413 _fill_cstate(drv, 6, "MPU OFF + CORE OFF");
414 cx = _fill_cstate_usage(dev, 6);
415 /*
416 * Erratum i583: implementation for ES rev < Es1.2 on 3630. We cannot
417 * enable OFF mode in a stable form for previous revisions.
418 * We disable C7 state as a result.
419 */
420 if (IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583)) {
421 cx->valid = 0;
422 pr_warn("%s: core off state C7 disabled due to i583\n",
423 __func__);
424 }
425 cx->mpu_state = PWRDM_POWER_OFF;
426 cx->core_state = PWRDM_POWER_OFF;
427
428 drv->state_count = OMAP3_NUM_STATES;
429 cpuidle_register_driver(&omap3_idle_driver); 369 cpuidle_register_driver(&omap3_idle_driver);
430 370
431 dev->state_count = OMAP3_NUM_STATES; 371 dev = &per_cpu(omap3_idle_dev, smp_processor_id());
372 dev->cpu = 0;
373
432 if (cpuidle_register_device(dev)) { 374 if (cpuidle_register_device(dev)) {
433 printk(KERN_ERR "%s: CPUidle register device failed\n", 375 printk(KERN_ERR "%s: CPUidle register device failed\n",
434 __func__); 376 __func__);
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c
index f386cbe9c889..be1617ca84bd 100644
--- a/arch/arm/mach-omap2/cpuidle44xx.c
+++ b/arch/arm/mach-omap2/cpuidle44xx.c
@@ -24,26 +24,31 @@
24 24
25#ifdef CONFIG_CPU_IDLE 25#ifdef CONFIG_CPU_IDLE
26 26
27/* Machine specific information to be recorded in the C-state driver_data */ 27/* Machine specific information */
28struct omap4_idle_statedata { 28struct omap4_idle_statedata {
29 u32 cpu_state; 29 u32 cpu_state;
30 u32 mpu_logic_state; 30 u32 mpu_logic_state;
31 u32 mpu_state; 31 u32 mpu_state;
32 u8 valid;
33}; 32};
34 33
35static struct cpuidle_params cpuidle_params_table[] = { 34static struct omap4_idle_statedata omap4_idle_data[] = {
36 /* C1 - CPU0 ON + CPU1 ON + MPU ON */ 35 {
37 {.exit_latency = 2 + 2 , .target_residency = 5, .valid = 1}, 36 .cpu_state = PWRDM_POWER_ON,
38 /* C2- CPU0 OFF + CPU1 OFF + MPU CSWR */ 37 .mpu_state = PWRDM_POWER_ON,
39 {.exit_latency = 328 + 440 , .target_residency = 960, .valid = 1}, 38 .mpu_logic_state = PWRDM_POWER_RET,
40 /* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */ 39 },
41 {.exit_latency = 460 + 518 , .target_residency = 1100, .valid = 1}, 40 {
41 .cpu_state = PWRDM_POWER_OFF,
42 .mpu_state = PWRDM_POWER_RET,
43 .mpu_logic_state = PWRDM_POWER_RET,
44 },
45 {
46 .cpu_state = PWRDM_POWER_OFF,
47 .mpu_state = PWRDM_POWER_RET,
48 .mpu_logic_state = PWRDM_POWER_OFF,
49 },
42}; 50};
43 51
44#define OMAP4_NUM_STATES ARRAY_SIZE(cpuidle_params_table)
45
46struct omap4_idle_statedata omap4_idle_data[OMAP4_NUM_STATES];
47static struct powerdomain *mpu_pd, *cpu0_pd, *cpu1_pd; 52static struct powerdomain *mpu_pd, *cpu0_pd, *cpu1_pd;
48 53
49/** 54/**
@@ -60,8 +65,7 @@ static int omap4_enter_idle(struct cpuidle_device *dev,
60 struct cpuidle_driver *drv, 65 struct cpuidle_driver *drv,
61 int index) 66 int index)
62{ 67{
63 struct omap4_idle_statedata *cx = 68 struct omap4_idle_statedata *cx = &omap4_idle_data[index];
64 cpuidle_get_statedata(&dev->states_usage[index]);
65 u32 cpu1_state; 69 u32 cpu1_state;
66 int cpu_id = smp_processor_id(); 70 int cpu_id = smp_processor_id();
67 71
@@ -78,7 +82,7 @@ static int omap4_enter_idle(struct cpuidle_device *dev,
78 cpu1_state = pwrdm_read_pwrst(cpu1_pd); 82 cpu1_state = pwrdm_read_pwrst(cpu1_pd);
79 if (cpu1_state != PWRDM_POWER_OFF) { 83 if (cpu1_state != PWRDM_POWER_OFF) {
80 index = drv->safe_state_index; 84 index = drv->safe_state_index;
81 cx = cpuidle_get_statedata(&dev->states_usage[index]); 85 cx = &omap4_idle_data[index];
82 } 86 }
83 87
84 if (index > 0) 88 if (index > 0)
@@ -133,36 +137,39 @@ struct cpuidle_driver omap4_idle_driver = {
133 .name = "omap4_idle", 137 .name = "omap4_idle",
134 .owner = THIS_MODULE, 138 .owner = THIS_MODULE,
135 .en_core_tk_irqen = 1, 139 .en_core_tk_irqen = 1,
140 .states = {
141 {
142 /* C1 - CPU0 ON + CPU1 ON + MPU ON */
143 .exit_latency = 2 + 2,
144 .target_residency = 5,
145 .flags = CPUIDLE_FLAG_TIME_VALID,
146 .enter = omap4_enter_idle,
147 .name = "C1",
148 .desc = "MPUSS ON"
149 },
150 {
151 /* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */
152 .exit_latency = 328 + 440,
153 .target_residency = 960,
154 .flags = CPUIDLE_FLAG_TIME_VALID,
155 .enter = omap4_enter_idle,
156 .name = "C2",
157 .desc = "MPUSS CSWR",
158 },
159 {
160 /* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */
161 .exit_latency = 460 + 518,
162 .target_residency = 1100,
163 .flags = CPUIDLE_FLAG_TIME_VALID,
164 .enter = omap4_enter_idle,
165 .name = "C3",
166 .desc = "MPUSS OSWR",
167 },
168 },
169 .state_count = ARRAY_SIZE(omap4_idle_data),
170 .safe_state_index = 0,
136}; 171};
137 172
138static inline void _fill_cstate(struct cpuidle_driver *drv,
139 int idx, const char *descr)
140{
141 struct cpuidle_state *state = &drv->states[idx];
142
143 state->exit_latency = cpuidle_params_table[idx].exit_latency;
144 state->target_residency = cpuidle_params_table[idx].target_residency;
145 state->flags = CPUIDLE_FLAG_TIME_VALID;
146 state->enter = omap4_enter_idle;
147 sprintf(state->name, "C%d", idx + 1);
148 strncpy(state->desc, descr, CPUIDLE_DESC_LEN);
149}
150
151static inline struct omap4_idle_statedata *_fill_cstate_usage(
152 struct cpuidle_device *dev,
153 int idx)
154{
155 struct omap4_idle_statedata *cx = &omap4_idle_data[idx];
156 struct cpuidle_state_usage *state_usage = &dev->states_usage[idx];
157
158 cx->valid = cpuidle_params_table[idx].valid;
159 cpuidle_set_statedata(state_usage, cx);
160
161 return cx;
162}
163
164
165
166/** 173/**
167 * omap4_idle_init - Init routine for OMAP4 idle 174 * omap4_idle_init - Init routine for OMAP4 idle
168 * 175 *
@@ -171,9 +178,7 @@ static inline struct omap4_idle_statedata *_fill_cstate_usage(
171 */ 178 */
172int __init omap4_idle_init(void) 179int __init omap4_idle_init(void)
173{ 180{
174 struct omap4_idle_statedata *cx;
175 struct cpuidle_device *dev; 181 struct cpuidle_device *dev;
176 struct cpuidle_driver *drv = &omap4_idle_driver;
177 unsigned int cpu_id = 0; 182 unsigned int cpu_id = 0;
178 183
179 mpu_pd = pwrdm_lookup("mpu_pwrdm"); 184 mpu_pd = pwrdm_lookup("mpu_pwrdm");
@@ -182,42 +187,15 @@ int __init omap4_idle_init(void)
182 if ((!mpu_pd) || (!cpu0_pd) || (!cpu1_pd)) 187 if ((!mpu_pd) || (!cpu0_pd) || (!cpu1_pd))
183 return -ENODEV; 188 return -ENODEV;
184 189
185
186 drv->safe_state_index = -1;
187 dev = &per_cpu(omap4_idle_dev, cpu_id); 190 dev = &per_cpu(omap4_idle_dev, cpu_id);
188 dev->cpu = cpu_id; 191 dev->cpu = cpu_id;
189 192
190 /* C1 - CPU0 ON + CPU1 ON + MPU ON */
191 _fill_cstate(drv, 0, "MPUSS ON");
192 drv->safe_state_index = 0;
193 cx = _fill_cstate_usage(dev, 0);
194 cx->valid = 1; /* C1 is always valid */
195 cx->cpu_state = PWRDM_POWER_ON;
196 cx->mpu_state = PWRDM_POWER_ON;
197 cx->mpu_logic_state = PWRDM_POWER_RET;
198
199 /* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */
200 _fill_cstate(drv, 1, "MPUSS CSWR");
201 cx = _fill_cstate_usage(dev, 1);
202 cx->cpu_state = PWRDM_POWER_OFF;
203 cx->mpu_state = PWRDM_POWER_RET;
204 cx->mpu_logic_state = PWRDM_POWER_RET;
205
206 /* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */
207 _fill_cstate(drv, 2, "MPUSS OSWR");
208 cx = _fill_cstate_usage(dev, 2);
209 cx->cpu_state = PWRDM_POWER_OFF;
210 cx->mpu_state = PWRDM_POWER_RET;
211 cx->mpu_logic_state = PWRDM_POWER_OFF;
212
213 drv->state_count = OMAP4_NUM_STATES;
214 cpuidle_register_driver(&omap4_idle_driver); 193 cpuidle_register_driver(&omap4_idle_driver);
215 194
216 dev->state_count = OMAP4_NUM_STATES;
217 if (cpuidle_register_device(dev)) { 195 if (cpuidle_register_device(dev)) {
218 pr_err("%s: CPUidle register device failed\n", __func__); 196 pr_err("%s: CPUidle register device failed\n", __func__);
219 return -EIO; 197 return -EIO;
220 } 198 }
221 199
222 return 0; 200 return 0;
223} 201}
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index e4336035c0ea..ae62ece04ef9 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -42,7 +42,6 @@
42 42
43static int __init omap3_l3_init(void) 43static int __init omap3_l3_init(void)
44{ 44{
45 int l;
46 struct omap_hwmod *oh; 45 struct omap_hwmod *oh;
47 struct platform_device *pdev; 46 struct platform_device *pdev;
48 char oh_name[L3_MODULES_MAX_LEN]; 47 char oh_name[L3_MODULES_MAX_LEN];
@@ -54,7 +53,7 @@ static int __init omap3_l3_init(void)
54 if (!(cpu_is_omap34xx())) 53 if (!(cpu_is_omap34xx()))
55 return -ENODEV; 54 return -ENODEV;
56 55
57 l = snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main"); 56 snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main");
58 57
59 oh = omap_hwmod_lookup(oh_name); 58 oh = omap_hwmod_lookup(oh_name);
60 59
@@ -72,7 +71,7 @@ postcore_initcall(omap3_l3_init);
72 71
73static int __init omap4_l3_init(void) 72static int __init omap4_l3_init(void)
74{ 73{
75 int l, i; 74 int i;
76 struct omap_hwmod *oh[3]; 75 struct omap_hwmod *oh[3];
77 struct platform_device *pdev; 76 struct platform_device *pdev;
78 char oh_name[L3_MODULES_MAX_LEN]; 77 char oh_name[L3_MODULES_MAX_LEN];
@@ -89,7 +88,7 @@ static int __init omap4_l3_init(void)
89 return -ENODEV; 88 return -ENODEV;
90 89
91 for (i = 0; i < L3_MODULES; i++) { 90 for (i = 0; i < L3_MODULES; i++) {
92 l = snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main_%d", i+1); 91 snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main_%d", i+1);
93 92
94 oh[i] = omap_hwmod_lookup(oh_name); 93 oh[i] = omap_hwmod_lookup(oh_name);
95 if (!(oh[i])) 94 if (!(oh[i]))
@@ -355,6 +354,36 @@ static void __init omap_init_dmic(void)
355static inline void omap_init_dmic(void) {} 354static inline void omap_init_dmic(void) {}
356#endif 355#endif
357 356
357#if defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI) || \
358 defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI_MODULE)
359
360static struct platform_device omap_hdmi_audio = {
361 .name = "omap-hdmi-audio",
362 .id = -1,
363};
364
365static void __init omap_init_hdmi_audio(void)
366{
367 struct omap_hwmod *oh;
368 struct platform_device *pdev;
369
370 oh = omap_hwmod_lookup("dss_hdmi");
371 if (!oh) {
372 printk(KERN_ERR "Could not look up dss_hdmi hw_mod\n");
373 return;
374 }
375
376 pdev = omap_device_build("omap-hdmi-audio-dai",
377 -1, oh, NULL, 0, NULL, 0, 0);
378 WARN(IS_ERR(pdev),
379 "Can't build omap_device for omap-hdmi-audio-dai.\n");
380
381 platform_device_register(&omap_hdmi_audio);
382}
383#else
384static inline void omap_init_hdmi_audio(void) {}
385#endif
386
358#if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE) 387#if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
359 388
360#include <plat/mcspi.h> 389#include <plat/mcspi.h>
@@ -701,11 +730,15 @@ static int __init omap2_init_devices(void)
701 * in alphabetical order so they're easier to sort through. 730 * in alphabetical order so they're easier to sort through.
702 */ 731 */
703 omap_init_audio(); 732 omap_init_audio();
704 omap_init_mcpdm();
705 omap_init_dmic();
706 omap_init_camera(); 733 omap_init_camera();
734 omap_init_hdmi_audio();
707 omap_init_mbox(); 735 omap_init_mbox();
708 omap_init_mcspi(); 736 /* If dtb is there, the devices will be created dynamically */
737 if (!of_have_populated_dt()) {
738 omap_init_dmic();
739 omap_init_mcpdm();
740 omap_init_mcspi();
741 }
709 omap_init_pmu(); 742 omap_init_pmu();
710 omap_hdq_init(); 743 omap_hdq_init();
711 omap_init_sti(); 744 omap_init_sti();
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index fc56745676fa..f0f10beeffe8 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -142,7 +142,8 @@ static int _omap3_noncore_dpll_lock(struct clk *clk)
142 142
143 ai = omap3_dpll_autoidle_read(clk); 143 ai = omap3_dpll_autoidle_read(clk);
144 144
145 omap3_dpll_deny_idle(clk); 145 if (ai)
146 omap3_dpll_deny_idle(clk);
146 147
147 _omap3_dpll_write_clken(clk, DPLL_LOCKED); 148 _omap3_dpll_write_clken(clk, DPLL_LOCKED);
148 149
@@ -186,8 +187,6 @@ static int _omap3_noncore_dpll_bypass(struct clk *clk)
186 187
187 if (ai) 188 if (ai)
188 omap3_dpll_allow_idle(clk); 189 omap3_dpll_allow_idle(clk);
189 else
190 omap3_dpll_deny_idle(clk);
191 190
192 return r; 191 return r;
193} 192}
@@ -216,8 +215,6 @@ static int _omap3_noncore_dpll_stop(struct clk *clk)
216 215
217 if (ai) 216 if (ai)
218 omap3_dpll_allow_idle(clk); 217 omap3_dpll_allow_idle(clk);
219 else
220 omap3_dpll_deny_idle(clk);
221 218
222 return 0; 219 return 0;
223} 220}
@@ -519,6 +516,9 @@ u32 omap3_dpll_autoidle_read(struct clk *clk)
519 516
520 dd = clk->dpll_data; 517 dd = clk->dpll_data;
521 518
519 if (!dd->autoidle_reg)
520 return -EINVAL;
521
522 v = __raw_readl(dd->autoidle_reg); 522 v = __raw_readl(dd->autoidle_reg);
523 v &= dd->autoidle_mask; 523 v &= dd->autoidle_mask;
524 v >>= __ffs(dd->autoidle_mask); 524 v >>= __ffs(dd->autoidle_mask);
@@ -545,6 +545,12 @@ void omap3_dpll_allow_idle(struct clk *clk)
545 545
546 dd = clk->dpll_data; 546 dd = clk->dpll_data;
547 547
548 if (!dd->autoidle_reg) {
549 pr_debug("clock: DPLL %s: autoidle not supported\n",
550 clk->name);
551 return;
552 }
553
548 /* 554 /*
549 * REVISIT: CORE DPLL can optionally enter low-power bypass 555 * REVISIT: CORE DPLL can optionally enter low-power bypass
550 * by writing 0x5 instead of 0x1. Add some mechanism to 556 * by writing 0x5 instead of 0x1. Add some mechanism to
@@ -554,6 +560,7 @@ void omap3_dpll_allow_idle(struct clk *clk)
554 v &= ~dd->autoidle_mask; 560 v &= ~dd->autoidle_mask;
555 v |= DPLL_AUTOIDLE_LOW_POWER_STOP << __ffs(dd->autoidle_mask); 561 v |= DPLL_AUTOIDLE_LOW_POWER_STOP << __ffs(dd->autoidle_mask);
556 __raw_writel(v, dd->autoidle_reg); 562 __raw_writel(v, dd->autoidle_reg);
563
557} 564}
558 565
559/** 566/**
@@ -572,6 +579,12 @@ void omap3_dpll_deny_idle(struct clk *clk)
572 579
573 dd = clk->dpll_data; 580 dd = clk->dpll_data;
574 581
582 if (!dd->autoidle_reg) {
583 pr_debug("clock: DPLL %s: autoidle not supported\n",
584 clk->name);
585 return;
586 }
587
575 v = __raw_readl(dd->autoidle_reg); 588 v = __raw_readl(dd->autoidle_reg);
576 v &= ~dd->autoidle_mask; 589 v &= ~dd->autoidle_mask;
577 v |= DPLL_AUTOIDLE_DISABLE << __ffs(dd->autoidle_mask); 590 v |= DPLL_AUTOIDLE_DISABLE << __ffs(dd->autoidle_mask);
diff --git a/arch/arm/mach-omap2/dsp.c b/arch/arm/mach-omap2/dsp.c
index 74f18f2952df..3376388b317a 100644
--- a/arch/arm/mach-omap2/dsp.c
+++ b/arch/arm/mach-omap2/dsp.c
@@ -57,8 +57,9 @@ static int __init omap_dsp_init(void)
57 57
58 if (pdata->phys_mempool_base) { 58 if (pdata->phys_mempool_base) {
59 pdata->phys_mempool_size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE; 59 pdata->phys_mempool_size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
60 pr_info("%s: %x bytes @ %x\n", __func__, 60 pr_info("%s: %llx bytes @ %llx\n", __func__,
61 pdata->phys_mempool_size, pdata->phys_mempool_base); 61 (unsigned long long)pdata->phys_mempool_size,
62 (unsigned long long)pdata->phys_mempool_base);
62 } 63 }
63 64
64 pdev = platform_device_alloc("omap-dsp", -1); 65 pdev = platform_device_alloc("omap-dsp", -1);
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 2f994e5194e8..a80e093b039f 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -20,6 +20,7 @@
20#include <linux/err.h> 20#include <linux/err.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/of.h>
23 24
24#include <plat/omap_hwmod.h> 25#include <plat/omap_hwmod.h>
25#include <plat/omap_device.h> 26#include <plat/omap_device.h>
@@ -58,7 +59,7 @@ static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
58 pdata->virtual_irq_start = IH_GPIO_BASE + 32 * (id - 1); 59 pdata->virtual_irq_start = IH_GPIO_BASE + 32 * (id - 1);
59 pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count; 60 pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
60 pdata->regs = kzalloc(sizeof(struct omap_gpio_reg_offs), GFP_KERNEL); 61 pdata->regs = kzalloc(sizeof(struct omap_gpio_reg_offs), GFP_KERNEL);
61 if (!pdata) { 62 if (!pdata->regs) {
62 pr_err("gpio%d: Memory allocation failed\n", id); 63 pr_err("gpio%d: Memory allocation failed\n", id);
63 return -ENOMEM; 64 return -ENOMEM;
64 } 65 }
@@ -146,7 +147,10 @@ static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
146 */ 147 */
147static int __init omap2_gpio_init(void) 148static int __init omap2_gpio_init(void)
148{ 149{
149 return omap_hwmod_for_each_by_class("gpio", omap2_gpio_dev_init, 150 /* If dtb is there, the devices will be created dynamically */
150 NULL); 151 if (of_have_populated_dt())
152 return -ENODEV;
153
154 return omap_hwmod_for_each_by_class("gpio", omap2_gpio_dev_init, NULL);
151} 155}
152postcore_initcall(omap2_gpio_init); 156postcore_initcall(omap2_gpio_init);
diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c
index 385b3e02c4a6..a0fa9bb2bda5 100644
--- a/arch/arm/mach-omap2/gpmc-onenand.c
+++ b/arch/arm/mach-omap2/gpmc-onenand.c
@@ -176,7 +176,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
176 const int t_wpl = 40; 176 const int t_wpl = 40;
177 const int t_wph = 30; 177 const int t_wph = 30;
178 int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo; 178 int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo;
179 int tick_ns, div, fclk_offset_ns, fclk_offset, gpmc_clk_ns, latency; 179 int div, fclk_offset_ns, fclk_offset, gpmc_clk_ns, latency;
180 int first_time = 0, hf = 0, vhf = 0, sync_read = 0, sync_write = 0; 180 int first_time = 0, hf = 0, vhf = 0, sync_read = 0, sync_write = 0;
181 int err, ticks_cez; 181 int err, ticks_cez;
182 int cs = cfg->cs, freq = *freq_ptr; 182 int cs = cfg->cs, freq = *freq_ptr;
@@ -240,7 +240,6 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
240 break; 240 break;
241 } 241 }
242 242
243 tick_ns = gpmc_ticks_to_ns(1);
244 div = gpmc_cs_calc_divider(cs, min_gpmc_clk_period); 243 div = gpmc_cs_calc_divider(cs, min_gpmc_clk_period);
245 gpmc_clk_ns = gpmc_ticks_to_ns(div); 244 gpmc_clk_ns = gpmc_ticks_to_ns(div);
246 if (gpmc_clk_ns < 15) /* >66Mhz */ 245 if (gpmc_clk_ns < 15) /* >66Mhz */
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 00d510858e28..580e684e8825 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -755,8 +755,7 @@ static int __init gpmc_init(void)
755 irq++; 755 irq++;
756 } 756 }
757 757
758 ret = request_irq(gpmc_irq, 758 ret = request_irq(gpmc_irq, gpmc_handle_irq, IRQF_SHARED, "gpmc", NULL);
759 gpmc_handle_irq, IRQF_SHARED, "gpmc", gpmc_base);
760 if (ret) 759 if (ret)
761 pr_err("gpmc: irq-%d could not claim: err %d\n", 760 pr_err("gpmc: irq-%d could not claim: err %d\n",
762 gpmc_irq, ret); 761 gpmc_irq, ret);
diff --git a/arch/arm/mach-omap2/hdq1w.c b/arch/arm/mach-omap2/hdq1w.c
new file mode 100644
index 000000000000..297ebe03f09c
--- /dev/null
+++ b/arch/arm/mach-omap2/hdq1w.c
@@ -0,0 +1,72 @@
1/*
2 * IP block integration code for the HDQ1W/1-wire IP block
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley
6 *
7 * Based on the I2C reset code in arch/arm/mach-omap2/i2c.c by
8 * Avinash.H.M <avinashhm@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * version 2 as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22 * 02110-1301 USA
23 */
24
25#include <plat/omap_hwmod.h>
26#include <plat/hdq1w.h>
27
28#include "common.h"
29
30/* Maximum microseconds to wait for OMAP module to softreset */
31#define MAX_MODULE_SOFTRESET_WAIT 10000
32
33/**
34 * omap_hdq1w_reset - reset the OMAP HDQ1W module
35 * @oh: struct omap_hwmod *
36 *
37 * OCP soft reset the HDQ1W IP block. Section 20.6.1.4 "HDQ1W/1-Wire
38 * Software Reset" of the OMAP34xx Technical Reference Manual Revision
39 * ZR (SWPU223R) does not include the rather important fact that, for
40 * the reset to succeed, the HDQ1W module's internal clock gate must be
41 * programmed to allow the clock to propagate to the rest of the
42 * module. In this sense, it's rather similar to the I2C custom reset
43 * function. Returns 0.
44 */
45int omap_hdq1w_reset(struct omap_hwmod *oh)
46{
47 u32 v;
48 int c = 0;
49
50 /* Write to the SOFTRESET bit */
51 omap_hwmod_softreset(oh);
52
53 /* Enable the module's internal clocks */
54 v = omap_hwmod_read(oh, HDQ_CTRL_STATUS_OFFSET);
55 v |= 1 << HDQ_CTRL_STATUS_CLOCKENABLE_SHIFT;
56 omap_hwmod_write(v, oh, HDQ_CTRL_STATUS_OFFSET);
57
58 /* Poll on RESETDONE bit */
59 omap_test_timeout((omap_hwmod_read(oh,
60 oh->class->sysc->syss_offs)
61 & SYSS_RESETDONE_MASK),
62 MAX_MODULE_SOFTRESET_WAIT, c);
63
64 if (c == MAX_MODULE_SOFTRESET_WAIT)
65 pr_warning("%s: %s: softreset failed (waited %d usec)\n",
66 __func__, oh->name, MAX_MODULE_SOFTRESET_WAIT);
67 else
68 pr_debug("%s: %s: softreset in %d usec\n", __func__,
69 oh->name, c);
70
71 return 0;
72}
diff --git a/arch/arm/mach-omap2/hwspinlock.c b/arch/arm/mach-omap2/hwspinlock.c
index 454dfce125ca..8763c8520dc2 100644
--- a/arch/arm/mach-omap2/hwspinlock.c
+++ b/arch/arm/mach-omap2/hwspinlock.c
@@ -28,7 +28,7 @@ static struct hwspinlock_pdata omap_hwspinlock_pdata __initdata = {
28 .base_id = 0, 28 .base_id = 0,
29}; 29};
30 30
31int __init hwspinlocks_init(void) 31static int __init hwspinlocks_init(void)
32{ 32{
33 int retval = 0; 33 int retval = 0;
34 struct omap_hwmod *oh; 34 struct omap_hwmod *oh;
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 0e79b7bc6aa4..f1398171d8a2 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -478,9 +478,12 @@ void __init omap4xxx_check_revision(void)
478 case 0xb94e: 478 case 0xb94e:
479 switch (rev) { 479 switch (rev) {
480 case 0: 480 case 0:
481 default:
482 omap_revision = OMAP4460_REV_ES1_0; 481 omap_revision = OMAP4460_REV_ES1_0;
483 break; 482 break;
483 case 2:
484 default:
485 omap_revision = OMAP4460_REV_ES1_1;
486 break;
484 } 487 }
485 break; 488 break;
486 case 0xb975: 489 case 0xb975:
diff --git a/arch/arm/mach-omap2/include/mach/ctrl_module_pad_core_44xx.h b/arch/arm/mach-omap2/include/mach/ctrl_module_pad_core_44xx.h
index 1e2d3322f33e..c88420de1151 100644
--- a/arch/arm/mach-omap2/include/mach/ctrl_module_pad_core_44xx.h
+++ b/arch/arm/mach-omap2/include/mach/ctrl_module_pad_core_44xx.h
@@ -941,10 +941,10 @@
941#define OMAP4_DSI2_LANEENABLE_MASK (0x7 << 29) 941#define OMAP4_DSI2_LANEENABLE_MASK (0x7 << 29)
942#define OMAP4_DSI1_LANEENABLE_SHIFT 24 942#define OMAP4_DSI1_LANEENABLE_SHIFT 24
943#define OMAP4_DSI1_LANEENABLE_MASK (0x1f << 24) 943#define OMAP4_DSI1_LANEENABLE_MASK (0x1f << 24)
944#define OMAP4_DSI2_PIPD_SHIFT 19 944#define OMAP4_DSI1_PIPD_SHIFT 19
945#define OMAP4_DSI2_PIPD_MASK (0x1f << 19) 945#define OMAP4_DSI1_PIPD_MASK (0x1f << 19)
946#define OMAP4_DSI1_PIPD_SHIFT 14 946#define OMAP4_DSI2_PIPD_SHIFT 14
947#define OMAP4_DSI1_PIPD_MASK (0x1f << 14) 947#define OMAP4_DSI2_PIPD_MASK (0x1f << 14)
948 948
949/* CONTROL_MCBSPLP */ 949/* CONTROL_MCBSPLP */
950#define OMAP4_ALBCTRLRX_FSX_SHIFT 31 950#define OMAP4_ALBCTRLRX_FSX_SHIFT 31
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 065bd768987c..4b9491aa36fa 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -31,6 +31,7 @@
31#include <plat/omap-pm.h> 31#include <plat/omap-pm.h>
32#include <plat/omap_hwmod.h> 32#include <plat/omap_hwmod.h>
33#include <plat/multi.h> 33#include <plat/multi.h>
34#include <plat/dma.h>
34 35
35#include "iomap.h" 36#include "iomap.h"
36#include "voltage.h" 37#include "voltage.h"
@@ -363,24 +364,6 @@ static void __init omap_hwmod_init_postsetup(void)
363#endif 364#endif
364 omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state); 365 omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state);
365 366
366 /*
367 * Set the default postsetup state for unusual modules (like
368 * MPU WDT).
369 *
370 * The postsetup_state is not actually used until
371 * omap_hwmod_late_init(), so boards that desire full watchdog
372 * coverage of kernel initialization can reprogram the
373 * postsetup_state between the calls to
374 * omap2_init_common_infra() and omap_sdrc_init().
375 *
376 * XXX ideally we could detect whether the MPU WDT was currently
377 * enabled here and make this conditional
378 */
379 postsetup_state = _HWMOD_STATE_DISABLED;
380 omap_hwmod_for_each_by_class("wd_timer",
381 _set_hwmod_postsetup_state,
382 &postsetup_state);
383
384 omap_pm_if_early_init(); 367 omap_pm_if_early_init();
385} 368}
386 369
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 65f0d2571c9a..1ecf54565fe2 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -25,6 +25,7 @@
25#include <mach/hardware.h> 25#include <mach/hardware.h>
26 26
27#include "iomap.h" 27#include "iomap.h"
28#include "common.h"
28 29
29/* selected INTC register offsets */ 30/* selected INTC register offsets */
30 31
@@ -149,7 +150,6 @@ omap_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
149 ct->chip.irq_mask = irq_gc_mask_disable_reg; 150 ct->chip.irq_mask = irq_gc_mask_disable_reg;
150 ct->chip.irq_unmask = irq_gc_unmask_enable_reg; 151 ct->chip.irq_unmask = irq_gc_unmask_enable_reg;
151 152
152 ct->regs.ack = INTC_CONTROL;
153 ct->regs.enable = INTC_MIR_CLEAR0; 153 ct->regs.enable = INTC_MIR_CLEAR0;
154 ct->regs.disable = INTC_MIR_SET0; 154 ct->regs.disable = INTC_MIR_SET0;
155 irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE, 155 irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE,
@@ -231,7 +231,7 @@ static inline void omap_intc_handle_irq(void __iomem *base_addr, struct pt_regs
231 goto out; 231 goto out;
232 232
233 irqnr = readl_relaxed(base_addr + 0xd8); 233 irqnr = readl_relaxed(base_addr + 0xd8);
234#ifdef CONFIG_SOC_OMAPTI816X 234#ifdef CONFIG_SOC_OMAPTI81XX
235 if (irqnr) 235 if (irqnr)
236 goto out; 236 goto out;
237 irqnr = readl_relaxed(base_addr + 0xf8); 237 irqnr = readl_relaxed(base_addr + 0xf8);
@@ -334,7 +334,7 @@ void omap_intc_restore_context(void)
334void omap3_intc_suspend(void) 334void omap3_intc_suspend(void)
335{ 335{
336 /* A pending interrupt would prevent OMAP from entering suspend */ 336 /* A pending interrupt would prevent OMAP from entering suspend */
337 omap_ack_irq(0); 337 omap_ack_irq(NULL);
338} 338}
339 339
340void omap3_intc_prepare_idle(void) 340void omap3_intc_prepare_idle(void)
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 415a6f1cf419..19b8b6774862 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -26,9 +26,9 @@
26#define MAILBOX_IRQSTATUS(u) (0x100 + 8 * (u)) 26#define MAILBOX_IRQSTATUS(u) (0x100 + 8 * (u))
27#define MAILBOX_IRQENABLE(u) (0x104 + 8 * (u)) 27#define MAILBOX_IRQENABLE(u) (0x104 + 8 * (u))
28 28
29#define OMAP4_MAILBOX_IRQSTATUS(u) (0x104 + 10 * (u)) 29#define OMAP4_MAILBOX_IRQSTATUS(u) (0x104 + 0x10 * (u))
30#define OMAP4_MAILBOX_IRQENABLE(u) (0x108 + 10 * (u)) 30#define OMAP4_MAILBOX_IRQENABLE(u) (0x108 + 0x10 * (u))
31#define OMAP4_MAILBOX_IRQENABLE_CLR(u) (0x10c + 10 * (u)) 31#define OMAP4_MAILBOX_IRQENABLE_CLR(u) (0x10c + 0x10 * (u))
32 32
33#define MAILBOX_IRQ_NEWMSG(m) (1 << (2 * (m))) 33#define MAILBOX_IRQ_NEWMSG(m) (1 << (2 * (m)))
34#define MAILBOX_IRQ_NOTFULL(m) (1 << (2 * (m) + 1)) 34#define MAILBOX_IRQ_NOTFULL(m) (1 << (2 * (m) + 1))
diff --git a/arch/arm/mach-omap2/msdi.c b/arch/arm/mach-omap2/msdi.c
new file mode 100644
index 000000000000..ef2a6924731a
--- /dev/null
+++ b/arch/arm/mach-omap2/msdi.c
@@ -0,0 +1,88 @@
1/*
2 * MSDI IP block reset
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 *
21 * XXX What about pad muxing?
22 */
23
24#include <linux/kernel.h>
25
26#include <plat/omap_hwmod.h>
27#include <plat/mmc.h>
28
29#include "common.h"
30
31/*
32 * MSDI_CON_OFFSET: offset in bytes of the MSDI IP block's CON register
33 * from the IP block's base address
34 */
35#define MSDI_CON_OFFSET 0x0c
36
37/* Register bitfields in the CON register */
38#define MSDI_CON_POW_MASK BIT(11)
39#define MSDI_CON_CLKD_MASK (0x3f << 0)
40#define MSDI_CON_CLKD_SHIFT 0
41
42/* Maximum microseconds to wait for OMAP module to softreset */
43#define MAX_MODULE_SOFTRESET_WAIT 10000
44
45/* MSDI_TARGET_RESET_CLKD: clock divisor to use throughout the reset */
46#define MSDI_TARGET_RESET_CLKD 0x3ff
47
48/**
49 * omap_msdi_reset - reset the MSDI IP block
50 * @oh: struct omap_hwmod *
51 *
52 * The MSDI IP block on OMAP2420 has to have both the POW and CLKD
53 * fields set inside its CON register for a reset to complete
54 * successfully. This is not documented in the TRM. For CLKD, we use
55 * the value that results in the lowest possible clock rate, to attempt
56 * to avoid disturbing any cards.
57 */
58int omap_msdi_reset(struct omap_hwmod *oh)
59{
60 u16 v = 0;
61 int c = 0;
62
63 /* Write to the SOFTRESET bit */
64 omap_hwmod_softreset(oh);
65
66 /* Enable the MSDI core and internal clock */
67 v |= MSDI_CON_POW_MASK;
68 v |= MSDI_TARGET_RESET_CLKD << MSDI_CON_CLKD_SHIFT;
69 omap_hwmod_write(v, oh, MSDI_CON_OFFSET);
70
71 /* Poll on RESETDONE bit */
72 omap_test_timeout((omap_hwmod_read(oh, oh->class->sysc->syss_offs)
73 & SYSS_RESETDONE_MASK),
74 MAX_MODULE_SOFTRESET_WAIT, c);
75
76 if (c == MAX_MODULE_SOFTRESET_WAIT)
77 pr_warning("%s: %s: softreset failed (waited %d usec)\n",
78 __func__, oh->name, MAX_MODULE_SOFTRESET_WAIT);
79 else
80 pr_debug("%s: %s: softreset in %d usec\n", __func__,
81 oh->name, c);
82
83 /* Disable the MSDI internal clock */
84 v &= ~MSDI_CON_CLKD_MASK;
85 omap_hwmod_write(v, oh, MSDI_CON_OFFSET);
86
87 return 0;
88}
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 65c33911341f..3268ee24eada 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -247,7 +247,7 @@ int __init omap_mux_init_signal(const char *muxname, int val)
247 int mux_mode; 247 int mux_mode;
248 248
249 mux_mode = omap_mux_get_by_name(muxname, &partition, &mux); 249 mux_mode = omap_mux_get_by_name(muxname, &partition, &mux);
250 if (mux_mode < 0) 250 if (mux_mode < 0 || !mux)
251 return mux_mode; 251 return mux_mode;
252 252
253 old_mode = omap_mux_read(partition, mux->reg_offset); 253 old_mode = omap_mux_read(partition, mux->reg_offset);
diff --git a/arch/arm/mach-omap2/omap-secure.c b/arch/arm/mach-omap2/omap-secure.c
index d8f8ef40290f..d9ae4a53d818 100644
--- a/arch/arm/mach-omap2/omap-secure.c
+++ b/arch/arm/mach-omap2/omap-secure.c
@@ -18,6 +18,7 @@
18#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
19#include <asm/memblock.h> 19#include <asm/memblock.h>
20 20
21#include <plat/omap-secure.h>
21#include <mach/omap-secure.h> 22#include <mach/omap-secure.h>
22 23
23static phys_addr_t omap_secure_memblock_base; 24static phys_addr_t omap_secure_memblock_base;
diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c
index 42cd7fb52414..d811c7790350 100644
--- a/arch/arm/mach-omap2/omap-wakeupgen.c
+++ b/arch/arm/mach-omap2/omap-wakeupgen.c
@@ -259,7 +259,7 @@ static void irq_save_context(void)
259/* 259/*
260 * Clear WakeupGen SAR backup status. 260 * Clear WakeupGen SAR backup status.
261 */ 261 */
262void irq_sar_clear(void) 262static void irq_sar_clear(void)
263{ 263{
264 u32 val; 264 u32 val;
265 val = __raw_readl(sar_base + SAR_BACKUP_STATUS_OFFSET); 265 val = __raw_readl(sar_base + SAR_BACKUP_STATUS_OFFSET);
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index 70de277f5c15..a8161e5f3204 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -25,11 +25,13 @@
25#include <plat/irqs.h> 25#include <plat/irqs.h>
26#include <plat/sram.h> 26#include <plat/sram.h>
27#include <plat/omap-secure.h> 27#include <plat/omap-secure.h>
28#include <plat/mmc.h>
28 29
29#include <mach/hardware.h> 30#include <mach/hardware.h>
30#include <mach/omap-wakeupgen.h> 31#include <mach/omap-wakeupgen.h>
31 32
32#include "common.h" 33#include "common.h"
34#include "hsmmc.h"
33#include "omap4-sar-layout.h" 35#include "omap4-sar-layout.h"
34#include <linux/export.h> 36#include <linux/export.h>
35 37
@@ -207,3 +209,59 @@ static int __init omap4_sar_ram_init(void)
207 return 0; 209 return 0;
208} 210}
209early_initcall(omap4_sar_ram_init); 211early_initcall(omap4_sar_ram_init);
212
213#if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
214static int omap4_twl6030_hsmmc_late_init(struct device *dev)
215{
216 int irq = 0;
217 struct platform_device *pdev = container_of(dev,
218 struct platform_device, dev);
219 struct omap_mmc_platform_data *pdata = dev->platform_data;
220
221 /* Setting MMC1 Card detect Irq */
222 if (pdev->id == 0) {
223 irq = twl6030_mmc_card_detect_config();
224 if (irq < 0) {
225 dev_err(dev, "%s: Error card detect config(%d)\n",
226 __func__, irq);
227 return irq;
228 }
229 pdata->slots[0].card_detect_irq = irq;
230 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
231 }
232 return 0;
233}
234
235static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
236{
237 struct omap_mmc_platform_data *pdata;
238
239 /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
240 if (!dev) {
241 pr_err("Failed %s\n", __func__);
242 return;
243 }
244 pdata = dev->platform_data;
245 pdata->init = omap4_twl6030_hsmmc_late_init;
246}
247
248int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
249{
250 struct omap2_hsmmc_info *c;
251
252 omap_hsmmc_init(controllers);
253 for (c = controllers; c->mmc; c++) {
254 /* pdev can be null if CONFIG_MMC_OMAP_HS is not set */
255 if (!c->pdev)
256 continue;
257 omap4_twl6030_hsmmc_set_late_init(&c->pdev->dev);
258 }
259
260 return 0;
261}
262#else
263int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
264{
265 return 0;
266}
267#endif
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 2c27fdb61e66..bf86f7e8f91f 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2,7 +2,7 @@
2 * omap_hwmod implementation for OMAP2/3/4 2 * omap_hwmod implementation for OMAP2/3/4
3 * 3 *
4 * Copyright (C) 2009-2011 Nokia Corporation 4 * Copyright (C) 2009-2011 Nokia Corporation
5 * Copyright (C) 2011 Texas Instruments, Inc. 5 * Copyright (C) 2011-2012 Texas Instruments, Inc.
6 * 6 *
7 * Paul Walmsley, Benoît Cousson, Kevin Hilman 7 * Paul Walmsley, Benoît Cousson, Kevin Hilman
8 * 8 *
@@ -137,6 +137,7 @@
137#include <linux/mutex.h> 137#include <linux/mutex.h>
138#include <linux/spinlock.h> 138#include <linux/spinlock.h>
139#include <linux/slab.h> 139#include <linux/slab.h>
140#include <linux/bootmem.h>
140 141
141#include "common.h" 142#include "common.h"
142#include <plat/cpu.h> 143#include <plat/cpu.h>
@@ -159,16 +160,58 @@
159/* Name of the OMAP hwmod for the MPU */ 160/* Name of the OMAP hwmod for the MPU */
160#define MPU_INITIATOR_NAME "mpu" 161#define MPU_INITIATOR_NAME "mpu"
161 162
163/*
164 * Number of struct omap_hwmod_link records per struct
165 * omap_hwmod_ocp_if record (master->slave and slave->master)
166 */
167#define LINKS_PER_OCP_IF 2
168
162/* omap_hwmod_list contains all registered struct omap_hwmods */ 169/* omap_hwmod_list contains all registered struct omap_hwmods */
163static LIST_HEAD(omap_hwmod_list); 170static LIST_HEAD(omap_hwmod_list);
164 171
165/* mpu_oh: used to add/remove MPU initiator from sleepdep list */ 172/* mpu_oh: used to add/remove MPU initiator from sleepdep list */
166static struct omap_hwmod *mpu_oh; 173static struct omap_hwmod *mpu_oh;
167 174
175/*
176 * linkspace: ptr to a buffer that struct omap_hwmod_link records are
177 * allocated from - used to reduce the number of small memory
178 * allocations, which has a significant impact on performance
179 */
180static struct omap_hwmod_link *linkspace;
181
182/*
183 * free_ls, max_ls: array indexes into linkspace; representing the
184 * next free struct omap_hwmod_link index, and the maximum number of
185 * struct omap_hwmod_link records allocated (respectively)
186 */
187static unsigned short free_ls, max_ls, ls_supp;
168 188
169/* Private functions */ 189/* Private functions */
170 190
171/** 191/**
192 * _fetch_next_ocp_if - return the next OCP interface in a list
193 * @p: ptr to a ptr to the list_head inside the ocp_if to return
194 * @i: pointer to the index of the element pointed to by @p in the list
195 *
196 * Return a pointer to the struct omap_hwmod_ocp_if record
197 * containing the struct list_head pointed to by @p, and increment
198 * @p such that a future call to this routine will return the next
199 * record.
200 */
201static struct omap_hwmod_ocp_if *_fetch_next_ocp_if(struct list_head **p,
202 int *i)
203{
204 struct omap_hwmod_ocp_if *oi;
205
206 oi = list_entry(*p, struct omap_hwmod_link, node)->ocp_if;
207 *p = (*p)->next;
208
209 *i = *i + 1;
210
211 return oi;
212}
213
214/**
172 * _update_sysc_cache - return the module OCP_SYSCONFIG register, keep copy 215 * _update_sysc_cache - return the module OCP_SYSCONFIG register, keep copy
173 * @oh: struct omap_hwmod * 216 * @oh: struct omap_hwmod *
174 * 217 *
@@ -582,16 +625,16 @@ static int _init_main_clk(struct omap_hwmod *oh)
582 */ 625 */
583static int _init_interface_clks(struct omap_hwmod *oh) 626static int _init_interface_clks(struct omap_hwmod *oh)
584{ 627{
628 struct omap_hwmod_ocp_if *os;
629 struct list_head *p;
585 struct clk *c; 630 struct clk *c;
586 int i; 631 int i = 0;
587 int ret = 0; 632 int ret = 0;
588 633
589 if (oh->slaves_cnt == 0) 634 p = oh->slave_ports.next;
590 return 0;
591
592 for (i = 0; i < oh->slaves_cnt; i++) {
593 struct omap_hwmod_ocp_if *os = oh->slaves[i];
594 635
636 while (i < oh->slaves_cnt) {
637 os = _fetch_next_ocp_if(&p, &i);
595 if (!os->clk) 638 if (!os->clk)
596 continue; 639 continue;
597 640
@@ -643,21 +686,22 @@ static int _init_opt_clks(struct omap_hwmod *oh)
643 */ 686 */
644static int _enable_clocks(struct omap_hwmod *oh) 687static int _enable_clocks(struct omap_hwmod *oh)
645{ 688{
646 int i; 689 struct omap_hwmod_ocp_if *os;
690 struct list_head *p;
691 int i = 0;
647 692
648 pr_debug("omap_hwmod: %s: enabling clocks\n", oh->name); 693 pr_debug("omap_hwmod: %s: enabling clocks\n", oh->name);
649 694
650 if (oh->_clk) 695 if (oh->_clk)
651 clk_enable(oh->_clk); 696 clk_enable(oh->_clk);
652 697
653 if (oh->slaves_cnt > 0) { 698 p = oh->slave_ports.next;
654 for (i = 0; i < oh->slaves_cnt; i++) {
655 struct omap_hwmod_ocp_if *os = oh->slaves[i];
656 struct clk *c = os->_clk;
657 699
658 if (c && (os->flags & OCPIF_SWSUP_IDLE)) 700 while (i < oh->slaves_cnt) {
659 clk_enable(c); 701 os = _fetch_next_ocp_if(&p, &i);
660 } 702
703 if (os->_clk && (os->flags & OCPIF_SWSUP_IDLE))
704 clk_enable(os->_clk);
661 } 705 }
662 706
663 /* The opt clocks are controlled by the device driver. */ 707 /* The opt clocks are controlled by the device driver. */
@@ -673,21 +717,22 @@ static int _enable_clocks(struct omap_hwmod *oh)
673 */ 717 */
674static int _disable_clocks(struct omap_hwmod *oh) 718static int _disable_clocks(struct omap_hwmod *oh)
675{ 719{
676 int i; 720 struct omap_hwmod_ocp_if *os;
721 struct list_head *p;
722 int i = 0;
677 723
678 pr_debug("omap_hwmod: %s: disabling clocks\n", oh->name); 724 pr_debug("omap_hwmod: %s: disabling clocks\n", oh->name);
679 725
680 if (oh->_clk) 726 if (oh->_clk)
681 clk_disable(oh->_clk); 727 clk_disable(oh->_clk);
682 728
683 if (oh->slaves_cnt > 0) { 729 p = oh->slave_ports.next;
684 for (i = 0; i < oh->slaves_cnt; i++) {
685 struct omap_hwmod_ocp_if *os = oh->slaves[i];
686 struct clk *c = os->_clk;
687 730
688 if (c && (os->flags & OCPIF_SWSUP_IDLE)) 731 while (i < oh->slaves_cnt) {
689 clk_disable(c); 732 os = _fetch_next_ocp_if(&p, &i);
690 } 733
734 if (os->_clk && (os->flags & OCPIF_SWSUP_IDLE))
735 clk_disable(os->_clk);
691 } 736 }
692 737
693 /* The opt clocks are controlled by the device driver. */ 738 /* The opt clocks are controlled by the device driver. */
@@ -781,39 +826,6 @@ static int _omap4_wait_target_disable(struct omap_hwmod *oh)
781} 826}
782 827
783/** 828/**
784 * _omap4_disable_module - enable CLKCTRL modulemode on OMAP4
785 * @oh: struct omap_hwmod *
786 *
787 * Disable the PRCM module mode related to the hwmod @oh.
788 * Return EINVAL if the modulemode is not supported and 0 in case of success.
789 */
790static int _omap4_disable_module(struct omap_hwmod *oh)
791{
792 int v;
793
794 /* The module mode does not exist prior OMAP4 */
795 if (!cpu_is_omap44xx())
796 return -EINVAL;
797
798 if (!oh->clkdm || !oh->prcm.omap4.modulemode)
799 return -EINVAL;
800
801 pr_debug("omap_hwmod: %s: %s\n", oh->name, __func__);
802
803 omap4_cminst_module_disable(oh->clkdm->prcm_partition,
804 oh->clkdm->cm_inst,
805 oh->clkdm->clkdm_offs,
806 oh->prcm.omap4.clkctrl_offs);
807
808 v = _omap4_wait_target_disable(oh);
809 if (v)
810 pr_warn("omap_hwmod: %s: _wait_target_disable failed\n",
811 oh->name);
812
813 return 0;
814}
815
816/**
817 * _count_mpu_irqs - count the number of MPU IRQ lines associated with @oh 829 * _count_mpu_irqs - count the number of MPU IRQ lines associated with @oh
818 * @oh: struct omap_hwmod *oh 830 * @oh: struct omap_hwmod *oh
819 * 831 *
@@ -883,59 +895,220 @@ static int _count_ocp_if_addr_spaces(struct omap_hwmod_ocp_if *os)
883} 895}
884 896
885/** 897/**
886 * _find_mpu_port_index - find hwmod OCP slave port ID intended for MPU use 898 * _get_mpu_irq_by_name - fetch MPU interrupt line number by name
887 * @oh: struct omap_hwmod * 899 * @oh: struct omap_hwmod * to operate on
900 * @name: pointer to the name of the MPU interrupt number to fetch (optional)
901 * @irq: pointer to an unsigned int to store the MPU IRQ number to
888 * 902 *
889 * Returns the array index of the OCP slave port that the MPU 903 * Retrieve a MPU hardware IRQ line number named by @name associated
890 * addresses the device on, or -EINVAL upon error or not found. 904 * with the IP block pointed to by @oh. The IRQ number will be filled
905 * into the address pointed to by @dma. When @name is non-null, the
906 * IRQ line number associated with the named entry will be returned.
907 * If @name is null, the first matching entry will be returned. Data
908 * order is not meaningful in hwmod data, so callers are strongly
909 * encouraged to use a non-null @name whenever possible to avoid
910 * unpredictable effects if hwmod data is later added that causes data
911 * ordering to change. Returns 0 upon success or a negative error
912 * code upon error.
891 */ 913 */
892static int __init _find_mpu_port_index(struct omap_hwmod *oh) 914static int _get_mpu_irq_by_name(struct omap_hwmod *oh, const char *name,
915 unsigned int *irq)
893{ 916{
894 int i; 917 int i;
895 int found = 0; 918 bool found = false;
896 919
897 if (!oh || oh->slaves_cnt == 0) 920 if (!oh->mpu_irqs)
898 return -EINVAL; 921 return -ENOENT;
899 922
900 for (i = 0; i < oh->slaves_cnt; i++) { 923 i = 0;
901 struct omap_hwmod_ocp_if *os = oh->slaves[i]; 924 while (oh->mpu_irqs[i].irq != -1) {
925 if (name == oh->mpu_irqs[i].name ||
926 !strcmp(name, oh->mpu_irqs[i].name)) {
927 found = true;
928 break;
929 }
930 i++;
931 }
902 932
903 if (os->user & OCP_USER_MPU) { 933 if (!found)
904 found = 1; 934 return -ENOENT;
935
936 *irq = oh->mpu_irqs[i].irq;
937
938 return 0;
939}
940
941/**
942 * _get_sdma_req_by_name - fetch SDMA request line ID by name
943 * @oh: struct omap_hwmod * to operate on
944 * @name: pointer to the name of the SDMA request line to fetch (optional)
945 * @dma: pointer to an unsigned int to store the request line ID to
946 *
947 * Retrieve an SDMA request line ID named by @name on the IP block
948 * pointed to by @oh. The ID will be filled into the address pointed
949 * to by @dma. When @name is non-null, the request line ID associated
950 * with the named entry will be returned. If @name is null, the first
951 * matching entry will be returned. Data order is not meaningful in
952 * hwmod data, so callers are strongly encouraged to use a non-null
953 * @name whenever possible to avoid unpredictable effects if hwmod
954 * data is later added that causes data ordering to change. Returns 0
955 * upon success or a negative error code upon error.
956 */
957static int _get_sdma_req_by_name(struct omap_hwmod *oh, const char *name,
958 unsigned int *dma)
959{
960 int i;
961 bool found = false;
962
963 if (!oh->sdma_reqs)
964 return -ENOENT;
965
966 i = 0;
967 while (oh->sdma_reqs[i].dma_req != -1) {
968 if (name == oh->sdma_reqs[i].name ||
969 !strcmp(name, oh->sdma_reqs[i].name)) {
970 found = true;
905 break; 971 break;
906 } 972 }
973 i++;
907 } 974 }
908 975
909 if (found) 976 if (!found)
910 pr_debug("omap_hwmod: %s: MPU OCP slave port ID %d\n", 977 return -ENOENT;
911 oh->name, i); 978
912 else 979 *dma = oh->sdma_reqs[i].dma_req;
913 pr_debug("omap_hwmod: %s: no MPU OCP slave port found\n",
914 oh->name);
915 980
916 return (found) ? i : -EINVAL; 981 return 0;
917} 982}
918 983
919/** 984/**
920 * _find_mpu_rt_base - find hwmod register target base addr accessible by MPU 985 * _get_addr_space_by_name - fetch address space start & end by name
921 * @oh: struct omap_hwmod * 986 * @oh: struct omap_hwmod * to operate on
987 * @name: pointer to the name of the address space to fetch (optional)
988 * @pa_start: pointer to a u32 to store the starting address to
989 * @pa_end: pointer to a u32 to store the ending address to
922 * 990 *
923 * Return the virtual address of the base of the register target of 991 * Retrieve address space start and end addresses for the IP block
924 * device @oh, or NULL on error. 992 * pointed to by @oh. The data will be filled into the addresses
993 * pointed to by @pa_start and @pa_end. When @name is non-null, the
994 * address space data associated with the named entry will be
995 * returned. If @name is null, the first matching entry will be
996 * returned. Data order is not meaningful in hwmod data, so callers
997 * are strongly encouraged to use a non-null @name whenever possible
998 * to avoid unpredictable effects if hwmod data is later added that
999 * causes data ordering to change. Returns 0 upon success or a
1000 * negative error code upon error.
925 */ 1001 */
926static void __iomem * __init _find_mpu_rt_base(struct omap_hwmod *oh, u8 index) 1002static int _get_addr_space_by_name(struct omap_hwmod *oh, const char *name,
1003 u32 *pa_start, u32 *pa_end)
927{ 1004{
1005 int i, j;
928 struct omap_hwmod_ocp_if *os; 1006 struct omap_hwmod_ocp_if *os;
929 struct omap_hwmod_addr_space *mem; 1007 struct list_head *p = NULL;
930 int i = 0, found = 0; 1008 bool found = false;
931 void __iomem *va_start; 1009
1010 p = oh->slave_ports.next;
1011
1012 i = 0;
1013 while (i < oh->slaves_cnt) {
1014 os = _fetch_next_ocp_if(&p, &i);
1015
1016 if (!os->addr)
1017 return -ENOENT;
1018
1019 j = 0;
1020 while (os->addr[j].pa_start != os->addr[j].pa_end) {
1021 if (name == os->addr[j].name ||
1022 !strcmp(name, os->addr[j].name)) {
1023 found = true;
1024 break;
1025 }
1026 j++;
1027 }
1028
1029 if (found)
1030 break;
1031 }
1032
1033 if (!found)
1034 return -ENOENT;
932 1035
933 if (!oh || oh->slaves_cnt == 0) 1036 *pa_start = os->addr[j].pa_start;
1037 *pa_end = os->addr[j].pa_end;
1038
1039 return 0;
1040}
1041
1042/**
1043 * _save_mpu_port_index - find and save the index to @oh's MPU port
1044 * @oh: struct omap_hwmod *
1045 *
1046 * Determines the array index of the OCP slave port that the MPU uses
1047 * to address the device, and saves it into the struct omap_hwmod.
1048 * Intended to be called during hwmod registration only. No return
1049 * value.
1050 */
1051static void __init _save_mpu_port_index(struct omap_hwmod *oh)
1052{
1053 struct omap_hwmod_ocp_if *os = NULL;
1054 struct list_head *p;
1055 int i = 0;
1056
1057 if (!oh)
1058 return;
1059
1060 oh->_int_flags |= _HWMOD_NO_MPU_PORT;
1061
1062 p = oh->slave_ports.next;
1063
1064 while (i < oh->slaves_cnt) {
1065 os = _fetch_next_ocp_if(&p, &i);
1066 if (os->user & OCP_USER_MPU) {
1067 oh->_mpu_port = os;
1068 oh->_int_flags &= ~_HWMOD_NO_MPU_PORT;
1069 break;
1070 }
1071 }
1072
1073 return;
1074}
1075
1076/**
1077 * _find_mpu_rt_port - return omap_hwmod_ocp_if accessible by the MPU
1078 * @oh: struct omap_hwmod *
1079 *
1080 * Given a pointer to a struct omap_hwmod record @oh, return a pointer
1081 * to the struct omap_hwmod_ocp_if record that is used by the MPU to
1082 * communicate with the IP block. This interface need not be directly
1083 * connected to the MPU (and almost certainly is not), but is directly
1084 * connected to the IP block represented by @oh. Returns a pointer
1085 * to the struct omap_hwmod_ocp_if * upon success, or returns NULL upon
1086 * error or if there does not appear to be a path from the MPU to this
1087 * IP block.
1088 */
1089static struct omap_hwmod_ocp_if *_find_mpu_rt_port(struct omap_hwmod *oh)
1090{
1091 if (!oh || oh->_int_flags & _HWMOD_NO_MPU_PORT || oh->slaves_cnt == 0)
934 return NULL; 1092 return NULL;
935 1093
936 os = oh->slaves[index]; 1094 return oh->_mpu_port;
1095};
937 1096
938 if (!os->addr) 1097/**
1098 * _find_mpu_rt_addr_space - return MPU register target address space for @oh
1099 * @oh: struct omap_hwmod *
1100 *
1101 * Returns a pointer to the struct omap_hwmod_addr_space record representing
1102 * the register target MPU address space; or returns NULL upon error.
1103 */
1104static struct omap_hwmod_addr_space * __init _find_mpu_rt_addr_space(struct omap_hwmod *oh)
1105{
1106 struct omap_hwmod_ocp_if *os;
1107 struct omap_hwmod_addr_space *mem;
1108 int found = 0, i = 0;
1109
1110 os = _find_mpu_rt_port(oh);
1111 if (!os || !os->addr)
939 return NULL; 1112 return NULL;
940 1113
941 do { 1114 do {
@@ -944,20 +1117,7 @@ static void __iomem * __init _find_mpu_rt_base(struct omap_hwmod *oh, u8 index)
944 found = 1; 1117 found = 1;
945 } while (!found && mem->pa_start != mem->pa_end); 1118 } while (!found && mem->pa_start != mem->pa_end);
946 1119
947 if (found) { 1120 return (found) ? mem : NULL;
948 va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
949 if (!va_start) {
950 pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name);
951 return NULL;
952 }
953 pr_debug("omap_hwmod: %s: MPU register target at va %p\n",
954 oh->name, va_start);
955 } else {
956 pr_debug("omap_hwmod: %s: no MPU register target found\n",
957 oh->name);
958 }
959
960 return (found) ? va_start : NULL;
961} 1121}
962 1122
963/** 1123/**
@@ -1205,12 +1365,11 @@ static int _wait_target_ready(struct omap_hwmod *oh)
1205 if (!oh) 1365 if (!oh)
1206 return -EINVAL; 1366 return -EINVAL;
1207 1367
1208 if (oh->_int_flags & _HWMOD_NO_MPU_PORT) 1368 if (oh->flags & HWMOD_NO_IDLEST)
1209 return 0; 1369 return 0;
1210 1370
1211 os = oh->slaves[oh->_mpu_port_index]; 1371 os = _find_mpu_rt_port(oh);
1212 1372 if (!os)
1213 if (oh->flags & HWMOD_NO_IDLEST)
1214 return 0; 1373 return 0;
1215 1374
1216 /* XXX check module SIDLEMODE */ 1375 /* XXX check module SIDLEMODE */
@@ -1378,13 +1537,73 @@ static int _read_hardreset(struct omap_hwmod *oh, const char *name)
1378} 1537}
1379 1538
1380/** 1539/**
1540 * _are_any_hardreset_lines_asserted - return true if part of @oh is hard-reset
1541 * @oh: struct omap_hwmod *
1542 *
1543 * If any hardreset line associated with @oh is asserted, then return true.
1544 * Otherwise, if @oh has no hardreset lines associated with it, or if
1545 * no hardreset lines associated with @oh are asserted, then return false.
1546 * This function is used to avoid executing some parts of the IP block
1547 * enable/disable sequence if a hardreset line is set.
1548 */
1549static bool _are_any_hardreset_lines_asserted(struct omap_hwmod *oh)
1550{
1551 int i;
1552
1553 if (oh->rst_lines_cnt == 0)
1554 return false;
1555
1556 for (i = 0; i < oh->rst_lines_cnt; i++)
1557 if (_read_hardreset(oh, oh->rst_lines[i].name) > 0)
1558 return true;
1559
1560 return false;
1561}
1562
1563/**
1564 * _omap4_disable_module - enable CLKCTRL modulemode on OMAP4
1565 * @oh: struct omap_hwmod *
1566 *
1567 * Disable the PRCM module mode related to the hwmod @oh.
1568 * Return EINVAL if the modulemode is not supported and 0 in case of success.
1569 */
1570static int _omap4_disable_module(struct omap_hwmod *oh)
1571{
1572 int v;
1573
1574 /* The module mode does not exist prior OMAP4 */
1575 if (!cpu_is_omap44xx())
1576 return -EINVAL;
1577
1578 if (!oh->clkdm || !oh->prcm.omap4.modulemode)
1579 return -EINVAL;
1580
1581 pr_debug("omap_hwmod: %s: %s\n", oh->name, __func__);
1582
1583 omap4_cminst_module_disable(oh->clkdm->prcm_partition,
1584 oh->clkdm->cm_inst,
1585 oh->clkdm->clkdm_offs,
1586 oh->prcm.omap4.clkctrl_offs);
1587
1588 if (_are_any_hardreset_lines_asserted(oh))
1589 return 0;
1590
1591 v = _omap4_wait_target_disable(oh);
1592 if (v)
1593 pr_warn("omap_hwmod: %s: _wait_target_disable failed\n",
1594 oh->name);
1595
1596 return 0;
1597}
1598
1599/**
1381 * _ocp_softreset - reset an omap_hwmod via the OCP_SYSCONFIG bit 1600 * _ocp_softreset - reset an omap_hwmod via the OCP_SYSCONFIG bit
1382 * @oh: struct omap_hwmod * 1601 * @oh: struct omap_hwmod *
1383 * 1602 *
1384 * Resets an omap_hwmod @oh via the OCP_SYSCONFIG bit. hwmod must be 1603 * Resets an omap_hwmod @oh via the OCP_SYSCONFIG bit. hwmod must be
1385 * enabled for this to work. Returns -EINVAL if the hwmod cannot be 1604 * enabled for this to work. Returns -ENOENT if the hwmod cannot be
1386 * reset this way or if the hwmod is in the wrong state, -ETIMEDOUT if 1605 * reset this way, -EINVAL if the hwmod is in the wrong state,
1387 * the module did not reset in time, or 0 upon success. 1606 * -ETIMEDOUT if the module did not reset in time, or 0 upon success.
1388 * 1607 *
1389 * In OMAP3 a specific SYSSTATUS register is used to get the reset status. 1608 * In OMAP3 a specific SYSSTATUS register is used to get the reset status.
1390 * Starting in OMAP4, some IPs do not have SYSSTATUS registers and instead 1609 * Starting in OMAP4, some IPs do not have SYSSTATUS registers and instead
@@ -1401,7 +1620,7 @@ static int _ocp_softreset(struct omap_hwmod *oh)
1401 1620
1402 if (!oh->class->sysc || 1621 if (!oh->class->sysc ||
1403 !(oh->class->sysc->sysc_flags & SYSC_HAS_SOFTRESET)) 1622 !(oh->class->sysc->sysc_flags & SYSC_HAS_SOFTRESET))
1404 return -EINVAL; 1623 return -ENOENT;
1405 1624
1406 /* clocks must be on for this operation */ 1625 /* clocks must be on for this operation */
1407 if (oh->_state != _HWMOD_STATE_ENABLED) { 1626 if (oh->_state != _HWMOD_STATE_ENABLED) {
@@ -1422,6 +1641,9 @@ static int _ocp_softreset(struct omap_hwmod *oh)
1422 goto dis_opt_clks; 1641 goto dis_opt_clks;
1423 _write_sysconfig(v, oh); 1642 _write_sysconfig(v, oh);
1424 1643
1644 if (oh->class->sysc->srst_udelay)
1645 udelay(oh->class->sysc->srst_udelay);
1646
1425 if (oh->class->sysc->sysc_flags & SYSS_HAS_RESET_STATUS) 1647 if (oh->class->sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
1426 omap_test_timeout((omap_hwmod_read(oh, 1648 omap_test_timeout((omap_hwmod_read(oh,
1427 oh->class->sysc->syss_offs) 1649 oh->class->sysc->syss_offs)
@@ -1459,32 +1681,60 @@ dis_opt_clks:
1459 * _reset - reset an omap_hwmod 1681 * _reset - reset an omap_hwmod
1460 * @oh: struct omap_hwmod * 1682 * @oh: struct omap_hwmod *
1461 * 1683 *
1462 * Resets an omap_hwmod @oh. The default software reset mechanism for 1684 * Resets an omap_hwmod @oh. If the module has a custom reset
1463 * most OMAP IP blocks is triggered via the OCP_SYSCONFIG.SOFTRESET 1685 * function pointer defined, then call it to reset the IP block, and
1464 * bit. However, some hwmods cannot be reset via this method: some 1686 * pass along its return value to the caller. Otherwise, if the IP
1465 * are not targets and therefore have no OCP header registers to 1687 * block has an OCP_SYSCONFIG register with a SOFTRESET bitfield
1466 * access; others (like the IVA) have idiosyncratic reset sequences. 1688 * associated with it, call a function to reset the IP block via that
1467 * So for these relatively rare cases, custom reset code can be 1689 * method, and pass along the return value to the caller. Finally, if
1468 * supplied in the struct omap_hwmod_class .reset function pointer. 1690 * the IP block has some hardreset lines associated with it, assert
1469 * Passes along the return value from either _reset() or the custom 1691 * all of those, but do _not_ deassert them. (This is because driver
1470 * reset function - these must return -EINVAL if the hwmod cannot be 1692 * authors have expressed an apparent requirement to control the
1471 * reset this way or if the hwmod is in the wrong state, -ETIMEDOUT if 1693 * deassertion of the hardreset lines themselves.)
1472 * the module did not reset in time, or 0 upon success. 1694 *
1695 * The default software reset mechanism for most OMAP IP blocks is
1696 * triggered via the OCP_SYSCONFIG.SOFTRESET bit. However, some
1697 * hwmods cannot be reset via this method. Some are not targets and
1698 * therefore have no OCP header registers to access. Others (like the
1699 * IVA) have idiosyncratic reset sequences. So for these relatively
1700 * rare cases, custom reset code can be supplied in the struct
1701 * omap_hwmod_class .reset function pointer. Passes along the return
1702 * value from either _ocp_softreset() or the custom reset function -
1703 * these must return -EINVAL if the hwmod cannot be reset this way or
1704 * if the hwmod is in the wrong state, -ETIMEDOUT if the module did
1705 * not reset in time, or 0 upon success.
1473 */ 1706 */
1474static int _reset(struct omap_hwmod *oh) 1707static int _reset(struct omap_hwmod *oh)
1475{ 1708{
1476 int ret; 1709 int i, r;
1477 1710
1478 pr_debug("omap_hwmod: %s: resetting\n", oh->name); 1711 pr_debug("omap_hwmod: %s: resetting\n", oh->name);
1479 1712
1480 ret = (oh->class->reset) ? oh->class->reset(oh) : _ocp_softreset(oh); 1713 if (oh->class->reset) {
1714 r = oh->class->reset(oh);
1715 } else {
1716 if (oh->rst_lines_cnt > 0) {
1717 for (i = 0; i < oh->rst_lines_cnt; i++)
1718 _assert_hardreset(oh, oh->rst_lines[i].name);
1719 return 0;
1720 } else {
1721 r = _ocp_softreset(oh);
1722 if (r == -ENOENT)
1723 r = 0;
1724 }
1725 }
1481 1726
1727 /*
1728 * OCP_SYSCONFIG bits need to be reprogrammed after a
1729 * softreset. The _enable() function should be split to avoid
1730 * the rewrite of the OCP_SYSCONFIG register.
1731 */
1482 if (oh->class->sysc) { 1732 if (oh->class->sysc) {
1483 _update_sysc_cache(oh); 1733 _update_sysc_cache(oh);
1484 _enable_sysc(oh); 1734 _enable_sysc(oh);
1485 } 1735 }
1486 1736
1487 return ret; 1737 return r;
1488} 1738}
1489 1739
1490/** 1740/**
@@ -1503,10 +1753,9 @@ static int _enable(struct omap_hwmod *oh)
1503 pr_debug("omap_hwmod: %s: enabling\n", oh->name); 1753 pr_debug("omap_hwmod: %s: enabling\n", oh->name);
1504 1754
1505 /* 1755 /*
1506 * hwmods with HWMOD_INIT_NO_IDLE flag set are left 1756 * hwmods with HWMOD_INIT_NO_IDLE flag set are left in enabled
1507 * in enabled state at init. 1757 * state at init. Now that someone is really trying to enable
1508 * Now that someone is really trying to enable them, 1758 * them, just ensure that the hwmod mux is set.
1509 * just ensure that the hwmod mux is set.
1510 */ 1759 */
1511 if (oh->_int_flags & _HWMOD_SKIP_ENABLE) { 1760 if (oh->_int_flags & _HWMOD_SKIP_ENABLE) {
1512 /* 1761 /*
@@ -1529,15 +1778,17 @@ static int _enable(struct omap_hwmod *oh)
1529 return -EINVAL; 1778 return -EINVAL;
1530 } 1779 }
1531 1780
1532
1533 /* 1781 /*
1534 * If an IP contains only one HW reset line, then de-assert it in order 1782 * If an IP block contains HW reset lines and any of them are
1535 * to allow the module state transition. Otherwise the PRCM will return 1783 * asserted, we let integration code associated with that
1536 * Intransition status, and the init will failed. 1784 * block handle the enable. We've received very little
1785 * information on what those driver authors need, and until
1786 * detailed information is provided and the driver code is
1787 * posted to the public lists, this is probably the best we
1788 * can do.
1537 */ 1789 */
1538 if ((oh->_state == _HWMOD_STATE_INITIALIZED || 1790 if (_are_any_hardreset_lines_asserted(oh))
1539 oh->_state == _HWMOD_STATE_DISABLED) && oh->rst_lines_cnt == 1) 1791 return 0;
1540 _deassert_hardreset(oh, oh->rst_lines[0].name);
1541 1792
1542 /* Mux pins for device runtime if populated */ 1793 /* Mux pins for device runtime if populated */
1543 if (oh->mux && (!oh->mux->enabled || 1794 if (oh->mux && (!oh->mux->enabled ||
@@ -1612,6 +1863,9 @@ static int _idle(struct omap_hwmod *oh)
1612 return -EINVAL; 1863 return -EINVAL;
1613 } 1864 }
1614 1865
1866 if (_are_any_hardreset_lines_asserted(oh))
1867 return 0;
1868
1615 if (oh->class->sysc) 1869 if (oh->class->sysc)
1616 _idle_sysc(oh); 1870 _idle_sysc(oh);
1617 _del_initiator_dep(oh, mpu_oh); 1871 _del_initiator_dep(oh, mpu_oh);
@@ -1684,7 +1938,7 @@ int omap_hwmod_set_ocp_autoidle(struct omap_hwmod *oh, u8 autoidle)
1684 */ 1938 */
1685static int _shutdown(struct omap_hwmod *oh) 1939static int _shutdown(struct omap_hwmod *oh)
1686{ 1940{
1687 int ret; 1941 int ret, i;
1688 u8 prev_state; 1942 u8 prev_state;
1689 1943
1690 if (oh->_state != _HWMOD_STATE_IDLE && 1944 if (oh->_state != _HWMOD_STATE_IDLE &&
@@ -1694,6 +1948,9 @@ static int _shutdown(struct omap_hwmod *oh)
1694 return -EINVAL; 1948 return -EINVAL;
1695 } 1949 }
1696 1950
1951 if (_are_any_hardreset_lines_asserted(oh))
1952 return 0;
1953
1697 pr_debug("omap_hwmod: %s: disabling\n", oh->name); 1954 pr_debug("omap_hwmod: %s: disabling\n", oh->name);
1698 1955
1699 if (oh->class->pre_shutdown) { 1956 if (oh->class->pre_shutdown) {
@@ -1725,12 +1982,8 @@ static int _shutdown(struct omap_hwmod *oh)
1725 } 1982 }
1726 /* XXX Should this code also force-disable the optional clocks? */ 1983 /* XXX Should this code also force-disable the optional clocks? */
1727 1984
1728 /* 1985 for (i = 0; i < oh->rst_lines_cnt; i++)
1729 * If an IP contains only one HW reset line, then assert it 1986 _assert_hardreset(oh, oh->rst_lines[i].name);
1730 * after disabling the clocks and before shutting down the IP.
1731 */
1732 if (oh->rst_lines_cnt == 1)
1733 _assert_hardreset(oh, oh->rst_lines[0].name);
1734 1987
1735 /* Mux pins to safe mode or use populated off mode values */ 1988 /* Mux pins to safe mode or use populated off mode values */
1736 if (oh->mux) 1989 if (oh->mux)
@@ -1742,59 +1995,186 @@ static int _shutdown(struct omap_hwmod *oh)
1742} 1995}
1743 1996
1744/** 1997/**
1745 * _setup - do initial configuration of omap_hwmod 1998 * _init_mpu_rt_base - populate the virtual address for a hwmod
1746 * @oh: struct omap_hwmod * 1999 * @oh: struct omap_hwmod * to locate the virtual address
1747 * 2000 *
1748 * Writes the CLOCKACTIVITY bits @clockact to the hwmod @oh 2001 * Cache the virtual address used by the MPU to access this IP block's
1749 * OCP_SYSCONFIG register. Returns 0. 2002 * registers. This address is needed early so the OCP registers that
2003 * are part of the device's address space can be ioremapped properly.
2004 * No return value.
1750 */ 2005 */
1751static int _setup(struct omap_hwmod *oh, void *data) 2006static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data)
1752{ 2007{
1753 int i, r; 2008 struct omap_hwmod_addr_space *mem;
1754 u8 postsetup_state; 2009 void __iomem *va_start;
2010
2011 if (!oh)
2012 return;
2013
2014 _save_mpu_port_index(oh);
2015
2016 if (oh->_int_flags & _HWMOD_NO_MPU_PORT)
2017 return;
2018
2019 mem = _find_mpu_rt_addr_space(oh);
2020 if (!mem) {
2021 pr_debug("omap_hwmod: %s: no MPU register target found\n",
2022 oh->name);
2023 return;
2024 }
2025
2026 va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
2027 if (!va_start) {
2028 pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name);
2029 return;
2030 }
2031
2032 pr_debug("omap_hwmod: %s: MPU register target at va %p\n",
2033 oh->name, va_start);
2034
2035 oh->_mpu_rt_va = va_start;
2036}
2037
2038/**
2039 * _init - initialize internal data for the hwmod @oh
2040 * @oh: struct omap_hwmod *
2041 * @n: (unused)
2042 *
2043 * Look up the clocks and the address space used by the MPU to access
2044 * registers belonging to the hwmod @oh. @oh must already be
2045 * registered at this point. This is the first of two phases for
2046 * hwmod initialization. Code called here does not touch any hardware
2047 * registers, it simply prepares internal data structures. Returns 0
2048 * upon success or if the hwmod isn't registered, or -EINVAL upon
2049 * failure.
2050 */
2051static int __init _init(struct omap_hwmod *oh, void *data)
2052{
2053 int r;
1755 2054
1756 if (oh->_state != _HWMOD_STATE_CLKS_INITED) 2055 if (oh->_state != _HWMOD_STATE_REGISTERED)
1757 return 0; 2056 return 0;
1758 2057
1759 /* Set iclk autoidle mode */ 2058 _init_mpu_rt_base(oh, NULL);
1760 if (oh->slaves_cnt > 0) {
1761 for (i = 0; i < oh->slaves_cnt; i++) {
1762 struct omap_hwmod_ocp_if *os = oh->slaves[i];
1763 struct clk *c = os->_clk;
1764 2059
1765 if (!c) 2060 r = _init_clocks(oh, NULL);
1766 continue; 2061 if (IS_ERR_VALUE(r)) {
2062 WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh->name);
2063 return -EINVAL;
2064 }
1767 2065
1768 if (os->flags & OCPIF_SWSUP_IDLE) { 2066 oh->_state = _HWMOD_STATE_INITIALIZED;
1769 /* XXX omap_iclk_deny_idle(c); */ 2067
1770 } else { 2068 return 0;
1771 /* XXX omap_iclk_allow_idle(c); */ 2069}
1772 clk_enable(c); 2070
1773 } 2071/**
2072 * _setup_iclk_autoidle - configure an IP block's interface clocks
2073 * @oh: struct omap_hwmod *
2074 *
2075 * Set up the module's interface clocks. XXX This function is still mostly
2076 * a stub; implementing this properly requires iclk autoidle usecounting in
2077 * the clock code. No return value.
2078 */
2079static void __init _setup_iclk_autoidle(struct omap_hwmod *oh)
2080{
2081 struct omap_hwmod_ocp_if *os;
2082 struct list_head *p;
2083 int i = 0;
2084 if (oh->_state != _HWMOD_STATE_INITIALIZED)
2085 return;
2086
2087 p = oh->slave_ports.next;
2088
2089 while (i < oh->slaves_cnt) {
2090 os = _fetch_next_ocp_if(&p, &i);
2091 if (!os->_clk)
2092 continue;
2093
2094 if (os->flags & OCPIF_SWSUP_IDLE) {
2095 /* XXX omap_iclk_deny_idle(c); */
2096 } else {
2097 /* XXX omap_iclk_allow_idle(c); */
2098 clk_enable(os->_clk);
1774 } 2099 }
1775 } 2100 }
1776 2101
1777 oh->_state = _HWMOD_STATE_INITIALIZED; 2102 return;
2103}
1778 2104
1779 /* 2105/**
1780 * In the case of hwmod with hardreset that should not be 2106 * _setup_reset - reset an IP block during the setup process
1781 * de-assert at boot time, we have to keep the module 2107 * @oh: struct omap_hwmod *
1782 * initialized, because we cannot enable it properly with the 2108 *
1783 * reset asserted. Exit without warning because that behavior is 2109 * Reset the IP block corresponding to the hwmod @oh during the setup
1784 * expected. 2110 * process. The IP block is first enabled so it can be successfully
1785 */ 2111 * reset. Returns 0 upon success or a negative error code upon
1786 if ((oh->flags & HWMOD_INIT_NO_RESET) && oh->rst_lines_cnt == 1) 2112 * failure.
1787 return 0; 2113 */
2114static int __init _setup_reset(struct omap_hwmod *oh)
2115{
2116 int r;
1788 2117
1789 r = _enable(oh); 2118 if (oh->_state != _HWMOD_STATE_INITIALIZED)
1790 if (r) { 2119 return -EINVAL;
1791 pr_warning("omap_hwmod: %s: cannot be enabled (%d)\n", 2120
1792 oh->name, oh->_state); 2121 if (oh->rst_lines_cnt == 0) {
1793 return 0; 2122 r = _enable(oh);
2123 if (r) {
2124 pr_warning("omap_hwmod: %s: cannot be enabled for reset (%d)\n",
2125 oh->name, oh->_state);
2126 return -EINVAL;
2127 }
1794 } 2128 }
1795 2129
1796 if (!(oh->flags & HWMOD_INIT_NO_RESET)) 2130 if (!(oh->flags & HWMOD_INIT_NO_RESET))
1797 _reset(oh); 2131 r = _reset(oh);
2132
2133 return r;
2134}
2135
2136/**
2137 * _setup_postsetup - transition to the appropriate state after _setup
2138 * @oh: struct omap_hwmod *
2139 *
2140 * Place an IP block represented by @oh into a "post-setup" state --
2141 * either IDLE, ENABLED, or DISABLED. ("post-setup" simply means that
2142 * this function is called at the end of _setup().) The postsetup
2143 * state for an IP block can be changed by calling
2144 * omap_hwmod_enter_postsetup_state() early in the boot process,
2145 * before one of the omap_hwmod_setup*() functions are called for the
2146 * IP block.
2147 *
2148 * The IP block stays in this state until a PM runtime-based driver is
2149 * loaded for that IP block. A post-setup state of IDLE is
2150 * appropriate for almost all IP blocks with runtime PM-enabled
2151 * drivers, since those drivers are able to enable the IP block. A
2152 * post-setup state of ENABLED is appropriate for kernels with PM
2153 * runtime disabled. The DISABLED state is appropriate for unusual IP
2154 * blocks such as the MPU WDTIMER on kernels without WDTIMER drivers
2155 * included, since the WDTIMER starts running on reset and will reset
2156 * the MPU if left active.
2157 *
2158 * This post-setup mechanism is deprecated. Once all of the OMAP
2159 * drivers have been converted to use PM runtime, and all of the IP
2160 * block data and interconnect data is available to the hwmod code, it
2161 * should be possible to replace this mechanism with a "lazy reset"
2162 * arrangement. In a "lazy reset" setup, each IP block is enabled
2163 * when the driver first probes, then all remaining IP blocks without
2164 * drivers are either shut down or enabled after the drivers have
2165 * loaded. However, this cannot take place until the above
2166 * preconditions have been met, since otherwise the late reset code
2167 * has no way of knowing which IP blocks are in use by drivers, and
2168 * which ones are unused.
2169 *
2170 * No return value.
2171 */
2172static void __init _setup_postsetup(struct omap_hwmod *oh)
2173{
2174 u8 postsetup_state;
2175
2176 if (oh->rst_lines_cnt > 0)
2177 return;
1798 2178
1799 postsetup_state = oh->_postsetup_state; 2179 postsetup_state = oh->_postsetup_state;
1800 if (postsetup_state == _HWMOD_STATE_UNKNOWN) 2180 if (postsetup_state == _HWMOD_STATE_UNKNOWN)
@@ -1818,6 +2198,35 @@ static int _setup(struct omap_hwmod *oh, void *data)
1818 WARN(1, "hwmod: %s: unknown postsetup state %d! defaulting to enabled\n", 2198 WARN(1, "hwmod: %s: unknown postsetup state %d! defaulting to enabled\n",
1819 oh->name, postsetup_state); 2199 oh->name, postsetup_state);
1820 2200
2201 return;
2202}
2203
2204/**
2205 * _setup - prepare IP block hardware for use
2206 * @oh: struct omap_hwmod *
2207 * @n: (unused, pass NULL)
2208 *
2209 * Configure the IP block represented by @oh. This may include
2210 * enabling the IP block, resetting it, and placing it into a
2211 * post-setup state, depending on the type of IP block and applicable
2212 * flags. IP blocks are reset to prevent any previous configuration
2213 * by the bootloader or previous operating system from interfering
2214 * with power management or other parts of the system. The reset can
2215 * be avoided; see omap_hwmod_no_setup_reset(). This is the second of
2216 * two phases for hwmod initialization. Code called here generally
2217 * affects the IP block hardware, or system integration hardware
2218 * associated with the IP block. Returns 0.
2219 */
2220static int __init _setup(struct omap_hwmod *oh, void *data)
2221{
2222 if (oh->_state != _HWMOD_STATE_INITIALIZED)
2223 return 0;
2224
2225 _setup_iclk_autoidle(oh);
2226
2227 if (!_setup_reset(oh))
2228 _setup_postsetup(oh);
2229
1821 return 0; 2230 return 0;
1822} 2231}
1823 2232
@@ -1840,8 +2249,6 @@ static int _setup(struct omap_hwmod *oh, void *data)
1840 */ 2249 */
1841static int __init _register(struct omap_hwmod *oh) 2250static int __init _register(struct omap_hwmod *oh)
1842{ 2251{
1843 int ms_id;
1844
1845 if (!oh || !oh->name || !oh->class || !oh->class->name || 2252 if (!oh || !oh->name || !oh->class || !oh->class->name ||
1846 (oh->_state != _HWMOD_STATE_UNKNOWN)) 2253 (oh->_state != _HWMOD_STATE_UNKNOWN))
1847 return -EINVAL; 2254 return -EINVAL;
@@ -1851,14 +2258,10 @@ static int __init _register(struct omap_hwmod *oh)
1851 if (_lookup(oh->name)) 2258 if (_lookup(oh->name))
1852 return -EEXIST; 2259 return -EEXIST;
1853 2260
1854 ms_id = _find_mpu_port_index(oh);
1855 if (!IS_ERR_VALUE(ms_id))
1856 oh->_mpu_port_index = ms_id;
1857 else
1858 oh->_int_flags |= _HWMOD_NO_MPU_PORT;
1859
1860 list_add_tail(&oh->node, &omap_hwmod_list); 2261 list_add_tail(&oh->node, &omap_hwmod_list);
1861 2262
2263 INIT_LIST_HEAD(&oh->master_ports);
2264 INIT_LIST_HEAD(&oh->slave_ports);
1862 spin_lock_init(&oh->_lock); 2265 spin_lock_init(&oh->_lock);
1863 2266
1864 oh->_state = _HWMOD_STATE_REGISTERED; 2267 oh->_state = _HWMOD_STATE_REGISTERED;
@@ -1873,6 +2276,160 @@ static int __init _register(struct omap_hwmod *oh)
1873 return 0; 2276 return 0;
1874} 2277}
1875 2278
2279/**
2280 * _alloc_links - return allocated memory for hwmod links
2281 * @ml: pointer to a struct omap_hwmod_link * for the master link
2282 * @sl: pointer to a struct omap_hwmod_link * for the slave link
2283 *
2284 * Return pointers to two struct omap_hwmod_link records, via the
2285 * addresses pointed to by @ml and @sl. Will first attempt to return
2286 * memory allocated as part of a large initial block, but if that has
2287 * been exhausted, will allocate memory itself. Since ideally this
2288 * second allocation path will never occur, the number of these
2289 * 'supplemental' allocations will be logged when debugging is
2290 * enabled. Returns 0.
2291 */
2292static int __init _alloc_links(struct omap_hwmod_link **ml,
2293 struct omap_hwmod_link **sl)
2294{
2295 unsigned int sz;
2296
2297 if ((free_ls + LINKS_PER_OCP_IF) <= max_ls) {
2298 *ml = &linkspace[free_ls++];
2299 *sl = &linkspace[free_ls++];
2300 return 0;
2301 }
2302
2303 sz = sizeof(struct omap_hwmod_link) * LINKS_PER_OCP_IF;
2304
2305 *sl = NULL;
2306 *ml = alloc_bootmem(sz);
2307
2308 memset(*ml, 0, sz);
2309
2310 *sl = (void *)(*ml) + sizeof(struct omap_hwmod_link);
2311
2312 ls_supp++;
2313 pr_debug("omap_hwmod: supplemental link allocations needed: %d\n",
2314 ls_supp * LINKS_PER_OCP_IF);
2315
2316 return 0;
2317};
2318
2319/**
2320 * _add_link - add an interconnect between two IP blocks
2321 * @oi: pointer to a struct omap_hwmod_ocp_if record
2322 *
2323 * Add struct omap_hwmod_link records connecting the master IP block
2324 * specified in @oi->master to @oi, and connecting the slave IP block
2325 * specified in @oi->slave to @oi. This code is assumed to run before
2326 * preemption or SMP has been enabled, thus avoiding the need for
2327 * locking in this code. Changes to this assumption will require
2328 * additional locking. Returns 0.
2329 */
2330static int __init _add_link(struct omap_hwmod_ocp_if *oi)
2331{
2332 struct omap_hwmod_link *ml, *sl;
2333
2334 pr_debug("omap_hwmod: %s -> %s: adding link\n", oi->master->name,
2335 oi->slave->name);
2336
2337 _alloc_links(&ml, &sl);
2338
2339 ml->ocp_if = oi;
2340 INIT_LIST_HEAD(&ml->node);
2341 list_add(&ml->node, &oi->master->master_ports);
2342 oi->master->masters_cnt++;
2343
2344 sl->ocp_if = oi;
2345 INIT_LIST_HEAD(&sl->node);
2346 list_add(&sl->node, &oi->slave->slave_ports);
2347 oi->slave->slaves_cnt++;
2348
2349 return 0;
2350}
2351
2352/**
2353 * _register_link - register a struct omap_hwmod_ocp_if
2354 * @oi: struct omap_hwmod_ocp_if *
2355 *
2356 * Registers the omap_hwmod_ocp_if record @oi. Returns -EEXIST if it
2357 * has already been registered; -EINVAL if @oi is NULL or if the
2358 * record pointed to by @oi is missing required fields; or 0 upon
2359 * success.
2360 *
2361 * XXX The data should be copied into bootmem, so the original data
2362 * should be marked __initdata and freed after init. This would allow
2363 * unneeded omap_hwmods to be freed on multi-OMAP configurations.
2364 */
2365static int __init _register_link(struct omap_hwmod_ocp_if *oi)
2366{
2367 if (!oi || !oi->master || !oi->slave || !oi->user)
2368 return -EINVAL;
2369
2370 if (oi->_int_flags & _OCPIF_INT_FLAGS_REGISTERED)
2371 return -EEXIST;
2372
2373 pr_debug("omap_hwmod: registering link from %s to %s\n",
2374 oi->master->name, oi->slave->name);
2375
2376 /*
2377 * Register the connected hwmods, if they haven't been
2378 * registered already
2379 */
2380 if (oi->master->_state != _HWMOD_STATE_REGISTERED)
2381 _register(oi->master);
2382
2383 if (oi->slave->_state != _HWMOD_STATE_REGISTERED)
2384 _register(oi->slave);
2385
2386 _add_link(oi);
2387
2388 oi->_int_flags |= _OCPIF_INT_FLAGS_REGISTERED;
2389
2390 return 0;
2391}
2392
2393/**
2394 * _alloc_linkspace - allocate large block of hwmod links
2395 * @ois: pointer to an array of struct omap_hwmod_ocp_if records to count
2396 *
2397 * Allocate a large block of struct omap_hwmod_link records. This
2398 * improves boot time significantly by avoiding the need to allocate
2399 * individual records one by one. If the number of records to
2400 * allocate in the block hasn't been manually specified, this function
2401 * will count the number of struct omap_hwmod_ocp_if records in @ois
2402 * and use that to determine the allocation size. For SoC families
2403 * that require multiple list registrations, such as OMAP3xxx, this
2404 * estimation process isn't optimal, so manual estimation is advised
2405 * in those cases. Returns -EEXIST if the allocation has already occurred
2406 * or 0 upon success.
2407 */
2408static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois)
2409{
2410 unsigned int i = 0;
2411 unsigned int sz;
2412
2413 if (linkspace) {
2414 WARN(1, "linkspace already allocated\n");
2415 return -EEXIST;
2416 }
2417
2418 if (max_ls == 0)
2419 while (ois[i++])
2420 max_ls += LINKS_PER_OCP_IF;
2421
2422 sz = sizeof(struct omap_hwmod_link) * max_ls;
2423
2424 pr_debug("omap_hwmod: %s: allocating %d byte linkspace (%d links)\n",
2425 __func__, sz, max_ls);
2426
2427 linkspace = alloc_bootmem(sz);
2428
2429 memset(linkspace, 0, sz);
2430
2431 return 0;
2432}
1876 2433
1877/* Public functions */ 2434/* Public functions */
1878 2435
@@ -1903,10 +2460,20 @@ void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs)
1903 */ 2460 */
1904int omap_hwmod_softreset(struct omap_hwmod *oh) 2461int omap_hwmod_softreset(struct omap_hwmod *oh)
1905{ 2462{
1906 if (!oh) 2463 u32 v;
2464 int ret;
2465
2466 if (!oh || !(oh->_sysc_cache))
1907 return -EINVAL; 2467 return -EINVAL;
1908 2468
1909 return _ocp_softreset(oh); 2469 v = oh->_sysc_cache;
2470 ret = _set_softreset(oh, &v);
2471 if (ret)
2472 goto error;
2473 _write_sysconfig(v, oh);
2474
2475error:
2476 return ret;
1910} 2477}
1911 2478
1912/** 2479/**
@@ -1991,120 +2558,101 @@ int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data),
1991} 2558}
1992 2559
1993/** 2560/**
1994 * omap_hwmod_register - register an array of hwmods 2561 * omap_hwmod_register_links - register an array of hwmod links
1995 * @ohs: pointer to an array of omap_hwmods to register 2562 * @ois: pointer to an array of omap_hwmod_ocp_if to register
1996 * 2563 *
1997 * Intended to be called early in boot before the clock framework is 2564 * Intended to be called early in boot before the clock framework is
1998 * initialized. If @ohs is not null, will register all omap_hwmods 2565 * initialized. If @ois is not null, will register all omap_hwmods
1999 * listed in @ohs that are valid for this chip. Returns 0. 2566 * listed in @ois that are valid for this chip. Returns 0.
2000 */ 2567 */
2001int __init omap_hwmod_register(struct omap_hwmod **ohs) 2568int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois)
2002{ 2569{
2003 int r, i; 2570 int r, i;
2004 2571
2005 if (!ohs) 2572 if (!ois)
2006 return 0; 2573 return 0;
2007 2574
2575 if (!linkspace) {
2576 if (_alloc_linkspace(ois)) {
2577 pr_err("omap_hwmod: could not allocate link space\n");
2578 return -ENOMEM;
2579 }
2580 }
2581
2008 i = 0; 2582 i = 0;
2009 do { 2583 do {
2010 r = _register(ohs[i]); 2584 r = _register_link(ois[i]);
2011 WARN(r, "omap_hwmod: %s: _register returned %d\n", ohs[i]->name, 2585 WARN(r && r != -EEXIST,
2012 r); 2586 "omap_hwmod: _register_link(%s -> %s) returned %d\n",
2013 } while (ohs[++i]); 2587 ois[i]->master->name, ois[i]->slave->name, r);
2588 } while (ois[++i]);
2014 2589
2015 return 0; 2590 return 0;
2016} 2591}
2017 2592
2018/* 2593/**
2019 * _populate_mpu_rt_base - populate the virtual address for a hwmod 2594 * _ensure_mpu_hwmod_is_setup - ensure the MPU SS hwmod is init'ed and set up
2595 * @oh: pointer to the hwmod currently being set up (usually not the MPU)
2020 * 2596 *
2021 * Must be called only from omap_hwmod_setup_*() so ioremap works properly. 2597 * If the hwmod data corresponding to the MPU subsystem IP block
2022 * Assumes the caller takes care of locking if needed. 2598 * hasn't been initialized and set up yet, do so now. This must be
2599 * done first since sleep dependencies may be added from other hwmods
2600 * to the MPU. Intended to be called only by omap_hwmod_setup*(). No
2601 * return value.
2023 */ 2602 */
2024static int __init _populate_mpu_rt_base(struct omap_hwmod *oh, void *data) 2603static void __init _ensure_mpu_hwmod_is_setup(struct omap_hwmod *oh)
2025{ 2604{
2026 if (oh->_state != _HWMOD_STATE_REGISTERED) 2605 if (!mpu_oh || mpu_oh->_state == _HWMOD_STATE_UNKNOWN)
2027 return 0; 2606 pr_err("omap_hwmod: %s: MPU initiator hwmod %s not yet registered\n",
2028 2607 __func__, MPU_INITIATOR_NAME);
2029 if (oh->_int_flags & _HWMOD_NO_MPU_PORT) 2608 else if (mpu_oh->_state == _HWMOD_STATE_REGISTERED && oh != mpu_oh)
2030 return 0; 2609 omap_hwmod_setup_one(MPU_INITIATOR_NAME);
2031
2032 oh->_mpu_rt_va = _find_mpu_rt_base(oh, oh->_mpu_port_index);
2033
2034 return 0;
2035} 2610}
2036 2611
2037/** 2612/**
2038 * omap_hwmod_setup_one - set up a single hwmod 2613 * omap_hwmod_setup_one - set up a single hwmod
2039 * @oh_name: const char * name of the already-registered hwmod to set up 2614 * @oh_name: const char * name of the already-registered hwmod to set up
2040 * 2615 *
2041 * Must be called after omap2_clk_init(). Resolves the struct clk 2616 * Initialize and set up a single hwmod. Intended to be used for a
2042 * names to struct clk pointers for each registered omap_hwmod. Also 2617 * small number of early devices, such as the timer IP blocks used for
2043 * calls _setup() on each hwmod. Returns -EINVAL upon error or 0 upon 2618 * the scheduler clock. Must be called after omap2_clk_init().
2044 * success. 2619 * Resolves the struct clk names to struct clk pointers for each
2620 * registered omap_hwmod. Also calls _setup() on each hwmod. Returns
2621 * -EINVAL upon error or 0 upon success.
2045 */ 2622 */
2046int __init omap_hwmod_setup_one(const char *oh_name) 2623int __init omap_hwmod_setup_one(const char *oh_name)
2047{ 2624{
2048 struct omap_hwmod *oh; 2625 struct omap_hwmod *oh;
2049 int r;
2050 2626
2051 pr_debug("omap_hwmod: %s: %s\n", oh_name, __func__); 2627 pr_debug("omap_hwmod: %s: %s\n", oh_name, __func__);
2052 2628
2053 if (!mpu_oh) {
2054 pr_err("omap_hwmod: %s: cannot setup_one: MPU initiator hwmod %s not yet registered\n",
2055 oh_name, MPU_INITIATOR_NAME);
2056 return -EINVAL;
2057 }
2058
2059 oh = _lookup(oh_name); 2629 oh = _lookup(oh_name);
2060 if (!oh) { 2630 if (!oh) {
2061 WARN(1, "omap_hwmod: %s: hwmod not yet registered\n", oh_name); 2631 WARN(1, "omap_hwmod: %s: hwmod not yet registered\n", oh_name);
2062 return -EINVAL; 2632 return -EINVAL;
2063 } 2633 }
2064 2634
2065 if (mpu_oh->_state == _HWMOD_STATE_REGISTERED && oh != mpu_oh) 2635 _ensure_mpu_hwmod_is_setup(oh);
2066 omap_hwmod_setup_one(MPU_INITIATOR_NAME);
2067
2068 r = _populate_mpu_rt_base(oh, NULL);
2069 if (IS_ERR_VALUE(r)) {
2070 WARN(1, "omap_hwmod: %s: couldn't set mpu_rt_base\n", oh_name);
2071 return -EINVAL;
2072 }
2073
2074 r = _init_clocks(oh, NULL);
2075 if (IS_ERR_VALUE(r)) {
2076 WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh_name);
2077 return -EINVAL;
2078 }
2079 2636
2637 _init(oh, NULL);
2080 _setup(oh, NULL); 2638 _setup(oh, NULL);
2081 2639
2082 return 0; 2640 return 0;
2083} 2641}
2084 2642
2085/** 2643/**
2086 * omap_hwmod_setup - do some post-clock framework initialization 2644 * omap_hwmod_setup_all - set up all registered IP blocks
2087 * 2645 *
2088 * Must be called after omap2_clk_init(). Resolves the struct clk names 2646 * Initialize and set up all IP blocks registered with the hwmod code.
2089 * to struct clk pointers for each registered omap_hwmod. Also calls 2647 * Must be called after omap2_clk_init(). Resolves the struct clk
2090 * _setup() on each hwmod. Returns 0 upon success. 2648 * names to struct clk pointers for each registered omap_hwmod. Also
2649 * calls _setup() on each hwmod. Returns 0 upon success.
2091 */ 2650 */
2092static int __init omap_hwmod_setup_all(void) 2651static int __init omap_hwmod_setup_all(void)
2093{ 2652{
2094 int r; 2653 _ensure_mpu_hwmod_is_setup(NULL);
2095
2096 if (!mpu_oh) {
2097 pr_err("omap_hwmod: %s: MPU initiator hwmod %s not yet registered\n",
2098 __func__, MPU_INITIATOR_NAME);
2099 return -EINVAL;
2100 }
2101
2102 r = omap_hwmod_for_each(_populate_mpu_rt_base, NULL);
2103
2104 r = omap_hwmod_for_each(_init_clocks, NULL);
2105 WARN(IS_ERR_VALUE(r),
2106 "omap_hwmod: %s: _init_clocks failed\n", __func__);
2107 2654
2655 omap_hwmod_for_each(_init, NULL);
2108 omap_hwmod_for_each(_setup, NULL); 2656 omap_hwmod_for_each(_setup, NULL);
2109 2657
2110 return 0; 2658 return 0;
@@ -2261,6 +2809,10 @@ int omap_hwmod_reset(struct omap_hwmod *oh)
2261 return r; 2809 return r;
2262} 2810}
2263 2811
2812/*
2813 * IP block data retrieval functions
2814 */
2815
2264/** 2816/**
2265 * omap_hwmod_count_resources - count number of struct resources needed by hwmod 2817 * omap_hwmod_count_resources - count number of struct resources needed by hwmod
2266 * @oh: struct omap_hwmod * 2818 * @oh: struct omap_hwmod *
@@ -2279,12 +2831,19 @@ int omap_hwmod_reset(struct omap_hwmod *oh)
2279 */ 2831 */
2280int omap_hwmod_count_resources(struct omap_hwmod *oh) 2832int omap_hwmod_count_resources(struct omap_hwmod *oh)
2281{ 2833{
2282 int ret, i; 2834 struct omap_hwmod_ocp_if *os;
2835 struct list_head *p;
2836 int ret;
2837 int i = 0;
2283 2838
2284 ret = _count_mpu_irqs(oh) + _count_sdma_reqs(oh); 2839 ret = _count_mpu_irqs(oh) + _count_sdma_reqs(oh);
2285 2840
2286 for (i = 0; i < oh->slaves_cnt; i++) 2841 p = oh->slave_ports.next;
2287 ret += _count_ocp_if_addr_spaces(oh->slaves[i]); 2842
2843 while (i < oh->slaves_cnt) {
2844 os = _fetch_next_ocp_if(&p, &i);
2845 ret += _count_ocp_if_addr_spaces(os);
2846 }
2288 2847
2289 return ret; 2848 return ret;
2290} 2849}
@@ -2301,7 +2860,9 @@ int omap_hwmod_count_resources(struct omap_hwmod *oh)
2301 */ 2860 */
2302int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res) 2861int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res)
2303{ 2862{
2304 int i, j, mpu_irqs_cnt, sdma_reqs_cnt; 2863 struct omap_hwmod_ocp_if *os;
2864 struct list_head *p;
2865 int i, j, mpu_irqs_cnt, sdma_reqs_cnt, addr_cnt;
2305 int r = 0; 2866 int r = 0;
2306 2867
2307 /* For each IRQ, DMA, memory area, fill in array.*/ 2868 /* For each IRQ, DMA, memory area, fill in array.*/
@@ -2324,11 +2885,11 @@ int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res)
2324 r++; 2885 r++;
2325 } 2886 }
2326 2887
2327 for (i = 0; i < oh->slaves_cnt; i++) { 2888 p = oh->slave_ports.next;
2328 struct omap_hwmod_ocp_if *os;
2329 int addr_cnt;
2330 2889
2331 os = oh->slaves[i]; 2890 i = 0;
2891 while (i < oh->slaves_cnt) {
2892 os = _fetch_next_ocp_if(&p, &i);
2332 addr_cnt = _count_ocp_if_addr_spaces(os); 2893 addr_cnt = _count_ocp_if_addr_spaces(os);
2333 2894
2334 for (j = 0; j < addr_cnt; j++) { 2895 for (j = 0; j < addr_cnt; j++) {
@@ -2344,6 +2905,69 @@ int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res)
2344} 2905}
2345 2906
2346/** 2907/**
2908 * omap_hwmod_get_resource_byname - fetch IP block integration data by name
2909 * @oh: struct omap_hwmod * to operate on
2910 * @type: one of the IORESOURCE_* constants from include/linux/ioport.h
2911 * @name: pointer to the name of the data to fetch (optional)
2912 * @rsrc: pointer to a struct resource, allocated by the caller
2913 *
2914 * Retrieve MPU IRQ, SDMA request line, or address space start/end
2915 * data for the IP block pointed to by @oh. The data will be filled
2916 * into a struct resource record pointed to by @rsrc. The struct
2917 * resource must be allocated by the caller. When @name is non-null,
2918 * the data associated with the matching entry in the IRQ/SDMA/address
2919 * space hwmod data arrays will be returned. If @name is null, the
2920 * first array entry will be returned. Data order is not meaningful
2921 * in hwmod data, so callers are strongly encouraged to use a non-null
2922 * @name whenever possible to avoid unpredictable effects if hwmod
2923 * data is later added that causes data ordering to change. This
2924 * function is only intended for use by OMAP core code. Device
2925 * drivers should not call this function - the appropriate bus-related
2926 * data accessor functions should be used instead. Returns 0 upon
2927 * success or a negative error code upon error.
2928 */
2929int omap_hwmod_get_resource_byname(struct omap_hwmod *oh, unsigned int type,
2930 const char *name, struct resource *rsrc)
2931{
2932 int r;
2933 unsigned int irq, dma;
2934 u32 pa_start, pa_end;
2935
2936 if (!oh || !rsrc)
2937 return -EINVAL;
2938
2939 if (type == IORESOURCE_IRQ) {
2940 r = _get_mpu_irq_by_name(oh, name, &irq);
2941 if (r)
2942 return r;
2943
2944 rsrc->start = irq;
2945 rsrc->end = irq;
2946 } else if (type == IORESOURCE_DMA) {
2947 r = _get_sdma_req_by_name(oh, name, &dma);
2948 if (r)
2949 return r;
2950
2951 rsrc->start = dma;
2952 rsrc->end = dma;
2953 } else if (type == IORESOURCE_MEM) {
2954 r = _get_addr_space_by_name(oh, name, &pa_start, &pa_end);
2955 if (r)
2956 return r;
2957
2958 rsrc->start = pa_start;
2959 rsrc->end = pa_end;
2960 } else {
2961 return -EINVAL;
2962 }
2963
2964 rsrc->flags = type;
2965 rsrc->name = name;
2966
2967 return 0;
2968}
2969
2970/**
2347 * omap_hwmod_get_pwrdm - return pointer to this module's main powerdomain 2971 * omap_hwmod_get_pwrdm - return pointer to this module's main powerdomain
2348 * @oh: struct omap_hwmod * 2972 * @oh: struct omap_hwmod *
2349 * 2973 *
@@ -2357,6 +2981,7 @@ int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res)
2357struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh) 2981struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
2358{ 2982{
2359 struct clk *c; 2983 struct clk *c;
2984 struct omap_hwmod_ocp_if *oi;
2360 2985
2361 if (!oh) 2986 if (!oh)
2362 return NULL; 2987 return NULL;
@@ -2364,9 +2989,10 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
2364 if (oh->_clk) { 2989 if (oh->_clk) {
2365 c = oh->_clk; 2990 c = oh->_clk;
2366 } else { 2991 } else {
2367 if (oh->_int_flags & _HWMOD_NO_MPU_PORT) 2992 oi = _find_mpu_rt_port(oh);
2993 if (!oi)
2368 return NULL; 2994 return NULL;
2369 c = oh->slaves[oh->_mpu_port_index]->_clk; 2995 c = oi->_clk;
2370 } 2996 }
2371 2997
2372 if (!c->clkdm) 2998 if (!c->clkdm)
@@ -2640,10 +3266,10 @@ int omap_hwmod_for_each_by_class(const char *classname,
2640 * @state: state that _setup() should leave the hwmod in 3266 * @state: state that _setup() should leave the hwmod in
2641 * 3267 *
2642 * Sets the hwmod state that @oh will enter at the end of _setup() 3268 * Sets the hwmod state that @oh will enter at the end of _setup()
2643 * (called by omap_hwmod_setup_*()). Only valid to call between 3269 * (called by omap_hwmod_setup_*()). See also the documentation
2644 * calling omap_hwmod_register() and omap_hwmod_setup_*(). Returns 3270 * for _setup_postsetup(), above. Returns 0 upon success or
2645 * 0 upon success or -EINVAL if there is a problem with the arguments 3271 * -EINVAL if there is a problem with the arguments or if the hwmod is
2646 * or if the hwmod is in the wrong state. 3272 * in the wrong state.
2647 */ 3273 */
2648int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state) 3274int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state)
2649{ 3275{
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index a5409ce3f323..a7640d1b215e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -2,6 +2,7 @@
2 * omap_hwmod_2420_data.c - hardware modules present on the OMAP2420 chips 2 * omap_hwmod_2420_data.c - hardware modules present on the OMAP2420 chips
3 * 3 *
4 * Copyright (C) 2009-2011 Nokia Corporation 4 * Copyright (C) 2009-2011 Nokia Corporation
5 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley 6 * Paul Walmsley
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
@@ -22,6 +23,7 @@
22#include <plat/dmtimer.h> 23#include <plat/dmtimer.h>
23#include <plat/l3_2xxx.h> 24#include <plat/l3_2xxx.h>
24#include <plat/l4_2xxx.h> 25#include <plat/l4_2xxx.h>
26#include <plat/mmc.h>
25 27
26#include "omap_hwmod_common_data.h" 28#include "omap_hwmod_common_data.h"
27 29
@@ -32,707 +34,329 @@
32/* 34/*
33 * OMAP2420 hardware module integration data 35 * OMAP2420 hardware module integration data
34 * 36 *
35 * ALl of the data in this section should be autogeneratable from the 37 * All of the data in this section should be autogeneratable from the
36 * TI hardware database or other technical documentation. Data that 38 * TI hardware database or other technical documentation. Data that
37 * is driver-specific or driver-kernel integration-specific belongs 39 * is driver-specific or driver-kernel integration-specific belongs
38 * elsewhere. 40 * elsewhere.
39 */ 41 */
40 42
41static struct omap_hwmod omap2420_mpu_hwmod;
42static struct omap_hwmod omap2420_iva_hwmod;
43static struct omap_hwmod omap2420_l3_main_hwmod;
44static struct omap_hwmod omap2420_l4_core_hwmod;
45static struct omap_hwmod omap2420_dss_core_hwmod;
46static struct omap_hwmod omap2420_dss_dispc_hwmod;
47static struct omap_hwmod omap2420_dss_rfbi_hwmod;
48static struct omap_hwmod omap2420_dss_venc_hwmod;
49static struct omap_hwmod omap2420_wd_timer2_hwmod;
50static struct omap_hwmod omap2420_gpio1_hwmod;
51static struct omap_hwmod omap2420_gpio2_hwmod;
52static struct omap_hwmod omap2420_gpio3_hwmod;
53static struct omap_hwmod omap2420_gpio4_hwmod;
54static struct omap_hwmod omap2420_dma_system_hwmod;
55static struct omap_hwmod omap2420_mcspi1_hwmod;
56static struct omap_hwmod omap2420_mcspi2_hwmod;
57
58/* L3 -> L4_CORE interface */
59static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = {
60 .master = &omap2420_l3_main_hwmod,
61 .slave = &omap2420_l4_core_hwmod,
62 .user = OCP_USER_MPU | OCP_USER_SDMA,
63};
64
65/* MPU -> L3 interface */
66static struct omap_hwmod_ocp_if omap2420_mpu__l3_main = {
67 .master = &omap2420_mpu_hwmod,
68 .slave = &omap2420_l3_main_hwmod,
69 .user = OCP_USER_MPU,
70};
71
72/* Slave interfaces on the L3 interconnect */
73static struct omap_hwmod_ocp_if *omap2420_l3_main_slaves[] = {
74 &omap2420_mpu__l3_main,
75};
76
77/* DSS -> l3 */
78static struct omap_hwmod_ocp_if omap2420_dss__l3 = {
79 .master = &omap2420_dss_core_hwmod,
80 .slave = &omap2420_l3_main_hwmod,
81 .fw = {
82 .omap2 = {
83 .l3_perm_bit = OMAP2_L3_CORE_FW_CONNID_DSS,
84 .flags = OMAP_FIREWALL_L3,
85 }
86 },
87 .user = OCP_USER_MPU | OCP_USER_SDMA,
88};
89
90/* Master interfaces on the L3 interconnect */
91static struct omap_hwmod_ocp_if *omap2420_l3_main_masters[] = {
92 &omap2420_l3_main__l4_core,
93};
94
95/* L3 */
96static struct omap_hwmod omap2420_l3_main_hwmod = {
97 .name = "l3_main",
98 .class = &l3_hwmod_class,
99 .masters = omap2420_l3_main_masters,
100 .masters_cnt = ARRAY_SIZE(omap2420_l3_main_masters),
101 .slaves = omap2420_l3_main_slaves,
102 .slaves_cnt = ARRAY_SIZE(omap2420_l3_main_slaves),
103 .flags = HWMOD_NO_IDLEST,
104};
105
106static struct omap_hwmod omap2420_l4_wkup_hwmod;
107static struct omap_hwmod omap2420_uart1_hwmod;
108static struct omap_hwmod omap2420_uart2_hwmod;
109static struct omap_hwmod omap2420_uart3_hwmod;
110static struct omap_hwmod omap2420_i2c1_hwmod;
111static struct omap_hwmod omap2420_i2c2_hwmod;
112static struct omap_hwmod omap2420_mcbsp1_hwmod;
113static struct omap_hwmod omap2420_mcbsp2_hwmod;
114
115/* l4 core -> mcspi1 interface */
116static struct omap_hwmod_ocp_if omap2420_l4_core__mcspi1 = {
117 .master = &omap2420_l4_core_hwmod,
118 .slave = &omap2420_mcspi1_hwmod,
119 .clk = "mcspi1_ick",
120 .addr = omap2_mcspi1_addr_space,
121 .user = OCP_USER_MPU | OCP_USER_SDMA,
122};
123
124/* l4 core -> mcspi2 interface */
125static struct omap_hwmod_ocp_if omap2420_l4_core__mcspi2 = {
126 .master = &omap2420_l4_core_hwmod,
127 .slave = &omap2420_mcspi2_hwmod,
128 .clk = "mcspi2_ick",
129 .addr = omap2_mcspi2_addr_space,
130 .user = OCP_USER_MPU | OCP_USER_SDMA,
131};
132
133/* L4_CORE -> L4_WKUP interface */
134static struct omap_hwmod_ocp_if omap2420_l4_core__l4_wkup = {
135 .master = &omap2420_l4_core_hwmod,
136 .slave = &omap2420_l4_wkup_hwmod,
137 .user = OCP_USER_MPU | OCP_USER_SDMA,
138};
139
140/* L4 CORE -> UART1 interface */
141static struct omap_hwmod_ocp_if omap2_l4_core__uart1 = {
142 .master = &omap2420_l4_core_hwmod,
143 .slave = &omap2420_uart1_hwmod,
144 .clk = "uart1_ick",
145 .addr = omap2xxx_uart1_addr_space,
146 .user = OCP_USER_MPU | OCP_USER_SDMA,
147};
148
149/* L4 CORE -> UART2 interface */
150static struct omap_hwmod_ocp_if omap2_l4_core__uart2 = {
151 .master = &omap2420_l4_core_hwmod,
152 .slave = &omap2420_uart2_hwmod,
153 .clk = "uart2_ick",
154 .addr = omap2xxx_uart2_addr_space,
155 .user = OCP_USER_MPU | OCP_USER_SDMA,
156};
157
158/* L4 PER -> UART3 interface */
159static struct omap_hwmod_ocp_if omap2_l4_core__uart3 = {
160 .master = &omap2420_l4_core_hwmod,
161 .slave = &omap2420_uart3_hwmod,
162 .clk = "uart3_ick",
163 .addr = omap2xxx_uart3_addr_space,
164 .user = OCP_USER_MPU | OCP_USER_SDMA,
165};
166
167/* L4 CORE -> I2C1 interface */
168static struct omap_hwmod_ocp_if omap2420_l4_core__i2c1 = {
169 .master = &omap2420_l4_core_hwmod,
170 .slave = &omap2420_i2c1_hwmod,
171 .clk = "i2c1_ick",
172 .addr = omap2_i2c1_addr_space,
173 .user = OCP_USER_MPU | OCP_USER_SDMA,
174};
175
176/* L4 CORE -> I2C2 interface */
177static struct omap_hwmod_ocp_if omap2420_l4_core__i2c2 = {
178 .master = &omap2420_l4_core_hwmod,
179 .slave = &omap2420_i2c2_hwmod,
180 .clk = "i2c2_ick",
181 .addr = omap2_i2c2_addr_space,
182 .user = OCP_USER_MPU | OCP_USER_SDMA,
183};
184
185/* Slave interfaces on the L4_CORE interconnect */
186static struct omap_hwmod_ocp_if *omap2420_l4_core_slaves[] = {
187 &omap2420_l3_main__l4_core,
188};
189
190/* Master interfaces on the L4_CORE interconnect */
191static struct omap_hwmod_ocp_if *omap2420_l4_core_masters[] = {
192 &omap2420_l4_core__l4_wkup,
193 &omap2_l4_core__uart1,
194 &omap2_l4_core__uart2,
195 &omap2_l4_core__uart3,
196 &omap2420_l4_core__i2c1,
197 &omap2420_l4_core__i2c2
198};
199
200/* L4 CORE */
201static struct omap_hwmod omap2420_l4_core_hwmod = {
202 .name = "l4_core",
203 .class = &l4_hwmod_class,
204 .masters = omap2420_l4_core_masters,
205 .masters_cnt = ARRAY_SIZE(omap2420_l4_core_masters),
206 .slaves = omap2420_l4_core_slaves,
207 .slaves_cnt = ARRAY_SIZE(omap2420_l4_core_slaves),
208 .flags = HWMOD_NO_IDLEST,
209};
210
211/* Slave interfaces on the L4_WKUP interconnect */
212static struct omap_hwmod_ocp_if *omap2420_l4_wkup_slaves[] = {
213 &omap2420_l4_core__l4_wkup,
214};
215
216/* Master interfaces on the L4_WKUP interconnect */
217static struct omap_hwmod_ocp_if *omap2420_l4_wkup_masters[] = {
218};
219
220/* L4 WKUP */
221static struct omap_hwmod omap2420_l4_wkup_hwmod = {
222 .name = "l4_wkup",
223 .class = &l4_hwmod_class,
224 .masters = omap2420_l4_wkup_masters,
225 .masters_cnt = ARRAY_SIZE(omap2420_l4_wkup_masters),
226 .slaves = omap2420_l4_wkup_slaves,
227 .slaves_cnt = ARRAY_SIZE(omap2420_l4_wkup_slaves),
228 .flags = HWMOD_NO_IDLEST,
229};
230
231/* Master interfaces on the MPU device */
232static struct omap_hwmod_ocp_if *omap2420_mpu_masters[] = {
233 &omap2420_mpu__l3_main,
234};
235
236/* MPU */
237static struct omap_hwmod omap2420_mpu_hwmod = {
238 .name = "mpu",
239 .class = &mpu_hwmod_class,
240 .main_clk = "mpu_ck",
241 .masters = omap2420_mpu_masters,
242 .masters_cnt = ARRAY_SIZE(omap2420_mpu_masters),
243};
244
245/* 43/*
246 * IVA1 interface data 44 * IP blocks
247 */ 45 */
248 46
249/* IVA <- L3 interface */ 47/* IVA1 (IVA1) */
250static struct omap_hwmod_ocp_if omap2420_l3__iva = { 48static struct omap_hwmod_class iva1_hwmod_class = {
251 .master = &omap2420_l3_main_hwmod, 49 .name = "iva1",
252 .slave = &omap2420_iva_hwmod,
253 .clk = "iva1_ifck",
254 .user = OCP_USER_MPU | OCP_USER_SDMA,
255}; 50};
256 51
257static struct omap_hwmod_ocp_if *omap2420_iva_masters[] = { 52static struct omap_hwmod_rst_info omap2420_iva_resets[] = {
258 &omap2420_l3__iva, 53 { .name = "iva", .rst_shift = 8 },
259}; 54};
260 55
261/*
262 * IVA2 (IVA2)
263 */
264
265static struct omap_hwmod omap2420_iva_hwmod = { 56static struct omap_hwmod omap2420_iva_hwmod = {
266 .name = "iva", 57 .name = "iva",
267 .class = &iva_hwmod_class, 58 .class = &iva1_hwmod_class,
268 .masters = omap2420_iva_masters, 59 .clkdm_name = "iva1_clkdm",
269 .masters_cnt = ARRAY_SIZE(omap2420_iva_masters), 60 .rst_lines = omap2420_iva_resets,
270}; 61 .rst_lines_cnt = ARRAY_SIZE(omap2420_iva_resets),
271 62 .main_clk = "iva1_ifck",
272/* always-on timers dev attribute */
273static struct omap_timer_capability_dev_attr capability_alwon_dev_attr = {
274 .timer_capability = OMAP_TIMER_ALWON,
275}; 63};
276 64
277/* pwm timers dev attribute */ 65/* DSP */
278static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = { 66static struct omap_hwmod_class dsp_hwmod_class = {
279 .timer_capability = OMAP_TIMER_HAS_PWM, 67 .name = "dsp",
280};
281
282/* timer1 */
283static struct omap_hwmod omap2420_timer1_hwmod;
284
285static struct omap_hwmod_addr_space omap2420_timer1_addrs[] = {
286 {
287 .pa_start = 0x48028000,
288 .pa_end = 0x48028000 + SZ_1K - 1,
289 .flags = ADDR_TYPE_RT
290 },
291 { }
292}; 68};
293 69
294/* l4_wkup -> timer1 */ 70static struct omap_hwmod_rst_info omap2420_dsp_resets[] = {
295static struct omap_hwmod_ocp_if omap2420_l4_wkup__timer1 = { 71 { .name = "logic", .rst_shift = 0 },
296 .master = &omap2420_l4_wkup_hwmod, 72 { .name = "mmu", .rst_shift = 1 },
297 .slave = &omap2420_timer1_hwmod,
298 .clk = "gpt1_ick",
299 .addr = omap2420_timer1_addrs,
300 .user = OCP_USER_MPU | OCP_USER_SDMA,
301}; 73};
302 74
303/* timer1 slave port */ 75static struct omap_hwmod omap2420_dsp_hwmod = {
304static struct omap_hwmod_ocp_if *omap2420_timer1_slaves[] = { 76 .name = "dsp",
305 &omap2420_l4_wkup__timer1, 77 .class = &dsp_hwmod_class,
78 .clkdm_name = "dsp_clkdm",
79 .rst_lines = omap2420_dsp_resets,
80 .rst_lines_cnt = ARRAY_SIZE(omap2420_dsp_resets),
81 .main_clk = "dsp_fck",
306}; 82};
307 83
308/* timer1 hwmod */ 84/* I2C common */
309static struct omap_hwmod omap2420_timer1_hwmod = { 85static struct omap_hwmod_class_sysconfig i2c_sysc = {
310 .name = "timer1", 86 .rev_offs = 0x00,
311 .mpu_irqs = omap2_timer1_mpu_irqs, 87 .sysc_offs = 0x20,
312 .main_clk = "gpt1_fck", 88 .syss_offs = 0x10,
313 .prcm = { 89 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
314 .omap2 = { 90 .sysc_fields = &omap_hwmod_sysc_type1,
315 .prcm_reg_id = 1,
316 .module_bit = OMAP24XX_EN_GPT1_SHIFT,
317 .module_offs = WKUP_MOD,
318 .idlest_reg_id = 1,
319 .idlest_idle_bit = OMAP24XX_ST_GPT1_SHIFT,
320 },
321 },
322 .dev_attr = &capability_alwon_dev_attr,
323 .slaves = omap2420_timer1_slaves,
324 .slaves_cnt = ARRAY_SIZE(omap2420_timer1_slaves),
325 .class = &omap2xxx_timer_hwmod_class,
326}; 91};
327 92
328/* timer2 */ 93static struct omap_hwmod_class i2c_class = {
329static struct omap_hwmod omap2420_timer2_hwmod; 94 .name = "i2c",
330 95 .sysc = &i2c_sysc,
331/* l4_core -> timer2 */ 96 .rev = OMAP_I2C_IP_VERSION_1,
332static struct omap_hwmod_ocp_if omap2420_l4_core__timer2 = { 97 .reset = &omap_i2c_reset,
333 .master = &omap2420_l4_core_hwmod,
334 .slave = &omap2420_timer2_hwmod,
335 .clk = "gpt2_ick",
336 .addr = omap2xxx_timer2_addrs,
337 .user = OCP_USER_MPU | OCP_USER_SDMA,
338}; 98};
339 99
340/* timer2 slave port */ 100static struct omap_i2c_dev_attr i2c_dev_attr = {
341static struct omap_hwmod_ocp_if *omap2420_timer2_slaves[] = { 101 .flags = OMAP_I2C_FLAG_NO_FIFO |
342 &omap2420_l4_core__timer2, 102 OMAP_I2C_FLAG_SIMPLE_CLOCK |
103 OMAP_I2C_FLAG_16BIT_DATA_REG |
104 OMAP_I2C_FLAG_BUS_SHIFT_2,
343}; 105};
344 106
345/* timer2 hwmod */ 107/* I2C1 */
346static struct omap_hwmod omap2420_timer2_hwmod = { 108static struct omap_hwmod omap2420_i2c1_hwmod = {
347 .name = "timer2", 109 .name = "i2c1",
348 .mpu_irqs = omap2_timer2_mpu_irqs, 110 .mpu_irqs = omap2_i2c1_mpu_irqs,
349 .main_clk = "gpt2_fck", 111 .sdma_reqs = omap2_i2c1_sdma_reqs,
112 .main_clk = "i2c1_fck",
350 .prcm = { 113 .prcm = {
351 .omap2 = { 114 .omap2 = {
352 .prcm_reg_id = 1,
353 .module_bit = OMAP24XX_EN_GPT2_SHIFT,
354 .module_offs = CORE_MOD, 115 .module_offs = CORE_MOD,
116 .prcm_reg_id = 1,
117 .module_bit = OMAP2420_EN_I2C1_SHIFT,
355 .idlest_reg_id = 1, 118 .idlest_reg_id = 1,
356 .idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT, 119 .idlest_idle_bit = OMAP2420_ST_I2C1_SHIFT,
357 }, 120 },
358 }, 121 },
359 .dev_attr = &capability_alwon_dev_attr, 122 .class = &i2c_class,
360 .slaves = omap2420_timer2_slaves, 123 .dev_attr = &i2c_dev_attr,
361 .slaves_cnt = ARRAY_SIZE(omap2420_timer2_slaves), 124 .flags = HWMOD_16BIT_REG,
362 .class = &omap2xxx_timer_hwmod_class,
363};
364
365/* timer3 */
366static struct omap_hwmod omap2420_timer3_hwmod;
367
368/* l4_core -> timer3 */
369static struct omap_hwmod_ocp_if omap2420_l4_core__timer3 = {
370 .master = &omap2420_l4_core_hwmod,
371 .slave = &omap2420_timer3_hwmod,
372 .clk = "gpt3_ick",
373 .addr = omap2xxx_timer3_addrs,
374 .user = OCP_USER_MPU | OCP_USER_SDMA,
375};
376
377/* timer3 slave port */
378static struct omap_hwmod_ocp_if *omap2420_timer3_slaves[] = {
379 &omap2420_l4_core__timer3,
380}; 125};
381 126
382/* timer3 hwmod */ 127/* I2C2 */
383static struct omap_hwmod omap2420_timer3_hwmod = { 128static struct omap_hwmod omap2420_i2c2_hwmod = {
384 .name = "timer3", 129 .name = "i2c2",
385 .mpu_irqs = omap2_timer3_mpu_irqs, 130 .mpu_irqs = omap2_i2c2_mpu_irqs,
386 .main_clk = "gpt3_fck", 131 .sdma_reqs = omap2_i2c2_sdma_reqs,
132 .main_clk = "i2c2_fck",
387 .prcm = { 133 .prcm = {
388 .omap2 = { 134 .omap2 = {
389 .prcm_reg_id = 1,
390 .module_bit = OMAP24XX_EN_GPT3_SHIFT,
391 .module_offs = CORE_MOD, 135 .module_offs = CORE_MOD,
136 .prcm_reg_id = 1,
137 .module_bit = OMAP2420_EN_I2C2_SHIFT,
392 .idlest_reg_id = 1, 138 .idlest_reg_id = 1,
393 .idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT, 139 .idlest_idle_bit = OMAP2420_ST_I2C2_SHIFT,
394 }, 140 },
395 }, 141 },
396 .dev_attr = &capability_alwon_dev_attr, 142 .class = &i2c_class,
397 .slaves = omap2420_timer3_slaves, 143 .dev_attr = &i2c_dev_attr,
398 .slaves_cnt = ARRAY_SIZE(omap2420_timer3_slaves), 144 .flags = HWMOD_16BIT_REG,
399 .class = &omap2xxx_timer_hwmod_class,
400}; 145};
401 146
402/* timer4 */ 147/* dma attributes */
403static struct omap_hwmod omap2420_timer4_hwmod; 148static struct omap_dma_dev_attr dma_dev_attr = {
149 .dev_caps = RESERVE_CHANNEL | DMA_LINKED_LCH | GLOBAL_PRIORITY |
150 IS_CSSA_32 | IS_CDSA_32,
151 .lch_count = 32,
152};
404 153
405/* l4_core -> timer4 */ 154static struct omap_hwmod omap2420_dma_system_hwmod = {
406static struct omap_hwmod_ocp_if omap2420_l4_core__timer4 = { 155 .name = "dma",
407 .master = &omap2420_l4_core_hwmod, 156 .class = &omap2xxx_dma_hwmod_class,
408 .slave = &omap2420_timer4_hwmod, 157 .mpu_irqs = omap2_dma_system_irqs,
409 .clk = "gpt4_ick", 158 .main_clk = "core_l3_ck",
410 .addr = omap2xxx_timer4_addrs, 159 .dev_attr = &dma_dev_attr,
411 .user = OCP_USER_MPU | OCP_USER_SDMA, 160 .flags = HWMOD_NO_IDLEST,
412}; 161};
413 162
414/* timer4 slave port */ 163/* mailbox */
415static struct omap_hwmod_ocp_if *omap2420_timer4_slaves[] = { 164static struct omap_hwmod_irq_info omap2420_mailbox_irqs[] = {
416 &omap2420_l4_core__timer4, 165 { .name = "dsp", .irq = 26 },
166 { .name = "iva", .irq = 34 },
167 { .irq = -1 }
417}; 168};
418 169
419/* timer4 hwmod */ 170static struct omap_hwmod omap2420_mailbox_hwmod = {
420static struct omap_hwmod omap2420_timer4_hwmod = { 171 .name = "mailbox",
421 .name = "timer4", 172 .class = &omap2xxx_mailbox_hwmod_class,
422 .mpu_irqs = omap2_timer4_mpu_irqs, 173 .mpu_irqs = omap2420_mailbox_irqs,
423 .main_clk = "gpt4_fck", 174 .main_clk = "mailboxes_ick",
424 .prcm = { 175 .prcm = {
425 .omap2 = { 176 .omap2 = {
426 .prcm_reg_id = 1, 177 .prcm_reg_id = 1,
427 .module_bit = OMAP24XX_EN_GPT4_SHIFT, 178 .module_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
428 .module_offs = CORE_MOD, 179 .module_offs = CORE_MOD,
429 .idlest_reg_id = 1, 180 .idlest_reg_id = 1,
430 .idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT, 181 .idlest_idle_bit = OMAP24XX_ST_MAILBOXES_SHIFT,
431 }, 182 },
432 }, 183 },
433 .dev_attr = &capability_alwon_dev_attr,
434 .slaves = omap2420_timer4_slaves,
435 .slaves_cnt = ARRAY_SIZE(omap2420_timer4_slaves),
436 .class = &omap2xxx_timer_hwmod_class,
437}; 184};
438 185
439/* timer5 */ 186/*
440static struct omap_hwmod omap2420_timer5_hwmod; 187 * 'mcbsp' class
188 * multi channel buffered serial port controller
189 */
441 190
442/* l4_core -> timer5 */ 191static struct omap_hwmod_class omap2420_mcbsp_hwmod_class = {
443static struct omap_hwmod_ocp_if omap2420_l4_core__timer5 = { 192 .name = "mcbsp",
444 .master = &omap2420_l4_core_hwmod,
445 .slave = &omap2420_timer5_hwmod,
446 .clk = "gpt5_ick",
447 .addr = omap2xxx_timer5_addrs,
448 .user = OCP_USER_MPU | OCP_USER_SDMA,
449}; 193};
450 194
451/* timer5 slave port */ 195/* mcbsp1 */
452static struct omap_hwmod_ocp_if *omap2420_timer5_slaves[] = { 196static struct omap_hwmod_irq_info omap2420_mcbsp1_irqs[] = {
453 &omap2420_l4_core__timer5, 197 { .name = "tx", .irq = 59 },
198 { .name = "rx", .irq = 60 },
199 { .irq = -1 }
454}; 200};
455 201
456/* timer5 hwmod */ 202static struct omap_hwmod omap2420_mcbsp1_hwmod = {
457static struct omap_hwmod omap2420_timer5_hwmod = { 203 .name = "mcbsp1",
458 .name = "timer5", 204 .class = &omap2420_mcbsp_hwmod_class,
459 .mpu_irqs = omap2_timer5_mpu_irqs, 205 .mpu_irqs = omap2420_mcbsp1_irqs,
460 .main_clk = "gpt5_fck", 206 .sdma_reqs = omap2_mcbsp1_sdma_reqs,
207 .main_clk = "mcbsp1_fck",
461 .prcm = { 208 .prcm = {
462 .omap2 = { 209 .omap2 = {
463 .prcm_reg_id = 1, 210 .prcm_reg_id = 1,
464 .module_bit = OMAP24XX_EN_GPT5_SHIFT, 211 .module_bit = OMAP24XX_EN_MCBSP1_SHIFT,
465 .module_offs = CORE_MOD, 212 .module_offs = CORE_MOD,
466 .idlest_reg_id = 1, 213 .idlest_reg_id = 1,
467 .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT, 214 .idlest_idle_bit = OMAP24XX_ST_MCBSP1_SHIFT,
468 }, 215 },
469 }, 216 },
470 .dev_attr = &capability_alwon_dev_attr,
471 .slaves = omap2420_timer5_slaves,
472 .slaves_cnt = ARRAY_SIZE(omap2420_timer5_slaves),
473 .class = &omap2xxx_timer_hwmod_class,
474}; 217};
475 218
476 219/* mcbsp2 */
477/* timer6 */ 220static struct omap_hwmod_irq_info omap2420_mcbsp2_irqs[] = {
478static struct omap_hwmod omap2420_timer6_hwmod; 221 { .name = "tx", .irq = 62 },
479 222 { .name = "rx", .irq = 63 },
480/* l4_core -> timer6 */ 223 { .irq = -1 }
481static struct omap_hwmod_ocp_if omap2420_l4_core__timer6 = {
482 .master = &omap2420_l4_core_hwmod,
483 .slave = &omap2420_timer6_hwmod,
484 .clk = "gpt6_ick",
485 .addr = omap2xxx_timer6_addrs,
486 .user = OCP_USER_MPU | OCP_USER_SDMA,
487};
488
489/* timer6 slave port */
490static struct omap_hwmod_ocp_if *omap2420_timer6_slaves[] = {
491 &omap2420_l4_core__timer6,
492}; 224};
493 225
494/* timer6 hwmod */ 226static struct omap_hwmod omap2420_mcbsp2_hwmod = {
495static struct omap_hwmod omap2420_timer6_hwmod = { 227 .name = "mcbsp2",
496 .name = "timer6", 228 .class = &omap2420_mcbsp_hwmod_class,
497 .mpu_irqs = omap2_timer6_mpu_irqs, 229 .mpu_irqs = omap2420_mcbsp2_irqs,
498 .main_clk = "gpt6_fck", 230 .sdma_reqs = omap2_mcbsp2_sdma_reqs,
231 .main_clk = "mcbsp2_fck",
499 .prcm = { 232 .prcm = {
500 .omap2 = { 233 .omap2 = {
501 .prcm_reg_id = 1, 234 .prcm_reg_id = 1,
502 .module_bit = OMAP24XX_EN_GPT6_SHIFT, 235 .module_bit = OMAP24XX_EN_MCBSP2_SHIFT,
503 .module_offs = CORE_MOD, 236 .module_offs = CORE_MOD,
504 .idlest_reg_id = 1, 237 .idlest_reg_id = 1,
505 .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT, 238 .idlest_idle_bit = OMAP24XX_ST_MCBSP2_SHIFT,
506 }, 239 },
507 }, 240 },
508 .dev_attr = &capability_alwon_dev_attr,
509 .slaves = omap2420_timer6_slaves,
510 .slaves_cnt = ARRAY_SIZE(omap2420_timer6_slaves),
511 .class = &omap2xxx_timer_hwmod_class,
512}; 241};
513 242
514/* timer7 */ 243static struct omap_hwmod_class_sysconfig omap2420_msdi_sysc = {
515static struct omap_hwmod omap2420_timer7_hwmod; 244 .rev_offs = 0x3c,
516 245 .sysc_offs = 0x64,
517/* l4_core -> timer7 */ 246 .syss_offs = 0x68,
518static struct omap_hwmod_ocp_if omap2420_l4_core__timer7 = { 247 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
519 .master = &omap2420_l4_core_hwmod, 248 .sysc_fields = &omap_hwmod_sysc_type1,
520 .slave = &omap2420_timer7_hwmod,
521 .clk = "gpt7_ick",
522 .addr = omap2xxx_timer7_addrs,
523 .user = OCP_USER_MPU | OCP_USER_SDMA,
524};
525
526/* timer7 slave port */
527static struct omap_hwmod_ocp_if *omap2420_timer7_slaves[] = {
528 &omap2420_l4_core__timer7,
529}; 249};
530 250
531/* timer7 hwmod */ 251static struct omap_hwmod_class omap2420_msdi_hwmod_class = {
532static struct omap_hwmod omap2420_timer7_hwmod = { 252 .name = "msdi",
533 .name = "timer7", 253 .sysc = &omap2420_msdi_sysc,
534 .mpu_irqs = omap2_timer7_mpu_irqs, 254 .reset = &omap_msdi_reset,
535 .main_clk = "gpt7_fck",
536 .prcm = {
537 .omap2 = {
538 .prcm_reg_id = 1,
539 .module_bit = OMAP24XX_EN_GPT7_SHIFT,
540 .module_offs = CORE_MOD,
541 .idlest_reg_id = 1,
542 .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT,
543 },
544 },
545 .dev_attr = &capability_alwon_dev_attr,
546 .slaves = omap2420_timer7_slaves,
547 .slaves_cnt = ARRAY_SIZE(omap2420_timer7_slaves),
548 .class = &omap2xxx_timer_hwmod_class,
549}; 255};
550 256
551/* timer8 */ 257/* msdi1 */
552static struct omap_hwmod omap2420_timer8_hwmod; 258static struct omap_hwmod_irq_info omap2420_msdi1_irqs[] = {
553 259 { .irq = 83 },
554/* l4_core -> timer8 */ 260 { .irq = -1 }
555static struct omap_hwmod_ocp_if omap2420_l4_core__timer8 = {
556 .master = &omap2420_l4_core_hwmod,
557 .slave = &omap2420_timer8_hwmod,
558 .clk = "gpt8_ick",
559 .addr = omap2xxx_timer8_addrs,
560 .user = OCP_USER_MPU | OCP_USER_SDMA,
561}; 261};
562 262
563/* timer8 slave port */ 263static struct omap_hwmod_dma_info omap2420_msdi1_sdma_reqs[] = {
564static struct omap_hwmod_ocp_if *omap2420_timer8_slaves[] = { 264 { .name = "tx", .dma_req = 61 }, /* OMAP24XX_DMA_MMC1_TX */
565 &omap2420_l4_core__timer8, 265 { .name = "rx", .dma_req = 62 }, /* OMAP24XX_DMA_MMC1_RX */
266 { .dma_req = -1 }
566}; 267};
567 268
568/* timer8 hwmod */ 269static struct omap_hwmod omap2420_msdi1_hwmod = {
569static struct omap_hwmod omap2420_timer8_hwmod = { 270 .name = "msdi1",
570 .name = "timer8", 271 .class = &omap2420_msdi_hwmod_class,
571 .mpu_irqs = omap2_timer8_mpu_irqs, 272 .mpu_irqs = omap2420_msdi1_irqs,
572 .main_clk = "gpt8_fck", 273 .sdma_reqs = omap2420_msdi1_sdma_reqs,
274 .main_clk = "mmc_fck",
573 .prcm = { 275 .prcm = {
574 .omap2 = { 276 .omap2 = {
575 .prcm_reg_id = 1, 277 .prcm_reg_id = 1,
576 .module_bit = OMAP24XX_EN_GPT8_SHIFT, 278 .module_bit = OMAP2420_EN_MMC_SHIFT,
577 .module_offs = CORE_MOD, 279 .module_offs = CORE_MOD,
578 .idlest_reg_id = 1, 280 .idlest_reg_id = 1,
579 .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT, 281 .idlest_idle_bit = OMAP2420_ST_MMC_SHIFT,
580 }, 282 },
581 }, 283 },
582 .dev_attr = &capability_alwon_dev_attr, 284 .flags = HWMOD_16BIT_REG,
583 .slaves = omap2420_timer8_slaves,
584 .slaves_cnt = ARRAY_SIZE(omap2420_timer8_slaves),
585 .class = &omap2xxx_timer_hwmod_class,
586};
587
588/* timer9 */
589static struct omap_hwmod omap2420_timer9_hwmod;
590
591/* l4_core -> timer9 */
592static struct omap_hwmod_ocp_if omap2420_l4_core__timer9 = {
593 .master = &omap2420_l4_core_hwmod,
594 .slave = &omap2420_timer9_hwmod,
595 .clk = "gpt9_ick",
596 .addr = omap2xxx_timer9_addrs,
597 .user = OCP_USER_MPU | OCP_USER_SDMA,
598};
599
600/* timer9 slave port */
601static struct omap_hwmod_ocp_if *omap2420_timer9_slaves[] = {
602 &omap2420_l4_core__timer9,
603}; 285};
604 286
605/* timer9 hwmod */ 287/* HDQ1W/1-wire */
606static struct omap_hwmod omap2420_timer9_hwmod = { 288static struct omap_hwmod omap2420_hdq1w_hwmod = {
607 .name = "timer9", 289 .name = "hdq1w",
608 .mpu_irqs = omap2_timer9_mpu_irqs, 290 .mpu_irqs = omap2_hdq1w_mpu_irqs,
609 .main_clk = "gpt9_fck", 291 .main_clk = "hdq_fck",
610 .prcm = { 292 .prcm = {
611 .omap2 = { 293 .omap2 = {
612 .prcm_reg_id = 1,
613 .module_bit = OMAP24XX_EN_GPT9_SHIFT,
614 .module_offs = CORE_MOD, 294 .module_offs = CORE_MOD,
295 .prcm_reg_id = 1,
296 .module_bit = OMAP24XX_EN_HDQ_SHIFT,
615 .idlest_reg_id = 1, 297 .idlest_reg_id = 1,
616 .idlest_idle_bit = OMAP24XX_ST_GPT9_SHIFT, 298 .idlest_idle_bit = OMAP24XX_ST_HDQ_SHIFT,
617 }, 299 },
618 }, 300 },
619 .dev_attr = &capability_pwm_dev_attr, 301 .class = &omap2_hdq1w_class,
620 .slaves = omap2420_timer9_slaves,
621 .slaves_cnt = ARRAY_SIZE(omap2420_timer9_slaves),
622 .class = &omap2xxx_timer_hwmod_class,
623}; 302};
624 303
625/* timer10 */ 304/*
626static struct omap_hwmod omap2420_timer10_hwmod; 305 * interfaces
306 */
627 307
628/* l4_core -> timer10 */ 308/* L4 CORE -> I2C1 interface */
629static struct omap_hwmod_ocp_if omap2420_l4_core__timer10 = { 309static struct omap_hwmod_ocp_if omap2420_l4_core__i2c1 = {
630 .master = &omap2420_l4_core_hwmod, 310 .master = &omap2xxx_l4_core_hwmod,
631 .slave = &omap2420_timer10_hwmod, 311 .slave = &omap2420_i2c1_hwmod,
632 .clk = "gpt10_ick", 312 .clk = "i2c1_ick",
633 .addr = omap2_timer10_addrs, 313 .addr = omap2_i2c1_addr_space,
634 .user = OCP_USER_MPU | OCP_USER_SDMA, 314 .user = OCP_USER_MPU | OCP_USER_SDMA,
635}; 315};
636 316
637/* timer10 slave port */ 317/* L4 CORE -> I2C2 interface */
638static struct omap_hwmod_ocp_if *omap2420_timer10_slaves[] = { 318static struct omap_hwmod_ocp_if omap2420_l4_core__i2c2 = {
639 &omap2420_l4_core__timer10, 319 .master = &omap2xxx_l4_core_hwmod,
640}; 320 .slave = &omap2420_i2c2_hwmod,
641 321 .clk = "i2c2_ick",
642/* timer10 hwmod */ 322 .addr = omap2_i2c2_addr_space,
643static struct omap_hwmod omap2420_timer10_hwmod = { 323 .user = OCP_USER_MPU | OCP_USER_SDMA,
644 .name = "timer10",
645 .mpu_irqs = omap2_timer10_mpu_irqs,
646 .main_clk = "gpt10_fck",
647 .prcm = {
648 .omap2 = {
649 .prcm_reg_id = 1,
650 .module_bit = OMAP24XX_EN_GPT10_SHIFT,
651 .module_offs = CORE_MOD,
652 .idlest_reg_id = 1,
653 .idlest_idle_bit = OMAP24XX_ST_GPT10_SHIFT,
654 },
655 },
656 .dev_attr = &capability_pwm_dev_attr,
657 .slaves = omap2420_timer10_slaves,
658 .slaves_cnt = ARRAY_SIZE(omap2420_timer10_slaves),
659 .class = &omap2xxx_timer_hwmod_class,
660}; 324};
661 325
662/* timer11 */ 326/* IVA <- L3 interface */
663static struct omap_hwmod omap2420_timer11_hwmod; 327static struct omap_hwmod_ocp_if omap2420_l3__iva = {
664 328 .master = &omap2xxx_l3_main_hwmod,
665/* l4_core -> timer11 */ 329 .slave = &omap2420_iva_hwmod,
666static struct omap_hwmod_ocp_if omap2420_l4_core__timer11 = { 330 .clk = "core_l3_ck",
667 .master = &omap2420_l4_core_hwmod,
668 .slave = &omap2420_timer11_hwmod,
669 .clk = "gpt11_ick",
670 .addr = omap2_timer11_addrs,
671 .user = OCP_USER_MPU | OCP_USER_SDMA, 331 .user = OCP_USER_MPU | OCP_USER_SDMA,
672}; 332};
673 333
674/* timer11 slave port */ 334/* DSP <- L3 interface */
675static struct omap_hwmod_ocp_if *omap2420_timer11_slaves[] = { 335static struct omap_hwmod_ocp_if omap2420_l3__dsp = {
676 &omap2420_l4_core__timer11, 336 .master = &omap2xxx_l3_main_hwmod,
337 .slave = &omap2420_dsp_hwmod,
338 .clk = "dsp_ick",
339 .user = OCP_USER_MPU | OCP_USER_SDMA,
677}; 340};
678 341
679/* timer11 hwmod */ 342static struct omap_hwmod_addr_space omap2420_timer1_addrs[] = {
680static struct omap_hwmod omap2420_timer11_hwmod = { 343 {
681 .name = "timer11", 344 .pa_start = 0x48028000,
682 .mpu_irqs = omap2_timer11_mpu_irqs, 345 .pa_end = 0x48028000 + SZ_1K - 1,
683 .main_clk = "gpt11_fck", 346 .flags = ADDR_TYPE_RT
684 .prcm = {
685 .omap2 = {
686 .prcm_reg_id = 1,
687 .module_bit = OMAP24XX_EN_GPT11_SHIFT,
688 .module_offs = CORE_MOD,
689 .idlest_reg_id = 1,
690 .idlest_idle_bit = OMAP24XX_ST_GPT11_SHIFT,
691 },
692 }, 347 },
693 .dev_attr = &capability_pwm_dev_attr, 348 { }
694 .slaves = omap2420_timer11_slaves,
695 .slaves_cnt = ARRAY_SIZE(omap2420_timer11_slaves),
696 .class = &omap2xxx_timer_hwmod_class,
697}; 349};
698 350
699/* timer12 */ 351/* l4_wkup -> timer1 */
700static struct omap_hwmod omap2420_timer12_hwmod; 352static struct omap_hwmod_ocp_if omap2420_l4_wkup__timer1 = {
701 353 .master = &omap2xxx_l4_wkup_hwmod,
702/* l4_core -> timer12 */ 354 .slave = &omap2xxx_timer1_hwmod,
703static struct omap_hwmod_ocp_if omap2420_l4_core__timer12 = { 355 .clk = "gpt1_ick",
704 .master = &omap2420_l4_core_hwmod, 356 .addr = omap2420_timer1_addrs,
705 .slave = &omap2420_timer12_hwmod,
706 .clk = "gpt12_ick",
707 .addr = omap2xxx_timer12_addrs,
708 .user = OCP_USER_MPU | OCP_USER_SDMA, 357 .user = OCP_USER_MPU | OCP_USER_SDMA,
709}; 358};
710 359
711/* timer12 slave port */
712static struct omap_hwmod_ocp_if *omap2420_timer12_slaves[] = {
713 &omap2420_l4_core__timer12,
714};
715
716/* timer12 hwmod */
717static struct omap_hwmod omap2420_timer12_hwmod = {
718 .name = "timer12",
719 .mpu_irqs = omap2xxx_timer12_mpu_irqs,
720 .main_clk = "gpt12_fck",
721 .prcm = {
722 .omap2 = {
723 .prcm_reg_id = 1,
724 .module_bit = OMAP24XX_EN_GPT12_SHIFT,
725 .module_offs = CORE_MOD,
726 .idlest_reg_id = 1,
727 .idlest_idle_bit = OMAP24XX_ST_GPT12_SHIFT,
728 },
729 },
730 .dev_attr = &capability_pwm_dev_attr,
731 .slaves = omap2420_timer12_slaves,
732 .slaves_cnt = ARRAY_SIZE(omap2420_timer12_slaves),
733 .class = &omap2xxx_timer_hwmod_class,
734};
735
736/* l4_wkup -> wd_timer2 */ 360/* l4_wkup -> wd_timer2 */
737static struct omap_hwmod_addr_space omap2420_wd_timer2_addrs[] = { 361static struct omap_hwmod_addr_space omap2420_wd_timer2_addrs[] = {
738 { 362 {
@@ -744,364 +368,13 @@ static struct omap_hwmod_addr_space omap2420_wd_timer2_addrs[] = {
744}; 368};
745 369
746static struct omap_hwmod_ocp_if omap2420_l4_wkup__wd_timer2 = { 370static struct omap_hwmod_ocp_if omap2420_l4_wkup__wd_timer2 = {
747 .master = &omap2420_l4_wkup_hwmod, 371 .master = &omap2xxx_l4_wkup_hwmod,
748 .slave = &omap2420_wd_timer2_hwmod, 372 .slave = &omap2xxx_wd_timer2_hwmod,
749 .clk = "mpu_wdt_ick", 373 .clk = "mpu_wdt_ick",
750 .addr = omap2420_wd_timer2_addrs, 374 .addr = omap2420_wd_timer2_addrs,
751 .user = OCP_USER_MPU | OCP_USER_SDMA, 375 .user = OCP_USER_MPU | OCP_USER_SDMA,
752}; 376};
753 377
754/* wd_timer2 */
755static struct omap_hwmod_ocp_if *omap2420_wd_timer2_slaves[] = {
756 &omap2420_l4_wkup__wd_timer2,
757};
758
759static struct omap_hwmod omap2420_wd_timer2_hwmod = {
760 .name = "wd_timer2",
761 .class = &omap2xxx_wd_timer_hwmod_class,
762 .main_clk = "mpu_wdt_fck",
763 .prcm = {
764 .omap2 = {
765 .prcm_reg_id = 1,
766 .module_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
767 .module_offs = WKUP_MOD,
768 .idlest_reg_id = 1,
769 .idlest_idle_bit = OMAP24XX_ST_MPU_WDT_SHIFT,
770 },
771 },
772 .slaves = omap2420_wd_timer2_slaves,
773 .slaves_cnt = ARRAY_SIZE(omap2420_wd_timer2_slaves),
774};
775
776/* UART1 */
777
778static struct omap_hwmod_ocp_if *omap2420_uart1_slaves[] = {
779 &omap2_l4_core__uart1,
780};
781
782static struct omap_hwmod omap2420_uart1_hwmod = {
783 .name = "uart1",
784 .mpu_irqs = omap2_uart1_mpu_irqs,
785 .sdma_reqs = omap2_uart1_sdma_reqs,
786 .main_clk = "uart1_fck",
787 .prcm = {
788 .omap2 = {
789 .module_offs = CORE_MOD,
790 .prcm_reg_id = 1,
791 .module_bit = OMAP24XX_EN_UART1_SHIFT,
792 .idlest_reg_id = 1,
793 .idlest_idle_bit = OMAP24XX_EN_UART1_SHIFT,
794 },
795 },
796 .slaves = omap2420_uart1_slaves,
797 .slaves_cnt = ARRAY_SIZE(omap2420_uart1_slaves),
798 .class = &omap2_uart_class,
799};
800
801/* UART2 */
802
803static struct omap_hwmod_ocp_if *omap2420_uart2_slaves[] = {
804 &omap2_l4_core__uart2,
805};
806
807static struct omap_hwmod omap2420_uart2_hwmod = {
808 .name = "uart2",
809 .mpu_irqs = omap2_uart2_mpu_irqs,
810 .sdma_reqs = omap2_uart2_sdma_reqs,
811 .main_clk = "uart2_fck",
812 .prcm = {
813 .omap2 = {
814 .module_offs = CORE_MOD,
815 .prcm_reg_id = 1,
816 .module_bit = OMAP24XX_EN_UART2_SHIFT,
817 .idlest_reg_id = 1,
818 .idlest_idle_bit = OMAP24XX_EN_UART2_SHIFT,
819 },
820 },
821 .slaves = omap2420_uart2_slaves,
822 .slaves_cnt = ARRAY_SIZE(omap2420_uart2_slaves),
823 .class = &omap2_uart_class,
824};
825
826/* UART3 */
827
828static struct omap_hwmod_ocp_if *omap2420_uart3_slaves[] = {
829 &omap2_l4_core__uart3,
830};
831
832static struct omap_hwmod omap2420_uart3_hwmod = {
833 .name = "uart3",
834 .mpu_irqs = omap2_uart3_mpu_irqs,
835 .sdma_reqs = omap2_uart3_sdma_reqs,
836 .main_clk = "uart3_fck",
837 .prcm = {
838 .omap2 = {
839 .module_offs = CORE_MOD,
840 .prcm_reg_id = 2,
841 .module_bit = OMAP24XX_EN_UART3_SHIFT,
842 .idlest_reg_id = 2,
843 .idlest_idle_bit = OMAP24XX_EN_UART3_SHIFT,
844 },
845 },
846 .slaves = omap2420_uart3_slaves,
847 .slaves_cnt = ARRAY_SIZE(omap2420_uart3_slaves),
848 .class = &omap2_uart_class,
849};
850
851/* dss */
852/* dss master ports */
853static struct omap_hwmod_ocp_if *omap2420_dss_masters[] = {
854 &omap2420_dss__l3,
855};
856
857/* l4_core -> dss */
858static struct omap_hwmod_ocp_if omap2420_l4_core__dss = {
859 .master = &omap2420_l4_core_hwmod,
860 .slave = &omap2420_dss_core_hwmod,
861 .clk = "dss_ick",
862 .addr = omap2_dss_addrs,
863 .fw = {
864 .omap2 = {
865 .l4_fw_region = OMAP2420_L4_CORE_FW_DSS_CORE_REGION,
866 .flags = OMAP_FIREWALL_L4,
867 }
868 },
869 .user = OCP_USER_MPU | OCP_USER_SDMA,
870};
871
872/* dss slave ports */
873static struct omap_hwmod_ocp_if *omap2420_dss_slaves[] = {
874 &omap2420_l4_core__dss,
875};
876
877static struct omap_hwmod_opt_clk dss_opt_clks[] = {
878 /*
879 * The DSS HW needs all DSS clocks enabled during reset. The dss_core
880 * driver does not use these clocks.
881 */
882 { .role = "tv_clk", .clk = "dss_54m_fck" },
883 { .role = "sys_clk", .clk = "dss2_fck" },
884};
885
886static struct omap_hwmod omap2420_dss_core_hwmod = {
887 .name = "dss_core",
888 .class = &omap2_dss_hwmod_class,
889 .main_clk = "dss1_fck", /* instead of dss_fck */
890 .sdma_reqs = omap2xxx_dss_sdma_chs,
891 .prcm = {
892 .omap2 = {
893 .prcm_reg_id = 1,
894 .module_bit = OMAP24XX_EN_DSS1_SHIFT,
895 .module_offs = CORE_MOD,
896 .idlest_reg_id = 1,
897 .idlest_stdby_bit = OMAP24XX_ST_DSS_SHIFT,
898 },
899 },
900 .opt_clks = dss_opt_clks,
901 .opt_clks_cnt = ARRAY_SIZE(dss_opt_clks),
902 .slaves = omap2420_dss_slaves,
903 .slaves_cnt = ARRAY_SIZE(omap2420_dss_slaves),
904 .masters = omap2420_dss_masters,
905 .masters_cnt = ARRAY_SIZE(omap2420_dss_masters),
906 .flags = HWMOD_NO_IDLEST | HWMOD_CONTROL_OPT_CLKS_IN_RESET,
907};
908
909/* l4_core -> dss_dispc */
910static struct omap_hwmod_ocp_if omap2420_l4_core__dss_dispc = {
911 .master = &omap2420_l4_core_hwmod,
912 .slave = &omap2420_dss_dispc_hwmod,
913 .clk = "dss_ick",
914 .addr = omap2_dss_dispc_addrs,
915 .fw = {
916 .omap2 = {
917 .l4_fw_region = OMAP2420_L4_CORE_FW_DSS_DISPC_REGION,
918 .flags = OMAP_FIREWALL_L4,
919 }
920 },
921 .user = OCP_USER_MPU | OCP_USER_SDMA,
922};
923
924/* dss_dispc slave ports */
925static struct omap_hwmod_ocp_if *omap2420_dss_dispc_slaves[] = {
926 &omap2420_l4_core__dss_dispc,
927};
928
929static struct omap_hwmod omap2420_dss_dispc_hwmod = {
930 .name = "dss_dispc",
931 .class = &omap2_dispc_hwmod_class,
932 .mpu_irqs = omap2_dispc_irqs,
933 .main_clk = "dss1_fck",
934 .prcm = {
935 .omap2 = {
936 .prcm_reg_id = 1,
937 .module_bit = OMAP24XX_EN_DSS1_SHIFT,
938 .module_offs = CORE_MOD,
939 .idlest_reg_id = 1,
940 .idlest_stdby_bit = OMAP24XX_ST_DSS_SHIFT,
941 },
942 },
943 .slaves = omap2420_dss_dispc_slaves,
944 .slaves_cnt = ARRAY_SIZE(omap2420_dss_dispc_slaves),
945 .flags = HWMOD_NO_IDLEST,
946 .dev_attr = &omap2_3_dss_dispc_dev_attr
947};
948
949/* l4_core -> dss_rfbi */
950static struct omap_hwmod_ocp_if omap2420_l4_core__dss_rfbi = {
951 .master = &omap2420_l4_core_hwmod,
952 .slave = &omap2420_dss_rfbi_hwmod,
953 .clk = "dss_ick",
954 .addr = omap2_dss_rfbi_addrs,
955 .fw = {
956 .omap2 = {
957 .l4_fw_region = OMAP2420_L4_CORE_FW_DSS_CORE_REGION,
958 .flags = OMAP_FIREWALL_L4,
959 }
960 },
961 .user = OCP_USER_MPU | OCP_USER_SDMA,
962};
963
964/* dss_rfbi slave ports */
965static struct omap_hwmod_ocp_if *omap2420_dss_rfbi_slaves[] = {
966 &omap2420_l4_core__dss_rfbi,
967};
968
969static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = {
970 { .role = "ick", .clk = "dss_ick" },
971};
972
973static struct omap_hwmod omap2420_dss_rfbi_hwmod = {
974 .name = "dss_rfbi",
975 .class = &omap2_rfbi_hwmod_class,
976 .main_clk = "dss1_fck",
977 .prcm = {
978 .omap2 = {
979 .prcm_reg_id = 1,
980 .module_bit = OMAP24XX_EN_DSS1_SHIFT,
981 .module_offs = CORE_MOD,
982 },
983 },
984 .opt_clks = dss_rfbi_opt_clks,
985 .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks),
986 .slaves = omap2420_dss_rfbi_slaves,
987 .slaves_cnt = ARRAY_SIZE(omap2420_dss_rfbi_slaves),
988 .flags = HWMOD_NO_IDLEST,
989};
990
991/* l4_core -> dss_venc */
992static struct omap_hwmod_ocp_if omap2420_l4_core__dss_venc = {
993 .master = &omap2420_l4_core_hwmod,
994 .slave = &omap2420_dss_venc_hwmod,
995 .clk = "dss_ick",
996 .addr = omap2_dss_venc_addrs,
997 .fw = {
998 .omap2 = {
999 .l4_fw_region = OMAP2420_L4_CORE_FW_DSS_VENC_REGION,
1000 .flags = OMAP_FIREWALL_L4,
1001 }
1002 },
1003 .flags = OCPIF_SWSUP_IDLE,
1004 .user = OCP_USER_MPU | OCP_USER_SDMA,
1005};
1006
1007/* dss_venc slave ports */
1008static struct omap_hwmod_ocp_if *omap2420_dss_venc_slaves[] = {
1009 &omap2420_l4_core__dss_venc,
1010};
1011
1012static struct omap_hwmod omap2420_dss_venc_hwmod = {
1013 .name = "dss_venc",
1014 .class = &omap2_venc_hwmod_class,
1015 .main_clk = "dss_54m_fck",
1016 .prcm = {
1017 .omap2 = {
1018 .prcm_reg_id = 1,
1019 .module_bit = OMAP24XX_EN_DSS1_SHIFT,
1020 .module_offs = CORE_MOD,
1021 },
1022 },
1023 .slaves = omap2420_dss_venc_slaves,
1024 .slaves_cnt = ARRAY_SIZE(omap2420_dss_venc_slaves),
1025 .flags = HWMOD_NO_IDLEST,
1026};
1027
1028/* I2C common */
1029static struct omap_hwmod_class_sysconfig i2c_sysc = {
1030 .rev_offs = 0x00,
1031 .sysc_offs = 0x20,
1032 .syss_offs = 0x10,
1033 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
1034 .sysc_fields = &omap_hwmod_sysc_type1,
1035};
1036
1037static struct omap_hwmod_class i2c_class = {
1038 .name = "i2c",
1039 .sysc = &i2c_sysc,
1040 .rev = OMAP_I2C_IP_VERSION_1,
1041 .reset = &omap_i2c_reset,
1042};
1043
1044static struct omap_i2c_dev_attr i2c_dev_attr = {
1045 .flags = OMAP_I2C_FLAG_NO_FIFO |
1046 OMAP_I2C_FLAG_SIMPLE_CLOCK |
1047 OMAP_I2C_FLAG_16BIT_DATA_REG |
1048 OMAP_I2C_FLAG_BUS_SHIFT_2,
1049};
1050
1051/* I2C1 */
1052
1053static struct omap_hwmod_ocp_if *omap2420_i2c1_slaves[] = {
1054 &omap2420_l4_core__i2c1,
1055};
1056
1057static struct omap_hwmod omap2420_i2c1_hwmod = {
1058 .name = "i2c1",
1059 .mpu_irqs = omap2_i2c1_mpu_irqs,
1060 .sdma_reqs = omap2_i2c1_sdma_reqs,
1061 .main_clk = "i2c1_fck",
1062 .prcm = {
1063 .omap2 = {
1064 .module_offs = CORE_MOD,
1065 .prcm_reg_id = 1,
1066 .module_bit = OMAP2420_EN_I2C1_SHIFT,
1067 .idlest_reg_id = 1,
1068 .idlest_idle_bit = OMAP2420_ST_I2C1_SHIFT,
1069 },
1070 },
1071 .slaves = omap2420_i2c1_slaves,
1072 .slaves_cnt = ARRAY_SIZE(omap2420_i2c1_slaves),
1073 .class = &i2c_class,
1074 .dev_attr = &i2c_dev_attr,
1075 .flags = HWMOD_16BIT_REG,
1076};
1077
1078/* I2C2 */
1079
1080static struct omap_hwmod_ocp_if *omap2420_i2c2_slaves[] = {
1081 &omap2420_l4_core__i2c2,
1082};
1083
1084static struct omap_hwmod omap2420_i2c2_hwmod = {
1085 .name = "i2c2",
1086 .mpu_irqs = omap2_i2c2_mpu_irqs,
1087 .sdma_reqs = omap2_i2c2_sdma_reqs,
1088 .main_clk = "i2c2_fck",
1089 .prcm = {
1090 .omap2 = {
1091 .module_offs = CORE_MOD,
1092 .prcm_reg_id = 1,
1093 .module_bit = OMAP2420_EN_I2C2_SHIFT,
1094 .idlest_reg_id = 1,
1095 .idlest_idle_bit = OMAP2420_ST_I2C2_SHIFT,
1096 },
1097 },
1098 .slaves = omap2420_i2c2_slaves,
1099 .slaves_cnt = ARRAY_SIZE(omap2420_i2c2_slaves),
1100 .class = &i2c_class,
1101 .dev_attr = &i2c_dev_attr,
1102 .flags = HWMOD_16BIT_REG,
1103};
1104
1105/* l4_wkup -> gpio1 */ 378/* l4_wkup -> gpio1 */
1106static struct omap_hwmod_addr_space omap2420_gpio1_addr_space[] = { 379static struct omap_hwmod_addr_space omap2420_gpio1_addr_space[] = {
1107 { 380 {
@@ -1113,8 +386,8 @@ static struct omap_hwmod_addr_space omap2420_gpio1_addr_space[] = {
1113}; 386};
1114 387
1115static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio1 = { 388static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio1 = {
1116 .master = &omap2420_l4_wkup_hwmod, 389 .master = &omap2xxx_l4_wkup_hwmod,
1117 .slave = &omap2420_gpio1_hwmod, 390 .slave = &omap2xxx_gpio1_hwmod,
1118 .clk = "gpios_ick", 391 .clk = "gpios_ick",
1119 .addr = omap2420_gpio1_addr_space, 392 .addr = omap2420_gpio1_addr_space,
1120 .user = OCP_USER_MPU | OCP_USER_SDMA, 393 .user = OCP_USER_MPU | OCP_USER_SDMA,
@@ -1131,8 +404,8 @@ static struct omap_hwmod_addr_space omap2420_gpio2_addr_space[] = {
1131}; 404};
1132 405
1133static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio2 = { 406static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio2 = {
1134 .master = &omap2420_l4_wkup_hwmod, 407 .master = &omap2xxx_l4_wkup_hwmod,
1135 .slave = &omap2420_gpio2_hwmod, 408 .slave = &omap2xxx_gpio2_hwmod,
1136 .clk = "gpios_ick", 409 .clk = "gpios_ick",
1137 .addr = omap2420_gpio2_addr_space, 410 .addr = omap2420_gpio2_addr_space,
1138 .user = OCP_USER_MPU | OCP_USER_SDMA, 411 .user = OCP_USER_MPU | OCP_USER_SDMA,
@@ -1149,8 +422,8 @@ static struct omap_hwmod_addr_space omap2420_gpio3_addr_space[] = {
1149}; 422};
1150 423
1151static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio3 = { 424static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio3 = {
1152 .master = &omap2420_l4_wkup_hwmod, 425 .master = &omap2xxx_l4_wkup_hwmod,
1153 .slave = &omap2420_gpio3_hwmod, 426 .slave = &omap2xxx_gpio3_hwmod,
1154 .clk = "gpios_ick", 427 .clk = "gpios_ick",
1155 .addr = omap2420_gpio3_addr_space, 428 .addr = omap2420_gpio3_addr_space,
1156 .user = OCP_USER_MPU | OCP_USER_SDMA, 429 .user = OCP_USER_MPU | OCP_USER_SDMA,
@@ -1167,408 +440,150 @@ static struct omap_hwmod_addr_space omap2420_gpio4_addr_space[] = {
1167}; 440};
1168 441
1169static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio4 = { 442static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio4 = {
1170 .master = &omap2420_l4_wkup_hwmod, 443 .master = &omap2xxx_l4_wkup_hwmod,
1171 .slave = &omap2420_gpio4_hwmod, 444 .slave = &omap2xxx_gpio4_hwmod,
1172 .clk = "gpios_ick", 445 .clk = "gpios_ick",
1173 .addr = omap2420_gpio4_addr_space, 446 .addr = omap2420_gpio4_addr_space,
1174 .user = OCP_USER_MPU | OCP_USER_SDMA, 447 .user = OCP_USER_MPU | OCP_USER_SDMA,
1175}; 448};
1176 449
1177/* gpio dev_attr */
1178static struct omap_gpio_dev_attr gpio_dev_attr = {
1179 .bank_width = 32,
1180 .dbck_flag = false,
1181};
1182
1183/* gpio1 */
1184static struct omap_hwmod_ocp_if *omap2420_gpio1_slaves[] = {
1185 &omap2420_l4_wkup__gpio1,
1186};
1187
1188static struct omap_hwmod omap2420_gpio1_hwmod = {
1189 .name = "gpio1",
1190 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1191 .mpu_irqs = omap2_gpio1_irqs,
1192 .main_clk = "gpios_fck",
1193 .prcm = {
1194 .omap2 = {
1195 .prcm_reg_id = 1,
1196 .module_bit = OMAP24XX_EN_GPIOS_SHIFT,
1197 .module_offs = WKUP_MOD,
1198 .idlest_reg_id = 1,
1199 .idlest_idle_bit = OMAP24XX_ST_GPIOS_SHIFT,
1200 },
1201 },
1202 .slaves = omap2420_gpio1_slaves,
1203 .slaves_cnt = ARRAY_SIZE(omap2420_gpio1_slaves),
1204 .class = &omap2xxx_gpio_hwmod_class,
1205 .dev_attr = &gpio_dev_attr,
1206};
1207
1208/* gpio2 */
1209static struct omap_hwmod_ocp_if *omap2420_gpio2_slaves[] = {
1210 &omap2420_l4_wkup__gpio2,
1211};
1212
1213static struct omap_hwmod omap2420_gpio2_hwmod = {
1214 .name = "gpio2",
1215 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1216 .mpu_irqs = omap2_gpio2_irqs,
1217 .main_clk = "gpios_fck",
1218 .prcm = {
1219 .omap2 = {
1220 .prcm_reg_id = 1,
1221 .module_bit = OMAP24XX_EN_GPIOS_SHIFT,
1222 .module_offs = WKUP_MOD,
1223 .idlest_reg_id = 1,
1224 .idlest_idle_bit = OMAP24XX_ST_GPIOS_SHIFT,
1225 },
1226 },
1227 .slaves = omap2420_gpio2_slaves,
1228 .slaves_cnt = ARRAY_SIZE(omap2420_gpio2_slaves),
1229 .class = &omap2xxx_gpio_hwmod_class,
1230 .dev_attr = &gpio_dev_attr,
1231};
1232
1233/* gpio3 */
1234static struct omap_hwmod_ocp_if *omap2420_gpio3_slaves[] = {
1235 &omap2420_l4_wkup__gpio3,
1236};
1237
1238static struct omap_hwmod omap2420_gpio3_hwmod = {
1239 .name = "gpio3",
1240 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1241 .mpu_irqs = omap2_gpio3_irqs,
1242 .main_clk = "gpios_fck",
1243 .prcm = {
1244 .omap2 = {
1245 .prcm_reg_id = 1,
1246 .module_bit = OMAP24XX_EN_GPIOS_SHIFT,
1247 .module_offs = WKUP_MOD,
1248 .idlest_reg_id = 1,
1249 .idlest_idle_bit = OMAP24XX_ST_GPIOS_SHIFT,
1250 },
1251 },
1252 .slaves = omap2420_gpio3_slaves,
1253 .slaves_cnt = ARRAY_SIZE(omap2420_gpio3_slaves),
1254 .class = &omap2xxx_gpio_hwmod_class,
1255 .dev_attr = &gpio_dev_attr,
1256};
1257
1258/* gpio4 */
1259static struct omap_hwmod_ocp_if *omap2420_gpio4_slaves[] = {
1260 &omap2420_l4_wkup__gpio4,
1261};
1262
1263static struct omap_hwmod omap2420_gpio4_hwmod = {
1264 .name = "gpio4",
1265 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1266 .mpu_irqs = omap2_gpio4_irqs,
1267 .main_clk = "gpios_fck",
1268 .prcm = {
1269 .omap2 = {
1270 .prcm_reg_id = 1,
1271 .module_bit = OMAP24XX_EN_GPIOS_SHIFT,
1272 .module_offs = WKUP_MOD,
1273 .idlest_reg_id = 1,
1274 .idlest_idle_bit = OMAP24XX_ST_GPIOS_SHIFT,
1275 },
1276 },
1277 .slaves = omap2420_gpio4_slaves,
1278 .slaves_cnt = ARRAY_SIZE(omap2420_gpio4_slaves),
1279 .class = &omap2xxx_gpio_hwmod_class,
1280 .dev_attr = &gpio_dev_attr,
1281};
1282
1283/* dma attributes */
1284static struct omap_dma_dev_attr dma_dev_attr = {
1285 .dev_caps = RESERVE_CHANNEL | DMA_LINKED_LCH | GLOBAL_PRIORITY |
1286 IS_CSSA_32 | IS_CDSA_32,
1287 .lch_count = 32,
1288};
1289
1290/* dma_system -> L3 */ 450/* dma_system -> L3 */
1291static struct omap_hwmod_ocp_if omap2420_dma_system__l3 = { 451static struct omap_hwmod_ocp_if omap2420_dma_system__l3 = {
1292 .master = &omap2420_dma_system_hwmod, 452 .master = &omap2420_dma_system_hwmod,
1293 .slave = &omap2420_l3_main_hwmod, 453 .slave = &omap2xxx_l3_main_hwmod,
1294 .clk = "core_l3_ck", 454 .clk = "core_l3_ck",
1295 .user = OCP_USER_MPU | OCP_USER_SDMA, 455 .user = OCP_USER_MPU | OCP_USER_SDMA,
1296}; 456};
1297 457
1298/* dma_system master ports */
1299static struct omap_hwmod_ocp_if *omap2420_dma_system_masters[] = {
1300 &omap2420_dma_system__l3,
1301};
1302
1303/* l4_core -> dma_system */ 458/* l4_core -> dma_system */
1304static struct omap_hwmod_ocp_if omap2420_l4_core__dma_system = { 459static struct omap_hwmod_ocp_if omap2420_l4_core__dma_system = {
1305 .master = &omap2420_l4_core_hwmod, 460 .master = &omap2xxx_l4_core_hwmod,
1306 .slave = &omap2420_dma_system_hwmod, 461 .slave = &omap2420_dma_system_hwmod,
1307 .clk = "sdma_ick", 462 .clk = "sdma_ick",
1308 .addr = omap2_dma_system_addrs, 463 .addr = omap2_dma_system_addrs,
1309 .user = OCP_USER_MPU | OCP_USER_SDMA, 464 .user = OCP_USER_MPU | OCP_USER_SDMA,
1310}; 465};
1311 466
1312/* dma_system slave ports */
1313static struct omap_hwmod_ocp_if *omap2420_dma_system_slaves[] = {
1314 &omap2420_l4_core__dma_system,
1315};
1316
1317static struct omap_hwmod omap2420_dma_system_hwmod = {
1318 .name = "dma",
1319 .class = &omap2xxx_dma_hwmod_class,
1320 .mpu_irqs = omap2_dma_system_irqs,
1321 .main_clk = "core_l3_ck",
1322 .slaves = omap2420_dma_system_slaves,
1323 .slaves_cnt = ARRAY_SIZE(omap2420_dma_system_slaves),
1324 .masters = omap2420_dma_system_masters,
1325 .masters_cnt = ARRAY_SIZE(omap2420_dma_system_masters),
1326 .dev_attr = &dma_dev_attr,
1327 .flags = HWMOD_NO_IDLEST,
1328};
1329
1330/* mailbox */
1331static struct omap_hwmod omap2420_mailbox_hwmod;
1332static struct omap_hwmod_irq_info omap2420_mailbox_irqs[] = {
1333 { .name = "dsp", .irq = 26 },
1334 { .name = "iva", .irq = 34 },
1335 { .irq = -1 }
1336};
1337
1338/* l4_core -> mailbox */ 467/* l4_core -> mailbox */
1339static struct omap_hwmod_ocp_if omap2420_l4_core__mailbox = { 468static struct omap_hwmod_ocp_if omap2420_l4_core__mailbox = {
1340 .master = &omap2420_l4_core_hwmod, 469 .master = &omap2xxx_l4_core_hwmod,
1341 .slave = &omap2420_mailbox_hwmod, 470 .slave = &omap2420_mailbox_hwmod,
1342 .addr = omap2_mailbox_addrs, 471 .addr = omap2_mailbox_addrs,
1343 .user = OCP_USER_MPU | OCP_USER_SDMA, 472 .user = OCP_USER_MPU | OCP_USER_SDMA,
1344}; 473};
1345 474
1346/* mailbox slave ports */
1347static struct omap_hwmod_ocp_if *omap2420_mailbox_slaves[] = {
1348 &omap2420_l4_core__mailbox,
1349};
1350
1351static struct omap_hwmod omap2420_mailbox_hwmod = {
1352 .name = "mailbox",
1353 .class = &omap2xxx_mailbox_hwmod_class,
1354 .mpu_irqs = omap2420_mailbox_irqs,
1355 .main_clk = "mailboxes_ick",
1356 .prcm = {
1357 .omap2 = {
1358 .prcm_reg_id = 1,
1359 .module_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
1360 .module_offs = CORE_MOD,
1361 .idlest_reg_id = 1,
1362 .idlest_idle_bit = OMAP24XX_ST_MAILBOXES_SHIFT,
1363 },
1364 },
1365 .slaves = omap2420_mailbox_slaves,
1366 .slaves_cnt = ARRAY_SIZE(omap2420_mailbox_slaves),
1367};
1368
1369/* mcspi1 */
1370static struct omap_hwmod_ocp_if *omap2420_mcspi1_slaves[] = {
1371 &omap2420_l4_core__mcspi1,
1372};
1373
1374static struct omap2_mcspi_dev_attr omap_mcspi1_dev_attr = {
1375 .num_chipselect = 4,
1376};
1377
1378static struct omap_hwmod omap2420_mcspi1_hwmod = {
1379 .name = "mcspi1_hwmod",
1380 .mpu_irqs = omap2_mcspi1_mpu_irqs,
1381 .sdma_reqs = omap2_mcspi1_sdma_reqs,
1382 .main_clk = "mcspi1_fck",
1383 .prcm = {
1384 .omap2 = {
1385 .module_offs = CORE_MOD,
1386 .prcm_reg_id = 1,
1387 .module_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1388 .idlest_reg_id = 1,
1389 .idlest_idle_bit = OMAP24XX_ST_MCSPI1_SHIFT,
1390 },
1391 },
1392 .slaves = omap2420_mcspi1_slaves,
1393 .slaves_cnt = ARRAY_SIZE(omap2420_mcspi1_slaves),
1394 .class = &omap2xxx_mcspi_class,
1395 .dev_attr = &omap_mcspi1_dev_attr,
1396};
1397
1398/* mcspi2 */
1399static struct omap_hwmod_ocp_if *omap2420_mcspi2_slaves[] = {
1400 &omap2420_l4_core__mcspi2,
1401};
1402
1403static struct omap2_mcspi_dev_attr omap_mcspi2_dev_attr = {
1404 .num_chipselect = 2,
1405};
1406
1407static struct omap_hwmod omap2420_mcspi2_hwmod = {
1408 .name = "mcspi2_hwmod",
1409 .mpu_irqs = omap2_mcspi2_mpu_irqs,
1410 .sdma_reqs = omap2_mcspi2_sdma_reqs,
1411 .main_clk = "mcspi2_fck",
1412 .prcm = {
1413 .omap2 = {
1414 .module_offs = CORE_MOD,
1415 .prcm_reg_id = 1,
1416 .module_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1417 .idlest_reg_id = 1,
1418 .idlest_idle_bit = OMAP24XX_ST_MCSPI2_SHIFT,
1419 },
1420 },
1421 .slaves = omap2420_mcspi2_slaves,
1422 .slaves_cnt = ARRAY_SIZE(omap2420_mcspi2_slaves),
1423 .class = &omap2xxx_mcspi_class,
1424 .dev_attr = &omap_mcspi2_dev_attr,
1425};
1426
1427/*
1428 * 'mcbsp' class
1429 * multi channel buffered serial port controller
1430 */
1431
1432static struct omap_hwmod_class omap2420_mcbsp_hwmod_class = {
1433 .name = "mcbsp",
1434};
1435
1436/* mcbsp1 */
1437static struct omap_hwmod_irq_info omap2420_mcbsp1_irqs[] = {
1438 { .name = "tx", .irq = 59 },
1439 { .name = "rx", .irq = 60 },
1440 { .irq = -1 }
1441};
1442
1443/* l4_core -> mcbsp1 */ 475/* l4_core -> mcbsp1 */
1444static struct omap_hwmod_ocp_if omap2420_l4_core__mcbsp1 = { 476static struct omap_hwmod_ocp_if omap2420_l4_core__mcbsp1 = {
1445 .master = &omap2420_l4_core_hwmod, 477 .master = &omap2xxx_l4_core_hwmod,
1446 .slave = &omap2420_mcbsp1_hwmod, 478 .slave = &omap2420_mcbsp1_hwmod,
1447 .clk = "mcbsp1_ick", 479 .clk = "mcbsp1_ick",
1448 .addr = omap2_mcbsp1_addrs, 480 .addr = omap2_mcbsp1_addrs,
1449 .user = OCP_USER_MPU | OCP_USER_SDMA, 481 .user = OCP_USER_MPU | OCP_USER_SDMA,
1450}; 482};
1451 483
1452/* mcbsp1 slave ports */
1453static struct omap_hwmod_ocp_if *omap2420_mcbsp1_slaves[] = {
1454 &omap2420_l4_core__mcbsp1,
1455};
1456
1457static struct omap_hwmod omap2420_mcbsp1_hwmod = {
1458 .name = "mcbsp1",
1459 .class = &omap2420_mcbsp_hwmod_class,
1460 .mpu_irqs = omap2420_mcbsp1_irqs,
1461 .sdma_reqs = omap2_mcbsp1_sdma_reqs,
1462 .main_clk = "mcbsp1_fck",
1463 .prcm = {
1464 .omap2 = {
1465 .prcm_reg_id = 1,
1466 .module_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1467 .module_offs = CORE_MOD,
1468 .idlest_reg_id = 1,
1469 .idlest_idle_bit = OMAP24XX_ST_MCBSP1_SHIFT,
1470 },
1471 },
1472 .slaves = omap2420_mcbsp1_slaves,
1473 .slaves_cnt = ARRAY_SIZE(omap2420_mcbsp1_slaves),
1474};
1475
1476/* mcbsp2 */
1477static struct omap_hwmod_irq_info omap2420_mcbsp2_irqs[] = {
1478 { .name = "tx", .irq = 62 },
1479 { .name = "rx", .irq = 63 },
1480 { .irq = -1 }
1481};
1482
1483/* l4_core -> mcbsp2 */ 484/* l4_core -> mcbsp2 */
1484static struct omap_hwmod_ocp_if omap2420_l4_core__mcbsp2 = { 485static struct omap_hwmod_ocp_if omap2420_l4_core__mcbsp2 = {
1485 .master = &omap2420_l4_core_hwmod, 486 .master = &omap2xxx_l4_core_hwmod,
1486 .slave = &omap2420_mcbsp2_hwmod, 487 .slave = &omap2420_mcbsp2_hwmod,
1487 .clk = "mcbsp2_ick", 488 .clk = "mcbsp2_ick",
1488 .addr = omap2xxx_mcbsp2_addrs, 489 .addr = omap2xxx_mcbsp2_addrs,
1489 .user = OCP_USER_MPU | OCP_USER_SDMA, 490 .user = OCP_USER_MPU | OCP_USER_SDMA,
1490}; 491};
1491 492
1492/* mcbsp2 slave ports */ 493static struct omap_hwmod_addr_space omap2420_msdi1_addrs[] = {
1493static struct omap_hwmod_ocp_if *omap2420_mcbsp2_slaves[] = { 494 {
1494 &omap2420_l4_core__mcbsp2, 495 .pa_start = 0x4809c000,
1495}; 496 .pa_end = 0x4809c000 + SZ_128 - 1,
1496 497 .flags = ADDR_TYPE_RT,
1497static struct omap_hwmod omap2420_mcbsp2_hwmod = {
1498 .name = "mcbsp2",
1499 .class = &omap2420_mcbsp_hwmod_class,
1500 .mpu_irqs = omap2420_mcbsp2_irqs,
1501 .sdma_reqs = omap2_mcbsp2_sdma_reqs,
1502 .main_clk = "mcbsp2_fck",
1503 .prcm = {
1504 .omap2 = {
1505 .prcm_reg_id = 1,
1506 .module_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1507 .module_offs = CORE_MOD,
1508 .idlest_reg_id = 1,
1509 .idlest_idle_bit = OMAP24XX_ST_MCBSP2_SHIFT,
1510 },
1511 }, 498 },
1512 .slaves = omap2420_mcbsp2_slaves, 499 { }
1513 .slaves_cnt = ARRAY_SIZE(omap2420_mcbsp2_slaves),
1514}; 500};
1515 501
1516static __initdata struct omap_hwmod *omap2420_hwmods[] = { 502/* l4_core -> msdi1 */
1517 &omap2420_l3_main_hwmod, 503static struct omap_hwmod_ocp_if omap2420_l4_core__msdi1 = {
1518 &omap2420_l4_core_hwmod, 504 .master = &omap2xxx_l4_core_hwmod,
1519 &omap2420_l4_wkup_hwmod, 505 .slave = &omap2420_msdi1_hwmod,
1520 &omap2420_mpu_hwmod, 506 .clk = "mmc_ick",
1521 &omap2420_iva_hwmod, 507 .addr = omap2420_msdi1_addrs,
1522 508 .user = OCP_USER_MPU | OCP_USER_SDMA,
1523 &omap2420_timer1_hwmod, 509};
1524 &omap2420_timer2_hwmod,
1525 &omap2420_timer3_hwmod,
1526 &omap2420_timer4_hwmod,
1527 &omap2420_timer5_hwmod,
1528 &omap2420_timer6_hwmod,
1529 &omap2420_timer7_hwmod,
1530 &omap2420_timer8_hwmod,
1531 &omap2420_timer9_hwmod,
1532 &omap2420_timer10_hwmod,
1533 &omap2420_timer11_hwmod,
1534 &omap2420_timer12_hwmod,
1535
1536 &omap2420_wd_timer2_hwmod,
1537 &omap2420_uart1_hwmod,
1538 &omap2420_uart2_hwmod,
1539 &omap2420_uart3_hwmod,
1540 /* dss class */
1541 &omap2420_dss_core_hwmod,
1542 &omap2420_dss_dispc_hwmod,
1543 &omap2420_dss_rfbi_hwmod,
1544 &omap2420_dss_venc_hwmod,
1545 /* i2c class */
1546 &omap2420_i2c1_hwmod,
1547 &omap2420_i2c2_hwmod,
1548 510
1549 /* gpio class */ 511/* l4_core -> hdq1w interface */
1550 &omap2420_gpio1_hwmod, 512static struct omap_hwmod_ocp_if omap2420_l4_core__hdq1w = {
1551 &omap2420_gpio2_hwmod, 513 .master = &omap2xxx_l4_core_hwmod,
1552 &omap2420_gpio3_hwmod, 514 .slave = &omap2420_hdq1w_hwmod,
1553 &omap2420_gpio4_hwmod, 515 .clk = "hdq_ick",
516 .addr = omap2_hdq1w_addr_space,
517 .user = OCP_USER_MPU | OCP_USER_SDMA,
518 .flags = OMAP_FIREWALL_L4 | OCPIF_SWSUP_IDLE,
519};
1554 520
1555 /* dma_system class*/
1556 &omap2420_dma_system_hwmod,
1557 521
1558 /* mailbox class */ 522/* l4_wkup -> 32ksync_counter */
1559 &omap2420_mailbox_hwmod, 523static struct omap_hwmod_addr_space omap2420_counter_32k_addrs[] = {
524 {
525 .pa_start = 0x48004000,
526 .pa_end = 0x4800401f,
527 .flags = ADDR_TYPE_RT
528 },
529 { }
530};
1560 531
1561 /* mcbsp class */ 532static struct omap_hwmod_ocp_if omap2420_l4_wkup__counter_32k = {
1562 &omap2420_mcbsp1_hwmod, 533 .master = &omap2xxx_l4_wkup_hwmod,
1563 &omap2420_mcbsp2_hwmod, 534 .slave = &omap2xxx_counter_32k_hwmod,
535 .clk = "sync_32k_ick",
536 .addr = omap2420_counter_32k_addrs,
537 .user = OCP_USER_MPU | OCP_USER_SDMA,
538};
1564 539
1565 /* mcspi class */ 540static struct omap_hwmod_ocp_if *omap2420_hwmod_ocp_ifs[] __initdata = {
1566 &omap2420_mcspi1_hwmod, 541 &omap2xxx_l3_main__l4_core,
1567 &omap2420_mcspi2_hwmod, 542 &omap2xxx_mpu__l3_main,
543 &omap2xxx_dss__l3,
544 &omap2xxx_l4_core__mcspi1,
545 &omap2xxx_l4_core__mcspi2,
546 &omap2xxx_l4_core__l4_wkup,
547 &omap2_l4_core__uart1,
548 &omap2_l4_core__uart2,
549 &omap2_l4_core__uart3,
550 &omap2420_l4_core__i2c1,
551 &omap2420_l4_core__i2c2,
552 &omap2420_l3__iva,
553 &omap2420_l3__dsp,
554 &omap2420_l4_wkup__timer1,
555 &omap2xxx_l4_core__timer2,
556 &omap2xxx_l4_core__timer3,
557 &omap2xxx_l4_core__timer4,
558 &omap2xxx_l4_core__timer5,
559 &omap2xxx_l4_core__timer6,
560 &omap2xxx_l4_core__timer7,
561 &omap2xxx_l4_core__timer8,
562 &omap2xxx_l4_core__timer9,
563 &omap2xxx_l4_core__timer10,
564 &omap2xxx_l4_core__timer11,
565 &omap2xxx_l4_core__timer12,
566 &omap2420_l4_wkup__wd_timer2,
567 &omap2xxx_l4_core__dss,
568 &omap2xxx_l4_core__dss_dispc,
569 &omap2xxx_l4_core__dss_rfbi,
570 &omap2xxx_l4_core__dss_venc,
571 &omap2420_l4_wkup__gpio1,
572 &omap2420_l4_wkup__gpio2,
573 &omap2420_l4_wkup__gpio3,
574 &omap2420_l4_wkup__gpio4,
575 &omap2420_dma_system__l3,
576 &omap2420_l4_core__dma_system,
577 &omap2420_l4_core__mailbox,
578 &omap2420_l4_core__mcbsp1,
579 &omap2420_l4_core__mcbsp2,
580 &omap2420_l4_core__msdi1,
581 &omap2420_l4_core__hdq1w,
582 &omap2420_l4_wkup__counter_32k,
1568 NULL, 583 NULL,
1569}; 584};
1570 585
1571int __init omap2420_hwmod_init(void) 586int __init omap2420_hwmod_init(void)
1572{ 587{
1573 return omap_hwmod_register(omap2420_hwmods); 588 return omap_hwmod_register_links(omap2420_hwmod_ocp_ifs);
1574} 589}
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index c4f56cb60d7d..4d7264981230 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -2,6 +2,7 @@
2 * omap_hwmod_2430_data.c - hardware modules present on the OMAP2430 chips 2 * omap_hwmod_2430_data.c - hardware modules present on the OMAP2430 chips
3 * 3 *
4 * Copyright (C) 2009-2011 Nokia Corporation 4 * Copyright (C) 2009-2011 Nokia Corporation
5 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley 6 * Paul Walmsley
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
@@ -33,1045 +34,29 @@
33/* 34/*
34 * OMAP2430 hardware module integration data 35 * OMAP2430 hardware module integration data
35 * 36 *
36 * ALl of the data in this section should be autogeneratable from the 37 * All of the data in this section should be autogeneratable from the
37 * TI hardware database or other technical documentation. Data that 38 * TI hardware database or other technical documentation. Data that
38 * is driver-specific or driver-kernel integration-specific belongs 39 * is driver-specific or driver-kernel integration-specific belongs
39 * elsewhere. 40 * elsewhere.
40 */ 41 */
41 42
42static struct omap_hwmod omap2430_mpu_hwmod;
43static struct omap_hwmod omap2430_iva_hwmod;
44static struct omap_hwmod omap2430_l3_main_hwmod;
45static struct omap_hwmod omap2430_l4_core_hwmod;
46static struct omap_hwmod omap2430_dss_core_hwmod;
47static struct omap_hwmod omap2430_dss_dispc_hwmod;
48static struct omap_hwmod omap2430_dss_rfbi_hwmod;
49static struct omap_hwmod omap2430_dss_venc_hwmod;
50static struct omap_hwmod omap2430_wd_timer2_hwmod;
51static struct omap_hwmod omap2430_gpio1_hwmod;
52static struct omap_hwmod omap2430_gpio2_hwmod;
53static struct omap_hwmod omap2430_gpio3_hwmod;
54static struct omap_hwmod omap2430_gpio4_hwmod;
55static struct omap_hwmod omap2430_gpio5_hwmod;
56static struct omap_hwmod omap2430_dma_system_hwmod;
57static struct omap_hwmod omap2430_mcbsp1_hwmod;
58static struct omap_hwmod omap2430_mcbsp2_hwmod;
59static struct omap_hwmod omap2430_mcbsp3_hwmod;
60static struct omap_hwmod omap2430_mcbsp4_hwmod;
61static struct omap_hwmod omap2430_mcbsp5_hwmod;
62static struct omap_hwmod omap2430_mcspi1_hwmod;
63static struct omap_hwmod omap2430_mcspi2_hwmod;
64static struct omap_hwmod omap2430_mcspi3_hwmod;
65static struct omap_hwmod omap2430_mmc1_hwmod;
66static struct omap_hwmod omap2430_mmc2_hwmod;
67
68/* L3 -> L4_CORE interface */
69static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = {
70 .master = &omap2430_l3_main_hwmod,
71 .slave = &omap2430_l4_core_hwmod,
72 .user = OCP_USER_MPU | OCP_USER_SDMA,
73};
74
75/* MPU -> L3 interface */
76static struct omap_hwmod_ocp_if omap2430_mpu__l3_main = {
77 .master = &omap2430_mpu_hwmod,
78 .slave = &omap2430_l3_main_hwmod,
79 .user = OCP_USER_MPU,
80};
81
82/* Slave interfaces on the L3 interconnect */
83static struct omap_hwmod_ocp_if *omap2430_l3_main_slaves[] = {
84 &omap2430_mpu__l3_main,
85};
86
87/* DSS -> l3 */
88static struct omap_hwmod_ocp_if omap2430_dss__l3 = {
89 .master = &omap2430_dss_core_hwmod,
90 .slave = &omap2430_l3_main_hwmod,
91 .fw = {
92 .omap2 = {
93 .l3_perm_bit = OMAP2_L3_CORE_FW_CONNID_DSS,
94 .flags = OMAP_FIREWALL_L3,
95 }
96 },
97 .user = OCP_USER_MPU | OCP_USER_SDMA,
98};
99
100/* Master interfaces on the L3 interconnect */
101static struct omap_hwmod_ocp_if *omap2430_l3_main_masters[] = {
102 &omap2430_l3_main__l4_core,
103};
104
105/* L3 */
106static struct omap_hwmod omap2430_l3_main_hwmod = {
107 .name = "l3_main",
108 .class = &l3_hwmod_class,
109 .masters = omap2430_l3_main_masters,
110 .masters_cnt = ARRAY_SIZE(omap2430_l3_main_masters),
111 .slaves = omap2430_l3_main_slaves,
112 .slaves_cnt = ARRAY_SIZE(omap2430_l3_main_slaves),
113 .flags = HWMOD_NO_IDLEST,
114};
115
116static struct omap_hwmod omap2430_l4_wkup_hwmod;
117static struct omap_hwmod omap2430_uart1_hwmod;
118static struct omap_hwmod omap2430_uart2_hwmod;
119static struct omap_hwmod omap2430_uart3_hwmod;
120static struct omap_hwmod omap2430_i2c1_hwmod;
121static struct omap_hwmod omap2430_i2c2_hwmod;
122
123static struct omap_hwmod omap2430_usbhsotg_hwmod;
124
125/* l3_core -> usbhsotg interface */
126static struct omap_hwmod_ocp_if omap2430_usbhsotg__l3 = {
127 .master = &omap2430_usbhsotg_hwmod,
128 .slave = &omap2430_l3_main_hwmod,
129 .clk = "core_l3_ck",
130 .user = OCP_USER_MPU,
131};
132
133/* L4 CORE -> I2C1 interface */
134static struct omap_hwmod_ocp_if omap2430_l4_core__i2c1 = {
135 .master = &omap2430_l4_core_hwmod,
136 .slave = &omap2430_i2c1_hwmod,
137 .clk = "i2c1_ick",
138 .addr = omap2_i2c1_addr_space,
139 .user = OCP_USER_MPU | OCP_USER_SDMA,
140};
141
142/* L4 CORE -> I2C2 interface */
143static struct omap_hwmod_ocp_if omap2430_l4_core__i2c2 = {
144 .master = &omap2430_l4_core_hwmod,
145 .slave = &omap2430_i2c2_hwmod,
146 .clk = "i2c2_ick",
147 .addr = omap2_i2c2_addr_space,
148 .user = OCP_USER_MPU | OCP_USER_SDMA,
149};
150
151/* L4_CORE -> L4_WKUP interface */
152static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = {
153 .master = &omap2430_l4_core_hwmod,
154 .slave = &omap2430_l4_wkup_hwmod,
155 .user = OCP_USER_MPU | OCP_USER_SDMA,
156};
157
158/* L4 CORE -> UART1 interface */
159static struct omap_hwmod_ocp_if omap2_l4_core__uart1 = {
160 .master = &omap2430_l4_core_hwmod,
161 .slave = &omap2430_uart1_hwmod,
162 .clk = "uart1_ick",
163 .addr = omap2xxx_uart1_addr_space,
164 .user = OCP_USER_MPU | OCP_USER_SDMA,
165};
166
167/* L4 CORE -> UART2 interface */
168static struct omap_hwmod_ocp_if omap2_l4_core__uart2 = {
169 .master = &omap2430_l4_core_hwmod,
170 .slave = &omap2430_uart2_hwmod,
171 .clk = "uart2_ick",
172 .addr = omap2xxx_uart2_addr_space,
173 .user = OCP_USER_MPU | OCP_USER_SDMA,
174};
175
176/* L4 PER -> UART3 interface */
177static struct omap_hwmod_ocp_if omap2_l4_core__uart3 = {
178 .master = &omap2430_l4_core_hwmod,
179 .slave = &omap2430_uart3_hwmod,
180 .clk = "uart3_ick",
181 .addr = omap2xxx_uart3_addr_space,
182 .user = OCP_USER_MPU | OCP_USER_SDMA,
183};
184
185/*
186* usbhsotg interface data
187*/
188static struct omap_hwmod_addr_space omap2430_usbhsotg_addrs[] = {
189 {
190 .pa_start = OMAP243X_HS_BASE,
191 .pa_end = OMAP243X_HS_BASE + SZ_4K - 1,
192 .flags = ADDR_TYPE_RT
193 },
194 { }
195};
196
197/* l4_core ->usbhsotg interface */
198static struct omap_hwmod_ocp_if omap2430_l4_core__usbhsotg = {
199 .master = &omap2430_l4_core_hwmod,
200 .slave = &omap2430_usbhsotg_hwmod,
201 .clk = "usb_l4_ick",
202 .addr = omap2430_usbhsotg_addrs,
203 .user = OCP_USER_MPU,
204};
205
206static struct omap_hwmod_ocp_if *omap2430_usbhsotg_masters[] = {
207 &omap2430_usbhsotg__l3,
208};
209
210static struct omap_hwmod_ocp_if *omap2430_usbhsotg_slaves[] = {
211 &omap2430_l4_core__usbhsotg,
212};
213
214/* L4 CORE -> MMC1 interface */
215static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = {
216 .master = &omap2430_l4_core_hwmod,
217 .slave = &omap2430_mmc1_hwmod,
218 .clk = "mmchs1_ick",
219 .addr = omap2430_mmc1_addr_space,
220 .user = OCP_USER_MPU | OCP_USER_SDMA,
221};
222
223/* L4 CORE -> MMC2 interface */
224static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = {
225 .master = &omap2430_l4_core_hwmod,
226 .slave = &omap2430_mmc2_hwmod,
227 .clk = "mmchs2_ick",
228 .addr = omap2430_mmc2_addr_space,
229 .user = OCP_USER_MPU | OCP_USER_SDMA,
230};
231
232/* Slave interfaces on the L4_CORE interconnect */
233static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = {
234 &omap2430_l3_main__l4_core,
235};
236
237/* Master interfaces on the L4_CORE interconnect */
238static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = {
239 &omap2430_l4_core__l4_wkup,
240 &omap2430_l4_core__mmc1,
241 &omap2430_l4_core__mmc2,
242};
243
244/* L4 CORE */
245static struct omap_hwmod omap2430_l4_core_hwmod = {
246 .name = "l4_core",
247 .class = &l4_hwmod_class,
248 .masters = omap2430_l4_core_masters,
249 .masters_cnt = ARRAY_SIZE(omap2430_l4_core_masters),
250 .slaves = omap2430_l4_core_slaves,
251 .slaves_cnt = ARRAY_SIZE(omap2430_l4_core_slaves),
252 .flags = HWMOD_NO_IDLEST,
253};
254
255/* Slave interfaces on the L4_WKUP interconnect */
256static struct omap_hwmod_ocp_if *omap2430_l4_wkup_slaves[] = {
257 &omap2430_l4_core__l4_wkup,
258 &omap2_l4_core__uart1,
259 &omap2_l4_core__uart2,
260 &omap2_l4_core__uart3,
261};
262
263/* Master interfaces on the L4_WKUP interconnect */
264static struct omap_hwmod_ocp_if *omap2430_l4_wkup_masters[] = {
265};
266
267/* l4 core -> mcspi1 interface */
268static struct omap_hwmod_ocp_if omap2430_l4_core__mcspi1 = {
269 .master = &omap2430_l4_core_hwmod,
270 .slave = &omap2430_mcspi1_hwmod,
271 .clk = "mcspi1_ick",
272 .addr = omap2_mcspi1_addr_space,
273 .user = OCP_USER_MPU | OCP_USER_SDMA,
274};
275
276/* l4 core -> mcspi2 interface */
277static struct omap_hwmod_ocp_if omap2430_l4_core__mcspi2 = {
278 .master = &omap2430_l4_core_hwmod,
279 .slave = &omap2430_mcspi2_hwmod,
280 .clk = "mcspi2_ick",
281 .addr = omap2_mcspi2_addr_space,
282 .user = OCP_USER_MPU | OCP_USER_SDMA,
283};
284
285/* l4 core -> mcspi3 interface */
286static struct omap_hwmod_ocp_if omap2430_l4_core__mcspi3 = {
287 .master = &omap2430_l4_core_hwmod,
288 .slave = &omap2430_mcspi3_hwmod,
289 .clk = "mcspi3_ick",
290 .addr = omap2430_mcspi3_addr_space,
291 .user = OCP_USER_MPU | OCP_USER_SDMA,
292};
293
294/* L4 WKUP */
295static struct omap_hwmod omap2430_l4_wkup_hwmod = {
296 .name = "l4_wkup",
297 .class = &l4_hwmod_class,
298 .masters = omap2430_l4_wkup_masters,
299 .masters_cnt = ARRAY_SIZE(omap2430_l4_wkup_masters),
300 .slaves = omap2430_l4_wkup_slaves,
301 .slaves_cnt = ARRAY_SIZE(omap2430_l4_wkup_slaves),
302 .flags = HWMOD_NO_IDLEST,
303};
304
305/* Master interfaces on the MPU device */
306static struct omap_hwmod_ocp_if *omap2430_mpu_masters[] = {
307 &omap2430_mpu__l3_main,
308};
309
310/* MPU */
311static struct omap_hwmod omap2430_mpu_hwmod = {
312 .name = "mpu",
313 .class = &mpu_hwmod_class,
314 .main_clk = "mpu_ck",
315 .masters = omap2430_mpu_masters,
316 .masters_cnt = ARRAY_SIZE(omap2430_mpu_masters),
317};
318
319/* 43/*
320 * IVA2_1 interface data 44 * IP blocks
321 */ 45 */
322 46
323/* IVA2 <- L3 interface */ 47/* IVA2 (IVA2) */
324static struct omap_hwmod_ocp_if omap2430_l3__iva = { 48static struct omap_hwmod_rst_info omap2430_iva_resets[] = {
325 .master = &omap2430_l3_main_hwmod, 49 { .name = "logic", .rst_shift = 0 },
326 .slave = &omap2430_iva_hwmod, 50 { .name = "mmu", .rst_shift = 1 },
327 .clk = "dsp_fck",
328 .user = OCP_USER_MPU | OCP_USER_SDMA,
329};
330
331static struct omap_hwmod_ocp_if *omap2430_iva_masters[] = {
332 &omap2430_l3__iva,
333}; 51};
334 52
335/*
336 * IVA2 (IVA2)
337 */
338
339static struct omap_hwmod omap2430_iva_hwmod = { 53static struct omap_hwmod omap2430_iva_hwmod = {
340 .name = "iva", 54 .name = "iva",
341 .class = &iva_hwmod_class, 55 .class = &iva_hwmod_class,
342 .masters = omap2430_iva_masters, 56 .clkdm_name = "dsp_clkdm",
343 .masters_cnt = ARRAY_SIZE(omap2430_iva_masters), 57 .rst_lines = omap2430_iva_resets,
344}; 58 .rst_lines_cnt = ARRAY_SIZE(omap2430_iva_resets),
345 59 .main_clk = "dsp_fck",
346/* always-on timers dev attribute */
347static struct omap_timer_capability_dev_attr capability_alwon_dev_attr = {
348 .timer_capability = OMAP_TIMER_ALWON,
349};
350
351/* pwm timers dev attribute */
352static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
353 .timer_capability = OMAP_TIMER_HAS_PWM,
354};
355
356/* timer1 */
357static struct omap_hwmod omap2430_timer1_hwmod;
358
359static struct omap_hwmod_addr_space omap2430_timer1_addrs[] = {
360 {
361 .pa_start = 0x49018000,
362 .pa_end = 0x49018000 + SZ_1K - 1,
363 .flags = ADDR_TYPE_RT
364 },
365 { }
366};
367
368/* l4_wkup -> timer1 */
369static struct omap_hwmod_ocp_if omap2430_l4_wkup__timer1 = {
370 .master = &omap2430_l4_wkup_hwmod,
371 .slave = &omap2430_timer1_hwmod,
372 .clk = "gpt1_ick",
373 .addr = omap2430_timer1_addrs,
374 .user = OCP_USER_MPU | OCP_USER_SDMA,
375};
376
377/* timer1 slave port */
378static struct omap_hwmod_ocp_if *omap2430_timer1_slaves[] = {
379 &omap2430_l4_wkup__timer1,
380};
381
382/* timer1 hwmod */
383static struct omap_hwmod omap2430_timer1_hwmod = {
384 .name = "timer1",
385 .mpu_irqs = omap2_timer1_mpu_irqs,
386 .main_clk = "gpt1_fck",
387 .prcm = {
388 .omap2 = {
389 .prcm_reg_id = 1,
390 .module_bit = OMAP24XX_EN_GPT1_SHIFT,
391 .module_offs = WKUP_MOD,
392 .idlest_reg_id = 1,
393 .idlest_idle_bit = OMAP24XX_ST_GPT1_SHIFT,
394 },
395 },
396 .dev_attr = &capability_alwon_dev_attr,
397 .slaves = omap2430_timer1_slaves,
398 .slaves_cnt = ARRAY_SIZE(omap2430_timer1_slaves),
399 .class = &omap2xxx_timer_hwmod_class,
400};
401
402/* timer2 */
403static struct omap_hwmod omap2430_timer2_hwmod;
404
405/* l4_core -> timer2 */
406static struct omap_hwmod_ocp_if omap2430_l4_core__timer2 = {
407 .master = &omap2430_l4_core_hwmod,
408 .slave = &omap2430_timer2_hwmod,
409 .clk = "gpt2_ick",
410 .addr = omap2xxx_timer2_addrs,
411 .user = OCP_USER_MPU | OCP_USER_SDMA,
412};
413
414/* timer2 slave port */
415static struct omap_hwmod_ocp_if *omap2430_timer2_slaves[] = {
416 &omap2430_l4_core__timer2,
417};
418
419/* timer2 hwmod */
420static struct omap_hwmod omap2430_timer2_hwmod = {
421 .name = "timer2",
422 .mpu_irqs = omap2_timer2_mpu_irqs,
423 .main_clk = "gpt2_fck",
424 .prcm = {
425 .omap2 = {
426 .prcm_reg_id = 1,
427 .module_bit = OMAP24XX_EN_GPT2_SHIFT,
428 .module_offs = CORE_MOD,
429 .idlest_reg_id = 1,
430 .idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT,
431 },
432 },
433 .dev_attr = &capability_alwon_dev_attr,
434 .slaves = omap2430_timer2_slaves,
435 .slaves_cnt = ARRAY_SIZE(omap2430_timer2_slaves),
436 .class = &omap2xxx_timer_hwmod_class,
437};
438
439/* timer3 */
440static struct omap_hwmod omap2430_timer3_hwmod;
441
442/* l4_core -> timer3 */
443static struct omap_hwmod_ocp_if omap2430_l4_core__timer3 = {
444 .master = &omap2430_l4_core_hwmod,
445 .slave = &omap2430_timer3_hwmod,
446 .clk = "gpt3_ick",
447 .addr = omap2xxx_timer3_addrs,
448 .user = OCP_USER_MPU | OCP_USER_SDMA,
449};
450
451/* timer3 slave port */
452static struct omap_hwmod_ocp_if *omap2430_timer3_slaves[] = {
453 &omap2430_l4_core__timer3,
454};
455
456/* timer3 hwmod */
457static struct omap_hwmod omap2430_timer3_hwmod = {
458 .name = "timer3",
459 .mpu_irqs = omap2_timer3_mpu_irqs,
460 .main_clk = "gpt3_fck",
461 .prcm = {
462 .omap2 = {
463 .prcm_reg_id = 1,
464 .module_bit = OMAP24XX_EN_GPT3_SHIFT,
465 .module_offs = CORE_MOD,
466 .idlest_reg_id = 1,
467 .idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT,
468 },
469 },
470 .dev_attr = &capability_alwon_dev_attr,
471 .slaves = omap2430_timer3_slaves,
472 .slaves_cnt = ARRAY_SIZE(omap2430_timer3_slaves),
473 .class = &omap2xxx_timer_hwmod_class,
474};
475
476/* timer4 */
477static struct omap_hwmod omap2430_timer4_hwmod;
478
479/* l4_core -> timer4 */
480static struct omap_hwmod_ocp_if omap2430_l4_core__timer4 = {
481 .master = &omap2430_l4_core_hwmod,
482 .slave = &omap2430_timer4_hwmod,
483 .clk = "gpt4_ick",
484 .addr = omap2xxx_timer4_addrs,
485 .user = OCP_USER_MPU | OCP_USER_SDMA,
486};
487
488/* timer4 slave port */
489static struct omap_hwmod_ocp_if *omap2430_timer4_slaves[] = {
490 &omap2430_l4_core__timer4,
491};
492
493/* timer4 hwmod */
494static struct omap_hwmod omap2430_timer4_hwmod = {
495 .name = "timer4",
496 .mpu_irqs = omap2_timer4_mpu_irqs,
497 .main_clk = "gpt4_fck",
498 .prcm = {
499 .omap2 = {
500 .prcm_reg_id = 1,
501 .module_bit = OMAP24XX_EN_GPT4_SHIFT,
502 .module_offs = CORE_MOD,
503 .idlest_reg_id = 1,
504 .idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT,
505 },
506 },
507 .dev_attr = &capability_alwon_dev_attr,
508 .slaves = omap2430_timer4_slaves,
509 .slaves_cnt = ARRAY_SIZE(omap2430_timer4_slaves),
510 .class = &omap2xxx_timer_hwmod_class,
511};
512
513/* timer5 */
514static struct omap_hwmod omap2430_timer5_hwmod;
515
516/* l4_core -> timer5 */
517static struct omap_hwmod_ocp_if omap2430_l4_core__timer5 = {
518 .master = &omap2430_l4_core_hwmod,
519 .slave = &omap2430_timer5_hwmod,
520 .clk = "gpt5_ick",
521 .addr = omap2xxx_timer5_addrs,
522 .user = OCP_USER_MPU | OCP_USER_SDMA,
523};
524
525/* timer5 slave port */
526static struct omap_hwmod_ocp_if *omap2430_timer5_slaves[] = {
527 &omap2430_l4_core__timer5,
528};
529
530/* timer5 hwmod */
531static struct omap_hwmod omap2430_timer5_hwmod = {
532 .name = "timer5",
533 .mpu_irqs = omap2_timer5_mpu_irqs,
534 .main_clk = "gpt5_fck",
535 .prcm = {
536 .omap2 = {
537 .prcm_reg_id = 1,
538 .module_bit = OMAP24XX_EN_GPT5_SHIFT,
539 .module_offs = CORE_MOD,
540 .idlest_reg_id = 1,
541 .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT,
542 },
543 },
544 .dev_attr = &capability_alwon_dev_attr,
545 .slaves = omap2430_timer5_slaves,
546 .slaves_cnt = ARRAY_SIZE(omap2430_timer5_slaves),
547 .class = &omap2xxx_timer_hwmod_class,
548};
549
550/* timer6 */
551static struct omap_hwmod omap2430_timer6_hwmod;
552
553/* l4_core -> timer6 */
554static struct omap_hwmod_ocp_if omap2430_l4_core__timer6 = {
555 .master = &omap2430_l4_core_hwmod,
556 .slave = &omap2430_timer6_hwmod,
557 .clk = "gpt6_ick",
558 .addr = omap2xxx_timer6_addrs,
559 .user = OCP_USER_MPU | OCP_USER_SDMA,
560};
561
562/* timer6 slave port */
563static struct omap_hwmod_ocp_if *omap2430_timer6_slaves[] = {
564 &omap2430_l4_core__timer6,
565};
566
567/* timer6 hwmod */
568static struct omap_hwmod omap2430_timer6_hwmod = {
569 .name = "timer6",
570 .mpu_irqs = omap2_timer6_mpu_irqs,
571 .main_clk = "gpt6_fck",
572 .prcm = {
573 .omap2 = {
574 .prcm_reg_id = 1,
575 .module_bit = OMAP24XX_EN_GPT6_SHIFT,
576 .module_offs = CORE_MOD,
577 .idlest_reg_id = 1,
578 .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT,
579 },
580 },
581 .dev_attr = &capability_alwon_dev_attr,
582 .slaves = omap2430_timer6_slaves,
583 .slaves_cnt = ARRAY_SIZE(omap2430_timer6_slaves),
584 .class = &omap2xxx_timer_hwmod_class,
585};
586
587/* timer7 */
588static struct omap_hwmod omap2430_timer7_hwmod;
589
590/* l4_core -> timer7 */
591static struct omap_hwmod_ocp_if omap2430_l4_core__timer7 = {
592 .master = &omap2430_l4_core_hwmod,
593 .slave = &omap2430_timer7_hwmod,
594 .clk = "gpt7_ick",
595 .addr = omap2xxx_timer7_addrs,
596 .user = OCP_USER_MPU | OCP_USER_SDMA,
597};
598
599/* timer7 slave port */
600static struct omap_hwmod_ocp_if *omap2430_timer7_slaves[] = {
601 &omap2430_l4_core__timer7,
602};
603
604/* timer7 hwmod */
605static struct omap_hwmod omap2430_timer7_hwmod = {
606 .name = "timer7",
607 .mpu_irqs = omap2_timer7_mpu_irqs,
608 .main_clk = "gpt7_fck",
609 .prcm = {
610 .omap2 = {
611 .prcm_reg_id = 1,
612 .module_bit = OMAP24XX_EN_GPT7_SHIFT,
613 .module_offs = CORE_MOD,
614 .idlest_reg_id = 1,
615 .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT,
616 },
617 },
618 .dev_attr = &capability_alwon_dev_attr,
619 .slaves = omap2430_timer7_slaves,
620 .slaves_cnt = ARRAY_SIZE(omap2430_timer7_slaves),
621 .class = &omap2xxx_timer_hwmod_class,
622};
623
624/* timer8 */
625static struct omap_hwmod omap2430_timer8_hwmod;
626
627/* l4_core -> timer8 */
628static struct omap_hwmod_ocp_if omap2430_l4_core__timer8 = {
629 .master = &omap2430_l4_core_hwmod,
630 .slave = &omap2430_timer8_hwmod,
631 .clk = "gpt8_ick",
632 .addr = omap2xxx_timer8_addrs,
633 .user = OCP_USER_MPU | OCP_USER_SDMA,
634};
635
636/* timer8 slave port */
637static struct omap_hwmod_ocp_if *omap2430_timer8_slaves[] = {
638 &omap2430_l4_core__timer8,
639};
640
641/* timer8 hwmod */
642static struct omap_hwmod omap2430_timer8_hwmod = {
643 .name = "timer8",
644 .mpu_irqs = omap2_timer8_mpu_irqs,
645 .main_clk = "gpt8_fck",
646 .prcm = {
647 .omap2 = {
648 .prcm_reg_id = 1,
649 .module_bit = OMAP24XX_EN_GPT8_SHIFT,
650 .module_offs = CORE_MOD,
651 .idlest_reg_id = 1,
652 .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT,
653 },
654 },
655 .dev_attr = &capability_alwon_dev_attr,
656 .slaves = omap2430_timer8_slaves,
657 .slaves_cnt = ARRAY_SIZE(omap2430_timer8_slaves),
658 .class = &omap2xxx_timer_hwmod_class,
659};
660
661/* timer9 */
662static struct omap_hwmod omap2430_timer9_hwmod;
663
664/* l4_core -> timer9 */
665static struct omap_hwmod_ocp_if omap2430_l4_core__timer9 = {
666 .master = &omap2430_l4_core_hwmod,
667 .slave = &omap2430_timer9_hwmod,
668 .clk = "gpt9_ick",
669 .addr = omap2xxx_timer9_addrs,
670 .user = OCP_USER_MPU | OCP_USER_SDMA,
671};
672
673/* timer9 slave port */
674static struct omap_hwmod_ocp_if *omap2430_timer9_slaves[] = {
675 &omap2430_l4_core__timer9,
676};
677
678/* timer9 hwmod */
679static struct omap_hwmod omap2430_timer9_hwmod = {
680 .name = "timer9",
681 .mpu_irqs = omap2_timer9_mpu_irqs,
682 .main_clk = "gpt9_fck",
683 .prcm = {
684 .omap2 = {
685 .prcm_reg_id = 1,
686 .module_bit = OMAP24XX_EN_GPT9_SHIFT,
687 .module_offs = CORE_MOD,
688 .idlest_reg_id = 1,
689 .idlest_idle_bit = OMAP24XX_ST_GPT9_SHIFT,
690 },
691 },
692 .dev_attr = &capability_pwm_dev_attr,
693 .slaves = omap2430_timer9_slaves,
694 .slaves_cnt = ARRAY_SIZE(omap2430_timer9_slaves),
695 .class = &omap2xxx_timer_hwmod_class,
696};
697
698/* timer10 */
699static struct omap_hwmod omap2430_timer10_hwmod;
700
701/* l4_core -> timer10 */
702static struct omap_hwmod_ocp_if omap2430_l4_core__timer10 = {
703 .master = &omap2430_l4_core_hwmod,
704 .slave = &omap2430_timer10_hwmod,
705 .clk = "gpt10_ick",
706 .addr = omap2_timer10_addrs,
707 .user = OCP_USER_MPU | OCP_USER_SDMA,
708};
709
710/* timer10 slave port */
711static struct omap_hwmod_ocp_if *omap2430_timer10_slaves[] = {
712 &omap2430_l4_core__timer10,
713};
714
715/* timer10 hwmod */
716static struct omap_hwmod omap2430_timer10_hwmod = {
717 .name = "timer10",
718 .mpu_irqs = omap2_timer10_mpu_irqs,
719 .main_clk = "gpt10_fck",
720 .prcm = {
721 .omap2 = {
722 .prcm_reg_id = 1,
723 .module_bit = OMAP24XX_EN_GPT10_SHIFT,
724 .module_offs = CORE_MOD,
725 .idlest_reg_id = 1,
726 .idlest_idle_bit = OMAP24XX_ST_GPT10_SHIFT,
727 },
728 },
729 .dev_attr = &capability_pwm_dev_attr,
730 .slaves = omap2430_timer10_slaves,
731 .slaves_cnt = ARRAY_SIZE(omap2430_timer10_slaves),
732 .class = &omap2xxx_timer_hwmod_class,
733};
734
735/* timer11 */
736static struct omap_hwmod omap2430_timer11_hwmod;
737
738/* l4_core -> timer11 */
739static struct omap_hwmod_ocp_if omap2430_l4_core__timer11 = {
740 .master = &omap2430_l4_core_hwmod,
741 .slave = &omap2430_timer11_hwmod,
742 .clk = "gpt11_ick",
743 .addr = omap2_timer11_addrs,
744 .user = OCP_USER_MPU | OCP_USER_SDMA,
745};
746
747/* timer11 slave port */
748static struct omap_hwmod_ocp_if *omap2430_timer11_slaves[] = {
749 &omap2430_l4_core__timer11,
750};
751
752/* timer11 hwmod */
753static struct omap_hwmod omap2430_timer11_hwmod = {
754 .name = "timer11",
755 .mpu_irqs = omap2_timer11_mpu_irqs,
756 .main_clk = "gpt11_fck",
757 .prcm = {
758 .omap2 = {
759 .prcm_reg_id = 1,
760 .module_bit = OMAP24XX_EN_GPT11_SHIFT,
761 .module_offs = CORE_MOD,
762 .idlest_reg_id = 1,
763 .idlest_idle_bit = OMAP24XX_ST_GPT11_SHIFT,
764 },
765 },
766 .dev_attr = &capability_pwm_dev_attr,
767 .slaves = omap2430_timer11_slaves,
768 .slaves_cnt = ARRAY_SIZE(omap2430_timer11_slaves),
769 .class = &omap2xxx_timer_hwmod_class,
770};
771
772/* timer12 */
773static struct omap_hwmod omap2430_timer12_hwmod;
774
775/* l4_core -> timer12 */
776static struct omap_hwmod_ocp_if omap2430_l4_core__timer12 = {
777 .master = &omap2430_l4_core_hwmod,
778 .slave = &omap2430_timer12_hwmod,
779 .clk = "gpt12_ick",
780 .addr = omap2xxx_timer12_addrs,
781 .user = OCP_USER_MPU | OCP_USER_SDMA,
782};
783
784/* timer12 slave port */
785static struct omap_hwmod_ocp_if *omap2430_timer12_slaves[] = {
786 &omap2430_l4_core__timer12,
787};
788
789/* timer12 hwmod */
790static struct omap_hwmod omap2430_timer12_hwmod = {
791 .name = "timer12",
792 .mpu_irqs = omap2xxx_timer12_mpu_irqs,
793 .main_clk = "gpt12_fck",
794 .prcm = {
795 .omap2 = {
796 .prcm_reg_id = 1,
797 .module_bit = OMAP24XX_EN_GPT12_SHIFT,
798 .module_offs = CORE_MOD,
799 .idlest_reg_id = 1,
800 .idlest_idle_bit = OMAP24XX_ST_GPT12_SHIFT,
801 },
802 },
803 .dev_attr = &capability_pwm_dev_attr,
804 .slaves = omap2430_timer12_slaves,
805 .slaves_cnt = ARRAY_SIZE(omap2430_timer12_slaves),
806 .class = &omap2xxx_timer_hwmod_class,
807};
808
809/* l4_wkup -> wd_timer2 */
810static struct omap_hwmod_addr_space omap2430_wd_timer2_addrs[] = {
811 {
812 .pa_start = 0x49016000,
813 .pa_end = 0x4901607f,
814 .flags = ADDR_TYPE_RT
815 },
816 { }
817};
818
819static struct omap_hwmod_ocp_if omap2430_l4_wkup__wd_timer2 = {
820 .master = &omap2430_l4_wkup_hwmod,
821 .slave = &omap2430_wd_timer2_hwmod,
822 .clk = "mpu_wdt_ick",
823 .addr = omap2430_wd_timer2_addrs,
824 .user = OCP_USER_MPU | OCP_USER_SDMA,
825};
826
827/* wd_timer2 */
828static struct omap_hwmod_ocp_if *omap2430_wd_timer2_slaves[] = {
829 &omap2430_l4_wkup__wd_timer2,
830};
831
832static struct omap_hwmod omap2430_wd_timer2_hwmod = {
833 .name = "wd_timer2",
834 .class = &omap2xxx_wd_timer_hwmod_class,
835 .main_clk = "mpu_wdt_fck",
836 .prcm = {
837 .omap2 = {
838 .prcm_reg_id = 1,
839 .module_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
840 .module_offs = WKUP_MOD,
841 .idlest_reg_id = 1,
842 .idlest_idle_bit = OMAP24XX_ST_MPU_WDT_SHIFT,
843 },
844 },
845 .slaves = omap2430_wd_timer2_slaves,
846 .slaves_cnt = ARRAY_SIZE(omap2430_wd_timer2_slaves),
847};
848
849/* UART1 */
850
851static struct omap_hwmod_ocp_if *omap2430_uart1_slaves[] = {
852 &omap2_l4_core__uart1,
853};
854
855static struct omap_hwmod omap2430_uart1_hwmod = {
856 .name = "uart1",
857 .mpu_irqs = omap2_uart1_mpu_irqs,
858 .sdma_reqs = omap2_uart1_sdma_reqs,
859 .main_clk = "uart1_fck",
860 .prcm = {
861 .omap2 = {
862 .module_offs = CORE_MOD,
863 .prcm_reg_id = 1,
864 .module_bit = OMAP24XX_EN_UART1_SHIFT,
865 .idlest_reg_id = 1,
866 .idlest_idle_bit = OMAP24XX_EN_UART1_SHIFT,
867 },
868 },
869 .slaves = omap2430_uart1_slaves,
870 .slaves_cnt = ARRAY_SIZE(omap2430_uart1_slaves),
871 .class = &omap2_uart_class,
872};
873
874/* UART2 */
875
876static struct omap_hwmod_ocp_if *omap2430_uart2_slaves[] = {
877 &omap2_l4_core__uart2,
878};
879
880static struct omap_hwmod omap2430_uart2_hwmod = {
881 .name = "uart2",
882 .mpu_irqs = omap2_uart2_mpu_irqs,
883 .sdma_reqs = omap2_uart2_sdma_reqs,
884 .main_clk = "uart2_fck",
885 .prcm = {
886 .omap2 = {
887 .module_offs = CORE_MOD,
888 .prcm_reg_id = 1,
889 .module_bit = OMAP24XX_EN_UART2_SHIFT,
890 .idlest_reg_id = 1,
891 .idlest_idle_bit = OMAP24XX_EN_UART2_SHIFT,
892 },
893 },
894 .slaves = omap2430_uart2_slaves,
895 .slaves_cnt = ARRAY_SIZE(omap2430_uart2_slaves),
896 .class = &omap2_uart_class,
897};
898
899/* UART3 */
900
901static struct omap_hwmod_ocp_if *omap2430_uart3_slaves[] = {
902 &omap2_l4_core__uart3,
903};
904
905static struct omap_hwmod omap2430_uart3_hwmod = {
906 .name = "uart3",
907 .mpu_irqs = omap2_uart3_mpu_irqs,
908 .sdma_reqs = omap2_uart3_sdma_reqs,
909 .main_clk = "uart3_fck",
910 .prcm = {
911 .omap2 = {
912 .module_offs = CORE_MOD,
913 .prcm_reg_id = 2,
914 .module_bit = OMAP24XX_EN_UART3_SHIFT,
915 .idlest_reg_id = 2,
916 .idlest_idle_bit = OMAP24XX_EN_UART3_SHIFT,
917 },
918 },
919 .slaves = omap2430_uart3_slaves,
920 .slaves_cnt = ARRAY_SIZE(omap2430_uart3_slaves),
921 .class = &omap2_uart_class,
922};
923
924/* dss */
925/* dss master ports */
926static struct omap_hwmod_ocp_if *omap2430_dss_masters[] = {
927 &omap2430_dss__l3,
928};
929
930/* l4_core -> dss */
931static struct omap_hwmod_ocp_if omap2430_l4_core__dss = {
932 .master = &omap2430_l4_core_hwmod,
933 .slave = &omap2430_dss_core_hwmod,
934 .clk = "dss_ick",
935 .addr = omap2_dss_addrs,
936 .user = OCP_USER_MPU | OCP_USER_SDMA,
937};
938
939/* dss slave ports */
940static struct omap_hwmod_ocp_if *omap2430_dss_slaves[] = {
941 &omap2430_l4_core__dss,
942};
943
944static struct omap_hwmod_opt_clk dss_opt_clks[] = {
945 /*
946 * The DSS HW needs all DSS clocks enabled during reset. The dss_core
947 * driver does not use these clocks.
948 */
949 { .role = "tv_clk", .clk = "dss_54m_fck" },
950 { .role = "sys_clk", .clk = "dss2_fck" },
951};
952
953static struct omap_hwmod omap2430_dss_core_hwmod = {
954 .name = "dss_core",
955 .class = &omap2_dss_hwmod_class,
956 .main_clk = "dss1_fck", /* instead of dss_fck */
957 .sdma_reqs = omap2xxx_dss_sdma_chs,
958 .prcm = {
959 .omap2 = {
960 .prcm_reg_id = 1,
961 .module_bit = OMAP24XX_EN_DSS1_SHIFT,
962 .module_offs = CORE_MOD,
963 .idlest_reg_id = 1,
964 .idlest_stdby_bit = OMAP24XX_ST_DSS_SHIFT,
965 },
966 },
967 .opt_clks = dss_opt_clks,
968 .opt_clks_cnt = ARRAY_SIZE(dss_opt_clks),
969 .slaves = omap2430_dss_slaves,
970 .slaves_cnt = ARRAY_SIZE(omap2430_dss_slaves),
971 .masters = omap2430_dss_masters,
972 .masters_cnt = ARRAY_SIZE(omap2430_dss_masters),
973 .flags = HWMOD_NO_IDLEST | HWMOD_CONTROL_OPT_CLKS_IN_RESET,
974};
975
976/* l4_core -> dss_dispc */
977static struct omap_hwmod_ocp_if omap2430_l4_core__dss_dispc = {
978 .master = &omap2430_l4_core_hwmod,
979 .slave = &omap2430_dss_dispc_hwmod,
980 .clk = "dss_ick",
981 .addr = omap2_dss_dispc_addrs,
982 .user = OCP_USER_MPU | OCP_USER_SDMA,
983};
984
985/* dss_dispc slave ports */
986static struct omap_hwmod_ocp_if *omap2430_dss_dispc_slaves[] = {
987 &omap2430_l4_core__dss_dispc,
988};
989
990static struct omap_hwmod omap2430_dss_dispc_hwmod = {
991 .name = "dss_dispc",
992 .class = &omap2_dispc_hwmod_class,
993 .mpu_irqs = omap2_dispc_irqs,
994 .main_clk = "dss1_fck",
995 .prcm = {
996 .omap2 = {
997 .prcm_reg_id = 1,
998 .module_bit = OMAP24XX_EN_DSS1_SHIFT,
999 .module_offs = CORE_MOD,
1000 .idlest_reg_id = 1,
1001 .idlest_stdby_bit = OMAP24XX_ST_DSS_SHIFT,
1002 },
1003 },
1004 .slaves = omap2430_dss_dispc_slaves,
1005 .slaves_cnt = ARRAY_SIZE(omap2430_dss_dispc_slaves),
1006 .flags = HWMOD_NO_IDLEST,
1007 .dev_attr = &omap2_3_dss_dispc_dev_attr
1008};
1009
1010/* l4_core -> dss_rfbi */
1011static struct omap_hwmod_ocp_if omap2430_l4_core__dss_rfbi = {
1012 .master = &omap2430_l4_core_hwmod,
1013 .slave = &omap2430_dss_rfbi_hwmod,
1014 .clk = "dss_ick",
1015 .addr = omap2_dss_rfbi_addrs,
1016 .user = OCP_USER_MPU | OCP_USER_SDMA,
1017};
1018
1019/* dss_rfbi slave ports */
1020static struct omap_hwmod_ocp_if *omap2430_dss_rfbi_slaves[] = {
1021 &omap2430_l4_core__dss_rfbi,
1022};
1023
1024static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = {
1025 { .role = "ick", .clk = "dss_ick" },
1026};
1027
1028static struct omap_hwmod omap2430_dss_rfbi_hwmod = {
1029 .name = "dss_rfbi",
1030 .class = &omap2_rfbi_hwmod_class,
1031 .main_clk = "dss1_fck",
1032 .prcm = {
1033 .omap2 = {
1034 .prcm_reg_id = 1,
1035 .module_bit = OMAP24XX_EN_DSS1_SHIFT,
1036 .module_offs = CORE_MOD,
1037 },
1038 },
1039 .opt_clks = dss_rfbi_opt_clks,
1040 .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks),
1041 .slaves = omap2430_dss_rfbi_slaves,
1042 .slaves_cnt = ARRAY_SIZE(omap2430_dss_rfbi_slaves),
1043 .flags = HWMOD_NO_IDLEST,
1044};
1045
1046/* l4_core -> dss_venc */
1047static struct omap_hwmod_ocp_if omap2430_l4_core__dss_venc = {
1048 .master = &omap2430_l4_core_hwmod,
1049 .slave = &omap2430_dss_venc_hwmod,
1050 .clk = "dss_ick",
1051 .addr = omap2_dss_venc_addrs,
1052 .flags = OCPIF_SWSUP_IDLE,
1053 .user = OCP_USER_MPU | OCP_USER_SDMA,
1054};
1055
1056/* dss_venc slave ports */
1057static struct omap_hwmod_ocp_if *omap2430_dss_venc_slaves[] = {
1058 &omap2430_l4_core__dss_venc,
1059};
1060
1061static struct omap_hwmod omap2430_dss_venc_hwmod = {
1062 .name = "dss_venc",
1063 .class = &omap2_venc_hwmod_class,
1064 .main_clk = "dss_54m_fck",
1065 .prcm = {
1066 .omap2 = {
1067 .prcm_reg_id = 1,
1068 .module_bit = OMAP24XX_EN_DSS1_SHIFT,
1069 .module_offs = CORE_MOD,
1070 },
1071 },
1072 .slaves = omap2430_dss_venc_slaves,
1073 .slaves_cnt = ARRAY_SIZE(omap2430_dss_venc_slaves),
1074 .flags = HWMOD_NO_IDLEST,
1075}; 60};
1076 61
1077/* I2C common */ 62/* I2C common */
@@ -1099,11 +84,6 @@ static struct omap_i2c_dev_attr i2c_dev_attr = {
1099}; 84};
1100 85
1101/* I2C1 */ 86/* I2C1 */
1102
1103static struct omap_hwmod_ocp_if *omap2430_i2c1_slaves[] = {
1104 &omap2430_l4_core__i2c1,
1105};
1106
1107static struct omap_hwmod omap2430_i2c1_hwmod = { 87static struct omap_hwmod omap2430_i2c1_hwmod = {
1108 .name = "i2c1", 88 .name = "i2c1",
1109 .flags = HWMOD_16BIT_REG, 89 .flags = HWMOD_16BIT_REG,
@@ -1127,18 +107,11 @@ static struct omap_hwmod omap2430_i2c1_hwmod = {
1127 .idlest_idle_bit = OMAP2430_ST_I2CHS1_SHIFT, 107 .idlest_idle_bit = OMAP2430_ST_I2CHS1_SHIFT,
1128 }, 108 },
1129 }, 109 },
1130 .slaves = omap2430_i2c1_slaves,
1131 .slaves_cnt = ARRAY_SIZE(omap2430_i2c1_slaves),
1132 .class = &i2c_class, 110 .class = &i2c_class,
1133 .dev_attr = &i2c_dev_attr, 111 .dev_attr = &i2c_dev_attr,
1134}; 112};
1135 113
1136/* I2C2 */ 114/* I2C2 */
1137
1138static struct omap_hwmod_ocp_if *omap2430_i2c2_slaves[] = {
1139 &omap2430_l4_core__i2c2,
1140};
1141
1142static struct omap_hwmod omap2430_i2c2_hwmod = { 115static struct omap_hwmod omap2430_i2c2_hwmod = {
1143 .name = "i2c2", 116 .name = "i2c2",
1144 .flags = HWMOD_16BIT_REG, 117 .flags = HWMOD_16BIT_REG,
@@ -1154,218 +127,16 @@ static struct omap_hwmod omap2430_i2c2_hwmod = {
1154 .idlest_idle_bit = OMAP2430_ST_I2CHS2_SHIFT, 127 .idlest_idle_bit = OMAP2430_ST_I2CHS2_SHIFT,
1155 }, 128 },
1156 }, 129 },
1157 .slaves = omap2430_i2c2_slaves,
1158 .slaves_cnt = ARRAY_SIZE(omap2430_i2c2_slaves),
1159 .class = &i2c_class, 130 .class = &i2c_class,
1160 .dev_attr = &i2c_dev_attr, 131 .dev_attr = &i2c_dev_attr,
1161}; 132};
1162 133
1163/* l4_wkup -> gpio1 */
1164static struct omap_hwmod_addr_space omap2430_gpio1_addr_space[] = {
1165 {
1166 .pa_start = 0x4900C000,
1167 .pa_end = 0x4900C1ff,
1168 .flags = ADDR_TYPE_RT
1169 },
1170 { }
1171};
1172
1173static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio1 = {
1174 .master = &omap2430_l4_wkup_hwmod,
1175 .slave = &omap2430_gpio1_hwmod,
1176 .clk = "gpios_ick",
1177 .addr = omap2430_gpio1_addr_space,
1178 .user = OCP_USER_MPU | OCP_USER_SDMA,
1179};
1180
1181/* l4_wkup -> gpio2 */
1182static struct omap_hwmod_addr_space omap2430_gpio2_addr_space[] = {
1183 {
1184 .pa_start = 0x4900E000,
1185 .pa_end = 0x4900E1ff,
1186 .flags = ADDR_TYPE_RT
1187 },
1188 { }
1189};
1190
1191static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio2 = {
1192 .master = &omap2430_l4_wkup_hwmod,
1193 .slave = &omap2430_gpio2_hwmod,
1194 .clk = "gpios_ick",
1195 .addr = omap2430_gpio2_addr_space,
1196 .user = OCP_USER_MPU | OCP_USER_SDMA,
1197};
1198
1199/* l4_wkup -> gpio3 */
1200static struct omap_hwmod_addr_space omap2430_gpio3_addr_space[] = {
1201 {
1202 .pa_start = 0x49010000,
1203 .pa_end = 0x490101ff,
1204 .flags = ADDR_TYPE_RT
1205 },
1206 { }
1207};
1208
1209static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio3 = {
1210 .master = &omap2430_l4_wkup_hwmod,
1211 .slave = &omap2430_gpio3_hwmod,
1212 .clk = "gpios_ick",
1213 .addr = omap2430_gpio3_addr_space,
1214 .user = OCP_USER_MPU | OCP_USER_SDMA,
1215};
1216
1217/* l4_wkup -> gpio4 */
1218static struct omap_hwmod_addr_space omap2430_gpio4_addr_space[] = {
1219 {
1220 .pa_start = 0x49012000,
1221 .pa_end = 0x490121ff,
1222 .flags = ADDR_TYPE_RT
1223 },
1224 { }
1225};
1226
1227static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio4 = {
1228 .master = &omap2430_l4_wkup_hwmod,
1229 .slave = &omap2430_gpio4_hwmod,
1230 .clk = "gpios_ick",
1231 .addr = omap2430_gpio4_addr_space,
1232 .user = OCP_USER_MPU | OCP_USER_SDMA,
1233};
1234
1235/* l4_core -> gpio5 */
1236static struct omap_hwmod_addr_space omap2430_gpio5_addr_space[] = {
1237 {
1238 .pa_start = 0x480B6000,
1239 .pa_end = 0x480B61ff,
1240 .flags = ADDR_TYPE_RT
1241 },
1242 { }
1243};
1244
1245static struct omap_hwmod_ocp_if omap2430_l4_core__gpio5 = {
1246 .master = &omap2430_l4_core_hwmod,
1247 .slave = &omap2430_gpio5_hwmod,
1248 .clk = "gpio5_ick",
1249 .addr = omap2430_gpio5_addr_space,
1250 .user = OCP_USER_MPU | OCP_USER_SDMA,
1251};
1252
1253/* gpio dev_attr */
1254static struct omap_gpio_dev_attr gpio_dev_attr = {
1255 .bank_width = 32,
1256 .dbck_flag = false,
1257};
1258
1259/* gpio1 */
1260static struct omap_hwmod_ocp_if *omap2430_gpio1_slaves[] = {
1261 &omap2430_l4_wkup__gpio1,
1262};
1263
1264static struct omap_hwmod omap2430_gpio1_hwmod = {
1265 .name = "gpio1",
1266 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1267 .mpu_irqs = omap2_gpio1_irqs,
1268 .main_clk = "gpios_fck",
1269 .prcm = {
1270 .omap2 = {
1271 .prcm_reg_id = 1,
1272 .module_bit = OMAP24XX_EN_GPIOS_SHIFT,
1273 .module_offs = WKUP_MOD,
1274 .idlest_reg_id = 1,
1275 .idlest_idle_bit = OMAP24XX_EN_GPIOS_SHIFT,
1276 },
1277 },
1278 .slaves = omap2430_gpio1_slaves,
1279 .slaves_cnt = ARRAY_SIZE(omap2430_gpio1_slaves),
1280 .class = &omap2xxx_gpio_hwmod_class,
1281 .dev_attr = &gpio_dev_attr,
1282};
1283
1284/* gpio2 */
1285static struct omap_hwmod_ocp_if *omap2430_gpio2_slaves[] = {
1286 &omap2430_l4_wkup__gpio2,
1287};
1288
1289static struct omap_hwmod omap2430_gpio2_hwmod = {
1290 .name = "gpio2",
1291 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1292 .mpu_irqs = omap2_gpio2_irqs,
1293 .main_clk = "gpios_fck",
1294 .prcm = {
1295 .omap2 = {
1296 .prcm_reg_id = 1,
1297 .module_bit = OMAP24XX_EN_GPIOS_SHIFT,
1298 .module_offs = WKUP_MOD,
1299 .idlest_reg_id = 1,
1300 .idlest_idle_bit = OMAP24XX_ST_GPIOS_SHIFT,
1301 },
1302 },
1303 .slaves = omap2430_gpio2_slaves,
1304 .slaves_cnt = ARRAY_SIZE(omap2430_gpio2_slaves),
1305 .class = &omap2xxx_gpio_hwmod_class,
1306 .dev_attr = &gpio_dev_attr,
1307};
1308
1309/* gpio3 */
1310static struct omap_hwmod_ocp_if *omap2430_gpio3_slaves[] = {
1311 &omap2430_l4_wkup__gpio3,
1312};
1313
1314static struct omap_hwmod omap2430_gpio3_hwmod = {
1315 .name = "gpio3",
1316 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1317 .mpu_irqs = omap2_gpio3_irqs,
1318 .main_clk = "gpios_fck",
1319 .prcm = {
1320 .omap2 = {
1321 .prcm_reg_id = 1,
1322 .module_bit = OMAP24XX_EN_GPIOS_SHIFT,
1323 .module_offs = WKUP_MOD,
1324 .idlest_reg_id = 1,
1325 .idlest_idle_bit = OMAP24XX_ST_GPIOS_SHIFT,
1326 },
1327 },
1328 .slaves = omap2430_gpio3_slaves,
1329 .slaves_cnt = ARRAY_SIZE(omap2430_gpio3_slaves),
1330 .class = &omap2xxx_gpio_hwmod_class,
1331 .dev_attr = &gpio_dev_attr,
1332};
1333
1334/* gpio4 */
1335static struct omap_hwmod_ocp_if *omap2430_gpio4_slaves[] = {
1336 &omap2430_l4_wkup__gpio4,
1337};
1338
1339static struct omap_hwmod omap2430_gpio4_hwmod = {
1340 .name = "gpio4",
1341 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1342 .mpu_irqs = omap2_gpio4_irqs,
1343 .main_clk = "gpios_fck",
1344 .prcm = {
1345 .omap2 = {
1346 .prcm_reg_id = 1,
1347 .module_bit = OMAP24XX_EN_GPIOS_SHIFT,
1348 .module_offs = WKUP_MOD,
1349 .idlest_reg_id = 1,
1350 .idlest_idle_bit = OMAP24XX_ST_GPIOS_SHIFT,
1351 },
1352 },
1353 .slaves = omap2430_gpio4_slaves,
1354 .slaves_cnt = ARRAY_SIZE(omap2430_gpio4_slaves),
1355 .class = &omap2xxx_gpio_hwmod_class,
1356 .dev_attr = &gpio_dev_attr,
1357};
1358
1359/* gpio5 */ 134/* gpio5 */
1360static struct omap_hwmod_irq_info omap243x_gpio5_irqs[] = { 135static struct omap_hwmod_irq_info omap243x_gpio5_irqs[] = {
1361 { .irq = 33 }, /* INT_24XX_GPIO_BANK5 */ 136 { .irq = 33 }, /* INT_24XX_GPIO_BANK5 */
1362 { .irq = -1 } 137 { .irq = -1 }
1363}; 138};
1364 139
1365static struct omap_hwmod_ocp_if *omap2430_gpio5_slaves[] = {
1366 &omap2430_l4_core__gpio5,
1367};
1368
1369static struct omap_hwmod omap2430_gpio5_hwmod = { 140static struct omap_hwmod omap2430_gpio5_hwmod = {
1370 .name = "gpio5", 141 .name = "gpio5",
1371 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 142 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
@@ -1380,10 +151,8 @@ static struct omap_hwmod omap2430_gpio5_hwmod = {
1380 .idlest_idle_bit = OMAP2430_ST_GPIO5_SHIFT, 151 .idlest_idle_bit = OMAP2430_ST_GPIO5_SHIFT,
1381 }, 152 },
1382 }, 153 },
1383 .slaves = omap2430_gpio5_slaves,
1384 .slaves_cnt = ARRAY_SIZE(omap2430_gpio5_slaves),
1385 .class = &omap2xxx_gpio_hwmod_class, 154 .class = &omap2xxx_gpio_hwmod_class,
1386 .dev_attr = &gpio_dev_attr, 155 .dev_attr = &omap2xxx_gpio_dev_attr,
1387}; 156};
1388 157
1389/* dma attributes */ 158/* dma attributes */
@@ -1393,66 +162,21 @@ static struct omap_dma_dev_attr dma_dev_attr = {
1393 .lch_count = 32, 162 .lch_count = 32,
1394}; 163};
1395 164
1396/* dma_system -> L3 */
1397static struct omap_hwmod_ocp_if omap2430_dma_system__l3 = {
1398 .master = &omap2430_dma_system_hwmod,
1399 .slave = &omap2430_l3_main_hwmod,
1400 .clk = "core_l3_ck",
1401 .user = OCP_USER_MPU | OCP_USER_SDMA,
1402};
1403
1404/* dma_system master ports */
1405static struct omap_hwmod_ocp_if *omap2430_dma_system_masters[] = {
1406 &omap2430_dma_system__l3,
1407};
1408
1409/* l4_core -> dma_system */
1410static struct omap_hwmod_ocp_if omap2430_l4_core__dma_system = {
1411 .master = &omap2430_l4_core_hwmod,
1412 .slave = &omap2430_dma_system_hwmod,
1413 .clk = "sdma_ick",
1414 .addr = omap2_dma_system_addrs,
1415 .user = OCP_USER_MPU | OCP_USER_SDMA,
1416};
1417
1418/* dma_system slave ports */
1419static struct omap_hwmod_ocp_if *omap2430_dma_system_slaves[] = {
1420 &omap2430_l4_core__dma_system,
1421};
1422
1423static struct omap_hwmod omap2430_dma_system_hwmod = { 165static struct omap_hwmod omap2430_dma_system_hwmod = {
1424 .name = "dma", 166 .name = "dma",
1425 .class = &omap2xxx_dma_hwmod_class, 167 .class = &omap2xxx_dma_hwmod_class,
1426 .mpu_irqs = omap2_dma_system_irqs, 168 .mpu_irqs = omap2_dma_system_irqs,
1427 .main_clk = "core_l3_ck", 169 .main_clk = "core_l3_ck",
1428 .slaves = omap2430_dma_system_slaves,
1429 .slaves_cnt = ARRAY_SIZE(omap2430_dma_system_slaves),
1430 .masters = omap2430_dma_system_masters,
1431 .masters_cnt = ARRAY_SIZE(omap2430_dma_system_masters),
1432 .dev_attr = &dma_dev_attr, 170 .dev_attr = &dma_dev_attr,
1433 .flags = HWMOD_NO_IDLEST, 171 .flags = HWMOD_NO_IDLEST,
1434}; 172};
1435 173
1436/* mailbox */ 174/* mailbox */
1437static struct omap_hwmod omap2430_mailbox_hwmod;
1438static struct omap_hwmod_irq_info omap2430_mailbox_irqs[] = { 175static struct omap_hwmod_irq_info omap2430_mailbox_irqs[] = {
1439 { .irq = 26 }, 176 { .irq = 26 },
1440 { .irq = -1 } 177 { .irq = -1 }
1441}; 178};
1442 179
1443/* l4_core -> mailbox */
1444static struct omap_hwmod_ocp_if omap2430_l4_core__mailbox = {
1445 .master = &omap2430_l4_core_hwmod,
1446 .slave = &omap2430_mailbox_hwmod,
1447 .addr = omap2_mailbox_addrs,
1448 .user = OCP_USER_MPU | OCP_USER_SDMA,
1449};
1450
1451/* mailbox slave ports */
1452static struct omap_hwmod_ocp_if *omap2430_mailbox_slaves[] = {
1453 &omap2430_l4_core__mailbox,
1454};
1455
1456static struct omap_hwmod omap2430_mailbox_hwmod = { 180static struct omap_hwmod omap2430_mailbox_hwmod = {
1457 .name = "mailbox", 181 .name = "mailbox",
1458 .class = &omap2xxx_mailbox_hwmod_class, 182 .class = &omap2xxx_mailbox_hwmod_class,
@@ -1467,66 +191,6 @@ static struct omap_hwmod omap2430_mailbox_hwmod = {
1467 .idlest_idle_bit = OMAP24XX_ST_MAILBOXES_SHIFT, 191 .idlest_idle_bit = OMAP24XX_ST_MAILBOXES_SHIFT,
1468 }, 192 },
1469 }, 193 },
1470 .slaves = omap2430_mailbox_slaves,
1471 .slaves_cnt = ARRAY_SIZE(omap2430_mailbox_slaves),
1472};
1473
1474/* mcspi1 */
1475static struct omap_hwmod_ocp_if *omap2430_mcspi1_slaves[] = {
1476 &omap2430_l4_core__mcspi1,
1477};
1478
1479static struct omap2_mcspi_dev_attr omap_mcspi1_dev_attr = {
1480 .num_chipselect = 4,
1481};
1482
1483static struct omap_hwmod omap2430_mcspi1_hwmod = {
1484 .name = "mcspi1_hwmod",
1485 .mpu_irqs = omap2_mcspi1_mpu_irqs,
1486 .sdma_reqs = omap2_mcspi1_sdma_reqs,
1487 .main_clk = "mcspi1_fck",
1488 .prcm = {
1489 .omap2 = {
1490 .module_offs = CORE_MOD,
1491 .prcm_reg_id = 1,
1492 .module_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1493 .idlest_reg_id = 1,
1494 .idlest_idle_bit = OMAP24XX_ST_MCSPI1_SHIFT,
1495 },
1496 },
1497 .slaves = omap2430_mcspi1_slaves,
1498 .slaves_cnt = ARRAY_SIZE(omap2430_mcspi1_slaves),
1499 .class = &omap2xxx_mcspi_class,
1500 .dev_attr = &omap_mcspi1_dev_attr,
1501};
1502
1503/* mcspi2 */
1504static struct omap_hwmod_ocp_if *omap2430_mcspi2_slaves[] = {
1505 &omap2430_l4_core__mcspi2,
1506};
1507
1508static struct omap2_mcspi_dev_attr omap_mcspi2_dev_attr = {
1509 .num_chipselect = 2,
1510};
1511
1512static struct omap_hwmod omap2430_mcspi2_hwmod = {
1513 .name = "mcspi2_hwmod",
1514 .mpu_irqs = omap2_mcspi2_mpu_irqs,
1515 .sdma_reqs = omap2_mcspi2_sdma_reqs,
1516 .main_clk = "mcspi2_fck",
1517 .prcm = {
1518 .omap2 = {
1519 .module_offs = CORE_MOD,
1520 .prcm_reg_id = 1,
1521 .module_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1522 .idlest_reg_id = 1,
1523 .idlest_idle_bit = OMAP24XX_ST_MCSPI2_SHIFT,
1524 },
1525 },
1526 .slaves = omap2430_mcspi2_slaves,
1527 .slaves_cnt = ARRAY_SIZE(omap2430_mcspi2_slaves),
1528 .class = &omap2xxx_mcspi_class,
1529 .dev_attr = &omap_mcspi2_dev_attr,
1530}; 194};
1531 195
1532/* mcspi3 */ 196/* mcspi3 */
@@ -1543,16 +207,12 @@ static struct omap_hwmod_dma_info omap2430_mcspi3_sdma_reqs[] = {
1543 { .dma_req = -1 } 207 { .dma_req = -1 }
1544}; 208};
1545 209
1546static struct omap_hwmod_ocp_if *omap2430_mcspi3_slaves[] = {
1547 &omap2430_l4_core__mcspi3,
1548};
1549
1550static struct omap2_mcspi_dev_attr omap_mcspi3_dev_attr = { 210static struct omap2_mcspi_dev_attr omap_mcspi3_dev_attr = {
1551 .num_chipselect = 2, 211 .num_chipselect = 2,
1552}; 212};
1553 213
1554static struct omap_hwmod omap2430_mcspi3_hwmod = { 214static struct omap_hwmod omap2430_mcspi3_hwmod = {
1555 .name = "mcspi3_hwmod", 215 .name = "mcspi3",
1556 .mpu_irqs = omap2430_mcspi3_mpu_irqs, 216 .mpu_irqs = omap2430_mcspi3_mpu_irqs,
1557 .sdma_reqs = omap2430_mcspi3_sdma_reqs, 217 .sdma_reqs = omap2430_mcspi3_sdma_reqs,
1558 .main_clk = "mcspi3_fck", 218 .main_clk = "mcspi3_fck",
@@ -1565,15 +225,11 @@ static struct omap_hwmod omap2430_mcspi3_hwmod = {
1565 .idlest_idle_bit = OMAP2430_ST_MCSPI3_SHIFT, 225 .idlest_idle_bit = OMAP2430_ST_MCSPI3_SHIFT,
1566 }, 226 },
1567 }, 227 },
1568 .slaves = omap2430_mcspi3_slaves,
1569 .slaves_cnt = ARRAY_SIZE(omap2430_mcspi3_slaves),
1570 .class = &omap2xxx_mcspi_class, 228 .class = &omap2xxx_mcspi_class,
1571 .dev_attr = &omap_mcspi3_dev_attr, 229 .dev_attr = &omap_mcspi3_dev_attr,
1572}; 230};
1573 231
1574/* 232/* usbhsotg */
1575 * usbhsotg
1576 */
1577static struct omap_hwmod_class_sysconfig omap2430_usbhsotg_sysc = { 233static struct omap_hwmod_class_sysconfig omap2430_usbhsotg_sysc = {
1578 .rev_offs = 0x0400, 234 .rev_offs = 0x0400,
1579 .sysc_offs = 0x0404, 235 .sysc_offs = 0x0404,
@@ -1612,10 +268,6 @@ static struct omap_hwmod omap2430_usbhsotg_hwmod = {
1612 .idlest_idle_bit = OMAP2430_ST_USBHS_SHIFT, 268 .idlest_idle_bit = OMAP2430_ST_USBHS_SHIFT,
1613 }, 269 },
1614 }, 270 },
1615 .masters = omap2430_usbhsotg_masters,
1616 .masters_cnt = ARRAY_SIZE(omap2430_usbhsotg_masters),
1617 .slaves = omap2430_usbhsotg_slaves,
1618 .slaves_cnt = ARRAY_SIZE(omap2430_usbhsotg_slaves),
1619 .class = &usbotg_class, 271 .class = &usbotg_class,
1620 /* 272 /*
1621 * Erratum ID: i479 idle_req / idle_ack mechanism potentially 273 * Erratum ID: i479 idle_req / idle_ack mechanism potentially
@@ -1653,20 +305,6 @@ static struct omap_hwmod_irq_info omap2430_mcbsp1_irqs[] = {
1653 { .irq = -1 } 305 { .irq = -1 }
1654}; 306};
1655 307
1656/* l4_core -> mcbsp1 */
1657static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp1 = {
1658 .master = &omap2430_l4_core_hwmod,
1659 .slave = &omap2430_mcbsp1_hwmod,
1660 .clk = "mcbsp1_ick",
1661 .addr = omap2_mcbsp1_addrs,
1662 .user = OCP_USER_MPU | OCP_USER_SDMA,
1663};
1664
1665/* mcbsp1 slave ports */
1666static struct omap_hwmod_ocp_if *omap2430_mcbsp1_slaves[] = {
1667 &omap2430_l4_core__mcbsp1,
1668};
1669
1670static struct omap_hwmod omap2430_mcbsp1_hwmod = { 308static struct omap_hwmod omap2430_mcbsp1_hwmod = {
1671 .name = "mcbsp1", 309 .name = "mcbsp1",
1672 .class = &omap2430_mcbsp_hwmod_class, 310 .class = &omap2430_mcbsp_hwmod_class,
@@ -1682,8 +320,6 @@ static struct omap_hwmod omap2430_mcbsp1_hwmod = {
1682 .idlest_idle_bit = OMAP24XX_ST_MCBSP1_SHIFT, 320 .idlest_idle_bit = OMAP24XX_ST_MCBSP1_SHIFT,
1683 }, 321 },
1684 }, 322 },
1685 .slaves = omap2430_mcbsp1_slaves,
1686 .slaves_cnt = ARRAY_SIZE(omap2430_mcbsp1_slaves),
1687}; 323};
1688 324
1689/* mcbsp2 */ 325/* mcbsp2 */
@@ -1694,20 +330,6 @@ static struct omap_hwmod_irq_info omap2430_mcbsp2_irqs[] = {
1694 { .irq = -1 } 330 { .irq = -1 }
1695}; 331};
1696 332
1697/* l4_core -> mcbsp2 */
1698static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp2 = {
1699 .master = &omap2430_l4_core_hwmod,
1700 .slave = &omap2430_mcbsp2_hwmod,
1701 .clk = "mcbsp2_ick",
1702 .addr = omap2xxx_mcbsp2_addrs,
1703 .user = OCP_USER_MPU | OCP_USER_SDMA,
1704};
1705
1706/* mcbsp2 slave ports */
1707static struct omap_hwmod_ocp_if *omap2430_mcbsp2_slaves[] = {
1708 &omap2430_l4_core__mcbsp2,
1709};
1710
1711static struct omap_hwmod omap2430_mcbsp2_hwmod = { 333static struct omap_hwmod omap2430_mcbsp2_hwmod = {
1712 .name = "mcbsp2", 334 .name = "mcbsp2",
1713 .class = &omap2430_mcbsp_hwmod_class, 335 .class = &omap2430_mcbsp_hwmod_class,
@@ -1723,8 +345,6 @@ static struct omap_hwmod omap2430_mcbsp2_hwmod = {
1723 .idlest_idle_bit = OMAP24XX_ST_MCBSP2_SHIFT, 345 .idlest_idle_bit = OMAP24XX_ST_MCBSP2_SHIFT,
1724 }, 346 },
1725 }, 347 },
1726 .slaves = omap2430_mcbsp2_slaves,
1727 .slaves_cnt = ARRAY_SIZE(omap2430_mcbsp2_slaves),
1728}; 348};
1729 349
1730/* mcbsp3 */ 350/* mcbsp3 */
@@ -1735,30 +355,6 @@ static struct omap_hwmod_irq_info omap2430_mcbsp3_irqs[] = {
1735 { .irq = -1 } 355 { .irq = -1 }
1736}; 356};
1737 357
1738static struct omap_hwmod_addr_space omap2430_mcbsp3_addrs[] = {
1739 {
1740 .name = "mpu",
1741 .pa_start = 0x4808C000,
1742 .pa_end = 0x4808C0ff,
1743 .flags = ADDR_TYPE_RT
1744 },
1745 { }
1746};
1747
1748/* l4_core -> mcbsp3 */
1749static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp3 = {
1750 .master = &omap2430_l4_core_hwmod,
1751 .slave = &omap2430_mcbsp3_hwmod,
1752 .clk = "mcbsp3_ick",
1753 .addr = omap2430_mcbsp3_addrs,
1754 .user = OCP_USER_MPU | OCP_USER_SDMA,
1755};
1756
1757/* mcbsp3 slave ports */
1758static struct omap_hwmod_ocp_if *omap2430_mcbsp3_slaves[] = {
1759 &omap2430_l4_core__mcbsp3,
1760};
1761
1762static struct omap_hwmod omap2430_mcbsp3_hwmod = { 358static struct omap_hwmod omap2430_mcbsp3_hwmod = {
1763 .name = "mcbsp3", 359 .name = "mcbsp3",
1764 .class = &omap2430_mcbsp_hwmod_class, 360 .class = &omap2430_mcbsp_hwmod_class,
@@ -1774,8 +370,6 @@ static struct omap_hwmod omap2430_mcbsp3_hwmod = {
1774 .idlest_idle_bit = OMAP2430_ST_MCBSP3_SHIFT, 370 .idlest_idle_bit = OMAP2430_ST_MCBSP3_SHIFT,
1775 }, 371 },
1776 }, 372 },
1777 .slaves = omap2430_mcbsp3_slaves,
1778 .slaves_cnt = ARRAY_SIZE(omap2430_mcbsp3_slaves),
1779}; 373};
1780 374
1781/* mcbsp4 */ 375/* mcbsp4 */
@@ -1792,30 +386,6 @@ static struct omap_hwmod_dma_info omap2430_mcbsp4_sdma_chs[] = {
1792 { .dma_req = -1 } 386 { .dma_req = -1 }
1793}; 387};
1794 388
1795static struct omap_hwmod_addr_space omap2430_mcbsp4_addrs[] = {
1796 {
1797 .name = "mpu",
1798 .pa_start = 0x4808E000,
1799 .pa_end = 0x4808E0ff,
1800 .flags = ADDR_TYPE_RT
1801 },
1802 { }
1803};
1804
1805/* l4_core -> mcbsp4 */
1806static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp4 = {
1807 .master = &omap2430_l4_core_hwmod,
1808 .slave = &omap2430_mcbsp4_hwmod,
1809 .clk = "mcbsp4_ick",
1810 .addr = omap2430_mcbsp4_addrs,
1811 .user = OCP_USER_MPU | OCP_USER_SDMA,
1812};
1813
1814/* mcbsp4 slave ports */
1815static struct omap_hwmod_ocp_if *omap2430_mcbsp4_slaves[] = {
1816 &omap2430_l4_core__mcbsp4,
1817};
1818
1819static struct omap_hwmod omap2430_mcbsp4_hwmod = { 389static struct omap_hwmod omap2430_mcbsp4_hwmod = {
1820 .name = "mcbsp4", 390 .name = "mcbsp4",
1821 .class = &omap2430_mcbsp_hwmod_class, 391 .class = &omap2430_mcbsp_hwmod_class,
@@ -1831,8 +401,6 @@ static struct omap_hwmod omap2430_mcbsp4_hwmod = {
1831 .idlest_idle_bit = OMAP2430_ST_MCBSP4_SHIFT, 401 .idlest_idle_bit = OMAP2430_ST_MCBSP4_SHIFT,
1832 }, 402 },
1833 }, 403 },
1834 .slaves = omap2430_mcbsp4_slaves,
1835 .slaves_cnt = ARRAY_SIZE(omap2430_mcbsp4_slaves),
1836}; 404};
1837 405
1838/* mcbsp5 */ 406/* mcbsp5 */
@@ -1849,30 +417,6 @@ static struct omap_hwmod_dma_info omap2430_mcbsp5_sdma_chs[] = {
1849 { .dma_req = -1 } 417 { .dma_req = -1 }
1850}; 418};
1851 419
1852static struct omap_hwmod_addr_space omap2430_mcbsp5_addrs[] = {
1853 {
1854 .name = "mpu",
1855 .pa_start = 0x48096000,
1856 .pa_end = 0x480960ff,
1857 .flags = ADDR_TYPE_RT
1858 },
1859 { }
1860};
1861
1862/* l4_core -> mcbsp5 */
1863static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp5 = {
1864 .master = &omap2430_l4_core_hwmod,
1865 .slave = &omap2430_mcbsp5_hwmod,
1866 .clk = "mcbsp5_ick",
1867 .addr = omap2430_mcbsp5_addrs,
1868 .user = OCP_USER_MPU | OCP_USER_SDMA,
1869};
1870
1871/* mcbsp5 slave ports */
1872static struct omap_hwmod_ocp_if *omap2430_mcbsp5_slaves[] = {
1873 &omap2430_l4_core__mcbsp5,
1874};
1875
1876static struct omap_hwmod omap2430_mcbsp5_hwmod = { 420static struct omap_hwmod omap2430_mcbsp5_hwmod = {
1877 .name = "mcbsp5", 421 .name = "mcbsp5",
1878 .class = &omap2430_mcbsp_hwmod_class, 422 .class = &omap2430_mcbsp_hwmod_class,
@@ -1888,12 +432,9 @@ static struct omap_hwmod omap2430_mcbsp5_hwmod = {
1888 .idlest_idle_bit = OMAP2430_ST_MCBSP5_SHIFT, 432 .idlest_idle_bit = OMAP2430_ST_MCBSP5_SHIFT,
1889 }, 433 },
1890 }, 434 },
1891 .slaves = omap2430_mcbsp5_slaves,
1892 .slaves_cnt = ARRAY_SIZE(omap2430_mcbsp5_slaves),
1893}; 435};
1894 436
1895/* MMC/SD/SDIO common */ 437/* MMC/SD/SDIO common */
1896
1897static struct omap_hwmod_class_sysconfig omap2430_mmc_sysc = { 438static struct omap_hwmod_class_sysconfig omap2430_mmc_sysc = {
1898 .rev_offs = 0x1fc, 439 .rev_offs = 0x1fc,
1899 .sysc_offs = 0x10, 440 .sysc_offs = 0x10,
@@ -1911,7 +452,6 @@ static struct omap_hwmod_class omap2430_mmc_class = {
1911}; 452};
1912 453
1913/* MMC/SD/SDIO1 */ 454/* MMC/SD/SDIO1 */
1914
1915static struct omap_hwmod_irq_info omap2430_mmc1_mpu_irqs[] = { 455static struct omap_hwmod_irq_info omap2430_mmc1_mpu_irqs[] = {
1916 { .irq = 83 }, 456 { .irq = 83 },
1917 { .irq = -1 } 457 { .irq = -1 }
@@ -1927,10 +467,6 @@ static struct omap_hwmod_opt_clk omap2430_mmc1_opt_clks[] = {
1927 { .role = "dbck", .clk = "mmchsdb1_fck" }, 467 { .role = "dbck", .clk = "mmchsdb1_fck" },
1928}; 468};
1929 469
1930static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = {
1931 &omap2430_l4_core__mmc1,
1932};
1933
1934static struct omap_mmc_dev_attr mmc1_dev_attr = { 470static struct omap_mmc_dev_attr mmc1_dev_attr = {
1935 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, 471 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
1936}; 472};
@@ -1953,13 +489,10 @@ static struct omap_hwmod omap2430_mmc1_hwmod = {
1953 }, 489 },
1954 }, 490 },
1955 .dev_attr = &mmc1_dev_attr, 491 .dev_attr = &mmc1_dev_attr,
1956 .slaves = omap2430_mmc1_slaves,
1957 .slaves_cnt = ARRAY_SIZE(omap2430_mmc1_slaves),
1958 .class = &omap2430_mmc_class, 492 .class = &omap2430_mmc_class,
1959}; 493};
1960 494
1961/* MMC/SD/SDIO2 */ 495/* MMC/SD/SDIO2 */
1962
1963static struct omap_hwmod_irq_info omap2430_mmc2_mpu_irqs[] = { 496static struct omap_hwmod_irq_info omap2430_mmc2_mpu_irqs[] = {
1964 { .irq = 86 }, 497 { .irq = 86 },
1965 { .irq = -1 } 498 { .irq = -1 }
@@ -1975,10 +508,6 @@ static struct omap_hwmod_opt_clk omap2430_mmc2_opt_clks[] = {
1975 { .role = "dbck", .clk = "mmchsdb2_fck" }, 508 { .role = "dbck", .clk = "mmchsdb2_fck" },
1976}; 509};
1977 510
1978static struct omap_hwmod_ocp_if *omap2430_mmc2_slaves[] = {
1979 &omap2430_l4_core__mmc2,
1980};
1981
1982static struct omap_hwmod omap2430_mmc2_hwmod = { 511static struct omap_hwmod omap2430_mmc2_hwmod = {
1983 .name = "mmc2", 512 .name = "mmc2",
1984 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 513 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
@@ -1996,78 +525,418 @@ static struct omap_hwmod omap2430_mmc2_hwmod = {
1996 .idlest_idle_bit = OMAP2430_ST_MMCHS2_SHIFT, 525 .idlest_idle_bit = OMAP2430_ST_MMCHS2_SHIFT,
1997 }, 526 },
1998 }, 527 },
1999 .slaves = omap2430_mmc2_slaves,
2000 .slaves_cnt = ARRAY_SIZE(omap2430_mmc2_slaves),
2001 .class = &omap2430_mmc_class, 528 .class = &omap2430_mmc_class,
2002}; 529};
2003 530
2004static __initdata struct omap_hwmod *omap2430_hwmods[] = { 531/* HDQ1W/1-wire */
2005 &omap2430_l3_main_hwmod, 532static struct omap_hwmod omap2430_hdq1w_hwmod = {
2006 &omap2430_l4_core_hwmod, 533 .name = "hdq1w",
2007 &omap2430_l4_wkup_hwmod, 534 .mpu_irqs = omap2_hdq1w_mpu_irqs,
2008 &omap2430_mpu_hwmod, 535 .main_clk = "hdq_fck",
2009 &omap2430_iva_hwmod, 536 .prcm = {
2010 537 .omap2 = {
2011 &omap2430_timer1_hwmod, 538 .module_offs = CORE_MOD,
2012 &omap2430_timer2_hwmod, 539 .prcm_reg_id = 1,
2013 &omap2430_timer3_hwmod, 540 .module_bit = OMAP24XX_EN_HDQ_SHIFT,
2014 &omap2430_timer4_hwmod, 541 .idlest_reg_id = 1,
2015 &omap2430_timer5_hwmod, 542 .idlest_idle_bit = OMAP24XX_ST_HDQ_SHIFT,
2016 &omap2430_timer6_hwmod, 543 },
2017 &omap2430_timer7_hwmod, 544 },
2018 &omap2430_timer8_hwmod, 545 .class = &omap2_hdq1w_class,
2019 &omap2430_timer9_hwmod, 546};
2020 &omap2430_timer10_hwmod, 547
2021 &omap2430_timer11_hwmod, 548/*
2022 &omap2430_timer12_hwmod, 549 * interfaces
2023 550 */
2024 &omap2430_wd_timer2_hwmod, 551
2025 &omap2430_uart1_hwmod, 552/* L3 -> L4_CORE interface */
2026 &omap2430_uart2_hwmod, 553/* l3_core -> usbhsotg interface */
2027 &omap2430_uart3_hwmod, 554static struct omap_hwmod_ocp_if omap2430_usbhsotg__l3 = {
2028 /* dss class */ 555 .master = &omap2430_usbhsotg_hwmod,
2029 &omap2430_dss_core_hwmod, 556 .slave = &omap2xxx_l3_main_hwmod,
2030 &omap2430_dss_dispc_hwmod, 557 .clk = "core_l3_ck",
2031 &omap2430_dss_rfbi_hwmod, 558 .user = OCP_USER_MPU,
2032 &omap2430_dss_venc_hwmod, 559};
2033 /* i2c class */ 560
2034 &omap2430_i2c1_hwmod, 561/* L4 CORE -> I2C1 interface */
2035 &omap2430_i2c2_hwmod, 562static struct omap_hwmod_ocp_if omap2430_l4_core__i2c1 = {
2036 &omap2430_mmc1_hwmod, 563 .master = &omap2xxx_l4_core_hwmod,
2037 &omap2430_mmc2_hwmod, 564 .slave = &omap2430_i2c1_hwmod,
2038 565 .clk = "i2c1_ick",
2039 /* gpio class */ 566 .addr = omap2_i2c1_addr_space,
2040 &omap2430_gpio1_hwmod, 567 .user = OCP_USER_MPU | OCP_USER_SDMA,
2041 &omap2430_gpio2_hwmod, 568};
2042 &omap2430_gpio3_hwmod, 569
2043 &omap2430_gpio4_hwmod, 570/* L4 CORE -> I2C2 interface */
2044 &omap2430_gpio5_hwmod, 571static struct omap_hwmod_ocp_if omap2430_l4_core__i2c2 = {
2045 572 .master = &omap2xxx_l4_core_hwmod,
2046 /* dma_system class*/ 573 .slave = &omap2430_i2c2_hwmod,
2047 &omap2430_dma_system_hwmod, 574 .clk = "i2c2_ick",
2048 575 .addr = omap2_i2c2_addr_space,
2049 /* mcbsp class */ 576 .user = OCP_USER_MPU | OCP_USER_SDMA,
2050 &omap2430_mcbsp1_hwmod, 577};
2051 &omap2430_mcbsp2_hwmod, 578
2052 &omap2430_mcbsp3_hwmod, 579static struct omap_hwmod_addr_space omap2430_usbhsotg_addrs[] = {
2053 &omap2430_mcbsp4_hwmod, 580 {
2054 &omap2430_mcbsp5_hwmod, 581 .pa_start = OMAP243X_HS_BASE,
2055 582 .pa_end = OMAP243X_HS_BASE + SZ_4K - 1,
2056 /* mailbox class */ 583 .flags = ADDR_TYPE_RT
2057 &omap2430_mailbox_hwmod, 584 },
2058 585 { }
2059 /* mcspi class */ 586};
2060 &omap2430_mcspi1_hwmod, 587
2061 &omap2430_mcspi2_hwmod, 588/* l4_core ->usbhsotg interface */
2062 &omap2430_mcspi3_hwmod, 589static struct omap_hwmod_ocp_if omap2430_l4_core__usbhsotg = {
2063 590 .master = &omap2xxx_l4_core_hwmod,
2064 /* usbotg class*/ 591 .slave = &omap2430_usbhsotg_hwmod,
2065 &omap2430_usbhsotg_hwmod, 592 .clk = "usb_l4_ick",
593 .addr = omap2430_usbhsotg_addrs,
594 .user = OCP_USER_MPU,
595};
2066 596
597/* L4 CORE -> MMC1 interface */
598static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = {
599 .master = &omap2xxx_l4_core_hwmod,
600 .slave = &omap2430_mmc1_hwmod,
601 .clk = "mmchs1_ick",
602 .addr = omap2430_mmc1_addr_space,
603 .user = OCP_USER_MPU | OCP_USER_SDMA,
604};
605
606/* L4 CORE -> MMC2 interface */
607static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = {
608 .master = &omap2xxx_l4_core_hwmod,
609 .slave = &omap2430_mmc2_hwmod,
610 .clk = "mmchs2_ick",
611 .addr = omap2430_mmc2_addr_space,
612 .user = OCP_USER_MPU | OCP_USER_SDMA,
613};
614
615/* l4 core -> mcspi3 interface */
616static struct omap_hwmod_ocp_if omap2430_l4_core__mcspi3 = {
617 .master = &omap2xxx_l4_core_hwmod,
618 .slave = &omap2430_mcspi3_hwmod,
619 .clk = "mcspi3_ick",
620 .addr = omap2430_mcspi3_addr_space,
621 .user = OCP_USER_MPU | OCP_USER_SDMA,
622};
623
624/* IVA2 <- L3 interface */
625static struct omap_hwmod_ocp_if omap2430_l3__iva = {
626 .master = &omap2xxx_l3_main_hwmod,
627 .slave = &omap2430_iva_hwmod,
628 .clk = "core_l3_ck",
629 .user = OCP_USER_MPU | OCP_USER_SDMA,
630};
631
632static struct omap_hwmod_addr_space omap2430_timer1_addrs[] = {
633 {
634 .pa_start = 0x49018000,
635 .pa_end = 0x49018000 + SZ_1K - 1,
636 .flags = ADDR_TYPE_RT
637 },
638 { }
639};
640
641/* l4_wkup -> timer1 */
642static struct omap_hwmod_ocp_if omap2430_l4_wkup__timer1 = {
643 .master = &omap2xxx_l4_wkup_hwmod,
644 .slave = &omap2xxx_timer1_hwmod,
645 .clk = "gpt1_ick",
646 .addr = omap2430_timer1_addrs,
647 .user = OCP_USER_MPU | OCP_USER_SDMA,
648};
649
650/* l4_wkup -> wd_timer2 */
651static struct omap_hwmod_addr_space omap2430_wd_timer2_addrs[] = {
652 {
653 .pa_start = 0x49016000,
654 .pa_end = 0x4901607f,
655 .flags = ADDR_TYPE_RT
656 },
657 { }
658};
659
660static struct omap_hwmod_ocp_if omap2430_l4_wkup__wd_timer2 = {
661 .master = &omap2xxx_l4_wkup_hwmod,
662 .slave = &omap2xxx_wd_timer2_hwmod,
663 .clk = "mpu_wdt_ick",
664 .addr = omap2430_wd_timer2_addrs,
665 .user = OCP_USER_MPU | OCP_USER_SDMA,
666};
667
668/* l4_wkup -> gpio1 */
669static struct omap_hwmod_addr_space omap2430_gpio1_addr_space[] = {
670 {
671 .pa_start = 0x4900C000,
672 .pa_end = 0x4900C1ff,
673 .flags = ADDR_TYPE_RT
674 },
675 { }
676};
677
678static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio1 = {
679 .master = &omap2xxx_l4_wkup_hwmod,
680 .slave = &omap2xxx_gpio1_hwmod,
681 .clk = "gpios_ick",
682 .addr = omap2430_gpio1_addr_space,
683 .user = OCP_USER_MPU | OCP_USER_SDMA,
684};
685
686/* l4_wkup -> gpio2 */
687static struct omap_hwmod_addr_space omap2430_gpio2_addr_space[] = {
688 {
689 .pa_start = 0x4900E000,
690 .pa_end = 0x4900E1ff,
691 .flags = ADDR_TYPE_RT
692 },
693 { }
694};
695
696static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio2 = {
697 .master = &omap2xxx_l4_wkup_hwmod,
698 .slave = &omap2xxx_gpio2_hwmod,
699 .clk = "gpios_ick",
700 .addr = omap2430_gpio2_addr_space,
701 .user = OCP_USER_MPU | OCP_USER_SDMA,
702};
703
704/* l4_wkup -> gpio3 */
705static struct omap_hwmod_addr_space omap2430_gpio3_addr_space[] = {
706 {
707 .pa_start = 0x49010000,
708 .pa_end = 0x490101ff,
709 .flags = ADDR_TYPE_RT
710 },
711 { }
712};
713
714static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio3 = {
715 .master = &omap2xxx_l4_wkup_hwmod,
716 .slave = &omap2xxx_gpio3_hwmod,
717 .clk = "gpios_ick",
718 .addr = omap2430_gpio3_addr_space,
719 .user = OCP_USER_MPU | OCP_USER_SDMA,
720};
721
722/* l4_wkup -> gpio4 */
723static struct omap_hwmod_addr_space omap2430_gpio4_addr_space[] = {
724 {
725 .pa_start = 0x49012000,
726 .pa_end = 0x490121ff,
727 .flags = ADDR_TYPE_RT
728 },
729 { }
730};
731
732static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio4 = {
733 .master = &omap2xxx_l4_wkup_hwmod,
734 .slave = &omap2xxx_gpio4_hwmod,
735 .clk = "gpios_ick",
736 .addr = omap2430_gpio4_addr_space,
737 .user = OCP_USER_MPU | OCP_USER_SDMA,
738};
739
740/* l4_core -> gpio5 */
741static struct omap_hwmod_addr_space omap2430_gpio5_addr_space[] = {
742 {
743 .pa_start = 0x480B6000,
744 .pa_end = 0x480B61ff,
745 .flags = ADDR_TYPE_RT
746 },
747 { }
748};
749
750static struct omap_hwmod_ocp_if omap2430_l4_core__gpio5 = {
751 .master = &omap2xxx_l4_core_hwmod,
752 .slave = &omap2430_gpio5_hwmod,
753 .clk = "gpio5_ick",
754 .addr = omap2430_gpio5_addr_space,
755 .user = OCP_USER_MPU | OCP_USER_SDMA,
756};
757
758/* dma_system -> L3 */
759static struct omap_hwmod_ocp_if omap2430_dma_system__l3 = {
760 .master = &omap2430_dma_system_hwmod,
761 .slave = &omap2xxx_l3_main_hwmod,
762 .clk = "core_l3_ck",
763 .user = OCP_USER_MPU | OCP_USER_SDMA,
764};
765
766/* l4_core -> dma_system */
767static struct omap_hwmod_ocp_if omap2430_l4_core__dma_system = {
768 .master = &omap2xxx_l4_core_hwmod,
769 .slave = &omap2430_dma_system_hwmod,
770 .clk = "sdma_ick",
771 .addr = omap2_dma_system_addrs,
772 .user = OCP_USER_MPU | OCP_USER_SDMA,
773};
774
775/* l4_core -> mailbox */
776static struct omap_hwmod_ocp_if omap2430_l4_core__mailbox = {
777 .master = &omap2xxx_l4_core_hwmod,
778 .slave = &omap2430_mailbox_hwmod,
779 .addr = omap2_mailbox_addrs,
780 .user = OCP_USER_MPU | OCP_USER_SDMA,
781};
782
783/* l4_core -> mcbsp1 */
784static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp1 = {
785 .master = &omap2xxx_l4_core_hwmod,
786 .slave = &omap2430_mcbsp1_hwmod,
787 .clk = "mcbsp1_ick",
788 .addr = omap2_mcbsp1_addrs,
789 .user = OCP_USER_MPU | OCP_USER_SDMA,
790};
791
792/* l4_core -> mcbsp2 */
793static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp2 = {
794 .master = &omap2xxx_l4_core_hwmod,
795 .slave = &omap2430_mcbsp2_hwmod,
796 .clk = "mcbsp2_ick",
797 .addr = omap2xxx_mcbsp2_addrs,
798 .user = OCP_USER_MPU | OCP_USER_SDMA,
799};
800
801static struct omap_hwmod_addr_space omap2430_mcbsp3_addrs[] = {
802 {
803 .name = "mpu",
804 .pa_start = 0x4808C000,
805 .pa_end = 0x4808C0ff,
806 .flags = ADDR_TYPE_RT
807 },
808 { }
809};
810
811/* l4_core -> mcbsp3 */
812static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp3 = {
813 .master = &omap2xxx_l4_core_hwmod,
814 .slave = &omap2430_mcbsp3_hwmod,
815 .clk = "mcbsp3_ick",
816 .addr = omap2430_mcbsp3_addrs,
817 .user = OCP_USER_MPU | OCP_USER_SDMA,
818};
819
820static struct omap_hwmod_addr_space omap2430_mcbsp4_addrs[] = {
821 {
822 .name = "mpu",
823 .pa_start = 0x4808E000,
824 .pa_end = 0x4808E0ff,
825 .flags = ADDR_TYPE_RT
826 },
827 { }
828};
829
830/* l4_core -> mcbsp4 */
831static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp4 = {
832 .master = &omap2xxx_l4_core_hwmod,
833 .slave = &omap2430_mcbsp4_hwmod,
834 .clk = "mcbsp4_ick",
835 .addr = omap2430_mcbsp4_addrs,
836 .user = OCP_USER_MPU | OCP_USER_SDMA,
837};
838
839static struct omap_hwmod_addr_space omap2430_mcbsp5_addrs[] = {
840 {
841 .name = "mpu",
842 .pa_start = 0x48096000,
843 .pa_end = 0x480960ff,
844 .flags = ADDR_TYPE_RT
845 },
846 { }
847};
848
849/* l4_core -> mcbsp5 */
850static struct omap_hwmod_ocp_if omap2430_l4_core__mcbsp5 = {
851 .master = &omap2xxx_l4_core_hwmod,
852 .slave = &omap2430_mcbsp5_hwmod,
853 .clk = "mcbsp5_ick",
854 .addr = omap2430_mcbsp5_addrs,
855 .user = OCP_USER_MPU | OCP_USER_SDMA,
856};
857
858/* l4_core -> hdq1w */
859static struct omap_hwmod_ocp_if omap2430_l4_core__hdq1w = {
860 .master = &omap2xxx_l4_core_hwmod,
861 .slave = &omap2430_hdq1w_hwmod,
862 .clk = "hdq_ick",
863 .addr = omap2_hdq1w_addr_space,
864 .user = OCP_USER_MPU | OCP_USER_SDMA,
865 .flags = OMAP_FIREWALL_L4 | OCPIF_SWSUP_IDLE,
866};
867
868/* l4_wkup -> 32ksync_counter */
869static struct omap_hwmod_addr_space omap2430_counter_32k_addrs[] = {
870 {
871 .pa_start = 0x49020000,
872 .pa_end = 0x4902001f,
873 .flags = ADDR_TYPE_RT
874 },
875 { }
876};
877
878static struct omap_hwmod_ocp_if omap2430_l4_wkup__counter_32k = {
879 .master = &omap2xxx_l4_wkup_hwmod,
880 .slave = &omap2xxx_counter_32k_hwmod,
881 .clk = "sync_32k_ick",
882 .addr = omap2430_counter_32k_addrs,
883 .user = OCP_USER_MPU | OCP_USER_SDMA,
884};
885
886static struct omap_hwmod_ocp_if *omap2430_hwmod_ocp_ifs[] __initdata = {
887 &omap2xxx_l3_main__l4_core,
888 &omap2xxx_mpu__l3_main,
889 &omap2xxx_dss__l3,
890 &omap2430_usbhsotg__l3,
891 &omap2430_l4_core__i2c1,
892 &omap2430_l4_core__i2c2,
893 &omap2xxx_l4_core__l4_wkup,
894 &omap2_l4_core__uart1,
895 &omap2_l4_core__uart2,
896 &omap2_l4_core__uart3,
897 &omap2430_l4_core__usbhsotg,
898 &omap2430_l4_core__mmc1,
899 &omap2430_l4_core__mmc2,
900 &omap2xxx_l4_core__mcspi1,
901 &omap2xxx_l4_core__mcspi2,
902 &omap2430_l4_core__mcspi3,
903 &omap2430_l3__iva,
904 &omap2430_l4_wkup__timer1,
905 &omap2xxx_l4_core__timer2,
906 &omap2xxx_l4_core__timer3,
907 &omap2xxx_l4_core__timer4,
908 &omap2xxx_l4_core__timer5,
909 &omap2xxx_l4_core__timer6,
910 &omap2xxx_l4_core__timer7,
911 &omap2xxx_l4_core__timer8,
912 &omap2xxx_l4_core__timer9,
913 &omap2xxx_l4_core__timer10,
914 &omap2xxx_l4_core__timer11,
915 &omap2xxx_l4_core__timer12,
916 &omap2430_l4_wkup__wd_timer2,
917 &omap2xxx_l4_core__dss,
918 &omap2xxx_l4_core__dss_dispc,
919 &omap2xxx_l4_core__dss_rfbi,
920 &omap2xxx_l4_core__dss_venc,
921 &omap2430_l4_wkup__gpio1,
922 &omap2430_l4_wkup__gpio2,
923 &omap2430_l4_wkup__gpio3,
924 &omap2430_l4_wkup__gpio4,
925 &omap2430_l4_core__gpio5,
926 &omap2430_dma_system__l3,
927 &omap2430_l4_core__dma_system,
928 &omap2430_l4_core__mailbox,
929 &omap2430_l4_core__mcbsp1,
930 &omap2430_l4_core__mcbsp2,
931 &omap2430_l4_core__mcbsp3,
932 &omap2430_l4_core__mcbsp4,
933 &omap2430_l4_core__mcbsp5,
934 &omap2430_l4_core__hdq1w,
935 &omap2430_l4_wkup__counter_32k,
2067 NULL, 936 NULL,
2068}; 937};
2069 938
2070int __init omap2430_hwmod_init(void) 939int __init omap2430_hwmod_init(void)
2071{ 940{
2072 return omap_hwmod_register(omap2430_hwmods); 941 return omap_hwmod_register_links(omap2430_hwmod_ocp_ifs);
2073} 942}
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c
index 04637fabadd2..cbb4ef6544ad 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c
@@ -171,3 +171,12 @@ struct omap_hwmod_addr_space omap2_mcbsp1_addrs[] = {
171 }, 171 },
172 { } 172 { }
173}; 173};
174
175struct omap_hwmod_addr_space omap2_hdq1w_addr_space[] = {
176 {
177 .pa_start = 0x480b2000,
178 .pa_end = 0x480b2fff,
179 .flags = ADDR_TYPE_RT,
180 },
181 { }
182};
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
index f08e442af397..102d76e9e9ea 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
@@ -2,6 +2,7 @@
2 * omap_hwmod_2xxx_3xxx_ipblock_data.c - common IP block data for OMAP2/3 2 * omap_hwmod_2xxx_3xxx_ipblock_data.c - common IP block data for OMAP2/3
3 * 3 *
4 * Copyright (C) 2011 Nokia Corporation 4 * Copyright (C) 2011 Nokia Corporation
5 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley 6 * Paul Walmsley
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
@@ -12,6 +13,7 @@
12#include <plat/serial.h> 13#include <plat/serial.h>
13#include <plat/dma.h> 14#include <plat/dma.h>
14#include <plat/common.h> 15#include <plat/common.h>
16#include <plat/hdq1w.h>
15 17
16#include <mach/irqs.h> 18#include <mach/irqs.h>
17 19
@@ -302,3 +304,23 @@ struct omap_hwmod_irq_info omap2_mcspi2_mpu_irqs[] = {
302 { .irq = -1 } 304 { .irq = -1 }
303}; 305};
304 306
307struct omap_hwmod_class_sysconfig omap2_hdq1w_sysc = {
308 .rev_offs = 0x0,
309 .sysc_offs = 0x14,
310 .syss_offs = 0x18,
311 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
312 SYSS_HAS_RESET_STATUS),
313 .sysc_fields = &omap_hwmod_sysc_type1,
314};
315
316struct omap_hwmod_class omap2_hdq1w_class = {
317 .name = "hdq1w",
318 .sysc = &omap2_hdq1w_sysc,
319 .reset = &omap_hdq1w_reset,
320};
321
322struct omap_hwmod_irq_info omap2_hdq1w_mpu_irqs[] = {
323 { .irq = 58, },
324 { .irq = -1 }
325};
326
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
index 4f3547c2a49e..5178e40e84f9 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
@@ -15,10 +15,12 @@
15 15
16#include <plat/omap_hwmod.h> 16#include <plat/omap_hwmod.h>
17#include <plat/serial.h> 17#include <plat/serial.h>
18#include <plat/l3_2xxx.h>
19#include <plat/l4_2xxx.h>
18 20
19#include "omap_hwmod_common_data.h" 21#include "omap_hwmod_common_data.h"
20 22
21struct omap_hwmod_addr_space omap2xxx_uart1_addr_space[] = { 23static struct omap_hwmod_addr_space omap2xxx_uart1_addr_space[] = {
22 { 24 {
23 .pa_start = OMAP2_UART1_BASE, 25 .pa_start = OMAP2_UART1_BASE,
24 .pa_end = OMAP2_UART1_BASE + SZ_8K - 1, 26 .pa_end = OMAP2_UART1_BASE + SZ_8K - 1,
@@ -27,7 +29,7 @@ struct omap_hwmod_addr_space omap2xxx_uart1_addr_space[] = {
27 { } 29 { }
28}; 30};
29 31
30struct omap_hwmod_addr_space omap2xxx_uart2_addr_space[] = { 32static struct omap_hwmod_addr_space omap2xxx_uart2_addr_space[] = {
31 { 33 {
32 .pa_start = OMAP2_UART2_BASE, 34 .pa_start = OMAP2_UART2_BASE,
33 .pa_end = OMAP2_UART2_BASE + SZ_1K - 1, 35 .pa_end = OMAP2_UART2_BASE + SZ_1K - 1,
@@ -36,7 +38,7 @@ struct omap_hwmod_addr_space omap2xxx_uart2_addr_space[] = {
36 { } 38 { }
37}; 39};
38 40
39struct omap_hwmod_addr_space omap2xxx_uart3_addr_space[] = { 41static struct omap_hwmod_addr_space omap2xxx_uart3_addr_space[] = {
40 { 42 {
41 .pa_start = OMAP2_UART3_BASE, 43 .pa_start = OMAP2_UART3_BASE,
42 .pa_end = OMAP2_UART3_BASE + SZ_1K - 1, 44 .pa_end = OMAP2_UART3_BASE + SZ_1K - 1,
@@ -45,7 +47,7 @@ struct omap_hwmod_addr_space omap2xxx_uart3_addr_space[] = {
45 { } 47 { }
46}; 48};
47 49
48struct omap_hwmod_addr_space omap2xxx_timer2_addrs[] = { 50static struct omap_hwmod_addr_space omap2xxx_timer2_addrs[] = {
49 { 51 {
50 .pa_start = 0x4802a000, 52 .pa_start = 0x4802a000,
51 .pa_end = 0x4802a000 + SZ_1K - 1, 53 .pa_end = 0x4802a000 + SZ_1K - 1,
@@ -54,7 +56,7 @@ struct omap_hwmod_addr_space omap2xxx_timer2_addrs[] = {
54 { } 56 { }
55}; 57};
56 58
57struct omap_hwmod_addr_space omap2xxx_timer3_addrs[] = { 59static struct omap_hwmod_addr_space omap2xxx_timer3_addrs[] = {
58 { 60 {
59 .pa_start = 0x48078000, 61 .pa_start = 0x48078000,
60 .pa_end = 0x48078000 + SZ_1K - 1, 62 .pa_end = 0x48078000 + SZ_1K - 1,
@@ -63,7 +65,7 @@ struct omap_hwmod_addr_space omap2xxx_timer3_addrs[] = {
63 { } 65 { }
64}; 66};
65 67
66struct omap_hwmod_addr_space omap2xxx_timer4_addrs[] = { 68static struct omap_hwmod_addr_space omap2xxx_timer4_addrs[] = {
67 { 69 {
68 .pa_start = 0x4807a000, 70 .pa_start = 0x4807a000,
69 .pa_end = 0x4807a000 + SZ_1K - 1, 71 .pa_end = 0x4807a000 + SZ_1K - 1,
@@ -72,7 +74,7 @@ struct omap_hwmod_addr_space omap2xxx_timer4_addrs[] = {
72 { } 74 { }
73}; 75};
74 76
75struct omap_hwmod_addr_space omap2xxx_timer5_addrs[] = { 77static struct omap_hwmod_addr_space omap2xxx_timer5_addrs[] = {
76 { 78 {
77 .pa_start = 0x4807c000, 79 .pa_start = 0x4807c000,
78 .pa_end = 0x4807c000 + SZ_1K - 1, 80 .pa_end = 0x4807c000 + SZ_1K - 1,
@@ -81,7 +83,7 @@ struct omap_hwmod_addr_space omap2xxx_timer5_addrs[] = {
81 { } 83 { }
82}; 84};
83 85
84struct omap_hwmod_addr_space omap2xxx_timer6_addrs[] = { 86static struct omap_hwmod_addr_space omap2xxx_timer6_addrs[] = {
85 { 87 {
86 .pa_start = 0x4807e000, 88 .pa_start = 0x4807e000,
87 .pa_end = 0x4807e000 + SZ_1K - 1, 89 .pa_end = 0x4807e000 + SZ_1K - 1,
@@ -90,7 +92,7 @@ struct omap_hwmod_addr_space omap2xxx_timer6_addrs[] = {
90 { } 92 { }
91}; 93};
92 94
93struct omap_hwmod_addr_space omap2xxx_timer7_addrs[] = { 95static struct omap_hwmod_addr_space omap2xxx_timer7_addrs[] = {
94 { 96 {
95 .pa_start = 0x48080000, 97 .pa_start = 0x48080000,
96 .pa_end = 0x48080000 + SZ_1K - 1, 98 .pa_end = 0x48080000 + SZ_1K - 1,
@@ -99,7 +101,7 @@ struct omap_hwmod_addr_space omap2xxx_timer7_addrs[] = {
99 { } 101 { }
100}; 102};
101 103
102struct omap_hwmod_addr_space omap2xxx_timer8_addrs[] = { 104static struct omap_hwmod_addr_space omap2xxx_timer8_addrs[] = {
103 { 105 {
104 .pa_start = 0x48082000, 106 .pa_start = 0x48082000,
105 .pa_end = 0x48082000 + SZ_1K - 1, 107 .pa_end = 0x48082000 + SZ_1K - 1,
@@ -108,7 +110,7 @@ struct omap_hwmod_addr_space omap2xxx_timer8_addrs[] = {
108 { } 110 { }
109}; 111};
110 112
111struct omap_hwmod_addr_space omap2xxx_timer9_addrs[] = { 113static struct omap_hwmod_addr_space omap2xxx_timer9_addrs[] = {
112 { 114 {
113 .pa_start = 0x48084000, 115 .pa_start = 0x48084000,
114 .pa_end = 0x48084000 + SZ_1K - 1, 116 .pa_end = 0x48084000 + SZ_1K - 1,
@@ -127,4 +129,246 @@ struct omap_hwmod_addr_space omap2xxx_mcbsp2_addrs[] = {
127 { } 129 { }
128}; 130};
129 131
132/*
133 * Common interconnect data
134 */
135
136/* L3 -> L4_CORE interface */
137struct omap_hwmod_ocp_if omap2xxx_l3_main__l4_core = {
138 .master = &omap2xxx_l3_main_hwmod,
139 .slave = &omap2xxx_l4_core_hwmod,
140 .user = OCP_USER_MPU | OCP_USER_SDMA,
141};
142
143/* MPU -> L3 interface */
144struct omap_hwmod_ocp_if omap2xxx_mpu__l3_main = {
145 .master = &omap2xxx_mpu_hwmod,
146 .slave = &omap2xxx_l3_main_hwmod,
147 .user = OCP_USER_MPU,
148};
149
150/* DSS -> l3 */
151struct omap_hwmod_ocp_if omap2xxx_dss__l3 = {
152 .master = &omap2xxx_dss_core_hwmod,
153 .slave = &omap2xxx_l3_main_hwmod,
154 .fw = {
155 .omap2 = {
156 .l3_perm_bit = OMAP2_L3_CORE_FW_CONNID_DSS,
157 .flags = OMAP_FIREWALL_L3,
158 }
159 },
160 .user = OCP_USER_MPU | OCP_USER_SDMA,
161};
162
163/* L4_CORE -> L4_WKUP interface */
164struct omap_hwmod_ocp_if omap2xxx_l4_core__l4_wkup = {
165 .master = &omap2xxx_l4_core_hwmod,
166 .slave = &omap2xxx_l4_wkup_hwmod,
167 .user = OCP_USER_MPU | OCP_USER_SDMA,
168};
169
170/* L4 CORE -> UART1 interface */
171struct omap_hwmod_ocp_if omap2_l4_core__uart1 = {
172 .master = &omap2xxx_l4_core_hwmod,
173 .slave = &omap2xxx_uart1_hwmod,
174 .clk = "uart1_ick",
175 .addr = omap2xxx_uart1_addr_space,
176 .user = OCP_USER_MPU | OCP_USER_SDMA,
177};
178
179/* L4 CORE -> UART2 interface */
180struct omap_hwmod_ocp_if omap2_l4_core__uart2 = {
181 .master = &omap2xxx_l4_core_hwmod,
182 .slave = &omap2xxx_uart2_hwmod,
183 .clk = "uart2_ick",
184 .addr = omap2xxx_uart2_addr_space,
185 .user = OCP_USER_MPU | OCP_USER_SDMA,
186};
187
188/* L4 PER -> UART3 interface */
189struct omap_hwmod_ocp_if omap2_l4_core__uart3 = {
190 .master = &omap2xxx_l4_core_hwmod,
191 .slave = &omap2xxx_uart3_hwmod,
192 .clk = "uart3_ick",
193 .addr = omap2xxx_uart3_addr_space,
194 .user = OCP_USER_MPU | OCP_USER_SDMA,
195};
196
197/* l4 core -> mcspi1 interface */
198struct omap_hwmod_ocp_if omap2xxx_l4_core__mcspi1 = {
199 .master = &omap2xxx_l4_core_hwmod,
200 .slave = &omap2xxx_mcspi1_hwmod,
201 .clk = "mcspi1_ick",
202 .addr = omap2_mcspi1_addr_space,
203 .user = OCP_USER_MPU | OCP_USER_SDMA,
204};
205
206/* l4 core -> mcspi2 interface */
207struct omap_hwmod_ocp_if omap2xxx_l4_core__mcspi2 = {
208 .master = &omap2xxx_l4_core_hwmod,
209 .slave = &omap2xxx_mcspi2_hwmod,
210 .clk = "mcspi2_ick",
211 .addr = omap2_mcspi2_addr_space,
212 .user = OCP_USER_MPU | OCP_USER_SDMA,
213};
214
215/* l4_core -> timer2 */
216struct omap_hwmod_ocp_if omap2xxx_l4_core__timer2 = {
217 .master = &omap2xxx_l4_core_hwmod,
218 .slave = &omap2xxx_timer2_hwmod,
219 .clk = "gpt2_ick",
220 .addr = omap2xxx_timer2_addrs,
221 .user = OCP_USER_MPU | OCP_USER_SDMA,
222};
223
224/* l4_core -> timer3 */
225struct omap_hwmod_ocp_if omap2xxx_l4_core__timer3 = {
226 .master = &omap2xxx_l4_core_hwmod,
227 .slave = &omap2xxx_timer3_hwmod,
228 .clk = "gpt3_ick",
229 .addr = omap2xxx_timer3_addrs,
230 .user = OCP_USER_MPU | OCP_USER_SDMA,
231};
232
233/* l4_core -> timer4 */
234struct omap_hwmod_ocp_if omap2xxx_l4_core__timer4 = {
235 .master = &omap2xxx_l4_core_hwmod,
236 .slave = &omap2xxx_timer4_hwmod,
237 .clk = "gpt4_ick",
238 .addr = omap2xxx_timer4_addrs,
239 .user = OCP_USER_MPU | OCP_USER_SDMA,
240};
241
242/* l4_core -> timer5 */
243struct omap_hwmod_ocp_if omap2xxx_l4_core__timer5 = {
244 .master = &omap2xxx_l4_core_hwmod,
245 .slave = &omap2xxx_timer5_hwmod,
246 .clk = "gpt5_ick",
247 .addr = omap2xxx_timer5_addrs,
248 .user = OCP_USER_MPU | OCP_USER_SDMA,
249};
250
251/* l4_core -> timer6 */
252struct omap_hwmod_ocp_if omap2xxx_l4_core__timer6 = {
253 .master = &omap2xxx_l4_core_hwmod,
254 .slave = &omap2xxx_timer6_hwmod,
255 .clk = "gpt6_ick",
256 .addr = omap2xxx_timer6_addrs,
257 .user = OCP_USER_MPU | OCP_USER_SDMA,
258};
259
260/* l4_core -> timer7 */
261struct omap_hwmod_ocp_if omap2xxx_l4_core__timer7 = {
262 .master = &omap2xxx_l4_core_hwmod,
263 .slave = &omap2xxx_timer7_hwmod,
264 .clk = "gpt7_ick",
265 .addr = omap2xxx_timer7_addrs,
266 .user = OCP_USER_MPU | OCP_USER_SDMA,
267};
268
269/* l4_core -> timer8 */
270struct omap_hwmod_ocp_if omap2xxx_l4_core__timer8 = {
271 .master = &omap2xxx_l4_core_hwmod,
272 .slave = &omap2xxx_timer8_hwmod,
273 .clk = "gpt8_ick",
274 .addr = omap2xxx_timer8_addrs,
275 .user = OCP_USER_MPU | OCP_USER_SDMA,
276};
277
278/* l4_core -> timer9 */
279struct omap_hwmod_ocp_if omap2xxx_l4_core__timer9 = {
280 .master = &omap2xxx_l4_core_hwmod,
281 .slave = &omap2xxx_timer9_hwmod,
282 .clk = "gpt9_ick",
283 .addr = omap2xxx_timer9_addrs,
284 .user = OCP_USER_MPU | OCP_USER_SDMA,
285};
286
287/* l4_core -> timer10 */
288struct omap_hwmod_ocp_if omap2xxx_l4_core__timer10 = {
289 .master = &omap2xxx_l4_core_hwmod,
290 .slave = &omap2xxx_timer10_hwmod,
291 .clk = "gpt10_ick",
292 .addr = omap2_timer10_addrs,
293 .user = OCP_USER_MPU | OCP_USER_SDMA,
294};
295
296/* l4_core -> timer11 */
297struct omap_hwmod_ocp_if omap2xxx_l4_core__timer11 = {
298 .master = &omap2xxx_l4_core_hwmod,
299 .slave = &omap2xxx_timer11_hwmod,
300 .clk = "gpt11_ick",
301 .addr = omap2_timer11_addrs,
302 .user = OCP_USER_MPU | OCP_USER_SDMA,
303};
304
305/* l4_core -> timer12 */
306struct omap_hwmod_ocp_if omap2xxx_l4_core__timer12 = {
307 .master = &omap2xxx_l4_core_hwmod,
308 .slave = &omap2xxx_timer12_hwmod,
309 .clk = "gpt12_ick",
310 .addr = omap2xxx_timer12_addrs,
311 .user = OCP_USER_MPU | OCP_USER_SDMA,
312};
313
314/* l4_core -> dss */
315struct omap_hwmod_ocp_if omap2xxx_l4_core__dss = {
316 .master = &omap2xxx_l4_core_hwmod,
317 .slave = &omap2xxx_dss_core_hwmod,
318 .clk = "dss_ick",
319 .addr = omap2_dss_addrs,
320 .fw = {
321 .omap2 = {
322 .l4_fw_region = OMAP2420_L4_CORE_FW_DSS_CORE_REGION,
323 .flags = OMAP_FIREWALL_L4,
324 }
325 },
326 .user = OCP_USER_MPU | OCP_USER_SDMA,
327};
328
329/* l4_core -> dss_dispc */
330struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_dispc = {
331 .master = &omap2xxx_l4_core_hwmod,
332 .slave = &omap2xxx_dss_dispc_hwmod,
333 .clk = "dss_ick",
334 .addr = omap2_dss_dispc_addrs,
335 .fw = {
336 .omap2 = {
337 .l4_fw_region = OMAP2420_L4_CORE_FW_DSS_DISPC_REGION,
338 .flags = OMAP_FIREWALL_L4,
339 }
340 },
341 .user = OCP_USER_MPU | OCP_USER_SDMA,
342};
343
344/* l4_core -> dss_rfbi */
345struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_rfbi = {
346 .master = &omap2xxx_l4_core_hwmod,
347 .slave = &omap2xxx_dss_rfbi_hwmod,
348 .clk = "dss_ick",
349 .addr = omap2_dss_rfbi_addrs,
350 .fw = {
351 .omap2 = {
352 .l4_fw_region = OMAP2420_L4_CORE_FW_DSS_CORE_REGION,
353 .flags = OMAP_FIREWALL_L4,
354 }
355 },
356 .user = OCP_USER_MPU | OCP_USER_SDMA,
357};
358
359/* l4_core -> dss_venc */
360struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_venc = {
361 .master = &omap2xxx_l4_core_hwmod,
362 .slave = &omap2xxx_dss_venc_hwmod,
363 .clk = "dss_ick",
364 .addr = omap2_dss_venc_addrs,
365 .fw = {
366 .omap2 = {
367 .l4_fw_region = OMAP2420_L4_CORE_FW_DSS_VENC_REGION,
368 .flags = OMAP_FIREWALL_L4,
369 }
370 },
371 .flags = OCPIF_SWSUP_IDLE,
372 .user = OCP_USER_MPU | OCP_USER_SDMA,
373};
130 374
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
index 2a6729741b06..83eafd96ecaa 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
@@ -10,6 +10,7 @@
10 */ 10 */
11#include <plat/omap_hwmod.h> 11#include <plat/omap_hwmod.h>
12#include <plat/serial.h> 12#include <plat/serial.h>
13#include <plat/gpio.h>
13#include <plat/dma.h> 14#include <plat/dma.h>
14#include <plat/dmtimer.h> 15#include <plat/dmtimer.h>
15#include <plat/mcspi.h> 16#include <plat/mcspi.h>
@@ -17,6 +18,8 @@
17#include <mach/irqs.h> 18#include <mach/irqs.h>
18 19
19#include "omap_hwmod_common_data.h" 20#include "omap_hwmod_common_data.h"
21#include "cm-regbits-24xx.h"
22#include "prm-regbits-24xx.h"
20#include "wd_timer.h" 23#include "wd_timer.h"
21 24
22struct omap_hwmod_irq_info omap2xxx_timer12_mpu_irqs[] = { 25struct omap_hwmod_irq_info omap2xxx_timer12_mpu_irqs[] = {
@@ -86,7 +89,8 @@ static struct omap_hwmod_class_sysconfig omap2xxx_wd_timer_sysc = {
86struct omap_hwmod_class omap2xxx_wd_timer_hwmod_class = { 89struct omap_hwmod_class omap2xxx_wd_timer_hwmod_class = {
87 .name = "wd_timer", 90 .name = "wd_timer",
88 .sysc = &omap2xxx_wd_timer_sysc, 91 .sysc = &omap2xxx_wd_timer_sysc,
89 .pre_shutdown = &omap2_wd_timer_disable 92 .pre_shutdown = &omap2_wd_timer_disable,
93 .reset = &omap2_wd_timer_reset,
90}; 94};
91 95
92/* 96/*
@@ -170,3 +174,582 @@ struct omap_hwmod_class omap2xxx_mcspi_class = {
170 .sysc = &omap2xxx_mcspi_sysc, 174 .sysc = &omap2xxx_mcspi_sysc,
171 .rev = OMAP2_MCSPI_REV, 175 .rev = OMAP2_MCSPI_REV,
172}; 176};
177
178/*
179 * IP blocks
180 */
181
182/* L3 */
183struct omap_hwmod omap2xxx_l3_main_hwmod = {
184 .name = "l3_main",
185 .class = &l3_hwmod_class,
186 .flags = HWMOD_NO_IDLEST,
187};
188
189/* L4 CORE */
190struct omap_hwmod omap2xxx_l4_core_hwmod = {
191 .name = "l4_core",
192 .class = &l4_hwmod_class,
193 .flags = HWMOD_NO_IDLEST,
194};
195
196/* L4 WKUP */
197struct omap_hwmod omap2xxx_l4_wkup_hwmod = {
198 .name = "l4_wkup",
199 .class = &l4_hwmod_class,
200 .flags = HWMOD_NO_IDLEST,
201};
202
203/* MPU */
204struct omap_hwmod omap2xxx_mpu_hwmod = {
205 .name = "mpu",
206 .class = &mpu_hwmod_class,
207 .main_clk = "mpu_ck",
208};
209
210/* IVA2 */
211struct omap_hwmod omap2xxx_iva_hwmod = {
212 .name = "iva",
213 .class = &iva_hwmod_class,
214};
215
216/* always-on timers dev attribute */
217static struct omap_timer_capability_dev_attr capability_alwon_dev_attr = {
218 .timer_capability = OMAP_TIMER_ALWON,
219};
220
221/* pwm timers dev attribute */
222static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
223 .timer_capability = OMAP_TIMER_HAS_PWM,
224};
225
226/* timer1 */
227
228struct omap_hwmod omap2xxx_timer1_hwmod = {
229 .name = "timer1",
230 .mpu_irqs = omap2_timer1_mpu_irqs,
231 .main_clk = "gpt1_fck",
232 .prcm = {
233 .omap2 = {
234 .prcm_reg_id = 1,
235 .module_bit = OMAP24XX_EN_GPT1_SHIFT,
236 .module_offs = WKUP_MOD,
237 .idlest_reg_id = 1,
238 .idlest_idle_bit = OMAP24XX_ST_GPT1_SHIFT,
239 },
240 },
241 .dev_attr = &capability_alwon_dev_attr,
242 .class = &omap2xxx_timer_hwmod_class,
243};
244
245/* timer2 */
246
247struct omap_hwmod omap2xxx_timer2_hwmod = {
248 .name = "timer2",
249 .mpu_irqs = omap2_timer2_mpu_irqs,
250 .main_clk = "gpt2_fck",
251 .prcm = {
252 .omap2 = {
253 .prcm_reg_id = 1,
254 .module_bit = OMAP24XX_EN_GPT2_SHIFT,
255 .module_offs = CORE_MOD,
256 .idlest_reg_id = 1,
257 .idlest_idle_bit = OMAP24XX_ST_GPT2_SHIFT,
258 },
259 },
260 .dev_attr = &capability_alwon_dev_attr,
261 .class = &omap2xxx_timer_hwmod_class,
262};
263
264/* timer3 */
265
266struct omap_hwmod omap2xxx_timer3_hwmod = {
267 .name = "timer3",
268 .mpu_irqs = omap2_timer3_mpu_irqs,
269 .main_clk = "gpt3_fck",
270 .prcm = {
271 .omap2 = {
272 .prcm_reg_id = 1,
273 .module_bit = OMAP24XX_EN_GPT3_SHIFT,
274 .module_offs = CORE_MOD,
275 .idlest_reg_id = 1,
276 .idlest_idle_bit = OMAP24XX_ST_GPT3_SHIFT,
277 },
278 },
279 .dev_attr = &capability_alwon_dev_attr,
280 .class = &omap2xxx_timer_hwmod_class,
281};
282
283/* timer4 */
284
285struct omap_hwmod omap2xxx_timer4_hwmod = {
286 .name = "timer4",
287 .mpu_irqs = omap2_timer4_mpu_irqs,
288 .main_clk = "gpt4_fck",
289 .prcm = {
290 .omap2 = {
291 .prcm_reg_id = 1,
292 .module_bit = OMAP24XX_EN_GPT4_SHIFT,
293 .module_offs = CORE_MOD,
294 .idlest_reg_id = 1,
295 .idlest_idle_bit = OMAP24XX_ST_GPT4_SHIFT,
296 },
297 },
298 .dev_attr = &capability_alwon_dev_attr,
299 .class = &omap2xxx_timer_hwmod_class,
300};
301
302/* timer5 */
303
304struct omap_hwmod omap2xxx_timer5_hwmod = {
305 .name = "timer5",
306 .mpu_irqs = omap2_timer5_mpu_irqs,
307 .main_clk = "gpt5_fck",
308 .prcm = {
309 .omap2 = {
310 .prcm_reg_id = 1,
311 .module_bit = OMAP24XX_EN_GPT5_SHIFT,
312 .module_offs = CORE_MOD,
313 .idlest_reg_id = 1,
314 .idlest_idle_bit = OMAP24XX_ST_GPT5_SHIFT,
315 },
316 },
317 .dev_attr = &capability_alwon_dev_attr,
318 .class = &omap2xxx_timer_hwmod_class,
319};
320
321/* timer6 */
322
323struct omap_hwmod omap2xxx_timer6_hwmod = {
324 .name = "timer6",
325 .mpu_irqs = omap2_timer6_mpu_irqs,
326 .main_clk = "gpt6_fck",
327 .prcm = {
328 .omap2 = {
329 .prcm_reg_id = 1,
330 .module_bit = OMAP24XX_EN_GPT6_SHIFT,
331 .module_offs = CORE_MOD,
332 .idlest_reg_id = 1,
333 .idlest_idle_bit = OMAP24XX_ST_GPT6_SHIFT,
334 },
335 },
336 .dev_attr = &capability_alwon_dev_attr,
337 .class = &omap2xxx_timer_hwmod_class,
338};
339
340/* timer7 */
341
342struct omap_hwmod omap2xxx_timer7_hwmod = {
343 .name = "timer7",
344 .mpu_irqs = omap2_timer7_mpu_irqs,
345 .main_clk = "gpt7_fck",
346 .prcm = {
347 .omap2 = {
348 .prcm_reg_id = 1,
349 .module_bit = OMAP24XX_EN_GPT7_SHIFT,
350 .module_offs = CORE_MOD,
351 .idlest_reg_id = 1,
352 .idlest_idle_bit = OMAP24XX_ST_GPT7_SHIFT,
353 },
354 },
355 .dev_attr = &capability_alwon_dev_attr,
356 .class = &omap2xxx_timer_hwmod_class,
357};
358
359/* timer8 */
360
361struct omap_hwmod omap2xxx_timer8_hwmod = {
362 .name = "timer8",
363 .mpu_irqs = omap2_timer8_mpu_irqs,
364 .main_clk = "gpt8_fck",
365 .prcm = {
366 .omap2 = {
367 .prcm_reg_id = 1,
368 .module_bit = OMAP24XX_EN_GPT8_SHIFT,
369 .module_offs = CORE_MOD,
370 .idlest_reg_id = 1,
371 .idlest_idle_bit = OMAP24XX_ST_GPT8_SHIFT,
372 },
373 },
374 .dev_attr = &capability_alwon_dev_attr,
375 .class = &omap2xxx_timer_hwmod_class,
376};
377
378/* timer9 */
379
380struct omap_hwmod omap2xxx_timer9_hwmod = {
381 .name = "timer9",
382 .mpu_irqs = omap2_timer9_mpu_irqs,
383 .main_clk = "gpt9_fck",
384 .prcm = {
385 .omap2 = {
386 .prcm_reg_id = 1,
387 .module_bit = OMAP24XX_EN_GPT9_SHIFT,
388 .module_offs = CORE_MOD,
389 .idlest_reg_id = 1,
390 .idlest_idle_bit = OMAP24XX_ST_GPT9_SHIFT,
391 },
392 },
393 .dev_attr = &capability_pwm_dev_attr,
394 .class = &omap2xxx_timer_hwmod_class,
395};
396
397/* timer10 */
398
399struct omap_hwmod omap2xxx_timer10_hwmod = {
400 .name = "timer10",
401 .mpu_irqs = omap2_timer10_mpu_irqs,
402 .main_clk = "gpt10_fck",
403 .prcm = {
404 .omap2 = {
405 .prcm_reg_id = 1,
406 .module_bit = OMAP24XX_EN_GPT10_SHIFT,
407 .module_offs = CORE_MOD,
408 .idlest_reg_id = 1,
409 .idlest_idle_bit = OMAP24XX_ST_GPT10_SHIFT,
410 },
411 },
412 .dev_attr = &capability_pwm_dev_attr,
413 .class = &omap2xxx_timer_hwmod_class,
414};
415
416/* timer11 */
417
418struct omap_hwmod omap2xxx_timer11_hwmod = {
419 .name = "timer11",
420 .mpu_irqs = omap2_timer11_mpu_irqs,
421 .main_clk = "gpt11_fck",
422 .prcm = {
423 .omap2 = {
424 .prcm_reg_id = 1,
425 .module_bit = OMAP24XX_EN_GPT11_SHIFT,
426 .module_offs = CORE_MOD,
427 .idlest_reg_id = 1,
428 .idlest_idle_bit = OMAP24XX_ST_GPT11_SHIFT,
429 },
430 },
431 .dev_attr = &capability_pwm_dev_attr,
432 .class = &omap2xxx_timer_hwmod_class,
433};
434
435/* timer12 */
436
437struct omap_hwmod omap2xxx_timer12_hwmod = {
438 .name = "timer12",
439 .mpu_irqs = omap2xxx_timer12_mpu_irqs,
440 .main_clk = "gpt12_fck",
441 .prcm = {
442 .omap2 = {
443 .prcm_reg_id = 1,
444 .module_bit = OMAP24XX_EN_GPT12_SHIFT,
445 .module_offs = CORE_MOD,
446 .idlest_reg_id = 1,
447 .idlest_idle_bit = OMAP24XX_ST_GPT12_SHIFT,
448 },
449 },
450 .dev_attr = &capability_pwm_dev_attr,
451 .class = &omap2xxx_timer_hwmod_class,
452};
453
454/* wd_timer2 */
455struct omap_hwmod omap2xxx_wd_timer2_hwmod = {
456 .name = "wd_timer2",
457 .class = &omap2xxx_wd_timer_hwmod_class,
458 .main_clk = "mpu_wdt_fck",
459 .prcm = {
460 .omap2 = {
461 .prcm_reg_id = 1,
462 .module_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
463 .module_offs = WKUP_MOD,
464 .idlest_reg_id = 1,
465 .idlest_idle_bit = OMAP24XX_ST_MPU_WDT_SHIFT,
466 },
467 },
468};
469
470/* UART1 */
471
472struct omap_hwmod omap2xxx_uart1_hwmod = {
473 .name = "uart1",
474 .mpu_irqs = omap2_uart1_mpu_irqs,
475 .sdma_reqs = omap2_uart1_sdma_reqs,
476 .main_clk = "uart1_fck",
477 .prcm = {
478 .omap2 = {
479 .module_offs = CORE_MOD,
480 .prcm_reg_id = 1,
481 .module_bit = OMAP24XX_EN_UART1_SHIFT,
482 .idlest_reg_id = 1,
483 .idlest_idle_bit = OMAP24XX_EN_UART1_SHIFT,
484 },
485 },
486 .class = &omap2_uart_class,
487};
488
489/* UART2 */
490
491struct omap_hwmod omap2xxx_uart2_hwmod = {
492 .name = "uart2",
493 .mpu_irqs = omap2_uart2_mpu_irqs,
494 .sdma_reqs = omap2_uart2_sdma_reqs,
495 .main_clk = "uart2_fck",
496 .prcm = {
497 .omap2 = {
498 .module_offs = CORE_MOD,
499 .prcm_reg_id = 1,
500 .module_bit = OMAP24XX_EN_UART2_SHIFT,
501 .idlest_reg_id = 1,
502 .idlest_idle_bit = OMAP24XX_EN_UART2_SHIFT,
503 },
504 },
505 .class = &omap2_uart_class,
506};
507
508/* UART3 */
509
510struct omap_hwmod omap2xxx_uart3_hwmod = {
511 .name = "uart3",
512 .mpu_irqs = omap2_uart3_mpu_irqs,
513 .sdma_reqs = omap2_uart3_sdma_reqs,
514 .main_clk = "uart3_fck",
515 .prcm = {
516 .omap2 = {
517 .module_offs = CORE_MOD,
518 .prcm_reg_id = 2,
519 .module_bit = OMAP24XX_EN_UART3_SHIFT,
520 .idlest_reg_id = 2,
521 .idlest_idle_bit = OMAP24XX_EN_UART3_SHIFT,
522 },
523 },
524 .class = &omap2_uart_class,
525};
526
527/* dss */
528
529static struct omap_hwmod_opt_clk dss_opt_clks[] = {
530 /*
531 * The DSS HW needs all DSS clocks enabled during reset. The dss_core
532 * driver does not use these clocks.
533 */
534 { .role = "tv_clk", .clk = "dss_54m_fck" },
535 { .role = "sys_clk", .clk = "dss2_fck" },
536};
537
538struct omap_hwmod omap2xxx_dss_core_hwmod = {
539 .name = "dss_core",
540 .class = &omap2_dss_hwmod_class,
541 .main_clk = "dss1_fck", /* instead of dss_fck */
542 .sdma_reqs = omap2xxx_dss_sdma_chs,
543 .prcm = {
544 .omap2 = {
545 .prcm_reg_id = 1,
546 .module_bit = OMAP24XX_EN_DSS1_SHIFT,
547 .module_offs = CORE_MOD,
548 .idlest_reg_id = 1,
549 .idlest_stdby_bit = OMAP24XX_ST_DSS_SHIFT,
550 },
551 },
552 .opt_clks = dss_opt_clks,
553 .opt_clks_cnt = ARRAY_SIZE(dss_opt_clks),
554 .flags = HWMOD_NO_IDLEST | HWMOD_CONTROL_OPT_CLKS_IN_RESET,
555};
556
557struct omap_hwmod omap2xxx_dss_dispc_hwmod = {
558 .name = "dss_dispc",
559 .class = &omap2_dispc_hwmod_class,
560 .mpu_irqs = omap2_dispc_irqs,
561 .main_clk = "dss1_fck",
562 .prcm = {
563 .omap2 = {
564 .prcm_reg_id = 1,
565 .module_bit = OMAP24XX_EN_DSS1_SHIFT,
566 .module_offs = CORE_MOD,
567 .idlest_reg_id = 1,
568 .idlest_stdby_bit = OMAP24XX_ST_DSS_SHIFT,
569 },
570 },
571 .flags = HWMOD_NO_IDLEST,
572 .dev_attr = &omap2_3_dss_dispc_dev_attr
573};
574
575static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = {
576 { .role = "ick", .clk = "dss_ick" },
577};
578
579struct omap_hwmod omap2xxx_dss_rfbi_hwmod = {
580 .name = "dss_rfbi",
581 .class = &omap2_rfbi_hwmod_class,
582 .main_clk = "dss1_fck",
583 .prcm = {
584 .omap2 = {
585 .prcm_reg_id = 1,
586 .module_bit = OMAP24XX_EN_DSS1_SHIFT,
587 .module_offs = CORE_MOD,
588 },
589 },
590 .opt_clks = dss_rfbi_opt_clks,
591 .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks),
592 .flags = HWMOD_NO_IDLEST,
593};
594
595struct omap_hwmod omap2xxx_dss_venc_hwmod = {
596 .name = "dss_venc",
597 .class = &omap2_venc_hwmod_class,
598 .main_clk = "dss_54m_fck",
599 .prcm = {
600 .omap2 = {
601 .prcm_reg_id = 1,
602 .module_bit = OMAP24XX_EN_DSS1_SHIFT,
603 .module_offs = CORE_MOD,
604 },
605 },
606 .flags = HWMOD_NO_IDLEST,
607};
608
609/* gpio dev_attr */
610struct omap_gpio_dev_attr omap2xxx_gpio_dev_attr = {
611 .bank_width = 32,
612 .dbck_flag = false,
613};
614
615/* gpio1 */
616struct omap_hwmod omap2xxx_gpio1_hwmod = {
617 .name = "gpio1",
618 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
619 .mpu_irqs = omap2_gpio1_irqs,
620 .main_clk = "gpios_fck",
621 .prcm = {
622 .omap2 = {
623 .prcm_reg_id = 1,
624 .module_bit = OMAP24XX_EN_GPIOS_SHIFT,
625 .module_offs = WKUP_MOD,
626 .idlest_reg_id = 1,
627 .idlest_idle_bit = OMAP24XX_ST_GPIOS_SHIFT,
628 },
629 },
630 .class = &omap2xxx_gpio_hwmod_class,
631 .dev_attr = &omap2xxx_gpio_dev_attr,
632};
633
634/* gpio2 */
635struct omap_hwmod omap2xxx_gpio2_hwmod = {
636 .name = "gpio2",
637 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
638 .mpu_irqs = omap2_gpio2_irqs,
639 .main_clk = "gpios_fck",
640 .prcm = {
641 .omap2 = {
642 .prcm_reg_id = 1,
643 .module_bit = OMAP24XX_EN_GPIOS_SHIFT,
644 .module_offs = WKUP_MOD,
645 .idlest_reg_id = 1,
646 .idlest_idle_bit = OMAP24XX_ST_GPIOS_SHIFT,
647 },
648 },
649 .class = &omap2xxx_gpio_hwmod_class,
650 .dev_attr = &omap2xxx_gpio_dev_attr,
651};
652
653/* gpio3 */
654struct omap_hwmod omap2xxx_gpio3_hwmod = {
655 .name = "gpio3",
656 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
657 .mpu_irqs = omap2_gpio3_irqs,
658 .main_clk = "gpios_fck",
659 .prcm = {
660 .omap2 = {
661 .prcm_reg_id = 1,
662 .module_bit = OMAP24XX_EN_GPIOS_SHIFT,
663 .module_offs = WKUP_MOD,
664 .idlest_reg_id = 1,
665 .idlest_idle_bit = OMAP24XX_ST_GPIOS_SHIFT,
666 },
667 },
668 .class = &omap2xxx_gpio_hwmod_class,
669 .dev_attr = &omap2xxx_gpio_dev_attr,
670};
671
672/* gpio4 */
673struct omap_hwmod omap2xxx_gpio4_hwmod = {
674 .name = "gpio4",
675 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
676 .mpu_irqs = omap2_gpio4_irqs,
677 .main_clk = "gpios_fck",
678 .prcm = {
679 .omap2 = {
680 .prcm_reg_id = 1,
681 .module_bit = OMAP24XX_EN_GPIOS_SHIFT,
682 .module_offs = WKUP_MOD,
683 .idlest_reg_id = 1,
684 .idlest_idle_bit = OMAP24XX_ST_GPIOS_SHIFT,
685 },
686 },
687 .class = &omap2xxx_gpio_hwmod_class,
688 .dev_attr = &omap2xxx_gpio_dev_attr,
689};
690
691/* mcspi1 */
692static struct omap2_mcspi_dev_attr omap_mcspi1_dev_attr = {
693 .num_chipselect = 4,
694};
695
696struct omap_hwmod omap2xxx_mcspi1_hwmod = {
697 .name = "mcspi1",
698 .mpu_irqs = omap2_mcspi1_mpu_irqs,
699 .sdma_reqs = omap2_mcspi1_sdma_reqs,
700 .main_clk = "mcspi1_fck",
701 .prcm = {
702 .omap2 = {
703 .module_offs = CORE_MOD,
704 .prcm_reg_id = 1,
705 .module_bit = OMAP24XX_EN_MCSPI1_SHIFT,
706 .idlest_reg_id = 1,
707 .idlest_idle_bit = OMAP24XX_ST_MCSPI1_SHIFT,
708 },
709 },
710 .class = &omap2xxx_mcspi_class,
711 .dev_attr = &omap_mcspi1_dev_attr,
712};
713
714/* mcspi2 */
715static struct omap2_mcspi_dev_attr omap_mcspi2_dev_attr = {
716 .num_chipselect = 2,
717};
718
719struct omap_hwmod omap2xxx_mcspi2_hwmod = {
720 .name = "mcspi2",
721 .mpu_irqs = omap2_mcspi2_mpu_irqs,
722 .sdma_reqs = omap2_mcspi2_sdma_reqs,
723 .main_clk = "mcspi2_fck",
724 .prcm = {
725 .omap2 = {
726 .module_offs = CORE_MOD,
727 .prcm_reg_id = 1,
728 .module_bit = OMAP24XX_EN_MCSPI2_SHIFT,
729 .idlest_reg_id = 1,
730 .idlest_idle_bit = OMAP24XX_ST_MCSPI2_SHIFT,
731 },
732 },
733 .class = &omap2xxx_mcspi_class,
734 .dev_attr = &omap_mcspi2_dev_attr,
735};
736
737
738static struct omap_hwmod_class omap2xxx_counter_hwmod_class = {
739 .name = "counter",
740};
741
742struct omap_hwmod omap2xxx_counter_32k_hwmod = {
743 .name = "counter_32k",
744 .main_clk = "func_32k_ck",
745 .prcm = {
746 .omap2 = {
747 .module_offs = WKUP_MOD,
748 .prcm_reg_id = 1,
749 .module_bit = OMAP24XX_ST_32KSYNC_SHIFT,
750 .idlest_reg_id = 1,
751 .idlest_idle_bit = OMAP24XX_ST_32KSYNC_SHIFT,
752 },
753 },
754 .class = &omap2xxx_counter_hwmod_class,
755};
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 34b9766d1d23..fd48797fa95a 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -2,6 +2,7 @@
2 * omap_hwmod_3xxx_data.c - hardware modules present on the OMAP3xxx chips 2 * omap_hwmod_3xxx_data.c - hardware modules present on the OMAP3xxx chips
3 * 3 *
4 * Copyright (C) 2009-2011 Nokia Corporation 4 * Copyright (C) 2009-2011 Nokia Corporation
5 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley 6 * Paul Walmsley
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
@@ -38,491 +39,56 @@
38/* 39/*
39 * OMAP3xxx hardware module integration data 40 * OMAP3xxx hardware module integration data
40 * 41 *
41 * ALl of the data in this section should be autogeneratable from the 42 * All of the data in this section should be autogeneratable from the
42 * TI hardware database or other technical documentation. Data that 43 * TI hardware database or other technical documentation. Data that
43 * is driver-specific or driver-kernel integration-specific belongs 44 * is driver-specific or driver-kernel integration-specific belongs
44 * elsewhere. 45 * elsewhere.
45 */ 46 */
46 47
47static struct omap_hwmod omap3xxx_mpu_hwmod; 48/*
48static struct omap_hwmod omap3xxx_iva_hwmod; 49 * IP blocks
49static struct omap_hwmod omap3xxx_l3_main_hwmod; 50 */
50static struct omap_hwmod omap3xxx_l4_core_hwmod;
51static struct omap_hwmod omap3xxx_l4_per_hwmod;
52static struct omap_hwmod omap3xxx_wd_timer2_hwmod;
53static struct omap_hwmod omap3430es1_dss_core_hwmod;
54static struct omap_hwmod omap3xxx_dss_core_hwmod;
55static struct omap_hwmod omap3xxx_dss_dispc_hwmod;
56static struct omap_hwmod omap3xxx_dss_dsi1_hwmod;
57static struct omap_hwmod omap3xxx_dss_rfbi_hwmod;
58static struct omap_hwmod omap3xxx_dss_venc_hwmod;
59static struct omap_hwmod omap3xxx_i2c1_hwmod;
60static struct omap_hwmod omap3xxx_i2c2_hwmod;
61static struct omap_hwmod omap3xxx_i2c3_hwmod;
62static struct omap_hwmod omap3xxx_gpio1_hwmod;
63static struct omap_hwmod omap3xxx_gpio2_hwmod;
64static struct omap_hwmod omap3xxx_gpio3_hwmod;
65static struct omap_hwmod omap3xxx_gpio4_hwmod;
66static struct omap_hwmod omap3xxx_gpio5_hwmod;
67static struct omap_hwmod omap3xxx_gpio6_hwmod;
68static struct omap_hwmod omap34xx_sr1_hwmod;
69static struct omap_hwmod omap34xx_sr2_hwmod;
70static struct omap_hwmod omap34xx_mcspi1;
71static struct omap_hwmod omap34xx_mcspi2;
72static struct omap_hwmod omap34xx_mcspi3;
73static struct omap_hwmod omap34xx_mcspi4;
74static struct omap_hwmod omap3xxx_mmc1_hwmod;
75static struct omap_hwmod omap3xxx_mmc2_hwmod;
76static struct omap_hwmod omap3xxx_mmc3_hwmod;
77static struct omap_hwmod am35xx_usbhsotg_hwmod;
78
79static struct omap_hwmod omap3xxx_dma_system_hwmod;
80
81static struct omap_hwmod omap3xxx_mcbsp1_hwmod;
82static struct omap_hwmod omap3xxx_mcbsp2_hwmod;
83static struct omap_hwmod omap3xxx_mcbsp3_hwmod;
84static struct omap_hwmod omap3xxx_mcbsp4_hwmod;
85static struct omap_hwmod omap3xxx_mcbsp5_hwmod;
86static struct omap_hwmod omap3xxx_mcbsp2_sidetone_hwmod;
87static struct omap_hwmod omap3xxx_mcbsp3_sidetone_hwmod;
88static struct omap_hwmod omap3xxx_usb_host_hs_hwmod;
89static struct omap_hwmod omap3xxx_usb_tll_hs_hwmod;
90
91/* L3 -> L4_CORE interface */
92static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = {
93 .master = &omap3xxx_l3_main_hwmod,
94 .slave = &omap3xxx_l4_core_hwmod,
95 .user = OCP_USER_MPU | OCP_USER_SDMA,
96};
97
98/* L3 -> L4_PER interface */
99static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_per = {
100 .master = &omap3xxx_l3_main_hwmod,
101 .slave = &omap3xxx_l4_per_hwmod,
102 .user = OCP_USER_MPU | OCP_USER_SDMA,
103};
104 51
105/* L3 taret configuration and error log registers */ 52/* L3 */
106static struct omap_hwmod_irq_info omap3xxx_l3_main_irqs[] = { 53static struct omap_hwmod_irq_info omap3xxx_l3_main_irqs[] = {
107 { .irq = INT_34XX_L3_DBG_IRQ }, 54 { .irq = INT_34XX_L3_DBG_IRQ },
108 { .irq = INT_34XX_L3_APP_IRQ }, 55 { .irq = INT_34XX_L3_APP_IRQ },
109 { .irq = -1 } 56 { .irq = -1 }
110}; 57};
111 58
112static struct omap_hwmod_addr_space omap3xxx_l3_main_addrs[] = {
113 {
114 .pa_start = 0x68000000,
115 .pa_end = 0x6800ffff,
116 .flags = ADDR_TYPE_RT,
117 },
118 { }
119};
120
121/* MPU -> L3 interface */
122static struct omap_hwmod_ocp_if omap3xxx_mpu__l3_main = {
123 .master = &omap3xxx_mpu_hwmod,
124 .slave = &omap3xxx_l3_main_hwmod,
125 .addr = omap3xxx_l3_main_addrs,
126 .user = OCP_USER_MPU,
127};
128
129/* Slave interfaces on the L3 interconnect */
130static struct omap_hwmod_ocp_if *omap3xxx_l3_main_slaves[] = {
131 &omap3xxx_mpu__l3_main,
132};
133
134/* DSS -> l3 */
135static struct omap_hwmod_ocp_if omap3xxx_dss__l3 = {
136 .master = &omap3xxx_dss_core_hwmod,
137 .slave = &omap3xxx_l3_main_hwmod,
138 .fw = {
139 .omap2 = {
140 .l3_perm_bit = OMAP3_L3_CORE_FW_INIT_ID_DSS,
141 .flags = OMAP_FIREWALL_L3,
142 }
143 },
144 .user = OCP_USER_MPU | OCP_USER_SDMA,
145};
146
147/* Master interfaces on the L3 interconnect */
148static struct omap_hwmod_ocp_if *omap3xxx_l3_main_masters[] = {
149 &omap3xxx_l3_main__l4_core,
150 &omap3xxx_l3_main__l4_per,
151};
152
153/* L3 */
154static struct omap_hwmod omap3xxx_l3_main_hwmod = { 59static struct omap_hwmod omap3xxx_l3_main_hwmod = {
155 .name = "l3_main", 60 .name = "l3_main",
156 .class = &l3_hwmod_class, 61 .class = &l3_hwmod_class,
157 .mpu_irqs = omap3xxx_l3_main_irqs, 62 .mpu_irqs = omap3xxx_l3_main_irqs,
158 .masters = omap3xxx_l3_main_masters,
159 .masters_cnt = ARRAY_SIZE(omap3xxx_l3_main_masters),
160 .slaves = omap3xxx_l3_main_slaves,
161 .slaves_cnt = ARRAY_SIZE(omap3xxx_l3_main_slaves),
162 .flags = HWMOD_NO_IDLEST, 63 .flags = HWMOD_NO_IDLEST,
163}; 64};
164 65
165static struct omap_hwmod omap3xxx_l4_wkup_hwmod;
166static struct omap_hwmod omap3xxx_uart1_hwmod;
167static struct omap_hwmod omap3xxx_uart2_hwmod;
168static struct omap_hwmod omap3xxx_uart3_hwmod;
169static struct omap_hwmod omap3xxx_uart4_hwmod;
170static struct omap_hwmod am35xx_uart4_hwmod;
171static struct omap_hwmod omap3xxx_usbhsotg_hwmod;
172
173/* l3_core -> usbhsotg interface */
174static struct omap_hwmod_ocp_if omap3xxx_usbhsotg__l3 = {
175 .master = &omap3xxx_usbhsotg_hwmod,
176 .slave = &omap3xxx_l3_main_hwmod,
177 .clk = "core_l3_ick",
178 .user = OCP_USER_MPU,
179};
180
181/* l3_core -> am35xx_usbhsotg interface */
182static struct omap_hwmod_ocp_if am35xx_usbhsotg__l3 = {
183 .master = &am35xx_usbhsotg_hwmod,
184 .slave = &omap3xxx_l3_main_hwmod,
185 .clk = "core_l3_ick",
186 .user = OCP_USER_MPU,
187};
188/* L4_CORE -> L4_WKUP interface */
189static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = {
190 .master = &omap3xxx_l4_core_hwmod,
191 .slave = &omap3xxx_l4_wkup_hwmod,
192 .user = OCP_USER_MPU | OCP_USER_SDMA,
193};
194
195/* L4 CORE -> MMC1 interface */
196static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc1 = {
197 .master = &omap3xxx_l4_core_hwmod,
198 .slave = &omap3xxx_mmc1_hwmod,
199 .clk = "mmchs1_ick",
200 .addr = omap2430_mmc1_addr_space,
201 .user = OCP_USER_MPU | OCP_USER_SDMA,
202 .flags = OMAP_FIREWALL_L4
203};
204
205/* L4 CORE -> MMC2 interface */
206static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc2 = {
207 .master = &omap3xxx_l4_core_hwmod,
208 .slave = &omap3xxx_mmc2_hwmod,
209 .clk = "mmchs2_ick",
210 .addr = omap2430_mmc2_addr_space,
211 .user = OCP_USER_MPU | OCP_USER_SDMA,
212 .flags = OMAP_FIREWALL_L4
213};
214
215/* L4 CORE -> MMC3 interface */
216static struct omap_hwmod_addr_space omap3xxx_mmc3_addr_space[] = {
217 {
218 .pa_start = 0x480ad000,
219 .pa_end = 0x480ad1ff,
220 .flags = ADDR_TYPE_RT,
221 },
222 { }
223};
224
225static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = {
226 .master = &omap3xxx_l4_core_hwmod,
227 .slave = &omap3xxx_mmc3_hwmod,
228 .clk = "mmchs3_ick",
229 .addr = omap3xxx_mmc3_addr_space,
230 .user = OCP_USER_MPU | OCP_USER_SDMA,
231 .flags = OMAP_FIREWALL_L4
232};
233
234/* L4 CORE -> UART1 interface */
235static struct omap_hwmod_addr_space omap3xxx_uart1_addr_space[] = {
236 {
237 .pa_start = OMAP3_UART1_BASE,
238 .pa_end = OMAP3_UART1_BASE + SZ_8K - 1,
239 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
240 },
241 { }
242};
243
244static struct omap_hwmod_ocp_if omap3_l4_core__uart1 = {
245 .master = &omap3xxx_l4_core_hwmod,
246 .slave = &omap3xxx_uart1_hwmod,
247 .clk = "uart1_ick",
248 .addr = omap3xxx_uart1_addr_space,
249 .user = OCP_USER_MPU | OCP_USER_SDMA,
250};
251
252/* L4 CORE -> UART2 interface */
253static struct omap_hwmod_addr_space omap3xxx_uart2_addr_space[] = {
254 {
255 .pa_start = OMAP3_UART2_BASE,
256 .pa_end = OMAP3_UART2_BASE + SZ_1K - 1,
257 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
258 },
259 { }
260};
261
262static struct omap_hwmod_ocp_if omap3_l4_core__uart2 = {
263 .master = &omap3xxx_l4_core_hwmod,
264 .slave = &omap3xxx_uart2_hwmod,
265 .clk = "uart2_ick",
266 .addr = omap3xxx_uart2_addr_space,
267 .user = OCP_USER_MPU | OCP_USER_SDMA,
268};
269
270/* L4 PER -> UART3 interface */
271static struct omap_hwmod_addr_space omap3xxx_uart3_addr_space[] = {
272 {
273 .pa_start = OMAP3_UART3_BASE,
274 .pa_end = OMAP3_UART3_BASE + SZ_1K - 1,
275 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
276 },
277 { }
278};
279
280static struct omap_hwmod_ocp_if omap3_l4_per__uart3 = {
281 .master = &omap3xxx_l4_per_hwmod,
282 .slave = &omap3xxx_uart3_hwmod,
283 .clk = "uart3_ick",
284 .addr = omap3xxx_uart3_addr_space,
285 .user = OCP_USER_MPU | OCP_USER_SDMA,
286};
287
288/* L4 PER -> UART4 interface */
289static struct omap_hwmod_addr_space omap3xxx_uart4_addr_space[] = {
290 {
291 .pa_start = OMAP3_UART4_BASE,
292 .pa_end = OMAP3_UART4_BASE + SZ_1K - 1,
293 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
294 },
295 { }
296};
297
298static struct omap_hwmod_ocp_if omap3_l4_per__uart4 = {
299 .master = &omap3xxx_l4_per_hwmod,
300 .slave = &omap3xxx_uart4_hwmod,
301 .clk = "uart4_ick",
302 .addr = omap3xxx_uart4_addr_space,
303 .user = OCP_USER_MPU | OCP_USER_SDMA,
304};
305
306/* AM35xx: L4 CORE -> UART4 interface */
307static struct omap_hwmod_addr_space am35xx_uart4_addr_space[] = {
308 {
309 .pa_start = OMAP3_UART4_AM35XX_BASE,
310 .pa_end = OMAP3_UART4_AM35XX_BASE + SZ_1K - 1,
311 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
312 },
313};
314
315static struct omap_hwmod_ocp_if am35xx_l4_core__uart4 = {
316 .master = &omap3xxx_l4_core_hwmod,
317 .slave = &am35xx_uart4_hwmod,
318 .clk = "uart4_ick",
319 .addr = am35xx_uart4_addr_space,
320 .user = OCP_USER_MPU | OCP_USER_SDMA,
321};
322
323/* L4 CORE -> I2C1 interface */
324static struct omap_hwmod_ocp_if omap3_l4_core__i2c1 = {
325 .master = &omap3xxx_l4_core_hwmod,
326 .slave = &omap3xxx_i2c1_hwmod,
327 .clk = "i2c1_ick",
328 .addr = omap2_i2c1_addr_space,
329 .fw = {
330 .omap2 = {
331 .l4_fw_region = OMAP3_L4_CORE_FW_I2C1_REGION,
332 .l4_prot_group = 7,
333 .flags = OMAP_FIREWALL_L4,
334 }
335 },
336 .user = OCP_USER_MPU | OCP_USER_SDMA,
337};
338
339/* L4 CORE -> I2C2 interface */
340static struct omap_hwmod_ocp_if omap3_l4_core__i2c2 = {
341 .master = &omap3xxx_l4_core_hwmod,
342 .slave = &omap3xxx_i2c2_hwmod,
343 .clk = "i2c2_ick",
344 .addr = omap2_i2c2_addr_space,
345 .fw = {
346 .omap2 = {
347 .l4_fw_region = OMAP3_L4_CORE_FW_I2C2_REGION,
348 .l4_prot_group = 7,
349 .flags = OMAP_FIREWALL_L4,
350 }
351 },
352 .user = OCP_USER_MPU | OCP_USER_SDMA,
353};
354
355/* L4 CORE -> I2C3 interface */
356static struct omap_hwmod_addr_space omap3xxx_i2c3_addr_space[] = {
357 {
358 .pa_start = 0x48060000,
359 .pa_end = 0x48060000 + SZ_128 - 1,
360 .flags = ADDR_TYPE_RT,
361 },
362 { }
363};
364
365static struct omap_hwmod_ocp_if omap3_l4_core__i2c3 = {
366 .master = &omap3xxx_l4_core_hwmod,
367 .slave = &omap3xxx_i2c3_hwmod,
368 .clk = "i2c3_ick",
369 .addr = omap3xxx_i2c3_addr_space,
370 .fw = {
371 .omap2 = {
372 .l4_fw_region = OMAP3_L4_CORE_FW_I2C3_REGION,
373 .l4_prot_group = 7,
374 .flags = OMAP_FIREWALL_L4,
375 }
376 },
377 .user = OCP_USER_MPU | OCP_USER_SDMA,
378};
379
380static struct omap_hwmod_irq_info omap3_smartreflex_mpu_irqs[] = {
381 { .irq = 18},
382 { .irq = -1 }
383};
384
385static struct omap_hwmod_irq_info omap3_smartreflex_core_irqs[] = {
386 { .irq = 19},
387 { .irq = -1 }
388};
389
390/* L4 CORE -> SR1 interface */
391static struct omap_hwmod_addr_space omap3_sr1_addr_space[] = {
392 {
393 .pa_start = OMAP34XX_SR1_BASE,
394 .pa_end = OMAP34XX_SR1_BASE + SZ_1K - 1,
395 .flags = ADDR_TYPE_RT,
396 },
397 { }
398};
399
400static struct omap_hwmod_ocp_if omap3_l4_core__sr1 = {
401 .master = &omap3xxx_l4_core_hwmod,
402 .slave = &omap34xx_sr1_hwmod,
403 .clk = "sr_l4_ick",
404 .addr = omap3_sr1_addr_space,
405 .user = OCP_USER_MPU,
406};
407
408/* L4 CORE -> SR1 interface */
409static struct omap_hwmod_addr_space omap3_sr2_addr_space[] = {
410 {
411 .pa_start = OMAP34XX_SR2_BASE,
412 .pa_end = OMAP34XX_SR2_BASE + SZ_1K - 1,
413 .flags = ADDR_TYPE_RT,
414 },
415 { }
416};
417
418static struct omap_hwmod_ocp_if omap3_l4_core__sr2 = {
419 .master = &omap3xxx_l4_core_hwmod,
420 .slave = &omap34xx_sr2_hwmod,
421 .clk = "sr_l4_ick",
422 .addr = omap3_sr2_addr_space,
423 .user = OCP_USER_MPU,
424};
425
426/*
427* usbhsotg interface data
428*/
429
430static struct omap_hwmod_addr_space omap3xxx_usbhsotg_addrs[] = {
431 {
432 .pa_start = OMAP34XX_HSUSB_OTG_BASE,
433 .pa_end = OMAP34XX_HSUSB_OTG_BASE + SZ_4K - 1,
434 .flags = ADDR_TYPE_RT
435 },
436 { }
437};
438
439/* l4_core -> usbhsotg */
440static struct omap_hwmod_ocp_if omap3xxx_l4_core__usbhsotg = {
441 .master = &omap3xxx_l4_core_hwmod,
442 .slave = &omap3xxx_usbhsotg_hwmod,
443 .clk = "l4_ick",
444 .addr = omap3xxx_usbhsotg_addrs,
445 .user = OCP_USER_MPU,
446};
447
448static struct omap_hwmod_ocp_if *omap3xxx_usbhsotg_masters[] = {
449 &omap3xxx_usbhsotg__l3,
450};
451
452static struct omap_hwmod_ocp_if *omap3xxx_usbhsotg_slaves[] = {
453 &omap3xxx_l4_core__usbhsotg,
454};
455
456static struct omap_hwmod_addr_space am35xx_usbhsotg_addrs[] = {
457 {
458 .pa_start = AM35XX_IPSS_USBOTGSS_BASE,
459 .pa_end = AM35XX_IPSS_USBOTGSS_BASE + SZ_4K - 1,
460 .flags = ADDR_TYPE_RT
461 },
462 { }
463};
464
465/* l4_core -> usbhsotg */
466static struct omap_hwmod_ocp_if am35xx_l4_core__usbhsotg = {
467 .master = &omap3xxx_l4_core_hwmod,
468 .slave = &am35xx_usbhsotg_hwmod,
469 .clk = "l4_ick",
470 .addr = am35xx_usbhsotg_addrs,
471 .user = OCP_USER_MPU,
472};
473
474static struct omap_hwmod_ocp_if *am35xx_usbhsotg_masters[] = {
475 &am35xx_usbhsotg__l3,
476};
477
478static struct omap_hwmod_ocp_if *am35xx_usbhsotg_slaves[] = {
479 &am35xx_l4_core__usbhsotg,
480};
481/* Slave interfaces on the L4_CORE interconnect */
482static struct omap_hwmod_ocp_if *omap3xxx_l4_core_slaves[] = {
483 &omap3xxx_l3_main__l4_core,
484};
485
486/* L4 CORE */ 66/* L4 CORE */
487static struct omap_hwmod omap3xxx_l4_core_hwmod = { 67static struct omap_hwmod omap3xxx_l4_core_hwmod = {
488 .name = "l4_core", 68 .name = "l4_core",
489 .class = &l4_hwmod_class, 69 .class = &l4_hwmod_class,
490 .slaves = omap3xxx_l4_core_slaves,
491 .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_core_slaves),
492 .flags = HWMOD_NO_IDLEST, 70 .flags = HWMOD_NO_IDLEST,
493}; 71};
494 72
495/* Slave interfaces on the L4_PER interconnect */
496static struct omap_hwmod_ocp_if *omap3xxx_l4_per_slaves[] = {
497 &omap3xxx_l3_main__l4_per,
498};
499
500/* L4 PER */ 73/* L4 PER */
501static struct omap_hwmod omap3xxx_l4_per_hwmod = { 74static struct omap_hwmod omap3xxx_l4_per_hwmod = {
502 .name = "l4_per", 75 .name = "l4_per",
503 .class = &l4_hwmod_class, 76 .class = &l4_hwmod_class,
504 .slaves = omap3xxx_l4_per_slaves,
505 .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_per_slaves),
506 .flags = HWMOD_NO_IDLEST, 77 .flags = HWMOD_NO_IDLEST,
507}; 78};
508 79
509/* Slave interfaces on the L4_WKUP interconnect */
510static struct omap_hwmod_ocp_if *omap3xxx_l4_wkup_slaves[] = {
511 &omap3xxx_l4_core__l4_wkup,
512};
513
514/* L4 WKUP */ 80/* L4 WKUP */
515static struct omap_hwmod omap3xxx_l4_wkup_hwmod = { 81static struct omap_hwmod omap3xxx_l4_wkup_hwmod = {
516 .name = "l4_wkup", 82 .name = "l4_wkup",
517 .class = &l4_hwmod_class, 83 .class = &l4_hwmod_class,
518 .slaves = omap3xxx_l4_wkup_slaves,
519 .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_wkup_slaves),
520 .flags = HWMOD_NO_IDLEST, 84 .flags = HWMOD_NO_IDLEST,
521}; 85};
522 86
523/* Master interfaces on the MPU device */ 87/* L4 SEC */
524static struct omap_hwmod_ocp_if *omap3xxx_mpu_masters[] = { 88static struct omap_hwmod omap3xxx_l4_sec_hwmod = {
525 &omap3xxx_mpu__l3_main, 89 .name = "l4_sec",
90 .class = &l4_hwmod_class,
91 .flags = HWMOD_NO_IDLEST,
526}; 92};
527 93
528/* MPU */ 94/* MPU */
@@ -530,35 +96,22 @@ static struct omap_hwmod omap3xxx_mpu_hwmod = {
530 .name = "mpu", 96 .name = "mpu",
531 .class = &mpu_hwmod_class, 97 .class = &mpu_hwmod_class,
532 .main_clk = "arm_fck", 98 .main_clk = "arm_fck",
533 .masters = omap3xxx_mpu_masters,
534 .masters_cnt = ARRAY_SIZE(omap3xxx_mpu_masters),
535}; 99};
536 100
537/* 101/* IVA2 (IVA2) */
538 * IVA2_2 interface data 102static struct omap_hwmod_rst_info omap3xxx_iva_resets[] = {
539 */ 103 { .name = "logic", .rst_shift = 0 },
540 104 { .name = "seq0", .rst_shift = 1 },
541/* IVA2 <- L3 interface */ 105 { .name = "seq1", .rst_shift = 2 },
542static struct omap_hwmod_ocp_if omap3xxx_l3__iva = {
543 .master = &omap3xxx_l3_main_hwmod,
544 .slave = &omap3xxx_iva_hwmod,
545 .clk = "iva2_ck",
546 .user = OCP_USER_MPU | OCP_USER_SDMA,
547}; 106};
548 107
549static struct omap_hwmod_ocp_if *omap3xxx_iva_masters[] = {
550 &omap3xxx_l3__iva,
551};
552
553/*
554 * IVA2 (IVA2)
555 */
556
557static struct omap_hwmod omap3xxx_iva_hwmod = { 108static struct omap_hwmod omap3xxx_iva_hwmod = {
558 .name = "iva", 109 .name = "iva",
559 .class = &iva_hwmod_class, 110 .class = &iva_hwmod_class,
560 .masters = omap3xxx_iva_masters, 111 .clkdm_name = "iva2_clkdm",
561 .masters_cnt = ARRAY_SIZE(omap3xxx_iva_masters), 112 .rst_lines = omap3xxx_iva_resets,
113 .rst_lines_cnt = ARRAY_SIZE(omap3xxx_iva_resets),
114 .main_clk = "iva2_ck",
562}; 115};
563 116
564/* timer class */ 117/* timer class */
@@ -597,46 +150,20 @@ static struct omap_hwmod_class omap3xxx_timer_hwmod_class = {
597 150
598/* secure timers dev attribute */ 151/* secure timers dev attribute */
599static struct omap_timer_capability_dev_attr capability_secure_dev_attr = { 152static struct omap_timer_capability_dev_attr capability_secure_dev_attr = {
600 .timer_capability = OMAP_TIMER_SECURE, 153 .timer_capability = OMAP_TIMER_SECURE,
601}; 154};
602 155
603/* always-on timers dev attribute */ 156/* always-on timers dev attribute */
604static struct omap_timer_capability_dev_attr capability_alwon_dev_attr = { 157static struct omap_timer_capability_dev_attr capability_alwon_dev_attr = {
605 .timer_capability = OMAP_TIMER_ALWON, 158 .timer_capability = OMAP_TIMER_ALWON,
606}; 159};
607 160
608/* pwm timers dev attribute */ 161/* pwm timers dev attribute */
609static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = { 162static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
610 .timer_capability = OMAP_TIMER_HAS_PWM, 163 .timer_capability = OMAP_TIMER_HAS_PWM,
611}; 164};
612 165
613/* timer1 */ 166/* timer1 */
614static struct omap_hwmod omap3xxx_timer1_hwmod;
615
616static struct omap_hwmod_addr_space omap3xxx_timer1_addrs[] = {
617 {
618 .pa_start = 0x48318000,
619 .pa_end = 0x48318000 + SZ_1K - 1,
620 .flags = ADDR_TYPE_RT
621 },
622 { }
623};
624
625/* l4_wkup -> timer1 */
626static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__timer1 = {
627 .master = &omap3xxx_l4_wkup_hwmod,
628 .slave = &omap3xxx_timer1_hwmod,
629 .clk = "gpt1_ick",
630 .addr = omap3xxx_timer1_addrs,
631 .user = OCP_USER_MPU | OCP_USER_SDMA,
632};
633
634/* timer1 slave port */
635static struct omap_hwmod_ocp_if *omap3xxx_timer1_slaves[] = {
636 &omap3xxx_l4_wkup__timer1,
637};
638
639/* timer1 hwmod */
640static struct omap_hwmod omap3xxx_timer1_hwmod = { 167static struct omap_hwmod omap3xxx_timer1_hwmod = {
641 .name = "timer1", 168 .name = "timer1",
642 .mpu_irqs = omap2_timer1_mpu_irqs, 169 .mpu_irqs = omap2_timer1_mpu_irqs,
@@ -651,38 +178,10 @@ static struct omap_hwmod omap3xxx_timer1_hwmod = {
651 }, 178 },
652 }, 179 },
653 .dev_attr = &capability_alwon_dev_attr, 180 .dev_attr = &capability_alwon_dev_attr,
654 .slaves = omap3xxx_timer1_slaves,
655 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer1_slaves),
656 .class = &omap3xxx_timer_1ms_hwmod_class, 181 .class = &omap3xxx_timer_1ms_hwmod_class,
657}; 182};
658 183
659/* timer2 */ 184/* timer2 */
660static struct omap_hwmod omap3xxx_timer2_hwmod;
661
662static struct omap_hwmod_addr_space omap3xxx_timer2_addrs[] = {
663 {
664 .pa_start = 0x49032000,
665 .pa_end = 0x49032000 + SZ_1K - 1,
666 .flags = ADDR_TYPE_RT
667 },
668 { }
669};
670
671/* l4_per -> timer2 */
672static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer2 = {
673 .master = &omap3xxx_l4_per_hwmod,
674 .slave = &omap3xxx_timer2_hwmod,
675 .clk = "gpt2_ick",
676 .addr = omap3xxx_timer2_addrs,
677 .user = OCP_USER_MPU | OCP_USER_SDMA,
678};
679
680/* timer2 slave port */
681static struct omap_hwmod_ocp_if *omap3xxx_timer2_slaves[] = {
682 &omap3xxx_l4_per__timer2,
683};
684
685/* timer2 hwmod */
686static struct omap_hwmod omap3xxx_timer2_hwmod = { 185static struct omap_hwmod omap3xxx_timer2_hwmod = {
687 .name = "timer2", 186 .name = "timer2",
688 .mpu_irqs = omap2_timer2_mpu_irqs, 187 .mpu_irqs = omap2_timer2_mpu_irqs,
@@ -697,38 +196,10 @@ static struct omap_hwmod omap3xxx_timer2_hwmod = {
697 }, 196 },
698 }, 197 },
699 .dev_attr = &capability_alwon_dev_attr, 198 .dev_attr = &capability_alwon_dev_attr,
700 .slaves = omap3xxx_timer2_slaves,
701 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer2_slaves),
702 .class = &omap3xxx_timer_1ms_hwmod_class, 199 .class = &omap3xxx_timer_1ms_hwmod_class,
703}; 200};
704 201
705/* timer3 */ 202/* timer3 */
706static struct omap_hwmod omap3xxx_timer3_hwmod;
707
708static struct omap_hwmod_addr_space omap3xxx_timer3_addrs[] = {
709 {
710 .pa_start = 0x49034000,
711 .pa_end = 0x49034000 + SZ_1K - 1,
712 .flags = ADDR_TYPE_RT
713 },
714 { }
715};
716
717/* l4_per -> timer3 */
718static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer3 = {
719 .master = &omap3xxx_l4_per_hwmod,
720 .slave = &omap3xxx_timer3_hwmod,
721 .clk = "gpt3_ick",
722 .addr = omap3xxx_timer3_addrs,
723 .user = OCP_USER_MPU | OCP_USER_SDMA,
724};
725
726/* timer3 slave port */
727static struct omap_hwmod_ocp_if *omap3xxx_timer3_slaves[] = {
728 &omap3xxx_l4_per__timer3,
729};
730
731/* timer3 hwmod */
732static struct omap_hwmod omap3xxx_timer3_hwmod = { 203static struct omap_hwmod omap3xxx_timer3_hwmod = {
733 .name = "timer3", 204 .name = "timer3",
734 .mpu_irqs = omap2_timer3_mpu_irqs, 205 .mpu_irqs = omap2_timer3_mpu_irqs,
@@ -743,38 +214,10 @@ static struct omap_hwmod omap3xxx_timer3_hwmod = {
743 }, 214 },
744 }, 215 },
745 .dev_attr = &capability_alwon_dev_attr, 216 .dev_attr = &capability_alwon_dev_attr,
746 .slaves = omap3xxx_timer3_slaves,
747 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer3_slaves),
748 .class = &omap3xxx_timer_hwmod_class, 217 .class = &omap3xxx_timer_hwmod_class,
749}; 218};
750 219
751/* timer4 */ 220/* timer4 */
752static struct omap_hwmod omap3xxx_timer4_hwmod;
753
754static struct omap_hwmod_addr_space omap3xxx_timer4_addrs[] = {
755 {
756 .pa_start = 0x49036000,
757 .pa_end = 0x49036000 + SZ_1K - 1,
758 .flags = ADDR_TYPE_RT
759 },
760 { }
761};
762
763/* l4_per -> timer4 */
764static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer4 = {
765 .master = &omap3xxx_l4_per_hwmod,
766 .slave = &omap3xxx_timer4_hwmod,
767 .clk = "gpt4_ick",
768 .addr = omap3xxx_timer4_addrs,
769 .user = OCP_USER_MPU | OCP_USER_SDMA,
770};
771
772/* timer4 slave port */
773static struct omap_hwmod_ocp_if *omap3xxx_timer4_slaves[] = {
774 &omap3xxx_l4_per__timer4,
775};
776
777/* timer4 hwmod */
778static struct omap_hwmod omap3xxx_timer4_hwmod = { 221static struct omap_hwmod omap3xxx_timer4_hwmod = {
779 .name = "timer4", 222 .name = "timer4",
780 .mpu_irqs = omap2_timer4_mpu_irqs, 223 .mpu_irqs = omap2_timer4_mpu_irqs,
@@ -789,38 +232,10 @@ static struct omap_hwmod omap3xxx_timer4_hwmod = {
789 }, 232 },
790 }, 233 },
791 .dev_attr = &capability_alwon_dev_attr, 234 .dev_attr = &capability_alwon_dev_attr,
792 .slaves = omap3xxx_timer4_slaves,
793 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer4_slaves),
794 .class = &omap3xxx_timer_hwmod_class, 235 .class = &omap3xxx_timer_hwmod_class,
795}; 236};
796 237
797/* timer5 */ 238/* timer5 */
798static struct omap_hwmod omap3xxx_timer5_hwmod;
799
800static struct omap_hwmod_addr_space omap3xxx_timer5_addrs[] = {
801 {
802 .pa_start = 0x49038000,
803 .pa_end = 0x49038000 + SZ_1K - 1,
804 .flags = ADDR_TYPE_RT
805 },
806 { }
807};
808
809/* l4_per -> timer5 */
810static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer5 = {
811 .master = &omap3xxx_l4_per_hwmod,
812 .slave = &omap3xxx_timer5_hwmod,
813 .clk = "gpt5_ick",
814 .addr = omap3xxx_timer5_addrs,
815 .user = OCP_USER_MPU | OCP_USER_SDMA,
816};
817
818/* timer5 slave port */
819static struct omap_hwmod_ocp_if *omap3xxx_timer5_slaves[] = {
820 &omap3xxx_l4_per__timer5,
821};
822
823/* timer5 hwmod */
824static struct omap_hwmod omap3xxx_timer5_hwmod = { 239static struct omap_hwmod omap3xxx_timer5_hwmod = {
825 .name = "timer5", 240 .name = "timer5",
826 .mpu_irqs = omap2_timer5_mpu_irqs, 241 .mpu_irqs = omap2_timer5_mpu_irqs,
@@ -835,38 +250,10 @@ static struct omap_hwmod omap3xxx_timer5_hwmod = {
835 }, 250 },
836 }, 251 },
837 .dev_attr = &capability_alwon_dev_attr, 252 .dev_attr = &capability_alwon_dev_attr,
838 .slaves = omap3xxx_timer5_slaves,
839 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer5_slaves),
840 .class = &omap3xxx_timer_hwmod_class, 253 .class = &omap3xxx_timer_hwmod_class,
841}; 254};
842 255
843/* timer6 */ 256/* timer6 */
844static struct omap_hwmod omap3xxx_timer6_hwmod;
845
846static struct omap_hwmod_addr_space omap3xxx_timer6_addrs[] = {
847 {
848 .pa_start = 0x4903A000,
849 .pa_end = 0x4903A000 + SZ_1K - 1,
850 .flags = ADDR_TYPE_RT
851 },
852 { }
853};
854
855/* l4_per -> timer6 */
856static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer6 = {
857 .master = &omap3xxx_l4_per_hwmod,
858 .slave = &omap3xxx_timer6_hwmod,
859 .clk = "gpt6_ick",
860 .addr = omap3xxx_timer6_addrs,
861 .user = OCP_USER_MPU | OCP_USER_SDMA,
862};
863
864/* timer6 slave port */
865static struct omap_hwmod_ocp_if *omap3xxx_timer6_slaves[] = {
866 &omap3xxx_l4_per__timer6,
867};
868
869/* timer6 hwmod */
870static struct omap_hwmod omap3xxx_timer6_hwmod = { 257static struct omap_hwmod omap3xxx_timer6_hwmod = {
871 .name = "timer6", 258 .name = "timer6",
872 .mpu_irqs = omap2_timer6_mpu_irqs, 259 .mpu_irqs = omap2_timer6_mpu_irqs,
@@ -881,38 +268,10 @@ static struct omap_hwmod omap3xxx_timer6_hwmod = {
881 }, 268 },
882 }, 269 },
883 .dev_attr = &capability_alwon_dev_attr, 270 .dev_attr = &capability_alwon_dev_attr,
884 .slaves = omap3xxx_timer6_slaves,
885 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer6_slaves),
886 .class = &omap3xxx_timer_hwmod_class, 271 .class = &omap3xxx_timer_hwmod_class,
887}; 272};
888 273
889/* timer7 */ 274/* timer7 */
890static struct omap_hwmod omap3xxx_timer7_hwmod;
891
892static struct omap_hwmod_addr_space omap3xxx_timer7_addrs[] = {
893 {
894 .pa_start = 0x4903C000,
895 .pa_end = 0x4903C000 + SZ_1K - 1,
896 .flags = ADDR_TYPE_RT
897 },
898 { }
899};
900
901/* l4_per -> timer7 */
902static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer7 = {
903 .master = &omap3xxx_l4_per_hwmod,
904 .slave = &omap3xxx_timer7_hwmod,
905 .clk = "gpt7_ick",
906 .addr = omap3xxx_timer7_addrs,
907 .user = OCP_USER_MPU | OCP_USER_SDMA,
908};
909
910/* timer7 slave port */
911static struct omap_hwmod_ocp_if *omap3xxx_timer7_slaves[] = {
912 &omap3xxx_l4_per__timer7,
913};
914
915/* timer7 hwmod */
916static struct omap_hwmod omap3xxx_timer7_hwmod = { 275static struct omap_hwmod omap3xxx_timer7_hwmod = {
917 .name = "timer7", 276 .name = "timer7",
918 .mpu_irqs = omap2_timer7_mpu_irqs, 277 .mpu_irqs = omap2_timer7_mpu_irqs,
@@ -927,38 +286,10 @@ static struct omap_hwmod omap3xxx_timer7_hwmod = {
927 }, 286 },
928 }, 287 },
929 .dev_attr = &capability_alwon_dev_attr, 288 .dev_attr = &capability_alwon_dev_attr,
930 .slaves = omap3xxx_timer7_slaves,
931 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer7_slaves),
932 .class = &omap3xxx_timer_hwmod_class, 289 .class = &omap3xxx_timer_hwmod_class,
933}; 290};
934 291
935/* timer8 */ 292/* timer8 */
936static struct omap_hwmod omap3xxx_timer8_hwmod;
937
938static struct omap_hwmod_addr_space omap3xxx_timer8_addrs[] = {
939 {
940 .pa_start = 0x4903E000,
941 .pa_end = 0x4903E000 + SZ_1K - 1,
942 .flags = ADDR_TYPE_RT
943 },
944 { }
945};
946
947/* l4_per -> timer8 */
948static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer8 = {
949 .master = &omap3xxx_l4_per_hwmod,
950 .slave = &omap3xxx_timer8_hwmod,
951 .clk = "gpt8_ick",
952 .addr = omap3xxx_timer8_addrs,
953 .user = OCP_USER_MPU | OCP_USER_SDMA,
954};
955
956/* timer8 slave port */
957static struct omap_hwmod_ocp_if *omap3xxx_timer8_slaves[] = {
958 &omap3xxx_l4_per__timer8,
959};
960
961/* timer8 hwmod */
962static struct omap_hwmod omap3xxx_timer8_hwmod = { 293static struct omap_hwmod omap3xxx_timer8_hwmod = {
963 .name = "timer8", 294 .name = "timer8",
964 .mpu_irqs = omap2_timer8_mpu_irqs, 295 .mpu_irqs = omap2_timer8_mpu_irqs,
@@ -973,38 +304,10 @@ static struct omap_hwmod omap3xxx_timer8_hwmod = {
973 }, 304 },
974 }, 305 },
975 .dev_attr = &capability_pwm_dev_attr, 306 .dev_attr = &capability_pwm_dev_attr,
976 .slaves = omap3xxx_timer8_slaves,
977 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer8_slaves),
978 .class = &omap3xxx_timer_hwmod_class, 307 .class = &omap3xxx_timer_hwmod_class,
979}; 308};
980 309
981/* timer9 */ 310/* timer9 */
982static struct omap_hwmod omap3xxx_timer9_hwmod;
983
984static struct omap_hwmod_addr_space omap3xxx_timer9_addrs[] = {
985 {
986 .pa_start = 0x49040000,
987 .pa_end = 0x49040000 + SZ_1K - 1,
988 .flags = ADDR_TYPE_RT
989 },
990 { }
991};
992
993/* l4_per -> timer9 */
994static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer9 = {
995 .master = &omap3xxx_l4_per_hwmod,
996 .slave = &omap3xxx_timer9_hwmod,
997 .clk = "gpt9_ick",
998 .addr = omap3xxx_timer9_addrs,
999 .user = OCP_USER_MPU | OCP_USER_SDMA,
1000};
1001
1002/* timer9 slave port */
1003static struct omap_hwmod_ocp_if *omap3xxx_timer9_slaves[] = {
1004 &omap3xxx_l4_per__timer9,
1005};
1006
1007/* timer9 hwmod */
1008static struct omap_hwmod omap3xxx_timer9_hwmod = { 311static struct omap_hwmod omap3xxx_timer9_hwmod = {
1009 .name = "timer9", 312 .name = "timer9",
1010 .mpu_irqs = omap2_timer9_mpu_irqs, 313 .mpu_irqs = omap2_timer9_mpu_irqs,
@@ -1019,29 +322,10 @@ static struct omap_hwmod omap3xxx_timer9_hwmod = {
1019 }, 322 },
1020 }, 323 },
1021 .dev_attr = &capability_pwm_dev_attr, 324 .dev_attr = &capability_pwm_dev_attr,
1022 .slaves = omap3xxx_timer9_slaves,
1023 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer9_slaves),
1024 .class = &omap3xxx_timer_hwmod_class, 325 .class = &omap3xxx_timer_hwmod_class,
1025}; 326};
1026 327
1027/* timer10 */ 328/* timer10 */
1028static struct omap_hwmod omap3xxx_timer10_hwmod;
1029
1030/* l4_core -> timer10 */
1031static struct omap_hwmod_ocp_if omap3xxx_l4_core__timer10 = {
1032 .master = &omap3xxx_l4_core_hwmod,
1033 .slave = &omap3xxx_timer10_hwmod,
1034 .clk = "gpt10_ick",
1035 .addr = omap2_timer10_addrs,
1036 .user = OCP_USER_MPU | OCP_USER_SDMA,
1037};
1038
1039/* timer10 slave port */
1040static struct omap_hwmod_ocp_if *omap3xxx_timer10_slaves[] = {
1041 &omap3xxx_l4_core__timer10,
1042};
1043
1044/* timer10 hwmod */
1045static struct omap_hwmod omap3xxx_timer10_hwmod = { 329static struct omap_hwmod omap3xxx_timer10_hwmod = {
1046 .name = "timer10", 330 .name = "timer10",
1047 .mpu_irqs = omap2_timer10_mpu_irqs, 331 .mpu_irqs = omap2_timer10_mpu_irqs,
@@ -1056,29 +340,10 @@ static struct omap_hwmod omap3xxx_timer10_hwmod = {
1056 }, 340 },
1057 }, 341 },
1058 .dev_attr = &capability_pwm_dev_attr, 342 .dev_attr = &capability_pwm_dev_attr,
1059 .slaves = omap3xxx_timer10_slaves,
1060 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer10_slaves),
1061 .class = &omap3xxx_timer_1ms_hwmod_class, 343 .class = &omap3xxx_timer_1ms_hwmod_class,
1062}; 344};
1063 345
1064/* timer11 */ 346/* timer11 */
1065static struct omap_hwmod omap3xxx_timer11_hwmod;
1066
1067/* l4_core -> timer11 */
1068static struct omap_hwmod_ocp_if omap3xxx_l4_core__timer11 = {
1069 .master = &omap3xxx_l4_core_hwmod,
1070 .slave = &omap3xxx_timer11_hwmod,
1071 .clk = "gpt11_ick",
1072 .addr = omap2_timer11_addrs,
1073 .user = OCP_USER_MPU | OCP_USER_SDMA,
1074};
1075
1076/* timer11 slave port */
1077static struct omap_hwmod_ocp_if *omap3xxx_timer11_slaves[] = {
1078 &omap3xxx_l4_core__timer11,
1079};
1080
1081/* timer11 hwmod */
1082static struct omap_hwmod omap3xxx_timer11_hwmod = { 347static struct omap_hwmod omap3xxx_timer11_hwmod = {
1083 .name = "timer11", 348 .name = "timer11",
1084 .mpu_irqs = omap2_timer11_mpu_irqs, 349 .mpu_irqs = omap2_timer11_mpu_irqs,
@@ -1093,42 +358,15 @@ static struct omap_hwmod omap3xxx_timer11_hwmod = {
1093 }, 358 },
1094 }, 359 },
1095 .dev_attr = &capability_pwm_dev_attr, 360 .dev_attr = &capability_pwm_dev_attr,
1096 .slaves = omap3xxx_timer11_slaves,
1097 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer11_slaves),
1098 .class = &omap3xxx_timer_hwmod_class, 361 .class = &omap3xxx_timer_hwmod_class,
1099}; 362};
1100 363
1101/* timer12*/ 364/* timer12 */
1102static struct omap_hwmod omap3xxx_timer12_hwmod;
1103static struct omap_hwmod_irq_info omap3xxx_timer12_mpu_irqs[] = { 365static struct omap_hwmod_irq_info omap3xxx_timer12_mpu_irqs[] = {
1104 { .irq = 95, }, 366 { .irq = 95, },
1105 { .irq = -1 } 367 { .irq = -1 }
1106}; 368};
1107 369
1108static struct omap_hwmod_addr_space omap3xxx_timer12_addrs[] = {
1109 {
1110 .pa_start = 0x48304000,
1111 .pa_end = 0x48304000 + SZ_1K - 1,
1112 .flags = ADDR_TYPE_RT
1113 },
1114 { }
1115};
1116
1117/* l4_core -> timer12 */
1118static struct omap_hwmod_ocp_if omap3xxx_l4_core__timer12 = {
1119 .master = &omap3xxx_l4_core_hwmod,
1120 .slave = &omap3xxx_timer12_hwmod,
1121 .clk = "gpt12_ick",
1122 .addr = omap3xxx_timer12_addrs,
1123 .user = OCP_USER_MPU | OCP_USER_SDMA,
1124};
1125
1126/* timer12 slave port */
1127static struct omap_hwmod_ocp_if *omap3xxx_timer12_slaves[] = {
1128 &omap3xxx_l4_core__timer12,
1129};
1130
1131/* timer12 hwmod */
1132static struct omap_hwmod omap3xxx_timer12_hwmod = { 370static struct omap_hwmod omap3xxx_timer12_hwmod = {
1133 .name = "timer12", 371 .name = "timer12",
1134 .mpu_irqs = omap3xxx_timer12_mpu_irqs, 372 .mpu_irqs = omap3xxx_timer12_mpu_irqs,
@@ -1143,29 +381,9 @@ static struct omap_hwmod omap3xxx_timer12_hwmod = {
1143 }, 381 },
1144 }, 382 },
1145 .dev_attr = &capability_secure_dev_attr, 383 .dev_attr = &capability_secure_dev_attr,
1146 .slaves = omap3xxx_timer12_slaves,
1147 .slaves_cnt = ARRAY_SIZE(omap3xxx_timer12_slaves),
1148 .class = &omap3xxx_timer_hwmod_class, 384 .class = &omap3xxx_timer_hwmod_class,
1149}; 385};
1150 386
1151/* l4_wkup -> wd_timer2 */
1152static struct omap_hwmod_addr_space omap3xxx_wd_timer2_addrs[] = {
1153 {
1154 .pa_start = 0x48314000,
1155 .pa_end = 0x4831407f,
1156 .flags = ADDR_TYPE_RT
1157 },
1158 { }
1159};
1160
1161static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__wd_timer2 = {
1162 .master = &omap3xxx_l4_wkup_hwmod,
1163 .slave = &omap3xxx_wd_timer2_hwmod,
1164 .clk = "wdt2_ick",
1165 .addr = omap3xxx_wd_timer2_addrs,
1166 .user = OCP_USER_MPU | OCP_USER_SDMA,
1167};
1168
1169/* 387/*
1170 * 'wd_timer' class 388 * 'wd_timer' class
1171 * 32-bit watchdog upward counter that generates a pulse on the reset pin on 389 * 32-bit watchdog upward counter that generates a pulse on the reset pin on
@@ -1200,12 +418,8 @@ static struct omap_hwmod_class_sysconfig i2c_sysc = {
1200static struct omap_hwmod_class omap3xxx_wd_timer_hwmod_class = { 418static struct omap_hwmod_class omap3xxx_wd_timer_hwmod_class = {
1201 .name = "wd_timer", 419 .name = "wd_timer",
1202 .sysc = &omap3xxx_wd_timer_sysc, 420 .sysc = &omap3xxx_wd_timer_sysc,
1203 .pre_shutdown = &omap2_wd_timer_disable 421 .pre_shutdown = &omap2_wd_timer_disable,
1204}; 422 .reset = &omap2_wd_timer_reset,
1205
1206/* wd_timer2 */
1207static struct omap_hwmod_ocp_if *omap3xxx_wd_timer2_slaves[] = {
1208 &omap3xxx_l4_wkup__wd_timer2,
1209}; 423};
1210 424
1211static struct omap_hwmod omap3xxx_wd_timer2_hwmod = { 425static struct omap_hwmod omap3xxx_wd_timer2_hwmod = {
@@ -1221,8 +435,6 @@ static struct omap_hwmod omap3xxx_wd_timer2_hwmod = {
1221 .idlest_idle_bit = OMAP3430_ST_WDT2_SHIFT, 435 .idlest_idle_bit = OMAP3430_ST_WDT2_SHIFT,
1222 }, 436 },
1223 }, 437 },
1224 .slaves = omap3xxx_wd_timer2_slaves,
1225 .slaves_cnt = ARRAY_SIZE(omap3xxx_wd_timer2_slaves),
1226 /* 438 /*
1227 * XXX: Use software supervised mode, HW supervised smartidle seems to 439 * XXX: Use software supervised mode, HW supervised smartidle seems to
1228 * block CORE power domain idle transitions. Maybe a HW bug in wdt2? 440 * block CORE power domain idle transitions. Maybe a HW bug in wdt2?
@@ -1231,11 +443,6 @@ static struct omap_hwmod omap3xxx_wd_timer2_hwmod = {
1231}; 443};
1232 444
1233/* UART1 */ 445/* UART1 */
1234
1235static struct omap_hwmod_ocp_if *omap3xxx_uart1_slaves[] = {
1236 &omap3_l4_core__uart1,
1237};
1238
1239static struct omap_hwmod omap3xxx_uart1_hwmod = { 446static struct omap_hwmod omap3xxx_uart1_hwmod = {
1240 .name = "uart1", 447 .name = "uart1",
1241 .mpu_irqs = omap2_uart1_mpu_irqs, 448 .mpu_irqs = omap2_uart1_mpu_irqs,
@@ -1250,17 +457,10 @@ static struct omap_hwmod omap3xxx_uart1_hwmod = {
1250 .idlest_idle_bit = OMAP3430_EN_UART1_SHIFT, 457 .idlest_idle_bit = OMAP3430_EN_UART1_SHIFT,
1251 }, 458 },
1252 }, 459 },
1253 .slaves = omap3xxx_uart1_slaves,
1254 .slaves_cnt = ARRAY_SIZE(omap3xxx_uart1_slaves),
1255 .class = &omap2_uart_class, 460 .class = &omap2_uart_class,
1256}; 461};
1257 462
1258/* UART2 */ 463/* UART2 */
1259
1260static struct omap_hwmod_ocp_if *omap3xxx_uart2_slaves[] = {
1261 &omap3_l4_core__uart2,
1262};
1263
1264static struct omap_hwmod omap3xxx_uart2_hwmod = { 464static struct omap_hwmod omap3xxx_uart2_hwmod = {
1265 .name = "uart2", 465 .name = "uart2",
1266 .mpu_irqs = omap2_uart2_mpu_irqs, 466 .mpu_irqs = omap2_uart2_mpu_irqs,
@@ -1275,17 +475,10 @@ static struct omap_hwmod omap3xxx_uart2_hwmod = {
1275 .idlest_idle_bit = OMAP3430_EN_UART2_SHIFT, 475 .idlest_idle_bit = OMAP3430_EN_UART2_SHIFT,
1276 }, 476 },
1277 }, 477 },
1278 .slaves = omap3xxx_uart2_slaves,
1279 .slaves_cnt = ARRAY_SIZE(omap3xxx_uart2_slaves),
1280 .class = &omap2_uart_class, 478 .class = &omap2_uart_class,
1281}; 479};
1282 480
1283/* UART3 */ 481/* UART3 */
1284
1285static struct omap_hwmod_ocp_if *omap3xxx_uart3_slaves[] = {
1286 &omap3_l4_per__uart3,
1287};
1288
1289static struct omap_hwmod omap3xxx_uart3_hwmod = { 482static struct omap_hwmod omap3xxx_uart3_hwmod = {
1290 .name = "uart3", 483 .name = "uart3",
1291 .mpu_irqs = omap2_uart3_mpu_irqs, 484 .mpu_irqs = omap2_uart3_mpu_irqs,
@@ -1300,13 +493,10 @@ static struct omap_hwmod omap3xxx_uart3_hwmod = {
1300 .idlest_idle_bit = OMAP3430_EN_UART3_SHIFT, 493 .idlest_idle_bit = OMAP3430_EN_UART3_SHIFT,
1301 }, 494 },
1302 }, 495 },
1303 .slaves = omap3xxx_uart3_slaves,
1304 .slaves_cnt = ARRAY_SIZE(omap3xxx_uart3_slaves),
1305 .class = &omap2_uart_class, 496 .class = &omap2_uart_class,
1306}; 497};
1307 498
1308/* UART4 */ 499/* UART4 */
1309
1310static struct omap_hwmod_irq_info uart4_mpu_irqs[] = { 500static struct omap_hwmod_irq_info uart4_mpu_irqs[] = {
1311 { .irq = INT_36XX_UART4_IRQ, }, 501 { .irq = INT_36XX_UART4_IRQ, },
1312 { .irq = -1 } 502 { .irq = -1 }
@@ -1318,11 +508,7 @@ static struct omap_hwmod_dma_info uart4_sdma_reqs[] = {
1318 { .dma_req = -1 } 508 { .dma_req = -1 }
1319}; 509};
1320 510
1321static struct omap_hwmod_ocp_if *omap3xxx_uart4_slaves[] = { 511static struct omap_hwmod omap36xx_uart4_hwmod = {
1322 &omap3_l4_per__uart4,
1323};
1324
1325static struct omap_hwmod omap3xxx_uart4_hwmod = {
1326 .name = "uart4", 512 .name = "uart4",
1327 .mpu_irqs = uart4_mpu_irqs, 513 .mpu_irqs = uart4_mpu_irqs,
1328 .sdma_reqs = uart4_sdma_reqs, 514 .sdma_reqs = uart4_sdma_reqs,
@@ -1336,8 +522,6 @@ static struct omap_hwmod omap3xxx_uart4_hwmod = {
1336 .idlest_idle_bit = OMAP3630_EN_UART4_SHIFT, 522 .idlest_idle_bit = OMAP3630_EN_UART4_SHIFT,
1337 }, 523 },
1338 }, 524 },
1339 .slaves = omap3xxx_uart4_slaves,
1340 .slaves_cnt = ARRAY_SIZE(omap3xxx_uart4_slaves),
1341 .class = &omap2_uart_class, 525 .class = &omap2_uart_class,
1342}; 526};
1343 527
@@ -1350,16 +534,12 @@ static struct omap_hwmod_dma_info am35xx_uart4_sdma_reqs[] = {
1350 { .name = "tx", .dma_req = AM35XX_DMA_UART4_TX, }, 534 { .name = "tx", .dma_req = AM35XX_DMA_UART4_TX, },
1351}; 535};
1352 536
1353static struct omap_hwmod_ocp_if *am35xx_uart4_slaves[] = {
1354 &am35xx_l4_core__uart4,
1355};
1356
1357static struct omap_hwmod am35xx_uart4_hwmod = { 537static struct omap_hwmod am35xx_uart4_hwmod = {
1358 .name = "uart4", 538 .name = "uart4",
1359 .mpu_irqs = am35xx_uart4_mpu_irqs, 539 .mpu_irqs = am35xx_uart4_mpu_irqs,
1360 .sdma_reqs = am35xx_uart4_sdma_reqs, 540 .sdma_reqs = am35xx_uart4_sdma_reqs,
1361 .main_clk = "uart4_fck", 541 .main_clk = "uart4_fck",
1362 .prcm = { 542 .prcm = {
1363 .omap2 = { 543 .omap2 = {
1364 .module_offs = CORE_MOD, 544 .module_offs = CORE_MOD,
1365 .prcm_reg_id = 1, 545 .prcm_reg_id = 1,
@@ -1368,12 +548,9 @@ static struct omap_hwmod am35xx_uart4_hwmod = {
1368 .idlest_idle_bit = OMAP3430_EN_UART4_SHIFT, 548 .idlest_idle_bit = OMAP3430_EN_UART4_SHIFT,
1369 }, 549 },
1370 }, 550 },
1371 .slaves = am35xx_uart4_slaves, 551 .class = &omap2_uart_class,
1372 .slaves_cnt = ARRAY_SIZE(am35xx_uart4_slaves),
1373 .class = &omap2_uart_class,
1374}; 552};
1375 553
1376
1377static struct omap_hwmod_class i2c_class = { 554static struct omap_hwmod_class i2c_class = {
1378 .name = "i2c", 555 .name = "i2c",
1379 .sysc = &i2c_sysc, 556 .sysc = &i2c_sysc,
@@ -1388,51 +565,6 @@ static struct omap_hwmod_dma_info omap3xxx_dss_sdma_chs[] = {
1388}; 565};
1389 566
1390/* dss */ 567/* dss */
1391/* dss master ports */
1392static struct omap_hwmod_ocp_if *omap3xxx_dss_masters[] = {
1393 &omap3xxx_dss__l3,
1394};
1395
1396/* l4_core -> dss */
1397static struct omap_hwmod_ocp_if omap3430es1_l4_core__dss = {
1398 .master = &omap3xxx_l4_core_hwmod,
1399 .slave = &omap3430es1_dss_core_hwmod,
1400 .clk = "dss_ick",
1401 .addr = omap2_dss_addrs,
1402 .fw = {
1403 .omap2 = {
1404 .l4_fw_region = OMAP3ES1_L4_CORE_FW_DSS_CORE_REGION,
1405 .l4_prot_group = OMAP3_L4_CORE_FW_DSS_PROT_GROUP,
1406 .flags = OMAP_FIREWALL_L4,
1407 }
1408 },
1409 .user = OCP_USER_MPU | OCP_USER_SDMA,
1410};
1411
1412static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss = {
1413 .master = &omap3xxx_l4_core_hwmod,
1414 .slave = &omap3xxx_dss_core_hwmod,
1415 .clk = "dss_ick",
1416 .addr = omap2_dss_addrs,
1417 .fw = {
1418 .omap2 = {
1419 .l4_fw_region = OMAP3_L4_CORE_FW_DSS_CORE_REGION,
1420 .l4_prot_group = OMAP3_L4_CORE_FW_DSS_PROT_GROUP,
1421 .flags = OMAP_FIREWALL_L4,
1422 }
1423 },
1424 .user = OCP_USER_MPU | OCP_USER_SDMA,
1425};
1426
1427/* dss slave ports */
1428static struct omap_hwmod_ocp_if *omap3430es1_dss_slaves[] = {
1429 &omap3430es1_l4_core__dss,
1430};
1431
1432static struct omap_hwmod_ocp_if *omap3xxx_dss_slaves[] = {
1433 &omap3xxx_l4_core__dss,
1434};
1435
1436static struct omap_hwmod_opt_clk dss_opt_clks[] = { 568static struct omap_hwmod_opt_clk dss_opt_clks[] = {
1437 /* 569 /*
1438 * The DSS HW needs all DSS clocks enabled during reset. The dss_core 570 * The DSS HW needs all DSS clocks enabled during reset. The dss_core
@@ -1460,10 +592,6 @@ static struct omap_hwmod omap3430es1_dss_core_hwmod = {
1460 }, 592 },
1461 .opt_clks = dss_opt_clks, 593 .opt_clks = dss_opt_clks,
1462 .opt_clks_cnt = ARRAY_SIZE(dss_opt_clks), 594 .opt_clks_cnt = ARRAY_SIZE(dss_opt_clks),
1463 .slaves = omap3430es1_dss_slaves,
1464 .slaves_cnt = ARRAY_SIZE(omap3430es1_dss_slaves),
1465 .masters = omap3xxx_dss_masters,
1466 .masters_cnt = ARRAY_SIZE(omap3xxx_dss_masters),
1467 .flags = HWMOD_NO_IDLEST | HWMOD_CONTROL_OPT_CLKS_IN_RESET, 595 .flags = HWMOD_NO_IDLEST | HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1468}; 596};
1469 597
@@ -1485,10 +613,6 @@ static struct omap_hwmod omap3xxx_dss_core_hwmod = {
1485 }, 613 },
1486 .opt_clks = dss_opt_clks, 614 .opt_clks = dss_opt_clks,
1487 .opt_clks_cnt = ARRAY_SIZE(dss_opt_clks), 615 .opt_clks_cnt = ARRAY_SIZE(dss_opt_clks),
1488 .slaves = omap3xxx_dss_slaves,
1489 .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_slaves),
1490 .masters = omap3xxx_dss_masters,
1491 .masters_cnt = ARRAY_SIZE(omap3xxx_dss_masters),
1492}; 616};
1493 617
1494/* 618/*
@@ -1513,27 +637,6 @@ static struct omap_hwmod_class omap3_dispc_hwmod_class = {
1513 .sysc = &omap3_dispc_sysc, 637 .sysc = &omap3_dispc_sysc,
1514}; 638};
1515 639
1516/* l4_core -> dss_dispc */
1517static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_dispc = {
1518 .master = &omap3xxx_l4_core_hwmod,
1519 .slave = &omap3xxx_dss_dispc_hwmod,
1520 .clk = "dss_ick",
1521 .addr = omap2_dss_dispc_addrs,
1522 .fw = {
1523 .omap2 = {
1524 .l4_fw_region = OMAP3_L4_CORE_FW_DSS_DISPC_REGION,
1525 .l4_prot_group = OMAP3_L4_CORE_FW_DSS_PROT_GROUP,
1526 .flags = OMAP_FIREWALL_L4,
1527 }
1528 },
1529 .user = OCP_USER_MPU | OCP_USER_SDMA,
1530};
1531
1532/* dss_dispc slave ports */
1533static struct omap_hwmod_ocp_if *omap3xxx_dss_dispc_slaves[] = {
1534 &omap3xxx_l4_core__dss_dispc,
1535};
1536
1537static struct omap_hwmod omap3xxx_dss_dispc_hwmod = { 640static struct omap_hwmod omap3xxx_dss_dispc_hwmod = {
1538 .name = "dss_dispc", 641 .name = "dss_dispc",
1539 .class = &omap3_dispc_hwmod_class, 642 .class = &omap3_dispc_hwmod_class,
@@ -1546,8 +649,6 @@ static struct omap_hwmod omap3xxx_dss_dispc_hwmod = {
1546 .module_offs = OMAP3430_DSS_MOD, 649 .module_offs = OMAP3430_DSS_MOD,
1547 }, 650 },
1548 }, 651 },
1549 .slaves = omap3xxx_dss_dispc_slaves,
1550 .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_dispc_slaves),
1551 .flags = HWMOD_NO_IDLEST, 652 .flags = HWMOD_NO_IDLEST,
1552 .dev_attr = &omap2_3_dss_dispc_dev_attr 653 .dev_attr = &omap2_3_dss_dispc_dev_attr
1553}; 654};
@@ -1567,36 +668,6 @@ static struct omap_hwmod_irq_info omap3xxx_dsi1_irqs[] = {
1567}; 668};
1568 669
1569/* dss_dsi1 */ 670/* dss_dsi1 */
1570static struct omap_hwmod_addr_space omap3xxx_dss_dsi1_addrs[] = {
1571 {
1572 .pa_start = 0x4804FC00,
1573 .pa_end = 0x4804FFFF,
1574 .flags = ADDR_TYPE_RT
1575 },
1576 { }
1577};
1578
1579/* l4_core -> dss_dsi1 */
1580static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_dsi1 = {
1581 .master = &omap3xxx_l4_core_hwmod,
1582 .slave = &omap3xxx_dss_dsi1_hwmod,
1583 .clk = "dss_ick",
1584 .addr = omap3xxx_dss_dsi1_addrs,
1585 .fw = {
1586 .omap2 = {
1587 .l4_fw_region = OMAP3_L4_CORE_FW_DSS_DSI_REGION,
1588 .l4_prot_group = OMAP3_L4_CORE_FW_DSS_PROT_GROUP,
1589 .flags = OMAP_FIREWALL_L4,
1590 }
1591 },
1592 .user = OCP_USER_MPU | OCP_USER_SDMA,
1593};
1594
1595/* dss_dsi1 slave ports */
1596static struct omap_hwmod_ocp_if *omap3xxx_dss_dsi1_slaves[] = {
1597 &omap3xxx_l4_core__dss_dsi1,
1598};
1599
1600static struct omap_hwmod_opt_clk dss_dsi1_opt_clks[] = { 671static struct omap_hwmod_opt_clk dss_dsi1_opt_clks[] = {
1601 { .role = "sys_clk", .clk = "dss2_alwon_fck" }, 672 { .role = "sys_clk", .clk = "dss2_alwon_fck" },
1602}; 673};
@@ -1615,32 +686,9 @@ static struct omap_hwmod omap3xxx_dss_dsi1_hwmod = {
1615 }, 686 },
1616 .opt_clks = dss_dsi1_opt_clks, 687 .opt_clks = dss_dsi1_opt_clks,
1617 .opt_clks_cnt = ARRAY_SIZE(dss_dsi1_opt_clks), 688 .opt_clks_cnt = ARRAY_SIZE(dss_dsi1_opt_clks),
1618 .slaves = omap3xxx_dss_dsi1_slaves,
1619 .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_dsi1_slaves),
1620 .flags = HWMOD_NO_IDLEST, 689 .flags = HWMOD_NO_IDLEST,
1621}; 690};
1622 691
1623/* l4_core -> dss_rfbi */
1624static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_rfbi = {
1625 .master = &omap3xxx_l4_core_hwmod,
1626 .slave = &omap3xxx_dss_rfbi_hwmod,
1627 .clk = "dss_ick",
1628 .addr = omap2_dss_rfbi_addrs,
1629 .fw = {
1630 .omap2 = {
1631 .l4_fw_region = OMAP3_L4_CORE_FW_DSS_RFBI_REGION,
1632 .l4_prot_group = OMAP3_L4_CORE_FW_DSS_PROT_GROUP ,
1633 .flags = OMAP_FIREWALL_L4,
1634 }
1635 },
1636 .user = OCP_USER_MPU | OCP_USER_SDMA,
1637};
1638
1639/* dss_rfbi slave ports */
1640static struct omap_hwmod_ocp_if *omap3xxx_dss_rfbi_slaves[] = {
1641 &omap3xxx_l4_core__dss_rfbi,
1642};
1643
1644static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = { 692static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = {
1645 { .role = "ick", .clk = "dss_ick" }, 693 { .role = "ick", .clk = "dss_ick" },
1646}; 694};
@@ -1658,33 +706,9 @@ static struct omap_hwmod omap3xxx_dss_rfbi_hwmod = {
1658 }, 706 },
1659 .opt_clks = dss_rfbi_opt_clks, 707 .opt_clks = dss_rfbi_opt_clks,
1660 .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks), 708 .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks),
1661 .slaves = omap3xxx_dss_rfbi_slaves,
1662 .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_rfbi_slaves),
1663 .flags = HWMOD_NO_IDLEST, 709 .flags = HWMOD_NO_IDLEST,
1664}; 710};
1665 711
1666/* l4_core -> dss_venc */
1667static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_venc = {
1668 .master = &omap3xxx_l4_core_hwmod,
1669 .slave = &omap3xxx_dss_venc_hwmod,
1670 .clk = "dss_ick",
1671 .addr = omap2_dss_venc_addrs,
1672 .fw = {
1673 .omap2 = {
1674 .l4_fw_region = OMAP3_L4_CORE_FW_DSS_VENC_REGION,
1675 .l4_prot_group = OMAP3_L4_CORE_FW_DSS_PROT_GROUP,
1676 .flags = OMAP_FIREWALL_L4,
1677 }
1678 },
1679 .flags = OCPIF_SWSUP_IDLE,
1680 .user = OCP_USER_MPU | OCP_USER_SDMA,
1681};
1682
1683/* dss_venc slave ports */
1684static struct omap_hwmod_ocp_if *omap3xxx_dss_venc_slaves[] = {
1685 &omap3xxx_l4_core__dss_venc,
1686};
1687
1688static struct omap_hwmod_opt_clk dss_venc_opt_clks[] = { 712static struct omap_hwmod_opt_clk dss_venc_opt_clks[] = {
1689 /* required only on OMAP3430 */ 713 /* required only on OMAP3430 */
1690 { .role = "tv_dac_clk", .clk = "dss_96m_fck" }, 714 { .role = "tv_dac_clk", .clk = "dss_96m_fck" },
@@ -1703,13 +727,10 @@ static struct omap_hwmod omap3xxx_dss_venc_hwmod = {
1703 }, 727 },
1704 .opt_clks = dss_venc_opt_clks, 728 .opt_clks = dss_venc_opt_clks,
1705 .opt_clks_cnt = ARRAY_SIZE(dss_venc_opt_clks), 729 .opt_clks_cnt = ARRAY_SIZE(dss_venc_opt_clks),
1706 .slaves = omap3xxx_dss_venc_slaves,
1707 .slaves_cnt = ARRAY_SIZE(omap3xxx_dss_venc_slaves),
1708 .flags = HWMOD_NO_IDLEST, 730 .flags = HWMOD_NO_IDLEST,
1709}; 731};
1710 732
1711/* I2C1 */ 733/* I2C1 */
1712
1713static struct omap_i2c_dev_attr i2c1_dev_attr = { 734static struct omap_i2c_dev_attr i2c1_dev_attr = {
1714 .fifo_depth = 8, /* bytes */ 735 .fifo_depth = 8, /* bytes */
1715 .flags = OMAP_I2C_FLAG_APPLY_ERRATA_I207 | 736 .flags = OMAP_I2C_FLAG_APPLY_ERRATA_I207 |
@@ -1717,10 +738,6 @@ static struct omap_i2c_dev_attr i2c1_dev_attr = {
1717 OMAP_I2C_FLAG_BUS_SHIFT_2, 738 OMAP_I2C_FLAG_BUS_SHIFT_2,
1718}; 739};
1719 740
1720static struct omap_hwmod_ocp_if *omap3xxx_i2c1_slaves[] = {
1721 &omap3_l4_core__i2c1,
1722};
1723
1724static struct omap_hwmod omap3xxx_i2c1_hwmod = { 741static struct omap_hwmod omap3xxx_i2c1_hwmod = {
1725 .name = "i2c1", 742 .name = "i2c1",
1726 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT, 743 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
@@ -1736,14 +753,11 @@ static struct omap_hwmod omap3xxx_i2c1_hwmod = {
1736 .idlest_idle_bit = OMAP3430_ST_I2C1_SHIFT, 753 .idlest_idle_bit = OMAP3430_ST_I2C1_SHIFT,
1737 }, 754 },
1738 }, 755 },
1739 .slaves = omap3xxx_i2c1_slaves,
1740 .slaves_cnt = ARRAY_SIZE(omap3xxx_i2c1_slaves),
1741 .class = &i2c_class, 756 .class = &i2c_class,
1742 .dev_attr = &i2c1_dev_attr, 757 .dev_attr = &i2c1_dev_attr,
1743}; 758};
1744 759
1745/* I2C2 */ 760/* I2C2 */
1746
1747static struct omap_i2c_dev_attr i2c2_dev_attr = { 761static struct omap_i2c_dev_attr i2c2_dev_attr = {
1748 .fifo_depth = 8, /* bytes */ 762 .fifo_depth = 8, /* bytes */
1749 .flags = OMAP_I2C_FLAG_APPLY_ERRATA_I207 | 763 .flags = OMAP_I2C_FLAG_APPLY_ERRATA_I207 |
@@ -1751,10 +765,6 @@ static struct omap_i2c_dev_attr i2c2_dev_attr = {
1751 OMAP_I2C_FLAG_BUS_SHIFT_2, 765 OMAP_I2C_FLAG_BUS_SHIFT_2,
1752}; 766};
1753 767
1754static struct omap_hwmod_ocp_if *omap3xxx_i2c2_slaves[] = {
1755 &omap3_l4_core__i2c2,
1756};
1757
1758static struct omap_hwmod omap3xxx_i2c2_hwmod = { 768static struct omap_hwmod omap3xxx_i2c2_hwmod = {
1759 .name = "i2c2", 769 .name = "i2c2",
1760 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT, 770 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
@@ -1770,14 +780,11 @@ static struct omap_hwmod omap3xxx_i2c2_hwmod = {
1770 .idlest_idle_bit = OMAP3430_ST_I2C2_SHIFT, 780 .idlest_idle_bit = OMAP3430_ST_I2C2_SHIFT,
1771 }, 781 },
1772 }, 782 },
1773 .slaves = omap3xxx_i2c2_slaves,
1774 .slaves_cnt = ARRAY_SIZE(omap3xxx_i2c2_slaves),
1775 .class = &i2c_class, 783 .class = &i2c_class,
1776 .dev_attr = &i2c2_dev_attr, 784 .dev_attr = &i2c2_dev_attr,
1777}; 785};
1778 786
1779/* I2C3 */ 787/* I2C3 */
1780
1781static struct omap_i2c_dev_attr i2c3_dev_attr = { 788static struct omap_i2c_dev_attr i2c3_dev_attr = {
1782 .fifo_depth = 64, /* bytes */ 789 .fifo_depth = 64, /* bytes */
1783 .flags = OMAP_I2C_FLAG_APPLY_ERRATA_I207 | 790 .flags = OMAP_I2C_FLAG_APPLY_ERRATA_I207 |
@@ -1796,10 +803,6 @@ static struct omap_hwmod_dma_info i2c3_sdma_reqs[] = {
1796 { .dma_req = -1 } 803 { .dma_req = -1 }
1797}; 804};
1798 805
1799static struct omap_hwmod_ocp_if *omap3xxx_i2c3_slaves[] = {
1800 &omap3_l4_core__i2c3,
1801};
1802
1803static struct omap_hwmod omap3xxx_i2c3_hwmod = { 806static struct omap_hwmod omap3xxx_i2c3_hwmod = {
1804 .name = "i2c3", 807 .name = "i2c3",
1805 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT, 808 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
@@ -1815,114 +818,10 @@ static struct omap_hwmod omap3xxx_i2c3_hwmod = {
1815 .idlest_idle_bit = OMAP3430_ST_I2C3_SHIFT, 818 .idlest_idle_bit = OMAP3430_ST_I2C3_SHIFT,
1816 }, 819 },
1817 }, 820 },
1818 .slaves = omap3xxx_i2c3_slaves,
1819 .slaves_cnt = ARRAY_SIZE(omap3xxx_i2c3_slaves),
1820 .class = &i2c_class, 821 .class = &i2c_class,
1821 .dev_attr = &i2c3_dev_attr, 822 .dev_attr = &i2c3_dev_attr,
1822}; 823};
1823 824
1824/* l4_wkup -> gpio1 */
1825static struct omap_hwmod_addr_space omap3xxx_gpio1_addrs[] = {
1826 {
1827 .pa_start = 0x48310000,
1828 .pa_end = 0x483101ff,
1829 .flags = ADDR_TYPE_RT
1830 },
1831 { }
1832};
1833
1834static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__gpio1 = {
1835 .master = &omap3xxx_l4_wkup_hwmod,
1836 .slave = &omap3xxx_gpio1_hwmod,
1837 .addr = omap3xxx_gpio1_addrs,
1838 .user = OCP_USER_MPU | OCP_USER_SDMA,
1839};
1840
1841/* l4_per -> gpio2 */
1842static struct omap_hwmod_addr_space omap3xxx_gpio2_addrs[] = {
1843 {
1844 .pa_start = 0x49050000,
1845 .pa_end = 0x490501ff,
1846 .flags = ADDR_TYPE_RT
1847 },
1848 { }
1849};
1850
1851static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio2 = {
1852 .master = &omap3xxx_l4_per_hwmod,
1853 .slave = &omap3xxx_gpio2_hwmod,
1854 .addr = omap3xxx_gpio2_addrs,
1855 .user = OCP_USER_MPU | OCP_USER_SDMA,
1856};
1857
1858/* l4_per -> gpio3 */
1859static struct omap_hwmod_addr_space omap3xxx_gpio3_addrs[] = {
1860 {
1861 .pa_start = 0x49052000,
1862 .pa_end = 0x490521ff,
1863 .flags = ADDR_TYPE_RT
1864 },
1865 { }
1866};
1867
1868static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio3 = {
1869 .master = &omap3xxx_l4_per_hwmod,
1870 .slave = &omap3xxx_gpio3_hwmod,
1871 .addr = omap3xxx_gpio3_addrs,
1872 .user = OCP_USER_MPU | OCP_USER_SDMA,
1873};
1874
1875/* l4_per -> gpio4 */
1876static struct omap_hwmod_addr_space omap3xxx_gpio4_addrs[] = {
1877 {
1878 .pa_start = 0x49054000,
1879 .pa_end = 0x490541ff,
1880 .flags = ADDR_TYPE_RT
1881 },
1882 { }
1883};
1884
1885static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio4 = {
1886 .master = &omap3xxx_l4_per_hwmod,
1887 .slave = &omap3xxx_gpio4_hwmod,
1888 .addr = omap3xxx_gpio4_addrs,
1889 .user = OCP_USER_MPU | OCP_USER_SDMA,
1890};
1891
1892/* l4_per -> gpio5 */
1893static struct omap_hwmod_addr_space omap3xxx_gpio5_addrs[] = {
1894 {
1895 .pa_start = 0x49056000,
1896 .pa_end = 0x490561ff,
1897 .flags = ADDR_TYPE_RT
1898 },
1899 { }
1900};
1901
1902static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio5 = {
1903 .master = &omap3xxx_l4_per_hwmod,
1904 .slave = &omap3xxx_gpio5_hwmod,
1905 .addr = omap3xxx_gpio5_addrs,
1906 .user = OCP_USER_MPU | OCP_USER_SDMA,
1907};
1908
1909/* l4_per -> gpio6 */
1910static struct omap_hwmod_addr_space omap3xxx_gpio6_addrs[] = {
1911 {
1912 .pa_start = 0x49058000,
1913 .pa_end = 0x490581ff,
1914 .flags = ADDR_TYPE_RT
1915 },
1916 { }
1917};
1918
1919static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio6 = {
1920 .master = &omap3xxx_l4_per_hwmod,
1921 .slave = &omap3xxx_gpio6_hwmod,
1922 .addr = omap3xxx_gpio6_addrs,
1923 .user = OCP_USER_MPU | OCP_USER_SDMA,
1924};
1925
1926/* 825/*
1927 * 'gpio' class 826 * 'gpio' class
1928 * general purpose io module 827 * general purpose io module
@@ -1945,7 +844,7 @@ static struct omap_hwmod_class omap3xxx_gpio_hwmod_class = {
1945 .rev = 1, 844 .rev = 1,
1946}; 845};
1947 846
1948/* gpio_dev_attr*/ 847/* gpio_dev_attr */
1949static struct omap_gpio_dev_attr gpio_dev_attr = { 848static struct omap_gpio_dev_attr gpio_dev_attr = {
1950 .bank_width = 32, 849 .bank_width = 32,
1951 .dbck_flag = true, 850 .dbck_flag = true,
@@ -1956,10 +855,6 @@ static struct omap_hwmod_opt_clk gpio1_opt_clks[] = {
1956 { .role = "dbclk", .clk = "gpio1_dbck", }, 855 { .role = "dbclk", .clk = "gpio1_dbck", },
1957}; 856};
1958 857
1959static struct omap_hwmod_ocp_if *omap3xxx_gpio1_slaves[] = {
1960 &omap3xxx_l4_wkup__gpio1,
1961};
1962
1963static struct omap_hwmod omap3xxx_gpio1_hwmod = { 858static struct omap_hwmod omap3xxx_gpio1_hwmod = {
1964 .name = "gpio1", 859 .name = "gpio1",
1965 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 860 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
@@ -1976,8 +871,6 @@ static struct omap_hwmod omap3xxx_gpio1_hwmod = {
1976 .idlest_idle_bit = OMAP3430_ST_GPIO1_SHIFT, 871 .idlest_idle_bit = OMAP3430_ST_GPIO1_SHIFT,
1977 }, 872 },
1978 }, 873 },
1979 .slaves = omap3xxx_gpio1_slaves,
1980 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio1_slaves),
1981 .class = &omap3xxx_gpio_hwmod_class, 874 .class = &omap3xxx_gpio_hwmod_class,
1982 .dev_attr = &gpio_dev_attr, 875 .dev_attr = &gpio_dev_attr,
1983}; 876};
@@ -1987,10 +880,6 @@ static struct omap_hwmod_opt_clk gpio2_opt_clks[] = {
1987 { .role = "dbclk", .clk = "gpio2_dbck", }, 880 { .role = "dbclk", .clk = "gpio2_dbck", },
1988}; 881};
1989 882
1990static struct omap_hwmod_ocp_if *omap3xxx_gpio2_slaves[] = {
1991 &omap3xxx_l4_per__gpio2,
1992};
1993
1994static struct omap_hwmod omap3xxx_gpio2_hwmod = { 883static struct omap_hwmod omap3xxx_gpio2_hwmod = {
1995 .name = "gpio2", 884 .name = "gpio2",
1996 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 885 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
@@ -2007,8 +896,6 @@ static struct omap_hwmod omap3xxx_gpio2_hwmod = {
2007 .idlest_idle_bit = OMAP3430_ST_GPIO2_SHIFT, 896 .idlest_idle_bit = OMAP3430_ST_GPIO2_SHIFT,
2008 }, 897 },
2009 }, 898 },
2010 .slaves = omap3xxx_gpio2_slaves,
2011 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio2_slaves),
2012 .class = &omap3xxx_gpio_hwmod_class, 899 .class = &omap3xxx_gpio_hwmod_class,
2013 .dev_attr = &gpio_dev_attr, 900 .dev_attr = &gpio_dev_attr,
2014}; 901};
@@ -2018,10 +905,6 @@ static struct omap_hwmod_opt_clk gpio3_opt_clks[] = {
2018 { .role = "dbclk", .clk = "gpio3_dbck", }, 905 { .role = "dbclk", .clk = "gpio3_dbck", },
2019}; 906};
2020 907
2021static struct omap_hwmod_ocp_if *omap3xxx_gpio3_slaves[] = {
2022 &omap3xxx_l4_per__gpio3,
2023};
2024
2025static struct omap_hwmod omap3xxx_gpio3_hwmod = { 908static struct omap_hwmod omap3xxx_gpio3_hwmod = {
2026 .name = "gpio3", 909 .name = "gpio3",
2027 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 910 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
@@ -2038,8 +921,6 @@ static struct omap_hwmod omap3xxx_gpio3_hwmod = {
2038 .idlest_idle_bit = OMAP3430_ST_GPIO3_SHIFT, 921 .idlest_idle_bit = OMAP3430_ST_GPIO3_SHIFT,
2039 }, 922 },
2040 }, 923 },
2041 .slaves = omap3xxx_gpio3_slaves,
2042 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio3_slaves),
2043 .class = &omap3xxx_gpio_hwmod_class, 924 .class = &omap3xxx_gpio_hwmod_class,
2044 .dev_attr = &gpio_dev_attr, 925 .dev_attr = &gpio_dev_attr,
2045}; 926};
@@ -2049,10 +930,6 @@ static struct omap_hwmod_opt_clk gpio4_opt_clks[] = {
2049 { .role = "dbclk", .clk = "gpio4_dbck", }, 930 { .role = "dbclk", .clk = "gpio4_dbck", },
2050}; 931};
2051 932
2052static struct omap_hwmod_ocp_if *omap3xxx_gpio4_slaves[] = {
2053 &omap3xxx_l4_per__gpio4,
2054};
2055
2056static struct omap_hwmod omap3xxx_gpio4_hwmod = { 933static struct omap_hwmod omap3xxx_gpio4_hwmod = {
2057 .name = "gpio4", 934 .name = "gpio4",
2058 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 935 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
@@ -2069,8 +946,6 @@ static struct omap_hwmod omap3xxx_gpio4_hwmod = {
2069 .idlest_idle_bit = OMAP3430_ST_GPIO4_SHIFT, 946 .idlest_idle_bit = OMAP3430_ST_GPIO4_SHIFT,
2070 }, 947 },
2071 }, 948 },
2072 .slaves = omap3xxx_gpio4_slaves,
2073 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio4_slaves),
2074 .class = &omap3xxx_gpio_hwmod_class, 949 .class = &omap3xxx_gpio_hwmod_class,
2075 .dev_attr = &gpio_dev_attr, 950 .dev_attr = &gpio_dev_attr,
2076}; 951};
@@ -2085,10 +960,6 @@ static struct omap_hwmod_opt_clk gpio5_opt_clks[] = {
2085 { .role = "dbclk", .clk = "gpio5_dbck", }, 960 { .role = "dbclk", .clk = "gpio5_dbck", },
2086}; 961};
2087 962
2088static struct omap_hwmod_ocp_if *omap3xxx_gpio5_slaves[] = {
2089 &omap3xxx_l4_per__gpio5,
2090};
2091
2092static struct omap_hwmod omap3xxx_gpio5_hwmod = { 963static struct omap_hwmod omap3xxx_gpio5_hwmod = {
2093 .name = "gpio5", 964 .name = "gpio5",
2094 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 965 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
@@ -2105,8 +976,6 @@ static struct omap_hwmod omap3xxx_gpio5_hwmod = {
2105 .idlest_idle_bit = OMAP3430_ST_GPIO5_SHIFT, 976 .idlest_idle_bit = OMAP3430_ST_GPIO5_SHIFT,
2106 }, 977 },
2107 }, 978 },
2108 .slaves = omap3xxx_gpio5_slaves,
2109 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio5_slaves),
2110 .class = &omap3xxx_gpio_hwmod_class, 979 .class = &omap3xxx_gpio_hwmod_class,
2111 .dev_attr = &gpio_dev_attr, 980 .dev_attr = &gpio_dev_attr,
2112}; 981};
@@ -2121,10 +990,6 @@ static struct omap_hwmod_opt_clk gpio6_opt_clks[] = {
2121 { .role = "dbclk", .clk = "gpio6_dbck", }, 990 { .role = "dbclk", .clk = "gpio6_dbck", },
2122}; 991};
2123 992
2124static struct omap_hwmod_ocp_if *omap3xxx_gpio6_slaves[] = {
2125 &omap3xxx_l4_per__gpio6,
2126};
2127
2128static struct omap_hwmod omap3xxx_gpio6_hwmod = { 993static struct omap_hwmod omap3xxx_gpio6_hwmod = {
2129 .name = "gpio6", 994 .name = "gpio6",
2130 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 995 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
@@ -2141,20 +1006,10 @@ static struct omap_hwmod omap3xxx_gpio6_hwmod = {
2141 .idlest_idle_bit = OMAP3430_ST_GPIO6_SHIFT, 1006 .idlest_idle_bit = OMAP3430_ST_GPIO6_SHIFT,
2142 }, 1007 },
2143 }, 1008 },
2144 .slaves = omap3xxx_gpio6_slaves,
2145 .slaves_cnt = ARRAY_SIZE(omap3xxx_gpio6_slaves),
2146 .class = &omap3xxx_gpio_hwmod_class, 1009 .class = &omap3xxx_gpio_hwmod_class,
2147 .dev_attr = &gpio_dev_attr, 1010 .dev_attr = &gpio_dev_attr,
2148}; 1011};
2149 1012
2150/* dma_system -> L3 */
2151static struct omap_hwmod_ocp_if omap3xxx_dma_system__l3 = {
2152 .master = &omap3xxx_dma_system_hwmod,
2153 .slave = &omap3xxx_l3_main_hwmod,
2154 .clk = "core_l3_ick",
2155 .user = OCP_USER_MPU | OCP_USER_SDMA,
2156};
2157
2158/* dma attributes */ 1013/* dma attributes */
2159static struct omap_dma_dev_attr dma_dev_attr = { 1014static struct omap_dma_dev_attr dma_dev_attr = {
2160 .dev_caps = RESERVE_CHANNEL | DMA_LINKED_LCH | GLOBAL_PRIORITY | 1015 .dev_caps = RESERVE_CHANNEL | DMA_LINKED_LCH | GLOBAL_PRIORITY |
@@ -2181,34 +1036,6 @@ static struct omap_hwmod_class omap3xxx_dma_hwmod_class = {
2181}; 1036};
2182 1037
2183/* dma_system */ 1038/* dma_system */
2184static struct omap_hwmod_addr_space omap3xxx_dma_system_addrs[] = {
2185 {
2186 .pa_start = 0x48056000,
2187 .pa_end = 0x48056fff,
2188 .flags = ADDR_TYPE_RT
2189 },
2190 { }
2191};
2192
2193/* dma_system master ports */
2194static struct omap_hwmod_ocp_if *omap3xxx_dma_system_masters[] = {
2195 &omap3xxx_dma_system__l3,
2196};
2197
2198/* l4_cfg -> dma_system */
2199static struct omap_hwmod_ocp_if omap3xxx_l4_core__dma_system = {
2200 .master = &omap3xxx_l4_core_hwmod,
2201 .slave = &omap3xxx_dma_system_hwmod,
2202 .clk = "core_l4_ick",
2203 .addr = omap3xxx_dma_system_addrs,
2204 .user = OCP_USER_MPU | OCP_USER_SDMA,
2205};
2206
2207/* dma_system slave ports */
2208static struct omap_hwmod_ocp_if *omap3xxx_dma_system_slaves[] = {
2209 &omap3xxx_l4_core__dma_system,
2210};
2211
2212static struct omap_hwmod omap3xxx_dma_system_hwmod = { 1039static struct omap_hwmod omap3xxx_dma_system_hwmod = {
2213 .name = "dma", 1040 .name = "dma",
2214 .class = &omap3xxx_dma_hwmod_class, 1041 .class = &omap3xxx_dma_hwmod_class,
@@ -2223,10 +1050,6 @@ static struct omap_hwmod omap3xxx_dma_system_hwmod = {
2223 .idlest_idle_bit = OMAP3430_ST_SDMA_SHIFT, 1050 .idlest_idle_bit = OMAP3430_ST_SDMA_SHIFT,
2224 }, 1051 },
2225 }, 1052 },
2226 .slaves = omap3xxx_dma_system_slaves,
2227 .slaves_cnt = ARRAY_SIZE(omap3xxx_dma_system_slaves),
2228 .masters = omap3xxx_dma_system_masters,
2229 .masters_cnt = ARRAY_SIZE(omap3xxx_dma_system_masters),
2230 .dev_attr = &dma_dev_attr, 1053 .dev_attr = &dma_dev_attr,
2231 .flags = HWMOD_NO_IDLEST, 1054 .flags = HWMOD_NO_IDLEST,
2232}; 1055};
@@ -2253,36 +1076,12 @@ static struct omap_hwmod_class omap3xxx_mcbsp_hwmod_class = {
2253 1076
2254/* mcbsp1 */ 1077/* mcbsp1 */
2255static struct omap_hwmod_irq_info omap3xxx_mcbsp1_irqs[] = { 1078static struct omap_hwmod_irq_info omap3xxx_mcbsp1_irqs[] = {
2256 { .name = "irq", .irq = 16 }, 1079 { .name = "common", .irq = 16 },
2257 { .name = "tx", .irq = 59 }, 1080 { .name = "tx", .irq = 59 },
2258 { .name = "rx", .irq = 60 }, 1081 { .name = "rx", .irq = 60 },
2259 { .irq = -1 } 1082 { .irq = -1 }
2260}; 1083};
2261 1084
2262static struct omap_hwmod_addr_space omap3xxx_mcbsp1_addrs[] = {
2263 {
2264 .name = "mpu",
2265 .pa_start = 0x48074000,
2266 .pa_end = 0x480740ff,
2267 .flags = ADDR_TYPE_RT
2268 },
2269 { }
2270};
2271
2272/* l4_core -> mcbsp1 */
2273static struct omap_hwmod_ocp_if omap3xxx_l4_core__mcbsp1 = {
2274 .master = &omap3xxx_l4_core_hwmod,
2275 .slave = &omap3xxx_mcbsp1_hwmod,
2276 .clk = "mcbsp1_ick",
2277 .addr = omap3xxx_mcbsp1_addrs,
2278 .user = OCP_USER_MPU | OCP_USER_SDMA,
2279};
2280
2281/* mcbsp1 slave ports */
2282static struct omap_hwmod_ocp_if *omap3xxx_mcbsp1_slaves[] = {
2283 &omap3xxx_l4_core__mcbsp1,
2284};
2285
2286static struct omap_hwmod omap3xxx_mcbsp1_hwmod = { 1085static struct omap_hwmod omap3xxx_mcbsp1_hwmod = {
2287 .name = "mcbsp1", 1086 .name = "mcbsp1",
2288 .class = &omap3xxx_mcbsp_hwmod_class, 1087 .class = &omap3xxx_mcbsp_hwmod_class,
@@ -2298,42 +1097,16 @@ static struct omap_hwmod omap3xxx_mcbsp1_hwmod = {
2298 .idlest_idle_bit = OMAP3430_ST_MCBSP1_SHIFT, 1097 .idlest_idle_bit = OMAP3430_ST_MCBSP1_SHIFT,
2299 }, 1098 },
2300 }, 1099 },
2301 .slaves = omap3xxx_mcbsp1_slaves,
2302 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp1_slaves),
2303}; 1100};
2304 1101
2305/* mcbsp2 */ 1102/* mcbsp2 */
2306static struct omap_hwmod_irq_info omap3xxx_mcbsp2_irqs[] = { 1103static struct omap_hwmod_irq_info omap3xxx_mcbsp2_irqs[] = {
2307 { .name = "irq", .irq = 17 }, 1104 { .name = "common", .irq = 17 },
2308 { .name = "tx", .irq = 62 }, 1105 { .name = "tx", .irq = 62 },
2309 { .name = "rx", .irq = 63 }, 1106 { .name = "rx", .irq = 63 },
2310 { .irq = -1 } 1107 { .irq = -1 }
2311}; 1108};
2312 1109
2313static struct omap_hwmod_addr_space omap3xxx_mcbsp2_addrs[] = {
2314 {
2315 .name = "mpu",
2316 .pa_start = 0x49022000,
2317 .pa_end = 0x490220ff,
2318 .flags = ADDR_TYPE_RT
2319 },
2320 { }
2321};
2322
2323/* l4_per -> mcbsp2 */
2324static struct omap_hwmod_ocp_if omap3xxx_l4_per__mcbsp2 = {
2325 .master = &omap3xxx_l4_per_hwmod,
2326 .slave = &omap3xxx_mcbsp2_hwmod,
2327 .clk = "mcbsp2_ick",
2328 .addr = omap3xxx_mcbsp2_addrs,
2329 .user = OCP_USER_MPU | OCP_USER_SDMA,
2330};
2331
2332/* mcbsp2 slave ports */
2333static struct omap_hwmod_ocp_if *omap3xxx_mcbsp2_slaves[] = {
2334 &omap3xxx_l4_per__mcbsp2,
2335};
2336
2337static struct omap_mcbsp_dev_attr omap34xx_mcbsp2_dev_attr = { 1110static struct omap_mcbsp_dev_attr omap34xx_mcbsp2_dev_attr = {
2338 .sidetone = "mcbsp2_sidetone", 1111 .sidetone = "mcbsp2_sidetone",
2339}; 1112};
@@ -2353,45 +1126,19 @@ static struct omap_hwmod omap3xxx_mcbsp2_hwmod = {
2353 .idlest_idle_bit = OMAP3430_ST_MCBSP2_SHIFT, 1126 .idlest_idle_bit = OMAP3430_ST_MCBSP2_SHIFT,
2354 }, 1127 },
2355 }, 1128 },
2356 .slaves = omap3xxx_mcbsp2_slaves,
2357 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp2_slaves),
2358 .dev_attr = &omap34xx_mcbsp2_dev_attr, 1129 .dev_attr = &omap34xx_mcbsp2_dev_attr,
2359}; 1130};
2360 1131
2361/* mcbsp3 */ 1132/* mcbsp3 */
2362static struct omap_hwmod_irq_info omap3xxx_mcbsp3_irqs[] = { 1133static struct omap_hwmod_irq_info omap3xxx_mcbsp3_irqs[] = {
2363 { .name = "irq", .irq = 22 }, 1134 { .name = "common", .irq = 22 },
2364 { .name = "tx", .irq = 89 }, 1135 { .name = "tx", .irq = 89 },
2365 { .name = "rx", .irq = 90 }, 1136 { .name = "rx", .irq = 90 },
2366 { .irq = -1 } 1137 { .irq = -1 }
2367}; 1138};
2368 1139
2369static struct omap_hwmod_addr_space omap3xxx_mcbsp3_addrs[] = {
2370 {
2371 .name = "mpu",
2372 .pa_start = 0x49024000,
2373 .pa_end = 0x490240ff,
2374 .flags = ADDR_TYPE_RT
2375 },
2376 { }
2377};
2378
2379/* l4_per -> mcbsp3 */
2380static struct omap_hwmod_ocp_if omap3xxx_l4_per__mcbsp3 = {
2381 .master = &omap3xxx_l4_per_hwmod,
2382 .slave = &omap3xxx_mcbsp3_hwmod,
2383 .clk = "mcbsp3_ick",
2384 .addr = omap3xxx_mcbsp3_addrs,
2385 .user = OCP_USER_MPU | OCP_USER_SDMA,
2386};
2387
2388/* mcbsp3 slave ports */
2389static struct omap_hwmod_ocp_if *omap3xxx_mcbsp3_slaves[] = {
2390 &omap3xxx_l4_per__mcbsp3,
2391};
2392
2393static struct omap_mcbsp_dev_attr omap34xx_mcbsp3_dev_attr = { 1140static struct omap_mcbsp_dev_attr omap34xx_mcbsp3_dev_attr = {
2394 .sidetone = "mcbsp3_sidetone", 1141 .sidetone = "mcbsp3_sidetone",
2395}; 1142};
2396 1143
2397static struct omap_hwmod omap3xxx_mcbsp3_hwmod = { 1144static struct omap_hwmod omap3xxx_mcbsp3_hwmod = {
@@ -2409,14 +1156,12 @@ static struct omap_hwmod omap3xxx_mcbsp3_hwmod = {
2409 .idlest_idle_bit = OMAP3430_ST_MCBSP3_SHIFT, 1156 .idlest_idle_bit = OMAP3430_ST_MCBSP3_SHIFT,
2410 }, 1157 },
2411 }, 1158 },
2412 .slaves = omap3xxx_mcbsp3_slaves,
2413 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp3_slaves),
2414 .dev_attr = &omap34xx_mcbsp3_dev_attr, 1159 .dev_attr = &omap34xx_mcbsp3_dev_attr,
2415}; 1160};
2416 1161
2417/* mcbsp4 */ 1162/* mcbsp4 */
2418static struct omap_hwmod_irq_info omap3xxx_mcbsp4_irqs[] = { 1163static struct omap_hwmod_irq_info omap3xxx_mcbsp4_irqs[] = {
2419 { .name = "irq", .irq = 23 }, 1164 { .name = "common", .irq = 23 },
2420 { .name = "tx", .irq = 54 }, 1165 { .name = "tx", .irq = 54 },
2421 { .name = "rx", .irq = 55 }, 1166 { .name = "rx", .irq = 55 },
2422 { .irq = -1 } 1167 { .irq = -1 }
@@ -2428,30 +1173,6 @@ static struct omap_hwmod_dma_info omap3xxx_mcbsp4_sdma_chs[] = {
2428 { .dma_req = -1 } 1173 { .dma_req = -1 }
2429}; 1174};
2430 1175
2431static struct omap_hwmod_addr_space omap3xxx_mcbsp4_addrs[] = {
2432 {
2433 .name = "mpu",
2434 .pa_start = 0x49026000,
2435 .pa_end = 0x490260ff,
2436 .flags = ADDR_TYPE_RT
2437 },
2438 { }
2439};
2440
2441/* l4_per -> mcbsp4 */
2442static struct omap_hwmod_ocp_if omap3xxx_l4_per__mcbsp4 = {
2443 .master = &omap3xxx_l4_per_hwmod,
2444 .slave = &omap3xxx_mcbsp4_hwmod,
2445 .clk = "mcbsp4_ick",
2446 .addr = omap3xxx_mcbsp4_addrs,
2447 .user = OCP_USER_MPU | OCP_USER_SDMA,
2448};
2449
2450/* mcbsp4 slave ports */
2451static struct omap_hwmod_ocp_if *omap3xxx_mcbsp4_slaves[] = {
2452 &omap3xxx_l4_per__mcbsp4,
2453};
2454
2455static struct omap_hwmod omap3xxx_mcbsp4_hwmod = { 1176static struct omap_hwmod omap3xxx_mcbsp4_hwmod = {
2456 .name = "mcbsp4", 1177 .name = "mcbsp4",
2457 .class = &omap3xxx_mcbsp_hwmod_class, 1178 .class = &omap3xxx_mcbsp_hwmod_class,
@@ -2467,13 +1188,11 @@ static struct omap_hwmod omap3xxx_mcbsp4_hwmod = {
2467 .idlest_idle_bit = OMAP3430_ST_MCBSP4_SHIFT, 1188 .idlest_idle_bit = OMAP3430_ST_MCBSP4_SHIFT,
2468 }, 1189 },
2469 }, 1190 },
2470 .slaves = omap3xxx_mcbsp4_slaves,
2471 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp4_slaves),
2472}; 1191};
2473 1192
2474/* mcbsp5 */ 1193/* mcbsp5 */
2475static struct omap_hwmod_irq_info omap3xxx_mcbsp5_irqs[] = { 1194static struct omap_hwmod_irq_info omap3xxx_mcbsp5_irqs[] = {
2476 { .name = "irq", .irq = 27 }, 1195 { .name = "common", .irq = 27 },
2477 { .name = "tx", .irq = 81 }, 1196 { .name = "tx", .irq = 81 },
2478 { .name = "rx", .irq = 82 }, 1197 { .name = "rx", .irq = 82 },
2479 { .irq = -1 } 1198 { .irq = -1 }
@@ -2485,30 +1204,6 @@ static struct omap_hwmod_dma_info omap3xxx_mcbsp5_sdma_chs[] = {
2485 { .dma_req = -1 } 1204 { .dma_req = -1 }
2486}; 1205};
2487 1206
2488static struct omap_hwmod_addr_space omap3xxx_mcbsp5_addrs[] = {
2489 {
2490 .name = "mpu",
2491 .pa_start = 0x48096000,
2492 .pa_end = 0x480960ff,
2493 .flags = ADDR_TYPE_RT
2494 },
2495 { }
2496};
2497
2498/* l4_core -> mcbsp5 */
2499static struct omap_hwmod_ocp_if omap3xxx_l4_core__mcbsp5 = {
2500 .master = &omap3xxx_l4_core_hwmod,
2501 .slave = &omap3xxx_mcbsp5_hwmod,
2502 .clk = "mcbsp5_ick",
2503 .addr = omap3xxx_mcbsp5_addrs,
2504 .user = OCP_USER_MPU | OCP_USER_SDMA,
2505};
2506
2507/* mcbsp5 slave ports */
2508static struct omap_hwmod_ocp_if *omap3xxx_mcbsp5_slaves[] = {
2509 &omap3xxx_l4_core__mcbsp5,
2510};
2511
2512static struct omap_hwmod omap3xxx_mcbsp5_hwmod = { 1207static struct omap_hwmod omap3xxx_mcbsp5_hwmod = {
2513 .name = "mcbsp5", 1208 .name = "mcbsp5",
2514 .class = &omap3xxx_mcbsp_hwmod_class, 1209 .class = &omap3xxx_mcbsp_hwmod_class,
@@ -2524,11 +1219,9 @@ static struct omap_hwmod omap3xxx_mcbsp5_hwmod = {
2524 .idlest_idle_bit = OMAP3430_ST_MCBSP5_SHIFT, 1219 .idlest_idle_bit = OMAP3430_ST_MCBSP5_SHIFT,
2525 }, 1220 },
2526 }, 1221 },
2527 .slaves = omap3xxx_mcbsp5_slaves,
2528 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp5_slaves),
2529}; 1222};
2530/* 'mcbsp sidetone' class */
2531 1223
1224/* 'mcbsp sidetone' class */
2532static struct omap_hwmod_class_sysconfig omap3xxx_mcbsp_sidetone_sysc = { 1225static struct omap_hwmod_class_sysconfig omap3xxx_mcbsp_sidetone_sysc = {
2533 .sysc_offs = 0x0010, 1226 .sysc_offs = 0x0010,
2534 .sysc_flags = SYSC_HAS_AUTOIDLE, 1227 .sysc_flags = SYSC_HAS_AUTOIDLE,
@@ -2546,30 +1239,6 @@ static struct omap_hwmod_irq_info omap3xxx_mcbsp2_sidetone_irqs[] = {
2546 { .irq = -1 } 1239 { .irq = -1 }
2547}; 1240};
2548 1241
2549static struct omap_hwmod_addr_space omap3xxx_mcbsp2_sidetone_addrs[] = {
2550 {
2551 .name = "sidetone",
2552 .pa_start = 0x49028000,
2553 .pa_end = 0x490280ff,
2554 .flags = ADDR_TYPE_RT
2555 },
2556 { }
2557};
2558
2559/* l4_per -> mcbsp2_sidetone */
2560static struct omap_hwmod_ocp_if omap3xxx_l4_per__mcbsp2_sidetone = {
2561 .master = &omap3xxx_l4_per_hwmod,
2562 .slave = &omap3xxx_mcbsp2_sidetone_hwmod,
2563 .clk = "mcbsp2_ick",
2564 .addr = omap3xxx_mcbsp2_sidetone_addrs,
2565 .user = OCP_USER_MPU,
2566};
2567
2568/* mcbsp2_sidetone slave ports */
2569static struct omap_hwmod_ocp_if *omap3xxx_mcbsp2_sidetone_slaves[] = {
2570 &omap3xxx_l4_per__mcbsp2_sidetone,
2571};
2572
2573static struct omap_hwmod omap3xxx_mcbsp2_sidetone_hwmod = { 1242static struct omap_hwmod omap3xxx_mcbsp2_sidetone_hwmod = {
2574 .name = "mcbsp2_sidetone", 1243 .name = "mcbsp2_sidetone",
2575 .class = &omap3xxx_mcbsp_sidetone_hwmod_class, 1244 .class = &omap3xxx_mcbsp_sidetone_hwmod_class,
@@ -2584,8 +1253,6 @@ static struct omap_hwmod omap3xxx_mcbsp2_sidetone_hwmod = {
2584 .idlest_idle_bit = OMAP3430_ST_MCBSP2_SHIFT, 1253 .idlest_idle_bit = OMAP3430_ST_MCBSP2_SHIFT,
2585 }, 1254 },
2586 }, 1255 },
2587 .slaves = omap3xxx_mcbsp2_sidetone_slaves,
2588 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp2_sidetone_slaves),
2589}; 1256};
2590 1257
2591/* mcbsp3_sidetone */ 1258/* mcbsp3_sidetone */
@@ -2594,30 +1261,6 @@ static struct omap_hwmod_irq_info omap3xxx_mcbsp3_sidetone_irqs[] = {
2594 { .irq = -1 } 1261 { .irq = -1 }
2595}; 1262};
2596 1263
2597static struct omap_hwmod_addr_space omap3xxx_mcbsp3_sidetone_addrs[] = {
2598 {
2599 .name = "sidetone",
2600 .pa_start = 0x4902A000,
2601 .pa_end = 0x4902A0ff,
2602 .flags = ADDR_TYPE_RT
2603 },
2604 { }
2605};
2606
2607/* l4_per -> mcbsp3_sidetone */
2608static struct omap_hwmod_ocp_if omap3xxx_l4_per__mcbsp3_sidetone = {
2609 .master = &omap3xxx_l4_per_hwmod,
2610 .slave = &omap3xxx_mcbsp3_sidetone_hwmod,
2611 .clk = "mcbsp3_ick",
2612 .addr = omap3xxx_mcbsp3_sidetone_addrs,
2613 .user = OCP_USER_MPU,
2614};
2615
2616/* mcbsp3_sidetone slave ports */
2617static struct omap_hwmod_ocp_if *omap3xxx_mcbsp3_sidetone_slaves[] = {
2618 &omap3xxx_l4_per__mcbsp3_sidetone,
2619};
2620
2621static struct omap_hwmod omap3xxx_mcbsp3_sidetone_hwmod = { 1264static struct omap_hwmod omap3xxx_mcbsp3_sidetone_hwmod = {
2622 .name = "mcbsp3_sidetone", 1265 .name = "mcbsp3_sidetone",
2623 .class = &omap3xxx_mcbsp_sidetone_hwmod_class, 1266 .class = &omap3xxx_mcbsp_sidetone_hwmod_class,
@@ -2632,11 +1275,8 @@ static struct omap_hwmod omap3xxx_mcbsp3_sidetone_hwmod = {
2632 .idlest_idle_bit = OMAP3430_ST_MCBSP3_SHIFT, 1275 .idlest_idle_bit = OMAP3430_ST_MCBSP3_SHIFT,
2633 }, 1276 },
2634 }, 1277 },
2635 .slaves = omap3xxx_mcbsp3_sidetone_slaves,
2636 .slaves_cnt = ARRAY_SIZE(omap3xxx_mcbsp3_sidetone_slaves),
2637}; 1278};
2638 1279
2639
2640/* SR common */ 1280/* SR common */
2641static struct omap_hwmod_sysc_fields omap34xx_sr_sysc_fields = { 1281static struct omap_hwmod_sysc_fields omap34xx_sr_sysc_fields = {
2642 .clkact_shift = 20, 1282 .clkact_shift = 20,
@@ -2657,7 +1297,7 @@ static struct omap_hwmod_class omap34xx_smartreflex_hwmod_class = {
2657 1297
2658static struct omap_hwmod_sysc_fields omap36xx_sr_sysc_fields = { 1298static struct omap_hwmod_sysc_fields omap36xx_sr_sysc_fields = {
2659 .sidle_shift = 24, 1299 .sidle_shift = 24,
2660 .enwkup_shift = 26 1300 .enwkup_shift = 26,
2661}; 1301};
2662 1302
2663static struct omap_hwmod_class_sysconfig omap36xx_sr_sysc = { 1303static struct omap_hwmod_class_sysconfig omap36xx_sr_sysc = {
@@ -2679,12 +1319,13 @@ static struct omap_smartreflex_dev_attr sr1_dev_attr = {
2679 .sensor_voltdm_name = "mpu_iva", 1319 .sensor_voltdm_name = "mpu_iva",
2680}; 1320};
2681 1321
2682static struct omap_hwmod_ocp_if *omap3_sr1_slaves[] = { 1322static struct omap_hwmod_irq_info omap3_smartreflex_mpu_irqs[] = {
2683 &omap3_l4_core__sr1, 1323 { .irq = 18 },
1324 { .irq = -1 }
2684}; 1325};
2685 1326
2686static struct omap_hwmod omap34xx_sr1_hwmod = { 1327static struct omap_hwmod omap34xx_sr1_hwmod = {
2687 .name = "sr1_hwmod", 1328 .name = "sr1",
2688 .class = &omap34xx_smartreflex_hwmod_class, 1329 .class = &omap34xx_smartreflex_hwmod_class,
2689 .main_clk = "sr1_fck", 1330 .main_clk = "sr1_fck",
2690 .prcm = { 1331 .prcm = {
@@ -2696,15 +1337,13 @@ static struct omap_hwmod omap34xx_sr1_hwmod = {
2696 .idlest_idle_bit = OMAP3430_EN_SR1_SHIFT, 1337 .idlest_idle_bit = OMAP3430_EN_SR1_SHIFT,
2697 }, 1338 },
2698 }, 1339 },
2699 .slaves = omap3_sr1_slaves,
2700 .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves),
2701 .dev_attr = &sr1_dev_attr, 1340 .dev_attr = &sr1_dev_attr,
2702 .mpu_irqs = omap3_smartreflex_mpu_irqs, 1341 .mpu_irqs = omap3_smartreflex_mpu_irqs,
2703 .flags = HWMOD_SET_DEFAULT_CLOCKACT, 1342 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
2704}; 1343};
2705 1344
2706static struct omap_hwmod omap36xx_sr1_hwmod = { 1345static struct omap_hwmod omap36xx_sr1_hwmod = {
2707 .name = "sr1_hwmod", 1346 .name = "sr1",
2708 .class = &omap36xx_smartreflex_hwmod_class, 1347 .class = &omap36xx_smartreflex_hwmod_class,
2709 .main_clk = "sr1_fck", 1348 .main_clk = "sr1_fck",
2710 .prcm = { 1349 .prcm = {
@@ -2716,8 +1355,6 @@ static struct omap_hwmod omap36xx_sr1_hwmod = {
2716 .idlest_idle_bit = OMAP3430_EN_SR1_SHIFT, 1355 .idlest_idle_bit = OMAP3430_EN_SR1_SHIFT,
2717 }, 1356 },
2718 }, 1357 },
2719 .slaves = omap3_sr1_slaves,
2720 .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves),
2721 .dev_attr = &sr1_dev_attr, 1358 .dev_attr = &sr1_dev_attr,
2722 .mpu_irqs = omap3_smartreflex_mpu_irqs, 1359 .mpu_irqs = omap3_smartreflex_mpu_irqs,
2723}; 1360};
@@ -2727,12 +1364,13 @@ static struct omap_smartreflex_dev_attr sr2_dev_attr = {
2727 .sensor_voltdm_name = "core", 1364 .sensor_voltdm_name = "core",
2728}; 1365};
2729 1366
2730static struct omap_hwmod_ocp_if *omap3_sr2_slaves[] = { 1367static struct omap_hwmod_irq_info omap3_smartreflex_core_irqs[] = {
2731 &omap3_l4_core__sr2, 1368 { .irq = 19 },
1369 { .irq = -1 }
2732}; 1370};
2733 1371
2734static struct omap_hwmod omap34xx_sr2_hwmod = { 1372static struct omap_hwmod omap34xx_sr2_hwmod = {
2735 .name = "sr2_hwmod", 1373 .name = "sr2",
2736 .class = &omap34xx_smartreflex_hwmod_class, 1374 .class = &omap34xx_smartreflex_hwmod_class,
2737 .main_clk = "sr2_fck", 1375 .main_clk = "sr2_fck",
2738 .prcm = { 1376 .prcm = {
@@ -2744,15 +1382,13 @@ static struct omap_hwmod omap34xx_sr2_hwmod = {
2744 .idlest_idle_bit = OMAP3430_EN_SR2_SHIFT, 1382 .idlest_idle_bit = OMAP3430_EN_SR2_SHIFT,
2745 }, 1383 },
2746 }, 1384 },
2747 .slaves = omap3_sr2_slaves,
2748 .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves),
2749 .dev_attr = &sr2_dev_attr, 1385 .dev_attr = &sr2_dev_attr,
2750 .mpu_irqs = omap3_smartreflex_core_irqs, 1386 .mpu_irqs = omap3_smartreflex_core_irqs,
2751 .flags = HWMOD_SET_DEFAULT_CLOCKACT, 1387 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
2752}; 1388};
2753 1389
2754static struct omap_hwmod omap36xx_sr2_hwmod = { 1390static struct omap_hwmod omap36xx_sr2_hwmod = {
2755 .name = "sr2_hwmod", 1391 .name = "sr2",
2756 .class = &omap36xx_smartreflex_hwmod_class, 1392 .class = &omap36xx_smartreflex_hwmod_class,
2757 .main_clk = "sr2_fck", 1393 .main_clk = "sr2_fck",
2758 .prcm = { 1394 .prcm = {
@@ -2764,8 +1400,6 @@ static struct omap_hwmod omap36xx_sr2_hwmod = {
2764 .idlest_idle_bit = OMAP3430_EN_SR2_SHIFT, 1400 .idlest_idle_bit = OMAP3430_EN_SR2_SHIFT,
2765 }, 1401 },
2766 }, 1402 },
2767 .slaves = omap3_sr2_slaves,
2768 .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves),
2769 .dev_attr = &sr2_dev_attr, 1403 .dev_attr = &sr2_dev_attr,
2770 .mpu_irqs = omap3_smartreflex_core_irqs, 1404 .mpu_irqs = omap3_smartreflex_core_irqs,
2771}; 1405};
@@ -2791,34 +1425,11 @@ static struct omap_hwmod_class omap3xxx_mailbox_hwmod_class = {
2791 .sysc = &omap3xxx_mailbox_sysc, 1425 .sysc = &omap3xxx_mailbox_sysc,
2792}; 1426};
2793 1427
2794static struct omap_hwmod omap3xxx_mailbox_hwmod;
2795static struct omap_hwmod_irq_info omap3xxx_mailbox_irqs[] = { 1428static struct omap_hwmod_irq_info omap3xxx_mailbox_irqs[] = {
2796 { .irq = 26 }, 1429 { .irq = 26 },
2797 { .irq = -1 } 1430 { .irq = -1 }
2798}; 1431};
2799 1432
2800static struct omap_hwmod_addr_space omap3xxx_mailbox_addrs[] = {
2801 {
2802 .pa_start = 0x48094000,
2803 .pa_end = 0x480941ff,
2804 .flags = ADDR_TYPE_RT,
2805 },
2806 { }
2807};
2808
2809/* l4_core -> mailbox */
2810static struct omap_hwmod_ocp_if omap3xxx_l4_core__mailbox = {
2811 .master = &omap3xxx_l4_core_hwmod,
2812 .slave = &omap3xxx_mailbox_hwmod,
2813 .addr = omap3xxx_mailbox_addrs,
2814 .user = OCP_USER_MPU | OCP_USER_SDMA,
2815};
2816
2817/* mailbox slave ports */
2818static struct omap_hwmod_ocp_if *omap3xxx_mailbox_slaves[] = {
2819 &omap3xxx_l4_core__mailbox,
2820};
2821
2822static struct omap_hwmod omap3xxx_mailbox_hwmod = { 1433static struct omap_hwmod omap3xxx_mailbox_hwmod = {
2823 .name = "mailbox", 1434 .name = "mailbox",
2824 .class = &omap3xxx_mailbox_hwmod_class, 1435 .class = &omap3xxx_mailbox_hwmod_class,
@@ -2833,53 +1444,6 @@ static struct omap_hwmod omap3xxx_mailbox_hwmod = {
2833 .idlest_idle_bit = OMAP3430_ST_MAILBOXES_SHIFT, 1444 .idlest_idle_bit = OMAP3430_ST_MAILBOXES_SHIFT,
2834 }, 1445 },
2835 }, 1446 },
2836 .slaves = omap3xxx_mailbox_slaves,
2837 .slaves_cnt = ARRAY_SIZE(omap3xxx_mailbox_slaves),
2838};
2839
2840/* l4 core -> mcspi1 interface */
2841static struct omap_hwmod_ocp_if omap34xx_l4_core__mcspi1 = {
2842 .master = &omap3xxx_l4_core_hwmod,
2843 .slave = &omap34xx_mcspi1,
2844 .clk = "mcspi1_ick",
2845 .addr = omap2_mcspi1_addr_space,
2846 .user = OCP_USER_MPU | OCP_USER_SDMA,
2847};
2848
2849/* l4 core -> mcspi2 interface */
2850static struct omap_hwmod_ocp_if omap34xx_l4_core__mcspi2 = {
2851 .master = &omap3xxx_l4_core_hwmod,
2852 .slave = &omap34xx_mcspi2,
2853 .clk = "mcspi2_ick",
2854 .addr = omap2_mcspi2_addr_space,
2855 .user = OCP_USER_MPU | OCP_USER_SDMA,
2856};
2857
2858/* l4 core -> mcspi3 interface */
2859static struct omap_hwmod_ocp_if omap34xx_l4_core__mcspi3 = {
2860 .master = &omap3xxx_l4_core_hwmod,
2861 .slave = &omap34xx_mcspi3,
2862 .clk = "mcspi3_ick",
2863 .addr = omap2430_mcspi3_addr_space,
2864 .user = OCP_USER_MPU | OCP_USER_SDMA,
2865};
2866
2867/* l4 core -> mcspi4 interface */
2868static struct omap_hwmod_addr_space omap34xx_mcspi4_addr_space[] = {
2869 {
2870 .pa_start = 0x480ba000,
2871 .pa_end = 0x480ba0ff,
2872 .flags = ADDR_TYPE_RT,
2873 },
2874 { }
2875};
2876
2877static struct omap_hwmod_ocp_if omap34xx_l4_core__mcspi4 = {
2878 .master = &omap3xxx_l4_core_hwmod,
2879 .slave = &omap34xx_mcspi4,
2880 .clk = "mcspi4_ick",
2881 .addr = omap34xx_mcspi4_addr_space,
2882 .user = OCP_USER_MPU | OCP_USER_SDMA,
2883}; 1447};
2884 1448
2885/* 1449/*
@@ -2906,10 +1470,6 @@ static struct omap_hwmod_class omap34xx_mcspi_class = {
2906}; 1470};
2907 1471
2908/* mcspi1 */ 1472/* mcspi1 */
2909static struct omap_hwmod_ocp_if *omap34xx_mcspi1_slaves[] = {
2910 &omap34xx_l4_core__mcspi1,
2911};
2912
2913static struct omap2_mcspi_dev_attr omap_mcspi1_dev_attr = { 1473static struct omap2_mcspi_dev_attr omap_mcspi1_dev_attr = {
2914 .num_chipselect = 4, 1474 .num_chipselect = 4,
2915}; 1475};
@@ -2928,17 +1488,11 @@ static struct omap_hwmod omap34xx_mcspi1 = {
2928 .idlest_idle_bit = OMAP3430_ST_MCSPI1_SHIFT, 1488 .idlest_idle_bit = OMAP3430_ST_MCSPI1_SHIFT,
2929 }, 1489 },
2930 }, 1490 },
2931 .slaves = omap34xx_mcspi1_slaves,
2932 .slaves_cnt = ARRAY_SIZE(omap34xx_mcspi1_slaves),
2933 .class = &omap34xx_mcspi_class, 1491 .class = &omap34xx_mcspi_class,
2934 .dev_attr = &omap_mcspi1_dev_attr, 1492 .dev_attr = &omap_mcspi1_dev_attr,
2935}; 1493};
2936 1494
2937/* mcspi2 */ 1495/* mcspi2 */
2938static struct omap_hwmod_ocp_if *omap34xx_mcspi2_slaves[] = {
2939 &omap34xx_l4_core__mcspi2,
2940};
2941
2942static struct omap2_mcspi_dev_attr omap_mcspi2_dev_attr = { 1496static struct omap2_mcspi_dev_attr omap_mcspi2_dev_attr = {
2943 .num_chipselect = 2, 1497 .num_chipselect = 2,
2944}; 1498};
@@ -2957,8 +1511,6 @@ static struct omap_hwmod omap34xx_mcspi2 = {
2957 .idlest_idle_bit = OMAP3430_ST_MCSPI2_SHIFT, 1511 .idlest_idle_bit = OMAP3430_ST_MCSPI2_SHIFT,
2958 }, 1512 },
2959 }, 1513 },
2960 .slaves = omap34xx_mcspi2_slaves,
2961 .slaves_cnt = ARRAY_SIZE(omap34xx_mcspi2_slaves),
2962 .class = &omap34xx_mcspi_class, 1514 .class = &omap34xx_mcspi_class,
2963 .dev_attr = &omap_mcspi2_dev_attr, 1515 .dev_attr = &omap_mcspi2_dev_attr,
2964}; 1516};
@@ -2977,10 +1529,6 @@ static struct omap_hwmod_dma_info omap34xx_mcspi3_sdma_reqs[] = {
2977 { .dma_req = -1 } 1529 { .dma_req = -1 }
2978}; 1530};
2979 1531
2980static struct omap_hwmod_ocp_if *omap34xx_mcspi3_slaves[] = {
2981 &omap34xx_l4_core__mcspi3,
2982};
2983
2984static struct omap2_mcspi_dev_attr omap_mcspi3_dev_attr = { 1532static struct omap2_mcspi_dev_attr omap_mcspi3_dev_attr = {
2985 .num_chipselect = 2, 1533 .num_chipselect = 2,
2986}; 1534};
@@ -2999,13 +1547,11 @@ static struct omap_hwmod omap34xx_mcspi3 = {
2999 .idlest_idle_bit = OMAP3430_ST_MCSPI3_SHIFT, 1547 .idlest_idle_bit = OMAP3430_ST_MCSPI3_SHIFT,
3000 }, 1548 },
3001 }, 1549 },
3002 .slaves = omap34xx_mcspi3_slaves,
3003 .slaves_cnt = ARRAY_SIZE(omap34xx_mcspi3_slaves),
3004 .class = &omap34xx_mcspi_class, 1550 .class = &omap34xx_mcspi_class,
3005 .dev_attr = &omap_mcspi3_dev_attr, 1551 .dev_attr = &omap_mcspi3_dev_attr,
3006}; 1552};
3007 1553
3008/* SPI4 */ 1554/* mcspi4 */
3009static struct omap_hwmod_irq_info omap34xx_mcspi4_mpu_irqs[] = { 1555static struct omap_hwmod_irq_info omap34xx_mcspi4_mpu_irqs[] = {
3010 { .name = "irq", .irq = INT_34XX_SPI4_IRQ }, /* 48 */ 1556 { .name = "irq", .irq = INT_34XX_SPI4_IRQ }, /* 48 */
3011 { .irq = -1 } 1557 { .irq = -1 }
@@ -3017,10 +1563,6 @@ static struct omap_hwmod_dma_info omap34xx_mcspi4_sdma_reqs[] = {
3017 { .dma_req = -1 } 1563 { .dma_req = -1 }
3018}; 1564};
3019 1565
3020static struct omap_hwmod_ocp_if *omap34xx_mcspi4_slaves[] = {
3021 &omap34xx_l4_core__mcspi4,
3022};
3023
3024static struct omap2_mcspi_dev_attr omap_mcspi4_dev_attr = { 1566static struct omap2_mcspi_dev_attr omap_mcspi4_dev_attr = {
3025 .num_chipselect = 1, 1567 .num_chipselect = 1,
3026}; 1568};
@@ -3039,15 +1581,11 @@ static struct omap_hwmod omap34xx_mcspi4 = {
3039 .idlest_idle_bit = OMAP3430_ST_MCSPI4_SHIFT, 1581 .idlest_idle_bit = OMAP3430_ST_MCSPI4_SHIFT,
3040 }, 1582 },
3041 }, 1583 },
3042 .slaves = omap34xx_mcspi4_slaves,
3043 .slaves_cnt = ARRAY_SIZE(omap34xx_mcspi4_slaves),
3044 .class = &omap34xx_mcspi_class, 1584 .class = &omap34xx_mcspi_class,
3045 .dev_attr = &omap_mcspi4_dev_attr, 1585 .dev_attr = &omap_mcspi4_dev_attr,
3046}; 1586};
3047 1587
3048/* 1588/* usbhsotg */
3049 * usbhsotg
3050 */
3051static struct omap_hwmod_class_sysconfig omap3xxx_usbhsotg_sysc = { 1589static struct omap_hwmod_class_sysconfig omap3xxx_usbhsotg_sysc = {
3052 .rev_offs = 0x0400, 1590 .rev_offs = 0x0400,
3053 .sysc_offs = 0x0404, 1591 .sysc_offs = 0x0404,
@@ -3064,6 +1602,7 @@ static struct omap_hwmod_class usbotg_class = {
3064 .name = "usbotg", 1602 .name = "usbotg",
3065 .sysc = &omap3xxx_usbhsotg_sysc, 1603 .sysc = &omap3xxx_usbhsotg_sysc,
3066}; 1604};
1605
3067/* usb_otg_hs */ 1606/* usb_otg_hs */
3068static struct omap_hwmod_irq_info omap3xxx_usbhsotg_mpu_irqs[] = { 1607static struct omap_hwmod_irq_info omap3xxx_usbhsotg_mpu_irqs[] = {
3069 1608
@@ -3086,10 +1625,6 @@ static struct omap_hwmod omap3xxx_usbhsotg_hwmod = {
3086 .idlest_stdby_bit = OMAP3430ES2_ST_HSOTGUSB_STDBY_SHIFT 1625 .idlest_stdby_bit = OMAP3430ES2_ST_HSOTGUSB_STDBY_SHIFT
3087 }, 1626 },
3088 }, 1627 },
3089 .masters = omap3xxx_usbhsotg_masters,
3090 .masters_cnt = ARRAY_SIZE(omap3xxx_usbhsotg_masters),
3091 .slaves = omap3xxx_usbhsotg_slaves,
3092 .slaves_cnt = ARRAY_SIZE(omap3xxx_usbhsotg_slaves),
3093 .class = &usbotg_class, 1628 .class = &usbotg_class,
3094 1629
3095 /* 1630 /*
@@ -3121,15 +1656,10 @@ static struct omap_hwmod am35xx_usbhsotg_hwmod = {
3121 .omap2 = { 1656 .omap2 = {
3122 }, 1657 },
3123 }, 1658 },
3124 .masters = am35xx_usbhsotg_masters,
3125 .masters_cnt = ARRAY_SIZE(am35xx_usbhsotg_masters),
3126 .slaves = am35xx_usbhsotg_slaves,
3127 .slaves_cnt = ARRAY_SIZE(am35xx_usbhsotg_slaves),
3128 .class = &am35xx_usbotg_class, 1659 .class = &am35xx_usbotg_class,
3129}; 1660};
3130 1661
3131/* MMC/SD/SDIO common */ 1662/* MMC/SD/SDIO common */
3132
3133static struct omap_hwmod_class_sysconfig omap34xx_mmc_sysc = { 1663static struct omap_hwmod_class_sysconfig omap34xx_mmc_sysc = {
3134 .rev_offs = 0x1fc, 1664 .rev_offs = 0x1fc,
3135 .sysc_offs = 0x10, 1665 .sysc_offs = 0x10,
@@ -3163,10 +1693,6 @@ static struct omap_hwmod_opt_clk omap34xx_mmc1_opt_clks[] = {
3163 { .role = "dbck", .clk = "omap_32k_fck", }, 1693 { .role = "dbck", .clk = "omap_32k_fck", },
3164}; 1694};
3165 1695
3166static struct omap_hwmod_ocp_if *omap3xxx_mmc1_slaves[] = {
3167 &omap3xxx_l4_core__mmc1,
3168};
3169
3170static struct omap_mmc_dev_attr mmc1_dev_attr = { 1696static struct omap_mmc_dev_attr mmc1_dev_attr = {
3171 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, 1697 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
3172}; 1698};
@@ -3194,8 +1720,6 @@ static struct omap_hwmod omap3xxx_pre_es3_mmc1_hwmod = {
3194 }, 1720 },
3195 }, 1721 },
3196 .dev_attr = &mmc1_pre_es3_dev_attr, 1722 .dev_attr = &mmc1_pre_es3_dev_attr,
3197 .slaves = omap3xxx_mmc1_slaves,
3198 .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc1_slaves),
3199 .class = &omap34xx_mmc_class, 1723 .class = &omap34xx_mmc_class,
3200}; 1724};
3201 1725
@@ -3216,8 +1740,6 @@ static struct omap_hwmod omap3xxx_es3plus_mmc1_hwmod = {
3216 }, 1740 },
3217 }, 1741 },
3218 .dev_attr = &mmc1_dev_attr, 1742 .dev_attr = &mmc1_dev_attr,
3219 .slaves = omap3xxx_mmc1_slaves,
3220 .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc1_slaves),
3221 .class = &omap34xx_mmc_class, 1743 .class = &omap34xx_mmc_class,
3222}; 1744};
3223 1745
@@ -3238,10 +1760,6 @@ static struct omap_hwmod_opt_clk omap34xx_mmc2_opt_clks[] = {
3238 { .role = "dbck", .clk = "omap_32k_fck", }, 1760 { .role = "dbck", .clk = "omap_32k_fck", },
3239}; 1761};
3240 1762
3241static struct omap_hwmod_ocp_if *omap3xxx_mmc2_slaves[] = {
3242 &omap3xxx_l4_core__mmc2,
3243};
3244
3245/* See 35xx errata 2.1.1.128 in SPRZ278F */ 1763/* See 35xx errata 2.1.1.128 in SPRZ278F */
3246static struct omap_mmc_dev_attr mmc2_pre_es3_dev_attr = { 1764static struct omap_mmc_dev_attr mmc2_pre_es3_dev_attr = {
3247 .flags = OMAP_HSMMC_BROKEN_MULTIBLOCK_READ, 1765 .flags = OMAP_HSMMC_BROKEN_MULTIBLOCK_READ,
@@ -3264,8 +1782,6 @@ static struct omap_hwmod omap3xxx_pre_es3_mmc2_hwmod = {
3264 }, 1782 },
3265 }, 1783 },
3266 .dev_attr = &mmc2_pre_es3_dev_attr, 1784 .dev_attr = &mmc2_pre_es3_dev_attr,
3267 .slaves = omap3xxx_mmc2_slaves,
3268 .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc2_slaves),
3269 .class = &omap34xx_mmc_class, 1785 .class = &omap34xx_mmc_class,
3270}; 1786};
3271 1787
@@ -3285,8 +1801,6 @@ static struct omap_hwmod omap3xxx_es3plus_mmc2_hwmod = {
3285 .idlest_idle_bit = OMAP3430_ST_MMC2_SHIFT, 1801 .idlest_idle_bit = OMAP3430_ST_MMC2_SHIFT,
3286 }, 1802 },
3287 }, 1803 },
3288 .slaves = omap3xxx_mmc2_slaves,
3289 .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc2_slaves),
3290 .class = &omap34xx_mmc_class, 1804 .class = &omap34xx_mmc_class,
3291}; 1805};
3292 1806
@@ -3307,10 +1821,6 @@ static struct omap_hwmod_opt_clk omap34xx_mmc3_opt_clks[] = {
3307 { .role = "dbck", .clk = "omap_32k_fck", }, 1821 { .role = "dbck", .clk = "omap_32k_fck", },
3308}; 1822};
3309 1823
3310static struct omap_hwmod_ocp_if *omap3xxx_mmc3_slaves[] = {
3311 &omap3xxx_l4_core__mmc3,
3312};
3313
3314static struct omap_hwmod omap3xxx_mmc3_hwmod = { 1824static struct omap_hwmod omap3xxx_mmc3_hwmod = {
3315 .name = "mmc3", 1825 .name = "mmc3",
3316 .mpu_irqs = omap34xx_mmc3_mpu_irqs, 1826 .mpu_irqs = omap34xx_mmc3_mpu_irqs,
@@ -3326,8 +1836,6 @@ static struct omap_hwmod omap3xxx_mmc3_hwmod = {
3326 .idlest_idle_bit = OMAP3430_ST_MMC3_SHIFT, 1836 .idlest_idle_bit = OMAP3430_ST_MMC3_SHIFT,
3327 }, 1837 },
3328 }, 1838 },
3329 .slaves = omap3xxx_mmc3_slaves,
3330 .slaves_cnt = ARRAY_SIZE(omap3xxx_mmc3_slaves),
3331 .class = &omap34xx_mmc_class, 1839 .class = &omap34xx_mmc_class,
3332}; 1840};
3333 1841
@@ -3335,12 +1843,6 @@ static struct omap_hwmod omap3xxx_mmc3_hwmod = {
3335 * 'usb_host_hs' class 1843 * 'usb_host_hs' class
3336 * high-speed multi-port usb host controller 1844 * high-speed multi-port usb host controller
3337 */ 1845 */
3338static struct omap_hwmod_ocp_if omap3xxx_usb_host_hs__l3_main_2 = {
3339 .master = &omap3xxx_usb_host_hs_hwmod,
3340 .slave = &omap3xxx_l3_main_hwmod,
3341 .clk = "core_l3_ick",
3342 .user = OCP_USER_MPU,
3343};
3344 1846
3345static struct omap_hwmod_class_sysconfig omap3xxx_usb_host_hs_sysc = { 1847static struct omap_hwmod_class_sysconfig omap3xxx_usb_host_hs_sysc = {
3346 .rev_offs = 0x0000, 1848 .rev_offs = 0x0000,
@@ -3359,42 +1861,6 @@ static struct omap_hwmod_class omap3xxx_usb_host_hs_hwmod_class = {
3359 .sysc = &omap3xxx_usb_host_hs_sysc, 1861 .sysc = &omap3xxx_usb_host_hs_sysc,
3360}; 1862};
3361 1863
3362static struct omap_hwmod_ocp_if *omap3xxx_usb_host_hs_masters[] = {
3363 &omap3xxx_usb_host_hs__l3_main_2,
3364};
3365
3366static struct omap_hwmod_addr_space omap3xxx_usb_host_hs_addrs[] = {
3367 {
3368 .name = "uhh",
3369 .pa_start = 0x48064000,
3370 .pa_end = 0x480643ff,
3371 .flags = ADDR_TYPE_RT
3372 },
3373 {
3374 .name = "ohci",
3375 .pa_start = 0x48064400,
3376 .pa_end = 0x480647ff,
3377 },
3378 {
3379 .name = "ehci",
3380 .pa_start = 0x48064800,
3381 .pa_end = 0x48064cff,
3382 },
3383 {}
3384};
3385
3386static struct omap_hwmod_ocp_if omap3xxx_l4_core__usb_host_hs = {
3387 .master = &omap3xxx_l4_core_hwmod,
3388 .slave = &omap3xxx_usb_host_hs_hwmod,
3389 .clk = "usbhost_ick",
3390 .addr = omap3xxx_usb_host_hs_addrs,
3391 .user = OCP_USER_MPU | OCP_USER_SDMA,
3392};
3393
3394static struct omap_hwmod_ocp_if *omap3xxx_usb_host_hs_slaves[] = {
3395 &omap3xxx_l4_core__usb_host_hs,
3396};
3397
3398static struct omap_hwmod_opt_clk omap3xxx_usb_host_hs_opt_clks[] = { 1864static struct omap_hwmod_opt_clk omap3xxx_usb_host_hs_opt_clks[] = {
3399 { .role = "ehci_logic_fck", .clk = "usbhost_120m_fck", }, 1865 { .role = "ehci_logic_fck", .clk = "usbhost_120m_fck", },
3400}; 1866};
@@ -3423,10 +1889,6 @@ static struct omap_hwmod omap3xxx_usb_host_hs_hwmod = {
3423 }, 1889 },
3424 .opt_clks = omap3xxx_usb_host_hs_opt_clks, 1890 .opt_clks = omap3xxx_usb_host_hs_opt_clks,
3425 .opt_clks_cnt = ARRAY_SIZE(omap3xxx_usb_host_hs_opt_clks), 1891 .opt_clks_cnt = ARRAY_SIZE(omap3xxx_usb_host_hs_opt_clks),
3426 .slaves = omap3xxx_usb_host_hs_slaves,
3427 .slaves_cnt = ARRAY_SIZE(omap3xxx_usb_host_hs_slaves),
3428 .masters = omap3xxx_usb_host_hs_masters,
3429 .masters_cnt = ARRAY_SIZE(omap3xxx_usb_host_hs_masters),
3430 1892
3431 /* 1893 /*
3432 * Errata: USBHOST Configured In Smart-Idle Can Lead To a Deadlock 1894 * Errata: USBHOST Configured In Smart-Idle Can Lead To a Deadlock
@@ -3502,6 +1964,1134 @@ static struct omap_hwmod_irq_info omap3xxx_usb_tll_hs_irqs[] = {
3502 { .irq = -1 } 1964 { .irq = -1 }
3503}; 1965};
3504 1966
1967static struct omap_hwmod omap3xxx_usb_tll_hs_hwmod = {
1968 .name = "usb_tll_hs",
1969 .class = &omap3xxx_usb_tll_hs_hwmod_class,
1970 .clkdm_name = "l3_init_clkdm",
1971 .mpu_irqs = omap3xxx_usb_tll_hs_irqs,
1972 .main_clk = "usbtll_fck",
1973 .prcm = {
1974 .omap2 = {
1975 .module_offs = CORE_MOD,
1976 .prcm_reg_id = 3,
1977 .module_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
1978 .idlest_reg_id = 3,
1979 .idlest_idle_bit = OMAP3430ES2_ST_USBTLL_SHIFT,
1980 },
1981 },
1982};
1983
1984static struct omap_hwmod omap3xxx_hdq1w_hwmod = {
1985 .name = "hdq1w",
1986 .mpu_irqs = omap2_hdq1w_mpu_irqs,
1987 .main_clk = "hdq_fck",
1988 .prcm = {
1989 .omap2 = {
1990 .module_offs = CORE_MOD,
1991 .prcm_reg_id = 1,
1992 .module_bit = OMAP3430_EN_HDQ_SHIFT,
1993 .idlest_reg_id = 1,
1994 .idlest_idle_bit = OMAP3430_ST_HDQ_SHIFT,
1995 },
1996 },
1997 .class = &omap2_hdq1w_class,
1998};
1999
2000/*
2001 * '32K sync counter' class
2002 * 32-bit ordinary counter, clocked by the falling edge of the 32 khz clock
2003 */
2004static struct omap_hwmod_class_sysconfig omap3xxx_counter_sysc = {
2005 .rev_offs = 0x0000,
2006 .sysc_offs = 0x0004,
2007 .sysc_flags = SYSC_HAS_SIDLEMODE,
2008 .idlemodes = (SIDLE_FORCE | SIDLE_NO),
2009 .sysc_fields = &omap_hwmod_sysc_type1,
2010};
2011
2012static struct omap_hwmod_class omap3xxx_counter_hwmod_class = {
2013 .name = "counter",
2014 .sysc = &omap3xxx_counter_sysc,
2015};
2016
2017static struct omap_hwmod omap3xxx_counter_32k_hwmod = {
2018 .name = "counter_32k",
2019 .class = &omap3xxx_counter_hwmod_class,
2020 .clkdm_name = "wkup_clkdm",
2021 .flags = HWMOD_SWSUP_SIDLE,
2022 .main_clk = "wkup_32k_fck",
2023 .prcm = {
2024 .omap2 = {
2025 .module_offs = WKUP_MOD,
2026 .prcm_reg_id = 1,
2027 .module_bit = OMAP3430_ST_32KSYNC_SHIFT,
2028 .idlest_reg_id = 1,
2029 .idlest_idle_bit = OMAP3430_ST_32KSYNC_SHIFT,
2030 },
2031 },
2032};
2033
2034/*
2035 * interfaces
2036 */
2037
2038/* L3 -> L4_CORE interface */
2039static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = {
2040 .master = &omap3xxx_l3_main_hwmod,
2041 .slave = &omap3xxx_l4_core_hwmod,
2042 .user = OCP_USER_MPU | OCP_USER_SDMA,
2043};
2044
2045/* L3 -> L4_PER interface */
2046static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_per = {
2047 .master = &omap3xxx_l3_main_hwmod,
2048 .slave = &omap3xxx_l4_per_hwmod,
2049 .user = OCP_USER_MPU | OCP_USER_SDMA,
2050};
2051
2052static struct omap_hwmod_addr_space omap3xxx_l3_main_addrs[] = {
2053 {
2054 .pa_start = 0x68000000,
2055 .pa_end = 0x6800ffff,
2056 .flags = ADDR_TYPE_RT,
2057 },
2058 { }
2059};
2060
2061/* MPU -> L3 interface */
2062static struct omap_hwmod_ocp_if omap3xxx_mpu__l3_main = {
2063 .master = &omap3xxx_mpu_hwmod,
2064 .slave = &omap3xxx_l3_main_hwmod,
2065 .addr = omap3xxx_l3_main_addrs,
2066 .user = OCP_USER_MPU,
2067};
2068
2069/* DSS -> l3 */
2070static struct omap_hwmod_ocp_if omap3430es1_dss__l3 = {
2071 .master = &omap3430es1_dss_core_hwmod,
2072 .slave = &omap3xxx_l3_main_hwmod,
2073 .user = OCP_USER_MPU | OCP_USER_SDMA,
2074};
2075
2076static struct omap_hwmod_ocp_if omap3xxx_dss__l3 = {
2077 .master = &omap3xxx_dss_core_hwmod,
2078 .slave = &omap3xxx_l3_main_hwmod,
2079 .fw = {
2080 .omap2 = {
2081 .l3_perm_bit = OMAP3_L3_CORE_FW_INIT_ID_DSS,
2082 .flags = OMAP_FIREWALL_L3,
2083 }
2084 },
2085 .user = OCP_USER_MPU | OCP_USER_SDMA,
2086};
2087
2088/* l3_core -> usbhsotg interface */
2089static struct omap_hwmod_ocp_if omap3xxx_usbhsotg__l3 = {
2090 .master = &omap3xxx_usbhsotg_hwmod,
2091 .slave = &omap3xxx_l3_main_hwmod,
2092 .clk = "core_l3_ick",
2093 .user = OCP_USER_MPU,
2094};
2095
2096/* l3_core -> am35xx_usbhsotg interface */
2097static struct omap_hwmod_ocp_if am35xx_usbhsotg__l3 = {
2098 .master = &am35xx_usbhsotg_hwmod,
2099 .slave = &omap3xxx_l3_main_hwmod,
2100 .clk = "core_l3_ick",
2101 .user = OCP_USER_MPU,
2102};
2103/* L4_CORE -> L4_WKUP interface */
2104static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = {
2105 .master = &omap3xxx_l4_core_hwmod,
2106 .slave = &omap3xxx_l4_wkup_hwmod,
2107 .user = OCP_USER_MPU | OCP_USER_SDMA,
2108};
2109
2110/* L4 CORE -> MMC1 interface */
2111static struct omap_hwmod_ocp_if omap3xxx_l4_core__pre_es3_mmc1 = {
2112 .master = &omap3xxx_l4_core_hwmod,
2113 .slave = &omap3xxx_pre_es3_mmc1_hwmod,
2114 .clk = "mmchs1_ick",
2115 .addr = omap2430_mmc1_addr_space,
2116 .user = OCP_USER_MPU | OCP_USER_SDMA,
2117 .flags = OMAP_FIREWALL_L4
2118};
2119
2120static struct omap_hwmod_ocp_if omap3xxx_l4_core__es3plus_mmc1 = {
2121 .master = &omap3xxx_l4_core_hwmod,
2122 .slave = &omap3xxx_es3plus_mmc1_hwmod,
2123 .clk = "mmchs1_ick",
2124 .addr = omap2430_mmc1_addr_space,
2125 .user = OCP_USER_MPU | OCP_USER_SDMA,
2126 .flags = OMAP_FIREWALL_L4
2127};
2128
2129/* L4 CORE -> MMC2 interface */
2130static struct omap_hwmod_ocp_if omap3xxx_l4_core__pre_es3_mmc2 = {
2131 .master = &omap3xxx_l4_core_hwmod,
2132 .slave = &omap3xxx_pre_es3_mmc2_hwmod,
2133 .clk = "mmchs2_ick",
2134 .addr = omap2430_mmc2_addr_space,
2135 .user = OCP_USER_MPU | OCP_USER_SDMA,
2136 .flags = OMAP_FIREWALL_L4
2137};
2138
2139static struct omap_hwmod_ocp_if omap3xxx_l4_core__es3plus_mmc2 = {
2140 .master = &omap3xxx_l4_core_hwmod,
2141 .slave = &omap3xxx_es3plus_mmc2_hwmod,
2142 .clk = "mmchs2_ick",
2143 .addr = omap2430_mmc2_addr_space,
2144 .user = OCP_USER_MPU | OCP_USER_SDMA,
2145 .flags = OMAP_FIREWALL_L4
2146};
2147
2148/* L4 CORE -> MMC3 interface */
2149static struct omap_hwmod_addr_space omap3xxx_mmc3_addr_space[] = {
2150 {
2151 .pa_start = 0x480ad000,
2152 .pa_end = 0x480ad1ff,
2153 .flags = ADDR_TYPE_RT,
2154 },
2155 { }
2156};
2157
2158static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = {
2159 .master = &omap3xxx_l4_core_hwmod,
2160 .slave = &omap3xxx_mmc3_hwmod,
2161 .clk = "mmchs3_ick",
2162 .addr = omap3xxx_mmc3_addr_space,
2163 .user = OCP_USER_MPU | OCP_USER_SDMA,
2164 .flags = OMAP_FIREWALL_L4
2165};
2166
2167/* L4 CORE -> UART1 interface */
2168static struct omap_hwmod_addr_space omap3xxx_uart1_addr_space[] = {
2169 {
2170 .pa_start = OMAP3_UART1_BASE,
2171 .pa_end = OMAP3_UART1_BASE + SZ_8K - 1,
2172 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
2173 },
2174 { }
2175};
2176
2177static struct omap_hwmod_ocp_if omap3_l4_core__uart1 = {
2178 .master = &omap3xxx_l4_core_hwmod,
2179 .slave = &omap3xxx_uart1_hwmod,
2180 .clk = "uart1_ick",
2181 .addr = omap3xxx_uart1_addr_space,
2182 .user = OCP_USER_MPU | OCP_USER_SDMA,
2183};
2184
2185/* L4 CORE -> UART2 interface */
2186static struct omap_hwmod_addr_space omap3xxx_uart2_addr_space[] = {
2187 {
2188 .pa_start = OMAP3_UART2_BASE,
2189 .pa_end = OMAP3_UART2_BASE + SZ_1K - 1,
2190 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
2191 },
2192 { }
2193};
2194
2195static struct omap_hwmod_ocp_if omap3_l4_core__uart2 = {
2196 .master = &omap3xxx_l4_core_hwmod,
2197 .slave = &omap3xxx_uart2_hwmod,
2198 .clk = "uart2_ick",
2199 .addr = omap3xxx_uart2_addr_space,
2200 .user = OCP_USER_MPU | OCP_USER_SDMA,
2201};
2202
2203/* L4 PER -> UART3 interface */
2204static struct omap_hwmod_addr_space omap3xxx_uart3_addr_space[] = {
2205 {
2206 .pa_start = OMAP3_UART3_BASE,
2207 .pa_end = OMAP3_UART3_BASE + SZ_1K - 1,
2208 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
2209 },
2210 { }
2211};
2212
2213static struct omap_hwmod_ocp_if omap3_l4_per__uart3 = {
2214 .master = &omap3xxx_l4_per_hwmod,
2215 .slave = &omap3xxx_uart3_hwmod,
2216 .clk = "uart3_ick",
2217 .addr = omap3xxx_uart3_addr_space,
2218 .user = OCP_USER_MPU | OCP_USER_SDMA,
2219};
2220
2221/* L4 PER -> UART4 interface */
2222static struct omap_hwmod_addr_space omap36xx_uart4_addr_space[] = {
2223 {
2224 .pa_start = OMAP3_UART4_BASE,
2225 .pa_end = OMAP3_UART4_BASE + SZ_1K - 1,
2226 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
2227 },
2228 { }
2229};
2230
2231static struct omap_hwmod_ocp_if omap36xx_l4_per__uart4 = {
2232 .master = &omap3xxx_l4_per_hwmod,
2233 .slave = &omap36xx_uart4_hwmod,
2234 .clk = "uart4_ick",
2235 .addr = omap36xx_uart4_addr_space,
2236 .user = OCP_USER_MPU | OCP_USER_SDMA,
2237};
2238
2239/* AM35xx: L4 CORE -> UART4 interface */
2240static struct omap_hwmod_addr_space am35xx_uart4_addr_space[] = {
2241 {
2242 .pa_start = OMAP3_UART4_AM35XX_BASE,
2243 .pa_end = OMAP3_UART4_AM35XX_BASE + SZ_1K - 1,
2244 .flags = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
2245 },
2246};
2247
2248static struct omap_hwmod_ocp_if am35xx_l4_core__uart4 = {
2249 .master = &omap3xxx_l4_core_hwmod,
2250 .slave = &am35xx_uart4_hwmod,
2251 .clk = "uart4_ick",
2252 .addr = am35xx_uart4_addr_space,
2253 .user = OCP_USER_MPU | OCP_USER_SDMA,
2254};
2255
2256/* L4 CORE -> I2C1 interface */
2257static struct omap_hwmod_ocp_if omap3_l4_core__i2c1 = {
2258 .master = &omap3xxx_l4_core_hwmod,
2259 .slave = &omap3xxx_i2c1_hwmod,
2260 .clk = "i2c1_ick",
2261 .addr = omap2_i2c1_addr_space,
2262 .fw = {
2263 .omap2 = {
2264 .l4_fw_region = OMAP3_L4_CORE_FW_I2C1_REGION,
2265 .l4_prot_group = 7,
2266 .flags = OMAP_FIREWALL_L4,
2267 }
2268 },
2269 .user = OCP_USER_MPU | OCP_USER_SDMA,
2270};
2271
2272/* L4 CORE -> I2C2 interface */
2273static struct omap_hwmod_ocp_if omap3_l4_core__i2c2 = {
2274 .master = &omap3xxx_l4_core_hwmod,
2275 .slave = &omap3xxx_i2c2_hwmod,
2276 .clk = "i2c2_ick",
2277 .addr = omap2_i2c2_addr_space,
2278 .fw = {
2279 .omap2 = {
2280 .l4_fw_region = OMAP3_L4_CORE_FW_I2C2_REGION,
2281 .l4_prot_group = 7,
2282 .flags = OMAP_FIREWALL_L4,
2283 }
2284 },
2285 .user = OCP_USER_MPU | OCP_USER_SDMA,
2286};
2287
2288/* L4 CORE -> I2C3 interface */
2289static struct omap_hwmod_addr_space omap3xxx_i2c3_addr_space[] = {
2290 {
2291 .pa_start = 0x48060000,
2292 .pa_end = 0x48060000 + SZ_128 - 1,
2293 .flags = ADDR_TYPE_RT,
2294 },
2295 { }
2296};
2297
2298static struct omap_hwmod_ocp_if omap3_l4_core__i2c3 = {
2299 .master = &omap3xxx_l4_core_hwmod,
2300 .slave = &omap3xxx_i2c3_hwmod,
2301 .clk = "i2c3_ick",
2302 .addr = omap3xxx_i2c3_addr_space,
2303 .fw = {
2304 .omap2 = {
2305 .l4_fw_region = OMAP3_L4_CORE_FW_I2C3_REGION,
2306 .l4_prot_group = 7,
2307 .flags = OMAP_FIREWALL_L4,
2308 }
2309 },
2310 .user = OCP_USER_MPU | OCP_USER_SDMA,
2311};
2312
2313/* L4 CORE -> SR1 interface */
2314static struct omap_hwmod_addr_space omap3_sr1_addr_space[] = {
2315 {
2316 .pa_start = OMAP34XX_SR1_BASE,
2317 .pa_end = OMAP34XX_SR1_BASE + SZ_1K - 1,
2318 .flags = ADDR_TYPE_RT,
2319 },
2320 { }
2321};
2322
2323static struct omap_hwmod_ocp_if omap34xx_l4_core__sr1 = {
2324 .master = &omap3xxx_l4_core_hwmod,
2325 .slave = &omap34xx_sr1_hwmod,
2326 .clk = "sr_l4_ick",
2327 .addr = omap3_sr1_addr_space,
2328 .user = OCP_USER_MPU,
2329};
2330
2331static struct omap_hwmod_ocp_if omap36xx_l4_core__sr1 = {
2332 .master = &omap3xxx_l4_core_hwmod,
2333 .slave = &omap36xx_sr1_hwmod,
2334 .clk = "sr_l4_ick",
2335 .addr = omap3_sr1_addr_space,
2336 .user = OCP_USER_MPU,
2337};
2338
2339/* L4 CORE -> SR1 interface */
2340static struct omap_hwmod_addr_space omap3_sr2_addr_space[] = {
2341 {
2342 .pa_start = OMAP34XX_SR2_BASE,
2343 .pa_end = OMAP34XX_SR2_BASE + SZ_1K - 1,
2344 .flags = ADDR_TYPE_RT,
2345 },
2346 { }
2347};
2348
2349static struct omap_hwmod_ocp_if omap34xx_l4_core__sr2 = {
2350 .master = &omap3xxx_l4_core_hwmod,
2351 .slave = &omap34xx_sr2_hwmod,
2352 .clk = "sr_l4_ick",
2353 .addr = omap3_sr2_addr_space,
2354 .user = OCP_USER_MPU,
2355};
2356
2357static struct omap_hwmod_ocp_if omap36xx_l4_core__sr2 = {
2358 .master = &omap3xxx_l4_core_hwmod,
2359 .slave = &omap36xx_sr2_hwmod,
2360 .clk = "sr_l4_ick",
2361 .addr = omap3_sr2_addr_space,
2362 .user = OCP_USER_MPU,
2363};
2364
2365static struct omap_hwmod_addr_space omap3xxx_usbhsotg_addrs[] = {
2366 {
2367 .pa_start = OMAP34XX_HSUSB_OTG_BASE,
2368 .pa_end = OMAP34XX_HSUSB_OTG_BASE + SZ_4K - 1,
2369 .flags = ADDR_TYPE_RT
2370 },
2371 { }
2372};
2373
2374/* l4_core -> usbhsotg */
2375static struct omap_hwmod_ocp_if omap3xxx_l4_core__usbhsotg = {
2376 .master = &omap3xxx_l4_core_hwmod,
2377 .slave = &omap3xxx_usbhsotg_hwmod,
2378 .clk = "l4_ick",
2379 .addr = omap3xxx_usbhsotg_addrs,
2380 .user = OCP_USER_MPU,
2381};
2382
2383static struct omap_hwmod_addr_space am35xx_usbhsotg_addrs[] = {
2384 {
2385 .pa_start = AM35XX_IPSS_USBOTGSS_BASE,
2386 .pa_end = AM35XX_IPSS_USBOTGSS_BASE + SZ_4K - 1,
2387 .flags = ADDR_TYPE_RT
2388 },
2389 { }
2390};
2391
2392/* l4_core -> usbhsotg */
2393static struct omap_hwmod_ocp_if am35xx_l4_core__usbhsotg = {
2394 .master = &omap3xxx_l4_core_hwmod,
2395 .slave = &am35xx_usbhsotg_hwmod,
2396 .clk = "l4_ick",
2397 .addr = am35xx_usbhsotg_addrs,
2398 .user = OCP_USER_MPU,
2399};
2400
2401/* L4_WKUP -> L4_SEC interface */
2402static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__l4_sec = {
2403 .master = &omap3xxx_l4_wkup_hwmod,
2404 .slave = &omap3xxx_l4_sec_hwmod,
2405 .user = OCP_USER_MPU | OCP_USER_SDMA,
2406};
2407
2408/* IVA2 <- L3 interface */
2409static struct omap_hwmod_ocp_if omap3xxx_l3__iva = {
2410 .master = &omap3xxx_l3_main_hwmod,
2411 .slave = &omap3xxx_iva_hwmod,
2412 .clk = "core_l3_ick",
2413 .user = OCP_USER_MPU | OCP_USER_SDMA,
2414};
2415
2416static struct omap_hwmod_addr_space omap3xxx_timer1_addrs[] = {
2417 {
2418 .pa_start = 0x48318000,
2419 .pa_end = 0x48318000 + SZ_1K - 1,
2420 .flags = ADDR_TYPE_RT
2421 },
2422 { }
2423};
2424
2425/* l4_wkup -> timer1 */
2426static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__timer1 = {
2427 .master = &omap3xxx_l4_wkup_hwmod,
2428 .slave = &omap3xxx_timer1_hwmod,
2429 .clk = "gpt1_ick",
2430 .addr = omap3xxx_timer1_addrs,
2431 .user = OCP_USER_MPU | OCP_USER_SDMA,
2432};
2433
2434static struct omap_hwmod_addr_space omap3xxx_timer2_addrs[] = {
2435 {
2436 .pa_start = 0x49032000,
2437 .pa_end = 0x49032000 + SZ_1K - 1,
2438 .flags = ADDR_TYPE_RT
2439 },
2440 { }
2441};
2442
2443/* l4_per -> timer2 */
2444static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer2 = {
2445 .master = &omap3xxx_l4_per_hwmod,
2446 .slave = &omap3xxx_timer2_hwmod,
2447 .clk = "gpt2_ick",
2448 .addr = omap3xxx_timer2_addrs,
2449 .user = OCP_USER_MPU | OCP_USER_SDMA,
2450};
2451
2452static struct omap_hwmod_addr_space omap3xxx_timer3_addrs[] = {
2453 {
2454 .pa_start = 0x49034000,
2455 .pa_end = 0x49034000 + SZ_1K - 1,
2456 .flags = ADDR_TYPE_RT
2457 },
2458 { }
2459};
2460
2461/* l4_per -> timer3 */
2462static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer3 = {
2463 .master = &omap3xxx_l4_per_hwmod,
2464 .slave = &omap3xxx_timer3_hwmod,
2465 .clk = "gpt3_ick",
2466 .addr = omap3xxx_timer3_addrs,
2467 .user = OCP_USER_MPU | OCP_USER_SDMA,
2468};
2469
2470static struct omap_hwmod_addr_space omap3xxx_timer4_addrs[] = {
2471 {
2472 .pa_start = 0x49036000,
2473 .pa_end = 0x49036000 + SZ_1K - 1,
2474 .flags = ADDR_TYPE_RT
2475 },
2476 { }
2477};
2478
2479/* l4_per -> timer4 */
2480static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer4 = {
2481 .master = &omap3xxx_l4_per_hwmod,
2482 .slave = &omap3xxx_timer4_hwmod,
2483 .clk = "gpt4_ick",
2484 .addr = omap3xxx_timer4_addrs,
2485 .user = OCP_USER_MPU | OCP_USER_SDMA,
2486};
2487
2488static struct omap_hwmod_addr_space omap3xxx_timer5_addrs[] = {
2489 {
2490 .pa_start = 0x49038000,
2491 .pa_end = 0x49038000 + SZ_1K - 1,
2492 .flags = ADDR_TYPE_RT
2493 },
2494 { }
2495};
2496
2497/* l4_per -> timer5 */
2498static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer5 = {
2499 .master = &omap3xxx_l4_per_hwmod,
2500 .slave = &omap3xxx_timer5_hwmod,
2501 .clk = "gpt5_ick",
2502 .addr = omap3xxx_timer5_addrs,
2503 .user = OCP_USER_MPU | OCP_USER_SDMA,
2504};
2505
2506static struct omap_hwmod_addr_space omap3xxx_timer6_addrs[] = {
2507 {
2508 .pa_start = 0x4903A000,
2509 .pa_end = 0x4903A000 + SZ_1K - 1,
2510 .flags = ADDR_TYPE_RT
2511 },
2512 { }
2513};
2514
2515/* l4_per -> timer6 */
2516static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer6 = {
2517 .master = &omap3xxx_l4_per_hwmod,
2518 .slave = &omap3xxx_timer6_hwmod,
2519 .clk = "gpt6_ick",
2520 .addr = omap3xxx_timer6_addrs,
2521 .user = OCP_USER_MPU | OCP_USER_SDMA,
2522};
2523
2524static struct omap_hwmod_addr_space omap3xxx_timer7_addrs[] = {
2525 {
2526 .pa_start = 0x4903C000,
2527 .pa_end = 0x4903C000 + SZ_1K - 1,
2528 .flags = ADDR_TYPE_RT
2529 },
2530 { }
2531};
2532
2533/* l4_per -> timer7 */
2534static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer7 = {
2535 .master = &omap3xxx_l4_per_hwmod,
2536 .slave = &omap3xxx_timer7_hwmod,
2537 .clk = "gpt7_ick",
2538 .addr = omap3xxx_timer7_addrs,
2539 .user = OCP_USER_MPU | OCP_USER_SDMA,
2540};
2541
2542static struct omap_hwmod_addr_space omap3xxx_timer8_addrs[] = {
2543 {
2544 .pa_start = 0x4903E000,
2545 .pa_end = 0x4903E000 + SZ_1K - 1,
2546 .flags = ADDR_TYPE_RT
2547 },
2548 { }
2549};
2550
2551/* l4_per -> timer8 */
2552static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer8 = {
2553 .master = &omap3xxx_l4_per_hwmod,
2554 .slave = &omap3xxx_timer8_hwmod,
2555 .clk = "gpt8_ick",
2556 .addr = omap3xxx_timer8_addrs,
2557 .user = OCP_USER_MPU | OCP_USER_SDMA,
2558};
2559
2560static struct omap_hwmod_addr_space omap3xxx_timer9_addrs[] = {
2561 {
2562 .pa_start = 0x49040000,
2563 .pa_end = 0x49040000 + SZ_1K - 1,
2564 .flags = ADDR_TYPE_RT
2565 },
2566 { }
2567};
2568
2569/* l4_per -> timer9 */
2570static struct omap_hwmod_ocp_if omap3xxx_l4_per__timer9 = {
2571 .master = &omap3xxx_l4_per_hwmod,
2572 .slave = &omap3xxx_timer9_hwmod,
2573 .clk = "gpt9_ick",
2574 .addr = omap3xxx_timer9_addrs,
2575 .user = OCP_USER_MPU | OCP_USER_SDMA,
2576};
2577
2578/* l4_core -> timer10 */
2579static struct omap_hwmod_ocp_if omap3xxx_l4_core__timer10 = {
2580 .master = &omap3xxx_l4_core_hwmod,
2581 .slave = &omap3xxx_timer10_hwmod,
2582 .clk = "gpt10_ick",
2583 .addr = omap2_timer10_addrs,
2584 .user = OCP_USER_MPU | OCP_USER_SDMA,
2585};
2586
2587/* l4_core -> timer11 */
2588static struct omap_hwmod_ocp_if omap3xxx_l4_core__timer11 = {
2589 .master = &omap3xxx_l4_core_hwmod,
2590 .slave = &omap3xxx_timer11_hwmod,
2591 .clk = "gpt11_ick",
2592 .addr = omap2_timer11_addrs,
2593 .user = OCP_USER_MPU | OCP_USER_SDMA,
2594};
2595
2596static struct omap_hwmod_addr_space omap3xxx_timer12_addrs[] = {
2597 {
2598 .pa_start = 0x48304000,
2599 .pa_end = 0x48304000 + SZ_1K - 1,
2600 .flags = ADDR_TYPE_RT
2601 },
2602 { }
2603};
2604
2605/* l4_core -> timer12 */
2606static struct omap_hwmod_ocp_if omap3xxx_l4_sec__timer12 = {
2607 .master = &omap3xxx_l4_sec_hwmod,
2608 .slave = &omap3xxx_timer12_hwmod,
2609 .clk = "gpt12_ick",
2610 .addr = omap3xxx_timer12_addrs,
2611 .user = OCP_USER_MPU | OCP_USER_SDMA,
2612};
2613
2614/* l4_wkup -> wd_timer2 */
2615static struct omap_hwmod_addr_space omap3xxx_wd_timer2_addrs[] = {
2616 {
2617 .pa_start = 0x48314000,
2618 .pa_end = 0x4831407f,
2619 .flags = ADDR_TYPE_RT
2620 },
2621 { }
2622};
2623
2624static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__wd_timer2 = {
2625 .master = &omap3xxx_l4_wkup_hwmod,
2626 .slave = &omap3xxx_wd_timer2_hwmod,
2627 .clk = "wdt2_ick",
2628 .addr = omap3xxx_wd_timer2_addrs,
2629 .user = OCP_USER_MPU | OCP_USER_SDMA,
2630};
2631
2632/* l4_core -> dss */
2633static struct omap_hwmod_ocp_if omap3430es1_l4_core__dss = {
2634 .master = &omap3xxx_l4_core_hwmod,
2635 .slave = &omap3430es1_dss_core_hwmod,
2636 .clk = "dss_ick",
2637 .addr = omap2_dss_addrs,
2638 .fw = {
2639 .omap2 = {
2640 .l4_fw_region = OMAP3ES1_L4_CORE_FW_DSS_CORE_REGION,
2641 .l4_prot_group = OMAP3_L4_CORE_FW_DSS_PROT_GROUP,
2642 .flags = OMAP_FIREWALL_L4,
2643 }
2644 },
2645 .user = OCP_USER_MPU | OCP_USER_SDMA,
2646};
2647
2648static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss = {
2649 .master = &omap3xxx_l4_core_hwmod,
2650 .slave = &omap3xxx_dss_core_hwmod,
2651 .clk = "dss_ick",
2652 .addr = omap2_dss_addrs,
2653 .fw = {
2654 .omap2 = {
2655 .l4_fw_region = OMAP3_L4_CORE_FW_DSS_CORE_REGION,
2656 .l4_prot_group = OMAP3_L4_CORE_FW_DSS_PROT_GROUP,
2657 .flags = OMAP_FIREWALL_L4,
2658 }
2659 },
2660 .user = OCP_USER_MPU | OCP_USER_SDMA,
2661};
2662
2663/* l4_core -> dss_dispc */
2664static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_dispc = {
2665 .master = &omap3xxx_l4_core_hwmod,
2666 .slave = &omap3xxx_dss_dispc_hwmod,
2667 .clk = "dss_ick",
2668 .addr = omap2_dss_dispc_addrs,
2669 .fw = {
2670 .omap2 = {
2671 .l4_fw_region = OMAP3_L4_CORE_FW_DSS_DISPC_REGION,
2672 .l4_prot_group = OMAP3_L4_CORE_FW_DSS_PROT_GROUP,
2673 .flags = OMAP_FIREWALL_L4,
2674 }
2675 },
2676 .user = OCP_USER_MPU | OCP_USER_SDMA,
2677};
2678
2679static struct omap_hwmod_addr_space omap3xxx_dss_dsi1_addrs[] = {
2680 {
2681 .pa_start = 0x4804FC00,
2682 .pa_end = 0x4804FFFF,
2683 .flags = ADDR_TYPE_RT
2684 },
2685 { }
2686};
2687
2688/* l4_core -> dss_dsi1 */
2689static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_dsi1 = {
2690 .master = &omap3xxx_l4_core_hwmod,
2691 .slave = &omap3xxx_dss_dsi1_hwmod,
2692 .clk = "dss_ick",
2693 .addr = omap3xxx_dss_dsi1_addrs,
2694 .fw = {
2695 .omap2 = {
2696 .l4_fw_region = OMAP3_L4_CORE_FW_DSS_DSI_REGION,
2697 .l4_prot_group = OMAP3_L4_CORE_FW_DSS_PROT_GROUP,
2698 .flags = OMAP_FIREWALL_L4,
2699 }
2700 },
2701 .user = OCP_USER_MPU | OCP_USER_SDMA,
2702};
2703
2704/* l4_core -> dss_rfbi */
2705static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_rfbi = {
2706 .master = &omap3xxx_l4_core_hwmod,
2707 .slave = &omap3xxx_dss_rfbi_hwmod,
2708 .clk = "dss_ick",
2709 .addr = omap2_dss_rfbi_addrs,
2710 .fw = {
2711 .omap2 = {
2712 .l4_fw_region = OMAP3_L4_CORE_FW_DSS_RFBI_REGION,
2713 .l4_prot_group = OMAP3_L4_CORE_FW_DSS_PROT_GROUP ,
2714 .flags = OMAP_FIREWALL_L4,
2715 }
2716 },
2717 .user = OCP_USER_MPU | OCP_USER_SDMA,
2718};
2719
2720/* l4_core -> dss_venc */
2721static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_venc = {
2722 .master = &omap3xxx_l4_core_hwmod,
2723 .slave = &omap3xxx_dss_venc_hwmod,
2724 .clk = "dss_ick",
2725 .addr = omap2_dss_venc_addrs,
2726 .fw = {
2727 .omap2 = {
2728 .l4_fw_region = OMAP3_L4_CORE_FW_DSS_VENC_REGION,
2729 .l4_prot_group = OMAP3_L4_CORE_FW_DSS_PROT_GROUP,
2730 .flags = OMAP_FIREWALL_L4,
2731 }
2732 },
2733 .flags = OCPIF_SWSUP_IDLE,
2734 .user = OCP_USER_MPU | OCP_USER_SDMA,
2735};
2736
2737/* l4_wkup -> gpio1 */
2738static struct omap_hwmod_addr_space omap3xxx_gpio1_addrs[] = {
2739 {
2740 .pa_start = 0x48310000,
2741 .pa_end = 0x483101ff,
2742 .flags = ADDR_TYPE_RT
2743 },
2744 { }
2745};
2746
2747static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__gpio1 = {
2748 .master = &omap3xxx_l4_wkup_hwmod,
2749 .slave = &omap3xxx_gpio1_hwmod,
2750 .addr = omap3xxx_gpio1_addrs,
2751 .user = OCP_USER_MPU | OCP_USER_SDMA,
2752};
2753
2754/* l4_per -> gpio2 */
2755static struct omap_hwmod_addr_space omap3xxx_gpio2_addrs[] = {
2756 {
2757 .pa_start = 0x49050000,
2758 .pa_end = 0x490501ff,
2759 .flags = ADDR_TYPE_RT
2760 },
2761 { }
2762};
2763
2764static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio2 = {
2765 .master = &omap3xxx_l4_per_hwmod,
2766 .slave = &omap3xxx_gpio2_hwmod,
2767 .addr = omap3xxx_gpio2_addrs,
2768 .user = OCP_USER_MPU | OCP_USER_SDMA,
2769};
2770
2771/* l4_per -> gpio3 */
2772static struct omap_hwmod_addr_space omap3xxx_gpio3_addrs[] = {
2773 {
2774 .pa_start = 0x49052000,
2775 .pa_end = 0x490521ff,
2776 .flags = ADDR_TYPE_RT
2777 },
2778 { }
2779};
2780
2781static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio3 = {
2782 .master = &omap3xxx_l4_per_hwmod,
2783 .slave = &omap3xxx_gpio3_hwmod,
2784 .addr = omap3xxx_gpio3_addrs,
2785 .user = OCP_USER_MPU | OCP_USER_SDMA,
2786};
2787
2788/* l4_per -> gpio4 */
2789static struct omap_hwmod_addr_space omap3xxx_gpio4_addrs[] = {
2790 {
2791 .pa_start = 0x49054000,
2792 .pa_end = 0x490541ff,
2793 .flags = ADDR_TYPE_RT
2794 },
2795 { }
2796};
2797
2798static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio4 = {
2799 .master = &omap3xxx_l4_per_hwmod,
2800 .slave = &omap3xxx_gpio4_hwmod,
2801 .addr = omap3xxx_gpio4_addrs,
2802 .user = OCP_USER_MPU | OCP_USER_SDMA,
2803};
2804
2805/* l4_per -> gpio5 */
2806static struct omap_hwmod_addr_space omap3xxx_gpio5_addrs[] = {
2807 {
2808 .pa_start = 0x49056000,
2809 .pa_end = 0x490561ff,
2810 .flags = ADDR_TYPE_RT
2811 },
2812 { }
2813};
2814
2815static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio5 = {
2816 .master = &omap3xxx_l4_per_hwmod,
2817 .slave = &omap3xxx_gpio5_hwmod,
2818 .addr = omap3xxx_gpio5_addrs,
2819 .user = OCP_USER_MPU | OCP_USER_SDMA,
2820};
2821
2822/* l4_per -> gpio6 */
2823static struct omap_hwmod_addr_space omap3xxx_gpio6_addrs[] = {
2824 {
2825 .pa_start = 0x49058000,
2826 .pa_end = 0x490581ff,
2827 .flags = ADDR_TYPE_RT
2828 },
2829 { }
2830};
2831
2832static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio6 = {
2833 .master = &omap3xxx_l4_per_hwmod,
2834 .slave = &omap3xxx_gpio6_hwmod,
2835 .addr = omap3xxx_gpio6_addrs,
2836 .user = OCP_USER_MPU | OCP_USER_SDMA,
2837};
2838
2839/* dma_system -> L3 */
2840static struct omap_hwmod_ocp_if omap3xxx_dma_system__l3 = {
2841 .master = &omap3xxx_dma_system_hwmod,
2842 .slave = &omap3xxx_l3_main_hwmod,
2843 .clk = "core_l3_ick",
2844 .user = OCP_USER_MPU | OCP_USER_SDMA,
2845};
2846
2847static struct omap_hwmod_addr_space omap3xxx_dma_system_addrs[] = {
2848 {
2849 .pa_start = 0x48056000,
2850 .pa_end = 0x48056fff,
2851 .flags = ADDR_TYPE_RT
2852 },
2853 { }
2854};
2855
2856/* l4_cfg -> dma_system */
2857static struct omap_hwmod_ocp_if omap3xxx_l4_core__dma_system = {
2858 .master = &omap3xxx_l4_core_hwmod,
2859 .slave = &omap3xxx_dma_system_hwmod,
2860 .clk = "core_l4_ick",
2861 .addr = omap3xxx_dma_system_addrs,
2862 .user = OCP_USER_MPU | OCP_USER_SDMA,
2863};
2864
2865static struct omap_hwmod_addr_space omap3xxx_mcbsp1_addrs[] = {
2866 {
2867 .name = "mpu",
2868 .pa_start = 0x48074000,
2869 .pa_end = 0x480740ff,
2870 .flags = ADDR_TYPE_RT
2871 },
2872 { }
2873};
2874
2875/* l4_core -> mcbsp1 */
2876static struct omap_hwmod_ocp_if omap3xxx_l4_core__mcbsp1 = {
2877 .master = &omap3xxx_l4_core_hwmod,
2878 .slave = &omap3xxx_mcbsp1_hwmod,
2879 .clk = "mcbsp1_ick",
2880 .addr = omap3xxx_mcbsp1_addrs,
2881 .user = OCP_USER_MPU | OCP_USER_SDMA,
2882};
2883
2884static struct omap_hwmod_addr_space omap3xxx_mcbsp2_addrs[] = {
2885 {
2886 .name = "mpu",
2887 .pa_start = 0x49022000,
2888 .pa_end = 0x490220ff,
2889 .flags = ADDR_TYPE_RT
2890 },
2891 { }
2892};
2893
2894/* l4_per -> mcbsp2 */
2895static struct omap_hwmod_ocp_if omap3xxx_l4_per__mcbsp2 = {
2896 .master = &omap3xxx_l4_per_hwmod,
2897 .slave = &omap3xxx_mcbsp2_hwmod,
2898 .clk = "mcbsp2_ick",
2899 .addr = omap3xxx_mcbsp2_addrs,
2900 .user = OCP_USER_MPU | OCP_USER_SDMA,
2901};
2902
2903static struct omap_hwmod_addr_space omap3xxx_mcbsp3_addrs[] = {
2904 {
2905 .name = "mpu",
2906 .pa_start = 0x49024000,
2907 .pa_end = 0x490240ff,
2908 .flags = ADDR_TYPE_RT
2909 },
2910 { }
2911};
2912
2913/* l4_per -> mcbsp3 */
2914static struct omap_hwmod_ocp_if omap3xxx_l4_per__mcbsp3 = {
2915 .master = &omap3xxx_l4_per_hwmod,
2916 .slave = &omap3xxx_mcbsp3_hwmod,
2917 .clk = "mcbsp3_ick",
2918 .addr = omap3xxx_mcbsp3_addrs,
2919 .user = OCP_USER_MPU | OCP_USER_SDMA,
2920};
2921
2922static struct omap_hwmod_addr_space omap3xxx_mcbsp4_addrs[] = {
2923 {
2924 .name = "mpu",
2925 .pa_start = 0x49026000,
2926 .pa_end = 0x490260ff,
2927 .flags = ADDR_TYPE_RT
2928 },
2929 { }
2930};
2931
2932/* l4_per -> mcbsp4 */
2933static struct omap_hwmod_ocp_if omap3xxx_l4_per__mcbsp4 = {
2934 .master = &omap3xxx_l4_per_hwmod,
2935 .slave = &omap3xxx_mcbsp4_hwmod,
2936 .clk = "mcbsp4_ick",
2937 .addr = omap3xxx_mcbsp4_addrs,
2938 .user = OCP_USER_MPU | OCP_USER_SDMA,
2939};
2940
2941static struct omap_hwmod_addr_space omap3xxx_mcbsp5_addrs[] = {
2942 {
2943 .name = "mpu",
2944 .pa_start = 0x48096000,
2945 .pa_end = 0x480960ff,
2946 .flags = ADDR_TYPE_RT
2947 },
2948 { }
2949};
2950
2951/* l4_core -> mcbsp5 */
2952static struct omap_hwmod_ocp_if omap3xxx_l4_core__mcbsp5 = {
2953 .master = &omap3xxx_l4_core_hwmod,
2954 .slave = &omap3xxx_mcbsp5_hwmod,
2955 .clk = "mcbsp5_ick",
2956 .addr = omap3xxx_mcbsp5_addrs,
2957 .user = OCP_USER_MPU | OCP_USER_SDMA,
2958};
2959
2960static struct omap_hwmod_addr_space omap3xxx_mcbsp2_sidetone_addrs[] = {
2961 {
2962 .name = "sidetone",
2963 .pa_start = 0x49028000,
2964 .pa_end = 0x490280ff,
2965 .flags = ADDR_TYPE_RT
2966 },
2967 { }
2968};
2969
2970/* l4_per -> mcbsp2_sidetone */
2971static struct omap_hwmod_ocp_if omap3xxx_l4_per__mcbsp2_sidetone = {
2972 .master = &omap3xxx_l4_per_hwmod,
2973 .slave = &omap3xxx_mcbsp2_sidetone_hwmod,
2974 .clk = "mcbsp2_ick",
2975 .addr = omap3xxx_mcbsp2_sidetone_addrs,
2976 .user = OCP_USER_MPU,
2977};
2978
2979static struct omap_hwmod_addr_space omap3xxx_mcbsp3_sidetone_addrs[] = {
2980 {
2981 .name = "sidetone",
2982 .pa_start = 0x4902A000,
2983 .pa_end = 0x4902A0ff,
2984 .flags = ADDR_TYPE_RT
2985 },
2986 { }
2987};
2988
2989/* l4_per -> mcbsp3_sidetone */
2990static struct omap_hwmod_ocp_if omap3xxx_l4_per__mcbsp3_sidetone = {
2991 .master = &omap3xxx_l4_per_hwmod,
2992 .slave = &omap3xxx_mcbsp3_sidetone_hwmod,
2993 .clk = "mcbsp3_ick",
2994 .addr = omap3xxx_mcbsp3_sidetone_addrs,
2995 .user = OCP_USER_MPU,
2996};
2997
2998static struct omap_hwmod_addr_space omap3xxx_mailbox_addrs[] = {
2999 {
3000 .pa_start = 0x48094000,
3001 .pa_end = 0x480941ff,
3002 .flags = ADDR_TYPE_RT,
3003 },
3004 { }
3005};
3006
3007/* l4_core -> mailbox */
3008static struct omap_hwmod_ocp_if omap3xxx_l4_core__mailbox = {
3009 .master = &omap3xxx_l4_core_hwmod,
3010 .slave = &omap3xxx_mailbox_hwmod,
3011 .addr = omap3xxx_mailbox_addrs,
3012 .user = OCP_USER_MPU | OCP_USER_SDMA,
3013};
3014
3015/* l4 core -> mcspi1 interface */
3016static struct omap_hwmod_ocp_if omap34xx_l4_core__mcspi1 = {
3017 .master = &omap3xxx_l4_core_hwmod,
3018 .slave = &omap34xx_mcspi1,
3019 .clk = "mcspi1_ick",
3020 .addr = omap2_mcspi1_addr_space,
3021 .user = OCP_USER_MPU | OCP_USER_SDMA,
3022};
3023
3024/* l4 core -> mcspi2 interface */
3025static struct omap_hwmod_ocp_if omap34xx_l4_core__mcspi2 = {
3026 .master = &omap3xxx_l4_core_hwmod,
3027 .slave = &omap34xx_mcspi2,
3028 .clk = "mcspi2_ick",
3029 .addr = omap2_mcspi2_addr_space,
3030 .user = OCP_USER_MPU | OCP_USER_SDMA,
3031};
3032
3033/* l4 core -> mcspi3 interface */
3034static struct omap_hwmod_ocp_if omap34xx_l4_core__mcspi3 = {
3035 .master = &omap3xxx_l4_core_hwmod,
3036 .slave = &omap34xx_mcspi3,
3037 .clk = "mcspi3_ick",
3038 .addr = omap2430_mcspi3_addr_space,
3039 .user = OCP_USER_MPU | OCP_USER_SDMA,
3040};
3041
3042/* l4 core -> mcspi4 interface */
3043static struct omap_hwmod_addr_space omap34xx_mcspi4_addr_space[] = {
3044 {
3045 .pa_start = 0x480ba000,
3046 .pa_end = 0x480ba0ff,
3047 .flags = ADDR_TYPE_RT,
3048 },
3049 { }
3050};
3051
3052static struct omap_hwmod_ocp_if omap34xx_l4_core__mcspi4 = {
3053 .master = &omap3xxx_l4_core_hwmod,
3054 .slave = &omap34xx_mcspi4,
3055 .clk = "mcspi4_ick",
3056 .addr = omap34xx_mcspi4_addr_space,
3057 .user = OCP_USER_MPU | OCP_USER_SDMA,
3058};
3059
3060static struct omap_hwmod_ocp_if omap3xxx_usb_host_hs__l3_main_2 = {
3061 .master = &omap3xxx_usb_host_hs_hwmod,
3062 .slave = &omap3xxx_l3_main_hwmod,
3063 .clk = "core_l3_ick",
3064 .user = OCP_USER_MPU,
3065};
3066
3067static struct omap_hwmod_addr_space omap3xxx_usb_host_hs_addrs[] = {
3068 {
3069 .name = "uhh",
3070 .pa_start = 0x48064000,
3071 .pa_end = 0x480643ff,
3072 .flags = ADDR_TYPE_RT
3073 },
3074 {
3075 .name = "ohci",
3076 .pa_start = 0x48064400,
3077 .pa_end = 0x480647ff,
3078 },
3079 {
3080 .name = "ehci",
3081 .pa_start = 0x48064800,
3082 .pa_end = 0x48064cff,
3083 },
3084 {}
3085};
3086
3087static struct omap_hwmod_ocp_if omap3xxx_l4_core__usb_host_hs = {
3088 .master = &omap3xxx_l4_core_hwmod,
3089 .slave = &omap3xxx_usb_host_hs_hwmod,
3090 .clk = "usbhost_ick",
3091 .addr = omap3xxx_usb_host_hs_addrs,
3092 .user = OCP_USER_MPU | OCP_USER_SDMA,
3093};
3094
3505static struct omap_hwmod_addr_space omap3xxx_usb_tll_hs_addrs[] = { 3095static struct omap_hwmod_addr_space omap3xxx_usb_tll_hs_addrs[] = {
3506 { 3096 {
3507 .name = "tll", 3097 .name = "tll",
@@ -3520,183 +3110,187 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__usb_tll_hs = {
3520 .user = OCP_USER_MPU | OCP_USER_SDMA, 3110 .user = OCP_USER_MPU | OCP_USER_SDMA,
3521}; 3111};
3522 3112
3523static struct omap_hwmod_ocp_if *omap3xxx_usb_tll_hs_slaves[] = { 3113/* l4_core -> hdq1w interface */
3524 &omap3xxx_l4_core__usb_tll_hs, 3114static struct omap_hwmod_ocp_if omap3xxx_l4_core__hdq1w = {
3115 .master = &omap3xxx_l4_core_hwmod,
3116 .slave = &omap3xxx_hdq1w_hwmod,
3117 .clk = "hdq_ick",
3118 .addr = omap2_hdq1w_addr_space,
3119 .user = OCP_USER_MPU | OCP_USER_SDMA,
3120 .flags = OMAP_FIREWALL_L4 | OCPIF_SWSUP_IDLE,
3525}; 3121};
3526 3122
3527static struct omap_hwmod omap3xxx_usb_tll_hs_hwmod = { 3123/* l4_wkup -> 32ksync_counter */
3528 .name = "usb_tll_hs", 3124static struct omap_hwmod_addr_space omap3xxx_counter_32k_addrs[] = {
3529 .class = &omap3xxx_usb_tll_hs_hwmod_class, 3125 {
3530 .clkdm_name = "l3_init_clkdm", 3126 .pa_start = 0x48320000,
3531 .mpu_irqs = omap3xxx_usb_tll_hs_irqs, 3127 .pa_end = 0x4832001f,
3532 .main_clk = "usbtll_fck", 3128 .flags = ADDR_TYPE_RT
3533 .prcm = {
3534 .omap2 = {
3535 .module_offs = CORE_MOD,
3536 .prcm_reg_id = 3,
3537 .module_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
3538 .idlest_reg_id = 3,
3539 .idlest_idle_bit = OMAP3430ES2_ST_USBTLL_SHIFT,
3540 },
3541 }, 3129 },
3542 .slaves = omap3xxx_usb_tll_hs_slaves, 3130 { }
3543 .slaves_cnt = ARRAY_SIZE(omap3xxx_usb_tll_hs_slaves), 3131};
3544};
3545
3546static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
3547 &omap3xxx_l3_main_hwmod,
3548 &omap3xxx_l4_core_hwmod,
3549 &omap3xxx_l4_per_hwmod,
3550 &omap3xxx_l4_wkup_hwmod,
3551 &omap3xxx_mmc3_hwmod,
3552 &omap3xxx_mpu_hwmod,
3553
3554 &omap3xxx_timer1_hwmod,
3555 &omap3xxx_timer2_hwmod,
3556 &omap3xxx_timer3_hwmod,
3557 &omap3xxx_timer4_hwmod,
3558 &omap3xxx_timer5_hwmod,
3559 &omap3xxx_timer6_hwmod,
3560 &omap3xxx_timer7_hwmod,
3561 &omap3xxx_timer8_hwmod,
3562 &omap3xxx_timer9_hwmod,
3563 &omap3xxx_timer10_hwmod,
3564 &omap3xxx_timer11_hwmod,
3565
3566 &omap3xxx_wd_timer2_hwmod,
3567 &omap3xxx_uart1_hwmod,
3568 &omap3xxx_uart2_hwmod,
3569 &omap3xxx_uart3_hwmod,
3570
3571 /* i2c class */
3572 &omap3xxx_i2c1_hwmod,
3573 &omap3xxx_i2c2_hwmod,
3574 &omap3xxx_i2c3_hwmod,
3575
3576 /* gpio class */
3577 &omap3xxx_gpio1_hwmod,
3578 &omap3xxx_gpio2_hwmod,
3579 &omap3xxx_gpio3_hwmod,
3580 &omap3xxx_gpio4_hwmod,
3581 &omap3xxx_gpio5_hwmod,
3582 &omap3xxx_gpio6_hwmod,
3583
3584 /* dma_system class*/
3585 &omap3xxx_dma_system_hwmod,
3586
3587 /* mcbsp class */
3588 &omap3xxx_mcbsp1_hwmod,
3589 &omap3xxx_mcbsp2_hwmod,
3590 &omap3xxx_mcbsp3_hwmod,
3591 &omap3xxx_mcbsp4_hwmod,
3592 &omap3xxx_mcbsp5_hwmod,
3593 &omap3xxx_mcbsp2_sidetone_hwmod,
3594 &omap3xxx_mcbsp3_sidetone_hwmod,
3595
3596
3597 /* mcspi class */
3598 &omap34xx_mcspi1,
3599 &omap34xx_mcspi2,
3600 &omap34xx_mcspi3,
3601 &omap34xx_mcspi4,
3602 3132
3133static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__counter_32k = {
3134 .master = &omap3xxx_l4_wkup_hwmod,
3135 .slave = &omap3xxx_counter_32k_hwmod,
3136 .clk = "omap_32ksync_ick",
3137 .addr = omap3xxx_counter_32k_addrs,
3138 .user = OCP_USER_MPU | OCP_USER_SDMA,
3139};
3140
3141static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = {
3142 &omap3xxx_l3_main__l4_core,
3143 &omap3xxx_l3_main__l4_per,
3144 &omap3xxx_mpu__l3_main,
3145 &omap3xxx_l4_core__l4_wkup,
3146 &omap3xxx_l4_core__mmc3,
3147 &omap3_l4_core__uart1,
3148 &omap3_l4_core__uart2,
3149 &omap3_l4_per__uart3,
3150 &omap3_l4_core__i2c1,
3151 &omap3_l4_core__i2c2,
3152 &omap3_l4_core__i2c3,
3153 &omap3xxx_l4_wkup__l4_sec,
3154 &omap3xxx_l4_wkup__timer1,
3155 &omap3xxx_l4_per__timer2,
3156 &omap3xxx_l4_per__timer3,
3157 &omap3xxx_l4_per__timer4,
3158 &omap3xxx_l4_per__timer5,
3159 &omap3xxx_l4_per__timer6,
3160 &omap3xxx_l4_per__timer7,
3161 &omap3xxx_l4_per__timer8,
3162 &omap3xxx_l4_per__timer9,
3163 &omap3xxx_l4_core__timer10,
3164 &omap3xxx_l4_core__timer11,
3165 &omap3xxx_l4_wkup__wd_timer2,
3166 &omap3xxx_l4_wkup__gpio1,
3167 &omap3xxx_l4_per__gpio2,
3168 &omap3xxx_l4_per__gpio3,
3169 &omap3xxx_l4_per__gpio4,
3170 &omap3xxx_l4_per__gpio5,
3171 &omap3xxx_l4_per__gpio6,
3172 &omap3xxx_dma_system__l3,
3173 &omap3xxx_l4_core__dma_system,
3174 &omap3xxx_l4_core__mcbsp1,
3175 &omap3xxx_l4_per__mcbsp2,
3176 &omap3xxx_l4_per__mcbsp3,
3177 &omap3xxx_l4_per__mcbsp4,
3178 &omap3xxx_l4_core__mcbsp5,
3179 &omap3xxx_l4_per__mcbsp2_sidetone,
3180 &omap3xxx_l4_per__mcbsp3_sidetone,
3181 &omap34xx_l4_core__mcspi1,
3182 &omap34xx_l4_core__mcspi2,
3183 &omap34xx_l4_core__mcspi3,
3184 &omap34xx_l4_core__mcspi4,
3185 &omap3xxx_l4_wkup__counter_32k,
3603 NULL, 3186 NULL,
3604}; 3187};
3605 3188
3606/* GP-only hwmods */ 3189/* GP-only hwmod links */
3607static __initdata struct omap_hwmod *omap3xxx_gp_hwmods[] = { 3190static struct omap_hwmod_ocp_if *omap3xxx_gp_hwmod_ocp_ifs[] __initdata = {
3608 &omap3xxx_timer12_hwmod, 3191 &omap3xxx_l4_sec__timer12,
3609 NULL 3192 NULL
3610}; 3193};
3611 3194
3612/* 3430ES1-only hwmods */ 3195/* 3430ES1-only hwmod links */
3613static __initdata struct omap_hwmod *omap3430es1_hwmods[] = { 3196static struct omap_hwmod_ocp_if *omap3430es1_hwmod_ocp_ifs[] __initdata = {
3614 &omap3430es1_dss_core_hwmod, 3197 &omap3430es1_dss__l3,
3198 &omap3430es1_l4_core__dss,
3615 NULL 3199 NULL
3616}; 3200};
3617 3201
3618/* 3430ES2+-only hwmods */ 3202/* 3430ES2+-only hwmod links */
3619static __initdata struct omap_hwmod *omap3430es2plus_hwmods[] = { 3203static struct omap_hwmod_ocp_if *omap3430es2plus_hwmod_ocp_ifs[] __initdata = {
3620 &omap3xxx_dss_core_hwmod, 3204 &omap3xxx_dss__l3,
3621 &omap3xxx_usbhsotg_hwmod, 3205 &omap3xxx_l4_core__dss,
3622 &omap3xxx_usb_host_hs_hwmod, 3206 &omap3xxx_usbhsotg__l3,
3623 &omap3xxx_usb_tll_hs_hwmod, 3207 &omap3xxx_l4_core__usbhsotg,
3208 &omap3xxx_usb_host_hs__l3_main_2,
3209 &omap3xxx_l4_core__usb_host_hs,
3210 &omap3xxx_l4_core__usb_tll_hs,
3624 NULL 3211 NULL
3625}; 3212};
3626 3213
3627/* <= 3430ES3-only hwmods */ 3214/* <= 3430ES3-only hwmod links */
3628static struct omap_hwmod *omap3430_pre_es3_hwmods[] __initdata = { 3215static struct omap_hwmod_ocp_if *omap3430_pre_es3_hwmod_ocp_ifs[] __initdata = {
3629 &omap3xxx_pre_es3_mmc1_hwmod, 3216 &omap3xxx_l4_core__pre_es3_mmc1,
3630 &omap3xxx_pre_es3_mmc2_hwmod, 3217 &omap3xxx_l4_core__pre_es3_mmc2,
3631 NULL 3218 NULL
3632}; 3219};
3633 3220
3634/* 3430ES3+-only hwmods */ 3221/* 3430ES3+-only hwmod links */
3635static struct omap_hwmod *omap3430_es3plus_hwmods[] __initdata = { 3222static struct omap_hwmod_ocp_if *omap3430_es3plus_hwmod_ocp_ifs[] __initdata = {
3636 &omap3xxx_es3plus_mmc1_hwmod, 3223 &omap3xxx_l4_core__es3plus_mmc1,
3637 &omap3xxx_es3plus_mmc2_hwmod, 3224 &omap3xxx_l4_core__es3plus_mmc2,
3638 NULL 3225 NULL
3639}; 3226};
3640 3227
3641/* 34xx-only hwmods (all ES revisions) */ 3228/* 34xx-only hwmod links (all ES revisions) */
3642static __initdata struct omap_hwmod *omap34xx_hwmods[] = { 3229static struct omap_hwmod_ocp_if *omap34xx_hwmod_ocp_ifs[] __initdata = {
3643 &omap3xxx_iva_hwmod, 3230 &omap3xxx_l3__iva,
3644 &omap34xx_sr1_hwmod, 3231 &omap34xx_l4_core__sr1,
3645 &omap34xx_sr2_hwmod, 3232 &omap34xx_l4_core__sr2,
3646 &omap3xxx_mailbox_hwmod, 3233 &omap3xxx_l4_core__mailbox,
3234 &omap3xxx_l4_core__hdq1w,
3647 NULL 3235 NULL
3648}; 3236};
3649 3237
3650/* 36xx-only hwmods (all ES revisions) */ 3238/* 36xx-only hwmod links (all ES revisions) */
3651static __initdata struct omap_hwmod *omap36xx_hwmods[] = { 3239static struct omap_hwmod_ocp_if *omap36xx_hwmod_ocp_ifs[] __initdata = {
3652 &omap3xxx_iva_hwmod, 3240 &omap3xxx_l3__iva,
3653 &omap3xxx_uart4_hwmod, 3241 &omap36xx_l4_per__uart4,
3654 &omap3xxx_dss_core_hwmod, 3242 &omap3xxx_dss__l3,
3655 &omap36xx_sr1_hwmod, 3243 &omap3xxx_l4_core__dss,
3656 &omap36xx_sr2_hwmod, 3244 &omap36xx_l4_core__sr1,
3657 &omap3xxx_usbhsotg_hwmod, 3245 &omap36xx_l4_core__sr2,
3658 &omap3xxx_mailbox_hwmod, 3246 &omap3xxx_usbhsotg__l3,
3659 &omap3xxx_usb_host_hs_hwmod, 3247 &omap3xxx_l4_core__usbhsotg,
3660 &omap3xxx_usb_tll_hs_hwmod, 3248 &omap3xxx_l4_core__mailbox,
3661 &omap3xxx_es3plus_mmc1_hwmod, 3249 &omap3xxx_usb_host_hs__l3_main_2,
3662 &omap3xxx_es3plus_mmc2_hwmod, 3250 &omap3xxx_l4_core__usb_host_hs,
3251 &omap3xxx_l4_core__usb_tll_hs,
3252 &omap3xxx_l4_core__es3plus_mmc1,
3253 &omap3xxx_l4_core__es3plus_mmc2,
3254 &omap3xxx_l4_core__hdq1w,
3663 NULL 3255 NULL
3664}; 3256};
3665 3257
3666static __initdata struct omap_hwmod *am35xx_hwmods[] = { 3258static struct omap_hwmod_ocp_if *am35xx_hwmod_ocp_ifs[] __initdata = {
3667 &omap3xxx_dss_core_hwmod, /* XXX ??? */ 3259 &omap3xxx_dss__l3,
3668 &am35xx_usbhsotg_hwmod, 3260 &omap3xxx_l4_core__dss,
3669 &am35xx_uart4_hwmod, 3261 &am35xx_usbhsotg__l3,
3670 &omap3xxx_usb_host_hs_hwmod, 3262 &am35xx_l4_core__usbhsotg,
3671 &omap3xxx_usb_tll_hs_hwmod, 3263 &am35xx_l4_core__uart4,
3672 &omap3xxx_es3plus_mmc1_hwmod, 3264 &omap3xxx_usb_host_hs__l3_main_2,
3673 &omap3xxx_es3plus_mmc2_hwmod, 3265 &omap3xxx_l4_core__usb_host_hs,
3266 &omap3xxx_l4_core__usb_tll_hs,
3267 &omap3xxx_l4_core__es3plus_mmc1,
3268 &omap3xxx_l4_core__es3plus_mmc2,
3674 NULL 3269 NULL
3675}; 3270};
3676 3271
3677static __initdata struct omap_hwmod *omap3xxx_dss_hwmods[] = { 3272static struct omap_hwmod_ocp_if *omap3xxx_dss_hwmod_ocp_ifs[] __initdata = {
3678 /* dss class */ 3273 &omap3xxx_l4_core__dss_dispc,
3679 &omap3xxx_dss_dispc_hwmod, 3274 &omap3xxx_l4_core__dss_dsi1,
3680 &omap3xxx_dss_dsi1_hwmod, 3275 &omap3xxx_l4_core__dss_rfbi,
3681 &omap3xxx_dss_rfbi_hwmod, 3276 &omap3xxx_l4_core__dss_venc,
3682 &omap3xxx_dss_venc_hwmod,
3683 NULL 3277 NULL
3684}; 3278};
3685 3279
3686int __init omap3xxx_hwmod_init(void) 3280int __init omap3xxx_hwmod_init(void)
3687{ 3281{
3688 int r; 3282 int r;
3689 struct omap_hwmod **h = NULL; 3283 struct omap_hwmod_ocp_if **h = NULL;
3690 unsigned int rev; 3284 unsigned int rev;
3691 3285
3692 /* Register hwmods common to all OMAP3 */ 3286 /* Register hwmod links common to all OMAP3 */
3693 r = omap_hwmod_register(omap3xxx_hwmods); 3287 r = omap_hwmod_register_links(omap3xxx_hwmod_ocp_ifs);
3694 if (r < 0) 3288 if (r < 0)
3695 return r; 3289 return r;
3696 3290
3697 /* Register GP-only hwmods. */ 3291 /* Register GP-only hwmod links. */
3698 if (omap_type() == OMAP2_DEVICE_TYPE_GP) { 3292 if (omap_type() == OMAP2_DEVICE_TYPE_GP) {
3699 r = omap_hwmod_register(omap3xxx_gp_hwmods); 3293 r = omap_hwmod_register_links(omap3xxx_gp_hwmod_ocp_ifs);
3700 if (r < 0) 3294 if (r < 0)
3701 return r; 3295 return r;
3702 } 3296 }
@@ -3704,43 +3298,43 @@ int __init omap3xxx_hwmod_init(void)
3704 rev = omap_rev(); 3298 rev = omap_rev();
3705 3299
3706 /* 3300 /*
3707 * Register hwmods common to individual OMAP3 families, all 3301 * Register hwmod links common to individual OMAP3 families, all
3708 * silicon revisions (e.g., 34xx, or AM3505/3517, or 36xx) 3302 * silicon revisions (e.g., 34xx, or AM3505/3517, or 36xx)
3709 * All possible revisions should be included in this conditional. 3303 * All possible revisions should be included in this conditional.
3710 */ 3304 */
3711 if (rev == OMAP3430_REV_ES1_0 || rev == OMAP3430_REV_ES2_0 || 3305 if (rev == OMAP3430_REV_ES1_0 || rev == OMAP3430_REV_ES2_0 ||
3712 rev == OMAP3430_REV_ES2_1 || rev == OMAP3430_REV_ES3_0 || 3306 rev == OMAP3430_REV_ES2_1 || rev == OMAP3430_REV_ES3_0 ||
3713 rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2) { 3307 rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2) {
3714 h = omap34xx_hwmods; 3308 h = omap34xx_hwmod_ocp_ifs;
3715 } else if (rev == OMAP3517_REV_ES1_0 || rev == OMAP3517_REV_ES1_1) { 3309 } else if (rev == OMAP3517_REV_ES1_0 || rev == OMAP3517_REV_ES1_1) {
3716 h = am35xx_hwmods; 3310 h = am35xx_hwmod_ocp_ifs;
3717 } else if (rev == OMAP3630_REV_ES1_0 || rev == OMAP3630_REV_ES1_1 || 3311 } else if (rev == OMAP3630_REV_ES1_0 || rev == OMAP3630_REV_ES1_1 ||
3718 rev == OMAP3630_REV_ES1_2) { 3312 rev == OMAP3630_REV_ES1_2) {
3719 h = omap36xx_hwmods; 3313 h = omap36xx_hwmod_ocp_ifs;
3720 } else { 3314 } else {
3721 WARN(1, "OMAP3 hwmod family init: unknown chip type\n"); 3315 WARN(1, "OMAP3 hwmod family init: unknown chip type\n");
3722 return -EINVAL; 3316 return -EINVAL;
3723 }; 3317 };
3724 3318
3725 r = omap_hwmod_register(h); 3319 r = omap_hwmod_register_links(h);
3726 if (r < 0) 3320 if (r < 0)
3727 return r; 3321 return r;
3728 3322
3729 /* 3323 /*
3730 * Register hwmods specific to certain ES levels of a 3324 * Register hwmod links specific to certain ES levels of a
3731 * particular family of silicon (e.g., 34xx ES1.0) 3325 * particular family of silicon (e.g., 34xx ES1.0)
3732 */ 3326 */
3733 h = NULL; 3327 h = NULL;
3734 if (rev == OMAP3430_REV_ES1_0) { 3328 if (rev == OMAP3430_REV_ES1_0) {
3735 h = omap3430es1_hwmods; 3329 h = omap3430es1_hwmod_ocp_ifs;
3736 } else if (rev == OMAP3430_REV_ES2_0 || rev == OMAP3430_REV_ES2_1 || 3330 } else if (rev == OMAP3430_REV_ES2_0 || rev == OMAP3430_REV_ES2_1 ||
3737 rev == OMAP3430_REV_ES3_0 || rev == OMAP3430_REV_ES3_1 || 3331 rev == OMAP3430_REV_ES3_0 || rev == OMAP3430_REV_ES3_1 ||
3738 rev == OMAP3430_REV_ES3_1_2) { 3332 rev == OMAP3430_REV_ES3_1_2) {
3739 h = omap3430es2plus_hwmods; 3333 h = omap3430es2plus_hwmod_ocp_ifs;
3740 }; 3334 };
3741 3335
3742 if (h) { 3336 if (h) {
3743 r = omap_hwmod_register(h); 3337 r = omap_hwmod_register_links(h);
3744 if (r < 0) 3338 if (r < 0)
3745 return r; 3339 return r;
3746 } 3340 }
@@ -3748,29 +3342,29 @@ int __init omap3xxx_hwmod_init(void)
3748 h = NULL; 3342 h = NULL;
3749 if (rev == OMAP3430_REV_ES1_0 || rev == OMAP3430_REV_ES2_0 || 3343 if (rev == OMAP3430_REV_ES1_0 || rev == OMAP3430_REV_ES2_0 ||
3750 rev == OMAP3430_REV_ES2_1) { 3344 rev == OMAP3430_REV_ES2_1) {
3751 h = omap3430_pre_es3_hwmods; 3345 h = omap3430_pre_es3_hwmod_ocp_ifs;
3752 } else if (rev == OMAP3430_REV_ES3_0 || rev == OMAP3430_REV_ES3_1 || 3346 } else if (rev == OMAP3430_REV_ES3_0 || rev == OMAP3430_REV_ES3_1 ||
3753 rev == OMAP3430_REV_ES3_1_2) { 3347 rev == OMAP3430_REV_ES3_1_2) {
3754 h = omap3430_es3plus_hwmods; 3348 h = omap3430_es3plus_hwmod_ocp_ifs;
3755 }; 3349 };
3756 3350
3757 if (h) 3351 if (h)
3758 r = omap_hwmod_register(h); 3352 r = omap_hwmod_register_links(h);
3759 if (r < 0) 3353 if (r < 0)
3760 return r; 3354 return r;
3761 3355
3762 /* 3356 /*
3763 * DSS code presumes that dss_core hwmod is handled first, 3357 * DSS code presumes that dss_core hwmod is handled first,
3764 * _before_ any other DSS related hwmods so register common 3358 * _before_ any other DSS related hwmods so register common
3765 * DSS hwmods last to ensure that dss_core is already registered. 3359 * DSS hwmod links last to ensure that dss_core is already
3766 * Otherwise some change things may happen, for ex. if dispc 3360 * registered. Otherwise some change things may happen, for
3767 * is handled before dss_core and DSS is enabled in bootloader 3361 * ex. if dispc is handled before dss_core and DSS is enabled
3768 * DIPSC will be reset with outputs enabled which sometimes leads 3362 * in bootloader DISPC will be reset with outputs enabled
3769 * to unrecoverable L3 error. 3363 * which sometimes leads to unrecoverable L3 error. XXX The
3770 * XXX The long-term fix to this is to ensure modules are set up 3364 * long-term fix to this is to ensure hwmods are set up in
3771 * in dependency order in the hwmod core code. 3365 * dependency order in the hwmod core code.
3772 */ 3366 */
3773 r = omap_hwmod_register(omap3xxx_dss_hwmods); 3367 r = omap_hwmod_register_links(omap3xxx_dss_hwmod_ocp_ifs);
3774 3368
3775 return r; 3369 return r;
3776} 3370}
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index cc9bd106a854..950454a3fa31 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Hardware modules present on the OMAP44xx chips 2 * Hardware modules present on the OMAP44xx chips
3 * 3 *
4 * Copyright (C) 2009-2011 Texas Instruments, Inc. 4 * Copyright (C) 2009-2012 Texas Instruments, Inc.
5 * Copyright (C) 2009-2010 Nokia Corporation 5 * Copyright (C) 2009-2010 Nokia Corporation
6 * 6 *
7 * Paul Walmsley 7 * Paul Walmsley
@@ -44,41 +44,34 @@
44#define OMAP44XX_IRQ_GIC_START 32 44#define OMAP44XX_IRQ_GIC_START 32
45 45
46/* Base offset for all OMAP4 dma requests */ 46/* Base offset for all OMAP4 dma requests */
47#define OMAP44XX_DMA_REQ_START 1 47#define OMAP44XX_DMA_REQ_START 1
48
49/* Backward references (IPs with Bus Master capability) */
50static struct omap_hwmod omap44xx_aess_hwmod;
51static struct omap_hwmod omap44xx_dma_system_hwmod;
52static struct omap_hwmod omap44xx_dmm_hwmod;
53static struct omap_hwmod omap44xx_dsp_hwmod;
54static struct omap_hwmod omap44xx_dss_hwmod;
55static struct omap_hwmod omap44xx_emif_fw_hwmod;
56static struct omap_hwmod omap44xx_hsi_hwmod;
57static struct omap_hwmod omap44xx_ipu_hwmod;
58static struct omap_hwmod omap44xx_iss_hwmod;
59static struct omap_hwmod omap44xx_iva_hwmod;
60static struct omap_hwmod omap44xx_l3_instr_hwmod;
61static struct omap_hwmod omap44xx_l3_main_1_hwmod;
62static struct omap_hwmod omap44xx_l3_main_2_hwmod;
63static struct omap_hwmod omap44xx_l3_main_3_hwmod;
64static struct omap_hwmod omap44xx_l4_abe_hwmod;
65static struct omap_hwmod omap44xx_l4_cfg_hwmod;
66static struct omap_hwmod omap44xx_l4_per_hwmod;
67static struct omap_hwmod omap44xx_l4_wkup_hwmod;
68static struct omap_hwmod omap44xx_mmc1_hwmod;
69static struct omap_hwmod omap44xx_mmc2_hwmod;
70static struct omap_hwmod omap44xx_mpu_hwmod;
71static struct omap_hwmod omap44xx_mpu_private_hwmod;
72static struct omap_hwmod omap44xx_usb_otg_hs_hwmod;
73static struct omap_hwmod omap44xx_usb_host_hs_hwmod;
74static struct omap_hwmod omap44xx_usb_tll_hs_hwmod;
75 48
76/* 49/*
77 * Interconnects omap_hwmod structures 50 * IP blocks
78 * hwmods that compose the global OMAP interconnect
79 */ 51 */
80 52
81/* 53/*
54 * 'c2c_target_fw' class
55 * instance(s): c2c_target_fw
56 */
57static struct omap_hwmod_class omap44xx_c2c_target_fw_hwmod_class = {
58 .name = "c2c_target_fw",
59};
60
61/* c2c_target_fw */
62static struct omap_hwmod omap44xx_c2c_target_fw_hwmod = {
63 .name = "c2c_target_fw",
64 .class = &omap44xx_c2c_target_fw_hwmod_class,
65 .clkdm_name = "d2d_clkdm",
66 .prcm = {
67 .omap4 = {
68 .clkctrl_offs = OMAP4_CM_D2D_SAD2D_FW_CLKCTRL_OFFSET,
69 .context_offs = OMAP4_RM_D2D_SAD2D_FW_CONTEXT_OFFSET,
70 },
71 },
72};
73
74/*
82 * 'dmm' class 75 * 'dmm' class
83 * instance(s): dmm 76 * instance(s): dmm
84 */ 77 */
@@ -92,51 +85,17 @@ static struct omap_hwmod_irq_info omap44xx_dmm_irqs[] = {
92 { .irq = -1 } 85 { .irq = -1 }
93}; 86};
94 87
95/* l3_main_1 -> dmm */
96static struct omap_hwmod_ocp_if omap44xx_l3_main_1__dmm = {
97 .master = &omap44xx_l3_main_1_hwmod,
98 .slave = &omap44xx_dmm_hwmod,
99 .clk = "l3_div_ck",
100 .user = OCP_USER_SDMA,
101};
102
103static struct omap_hwmod_addr_space omap44xx_dmm_addrs[] = {
104 {
105 .pa_start = 0x4e000000,
106 .pa_end = 0x4e0007ff,
107 .flags = ADDR_TYPE_RT
108 },
109 { }
110};
111
112/* mpu -> dmm */
113static struct omap_hwmod_ocp_if omap44xx_mpu__dmm = {
114 .master = &omap44xx_mpu_hwmod,
115 .slave = &omap44xx_dmm_hwmod,
116 .clk = "l3_div_ck",
117 .addr = omap44xx_dmm_addrs,
118 .user = OCP_USER_MPU,
119};
120
121/* dmm slave ports */
122static struct omap_hwmod_ocp_if *omap44xx_dmm_slaves[] = {
123 &omap44xx_l3_main_1__dmm,
124 &omap44xx_mpu__dmm,
125};
126
127static struct omap_hwmod omap44xx_dmm_hwmod = { 88static struct omap_hwmod omap44xx_dmm_hwmod = {
128 .name = "dmm", 89 .name = "dmm",
129 .class = &omap44xx_dmm_hwmod_class, 90 .class = &omap44xx_dmm_hwmod_class,
130 .clkdm_name = "l3_emif_clkdm", 91 .clkdm_name = "l3_emif_clkdm",
92 .mpu_irqs = omap44xx_dmm_irqs,
131 .prcm = { 93 .prcm = {
132 .omap4 = { 94 .omap4 = {
133 .clkctrl_offs = OMAP4_CM_MEMIF_DMM_CLKCTRL_OFFSET, 95 .clkctrl_offs = OMAP4_CM_MEMIF_DMM_CLKCTRL_OFFSET,
134 .context_offs = OMAP4_RM_MEMIF_DMM_CONTEXT_OFFSET, 96 .context_offs = OMAP4_RM_MEMIF_DMM_CONTEXT_OFFSET,
135 }, 97 },
136 }, 98 },
137 .slaves = omap44xx_dmm_slaves,
138 .slaves_cnt = ARRAY_SIZE(omap44xx_dmm_slaves),
139 .mpu_irqs = omap44xx_dmm_irqs,
140}; 99};
141 100
142/* 101/*
@@ -148,38 +107,6 @@ static struct omap_hwmod_class omap44xx_emif_fw_hwmod_class = {
148}; 107};
149 108
150/* emif_fw */ 109/* emif_fw */
151/* dmm -> emif_fw */
152static struct omap_hwmod_ocp_if omap44xx_dmm__emif_fw = {
153 .master = &omap44xx_dmm_hwmod,
154 .slave = &omap44xx_emif_fw_hwmod,
155 .clk = "l3_div_ck",
156 .user = OCP_USER_MPU | OCP_USER_SDMA,
157};
158
159static struct omap_hwmod_addr_space omap44xx_emif_fw_addrs[] = {
160 {
161 .pa_start = 0x4a20c000,
162 .pa_end = 0x4a20c0ff,
163 .flags = ADDR_TYPE_RT
164 },
165 { }
166};
167
168/* l4_cfg -> emif_fw */
169static struct omap_hwmod_ocp_if omap44xx_l4_cfg__emif_fw = {
170 .master = &omap44xx_l4_cfg_hwmod,
171 .slave = &omap44xx_emif_fw_hwmod,
172 .clk = "l4_div_ck",
173 .addr = omap44xx_emif_fw_addrs,
174 .user = OCP_USER_MPU,
175};
176
177/* emif_fw slave ports */
178static struct omap_hwmod_ocp_if *omap44xx_emif_fw_slaves[] = {
179 &omap44xx_dmm__emif_fw,
180 &omap44xx_l4_cfg__emif_fw,
181};
182
183static struct omap_hwmod omap44xx_emif_fw_hwmod = { 110static struct omap_hwmod omap44xx_emif_fw_hwmod = {
184 .name = "emif_fw", 111 .name = "emif_fw",
185 .class = &omap44xx_emif_fw_hwmod_class, 112 .class = &omap44xx_emif_fw_hwmod_class,
@@ -190,8 +117,6 @@ static struct omap_hwmod omap44xx_emif_fw_hwmod = {
190 .context_offs = OMAP4_RM_MEMIF_EMIF_FW_CONTEXT_OFFSET, 117 .context_offs = OMAP4_RM_MEMIF_EMIF_FW_CONTEXT_OFFSET,
191 }, 118 },
192 }, 119 },
193 .slaves = omap44xx_emif_fw_slaves,
194 .slaves_cnt = ARRAY_SIZE(omap44xx_emif_fw_slaves),
195}; 120};
196 121
197/* 122/*
@@ -203,28 +128,6 @@ static struct omap_hwmod_class omap44xx_l3_hwmod_class = {
203}; 128};
204 129
205/* l3_instr */ 130/* l3_instr */
206/* iva -> l3_instr */
207static struct omap_hwmod_ocp_if omap44xx_iva__l3_instr = {
208 .master = &omap44xx_iva_hwmod,
209 .slave = &omap44xx_l3_instr_hwmod,
210 .clk = "l3_div_ck",
211 .user = OCP_USER_MPU | OCP_USER_SDMA,
212};
213
214/* l3_main_3 -> l3_instr */
215static struct omap_hwmod_ocp_if omap44xx_l3_main_3__l3_instr = {
216 .master = &omap44xx_l3_main_3_hwmod,
217 .slave = &omap44xx_l3_instr_hwmod,
218 .clk = "l3_div_ck",
219 .user = OCP_USER_MPU | OCP_USER_SDMA,
220};
221
222/* l3_instr slave ports */
223static struct omap_hwmod_ocp_if *omap44xx_l3_instr_slaves[] = {
224 &omap44xx_iva__l3_instr,
225 &omap44xx_l3_main_3__l3_instr,
226};
227
228static struct omap_hwmod omap44xx_l3_instr_hwmod = { 131static struct omap_hwmod omap44xx_l3_instr_hwmod = {
229 .name = "l3_instr", 132 .name = "l3_instr",
230 .class = &omap44xx_l3_hwmod_class, 133 .class = &omap44xx_l3_hwmod_class,
@@ -236,8 +139,6 @@ static struct omap_hwmod omap44xx_l3_instr_hwmod = {
236 .modulemode = MODULEMODE_HWCTRL, 139 .modulemode = MODULEMODE_HWCTRL,
237 }, 140 },
238 }, 141 },
239 .slaves = omap44xx_l3_instr_slaves,
240 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_instr_slaves),
241}; 142};
242 143
243/* l3_main_1 */ 144/* l3_main_1 */
@@ -247,83 +148,6 @@ static struct omap_hwmod_irq_info omap44xx_l3_main_1_irqs[] = {
247 { .irq = -1 } 148 { .irq = -1 }
248}; 149};
249 150
250/* dsp -> l3_main_1 */
251static struct omap_hwmod_ocp_if omap44xx_dsp__l3_main_1 = {
252 .master = &omap44xx_dsp_hwmod,
253 .slave = &omap44xx_l3_main_1_hwmod,
254 .clk = "l3_div_ck",
255 .user = OCP_USER_MPU | OCP_USER_SDMA,
256};
257
258/* dss -> l3_main_1 */
259static struct omap_hwmod_ocp_if omap44xx_dss__l3_main_1 = {
260 .master = &omap44xx_dss_hwmod,
261 .slave = &omap44xx_l3_main_1_hwmod,
262 .clk = "l3_div_ck",
263 .user = OCP_USER_MPU | OCP_USER_SDMA,
264};
265
266/* l3_main_2 -> l3_main_1 */
267static struct omap_hwmod_ocp_if omap44xx_l3_main_2__l3_main_1 = {
268 .master = &omap44xx_l3_main_2_hwmod,
269 .slave = &omap44xx_l3_main_1_hwmod,
270 .clk = "l3_div_ck",
271 .user = OCP_USER_MPU | OCP_USER_SDMA,
272};
273
274/* l4_cfg -> l3_main_1 */
275static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_1 = {
276 .master = &omap44xx_l4_cfg_hwmod,
277 .slave = &omap44xx_l3_main_1_hwmod,
278 .clk = "l4_div_ck",
279 .user = OCP_USER_MPU | OCP_USER_SDMA,
280};
281
282/* mmc1 -> l3_main_1 */
283static struct omap_hwmod_ocp_if omap44xx_mmc1__l3_main_1 = {
284 .master = &omap44xx_mmc1_hwmod,
285 .slave = &omap44xx_l3_main_1_hwmod,
286 .clk = "l3_div_ck",
287 .user = OCP_USER_MPU | OCP_USER_SDMA,
288};
289
290/* mmc2 -> l3_main_1 */
291static struct omap_hwmod_ocp_if omap44xx_mmc2__l3_main_1 = {
292 .master = &omap44xx_mmc2_hwmod,
293 .slave = &omap44xx_l3_main_1_hwmod,
294 .clk = "l3_div_ck",
295 .user = OCP_USER_MPU | OCP_USER_SDMA,
296};
297
298static struct omap_hwmod_addr_space omap44xx_l3_main_1_addrs[] = {
299 {
300 .pa_start = 0x44000000,
301 .pa_end = 0x44000fff,
302 .flags = ADDR_TYPE_RT
303 },
304 { }
305};
306
307/* mpu -> l3_main_1 */
308static struct omap_hwmod_ocp_if omap44xx_mpu__l3_main_1 = {
309 .master = &omap44xx_mpu_hwmod,
310 .slave = &omap44xx_l3_main_1_hwmod,
311 .clk = "l3_div_ck",
312 .addr = omap44xx_l3_main_1_addrs,
313 .user = OCP_USER_MPU,
314};
315
316/* l3_main_1 slave ports */
317static struct omap_hwmod_ocp_if *omap44xx_l3_main_1_slaves[] = {
318 &omap44xx_dsp__l3_main_1,
319 &omap44xx_dss__l3_main_1,
320 &omap44xx_l3_main_2__l3_main_1,
321 &omap44xx_l4_cfg__l3_main_1,
322 &omap44xx_mmc1__l3_main_1,
323 &omap44xx_mmc2__l3_main_1,
324 &omap44xx_mpu__l3_main_1,
325};
326
327static struct omap_hwmod omap44xx_l3_main_1_hwmod = { 151static struct omap_hwmod omap44xx_l3_main_1_hwmod = {
328 .name = "l3_main_1", 152 .name = "l3_main_1",
329 .class = &omap44xx_l3_hwmod_class, 153 .class = &omap44xx_l3_hwmod_class,
@@ -335,97 +159,9 @@ static struct omap_hwmod omap44xx_l3_main_1_hwmod = {
335 .context_offs = OMAP4_RM_L3_1_L3_1_CONTEXT_OFFSET, 159 .context_offs = OMAP4_RM_L3_1_L3_1_CONTEXT_OFFSET,
336 }, 160 },
337 }, 161 },
338 .slaves = omap44xx_l3_main_1_slaves,
339 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_main_1_slaves),
340}; 162};
341 163
342/* l3_main_2 */ 164/* l3_main_2 */
343/* dma_system -> l3_main_2 */
344static struct omap_hwmod_ocp_if omap44xx_dma_system__l3_main_2 = {
345 .master = &omap44xx_dma_system_hwmod,
346 .slave = &omap44xx_l3_main_2_hwmod,
347 .clk = "l3_div_ck",
348 .user = OCP_USER_MPU | OCP_USER_SDMA,
349};
350
351/* hsi -> l3_main_2 */
352static struct omap_hwmod_ocp_if omap44xx_hsi__l3_main_2 = {
353 .master = &omap44xx_hsi_hwmod,
354 .slave = &omap44xx_l3_main_2_hwmod,
355 .clk = "l3_div_ck",
356 .user = OCP_USER_MPU | OCP_USER_SDMA,
357};
358
359/* ipu -> l3_main_2 */
360static struct omap_hwmod_ocp_if omap44xx_ipu__l3_main_2 = {
361 .master = &omap44xx_ipu_hwmod,
362 .slave = &omap44xx_l3_main_2_hwmod,
363 .clk = "l3_div_ck",
364 .user = OCP_USER_MPU | OCP_USER_SDMA,
365};
366
367/* iss -> l3_main_2 */
368static struct omap_hwmod_ocp_if omap44xx_iss__l3_main_2 = {
369 .master = &omap44xx_iss_hwmod,
370 .slave = &omap44xx_l3_main_2_hwmod,
371 .clk = "l3_div_ck",
372 .user = OCP_USER_MPU | OCP_USER_SDMA,
373};
374
375/* iva -> l3_main_2 */
376static struct omap_hwmod_ocp_if omap44xx_iva__l3_main_2 = {
377 .master = &omap44xx_iva_hwmod,
378 .slave = &omap44xx_l3_main_2_hwmod,
379 .clk = "l3_div_ck",
380 .user = OCP_USER_MPU | OCP_USER_SDMA,
381};
382
383static struct omap_hwmod_addr_space omap44xx_l3_main_2_addrs[] = {
384 {
385 .pa_start = 0x44800000,
386 .pa_end = 0x44801fff,
387 .flags = ADDR_TYPE_RT
388 },
389 { }
390};
391
392/* l3_main_1 -> l3_main_2 */
393static struct omap_hwmod_ocp_if omap44xx_l3_main_1__l3_main_2 = {
394 .master = &omap44xx_l3_main_1_hwmod,
395 .slave = &omap44xx_l3_main_2_hwmod,
396 .clk = "l3_div_ck",
397 .addr = omap44xx_l3_main_2_addrs,
398 .user = OCP_USER_MPU,
399};
400
401/* l4_cfg -> l3_main_2 */
402static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_2 = {
403 .master = &omap44xx_l4_cfg_hwmod,
404 .slave = &omap44xx_l3_main_2_hwmod,
405 .clk = "l4_div_ck",
406 .user = OCP_USER_MPU | OCP_USER_SDMA,
407};
408
409/* usb_otg_hs -> l3_main_2 */
410static struct omap_hwmod_ocp_if omap44xx_usb_otg_hs__l3_main_2 = {
411 .master = &omap44xx_usb_otg_hs_hwmod,
412 .slave = &omap44xx_l3_main_2_hwmod,
413 .clk = "l3_div_ck",
414 .user = OCP_USER_MPU | OCP_USER_SDMA,
415};
416
417/* l3_main_2 slave ports */
418static struct omap_hwmod_ocp_if *omap44xx_l3_main_2_slaves[] = {
419 &omap44xx_dma_system__l3_main_2,
420 &omap44xx_hsi__l3_main_2,
421 &omap44xx_ipu__l3_main_2,
422 &omap44xx_iss__l3_main_2,
423 &omap44xx_iva__l3_main_2,
424 &omap44xx_l3_main_1__l3_main_2,
425 &omap44xx_l4_cfg__l3_main_2,
426 &omap44xx_usb_otg_hs__l3_main_2,
427};
428
429static struct omap_hwmod omap44xx_l3_main_2_hwmod = { 165static struct omap_hwmod omap44xx_l3_main_2_hwmod = {
430 .name = "l3_main_2", 166 .name = "l3_main_2",
431 .class = &omap44xx_l3_hwmod_class, 167 .class = &omap44xx_l3_hwmod_class,
@@ -436,52 +172,9 @@ static struct omap_hwmod omap44xx_l3_main_2_hwmod = {
436 .context_offs = OMAP4_RM_L3_2_L3_2_CONTEXT_OFFSET, 172 .context_offs = OMAP4_RM_L3_2_L3_2_CONTEXT_OFFSET,
437 }, 173 },
438 }, 174 },
439 .slaves = omap44xx_l3_main_2_slaves,
440 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_main_2_slaves),
441}; 175};
442 176
443/* l3_main_3 */ 177/* l3_main_3 */
444static struct omap_hwmod_addr_space omap44xx_l3_main_3_addrs[] = {
445 {
446 .pa_start = 0x45000000,
447 .pa_end = 0x45000fff,
448 .flags = ADDR_TYPE_RT
449 },
450 { }
451};
452
453/* l3_main_1 -> l3_main_3 */
454static struct omap_hwmod_ocp_if omap44xx_l3_main_1__l3_main_3 = {
455 .master = &omap44xx_l3_main_1_hwmod,
456 .slave = &omap44xx_l3_main_3_hwmod,
457 .clk = "l3_div_ck",
458 .addr = omap44xx_l3_main_3_addrs,
459 .user = OCP_USER_MPU,
460};
461
462/* l3_main_2 -> l3_main_3 */
463static struct omap_hwmod_ocp_if omap44xx_l3_main_2__l3_main_3 = {
464 .master = &omap44xx_l3_main_2_hwmod,
465 .slave = &omap44xx_l3_main_3_hwmod,
466 .clk = "l3_div_ck",
467 .user = OCP_USER_MPU | OCP_USER_SDMA,
468};
469
470/* l4_cfg -> l3_main_3 */
471static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_3 = {
472 .master = &omap44xx_l4_cfg_hwmod,
473 .slave = &omap44xx_l3_main_3_hwmod,
474 .clk = "l4_div_ck",
475 .user = OCP_USER_MPU | OCP_USER_SDMA,
476};
477
478/* l3_main_3 slave ports */
479static struct omap_hwmod_ocp_if *omap44xx_l3_main_3_slaves[] = {
480 &omap44xx_l3_main_1__l3_main_3,
481 &omap44xx_l3_main_2__l3_main_3,
482 &omap44xx_l4_cfg__l3_main_3,
483};
484
485static struct omap_hwmod omap44xx_l3_main_3_hwmod = { 178static struct omap_hwmod omap44xx_l3_main_3_hwmod = {
486 .name = "l3_main_3", 179 .name = "l3_main_3",
487 .class = &omap44xx_l3_hwmod_class, 180 .class = &omap44xx_l3_hwmod_class,
@@ -493,8 +186,6 @@ static struct omap_hwmod omap44xx_l3_main_3_hwmod = {
493 .modulemode = MODULEMODE_HWCTRL, 186 .modulemode = MODULEMODE_HWCTRL,
494 }, 187 },
495 }, 188 },
496 .slaves = omap44xx_l3_main_3_slaves,
497 .slaves_cnt = ARRAY_SIZE(omap44xx_l3_main_3_slaves),
498}; 189};
499 190
500/* 191/*
@@ -506,46 +197,6 @@ static struct omap_hwmod_class omap44xx_l4_hwmod_class = {
506}; 197};
507 198
508/* l4_abe */ 199/* l4_abe */
509/* aess -> l4_abe */
510static struct omap_hwmod_ocp_if omap44xx_aess__l4_abe = {
511 .master = &omap44xx_aess_hwmod,
512 .slave = &omap44xx_l4_abe_hwmod,
513 .clk = "ocp_abe_iclk",
514 .user = OCP_USER_MPU | OCP_USER_SDMA,
515};
516
517/* dsp -> l4_abe */
518static struct omap_hwmod_ocp_if omap44xx_dsp__l4_abe = {
519 .master = &omap44xx_dsp_hwmod,
520 .slave = &omap44xx_l4_abe_hwmod,
521 .clk = "ocp_abe_iclk",
522 .user = OCP_USER_MPU | OCP_USER_SDMA,
523};
524
525/* l3_main_1 -> l4_abe */
526static struct omap_hwmod_ocp_if omap44xx_l3_main_1__l4_abe = {
527 .master = &omap44xx_l3_main_1_hwmod,
528 .slave = &omap44xx_l4_abe_hwmod,
529 .clk = "l3_div_ck",
530 .user = OCP_USER_MPU | OCP_USER_SDMA,
531};
532
533/* mpu -> l4_abe */
534static struct omap_hwmod_ocp_if omap44xx_mpu__l4_abe = {
535 .master = &omap44xx_mpu_hwmod,
536 .slave = &omap44xx_l4_abe_hwmod,
537 .clk = "ocp_abe_iclk",
538 .user = OCP_USER_MPU | OCP_USER_SDMA,
539};
540
541/* l4_abe slave ports */
542static struct omap_hwmod_ocp_if *omap44xx_l4_abe_slaves[] = {
543 &omap44xx_aess__l4_abe,
544 &omap44xx_dsp__l4_abe,
545 &omap44xx_l3_main_1__l4_abe,
546 &omap44xx_mpu__l4_abe,
547};
548
549static struct omap_hwmod omap44xx_l4_abe_hwmod = { 200static struct omap_hwmod omap44xx_l4_abe_hwmod = {
550 .name = "l4_abe", 201 .name = "l4_abe",
551 .class = &omap44xx_l4_hwmod_class, 202 .class = &omap44xx_l4_hwmod_class,
@@ -555,24 +206,9 @@ static struct omap_hwmod omap44xx_l4_abe_hwmod = {
555 .clkctrl_offs = OMAP4_CM1_ABE_L4ABE_CLKCTRL_OFFSET, 206 .clkctrl_offs = OMAP4_CM1_ABE_L4ABE_CLKCTRL_OFFSET,
556 }, 207 },
557 }, 208 },
558 .slaves = omap44xx_l4_abe_slaves,
559 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_abe_slaves),
560}; 209};
561 210
562/* l4_cfg */ 211/* l4_cfg */
563/* l3_main_1 -> l4_cfg */
564static struct omap_hwmod_ocp_if omap44xx_l3_main_1__l4_cfg = {
565 .master = &omap44xx_l3_main_1_hwmod,
566 .slave = &omap44xx_l4_cfg_hwmod,
567 .clk = "l3_div_ck",
568 .user = OCP_USER_MPU | OCP_USER_SDMA,
569};
570
571/* l4_cfg slave ports */
572static struct omap_hwmod_ocp_if *omap44xx_l4_cfg_slaves[] = {
573 &omap44xx_l3_main_1__l4_cfg,
574};
575
576static struct omap_hwmod omap44xx_l4_cfg_hwmod = { 212static struct omap_hwmod omap44xx_l4_cfg_hwmod = {
577 .name = "l4_cfg", 213 .name = "l4_cfg",
578 .class = &omap44xx_l4_hwmod_class, 214 .class = &omap44xx_l4_hwmod_class,
@@ -583,24 +219,9 @@ static struct omap_hwmod omap44xx_l4_cfg_hwmod = {
583 .context_offs = OMAP4_RM_L4CFG_L4_CFG_CONTEXT_OFFSET, 219 .context_offs = OMAP4_RM_L4CFG_L4_CFG_CONTEXT_OFFSET,
584 }, 220 },
585 }, 221 },
586 .slaves = omap44xx_l4_cfg_slaves,
587 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_cfg_slaves),
588}; 222};
589 223
590/* l4_per */ 224/* l4_per */
591/* l3_main_2 -> l4_per */
592static struct omap_hwmod_ocp_if omap44xx_l3_main_2__l4_per = {
593 .master = &omap44xx_l3_main_2_hwmod,
594 .slave = &omap44xx_l4_per_hwmod,
595 .clk = "l3_div_ck",
596 .user = OCP_USER_MPU | OCP_USER_SDMA,
597};
598
599/* l4_per slave ports */
600static struct omap_hwmod_ocp_if *omap44xx_l4_per_slaves[] = {
601 &omap44xx_l3_main_2__l4_per,
602};
603
604static struct omap_hwmod omap44xx_l4_per_hwmod = { 225static struct omap_hwmod omap44xx_l4_per_hwmod = {
605 .name = "l4_per", 226 .name = "l4_per",
606 .class = &omap44xx_l4_hwmod_class, 227 .class = &omap44xx_l4_hwmod_class,
@@ -611,24 +232,9 @@ static struct omap_hwmod omap44xx_l4_per_hwmod = {
611 .context_offs = OMAP4_RM_L4PER_L4_PER_CONTEXT_OFFSET, 232 .context_offs = OMAP4_RM_L4PER_L4_PER_CONTEXT_OFFSET,
612 }, 233 },
613 }, 234 },
614 .slaves = omap44xx_l4_per_slaves,
615 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_per_slaves),
616}; 235};
617 236
618/* l4_wkup */ 237/* l4_wkup */
619/* l4_cfg -> l4_wkup */
620static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l4_wkup = {
621 .master = &omap44xx_l4_cfg_hwmod,
622 .slave = &omap44xx_l4_wkup_hwmod,
623 .clk = "l4_div_ck",
624 .user = OCP_USER_MPU | OCP_USER_SDMA,
625};
626
627/* l4_wkup slave ports */
628static struct omap_hwmod_ocp_if *omap44xx_l4_wkup_slaves[] = {
629 &omap44xx_l4_cfg__l4_wkup,
630};
631
632static struct omap_hwmod omap44xx_l4_wkup_hwmod = { 238static struct omap_hwmod omap44xx_l4_wkup_hwmod = {
633 .name = "l4_wkup", 239 .name = "l4_wkup",
634 .class = &omap44xx_l4_hwmod_class, 240 .class = &omap44xx_l4_hwmod_class,
@@ -639,8 +245,6 @@ static struct omap_hwmod omap44xx_l4_wkup_hwmod = {
639 .context_offs = OMAP4_RM_WKUP_L4WKUP_CONTEXT_OFFSET, 245 .context_offs = OMAP4_RM_WKUP_L4WKUP_CONTEXT_OFFSET,
640 }, 246 },
641 }, 247 },
642 .slaves = omap44xx_l4_wkup_slaves,
643 .slaves_cnt = ARRAY_SIZE(omap44xx_l4_wkup_slaves),
644}; 248};
645 249
646/* 250/*
@@ -652,25 +256,32 @@ static struct omap_hwmod_class omap44xx_mpu_bus_hwmod_class = {
652}; 256};
653 257
654/* mpu_private */ 258/* mpu_private */
655/* mpu -> mpu_private */
656static struct omap_hwmod_ocp_if omap44xx_mpu__mpu_private = {
657 .master = &omap44xx_mpu_hwmod,
658 .slave = &omap44xx_mpu_private_hwmod,
659 .clk = "l3_div_ck",
660 .user = OCP_USER_MPU | OCP_USER_SDMA,
661};
662
663/* mpu_private slave ports */
664static struct omap_hwmod_ocp_if *omap44xx_mpu_private_slaves[] = {
665 &omap44xx_mpu__mpu_private,
666};
667
668static struct omap_hwmod omap44xx_mpu_private_hwmod = { 259static struct omap_hwmod omap44xx_mpu_private_hwmod = {
669 .name = "mpu_private", 260 .name = "mpu_private",
670 .class = &omap44xx_mpu_bus_hwmod_class, 261 .class = &omap44xx_mpu_bus_hwmod_class,
671 .clkdm_name = "mpuss_clkdm", 262 .clkdm_name = "mpuss_clkdm",
672 .slaves = omap44xx_mpu_private_slaves, 263};
673 .slaves_cnt = ARRAY_SIZE(omap44xx_mpu_private_slaves), 264
265/*
266 * 'ocp_wp_noc' class
267 * instance(s): ocp_wp_noc
268 */
269static struct omap_hwmod_class omap44xx_ocp_wp_noc_hwmod_class = {
270 .name = "ocp_wp_noc",
271};
272
273/* ocp_wp_noc */
274static struct omap_hwmod omap44xx_ocp_wp_noc_hwmod = {
275 .name = "ocp_wp_noc",
276 .class = &omap44xx_ocp_wp_noc_hwmod_class,
277 .clkdm_name = "l3_instr_clkdm",
278 .prcm = {
279 .omap4 = {
280 .clkctrl_offs = OMAP4_CM_L3INSTR_OCP_WP1_CLKCTRL_OFFSET,
281 .context_offs = OMAP4_RM_L3INSTR_OCP_WP1_CONTEXT_OFFSET,
282 .modulemode = MODULEMODE_HWCTRL,
283 },
284 },
674}; 285};
675 286
676/* 287/*
@@ -681,41 +292,7 @@ static struct omap_hwmod omap44xx_mpu_private_hwmod = {
681 * - They still need to be validated with the driver 292 * - They still need to be validated with the driver
682 * properly adapted to omap_hwmod / omap_device 293 * properly adapted to omap_hwmod / omap_device
683 * 294 *
684 * c2c 295 * usim
685 * c2c_target_fw
686 * cm_core
687 * cm_core_aon
688 * ctrl_module_core
689 * ctrl_module_pad_core
690 * ctrl_module_pad_wkup
691 * ctrl_module_wkup
692 * debugss
693 * efuse_ctrl_cust
694 * efuse_ctrl_std
695 * elm
696 * emif1
697 * emif2
698 * fdif
699 * gpmc
700 * gpu
701 * hdq1w
702 * mcasp
703 * mpu_c0
704 * mpu_c1
705 * ocmc_ram
706 * ocp2scp_usb_phy
707 * ocp_wp_noc
708 * prcm_mpu
709 * prm
710 * scrm
711 * sl2if
712 * slimbus1
713 * slimbus2
714 * usb_host_fs
715 * usb_host_hs
716 * usb_phy_cm
717 * usb_tll_hs
718 * usim
719 */ 296 */
720 297
721/* 298/*
@@ -756,53 +333,6 @@ static struct omap_hwmod_dma_info omap44xx_aess_sdma_reqs[] = {
756 { .dma_req = -1 } 333 { .dma_req = -1 }
757}; 334};
758 335
759/* aess master ports */
760static struct omap_hwmod_ocp_if *omap44xx_aess_masters[] = {
761 &omap44xx_aess__l4_abe,
762};
763
764static struct omap_hwmod_addr_space omap44xx_aess_addrs[] = {
765 {
766 .pa_start = 0x401f1000,
767 .pa_end = 0x401f13ff,
768 .flags = ADDR_TYPE_RT
769 },
770 { }
771};
772
773/* l4_abe -> aess */
774static struct omap_hwmod_ocp_if omap44xx_l4_abe__aess = {
775 .master = &omap44xx_l4_abe_hwmod,
776 .slave = &omap44xx_aess_hwmod,
777 .clk = "ocp_abe_iclk",
778 .addr = omap44xx_aess_addrs,
779 .user = OCP_USER_MPU,
780};
781
782static struct omap_hwmod_addr_space omap44xx_aess_dma_addrs[] = {
783 {
784 .pa_start = 0x490f1000,
785 .pa_end = 0x490f13ff,
786 .flags = ADDR_TYPE_RT
787 },
788 { }
789};
790
791/* l4_abe -> aess (dma) */
792static struct omap_hwmod_ocp_if omap44xx_l4_abe__aess_dma = {
793 .master = &omap44xx_l4_abe_hwmod,
794 .slave = &omap44xx_aess_hwmod,
795 .clk = "ocp_abe_iclk",
796 .addr = omap44xx_aess_dma_addrs,
797 .user = OCP_USER_SDMA,
798};
799
800/* aess slave ports */
801static struct omap_hwmod_ocp_if *omap44xx_aess_slaves[] = {
802 &omap44xx_l4_abe__aess,
803 &omap44xx_l4_abe__aess_dma,
804};
805
806static struct omap_hwmod omap44xx_aess_hwmod = { 336static struct omap_hwmod omap44xx_aess_hwmod = {
807 .name = "aess", 337 .name = "aess",
808 .class = &omap44xx_aess_hwmod_class, 338 .class = &omap44xx_aess_hwmod_class,
@@ -817,37 +347,41 @@ static struct omap_hwmod omap44xx_aess_hwmod = {
817 .modulemode = MODULEMODE_SWCTRL, 347 .modulemode = MODULEMODE_SWCTRL,
818 }, 348 },
819 }, 349 },
820 .slaves = omap44xx_aess_slaves,
821 .slaves_cnt = ARRAY_SIZE(omap44xx_aess_slaves),
822 .masters = omap44xx_aess_masters,
823 .masters_cnt = ARRAY_SIZE(omap44xx_aess_masters),
824}; 350};
825 351
826/* 352/*
827 * 'bandgap' class 353 * 'c2c' class
828 * bangap reference for ldo regulators 354 * chip 2 chip interface used to plug the ape soc (omap) with an external modem
355 * soc
829 */ 356 */
830 357
831static struct omap_hwmod_class omap44xx_bandgap_hwmod_class = { 358static struct omap_hwmod_class omap44xx_c2c_hwmod_class = {
832 .name = "bandgap", 359 .name = "c2c",
833}; 360};
834 361
835/* bandgap */ 362/* c2c */
836static struct omap_hwmod_opt_clk bandgap_opt_clks[] = { 363static struct omap_hwmod_irq_info omap44xx_c2c_irqs[] = {
837 { .role = "fclk", .clk = "bandgap_fclk" }, 364 { .irq = 88 + OMAP44XX_IRQ_GIC_START },
365 { .irq = -1 }
838}; 366};
839 367
840static struct omap_hwmod omap44xx_bandgap_hwmod = { 368static struct omap_hwmod_dma_info omap44xx_c2c_sdma_reqs[] = {
841 .name = "bandgap", 369 { .dma_req = 68 + OMAP44XX_DMA_REQ_START },
842 .class = &omap44xx_bandgap_hwmod_class, 370 { .dma_req = -1 }
843 .clkdm_name = "l4_wkup_clkdm", 371};
372
373static struct omap_hwmod omap44xx_c2c_hwmod = {
374 .name = "c2c",
375 .class = &omap44xx_c2c_hwmod_class,
376 .clkdm_name = "d2d_clkdm",
377 .mpu_irqs = omap44xx_c2c_irqs,
378 .sdma_reqs = omap44xx_c2c_sdma_reqs,
844 .prcm = { 379 .prcm = {
845 .omap4 = { 380 .omap4 = {
846 .clkctrl_offs = OMAP4_CM_WKUP_BANDGAP_CLKCTRL_OFFSET, 381 .clkctrl_offs = OMAP4_CM_D2D_SAD2D_CLKCTRL_OFFSET,
382 .context_offs = OMAP4_RM_D2D_SAD2D_CONTEXT_OFFSET,
847 }, 383 },
848 }, 384 },
849 .opt_clks = bandgap_opt_clks,
850 .opt_clks_cnt = ARRAY_SIZE(bandgap_opt_clks),
851}; 385};
852 386
853/* 387/*
@@ -870,30 +404,6 @@ static struct omap_hwmod_class omap44xx_counter_hwmod_class = {
870}; 404};
871 405
872/* counter_32k */ 406/* counter_32k */
873static struct omap_hwmod omap44xx_counter_32k_hwmod;
874static struct omap_hwmod_addr_space omap44xx_counter_32k_addrs[] = {
875 {
876 .pa_start = 0x4a304000,
877 .pa_end = 0x4a30401f,
878 .flags = ADDR_TYPE_RT
879 },
880 { }
881};
882
883/* l4_wkup -> counter_32k */
884static struct omap_hwmod_ocp_if omap44xx_l4_wkup__counter_32k = {
885 .master = &omap44xx_l4_wkup_hwmod,
886 .slave = &omap44xx_counter_32k_hwmod,
887 .clk = "l4_wkup_clk_mux_ck",
888 .addr = omap44xx_counter_32k_addrs,
889 .user = OCP_USER_MPU | OCP_USER_SDMA,
890};
891
892/* counter_32k slave ports */
893static struct omap_hwmod_ocp_if *omap44xx_counter_32k_slaves[] = {
894 &omap44xx_l4_wkup__counter_32k,
895};
896
897static struct omap_hwmod omap44xx_counter_32k_hwmod = { 407static struct omap_hwmod omap44xx_counter_32k_hwmod = {
898 .name = "counter_32k", 408 .name = "counter_32k",
899 .class = &omap44xx_counter_hwmod_class, 409 .class = &omap44xx_counter_hwmod_class,
@@ -906,8 +416,83 @@ static struct omap_hwmod omap44xx_counter_32k_hwmod = {
906 .context_offs = OMAP4_RM_WKUP_SYNCTIMER_CONTEXT_OFFSET, 416 .context_offs = OMAP4_RM_WKUP_SYNCTIMER_CONTEXT_OFFSET,
907 }, 417 },
908 }, 418 },
909 .slaves = omap44xx_counter_32k_slaves, 419};
910 .slaves_cnt = ARRAY_SIZE(omap44xx_counter_32k_slaves), 420
421/*
422 * 'ctrl_module' class
423 * attila core control module + core pad control module + wkup pad control
424 * module + attila wkup control module
425 */
426
427static struct omap_hwmod_class_sysconfig omap44xx_ctrl_module_sysc = {
428 .rev_offs = 0x0000,
429 .sysc_offs = 0x0010,
430 .sysc_flags = SYSC_HAS_SIDLEMODE,
431 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
432 SIDLE_SMART_WKUP),
433 .sysc_fields = &omap_hwmod_sysc_type2,
434};
435
436static struct omap_hwmod_class omap44xx_ctrl_module_hwmod_class = {
437 .name = "ctrl_module",
438 .sysc = &omap44xx_ctrl_module_sysc,
439};
440
441/* ctrl_module_core */
442static struct omap_hwmod_irq_info omap44xx_ctrl_module_core_irqs[] = {
443 { .irq = 8 + OMAP44XX_IRQ_GIC_START },
444 { .irq = -1 }
445};
446
447static struct omap_hwmod omap44xx_ctrl_module_core_hwmod = {
448 .name = "ctrl_module_core",
449 .class = &omap44xx_ctrl_module_hwmod_class,
450 .clkdm_name = "l4_cfg_clkdm",
451 .mpu_irqs = omap44xx_ctrl_module_core_irqs,
452};
453
454/* ctrl_module_pad_core */
455static struct omap_hwmod omap44xx_ctrl_module_pad_core_hwmod = {
456 .name = "ctrl_module_pad_core",
457 .class = &omap44xx_ctrl_module_hwmod_class,
458 .clkdm_name = "l4_cfg_clkdm",
459};
460
461/* ctrl_module_wkup */
462static struct omap_hwmod omap44xx_ctrl_module_wkup_hwmod = {
463 .name = "ctrl_module_wkup",
464 .class = &omap44xx_ctrl_module_hwmod_class,
465 .clkdm_name = "l4_wkup_clkdm",
466};
467
468/* ctrl_module_pad_wkup */
469static struct omap_hwmod omap44xx_ctrl_module_pad_wkup_hwmod = {
470 .name = "ctrl_module_pad_wkup",
471 .class = &omap44xx_ctrl_module_hwmod_class,
472 .clkdm_name = "l4_wkup_clkdm",
473};
474
475/*
476 * 'debugss' class
477 * debug and emulation sub system
478 */
479
480static struct omap_hwmod_class omap44xx_debugss_hwmod_class = {
481 .name = "debugss",
482};
483
484/* debugss */
485static struct omap_hwmod omap44xx_debugss_hwmod = {
486 .name = "debugss",
487 .class = &omap44xx_debugss_hwmod_class,
488 .clkdm_name = "emu_sys_clkdm",
489 .main_clk = "trace_clk_div_ck",
490 .prcm = {
491 .omap4 = {
492 .clkctrl_offs = OMAP4_CM_EMU_DEBUGSS_CLKCTRL_OFFSET,
493 .context_offs = OMAP4_RM_EMU_DEBUGSS_CONTEXT_OFFSET,
494 },
495 },
911}; 496};
912 497
913/* 498/*
@@ -950,34 +535,6 @@ static struct omap_hwmod_irq_info omap44xx_dma_system_irqs[] = {
950 { .irq = -1 } 535 { .irq = -1 }
951}; 536};
952 537
953/* dma_system master ports */
954static struct omap_hwmod_ocp_if *omap44xx_dma_system_masters[] = {
955 &omap44xx_dma_system__l3_main_2,
956};
957
958static struct omap_hwmod_addr_space omap44xx_dma_system_addrs[] = {
959 {
960 .pa_start = 0x4a056000,
961 .pa_end = 0x4a056fff,
962 .flags = ADDR_TYPE_RT
963 },
964 { }
965};
966
967/* l4_cfg -> dma_system */
968static struct omap_hwmod_ocp_if omap44xx_l4_cfg__dma_system = {
969 .master = &omap44xx_l4_cfg_hwmod,
970 .slave = &omap44xx_dma_system_hwmod,
971 .clk = "l4_div_ck",
972 .addr = omap44xx_dma_system_addrs,
973 .user = OCP_USER_MPU | OCP_USER_SDMA,
974};
975
976/* dma_system slave ports */
977static struct omap_hwmod_ocp_if *omap44xx_dma_system_slaves[] = {
978 &omap44xx_l4_cfg__dma_system,
979};
980
981static struct omap_hwmod omap44xx_dma_system_hwmod = { 538static struct omap_hwmod omap44xx_dma_system_hwmod = {
982 .name = "dma_system", 539 .name = "dma_system",
983 .class = &omap44xx_dma_hwmod_class, 540 .class = &omap44xx_dma_hwmod_class,
@@ -991,10 +548,6 @@ static struct omap_hwmod omap44xx_dma_system_hwmod = {
991 }, 548 },
992 }, 549 },
993 .dev_attr = &dma_dev_attr, 550 .dev_attr = &dma_dev_attr,
994 .slaves = omap44xx_dma_system_slaves,
995 .slaves_cnt = ARRAY_SIZE(omap44xx_dma_system_slaves),
996 .masters = omap44xx_dma_system_masters,
997 .masters_cnt = ARRAY_SIZE(omap44xx_dma_system_masters),
998}; 551};
999 552
1000/* 553/*
@@ -1018,7 +571,6 @@ static struct omap_hwmod_class omap44xx_dmic_hwmod_class = {
1018}; 571};
1019 572
1020/* dmic */ 573/* dmic */
1021static struct omap_hwmod omap44xx_dmic_hwmod;
1022static struct omap_hwmod_irq_info omap44xx_dmic_irqs[] = { 574static struct omap_hwmod_irq_info omap44xx_dmic_irqs[] = {
1023 { .irq = 114 + OMAP44XX_IRQ_GIC_START }, 575 { .irq = 114 + OMAP44XX_IRQ_GIC_START },
1024 { .irq = -1 } 576 { .irq = -1 }
@@ -1029,50 +581,6 @@ static struct omap_hwmod_dma_info omap44xx_dmic_sdma_reqs[] = {
1029 { .dma_req = -1 } 581 { .dma_req = -1 }
1030}; 582};
1031 583
1032static struct omap_hwmod_addr_space omap44xx_dmic_addrs[] = {
1033 {
1034 .name = "mpu",
1035 .pa_start = 0x4012e000,
1036 .pa_end = 0x4012e07f,
1037 .flags = ADDR_TYPE_RT
1038 },
1039 { }
1040};
1041
1042/* l4_abe -> dmic */
1043static struct omap_hwmod_ocp_if omap44xx_l4_abe__dmic = {
1044 .master = &omap44xx_l4_abe_hwmod,
1045 .slave = &omap44xx_dmic_hwmod,
1046 .clk = "ocp_abe_iclk",
1047 .addr = omap44xx_dmic_addrs,
1048 .user = OCP_USER_MPU,
1049};
1050
1051static struct omap_hwmod_addr_space omap44xx_dmic_dma_addrs[] = {
1052 {
1053 .name = "dma",
1054 .pa_start = 0x4902e000,
1055 .pa_end = 0x4902e07f,
1056 .flags = ADDR_TYPE_RT
1057 },
1058 { }
1059};
1060
1061/* l4_abe -> dmic (dma) */
1062static struct omap_hwmod_ocp_if omap44xx_l4_abe__dmic_dma = {
1063 .master = &omap44xx_l4_abe_hwmod,
1064 .slave = &omap44xx_dmic_hwmod,
1065 .clk = "ocp_abe_iclk",
1066 .addr = omap44xx_dmic_dma_addrs,
1067 .user = OCP_USER_SDMA,
1068};
1069
1070/* dmic slave ports */
1071static struct omap_hwmod_ocp_if *omap44xx_dmic_slaves[] = {
1072 &omap44xx_l4_abe__dmic,
1073 &omap44xx_l4_abe__dmic_dma,
1074};
1075
1076static struct omap_hwmod omap44xx_dmic_hwmod = { 584static struct omap_hwmod omap44xx_dmic_hwmod = {
1077 .name = "dmic", 585 .name = "dmic",
1078 .class = &omap44xx_dmic_hwmod_class, 586 .class = &omap44xx_dmic_hwmod_class,
@@ -1087,8 +595,6 @@ static struct omap_hwmod omap44xx_dmic_hwmod = {
1087 .modulemode = MODULEMODE_SWCTRL, 595 .modulemode = MODULEMODE_SWCTRL,
1088 }, 596 },
1089 }, 597 },
1090 .slaves = omap44xx_dmic_slaves,
1091 .slaves_cnt = ARRAY_SIZE(omap44xx_dmic_slaves),
1092}; 598};
1093 599
1094/* 600/*
@@ -1107,53 +613,8 @@ static struct omap_hwmod_irq_info omap44xx_dsp_irqs[] = {
1107}; 613};
1108 614
1109static struct omap_hwmod_rst_info omap44xx_dsp_resets[] = { 615static struct omap_hwmod_rst_info omap44xx_dsp_resets[] = {
1110 { .name = "mmu_cache", .rst_shift = 1 },
1111};
1112
1113static struct omap_hwmod_rst_info omap44xx_dsp_c0_resets[] = {
1114 { .name = "dsp", .rst_shift = 0 }, 616 { .name = "dsp", .rst_shift = 0 },
1115}; 617 { .name = "mmu_cache", .rst_shift = 1 },
1116
1117/* dsp -> iva */
1118static struct omap_hwmod_ocp_if omap44xx_dsp__iva = {
1119 .master = &omap44xx_dsp_hwmod,
1120 .slave = &omap44xx_iva_hwmod,
1121 .clk = "dpll_iva_m5x2_ck",
1122};
1123
1124/* dsp master ports */
1125static struct omap_hwmod_ocp_if *omap44xx_dsp_masters[] = {
1126 &omap44xx_dsp__l3_main_1,
1127 &omap44xx_dsp__l4_abe,
1128 &omap44xx_dsp__iva,
1129};
1130
1131/* l4_cfg -> dsp */
1132static struct omap_hwmod_ocp_if omap44xx_l4_cfg__dsp = {
1133 .master = &omap44xx_l4_cfg_hwmod,
1134 .slave = &omap44xx_dsp_hwmod,
1135 .clk = "l4_div_ck",
1136 .user = OCP_USER_MPU | OCP_USER_SDMA,
1137};
1138
1139/* dsp slave ports */
1140static struct omap_hwmod_ocp_if *omap44xx_dsp_slaves[] = {
1141 &omap44xx_l4_cfg__dsp,
1142};
1143
1144/* Pseudo hwmod for reset control purpose only */
1145static struct omap_hwmod omap44xx_dsp_c0_hwmod = {
1146 .name = "dsp_c0",
1147 .class = &omap44xx_dsp_hwmod_class,
1148 .clkdm_name = "tesla_clkdm",
1149 .flags = HWMOD_INIT_NO_RESET,
1150 .rst_lines = omap44xx_dsp_c0_resets,
1151 .rst_lines_cnt = ARRAY_SIZE(omap44xx_dsp_c0_resets),
1152 .prcm = {
1153 .omap4 = {
1154 .rstctrl_offs = OMAP4_RM_TESLA_RSTCTRL_OFFSET,
1155 },
1156 },
1157}; 618};
1158 619
1159static struct omap_hwmod omap44xx_dsp_hwmod = { 620static struct omap_hwmod omap44xx_dsp_hwmod = {
@@ -1172,10 +633,6 @@ static struct omap_hwmod omap44xx_dsp_hwmod = {
1172 .modulemode = MODULEMODE_HWCTRL, 633 .modulemode = MODULEMODE_HWCTRL,
1173 }, 634 },
1174 }, 635 },
1175 .slaves = omap44xx_dsp_slaves,
1176 .slaves_cnt = ARRAY_SIZE(omap44xx_dsp_slaves),
1177 .masters = omap44xx_dsp_masters,
1178 .masters_cnt = ARRAY_SIZE(omap44xx_dsp_masters),
1179}; 636};
1180 637
1181/* 638/*
@@ -1196,53 +653,6 @@ static struct omap_hwmod_class omap44xx_dss_hwmod_class = {
1196}; 653};
1197 654
1198/* dss */ 655/* dss */
1199/* dss master ports */
1200static struct omap_hwmod_ocp_if *omap44xx_dss_masters[] = {
1201 &omap44xx_dss__l3_main_1,
1202};
1203
1204static struct omap_hwmod_addr_space omap44xx_dss_dma_addrs[] = {
1205 {
1206 .pa_start = 0x58000000,
1207 .pa_end = 0x5800007f,
1208 .flags = ADDR_TYPE_RT
1209 },
1210 { }
1211};
1212
1213/* l3_main_2 -> dss */
1214static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss = {
1215 .master = &omap44xx_l3_main_2_hwmod,
1216 .slave = &omap44xx_dss_hwmod,
1217 .clk = "dss_fck",
1218 .addr = omap44xx_dss_dma_addrs,
1219 .user = OCP_USER_SDMA,
1220};
1221
1222static struct omap_hwmod_addr_space omap44xx_dss_addrs[] = {
1223 {
1224 .pa_start = 0x48040000,
1225 .pa_end = 0x4804007f,
1226 .flags = ADDR_TYPE_RT
1227 },
1228 { }
1229};
1230
1231/* l4_per -> dss */
1232static struct omap_hwmod_ocp_if omap44xx_l4_per__dss = {
1233 .master = &omap44xx_l4_per_hwmod,
1234 .slave = &omap44xx_dss_hwmod,
1235 .clk = "l4_div_ck",
1236 .addr = omap44xx_dss_addrs,
1237 .user = OCP_USER_MPU,
1238};
1239
1240/* dss slave ports */
1241static struct omap_hwmod_ocp_if *omap44xx_dss_slaves[] = {
1242 &omap44xx_l3_main_2__dss,
1243 &omap44xx_l4_per__dss,
1244};
1245
1246static struct omap_hwmod_opt_clk dss_opt_clks[] = { 656static struct omap_hwmod_opt_clk dss_opt_clks[] = {
1247 { .role = "sys_clk", .clk = "dss_sys_clk" }, 657 { .role = "sys_clk", .clk = "dss_sys_clk" },
1248 { .role = "tv_clk", .clk = "dss_tv_clk" }, 658 { .role = "tv_clk", .clk = "dss_tv_clk" },
@@ -1263,10 +673,6 @@ static struct omap_hwmod omap44xx_dss_hwmod = {
1263 }, 673 },
1264 .opt_clks = dss_opt_clks, 674 .opt_clks = dss_opt_clks,
1265 .opt_clks_cnt = ARRAY_SIZE(dss_opt_clks), 675 .opt_clks_cnt = ARRAY_SIZE(dss_opt_clks),
1266 .slaves = omap44xx_dss_slaves,
1267 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_slaves),
1268 .masters = omap44xx_dss_masters,
1269 .masters_cnt = ARRAY_SIZE(omap44xx_dss_masters),
1270}; 676};
1271 677
1272/* 678/*
@@ -1293,7 +699,6 @@ static struct omap_hwmod_class omap44xx_dispc_hwmod_class = {
1293}; 699};
1294 700
1295/* dss_dispc */ 701/* dss_dispc */
1296static struct omap_hwmod omap44xx_dss_dispc_hwmod;
1297static struct omap_hwmod_irq_info omap44xx_dss_dispc_irqs[] = { 702static struct omap_hwmod_irq_info omap44xx_dss_dispc_irqs[] = {
1298 { .irq = 25 + OMAP44XX_IRQ_GIC_START }, 703 { .irq = 25 + OMAP44XX_IRQ_GIC_START },
1299 { .irq = -1 } 704 { .irq = -1 }
@@ -1304,53 +709,11 @@ static struct omap_hwmod_dma_info omap44xx_dss_dispc_sdma_reqs[] = {
1304 { .dma_req = -1 } 709 { .dma_req = -1 }
1305}; 710};
1306 711
1307static struct omap_hwmod_addr_space omap44xx_dss_dispc_dma_addrs[] = {
1308 {
1309 .pa_start = 0x58001000,
1310 .pa_end = 0x58001fff,
1311 .flags = ADDR_TYPE_RT
1312 },
1313 { }
1314};
1315
1316/* l3_main_2 -> dss_dispc */
1317static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dispc = {
1318 .master = &omap44xx_l3_main_2_hwmod,
1319 .slave = &omap44xx_dss_dispc_hwmod,
1320 .clk = "dss_fck",
1321 .addr = omap44xx_dss_dispc_dma_addrs,
1322 .user = OCP_USER_SDMA,
1323};
1324
1325static struct omap_hwmod_addr_space omap44xx_dss_dispc_addrs[] = {
1326 {
1327 .pa_start = 0x48041000,
1328 .pa_end = 0x48041fff,
1329 .flags = ADDR_TYPE_RT
1330 },
1331 { }
1332};
1333
1334static struct omap_dss_dispc_dev_attr omap44xx_dss_dispc_dev_attr = { 712static struct omap_dss_dispc_dev_attr omap44xx_dss_dispc_dev_attr = {
1335 .manager_count = 3, 713 .manager_count = 3,
1336 .has_framedonetv_irq = 1 714 .has_framedonetv_irq = 1
1337}; 715};
1338 716
1339/* l4_per -> dss_dispc */
1340static struct omap_hwmod_ocp_if omap44xx_l4_per__dss_dispc = {
1341 .master = &omap44xx_l4_per_hwmod,
1342 .slave = &omap44xx_dss_dispc_hwmod,
1343 .clk = "l4_div_ck",
1344 .addr = omap44xx_dss_dispc_addrs,
1345 .user = OCP_USER_MPU,
1346};
1347
1348/* dss_dispc slave ports */
1349static struct omap_hwmod_ocp_if *omap44xx_dss_dispc_slaves[] = {
1350 &omap44xx_l3_main_2__dss_dispc,
1351 &omap44xx_l4_per__dss_dispc,
1352};
1353
1354static struct omap_hwmod omap44xx_dss_dispc_hwmod = { 717static struct omap_hwmod omap44xx_dss_dispc_hwmod = {
1355 .name = "dss_dispc", 718 .name = "dss_dispc",
1356 .class = &omap44xx_dispc_hwmod_class, 719 .class = &omap44xx_dispc_hwmod_class,
@@ -1364,8 +727,6 @@ static struct omap_hwmod omap44xx_dss_dispc_hwmod = {
1364 .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET, 727 .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET,
1365 }, 728 },
1366 }, 729 },
1367 .slaves = omap44xx_dss_dispc_slaves,
1368 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_dispc_slaves),
1369 .dev_attr = &omap44xx_dss_dispc_dev_attr 730 .dev_attr = &omap44xx_dss_dispc_dev_attr
1370}; 731};
1371 732
@@ -1391,7 +752,6 @@ static struct omap_hwmod_class omap44xx_dsi_hwmod_class = {
1391}; 752};
1392 753
1393/* dss_dsi1 */ 754/* dss_dsi1 */
1394static struct omap_hwmod omap44xx_dss_dsi1_hwmod;
1395static struct omap_hwmod_irq_info omap44xx_dss_dsi1_irqs[] = { 755static struct omap_hwmod_irq_info omap44xx_dss_dsi1_irqs[] = {
1396 { .irq = 53 + OMAP44XX_IRQ_GIC_START }, 756 { .irq = 53 + OMAP44XX_IRQ_GIC_START },
1397 { .irq = -1 } 757 { .irq = -1 }
@@ -1402,48 +762,6 @@ static struct omap_hwmod_dma_info omap44xx_dss_dsi1_sdma_reqs[] = {
1402 { .dma_req = -1 } 762 { .dma_req = -1 }
1403}; 763};
1404 764
1405static struct omap_hwmod_addr_space omap44xx_dss_dsi1_dma_addrs[] = {
1406 {
1407 .pa_start = 0x58004000,
1408 .pa_end = 0x580041ff,
1409 .flags = ADDR_TYPE_RT
1410 },
1411 { }
1412};
1413
1414/* l3_main_2 -> dss_dsi1 */
1415static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dsi1 = {
1416 .master = &omap44xx_l3_main_2_hwmod,
1417 .slave = &omap44xx_dss_dsi1_hwmod,
1418 .clk = "dss_fck",
1419 .addr = omap44xx_dss_dsi1_dma_addrs,
1420 .user = OCP_USER_SDMA,
1421};
1422
1423static struct omap_hwmod_addr_space omap44xx_dss_dsi1_addrs[] = {
1424 {
1425 .pa_start = 0x48044000,
1426 .pa_end = 0x480441ff,
1427 .flags = ADDR_TYPE_RT
1428 },
1429 { }
1430};
1431
1432/* l4_per -> dss_dsi1 */
1433static struct omap_hwmod_ocp_if omap44xx_l4_per__dss_dsi1 = {
1434 .master = &omap44xx_l4_per_hwmod,
1435 .slave = &omap44xx_dss_dsi1_hwmod,
1436 .clk = "l4_div_ck",
1437 .addr = omap44xx_dss_dsi1_addrs,
1438 .user = OCP_USER_MPU,
1439};
1440
1441/* dss_dsi1 slave ports */
1442static struct omap_hwmod_ocp_if *omap44xx_dss_dsi1_slaves[] = {
1443 &omap44xx_l3_main_2__dss_dsi1,
1444 &omap44xx_l4_per__dss_dsi1,
1445};
1446
1447static struct omap_hwmod_opt_clk dss_dsi1_opt_clks[] = { 765static struct omap_hwmod_opt_clk dss_dsi1_opt_clks[] = {
1448 { .role = "sys_clk", .clk = "dss_sys_clk" }, 766 { .role = "sys_clk", .clk = "dss_sys_clk" },
1449}; 767};
@@ -1463,12 +781,9 @@ static struct omap_hwmod omap44xx_dss_dsi1_hwmod = {
1463 }, 781 },
1464 .opt_clks = dss_dsi1_opt_clks, 782 .opt_clks = dss_dsi1_opt_clks,
1465 .opt_clks_cnt = ARRAY_SIZE(dss_dsi1_opt_clks), 783 .opt_clks_cnt = ARRAY_SIZE(dss_dsi1_opt_clks),
1466 .slaves = omap44xx_dss_dsi1_slaves,
1467 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_dsi1_slaves),
1468}; 784};
1469 785
1470/* dss_dsi2 */ 786/* dss_dsi2 */
1471static struct omap_hwmod omap44xx_dss_dsi2_hwmod;
1472static struct omap_hwmod_irq_info omap44xx_dss_dsi2_irqs[] = { 787static struct omap_hwmod_irq_info omap44xx_dss_dsi2_irqs[] = {
1473 { .irq = 84 + OMAP44XX_IRQ_GIC_START }, 788 { .irq = 84 + OMAP44XX_IRQ_GIC_START },
1474 { .irq = -1 } 789 { .irq = -1 }
@@ -1479,48 +794,6 @@ static struct omap_hwmod_dma_info omap44xx_dss_dsi2_sdma_reqs[] = {
1479 { .dma_req = -1 } 794 { .dma_req = -1 }
1480}; 795};
1481 796
1482static struct omap_hwmod_addr_space omap44xx_dss_dsi2_dma_addrs[] = {
1483 {
1484 .pa_start = 0x58005000,
1485 .pa_end = 0x580051ff,
1486 .flags = ADDR_TYPE_RT
1487 },
1488 { }
1489};
1490
1491/* l3_main_2 -> dss_dsi2 */
1492static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dsi2 = {
1493 .master = &omap44xx_l3_main_2_hwmod,
1494 .slave = &omap44xx_dss_dsi2_hwmod,
1495 .clk = "dss_fck",
1496 .addr = omap44xx_dss_dsi2_dma_addrs,
1497 .user = OCP_USER_SDMA,
1498};
1499
1500static struct omap_hwmod_addr_space omap44xx_dss_dsi2_addrs[] = {
1501 {
1502 .pa_start = 0x48045000,
1503 .pa_end = 0x480451ff,
1504 .flags = ADDR_TYPE_RT
1505 },
1506 { }
1507};
1508
1509/* l4_per -> dss_dsi2 */
1510static struct omap_hwmod_ocp_if omap44xx_l4_per__dss_dsi2 = {
1511 .master = &omap44xx_l4_per_hwmod,
1512 .slave = &omap44xx_dss_dsi2_hwmod,
1513 .clk = "l4_div_ck",
1514 .addr = omap44xx_dss_dsi2_addrs,
1515 .user = OCP_USER_MPU,
1516};
1517
1518/* dss_dsi2 slave ports */
1519static struct omap_hwmod_ocp_if *omap44xx_dss_dsi2_slaves[] = {
1520 &omap44xx_l3_main_2__dss_dsi2,
1521 &omap44xx_l4_per__dss_dsi2,
1522};
1523
1524static struct omap_hwmod_opt_clk dss_dsi2_opt_clks[] = { 797static struct omap_hwmod_opt_clk dss_dsi2_opt_clks[] = {
1525 { .role = "sys_clk", .clk = "dss_sys_clk" }, 798 { .role = "sys_clk", .clk = "dss_sys_clk" },
1526}; 799};
@@ -1540,8 +813,6 @@ static struct omap_hwmod omap44xx_dss_dsi2_hwmod = {
1540 }, 813 },
1541 .opt_clks = dss_dsi2_opt_clks, 814 .opt_clks = dss_dsi2_opt_clks,
1542 .opt_clks_cnt = ARRAY_SIZE(dss_dsi2_opt_clks), 815 .opt_clks_cnt = ARRAY_SIZE(dss_dsi2_opt_clks),
1543 .slaves = omap44xx_dss_dsi2_slaves,
1544 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_dsi2_slaves),
1545}; 816};
1546 817
1547/* 818/*
@@ -1565,7 +836,6 @@ static struct omap_hwmod_class omap44xx_hdmi_hwmod_class = {
1565}; 836};
1566 837
1567/* dss_hdmi */ 838/* dss_hdmi */
1568static struct omap_hwmod omap44xx_dss_hdmi_hwmod;
1569static struct omap_hwmod_irq_info omap44xx_dss_hdmi_irqs[] = { 839static struct omap_hwmod_irq_info omap44xx_dss_hdmi_irqs[] = {
1570 { .irq = 101 + OMAP44XX_IRQ_GIC_START }, 840 { .irq = 101 + OMAP44XX_IRQ_GIC_START },
1571 { .irq = -1 } 841 { .irq = -1 }
@@ -1576,48 +846,6 @@ static struct omap_hwmod_dma_info omap44xx_dss_hdmi_sdma_reqs[] = {
1576 { .dma_req = -1 } 846 { .dma_req = -1 }
1577}; 847};
1578 848
1579static struct omap_hwmod_addr_space omap44xx_dss_hdmi_dma_addrs[] = {
1580 {
1581 .pa_start = 0x58006000,
1582 .pa_end = 0x58006fff,
1583 .flags = ADDR_TYPE_RT
1584 },
1585 { }
1586};
1587
1588/* l3_main_2 -> dss_hdmi */
1589static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_hdmi = {
1590 .master = &omap44xx_l3_main_2_hwmod,
1591 .slave = &omap44xx_dss_hdmi_hwmod,
1592 .clk = "dss_fck",
1593 .addr = omap44xx_dss_hdmi_dma_addrs,
1594 .user = OCP_USER_SDMA,
1595};
1596
1597static struct omap_hwmod_addr_space omap44xx_dss_hdmi_addrs[] = {
1598 {
1599 .pa_start = 0x48046000,
1600 .pa_end = 0x48046fff,
1601 .flags = ADDR_TYPE_RT
1602 },
1603 { }
1604};
1605
1606/* l4_per -> dss_hdmi */
1607static struct omap_hwmod_ocp_if omap44xx_l4_per__dss_hdmi = {
1608 .master = &omap44xx_l4_per_hwmod,
1609 .slave = &omap44xx_dss_hdmi_hwmod,
1610 .clk = "l4_div_ck",
1611 .addr = omap44xx_dss_hdmi_addrs,
1612 .user = OCP_USER_MPU,
1613};
1614
1615/* dss_hdmi slave ports */
1616static struct omap_hwmod_ocp_if *omap44xx_dss_hdmi_slaves[] = {
1617 &omap44xx_l3_main_2__dss_hdmi,
1618 &omap44xx_l4_per__dss_hdmi,
1619};
1620
1621static struct omap_hwmod_opt_clk dss_hdmi_opt_clks[] = { 849static struct omap_hwmod_opt_clk dss_hdmi_opt_clks[] = {
1622 { .role = "sys_clk", .clk = "dss_sys_clk" }, 850 { .role = "sys_clk", .clk = "dss_sys_clk" },
1623}; 851};
@@ -1637,8 +865,6 @@ static struct omap_hwmod omap44xx_dss_hdmi_hwmod = {
1637 }, 865 },
1638 .opt_clks = dss_hdmi_opt_clks, 866 .opt_clks = dss_hdmi_opt_clks,
1639 .opt_clks_cnt = ARRAY_SIZE(dss_hdmi_opt_clks), 867 .opt_clks_cnt = ARRAY_SIZE(dss_hdmi_opt_clks),
1640 .slaves = omap44xx_dss_hdmi_slaves,
1641 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_hdmi_slaves),
1642}; 868};
1643 869
1644/* 870/*
@@ -1662,54 +888,11 @@ static struct omap_hwmod_class omap44xx_rfbi_hwmod_class = {
1662}; 888};
1663 889
1664/* dss_rfbi */ 890/* dss_rfbi */
1665static struct omap_hwmod omap44xx_dss_rfbi_hwmod;
1666static struct omap_hwmod_dma_info omap44xx_dss_rfbi_sdma_reqs[] = { 891static struct omap_hwmod_dma_info omap44xx_dss_rfbi_sdma_reqs[] = {
1667 { .dma_req = 13 + OMAP44XX_DMA_REQ_START }, 892 { .dma_req = 13 + OMAP44XX_DMA_REQ_START },
1668 { .dma_req = -1 } 893 { .dma_req = -1 }
1669}; 894};
1670 895
1671static struct omap_hwmod_addr_space omap44xx_dss_rfbi_dma_addrs[] = {
1672 {
1673 .pa_start = 0x58002000,
1674 .pa_end = 0x580020ff,
1675 .flags = ADDR_TYPE_RT
1676 },
1677 { }
1678};
1679
1680/* l3_main_2 -> dss_rfbi */
1681static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_rfbi = {
1682 .master = &omap44xx_l3_main_2_hwmod,
1683 .slave = &omap44xx_dss_rfbi_hwmod,
1684 .clk = "dss_fck",
1685 .addr = omap44xx_dss_rfbi_dma_addrs,
1686 .user = OCP_USER_SDMA,
1687};
1688
1689static struct omap_hwmod_addr_space omap44xx_dss_rfbi_addrs[] = {
1690 {
1691 .pa_start = 0x48042000,
1692 .pa_end = 0x480420ff,
1693 .flags = ADDR_TYPE_RT
1694 },
1695 { }
1696};
1697
1698/* l4_per -> dss_rfbi */
1699static struct omap_hwmod_ocp_if omap44xx_l4_per__dss_rfbi = {
1700 .master = &omap44xx_l4_per_hwmod,
1701 .slave = &omap44xx_dss_rfbi_hwmod,
1702 .clk = "l4_div_ck",
1703 .addr = omap44xx_dss_rfbi_addrs,
1704 .user = OCP_USER_MPU,
1705};
1706
1707/* dss_rfbi slave ports */
1708static struct omap_hwmod_ocp_if *omap44xx_dss_rfbi_slaves[] = {
1709 &omap44xx_l3_main_2__dss_rfbi,
1710 &omap44xx_l4_per__dss_rfbi,
1711};
1712
1713static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = { 896static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = {
1714 { .role = "ick", .clk = "dss_fck" }, 897 { .role = "ick", .clk = "dss_fck" },
1715}; 898};
@@ -1728,8 +911,6 @@ static struct omap_hwmod omap44xx_dss_rfbi_hwmod = {
1728 }, 911 },
1729 .opt_clks = dss_rfbi_opt_clks, 912 .opt_clks = dss_rfbi_opt_clks,
1730 .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks), 913 .opt_clks_cnt = ARRAY_SIZE(dss_rfbi_opt_clks),
1731 .slaves = omap44xx_dss_rfbi_slaves,
1732 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_rfbi_slaves),
1733}; 914};
1734 915
1735/* 916/*
@@ -1742,62 +923,165 @@ static struct omap_hwmod_class omap44xx_venc_hwmod_class = {
1742}; 923};
1743 924
1744/* dss_venc */ 925/* dss_venc */
1745static struct omap_hwmod omap44xx_dss_venc_hwmod; 926static struct omap_hwmod omap44xx_dss_venc_hwmod = {
1746static struct omap_hwmod_addr_space omap44xx_dss_venc_dma_addrs[] = { 927 .name = "dss_venc",
1747 { 928 .class = &omap44xx_venc_hwmod_class,
1748 .pa_start = 0x58003000, 929 .clkdm_name = "l3_dss_clkdm",
1749 .pa_end = 0x580030ff, 930 .main_clk = "dss_tv_clk",
1750 .flags = ADDR_TYPE_RT 931 .prcm = {
932 .omap4 = {
933 .clkctrl_offs = OMAP4_CM_DSS_DSS_CLKCTRL_OFFSET,
934 .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET,
935 },
1751 }, 936 },
1752 { }
1753}; 937};
1754 938
1755/* l3_main_2 -> dss_venc */ 939/*
1756static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_venc = { 940 * 'elm' class
1757 .master = &omap44xx_l3_main_2_hwmod, 941 * bch error location module
1758 .slave = &omap44xx_dss_venc_hwmod, 942 */
1759 .clk = "dss_fck", 943
1760 .addr = omap44xx_dss_venc_dma_addrs, 944static struct omap_hwmod_class_sysconfig omap44xx_elm_sysc = {
1761 .user = OCP_USER_SDMA, 945 .rev_offs = 0x0000,
946 .sysc_offs = 0x0010,
947 .syss_offs = 0x0014,
948 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
949 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
950 SYSS_HAS_RESET_STATUS),
951 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
952 .sysc_fields = &omap_hwmod_sysc_type1,
1762}; 953};
1763 954
1764static struct omap_hwmod_addr_space omap44xx_dss_venc_addrs[] = { 955static struct omap_hwmod_class omap44xx_elm_hwmod_class = {
1765 { 956 .name = "elm",
1766 .pa_start = 0x48043000, 957 .sysc = &omap44xx_elm_sysc,
1767 .pa_end = 0x480430ff, 958};
1768 .flags = ADDR_TYPE_RT 959
960/* elm */
961static struct omap_hwmod_irq_info omap44xx_elm_irqs[] = {
962 { .irq = 4 + OMAP44XX_IRQ_GIC_START },
963 { .irq = -1 }
964};
965
966static struct omap_hwmod omap44xx_elm_hwmod = {
967 .name = "elm",
968 .class = &omap44xx_elm_hwmod_class,
969 .clkdm_name = "l4_per_clkdm",
970 .mpu_irqs = omap44xx_elm_irqs,
971 .prcm = {
972 .omap4 = {
973 .clkctrl_offs = OMAP4_CM_L4PER_ELM_CLKCTRL_OFFSET,
974 .context_offs = OMAP4_RM_L4PER_ELM_CONTEXT_OFFSET,
975 },
1769 }, 976 },
1770 { }
1771}; 977};
1772 978
1773/* l4_per -> dss_venc */ 979/*
1774static struct omap_hwmod_ocp_if omap44xx_l4_per__dss_venc = { 980 * 'emif' class
1775 .master = &omap44xx_l4_per_hwmod, 981 * external memory interface no1
1776 .slave = &omap44xx_dss_venc_hwmod, 982 */
1777 .clk = "l4_div_ck", 983
1778 .addr = omap44xx_dss_venc_addrs, 984static struct omap_hwmod_class_sysconfig omap44xx_emif_sysc = {
1779 .user = OCP_USER_MPU, 985 .rev_offs = 0x0000,
1780}; 986};
1781 987
1782/* dss_venc slave ports */ 988static struct omap_hwmod_class omap44xx_emif_hwmod_class = {
1783static struct omap_hwmod_ocp_if *omap44xx_dss_venc_slaves[] = { 989 .name = "emif",
1784 &omap44xx_l3_main_2__dss_venc, 990 .sysc = &omap44xx_emif_sysc,
1785 &omap44xx_l4_per__dss_venc,
1786}; 991};
1787 992
1788static struct omap_hwmod omap44xx_dss_venc_hwmod = { 993/* emif1 */
1789 .name = "dss_venc", 994static struct omap_hwmod_irq_info omap44xx_emif1_irqs[] = {
1790 .class = &omap44xx_venc_hwmod_class, 995 { .irq = 110 + OMAP44XX_IRQ_GIC_START },
1791 .clkdm_name = "l3_dss_clkdm", 996 { .irq = -1 }
1792 .main_clk = "dss_tv_clk", 997};
998
999static struct omap_hwmod omap44xx_emif1_hwmod = {
1000 .name = "emif1",
1001 .class = &omap44xx_emif_hwmod_class,
1002 .clkdm_name = "l3_emif_clkdm",
1003 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET,
1004 .mpu_irqs = omap44xx_emif1_irqs,
1005 .main_clk = "ddrphy_ck",
1793 .prcm = { 1006 .prcm = {
1794 .omap4 = { 1007 .omap4 = {
1795 .clkctrl_offs = OMAP4_CM_DSS_DSS_CLKCTRL_OFFSET, 1008 .clkctrl_offs = OMAP4_CM_MEMIF_EMIF_1_CLKCTRL_OFFSET,
1796 .context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET, 1009 .context_offs = OMAP4_RM_MEMIF_EMIF_1_CONTEXT_OFFSET,
1010 .modulemode = MODULEMODE_HWCTRL,
1011 },
1012 },
1013};
1014
1015/* emif2 */
1016static struct omap_hwmod_irq_info omap44xx_emif2_irqs[] = {
1017 { .irq = 111 + OMAP44XX_IRQ_GIC_START },
1018 { .irq = -1 }
1019};
1020
1021static struct omap_hwmod omap44xx_emif2_hwmod = {
1022 .name = "emif2",
1023 .class = &omap44xx_emif_hwmod_class,
1024 .clkdm_name = "l3_emif_clkdm",
1025 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET,
1026 .mpu_irqs = omap44xx_emif2_irqs,
1027 .main_clk = "ddrphy_ck",
1028 .prcm = {
1029 .omap4 = {
1030 .clkctrl_offs = OMAP4_CM_MEMIF_EMIF_2_CLKCTRL_OFFSET,
1031 .context_offs = OMAP4_RM_MEMIF_EMIF_2_CONTEXT_OFFSET,
1032 .modulemode = MODULEMODE_HWCTRL,
1033 },
1034 },
1035};
1036
1037/*
1038 * 'fdif' class
1039 * face detection hw accelerator module
1040 */
1041
1042static struct omap_hwmod_class_sysconfig omap44xx_fdif_sysc = {
1043 .rev_offs = 0x0000,
1044 .sysc_offs = 0x0010,
1045 /*
1046 * FDIF needs 100 OCP clk cycles delay after a softreset before
1047 * accessing sysconfig again.
1048 * The lowest frequency at the moment for L3 bus is 100 MHz, so
1049 * 1usec delay is needed. Add an x2 margin to be safe (2 usecs).
1050 *
1051 * TODO: Indicate errata when available.
1052 */
1053 .srst_udelay = 2,
1054 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS |
1055 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
1056 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1057 MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
1058 .sysc_fields = &omap_hwmod_sysc_type2,
1059};
1060
1061static struct omap_hwmod_class omap44xx_fdif_hwmod_class = {
1062 .name = "fdif",
1063 .sysc = &omap44xx_fdif_sysc,
1064};
1065
1066/* fdif */
1067static struct omap_hwmod_irq_info omap44xx_fdif_irqs[] = {
1068 { .irq = 69 + OMAP44XX_IRQ_GIC_START },
1069 { .irq = -1 }
1070};
1071
1072static struct omap_hwmod omap44xx_fdif_hwmod = {
1073 .name = "fdif",
1074 .class = &omap44xx_fdif_hwmod_class,
1075 .clkdm_name = "iss_clkdm",
1076 .mpu_irqs = omap44xx_fdif_irqs,
1077 .main_clk = "fdif_fck",
1078 .prcm = {
1079 .omap4 = {
1080 .clkctrl_offs = OMAP4_CM_CAM_FDIF_CLKCTRL_OFFSET,
1081 .context_offs = OMAP4_RM_CAM_FDIF_CONTEXT_OFFSET,
1082 .modulemode = MODULEMODE_SWCTRL,
1797 }, 1083 },
1798 }, 1084 },
1799 .slaves = omap44xx_dss_venc_slaves,
1800 .slaves_cnt = ARRAY_SIZE(omap44xx_dss_venc_slaves),
1801}; 1085};
1802 1086
1803/* 1087/*
@@ -1830,35 +1114,11 @@ static struct omap_gpio_dev_attr gpio_dev_attr = {
1830}; 1114};
1831 1115
1832/* gpio1 */ 1116/* gpio1 */
1833static struct omap_hwmod omap44xx_gpio1_hwmod;
1834static struct omap_hwmod_irq_info omap44xx_gpio1_irqs[] = { 1117static struct omap_hwmod_irq_info omap44xx_gpio1_irqs[] = {
1835 { .irq = 29 + OMAP44XX_IRQ_GIC_START }, 1118 { .irq = 29 + OMAP44XX_IRQ_GIC_START },
1836 { .irq = -1 } 1119 { .irq = -1 }
1837}; 1120};
1838 1121
1839static struct omap_hwmod_addr_space omap44xx_gpio1_addrs[] = {
1840 {
1841 .pa_start = 0x4a310000,
1842 .pa_end = 0x4a3101ff,
1843 .flags = ADDR_TYPE_RT
1844 },
1845 { }
1846};
1847
1848/* l4_wkup -> gpio1 */
1849static struct omap_hwmod_ocp_if omap44xx_l4_wkup__gpio1 = {
1850 .master = &omap44xx_l4_wkup_hwmod,
1851 .slave = &omap44xx_gpio1_hwmod,
1852 .clk = "l4_wkup_clk_mux_ck",
1853 .addr = omap44xx_gpio1_addrs,
1854 .user = OCP_USER_MPU | OCP_USER_SDMA,
1855};
1856
1857/* gpio1 slave ports */
1858static struct omap_hwmod_ocp_if *omap44xx_gpio1_slaves[] = {
1859 &omap44xx_l4_wkup__gpio1,
1860};
1861
1862static struct omap_hwmod_opt_clk gpio1_opt_clks[] = { 1122static struct omap_hwmod_opt_clk gpio1_opt_clks[] = {
1863 { .role = "dbclk", .clk = "gpio1_dbclk" }, 1123 { .role = "dbclk", .clk = "gpio1_dbclk" },
1864}; 1124};
@@ -1879,40 +1139,14 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = {
1879 .opt_clks = gpio1_opt_clks, 1139 .opt_clks = gpio1_opt_clks,
1880 .opt_clks_cnt = ARRAY_SIZE(gpio1_opt_clks), 1140 .opt_clks_cnt = ARRAY_SIZE(gpio1_opt_clks),
1881 .dev_attr = &gpio_dev_attr, 1141 .dev_attr = &gpio_dev_attr,
1882 .slaves = omap44xx_gpio1_slaves,
1883 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio1_slaves),
1884}; 1142};
1885 1143
1886/* gpio2 */ 1144/* gpio2 */
1887static struct omap_hwmod omap44xx_gpio2_hwmod;
1888static struct omap_hwmod_irq_info omap44xx_gpio2_irqs[] = { 1145static struct omap_hwmod_irq_info omap44xx_gpio2_irqs[] = {
1889 { .irq = 30 + OMAP44XX_IRQ_GIC_START }, 1146 { .irq = 30 + OMAP44XX_IRQ_GIC_START },
1890 { .irq = -1 } 1147 { .irq = -1 }
1891}; 1148};
1892 1149
1893static struct omap_hwmod_addr_space omap44xx_gpio2_addrs[] = {
1894 {
1895 .pa_start = 0x48055000,
1896 .pa_end = 0x480551ff,
1897 .flags = ADDR_TYPE_RT
1898 },
1899 { }
1900};
1901
1902/* l4_per -> gpio2 */
1903static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio2 = {
1904 .master = &omap44xx_l4_per_hwmod,
1905 .slave = &omap44xx_gpio2_hwmod,
1906 .clk = "l4_div_ck",
1907 .addr = omap44xx_gpio2_addrs,
1908 .user = OCP_USER_MPU | OCP_USER_SDMA,
1909};
1910
1911/* gpio2 slave ports */
1912static struct omap_hwmod_ocp_if *omap44xx_gpio2_slaves[] = {
1913 &omap44xx_l4_per__gpio2,
1914};
1915
1916static struct omap_hwmod_opt_clk gpio2_opt_clks[] = { 1150static struct omap_hwmod_opt_clk gpio2_opt_clks[] = {
1917 { .role = "dbclk", .clk = "gpio2_dbclk" }, 1151 { .role = "dbclk", .clk = "gpio2_dbclk" },
1918}; 1152};
@@ -1934,40 +1168,14 @@ static struct omap_hwmod omap44xx_gpio2_hwmod = {
1934 .opt_clks = gpio2_opt_clks, 1168 .opt_clks = gpio2_opt_clks,
1935 .opt_clks_cnt = ARRAY_SIZE(gpio2_opt_clks), 1169 .opt_clks_cnt = ARRAY_SIZE(gpio2_opt_clks),
1936 .dev_attr = &gpio_dev_attr, 1170 .dev_attr = &gpio_dev_attr,
1937 .slaves = omap44xx_gpio2_slaves,
1938 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio2_slaves),
1939}; 1171};
1940 1172
1941/* gpio3 */ 1173/* gpio3 */
1942static struct omap_hwmod omap44xx_gpio3_hwmod;
1943static struct omap_hwmod_irq_info omap44xx_gpio3_irqs[] = { 1174static struct omap_hwmod_irq_info omap44xx_gpio3_irqs[] = {
1944 { .irq = 31 + OMAP44XX_IRQ_GIC_START }, 1175 { .irq = 31 + OMAP44XX_IRQ_GIC_START },
1945 { .irq = -1 } 1176 { .irq = -1 }
1946}; 1177};
1947 1178
1948static struct omap_hwmod_addr_space omap44xx_gpio3_addrs[] = {
1949 {
1950 .pa_start = 0x48057000,
1951 .pa_end = 0x480571ff,
1952 .flags = ADDR_TYPE_RT
1953 },
1954 { }
1955};
1956
1957/* l4_per -> gpio3 */
1958static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio3 = {
1959 .master = &omap44xx_l4_per_hwmod,
1960 .slave = &omap44xx_gpio3_hwmod,
1961 .clk = "l4_div_ck",
1962 .addr = omap44xx_gpio3_addrs,
1963 .user = OCP_USER_MPU | OCP_USER_SDMA,
1964};
1965
1966/* gpio3 slave ports */
1967static struct omap_hwmod_ocp_if *omap44xx_gpio3_slaves[] = {
1968 &omap44xx_l4_per__gpio3,
1969};
1970
1971static struct omap_hwmod_opt_clk gpio3_opt_clks[] = { 1179static struct omap_hwmod_opt_clk gpio3_opt_clks[] = {
1972 { .role = "dbclk", .clk = "gpio3_dbclk" }, 1180 { .role = "dbclk", .clk = "gpio3_dbclk" },
1973}; 1181};
@@ -1989,40 +1197,14 @@ static struct omap_hwmod omap44xx_gpio3_hwmod = {
1989 .opt_clks = gpio3_opt_clks, 1197 .opt_clks = gpio3_opt_clks,
1990 .opt_clks_cnt = ARRAY_SIZE(gpio3_opt_clks), 1198 .opt_clks_cnt = ARRAY_SIZE(gpio3_opt_clks),
1991 .dev_attr = &gpio_dev_attr, 1199 .dev_attr = &gpio_dev_attr,
1992 .slaves = omap44xx_gpio3_slaves,
1993 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio3_slaves),
1994}; 1200};
1995 1201
1996/* gpio4 */ 1202/* gpio4 */
1997static struct omap_hwmod omap44xx_gpio4_hwmod;
1998static struct omap_hwmod_irq_info omap44xx_gpio4_irqs[] = { 1203static struct omap_hwmod_irq_info omap44xx_gpio4_irqs[] = {
1999 { .irq = 32 + OMAP44XX_IRQ_GIC_START }, 1204 { .irq = 32 + OMAP44XX_IRQ_GIC_START },
2000 { .irq = -1 } 1205 { .irq = -1 }
2001}; 1206};
2002 1207
2003static struct omap_hwmod_addr_space omap44xx_gpio4_addrs[] = {
2004 {
2005 .pa_start = 0x48059000,
2006 .pa_end = 0x480591ff,
2007 .flags = ADDR_TYPE_RT
2008 },
2009 { }
2010};
2011
2012/* l4_per -> gpio4 */
2013static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio4 = {
2014 .master = &omap44xx_l4_per_hwmod,
2015 .slave = &omap44xx_gpio4_hwmod,
2016 .clk = "l4_div_ck",
2017 .addr = omap44xx_gpio4_addrs,
2018 .user = OCP_USER_MPU | OCP_USER_SDMA,
2019};
2020
2021/* gpio4 slave ports */
2022static struct omap_hwmod_ocp_if *omap44xx_gpio4_slaves[] = {
2023 &omap44xx_l4_per__gpio4,
2024};
2025
2026static struct omap_hwmod_opt_clk gpio4_opt_clks[] = { 1208static struct omap_hwmod_opt_clk gpio4_opt_clks[] = {
2027 { .role = "dbclk", .clk = "gpio4_dbclk" }, 1209 { .role = "dbclk", .clk = "gpio4_dbclk" },
2028}; 1210};
@@ -2044,40 +1226,14 @@ static struct omap_hwmod omap44xx_gpio4_hwmod = {
2044 .opt_clks = gpio4_opt_clks, 1226 .opt_clks = gpio4_opt_clks,
2045 .opt_clks_cnt = ARRAY_SIZE(gpio4_opt_clks), 1227 .opt_clks_cnt = ARRAY_SIZE(gpio4_opt_clks),
2046 .dev_attr = &gpio_dev_attr, 1228 .dev_attr = &gpio_dev_attr,
2047 .slaves = omap44xx_gpio4_slaves,
2048 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio4_slaves),
2049}; 1229};
2050 1230
2051/* gpio5 */ 1231/* gpio5 */
2052static struct omap_hwmod omap44xx_gpio5_hwmod;
2053static struct omap_hwmod_irq_info omap44xx_gpio5_irqs[] = { 1232static struct omap_hwmod_irq_info omap44xx_gpio5_irqs[] = {
2054 { .irq = 33 + OMAP44XX_IRQ_GIC_START }, 1233 { .irq = 33 + OMAP44XX_IRQ_GIC_START },
2055 { .irq = -1 } 1234 { .irq = -1 }
2056}; 1235};
2057 1236
2058static struct omap_hwmod_addr_space omap44xx_gpio5_addrs[] = {
2059 {
2060 .pa_start = 0x4805b000,
2061 .pa_end = 0x4805b1ff,
2062 .flags = ADDR_TYPE_RT
2063 },
2064 { }
2065};
2066
2067/* l4_per -> gpio5 */
2068static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio5 = {
2069 .master = &omap44xx_l4_per_hwmod,
2070 .slave = &omap44xx_gpio5_hwmod,
2071 .clk = "l4_div_ck",
2072 .addr = omap44xx_gpio5_addrs,
2073 .user = OCP_USER_MPU | OCP_USER_SDMA,
2074};
2075
2076/* gpio5 slave ports */
2077static struct omap_hwmod_ocp_if *omap44xx_gpio5_slaves[] = {
2078 &omap44xx_l4_per__gpio5,
2079};
2080
2081static struct omap_hwmod_opt_clk gpio5_opt_clks[] = { 1237static struct omap_hwmod_opt_clk gpio5_opt_clks[] = {
2082 { .role = "dbclk", .clk = "gpio5_dbclk" }, 1238 { .role = "dbclk", .clk = "gpio5_dbclk" },
2083}; 1239};
@@ -2099,40 +1255,14 @@ static struct omap_hwmod omap44xx_gpio5_hwmod = {
2099 .opt_clks = gpio5_opt_clks, 1255 .opt_clks = gpio5_opt_clks,
2100 .opt_clks_cnt = ARRAY_SIZE(gpio5_opt_clks), 1256 .opt_clks_cnt = ARRAY_SIZE(gpio5_opt_clks),
2101 .dev_attr = &gpio_dev_attr, 1257 .dev_attr = &gpio_dev_attr,
2102 .slaves = omap44xx_gpio5_slaves,
2103 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio5_slaves),
2104}; 1258};
2105 1259
2106/* gpio6 */ 1260/* gpio6 */
2107static struct omap_hwmod omap44xx_gpio6_hwmod;
2108static struct omap_hwmod_irq_info omap44xx_gpio6_irqs[] = { 1261static struct omap_hwmod_irq_info omap44xx_gpio6_irqs[] = {
2109 { .irq = 34 + OMAP44XX_IRQ_GIC_START }, 1262 { .irq = 34 + OMAP44XX_IRQ_GIC_START },
2110 { .irq = -1 } 1263 { .irq = -1 }
2111}; 1264};
2112 1265
2113static struct omap_hwmod_addr_space omap44xx_gpio6_addrs[] = {
2114 {
2115 .pa_start = 0x4805d000,
2116 .pa_end = 0x4805d1ff,
2117 .flags = ADDR_TYPE_RT
2118 },
2119 { }
2120};
2121
2122/* l4_per -> gpio6 */
2123static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio6 = {
2124 .master = &omap44xx_l4_per_hwmod,
2125 .slave = &omap44xx_gpio6_hwmod,
2126 .clk = "l4_div_ck",
2127 .addr = omap44xx_gpio6_addrs,
2128 .user = OCP_USER_MPU | OCP_USER_SDMA,
2129};
2130
2131/* gpio6 slave ports */
2132static struct omap_hwmod_ocp_if *omap44xx_gpio6_slaves[] = {
2133 &omap44xx_l4_per__gpio6,
2134};
2135
2136static struct omap_hwmod_opt_clk gpio6_opt_clks[] = { 1266static struct omap_hwmod_opt_clk gpio6_opt_clks[] = {
2137 { .role = "dbclk", .clk = "gpio6_dbclk" }, 1267 { .role = "dbclk", .clk = "gpio6_dbclk" },
2138}; 1268};
@@ -2154,8 +1284,135 @@ static struct omap_hwmod omap44xx_gpio6_hwmod = {
2154 .opt_clks = gpio6_opt_clks, 1284 .opt_clks = gpio6_opt_clks,
2155 .opt_clks_cnt = ARRAY_SIZE(gpio6_opt_clks), 1285 .opt_clks_cnt = ARRAY_SIZE(gpio6_opt_clks),
2156 .dev_attr = &gpio_dev_attr, 1286 .dev_attr = &gpio_dev_attr,
2157 .slaves = omap44xx_gpio6_slaves, 1287};
2158 .slaves_cnt = ARRAY_SIZE(omap44xx_gpio6_slaves), 1288
1289/*
1290 * 'gpmc' class
1291 * general purpose memory controller
1292 */
1293
1294static struct omap_hwmod_class_sysconfig omap44xx_gpmc_sysc = {
1295 .rev_offs = 0x0000,
1296 .sysc_offs = 0x0010,
1297 .syss_offs = 0x0014,
1298 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_SIDLEMODE |
1299 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
1300 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1301 .sysc_fields = &omap_hwmod_sysc_type1,
1302};
1303
1304static struct omap_hwmod_class omap44xx_gpmc_hwmod_class = {
1305 .name = "gpmc",
1306 .sysc = &omap44xx_gpmc_sysc,
1307};
1308
1309/* gpmc */
1310static struct omap_hwmod_irq_info omap44xx_gpmc_irqs[] = {
1311 { .irq = 20 + OMAP44XX_IRQ_GIC_START },
1312 { .irq = -1 }
1313};
1314
1315static struct omap_hwmod_dma_info omap44xx_gpmc_sdma_reqs[] = {
1316 { .dma_req = 3 + OMAP44XX_DMA_REQ_START },
1317 { .dma_req = -1 }
1318};
1319
1320static struct omap_hwmod omap44xx_gpmc_hwmod = {
1321 .name = "gpmc",
1322 .class = &omap44xx_gpmc_hwmod_class,
1323 .clkdm_name = "l3_2_clkdm",
1324 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET,
1325 .mpu_irqs = omap44xx_gpmc_irqs,
1326 .sdma_reqs = omap44xx_gpmc_sdma_reqs,
1327 .prcm = {
1328 .omap4 = {
1329 .clkctrl_offs = OMAP4_CM_L3_2_GPMC_CLKCTRL_OFFSET,
1330 .context_offs = OMAP4_RM_L3_2_GPMC_CONTEXT_OFFSET,
1331 .modulemode = MODULEMODE_HWCTRL,
1332 },
1333 },
1334};
1335
1336/*
1337 * 'gpu' class
1338 * 2d/3d graphics accelerator
1339 */
1340
1341static struct omap_hwmod_class_sysconfig omap44xx_gpu_sysc = {
1342 .rev_offs = 0x1fc00,
1343 .sysc_offs = 0x1fc10,
1344 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE),
1345 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1346 SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
1347 MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
1348 .sysc_fields = &omap_hwmod_sysc_type2,
1349};
1350
1351static struct omap_hwmod_class omap44xx_gpu_hwmod_class = {
1352 .name = "gpu",
1353 .sysc = &omap44xx_gpu_sysc,
1354};
1355
1356/* gpu */
1357static struct omap_hwmod_irq_info omap44xx_gpu_irqs[] = {
1358 { .irq = 21 + OMAP44XX_IRQ_GIC_START },
1359 { .irq = -1 }
1360};
1361
1362static struct omap_hwmod omap44xx_gpu_hwmod = {
1363 .name = "gpu",
1364 .class = &omap44xx_gpu_hwmod_class,
1365 .clkdm_name = "l3_gfx_clkdm",
1366 .mpu_irqs = omap44xx_gpu_irqs,
1367 .main_clk = "gpu_fck",
1368 .prcm = {
1369 .omap4 = {
1370 .clkctrl_offs = OMAP4_CM_GFX_GFX_CLKCTRL_OFFSET,
1371 .context_offs = OMAP4_RM_GFX_GFX_CONTEXT_OFFSET,
1372 .modulemode = MODULEMODE_SWCTRL,
1373 },
1374 },
1375};
1376
1377/*
1378 * 'hdq1w' class
1379 * hdq / 1-wire serial interface controller
1380 */
1381
1382static struct omap_hwmod_class_sysconfig omap44xx_hdq1w_sysc = {
1383 .rev_offs = 0x0000,
1384 .sysc_offs = 0x0014,
1385 .syss_offs = 0x0018,
1386 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_SOFTRESET |
1387 SYSS_HAS_RESET_STATUS),
1388 .sysc_fields = &omap_hwmod_sysc_type1,
1389};
1390
1391static struct omap_hwmod_class omap44xx_hdq1w_hwmod_class = {
1392 .name = "hdq1w",
1393 .sysc = &omap44xx_hdq1w_sysc,
1394};
1395
1396/* hdq1w */
1397static struct omap_hwmod_irq_info omap44xx_hdq1w_irqs[] = {
1398 { .irq = 58 + OMAP44XX_IRQ_GIC_START },
1399 { .irq = -1 }
1400};
1401
1402static struct omap_hwmod omap44xx_hdq1w_hwmod = {
1403 .name = "hdq1w",
1404 .class = &omap44xx_hdq1w_hwmod_class,
1405 .clkdm_name = "l4_per_clkdm",
1406 .flags = HWMOD_INIT_NO_RESET, /* XXX temporary */
1407 .mpu_irqs = omap44xx_hdq1w_irqs,
1408 .main_clk = "hdq1w_fck",
1409 .prcm = {
1410 .omap4 = {
1411 .clkctrl_offs = OMAP4_CM_L4PER_HDQ1W_CLKCTRL_OFFSET,
1412 .context_offs = OMAP4_RM_L4PER_HDQ1W_CONTEXT_OFFSET,
1413 .modulemode = MODULEMODE_SWCTRL,
1414 },
1415 },
2159}; 1416};
2160 1417
2161/* 1418/*
@@ -2190,34 +1447,6 @@ static struct omap_hwmod_irq_info omap44xx_hsi_irqs[] = {
2190 { .irq = -1 } 1447 { .irq = -1 }
2191}; 1448};
2192 1449
2193/* hsi master ports */
2194static struct omap_hwmod_ocp_if *omap44xx_hsi_masters[] = {
2195 &omap44xx_hsi__l3_main_2,
2196};
2197
2198static struct omap_hwmod_addr_space omap44xx_hsi_addrs[] = {
2199 {
2200 .pa_start = 0x4a058000,
2201 .pa_end = 0x4a05bfff,
2202 .flags = ADDR_TYPE_RT
2203 },
2204 { }
2205};
2206
2207/* l4_cfg -> hsi */
2208static struct omap_hwmod_ocp_if omap44xx_l4_cfg__hsi = {
2209 .master = &omap44xx_l4_cfg_hwmod,
2210 .slave = &omap44xx_hsi_hwmod,
2211 .clk = "l4_div_ck",
2212 .addr = omap44xx_hsi_addrs,
2213 .user = OCP_USER_MPU | OCP_USER_SDMA,
2214};
2215
2216/* hsi slave ports */
2217static struct omap_hwmod_ocp_if *omap44xx_hsi_slaves[] = {
2218 &omap44xx_l4_cfg__hsi,
2219};
2220
2221static struct omap_hwmod omap44xx_hsi_hwmod = { 1450static struct omap_hwmod omap44xx_hsi_hwmod = {
2222 .name = "hsi", 1451 .name = "hsi",
2223 .class = &omap44xx_hsi_hwmod_class, 1452 .class = &omap44xx_hsi_hwmod_class,
@@ -2231,10 +1460,6 @@ static struct omap_hwmod omap44xx_hsi_hwmod = {
2231 .modulemode = MODULEMODE_HWCTRL, 1460 .modulemode = MODULEMODE_HWCTRL,
2232 }, 1461 },
2233 }, 1462 },
2234 .slaves = omap44xx_hsi_slaves,
2235 .slaves_cnt = ARRAY_SIZE(omap44xx_hsi_slaves),
2236 .masters = omap44xx_hsi_masters,
2237 .masters_cnt = ARRAY_SIZE(omap44xx_hsi_masters),
2238}; 1463};
2239 1464
2240/* 1465/*
@@ -2262,11 +1487,11 @@ static struct omap_hwmod_class omap44xx_i2c_hwmod_class = {
2262}; 1487};
2263 1488
2264static struct omap_i2c_dev_attr i2c_dev_attr = { 1489static struct omap_i2c_dev_attr i2c_dev_attr = {
2265 .flags = OMAP_I2C_FLAG_BUS_SHIFT_NONE, 1490 .flags = OMAP_I2C_FLAG_BUS_SHIFT_NONE |
1491 OMAP_I2C_FLAG_RESET_REGS_POSTIDLE,
2266}; 1492};
2267 1493
2268/* i2c1 */ 1494/* i2c1 */
2269static struct omap_hwmod omap44xx_i2c1_hwmod;
2270static struct omap_hwmod_irq_info omap44xx_i2c1_irqs[] = { 1495static struct omap_hwmod_irq_info omap44xx_i2c1_irqs[] = {
2271 { .irq = 56 + OMAP44XX_IRQ_GIC_START }, 1496 { .irq = 56 + OMAP44XX_IRQ_GIC_START },
2272 { .irq = -1 } 1497 { .irq = -1 }
@@ -2278,29 +1503,6 @@ static struct omap_hwmod_dma_info omap44xx_i2c1_sdma_reqs[] = {
2278 { .dma_req = -1 } 1503 { .dma_req = -1 }
2279}; 1504};
2280 1505
2281static struct omap_hwmod_addr_space omap44xx_i2c1_addrs[] = {
2282 {
2283 .pa_start = 0x48070000,
2284 .pa_end = 0x480700ff,
2285 .flags = ADDR_TYPE_RT
2286 },
2287 { }
2288};
2289
2290/* l4_per -> i2c1 */
2291static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c1 = {
2292 .master = &omap44xx_l4_per_hwmod,
2293 .slave = &omap44xx_i2c1_hwmod,
2294 .clk = "l4_div_ck",
2295 .addr = omap44xx_i2c1_addrs,
2296 .user = OCP_USER_MPU | OCP_USER_SDMA,
2297};
2298
2299/* i2c1 slave ports */
2300static struct omap_hwmod_ocp_if *omap44xx_i2c1_slaves[] = {
2301 &omap44xx_l4_per__i2c1,
2302};
2303
2304static struct omap_hwmod omap44xx_i2c1_hwmod = { 1506static struct omap_hwmod omap44xx_i2c1_hwmod = {
2305 .name = "i2c1", 1507 .name = "i2c1",
2306 .class = &omap44xx_i2c_hwmod_class, 1508 .class = &omap44xx_i2c_hwmod_class,
@@ -2316,13 +1518,10 @@ static struct omap_hwmod omap44xx_i2c1_hwmod = {
2316 .modulemode = MODULEMODE_SWCTRL, 1518 .modulemode = MODULEMODE_SWCTRL,
2317 }, 1519 },
2318 }, 1520 },
2319 .slaves = omap44xx_i2c1_slaves,
2320 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c1_slaves),
2321 .dev_attr = &i2c_dev_attr, 1521 .dev_attr = &i2c_dev_attr,
2322}; 1522};
2323 1523
2324/* i2c2 */ 1524/* i2c2 */
2325static struct omap_hwmod omap44xx_i2c2_hwmod;
2326static struct omap_hwmod_irq_info omap44xx_i2c2_irqs[] = { 1525static struct omap_hwmod_irq_info omap44xx_i2c2_irqs[] = {
2327 { .irq = 57 + OMAP44XX_IRQ_GIC_START }, 1526 { .irq = 57 + OMAP44XX_IRQ_GIC_START },
2328 { .irq = -1 } 1527 { .irq = -1 }
@@ -2334,29 +1533,6 @@ static struct omap_hwmod_dma_info omap44xx_i2c2_sdma_reqs[] = {
2334 { .dma_req = -1 } 1533 { .dma_req = -1 }
2335}; 1534};
2336 1535
2337static struct omap_hwmod_addr_space omap44xx_i2c2_addrs[] = {
2338 {
2339 .pa_start = 0x48072000,
2340 .pa_end = 0x480720ff,
2341 .flags = ADDR_TYPE_RT
2342 },
2343 { }
2344};
2345
2346/* l4_per -> i2c2 */
2347static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c2 = {
2348 .master = &omap44xx_l4_per_hwmod,
2349 .slave = &omap44xx_i2c2_hwmod,
2350 .clk = "l4_div_ck",
2351 .addr = omap44xx_i2c2_addrs,
2352 .user = OCP_USER_MPU | OCP_USER_SDMA,
2353};
2354
2355/* i2c2 slave ports */
2356static struct omap_hwmod_ocp_if *omap44xx_i2c2_slaves[] = {
2357 &omap44xx_l4_per__i2c2,
2358};
2359
2360static struct omap_hwmod omap44xx_i2c2_hwmod = { 1536static struct omap_hwmod omap44xx_i2c2_hwmod = {
2361 .name = "i2c2", 1537 .name = "i2c2",
2362 .class = &omap44xx_i2c_hwmod_class, 1538 .class = &omap44xx_i2c_hwmod_class,
@@ -2372,13 +1548,10 @@ static struct omap_hwmod omap44xx_i2c2_hwmod = {
2372 .modulemode = MODULEMODE_SWCTRL, 1548 .modulemode = MODULEMODE_SWCTRL,
2373 }, 1549 },
2374 }, 1550 },
2375 .slaves = omap44xx_i2c2_slaves,
2376 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c2_slaves),
2377 .dev_attr = &i2c_dev_attr, 1551 .dev_attr = &i2c_dev_attr,
2378}; 1552};
2379 1553
2380/* i2c3 */ 1554/* i2c3 */
2381static struct omap_hwmod omap44xx_i2c3_hwmod;
2382static struct omap_hwmod_irq_info omap44xx_i2c3_irqs[] = { 1555static struct omap_hwmod_irq_info omap44xx_i2c3_irqs[] = {
2383 { .irq = 61 + OMAP44XX_IRQ_GIC_START }, 1556 { .irq = 61 + OMAP44XX_IRQ_GIC_START },
2384 { .irq = -1 } 1557 { .irq = -1 }
@@ -2390,29 +1563,6 @@ static struct omap_hwmod_dma_info omap44xx_i2c3_sdma_reqs[] = {
2390 { .dma_req = -1 } 1563 { .dma_req = -1 }
2391}; 1564};
2392 1565
2393static struct omap_hwmod_addr_space omap44xx_i2c3_addrs[] = {
2394 {
2395 .pa_start = 0x48060000,
2396 .pa_end = 0x480600ff,
2397 .flags = ADDR_TYPE_RT
2398 },
2399 { }
2400};
2401
2402/* l4_per -> i2c3 */
2403static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c3 = {
2404 .master = &omap44xx_l4_per_hwmod,
2405 .slave = &omap44xx_i2c3_hwmod,
2406 .clk = "l4_div_ck",
2407 .addr = omap44xx_i2c3_addrs,
2408 .user = OCP_USER_MPU | OCP_USER_SDMA,
2409};
2410
2411/* i2c3 slave ports */
2412static struct omap_hwmod_ocp_if *omap44xx_i2c3_slaves[] = {
2413 &omap44xx_l4_per__i2c3,
2414};
2415
2416static struct omap_hwmod omap44xx_i2c3_hwmod = { 1566static struct omap_hwmod omap44xx_i2c3_hwmod = {
2417 .name = "i2c3", 1567 .name = "i2c3",
2418 .class = &omap44xx_i2c_hwmod_class, 1568 .class = &omap44xx_i2c_hwmod_class,
@@ -2428,13 +1578,10 @@ static struct omap_hwmod omap44xx_i2c3_hwmod = {
2428 .modulemode = MODULEMODE_SWCTRL, 1578 .modulemode = MODULEMODE_SWCTRL,
2429 }, 1579 },
2430 }, 1580 },
2431 .slaves = omap44xx_i2c3_slaves,
2432 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c3_slaves),
2433 .dev_attr = &i2c_dev_attr, 1581 .dev_attr = &i2c_dev_attr,
2434}; 1582};
2435 1583
2436/* i2c4 */ 1584/* i2c4 */
2437static struct omap_hwmod omap44xx_i2c4_hwmod;
2438static struct omap_hwmod_irq_info omap44xx_i2c4_irqs[] = { 1585static struct omap_hwmod_irq_info omap44xx_i2c4_irqs[] = {
2439 { .irq = 62 + OMAP44XX_IRQ_GIC_START }, 1586 { .irq = 62 + OMAP44XX_IRQ_GIC_START },
2440 { .irq = -1 } 1587 { .irq = -1 }
@@ -2446,29 +1593,6 @@ static struct omap_hwmod_dma_info omap44xx_i2c4_sdma_reqs[] = {
2446 { .dma_req = -1 } 1593 { .dma_req = -1 }
2447}; 1594};
2448 1595
2449static struct omap_hwmod_addr_space omap44xx_i2c4_addrs[] = {
2450 {
2451 .pa_start = 0x48350000,
2452 .pa_end = 0x483500ff,
2453 .flags = ADDR_TYPE_RT
2454 },
2455 { }
2456};
2457
2458/* l4_per -> i2c4 */
2459static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c4 = {
2460 .master = &omap44xx_l4_per_hwmod,
2461 .slave = &omap44xx_i2c4_hwmod,
2462 .clk = "l4_div_ck",
2463 .addr = omap44xx_i2c4_addrs,
2464 .user = OCP_USER_MPU | OCP_USER_SDMA,
2465};
2466
2467/* i2c4 slave ports */
2468static struct omap_hwmod_ocp_if *omap44xx_i2c4_slaves[] = {
2469 &omap44xx_l4_per__i2c4,
2470};
2471
2472static struct omap_hwmod omap44xx_i2c4_hwmod = { 1596static struct omap_hwmod omap44xx_i2c4_hwmod = {
2473 .name = "i2c4", 1597 .name = "i2c4",
2474 .class = &omap44xx_i2c_hwmod_class, 1598 .class = &omap44xx_i2c_hwmod_class,
@@ -2484,8 +1608,6 @@ static struct omap_hwmod omap44xx_i2c4_hwmod = {
2484 .modulemode = MODULEMODE_SWCTRL, 1608 .modulemode = MODULEMODE_SWCTRL,
2485 }, 1609 },
2486 }, 1610 },
2487 .slaves = omap44xx_i2c4_slaves,
2488 .slaves_cnt = ARRAY_SIZE(omap44xx_i2c4_slaves),
2489 .dev_attr = &i2c_dev_attr, 1611 .dev_attr = &i2c_dev_attr,
2490}; 1612};
2491 1613
@@ -2504,66 +1626,12 @@ static struct omap_hwmod_irq_info omap44xx_ipu_irqs[] = {
2504 { .irq = -1 } 1626 { .irq = -1 }
2505}; 1627};
2506 1628
2507static struct omap_hwmod_rst_info omap44xx_ipu_c0_resets[] = { 1629static struct omap_hwmod_rst_info omap44xx_ipu_resets[] = {
2508 { .name = "cpu0", .rst_shift = 0 }, 1630 { .name = "cpu0", .rst_shift = 0 },
2509};
2510
2511static struct omap_hwmod_rst_info omap44xx_ipu_c1_resets[] = {
2512 { .name = "cpu1", .rst_shift = 1 }, 1631 { .name = "cpu1", .rst_shift = 1 },
2513};
2514
2515static struct omap_hwmod_rst_info omap44xx_ipu_resets[] = {
2516 { .name = "mmu_cache", .rst_shift = 2 }, 1632 { .name = "mmu_cache", .rst_shift = 2 },
2517}; 1633};
2518 1634
2519/* ipu master ports */
2520static struct omap_hwmod_ocp_if *omap44xx_ipu_masters[] = {
2521 &omap44xx_ipu__l3_main_2,
2522};
2523
2524/* l3_main_2 -> ipu */
2525static struct omap_hwmod_ocp_if omap44xx_l3_main_2__ipu = {
2526 .master = &omap44xx_l3_main_2_hwmod,
2527 .slave = &omap44xx_ipu_hwmod,
2528 .clk = "l3_div_ck",
2529 .user = OCP_USER_MPU | OCP_USER_SDMA,
2530};
2531
2532/* ipu slave ports */
2533static struct omap_hwmod_ocp_if *omap44xx_ipu_slaves[] = {
2534 &omap44xx_l3_main_2__ipu,
2535};
2536
2537/* Pseudo hwmod for reset control purpose only */
2538static struct omap_hwmod omap44xx_ipu_c0_hwmod = {
2539 .name = "ipu_c0",
2540 .class = &omap44xx_ipu_hwmod_class,
2541 .clkdm_name = "ducati_clkdm",
2542 .flags = HWMOD_INIT_NO_RESET,
2543 .rst_lines = omap44xx_ipu_c0_resets,
2544 .rst_lines_cnt = ARRAY_SIZE(omap44xx_ipu_c0_resets),
2545 .prcm = {
2546 .omap4 = {
2547 .rstctrl_offs = OMAP4_RM_DUCATI_RSTCTRL_OFFSET,
2548 },
2549 },
2550};
2551
2552/* Pseudo hwmod for reset control purpose only */
2553static struct omap_hwmod omap44xx_ipu_c1_hwmod = {
2554 .name = "ipu_c1",
2555 .class = &omap44xx_ipu_hwmod_class,
2556 .clkdm_name = "ducati_clkdm",
2557 .flags = HWMOD_INIT_NO_RESET,
2558 .rst_lines = omap44xx_ipu_c1_resets,
2559 .rst_lines_cnt = ARRAY_SIZE(omap44xx_ipu_c1_resets),
2560 .prcm = {
2561 .omap4 = {
2562 .rstctrl_offs = OMAP4_RM_DUCATI_RSTCTRL_OFFSET,
2563 },
2564 },
2565};
2566
2567static struct omap_hwmod omap44xx_ipu_hwmod = { 1635static struct omap_hwmod omap44xx_ipu_hwmod = {
2568 .name = "ipu", 1636 .name = "ipu",
2569 .class = &omap44xx_ipu_hwmod_class, 1637 .class = &omap44xx_ipu_hwmod_class,
@@ -2580,10 +1648,6 @@ static struct omap_hwmod omap44xx_ipu_hwmod = {
2580 .modulemode = MODULEMODE_HWCTRL, 1648 .modulemode = MODULEMODE_HWCTRL,
2581 }, 1649 },
2582 }, 1650 },
2583 .slaves = omap44xx_ipu_slaves,
2584 .slaves_cnt = ARRAY_SIZE(omap44xx_ipu_slaves),
2585 .masters = omap44xx_ipu_masters,
2586 .masters_cnt = ARRAY_SIZE(omap44xx_ipu_masters),
2587}; 1651};
2588 1652
2589/* 1653/*
@@ -2594,6 +1658,15 @@ static struct omap_hwmod omap44xx_ipu_hwmod = {
2594static struct omap_hwmod_class_sysconfig omap44xx_iss_sysc = { 1658static struct omap_hwmod_class_sysconfig omap44xx_iss_sysc = {
2595 .rev_offs = 0x0000, 1659 .rev_offs = 0x0000,
2596 .sysc_offs = 0x0010, 1660 .sysc_offs = 0x0010,
1661 /*
1662 * ISS needs 100 OCP clk cycles delay after a softreset before
1663 * accessing sysconfig again.
1664 * The lowest frequency at the moment for L3 bus is 100 MHz, so
1665 * 1usec delay is needed. Add an x2 margin to be safe (2 usecs).
1666 *
1667 * TODO: Indicate errata when available.
1668 */
1669 .srst_udelay = 2,
2597 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS | 1670 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS |
2598 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET), 1671 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
2599 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 1672 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
@@ -2621,34 +1694,6 @@ static struct omap_hwmod_dma_info omap44xx_iss_sdma_reqs[] = {
2621 { .dma_req = -1 } 1694 { .dma_req = -1 }
2622}; 1695};
2623 1696
2624/* iss master ports */
2625static struct omap_hwmod_ocp_if *omap44xx_iss_masters[] = {
2626 &omap44xx_iss__l3_main_2,
2627};
2628
2629static struct omap_hwmod_addr_space omap44xx_iss_addrs[] = {
2630 {
2631 .pa_start = 0x52000000,
2632 .pa_end = 0x520000ff,
2633 .flags = ADDR_TYPE_RT
2634 },
2635 { }
2636};
2637
2638/* l3_main_2 -> iss */
2639static struct omap_hwmod_ocp_if omap44xx_l3_main_2__iss = {
2640 .master = &omap44xx_l3_main_2_hwmod,
2641 .slave = &omap44xx_iss_hwmod,
2642 .clk = "l3_div_ck",
2643 .addr = omap44xx_iss_addrs,
2644 .user = OCP_USER_MPU | OCP_USER_SDMA,
2645};
2646
2647/* iss slave ports */
2648static struct omap_hwmod_ocp_if *omap44xx_iss_slaves[] = {
2649 &omap44xx_l3_main_2__iss,
2650};
2651
2652static struct omap_hwmod_opt_clk iss_opt_clks[] = { 1697static struct omap_hwmod_opt_clk iss_opt_clks[] = {
2653 { .role = "ctrlclk", .clk = "iss_ctrlclk" }, 1698 { .role = "ctrlclk", .clk = "iss_ctrlclk" },
2654}; 1699};
@@ -2669,10 +1714,6 @@ static struct omap_hwmod omap44xx_iss_hwmod = {
2669 }, 1714 },
2670 .opt_clks = iss_opt_clks, 1715 .opt_clks = iss_opt_clks,
2671 .opt_clks_cnt = ARRAY_SIZE(iss_opt_clks), 1716 .opt_clks_cnt = ARRAY_SIZE(iss_opt_clks),
2672 .slaves = omap44xx_iss_slaves,
2673 .slaves_cnt = ARRAY_SIZE(omap44xx_iss_slaves),
2674 .masters = omap44xx_iss_masters,
2675 .masters_cnt = ARRAY_SIZE(omap44xx_iss_masters),
2676}; 1717};
2677 1718
2678/* 1719/*
@@ -2693,75 +1734,9 @@ static struct omap_hwmod_irq_info omap44xx_iva_irqs[] = {
2693}; 1734};
2694 1735
2695static struct omap_hwmod_rst_info omap44xx_iva_resets[] = { 1736static struct omap_hwmod_rst_info omap44xx_iva_resets[] = {
2696 { .name = "logic", .rst_shift = 2 },
2697};
2698
2699static struct omap_hwmod_rst_info omap44xx_iva_seq0_resets[] = {
2700 { .name = "seq0", .rst_shift = 0 }, 1737 { .name = "seq0", .rst_shift = 0 },
2701};
2702
2703static struct omap_hwmod_rst_info omap44xx_iva_seq1_resets[] = {
2704 { .name = "seq1", .rst_shift = 1 }, 1738 { .name = "seq1", .rst_shift = 1 },
2705}; 1739 { .name = "logic", .rst_shift = 2 },
2706
2707/* iva master ports */
2708static struct omap_hwmod_ocp_if *omap44xx_iva_masters[] = {
2709 &omap44xx_iva__l3_main_2,
2710 &omap44xx_iva__l3_instr,
2711};
2712
2713static struct omap_hwmod_addr_space omap44xx_iva_addrs[] = {
2714 {
2715 .pa_start = 0x5a000000,
2716 .pa_end = 0x5a07ffff,
2717 .flags = ADDR_TYPE_RT
2718 },
2719 { }
2720};
2721
2722/* l3_main_2 -> iva */
2723static struct omap_hwmod_ocp_if omap44xx_l3_main_2__iva = {
2724 .master = &omap44xx_l3_main_2_hwmod,
2725 .slave = &omap44xx_iva_hwmod,
2726 .clk = "l3_div_ck",
2727 .addr = omap44xx_iva_addrs,
2728 .user = OCP_USER_MPU,
2729};
2730
2731/* iva slave ports */
2732static struct omap_hwmod_ocp_if *omap44xx_iva_slaves[] = {
2733 &omap44xx_dsp__iva,
2734 &omap44xx_l3_main_2__iva,
2735};
2736
2737/* Pseudo hwmod for reset control purpose only */
2738static struct omap_hwmod omap44xx_iva_seq0_hwmod = {
2739 .name = "iva_seq0",
2740 .class = &omap44xx_iva_hwmod_class,
2741 .clkdm_name = "ivahd_clkdm",
2742 .flags = HWMOD_INIT_NO_RESET,
2743 .rst_lines = omap44xx_iva_seq0_resets,
2744 .rst_lines_cnt = ARRAY_SIZE(omap44xx_iva_seq0_resets),
2745 .prcm = {
2746 .omap4 = {
2747 .rstctrl_offs = OMAP4_RM_IVAHD_RSTCTRL_OFFSET,
2748 },
2749 },
2750};
2751
2752/* Pseudo hwmod for reset control purpose only */
2753static struct omap_hwmod omap44xx_iva_seq1_hwmod = {
2754 .name = "iva_seq1",
2755 .class = &omap44xx_iva_hwmod_class,
2756 .clkdm_name = "ivahd_clkdm",
2757 .flags = HWMOD_INIT_NO_RESET,
2758 .rst_lines = omap44xx_iva_seq1_resets,
2759 .rst_lines_cnt = ARRAY_SIZE(omap44xx_iva_seq1_resets),
2760 .prcm = {
2761 .omap4 = {
2762 .rstctrl_offs = OMAP4_RM_IVAHD_RSTCTRL_OFFSET,
2763 },
2764 },
2765}; 1740};
2766 1741
2767static struct omap_hwmod omap44xx_iva_hwmod = { 1742static struct omap_hwmod omap44xx_iva_hwmod = {
@@ -2780,10 +1755,6 @@ static struct omap_hwmod omap44xx_iva_hwmod = {
2780 .modulemode = MODULEMODE_HWCTRL, 1755 .modulemode = MODULEMODE_HWCTRL,
2781 }, 1756 },
2782 }, 1757 },
2783 .slaves = omap44xx_iva_slaves,
2784 .slaves_cnt = ARRAY_SIZE(omap44xx_iva_slaves),
2785 .masters = omap44xx_iva_masters,
2786 .masters_cnt = ARRAY_SIZE(omap44xx_iva_masters),
2787}; 1758};
2788 1759
2789/* 1760/*
@@ -2809,35 +1780,11 @@ static struct omap_hwmod_class omap44xx_kbd_hwmod_class = {
2809}; 1780};
2810 1781
2811/* kbd */ 1782/* kbd */
2812static struct omap_hwmod omap44xx_kbd_hwmod;
2813static struct omap_hwmod_irq_info omap44xx_kbd_irqs[] = { 1783static struct omap_hwmod_irq_info omap44xx_kbd_irqs[] = {
2814 { .irq = 120 + OMAP44XX_IRQ_GIC_START }, 1784 { .irq = 120 + OMAP44XX_IRQ_GIC_START },
2815 { .irq = -1 } 1785 { .irq = -1 }
2816}; 1786};
2817 1787
2818static struct omap_hwmod_addr_space omap44xx_kbd_addrs[] = {
2819 {
2820 .pa_start = 0x4a31c000,
2821 .pa_end = 0x4a31c07f,
2822 .flags = ADDR_TYPE_RT
2823 },
2824 { }
2825};
2826
2827/* l4_wkup -> kbd */
2828static struct omap_hwmod_ocp_if omap44xx_l4_wkup__kbd = {
2829 .master = &omap44xx_l4_wkup_hwmod,
2830 .slave = &omap44xx_kbd_hwmod,
2831 .clk = "l4_wkup_clk_mux_ck",
2832 .addr = omap44xx_kbd_addrs,
2833 .user = OCP_USER_MPU | OCP_USER_SDMA,
2834};
2835
2836/* kbd slave ports */
2837static struct omap_hwmod_ocp_if *omap44xx_kbd_slaves[] = {
2838 &omap44xx_l4_wkup__kbd,
2839};
2840
2841static struct omap_hwmod omap44xx_kbd_hwmod = { 1788static struct omap_hwmod omap44xx_kbd_hwmod = {
2842 .name = "kbd", 1789 .name = "kbd",
2843 .class = &omap44xx_kbd_hwmod_class, 1790 .class = &omap44xx_kbd_hwmod_class,
@@ -2851,8 +1798,6 @@ static struct omap_hwmod omap44xx_kbd_hwmod = {
2851 .modulemode = MODULEMODE_SWCTRL, 1798 .modulemode = MODULEMODE_SWCTRL,
2852 }, 1799 },
2853 }, 1800 },
2854 .slaves = omap44xx_kbd_slaves,
2855 .slaves_cnt = ARRAY_SIZE(omap44xx_kbd_slaves),
2856}; 1801};
2857 1802
2858/* 1803/*
@@ -2876,35 +1821,11 @@ static struct omap_hwmod_class omap44xx_mailbox_hwmod_class = {
2876}; 1821};
2877 1822
2878/* mailbox */ 1823/* mailbox */
2879static struct omap_hwmod omap44xx_mailbox_hwmod;
2880static struct omap_hwmod_irq_info omap44xx_mailbox_irqs[] = { 1824static struct omap_hwmod_irq_info omap44xx_mailbox_irqs[] = {
2881 { .irq = 26 + OMAP44XX_IRQ_GIC_START }, 1825 { .irq = 26 + OMAP44XX_IRQ_GIC_START },
2882 { .irq = -1 } 1826 { .irq = -1 }
2883}; 1827};
2884 1828
2885static struct omap_hwmod_addr_space omap44xx_mailbox_addrs[] = {
2886 {
2887 .pa_start = 0x4a0f4000,
2888 .pa_end = 0x4a0f41ff,
2889 .flags = ADDR_TYPE_RT
2890 },
2891 { }
2892};
2893
2894/* l4_cfg -> mailbox */
2895static struct omap_hwmod_ocp_if omap44xx_l4_cfg__mailbox = {
2896 .master = &omap44xx_l4_cfg_hwmod,
2897 .slave = &omap44xx_mailbox_hwmod,
2898 .clk = "l4_div_ck",
2899 .addr = omap44xx_mailbox_addrs,
2900 .user = OCP_USER_MPU | OCP_USER_SDMA,
2901};
2902
2903/* mailbox slave ports */
2904static struct omap_hwmod_ocp_if *omap44xx_mailbox_slaves[] = {
2905 &omap44xx_l4_cfg__mailbox,
2906};
2907
2908static struct omap_hwmod omap44xx_mailbox_hwmod = { 1829static struct omap_hwmod omap44xx_mailbox_hwmod = {
2909 .name = "mailbox", 1830 .name = "mailbox",
2910 .class = &omap44xx_mailbox_hwmod_class, 1831 .class = &omap44xx_mailbox_hwmod_class,
@@ -2916,8 +1837,58 @@ static struct omap_hwmod omap44xx_mailbox_hwmod = {
2916 .context_offs = OMAP4_RM_L4CFG_MAILBOX_CONTEXT_OFFSET, 1837 .context_offs = OMAP4_RM_L4CFG_MAILBOX_CONTEXT_OFFSET,
2917 }, 1838 },
2918 }, 1839 },
2919 .slaves = omap44xx_mailbox_slaves, 1840};
2920 .slaves_cnt = ARRAY_SIZE(omap44xx_mailbox_slaves), 1841
1842/*
1843 * 'mcasp' class
1844 * multi-channel audio serial port controller
1845 */
1846
1847/* The IP is not compliant to type1 / type2 scheme */
1848static struct omap_hwmod_sysc_fields omap_hwmod_sysc_type_mcasp = {
1849 .sidle_shift = 0,
1850};
1851
1852static struct omap_hwmod_class_sysconfig omap44xx_mcasp_sysc = {
1853 .sysc_offs = 0x0004,
1854 .sysc_flags = SYSC_HAS_SIDLEMODE,
1855 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1856 SIDLE_SMART_WKUP),
1857 .sysc_fields = &omap_hwmod_sysc_type_mcasp,
1858};
1859
1860static struct omap_hwmod_class omap44xx_mcasp_hwmod_class = {
1861 .name = "mcasp",
1862 .sysc = &omap44xx_mcasp_sysc,
1863};
1864
1865/* mcasp */
1866static struct omap_hwmod_irq_info omap44xx_mcasp_irqs[] = {
1867 { .name = "arevt", .irq = 108 + OMAP44XX_IRQ_GIC_START },
1868 { .name = "axevt", .irq = 109 + OMAP44XX_IRQ_GIC_START },
1869 { .irq = -1 }
1870};
1871
1872static struct omap_hwmod_dma_info omap44xx_mcasp_sdma_reqs[] = {
1873 { .name = "axevt", .dma_req = 7 + OMAP44XX_DMA_REQ_START },
1874 { .name = "arevt", .dma_req = 10 + OMAP44XX_DMA_REQ_START },
1875 { .dma_req = -1 }
1876};
1877
1878static struct omap_hwmod omap44xx_mcasp_hwmod = {
1879 .name = "mcasp",
1880 .class = &omap44xx_mcasp_hwmod_class,
1881 .clkdm_name = "abe_clkdm",
1882 .mpu_irqs = omap44xx_mcasp_irqs,
1883 .sdma_reqs = omap44xx_mcasp_sdma_reqs,
1884 .main_clk = "mcasp_fck",
1885 .prcm = {
1886 .omap4 = {
1887 .clkctrl_offs = OMAP4_CM1_ABE_MCASP_CLKCTRL_OFFSET,
1888 .context_offs = OMAP4_RM_ABE_MCASP_CONTEXT_OFFSET,
1889 .modulemode = MODULEMODE_SWCTRL,
1890 },
1891 },
2921}; 1892};
2922 1893
2923/* 1894/*
@@ -2940,9 +1911,8 @@ static struct omap_hwmod_class omap44xx_mcbsp_hwmod_class = {
2940}; 1911};
2941 1912
2942/* mcbsp1 */ 1913/* mcbsp1 */
2943static struct omap_hwmod omap44xx_mcbsp1_hwmod;
2944static struct omap_hwmod_irq_info omap44xx_mcbsp1_irqs[] = { 1914static struct omap_hwmod_irq_info omap44xx_mcbsp1_irqs[] = {
2945 { .irq = 17 + OMAP44XX_IRQ_GIC_START }, 1915 { .name = "common", .irq = 17 + OMAP44XX_IRQ_GIC_START },
2946 { .irq = -1 } 1916 { .irq = -1 }
2947}; 1917};
2948 1918
@@ -2952,50 +1922,6 @@ static struct omap_hwmod_dma_info omap44xx_mcbsp1_sdma_reqs[] = {
2952 { .dma_req = -1 } 1922 { .dma_req = -1 }
2953}; 1923};
2954 1924
2955static struct omap_hwmod_addr_space omap44xx_mcbsp1_addrs[] = {
2956 {
2957 .name = "mpu",
2958 .pa_start = 0x40122000,
2959 .pa_end = 0x401220ff,
2960 .flags = ADDR_TYPE_RT
2961 },
2962 { }
2963};
2964
2965/* l4_abe -> mcbsp1 */
2966static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp1 = {
2967 .master = &omap44xx_l4_abe_hwmod,
2968 .slave = &omap44xx_mcbsp1_hwmod,
2969 .clk = "ocp_abe_iclk",
2970 .addr = omap44xx_mcbsp1_addrs,
2971 .user = OCP_USER_MPU,
2972};
2973
2974static struct omap_hwmod_addr_space omap44xx_mcbsp1_dma_addrs[] = {
2975 {
2976 .name = "dma",
2977 .pa_start = 0x49022000,
2978 .pa_end = 0x490220ff,
2979 .flags = ADDR_TYPE_RT
2980 },
2981 { }
2982};
2983
2984/* l4_abe -> mcbsp1 (dma) */
2985static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp1_dma = {
2986 .master = &omap44xx_l4_abe_hwmod,
2987 .slave = &omap44xx_mcbsp1_hwmod,
2988 .clk = "ocp_abe_iclk",
2989 .addr = omap44xx_mcbsp1_dma_addrs,
2990 .user = OCP_USER_SDMA,
2991};
2992
2993/* mcbsp1 slave ports */
2994static struct omap_hwmod_ocp_if *omap44xx_mcbsp1_slaves[] = {
2995 &omap44xx_l4_abe__mcbsp1,
2996 &omap44xx_l4_abe__mcbsp1_dma,
2997};
2998
2999static struct omap_hwmod_opt_clk mcbsp1_opt_clks[] = { 1925static struct omap_hwmod_opt_clk mcbsp1_opt_clks[] = {
3000 { .role = "pad_fck", .clk = "pad_clks_ck" }, 1926 { .role = "pad_fck", .clk = "pad_clks_ck" },
3001 { .role = "prcm_clk", .clk = "mcbsp1_sync_mux_ck" }, 1927 { .role = "prcm_clk", .clk = "mcbsp1_sync_mux_ck" },
@@ -3015,16 +1941,13 @@ static struct omap_hwmod omap44xx_mcbsp1_hwmod = {
3015 .modulemode = MODULEMODE_SWCTRL, 1941 .modulemode = MODULEMODE_SWCTRL,
3016 }, 1942 },
3017 }, 1943 },
3018 .slaves = omap44xx_mcbsp1_slaves,
3019 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp1_slaves),
3020 .opt_clks = mcbsp1_opt_clks, 1944 .opt_clks = mcbsp1_opt_clks,
3021 .opt_clks_cnt = ARRAY_SIZE(mcbsp1_opt_clks), 1945 .opt_clks_cnt = ARRAY_SIZE(mcbsp1_opt_clks),
3022}; 1946};
3023 1947
3024/* mcbsp2 */ 1948/* mcbsp2 */
3025static struct omap_hwmod omap44xx_mcbsp2_hwmod;
3026static struct omap_hwmod_irq_info omap44xx_mcbsp2_irqs[] = { 1949static struct omap_hwmod_irq_info omap44xx_mcbsp2_irqs[] = {
3027 { .irq = 22 + OMAP44XX_IRQ_GIC_START }, 1950 { .name = "common", .irq = 22 + OMAP44XX_IRQ_GIC_START },
3028 { .irq = -1 } 1951 { .irq = -1 }
3029}; 1952};
3030 1953
@@ -3034,50 +1957,6 @@ static struct omap_hwmod_dma_info omap44xx_mcbsp2_sdma_reqs[] = {
3034 { .dma_req = -1 } 1957 { .dma_req = -1 }
3035}; 1958};
3036 1959
3037static struct omap_hwmod_addr_space omap44xx_mcbsp2_addrs[] = {
3038 {
3039 .name = "mpu",
3040 .pa_start = 0x40124000,
3041 .pa_end = 0x401240ff,
3042 .flags = ADDR_TYPE_RT
3043 },
3044 { }
3045};
3046
3047/* l4_abe -> mcbsp2 */
3048static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp2 = {
3049 .master = &omap44xx_l4_abe_hwmod,
3050 .slave = &omap44xx_mcbsp2_hwmod,
3051 .clk = "ocp_abe_iclk",
3052 .addr = omap44xx_mcbsp2_addrs,
3053 .user = OCP_USER_MPU,
3054};
3055
3056static struct omap_hwmod_addr_space omap44xx_mcbsp2_dma_addrs[] = {
3057 {
3058 .name = "dma",
3059 .pa_start = 0x49024000,
3060 .pa_end = 0x490240ff,
3061 .flags = ADDR_TYPE_RT
3062 },
3063 { }
3064};
3065
3066/* l4_abe -> mcbsp2 (dma) */
3067static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp2_dma = {
3068 .master = &omap44xx_l4_abe_hwmod,
3069 .slave = &omap44xx_mcbsp2_hwmod,
3070 .clk = "ocp_abe_iclk",
3071 .addr = omap44xx_mcbsp2_dma_addrs,
3072 .user = OCP_USER_SDMA,
3073};
3074
3075/* mcbsp2 slave ports */
3076static struct omap_hwmod_ocp_if *omap44xx_mcbsp2_slaves[] = {
3077 &omap44xx_l4_abe__mcbsp2,
3078 &omap44xx_l4_abe__mcbsp2_dma,
3079};
3080
3081static struct omap_hwmod_opt_clk mcbsp2_opt_clks[] = { 1960static struct omap_hwmod_opt_clk mcbsp2_opt_clks[] = {
3082 { .role = "pad_fck", .clk = "pad_clks_ck" }, 1961 { .role = "pad_fck", .clk = "pad_clks_ck" },
3083 { .role = "prcm_clk", .clk = "mcbsp2_sync_mux_ck" }, 1962 { .role = "prcm_clk", .clk = "mcbsp2_sync_mux_ck" },
@@ -3097,16 +1976,13 @@ static struct omap_hwmod omap44xx_mcbsp2_hwmod = {
3097 .modulemode = MODULEMODE_SWCTRL, 1976 .modulemode = MODULEMODE_SWCTRL,
3098 }, 1977 },
3099 }, 1978 },
3100 .slaves = omap44xx_mcbsp2_slaves,
3101 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp2_slaves),
3102 .opt_clks = mcbsp2_opt_clks, 1979 .opt_clks = mcbsp2_opt_clks,
3103 .opt_clks_cnt = ARRAY_SIZE(mcbsp2_opt_clks), 1980 .opt_clks_cnt = ARRAY_SIZE(mcbsp2_opt_clks),
3104}; 1981};
3105 1982
3106/* mcbsp3 */ 1983/* mcbsp3 */
3107static struct omap_hwmod omap44xx_mcbsp3_hwmod;
3108static struct omap_hwmod_irq_info omap44xx_mcbsp3_irqs[] = { 1984static struct omap_hwmod_irq_info omap44xx_mcbsp3_irqs[] = {
3109 { .irq = 23 + OMAP44XX_IRQ_GIC_START }, 1985 { .name = "common", .irq = 23 + OMAP44XX_IRQ_GIC_START },
3110 { .irq = -1 } 1986 { .irq = -1 }
3111}; 1987};
3112 1988
@@ -3116,50 +1992,6 @@ static struct omap_hwmod_dma_info omap44xx_mcbsp3_sdma_reqs[] = {
3116 { .dma_req = -1 } 1992 { .dma_req = -1 }
3117}; 1993};
3118 1994
3119static struct omap_hwmod_addr_space omap44xx_mcbsp3_addrs[] = {
3120 {
3121 .name = "mpu",
3122 .pa_start = 0x40126000,
3123 .pa_end = 0x401260ff,
3124 .flags = ADDR_TYPE_RT
3125 },
3126 { }
3127};
3128
3129/* l4_abe -> mcbsp3 */
3130static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp3 = {
3131 .master = &omap44xx_l4_abe_hwmod,
3132 .slave = &omap44xx_mcbsp3_hwmod,
3133 .clk = "ocp_abe_iclk",
3134 .addr = omap44xx_mcbsp3_addrs,
3135 .user = OCP_USER_MPU,
3136};
3137
3138static struct omap_hwmod_addr_space omap44xx_mcbsp3_dma_addrs[] = {
3139 {
3140 .name = "dma",
3141 .pa_start = 0x49026000,
3142 .pa_end = 0x490260ff,
3143 .flags = ADDR_TYPE_RT
3144 },
3145 { }
3146};
3147
3148/* l4_abe -> mcbsp3 (dma) */
3149static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp3_dma = {
3150 .master = &omap44xx_l4_abe_hwmod,
3151 .slave = &omap44xx_mcbsp3_hwmod,
3152 .clk = "ocp_abe_iclk",
3153 .addr = omap44xx_mcbsp3_dma_addrs,
3154 .user = OCP_USER_SDMA,
3155};
3156
3157/* mcbsp3 slave ports */
3158static struct omap_hwmod_ocp_if *omap44xx_mcbsp3_slaves[] = {
3159 &omap44xx_l4_abe__mcbsp3,
3160 &omap44xx_l4_abe__mcbsp3_dma,
3161};
3162
3163static struct omap_hwmod_opt_clk mcbsp3_opt_clks[] = { 1995static struct omap_hwmod_opt_clk mcbsp3_opt_clks[] = {
3164 { .role = "pad_fck", .clk = "pad_clks_ck" }, 1996 { .role = "pad_fck", .clk = "pad_clks_ck" },
3165 { .role = "prcm_clk", .clk = "mcbsp3_sync_mux_ck" }, 1997 { .role = "prcm_clk", .clk = "mcbsp3_sync_mux_ck" },
@@ -3179,16 +2011,13 @@ static struct omap_hwmod omap44xx_mcbsp3_hwmod = {
3179 .modulemode = MODULEMODE_SWCTRL, 2011 .modulemode = MODULEMODE_SWCTRL,
3180 }, 2012 },
3181 }, 2013 },
3182 .slaves = omap44xx_mcbsp3_slaves,
3183 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp3_slaves),
3184 .opt_clks = mcbsp3_opt_clks, 2014 .opt_clks = mcbsp3_opt_clks,
3185 .opt_clks_cnt = ARRAY_SIZE(mcbsp3_opt_clks), 2015 .opt_clks_cnt = ARRAY_SIZE(mcbsp3_opt_clks),
3186}; 2016};
3187 2017
3188/* mcbsp4 */ 2018/* mcbsp4 */
3189static struct omap_hwmod omap44xx_mcbsp4_hwmod;
3190static struct omap_hwmod_irq_info omap44xx_mcbsp4_irqs[] = { 2019static struct omap_hwmod_irq_info omap44xx_mcbsp4_irqs[] = {
3191 { .irq = 16 + OMAP44XX_IRQ_GIC_START }, 2020 { .name = "common", .irq = 16 + OMAP44XX_IRQ_GIC_START },
3192 { .irq = -1 } 2021 { .irq = -1 }
3193}; 2022};
3194 2023
@@ -3198,29 +2027,6 @@ static struct omap_hwmod_dma_info omap44xx_mcbsp4_sdma_reqs[] = {
3198 { .dma_req = -1 } 2027 { .dma_req = -1 }
3199}; 2028};
3200 2029
3201static struct omap_hwmod_addr_space omap44xx_mcbsp4_addrs[] = {
3202 {
3203 .pa_start = 0x48096000,
3204 .pa_end = 0x480960ff,
3205 .flags = ADDR_TYPE_RT
3206 },
3207 { }
3208};
3209
3210/* l4_per -> mcbsp4 */
3211static struct omap_hwmod_ocp_if omap44xx_l4_per__mcbsp4 = {
3212 .master = &omap44xx_l4_per_hwmod,
3213 .slave = &omap44xx_mcbsp4_hwmod,
3214 .clk = "l4_div_ck",
3215 .addr = omap44xx_mcbsp4_addrs,
3216 .user = OCP_USER_MPU | OCP_USER_SDMA,
3217};
3218
3219/* mcbsp4 slave ports */
3220static struct omap_hwmod_ocp_if *omap44xx_mcbsp4_slaves[] = {
3221 &omap44xx_l4_per__mcbsp4,
3222};
3223
3224static struct omap_hwmod_opt_clk mcbsp4_opt_clks[] = { 2030static struct omap_hwmod_opt_clk mcbsp4_opt_clks[] = {
3225 { .role = "pad_fck", .clk = "pad_clks_ck" }, 2031 { .role = "pad_fck", .clk = "pad_clks_ck" },
3226 { .role = "prcm_clk", .clk = "mcbsp4_sync_mux_ck" }, 2032 { .role = "prcm_clk", .clk = "mcbsp4_sync_mux_ck" },
@@ -3240,8 +2046,6 @@ static struct omap_hwmod omap44xx_mcbsp4_hwmod = {
3240 .modulemode = MODULEMODE_SWCTRL, 2046 .modulemode = MODULEMODE_SWCTRL,
3241 }, 2047 },
3242 }, 2048 },
3243 .slaves = omap44xx_mcbsp4_slaves,
3244 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp4_slaves),
3245 .opt_clks = mcbsp4_opt_clks, 2049 .opt_clks = mcbsp4_opt_clks,
3246 .opt_clks_cnt = ARRAY_SIZE(mcbsp4_opt_clks), 2050 .opt_clks_cnt = ARRAY_SIZE(mcbsp4_opt_clks),
3247}; 2051};
@@ -3268,7 +2072,6 @@ static struct omap_hwmod_class omap44xx_mcpdm_hwmod_class = {
3268}; 2072};
3269 2073
3270/* mcpdm */ 2074/* mcpdm */
3271static struct omap_hwmod omap44xx_mcpdm_hwmod;
3272static struct omap_hwmod_irq_info omap44xx_mcpdm_irqs[] = { 2075static struct omap_hwmod_irq_info omap44xx_mcpdm_irqs[] = {
3273 { .irq = 112 + OMAP44XX_IRQ_GIC_START }, 2076 { .irq = 112 + OMAP44XX_IRQ_GIC_START },
3274 { .irq = -1 } 2077 { .irq = -1 }
@@ -3280,48 +2083,6 @@ static struct omap_hwmod_dma_info omap44xx_mcpdm_sdma_reqs[] = {
3280 { .dma_req = -1 } 2083 { .dma_req = -1 }
3281}; 2084};
3282 2085
3283static struct omap_hwmod_addr_space omap44xx_mcpdm_addrs[] = {
3284 {
3285 .pa_start = 0x40132000,
3286 .pa_end = 0x4013207f,
3287 .flags = ADDR_TYPE_RT
3288 },
3289 { }
3290};
3291
3292/* l4_abe -> mcpdm */
3293static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcpdm = {
3294 .master = &omap44xx_l4_abe_hwmod,
3295 .slave = &omap44xx_mcpdm_hwmod,
3296 .clk = "ocp_abe_iclk",
3297 .addr = omap44xx_mcpdm_addrs,
3298 .user = OCP_USER_MPU,
3299};
3300
3301static struct omap_hwmod_addr_space omap44xx_mcpdm_dma_addrs[] = {
3302 {
3303 .pa_start = 0x49032000,
3304 .pa_end = 0x4903207f,
3305 .flags = ADDR_TYPE_RT
3306 },
3307 { }
3308};
3309
3310/* l4_abe -> mcpdm (dma) */
3311static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcpdm_dma = {
3312 .master = &omap44xx_l4_abe_hwmod,
3313 .slave = &omap44xx_mcpdm_hwmod,
3314 .clk = "ocp_abe_iclk",
3315 .addr = omap44xx_mcpdm_dma_addrs,
3316 .user = OCP_USER_SDMA,
3317};
3318
3319/* mcpdm slave ports */
3320static struct omap_hwmod_ocp_if *omap44xx_mcpdm_slaves[] = {
3321 &omap44xx_l4_abe__mcpdm,
3322 &omap44xx_l4_abe__mcpdm_dma,
3323};
3324
3325static struct omap_hwmod omap44xx_mcpdm_hwmod = { 2086static struct omap_hwmod omap44xx_mcpdm_hwmod = {
3326 .name = "mcpdm", 2087 .name = "mcpdm",
3327 .class = &omap44xx_mcpdm_hwmod_class, 2088 .class = &omap44xx_mcpdm_hwmod_class,
@@ -3336,8 +2097,6 @@ static struct omap_hwmod omap44xx_mcpdm_hwmod = {
3336 .modulemode = MODULEMODE_SWCTRL, 2097 .modulemode = MODULEMODE_SWCTRL,
3337 }, 2098 },
3338 }, 2099 },
3339 .slaves = omap44xx_mcpdm_slaves,
3340 .slaves_cnt = ARRAY_SIZE(omap44xx_mcpdm_slaves),
3341}; 2100};
3342 2101
3343/* 2102/*
@@ -3363,7 +2122,6 @@ static struct omap_hwmod_class omap44xx_mcspi_hwmod_class = {
3363}; 2122};
3364 2123
3365/* mcspi1 */ 2124/* mcspi1 */
3366static struct omap_hwmod omap44xx_mcspi1_hwmod;
3367static struct omap_hwmod_irq_info omap44xx_mcspi1_irqs[] = { 2125static struct omap_hwmod_irq_info omap44xx_mcspi1_irqs[] = {
3368 { .irq = 65 + OMAP44XX_IRQ_GIC_START }, 2126 { .irq = 65 + OMAP44XX_IRQ_GIC_START },
3369 { .irq = -1 } 2127 { .irq = -1 }
@@ -3381,29 +2139,6 @@ static struct omap_hwmod_dma_info omap44xx_mcspi1_sdma_reqs[] = {
3381 { .dma_req = -1 } 2139 { .dma_req = -1 }
3382}; 2140};
3383 2141
3384static struct omap_hwmod_addr_space omap44xx_mcspi1_addrs[] = {
3385 {
3386 .pa_start = 0x48098000,
3387 .pa_end = 0x480981ff,
3388 .flags = ADDR_TYPE_RT
3389 },
3390 { }
3391};
3392
3393/* l4_per -> mcspi1 */
3394static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi1 = {
3395 .master = &omap44xx_l4_per_hwmod,
3396 .slave = &omap44xx_mcspi1_hwmod,
3397 .clk = "l4_div_ck",
3398 .addr = omap44xx_mcspi1_addrs,
3399 .user = OCP_USER_MPU | OCP_USER_SDMA,
3400};
3401
3402/* mcspi1 slave ports */
3403static struct omap_hwmod_ocp_if *omap44xx_mcspi1_slaves[] = {
3404 &omap44xx_l4_per__mcspi1,
3405};
3406
3407/* mcspi1 dev_attr */ 2142/* mcspi1 dev_attr */
3408static struct omap2_mcspi_dev_attr mcspi1_dev_attr = { 2143static struct omap2_mcspi_dev_attr mcspi1_dev_attr = {
3409 .num_chipselect = 4, 2144 .num_chipselect = 4,
@@ -3424,12 +2159,9 @@ static struct omap_hwmod omap44xx_mcspi1_hwmod = {
3424 }, 2159 },
3425 }, 2160 },
3426 .dev_attr = &mcspi1_dev_attr, 2161 .dev_attr = &mcspi1_dev_attr,
3427 .slaves = omap44xx_mcspi1_slaves,
3428 .slaves_cnt = ARRAY_SIZE(omap44xx_mcspi1_slaves),
3429}; 2162};
3430 2163
3431/* mcspi2 */ 2164/* mcspi2 */
3432static struct omap_hwmod omap44xx_mcspi2_hwmod;
3433static struct omap_hwmod_irq_info omap44xx_mcspi2_irqs[] = { 2165static struct omap_hwmod_irq_info omap44xx_mcspi2_irqs[] = {
3434 { .irq = 66 + OMAP44XX_IRQ_GIC_START }, 2166 { .irq = 66 + OMAP44XX_IRQ_GIC_START },
3435 { .irq = -1 } 2167 { .irq = -1 }
@@ -3443,29 +2175,6 @@ static struct omap_hwmod_dma_info omap44xx_mcspi2_sdma_reqs[] = {
3443 { .dma_req = -1 } 2175 { .dma_req = -1 }
3444}; 2176};
3445 2177
3446static struct omap_hwmod_addr_space omap44xx_mcspi2_addrs[] = {
3447 {
3448 .pa_start = 0x4809a000,
3449 .pa_end = 0x4809a1ff,
3450 .flags = ADDR_TYPE_RT
3451 },
3452 { }
3453};
3454
3455/* l4_per -> mcspi2 */
3456static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi2 = {
3457 .master = &omap44xx_l4_per_hwmod,
3458 .slave = &omap44xx_mcspi2_hwmod,
3459 .clk = "l4_div_ck",
3460 .addr = omap44xx_mcspi2_addrs,
3461 .user = OCP_USER_MPU | OCP_USER_SDMA,
3462};
3463
3464/* mcspi2 slave ports */
3465static struct omap_hwmod_ocp_if *omap44xx_mcspi2_slaves[] = {
3466 &omap44xx_l4_per__mcspi2,
3467};
3468
3469/* mcspi2 dev_attr */ 2178/* mcspi2 dev_attr */
3470static struct omap2_mcspi_dev_attr mcspi2_dev_attr = { 2179static struct omap2_mcspi_dev_attr mcspi2_dev_attr = {
3471 .num_chipselect = 2, 2180 .num_chipselect = 2,
@@ -3486,12 +2195,9 @@ static struct omap_hwmod omap44xx_mcspi2_hwmod = {
3486 }, 2195 },
3487 }, 2196 },
3488 .dev_attr = &mcspi2_dev_attr, 2197 .dev_attr = &mcspi2_dev_attr,
3489 .slaves = omap44xx_mcspi2_slaves,
3490 .slaves_cnt = ARRAY_SIZE(omap44xx_mcspi2_slaves),
3491}; 2198};
3492 2199
3493/* mcspi3 */ 2200/* mcspi3 */
3494static struct omap_hwmod omap44xx_mcspi3_hwmod;
3495static struct omap_hwmod_irq_info omap44xx_mcspi3_irqs[] = { 2201static struct omap_hwmod_irq_info omap44xx_mcspi3_irqs[] = {
3496 { .irq = 91 + OMAP44XX_IRQ_GIC_START }, 2202 { .irq = 91 + OMAP44XX_IRQ_GIC_START },
3497 { .irq = -1 } 2203 { .irq = -1 }
@@ -3505,29 +2211,6 @@ static struct omap_hwmod_dma_info omap44xx_mcspi3_sdma_reqs[] = {
3505 { .dma_req = -1 } 2211 { .dma_req = -1 }
3506}; 2212};
3507 2213
3508static struct omap_hwmod_addr_space omap44xx_mcspi3_addrs[] = {
3509 {
3510 .pa_start = 0x480b8000,
3511 .pa_end = 0x480b81ff,
3512 .flags = ADDR_TYPE_RT
3513 },
3514 { }
3515};
3516
3517/* l4_per -> mcspi3 */
3518static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi3 = {
3519 .master = &omap44xx_l4_per_hwmod,
3520 .slave = &omap44xx_mcspi3_hwmod,
3521 .clk = "l4_div_ck",
3522 .addr = omap44xx_mcspi3_addrs,
3523 .user = OCP_USER_MPU | OCP_USER_SDMA,
3524};
3525
3526/* mcspi3 slave ports */
3527static struct omap_hwmod_ocp_if *omap44xx_mcspi3_slaves[] = {
3528 &omap44xx_l4_per__mcspi3,
3529};
3530
3531/* mcspi3 dev_attr */ 2214/* mcspi3 dev_attr */
3532static struct omap2_mcspi_dev_attr mcspi3_dev_attr = { 2215static struct omap2_mcspi_dev_attr mcspi3_dev_attr = {
3533 .num_chipselect = 2, 2216 .num_chipselect = 2,
@@ -3548,12 +2231,9 @@ static struct omap_hwmod omap44xx_mcspi3_hwmod = {
3548 }, 2231 },
3549 }, 2232 },
3550 .dev_attr = &mcspi3_dev_attr, 2233 .dev_attr = &mcspi3_dev_attr,
3551 .slaves = omap44xx_mcspi3_slaves,
3552 .slaves_cnt = ARRAY_SIZE(omap44xx_mcspi3_slaves),
3553}; 2234};
3554 2235
3555/* mcspi4 */ 2236/* mcspi4 */
3556static struct omap_hwmod omap44xx_mcspi4_hwmod;
3557static struct omap_hwmod_irq_info omap44xx_mcspi4_irqs[] = { 2237static struct omap_hwmod_irq_info omap44xx_mcspi4_irqs[] = {
3558 { .irq = 48 + OMAP44XX_IRQ_GIC_START }, 2238 { .irq = 48 + OMAP44XX_IRQ_GIC_START },
3559 { .irq = -1 } 2239 { .irq = -1 }
@@ -3565,29 +2245,6 @@ static struct omap_hwmod_dma_info omap44xx_mcspi4_sdma_reqs[] = {
3565 { .dma_req = -1 } 2245 { .dma_req = -1 }
3566}; 2246};
3567 2247
3568static struct omap_hwmod_addr_space omap44xx_mcspi4_addrs[] = {
3569 {
3570 .pa_start = 0x480ba000,
3571 .pa_end = 0x480ba1ff,
3572 .flags = ADDR_TYPE_RT
3573 },
3574 { }
3575};
3576
3577/* l4_per -> mcspi4 */
3578static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi4 = {
3579 .master = &omap44xx_l4_per_hwmod,
3580 .slave = &omap44xx_mcspi4_hwmod,
3581 .clk = "l4_div_ck",
3582 .addr = omap44xx_mcspi4_addrs,
3583 .user = OCP_USER_MPU | OCP_USER_SDMA,
3584};
3585
3586/* mcspi4 slave ports */
3587static struct omap_hwmod_ocp_if *omap44xx_mcspi4_slaves[] = {
3588 &omap44xx_l4_per__mcspi4,
3589};
3590
3591/* mcspi4 dev_attr */ 2248/* mcspi4 dev_attr */
3592static struct omap2_mcspi_dev_attr mcspi4_dev_attr = { 2249static struct omap2_mcspi_dev_attr mcspi4_dev_attr = {
3593 .num_chipselect = 1, 2250 .num_chipselect = 1,
@@ -3608,8 +2265,6 @@ static struct omap_hwmod omap44xx_mcspi4_hwmod = {
3608 }, 2265 },
3609 }, 2266 },
3610 .dev_attr = &mcspi4_dev_attr, 2267 .dev_attr = &mcspi4_dev_attr,
3611 .slaves = omap44xx_mcspi4_slaves,
3612 .slaves_cnt = ARRAY_SIZE(omap44xx_mcspi4_slaves),
3613}; 2268};
3614 2269
3615/* 2270/*
@@ -3646,34 +2301,6 @@ static struct omap_hwmod_dma_info omap44xx_mmc1_sdma_reqs[] = {
3646 { .dma_req = -1 } 2301 { .dma_req = -1 }
3647}; 2302};
3648 2303
3649/* mmc1 master ports */
3650static struct omap_hwmod_ocp_if *omap44xx_mmc1_masters[] = {
3651 &omap44xx_mmc1__l3_main_1,
3652};
3653
3654static struct omap_hwmod_addr_space omap44xx_mmc1_addrs[] = {
3655 {
3656 .pa_start = 0x4809c000,
3657 .pa_end = 0x4809c3ff,
3658 .flags = ADDR_TYPE_RT
3659 },
3660 { }
3661};
3662
3663/* l4_per -> mmc1 */
3664static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc1 = {
3665 .master = &omap44xx_l4_per_hwmod,
3666 .slave = &omap44xx_mmc1_hwmod,
3667 .clk = "l4_div_ck",
3668 .addr = omap44xx_mmc1_addrs,
3669 .user = OCP_USER_MPU | OCP_USER_SDMA,
3670};
3671
3672/* mmc1 slave ports */
3673static struct omap_hwmod_ocp_if *omap44xx_mmc1_slaves[] = {
3674 &omap44xx_l4_per__mmc1,
3675};
3676
3677/* mmc1 dev_attr */ 2304/* mmc1 dev_attr */
3678static struct omap_mmc_dev_attr mmc1_dev_attr = { 2305static struct omap_mmc_dev_attr mmc1_dev_attr = {
3679 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, 2306 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
@@ -3694,10 +2321,6 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = {
3694 }, 2321 },
3695 }, 2322 },
3696 .dev_attr = &mmc1_dev_attr, 2323 .dev_attr = &mmc1_dev_attr,
3697 .slaves = omap44xx_mmc1_slaves,
3698 .slaves_cnt = ARRAY_SIZE(omap44xx_mmc1_slaves),
3699 .masters = omap44xx_mmc1_masters,
3700 .masters_cnt = ARRAY_SIZE(omap44xx_mmc1_masters),
3701}; 2324};
3702 2325
3703/* mmc2 */ 2326/* mmc2 */
@@ -3712,34 +2335,6 @@ static struct omap_hwmod_dma_info omap44xx_mmc2_sdma_reqs[] = {
3712 { .dma_req = -1 } 2335 { .dma_req = -1 }
3713}; 2336};
3714 2337
3715/* mmc2 master ports */
3716static struct omap_hwmod_ocp_if *omap44xx_mmc2_masters[] = {
3717 &omap44xx_mmc2__l3_main_1,
3718};
3719
3720static struct omap_hwmod_addr_space omap44xx_mmc2_addrs[] = {
3721 {
3722 .pa_start = 0x480b4000,
3723 .pa_end = 0x480b43ff,
3724 .flags = ADDR_TYPE_RT
3725 },
3726 { }
3727};
3728
3729/* l4_per -> mmc2 */
3730static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc2 = {
3731 .master = &omap44xx_l4_per_hwmod,
3732 .slave = &omap44xx_mmc2_hwmod,
3733 .clk = "l4_div_ck",
3734 .addr = omap44xx_mmc2_addrs,
3735 .user = OCP_USER_MPU | OCP_USER_SDMA,
3736};
3737
3738/* mmc2 slave ports */
3739static struct omap_hwmod_ocp_if *omap44xx_mmc2_slaves[] = {
3740 &omap44xx_l4_per__mmc2,
3741};
3742
3743static struct omap_hwmod omap44xx_mmc2_hwmod = { 2338static struct omap_hwmod omap44xx_mmc2_hwmod = {
3744 .name = "mmc2", 2339 .name = "mmc2",
3745 .class = &omap44xx_mmc_hwmod_class, 2340 .class = &omap44xx_mmc_hwmod_class,
@@ -3754,14 +2349,9 @@ static struct omap_hwmod omap44xx_mmc2_hwmod = {
3754 .modulemode = MODULEMODE_SWCTRL, 2349 .modulemode = MODULEMODE_SWCTRL,
3755 }, 2350 },
3756 }, 2351 },
3757 .slaves = omap44xx_mmc2_slaves,
3758 .slaves_cnt = ARRAY_SIZE(omap44xx_mmc2_slaves),
3759 .masters = omap44xx_mmc2_masters,
3760 .masters_cnt = ARRAY_SIZE(omap44xx_mmc2_masters),
3761}; 2352};
3762 2353
3763/* mmc3 */ 2354/* mmc3 */
3764static struct omap_hwmod omap44xx_mmc3_hwmod;
3765static struct omap_hwmod_irq_info omap44xx_mmc3_irqs[] = { 2355static struct omap_hwmod_irq_info omap44xx_mmc3_irqs[] = {
3766 { .irq = 94 + OMAP44XX_IRQ_GIC_START }, 2356 { .irq = 94 + OMAP44XX_IRQ_GIC_START },
3767 { .irq = -1 } 2357 { .irq = -1 }
@@ -3773,29 +2363,6 @@ static struct omap_hwmod_dma_info omap44xx_mmc3_sdma_reqs[] = {
3773 { .dma_req = -1 } 2363 { .dma_req = -1 }
3774}; 2364};
3775 2365
3776static struct omap_hwmod_addr_space omap44xx_mmc3_addrs[] = {
3777 {
3778 .pa_start = 0x480ad000,
3779 .pa_end = 0x480ad3ff,
3780 .flags = ADDR_TYPE_RT
3781 },
3782 { }
3783};
3784
3785/* l4_per -> mmc3 */
3786static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc3 = {
3787 .master = &omap44xx_l4_per_hwmod,
3788 .slave = &omap44xx_mmc3_hwmod,
3789 .clk = "l4_div_ck",
3790 .addr = omap44xx_mmc3_addrs,
3791 .user = OCP_USER_MPU | OCP_USER_SDMA,
3792};
3793
3794/* mmc3 slave ports */
3795static struct omap_hwmod_ocp_if *omap44xx_mmc3_slaves[] = {
3796 &omap44xx_l4_per__mmc3,
3797};
3798
3799static struct omap_hwmod omap44xx_mmc3_hwmod = { 2366static struct omap_hwmod omap44xx_mmc3_hwmod = {
3800 .name = "mmc3", 2367 .name = "mmc3",
3801 .class = &omap44xx_mmc_hwmod_class, 2368 .class = &omap44xx_mmc_hwmod_class,
@@ -3810,12 +2377,9 @@ static struct omap_hwmod omap44xx_mmc3_hwmod = {
3810 .modulemode = MODULEMODE_SWCTRL, 2377 .modulemode = MODULEMODE_SWCTRL,
3811 }, 2378 },
3812 }, 2379 },
3813 .slaves = omap44xx_mmc3_slaves,
3814 .slaves_cnt = ARRAY_SIZE(omap44xx_mmc3_slaves),
3815}; 2380};
3816 2381
3817/* mmc4 */ 2382/* mmc4 */
3818static struct omap_hwmod omap44xx_mmc4_hwmod;
3819static struct omap_hwmod_irq_info omap44xx_mmc4_irqs[] = { 2383static struct omap_hwmod_irq_info omap44xx_mmc4_irqs[] = {
3820 { .irq = 96 + OMAP44XX_IRQ_GIC_START }, 2384 { .irq = 96 + OMAP44XX_IRQ_GIC_START },
3821 { .irq = -1 } 2385 { .irq = -1 }
@@ -3827,35 +2391,11 @@ static struct omap_hwmod_dma_info omap44xx_mmc4_sdma_reqs[] = {
3827 { .dma_req = -1 } 2391 { .dma_req = -1 }
3828}; 2392};
3829 2393
3830static struct omap_hwmod_addr_space omap44xx_mmc4_addrs[] = {
3831 {
3832 .pa_start = 0x480d1000,
3833 .pa_end = 0x480d13ff,
3834 .flags = ADDR_TYPE_RT
3835 },
3836 { }
3837};
3838
3839/* l4_per -> mmc4 */
3840static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc4 = {
3841 .master = &omap44xx_l4_per_hwmod,
3842 .slave = &omap44xx_mmc4_hwmod,
3843 .clk = "l4_div_ck",
3844 .addr = omap44xx_mmc4_addrs,
3845 .user = OCP_USER_MPU | OCP_USER_SDMA,
3846};
3847
3848/* mmc4 slave ports */
3849static struct omap_hwmod_ocp_if *omap44xx_mmc4_slaves[] = {
3850 &omap44xx_l4_per__mmc4,
3851};
3852
3853static struct omap_hwmod omap44xx_mmc4_hwmod = { 2394static struct omap_hwmod omap44xx_mmc4_hwmod = {
3854 .name = "mmc4", 2395 .name = "mmc4",
3855 .class = &omap44xx_mmc_hwmod_class, 2396 .class = &omap44xx_mmc_hwmod_class,
3856 .clkdm_name = "l4_per_clkdm", 2397 .clkdm_name = "l4_per_clkdm",
3857 .mpu_irqs = omap44xx_mmc4_irqs, 2398 .mpu_irqs = omap44xx_mmc4_irqs,
3858
3859 .sdma_reqs = omap44xx_mmc4_sdma_reqs, 2399 .sdma_reqs = omap44xx_mmc4_sdma_reqs,
3860 .main_clk = "mmc4_fck", 2400 .main_clk = "mmc4_fck",
3861 .prcm = { 2401 .prcm = {
@@ -3865,12 +2405,9 @@ static struct omap_hwmod omap44xx_mmc4_hwmod = {
3865 .modulemode = MODULEMODE_SWCTRL, 2405 .modulemode = MODULEMODE_SWCTRL,
3866 }, 2406 },
3867 }, 2407 },
3868 .slaves = omap44xx_mmc4_slaves,
3869 .slaves_cnt = ARRAY_SIZE(omap44xx_mmc4_slaves),
3870}; 2408};
3871 2409
3872/* mmc5 */ 2410/* mmc5 */
3873static struct omap_hwmod omap44xx_mmc5_hwmod;
3874static struct omap_hwmod_irq_info omap44xx_mmc5_irqs[] = { 2411static struct omap_hwmod_irq_info omap44xx_mmc5_irqs[] = {
3875 { .irq = 59 + OMAP44XX_IRQ_GIC_START }, 2412 { .irq = 59 + OMAP44XX_IRQ_GIC_START },
3876 { .irq = -1 } 2413 { .irq = -1 }
@@ -3882,29 +2419,6 @@ static struct omap_hwmod_dma_info omap44xx_mmc5_sdma_reqs[] = {
3882 { .dma_req = -1 } 2419 { .dma_req = -1 }
3883}; 2420};
3884 2421
3885static struct omap_hwmod_addr_space omap44xx_mmc5_addrs[] = {
3886 {
3887 .pa_start = 0x480d5000,
3888 .pa_end = 0x480d53ff,
3889 .flags = ADDR_TYPE_RT
3890 },
3891 { }
3892};
3893
3894/* l4_per -> mmc5 */
3895static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc5 = {
3896 .master = &omap44xx_l4_per_hwmod,
3897 .slave = &omap44xx_mmc5_hwmod,
3898 .clk = "l4_div_ck",
3899 .addr = omap44xx_mmc5_addrs,
3900 .user = OCP_USER_MPU | OCP_USER_SDMA,
3901};
3902
3903/* mmc5 slave ports */
3904static struct omap_hwmod_ocp_if *omap44xx_mmc5_slaves[] = {
3905 &omap44xx_l4_per__mmc5,
3906};
3907
3908static struct omap_hwmod omap44xx_mmc5_hwmod = { 2422static struct omap_hwmod omap44xx_mmc5_hwmod = {
3909 .name = "mmc5", 2423 .name = "mmc5",
3910 .class = &omap44xx_mmc_hwmod_class, 2424 .class = &omap44xx_mmc_hwmod_class,
@@ -3919,8 +2433,6 @@ static struct omap_hwmod omap44xx_mmc5_hwmod = {
3919 .modulemode = MODULEMODE_SWCTRL, 2433 .modulemode = MODULEMODE_SWCTRL,
3920 }, 2434 },
3921 }, 2435 },
3922 .slaves = omap44xx_mmc5_slaves,
3923 .slaves_cnt = ARRAY_SIZE(omap44xx_mmc5_slaves),
3924}; 2436};
3925 2437
3926/* 2438/*
@@ -3940,13 +2452,6 @@ static struct omap_hwmod_irq_info omap44xx_mpu_irqs[] = {
3940 { .irq = -1 } 2452 { .irq = -1 }
3941}; 2453};
3942 2454
3943/* mpu master ports */
3944static struct omap_hwmod_ocp_if *omap44xx_mpu_masters[] = {
3945 &omap44xx_mpu__l3_main_1,
3946 &omap44xx_mpu__l4_abe,
3947 &omap44xx_mpu__dmm,
3948};
3949
3950static struct omap_hwmod omap44xx_mpu_hwmod = { 2455static struct omap_hwmod omap44xx_mpu_hwmod = {
3951 .name = "mpu", 2456 .name = "mpu",
3952 .class = &omap44xx_mpu_hwmod_class, 2457 .class = &omap44xx_mpu_hwmod_class,
@@ -3960,8 +2465,252 @@ static struct omap_hwmod omap44xx_mpu_hwmod = {
3960 .context_offs = OMAP4_RM_MPU_MPU_CONTEXT_OFFSET, 2465 .context_offs = OMAP4_RM_MPU_MPU_CONTEXT_OFFSET,
3961 }, 2466 },
3962 }, 2467 },
3963 .masters = omap44xx_mpu_masters, 2468};
3964 .masters_cnt = ARRAY_SIZE(omap44xx_mpu_masters), 2469
2470/*
2471 * 'ocmc_ram' class
2472 * top-level core on-chip ram
2473 */
2474
2475static struct omap_hwmod_class omap44xx_ocmc_ram_hwmod_class = {
2476 .name = "ocmc_ram",
2477};
2478
2479/* ocmc_ram */
2480static struct omap_hwmod omap44xx_ocmc_ram_hwmod = {
2481 .name = "ocmc_ram",
2482 .class = &omap44xx_ocmc_ram_hwmod_class,
2483 .clkdm_name = "l3_2_clkdm",
2484 .prcm = {
2485 .omap4 = {
2486 .clkctrl_offs = OMAP4_CM_L3_2_OCMC_RAM_CLKCTRL_OFFSET,
2487 .context_offs = OMAP4_RM_L3_2_OCMC_RAM_CONTEXT_OFFSET,
2488 },
2489 },
2490};
2491
2492/*
2493 * 'ocp2scp' class
2494 * bridge to transform ocp interface protocol to scp (serial control port)
2495 * protocol
2496 */
2497
2498static struct omap_hwmod_class omap44xx_ocp2scp_hwmod_class = {
2499 .name = "ocp2scp",
2500};
2501
2502/* ocp2scp_usb_phy */
2503static struct omap_hwmod_opt_clk ocp2scp_usb_phy_opt_clks[] = {
2504 { .role = "phy_48m", .clk = "ocp2scp_usb_phy_phy_48m" },
2505};
2506
2507static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
2508 .name = "ocp2scp_usb_phy",
2509 .class = &omap44xx_ocp2scp_hwmod_class,
2510 .clkdm_name = "l3_init_clkdm",
2511 .prcm = {
2512 .omap4 = {
2513 .clkctrl_offs = OMAP4_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL_OFFSET,
2514 .context_offs = OMAP4_RM_L3INIT_USBPHYOCP2SCP_CONTEXT_OFFSET,
2515 .modulemode = MODULEMODE_HWCTRL,
2516 },
2517 },
2518 .opt_clks = ocp2scp_usb_phy_opt_clks,
2519 .opt_clks_cnt = ARRAY_SIZE(ocp2scp_usb_phy_opt_clks),
2520};
2521
2522/*
2523 * 'prcm' class
2524 * power and reset manager (part of the prcm infrastructure) + clock manager 2
2525 * + clock manager 1 (in always on power domain) + local prm in mpu
2526 */
2527
2528static struct omap_hwmod_class omap44xx_prcm_hwmod_class = {
2529 .name = "prcm",
2530};
2531
2532/* prcm_mpu */
2533static struct omap_hwmod omap44xx_prcm_mpu_hwmod = {
2534 .name = "prcm_mpu",
2535 .class = &omap44xx_prcm_hwmod_class,
2536 .clkdm_name = "l4_wkup_clkdm",
2537};
2538
2539/* cm_core_aon */
2540static struct omap_hwmod omap44xx_cm_core_aon_hwmod = {
2541 .name = "cm_core_aon",
2542 .class = &omap44xx_prcm_hwmod_class,
2543 .clkdm_name = "cm_clkdm",
2544};
2545
2546/* cm_core */
2547static struct omap_hwmod omap44xx_cm_core_hwmod = {
2548 .name = "cm_core",
2549 .class = &omap44xx_prcm_hwmod_class,
2550 .clkdm_name = "cm_clkdm",
2551};
2552
2553/* prm */
2554static struct omap_hwmod_irq_info omap44xx_prm_irqs[] = {
2555 { .irq = 11 + OMAP44XX_IRQ_GIC_START },
2556 { .irq = -1 }
2557};
2558
2559static struct omap_hwmod_rst_info omap44xx_prm_resets[] = {
2560 { .name = "rst_global_warm_sw", .rst_shift = 0 },
2561 { .name = "rst_global_cold_sw", .rst_shift = 1 },
2562};
2563
2564static struct omap_hwmod omap44xx_prm_hwmod = {
2565 .name = "prm",
2566 .class = &omap44xx_prcm_hwmod_class,
2567 .clkdm_name = "prm_clkdm",
2568 .mpu_irqs = omap44xx_prm_irqs,
2569 .rst_lines = omap44xx_prm_resets,
2570 .rst_lines_cnt = ARRAY_SIZE(omap44xx_prm_resets),
2571};
2572
2573/*
2574 * 'scrm' class
2575 * system clock and reset manager
2576 */
2577
2578static struct omap_hwmod_class omap44xx_scrm_hwmod_class = {
2579 .name = "scrm",
2580};
2581
2582/* scrm */
2583static struct omap_hwmod omap44xx_scrm_hwmod = {
2584 .name = "scrm",
2585 .class = &omap44xx_scrm_hwmod_class,
2586 .clkdm_name = "l4_wkup_clkdm",
2587};
2588
2589/*
2590 * 'sl2if' class
2591 * shared level 2 memory interface
2592 */
2593
2594static struct omap_hwmod_class omap44xx_sl2if_hwmod_class = {
2595 .name = "sl2if",
2596};
2597
2598/* sl2if */
2599static struct omap_hwmod omap44xx_sl2if_hwmod = {
2600 .name = "sl2if",
2601 .class = &omap44xx_sl2if_hwmod_class,
2602 .clkdm_name = "ivahd_clkdm",
2603 .prcm = {
2604 .omap4 = {
2605 .clkctrl_offs = OMAP4_CM_IVAHD_SL2_CLKCTRL_OFFSET,
2606 .context_offs = OMAP4_RM_IVAHD_SL2_CONTEXT_OFFSET,
2607 .modulemode = MODULEMODE_HWCTRL,
2608 },
2609 },
2610};
2611
2612/*
2613 * 'slimbus' class
2614 * bidirectional, multi-drop, multi-channel two-line serial interface between
2615 * the device and external components
2616 */
2617
2618static struct omap_hwmod_class_sysconfig omap44xx_slimbus_sysc = {
2619 .rev_offs = 0x0000,
2620 .sysc_offs = 0x0010,
2621 .sysc_flags = (SYSC_HAS_RESET_STATUS | SYSC_HAS_SIDLEMODE |
2622 SYSC_HAS_SOFTRESET),
2623 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
2624 SIDLE_SMART_WKUP),
2625 .sysc_fields = &omap_hwmod_sysc_type2,
2626};
2627
2628static struct omap_hwmod_class omap44xx_slimbus_hwmod_class = {
2629 .name = "slimbus",
2630 .sysc = &omap44xx_slimbus_sysc,
2631};
2632
2633/* slimbus1 */
2634static struct omap_hwmod_irq_info omap44xx_slimbus1_irqs[] = {
2635 { .irq = 97 + OMAP44XX_IRQ_GIC_START },
2636 { .irq = -1 }
2637};
2638
2639static struct omap_hwmod_dma_info omap44xx_slimbus1_sdma_reqs[] = {
2640 { .name = "tx0", .dma_req = 84 + OMAP44XX_DMA_REQ_START },
2641 { .name = "tx1", .dma_req = 85 + OMAP44XX_DMA_REQ_START },
2642 { .name = "tx2", .dma_req = 86 + OMAP44XX_DMA_REQ_START },
2643 { .name = "tx3", .dma_req = 87 + OMAP44XX_DMA_REQ_START },
2644 { .name = "rx0", .dma_req = 88 + OMAP44XX_DMA_REQ_START },
2645 { .name = "rx1", .dma_req = 89 + OMAP44XX_DMA_REQ_START },
2646 { .name = "rx2", .dma_req = 90 + OMAP44XX_DMA_REQ_START },
2647 { .name = "rx3", .dma_req = 91 + OMAP44XX_DMA_REQ_START },
2648 { .dma_req = -1 }
2649};
2650
2651static struct omap_hwmod_opt_clk slimbus1_opt_clks[] = {
2652 { .role = "fclk_1", .clk = "slimbus1_fclk_1" },
2653 { .role = "fclk_0", .clk = "slimbus1_fclk_0" },
2654 { .role = "fclk_2", .clk = "slimbus1_fclk_2" },
2655 { .role = "slimbus_clk", .clk = "slimbus1_slimbus_clk" },
2656};
2657
2658static struct omap_hwmod omap44xx_slimbus1_hwmod = {
2659 .name = "slimbus1",
2660 .class = &omap44xx_slimbus_hwmod_class,
2661 .clkdm_name = "abe_clkdm",
2662 .mpu_irqs = omap44xx_slimbus1_irqs,
2663 .sdma_reqs = omap44xx_slimbus1_sdma_reqs,
2664 .prcm = {
2665 .omap4 = {
2666 .clkctrl_offs = OMAP4_CM1_ABE_SLIMBUS_CLKCTRL_OFFSET,
2667 .context_offs = OMAP4_RM_ABE_SLIMBUS_CONTEXT_OFFSET,
2668 .modulemode = MODULEMODE_SWCTRL,
2669 },
2670 },
2671 .opt_clks = slimbus1_opt_clks,
2672 .opt_clks_cnt = ARRAY_SIZE(slimbus1_opt_clks),
2673};
2674
2675/* slimbus2 */
2676static struct omap_hwmod_irq_info omap44xx_slimbus2_irqs[] = {
2677 { .irq = 98 + OMAP44XX_IRQ_GIC_START },
2678 { .irq = -1 }
2679};
2680
2681static struct omap_hwmod_dma_info omap44xx_slimbus2_sdma_reqs[] = {
2682 { .name = "tx0", .dma_req = 92 + OMAP44XX_DMA_REQ_START },
2683 { .name = "tx1", .dma_req = 93 + OMAP44XX_DMA_REQ_START },
2684 { .name = "tx2", .dma_req = 94 + OMAP44XX_DMA_REQ_START },
2685 { .name = "tx3", .dma_req = 95 + OMAP44XX_DMA_REQ_START },
2686 { .name = "rx0", .dma_req = 96 + OMAP44XX_DMA_REQ_START },
2687 { .name = "rx1", .dma_req = 97 + OMAP44XX_DMA_REQ_START },
2688 { .name = "rx2", .dma_req = 98 + OMAP44XX_DMA_REQ_START },
2689 { .name = "rx3", .dma_req = 99 + OMAP44XX_DMA_REQ_START },
2690 { .dma_req = -1 }
2691};
2692
2693static struct omap_hwmod_opt_clk slimbus2_opt_clks[] = {
2694 { .role = "fclk_1", .clk = "slimbus2_fclk_1" },
2695 { .role = "fclk_0", .clk = "slimbus2_fclk_0" },
2696 { .role = "slimbus_clk", .clk = "slimbus2_slimbus_clk" },
2697};
2698
2699static struct omap_hwmod omap44xx_slimbus2_hwmod = {
2700 .name = "slimbus2",
2701 .class = &omap44xx_slimbus_hwmod_class,
2702 .clkdm_name = "l4_per_clkdm",
2703 .mpu_irqs = omap44xx_slimbus2_irqs,
2704 .sdma_reqs = omap44xx_slimbus2_sdma_reqs,
2705 .prcm = {
2706 .omap4 = {
2707 .clkctrl_offs = OMAP4_CM_L4PER_SLIMBUS2_CLKCTRL_OFFSET,
2708 .context_offs = OMAP4_RM_L4PER_SLIMBUS2_CONTEXT_OFFSET,
2709 .modulemode = MODULEMODE_SWCTRL,
2710 },
2711 },
2712 .opt_clks = slimbus2_opt_clks,
2713 .opt_clks_cnt = ARRAY_SIZE(slimbus2_opt_clks),
3965}; 2714};
3966 2715
3967/* 2716/*
@@ -3995,35 +2744,11 @@ static struct omap_smartreflex_dev_attr smartreflex_core_dev_attr = {
3995 .sensor_voltdm_name = "core", 2744 .sensor_voltdm_name = "core",
3996}; 2745};
3997 2746
3998static struct omap_hwmod omap44xx_smartreflex_core_hwmod;
3999static struct omap_hwmod_irq_info omap44xx_smartreflex_core_irqs[] = { 2747static struct omap_hwmod_irq_info omap44xx_smartreflex_core_irqs[] = {
4000 { .irq = 19 + OMAP44XX_IRQ_GIC_START }, 2748 { .irq = 19 + OMAP44XX_IRQ_GIC_START },
4001 { .irq = -1 } 2749 { .irq = -1 }
4002}; 2750};
4003 2751
4004static struct omap_hwmod_addr_space omap44xx_smartreflex_core_addrs[] = {
4005 {
4006 .pa_start = 0x4a0dd000,
4007 .pa_end = 0x4a0dd03f,
4008 .flags = ADDR_TYPE_RT
4009 },
4010 { }
4011};
4012
4013/* l4_cfg -> smartreflex_core */
4014static struct omap_hwmod_ocp_if omap44xx_l4_cfg__smartreflex_core = {
4015 .master = &omap44xx_l4_cfg_hwmod,
4016 .slave = &omap44xx_smartreflex_core_hwmod,
4017 .clk = "l4_div_ck",
4018 .addr = omap44xx_smartreflex_core_addrs,
4019 .user = OCP_USER_MPU | OCP_USER_SDMA,
4020};
4021
4022/* smartreflex_core slave ports */
4023static struct omap_hwmod_ocp_if *omap44xx_smartreflex_core_slaves[] = {
4024 &omap44xx_l4_cfg__smartreflex_core,
4025};
4026
4027static struct omap_hwmod omap44xx_smartreflex_core_hwmod = { 2752static struct omap_hwmod omap44xx_smartreflex_core_hwmod = {
4028 .name = "smartreflex_core", 2753 .name = "smartreflex_core",
4029 .class = &omap44xx_smartreflex_hwmod_class, 2754 .class = &omap44xx_smartreflex_hwmod_class,
@@ -4038,8 +2763,6 @@ static struct omap_hwmod omap44xx_smartreflex_core_hwmod = {
4038 .modulemode = MODULEMODE_SWCTRL, 2763 .modulemode = MODULEMODE_SWCTRL,
4039 }, 2764 },
4040 }, 2765 },
4041 .slaves = omap44xx_smartreflex_core_slaves,
4042 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_core_slaves),
4043 .dev_attr = &smartreflex_core_dev_attr, 2766 .dev_attr = &smartreflex_core_dev_attr,
4044}; 2767};
4045 2768
@@ -4048,35 +2771,11 @@ static struct omap_smartreflex_dev_attr smartreflex_iva_dev_attr = {
4048 .sensor_voltdm_name = "iva", 2771 .sensor_voltdm_name = "iva",
4049}; 2772};
4050 2773
4051static struct omap_hwmod omap44xx_smartreflex_iva_hwmod;
4052static struct omap_hwmod_irq_info omap44xx_smartreflex_iva_irqs[] = { 2774static struct omap_hwmod_irq_info omap44xx_smartreflex_iva_irqs[] = {
4053 { .irq = 102 + OMAP44XX_IRQ_GIC_START }, 2775 { .irq = 102 + OMAP44XX_IRQ_GIC_START },
4054 { .irq = -1 } 2776 { .irq = -1 }
4055}; 2777};
4056 2778
4057static struct omap_hwmod_addr_space omap44xx_smartreflex_iva_addrs[] = {
4058 {
4059 .pa_start = 0x4a0db000,
4060 .pa_end = 0x4a0db03f,
4061 .flags = ADDR_TYPE_RT
4062 },
4063 { }
4064};
4065
4066/* l4_cfg -> smartreflex_iva */
4067static struct omap_hwmod_ocp_if omap44xx_l4_cfg__smartreflex_iva = {
4068 .master = &omap44xx_l4_cfg_hwmod,
4069 .slave = &omap44xx_smartreflex_iva_hwmod,
4070 .clk = "l4_div_ck",
4071 .addr = omap44xx_smartreflex_iva_addrs,
4072 .user = OCP_USER_MPU | OCP_USER_SDMA,
4073};
4074
4075/* smartreflex_iva slave ports */
4076static struct omap_hwmod_ocp_if *omap44xx_smartreflex_iva_slaves[] = {
4077 &omap44xx_l4_cfg__smartreflex_iva,
4078};
4079
4080static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = { 2779static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = {
4081 .name = "smartreflex_iva", 2780 .name = "smartreflex_iva",
4082 .class = &omap44xx_smartreflex_hwmod_class, 2781 .class = &omap44xx_smartreflex_hwmod_class,
@@ -4090,8 +2789,6 @@ static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = {
4090 .modulemode = MODULEMODE_SWCTRL, 2789 .modulemode = MODULEMODE_SWCTRL,
4091 }, 2790 },
4092 }, 2791 },
4093 .slaves = omap44xx_smartreflex_iva_slaves,
4094 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_iva_slaves),
4095 .dev_attr = &smartreflex_iva_dev_attr, 2792 .dev_attr = &smartreflex_iva_dev_attr,
4096}; 2793};
4097 2794
@@ -4100,35 +2797,11 @@ static struct omap_smartreflex_dev_attr smartreflex_mpu_dev_attr = {
4100 .sensor_voltdm_name = "mpu", 2797 .sensor_voltdm_name = "mpu",
4101}; 2798};
4102 2799
4103static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod;
4104static struct omap_hwmod_irq_info omap44xx_smartreflex_mpu_irqs[] = { 2800static struct omap_hwmod_irq_info omap44xx_smartreflex_mpu_irqs[] = {
4105 { .irq = 18 + OMAP44XX_IRQ_GIC_START }, 2801 { .irq = 18 + OMAP44XX_IRQ_GIC_START },
4106 { .irq = -1 } 2802 { .irq = -1 }
4107}; 2803};
4108 2804
4109static struct omap_hwmod_addr_space omap44xx_smartreflex_mpu_addrs[] = {
4110 {
4111 .pa_start = 0x4a0d9000,
4112 .pa_end = 0x4a0d903f,
4113 .flags = ADDR_TYPE_RT
4114 },
4115 { }
4116};
4117
4118/* l4_cfg -> smartreflex_mpu */
4119static struct omap_hwmod_ocp_if omap44xx_l4_cfg__smartreflex_mpu = {
4120 .master = &omap44xx_l4_cfg_hwmod,
4121 .slave = &omap44xx_smartreflex_mpu_hwmod,
4122 .clk = "l4_div_ck",
4123 .addr = omap44xx_smartreflex_mpu_addrs,
4124 .user = OCP_USER_MPU | OCP_USER_SDMA,
4125};
4126
4127/* smartreflex_mpu slave ports */
4128static struct omap_hwmod_ocp_if *omap44xx_smartreflex_mpu_slaves[] = {
4129 &omap44xx_l4_cfg__smartreflex_mpu,
4130};
4131
4132static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod = { 2805static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod = {
4133 .name = "smartreflex_mpu", 2806 .name = "smartreflex_mpu",
4134 .class = &omap44xx_smartreflex_hwmod_class, 2807 .class = &omap44xx_smartreflex_hwmod_class,
@@ -4142,8 +2815,6 @@ static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod = {
4142 .modulemode = MODULEMODE_SWCTRL, 2815 .modulemode = MODULEMODE_SWCTRL,
4143 }, 2816 },
4144 }, 2817 },
4145 .slaves = omap44xx_smartreflex_mpu_slaves,
4146 .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_mpu_slaves),
4147 .dev_attr = &smartreflex_mpu_dev_attr, 2818 .dev_attr = &smartreflex_mpu_dev_attr,
4148}; 2819};
4149 2820
@@ -4171,30 +2842,6 @@ static struct omap_hwmod_class omap44xx_spinlock_hwmod_class = {
4171}; 2842};
4172 2843
4173/* spinlock */ 2844/* spinlock */
4174static struct omap_hwmod omap44xx_spinlock_hwmod;
4175static struct omap_hwmod_addr_space omap44xx_spinlock_addrs[] = {
4176 {
4177 .pa_start = 0x4a0f6000,
4178 .pa_end = 0x4a0f6fff,
4179 .flags = ADDR_TYPE_RT
4180 },
4181 { }
4182};
4183
4184/* l4_cfg -> spinlock */
4185static struct omap_hwmod_ocp_if omap44xx_l4_cfg__spinlock = {
4186 .master = &omap44xx_l4_cfg_hwmod,
4187 .slave = &omap44xx_spinlock_hwmod,
4188 .clk = "l4_div_ck",
4189 .addr = omap44xx_spinlock_addrs,
4190 .user = OCP_USER_MPU | OCP_USER_SDMA,
4191};
4192
4193/* spinlock slave ports */
4194static struct omap_hwmod_ocp_if *omap44xx_spinlock_slaves[] = {
4195 &omap44xx_l4_cfg__spinlock,
4196};
4197
4198static struct omap_hwmod omap44xx_spinlock_hwmod = { 2845static struct omap_hwmod omap44xx_spinlock_hwmod = {
4199 .name = "spinlock", 2846 .name = "spinlock",
4200 .class = &omap44xx_spinlock_hwmod_class, 2847 .class = &omap44xx_spinlock_hwmod_class,
@@ -4205,8 +2852,6 @@ static struct omap_hwmod omap44xx_spinlock_hwmod = {
4205 .context_offs = OMAP4_RM_L4CFG_HW_SEM_CONTEXT_OFFSET, 2852 .context_offs = OMAP4_RM_L4CFG_HW_SEM_CONTEXT_OFFSET,
4206 }, 2853 },
4207 }, 2854 },
4208 .slaves = omap44xx_spinlock_slaves,
4209 .slaves_cnt = ARRAY_SIZE(omap44xx_spinlock_slaves),
4210}; 2855};
4211 2856
4212/* 2857/*
@@ -4258,35 +2903,11 @@ static struct omap_timer_capability_dev_attr capability_pwm_dev_attr = {
4258}; 2903};
4259 2904
4260/* timer1 */ 2905/* timer1 */
4261static struct omap_hwmod omap44xx_timer1_hwmod;
4262static struct omap_hwmod_irq_info omap44xx_timer1_irqs[] = { 2906static struct omap_hwmod_irq_info omap44xx_timer1_irqs[] = {
4263 { .irq = 37 + OMAP44XX_IRQ_GIC_START }, 2907 { .irq = 37 + OMAP44XX_IRQ_GIC_START },
4264 { .irq = -1 } 2908 { .irq = -1 }
4265}; 2909};
4266 2910
4267static struct omap_hwmod_addr_space omap44xx_timer1_addrs[] = {
4268 {
4269 .pa_start = 0x4a318000,
4270 .pa_end = 0x4a31807f,
4271 .flags = ADDR_TYPE_RT
4272 },
4273 { }
4274};
4275
4276/* l4_wkup -> timer1 */
4277static struct omap_hwmod_ocp_if omap44xx_l4_wkup__timer1 = {
4278 .master = &omap44xx_l4_wkup_hwmod,
4279 .slave = &omap44xx_timer1_hwmod,
4280 .clk = "l4_wkup_clk_mux_ck",
4281 .addr = omap44xx_timer1_addrs,
4282 .user = OCP_USER_MPU | OCP_USER_SDMA,
4283};
4284
4285/* timer1 slave ports */
4286static struct omap_hwmod_ocp_if *omap44xx_timer1_slaves[] = {
4287 &omap44xx_l4_wkup__timer1,
4288};
4289
4290static struct omap_hwmod omap44xx_timer1_hwmod = { 2911static struct omap_hwmod omap44xx_timer1_hwmod = {
4291 .name = "timer1", 2912 .name = "timer1",
4292 .class = &omap44xx_timer_1ms_hwmod_class, 2913 .class = &omap44xx_timer_1ms_hwmod_class,
@@ -4301,40 +2922,14 @@ static struct omap_hwmod omap44xx_timer1_hwmod = {
4301 }, 2922 },
4302 }, 2923 },
4303 .dev_attr = &capability_alwon_dev_attr, 2924 .dev_attr = &capability_alwon_dev_attr,
4304 .slaves = omap44xx_timer1_slaves,
4305 .slaves_cnt = ARRAY_SIZE(omap44xx_timer1_slaves),
4306}; 2925};
4307 2926
4308/* timer2 */ 2927/* timer2 */
4309static struct omap_hwmod omap44xx_timer2_hwmod;
4310static struct omap_hwmod_irq_info omap44xx_timer2_irqs[] = { 2928static struct omap_hwmod_irq_info omap44xx_timer2_irqs[] = {
4311 { .irq = 38 + OMAP44XX_IRQ_GIC_START }, 2929 { .irq = 38 + OMAP44XX_IRQ_GIC_START },
4312 { .irq = -1 } 2930 { .irq = -1 }
4313}; 2931};
4314 2932
4315static struct omap_hwmod_addr_space omap44xx_timer2_addrs[] = {
4316 {
4317 .pa_start = 0x48032000,
4318 .pa_end = 0x4803207f,
4319 .flags = ADDR_TYPE_RT
4320 },
4321 { }
4322};
4323
4324/* l4_per -> timer2 */
4325static struct omap_hwmod_ocp_if omap44xx_l4_per__timer2 = {
4326 .master = &omap44xx_l4_per_hwmod,
4327 .slave = &omap44xx_timer2_hwmod,
4328 .clk = "l4_div_ck",
4329 .addr = omap44xx_timer2_addrs,
4330 .user = OCP_USER_MPU | OCP_USER_SDMA,
4331};
4332
4333/* timer2 slave ports */
4334static struct omap_hwmod_ocp_if *omap44xx_timer2_slaves[] = {
4335 &omap44xx_l4_per__timer2,
4336};
4337
4338static struct omap_hwmod omap44xx_timer2_hwmod = { 2933static struct omap_hwmod omap44xx_timer2_hwmod = {
4339 .name = "timer2", 2934 .name = "timer2",
4340 .class = &omap44xx_timer_1ms_hwmod_class, 2935 .class = &omap44xx_timer_1ms_hwmod_class,
@@ -4349,40 +2944,14 @@ static struct omap_hwmod omap44xx_timer2_hwmod = {
4349 }, 2944 },
4350 }, 2945 },
4351 .dev_attr = &capability_alwon_dev_attr, 2946 .dev_attr = &capability_alwon_dev_attr,
4352 .slaves = omap44xx_timer2_slaves,
4353 .slaves_cnt = ARRAY_SIZE(omap44xx_timer2_slaves),
4354}; 2947};
4355 2948
4356/* timer3 */ 2949/* timer3 */
4357static struct omap_hwmod omap44xx_timer3_hwmod;
4358static struct omap_hwmod_irq_info omap44xx_timer3_irqs[] = { 2950static struct omap_hwmod_irq_info omap44xx_timer3_irqs[] = {
4359 { .irq = 39 + OMAP44XX_IRQ_GIC_START }, 2951 { .irq = 39 + OMAP44XX_IRQ_GIC_START },
4360 { .irq = -1 } 2952 { .irq = -1 }
4361}; 2953};
4362 2954
4363static struct omap_hwmod_addr_space omap44xx_timer3_addrs[] = {
4364 {
4365 .pa_start = 0x48034000,
4366 .pa_end = 0x4803407f,
4367 .flags = ADDR_TYPE_RT
4368 },
4369 { }
4370};
4371
4372/* l4_per -> timer3 */
4373static struct omap_hwmod_ocp_if omap44xx_l4_per__timer3 = {
4374 .master = &omap44xx_l4_per_hwmod,
4375 .slave = &omap44xx_timer3_hwmod,
4376 .clk = "l4_div_ck",
4377 .addr = omap44xx_timer3_addrs,
4378 .user = OCP_USER_MPU | OCP_USER_SDMA,
4379};
4380
4381/* timer3 slave ports */
4382static struct omap_hwmod_ocp_if *omap44xx_timer3_slaves[] = {
4383 &omap44xx_l4_per__timer3,
4384};
4385
4386static struct omap_hwmod omap44xx_timer3_hwmod = { 2955static struct omap_hwmod omap44xx_timer3_hwmod = {
4387 .name = "timer3", 2956 .name = "timer3",
4388 .class = &omap44xx_timer_hwmod_class, 2957 .class = &omap44xx_timer_hwmod_class,
@@ -4397,40 +2966,14 @@ static struct omap_hwmod omap44xx_timer3_hwmod = {
4397 }, 2966 },
4398 }, 2967 },
4399 .dev_attr = &capability_alwon_dev_attr, 2968 .dev_attr = &capability_alwon_dev_attr,
4400 .slaves = omap44xx_timer3_slaves,
4401 .slaves_cnt = ARRAY_SIZE(omap44xx_timer3_slaves),
4402}; 2969};
4403 2970
4404/* timer4 */ 2971/* timer4 */
4405static struct omap_hwmod omap44xx_timer4_hwmod;
4406static struct omap_hwmod_irq_info omap44xx_timer4_irqs[] = { 2972static struct omap_hwmod_irq_info omap44xx_timer4_irqs[] = {
4407 { .irq = 40 + OMAP44XX_IRQ_GIC_START }, 2973 { .irq = 40 + OMAP44XX_IRQ_GIC_START },
4408 { .irq = -1 } 2974 { .irq = -1 }
4409}; 2975};
4410 2976
4411static struct omap_hwmod_addr_space omap44xx_timer4_addrs[] = {
4412 {
4413 .pa_start = 0x48036000,
4414 .pa_end = 0x4803607f,
4415 .flags = ADDR_TYPE_RT
4416 },
4417 { }
4418};
4419
4420/* l4_per -> timer4 */
4421static struct omap_hwmod_ocp_if omap44xx_l4_per__timer4 = {
4422 .master = &omap44xx_l4_per_hwmod,
4423 .slave = &omap44xx_timer4_hwmod,
4424 .clk = "l4_div_ck",
4425 .addr = omap44xx_timer4_addrs,
4426 .user = OCP_USER_MPU | OCP_USER_SDMA,
4427};
4428
4429/* timer4 slave ports */
4430static struct omap_hwmod_ocp_if *omap44xx_timer4_slaves[] = {
4431 &omap44xx_l4_per__timer4,
4432};
4433
4434static struct omap_hwmod omap44xx_timer4_hwmod = { 2977static struct omap_hwmod omap44xx_timer4_hwmod = {
4435 .name = "timer4", 2978 .name = "timer4",
4436 .class = &omap44xx_timer_hwmod_class, 2979 .class = &omap44xx_timer_hwmod_class,
@@ -4445,59 +2988,14 @@ static struct omap_hwmod omap44xx_timer4_hwmod = {
4445 }, 2988 },
4446 }, 2989 },
4447 .dev_attr = &capability_alwon_dev_attr, 2990 .dev_attr = &capability_alwon_dev_attr,
4448 .slaves = omap44xx_timer4_slaves,
4449 .slaves_cnt = ARRAY_SIZE(omap44xx_timer4_slaves),
4450}; 2991};
4451 2992
4452/* timer5 */ 2993/* timer5 */
4453static struct omap_hwmod omap44xx_timer5_hwmod;
4454static struct omap_hwmod_irq_info omap44xx_timer5_irqs[] = { 2994static struct omap_hwmod_irq_info omap44xx_timer5_irqs[] = {
4455 { .irq = 41 + OMAP44XX_IRQ_GIC_START }, 2995 { .irq = 41 + OMAP44XX_IRQ_GIC_START },
4456 { .irq = -1 } 2996 { .irq = -1 }
4457}; 2997};
4458 2998
4459static struct omap_hwmod_addr_space omap44xx_timer5_addrs[] = {
4460 {
4461 .pa_start = 0x40138000,
4462 .pa_end = 0x4013807f,
4463 .flags = ADDR_TYPE_RT
4464 },
4465 { }
4466};
4467
4468/* l4_abe -> timer5 */
4469static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer5 = {
4470 .master = &omap44xx_l4_abe_hwmod,
4471 .slave = &omap44xx_timer5_hwmod,
4472 .clk = "ocp_abe_iclk",
4473 .addr = omap44xx_timer5_addrs,
4474 .user = OCP_USER_MPU,
4475};
4476
4477static struct omap_hwmod_addr_space omap44xx_timer5_dma_addrs[] = {
4478 {
4479 .pa_start = 0x49038000,
4480 .pa_end = 0x4903807f,
4481 .flags = ADDR_TYPE_RT
4482 },
4483 { }
4484};
4485
4486/* l4_abe -> timer5 (dma) */
4487static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer5_dma = {
4488 .master = &omap44xx_l4_abe_hwmod,
4489 .slave = &omap44xx_timer5_hwmod,
4490 .clk = "ocp_abe_iclk",
4491 .addr = omap44xx_timer5_dma_addrs,
4492 .user = OCP_USER_SDMA,
4493};
4494
4495/* timer5 slave ports */
4496static struct omap_hwmod_ocp_if *omap44xx_timer5_slaves[] = {
4497 &omap44xx_l4_abe__timer5,
4498 &omap44xx_l4_abe__timer5_dma,
4499};
4500
4501static struct omap_hwmod omap44xx_timer5_hwmod = { 2999static struct omap_hwmod omap44xx_timer5_hwmod = {
4502 .name = "timer5", 3000 .name = "timer5",
4503 .class = &omap44xx_timer_hwmod_class, 3001 .class = &omap44xx_timer_hwmod_class,
@@ -4512,59 +3010,14 @@ static struct omap_hwmod omap44xx_timer5_hwmod = {
4512 }, 3010 },
4513 }, 3011 },
4514 .dev_attr = &capability_alwon_dev_attr, 3012 .dev_attr = &capability_alwon_dev_attr,
4515 .slaves = omap44xx_timer5_slaves,
4516 .slaves_cnt = ARRAY_SIZE(omap44xx_timer5_slaves),
4517}; 3013};
4518 3014
4519/* timer6 */ 3015/* timer6 */
4520static struct omap_hwmod omap44xx_timer6_hwmod;
4521static struct omap_hwmod_irq_info omap44xx_timer6_irqs[] = { 3016static struct omap_hwmod_irq_info omap44xx_timer6_irqs[] = {
4522 { .irq = 42 + OMAP44XX_IRQ_GIC_START }, 3017 { .irq = 42 + OMAP44XX_IRQ_GIC_START },
4523 { .irq = -1 } 3018 { .irq = -1 }
4524}; 3019};
4525 3020
4526static struct omap_hwmod_addr_space omap44xx_timer6_addrs[] = {
4527 {
4528 .pa_start = 0x4013a000,
4529 .pa_end = 0x4013a07f,
4530 .flags = ADDR_TYPE_RT
4531 },
4532 { }
4533};
4534
4535/* l4_abe -> timer6 */
4536static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer6 = {
4537 .master = &omap44xx_l4_abe_hwmod,
4538 .slave = &omap44xx_timer6_hwmod,
4539 .clk = "ocp_abe_iclk",
4540 .addr = omap44xx_timer6_addrs,
4541 .user = OCP_USER_MPU,
4542};
4543
4544static struct omap_hwmod_addr_space omap44xx_timer6_dma_addrs[] = {
4545 {
4546 .pa_start = 0x4903a000,
4547 .pa_end = 0x4903a07f,
4548 .flags = ADDR_TYPE_RT
4549 },
4550 { }
4551};
4552
4553/* l4_abe -> timer6 (dma) */
4554static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer6_dma = {
4555 .master = &omap44xx_l4_abe_hwmod,
4556 .slave = &omap44xx_timer6_hwmod,
4557 .clk = "ocp_abe_iclk",
4558 .addr = omap44xx_timer6_dma_addrs,
4559 .user = OCP_USER_SDMA,
4560};
4561
4562/* timer6 slave ports */
4563static struct omap_hwmod_ocp_if *omap44xx_timer6_slaves[] = {
4564 &omap44xx_l4_abe__timer6,
4565 &omap44xx_l4_abe__timer6_dma,
4566};
4567
4568static struct omap_hwmod omap44xx_timer6_hwmod = { 3021static struct omap_hwmod omap44xx_timer6_hwmod = {
4569 .name = "timer6", 3022 .name = "timer6",
4570 .class = &omap44xx_timer_hwmod_class, 3023 .class = &omap44xx_timer_hwmod_class,
@@ -4580,59 +3033,14 @@ static struct omap_hwmod omap44xx_timer6_hwmod = {
4580 }, 3033 },
4581 }, 3034 },
4582 .dev_attr = &capability_alwon_dev_attr, 3035 .dev_attr = &capability_alwon_dev_attr,
4583 .slaves = omap44xx_timer6_slaves,
4584 .slaves_cnt = ARRAY_SIZE(omap44xx_timer6_slaves),
4585}; 3036};
4586 3037
4587/* timer7 */ 3038/* timer7 */
4588static struct omap_hwmod omap44xx_timer7_hwmod;
4589static struct omap_hwmod_irq_info omap44xx_timer7_irqs[] = { 3039static struct omap_hwmod_irq_info omap44xx_timer7_irqs[] = {
4590 { .irq = 43 + OMAP44XX_IRQ_GIC_START }, 3040 { .irq = 43 + OMAP44XX_IRQ_GIC_START },
4591 { .irq = -1 } 3041 { .irq = -1 }
4592}; 3042};
4593 3043
4594static struct omap_hwmod_addr_space omap44xx_timer7_addrs[] = {
4595 {
4596 .pa_start = 0x4013c000,
4597 .pa_end = 0x4013c07f,
4598 .flags = ADDR_TYPE_RT
4599 },
4600 { }
4601};
4602
4603/* l4_abe -> timer7 */
4604static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer7 = {
4605 .master = &omap44xx_l4_abe_hwmod,
4606 .slave = &omap44xx_timer7_hwmod,
4607 .clk = "ocp_abe_iclk",
4608 .addr = omap44xx_timer7_addrs,
4609 .user = OCP_USER_MPU,
4610};
4611
4612static struct omap_hwmod_addr_space omap44xx_timer7_dma_addrs[] = {
4613 {
4614 .pa_start = 0x4903c000,
4615 .pa_end = 0x4903c07f,
4616 .flags = ADDR_TYPE_RT
4617 },
4618 { }
4619};
4620
4621/* l4_abe -> timer7 (dma) */
4622static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer7_dma = {
4623 .master = &omap44xx_l4_abe_hwmod,
4624 .slave = &omap44xx_timer7_hwmod,
4625 .clk = "ocp_abe_iclk",
4626 .addr = omap44xx_timer7_dma_addrs,
4627 .user = OCP_USER_SDMA,
4628};
4629
4630/* timer7 slave ports */
4631static struct omap_hwmod_ocp_if *omap44xx_timer7_slaves[] = {
4632 &omap44xx_l4_abe__timer7,
4633 &omap44xx_l4_abe__timer7_dma,
4634};
4635
4636static struct omap_hwmod omap44xx_timer7_hwmod = { 3044static struct omap_hwmod omap44xx_timer7_hwmod = {
4637 .name = "timer7", 3045 .name = "timer7",
4638 .class = &omap44xx_timer_hwmod_class, 3046 .class = &omap44xx_timer_hwmod_class,
@@ -4647,59 +3055,14 @@ static struct omap_hwmod omap44xx_timer7_hwmod = {
4647 }, 3055 },
4648 }, 3056 },
4649 .dev_attr = &capability_alwon_dev_attr, 3057 .dev_attr = &capability_alwon_dev_attr,
4650 .slaves = omap44xx_timer7_slaves,
4651 .slaves_cnt = ARRAY_SIZE(omap44xx_timer7_slaves),
4652}; 3058};
4653 3059
4654/* timer8 */ 3060/* timer8 */
4655static struct omap_hwmod omap44xx_timer8_hwmod;
4656static struct omap_hwmod_irq_info omap44xx_timer8_irqs[] = { 3061static struct omap_hwmod_irq_info omap44xx_timer8_irqs[] = {
4657 { .irq = 44 + OMAP44XX_IRQ_GIC_START }, 3062 { .irq = 44 + OMAP44XX_IRQ_GIC_START },
4658 { .irq = -1 } 3063 { .irq = -1 }
4659}; 3064};
4660 3065
4661static struct omap_hwmod_addr_space omap44xx_timer8_addrs[] = {
4662 {
4663 .pa_start = 0x4013e000,
4664 .pa_end = 0x4013e07f,
4665 .flags = ADDR_TYPE_RT
4666 },
4667 { }
4668};
4669
4670/* l4_abe -> timer8 */
4671static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer8 = {
4672 .master = &omap44xx_l4_abe_hwmod,
4673 .slave = &omap44xx_timer8_hwmod,
4674 .clk = "ocp_abe_iclk",
4675 .addr = omap44xx_timer8_addrs,
4676 .user = OCP_USER_MPU,
4677};
4678
4679static struct omap_hwmod_addr_space omap44xx_timer8_dma_addrs[] = {
4680 {
4681 .pa_start = 0x4903e000,
4682 .pa_end = 0x4903e07f,
4683 .flags = ADDR_TYPE_RT
4684 },
4685 { }
4686};
4687
4688/* l4_abe -> timer8 (dma) */
4689static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer8_dma = {
4690 .master = &omap44xx_l4_abe_hwmod,
4691 .slave = &omap44xx_timer8_hwmod,
4692 .clk = "ocp_abe_iclk",
4693 .addr = omap44xx_timer8_dma_addrs,
4694 .user = OCP_USER_SDMA,
4695};
4696
4697/* timer8 slave ports */
4698static struct omap_hwmod_ocp_if *omap44xx_timer8_slaves[] = {
4699 &omap44xx_l4_abe__timer8,
4700 &omap44xx_l4_abe__timer8_dma,
4701};
4702
4703static struct omap_hwmod omap44xx_timer8_hwmod = { 3066static struct omap_hwmod omap44xx_timer8_hwmod = {
4704 .name = "timer8", 3067 .name = "timer8",
4705 .class = &omap44xx_timer_hwmod_class, 3068 .class = &omap44xx_timer_hwmod_class,
@@ -4714,40 +3077,14 @@ static struct omap_hwmod omap44xx_timer8_hwmod = {
4714 }, 3077 },
4715 }, 3078 },
4716 .dev_attr = &capability_pwm_dev_attr, 3079 .dev_attr = &capability_pwm_dev_attr,
4717 .slaves = omap44xx_timer8_slaves,
4718 .slaves_cnt = ARRAY_SIZE(omap44xx_timer8_slaves),
4719}; 3080};
4720 3081
4721/* timer9 */ 3082/* timer9 */
4722static struct omap_hwmod omap44xx_timer9_hwmod;
4723static struct omap_hwmod_irq_info omap44xx_timer9_irqs[] = { 3083static struct omap_hwmod_irq_info omap44xx_timer9_irqs[] = {
4724 { .irq = 45 + OMAP44XX_IRQ_GIC_START }, 3084 { .irq = 45 + OMAP44XX_IRQ_GIC_START },
4725 { .irq = -1 } 3085 { .irq = -1 }
4726}; 3086};
4727 3087
4728static struct omap_hwmod_addr_space omap44xx_timer9_addrs[] = {
4729 {
4730 .pa_start = 0x4803e000,
4731 .pa_end = 0x4803e07f,
4732 .flags = ADDR_TYPE_RT
4733 },
4734 { }
4735};
4736
4737/* l4_per -> timer9 */
4738static struct omap_hwmod_ocp_if omap44xx_l4_per__timer9 = {
4739 .master = &omap44xx_l4_per_hwmod,
4740 .slave = &omap44xx_timer9_hwmod,
4741 .clk = "l4_div_ck",
4742 .addr = omap44xx_timer9_addrs,
4743 .user = OCP_USER_MPU | OCP_USER_SDMA,
4744};
4745
4746/* timer9 slave ports */
4747static struct omap_hwmod_ocp_if *omap44xx_timer9_slaves[] = {
4748 &omap44xx_l4_per__timer9,
4749};
4750
4751static struct omap_hwmod omap44xx_timer9_hwmod = { 3088static struct omap_hwmod omap44xx_timer9_hwmod = {
4752 .name = "timer9", 3089 .name = "timer9",
4753 .class = &omap44xx_timer_hwmod_class, 3090 .class = &omap44xx_timer_hwmod_class,
@@ -4762,40 +3099,14 @@ static struct omap_hwmod omap44xx_timer9_hwmod = {
4762 }, 3099 },
4763 }, 3100 },
4764 .dev_attr = &capability_pwm_dev_attr, 3101 .dev_attr = &capability_pwm_dev_attr,
4765 .slaves = omap44xx_timer9_slaves,
4766 .slaves_cnt = ARRAY_SIZE(omap44xx_timer9_slaves),
4767}; 3102};
4768 3103
4769/* timer10 */ 3104/* timer10 */
4770static struct omap_hwmod omap44xx_timer10_hwmod;
4771static struct omap_hwmod_irq_info omap44xx_timer10_irqs[] = { 3105static struct omap_hwmod_irq_info omap44xx_timer10_irqs[] = {
4772 { .irq = 46 + OMAP44XX_IRQ_GIC_START }, 3106 { .irq = 46 + OMAP44XX_IRQ_GIC_START },
4773 { .irq = -1 } 3107 { .irq = -1 }
4774}; 3108};
4775 3109
4776static struct omap_hwmod_addr_space omap44xx_timer10_addrs[] = {
4777 {
4778 .pa_start = 0x48086000,
4779 .pa_end = 0x4808607f,
4780 .flags = ADDR_TYPE_RT
4781 },
4782 { }
4783};
4784
4785/* l4_per -> timer10 */
4786static struct omap_hwmod_ocp_if omap44xx_l4_per__timer10 = {
4787 .master = &omap44xx_l4_per_hwmod,
4788 .slave = &omap44xx_timer10_hwmod,
4789 .clk = "l4_div_ck",
4790 .addr = omap44xx_timer10_addrs,
4791 .user = OCP_USER_MPU | OCP_USER_SDMA,
4792};
4793
4794/* timer10 slave ports */
4795static struct omap_hwmod_ocp_if *omap44xx_timer10_slaves[] = {
4796 &omap44xx_l4_per__timer10,
4797};
4798
4799static struct omap_hwmod omap44xx_timer10_hwmod = { 3110static struct omap_hwmod omap44xx_timer10_hwmod = {
4800 .name = "timer10", 3111 .name = "timer10",
4801 .class = &omap44xx_timer_1ms_hwmod_class, 3112 .class = &omap44xx_timer_1ms_hwmod_class,
@@ -4810,40 +3121,14 @@ static struct omap_hwmod omap44xx_timer10_hwmod = {
4810 }, 3121 },
4811 }, 3122 },
4812 .dev_attr = &capability_pwm_dev_attr, 3123 .dev_attr = &capability_pwm_dev_attr,
4813 .slaves = omap44xx_timer10_slaves,
4814 .slaves_cnt = ARRAY_SIZE(omap44xx_timer10_slaves),
4815}; 3124};
4816 3125
4817/* timer11 */ 3126/* timer11 */
4818static struct omap_hwmod omap44xx_timer11_hwmod;
4819static struct omap_hwmod_irq_info omap44xx_timer11_irqs[] = { 3127static struct omap_hwmod_irq_info omap44xx_timer11_irqs[] = {
4820 { .irq = 47 + OMAP44XX_IRQ_GIC_START }, 3128 { .irq = 47 + OMAP44XX_IRQ_GIC_START },
4821 { .irq = -1 } 3129 { .irq = -1 }
4822}; 3130};
4823 3131
4824static struct omap_hwmod_addr_space omap44xx_timer11_addrs[] = {
4825 {
4826 .pa_start = 0x48088000,
4827 .pa_end = 0x4808807f,
4828 .flags = ADDR_TYPE_RT
4829 },
4830 { }
4831};
4832
4833/* l4_per -> timer11 */
4834static struct omap_hwmod_ocp_if omap44xx_l4_per__timer11 = {
4835 .master = &omap44xx_l4_per_hwmod,
4836 .slave = &omap44xx_timer11_hwmod,
4837 .clk = "l4_div_ck",
4838 .addr = omap44xx_timer11_addrs,
4839 .user = OCP_USER_MPU | OCP_USER_SDMA,
4840};
4841
4842/* timer11 slave ports */
4843static struct omap_hwmod_ocp_if *omap44xx_timer11_slaves[] = {
4844 &omap44xx_l4_per__timer11,
4845};
4846
4847static struct omap_hwmod omap44xx_timer11_hwmod = { 3132static struct omap_hwmod omap44xx_timer11_hwmod = {
4848 .name = "timer11", 3133 .name = "timer11",
4849 .class = &omap44xx_timer_hwmod_class, 3134 .class = &omap44xx_timer_hwmod_class,
@@ -4858,8 +3143,6 @@ static struct omap_hwmod omap44xx_timer11_hwmod = {
4858 }, 3143 },
4859 }, 3144 },
4860 .dev_attr = &capability_pwm_dev_attr, 3145 .dev_attr = &capability_pwm_dev_attr,
4861 .slaves = omap44xx_timer11_slaves,
4862 .slaves_cnt = ARRAY_SIZE(omap44xx_timer11_slaves),
4863}; 3146};
4864 3147
4865/* 3148/*
@@ -4885,7 +3168,6 @@ static struct omap_hwmod_class omap44xx_uart_hwmod_class = {
4885}; 3168};
4886 3169
4887/* uart1 */ 3170/* uart1 */
4888static struct omap_hwmod omap44xx_uart1_hwmod;
4889static struct omap_hwmod_irq_info omap44xx_uart1_irqs[] = { 3171static struct omap_hwmod_irq_info omap44xx_uart1_irqs[] = {
4890 { .irq = 72 + OMAP44XX_IRQ_GIC_START }, 3172 { .irq = 72 + OMAP44XX_IRQ_GIC_START },
4891 { .irq = -1 } 3173 { .irq = -1 }
@@ -4897,29 +3179,6 @@ static struct omap_hwmod_dma_info omap44xx_uart1_sdma_reqs[] = {
4897 { .dma_req = -1 } 3179 { .dma_req = -1 }
4898}; 3180};
4899 3181
4900static struct omap_hwmod_addr_space omap44xx_uart1_addrs[] = {
4901 {
4902 .pa_start = 0x4806a000,
4903 .pa_end = 0x4806a0ff,
4904 .flags = ADDR_TYPE_RT
4905 },
4906 { }
4907};
4908
4909/* l4_per -> uart1 */
4910static struct omap_hwmod_ocp_if omap44xx_l4_per__uart1 = {
4911 .master = &omap44xx_l4_per_hwmod,
4912 .slave = &omap44xx_uart1_hwmod,
4913 .clk = "l4_div_ck",
4914 .addr = omap44xx_uart1_addrs,
4915 .user = OCP_USER_MPU | OCP_USER_SDMA,
4916};
4917
4918/* uart1 slave ports */
4919static struct omap_hwmod_ocp_if *omap44xx_uart1_slaves[] = {
4920 &omap44xx_l4_per__uart1,
4921};
4922
4923static struct omap_hwmod omap44xx_uart1_hwmod = { 3182static struct omap_hwmod omap44xx_uart1_hwmod = {
4924 .name = "uart1", 3183 .name = "uart1",
4925 .class = &omap44xx_uart_hwmod_class, 3184 .class = &omap44xx_uart_hwmod_class,
@@ -4934,12 +3193,9 @@ static struct omap_hwmod omap44xx_uart1_hwmod = {
4934 .modulemode = MODULEMODE_SWCTRL, 3193 .modulemode = MODULEMODE_SWCTRL,
4935 }, 3194 },
4936 }, 3195 },
4937 .slaves = omap44xx_uart1_slaves,
4938 .slaves_cnt = ARRAY_SIZE(omap44xx_uart1_slaves),
4939}; 3196};
4940 3197
4941/* uart2 */ 3198/* uart2 */
4942static struct omap_hwmod omap44xx_uart2_hwmod;
4943static struct omap_hwmod_irq_info omap44xx_uart2_irqs[] = { 3199static struct omap_hwmod_irq_info omap44xx_uart2_irqs[] = {
4944 { .irq = 73 + OMAP44XX_IRQ_GIC_START }, 3200 { .irq = 73 + OMAP44XX_IRQ_GIC_START },
4945 { .irq = -1 } 3201 { .irq = -1 }
@@ -4951,29 +3207,6 @@ static struct omap_hwmod_dma_info omap44xx_uart2_sdma_reqs[] = {
4951 { .dma_req = -1 } 3207 { .dma_req = -1 }
4952}; 3208};
4953 3209
4954static struct omap_hwmod_addr_space omap44xx_uart2_addrs[] = {
4955 {
4956 .pa_start = 0x4806c000,
4957 .pa_end = 0x4806c0ff,
4958 .flags = ADDR_TYPE_RT
4959 },
4960 { }
4961};
4962
4963/* l4_per -> uart2 */
4964static struct omap_hwmod_ocp_if omap44xx_l4_per__uart2 = {
4965 .master = &omap44xx_l4_per_hwmod,
4966 .slave = &omap44xx_uart2_hwmod,
4967 .clk = "l4_div_ck",
4968 .addr = omap44xx_uart2_addrs,
4969 .user = OCP_USER_MPU | OCP_USER_SDMA,
4970};
4971
4972/* uart2 slave ports */
4973static struct omap_hwmod_ocp_if *omap44xx_uart2_slaves[] = {
4974 &omap44xx_l4_per__uart2,
4975};
4976
4977static struct omap_hwmod omap44xx_uart2_hwmod = { 3210static struct omap_hwmod omap44xx_uart2_hwmod = {
4978 .name = "uart2", 3211 .name = "uart2",
4979 .class = &omap44xx_uart_hwmod_class, 3212 .class = &omap44xx_uart_hwmod_class,
@@ -4988,12 +3221,9 @@ static struct omap_hwmod omap44xx_uart2_hwmod = {
4988 .modulemode = MODULEMODE_SWCTRL, 3221 .modulemode = MODULEMODE_SWCTRL,
4989 }, 3222 },
4990 }, 3223 },
4991 .slaves = omap44xx_uart2_slaves,
4992 .slaves_cnt = ARRAY_SIZE(omap44xx_uart2_slaves),
4993}; 3224};
4994 3225
4995/* uart3 */ 3226/* uart3 */
4996static struct omap_hwmod omap44xx_uart3_hwmod;
4997static struct omap_hwmod_irq_info omap44xx_uart3_irqs[] = { 3227static struct omap_hwmod_irq_info omap44xx_uart3_irqs[] = {
4998 { .irq = 74 + OMAP44XX_IRQ_GIC_START }, 3228 { .irq = 74 + OMAP44XX_IRQ_GIC_START },
4999 { .irq = -1 } 3229 { .irq = -1 }
@@ -5005,29 +3235,6 @@ static struct omap_hwmod_dma_info omap44xx_uart3_sdma_reqs[] = {
5005 { .dma_req = -1 } 3235 { .dma_req = -1 }
5006}; 3236};
5007 3237
5008static struct omap_hwmod_addr_space omap44xx_uart3_addrs[] = {
5009 {
5010 .pa_start = 0x48020000,
5011 .pa_end = 0x480200ff,
5012 .flags = ADDR_TYPE_RT
5013 },
5014 { }
5015};
5016
5017/* l4_per -> uart3 */
5018static struct omap_hwmod_ocp_if omap44xx_l4_per__uart3 = {
5019 .master = &omap44xx_l4_per_hwmod,
5020 .slave = &omap44xx_uart3_hwmod,
5021 .clk = "l4_div_ck",
5022 .addr = omap44xx_uart3_addrs,
5023 .user = OCP_USER_MPU | OCP_USER_SDMA,
5024};
5025
5026/* uart3 slave ports */
5027static struct omap_hwmod_ocp_if *omap44xx_uart3_slaves[] = {
5028 &omap44xx_l4_per__uart3,
5029};
5030
5031static struct omap_hwmod omap44xx_uart3_hwmod = { 3238static struct omap_hwmod omap44xx_uart3_hwmod = {
5032 .name = "uart3", 3239 .name = "uart3",
5033 .class = &omap44xx_uart_hwmod_class, 3240 .class = &omap44xx_uart_hwmod_class,
@@ -5043,12 +3250,9 @@ static struct omap_hwmod omap44xx_uart3_hwmod = {
5043 .modulemode = MODULEMODE_SWCTRL, 3250 .modulemode = MODULEMODE_SWCTRL,
5044 }, 3251 },
5045 }, 3252 },
5046 .slaves = omap44xx_uart3_slaves,
5047 .slaves_cnt = ARRAY_SIZE(omap44xx_uart3_slaves),
5048}; 3253};
5049 3254
5050/* uart4 */ 3255/* uart4 */
5051static struct omap_hwmod omap44xx_uart4_hwmod;
5052static struct omap_hwmod_irq_info omap44xx_uart4_irqs[] = { 3256static struct omap_hwmod_irq_info omap44xx_uart4_irqs[] = {
5053 { .irq = 70 + OMAP44XX_IRQ_GIC_START }, 3257 { .irq = 70 + OMAP44XX_IRQ_GIC_START },
5054 { .irq = -1 } 3258 { .irq = -1 }
@@ -5060,29 +3264,6 @@ static struct omap_hwmod_dma_info omap44xx_uart4_sdma_reqs[] = {
5060 { .dma_req = -1 } 3264 { .dma_req = -1 }
5061}; 3265};
5062 3266
5063static struct omap_hwmod_addr_space omap44xx_uart4_addrs[] = {
5064 {
5065 .pa_start = 0x4806e000,
5066 .pa_end = 0x4806e0ff,
5067 .flags = ADDR_TYPE_RT
5068 },
5069 { }
5070};
5071
5072/* l4_per -> uart4 */
5073static struct omap_hwmod_ocp_if omap44xx_l4_per__uart4 = {
5074 .master = &omap44xx_l4_per_hwmod,
5075 .slave = &omap44xx_uart4_hwmod,
5076 .clk = "l4_div_ck",
5077 .addr = omap44xx_uart4_addrs,
5078 .user = OCP_USER_MPU | OCP_USER_SDMA,
5079};
5080
5081/* uart4 slave ports */
5082static struct omap_hwmod_ocp_if *omap44xx_uart4_slaves[] = {
5083 &omap44xx_l4_per__uart4,
5084};
5085
5086static struct omap_hwmod omap44xx_uart4_hwmod = { 3267static struct omap_hwmod omap44xx_uart4_hwmod = {
5087 .name = "uart4", 3268 .name = "uart4",
5088 .class = &omap44xx_uart_hwmod_class, 3269 .class = &omap44xx_uart_hwmod_class,
@@ -5097,8 +3278,147 @@ static struct omap_hwmod omap44xx_uart4_hwmod = {
5097 .modulemode = MODULEMODE_SWCTRL, 3278 .modulemode = MODULEMODE_SWCTRL,
5098 }, 3279 },
5099 }, 3280 },
5100 .slaves = omap44xx_uart4_slaves, 3281};
5101 .slaves_cnt = ARRAY_SIZE(omap44xx_uart4_slaves), 3282
3283/*
3284 * 'usb_host_fs' class
3285 * full-speed usb host controller
3286 */
3287
3288/* The IP is not compliant to type1 / type2 scheme */
3289static struct omap_hwmod_sysc_fields omap_hwmod_sysc_type_usb_host_fs = {
3290 .midle_shift = 4,
3291 .sidle_shift = 2,
3292 .srst_shift = 1,
3293};
3294
3295static struct omap_hwmod_class_sysconfig omap44xx_usb_host_fs_sysc = {
3296 .rev_offs = 0x0000,
3297 .sysc_offs = 0x0210,
3298 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE |
3299 SYSC_HAS_SOFTRESET),
3300 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
3301 SIDLE_SMART_WKUP),
3302 .sysc_fields = &omap_hwmod_sysc_type_usb_host_fs,
3303};
3304
3305static struct omap_hwmod_class omap44xx_usb_host_fs_hwmod_class = {
3306 .name = "usb_host_fs",
3307 .sysc = &omap44xx_usb_host_fs_sysc,
3308};
3309
3310/* usb_host_fs */
3311static struct omap_hwmod_irq_info omap44xx_usb_host_fs_irqs[] = {
3312 { .name = "std", .irq = 89 + OMAP44XX_IRQ_GIC_START },
3313 { .name = "smi", .irq = 90 + OMAP44XX_IRQ_GIC_START },
3314 { .irq = -1 }
3315};
3316
3317static struct omap_hwmod omap44xx_usb_host_fs_hwmod = {
3318 .name = "usb_host_fs",
3319 .class = &omap44xx_usb_host_fs_hwmod_class,
3320 .clkdm_name = "l3_init_clkdm",
3321 .mpu_irqs = omap44xx_usb_host_fs_irqs,
3322 .main_clk = "usb_host_fs_fck",
3323 .prcm = {
3324 .omap4 = {
3325 .clkctrl_offs = OMAP4_CM_L3INIT_USB_HOST_FS_CLKCTRL_OFFSET,
3326 .context_offs = OMAP4_RM_L3INIT_USB_HOST_FS_CONTEXT_OFFSET,
3327 .modulemode = MODULEMODE_SWCTRL,
3328 },
3329 },
3330};
3331
3332/*
3333 * 'usb_host_hs' class
3334 * high-speed multi-port usb host controller
3335 */
3336
3337static struct omap_hwmod_class_sysconfig omap44xx_usb_host_hs_sysc = {
3338 .rev_offs = 0x0000,
3339 .sysc_offs = 0x0010,
3340 .syss_offs = 0x0014,
3341 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE |
3342 SYSC_HAS_SOFTRESET),
3343 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
3344 SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
3345 MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
3346 .sysc_fields = &omap_hwmod_sysc_type2,
3347};
3348
3349static struct omap_hwmod_class omap44xx_usb_host_hs_hwmod_class = {
3350 .name = "usb_host_hs",
3351 .sysc = &omap44xx_usb_host_hs_sysc,
3352};
3353
3354/* usb_host_hs */
3355static struct omap_hwmod_irq_info omap44xx_usb_host_hs_irqs[] = {
3356 { .name = "ohci-irq", .irq = 76 + OMAP44XX_IRQ_GIC_START },
3357 { .name = "ehci-irq", .irq = 77 + OMAP44XX_IRQ_GIC_START },
3358 { .irq = -1 }
3359};
3360
3361static struct omap_hwmod omap44xx_usb_host_hs_hwmod = {
3362 .name = "usb_host_hs",
3363 .class = &omap44xx_usb_host_hs_hwmod_class,
3364 .clkdm_name = "l3_init_clkdm",
3365 .main_clk = "usb_host_hs_fck",
3366 .prcm = {
3367 .omap4 = {
3368 .clkctrl_offs = OMAP4_CM_L3INIT_USB_HOST_CLKCTRL_OFFSET,
3369 .context_offs = OMAP4_RM_L3INIT_USB_HOST_CONTEXT_OFFSET,
3370 .modulemode = MODULEMODE_SWCTRL,
3371 },
3372 },
3373 .mpu_irqs = omap44xx_usb_host_hs_irqs,
3374
3375 /*
3376 * Errata: USBHOST Configured In Smart-Idle Can Lead To a Deadlock
3377 * id: i660
3378 *
3379 * Description:
3380 * In the following configuration :
3381 * - USBHOST module is set to smart-idle mode
3382 * - PRCM asserts idle_req to the USBHOST module ( This typically
3383 * happens when the system is going to a low power mode : all ports
3384 * have been suspended, the master part of the USBHOST module has
3385 * entered the standby state, and SW has cut the functional clocks)
3386 * - an USBHOST interrupt occurs before the module is able to answer
3387 * idle_ack, typically a remote wakeup IRQ.
3388 * Then the USB HOST module will enter a deadlock situation where it
3389 * is no more accessible nor functional.
3390 *
3391 * Workaround:
3392 * Don't use smart idle; use only force idle, hence HWMOD_SWSUP_SIDLE
3393 */
3394
3395 /*
3396 * Errata: USB host EHCI may stall when entering smart-standby mode
3397 * Id: i571
3398 *
3399 * Description:
3400 * When the USBHOST module is set to smart-standby mode, and when it is
3401 * ready to enter the standby state (i.e. all ports are suspended and
3402 * all attached devices are in suspend mode), then it can wrongly assert
3403 * the Mstandby signal too early while there are still some residual OCP
3404 * transactions ongoing. If this condition occurs, the internal state
3405 * machine may go to an undefined state and the USB link may be stuck
3406 * upon the next resume.
3407 *
3408 * Workaround:
3409 * Don't use smart standby; use only force standby,
3410 * hence HWMOD_SWSUP_MSTANDBY
3411 */
3412
3413 /*
3414 * During system boot; If the hwmod framework resets the module
3415 * the module will have smart idle settings; which can lead to deadlock
3416 * (above Errata Id:i660); so, dont reset the module during boot;
3417 * Use HWMOD_INIT_NO_RESET.
3418 */
3419
3420 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
3421 HWMOD_INIT_NO_RESET,
5102}; 3422};
5103 3423
5104/* 3424/*
@@ -5131,34 +3451,6 @@ static struct omap_hwmod_irq_info omap44xx_usb_otg_hs_irqs[] = {
5131 { .irq = -1 } 3451 { .irq = -1 }
5132}; 3452};
5133 3453
5134/* usb_otg_hs master ports */
5135static struct omap_hwmod_ocp_if *omap44xx_usb_otg_hs_masters[] = {
5136 &omap44xx_usb_otg_hs__l3_main_2,
5137};
5138
5139static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = {
5140 {
5141 .pa_start = 0x4a0ab000,
5142 .pa_end = 0x4a0ab003,
5143 .flags = ADDR_TYPE_RT
5144 },
5145 { }
5146};
5147
5148/* l4_cfg -> usb_otg_hs */
5149static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_otg_hs = {
5150 .master = &omap44xx_l4_cfg_hwmod,
5151 .slave = &omap44xx_usb_otg_hs_hwmod,
5152 .clk = "l4_div_ck",
5153 .addr = omap44xx_usb_otg_hs_addrs,
5154 .user = OCP_USER_MPU | OCP_USER_SDMA,
5155};
5156
5157/* usb_otg_hs slave ports */
5158static struct omap_hwmod_ocp_if *omap44xx_usb_otg_hs_slaves[] = {
5159 &omap44xx_l4_cfg__usb_otg_hs,
5160};
5161
5162static struct omap_hwmod_opt_clk usb_otg_hs_opt_clks[] = { 3454static struct omap_hwmod_opt_clk usb_otg_hs_opt_clks[] = {
5163 { .role = "xclk", .clk = "usb_otg_hs_xclk" }, 3455 { .role = "xclk", .clk = "usb_otg_hs_xclk" },
5164}; 3456};
@@ -5179,10 +3471,47 @@ static struct omap_hwmod omap44xx_usb_otg_hs_hwmod = {
5179 }, 3471 },
5180 .opt_clks = usb_otg_hs_opt_clks, 3472 .opt_clks = usb_otg_hs_opt_clks,
5181 .opt_clks_cnt = ARRAY_SIZE(usb_otg_hs_opt_clks), 3473 .opt_clks_cnt = ARRAY_SIZE(usb_otg_hs_opt_clks),
5182 .slaves = omap44xx_usb_otg_hs_slaves, 3474};
5183 .slaves_cnt = ARRAY_SIZE(omap44xx_usb_otg_hs_slaves), 3475
5184 .masters = omap44xx_usb_otg_hs_masters, 3476/*
5185 .masters_cnt = ARRAY_SIZE(omap44xx_usb_otg_hs_masters), 3477 * 'usb_tll_hs' class
3478 * usb_tll_hs module is the adapter on the usb_host_hs ports
3479 */
3480
3481static struct omap_hwmod_class_sysconfig omap44xx_usb_tll_hs_sysc = {
3482 .rev_offs = 0x0000,
3483 .sysc_offs = 0x0010,
3484 .syss_offs = 0x0014,
3485 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
3486 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
3487 SYSC_HAS_AUTOIDLE),
3488 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
3489 .sysc_fields = &omap_hwmod_sysc_type1,
3490};
3491
3492static struct omap_hwmod_class omap44xx_usb_tll_hs_hwmod_class = {
3493 .name = "usb_tll_hs",
3494 .sysc = &omap44xx_usb_tll_hs_sysc,
3495};
3496
3497static struct omap_hwmod_irq_info omap44xx_usb_tll_hs_irqs[] = {
3498 { .name = "tll-irq", .irq = 78 + OMAP44XX_IRQ_GIC_START },
3499 { .irq = -1 }
3500};
3501
3502static struct omap_hwmod omap44xx_usb_tll_hs_hwmod = {
3503 .name = "usb_tll_hs",
3504 .class = &omap44xx_usb_tll_hs_hwmod_class,
3505 .clkdm_name = "l3_init_clkdm",
3506 .mpu_irqs = omap44xx_usb_tll_hs_irqs,
3507 .main_clk = "usb_tll_hs_ick",
3508 .prcm = {
3509 .omap4 = {
3510 .clkctrl_offs = OMAP4_CM_L3INIT_USB_TLL_CLKCTRL_OFFSET,
3511 .context_offs = OMAP4_RM_L3INIT_USB_TLL_CONTEXT_OFFSET,
3512 .modulemode = MODULEMODE_HWCTRL,
3513 },
3514 },
5186}; 3515};
5187 3516
5188/* 3517/*
@@ -5206,38 +3535,15 @@ static struct omap_hwmod_class omap44xx_wd_timer_hwmod_class = {
5206 .name = "wd_timer", 3535 .name = "wd_timer",
5207 .sysc = &omap44xx_wd_timer_sysc, 3536 .sysc = &omap44xx_wd_timer_sysc,
5208 .pre_shutdown = &omap2_wd_timer_disable, 3537 .pre_shutdown = &omap2_wd_timer_disable,
3538 .reset = &omap2_wd_timer_reset,
5209}; 3539};
5210 3540
5211/* wd_timer2 */ 3541/* wd_timer2 */
5212static struct omap_hwmod omap44xx_wd_timer2_hwmod;
5213static struct omap_hwmod_irq_info omap44xx_wd_timer2_irqs[] = { 3542static struct omap_hwmod_irq_info omap44xx_wd_timer2_irqs[] = {
5214 { .irq = 80 + OMAP44XX_IRQ_GIC_START }, 3543 { .irq = 80 + OMAP44XX_IRQ_GIC_START },
5215 { .irq = -1 } 3544 { .irq = -1 }
5216}; 3545};
5217 3546
5218static struct omap_hwmod_addr_space omap44xx_wd_timer2_addrs[] = {
5219 {
5220 .pa_start = 0x4a314000,
5221 .pa_end = 0x4a31407f,
5222 .flags = ADDR_TYPE_RT
5223 },
5224 { }
5225};
5226
5227/* l4_wkup -> wd_timer2 */
5228static struct omap_hwmod_ocp_if omap44xx_l4_wkup__wd_timer2 = {
5229 .master = &omap44xx_l4_wkup_hwmod,
5230 .slave = &omap44xx_wd_timer2_hwmod,
5231 .clk = "l4_wkup_clk_mux_ck",
5232 .addr = omap44xx_wd_timer2_addrs,
5233 .user = OCP_USER_MPU | OCP_USER_SDMA,
5234};
5235
5236/* wd_timer2 slave ports */
5237static struct omap_hwmod_ocp_if *omap44xx_wd_timer2_slaves[] = {
5238 &omap44xx_l4_wkup__wd_timer2,
5239};
5240
5241static struct omap_hwmod omap44xx_wd_timer2_hwmod = { 3547static struct omap_hwmod omap44xx_wd_timer2_hwmod = {
5242 .name = "wd_timer2", 3548 .name = "wd_timer2",
5243 .class = &omap44xx_wd_timer_hwmod_class, 3549 .class = &omap44xx_wd_timer_hwmod_class,
@@ -5251,106 +3557,2308 @@ static struct omap_hwmod omap44xx_wd_timer2_hwmod = {
5251 .modulemode = MODULEMODE_SWCTRL, 3557 .modulemode = MODULEMODE_SWCTRL,
5252 }, 3558 },
5253 }, 3559 },
5254 .slaves = omap44xx_wd_timer2_slaves,
5255 .slaves_cnt = ARRAY_SIZE(omap44xx_wd_timer2_slaves),
5256}; 3560};
5257 3561
5258/* wd_timer3 */ 3562/* wd_timer3 */
5259static struct omap_hwmod omap44xx_wd_timer3_hwmod;
5260static struct omap_hwmod_irq_info omap44xx_wd_timer3_irqs[] = { 3563static struct omap_hwmod_irq_info omap44xx_wd_timer3_irqs[] = {
5261 { .irq = 36 + OMAP44XX_IRQ_GIC_START }, 3564 { .irq = 36 + OMAP44XX_IRQ_GIC_START },
5262 { .irq = -1 } 3565 { .irq = -1 }
5263}; 3566};
5264 3567
5265static struct omap_hwmod_addr_space omap44xx_wd_timer3_addrs[] = { 3568static struct omap_hwmod omap44xx_wd_timer3_hwmod = {
3569 .name = "wd_timer3",
3570 .class = &omap44xx_wd_timer_hwmod_class,
3571 .clkdm_name = "abe_clkdm",
3572 .mpu_irqs = omap44xx_wd_timer3_irqs,
3573 .main_clk = "wd_timer3_fck",
3574 .prcm = {
3575 .omap4 = {
3576 .clkctrl_offs = OMAP4_CM1_ABE_WDT3_CLKCTRL_OFFSET,
3577 .context_offs = OMAP4_RM_ABE_WDT3_CONTEXT_OFFSET,
3578 .modulemode = MODULEMODE_SWCTRL,
3579 },
3580 },
3581};
3582
3583
3584/*
3585 * interfaces
3586 */
3587
3588static struct omap_hwmod_addr_space omap44xx_c2c_target_fw_addrs[] = {
5266 { 3589 {
5267 .pa_start = 0x40130000, 3590 .pa_start = 0x4a204000,
5268 .pa_end = 0x4013007f, 3591 .pa_end = 0x4a2040ff,
5269 .flags = ADDR_TYPE_RT 3592 .flags = ADDR_TYPE_RT
5270 }, 3593 },
5271 { } 3594 { }
5272}; 3595};
5273 3596
5274/* l4_abe -> wd_timer3 */ 3597/* c2c -> c2c_target_fw */
5275static struct omap_hwmod_ocp_if omap44xx_l4_abe__wd_timer3 = { 3598static struct omap_hwmod_ocp_if omap44xx_c2c__c2c_target_fw = {
3599 .master = &omap44xx_c2c_hwmod,
3600 .slave = &omap44xx_c2c_target_fw_hwmod,
3601 .clk = "div_core_ck",
3602 .addr = omap44xx_c2c_target_fw_addrs,
3603 .user = OCP_USER_MPU,
3604};
3605
3606/* l4_cfg -> c2c_target_fw */
3607static struct omap_hwmod_ocp_if omap44xx_l4_cfg__c2c_target_fw = {
3608 .master = &omap44xx_l4_cfg_hwmod,
3609 .slave = &omap44xx_c2c_target_fw_hwmod,
3610 .clk = "l4_div_ck",
3611 .user = OCP_USER_MPU | OCP_USER_SDMA,
3612};
3613
3614/* l3_main_1 -> dmm */
3615static struct omap_hwmod_ocp_if omap44xx_l3_main_1__dmm = {
3616 .master = &omap44xx_l3_main_1_hwmod,
3617 .slave = &omap44xx_dmm_hwmod,
3618 .clk = "l3_div_ck",
3619 .user = OCP_USER_SDMA,
3620};
3621
3622static struct omap_hwmod_addr_space omap44xx_dmm_addrs[] = {
3623 {
3624 .pa_start = 0x4e000000,
3625 .pa_end = 0x4e0007ff,
3626 .flags = ADDR_TYPE_RT
3627 },
3628 { }
3629};
3630
3631/* mpu -> dmm */
3632static struct omap_hwmod_ocp_if omap44xx_mpu__dmm = {
3633 .master = &omap44xx_mpu_hwmod,
3634 .slave = &omap44xx_dmm_hwmod,
3635 .clk = "l3_div_ck",
3636 .addr = omap44xx_dmm_addrs,
3637 .user = OCP_USER_MPU,
3638};
3639
3640/* c2c -> emif_fw */
3641static struct omap_hwmod_ocp_if omap44xx_c2c__emif_fw = {
3642 .master = &omap44xx_c2c_hwmod,
3643 .slave = &omap44xx_emif_fw_hwmod,
3644 .clk = "div_core_ck",
3645 .user = OCP_USER_MPU | OCP_USER_SDMA,
3646};
3647
3648/* dmm -> emif_fw */
3649static struct omap_hwmod_ocp_if omap44xx_dmm__emif_fw = {
3650 .master = &omap44xx_dmm_hwmod,
3651 .slave = &omap44xx_emif_fw_hwmod,
3652 .clk = "l3_div_ck",
3653 .user = OCP_USER_MPU | OCP_USER_SDMA,
3654};
3655
3656static struct omap_hwmod_addr_space omap44xx_emif_fw_addrs[] = {
3657 {
3658 .pa_start = 0x4a20c000,
3659 .pa_end = 0x4a20c0ff,
3660 .flags = ADDR_TYPE_RT
3661 },
3662 { }
3663};
3664
3665/* l4_cfg -> emif_fw */
3666static struct omap_hwmod_ocp_if omap44xx_l4_cfg__emif_fw = {
3667 .master = &omap44xx_l4_cfg_hwmod,
3668 .slave = &omap44xx_emif_fw_hwmod,
3669 .clk = "l4_div_ck",
3670 .addr = omap44xx_emif_fw_addrs,
3671 .user = OCP_USER_MPU,
3672};
3673
3674/* iva -> l3_instr */
3675static struct omap_hwmod_ocp_if omap44xx_iva__l3_instr = {
3676 .master = &omap44xx_iva_hwmod,
3677 .slave = &omap44xx_l3_instr_hwmod,
3678 .clk = "l3_div_ck",
3679 .user = OCP_USER_MPU | OCP_USER_SDMA,
3680};
3681
3682/* l3_main_3 -> l3_instr */
3683static struct omap_hwmod_ocp_if omap44xx_l3_main_3__l3_instr = {
3684 .master = &omap44xx_l3_main_3_hwmod,
3685 .slave = &omap44xx_l3_instr_hwmod,
3686 .clk = "l3_div_ck",
3687 .user = OCP_USER_MPU | OCP_USER_SDMA,
3688};
3689
3690/* ocp_wp_noc -> l3_instr */
3691static struct omap_hwmod_ocp_if omap44xx_ocp_wp_noc__l3_instr = {
3692 .master = &omap44xx_ocp_wp_noc_hwmod,
3693 .slave = &omap44xx_l3_instr_hwmod,
3694 .clk = "l3_div_ck",
3695 .user = OCP_USER_MPU | OCP_USER_SDMA,
3696};
3697
3698/* dsp -> l3_main_1 */
3699static struct omap_hwmod_ocp_if omap44xx_dsp__l3_main_1 = {
3700 .master = &omap44xx_dsp_hwmod,
3701 .slave = &omap44xx_l3_main_1_hwmod,
3702 .clk = "l3_div_ck",
3703 .user = OCP_USER_MPU | OCP_USER_SDMA,
3704};
3705
3706/* dss -> l3_main_1 */
3707static struct omap_hwmod_ocp_if omap44xx_dss__l3_main_1 = {
3708 .master = &omap44xx_dss_hwmod,
3709 .slave = &omap44xx_l3_main_1_hwmod,
3710 .clk = "l3_div_ck",
3711 .user = OCP_USER_MPU | OCP_USER_SDMA,
3712};
3713
3714/* l3_main_2 -> l3_main_1 */
3715static struct omap_hwmod_ocp_if omap44xx_l3_main_2__l3_main_1 = {
3716 .master = &omap44xx_l3_main_2_hwmod,
3717 .slave = &omap44xx_l3_main_1_hwmod,
3718 .clk = "l3_div_ck",
3719 .user = OCP_USER_MPU | OCP_USER_SDMA,
3720};
3721
3722/* l4_cfg -> l3_main_1 */
3723static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_1 = {
3724 .master = &omap44xx_l4_cfg_hwmod,
3725 .slave = &omap44xx_l3_main_1_hwmod,
3726 .clk = "l4_div_ck",
3727 .user = OCP_USER_MPU | OCP_USER_SDMA,
3728};
3729
3730/* mmc1 -> l3_main_1 */
3731static struct omap_hwmod_ocp_if omap44xx_mmc1__l3_main_1 = {
3732 .master = &omap44xx_mmc1_hwmod,
3733 .slave = &omap44xx_l3_main_1_hwmod,
3734 .clk = "l3_div_ck",
3735 .user = OCP_USER_MPU | OCP_USER_SDMA,
3736};
3737
3738/* mmc2 -> l3_main_1 */
3739static struct omap_hwmod_ocp_if omap44xx_mmc2__l3_main_1 = {
3740 .master = &omap44xx_mmc2_hwmod,
3741 .slave = &omap44xx_l3_main_1_hwmod,
3742 .clk = "l3_div_ck",
3743 .user = OCP_USER_MPU | OCP_USER_SDMA,
3744};
3745
3746static struct omap_hwmod_addr_space omap44xx_l3_main_1_addrs[] = {
3747 {
3748 .pa_start = 0x44000000,
3749 .pa_end = 0x44000fff,
3750 .flags = ADDR_TYPE_RT
3751 },
3752 { }
3753};
3754
3755/* mpu -> l3_main_1 */
3756static struct omap_hwmod_ocp_if omap44xx_mpu__l3_main_1 = {
3757 .master = &omap44xx_mpu_hwmod,
3758 .slave = &omap44xx_l3_main_1_hwmod,
3759 .clk = "l3_div_ck",
3760 .addr = omap44xx_l3_main_1_addrs,
3761 .user = OCP_USER_MPU,
3762};
3763
3764/* c2c_target_fw -> l3_main_2 */
3765static struct omap_hwmod_ocp_if omap44xx_c2c_target_fw__l3_main_2 = {
3766 .master = &omap44xx_c2c_target_fw_hwmod,
3767 .slave = &omap44xx_l3_main_2_hwmod,
3768 .clk = "l3_div_ck",
3769 .user = OCP_USER_MPU | OCP_USER_SDMA,
3770};
3771
3772/* debugss -> l3_main_2 */
3773static struct omap_hwmod_ocp_if omap44xx_debugss__l3_main_2 = {
3774 .master = &omap44xx_debugss_hwmod,
3775 .slave = &omap44xx_l3_main_2_hwmod,
3776 .clk = "dbgclk_mux_ck",
3777 .user = OCP_USER_MPU | OCP_USER_SDMA,
3778};
3779
3780/* dma_system -> l3_main_2 */
3781static struct omap_hwmod_ocp_if omap44xx_dma_system__l3_main_2 = {
3782 .master = &omap44xx_dma_system_hwmod,
3783 .slave = &omap44xx_l3_main_2_hwmod,
3784 .clk = "l3_div_ck",
3785 .user = OCP_USER_MPU | OCP_USER_SDMA,
3786};
3787
3788/* fdif -> l3_main_2 */
3789static struct omap_hwmod_ocp_if omap44xx_fdif__l3_main_2 = {
3790 .master = &omap44xx_fdif_hwmod,
3791 .slave = &omap44xx_l3_main_2_hwmod,
3792 .clk = "l3_div_ck",
3793 .user = OCP_USER_MPU | OCP_USER_SDMA,
3794};
3795
3796/* gpu -> l3_main_2 */
3797static struct omap_hwmod_ocp_if omap44xx_gpu__l3_main_2 = {
3798 .master = &omap44xx_gpu_hwmod,
3799 .slave = &omap44xx_l3_main_2_hwmod,
3800 .clk = "l3_div_ck",
3801 .user = OCP_USER_MPU | OCP_USER_SDMA,
3802};
3803
3804/* hsi -> l3_main_2 */
3805static struct omap_hwmod_ocp_if omap44xx_hsi__l3_main_2 = {
3806 .master = &omap44xx_hsi_hwmod,
3807 .slave = &omap44xx_l3_main_2_hwmod,
3808 .clk = "l3_div_ck",
3809 .user = OCP_USER_MPU | OCP_USER_SDMA,
3810};
3811
3812/* ipu -> l3_main_2 */
3813static struct omap_hwmod_ocp_if omap44xx_ipu__l3_main_2 = {
3814 .master = &omap44xx_ipu_hwmod,
3815 .slave = &omap44xx_l3_main_2_hwmod,
3816 .clk = "l3_div_ck",
3817 .user = OCP_USER_MPU | OCP_USER_SDMA,
3818};
3819
3820/* iss -> l3_main_2 */
3821static struct omap_hwmod_ocp_if omap44xx_iss__l3_main_2 = {
3822 .master = &omap44xx_iss_hwmod,
3823 .slave = &omap44xx_l3_main_2_hwmod,
3824 .clk = "l3_div_ck",
3825 .user = OCP_USER_MPU | OCP_USER_SDMA,
3826};
3827
3828/* iva -> l3_main_2 */
3829static struct omap_hwmod_ocp_if omap44xx_iva__l3_main_2 = {
3830 .master = &omap44xx_iva_hwmod,
3831 .slave = &omap44xx_l3_main_2_hwmod,
3832 .clk = "l3_div_ck",
3833 .user = OCP_USER_MPU | OCP_USER_SDMA,
3834};
3835
3836static struct omap_hwmod_addr_space omap44xx_l3_main_2_addrs[] = {
3837 {
3838 .pa_start = 0x44800000,
3839 .pa_end = 0x44801fff,
3840 .flags = ADDR_TYPE_RT
3841 },
3842 { }
3843};
3844
3845/* l3_main_1 -> l3_main_2 */
3846static struct omap_hwmod_ocp_if omap44xx_l3_main_1__l3_main_2 = {
3847 .master = &omap44xx_l3_main_1_hwmod,
3848 .slave = &omap44xx_l3_main_2_hwmod,
3849 .clk = "l3_div_ck",
3850 .addr = omap44xx_l3_main_2_addrs,
3851 .user = OCP_USER_MPU,
3852};
3853
3854/* l4_cfg -> l3_main_2 */
3855static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_2 = {
3856 .master = &omap44xx_l4_cfg_hwmod,
3857 .slave = &omap44xx_l3_main_2_hwmod,
3858 .clk = "l4_div_ck",
3859 .user = OCP_USER_MPU | OCP_USER_SDMA,
3860};
3861
3862/* usb_host_fs -> l3_main_2 */
3863static struct omap_hwmod_ocp_if omap44xx_usb_host_fs__l3_main_2 = {
3864 .master = &omap44xx_usb_host_fs_hwmod,
3865 .slave = &omap44xx_l3_main_2_hwmod,
3866 .clk = "l3_div_ck",
3867 .user = OCP_USER_MPU | OCP_USER_SDMA,
3868};
3869
3870/* usb_host_hs -> l3_main_2 */
3871static struct omap_hwmod_ocp_if omap44xx_usb_host_hs__l3_main_2 = {
3872 .master = &omap44xx_usb_host_hs_hwmod,
3873 .slave = &omap44xx_l3_main_2_hwmod,
3874 .clk = "l3_div_ck",
3875 .user = OCP_USER_MPU | OCP_USER_SDMA,
3876};
3877
3878/* usb_otg_hs -> l3_main_2 */
3879static struct omap_hwmod_ocp_if omap44xx_usb_otg_hs__l3_main_2 = {
3880 .master = &omap44xx_usb_otg_hs_hwmod,
3881 .slave = &omap44xx_l3_main_2_hwmod,
3882 .clk = "l3_div_ck",
3883 .user = OCP_USER_MPU | OCP_USER_SDMA,
3884};
3885
3886static struct omap_hwmod_addr_space omap44xx_l3_main_3_addrs[] = {
3887 {
3888 .pa_start = 0x45000000,
3889 .pa_end = 0x45000fff,
3890 .flags = ADDR_TYPE_RT
3891 },
3892 { }
3893};
3894
3895/* l3_main_1 -> l3_main_3 */
3896static struct omap_hwmod_ocp_if omap44xx_l3_main_1__l3_main_3 = {
3897 .master = &omap44xx_l3_main_1_hwmod,
3898 .slave = &omap44xx_l3_main_3_hwmod,
3899 .clk = "l3_div_ck",
3900 .addr = omap44xx_l3_main_3_addrs,
3901 .user = OCP_USER_MPU,
3902};
3903
3904/* l3_main_2 -> l3_main_3 */
3905static struct omap_hwmod_ocp_if omap44xx_l3_main_2__l3_main_3 = {
3906 .master = &omap44xx_l3_main_2_hwmod,
3907 .slave = &omap44xx_l3_main_3_hwmod,
3908 .clk = "l3_div_ck",
3909 .user = OCP_USER_MPU | OCP_USER_SDMA,
3910};
3911
3912/* l4_cfg -> l3_main_3 */
3913static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l3_main_3 = {
3914 .master = &omap44xx_l4_cfg_hwmod,
3915 .slave = &omap44xx_l3_main_3_hwmod,
3916 .clk = "l4_div_ck",
3917 .user = OCP_USER_MPU | OCP_USER_SDMA,
3918};
3919
3920/* aess -> l4_abe */
3921static struct omap_hwmod_ocp_if omap44xx_aess__l4_abe = {
3922 .master = &omap44xx_aess_hwmod,
3923 .slave = &omap44xx_l4_abe_hwmod,
3924 .clk = "ocp_abe_iclk",
3925 .user = OCP_USER_MPU | OCP_USER_SDMA,
3926};
3927
3928/* dsp -> l4_abe */
3929static struct omap_hwmod_ocp_if omap44xx_dsp__l4_abe = {
3930 .master = &omap44xx_dsp_hwmod,
3931 .slave = &omap44xx_l4_abe_hwmod,
3932 .clk = "ocp_abe_iclk",
3933 .user = OCP_USER_MPU | OCP_USER_SDMA,
3934};
3935
3936/* l3_main_1 -> l4_abe */
3937static struct omap_hwmod_ocp_if omap44xx_l3_main_1__l4_abe = {
3938 .master = &omap44xx_l3_main_1_hwmod,
3939 .slave = &omap44xx_l4_abe_hwmod,
3940 .clk = "l3_div_ck",
3941 .user = OCP_USER_MPU | OCP_USER_SDMA,
3942};
3943
3944/* mpu -> l4_abe */
3945static struct omap_hwmod_ocp_if omap44xx_mpu__l4_abe = {
3946 .master = &omap44xx_mpu_hwmod,
3947 .slave = &omap44xx_l4_abe_hwmod,
3948 .clk = "ocp_abe_iclk",
3949 .user = OCP_USER_MPU | OCP_USER_SDMA,
3950};
3951
3952/* l3_main_1 -> l4_cfg */
3953static struct omap_hwmod_ocp_if omap44xx_l3_main_1__l4_cfg = {
3954 .master = &omap44xx_l3_main_1_hwmod,
3955 .slave = &omap44xx_l4_cfg_hwmod,
3956 .clk = "l3_div_ck",
3957 .user = OCP_USER_MPU | OCP_USER_SDMA,
3958};
3959
3960/* l3_main_2 -> l4_per */
3961static struct omap_hwmod_ocp_if omap44xx_l3_main_2__l4_per = {
3962 .master = &omap44xx_l3_main_2_hwmod,
3963 .slave = &omap44xx_l4_per_hwmod,
3964 .clk = "l3_div_ck",
3965 .user = OCP_USER_MPU | OCP_USER_SDMA,
3966};
3967
3968/* l4_cfg -> l4_wkup */
3969static struct omap_hwmod_ocp_if omap44xx_l4_cfg__l4_wkup = {
3970 .master = &omap44xx_l4_cfg_hwmod,
3971 .slave = &omap44xx_l4_wkup_hwmod,
3972 .clk = "l4_div_ck",
3973 .user = OCP_USER_MPU | OCP_USER_SDMA,
3974};
3975
3976/* mpu -> mpu_private */
3977static struct omap_hwmod_ocp_if omap44xx_mpu__mpu_private = {
3978 .master = &omap44xx_mpu_hwmod,
3979 .slave = &omap44xx_mpu_private_hwmod,
3980 .clk = "l3_div_ck",
3981 .user = OCP_USER_MPU | OCP_USER_SDMA,
3982};
3983
3984static struct omap_hwmod_addr_space omap44xx_ocp_wp_noc_addrs[] = {
3985 {
3986 .pa_start = 0x4a102000,
3987 .pa_end = 0x4a10207f,
3988 .flags = ADDR_TYPE_RT
3989 },
3990 { }
3991};
3992
3993/* l4_cfg -> ocp_wp_noc */
3994static struct omap_hwmod_ocp_if omap44xx_l4_cfg__ocp_wp_noc = {
3995 .master = &omap44xx_l4_cfg_hwmod,
3996 .slave = &omap44xx_ocp_wp_noc_hwmod,
3997 .clk = "l4_div_ck",
3998 .addr = omap44xx_ocp_wp_noc_addrs,
3999 .user = OCP_USER_MPU | OCP_USER_SDMA,
4000};
4001
4002static struct omap_hwmod_addr_space omap44xx_aess_addrs[] = {
4003 {
4004 .pa_start = 0x401f1000,
4005 .pa_end = 0x401f13ff,
4006 .flags = ADDR_TYPE_RT
4007 },
4008 { }
4009};
4010
4011/* l4_abe -> aess */
4012static struct omap_hwmod_ocp_if omap44xx_l4_abe__aess = {
5276 .master = &omap44xx_l4_abe_hwmod, 4013 .master = &omap44xx_l4_abe_hwmod,
5277 .slave = &omap44xx_wd_timer3_hwmod, 4014 .slave = &omap44xx_aess_hwmod,
5278 .clk = "ocp_abe_iclk", 4015 .clk = "ocp_abe_iclk",
5279 .addr = omap44xx_wd_timer3_addrs, 4016 .addr = omap44xx_aess_addrs,
5280 .user = OCP_USER_MPU, 4017 .user = OCP_USER_MPU,
5281}; 4018};
5282 4019
5283static struct omap_hwmod_addr_space omap44xx_wd_timer3_dma_addrs[] = { 4020static struct omap_hwmod_addr_space omap44xx_aess_dma_addrs[] = {
5284 { 4021 {
5285 .pa_start = 0x49030000, 4022 .pa_start = 0x490f1000,
5286 .pa_end = 0x4903007f, 4023 .pa_end = 0x490f13ff,
5287 .flags = ADDR_TYPE_RT 4024 .flags = ADDR_TYPE_RT
5288 }, 4025 },
5289 { } 4026 { }
5290}; 4027};
5291 4028
5292/* l4_abe -> wd_timer3 (dma) */ 4029/* l4_abe -> aess (dma) */
5293static struct omap_hwmod_ocp_if omap44xx_l4_abe__wd_timer3_dma = { 4030static struct omap_hwmod_ocp_if omap44xx_l4_abe__aess_dma = {
5294 .master = &omap44xx_l4_abe_hwmod, 4031 .master = &omap44xx_l4_abe_hwmod,
5295 .slave = &omap44xx_wd_timer3_hwmod, 4032 .slave = &omap44xx_aess_hwmod,
5296 .clk = "ocp_abe_iclk", 4033 .clk = "ocp_abe_iclk",
5297 .addr = omap44xx_wd_timer3_dma_addrs, 4034 .addr = omap44xx_aess_dma_addrs,
5298 .user = OCP_USER_SDMA, 4035 .user = OCP_USER_SDMA,
5299}; 4036};
5300 4037
5301/* wd_timer3 slave ports */ 4038/* l3_main_2 -> c2c */
5302static struct omap_hwmod_ocp_if *omap44xx_wd_timer3_slaves[] = { 4039static struct omap_hwmod_ocp_if omap44xx_l3_main_2__c2c = {
5303 &omap44xx_l4_abe__wd_timer3, 4040 .master = &omap44xx_l3_main_2_hwmod,
5304 &omap44xx_l4_abe__wd_timer3_dma, 4041 .slave = &omap44xx_c2c_hwmod,
4042 .clk = "l3_div_ck",
4043 .user = OCP_USER_MPU | OCP_USER_SDMA,
5305}; 4044};
5306 4045
5307static struct omap_hwmod omap44xx_wd_timer3_hwmod = { 4046static struct omap_hwmod_addr_space omap44xx_counter_32k_addrs[] = {
5308 .name = "wd_timer3", 4047 {
5309 .class = &omap44xx_wd_timer_hwmod_class, 4048 .pa_start = 0x4a304000,
5310 .clkdm_name = "abe_clkdm", 4049 .pa_end = 0x4a30401f,
5311 .mpu_irqs = omap44xx_wd_timer3_irqs, 4050 .flags = ADDR_TYPE_RT
5312 .main_clk = "wd_timer3_fck",
5313 .prcm = {
5314 .omap4 = {
5315 .clkctrl_offs = OMAP4_CM1_ABE_WDT3_CLKCTRL_OFFSET,
5316 .context_offs = OMAP4_RM_ABE_WDT3_CONTEXT_OFFSET,
5317 .modulemode = MODULEMODE_SWCTRL,
5318 },
5319 }, 4051 },
5320 .slaves = omap44xx_wd_timer3_slaves, 4052 { }
5321 .slaves_cnt = ARRAY_SIZE(omap44xx_wd_timer3_slaves),
5322}; 4053};
5323 4054
5324/* 4055/* l4_wkup -> counter_32k */
5325 * 'usb_host_hs' class 4056static struct omap_hwmod_ocp_if omap44xx_l4_wkup__counter_32k = {
5326 * high-speed multi-port usb host controller 4057 .master = &omap44xx_l4_wkup_hwmod,
5327 */ 4058 .slave = &omap44xx_counter_32k_hwmod,
5328static struct omap_hwmod_ocp_if omap44xx_usb_host_hs__l3_main_2 = { 4059 .clk = "l4_wkup_clk_mux_ck",
5329 .master = &omap44xx_usb_host_hs_hwmod, 4060 .addr = omap44xx_counter_32k_addrs,
5330 .slave = &omap44xx_l3_main_2_hwmod, 4061 .user = OCP_USER_MPU | OCP_USER_SDMA,
4062};
4063
4064static struct omap_hwmod_addr_space omap44xx_ctrl_module_core_addrs[] = {
4065 {
4066 .pa_start = 0x4a002000,
4067 .pa_end = 0x4a0027ff,
4068 .flags = ADDR_TYPE_RT
4069 },
4070 { }
4071};
4072
4073/* l4_cfg -> ctrl_module_core */
4074static struct omap_hwmod_ocp_if omap44xx_l4_cfg__ctrl_module_core = {
4075 .master = &omap44xx_l4_cfg_hwmod,
4076 .slave = &omap44xx_ctrl_module_core_hwmod,
4077 .clk = "l4_div_ck",
4078 .addr = omap44xx_ctrl_module_core_addrs,
4079 .user = OCP_USER_MPU | OCP_USER_SDMA,
4080};
4081
4082static struct omap_hwmod_addr_space omap44xx_ctrl_module_pad_core_addrs[] = {
4083 {
4084 .pa_start = 0x4a100000,
4085 .pa_end = 0x4a1007ff,
4086 .flags = ADDR_TYPE_RT
4087 },
4088 { }
4089};
4090
4091/* l4_cfg -> ctrl_module_pad_core */
4092static struct omap_hwmod_ocp_if omap44xx_l4_cfg__ctrl_module_pad_core = {
4093 .master = &omap44xx_l4_cfg_hwmod,
4094 .slave = &omap44xx_ctrl_module_pad_core_hwmod,
4095 .clk = "l4_div_ck",
4096 .addr = omap44xx_ctrl_module_pad_core_addrs,
4097 .user = OCP_USER_MPU | OCP_USER_SDMA,
4098};
4099
4100static struct omap_hwmod_addr_space omap44xx_ctrl_module_wkup_addrs[] = {
4101 {
4102 .pa_start = 0x4a30c000,
4103 .pa_end = 0x4a30c7ff,
4104 .flags = ADDR_TYPE_RT
4105 },
4106 { }
4107};
4108
4109/* l4_wkup -> ctrl_module_wkup */
4110static struct omap_hwmod_ocp_if omap44xx_l4_wkup__ctrl_module_wkup = {
4111 .master = &omap44xx_l4_wkup_hwmod,
4112 .slave = &omap44xx_ctrl_module_wkup_hwmod,
4113 .clk = "l4_wkup_clk_mux_ck",
4114 .addr = omap44xx_ctrl_module_wkup_addrs,
4115 .user = OCP_USER_MPU | OCP_USER_SDMA,
4116};
4117
4118static struct omap_hwmod_addr_space omap44xx_ctrl_module_pad_wkup_addrs[] = {
4119 {
4120 .pa_start = 0x4a31e000,
4121 .pa_end = 0x4a31e7ff,
4122 .flags = ADDR_TYPE_RT
4123 },
4124 { }
4125};
4126
4127/* l4_wkup -> ctrl_module_pad_wkup */
4128static struct omap_hwmod_ocp_if omap44xx_l4_wkup__ctrl_module_pad_wkup = {
4129 .master = &omap44xx_l4_wkup_hwmod,
4130 .slave = &omap44xx_ctrl_module_pad_wkup_hwmod,
4131 .clk = "l4_wkup_clk_mux_ck",
4132 .addr = omap44xx_ctrl_module_pad_wkup_addrs,
4133 .user = OCP_USER_MPU | OCP_USER_SDMA,
4134};
4135
4136static struct omap_hwmod_addr_space omap44xx_debugss_addrs[] = {
4137 {
4138 .pa_start = 0x54160000,
4139 .pa_end = 0x54167fff,
4140 .flags = ADDR_TYPE_RT
4141 },
4142 { }
4143};
4144
4145/* l3_instr -> debugss */
4146static struct omap_hwmod_ocp_if omap44xx_l3_instr__debugss = {
4147 .master = &omap44xx_l3_instr_hwmod,
4148 .slave = &omap44xx_debugss_hwmod,
5331 .clk = "l3_div_ck", 4149 .clk = "l3_div_ck",
4150 .addr = omap44xx_debugss_addrs,
5332 .user = OCP_USER_MPU | OCP_USER_SDMA, 4151 .user = OCP_USER_MPU | OCP_USER_SDMA,
5333}; 4152};
5334 4153
5335static struct omap_hwmod_class_sysconfig omap44xx_usb_host_hs_sysc = { 4154static struct omap_hwmod_addr_space omap44xx_dma_system_addrs[] = {
5336 .rev_offs = 0x0000, 4155 {
5337 .sysc_offs = 0x0010, 4156 .pa_start = 0x4a056000,
5338 .syss_offs = 0x0014, 4157 .pa_end = 0x4a056fff,
5339 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE | 4158 .flags = ADDR_TYPE_RT
5340 SYSC_HAS_SOFTRESET), 4159 },
5341 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 4160 { }
5342 SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
5343 MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
5344 .sysc_fields = &omap_hwmod_sysc_type2,
5345}; 4161};
5346 4162
5347static struct omap_hwmod_class omap44xx_usb_host_hs_hwmod_class = { 4163/* l4_cfg -> dma_system */
5348 .name = "usb_host_hs", 4164static struct omap_hwmod_ocp_if omap44xx_l4_cfg__dma_system = {
5349 .sysc = &omap44xx_usb_host_hs_sysc, 4165 .master = &omap44xx_l4_cfg_hwmod,
4166 .slave = &omap44xx_dma_system_hwmod,
4167 .clk = "l4_div_ck",
4168 .addr = omap44xx_dma_system_addrs,
4169 .user = OCP_USER_MPU | OCP_USER_SDMA,
5350}; 4170};
5351 4171
5352static struct omap_hwmod_ocp_if *omap44xx_usb_host_hs_masters[] = { 4172static struct omap_hwmod_addr_space omap44xx_dmic_addrs[] = {
5353 &omap44xx_usb_host_hs__l3_main_2, 4173 {
4174 .name = "mpu",
4175 .pa_start = 0x4012e000,
4176 .pa_end = 0x4012e07f,
4177 .flags = ADDR_TYPE_RT
4178 },
4179 { }
4180};
4181
4182/* l4_abe -> dmic */
4183static struct omap_hwmod_ocp_if omap44xx_l4_abe__dmic = {
4184 .master = &omap44xx_l4_abe_hwmod,
4185 .slave = &omap44xx_dmic_hwmod,
4186 .clk = "ocp_abe_iclk",
4187 .addr = omap44xx_dmic_addrs,
4188 .user = OCP_USER_MPU,
4189};
4190
4191static struct omap_hwmod_addr_space omap44xx_dmic_dma_addrs[] = {
4192 {
4193 .name = "dma",
4194 .pa_start = 0x4902e000,
4195 .pa_end = 0x4902e07f,
4196 .flags = ADDR_TYPE_RT
4197 },
4198 { }
4199};
4200
4201/* l4_abe -> dmic (dma) */
4202static struct omap_hwmod_ocp_if omap44xx_l4_abe__dmic_dma = {
4203 .master = &omap44xx_l4_abe_hwmod,
4204 .slave = &omap44xx_dmic_hwmod,
4205 .clk = "ocp_abe_iclk",
4206 .addr = omap44xx_dmic_dma_addrs,
4207 .user = OCP_USER_SDMA,
4208};
4209
4210/* dsp -> iva */
4211static struct omap_hwmod_ocp_if omap44xx_dsp__iva = {
4212 .master = &omap44xx_dsp_hwmod,
4213 .slave = &omap44xx_iva_hwmod,
4214 .clk = "dpll_iva_m5x2_ck",
4215 .user = OCP_USER_DSP,
4216};
4217
4218/* dsp -> sl2if */
4219static struct omap_hwmod_ocp_if omap44xx_dsp__sl2if = {
4220 .master = &omap44xx_dsp_hwmod,
4221 .slave = &omap44xx_sl2if_hwmod,
4222 .clk = "dpll_iva_m5x2_ck",
4223 .user = OCP_USER_DSP,
4224};
4225
4226/* l4_cfg -> dsp */
4227static struct omap_hwmod_ocp_if omap44xx_l4_cfg__dsp = {
4228 .master = &omap44xx_l4_cfg_hwmod,
4229 .slave = &omap44xx_dsp_hwmod,
4230 .clk = "l4_div_ck",
4231 .user = OCP_USER_MPU | OCP_USER_SDMA,
4232};
4233
4234static struct omap_hwmod_addr_space omap44xx_dss_dma_addrs[] = {
4235 {
4236 .pa_start = 0x58000000,
4237 .pa_end = 0x5800007f,
4238 .flags = ADDR_TYPE_RT
4239 },
4240 { }
4241};
4242
4243/* l3_main_2 -> dss */
4244static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss = {
4245 .master = &omap44xx_l3_main_2_hwmod,
4246 .slave = &omap44xx_dss_hwmod,
4247 .clk = "dss_fck",
4248 .addr = omap44xx_dss_dma_addrs,
4249 .user = OCP_USER_SDMA,
4250};
4251
4252static struct omap_hwmod_addr_space omap44xx_dss_addrs[] = {
4253 {
4254 .pa_start = 0x48040000,
4255 .pa_end = 0x4804007f,
4256 .flags = ADDR_TYPE_RT
4257 },
4258 { }
4259};
4260
4261/* l4_per -> dss */
4262static struct omap_hwmod_ocp_if omap44xx_l4_per__dss = {
4263 .master = &omap44xx_l4_per_hwmod,
4264 .slave = &omap44xx_dss_hwmod,
4265 .clk = "l4_div_ck",
4266 .addr = omap44xx_dss_addrs,
4267 .user = OCP_USER_MPU,
4268};
4269
4270static struct omap_hwmod_addr_space omap44xx_dss_dispc_dma_addrs[] = {
4271 {
4272 .pa_start = 0x58001000,
4273 .pa_end = 0x58001fff,
4274 .flags = ADDR_TYPE_RT
4275 },
4276 { }
4277};
4278
4279/* l3_main_2 -> dss_dispc */
4280static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dispc = {
4281 .master = &omap44xx_l3_main_2_hwmod,
4282 .slave = &omap44xx_dss_dispc_hwmod,
4283 .clk = "dss_fck",
4284 .addr = omap44xx_dss_dispc_dma_addrs,
4285 .user = OCP_USER_SDMA,
4286};
4287
4288static struct omap_hwmod_addr_space omap44xx_dss_dispc_addrs[] = {
4289 {
4290 .pa_start = 0x48041000,
4291 .pa_end = 0x48041fff,
4292 .flags = ADDR_TYPE_RT
4293 },
4294 { }
4295};
4296
4297/* l4_per -> dss_dispc */
4298static struct omap_hwmod_ocp_if omap44xx_l4_per__dss_dispc = {
4299 .master = &omap44xx_l4_per_hwmod,
4300 .slave = &omap44xx_dss_dispc_hwmod,
4301 .clk = "l4_div_ck",
4302 .addr = omap44xx_dss_dispc_addrs,
4303 .user = OCP_USER_MPU,
4304};
4305
4306static struct omap_hwmod_addr_space omap44xx_dss_dsi1_dma_addrs[] = {
4307 {
4308 .pa_start = 0x58004000,
4309 .pa_end = 0x580041ff,
4310 .flags = ADDR_TYPE_RT
4311 },
4312 { }
4313};
4314
4315/* l3_main_2 -> dss_dsi1 */
4316static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dsi1 = {
4317 .master = &omap44xx_l3_main_2_hwmod,
4318 .slave = &omap44xx_dss_dsi1_hwmod,
4319 .clk = "dss_fck",
4320 .addr = omap44xx_dss_dsi1_dma_addrs,
4321 .user = OCP_USER_SDMA,
4322};
4323
4324static struct omap_hwmod_addr_space omap44xx_dss_dsi1_addrs[] = {
4325 {
4326 .pa_start = 0x48044000,
4327 .pa_end = 0x480441ff,
4328 .flags = ADDR_TYPE_RT
4329 },
4330 { }
4331};
4332
4333/* l4_per -> dss_dsi1 */
4334static struct omap_hwmod_ocp_if omap44xx_l4_per__dss_dsi1 = {
4335 .master = &omap44xx_l4_per_hwmod,
4336 .slave = &omap44xx_dss_dsi1_hwmod,
4337 .clk = "l4_div_ck",
4338 .addr = omap44xx_dss_dsi1_addrs,
4339 .user = OCP_USER_MPU,
4340};
4341
4342static struct omap_hwmod_addr_space omap44xx_dss_dsi2_dma_addrs[] = {
4343 {
4344 .pa_start = 0x58005000,
4345 .pa_end = 0x580051ff,
4346 .flags = ADDR_TYPE_RT
4347 },
4348 { }
4349};
4350
4351/* l3_main_2 -> dss_dsi2 */
4352static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dsi2 = {
4353 .master = &omap44xx_l3_main_2_hwmod,
4354 .slave = &omap44xx_dss_dsi2_hwmod,
4355 .clk = "dss_fck",
4356 .addr = omap44xx_dss_dsi2_dma_addrs,
4357 .user = OCP_USER_SDMA,
4358};
4359
4360static struct omap_hwmod_addr_space omap44xx_dss_dsi2_addrs[] = {
4361 {
4362 .pa_start = 0x48045000,
4363 .pa_end = 0x480451ff,
4364 .flags = ADDR_TYPE_RT
4365 },
4366 { }
4367};
4368
4369/* l4_per -> dss_dsi2 */
4370static struct omap_hwmod_ocp_if omap44xx_l4_per__dss_dsi2 = {
4371 .master = &omap44xx_l4_per_hwmod,
4372 .slave = &omap44xx_dss_dsi2_hwmod,
4373 .clk = "l4_div_ck",
4374 .addr = omap44xx_dss_dsi2_addrs,
4375 .user = OCP_USER_MPU,
4376};
4377
4378static struct omap_hwmod_addr_space omap44xx_dss_hdmi_dma_addrs[] = {
4379 {
4380 .pa_start = 0x58006000,
4381 .pa_end = 0x58006fff,
4382 .flags = ADDR_TYPE_RT
4383 },
4384 { }
4385};
4386
4387/* l3_main_2 -> dss_hdmi */
4388static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_hdmi = {
4389 .master = &omap44xx_l3_main_2_hwmod,
4390 .slave = &omap44xx_dss_hdmi_hwmod,
4391 .clk = "dss_fck",
4392 .addr = omap44xx_dss_hdmi_dma_addrs,
4393 .user = OCP_USER_SDMA,
4394};
4395
4396static struct omap_hwmod_addr_space omap44xx_dss_hdmi_addrs[] = {
4397 {
4398 .pa_start = 0x48046000,
4399 .pa_end = 0x48046fff,
4400 .flags = ADDR_TYPE_RT
4401 },
4402 { }
4403};
4404
4405/* l4_per -> dss_hdmi */
4406static struct omap_hwmod_ocp_if omap44xx_l4_per__dss_hdmi = {
4407 .master = &omap44xx_l4_per_hwmod,
4408 .slave = &omap44xx_dss_hdmi_hwmod,
4409 .clk = "l4_div_ck",
4410 .addr = omap44xx_dss_hdmi_addrs,
4411 .user = OCP_USER_MPU,
4412};
4413
4414static struct omap_hwmod_addr_space omap44xx_dss_rfbi_dma_addrs[] = {
4415 {
4416 .pa_start = 0x58002000,
4417 .pa_end = 0x580020ff,
4418 .flags = ADDR_TYPE_RT
4419 },
4420 { }
4421};
4422
4423/* l3_main_2 -> dss_rfbi */
4424static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_rfbi = {
4425 .master = &omap44xx_l3_main_2_hwmod,
4426 .slave = &omap44xx_dss_rfbi_hwmod,
4427 .clk = "dss_fck",
4428 .addr = omap44xx_dss_rfbi_dma_addrs,
4429 .user = OCP_USER_SDMA,
4430};
4431
4432static struct omap_hwmod_addr_space omap44xx_dss_rfbi_addrs[] = {
4433 {
4434 .pa_start = 0x48042000,
4435 .pa_end = 0x480420ff,
4436 .flags = ADDR_TYPE_RT
4437 },
4438 { }
4439};
4440
4441/* l4_per -> dss_rfbi */
4442static struct omap_hwmod_ocp_if omap44xx_l4_per__dss_rfbi = {
4443 .master = &omap44xx_l4_per_hwmod,
4444 .slave = &omap44xx_dss_rfbi_hwmod,
4445 .clk = "l4_div_ck",
4446 .addr = omap44xx_dss_rfbi_addrs,
4447 .user = OCP_USER_MPU,
4448};
4449
4450static struct omap_hwmod_addr_space omap44xx_dss_venc_dma_addrs[] = {
4451 {
4452 .pa_start = 0x58003000,
4453 .pa_end = 0x580030ff,
4454 .flags = ADDR_TYPE_RT
4455 },
4456 { }
4457};
4458
4459/* l3_main_2 -> dss_venc */
4460static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_venc = {
4461 .master = &omap44xx_l3_main_2_hwmod,
4462 .slave = &omap44xx_dss_venc_hwmod,
4463 .clk = "dss_fck",
4464 .addr = omap44xx_dss_venc_dma_addrs,
4465 .user = OCP_USER_SDMA,
4466};
4467
4468static struct omap_hwmod_addr_space omap44xx_dss_venc_addrs[] = {
4469 {
4470 .pa_start = 0x48043000,
4471 .pa_end = 0x480430ff,
4472 .flags = ADDR_TYPE_RT
4473 },
4474 { }
4475};
4476
4477/* l4_per -> dss_venc */
4478static struct omap_hwmod_ocp_if omap44xx_l4_per__dss_venc = {
4479 .master = &omap44xx_l4_per_hwmod,
4480 .slave = &omap44xx_dss_venc_hwmod,
4481 .clk = "l4_div_ck",
4482 .addr = omap44xx_dss_venc_addrs,
4483 .user = OCP_USER_MPU,
4484};
4485
4486static struct omap_hwmod_addr_space omap44xx_elm_addrs[] = {
4487 {
4488 .pa_start = 0x48078000,
4489 .pa_end = 0x48078fff,
4490 .flags = ADDR_TYPE_RT
4491 },
4492 { }
4493};
4494
4495/* l4_per -> elm */
4496static struct omap_hwmod_ocp_if omap44xx_l4_per__elm = {
4497 .master = &omap44xx_l4_per_hwmod,
4498 .slave = &omap44xx_elm_hwmod,
4499 .clk = "l4_div_ck",
4500 .addr = omap44xx_elm_addrs,
4501 .user = OCP_USER_MPU | OCP_USER_SDMA,
4502};
4503
4504static struct omap_hwmod_addr_space omap44xx_emif1_addrs[] = {
4505 {
4506 .pa_start = 0x4c000000,
4507 .pa_end = 0x4c0000ff,
4508 .flags = ADDR_TYPE_RT
4509 },
4510 { }
4511};
4512
4513/* emif_fw -> emif1 */
4514static struct omap_hwmod_ocp_if omap44xx_emif_fw__emif1 = {
4515 .master = &omap44xx_emif_fw_hwmod,
4516 .slave = &omap44xx_emif1_hwmod,
4517 .clk = "l3_div_ck",
4518 .addr = omap44xx_emif1_addrs,
4519 .user = OCP_USER_MPU | OCP_USER_SDMA,
4520};
4521
4522static struct omap_hwmod_addr_space omap44xx_emif2_addrs[] = {
4523 {
4524 .pa_start = 0x4d000000,
4525 .pa_end = 0x4d0000ff,
4526 .flags = ADDR_TYPE_RT
4527 },
4528 { }
4529};
4530
4531/* emif_fw -> emif2 */
4532static struct omap_hwmod_ocp_if omap44xx_emif_fw__emif2 = {
4533 .master = &omap44xx_emif_fw_hwmod,
4534 .slave = &omap44xx_emif2_hwmod,
4535 .clk = "l3_div_ck",
4536 .addr = omap44xx_emif2_addrs,
4537 .user = OCP_USER_MPU | OCP_USER_SDMA,
4538};
4539
4540static struct omap_hwmod_addr_space omap44xx_fdif_addrs[] = {
4541 {
4542 .pa_start = 0x4a10a000,
4543 .pa_end = 0x4a10a1ff,
4544 .flags = ADDR_TYPE_RT
4545 },
4546 { }
4547};
4548
4549/* l4_cfg -> fdif */
4550static struct omap_hwmod_ocp_if omap44xx_l4_cfg__fdif = {
4551 .master = &omap44xx_l4_cfg_hwmod,
4552 .slave = &omap44xx_fdif_hwmod,
4553 .clk = "l4_div_ck",
4554 .addr = omap44xx_fdif_addrs,
4555 .user = OCP_USER_MPU | OCP_USER_SDMA,
4556};
4557
4558static struct omap_hwmod_addr_space omap44xx_gpio1_addrs[] = {
4559 {
4560 .pa_start = 0x4a310000,
4561 .pa_end = 0x4a3101ff,
4562 .flags = ADDR_TYPE_RT
4563 },
4564 { }
4565};
4566
4567/* l4_wkup -> gpio1 */
4568static struct omap_hwmod_ocp_if omap44xx_l4_wkup__gpio1 = {
4569 .master = &omap44xx_l4_wkup_hwmod,
4570 .slave = &omap44xx_gpio1_hwmod,
4571 .clk = "l4_wkup_clk_mux_ck",
4572 .addr = omap44xx_gpio1_addrs,
4573 .user = OCP_USER_MPU | OCP_USER_SDMA,
4574};
4575
4576static struct omap_hwmod_addr_space omap44xx_gpio2_addrs[] = {
4577 {
4578 .pa_start = 0x48055000,
4579 .pa_end = 0x480551ff,
4580 .flags = ADDR_TYPE_RT
4581 },
4582 { }
4583};
4584
4585/* l4_per -> gpio2 */
4586static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio2 = {
4587 .master = &omap44xx_l4_per_hwmod,
4588 .slave = &omap44xx_gpio2_hwmod,
4589 .clk = "l4_div_ck",
4590 .addr = omap44xx_gpio2_addrs,
4591 .user = OCP_USER_MPU | OCP_USER_SDMA,
4592};
4593
4594static struct omap_hwmod_addr_space omap44xx_gpio3_addrs[] = {
4595 {
4596 .pa_start = 0x48057000,
4597 .pa_end = 0x480571ff,
4598 .flags = ADDR_TYPE_RT
4599 },
4600 { }
4601};
4602
4603/* l4_per -> gpio3 */
4604static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio3 = {
4605 .master = &omap44xx_l4_per_hwmod,
4606 .slave = &omap44xx_gpio3_hwmod,
4607 .clk = "l4_div_ck",
4608 .addr = omap44xx_gpio3_addrs,
4609 .user = OCP_USER_MPU | OCP_USER_SDMA,
4610};
4611
4612static struct omap_hwmod_addr_space omap44xx_gpio4_addrs[] = {
4613 {
4614 .pa_start = 0x48059000,
4615 .pa_end = 0x480591ff,
4616 .flags = ADDR_TYPE_RT
4617 },
4618 { }
4619};
4620
4621/* l4_per -> gpio4 */
4622static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio4 = {
4623 .master = &omap44xx_l4_per_hwmod,
4624 .slave = &omap44xx_gpio4_hwmod,
4625 .clk = "l4_div_ck",
4626 .addr = omap44xx_gpio4_addrs,
4627 .user = OCP_USER_MPU | OCP_USER_SDMA,
4628};
4629
4630static struct omap_hwmod_addr_space omap44xx_gpio5_addrs[] = {
4631 {
4632 .pa_start = 0x4805b000,
4633 .pa_end = 0x4805b1ff,
4634 .flags = ADDR_TYPE_RT
4635 },
4636 { }
4637};
4638
4639/* l4_per -> gpio5 */
4640static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio5 = {
4641 .master = &omap44xx_l4_per_hwmod,
4642 .slave = &omap44xx_gpio5_hwmod,
4643 .clk = "l4_div_ck",
4644 .addr = omap44xx_gpio5_addrs,
4645 .user = OCP_USER_MPU | OCP_USER_SDMA,
4646};
4647
4648static struct omap_hwmod_addr_space omap44xx_gpio6_addrs[] = {
4649 {
4650 .pa_start = 0x4805d000,
4651 .pa_end = 0x4805d1ff,
4652 .flags = ADDR_TYPE_RT
4653 },
4654 { }
4655};
4656
4657/* l4_per -> gpio6 */
4658static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio6 = {
4659 .master = &omap44xx_l4_per_hwmod,
4660 .slave = &omap44xx_gpio6_hwmod,
4661 .clk = "l4_div_ck",
4662 .addr = omap44xx_gpio6_addrs,
4663 .user = OCP_USER_MPU | OCP_USER_SDMA,
4664};
4665
4666static struct omap_hwmod_addr_space omap44xx_gpmc_addrs[] = {
4667 {
4668 .pa_start = 0x50000000,
4669 .pa_end = 0x500003ff,
4670 .flags = ADDR_TYPE_RT
4671 },
4672 { }
4673};
4674
4675/* l3_main_2 -> gpmc */
4676static struct omap_hwmod_ocp_if omap44xx_l3_main_2__gpmc = {
4677 .master = &omap44xx_l3_main_2_hwmod,
4678 .slave = &omap44xx_gpmc_hwmod,
4679 .clk = "l3_div_ck",
4680 .addr = omap44xx_gpmc_addrs,
4681 .user = OCP_USER_MPU | OCP_USER_SDMA,
4682};
4683
4684static struct omap_hwmod_addr_space omap44xx_gpu_addrs[] = {
4685 {
4686 .pa_start = 0x56000000,
4687 .pa_end = 0x5600ffff,
4688 .flags = ADDR_TYPE_RT
4689 },
4690 { }
4691};
4692
4693/* l3_main_2 -> gpu */
4694static struct omap_hwmod_ocp_if omap44xx_l3_main_2__gpu = {
4695 .master = &omap44xx_l3_main_2_hwmod,
4696 .slave = &omap44xx_gpu_hwmod,
4697 .clk = "l3_div_ck",
4698 .addr = omap44xx_gpu_addrs,
4699 .user = OCP_USER_MPU | OCP_USER_SDMA,
4700};
4701
4702static struct omap_hwmod_addr_space omap44xx_hdq1w_addrs[] = {
4703 {
4704 .pa_start = 0x480b2000,
4705 .pa_end = 0x480b201f,
4706 .flags = ADDR_TYPE_RT
4707 },
4708 { }
4709};
4710
4711/* l4_per -> hdq1w */
4712static struct omap_hwmod_ocp_if omap44xx_l4_per__hdq1w = {
4713 .master = &omap44xx_l4_per_hwmod,
4714 .slave = &omap44xx_hdq1w_hwmod,
4715 .clk = "l4_div_ck",
4716 .addr = omap44xx_hdq1w_addrs,
4717 .user = OCP_USER_MPU | OCP_USER_SDMA,
4718};
4719
4720static struct omap_hwmod_addr_space omap44xx_hsi_addrs[] = {
4721 {
4722 .pa_start = 0x4a058000,
4723 .pa_end = 0x4a05bfff,
4724 .flags = ADDR_TYPE_RT
4725 },
4726 { }
4727};
4728
4729/* l4_cfg -> hsi */
4730static struct omap_hwmod_ocp_if omap44xx_l4_cfg__hsi = {
4731 .master = &omap44xx_l4_cfg_hwmod,
4732 .slave = &omap44xx_hsi_hwmod,
4733 .clk = "l4_div_ck",
4734 .addr = omap44xx_hsi_addrs,
4735 .user = OCP_USER_MPU | OCP_USER_SDMA,
4736};
4737
4738static struct omap_hwmod_addr_space omap44xx_i2c1_addrs[] = {
4739 {
4740 .pa_start = 0x48070000,
4741 .pa_end = 0x480700ff,
4742 .flags = ADDR_TYPE_RT
4743 },
4744 { }
4745};
4746
4747/* l4_per -> i2c1 */
4748static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c1 = {
4749 .master = &omap44xx_l4_per_hwmod,
4750 .slave = &omap44xx_i2c1_hwmod,
4751 .clk = "l4_div_ck",
4752 .addr = omap44xx_i2c1_addrs,
4753 .user = OCP_USER_MPU | OCP_USER_SDMA,
4754};
4755
4756static struct omap_hwmod_addr_space omap44xx_i2c2_addrs[] = {
4757 {
4758 .pa_start = 0x48072000,
4759 .pa_end = 0x480720ff,
4760 .flags = ADDR_TYPE_RT
4761 },
4762 { }
4763};
4764
4765/* l4_per -> i2c2 */
4766static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c2 = {
4767 .master = &omap44xx_l4_per_hwmod,
4768 .slave = &omap44xx_i2c2_hwmod,
4769 .clk = "l4_div_ck",
4770 .addr = omap44xx_i2c2_addrs,
4771 .user = OCP_USER_MPU | OCP_USER_SDMA,
4772};
4773
4774static struct omap_hwmod_addr_space omap44xx_i2c3_addrs[] = {
4775 {
4776 .pa_start = 0x48060000,
4777 .pa_end = 0x480600ff,
4778 .flags = ADDR_TYPE_RT
4779 },
4780 { }
4781};
4782
4783/* l4_per -> i2c3 */
4784static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c3 = {
4785 .master = &omap44xx_l4_per_hwmod,
4786 .slave = &omap44xx_i2c3_hwmod,
4787 .clk = "l4_div_ck",
4788 .addr = omap44xx_i2c3_addrs,
4789 .user = OCP_USER_MPU | OCP_USER_SDMA,
4790};
4791
4792static struct omap_hwmod_addr_space omap44xx_i2c4_addrs[] = {
4793 {
4794 .pa_start = 0x48350000,
4795 .pa_end = 0x483500ff,
4796 .flags = ADDR_TYPE_RT
4797 },
4798 { }
4799};
4800
4801/* l4_per -> i2c4 */
4802static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c4 = {
4803 .master = &omap44xx_l4_per_hwmod,
4804 .slave = &omap44xx_i2c4_hwmod,
4805 .clk = "l4_div_ck",
4806 .addr = omap44xx_i2c4_addrs,
4807 .user = OCP_USER_MPU | OCP_USER_SDMA,
4808};
4809
4810/* l3_main_2 -> ipu */
4811static struct omap_hwmod_ocp_if omap44xx_l3_main_2__ipu = {
4812 .master = &omap44xx_l3_main_2_hwmod,
4813 .slave = &omap44xx_ipu_hwmod,
4814 .clk = "l3_div_ck",
4815 .user = OCP_USER_MPU | OCP_USER_SDMA,
4816};
4817
4818static struct omap_hwmod_addr_space omap44xx_iss_addrs[] = {
4819 {
4820 .pa_start = 0x52000000,
4821 .pa_end = 0x520000ff,
4822 .flags = ADDR_TYPE_RT
4823 },
4824 { }
4825};
4826
4827/* l3_main_2 -> iss */
4828static struct omap_hwmod_ocp_if omap44xx_l3_main_2__iss = {
4829 .master = &omap44xx_l3_main_2_hwmod,
4830 .slave = &omap44xx_iss_hwmod,
4831 .clk = "l3_div_ck",
4832 .addr = omap44xx_iss_addrs,
4833 .user = OCP_USER_MPU | OCP_USER_SDMA,
4834};
4835
4836/* iva -> sl2if */
4837static struct omap_hwmod_ocp_if omap44xx_iva__sl2if = {
4838 .master = &omap44xx_iva_hwmod,
4839 .slave = &omap44xx_sl2if_hwmod,
4840 .clk = "dpll_iva_m5x2_ck",
4841 .user = OCP_USER_IVA,
4842};
4843
4844static struct omap_hwmod_addr_space omap44xx_iva_addrs[] = {
4845 {
4846 .pa_start = 0x5a000000,
4847 .pa_end = 0x5a07ffff,
4848 .flags = ADDR_TYPE_RT
4849 },
4850 { }
4851};
4852
4853/* l3_main_2 -> iva */
4854static struct omap_hwmod_ocp_if omap44xx_l3_main_2__iva = {
4855 .master = &omap44xx_l3_main_2_hwmod,
4856 .slave = &omap44xx_iva_hwmod,
4857 .clk = "l3_div_ck",
4858 .addr = omap44xx_iva_addrs,
4859 .user = OCP_USER_MPU,
4860};
4861
4862static struct omap_hwmod_addr_space omap44xx_kbd_addrs[] = {
4863 {
4864 .pa_start = 0x4a31c000,
4865 .pa_end = 0x4a31c07f,
4866 .flags = ADDR_TYPE_RT
4867 },
4868 { }
4869};
4870
4871/* l4_wkup -> kbd */
4872static struct omap_hwmod_ocp_if omap44xx_l4_wkup__kbd = {
4873 .master = &omap44xx_l4_wkup_hwmod,
4874 .slave = &omap44xx_kbd_hwmod,
4875 .clk = "l4_wkup_clk_mux_ck",
4876 .addr = omap44xx_kbd_addrs,
4877 .user = OCP_USER_MPU | OCP_USER_SDMA,
4878};
4879
4880static struct omap_hwmod_addr_space omap44xx_mailbox_addrs[] = {
4881 {
4882 .pa_start = 0x4a0f4000,
4883 .pa_end = 0x4a0f41ff,
4884 .flags = ADDR_TYPE_RT
4885 },
4886 { }
4887};
4888
4889/* l4_cfg -> mailbox */
4890static struct omap_hwmod_ocp_if omap44xx_l4_cfg__mailbox = {
4891 .master = &omap44xx_l4_cfg_hwmod,
4892 .slave = &omap44xx_mailbox_hwmod,
4893 .clk = "l4_div_ck",
4894 .addr = omap44xx_mailbox_addrs,
4895 .user = OCP_USER_MPU | OCP_USER_SDMA,
4896};
4897
4898static struct omap_hwmod_addr_space omap44xx_mcasp_addrs[] = {
4899 {
4900 .pa_start = 0x40128000,
4901 .pa_end = 0x401283ff,
4902 .flags = ADDR_TYPE_RT
4903 },
4904 { }
4905};
4906
4907/* l4_abe -> mcasp */
4908static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcasp = {
4909 .master = &omap44xx_l4_abe_hwmod,
4910 .slave = &omap44xx_mcasp_hwmod,
4911 .clk = "ocp_abe_iclk",
4912 .addr = omap44xx_mcasp_addrs,
4913 .user = OCP_USER_MPU,
4914};
4915
4916static struct omap_hwmod_addr_space omap44xx_mcasp_dma_addrs[] = {
4917 {
4918 .pa_start = 0x49028000,
4919 .pa_end = 0x490283ff,
4920 .flags = ADDR_TYPE_RT
4921 },
4922 { }
4923};
4924
4925/* l4_abe -> mcasp (dma) */
4926static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcasp_dma = {
4927 .master = &omap44xx_l4_abe_hwmod,
4928 .slave = &omap44xx_mcasp_hwmod,
4929 .clk = "ocp_abe_iclk",
4930 .addr = omap44xx_mcasp_dma_addrs,
4931 .user = OCP_USER_SDMA,
4932};
4933
4934static struct omap_hwmod_addr_space omap44xx_mcbsp1_addrs[] = {
4935 {
4936 .name = "mpu",
4937 .pa_start = 0x40122000,
4938 .pa_end = 0x401220ff,
4939 .flags = ADDR_TYPE_RT
4940 },
4941 { }
4942};
4943
4944/* l4_abe -> mcbsp1 */
4945static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp1 = {
4946 .master = &omap44xx_l4_abe_hwmod,
4947 .slave = &omap44xx_mcbsp1_hwmod,
4948 .clk = "ocp_abe_iclk",
4949 .addr = omap44xx_mcbsp1_addrs,
4950 .user = OCP_USER_MPU,
4951};
4952
4953static struct omap_hwmod_addr_space omap44xx_mcbsp1_dma_addrs[] = {
4954 {
4955 .name = "dma",
4956 .pa_start = 0x49022000,
4957 .pa_end = 0x490220ff,
4958 .flags = ADDR_TYPE_RT
4959 },
4960 { }
4961};
4962
4963/* l4_abe -> mcbsp1 (dma) */
4964static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp1_dma = {
4965 .master = &omap44xx_l4_abe_hwmod,
4966 .slave = &omap44xx_mcbsp1_hwmod,
4967 .clk = "ocp_abe_iclk",
4968 .addr = omap44xx_mcbsp1_dma_addrs,
4969 .user = OCP_USER_SDMA,
4970};
4971
4972static struct omap_hwmod_addr_space omap44xx_mcbsp2_addrs[] = {
4973 {
4974 .name = "mpu",
4975 .pa_start = 0x40124000,
4976 .pa_end = 0x401240ff,
4977 .flags = ADDR_TYPE_RT
4978 },
4979 { }
4980};
4981
4982/* l4_abe -> mcbsp2 */
4983static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp2 = {
4984 .master = &omap44xx_l4_abe_hwmod,
4985 .slave = &omap44xx_mcbsp2_hwmod,
4986 .clk = "ocp_abe_iclk",
4987 .addr = omap44xx_mcbsp2_addrs,
4988 .user = OCP_USER_MPU,
4989};
4990
4991static struct omap_hwmod_addr_space omap44xx_mcbsp2_dma_addrs[] = {
4992 {
4993 .name = "dma",
4994 .pa_start = 0x49024000,
4995 .pa_end = 0x490240ff,
4996 .flags = ADDR_TYPE_RT
4997 },
4998 { }
4999};
5000
5001/* l4_abe -> mcbsp2 (dma) */
5002static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp2_dma = {
5003 .master = &omap44xx_l4_abe_hwmod,
5004 .slave = &omap44xx_mcbsp2_hwmod,
5005 .clk = "ocp_abe_iclk",
5006 .addr = omap44xx_mcbsp2_dma_addrs,
5007 .user = OCP_USER_SDMA,
5008};
5009
5010static struct omap_hwmod_addr_space omap44xx_mcbsp3_addrs[] = {
5011 {
5012 .name = "mpu",
5013 .pa_start = 0x40126000,
5014 .pa_end = 0x401260ff,
5015 .flags = ADDR_TYPE_RT
5016 },
5017 { }
5018};
5019
5020/* l4_abe -> mcbsp3 */
5021static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp3 = {
5022 .master = &omap44xx_l4_abe_hwmod,
5023 .slave = &omap44xx_mcbsp3_hwmod,
5024 .clk = "ocp_abe_iclk",
5025 .addr = omap44xx_mcbsp3_addrs,
5026 .user = OCP_USER_MPU,
5027};
5028
5029static struct omap_hwmod_addr_space omap44xx_mcbsp3_dma_addrs[] = {
5030 {
5031 .name = "dma",
5032 .pa_start = 0x49026000,
5033 .pa_end = 0x490260ff,
5034 .flags = ADDR_TYPE_RT
5035 },
5036 { }
5037};
5038
5039/* l4_abe -> mcbsp3 (dma) */
5040static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp3_dma = {
5041 .master = &omap44xx_l4_abe_hwmod,
5042 .slave = &omap44xx_mcbsp3_hwmod,
5043 .clk = "ocp_abe_iclk",
5044 .addr = omap44xx_mcbsp3_dma_addrs,
5045 .user = OCP_USER_SDMA,
5046};
5047
5048static struct omap_hwmod_addr_space omap44xx_mcbsp4_addrs[] = {
5049 {
5050 .pa_start = 0x48096000,
5051 .pa_end = 0x480960ff,
5052 .flags = ADDR_TYPE_RT
5053 },
5054 { }
5055};
5056
5057/* l4_per -> mcbsp4 */
5058static struct omap_hwmod_ocp_if omap44xx_l4_per__mcbsp4 = {
5059 .master = &omap44xx_l4_per_hwmod,
5060 .slave = &omap44xx_mcbsp4_hwmod,
5061 .clk = "l4_div_ck",
5062 .addr = omap44xx_mcbsp4_addrs,
5063 .user = OCP_USER_MPU | OCP_USER_SDMA,
5064};
5065
5066static struct omap_hwmod_addr_space omap44xx_mcpdm_addrs[] = {
5067 {
5068 .pa_start = 0x40132000,
5069 .pa_end = 0x4013207f,
5070 .flags = ADDR_TYPE_RT
5071 },
5072 { }
5073};
5074
5075/* l4_abe -> mcpdm */
5076static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcpdm = {
5077 .master = &omap44xx_l4_abe_hwmod,
5078 .slave = &omap44xx_mcpdm_hwmod,
5079 .clk = "ocp_abe_iclk",
5080 .addr = omap44xx_mcpdm_addrs,
5081 .user = OCP_USER_MPU,
5082};
5083
5084static struct omap_hwmod_addr_space omap44xx_mcpdm_dma_addrs[] = {
5085 {
5086 .pa_start = 0x49032000,
5087 .pa_end = 0x4903207f,
5088 .flags = ADDR_TYPE_RT
5089 },
5090 { }
5091};
5092
5093/* l4_abe -> mcpdm (dma) */
5094static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcpdm_dma = {
5095 .master = &omap44xx_l4_abe_hwmod,
5096 .slave = &omap44xx_mcpdm_hwmod,
5097 .clk = "ocp_abe_iclk",
5098 .addr = omap44xx_mcpdm_dma_addrs,
5099 .user = OCP_USER_SDMA,
5100};
5101
5102static struct omap_hwmod_addr_space omap44xx_mcspi1_addrs[] = {
5103 {
5104 .pa_start = 0x48098000,
5105 .pa_end = 0x480981ff,
5106 .flags = ADDR_TYPE_RT
5107 },
5108 { }
5109};
5110
5111/* l4_per -> mcspi1 */
5112static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi1 = {
5113 .master = &omap44xx_l4_per_hwmod,
5114 .slave = &omap44xx_mcspi1_hwmod,
5115 .clk = "l4_div_ck",
5116 .addr = omap44xx_mcspi1_addrs,
5117 .user = OCP_USER_MPU | OCP_USER_SDMA,
5118};
5119
5120static struct omap_hwmod_addr_space omap44xx_mcspi2_addrs[] = {
5121 {
5122 .pa_start = 0x4809a000,
5123 .pa_end = 0x4809a1ff,
5124 .flags = ADDR_TYPE_RT
5125 },
5126 { }
5127};
5128
5129/* l4_per -> mcspi2 */
5130static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi2 = {
5131 .master = &omap44xx_l4_per_hwmod,
5132 .slave = &omap44xx_mcspi2_hwmod,
5133 .clk = "l4_div_ck",
5134 .addr = omap44xx_mcspi2_addrs,
5135 .user = OCP_USER_MPU | OCP_USER_SDMA,
5136};
5137
5138static struct omap_hwmod_addr_space omap44xx_mcspi3_addrs[] = {
5139 {
5140 .pa_start = 0x480b8000,
5141 .pa_end = 0x480b81ff,
5142 .flags = ADDR_TYPE_RT
5143 },
5144 { }
5145};
5146
5147/* l4_per -> mcspi3 */
5148static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi3 = {
5149 .master = &omap44xx_l4_per_hwmod,
5150 .slave = &omap44xx_mcspi3_hwmod,
5151 .clk = "l4_div_ck",
5152 .addr = omap44xx_mcspi3_addrs,
5153 .user = OCP_USER_MPU | OCP_USER_SDMA,
5154};
5155
5156static struct omap_hwmod_addr_space omap44xx_mcspi4_addrs[] = {
5157 {
5158 .pa_start = 0x480ba000,
5159 .pa_end = 0x480ba1ff,
5160 .flags = ADDR_TYPE_RT
5161 },
5162 { }
5163};
5164
5165/* l4_per -> mcspi4 */
5166static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi4 = {
5167 .master = &omap44xx_l4_per_hwmod,
5168 .slave = &omap44xx_mcspi4_hwmod,
5169 .clk = "l4_div_ck",
5170 .addr = omap44xx_mcspi4_addrs,
5171 .user = OCP_USER_MPU | OCP_USER_SDMA,
5172};
5173
5174static struct omap_hwmod_addr_space omap44xx_mmc1_addrs[] = {
5175 {
5176 .pa_start = 0x4809c000,
5177 .pa_end = 0x4809c3ff,
5178 .flags = ADDR_TYPE_RT
5179 },
5180 { }
5181};
5182
5183/* l4_per -> mmc1 */
5184static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc1 = {
5185 .master = &omap44xx_l4_per_hwmod,
5186 .slave = &omap44xx_mmc1_hwmod,
5187 .clk = "l4_div_ck",
5188 .addr = omap44xx_mmc1_addrs,
5189 .user = OCP_USER_MPU | OCP_USER_SDMA,
5190};
5191
5192static struct omap_hwmod_addr_space omap44xx_mmc2_addrs[] = {
5193 {
5194 .pa_start = 0x480b4000,
5195 .pa_end = 0x480b43ff,
5196 .flags = ADDR_TYPE_RT
5197 },
5198 { }
5199};
5200
5201/* l4_per -> mmc2 */
5202static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc2 = {
5203 .master = &omap44xx_l4_per_hwmod,
5204 .slave = &omap44xx_mmc2_hwmod,
5205 .clk = "l4_div_ck",
5206 .addr = omap44xx_mmc2_addrs,
5207 .user = OCP_USER_MPU | OCP_USER_SDMA,
5208};
5209
5210static struct omap_hwmod_addr_space omap44xx_mmc3_addrs[] = {
5211 {
5212 .pa_start = 0x480ad000,
5213 .pa_end = 0x480ad3ff,
5214 .flags = ADDR_TYPE_RT
5215 },
5216 { }
5217};
5218
5219/* l4_per -> mmc3 */
5220static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc3 = {
5221 .master = &omap44xx_l4_per_hwmod,
5222 .slave = &omap44xx_mmc3_hwmod,
5223 .clk = "l4_div_ck",
5224 .addr = omap44xx_mmc3_addrs,
5225 .user = OCP_USER_MPU | OCP_USER_SDMA,
5226};
5227
5228static struct omap_hwmod_addr_space omap44xx_mmc4_addrs[] = {
5229 {
5230 .pa_start = 0x480d1000,
5231 .pa_end = 0x480d13ff,
5232 .flags = ADDR_TYPE_RT
5233 },
5234 { }
5235};
5236
5237/* l4_per -> mmc4 */
5238static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc4 = {
5239 .master = &omap44xx_l4_per_hwmod,
5240 .slave = &omap44xx_mmc4_hwmod,
5241 .clk = "l4_div_ck",
5242 .addr = omap44xx_mmc4_addrs,
5243 .user = OCP_USER_MPU | OCP_USER_SDMA,
5244};
5245
5246static struct omap_hwmod_addr_space omap44xx_mmc5_addrs[] = {
5247 {
5248 .pa_start = 0x480d5000,
5249 .pa_end = 0x480d53ff,
5250 .flags = ADDR_TYPE_RT
5251 },
5252 { }
5253};
5254
5255/* l4_per -> mmc5 */
5256static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc5 = {
5257 .master = &omap44xx_l4_per_hwmod,
5258 .slave = &omap44xx_mmc5_hwmod,
5259 .clk = "l4_div_ck",
5260 .addr = omap44xx_mmc5_addrs,
5261 .user = OCP_USER_MPU | OCP_USER_SDMA,
5262};
5263
5264/* l3_main_2 -> ocmc_ram */
5265static struct omap_hwmod_ocp_if omap44xx_l3_main_2__ocmc_ram = {
5266 .master = &omap44xx_l3_main_2_hwmod,
5267 .slave = &omap44xx_ocmc_ram_hwmod,
5268 .clk = "l3_div_ck",
5269 .user = OCP_USER_MPU | OCP_USER_SDMA,
5270};
5271
5272/* l4_cfg -> ocp2scp_usb_phy */
5273static struct omap_hwmod_ocp_if omap44xx_l4_cfg__ocp2scp_usb_phy = {
5274 .master = &omap44xx_l4_cfg_hwmod,
5275 .slave = &omap44xx_ocp2scp_usb_phy_hwmod,
5276 .clk = "l4_div_ck",
5277 .user = OCP_USER_MPU | OCP_USER_SDMA,
5278};
5279
5280static struct omap_hwmod_addr_space omap44xx_prcm_mpu_addrs[] = {
5281 {
5282 .pa_start = 0x48243000,
5283 .pa_end = 0x48243fff,
5284 .flags = ADDR_TYPE_RT
5285 },
5286 { }
5287};
5288
5289/* mpu_private -> prcm_mpu */
5290static struct omap_hwmod_ocp_if omap44xx_mpu_private__prcm_mpu = {
5291 .master = &omap44xx_mpu_private_hwmod,
5292 .slave = &omap44xx_prcm_mpu_hwmod,
5293 .clk = "l3_div_ck",
5294 .addr = omap44xx_prcm_mpu_addrs,
5295 .user = OCP_USER_MPU | OCP_USER_SDMA,
5296};
5297
5298static struct omap_hwmod_addr_space omap44xx_cm_core_aon_addrs[] = {
5299 {
5300 .pa_start = 0x4a004000,
5301 .pa_end = 0x4a004fff,
5302 .flags = ADDR_TYPE_RT
5303 },
5304 { }
5305};
5306
5307/* l4_wkup -> cm_core_aon */
5308static struct omap_hwmod_ocp_if omap44xx_l4_wkup__cm_core_aon = {
5309 .master = &omap44xx_l4_wkup_hwmod,
5310 .slave = &omap44xx_cm_core_aon_hwmod,
5311 .clk = "l4_wkup_clk_mux_ck",
5312 .addr = omap44xx_cm_core_aon_addrs,
5313 .user = OCP_USER_MPU | OCP_USER_SDMA,
5314};
5315
5316static struct omap_hwmod_addr_space omap44xx_cm_core_addrs[] = {
5317 {
5318 .pa_start = 0x4a008000,
5319 .pa_end = 0x4a009fff,
5320 .flags = ADDR_TYPE_RT
5321 },
5322 { }
5323};
5324
5325/* l4_cfg -> cm_core */
5326static struct omap_hwmod_ocp_if omap44xx_l4_cfg__cm_core = {
5327 .master = &omap44xx_l4_cfg_hwmod,
5328 .slave = &omap44xx_cm_core_hwmod,
5329 .clk = "l4_div_ck",
5330 .addr = omap44xx_cm_core_addrs,
5331 .user = OCP_USER_MPU | OCP_USER_SDMA,
5332};
5333
5334static struct omap_hwmod_addr_space omap44xx_prm_addrs[] = {
5335 {
5336 .pa_start = 0x4a306000,
5337 .pa_end = 0x4a307fff,
5338 .flags = ADDR_TYPE_RT
5339 },
5340 { }
5341};
5342
5343/* l4_wkup -> prm */
5344static struct omap_hwmod_ocp_if omap44xx_l4_wkup__prm = {
5345 .master = &omap44xx_l4_wkup_hwmod,
5346 .slave = &omap44xx_prm_hwmod,
5347 .clk = "l4_wkup_clk_mux_ck",
5348 .addr = omap44xx_prm_addrs,
5349 .user = OCP_USER_MPU | OCP_USER_SDMA,
5350};
5351
5352static struct omap_hwmod_addr_space omap44xx_scrm_addrs[] = {
5353 {
5354 .pa_start = 0x4a30a000,
5355 .pa_end = 0x4a30a7ff,
5356 .flags = ADDR_TYPE_RT
5357 },
5358 { }
5359};
5360
5361/* l4_wkup -> scrm */
5362static struct omap_hwmod_ocp_if omap44xx_l4_wkup__scrm = {
5363 .master = &omap44xx_l4_wkup_hwmod,
5364 .slave = &omap44xx_scrm_hwmod,
5365 .clk = "l4_wkup_clk_mux_ck",
5366 .addr = omap44xx_scrm_addrs,
5367 .user = OCP_USER_MPU | OCP_USER_SDMA,
5368};
5369
5370/* l3_main_2 -> sl2if */
5371static struct omap_hwmod_ocp_if omap44xx_l3_main_2__sl2if = {
5372 .master = &omap44xx_l3_main_2_hwmod,
5373 .slave = &omap44xx_sl2if_hwmod,
5374 .clk = "l3_div_ck",
5375 .user = OCP_USER_MPU | OCP_USER_SDMA,
5376};
5377
5378static struct omap_hwmod_addr_space omap44xx_slimbus1_addrs[] = {
5379 {
5380 .pa_start = 0x4012c000,
5381 .pa_end = 0x4012c3ff,
5382 .flags = ADDR_TYPE_RT
5383 },
5384 { }
5385};
5386
5387/* l4_abe -> slimbus1 */
5388static struct omap_hwmod_ocp_if omap44xx_l4_abe__slimbus1 = {
5389 .master = &omap44xx_l4_abe_hwmod,
5390 .slave = &omap44xx_slimbus1_hwmod,
5391 .clk = "ocp_abe_iclk",
5392 .addr = omap44xx_slimbus1_addrs,
5393 .user = OCP_USER_MPU,
5394};
5395
5396static struct omap_hwmod_addr_space omap44xx_slimbus1_dma_addrs[] = {
5397 {
5398 .pa_start = 0x4902c000,
5399 .pa_end = 0x4902c3ff,
5400 .flags = ADDR_TYPE_RT
5401 },
5402 { }
5403};
5404
5405/* l4_abe -> slimbus1 (dma) */
5406static struct omap_hwmod_ocp_if omap44xx_l4_abe__slimbus1_dma = {
5407 .master = &omap44xx_l4_abe_hwmod,
5408 .slave = &omap44xx_slimbus1_hwmod,
5409 .clk = "ocp_abe_iclk",
5410 .addr = omap44xx_slimbus1_dma_addrs,
5411 .user = OCP_USER_SDMA,
5412};
5413
5414static struct omap_hwmod_addr_space omap44xx_slimbus2_addrs[] = {
5415 {
5416 .pa_start = 0x48076000,
5417 .pa_end = 0x480763ff,
5418 .flags = ADDR_TYPE_RT
5419 },
5420 { }
5421};
5422
5423/* l4_per -> slimbus2 */
5424static struct omap_hwmod_ocp_if omap44xx_l4_per__slimbus2 = {
5425 .master = &omap44xx_l4_per_hwmod,
5426 .slave = &omap44xx_slimbus2_hwmod,
5427 .clk = "l4_div_ck",
5428 .addr = omap44xx_slimbus2_addrs,
5429 .user = OCP_USER_MPU | OCP_USER_SDMA,
5430};
5431
5432static struct omap_hwmod_addr_space omap44xx_smartreflex_core_addrs[] = {
5433 {
5434 .pa_start = 0x4a0dd000,
5435 .pa_end = 0x4a0dd03f,
5436 .flags = ADDR_TYPE_RT
5437 },
5438 { }
5439};
5440
5441/* l4_cfg -> smartreflex_core */
5442static struct omap_hwmod_ocp_if omap44xx_l4_cfg__smartreflex_core = {
5443 .master = &omap44xx_l4_cfg_hwmod,
5444 .slave = &omap44xx_smartreflex_core_hwmod,
5445 .clk = "l4_div_ck",
5446 .addr = omap44xx_smartreflex_core_addrs,
5447 .user = OCP_USER_MPU | OCP_USER_SDMA,
5448};
5449
5450static struct omap_hwmod_addr_space omap44xx_smartreflex_iva_addrs[] = {
5451 {
5452 .pa_start = 0x4a0db000,
5453 .pa_end = 0x4a0db03f,
5454 .flags = ADDR_TYPE_RT
5455 },
5456 { }
5457};
5458
5459/* l4_cfg -> smartreflex_iva */
5460static struct omap_hwmod_ocp_if omap44xx_l4_cfg__smartreflex_iva = {
5461 .master = &omap44xx_l4_cfg_hwmod,
5462 .slave = &omap44xx_smartreflex_iva_hwmod,
5463 .clk = "l4_div_ck",
5464 .addr = omap44xx_smartreflex_iva_addrs,
5465 .user = OCP_USER_MPU | OCP_USER_SDMA,
5466};
5467
5468static struct omap_hwmod_addr_space omap44xx_smartreflex_mpu_addrs[] = {
5469 {
5470 .pa_start = 0x4a0d9000,
5471 .pa_end = 0x4a0d903f,
5472 .flags = ADDR_TYPE_RT
5473 },
5474 { }
5475};
5476
5477/* l4_cfg -> smartreflex_mpu */
5478static struct omap_hwmod_ocp_if omap44xx_l4_cfg__smartreflex_mpu = {
5479 .master = &omap44xx_l4_cfg_hwmod,
5480 .slave = &omap44xx_smartreflex_mpu_hwmod,
5481 .clk = "l4_div_ck",
5482 .addr = omap44xx_smartreflex_mpu_addrs,
5483 .user = OCP_USER_MPU | OCP_USER_SDMA,
5484};
5485
5486static struct omap_hwmod_addr_space omap44xx_spinlock_addrs[] = {
5487 {
5488 .pa_start = 0x4a0f6000,
5489 .pa_end = 0x4a0f6fff,
5490 .flags = ADDR_TYPE_RT
5491 },
5492 { }
5493};
5494
5495/* l4_cfg -> spinlock */
5496static struct omap_hwmod_ocp_if omap44xx_l4_cfg__spinlock = {
5497 .master = &omap44xx_l4_cfg_hwmod,
5498 .slave = &omap44xx_spinlock_hwmod,
5499 .clk = "l4_div_ck",
5500 .addr = omap44xx_spinlock_addrs,
5501 .user = OCP_USER_MPU | OCP_USER_SDMA,
5502};
5503
5504static struct omap_hwmod_addr_space omap44xx_timer1_addrs[] = {
5505 {
5506 .pa_start = 0x4a318000,
5507 .pa_end = 0x4a31807f,
5508 .flags = ADDR_TYPE_RT
5509 },
5510 { }
5511};
5512
5513/* l4_wkup -> timer1 */
5514static struct omap_hwmod_ocp_if omap44xx_l4_wkup__timer1 = {
5515 .master = &omap44xx_l4_wkup_hwmod,
5516 .slave = &omap44xx_timer1_hwmod,
5517 .clk = "l4_wkup_clk_mux_ck",
5518 .addr = omap44xx_timer1_addrs,
5519 .user = OCP_USER_MPU | OCP_USER_SDMA,
5520};
5521
5522static struct omap_hwmod_addr_space omap44xx_timer2_addrs[] = {
5523 {
5524 .pa_start = 0x48032000,
5525 .pa_end = 0x4803207f,
5526 .flags = ADDR_TYPE_RT
5527 },
5528 { }
5529};
5530
5531/* l4_per -> timer2 */
5532static struct omap_hwmod_ocp_if omap44xx_l4_per__timer2 = {
5533 .master = &omap44xx_l4_per_hwmod,
5534 .slave = &omap44xx_timer2_hwmod,
5535 .clk = "l4_div_ck",
5536 .addr = omap44xx_timer2_addrs,
5537 .user = OCP_USER_MPU | OCP_USER_SDMA,
5538};
5539
5540static struct omap_hwmod_addr_space omap44xx_timer3_addrs[] = {
5541 {
5542 .pa_start = 0x48034000,
5543 .pa_end = 0x4803407f,
5544 .flags = ADDR_TYPE_RT
5545 },
5546 { }
5547};
5548
5549/* l4_per -> timer3 */
5550static struct omap_hwmod_ocp_if omap44xx_l4_per__timer3 = {
5551 .master = &omap44xx_l4_per_hwmod,
5552 .slave = &omap44xx_timer3_hwmod,
5553 .clk = "l4_div_ck",
5554 .addr = omap44xx_timer3_addrs,
5555 .user = OCP_USER_MPU | OCP_USER_SDMA,
5556};
5557
5558static struct omap_hwmod_addr_space omap44xx_timer4_addrs[] = {
5559 {
5560 .pa_start = 0x48036000,
5561 .pa_end = 0x4803607f,
5562 .flags = ADDR_TYPE_RT
5563 },
5564 { }
5565};
5566
5567/* l4_per -> timer4 */
5568static struct omap_hwmod_ocp_if omap44xx_l4_per__timer4 = {
5569 .master = &omap44xx_l4_per_hwmod,
5570 .slave = &omap44xx_timer4_hwmod,
5571 .clk = "l4_div_ck",
5572 .addr = omap44xx_timer4_addrs,
5573 .user = OCP_USER_MPU | OCP_USER_SDMA,
5574};
5575
5576static struct omap_hwmod_addr_space omap44xx_timer5_addrs[] = {
5577 {
5578 .pa_start = 0x40138000,
5579 .pa_end = 0x4013807f,
5580 .flags = ADDR_TYPE_RT
5581 },
5582 { }
5583};
5584
5585/* l4_abe -> timer5 */
5586static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer5 = {
5587 .master = &omap44xx_l4_abe_hwmod,
5588 .slave = &omap44xx_timer5_hwmod,
5589 .clk = "ocp_abe_iclk",
5590 .addr = omap44xx_timer5_addrs,
5591 .user = OCP_USER_MPU,
5592};
5593
5594static struct omap_hwmod_addr_space omap44xx_timer5_dma_addrs[] = {
5595 {
5596 .pa_start = 0x49038000,
5597 .pa_end = 0x4903807f,
5598 .flags = ADDR_TYPE_RT
5599 },
5600 { }
5601};
5602
5603/* l4_abe -> timer5 (dma) */
5604static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer5_dma = {
5605 .master = &omap44xx_l4_abe_hwmod,
5606 .slave = &omap44xx_timer5_hwmod,
5607 .clk = "ocp_abe_iclk",
5608 .addr = omap44xx_timer5_dma_addrs,
5609 .user = OCP_USER_SDMA,
5610};
5611
5612static struct omap_hwmod_addr_space omap44xx_timer6_addrs[] = {
5613 {
5614 .pa_start = 0x4013a000,
5615 .pa_end = 0x4013a07f,
5616 .flags = ADDR_TYPE_RT
5617 },
5618 { }
5619};
5620
5621/* l4_abe -> timer6 */
5622static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer6 = {
5623 .master = &omap44xx_l4_abe_hwmod,
5624 .slave = &omap44xx_timer6_hwmod,
5625 .clk = "ocp_abe_iclk",
5626 .addr = omap44xx_timer6_addrs,
5627 .user = OCP_USER_MPU,
5628};
5629
5630static struct omap_hwmod_addr_space omap44xx_timer6_dma_addrs[] = {
5631 {
5632 .pa_start = 0x4903a000,
5633 .pa_end = 0x4903a07f,
5634 .flags = ADDR_TYPE_RT
5635 },
5636 { }
5637};
5638
5639/* l4_abe -> timer6 (dma) */
5640static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer6_dma = {
5641 .master = &omap44xx_l4_abe_hwmod,
5642 .slave = &omap44xx_timer6_hwmod,
5643 .clk = "ocp_abe_iclk",
5644 .addr = omap44xx_timer6_dma_addrs,
5645 .user = OCP_USER_SDMA,
5646};
5647
5648static struct omap_hwmod_addr_space omap44xx_timer7_addrs[] = {
5649 {
5650 .pa_start = 0x4013c000,
5651 .pa_end = 0x4013c07f,
5652 .flags = ADDR_TYPE_RT
5653 },
5654 { }
5655};
5656
5657/* l4_abe -> timer7 */
5658static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer7 = {
5659 .master = &omap44xx_l4_abe_hwmod,
5660 .slave = &omap44xx_timer7_hwmod,
5661 .clk = "ocp_abe_iclk",
5662 .addr = omap44xx_timer7_addrs,
5663 .user = OCP_USER_MPU,
5664};
5665
5666static struct omap_hwmod_addr_space omap44xx_timer7_dma_addrs[] = {
5667 {
5668 .pa_start = 0x4903c000,
5669 .pa_end = 0x4903c07f,
5670 .flags = ADDR_TYPE_RT
5671 },
5672 { }
5673};
5674
5675/* l4_abe -> timer7 (dma) */
5676static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer7_dma = {
5677 .master = &omap44xx_l4_abe_hwmod,
5678 .slave = &omap44xx_timer7_hwmod,
5679 .clk = "ocp_abe_iclk",
5680 .addr = omap44xx_timer7_dma_addrs,
5681 .user = OCP_USER_SDMA,
5682};
5683
5684static struct omap_hwmod_addr_space omap44xx_timer8_addrs[] = {
5685 {
5686 .pa_start = 0x4013e000,
5687 .pa_end = 0x4013e07f,
5688 .flags = ADDR_TYPE_RT
5689 },
5690 { }
5691};
5692
5693/* l4_abe -> timer8 */
5694static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer8 = {
5695 .master = &omap44xx_l4_abe_hwmod,
5696 .slave = &omap44xx_timer8_hwmod,
5697 .clk = "ocp_abe_iclk",
5698 .addr = omap44xx_timer8_addrs,
5699 .user = OCP_USER_MPU,
5700};
5701
5702static struct omap_hwmod_addr_space omap44xx_timer8_dma_addrs[] = {
5703 {
5704 .pa_start = 0x4903e000,
5705 .pa_end = 0x4903e07f,
5706 .flags = ADDR_TYPE_RT
5707 },
5708 { }
5709};
5710
5711/* l4_abe -> timer8 (dma) */
5712static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer8_dma = {
5713 .master = &omap44xx_l4_abe_hwmod,
5714 .slave = &omap44xx_timer8_hwmod,
5715 .clk = "ocp_abe_iclk",
5716 .addr = omap44xx_timer8_dma_addrs,
5717 .user = OCP_USER_SDMA,
5718};
5719
5720static struct omap_hwmod_addr_space omap44xx_timer9_addrs[] = {
5721 {
5722 .pa_start = 0x4803e000,
5723 .pa_end = 0x4803e07f,
5724 .flags = ADDR_TYPE_RT
5725 },
5726 { }
5727};
5728
5729/* l4_per -> timer9 */
5730static struct omap_hwmod_ocp_if omap44xx_l4_per__timer9 = {
5731 .master = &omap44xx_l4_per_hwmod,
5732 .slave = &omap44xx_timer9_hwmod,
5733 .clk = "l4_div_ck",
5734 .addr = omap44xx_timer9_addrs,
5735 .user = OCP_USER_MPU | OCP_USER_SDMA,
5736};
5737
5738static struct omap_hwmod_addr_space omap44xx_timer10_addrs[] = {
5739 {
5740 .pa_start = 0x48086000,
5741 .pa_end = 0x4808607f,
5742 .flags = ADDR_TYPE_RT
5743 },
5744 { }
5745};
5746
5747/* l4_per -> timer10 */
5748static struct omap_hwmod_ocp_if omap44xx_l4_per__timer10 = {
5749 .master = &omap44xx_l4_per_hwmod,
5750 .slave = &omap44xx_timer10_hwmod,
5751 .clk = "l4_div_ck",
5752 .addr = omap44xx_timer10_addrs,
5753 .user = OCP_USER_MPU | OCP_USER_SDMA,
5754};
5755
5756static struct omap_hwmod_addr_space omap44xx_timer11_addrs[] = {
5757 {
5758 .pa_start = 0x48088000,
5759 .pa_end = 0x4808807f,
5760 .flags = ADDR_TYPE_RT
5761 },
5762 { }
5763};
5764
5765/* l4_per -> timer11 */
5766static struct omap_hwmod_ocp_if omap44xx_l4_per__timer11 = {
5767 .master = &omap44xx_l4_per_hwmod,
5768 .slave = &omap44xx_timer11_hwmod,
5769 .clk = "l4_div_ck",
5770 .addr = omap44xx_timer11_addrs,
5771 .user = OCP_USER_MPU | OCP_USER_SDMA,
5772};
5773
5774static struct omap_hwmod_addr_space omap44xx_uart1_addrs[] = {
5775 {
5776 .pa_start = 0x4806a000,
5777 .pa_end = 0x4806a0ff,
5778 .flags = ADDR_TYPE_RT
5779 },
5780 { }
5781};
5782
5783/* l4_per -> uart1 */
5784static struct omap_hwmod_ocp_if omap44xx_l4_per__uart1 = {
5785 .master = &omap44xx_l4_per_hwmod,
5786 .slave = &omap44xx_uart1_hwmod,
5787 .clk = "l4_div_ck",
5788 .addr = omap44xx_uart1_addrs,
5789 .user = OCP_USER_MPU | OCP_USER_SDMA,
5790};
5791
5792static struct omap_hwmod_addr_space omap44xx_uart2_addrs[] = {
5793 {
5794 .pa_start = 0x4806c000,
5795 .pa_end = 0x4806c0ff,
5796 .flags = ADDR_TYPE_RT
5797 },
5798 { }
5799};
5800
5801/* l4_per -> uart2 */
5802static struct omap_hwmod_ocp_if omap44xx_l4_per__uart2 = {
5803 .master = &omap44xx_l4_per_hwmod,
5804 .slave = &omap44xx_uart2_hwmod,
5805 .clk = "l4_div_ck",
5806 .addr = omap44xx_uart2_addrs,
5807 .user = OCP_USER_MPU | OCP_USER_SDMA,
5808};
5809
5810static struct omap_hwmod_addr_space omap44xx_uart3_addrs[] = {
5811 {
5812 .pa_start = 0x48020000,
5813 .pa_end = 0x480200ff,
5814 .flags = ADDR_TYPE_RT
5815 },
5816 { }
5817};
5818
5819/* l4_per -> uart3 */
5820static struct omap_hwmod_ocp_if omap44xx_l4_per__uart3 = {
5821 .master = &omap44xx_l4_per_hwmod,
5822 .slave = &omap44xx_uart3_hwmod,
5823 .clk = "l4_div_ck",
5824 .addr = omap44xx_uart3_addrs,
5825 .user = OCP_USER_MPU | OCP_USER_SDMA,
5826};
5827
5828static struct omap_hwmod_addr_space omap44xx_uart4_addrs[] = {
5829 {
5830 .pa_start = 0x4806e000,
5831 .pa_end = 0x4806e0ff,
5832 .flags = ADDR_TYPE_RT
5833 },
5834 { }
5835};
5836
5837/* l4_per -> uart4 */
5838static struct omap_hwmod_ocp_if omap44xx_l4_per__uart4 = {
5839 .master = &omap44xx_l4_per_hwmod,
5840 .slave = &omap44xx_uart4_hwmod,
5841 .clk = "l4_div_ck",
5842 .addr = omap44xx_uart4_addrs,
5843 .user = OCP_USER_MPU | OCP_USER_SDMA,
5844};
5845
5846static struct omap_hwmod_addr_space omap44xx_usb_host_fs_addrs[] = {
5847 {
5848 .pa_start = 0x4a0a9000,
5849 .pa_end = 0x4a0a93ff,
5850 .flags = ADDR_TYPE_RT
5851 },
5852 { }
5853};
5854
5855/* l4_cfg -> usb_host_fs */
5856static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_host_fs = {
5857 .master = &omap44xx_l4_cfg_hwmod,
5858 .slave = &omap44xx_usb_host_fs_hwmod,
5859 .clk = "l4_div_ck",
5860 .addr = omap44xx_usb_host_fs_addrs,
5861 .user = OCP_USER_MPU | OCP_USER_SDMA,
5354}; 5862};
5355 5863
5356static struct omap_hwmod_addr_space omap44xx_usb_host_hs_addrs[] = { 5864static struct omap_hwmod_addr_space omap44xx_usb_host_hs_addrs[] = {
@@ -5373,12 +5881,7 @@ static struct omap_hwmod_addr_space omap44xx_usb_host_hs_addrs[] = {
5373 {} 5881 {}
5374}; 5882};
5375 5883
5376static struct omap_hwmod_irq_info omap44xx_usb_host_hs_irqs[] = { 5884/* l4_cfg -> usb_host_hs */
5377 { .name = "ohci-irq", .irq = 76 + OMAP44XX_IRQ_GIC_START },
5378 { .name = "ehci-irq", .irq = 77 + OMAP44XX_IRQ_GIC_START },
5379 { .irq = -1 }
5380};
5381
5382static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_host_hs = { 5885static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_host_hs = {
5383 .master = &omap44xx_l4_cfg_hwmod, 5886 .master = &omap44xx_l4_cfg_hwmod,
5384 .slave = &omap44xx_usb_host_hs_hwmod, 5887 .slave = &omap44xx_usb_host_hs_hwmod,
@@ -5387,100 +5890,22 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_host_hs = {
5387 .user = OCP_USER_MPU | OCP_USER_SDMA, 5890 .user = OCP_USER_MPU | OCP_USER_SDMA,
5388}; 5891};
5389 5892
5390static struct omap_hwmod_ocp_if *omap44xx_usb_host_hs_slaves[] = { 5893static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = {
5391 &omap44xx_l4_cfg__usb_host_hs, 5894 {
5392}; 5895 .pa_start = 0x4a0ab000,
5393 5896 .pa_end = 0x4a0ab003,
5394static struct omap_hwmod omap44xx_usb_host_hs_hwmod = { 5897 .flags = ADDR_TYPE_RT
5395 .name = "usb_host_hs",
5396 .class = &omap44xx_usb_host_hs_hwmod_class,
5397 .clkdm_name = "l3_init_clkdm",
5398 .main_clk = "usb_host_hs_fck",
5399 .prcm = {
5400 .omap4 = {
5401 .clkctrl_offs = OMAP4_CM_L3INIT_USB_HOST_CLKCTRL_OFFSET,
5402 .context_offs = OMAP4_RM_L3INIT_USB_HOST_CONTEXT_OFFSET,
5403 .modulemode = MODULEMODE_SWCTRL,
5404 },
5405 }, 5898 },
5406 .mpu_irqs = omap44xx_usb_host_hs_irqs, 5899 { }
5407 .slaves = omap44xx_usb_host_hs_slaves,
5408 .slaves_cnt = ARRAY_SIZE(omap44xx_usb_host_hs_slaves),
5409 .masters = omap44xx_usb_host_hs_masters,
5410 .masters_cnt = ARRAY_SIZE(omap44xx_usb_host_hs_masters),
5411
5412 /*
5413 * Errata: USBHOST Configured In Smart-Idle Can Lead To a Deadlock
5414 * id: i660
5415 *
5416 * Description:
5417 * In the following configuration :
5418 * - USBHOST module is set to smart-idle mode
5419 * - PRCM asserts idle_req to the USBHOST module ( This typically
5420 * happens when the system is going to a low power mode : all ports
5421 * have been suspended, the master part of the USBHOST module has
5422 * entered the standby state, and SW has cut the functional clocks)
5423 * - an USBHOST interrupt occurs before the module is able to answer
5424 * idle_ack, typically a remote wakeup IRQ.
5425 * Then the USB HOST module will enter a deadlock situation where it
5426 * is no more accessible nor functional.
5427 *
5428 * Workaround:
5429 * Don't use smart idle; use only force idle, hence HWMOD_SWSUP_SIDLE
5430 */
5431
5432 /*
5433 * Errata: USB host EHCI may stall when entering smart-standby mode
5434 * Id: i571
5435 *
5436 * Description:
5437 * When the USBHOST module is set to smart-standby mode, and when it is
5438 * ready to enter the standby state (i.e. all ports are suspended and
5439 * all attached devices are in suspend mode), then it can wrongly assert
5440 * the Mstandby signal too early while there are still some residual OCP
5441 * transactions ongoing. If this condition occurs, the internal state
5442 * machine may go to an undefined state and the USB link may be stuck
5443 * upon the next resume.
5444 *
5445 * Workaround:
5446 * Don't use smart standby; use only force standby,
5447 * hence HWMOD_SWSUP_MSTANDBY
5448 */
5449
5450 /*
5451 * During system boot; If the hwmod framework resets the module
5452 * the module will have smart idle settings; which can lead to deadlock
5453 * (above Errata Id:i660); so, dont reset the module during boot;
5454 * Use HWMOD_INIT_NO_RESET.
5455 */
5456
5457 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY |
5458 HWMOD_INIT_NO_RESET,
5459};
5460
5461/*
5462 * 'usb_tll_hs' class
5463 * usb_tll_hs module is the adapter on the usb_host_hs ports
5464 */
5465static struct omap_hwmod_class_sysconfig omap44xx_usb_tll_hs_sysc = {
5466 .rev_offs = 0x0000,
5467 .sysc_offs = 0x0010,
5468 .syss_offs = 0x0014,
5469 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
5470 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
5471 SYSC_HAS_AUTOIDLE),
5472 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
5473 .sysc_fields = &omap_hwmod_sysc_type1,
5474};
5475
5476static struct omap_hwmod_class omap44xx_usb_tll_hs_hwmod_class = {
5477 .name = "usb_tll_hs",
5478 .sysc = &omap44xx_usb_tll_hs_sysc,
5479}; 5900};
5480 5901
5481static struct omap_hwmod_irq_info omap44xx_usb_tll_hs_irqs[] = { 5902/* l4_cfg -> usb_otg_hs */
5482 { .name = "tll-irq", .irq = 78 + OMAP44XX_IRQ_GIC_START }, 5903static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_otg_hs = {
5483 { .irq = -1 } 5904 .master = &omap44xx_l4_cfg_hwmod,
5905 .slave = &omap44xx_usb_otg_hs_hwmod,
5906 .clk = "l4_div_ck",
5907 .addr = omap44xx_usb_otg_hs_addrs,
5908 .user = OCP_USER_MPU | OCP_USER_SDMA,
5484}; 5909};
5485 5910
5486static struct omap_hwmod_addr_space omap44xx_usb_tll_hs_addrs[] = { 5911static struct omap_hwmod_addr_space omap44xx_usb_tll_hs_addrs[] = {
@@ -5493,6 +5918,7 @@ static struct omap_hwmod_addr_space omap44xx_usb_tll_hs_addrs[] = {
5493 {} 5918 {}
5494}; 5919};
5495 5920
5921/* l4_cfg -> usb_tll_hs */
5496static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_tll_hs = { 5922static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_tll_hs = {
5497 .master = &omap44xx_l4_cfg_hwmod, 5923 .master = &omap44xx_l4_cfg_hwmod,
5498 .slave = &omap44xx_usb_tll_hs_hwmod, 5924 .slave = &omap44xx_usb_tll_hs_hwmod,
@@ -5501,181 +5927,223 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_tll_hs = {
5501 .user = OCP_USER_MPU | OCP_USER_SDMA, 5927 .user = OCP_USER_MPU | OCP_USER_SDMA,
5502}; 5928};
5503 5929
5504static struct omap_hwmod_ocp_if *omap44xx_usb_tll_hs_slaves[] = { 5930static struct omap_hwmod_addr_space omap44xx_wd_timer2_addrs[] = {
5505 &omap44xx_l4_cfg__usb_tll_hs, 5931 {
5932 .pa_start = 0x4a314000,
5933 .pa_end = 0x4a31407f,
5934 .flags = ADDR_TYPE_RT
5935 },
5936 { }
5506}; 5937};
5507 5938
5508static struct omap_hwmod omap44xx_usb_tll_hs_hwmod = { 5939/* l4_wkup -> wd_timer2 */
5509 .name = "usb_tll_hs", 5940static struct omap_hwmod_ocp_if omap44xx_l4_wkup__wd_timer2 = {
5510 .class = &omap44xx_usb_tll_hs_hwmod_class, 5941 .master = &omap44xx_l4_wkup_hwmod,
5511 .clkdm_name = "l3_init_clkdm", 5942 .slave = &omap44xx_wd_timer2_hwmod,
5512 .main_clk = "usb_tll_hs_ick", 5943 .clk = "l4_wkup_clk_mux_ck",
5513 .prcm = { 5944 .addr = omap44xx_wd_timer2_addrs,
5514 .omap4 = { 5945 .user = OCP_USER_MPU | OCP_USER_SDMA,
5515 .clkctrl_offs = OMAP4_CM_L3INIT_USB_TLL_CLKCTRL_OFFSET, 5946};
5516 .context_offs = OMAP4_RM_L3INIT_USB_TLL_CONTEXT_OFFSET, 5947
5517 .modulemode = MODULEMODE_HWCTRL, 5948static struct omap_hwmod_addr_space omap44xx_wd_timer3_addrs[] = {
5518 }, 5949 {
5950 .pa_start = 0x40130000,
5951 .pa_end = 0x4013007f,
5952 .flags = ADDR_TYPE_RT
5519 }, 5953 },
5520 .mpu_irqs = omap44xx_usb_tll_hs_irqs, 5954 { }
5521 .slaves = omap44xx_usb_tll_hs_slaves,
5522 .slaves_cnt = ARRAY_SIZE(omap44xx_usb_tll_hs_slaves),
5523}; 5955};
5524 5956
5525static __initdata struct omap_hwmod *omap44xx_hwmods[] = { 5957/* l4_abe -> wd_timer3 */
5526 5958static struct omap_hwmod_ocp_if omap44xx_l4_abe__wd_timer3 = {
5527 /* dmm class */ 5959 .master = &omap44xx_l4_abe_hwmod,
5528 &omap44xx_dmm_hwmod, 5960 .slave = &omap44xx_wd_timer3_hwmod,
5529 5961 .clk = "ocp_abe_iclk",
5530 /* emif_fw class */ 5962 .addr = omap44xx_wd_timer3_addrs,
5531 &omap44xx_emif_fw_hwmod, 5963 .user = OCP_USER_MPU,
5532 5964};
5533 /* l3 class */ 5965
5534 &omap44xx_l3_instr_hwmod, 5966static struct omap_hwmod_addr_space omap44xx_wd_timer3_dma_addrs[] = {
5535 &omap44xx_l3_main_1_hwmod, 5967 {
5536 &omap44xx_l3_main_2_hwmod, 5968 .pa_start = 0x49030000,
5537 &omap44xx_l3_main_3_hwmod, 5969 .pa_end = 0x4903007f,
5538 5970 .flags = ADDR_TYPE_RT
5539 /* l4 class */ 5971 },
5540 &omap44xx_l4_abe_hwmod, 5972 { }
5541 &omap44xx_l4_cfg_hwmod, 5973};
5542 &omap44xx_l4_per_hwmod, 5974
5543 &omap44xx_l4_wkup_hwmod, 5975/* l4_abe -> wd_timer3 (dma) */
5544 5976static struct omap_hwmod_ocp_if omap44xx_l4_abe__wd_timer3_dma = {
5545 /* mpu_bus class */ 5977 .master = &omap44xx_l4_abe_hwmod,
5546 &omap44xx_mpu_private_hwmod, 5978 .slave = &omap44xx_wd_timer3_hwmod,
5547 5979 .clk = "ocp_abe_iclk",
5548 /* aess class */ 5980 .addr = omap44xx_wd_timer3_dma_addrs,
5549/* &omap44xx_aess_hwmod, */ 5981 .user = OCP_USER_SDMA,
5550 5982};
5551 /* bandgap class */ 5983
5552 &omap44xx_bandgap_hwmod, 5984static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
5553 5985 &omap44xx_c2c__c2c_target_fw,
5554 /* counter class */ 5986 &omap44xx_l4_cfg__c2c_target_fw,
5555/* &omap44xx_counter_32k_hwmod, */ 5987 &omap44xx_l3_main_1__dmm,
5556 5988 &omap44xx_mpu__dmm,
5557 /* dma class */ 5989 &omap44xx_c2c__emif_fw,
5558 &omap44xx_dma_system_hwmod, 5990 &omap44xx_dmm__emif_fw,
5559 5991 &omap44xx_l4_cfg__emif_fw,
5560 /* dmic class */ 5992 &omap44xx_iva__l3_instr,
5561 &omap44xx_dmic_hwmod, 5993 &omap44xx_l3_main_3__l3_instr,
5562 5994 &omap44xx_ocp_wp_noc__l3_instr,
5563 /* dsp class */ 5995 &omap44xx_dsp__l3_main_1,
5564 &omap44xx_dsp_hwmod, 5996 &omap44xx_dss__l3_main_1,
5565 &omap44xx_dsp_c0_hwmod, 5997 &omap44xx_l3_main_2__l3_main_1,
5566 5998 &omap44xx_l4_cfg__l3_main_1,
5567 /* dss class */ 5999 &omap44xx_mmc1__l3_main_1,
5568 &omap44xx_dss_hwmod, 6000 &omap44xx_mmc2__l3_main_1,
5569 &omap44xx_dss_dispc_hwmod, 6001 &omap44xx_mpu__l3_main_1,
5570 &omap44xx_dss_dsi1_hwmod, 6002 &omap44xx_c2c_target_fw__l3_main_2,
5571 &omap44xx_dss_dsi2_hwmod, 6003 &omap44xx_debugss__l3_main_2,
5572 &omap44xx_dss_hdmi_hwmod, 6004 &omap44xx_dma_system__l3_main_2,
5573 &omap44xx_dss_rfbi_hwmod, 6005 &omap44xx_fdif__l3_main_2,
5574 &omap44xx_dss_venc_hwmod, 6006 &omap44xx_gpu__l3_main_2,
5575 6007 &omap44xx_hsi__l3_main_2,
5576 /* gpio class */ 6008 &omap44xx_ipu__l3_main_2,
5577 &omap44xx_gpio1_hwmod, 6009 &omap44xx_iss__l3_main_2,
5578 &omap44xx_gpio2_hwmod, 6010 &omap44xx_iva__l3_main_2,
5579 &omap44xx_gpio3_hwmod, 6011 &omap44xx_l3_main_1__l3_main_2,
5580 &omap44xx_gpio4_hwmod, 6012 &omap44xx_l4_cfg__l3_main_2,
5581 &omap44xx_gpio5_hwmod, 6013 &omap44xx_usb_host_fs__l3_main_2,
5582 &omap44xx_gpio6_hwmod, 6014 &omap44xx_usb_host_hs__l3_main_2,
5583 6015 &omap44xx_usb_otg_hs__l3_main_2,
5584 /* hsi class */ 6016 &omap44xx_l3_main_1__l3_main_3,
5585/* &omap44xx_hsi_hwmod, */ 6017 &omap44xx_l3_main_2__l3_main_3,
5586 6018 &omap44xx_l4_cfg__l3_main_3,
5587 /* i2c class */ 6019 &omap44xx_aess__l4_abe,
5588 &omap44xx_i2c1_hwmod, 6020 &omap44xx_dsp__l4_abe,
5589 &omap44xx_i2c2_hwmod, 6021 &omap44xx_l3_main_1__l4_abe,
5590 &omap44xx_i2c3_hwmod, 6022 &omap44xx_mpu__l4_abe,
5591 &omap44xx_i2c4_hwmod, 6023 &omap44xx_l3_main_1__l4_cfg,
5592 6024 &omap44xx_l3_main_2__l4_per,
5593 /* ipu class */ 6025 &omap44xx_l4_cfg__l4_wkup,
5594 &omap44xx_ipu_hwmod, 6026 &omap44xx_mpu__mpu_private,
5595 &omap44xx_ipu_c0_hwmod, 6027 &omap44xx_l4_cfg__ocp_wp_noc,
5596 &omap44xx_ipu_c1_hwmod, 6028 &omap44xx_l4_abe__aess,
5597 6029 &omap44xx_l4_abe__aess_dma,
5598 /* iss class */ 6030 &omap44xx_l3_main_2__c2c,
5599/* &omap44xx_iss_hwmod, */ 6031 &omap44xx_l4_wkup__counter_32k,
5600 6032 &omap44xx_l4_cfg__ctrl_module_core,
5601 /* iva class */ 6033 &omap44xx_l4_cfg__ctrl_module_pad_core,
5602 &omap44xx_iva_hwmod, 6034 &omap44xx_l4_wkup__ctrl_module_wkup,
5603 &omap44xx_iva_seq0_hwmod, 6035 &omap44xx_l4_wkup__ctrl_module_pad_wkup,
5604 &omap44xx_iva_seq1_hwmod, 6036 &omap44xx_l3_instr__debugss,
5605 6037 &omap44xx_l4_cfg__dma_system,
5606 /* kbd class */ 6038 &omap44xx_l4_abe__dmic,
5607 &omap44xx_kbd_hwmod, 6039 &omap44xx_l4_abe__dmic_dma,
5608 6040 &omap44xx_dsp__iva,
5609 /* mailbox class */ 6041 &omap44xx_dsp__sl2if,
5610 &omap44xx_mailbox_hwmod, 6042 &omap44xx_l4_cfg__dsp,
5611 6043 &omap44xx_l3_main_2__dss,
5612 /* mcbsp class */ 6044 &omap44xx_l4_per__dss,
5613 &omap44xx_mcbsp1_hwmod, 6045 &omap44xx_l3_main_2__dss_dispc,
5614 &omap44xx_mcbsp2_hwmod, 6046 &omap44xx_l4_per__dss_dispc,
5615 &omap44xx_mcbsp3_hwmod, 6047 &omap44xx_l3_main_2__dss_dsi1,
5616 &omap44xx_mcbsp4_hwmod, 6048 &omap44xx_l4_per__dss_dsi1,
5617 6049 &omap44xx_l3_main_2__dss_dsi2,
5618 /* mcpdm class */ 6050 &omap44xx_l4_per__dss_dsi2,
5619 &omap44xx_mcpdm_hwmod, 6051 &omap44xx_l3_main_2__dss_hdmi,
5620 6052 &omap44xx_l4_per__dss_hdmi,
5621 /* mcspi class */ 6053 &omap44xx_l3_main_2__dss_rfbi,
5622 &omap44xx_mcspi1_hwmod, 6054 &omap44xx_l4_per__dss_rfbi,
5623 &omap44xx_mcspi2_hwmod, 6055 &omap44xx_l3_main_2__dss_venc,
5624 &omap44xx_mcspi3_hwmod, 6056 &omap44xx_l4_per__dss_venc,
5625 &omap44xx_mcspi4_hwmod, 6057 &omap44xx_l4_per__elm,
5626 6058 &omap44xx_emif_fw__emif1,
5627 /* mmc class */ 6059 &omap44xx_emif_fw__emif2,
5628 &omap44xx_mmc1_hwmod, 6060 &omap44xx_l4_cfg__fdif,
5629 &omap44xx_mmc2_hwmod, 6061 &omap44xx_l4_wkup__gpio1,
5630 &omap44xx_mmc3_hwmod, 6062 &omap44xx_l4_per__gpio2,
5631 &omap44xx_mmc4_hwmod, 6063 &omap44xx_l4_per__gpio3,
5632 &omap44xx_mmc5_hwmod, 6064 &omap44xx_l4_per__gpio4,
5633 6065 &omap44xx_l4_per__gpio5,
5634 /* mpu class */ 6066 &omap44xx_l4_per__gpio6,
5635 &omap44xx_mpu_hwmod, 6067 &omap44xx_l3_main_2__gpmc,
5636 6068 &omap44xx_l3_main_2__gpu,
5637 /* smartreflex class */ 6069 &omap44xx_l4_per__hdq1w,
5638 &omap44xx_smartreflex_core_hwmod, 6070 &omap44xx_l4_cfg__hsi,
5639 &omap44xx_smartreflex_iva_hwmod, 6071 &omap44xx_l4_per__i2c1,
5640 &omap44xx_smartreflex_mpu_hwmod, 6072 &omap44xx_l4_per__i2c2,
5641 6073 &omap44xx_l4_per__i2c3,
5642 /* spinlock class */ 6074 &omap44xx_l4_per__i2c4,
5643 &omap44xx_spinlock_hwmod, 6075 &omap44xx_l3_main_2__ipu,
5644 6076 &omap44xx_l3_main_2__iss,
5645 /* timer class */ 6077 &omap44xx_iva__sl2if,
5646 &omap44xx_timer1_hwmod, 6078 &omap44xx_l3_main_2__iva,
5647 &omap44xx_timer2_hwmod, 6079 &omap44xx_l4_wkup__kbd,
5648 &omap44xx_timer3_hwmod, 6080 &omap44xx_l4_cfg__mailbox,
5649 &omap44xx_timer4_hwmod, 6081 &omap44xx_l4_abe__mcasp,
5650 &omap44xx_timer5_hwmod, 6082 &omap44xx_l4_abe__mcasp_dma,
5651 &omap44xx_timer6_hwmod, 6083 &omap44xx_l4_abe__mcbsp1,
5652 &omap44xx_timer7_hwmod, 6084 &omap44xx_l4_abe__mcbsp1_dma,
5653 &omap44xx_timer8_hwmod, 6085 &omap44xx_l4_abe__mcbsp2,
5654 &omap44xx_timer9_hwmod, 6086 &omap44xx_l4_abe__mcbsp2_dma,
5655 &omap44xx_timer10_hwmod, 6087 &omap44xx_l4_abe__mcbsp3,
5656 &omap44xx_timer11_hwmod, 6088 &omap44xx_l4_abe__mcbsp3_dma,
5657 6089 &omap44xx_l4_per__mcbsp4,
5658 /* uart class */ 6090 &omap44xx_l4_abe__mcpdm,
5659 &omap44xx_uart1_hwmod, 6091 &omap44xx_l4_abe__mcpdm_dma,
5660 &omap44xx_uart2_hwmod, 6092 &omap44xx_l4_per__mcspi1,
5661 &omap44xx_uart3_hwmod, 6093 &omap44xx_l4_per__mcspi2,
5662 &omap44xx_uart4_hwmod, 6094 &omap44xx_l4_per__mcspi3,
5663 6095 &omap44xx_l4_per__mcspi4,
5664 /* usb host class */ 6096 &omap44xx_l4_per__mmc1,
5665 &omap44xx_usb_host_hs_hwmod, 6097 &omap44xx_l4_per__mmc2,
5666 &omap44xx_usb_tll_hs_hwmod, 6098 &omap44xx_l4_per__mmc3,
5667 6099 &omap44xx_l4_per__mmc4,
5668 /* usb_otg_hs class */ 6100 &omap44xx_l4_per__mmc5,
5669 &omap44xx_usb_otg_hs_hwmod, 6101 &omap44xx_l3_main_2__ocmc_ram,
5670 6102 &omap44xx_l4_cfg__ocp2scp_usb_phy,
5671 /* wd_timer class */ 6103 &omap44xx_mpu_private__prcm_mpu,
5672 &omap44xx_wd_timer2_hwmod, 6104 &omap44xx_l4_wkup__cm_core_aon,
5673 &omap44xx_wd_timer3_hwmod, 6105 &omap44xx_l4_cfg__cm_core,
6106 &omap44xx_l4_wkup__prm,
6107 &omap44xx_l4_wkup__scrm,
6108 &omap44xx_l3_main_2__sl2if,
6109 &omap44xx_l4_abe__slimbus1,
6110 &omap44xx_l4_abe__slimbus1_dma,
6111 &omap44xx_l4_per__slimbus2,
6112 &omap44xx_l4_cfg__smartreflex_core,
6113 &omap44xx_l4_cfg__smartreflex_iva,
6114 &omap44xx_l4_cfg__smartreflex_mpu,
6115 &omap44xx_l4_cfg__spinlock,
6116 &omap44xx_l4_wkup__timer1,
6117 &omap44xx_l4_per__timer2,
6118 &omap44xx_l4_per__timer3,
6119 &omap44xx_l4_per__timer4,
6120 &omap44xx_l4_abe__timer5,
6121 &omap44xx_l4_abe__timer5_dma,
6122 &omap44xx_l4_abe__timer6,
6123 &omap44xx_l4_abe__timer6_dma,
6124 &omap44xx_l4_abe__timer7,
6125 &omap44xx_l4_abe__timer7_dma,
6126 &omap44xx_l4_abe__timer8,
6127 &omap44xx_l4_abe__timer8_dma,
6128 &omap44xx_l4_per__timer9,
6129 &omap44xx_l4_per__timer10,
6130 &omap44xx_l4_per__timer11,
6131 &omap44xx_l4_per__uart1,
6132 &omap44xx_l4_per__uart2,
6133 &omap44xx_l4_per__uart3,
6134 &omap44xx_l4_per__uart4,
6135 &omap44xx_l4_cfg__usb_host_fs,
6136 &omap44xx_l4_cfg__usb_host_hs,
6137 &omap44xx_l4_cfg__usb_otg_hs,
6138 &omap44xx_l4_cfg__usb_tll_hs,
6139 &omap44xx_l4_wkup__wd_timer2,
6140 &omap44xx_l4_abe__wd_timer3,
6141 &omap44xx_l4_abe__wd_timer3_dma,
5674 NULL, 6142 NULL,
5675}; 6143};
5676 6144
5677int __init omap44xx_hwmod_init(void) 6145int __init omap44xx_hwmod_init(void)
5678{ 6146{
5679 return omap_hwmod_register(omap44xx_hwmods); 6147 return omap_hwmod_register_links(omap44xx_hwmod_ocp_ifs);
5680} 6148}
5681 6149
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.h b/arch/arm/mach-omap2/omap_hwmod_common_data.h
index ad5d8f04c0b8..e7e8eeae95e5 100644
--- a/arch/arm/mach-omap2/omap_hwmod_common_data.h
+++ b/arch/arm/mach-omap2/omap_hwmod_common_data.h
@@ -19,18 +19,6 @@
19#include "display.h" 19#include "display.h"
20 20
21/* Common address space across OMAP2xxx */ 21/* Common address space across OMAP2xxx */
22extern struct omap_hwmod_addr_space omap2xxx_uart1_addr_space[];
23extern struct omap_hwmod_addr_space omap2xxx_uart2_addr_space[];
24extern struct omap_hwmod_addr_space omap2xxx_uart3_addr_space[];
25extern struct omap_hwmod_addr_space omap2xxx_timer2_addrs[];
26extern struct omap_hwmod_addr_space omap2xxx_timer3_addrs[];
27extern struct omap_hwmod_addr_space omap2xxx_timer4_addrs[];
28extern struct omap_hwmod_addr_space omap2xxx_timer5_addrs[];
29extern struct omap_hwmod_addr_space omap2xxx_timer6_addrs[];
30extern struct omap_hwmod_addr_space omap2xxx_timer7_addrs[];
31extern struct omap_hwmod_addr_space omap2xxx_timer8_addrs[];
32extern struct omap_hwmod_addr_space omap2xxx_timer9_addrs[];
33extern struct omap_hwmod_addr_space omap2xxx_timer12_addrs[];
34extern struct omap_hwmod_addr_space omap2xxx_mcbsp2_addrs[]; 22extern struct omap_hwmod_addr_space omap2xxx_mcbsp2_addrs[];
35 23
36/* Common address space across OMAP2xxx/3xxx */ 24/* Common address space across OMAP2xxx/3xxx */
@@ -50,10 +38,70 @@ extern struct omap_hwmod_addr_space omap2430_mcspi3_addr_space[];
50extern struct omap_hwmod_addr_space omap2_dma_system_addrs[]; 38extern struct omap_hwmod_addr_space omap2_dma_system_addrs[];
51extern struct omap_hwmod_addr_space omap2_mailbox_addrs[]; 39extern struct omap_hwmod_addr_space omap2_mailbox_addrs[];
52extern struct omap_hwmod_addr_space omap2_mcbsp1_addrs[]; 40extern struct omap_hwmod_addr_space omap2_mcbsp1_addrs[];
41extern struct omap_hwmod_addr_space omap2_hdq1w_addr_space[];
53 42
54/* Common IP block data across OMAP2xxx */ 43/* Common IP block data across OMAP2xxx */
55extern struct omap_hwmod_irq_info omap2xxx_timer12_mpu_irqs[]; 44extern struct omap_hwmod_irq_info omap2xxx_timer12_mpu_irqs[];
56extern struct omap_hwmod_dma_info omap2xxx_dss_sdma_chs[]; 45extern struct omap_hwmod_dma_info omap2xxx_dss_sdma_chs[];
46extern struct omap_gpio_dev_attr omap2xxx_gpio_dev_attr;
47extern struct omap_hwmod omap2xxx_l3_main_hwmod;
48extern struct omap_hwmod omap2xxx_l4_core_hwmod;
49extern struct omap_hwmod omap2xxx_l4_wkup_hwmod;
50extern struct omap_hwmod omap2xxx_mpu_hwmod;
51extern struct omap_hwmod omap2xxx_iva_hwmod;
52extern struct omap_hwmod omap2xxx_timer1_hwmod;
53extern struct omap_hwmod omap2xxx_timer2_hwmod;
54extern struct omap_hwmod omap2xxx_timer3_hwmod;
55extern struct omap_hwmod omap2xxx_timer4_hwmod;
56extern struct omap_hwmod omap2xxx_timer5_hwmod;
57extern struct omap_hwmod omap2xxx_timer6_hwmod;
58extern struct omap_hwmod omap2xxx_timer7_hwmod;
59extern struct omap_hwmod omap2xxx_timer8_hwmod;
60extern struct omap_hwmod omap2xxx_timer9_hwmod;
61extern struct omap_hwmod omap2xxx_timer10_hwmod;
62extern struct omap_hwmod omap2xxx_timer11_hwmod;
63extern struct omap_hwmod omap2xxx_timer12_hwmod;
64extern struct omap_hwmod omap2xxx_wd_timer2_hwmod;
65extern struct omap_hwmod omap2xxx_uart1_hwmod;
66extern struct omap_hwmod omap2xxx_uart2_hwmod;
67extern struct omap_hwmod omap2xxx_uart3_hwmod;
68extern struct omap_hwmod omap2xxx_dss_core_hwmod;
69extern struct omap_hwmod omap2xxx_dss_dispc_hwmod;
70extern struct omap_hwmod omap2xxx_dss_rfbi_hwmod;
71extern struct omap_hwmod omap2xxx_dss_venc_hwmod;
72extern struct omap_hwmod omap2xxx_gpio1_hwmod;
73extern struct omap_hwmod omap2xxx_gpio2_hwmod;
74extern struct omap_hwmod omap2xxx_gpio3_hwmod;
75extern struct omap_hwmod omap2xxx_gpio4_hwmod;
76extern struct omap_hwmod omap2xxx_mcspi1_hwmod;
77extern struct omap_hwmod omap2xxx_mcspi2_hwmod;
78extern struct omap_hwmod omap2xxx_counter_32k_hwmod;
79
80/* Common interface data across OMAP2xxx */
81extern struct omap_hwmod_ocp_if omap2xxx_l3_main__l4_core;
82extern struct omap_hwmod_ocp_if omap2xxx_mpu__l3_main;
83extern struct omap_hwmod_ocp_if omap2xxx_dss__l3;
84extern struct omap_hwmod_ocp_if omap2xxx_l4_core__l4_wkup;
85extern struct omap_hwmod_ocp_if omap2_l4_core__uart1;
86extern struct omap_hwmod_ocp_if omap2_l4_core__uart2;
87extern struct omap_hwmod_ocp_if omap2_l4_core__uart3;
88extern struct omap_hwmod_ocp_if omap2xxx_l4_core__mcspi1;
89extern struct omap_hwmod_ocp_if omap2xxx_l4_core__mcspi2;
90extern struct omap_hwmod_ocp_if omap2xxx_l4_core__timer2;
91extern struct omap_hwmod_ocp_if omap2xxx_l4_core__timer3;
92extern struct omap_hwmod_ocp_if omap2xxx_l4_core__timer4;
93extern struct omap_hwmod_ocp_if omap2xxx_l4_core__timer5;
94extern struct omap_hwmod_ocp_if omap2xxx_l4_core__timer6;
95extern struct omap_hwmod_ocp_if omap2xxx_l4_core__timer7;
96extern struct omap_hwmod_ocp_if omap2xxx_l4_core__timer8;
97extern struct omap_hwmod_ocp_if omap2xxx_l4_core__timer9;
98extern struct omap_hwmod_ocp_if omap2xxx_l4_core__timer10;
99extern struct omap_hwmod_ocp_if omap2xxx_l4_core__timer11;
100extern struct omap_hwmod_ocp_if omap2xxx_l4_core__timer12;
101extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss;
102extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_dispc;
103extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_rfbi;
104extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_venc;
57 105
58/* Common IP block data */ 106/* Common IP block data */
59extern struct omap_hwmod_dma_info omap2_uart1_sdma_reqs[]; 107extern struct omap_hwmod_dma_info omap2_uart1_sdma_reqs[];
@@ -94,6 +142,8 @@ extern struct omap_hwmod_irq_info omap2_gpio4_irqs[];
94extern struct omap_hwmod_irq_info omap2_dma_system_irqs[]; 142extern struct omap_hwmod_irq_info omap2_dma_system_irqs[];
95extern struct omap_hwmod_irq_info omap2_mcspi1_mpu_irqs[]; 143extern struct omap_hwmod_irq_info omap2_mcspi1_mpu_irqs[];
96extern struct omap_hwmod_irq_info omap2_mcspi2_mpu_irqs[]; 144extern struct omap_hwmod_irq_info omap2_mcspi2_mpu_irqs[];
145extern struct omap_hwmod_addr_space omap2xxx_timer12_addrs[];
146extern struct omap_hwmod_irq_info omap2_hdq1w_mpu_irqs[];
97 147
98/* OMAP hwmod classes - forward declarations */ 148/* OMAP hwmod classes - forward declarations */
99extern struct omap_hwmod_class l3_hwmod_class; 149extern struct omap_hwmod_class l3_hwmod_class;
@@ -105,6 +155,8 @@ extern struct omap_hwmod_class omap2_dss_hwmod_class;
105extern struct omap_hwmod_class omap2_dispc_hwmod_class; 155extern struct omap_hwmod_class omap2_dispc_hwmod_class;
106extern struct omap_hwmod_class omap2_rfbi_hwmod_class; 156extern struct omap_hwmod_class omap2_rfbi_hwmod_class;
107extern struct omap_hwmod_class omap2_venc_hwmod_class; 157extern struct omap_hwmod_class omap2_venc_hwmod_class;
158extern struct omap_hwmod_class_sysconfig omap2_hdq1w_sysc;
159extern struct omap_hwmod_class omap2_hdq1w_class;
108 160
109extern struct omap_hwmod_class omap2xxx_timer_hwmod_class; 161extern struct omap_hwmod_class omap2xxx_timer_hwmod_class;
110extern struct omap_hwmod_class omap2xxx_wd_timer_hwmod_class; 162extern struct omap_hwmod_class omap2xxx_wd_timer_hwmod_class;
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 36fa90b6ece8..78564895e914 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -38,27 +38,6 @@ static inline int omap4_opp_init(void)
38} 38}
39#endif 39#endif
40 40
41/*
42 * cpuidle mach specific parameters
43 *
44 * The board code can override the default C-states definition using
45 * omap3_pm_init_cpuidle
46 */
47struct cpuidle_params {
48 u32 exit_latency; /* exit_latency = sleep + wake-up latencies */
49 u32 target_residency;
50 u8 valid; /* validates the C-state */
51};
52
53#if defined(CONFIG_PM) && defined(CONFIG_CPU_IDLE)
54extern void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params);
55#else
56static
57inline void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params)
58{
59}
60#endif
61
62extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm); 41extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm);
63extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state); 42extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
64 43
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index 95442b69ae27..facfffca9eac 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -171,8 +171,6 @@ static int omap2_allow_mpu_retention(void)
171 171
172static void omap2_enter_mpu_retention(void) 172static void omap2_enter_mpu_retention(void)
173{ 173{
174 int only_idle = 0;
175
176 /* Putting MPU into the WFI state while a transfer is active 174 /* Putting MPU into the WFI state while a transfer is active
177 * seems to cause the I2C block to timeout. Why? Good question. */ 175 * seems to cause the I2C block to timeout. Why? Good question. */
178 if (omap2_i2c_active()) 176 if (omap2_i2c_active())
@@ -195,7 +193,6 @@ static void omap2_enter_mpu_retention(void)
195 193
196 omap2_prm_write_mod_reg(OMAP_LOGICRETSTATE_MASK, MPU_MOD, 194 omap2_prm_write_mod_reg(OMAP_LOGICRETSTATE_MASK, MPU_MOD,
197 OMAP2_PM_PWSTCTRL); 195 OMAP2_PM_PWSTCTRL);
198 only_idle = 1;
199 } 196 }
200 197
201 omap2_sram_idle(); 198 omap2_sram_idle();
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 703bd1099259..8b43aefba0ea 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -273,7 +273,7 @@ void omap_sram_idle(void)
273 int per_next_state = PWRDM_POWER_ON; 273 int per_next_state = PWRDM_POWER_ON;
274 int core_next_state = PWRDM_POWER_ON; 274 int core_next_state = PWRDM_POWER_ON;
275 int per_going_off; 275 int per_going_off;
276 int core_prev_state, per_prev_state; 276 int core_prev_state;
277 u32 sdrc_pwr = 0; 277 u32 sdrc_pwr = 0;
278 278
279 mpu_next_state = pwrdm_read_next_pwrst(mpu_pwrdm); 279 mpu_next_state = pwrdm_read_next_pwrst(mpu_pwrdm);
@@ -375,10 +375,8 @@ void omap_sram_idle(void)
375 pwrdm_post_transition(); 375 pwrdm_post_transition();
376 376
377 /* PER */ 377 /* PER */
378 if (per_next_state < PWRDM_POWER_ON) { 378 if (per_next_state < PWRDM_POWER_ON)
379 per_prev_state = pwrdm_read_prev_pwrst(per_pwrdm);
380 omap2_gpio_resume_after_idle(); 379 omap2_gpio_resume_after_idle();
381 }
382 380
383 /* Disable IO-PAD and IO-CHAIN wakeup */ 381 /* Disable IO-PAD and IO-CHAIN wakeup */
384 if (omap3_has_io_wakeup() && 382 if (omap3_has_io_wakeup() &&
@@ -702,7 +700,7 @@ static void __init pm_errata_configure(void)
702static int __init omap3_pm_init(void) 700static int __init omap3_pm_init(void)
703{ 701{
704 struct power_state *pwrst, *tmp; 702 struct power_state *pwrst, *tmp;
705 struct clockdomain *neon_clkdm, *per_clkdm, *mpu_clkdm, *core_clkdm; 703 struct clockdomain *neon_clkdm, *mpu_clkdm;
706 int ret; 704 int ret;
707 705
708 if (!cpu_is_omap34xx()) 706 if (!cpu_is_omap34xx())
@@ -757,8 +755,6 @@ static int __init omap3_pm_init(void)
757 755
758 neon_clkdm = clkdm_lookup("neon_clkdm"); 756 neon_clkdm = clkdm_lookup("neon_clkdm");
759 mpu_clkdm = clkdm_lookup("mpu_clkdm"); 757 mpu_clkdm = clkdm_lookup("mpu_clkdm");
760 per_clkdm = clkdm_lookup("per_clkdm");
761 core_clkdm = clkdm_lookup("core_clkdm");
762 758
763#ifdef CONFIG_SUSPEND 759#ifdef CONFIG_SUSPEND
764 omap_pm_suspend = omap3_pm_suspend; 760 omap_pm_suspend = omap3_pm_suspend;
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 96ad3dbeac34..96114901b932 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -981,16 +981,6 @@ int pwrdm_state_switch(struct powerdomain *pwrdm)
981 return ret; 981 return ret;
982} 982}
983 983
984int pwrdm_clkdm_state_switch(struct clockdomain *clkdm)
985{
986 if (clkdm != NULL && clkdm->pwrdm.ptr != NULL) {
987 pwrdm_wait_transition(clkdm->pwrdm.ptr);
988 return pwrdm_state_switch(clkdm->pwrdm.ptr);
989 }
990
991 return -EINVAL;
992}
993
994int pwrdm_pre_transition(void) 984int pwrdm_pre_transition(void)
995{ 985{
996 pwrdm_for_each(_pwrdm_pre_transition_cb, NULL); 986 pwrdm_for_each(_pwrdm_pre_transition_cb, NULL);
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index 0d72a8a8ce4d..8f88d65c46ea 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -213,7 +213,6 @@ bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm);
213int pwrdm_wait_transition(struct powerdomain *pwrdm); 213int pwrdm_wait_transition(struct powerdomain *pwrdm);
214 214
215int pwrdm_state_switch(struct powerdomain *pwrdm); 215int pwrdm_state_switch(struct powerdomain *pwrdm);
216int pwrdm_clkdm_state_switch(struct clockdomain *clkdm);
217int pwrdm_pre_transition(void); 216int pwrdm_pre_transition(void);
218int pwrdm_post_transition(void); 217int pwrdm_post_transition(void);
219int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm); 218int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm);
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index 5aa5435e3ff1..6da3ba483ad1 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -177,6 +177,8 @@
177/* PM_WKST_WKUP, CM_IDLEST_WKUP shared bits */ 177/* PM_WKST_WKUP, CM_IDLEST_WKUP shared bits */
178#define OMAP24XX_ST_GPIOS_SHIFT 2 178#define OMAP24XX_ST_GPIOS_SHIFT 2
179#define OMAP24XX_ST_GPIOS_MASK (1 << 2) 179#define OMAP24XX_ST_GPIOS_MASK (1 << 2)
180#define OMAP24XX_ST_32KSYNC_SHIFT 1
181#define OMAP24XX_ST_32KSYNC_MASK (1 << 1)
180#define OMAP24XX_ST_GPT1_SHIFT 0 182#define OMAP24XX_ST_GPT1_SHIFT 0
181#define OMAP24XX_ST_GPT1_MASK (1 << 0) 183#define OMAP24XX_ST_GPT1_MASK (1 << 0)
182 184
@@ -307,6 +309,8 @@
307#define OMAP3430_ST_SR1_MASK (1 << 6) 309#define OMAP3430_ST_SR1_MASK (1 << 6)
308#define OMAP3430_ST_GPIO1_SHIFT 3 310#define OMAP3430_ST_GPIO1_SHIFT 3
309#define OMAP3430_ST_GPIO1_MASK (1 << 3) 311#define OMAP3430_ST_GPIO1_MASK (1 << 3)
312#define OMAP3430_ST_32KSYNC_SHIFT 2
313#define OMAP3430_ST_32KSYNC_MASK (1 << 2)
310#define OMAP3430_ST_GPT12_SHIFT 1 314#define OMAP3430_ST_GPT12_SHIFT 1
311#define OMAP3430_ST_GPT12_MASK (1 << 1) 315#define OMAP3430_ST_GPT12_MASK (1 << 1)
312#define OMAP3430_ST_GPT1_SHIFT 0 316#define OMAP3430_ST_GPT1_SHIFT 0
@@ -410,6 +414,19 @@
410extern void __iomem *prm_base; 414extern void __iomem *prm_base;
411extern void __iomem *cm_base; 415extern void __iomem *cm_base;
412extern void __iomem *cm2_base; 416extern void __iomem *cm2_base;
417extern void __iomem *prcm_mpu_base;
418
419#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_ARCH_OMAP5)
420extern void omap_prm_base_init(void);
421extern void omap_cm_base_init(void);
422#else
423static inline void omap_prm_base_init(void)
424{
425}
426static inline void omap_cm_base_init(void)
427{
428}
429#endif
413 430
414/** 431/**
415 * struct omap_prcm_irq - describes a PRCM interrupt bit 432 * struct omap_prcm_irq - describes a PRCM interrupt bit
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index 626acfad7190..480f40a5ee42 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -42,6 +42,7 @@
42void __iomem *prm_base; 42void __iomem *prm_base;
43void __iomem *cm_base; 43void __iomem *cm_base;
44void __iomem *cm2_base; 44void __iomem *cm2_base;
45void __iomem *prcm_mpu_base;
45 46
46#define MAX_MODULE_ENABLE_WAIT 100000 47#define MAX_MODULE_ENABLE_WAIT 100000
47 48
@@ -155,4 +156,11 @@ void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
155 cm_base = omap2_globals->cm; 156 cm_base = omap2_globals->cm;
156 if (omap2_globals->cm2) 157 if (omap2_globals->cm2)
157 cm2_base = omap2_globals->cm2; 158 cm2_base = omap2_globals->cm2;
159 if (omap2_globals->prcm_mpu)
160 prcm_mpu_base = omap2_globals->prcm_mpu;
161
162 if (cpu_is_omap44xx()) {
163 omap_prm_base_init();
164 omap_cm_base_init();
165 }
158} 166}
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index d28f848897d6..dfe00ddb5c60 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -237,7 +237,7 @@ void omap_prcm_irq_complete(void)
237 */ 237 */
238int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup) 238int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
239{ 239{
240 int nr_regs = irq_setup->nr_regs; 240 int nr_regs;
241 u32 mask[OMAP_PRCM_MAX_NR_PENDING_REG]; 241 u32 mask[OMAP_PRCM_MAX_NR_PENDING_REG];
242 int offset, i; 242 int offset, i;
243 struct irq_chip_generic *gc; 243 struct irq_chip_generic *gc;
@@ -246,6 +246,8 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
246 if (!irq_setup) 246 if (!irq_setup)
247 return -EINVAL; 247 return -EINVAL;
248 248
249 nr_regs = irq_setup->nr_regs;
250
249 if (prcm_irq_setup) { 251 if (prcm_irq_setup) {
250 pr_err("PRCM: already initialized; won't reinitialize\n"); 252 pr_err("PRCM: already initialized; won't reinitialize\n");
251 return -EINVAL; 253 return -EINVAL;
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c
index 9b3898a3ac9b..c12320c0ae95 100644
--- a/arch/arm/mach-omap2/prminst44xx.c
+++ b/arch/arm/mach-omap2/prminst44xx.c
@@ -18,20 +18,26 @@
18 18
19#include "iomap.h" 19#include "iomap.h"
20#include "common.h" 20#include "common.h"
21#include "prcm-common.h"
21#include "prm44xx.h" 22#include "prm44xx.h"
22#include "prminst44xx.h" 23#include "prminst44xx.h"
23#include "prm-regbits-44xx.h" 24#include "prm-regbits-44xx.h"
24#include "prcm44xx.h" 25#include "prcm44xx.h"
25#include "prcm_mpu44xx.h" 26#include "prcm_mpu44xx.h"
26 27
27static u32 _prm_bases[OMAP4_MAX_PRCM_PARTITIONS] = { 28static void __iomem *_prm_bases[OMAP4_MAX_PRCM_PARTITIONS];
28 [OMAP4430_INVALID_PRCM_PARTITION] = 0, 29
29 [OMAP4430_PRM_PARTITION] = OMAP4430_PRM_BASE, 30/**
30 [OMAP4430_CM1_PARTITION] = 0, 31 * omap_prm_base_init - Populates the prm partitions
31 [OMAP4430_CM2_PARTITION] = 0, 32 *
32 [OMAP4430_SCRM_PARTITION] = 0, 33 * Populates the base addresses of the _prm_bases
33 [OMAP4430_PRCM_MPU_PARTITION] = OMAP4430_PRCM_MPU_BASE, 34 * array used for read/write of prm module registers.
34}; 35 */
36void omap_prm_base_init(void)
37{
38 _prm_bases[OMAP4430_PRM_PARTITION] = prm_base;
39 _prm_bases[OMAP4430_PRCM_MPU_PARTITION] = prcm_mpu_base;
40}
35 41
36/* Read a register in a PRM instance */ 42/* Read a register in a PRM instance */
37u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx) 43u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx)
@@ -39,8 +45,7 @@ u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx)
39 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || 45 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
40 part == OMAP4430_INVALID_PRCM_PARTITION || 46 part == OMAP4430_INVALID_PRCM_PARTITION ||
41 !_prm_bases[part]); 47 !_prm_bases[part]);
42 return __raw_readl(OMAP2_L4_IO_ADDRESS(_prm_bases[part] + inst + 48 return __raw_readl(_prm_bases[part] + inst + idx);
43 idx));
44} 49}
45 50
46/* Write into a register in a PRM instance */ 51/* Write into a register in a PRM instance */
@@ -49,7 +54,7 @@ void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx)
49 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || 54 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
50 part == OMAP4430_INVALID_PRCM_PARTITION || 55 part == OMAP4430_INVALID_PRCM_PARTITION ||
51 !_prm_bases[part]); 56 !_prm_bases[part]);
52 __raw_writel(val, OMAP2_L4_IO_ADDRESS(_prm_bases[part] + inst + idx)); 57 __raw_writel(val, _prm_bases[part] + inst + idx);
53} 58}
54 59
55/* Read-modify-write a register in PRM. Caller must lock */ 60/* Read-modify-write a register in PRM. Caller must lock */
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 0cdd359a128e..292d4aaca068 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -108,8 +108,14 @@ static void omap_uart_set_noidle(struct platform_device *pdev)
108static void omap_uart_set_smartidle(struct platform_device *pdev) 108static void omap_uart_set_smartidle(struct platform_device *pdev)
109{ 109{
110 struct omap_device *od = to_omap_device(pdev); 110 struct omap_device *od = to_omap_device(pdev);
111 u8 idlemode;
111 112
112 omap_hwmod_set_slave_idlemode(od->hwmods[0], HWMOD_IDLEMODE_SMART); 113 if (od->hwmods[0]->class->sysc->idlemodes & SIDLE_SMART_WKUP)
114 idlemode = HWMOD_IDLEMODE_SMART_WKUP;
115 else
116 idlemode = HWMOD_IDLEMODE_SMART;
117
118 omap_hwmod_set_slave_idlemode(od->hwmods[0], idlemode);
113} 119}
114 120
115#else 121#else
@@ -120,130 +126,14 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {}
120#endif /* CONFIG_PM */ 126#endif /* CONFIG_PM */
121 127
122#ifdef CONFIG_OMAP_MUX 128#ifdef CONFIG_OMAP_MUX
123static struct omap_device_pad default_uart1_pads[] __initdata = {
124 {
125 .name = "uart1_cts.uart1_cts",
126 .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
127 },
128 {
129 .name = "uart1_rts.uart1_rts",
130 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
131 },
132 {
133 .name = "uart1_tx.uart1_tx",
134 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
135 },
136 {
137 .name = "uart1_rx.uart1_rx",
138 .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
139 .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
140 .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
141 },
142};
143
144static struct omap_device_pad default_uart2_pads[] __initdata = {
145 {
146 .name = "uart2_cts.uart2_cts",
147 .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
148 },
149 {
150 .name = "uart2_rts.uart2_rts",
151 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
152 },
153 {
154 .name = "uart2_tx.uart2_tx",
155 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
156 },
157 {
158 .name = "uart2_rx.uart2_rx",
159 .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
160 .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
161 .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
162 },
163};
164
165static struct omap_device_pad default_uart3_pads[] __initdata = {
166 {
167 .name = "uart3_cts_rctx.uart3_cts_rctx",
168 .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
169 },
170 {
171 .name = "uart3_rts_sd.uart3_rts_sd",
172 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
173 },
174 {
175 .name = "uart3_tx_irtx.uart3_tx_irtx",
176 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
177 },
178 {
179 .name = "uart3_rx_irrx.uart3_rx_irrx",
180 .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
181 .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0,
182 .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0,
183 },
184};
185
186static struct omap_device_pad default_omap36xx_uart4_pads[] __initdata = {
187 {
188 .name = "gpmc_wait2.uart4_tx",
189 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
190 },
191 {
192 .name = "gpmc_wait3.uart4_rx",
193 .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
194 .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE2,
195 .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE2,
196 },
197};
198
199static struct omap_device_pad default_omap4_uart4_pads[] __initdata = {
200 {
201 .name = "uart4_tx.uart4_tx",
202 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
203 },
204 {
205 .name = "uart4_rx.uart4_rx",
206 .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
207 .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0,
208 .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0,
209 },
210};
211
212static void omap_serial_fill_default_pads(struct omap_board_data *bdata) 129static void omap_serial_fill_default_pads(struct omap_board_data *bdata)
213{ 130{
214 switch (bdata->id) {
215 case 0:
216 bdata->pads = default_uart1_pads;
217 bdata->pads_cnt = ARRAY_SIZE(default_uart1_pads);
218 break;
219 case 1:
220 bdata->pads = default_uart2_pads;
221 bdata->pads_cnt = ARRAY_SIZE(default_uart2_pads);
222 break;
223 case 2:
224 bdata->pads = default_uart3_pads;
225 bdata->pads_cnt = ARRAY_SIZE(default_uart3_pads);
226 break;
227 case 3:
228 if (cpu_is_omap44xx()) {
229 bdata->pads = default_omap4_uart4_pads;
230 bdata->pads_cnt =
231 ARRAY_SIZE(default_omap4_uart4_pads);
232 } else if (cpu_is_omap3630()) {
233 bdata->pads = default_omap36xx_uart4_pads;
234 bdata->pads_cnt =
235 ARRAY_SIZE(default_omap36xx_uart4_pads);
236 }
237 break;
238 default:
239 break;
240 }
241} 131}
242#else 132#else
243static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} 133static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {}
244#endif 134#endif
245 135
246char *cmdline_find_option(char *str) 136static char *cmdline_find_option(char *str)
247{ 137{
248 extern char *saved_command_line; 138 extern char *saved_command_line;
249 139
@@ -355,14 +245,6 @@ void __init omap_serial_init_port(struct omap_board_data *bdata,
355 omap_up.dma_rx_poll_rate = info->dma_rx_poll_rate; 245 omap_up.dma_rx_poll_rate = info->dma_rx_poll_rate;
356 omap_up.autosuspend_timeout = info->autosuspend_timeout; 246 omap_up.autosuspend_timeout = info->autosuspend_timeout;
357 247
358 /* Enable the MDR1 Errata i202 for OMAP2430/3xxx/44xx */
359 if (!cpu_is_omap2420() && !cpu_is_ti816x())
360 omap_up.errata |= UART_ERRATA_i202_MDR1_ACCESS;
361
362 /* Enable DMA Mode Force Idle Errata i291 for omap34xx/3630 */
363 if (cpu_is_omap34xx() || cpu_is_omap3630())
364 omap_up.errata |= UART_ERRATA_i291_DMA_FORCEIDLE;
365
366 pdata = &omap_up; 248 pdata = &omap_up;
367 pdata_size = sizeof(struct omap_uart_port_info); 249 pdata_size = sizeof(struct omap_uart_port_info);
368 250
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index c512bac69ec5..1b7835865c83 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -145,8 +145,10 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
145{ 145{
146 char name[10]; /* 10 = sizeof("gptXX_Xck0") */ 146 char name[10]; /* 10 = sizeof("gptXX_Xck0") */
147 struct omap_hwmod *oh; 147 struct omap_hwmod *oh;
148 struct resource irq_rsrc, mem_rsrc;
148 size_t size; 149 size_t size;
149 int res = 0; 150 int res = 0;
151 int r;
150 152
151 sprintf(name, "timer%d", gptimer_id); 153 sprintf(name, "timer%d", gptimer_id);
152 omap_hwmod_setup_one(name); 154 omap_hwmod_setup_one(name);
@@ -154,9 +156,16 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
154 if (!oh) 156 if (!oh)
155 return -ENODEV; 157 return -ENODEV;
156 158
157 timer->irq = oh->mpu_irqs[0].irq; 159 r = omap_hwmod_get_resource_byname(oh, IORESOURCE_IRQ, NULL, &irq_rsrc);
158 timer->phys_base = oh->slaves[0]->addr->pa_start; 160 if (r)
159 size = oh->slaves[0]->addr->pa_end - timer->phys_base; 161 return -ENXIO;
162 timer->irq = irq_rsrc.start;
163
164 r = omap_hwmod_get_resource_byname(oh, IORESOURCE_MEM, NULL, &mem_rsrc);
165 if (r)
166 return -ENXIO;
167 timer->phys_base = mem_rsrc.start;
168 size = mem_rsrc.end - mem_rsrc.start;
160 169
161 /* Static mapping, never released */ 170 /* Static mapping, never released */
162 timer->io_base = ioremap(timer->phys_base, size); 171 timer->io_base = ioremap(timer->phys_base, size);
@@ -169,13 +178,6 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
169 if (IS_ERR(timer->fclk)) 178 if (IS_ERR(timer->fclk))
170 return -ENODEV; 179 return -ENODEV;
171 180
172 sprintf(name, "gpt%d_ick", gptimer_id);
173 timer->iclk = clk_get(NULL, name);
174 if (IS_ERR(timer->iclk)) {
175 clk_put(timer->fclk);
176 return -ENODEV;
177 }
178
179 omap_hwmod_enable(oh); 181 omap_hwmod_enable(oh);
180 182
181 sys_timer_reserved |= (1 << (gptimer_id - 1)); 183 sys_timer_reserved |= (1 << (gptimer_id - 1));
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 4b57757bf9d1..119d5a910f3a 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -31,12 +31,35 @@
31 31
32#include "twl-common.h" 32#include "twl-common.h"
33#include "pm.h" 33#include "pm.h"
34#include "voltage.h"
34 35
35static struct i2c_board_info __initdata pmic_i2c_board_info = { 36static struct i2c_board_info __initdata pmic_i2c_board_info = {
36 .addr = 0x48, 37 .addr = 0x48,
37 .flags = I2C_CLIENT_WAKE, 38 .flags = I2C_CLIENT_WAKE,
38}; 39};
39 40
41static struct i2c_board_info __initdata omap4_i2c1_board_info[] = {
42 {
43 .addr = 0x48,
44 .flags = I2C_CLIENT_WAKE,
45 },
46 {
47 I2C_BOARD_INFO("twl6040", 0x4b),
48 },
49};
50
51static int twl_set_voltage(void *data, int target_uV)
52{
53 struct voltagedomain *voltdm = (struct voltagedomain *)data;
54 return voltdm_scale(voltdm, target_uV);
55}
56
57static int twl_get_voltage(void *data)
58{
59 struct voltagedomain *voltdm = (struct voltagedomain *)data;
60 return voltdm_get_voltage(voltdm);
61}
62
40void __init omap_pmic_init(int bus, u32 clkrate, 63void __init omap_pmic_init(int bus, u32 clkrate,
41 const char *pmic_type, int pmic_irq, 64 const char *pmic_type, int pmic_irq,
42 struct twl4030_platform_data *pmic_data) 65 struct twl4030_platform_data *pmic_data)
@@ -49,14 +72,31 @@ void __init omap_pmic_init(int bus, u32 clkrate,
49 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); 72 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
50} 73}
51 74
75void __init omap4_pmic_init(const char *pmic_type,
76 struct twl4030_platform_data *pmic_data,
77 struct twl6040_platform_data *twl6040_data, int twl6040_irq)
78{
79 /* PMIC part*/
80 strncpy(omap4_i2c1_board_info[0].type, pmic_type,
81 sizeof(omap4_i2c1_board_info[0].type));
82 omap4_i2c1_board_info[0].irq = OMAP44XX_IRQ_SYS_1N;
83 omap4_i2c1_board_info[0].platform_data = pmic_data;
84
85 /* TWL6040 audio IC part */
86 omap4_i2c1_board_info[1].irq = twl6040_irq;
87 omap4_i2c1_board_info[1].platform_data = twl6040_data;
88
89 omap_register_i2c_bus(1, 400, omap4_i2c1_board_info, 2);
90
91}
92
52void __init omap_pmic_late_init(void) 93void __init omap_pmic_late_init(void)
53{ 94{
54 /* Init the OMAP TWL parameters (if PMIC has been registerd) */ 95 /* Init the OMAP TWL parameters (if PMIC has been registerd) */
55 if (!pmic_i2c_board_info.irq) 96 if (pmic_i2c_board_info.irq)
56 return; 97 omap3_twl_init();
57 98 if (omap4_i2c1_board_info[0].irq)
58 omap3_twl_init(); 99 omap4_twl_init();
59 omap4_twl_init();
60} 100}
61 101
62#if defined(CONFIG_ARCH_OMAP3) 102#if defined(CONFIG_ARCH_OMAP3)
@@ -126,6 +166,48 @@ static struct regulator_init_data omap3_vpll2_idata = {
126 .consumer_supplies = omap3_vpll2_supplies, 166 .consumer_supplies = omap3_vpll2_supplies,
127}; 167};
128 168
169static struct regulator_consumer_supply omap3_vdd1_supply[] = {
170 REGULATOR_SUPPLY("vcc", "mpu.0"),
171};
172
173static struct regulator_consumer_supply omap3_vdd2_supply[] = {
174 REGULATOR_SUPPLY("vcc", "l3_main.0"),
175};
176
177static struct regulator_init_data omap3_vdd1 = {
178 .constraints = {
179 .name = "vdd_mpu_iva",
180 .min_uV = 600000,
181 .max_uV = 1450000,
182 .valid_modes_mask = REGULATOR_MODE_NORMAL,
183 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
184 },
185 .num_consumer_supplies = ARRAY_SIZE(omap3_vdd1_supply),
186 .consumer_supplies = omap3_vdd1_supply,
187};
188
189static struct regulator_init_data omap3_vdd2 = {
190 .constraints = {
191 .name = "vdd_core",
192 .min_uV = 600000,
193 .max_uV = 1450000,
194 .valid_modes_mask = REGULATOR_MODE_NORMAL,
195 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
196 },
197 .num_consumer_supplies = ARRAY_SIZE(omap3_vdd2_supply),
198 .consumer_supplies = omap3_vdd2_supply,
199};
200
201static struct twl_regulator_driver_data omap3_vdd1_drvdata = {
202 .get_voltage = twl_get_voltage,
203 .set_voltage = twl_set_voltage,
204};
205
206static struct twl_regulator_driver_data omap3_vdd2_drvdata = {
207 .get_voltage = twl_get_voltage,
208 .set_voltage = twl_set_voltage,
209};
210
129void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, 211void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
130 u32 pdata_flags, u32 regulators_flags) 212 u32 pdata_flags, u32 regulators_flags)
131{ 213{
@@ -133,6 +215,16 @@ void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
133 pmic_data->irq_base = TWL4030_IRQ_BASE; 215 pmic_data->irq_base = TWL4030_IRQ_BASE;
134 if (!pmic_data->irq_end) 216 if (!pmic_data->irq_end)
135 pmic_data->irq_end = TWL4030_IRQ_END; 217 pmic_data->irq_end = TWL4030_IRQ_END;
218 if (!pmic_data->vdd1) {
219 omap3_vdd1.driver_data = &omap3_vdd1_drvdata;
220 omap3_vdd1_drvdata.data = voltdm_lookup("mpu_iva");
221 pmic_data->vdd1 = &omap3_vdd1;
222 }
223 if (!pmic_data->vdd2) {
224 omap3_vdd2.driver_data = &omap3_vdd2_drvdata;
225 omap3_vdd2_drvdata.data = voltdm_lookup("core");
226 pmic_data->vdd2 = &omap3_vdd2;
227 }
136 228
137 /* Common platform data configurations */ 229 /* Common platform data configurations */
138 if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb) 230 if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
@@ -174,6 +266,7 @@ static struct regulator_init_data omap4_vdac_idata = {
174 .valid_ops_mask = REGULATOR_CHANGE_MODE 266 .valid_ops_mask = REGULATOR_CHANGE_MODE
175 | REGULATOR_CHANGE_STATUS, 267 | REGULATOR_CHANGE_STATUS,
176 }, 268 },
269 .supply_regulator = "V2V1",
177}; 270};
178 271
179static struct regulator_init_data omap4_vaux2_idata = { 272static struct regulator_init_data omap4_vaux2_idata = {
@@ -264,6 +357,7 @@ static struct regulator_init_data omap4_vcxio_idata = {
264 }, 357 },
265 .num_consumer_supplies = ARRAY_SIZE(omap4_vcxio_supply), 358 .num_consumer_supplies = ARRAY_SIZE(omap4_vcxio_supply),
266 .consumer_supplies = omap4_vcxio_supply, 359 .consumer_supplies = omap4_vcxio_supply,
360 .supply_regulator = "V2V1",
267}; 361};
268 362
269static struct regulator_init_data omap4_vusb_idata = { 363static struct regulator_init_data omap4_vusb_idata = {
@@ -283,6 +377,105 @@ static struct regulator_init_data omap4_clk32kg_idata = {
283 }, 377 },
284}; 378};
285 379
380static struct regulator_consumer_supply omap4_vdd1_supply[] = {
381 REGULATOR_SUPPLY("vcc", "mpu.0"),
382};
383
384static struct regulator_consumer_supply omap4_vdd2_supply[] = {
385 REGULATOR_SUPPLY("vcc", "iva.0"),
386};
387
388static struct regulator_consumer_supply omap4_vdd3_supply[] = {
389 REGULATOR_SUPPLY("vcc", "l3_main.0"),
390};
391
392static struct regulator_init_data omap4_vdd1 = {
393 .constraints = {
394 .name = "vdd_mpu",
395 .min_uV = 500000,
396 .max_uV = 1500000,
397 .valid_modes_mask = REGULATOR_MODE_NORMAL,
398 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
399 },
400 .num_consumer_supplies = ARRAY_SIZE(omap4_vdd1_supply),
401 .consumer_supplies = omap4_vdd1_supply,
402};
403
404static struct regulator_init_data omap4_vdd2 = {
405 .constraints = {
406 .name = "vdd_iva",
407 .min_uV = 500000,
408 .max_uV = 1500000,
409 .valid_modes_mask = REGULATOR_MODE_NORMAL,
410 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
411 },
412 .num_consumer_supplies = ARRAY_SIZE(omap4_vdd2_supply),
413 .consumer_supplies = omap4_vdd2_supply,
414};
415
416static struct regulator_init_data omap4_vdd3 = {
417 .constraints = {
418 .name = "vdd_core",
419 .min_uV = 500000,
420 .max_uV = 1500000,
421 .valid_modes_mask = REGULATOR_MODE_NORMAL,
422 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
423 },
424 .num_consumer_supplies = ARRAY_SIZE(omap4_vdd3_supply),
425 .consumer_supplies = omap4_vdd3_supply,
426};
427
428
429static struct twl_regulator_driver_data omap4_vdd1_drvdata = {
430 .get_voltage = twl_get_voltage,
431 .set_voltage = twl_set_voltage,
432};
433
434static struct twl_regulator_driver_data omap4_vdd2_drvdata = {
435 .get_voltage = twl_get_voltage,
436 .set_voltage = twl_set_voltage,
437};
438
439static struct twl_regulator_driver_data omap4_vdd3_drvdata = {
440 .get_voltage = twl_get_voltage,
441 .set_voltage = twl_set_voltage,
442};
443
444static struct regulator_consumer_supply omap4_v1v8_supply[] = {
445 REGULATOR_SUPPLY("vio", "1-004b"),
446};
447
448static struct regulator_init_data omap4_v1v8_idata = {
449 .constraints = {
450 .min_uV = 1800000,
451 .max_uV = 1800000,
452 .valid_modes_mask = REGULATOR_MODE_NORMAL
453 | REGULATOR_MODE_STANDBY,
454 .valid_ops_mask = REGULATOR_CHANGE_MODE
455 | REGULATOR_CHANGE_STATUS,
456 .always_on = true,
457 },
458 .num_consumer_supplies = ARRAY_SIZE(omap4_v1v8_supply),
459 .consumer_supplies = omap4_v1v8_supply,
460};
461
462static struct regulator_consumer_supply omap4_v2v1_supply[] = {
463 REGULATOR_SUPPLY("v2v1", "1-004b"),
464};
465
466static struct regulator_init_data omap4_v2v1_idata = {
467 .constraints = {
468 .min_uV = 2100000,
469 .max_uV = 2100000,
470 .valid_modes_mask = REGULATOR_MODE_NORMAL
471 | REGULATOR_MODE_STANDBY,
472 .valid_ops_mask = REGULATOR_CHANGE_MODE
473 | REGULATOR_CHANGE_STATUS,
474 },
475 .num_consumer_supplies = ARRAY_SIZE(omap4_v2v1_supply),
476 .consumer_supplies = omap4_v2v1_supply,
477};
478
286void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data, 479void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
287 u32 pdata_flags, u32 regulators_flags) 480 u32 pdata_flags, u32 regulators_flags)
288{ 481{
@@ -291,6 +484,24 @@ void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
291 if (!pmic_data->irq_end) 484 if (!pmic_data->irq_end)
292 pmic_data->irq_end = TWL6030_IRQ_END; 485 pmic_data->irq_end = TWL6030_IRQ_END;
293 486
487 if (!pmic_data->vdd1) {
488 omap4_vdd1.driver_data = &omap4_vdd1_drvdata;
489 omap4_vdd1_drvdata.data = voltdm_lookup("mpu");
490 pmic_data->vdd1 = &omap4_vdd1;
491 }
492
493 if (!pmic_data->vdd2) {
494 omap4_vdd2.driver_data = &omap4_vdd2_drvdata;
495 omap4_vdd2_drvdata.data = voltdm_lookup("iva");
496 pmic_data->vdd2 = &omap4_vdd2;
497 }
498
499 if (!pmic_data->vdd3) {
500 omap4_vdd3.driver_data = &omap4_vdd3_drvdata;
501 omap4_vdd3_drvdata.data = voltdm_lookup("core");
502 pmic_data->vdd3 = &omap4_vdd3;
503 }
504
294 /* Common platform data configurations */ 505 /* Common platform data configurations */
295 if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb) 506 if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
296 pmic_data->usb = &omap4_usb_pdata; 507 pmic_data->usb = &omap4_usb_pdata;
@@ -323,5 +534,11 @@ void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
323 if (regulators_flags & TWL_COMMON_REGULATOR_CLK32KG && 534 if (regulators_flags & TWL_COMMON_REGULATOR_CLK32KG &&
324 !pmic_data->clk32kg) 535 !pmic_data->clk32kg)
325 pmic_data->clk32kg = &omap4_clk32kg_idata; 536 pmic_data->clk32kg = &omap4_clk32kg_idata;
537
538 if (regulators_flags & TWL_COMMON_REGULATOR_V1V8 && !pmic_data->v1v8)
539 pmic_data->v1v8 = &omap4_v1v8_idata;
540
541 if (regulators_flags & TWL_COMMON_REGULATOR_V2V1 && !pmic_data->v2v1)
542 pmic_data->v2v1 = &omap4_v2v1_idata;
326} 543}
327#endif /* CONFIG_ARCH_OMAP4 */ 544#endif /* CONFIG_ARCH_OMAP4 */
diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h
index 275dde8cb27a..8fe71cfd002c 100644
--- a/arch/arm/mach-omap2/twl-common.h
+++ b/arch/arm/mach-omap2/twl-common.h
@@ -22,6 +22,8 @@
22#define TWL_COMMON_REGULATOR_VCXIO (1 << 8) 22#define TWL_COMMON_REGULATOR_VCXIO (1 << 8)
23#define TWL_COMMON_REGULATOR_VUSB (1 << 9) 23#define TWL_COMMON_REGULATOR_VUSB (1 << 9)
24#define TWL_COMMON_REGULATOR_CLK32KG (1 << 10) 24#define TWL_COMMON_REGULATOR_CLK32KG (1 << 10)
25#define TWL_COMMON_REGULATOR_V1V8 (1 << 11)
26#define TWL_COMMON_REGULATOR_V2V1 (1 << 12)
25 27
26/* TWL4030 LDO regulators */ 28/* TWL4030 LDO regulators */
27#define TWL_COMMON_REGULATOR_VPLL1 (1 << 4) 29#define TWL_COMMON_REGULATOR_VPLL1 (1 << 4)
@@ -29,6 +31,7 @@
29 31
30 32
31struct twl4030_platform_data; 33struct twl4030_platform_data;
34struct twl6040_platform_data;
32 35
33void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, 36void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq,
34 struct twl4030_platform_data *pmic_data); 37 struct twl4030_platform_data *pmic_data);
@@ -46,12 +49,9 @@ static inline void omap3_pmic_init(const char *pmic_type,
46 omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data); 49 omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data);
47} 50}
48 51
49static inline void omap4_pmic_init(const char *pmic_type, 52void omap4_pmic_init(const char *pmic_type,
50 struct twl4030_platform_data *pmic_data) 53 struct twl4030_platform_data *pmic_data,
51{ 54 struct twl6040_platform_data *audio_data, int twl6040_irq);
52 /* Phoenix Audio IC needs I2C1 to start with 400 KHz or less */
53 omap_pmic_init(1, 400, pmic_type, OMAP44XX_IRQ_SYS_1N, pmic_data);
54}
55 55
56void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, 56void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
57 u32 pdata_flags, u32 regulators_flags); 57 u32 pdata_flags, u32 regulators_flags);
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
index 994d8f591a1d..db84a46ce7fd 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -126,7 +126,7 @@ static int tusb_set_sync_mode(unsigned sysclk_ps, unsigned fclk_ps)
126 tmp = (t.sync_clk + fclk_ps - 1) / fclk_ps; 126 tmp = (t.sync_clk + fclk_ps - 1) / fclk_ps;
127 if (tmp > 4) 127 if (tmp > 4)
128 return -ERANGE; 128 return -ERANGE;
129 if (tmp <= 0) 129 if (tmp == 0)
130 tmp = 1; 130 tmp = 1;
131 t.page_burst_access = (fclk_ps * tmp) / 1000; 131 t.page_burst_access = (fclk_ps * tmp) / 1000;
132 132
diff --git a/arch/arm/mach-omap2/vc3xxx_data.c b/arch/arm/mach-omap2/vc3xxx_data.c
index a5ec7f8f2ea8..5d8eaf31569c 100644
--- a/arch/arm/mach-omap2/vc3xxx_data.c
+++ b/arch/arm/mach-omap2/vc3xxx_data.c
@@ -46,6 +46,7 @@ static struct omap_vc_common omap3_vc_common = {
46}; 46};
47 47
48struct omap_vc_channel omap3_vc_mpu = { 48struct omap_vc_channel omap3_vc_mpu = {
49 .flags = OMAP_VC_CHANNEL_DEFAULT,
49 .common = &omap3_vc_common, 50 .common = &omap3_vc_common,
50 .smps_sa_reg = OMAP3_PRM_VC_SMPS_SA_OFFSET, 51 .smps_sa_reg = OMAP3_PRM_VC_SMPS_SA_OFFSET,
51 .smps_volra_reg = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET, 52 .smps_volra_reg = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET,
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 8a36342e60d2..4dc60e83e00d 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -73,7 +73,8 @@ unsigned long voltdm_get_voltage(struct voltagedomain *voltdm)
73int voltdm_scale(struct voltagedomain *voltdm, 73int voltdm_scale(struct voltagedomain *voltdm,
74 unsigned long target_volt) 74 unsigned long target_volt)
75{ 75{
76 int ret; 76 int ret, i;
77 unsigned long volt = 0;
77 78
78 if (!voltdm || IS_ERR(voltdm)) { 79 if (!voltdm || IS_ERR(voltdm)) {
79 pr_warning("%s: VDD specified does not exist!\n", __func__); 80 pr_warning("%s: VDD specified does not exist!\n", __func__);
@@ -86,9 +87,23 @@ int voltdm_scale(struct voltagedomain *voltdm,
86 return -ENODATA; 87 return -ENODATA;
87 } 88 }
88 89
89 ret = voltdm->scale(voltdm, target_volt); 90 /* Adjust voltage to the exact voltage from the OPP table */
91 for (i = 0; voltdm->volt_data[i].volt_nominal != 0; i++) {
92 if (voltdm->volt_data[i].volt_nominal >= target_volt) {
93 volt = voltdm->volt_data[i].volt_nominal;
94 break;
95 }
96 }
97
98 if (!volt) {
99 pr_warning("%s: not scaling. OPP voltage for %lu, not found.\n",
100 __func__, target_volt);
101 return -EINVAL;
102 }
103
104 ret = voltdm->scale(voltdm, volt);
90 if (!ret) 105 if (!ret)
91 voltdm->nominal_volt = target_volt; 106 voltdm->nominal_volt = volt;
92 107
93 return ret; 108 return ret;
94} 109}
diff --git a/arch/arm/mach-omap2/wd_timer.c b/arch/arm/mach-omap2/wd_timer.c
index 4067669d96c4..b2f1c67043a2 100644
--- a/arch/arm/mach-omap2/wd_timer.c
+++ b/arch/arm/mach-omap2/wd_timer.c
@@ -14,6 +14,7 @@
14#include <plat/omap_hwmod.h> 14#include <plat/omap_hwmod.h>
15 15
16#include "wd_timer.h" 16#include "wd_timer.h"
17#include "common.h"
17 18
18/* 19/*
19 * In order to avoid any assumptions from bootloader regarding WDT 20 * In order to avoid any assumptions from bootloader regarding WDT
@@ -25,6 +26,8 @@
25#define OMAP_WDT_WPS 0x34 26#define OMAP_WDT_WPS 0x34
26#define OMAP_WDT_SPR 0x48 27#define OMAP_WDT_SPR 0x48
27 28
29/* Maximum microseconds to wait for OMAP module to softreset */
30#define MAX_MODULE_SOFTRESET_WAIT 10000
28 31
29int omap2_wd_timer_disable(struct omap_hwmod *oh) 32int omap2_wd_timer_disable(struct omap_hwmod *oh)
30{ 33{
@@ -54,3 +57,45 @@ int omap2_wd_timer_disable(struct omap_hwmod *oh)
54 return 0; 57 return 0;
55} 58}
56 59
60/**
61 * omap2_wdtimer_reset - reset and disable the WDTIMER IP block
62 * @oh: struct omap_hwmod *
63 *
64 * After the WDTIMER IP blocks are reset on OMAP2/3, we must also take
65 * care to execute the special watchdog disable sequence. This is
66 * because the watchdog is re-armed upon OCP softreset. (On OMAP4,
67 * this behavior was apparently changed and the watchdog is no longer
68 * re-armed after an OCP soft-reset.) Returns -ETIMEDOUT if the reset
69 * did not complete, or 0 upon success.
70 *
71 * XXX Most of this code should be moved to the omap_hwmod.c layer
72 * during a normal merge window. omap_hwmod_softreset() should be
73 * renamed to omap_hwmod_set_ocp_softreset(), and omap_hwmod_softreset()
74 * should call the hwmod _ocp_softreset() code.
75 */
76int omap2_wd_timer_reset(struct omap_hwmod *oh)
77{
78 int c = 0;
79
80 /* Write to the SOFTRESET bit */
81 omap_hwmod_softreset(oh);
82
83 /* Poll on RESETDONE bit */
84 omap_test_timeout((omap_hwmod_read(oh,
85 oh->class->sysc->syss_offs)
86 & SYSS_RESETDONE_MASK),
87 MAX_MODULE_SOFTRESET_WAIT, c);
88
89 if (oh->class->sysc->srst_udelay)
90 udelay(oh->class->sysc->srst_udelay);
91
92 if (c == MAX_MODULE_SOFTRESET_WAIT)
93 pr_warning("%s: %s: softreset failed (waited %d usec)\n",
94 __func__, oh->name, MAX_MODULE_SOFTRESET_WAIT);
95 else
96 pr_debug("%s: %s: softreset in %d usec\n", __func__,
97 oh->name, c);
98
99 return (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT :
100 omap2_wd_timer_disable(oh);
101}
diff --git a/arch/arm/mach-omap2/wd_timer.h b/arch/arm/mach-omap2/wd_timer.h
index e0054a2d5505..f6bbba73b535 100644
--- a/arch/arm/mach-omap2/wd_timer.h
+++ b/arch/arm/mach-omap2/wd_timer.h
@@ -13,5 +13,6 @@
13#include <plat/omap_hwmod.h> 13#include <plat/omap_hwmod.h>
14 14
15extern int omap2_wd_timer_disable(struct omap_hwmod *oh); 15extern int omap2_wd_timer_disable(struct omap_hwmod *oh);
16extern int omap2_wd_timer_reset(struct omap_hwmod *oh);
16 17
17#endif 18#endif
diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
index 6604fc6ca58a..0673f0c10432 100644
--- a/arch/arm/mach-orion5x/Kconfig
+++ b/arch/arm/mach-orion5x/Kconfig
@@ -86,7 +86,6 @@ config MACH_WRT350N_V2
86 86
87config MACH_TS78XX 87config MACH_TS78XX
88 bool "Technologic Systems TS-78xx" 88 bool "Technologic Systems TS-78xx"
89 select PM
90 help 89 help
91 Say 'Y' here if you want your kernel to support the 90 Say 'Y' here if you want your kernel to support the
92 Technologic Systems TS-78xx platform. 91 Technologic Systems TS-78xx platform.
diff --git a/arch/arm/mach-orion5x/addr-map.c b/arch/arm/mach-orion5x/addr-map.c
index 3638e5c12b7e..eaac83d1df6f 100644
--- a/arch/arm/mach-orion5x/addr-map.c
+++ b/arch/arm/mach-orion5x/addr-map.c
@@ -76,7 +76,7 @@ static int __init cpu_win_can_remap(const struct orion_addr_map_cfg *cfg,
76/* 76/*
77 * Description of the windows needed by the platform code 77 * Description of the windows needed by the platform code
78 */ 78 */
79static struct __initdata orion_addr_map_cfg addr_map_cfg = { 79static struct orion_addr_map_cfg addr_map_cfg __initdata = {
80 .num_wins = 8, 80 .num_wins = 8,
81 .cpu_win_can_remap = cpu_win_can_remap, 81 .cpu_win_can_remap = cpu_win_can_remap,
82 .bridge_virt_base = ORION5X_BRIDGE_VIRT_BASE, 82 .bridge_virt_base = ORION5X_BRIDGE_VIRT_BASE,
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 24481666d2cd..e2e9db492d0c 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -205,7 +205,7 @@ int __init orion5x_find_tclk(void)
205 return 166666667; 205 return 166666667;
206} 206}
207 207
208static void orion5x_timer_init(void) 208static void __init orion5x_timer_init(void)
209{ 209{
210 orion5x_tclk = orion5x_find_tclk(); 210 orion5x_tclk = orion5x_find_tclk();
211 211
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h
index 2e6454c8d4ba..31bab92ce038 100644
--- a/arch/arm/mach-orion5x/common.h
+++ b/arch/arm/mach-orion5x/common.h
@@ -45,6 +45,7 @@ void orion5x_restart(char, const char *);
45 */ 45 */
46struct pci_bus; 46struct pci_bus;
47struct pci_sys_data; 47struct pci_sys_data;
48struct pci_dev;
48 49
49void orion5x_pcie_id(u32 *dev, u32 *rev); 50void orion5x_pcie_id(u32 *dev, u32 *rev);
50void orion5x_pci_disable(void); 51void orion5x_pci_disable(void);
diff --git a/arch/arm/mach-orion5x/db88f5281-setup.c b/arch/arm/mach-orion5x/db88f5281-setup.c
index e52108c9aaea..49a3fd630313 100644
--- a/arch/arm/mach-orion5x/db88f5281-setup.c
+++ b/arch/arm/mach-orion5x/db88f5281-setup.c
@@ -265,7 +265,6 @@ static int __init db88f5281_pci_map_irq(const struct pci_dev *dev, u8 slot,
265static struct hw_pci db88f5281_pci __initdata = { 265static struct hw_pci db88f5281_pci __initdata = {
266 .nr_controllers = 2, 266 .nr_controllers = 2,
267 .preinit = db88f5281_pci_preinit, 267 .preinit = db88f5281_pci_preinit,
268 .swizzle = pci_std_swizzle,
269 .setup = orion5x_pci_sys_setup, 268 .setup = orion5x_pci_sys_setup,
270 .scan = orion5x_pci_sys_scan_bus, 269 .scan = orion5x_pci_sys_scan_bus,
271 .map_irq = db88f5281_pci_map_irq, 270 .map_irq = db88f5281_pci_map_irq,
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index c3ed15b8ea25..d470864b4e42 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -86,7 +86,6 @@ static int __init dns323_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
86 86
87static struct hw_pci dns323_pci __initdata = { 87static struct hw_pci dns323_pci __initdata = {
88 .nr_controllers = 2, 88 .nr_controllers = 2,
89 .swizzle = pci_std_swizzle,
90 .setup = orion5x_pci_sys_setup, 89 .setup = orion5x_pci_sys_setup,
91 .scan = orion5x_pci_sys_scan_bus, 90 .scan = orion5x_pci_sys_scan_bus,
92 .map_irq = dns323_pci_map_irq, 91 .map_irq = dns323_pci_map_irq,
@@ -253,27 +252,6 @@ error_fail:
253 * GPIO LEDs (simple - doesn't use hardware blinking support) 252 * GPIO LEDs (simple - doesn't use hardware blinking support)
254 */ 253 */
255 254
256#define ORION_BLINK_HALF_PERIOD 100 /* ms */
257
258static int dns323_gpio_blink_set(unsigned gpio, int state,
259 unsigned long *delay_on, unsigned long *delay_off)
260{
261
262 if (delay_on && delay_off && !*delay_on && !*delay_off)
263 *delay_on = *delay_off = ORION_BLINK_HALF_PERIOD;
264
265 switch(state) {
266 case GPIO_LED_NO_BLINK_LOW:
267 case GPIO_LED_NO_BLINK_HIGH:
268 orion_gpio_set_blink(gpio, 0);
269 gpio_set_value(gpio, state);
270 break;
271 case GPIO_LED_BLINK:
272 orion_gpio_set_blink(gpio, 1);
273 }
274 return 0;
275}
276
277static struct gpio_led dns323ab_leds[] = { 255static struct gpio_led dns323ab_leds[] = {
278 { 256 {
279 .name = "power:blue", 257 .name = "power:blue",
@@ -312,13 +290,13 @@ static struct gpio_led dns323c_leds[] = {
312static struct gpio_led_platform_data dns323ab_led_data = { 290static struct gpio_led_platform_data dns323ab_led_data = {
313 .num_leds = ARRAY_SIZE(dns323ab_leds), 291 .num_leds = ARRAY_SIZE(dns323ab_leds),
314 .leds = dns323ab_leds, 292 .leds = dns323ab_leds,
315 .gpio_blink_set = dns323_gpio_blink_set, 293 .gpio_blink_set = orion_gpio_led_blink_set,
316}; 294};
317 295
318static struct gpio_led_platform_data dns323c_led_data = { 296static struct gpio_led_platform_data dns323c_led_data = {
319 .num_leds = ARRAY_SIZE(dns323c_leds), 297 .num_leds = ARRAY_SIZE(dns323c_leds),
320 .leds = dns323c_leds, 298 .leds = dns323c_leds,
321 .gpio_blink_set = dns323_gpio_blink_set, 299 .gpio_blink_set = orion_gpio_led_blink_set,
322}; 300};
323 301
324static struct platform_device dns323_gpio_leds = { 302static struct platform_device dns323_gpio_leds = {
diff --git a/arch/arm/mach-orion5x/kurobox_pro-setup.c b/arch/arm/mach-orion5x/kurobox_pro-setup.c
index 47587b832842..1e458efafb9a 100644
--- a/arch/arm/mach-orion5x/kurobox_pro-setup.c
+++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c
@@ -138,7 +138,6 @@ static int __init kurobox_pro_pci_map_irq(const struct pci_dev *dev, u8 slot,
138 138
139static struct hw_pci kurobox_pro_pci __initdata = { 139static struct hw_pci kurobox_pro_pci __initdata = {
140 .nr_controllers = 2, 140 .nr_controllers = 2,
141 .swizzle = pci_std_swizzle,
142 .setup = orion5x_pci_sys_setup, 141 .setup = orion5x_pci_sys_setup,
143 .scan = orion5x_pci_sys_scan_bus, 142 .scan = orion5x_pci_sys_scan_bus,
144 .map_irq = kurobox_pro_pci_map_irq, 143 .map_irq = kurobox_pro_pci_map_irq,
diff --git a/arch/arm/mach-orion5x/mpp.h b/arch/arm/mach-orion5x/mpp.h
index eac68978a2c2..db70e79a1198 100644
--- a/arch/arm/mach-orion5x/mpp.h
+++ b/arch/arm/mach-orion5x/mpp.h
@@ -65,8 +65,8 @@
65#define MPP8_GIGE MPP(8, 0x1, 0, 0, 1, 1, 1) 65#define MPP8_GIGE MPP(8, 0x1, 0, 0, 1, 1, 1)
66 66
67#define MPP9_UNUSED MPP(9, 0x0, 0, 0, 1, 1, 1) 67#define MPP9_UNUSED MPP(9, 0x0, 0, 0, 1, 1, 1)
68#define MPP9_GPIO MPP(9, 0x0, 0, 0, 1, 1, 1) 68#define MPP9_GPIO MPP(9, 0x0, 1, 1, 1, 1, 1)
69#define MPP9_GIGE MPP(9, 0x1, 1, 1, 1, 1, 1) 69#define MPP9_GIGE MPP(9, 0x1, 0, 0, 1, 1, 1)
70 70
71#define MPP10_UNUSED MPP(10, 0x0, 0, 0, 1, 1, 1) 71#define MPP10_UNUSED MPP(10, 0x0, 0, 0, 1, 1, 1)
72#define MPP10_GPIO MPP(10, 0x0, 1, 1, 1, 1, 1) 72#define MPP10_GPIO MPP(10, 0x0, 1, 1, 1, 1, 1)
diff --git a/arch/arm/mach-orion5x/mss2-setup.c b/arch/arm/mach-orion5x/mss2-setup.c
index 65faaa34de61..1c16d045333e 100644
--- a/arch/arm/mach-orion5x/mss2-setup.c
+++ b/arch/arm/mach-orion5x/mss2-setup.c
@@ -89,7 +89,6 @@ static int __init mss2_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
89 89
90static struct hw_pci mss2_pci __initdata = { 90static struct hw_pci mss2_pci __initdata = {
91 .nr_controllers = 2, 91 .nr_controllers = 2,
92 .swizzle = pci_std_swizzle,
93 .setup = orion5x_pci_sys_setup, 92 .setup = orion5x_pci_sys_setup,
94 .scan = orion5x_pci_sys_scan_bus, 93 .scan = orion5x_pci_sys_scan_bus,
95 .map_irq = mss2_pci_map_irq, 94 .map_irq = mss2_pci_map_irq,
diff --git a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
index 292038fc59fd..78a6a11d8216 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
@@ -149,7 +149,6 @@ rd88f5181l_fxo_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
149 149
150static struct hw_pci rd88f5181l_fxo_pci __initdata = { 150static struct hw_pci rd88f5181l_fxo_pci __initdata = {
151 .nr_controllers = 2, 151 .nr_controllers = 2,
152 .swizzle = pci_std_swizzle,
153 .setup = orion5x_pci_sys_setup, 152 .setup = orion5x_pci_sys_setup,
154 .scan = orion5x_pci_sys_scan_bus, 153 .scan = orion5x_pci_sys_scan_bus,
155 .map_irq = rd88f5181l_fxo_pci_map_irq, 154 .map_irq = rd88f5181l_fxo_pci_map_irq,
diff --git a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
index c44eabaabc16..2f5dc54cd4cd 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
@@ -161,7 +161,6 @@ rd88f5181l_ge_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
161 161
162static struct hw_pci rd88f5181l_ge_pci __initdata = { 162static struct hw_pci rd88f5181l_ge_pci __initdata = {
163 .nr_controllers = 2, 163 .nr_controllers = 2,
164 .swizzle = pci_std_swizzle,
165 .setup = orion5x_pci_sys_setup, 164 .setup = orion5x_pci_sys_setup,
166 .scan = orion5x_pci_sys_scan_bus, 165 .scan = orion5x_pci_sys_scan_bus,
167 .map_irq = rd88f5181l_ge_pci_map_irq, 166 .map_irq = rd88f5181l_ge_pci_map_irq,
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c
index e3ce61711478..399130fac0b6 100644
--- a/arch/arm/mach-orion5x/rd88f5182-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5182-setup.c
@@ -200,7 +200,6 @@ static int __init rd88f5182_pci_map_irq(const struct pci_dev *dev, u8 slot,
200static struct hw_pci rd88f5182_pci __initdata = { 200static struct hw_pci rd88f5182_pci __initdata = {
201 .nr_controllers = 2, 201 .nr_controllers = 2,
202 .preinit = rd88f5182_pci_preinit, 202 .preinit = rd88f5182_pci_preinit,
203 .swizzle = pci_std_swizzle,
204 .setup = orion5x_pci_sys_setup, 203 .setup = orion5x_pci_sys_setup,
205 .scan = orion5x_pci_sys_scan_bus, 204 .scan = orion5x_pci_sys_scan_bus,
206 .map_irq = rd88f5182_pci_map_irq, 205 .map_irq = rd88f5182_pci_map_irq,
diff --git a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
index 2c5fab00d205..e91bf0ba4e8e 100644
--- a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
+++ b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
@@ -102,7 +102,6 @@ static void __init rd88f6183ap_ge_init(void)
102 102
103static struct hw_pci rd88f6183ap_ge_pci __initdata = { 103static struct hw_pci rd88f6183ap_ge_pci __initdata = {
104 .nr_controllers = 2, 104 .nr_controllers = 2,
105 .swizzle = pci_std_swizzle,
106 .setup = orion5x_pci_sys_setup, 105 .setup = orion5x_pci_sys_setup,
107 .scan = orion5x_pci_sys_scan_bus, 106 .scan = orion5x_pci_sys_scan_bus,
108 .map_irq = orion5x_pci_map_irq, 107 .map_irq = orion5x_pci_map_irq,
diff --git a/arch/arm/mach-orion5x/terastation_pro2-setup.c b/arch/arm/mach-orion5x/terastation_pro2-setup.c
index 632a861ef82b..90e571dc4deb 100644
--- a/arch/arm/mach-orion5x/terastation_pro2-setup.c
+++ b/arch/arm/mach-orion5x/terastation_pro2-setup.c
@@ -122,7 +122,6 @@ static int __init tsp2_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
122static struct hw_pci tsp2_pci __initdata = { 122static struct hw_pci tsp2_pci __initdata = {
123 .nr_controllers = 2, 123 .nr_controllers = 2,
124 .preinit = tsp2_pci_preinit, 124 .preinit = tsp2_pci_preinit,
125 .swizzle = pci_std_swizzle,
126 .setup = orion5x_pci_sys_setup, 125 .setup = orion5x_pci_sys_setup,
127 .scan = orion5x_pci_sys_scan_bus, 126 .scan = orion5x_pci_sys_scan_bus,
128 .map_irq = tsp2_pci_map_irq, 127 .map_irq = tsp2_pci_map_irq,
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c
index 5d6408745582..b184f680e0db 100644
--- a/arch/arm/mach-orion5x/ts209-setup.c
+++ b/arch/arm/mach-orion5x/ts209-setup.c
@@ -170,7 +170,6 @@ static int __init qnap_ts209_pci_map_irq(const struct pci_dev *dev, u8 slot,
170static struct hw_pci qnap_ts209_pci __initdata = { 170static struct hw_pci qnap_ts209_pci __initdata = {
171 .nr_controllers = 2, 171 .nr_controllers = 2,
172 .preinit = qnap_ts209_pci_preinit, 172 .preinit = qnap_ts209_pci_preinit,
173 .swizzle = pci_std_swizzle,
174 .setup = orion5x_pci_sys_setup, 173 .setup = orion5x_pci_sys_setup,
175 .scan = orion5x_pci_sys_scan_bus, 174 .scan = orion5x_pci_sys_scan_bus,
176 .map_irq = qnap_ts209_pci_map_irq, 175 .map_irq = qnap_ts209_pci_map_irq,
diff --git a/arch/arm/mach-orion5x/ts409-setup.c b/arch/arm/mach-orion5x/ts409-setup.c
index 4e6ff759cd32..a5c2e64c4ece 100644
--- a/arch/arm/mach-orion5x/ts409-setup.c
+++ b/arch/arm/mach-orion5x/ts409-setup.c
@@ -140,7 +140,6 @@ static int __init qnap_ts409_pci_map_irq(const struct pci_dev *dev, u8 slot,
140 140
141static struct hw_pci qnap_ts409_pci __initdata = { 141static struct hw_pci qnap_ts409_pci __initdata = {
142 .nr_controllers = 2, 142 .nr_controllers = 2,
143 .swizzle = pci_std_swizzle,
144 .setup = orion5x_pci_sys_setup, 143 .setup = orion5x_pci_sys_setup,
145 .scan = orion5x_pci_sys_scan_bus, 144 .scan = orion5x_pci_sys_scan_bus,
146 .map_irq = qnap_ts409_pci_map_irq, 145 .map_irq = qnap_ts409_pci_map_irq,
diff --git a/arch/arm/mach-orion5x/ts78xx-fpga.h b/arch/arm/mach-orion5x/ts78xx-fpga.h
index 151e89e1e676..97c393d39ae2 100644
--- a/arch/arm/mach-orion5x/ts78xx-fpga.h
+++ b/arch/arm/mach-orion5x/ts78xx-fpga.h
@@ -28,9 +28,9 @@ struct fpga_device {
28 28
29struct fpga_devices { 29struct fpga_devices {
30 /* Technologic Systems */ 30 /* Technologic Systems */
31 struct fpga_device ts_rtc; 31 struct fpga_device ts_rtc;
32 struct fpga_device ts_nand; 32 struct fpga_device ts_nand;
33 struct fpga_device ts_rng; 33 struct fpga_device ts_rng;
34}; 34};
35 35
36struct ts78xx_fpga_data { 36struct ts78xx_fpga_data {
diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c b/arch/arm/mach-orion5x/ts78xx-setup.c
index c96f37472eda..a74f3cf54cc5 100644
--- a/arch/arm/mach-orion5x/ts78xx-setup.c
+++ b/arch/arm/mach-orion5x/ts78xx-setup.c
@@ -8,6 +8,8 @@
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10
11#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
12
11#include <linux/kernel.h> 13#include <linux/kernel.h>
12#include <linux/init.h> 14#include <linux/init.h>
13#include <linux/sysfs.h> 15#include <linux/sysfs.h>
@@ -115,7 +117,7 @@ static struct platform_device ts78xx_ts_rtc_device = {
115 * I've used the method TS use in their rtc7800.c example for the detection 117 * I've used the method TS use in their rtc7800.c example for the detection
116 * 118 *
117 * TODO: track down a guinea pig without an RTC to see if we can work out a 119 * TODO: track down a guinea pig without an RTC to see if we can work out a
118 * better RTC detection routine 120 * better RTC detection routine
119 */ 121 */
120static int ts78xx_ts_rtc_load(void) 122static int ts78xx_ts_rtc_load(void)
121{ 123{
@@ -141,10 +143,14 @@ static int ts78xx_ts_rtc_load(void)
141 } else 143 } else
142 rc = platform_device_add(&ts78xx_ts_rtc_device); 144 rc = platform_device_add(&ts78xx_ts_rtc_device);
143 145
146 if (rc)
147 pr_info("RTC could not be registered: %d\n",
148 rc);
144 return rc; 149 return rc;
145 } 150 }
146 } 151 }
147 152
153 pr_info("RTC not found\n");
148 return -ENODEV; 154 return -ENODEV;
149}; 155};
150 156
@@ -292,11 +298,8 @@ static struct platform_nand_data ts78xx_ts_nand_data = {
292 }, 298 },
293}; 299};
294 300
295static struct resource ts78xx_ts_nand_resources = { 301static struct resource ts78xx_ts_nand_resources
296 .start = TS_NAND_DATA, 302 = DEFINE_RES_MEM(TS_NAND_DATA, 4);
297 .end = TS_NAND_DATA + 4,
298 .flags = IORESOURCE_MEM,
299};
300 303
301static struct platform_device ts78xx_ts_nand_device = { 304static struct platform_device ts78xx_ts_nand_device = {
302 .name = "gen_nand", 305 .name = "gen_nand",
@@ -319,6 +322,8 @@ static int ts78xx_ts_nand_load(void)
319 } else 322 } else
320 rc = platform_device_add(&ts78xx_ts_nand_device); 323 rc = platform_device_add(&ts78xx_ts_nand_device);
321 324
325 if (rc)
326 pr_info("NAND could not be registered: %d\n", rc);
322 return rc; 327 return rc;
323}; 328};
324 329
@@ -332,11 +337,8 @@ static void ts78xx_ts_nand_unload(void)
332 ****************************************************************************/ 337 ****************************************************************************/
333#define TS_RNG_DATA (TS78XX_FPGA_REGS_PHYS_BASE | 0x044) 338#define TS_RNG_DATA (TS78XX_FPGA_REGS_PHYS_BASE | 0x044)
334 339
335static struct resource ts78xx_ts_rng_resource = { 340static struct resource ts78xx_ts_rng_resource
336 .flags = IORESOURCE_MEM, 341 = DEFINE_RES_MEM(TS_RNG_DATA, 4);
337 .start = TS_RNG_DATA,
338 .end = TS_RNG_DATA + 4 - 1,
339};
340 342
341static struct timeriomem_rng_data ts78xx_ts_rng_data = { 343static struct timeriomem_rng_data ts78xx_ts_rng_data = {
342 .period = 1000000, /* one second */ 344 .period = 1000000, /* one second */
@@ -363,6 +365,8 @@ static int ts78xx_ts_rng_load(void)
363 } else 365 } else
364 rc = platform_device_add(&ts78xx_ts_rng_device); 366 rc = platform_device_add(&ts78xx_ts_rng_device);
365 367
368 if (rc)
369 pr_info("RNG could not be registered: %d\n", rc);
366 return rc; 370 return rc;
367}; 371};
368 372
@@ -402,7 +406,7 @@ static void ts78xx_fpga_supports(void)
402 /* enable devices if magic matches */ 406 /* enable devices if magic matches */
403 switch ((ts78xx_fpga.id >> 8) & 0xffffff) { 407 switch ((ts78xx_fpga.id >> 8) & 0xffffff) {
404 case TS7800_FPGA_MAGIC: 408 case TS7800_FPGA_MAGIC:
405 pr_warning("TS-7800 FPGA: unrecognized revision 0x%.2x\n", 409 pr_warning("unrecognised FPGA revision 0x%.2x\n",
406 ts78xx_fpga.id & 0xff); 410 ts78xx_fpga.id & 0xff);
407 ts78xx_fpga.supports.ts_rtc.present = 1; 411 ts78xx_fpga.supports.ts_rtc.present = 1;
408 ts78xx_fpga.supports.ts_nand.present = 1; 412 ts78xx_fpga.supports.ts_nand.present = 1;
@@ -422,26 +426,20 @@ static int ts78xx_fpga_load_devices(void)
422 426
423 if (ts78xx_fpga.supports.ts_rtc.present == 1) { 427 if (ts78xx_fpga.supports.ts_rtc.present == 1) {
424 tmp = ts78xx_ts_rtc_load(); 428 tmp = ts78xx_ts_rtc_load();
425 if (tmp) { 429 if (tmp)
426 pr_info("TS-78xx: RTC not registered\n");
427 ts78xx_fpga.supports.ts_rtc.present = 0; 430 ts78xx_fpga.supports.ts_rtc.present = 0;
428 }
429 ret |= tmp; 431 ret |= tmp;
430 } 432 }
431 if (ts78xx_fpga.supports.ts_nand.present == 1) { 433 if (ts78xx_fpga.supports.ts_nand.present == 1) {
432 tmp = ts78xx_ts_nand_load(); 434 tmp = ts78xx_ts_nand_load();
433 if (tmp) { 435 if (tmp)
434 pr_info("TS-78xx: NAND not registered\n");
435 ts78xx_fpga.supports.ts_nand.present = 0; 436 ts78xx_fpga.supports.ts_nand.present = 0;
436 }
437 ret |= tmp; 437 ret |= tmp;
438 } 438 }
439 if (ts78xx_fpga.supports.ts_rng.present == 1) { 439 if (ts78xx_fpga.supports.ts_rng.present == 1) {
440 tmp = ts78xx_ts_rng_load(); 440 tmp = ts78xx_ts_rng_load();
441 if (tmp) { 441 if (tmp)
442 pr_info("TS-78xx: RNG not registered\n");
443 ts78xx_fpga.supports.ts_rng.present = 0; 442 ts78xx_fpga.supports.ts_rng.present = 0;
444 }
445 ret |= tmp; 443 ret |= tmp;
446 } 444 }
447 445
@@ -466,7 +464,7 @@ static int ts78xx_fpga_load(void)
466{ 464{
467 ts78xx_fpga.id = readl(TS78XX_FPGA_REGS_VIRT_BASE); 465 ts78xx_fpga.id = readl(TS78XX_FPGA_REGS_VIRT_BASE);
468 466
469 pr_info("TS-78xx FPGA: magic=0x%.6x, rev=0x%.2x\n", 467 pr_info("FPGA magic=0x%.6x, rev=0x%.2x\n",
470 (ts78xx_fpga.id >> 8) & 0xffffff, 468 (ts78xx_fpga.id >> 8) & 0xffffff,
471 ts78xx_fpga.id & 0xff); 469 ts78xx_fpga.id & 0xff);
472 470
@@ -494,7 +492,7 @@ static int ts78xx_fpga_unload(void)
494 * UrJTAG SVN since r1381 can be used to reprogram the FPGA 492 * UrJTAG SVN since r1381 can be used to reprogram the FPGA
495 */ 493 */
496 if (ts78xx_fpga.id != fpga_id) { 494 if (ts78xx_fpga.id != fpga_id) {
497 pr_err("TS-78xx FPGA: magic/rev mismatch\n" 495 pr_err("FPGA magic/rev mismatch\n"
498 "TS-78xx FPGA: was 0x%.6x/%.2x but now 0x%.6x/%.2x\n", 496 "TS-78xx FPGA: was 0x%.6x/%.2x but now 0x%.6x/%.2x\n",
499 (ts78xx_fpga.id >> 8) & 0xffffff, ts78xx_fpga.id & 0xff, 497 (ts78xx_fpga.id >> 8) & 0xffffff, ts78xx_fpga.id & 0xff,
500 (fpga_id >> 8) & 0xffffff, fpga_id & 0xff); 498 (fpga_id >> 8) & 0xffffff, fpga_id & 0xff);
@@ -525,7 +523,7 @@ static ssize_t ts78xx_fpga_store(struct kobject *kobj,
525 int value, ret; 523 int value, ret;
526 524
527 if (ts78xx_fpga.state < 0) { 525 if (ts78xx_fpga.state < 0) {
528 pr_err("TS-78xx FPGA: borked, you must powercycle asap\n"); 526 pr_err("FPGA borked, you must powercycle ASAP\n");
529 return -EBUSY; 527 return -EBUSY;
530 } 528 }
531 529
@@ -533,10 +531,8 @@ static ssize_t ts78xx_fpga_store(struct kobject *kobj,
533 value = 1; 531 value = 1;
534 else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) 532 else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0)
535 value = 0; 533 value = 0;
536 else { 534 else
537 pr_err("ts78xx_fpga_store: Invalid value\n");
538 return -EINVAL; 535 return -EINVAL;
539 }
540 536
541 if (ts78xx_fpga.state == value) 537 if (ts78xx_fpga.state == value)
542 return n; 538 return n;
@@ -614,7 +610,7 @@ static void __init ts78xx_init(void)
614 /* FPGA init */ 610 /* FPGA init */
615 ts78xx_fpga_devices_zero_init(); 611 ts78xx_fpga_devices_zero_init();
616 ret = ts78xx_fpga_load(); 612 ret = ts78xx_fpga_load();
617 ret = sysfs_create_file(power_kobj, &ts78xx_fpga_attr.attr); 613 ret = sysfs_create_file(firmware_kobj, &ts78xx_fpga_attr.attr);
618 if (ret) 614 if (ret)
619 pr_err("sysfs_create_file failed: %d\n", ret); 615 pr_err("sysfs_create_file failed: %d\n", ret);
620} 616}
diff --git a/arch/arm/mach-orion5x/wnr854t-setup.c b/arch/arm/mach-orion5x/wnr854t-setup.c
index 078c03f7cd52..754c12b6abf0 100644
--- a/arch/arm/mach-orion5x/wnr854t-setup.c
+++ b/arch/arm/mach-orion5x/wnr854t-setup.c
@@ -155,7 +155,6 @@ static int __init wnr854t_pci_map_irq(const struct pci_dev *dev, u8 slot,
155 155
156static struct hw_pci wnr854t_pci __initdata = { 156static struct hw_pci wnr854t_pci __initdata = {
157 .nr_controllers = 2, 157 .nr_controllers = 2,
158 .swizzle = pci_std_swizzle,
159 .setup = orion5x_pci_sys_setup, 158 .setup = orion5x_pci_sys_setup,
160 .scan = orion5x_pci_sys_scan_bus, 159 .scan = orion5x_pci_sys_scan_bus,
161 .map_irq = wnr854t_pci_map_irq, 160 .map_irq = wnr854t_pci_map_irq,
diff --git a/arch/arm/mach-orion5x/wrt350n-v2-setup.c b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
index 46a9778171ce..45c21251eb1e 100644
--- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c
+++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
@@ -243,7 +243,6 @@ static int __init wrt350n_v2_pci_map_irq(const struct pci_dev *dev, u8 slot,
243 243
244static struct hw_pci wrt350n_v2_pci __initdata = { 244static struct hw_pci wrt350n_v2_pci __initdata = {
245 .nr_controllers = 2, 245 .nr_controllers = 2,
246 .swizzle = pci_std_swizzle,
247 .setup = orion5x_pci_sys_setup, 246 .setup = orion5x_pci_sys_setup,
248 .scan = orion5x_pci_sys_scan_bus, 247 .scan = orion5x_pci_sys_scan_bus,
249 .map_irq = wrt350n_v2_pci_map_irq, 248 .map_irq = wrt350n_v2_pci_map_irq,
diff --git a/arch/arm/mach-pnx4008/i2c.c b/arch/arm/mach-pnx4008/i2c.c
index 8103f9644e2d..550cfc2a1f2e 100644
--- a/arch/arm/mach-pnx4008/i2c.c
+++ b/arch/arm/mach-pnx4008/i2c.c
@@ -16,48 +16,62 @@
16#include <linux/err.h> 16#include <linux/err.h>
17#include <mach/platform.h> 17#include <mach/platform.h>
18#include <mach/irqs.h> 18#include <mach/irqs.h>
19#include <mach/i2c.h>
20 19
21static struct i2c_pnx_data i2c0_data = { 20static struct resource i2c0_resources[] = {
22 .name = I2C_CHIP_NAME "0", 21 {
23 .base = PNX4008_I2C1_BASE, 22 .start = PNX4008_I2C1_BASE,
24 .irq = I2C_1_INT, 23 .end = PNX4008_I2C1_BASE + SZ_4K - 1,
24 .flags = IORESOURCE_MEM,
25 }, {
26 .start = I2C_1_INT,
27 .end = I2C_1_INT,
28 .flags = IORESOURCE_IRQ,
29 },
25}; 30};
26 31
27static struct i2c_pnx_data i2c1_data = { 32static struct resource i2c1_resources[] = {
28 .name = I2C_CHIP_NAME "1", 33 {
29 .base = PNX4008_I2C2_BASE, 34 .start = PNX4008_I2C2_BASE,
30 .irq = I2C_2_INT, 35 .end = PNX4008_I2C2_BASE + SZ_4K - 1,
36 .flags = IORESOURCE_MEM,
37 }, {
38 .start = I2C_2_INT,
39 .end = I2C_2_INT,
40 .flags = IORESOURCE_IRQ,
41 },
31}; 42};
32 43
33static struct i2c_pnx_data i2c2_data = { 44static struct resource i2c2_resources[] = {
34 .name = "USB-I2C", 45 {
35 .base = (PNX4008_USB_CONFIG_BASE + 0x300), 46 .start = PNX4008_USB_CONFIG_BASE + 0x300,
36 .irq = USB_I2C_INT, 47 .end = PNX4008_USB_CONFIG_BASE + 0x300 + SZ_4K - 1,
48 .flags = IORESOURCE_MEM,
49 }, {
50 .start = USB_I2C_INT,
51 .end = USB_I2C_INT,
52 .flags = IORESOURCE_IRQ,
53 },
37}; 54};
38 55
39static struct platform_device i2c0_device = { 56static struct platform_device i2c0_device = {
40 .name = "pnx-i2c", 57 .name = "pnx-i2c.0",
41 .id = 0, 58 .id = 0,
42 .dev = { 59 .resource = i2c0_resources,
43 .platform_data = &i2c0_data, 60 .num_resources = ARRAY_SIZE(i2c0_resources),
44 },
45}; 61};
46 62
47static struct platform_device i2c1_device = { 63static struct platform_device i2c1_device = {
48 .name = "pnx-i2c", 64 .name = "pnx-i2c.1",
49 .id = 1, 65 .id = 1,
50 .dev = { 66 .resource = i2c1_resources,
51 .platform_data = &i2c1_data, 67 .num_resources = ARRAY_SIZE(i2c1_resources),
52 },
53}; 68};
54 69
55static struct platform_device i2c2_device = { 70static struct platform_device i2c2_device = {
56 .name = "pnx-i2c", 71 .name = "pnx-i2c.2",
57 .id = 2, 72 .id = 2,
58 .dev = { 73 .resource = i2c2_resources,
59 .platform_data = &i2c2_data, 74 .num_resources = ARRAY_SIZE(i2c2_resources),
60 },
61}; 75};
62 76
63static struct platform_device *devices[] __initdata = { 77static struct platform_device *devices[] __initdata = {
diff --git a/arch/arm/mach-pnx4008/include/mach/i2c.h b/arch/arm/mach-pnx4008/include/mach/i2c.h
deleted file mode 100644
index 259ac53abf40..000000000000
--- a/arch/arm/mach-pnx4008/include/mach/i2c.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * PNX4008-specific tweaks for I2C IP3204 block
3 *
4 * Author: Vitaly Wool <vwool@ru.mvista.com>
5 *
6 * 2005 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#ifndef __ASM_ARCH_I2C_H__
13#define __ASM_ARCH_I2C_H__
14
15enum {
16 mstatus_tdi = 0x00000001,
17 mstatus_afi = 0x00000002,
18 mstatus_nai = 0x00000004,
19 mstatus_drmi = 0x00000008,
20 mstatus_active = 0x00000020,
21 mstatus_scl = 0x00000040,
22 mstatus_sda = 0x00000080,
23 mstatus_rff = 0x00000100,
24 mstatus_rfe = 0x00000200,
25 mstatus_tff = 0x00000400,
26 mstatus_tfe = 0x00000800,
27};
28
29enum {
30 mcntrl_tdie = 0x00000001,
31 mcntrl_afie = 0x00000002,
32 mcntrl_naie = 0x00000004,
33 mcntrl_drmie = 0x00000008,
34 mcntrl_daie = 0x00000020,
35 mcntrl_rffie = 0x00000040,
36 mcntrl_tffie = 0x00000080,
37 mcntrl_reset = 0x00000100,
38 mcntrl_cdbmode = 0x00000400,
39};
40
41enum {
42 rw_bit = 1 << 0,
43 start_bit = 1 << 8,
44 stop_bit = 1 << 9,
45};
46
47#define I2C_REG_RX(a) ((a)->ioaddr) /* Rx FIFO reg (RO) */
48#define I2C_REG_TX(a) ((a)->ioaddr) /* Tx FIFO reg (WO) */
49#define I2C_REG_STS(a) ((a)->ioaddr + 0x04) /* Status reg (RO) */
50#define I2C_REG_CTL(a) ((a)->ioaddr + 0x08) /* Ctl reg */
51#define I2C_REG_CKL(a) ((a)->ioaddr + 0x0c) /* Clock divider low */
52#define I2C_REG_CKH(a) ((a)->ioaddr + 0x10) /* Clock divider high */
53#define I2C_REG_ADR(a) ((a)->ioaddr + 0x14) /* I2C address */
54#define I2C_REG_RFL(a) ((a)->ioaddr + 0x18) /* Rx FIFO level (RO) */
55#define I2C_REG_TFL(a) ((a)->ioaddr + 0x1c) /* Tx FIFO level (RO) */
56#define I2C_REG_RXB(a) ((a)->ioaddr + 0x20) /* Num of bytes Rx-ed (RO) */
57#define I2C_REG_TXB(a) ((a)->ioaddr + 0x24) /* Num of bytes Tx-ed (RO) */
58#define I2C_REG_TXS(a) ((a)->ioaddr + 0x28) /* Tx slave FIFO (RO) */
59#define I2C_REG_STFL(a) ((a)->ioaddr + 0x2c) /* Tx slave FIFO level (RO) */
60
61#define HCLK_MHZ 13
62#define I2C_CHIP_NAME "PNX4008-I2C"
63
64#endif /* __ASM_ARCH_I2C_H___ */
diff --git a/arch/arm/mach-prima2/irq.c b/arch/arm/mach-prima2/irq.c
index 37c2de9b6f26..a7b9415d30f8 100644
--- a/arch/arm/mach-prima2/irq.c
+++ b/arch/arm/mach-prima2/irq.c
@@ -42,7 +42,8 @@ sirfsoc_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
42static __init void sirfsoc_irq_init(void) 42static __init void sirfsoc_irq_init(void)
43{ 43{
44 sirfsoc_alloc_gc(sirfsoc_intc_base, 0, 32); 44 sirfsoc_alloc_gc(sirfsoc_intc_base, 0, 32);
45 sirfsoc_alloc_gc(sirfsoc_intc_base + 4, 32, SIRFSOC_INTENAL_IRQ_END - 32); 45 sirfsoc_alloc_gc(sirfsoc_intc_base + 4, 32,
46 SIRFSOC_INTENAL_IRQ_END + 1 - 32);
46 47
47 writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL0); 48 writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL0);
48 writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL1); 49 writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL1);
@@ -68,7 +69,8 @@ void __init sirfsoc_of_irq_init(void)
68 if (!sirfsoc_intc_base) 69 if (!sirfsoc_intc_base)
69 panic("unable to map intc cpu registers\n"); 70 panic("unable to map intc cpu registers\n");
70 71
71 irq_domain_add_legacy(np, 32, 0, 0, &irq_domain_simple_ops, NULL); 72 irq_domain_add_legacy(np, SIRFSOC_INTENAL_IRQ_END + 1, 0, 0,
73 &irq_domain_simple_ops, NULL);
72 74
73 of_node_put(np); 75 of_node_put(np);
74 76
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
index c35456f02acb..56e8cebeb7d5 100644
--- a/arch/arm/mach-pxa/balloon3.c
+++ b/arch/arm/mach-pxa/balloon3.c
@@ -732,9 +732,7 @@ static inline void balloon3_nand_init(void) {}
732#if defined(CONFIG_REGULATOR_MAX1586) || \ 732#if defined(CONFIG_REGULATOR_MAX1586) || \
733 defined(CONFIG_REGULATOR_MAX1586_MODULE) 733 defined(CONFIG_REGULATOR_MAX1586_MODULE)
734static struct regulator_consumer_supply balloon3_max1587a_consumers[] = { 734static struct regulator_consumer_supply balloon3_max1587a_consumers[] = {
735 { 735 REGULATOR_SUPPLY("vcc_core", NULL),
736 .supply = "vcc_core",
737 }
738}; 736};
739 737
740static struct regulator_init_data balloon3_max1587a_v3_info = { 738static struct regulator_init_data balloon3_max1587a_v3_info = {
diff --git a/arch/arm/mach-pxa/cm-x2xx-pci.c b/arch/arm/mach-pxa/cm-x2xx-pci.c
index ebd9259f5ac9..d8f816c24a2f 100644
--- a/arch/arm/mach-pxa/cm-x2xx-pci.c
+++ b/arch/arm/mach-pxa/cm-x2xx-pci.c
@@ -181,11 +181,10 @@ static void cmx2xx_pci_preinit(void)
181} 181}
182 182
183static struct hw_pci cmx2xx_pci __initdata = { 183static struct hw_pci cmx2xx_pci __initdata = {
184 .swizzle = pci_std_swizzle,
185 .map_irq = cmx2xx_pci_map_irq, 184 .map_irq = cmx2xx_pci_map_irq,
186 .nr_controllers = 1, 185 .nr_controllers = 1,
186 .ops = &it8152_ops,
187 .setup = it8152_pci_setup, 187 .setup = it8152_pci_setup,
188 .scan = it8152_pci_scan_bus,
189 .preinit = cmx2xx_pci_preinit, 188 .preinit = cmx2xx_pci_preinit,
190}; 189};
191 190
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
index 313274016277..3e4e9fe2d462 100644
--- a/arch/arm/mach-pxa/cm-x300.c
+++ b/arch/arm/mach-pxa/cm-x300.c
@@ -713,9 +713,7 @@ struct da9030_battery_info cm_x300_battery_info = {
713}; 713};
714 714
715static struct regulator_consumer_supply buck2_consumers[] = { 715static struct regulator_consumer_supply buck2_consumers[] = {
716 { 716 REGULATOR_SUPPLY("vcc_core", NULL),
717 .supply = "vcc_core",
718 },
719}; 717};
720 718
721static struct regulator_init_data buck2_data = { 719static struct regulator_init_data buck2_data = {
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 16ec557b8e43..a3a4a38d4972 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -1085,10 +1085,7 @@ static void __init em_x270_userspace_consumers_init(void)
1085/* DA9030 related initializations */ 1085/* DA9030 related initializations */
1086#define REGULATOR_CONSUMER(_name, _dev_name, _supply) \ 1086#define REGULATOR_CONSUMER(_name, _dev_name, _supply) \
1087 static struct regulator_consumer_supply _name##_consumers[] = { \ 1087 static struct regulator_consumer_supply _name##_consumers[] = { \
1088 { \ 1088 REGULATOR_SUPPLY(_supply, _dev_name), \
1089 .dev_name = _dev_name, \
1090 .supply = _supply, \
1091 }, \
1092 } 1089 }
1093 1090
1094REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer.0", "vcc gps"); 1091REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer.0", "vcc gps");
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index b83b95a29503..d09da6a746b8 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -22,6 +22,7 @@
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/gpio_keys.h> 23#include <linux/gpio_keys.h>
24#include <linux/input.h> 24#include <linux/input.h>
25#include <linux/input/navpoint.h>
25#include <linux/lcd.h> 26#include <linux/lcd.h>
26#include <linux/mfd/htc-egpio.h> 27#include <linux/mfd/htc-egpio.h>
27#include <linux/mfd/asic3.h> 28#include <linux/mfd/asic3.h>
@@ -102,6 +103,10 @@ static unsigned long hx4700_pin_config[] __initdata = {
102 GPIO44_BTUART_CTS, 103 GPIO44_BTUART_CTS,
103 GPIO45_BTUART_RTS_LPM_LOW, 104 GPIO45_BTUART_RTS_LPM_LOW,
104 105
106 /* STUART (IRDA) */
107 GPIO46_STUART_RXD,
108 GPIO47_STUART_TXD,
109
105 /* PWM 1 (Backlight) */ 110 /* PWM 1 (Backlight) */
106 GPIO17_PWM1_OUT, 111 GPIO17_PWM1_OUT,
107 112
@@ -113,7 +118,7 @@ static unsigned long hx4700_pin_config[] __initdata = {
113 GPIO113_I2S_SYSCLK, 118 GPIO113_I2S_SYSCLK,
114 119
115 /* SSP 1 (NavPoint) */ 120 /* SSP 1 (NavPoint) */
116 GPIO23_SSP1_SCLK, 121 GPIO23_SSP1_SCLK_IN,
117 GPIO24_SSP1_SFRM, 122 GPIO24_SSP1_SFRM,
118 GPIO25_SSP1_TXD, 123 GPIO25_SSP1_TXD,
119 GPIO26_SSP1_RXD, 124 GPIO26_SSP1_RXD,
@@ -125,10 +130,13 @@ static unsigned long hx4700_pin_config[] __initdata = {
125 GPIO88_GPIO, 130 GPIO88_GPIO,
126 131
127 /* HX4700 specific input GPIOs */ 132 /* HX4700 specific input GPIOs */
128 GPIO12_GPIO, /* ASIC3_IRQ */ 133 GPIO12_GPIO | WAKEUP_ON_EDGE_RISE, /* ASIC3_IRQ */
129 GPIO13_GPIO, /* W3220_IRQ */ 134 GPIO13_GPIO, /* W3220_IRQ */
130 GPIO14_GPIO, /* nWLAN_IRQ */ 135 GPIO14_GPIO, /* nWLAN_IRQ */
131 136
137 /* HX4700 specific output GPIOs */
138 GPIO102_GPIO | MFP_LPM_DRIVE_LOW, /* SYNAPTICS_POWER_ON */
139
132 GPIO10_GPIO, /* GSM_IRQ */ 140 GPIO10_GPIO, /* GSM_IRQ */
133 GPIO13_GPIO, /* CPLD_IRQ */ 141 GPIO13_GPIO, /* CPLD_IRQ */
134 GPIO107_GPIO, /* DS1WM_IRQ */ 142 GPIO107_GPIO, /* DS1WM_IRQ */
@@ -183,6 +191,23 @@ static struct platform_device gpio_keys = {
183}; 191};
184 192
185/* 193/*
194 * Synaptics NavPoint connected to SSP1
195 */
196
197static struct navpoint_platform_data navpoint_platform_data = {
198 .port = 1,
199 .gpio = GPIO102_HX4700_SYNAPTICS_POWER_ON,
200};
201
202static struct platform_device navpoint = {
203 .name = "navpoint",
204 .id = -1,
205 .dev = {
206 .platform_data = &navpoint_platform_data,
207 },
208};
209
210/*
186 * ASIC3 211 * ASIC3
187 */ 212 */
188 213
@@ -227,7 +252,6 @@ static u16 asic3_gpio_config[] = {
227 ASIC3_GPIOC0_LED0, /* red */ 252 ASIC3_GPIOC0_LED0, /* red */
228 ASIC3_GPIOC1_LED1, /* green */ 253 ASIC3_GPIOC1_LED1, /* green */
229 ASIC3_GPIOC2_LED2, /* blue */ 254 ASIC3_GPIOC2_LED2, /* blue */
230 ASIC3_GPIOC4_CF_nCD,
231 ASIC3_GPIOC5_nCIOW, 255 ASIC3_GPIOC5_nCIOW,
232 ASIC3_GPIOC6_nCIOR, 256 ASIC3_GPIOC6_nCIOR,
233 ASIC3_GPIOC7_nPCE_1, 257 ASIC3_GPIOC7_nPCE_1,
@@ -241,6 +265,7 @@ static u16 asic3_gpio_config[] = {
241 ASIC3_GPIOC15_nPIOR, 265 ASIC3_GPIOC15_nPIOR,
242 266
243 /* GPIOD: input GPIOs, CF */ 267 /* GPIOD: input GPIOs, CF */
268 ASIC3_GPIOD4_CF_nCD,
244 ASIC3_GPIOD11_nCIOIS16, 269 ASIC3_GPIOD11_nCIOIS16,
245 ASIC3_GPIOD12_nCWAIT, 270 ASIC3_GPIOD12_nCWAIT,
246 ASIC3_GPIOD15_nPIOW, 271 ASIC3_GPIOD15_nPIOW,
@@ -291,6 +316,7 @@ static struct asic3_platform_data asic3_platform_data = {
291 .gpio_config_num = ARRAY_SIZE(asic3_gpio_config), 316 .gpio_config_num = ARRAY_SIZE(asic3_gpio_config),
292 .irq_base = IRQ_BOARD_START, 317 .irq_base = IRQ_BOARD_START,
293 .gpio_base = HX4700_ASIC3_GPIO_BASE, 318 .gpio_base = HX4700_ASIC3_GPIO_BASE,
319 .clock_rate = 4000000,
294 .leds = asic3_leds, 320 .leds = asic3_leds,
295}; 321};
296 322
@@ -680,12 +706,8 @@ static struct platform_device power_supply = {
680 */ 706 */
681 707
682static struct regulator_consumer_supply bq24022_consumers[] = { 708static struct regulator_consumer_supply bq24022_consumers[] = {
683 { 709 REGULATOR_SUPPLY("vbus_draw", NULL),
684 .supply = "vbus_draw", 710 REGULATOR_SUPPLY("ac_draw", NULL),
685 },
686 {
687 .supply = "ac_draw",
688 },
689}; 711};
690 712
691static struct regulator_init_data bq24022_init_data = { 713static struct regulator_init_data bq24022_init_data = {
@@ -764,9 +786,8 @@ static struct platform_device strataflash = {
764 * Maxim MAX1587A on PI2C 786 * Maxim MAX1587A on PI2C
765 */ 787 */
766 788
767static struct regulator_consumer_supply max1587a_consumer = { 789static struct regulator_consumer_supply max1587a_consumer =
768 .supply = "vcc_core", 790 REGULATOR_SUPPLY("vcc_core", NULL);
769};
770 791
771static struct regulator_init_data max1587a_v3_info = { 792static struct regulator_init_data max1587a_v3_info = {
772 .constraints = { 793 .constraints = {
@@ -828,6 +849,7 @@ static struct platform_device audio = {
828static struct platform_device *devices[] __initdata = { 849static struct platform_device *devices[] __initdata = {
829 &asic3, 850 &asic3,
830 &gpio_keys, 851 &gpio_keys,
852 &navpoint,
831 &backlight, 853 &backlight,
832 &w3220, 854 &w3220,
833 &hx4700_lcd, 855 &hx4700_lcd,
@@ -859,6 +881,7 @@ static void __init hx4700_init(void)
859 int ret; 881 int ret;
860 882
861 pxa2xx_mfp_config(ARRAY_AND_SIZE(hx4700_pin_config)); 883 pxa2xx_mfp_config(ARRAY_AND_SIZE(hx4700_pin_config));
884 gpio_set_wake(GPIO12_HX4700_ASIC3_IRQ, 1);
862 ret = gpio_request_array(ARRAY_AND_SIZE(global_gpios)); 885 ret = gpio_request_array(ARRAY_AND_SIZE(global_gpios));
863 if (ret) 886 if (ret)
864 pr_err ("hx4700: Failed to request GPIOs.\n"); 887 pr_err ("hx4700: Failed to request GPIOs.\n");
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
index a65867209aa0..a611ad3153c7 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
@@ -208,6 +208,7 @@
208#define GPIO113_I2S_SYSCLK MFP_CFG_OUT(GPIO113, AF1, DRIVE_LOW) 208#define GPIO113_I2S_SYSCLK MFP_CFG_OUT(GPIO113, AF1, DRIVE_LOW)
209 209
210/* SSP 1 */ 210/* SSP 1 */
211#define GPIO23_SSP1_SCLK_IN MFP_CFG_IN(GPIO23, AF2)
211#define GPIO23_SSP1_SCLK MFP_CFG_OUT(GPIO23, AF2, DRIVE_LOW) 212#define GPIO23_SSP1_SCLK MFP_CFG_OUT(GPIO23, AF2, DRIVE_LOW)
212#define GPIO29_SSP1_SCLK MFP_CFG_IN(GPIO29, AF3) 213#define GPIO29_SSP1_SCLK MFP_CFG_IN(GPIO29, AF3)
213#define GPIO27_SSP1_SYSCLK MFP_CFG_OUT(GPIO27, AF1, DRIVE_LOW) 214#define GPIO27_SSP1_SYSCLK MFP_CFG_OUT(GPIO27, AF1, DRIVE_LOW)
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h b/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h
index c54cef25895c..cbf51ae81855 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa2xx.h
@@ -17,6 +17,7 @@
17 * 17 *
18 * bit 23 - Input/Output (PXA2xx specific) 18 * bit 23 - Input/Output (PXA2xx specific)
19 * bit 24 - Wakeup Enable(PXA2xx specific) 19 * bit 24 - Wakeup Enable(PXA2xx specific)
20 * bit 25 - Keep Output (PXA2xx specific)
20 */ 21 */
21 22
22#define MFP_DIR_IN (0x0 << 23) 23#define MFP_DIR_IN (0x0 << 23)
@@ -25,6 +26,12 @@
25#define MFP_DIR(x) (((x) >> 23) & 0x1) 26#define MFP_DIR(x) (((x) >> 23) & 0x1)
26 27
27#define MFP_LPM_CAN_WAKEUP (0x1 << 24) 28#define MFP_LPM_CAN_WAKEUP (0x1 << 24)
29
30/*
31 * MFP_LPM_KEEP_OUTPUT must be specified for pins that need to
32 * retain their last output level (low or high).
33 * Note: MFP_LPM_KEEP_OUTPUT has no effect on pins configured for input.
34 */
28#define MFP_LPM_KEEP_OUTPUT (0x1 << 25) 35#define MFP_LPM_KEEP_OUTPUT (0x1 << 25)
29 36
30#define WAKEUP_ON_EDGE_RISE (MFP_LPM_CAN_WAKEUP | MFP_LPM_EDGE_RISE) 37#define WAKEUP_ON_EDGE_RISE (MFP_LPM_CAN_WAKEUP | MFP_LPM_EDGE_RISE)
diff --git a/arch/arm/mach-pxa/include/mach/mioa701.h b/arch/arm/mach-pxa/include/mach/mioa701.h
index 02868447b0b1..e57f5c724e8a 100644
--- a/arch/arm/mach-pxa/include/mach/mioa701.h
+++ b/arch/arm/mach-pxa/include/mach/mioa701.h
@@ -61,6 +61,9 @@
61#define GPIO93_KEY_VOLUME_UP 93 61#define GPIO93_KEY_VOLUME_UP 93
62#define GPIO94_KEY_VOLUME_DOWN 94 62#define GPIO94_KEY_VOLUME_DOWN 94
63 63
64/* Camera */
65#define GPIO56_MT9M111_nOE 56
66
64extern struct input_dev *mioa701_evdev; 67extern struct input_dev *mioa701_evdev;
65extern void mioa701_gpio_lpm_set(unsigned long mfp_pin); 68extern void mioa701_gpio_lpm_set(unsigned long mfp_pin);
66 69
diff --git a/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h b/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h
index d72791695b26..0260aaa2fc17 100644
--- a/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h
+++ b/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h
@@ -31,7 +31,6 @@
31#define PCM990_CTRL_INT_IRQ PXA_GPIO_TO_IRQ(PCM990_CTRL_INT_IRQ_GPIO) 31#define PCM990_CTRL_INT_IRQ PXA_GPIO_TO_IRQ(PCM990_CTRL_INT_IRQ_GPIO)
32#define PCM990_CTRL_INT_IRQ_EDGE IRQ_TYPE_EDGE_RISING 32#define PCM990_CTRL_INT_IRQ_EDGE IRQ_TYPE_EDGE_RISING
33#define PCM990_CTRL_PHYS PXA_CS1_PHYS /* 16-Bit */ 33#define PCM990_CTRL_PHYS PXA_CS1_PHYS /* 16-Bit */
34#define PCM990_CTRL_BASE 0xea000000
35#define PCM990_CTRL_SIZE (1*1024*1024) 34#define PCM990_CTRL_SIZE (1*1024*1024)
36 35
37#define PCM990_CTRL_PWR_IRQ_GPIO 14 36#define PCM990_CTRL_PWR_IRQ_GPIO 14
@@ -69,13 +68,13 @@
69#define PCM990_CTRL_MMC2DE 0x0004 /* R MMC2 Card detect */ 68#define PCM990_CTRL_MMC2DE 0x0004 /* R MMC2 Card detect */
70#define PCM990_CTRL_MMC2WP 0x0008 /* R MMC2 Card write protect */ 69#define PCM990_CTRL_MMC2WP 0x0008 /* R MMC2 Card write protect */
71 70
72#define PCM990_CTRL_REG6 0x000C /* Interrupt Clear REGISTER */ 71#define PCM990_CTRL_INTSETCLR 0x000C /* Interrupt Clear REGISTER */
73#define PCM990_CTRL_INTC0 0x0001 /* Clear Reg BT Detect */ 72#define PCM990_CTRL_INTC0 0x0001 /* Clear Reg BT Detect */
74#define PCM990_CTRL_INTC1 0x0002 /* Clear Reg FR RI */ 73#define PCM990_CTRL_INTC1 0x0002 /* Clear Reg FR RI */
75#define PCM990_CTRL_INTC2 0x0004 /* Clear Reg MMC1 Detect */ 74#define PCM990_CTRL_INTC2 0x0004 /* Clear Reg MMC1 Detect */
76#define PCM990_CTRL_INTC3 0x0008 /* Clear Reg PM_5V off */ 75#define PCM990_CTRL_INTC3 0x0008 /* Clear Reg PM_5V off */
77 76
78#define PCM990_CTRL_REG7 0x000E /* Interrupt Enable REGISTER */ 77#define PCM990_CTRL_INTMSKENA 0x000E /* Interrupt Enable REGISTER */
79#define PCM990_CTRL_ENAINT0 0x0001 /* Enable Int BT Detect */ 78#define PCM990_CTRL_ENAINT0 0x0001 /* Enable Int BT Detect */
80#define PCM990_CTRL_ENAINT1 0x0002 /* Enable Int FR RI */ 79#define PCM990_CTRL_ENAINT1 0x0002 /* Enable Int FR RI */
81#define PCM990_CTRL_ENAINT2 0x0004 /* Enable Int MMC1 Detect */ 80#define PCM990_CTRL_ENAINT2 0x0004 /* Enable Int MMC1 Detect */
@@ -102,32 +101,6 @@
102#define PCM990_CTRL_ACPRES 0x0004 /* DC Present */ 101#define PCM990_CTRL_ACPRES 0x0004 /* DC Present */
103#define PCM990_CTRL_ACALARM 0x0008 /* Error Akku */ 102#define PCM990_CTRL_ACALARM 0x0008 /* Error Akku */
104 103
105#define PCM990_CTRL_P2V(x) ((x) - PCM990_CTRL_PHYS + PCM990_CTRL_BASE)
106#define PCM990_CTRL_V2P(x) ((x) - PCM990_CTRL_BASE + PCM990_CTRL_PHYS)
107
108#ifndef __ASSEMBLY__
109# define __PCM990_CTRL_REG(x) \
110 (*((volatile unsigned char *)PCM990_CTRL_P2V(x)))
111#else
112# define __PCM990_CTRL_REG(x) PCM990_CTRL_P2V(x)
113#endif
114
115#define PCM990_INTMSKENA __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG7)
116#define PCM990_INTSETCLR __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG6)
117#define PCM990_CTRL0 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG0)
118#define PCM990_CTRL1 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG1)
119#define PCM990_CTRL2 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG2)
120#define PCM990_CTRL3 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG3)
121#define PCM990_CTRL4 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG4)
122#define PCM990_CTRL5 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG5)
123#define PCM990_CTRL6 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG6)
124#define PCM990_CTRL7 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG7)
125#define PCM990_CTRL8 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG8)
126#define PCM990_CTRL9 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG9)
127#define PCM990_CTRL10 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG10)
128#define PCM990_CTRL11 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG11)
129
130
131/* 104/*
132 * IDE 105 * IDE
133 */ 106 */
@@ -166,24 +139,6 @@
166#define PCM990_IDE_PLD_P2V(x) ((x) - PCM990_IDE_PLD_PHYS + PCM990_IDE_PLD_BASE) 139#define PCM990_IDE_PLD_P2V(x) ((x) - PCM990_IDE_PLD_PHYS + PCM990_IDE_PLD_BASE)
167#define PCM990_IDE_PLD_V2P(x) ((x) - PCM990_IDE_PLD_BASE + PCM990_IDE_PLD_PHYS) 140#define PCM990_IDE_PLD_V2P(x) ((x) - PCM990_IDE_PLD_BASE + PCM990_IDE_PLD_PHYS)
168 141
169#ifndef __ASSEMBLY__
170# define __PCM990_IDE_PLD_REG(x) \
171 (*((volatile unsigned char *)PCM990_IDE_PLD_P2V(x)))
172#else
173# define __PCM990_IDE_PLD_REG(x) PCM990_IDE_PLD_P2V(x)
174#endif
175
176#define PCM990_IDE0 \
177 __PCM990_IDE_PLD_REG(PCM990_IDE_PLD_PHYS + PCM990_IDE_PLD_REG0)
178#define PCM990_IDE1 \
179 __PCM990_IDE_PLD_REG(PCM990_IDE_PLD_PHYS + PCM990_IDE_PLD_REG1)
180#define PCM990_IDE2 \
181 __PCM990_IDE_PLD_REG(PCM990_IDE_PLD_PHYS + PCM990_IDE_PLD_REG2)
182#define PCM990_IDE3 \
183 __PCM990_IDE_PLD_REG(PCM990_IDE_PLD_PHYS + PCM990_IDE_PLD_REG3)
184#define PCM990_IDE4 \
185 __PCM990_IDE_PLD_REG(PCM990_IDE_PLD_PHYS + PCM990_IDE_PLD_REG4)
186
187/* 142/*
188 * Compact Flash 143 * Compact Flash
189 */ 144 */
@@ -196,10 +151,6 @@
196#define PCM990_CF_CD_EDGE IRQ_TYPE_EDGE_RISING 151#define PCM990_CF_CD_EDGE IRQ_TYPE_EDGE_RISING
197 152
198#define PCM990_CF_PLD_PHYS 0x30000000 /* 16 bit wide */ 153#define PCM990_CF_PLD_PHYS 0x30000000 /* 16 bit wide */
199#define PCM990_CF_PLD_BASE 0xef000000
200#define PCM990_CF_PLD_SIZE (1*1024*1024)
201#define PCM990_CF_PLD_P2V(x) ((x) - PCM990_CF_PLD_PHYS + PCM990_CF_PLD_BASE)
202#define PCM990_CF_PLD_V2P(x) ((x) - PCM990_CF_PLD_BASE + PCM990_CF_PLD_PHYS)
203 154
204/* visible CPLD (U6) registers */ 155/* visible CPLD (U6) registers */
205#define PCM990_CF_PLD_REG0 0x1000 /* OFFSET CF REGISTER 0 */ 156#define PCM990_CF_PLD_REG0 0x1000 /* OFFSET CF REGISTER 0 */
@@ -239,21 +190,6 @@
239#define PCM990_CF_REG6_CD1 0x0001 /* R CF Card_Detect1 */ 190#define PCM990_CF_REG6_CD1 0x0001 /* R CF Card_Detect1 */
240#define PCM990_CF_REG6_CD2 0x0002 /* R CF Card_Detect2 */ 191#define PCM990_CF_REG6_CD2 0x0002 /* R CF Card_Detect2 */
241 192
242#ifndef __ASSEMBLY__
243# define __PCM990_CF_PLD_REG(x) \
244 (*((volatile unsigned char *)PCM990_CF_PLD_P2V(x)))
245#else
246# define __PCM990_CF_PLD_REG(x) PCM990_CF_PLD_P2V(x)
247#endif
248
249#define PCM990_CF0 __PCM990_CF_PLD_REG(PCM990_CF_PLD_PHYS + PCM990_CF_PLD_REG0)
250#define PCM990_CF1 __PCM990_CF_PLD_REG(PCM990_CF_PLD_PHYS + PCM990_CF_PLD_REG1)
251#define PCM990_CF2 __PCM990_CF_PLD_REG(PCM990_CF_PLD_PHYS + PCM990_CF_PLD_REG2)
252#define PCM990_CF3 __PCM990_CF_PLD_REG(PCM990_CF_PLD_PHYS + PCM990_CF_PLD_REG3)
253#define PCM990_CF4 __PCM990_CF_PLD_REG(PCM990_CF_PLD_PHYS + PCM990_CF_PLD_REG4)
254#define PCM990_CF5 __PCM990_CF_PLD_REG(PCM990_CF_PLD_PHYS + PCM990_CF_PLD_REG5)
255#define PCM990_CF6 __PCM990_CF_PLD_REG(PCM990_CF_PLD_PHYS + PCM990_CF_PLD_REG6)
256
257/* 193/*
258 * Wolfson AC97 Touch 194 * Wolfson AC97 Touch
259 */ 195 */
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 8de0651d7efb..2db697cd2b4e 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -579,12 +579,8 @@ static struct platform_device power_supply = {
579 */ 579 */
580 580
581static struct regulator_consumer_supply bq24022_consumers[] = { 581static struct regulator_consumer_supply bq24022_consumers[] = {
582 { 582 REGULATOR_SUPPLY("vbus_draw", NULL),
583 .supply = "vbus_draw", 583 REGULATOR_SUPPLY("ac_draw", NULL),
584 },
585 {
586 .supply = "ac_draw",
587 },
588}; 584};
589 585
590static struct regulator_init_data bq24022_init_data = { 586static struct regulator_init_data bq24022_init_data = {
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
index b0a842887780..ef0426a159d4 100644
--- a/arch/arm/mach-pxa/mfp-pxa2xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa2xx.c
@@ -33,6 +33,8 @@
33#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2)) 33#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
34#define GPLR(x) __REG2(0x40E00000, BANK_OFF((x) >> 5)) 34#define GPLR(x) __REG2(0x40E00000, BANK_OFF((x) >> 5))
35#define GPDR(x) __REG2(0x40E00000, BANK_OFF((x) >> 5) + 0x0c) 35#define GPDR(x) __REG2(0x40E00000, BANK_OFF((x) >> 5) + 0x0c)
36#define GPSR(x) __REG2(0x40E00000, BANK_OFF((x) >> 5) + 0x18)
37#define GPCR(x) __REG2(0x40E00000, BANK_OFF((x) >> 5) + 0x24)
36 38
37#define PWER_WE35 (1 << 24) 39#define PWER_WE35 (1 << 24)
38 40
@@ -348,6 +350,7 @@ static inline void pxa27x_mfp_init(void) {}
348#ifdef CONFIG_PM 350#ifdef CONFIG_PM
349static unsigned long saved_gafr[2][4]; 351static unsigned long saved_gafr[2][4];
350static unsigned long saved_gpdr[4]; 352static unsigned long saved_gpdr[4];
353static unsigned long saved_gplr[4];
351static unsigned long saved_pgsr[4]; 354static unsigned long saved_pgsr[4];
352 355
353static int pxa2xx_mfp_suspend(void) 356static int pxa2xx_mfp_suspend(void)
@@ -366,14 +369,26 @@ static int pxa2xx_mfp_suspend(void)
366 } 369 }
367 370
368 for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++) { 371 for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++) {
369
370 saved_gafr[0][i] = GAFR_L(i); 372 saved_gafr[0][i] = GAFR_L(i);
371 saved_gafr[1][i] = GAFR_U(i); 373 saved_gafr[1][i] = GAFR_U(i);
372 saved_gpdr[i] = GPDR(i * 32); 374 saved_gpdr[i] = GPDR(i * 32);
375 saved_gplr[i] = GPLR(i * 32);
373 saved_pgsr[i] = PGSR(i); 376 saved_pgsr[i] = PGSR(i);
374 377
375 GPDR(i * 32) = gpdr_lpm[i]; 378 GPSR(i * 32) = PGSR(i);
379 GPCR(i * 32) = ~PGSR(i);
380 }
381
382 /* set GPDR bits taking into account MFP_LPM_KEEP_OUTPUT */
383 for (i = 0; i < pxa_last_gpio; i++) {
384 if ((gpdr_lpm[gpio_to_bank(i)] & GPIO_bit(i)) ||
385 ((gpio_desc[i].config & MFP_LPM_KEEP_OUTPUT) &&
386 (saved_gpdr[gpio_to_bank(i)] & GPIO_bit(i))))
387 GPDR(i) |= GPIO_bit(i);
388 else
389 GPDR(i) &= ~GPIO_bit(i);
376 } 390 }
391
377 return 0; 392 return 0;
378} 393}
379 394
@@ -384,6 +399,8 @@ static void pxa2xx_mfp_resume(void)
384 for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++) { 399 for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++) {
385 GAFR_L(i) = saved_gafr[0][i]; 400 GAFR_L(i) = saved_gafr[0][i];
386 GAFR_U(i) = saved_gafr[1][i]; 401 GAFR_U(i) = saved_gafr[1][i];
402 GPSR(i * 32) = saved_gplr[i];
403 GPCR(i * 32) = ~saved_gplr[i];
387 GPDR(i * 32) = saved_gpdr[i]; 404 GPDR(i * 32) = saved_gpdr[i];
388 PGSR(i) = saved_pgsr[i]; 405 PGSR(i) = saved_pgsr[i];
389 } 406 }
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index 061d57009cee..bf99022b021f 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -103,6 +103,7 @@ static unsigned long mioa701_pin_config[] = {
103 GPIO82_CIF_DD_5, 103 GPIO82_CIF_DD_5,
104 GPIO84_CIF_FV, 104 GPIO84_CIF_FV,
105 GPIO85_CIF_LV, 105 GPIO85_CIF_LV,
106 MIO_CFG_OUT(GPIO56_MT9M111_nOE, AF0, DRIVE_LOW),
106 107
107 /* Bluetooth */ 108 /* Bluetooth */
108 MIO_CFG_IN(GPIO14_BT_nACTIVITY, AF0), 109 MIO_CFG_IN(GPIO14_BT_nACTIVITY, AF0),
@@ -581,9 +582,7 @@ static struct wm97xx_pdata mioa701_wm97xx_pdata = {
581 * Voltage regulation 582 * Voltage regulation
582 */ 583 */
583static struct regulator_consumer_supply max1586_consumers[] = { 584static struct regulator_consumer_supply max1586_consumers[] = {
584 { 585 REGULATOR_SUPPLY("vcc_core", NULL),
585 .supply = "vcc_core",
586 }
587}; 586};
588 587
589static struct regulator_init_data max1586_v3_info = { 588static struct regulator_init_data max1586_v3_info = {
@@ -705,6 +704,7 @@ static struct gpio global_gpios[] = {
705 { GPIO9_CHARGE_EN, GPIOF_OUT_INIT_HIGH, "Charger enable" }, 704 { GPIO9_CHARGE_EN, GPIOF_OUT_INIT_HIGH, "Charger enable" },
706 { GPIO18_POWEROFF, GPIOF_OUT_INIT_LOW, "Power Off" }, 705 { GPIO18_POWEROFF, GPIOF_OUT_INIT_LOW, "Power Off" },
707 { GPIO87_LCD_POWER, GPIOF_OUT_INIT_LOW, "LCD Power" }, 706 { GPIO87_LCD_POWER, GPIOF_OUT_INIT_LOW, "LCD Power" },
707 { GPIO56_MT9M111_nOE, GPIOF_OUT_INIT_LOW, "Camera nOE" },
708}; 708};
709 709
710static void __init mioa701_machine_init(void) 710static void __init mioa701_machine_init(void)
diff --git a/arch/arm/mach-pxa/palm27x.c b/arch/arm/mach-pxa/palm27x.c
index fbc10d7b95d1..dad71cfa34c8 100644
--- a/arch/arm/mach-pxa/palm27x.c
+++ b/arch/arm/mach-pxa/palm27x.c
@@ -429,9 +429,7 @@ void __init palm27x_power_init(int ac, int usb)
429#if defined(CONFIG_REGULATOR_MAX1586) || \ 429#if defined(CONFIG_REGULATOR_MAX1586) || \
430 defined(CONFIG_REGULATOR_MAX1586_MODULE) 430 defined(CONFIG_REGULATOR_MAX1586_MODULE)
431static struct regulator_consumer_supply palm27x_max1587a_consumers[] = { 431static struct regulator_consumer_supply palm27x_max1587a_consumers[] = {
432 { 432 REGULATOR_SUPPLY("vcc_core", NULL),
433 .supply = "vcc_core",
434 }
435}; 433};
436 434
437static struct regulator_init_data palm27x_max1587a_v3_info = { 435static struct regulator_init_data palm27x_max1587a_v3_info = {
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index abab4e2b122c..cb723e84bc27 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -65,6 +65,18 @@ static unsigned long pcm990_pin_config[] __initdata = {
65 GPIO31_AC97_SYNC, 65 GPIO31_AC97_SYNC,
66}; 66};
67 67
68static void __iomem *pcm990_cpld_base;
69
70static u8 pcm990_cpld_readb(unsigned int reg)
71{
72 return readb(pcm990_cpld_base + reg);
73}
74
75static void pcm990_cpld_writeb(u8 value, unsigned int reg)
76{
77 writeb(value, pcm990_cpld_base + reg);
78}
79
68/* 80/*
69 * pcm990_lcd_power - control power supply to the LCD 81 * pcm990_lcd_power - control power supply to the LCD
70 * @on: 0 = switch off, 1 = switch on 82 * @on: 0 = switch off, 1 = switch on
@@ -78,13 +90,13 @@ static void pcm990_lcd_power(int on, struct fb_var_screeninfo *var)
78 /* enable LCD-Latches 90 /* enable LCD-Latches
79 * power on LCD 91 * power on LCD
80 */ 92 */
81 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG3) = 93 pcm990_cpld_writeb(PCM990_CTRL_LCDPWR + PCM990_CTRL_LCDON,
82 PCM990_CTRL_LCDPWR + PCM990_CTRL_LCDON; 94 PCM990_CTRL_REG3);
83 } else { 95 } else {
84 /* disable LCD-Latches 96 /* disable LCD-Latches
85 * power off LCD 97 * power off LCD
86 */ 98 */
87 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG3) = 0x00; 99 pcm990_cpld_writeb(0, PCM990_CTRL_REG3);
88 } 100 }
89} 101}
90#endif 102#endif
@@ -243,15 +255,26 @@ static unsigned long pcm990_irq_enabled;
243static void pcm990_mask_ack_irq(struct irq_data *d) 255static void pcm990_mask_ack_irq(struct irq_data *d)
244{ 256{
245 int pcm990_irq = (d->irq - PCM027_IRQ(0)); 257 int pcm990_irq = (d->irq - PCM027_IRQ(0));
246 PCM990_INTMSKENA = (pcm990_irq_enabled &= ~(1 << pcm990_irq)); 258
259 pcm990_irq_enabled &= ~(1 << pcm990_irq);
260
261 pcm990_cpld_writeb(pcm990_irq_enabled, PCM990_CTRL_INTMSKENA);
247} 262}
248 263
249static void pcm990_unmask_irq(struct irq_data *d) 264static void pcm990_unmask_irq(struct irq_data *d)
250{ 265{
251 int pcm990_irq = (d->irq - PCM027_IRQ(0)); 266 int pcm990_irq = (d->irq - PCM027_IRQ(0));
267 u8 val;
268
252 /* the irq can be acknowledged only if deasserted, so it's done here */ 269 /* the irq can be acknowledged only if deasserted, so it's done here */
253 PCM990_INTSETCLR |= 1 << pcm990_irq; 270
254 PCM990_INTMSKENA = (pcm990_irq_enabled |= (1 << pcm990_irq)); 271 pcm990_irq_enabled |= (1 << pcm990_irq);
272
273 val = pcm990_cpld_readb(PCM990_CTRL_INTSETCLR);
274 val |= 1 << pcm990_irq;
275 pcm990_cpld_writeb(val, PCM990_CTRL_INTSETCLR);
276
277 pcm990_cpld_writeb(pcm990_irq_enabled, PCM990_CTRL_INTMSKENA);
255} 278}
256 279
257static struct irq_chip pcm990_irq_chip = { 280static struct irq_chip pcm990_irq_chip = {
@@ -261,7 +284,10 @@ static struct irq_chip pcm990_irq_chip = {
261 284
262static void pcm990_irq_handler(unsigned int irq, struct irq_desc *desc) 285static void pcm990_irq_handler(unsigned int irq, struct irq_desc *desc)
263{ 286{
264 unsigned long pending = (~PCM990_INTSETCLR) & pcm990_irq_enabled; 287 unsigned long pending;
288
289 pending = ~pcm990_cpld_readb(PCM990_CTRL_INTSETCLR);
290 pending &= pcm990_irq_enabled;
265 291
266 do { 292 do {
267 /* clear our parent IRQ */ 293 /* clear our parent IRQ */
@@ -270,7 +296,8 @@ static void pcm990_irq_handler(unsigned int irq, struct irq_desc *desc)
270 irq = PCM027_IRQ(0) + __ffs(pending); 296 irq = PCM027_IRQ(0) + __ffs(pending);
271 generic_handle_irq(irq); 297 generic_handle_irq(irq);
272 } 298 }
273 pending = (~PCM990_INTSETCLR) & pcm990_irq_enabled; 299 pending = ~pcm990_cpld_readb(PCM990_CTRL_INTSETCLR);
300 pending &= pcm990_irq_enabled;
274 } while (pending); 301 } while (pending);
275} 302}
276 303
@@ -285,8 +312,9 @@ static void __init pcm990_init_irq(void)
285 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 312 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
286 } 313 }
287 314
288 PCM990_INTMSKENA = 0x00; /* disable all Interrupts */ 315 /* disable all Interrupts */
289 PCM990_INTSETCLR = 0xFF; 316 pcm990_cpld_writeb(0x0, PCM990_CTRL_INTMSKENA);
317 pcm990_cpld_writeb(0xff, PCM990_CTRL_INTSETCLR);
290 318
291 irq_set_chained_handler(PCM990_CTRL_INT_IRQ, pcm990_irq_handler); 319 irq_set_chained_handler(PCM990_CTRL_INT_IRQ, pcm990_irq_handler);
292 irq_set_irq_type(PCM990_CTRL_INT_IRQ, PCM990_CTRL_INT_IRQ_EDGE); 320 irq_set_irq_type(PCM990_CTRL_INT_IRQ, PCM990_CTRL_INT_IRQ_EDGE);
@@ -309,13 +337,16 @@ static int pcm990_mci_init(struct device *dev, irq_handler_t mci_detect_int,
309static void pcm990_mci_setpower(struct device *dev, unsigned int vdd) 337static void pcm990_mci_setpower(struct device *dev, unsigned int vdd)
310{ 338{
311 struct pxamci_platform_data *p_d = dev->platform_data; 339 struct pxamci_platform_data *p_d = dev->platform_data;
340 u8 val;
341
342 val = pcm990_cpld_readb(PCM990_CTRL_REG5);
312 343
313 if ((1 << vdd) & p_d->ocr_mask) 344 if ((1 << vdd) & p_d->ocr_mask)
314 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG5) = 345 val |= PCM990_CTRL_MMC2PWR;
315 PCM990_CTRL_MMC2PWR;
316 else 346 else
317 __PCM990_CTRL_REG(PCM990_CTRL_PHYS + PCM990_CTRL_REG5) = 347 val &= ~PCM990_CTRL_MMC2PWR;
318 ~PCM990_CTRL_MMC2PWR; 348
349 pcm990_cpld_writeb(PCM990_CTRL_MMC2PWR, PCM990_CTRL_REG5);
319} 350}
320 351
321static void pcm990_mci_exit(struct device *dev, void *data) 352static void pcm990_mci_exit(struct device *dev, void *data)
@@ -481,23 +512,6 @@ static struct platform_device pcm990_camera[] = {
481#endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */ 512#endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */
482 513
483/* 514/*
484 * enable generic access to the base board control CPLDs U6 and U7
485 */
486static struct map_desc pcm990_io_desc[] __initdata = {
487 {
488 .virtual = PCM990_CTRL_BASE,
489 .pfn = __phys_to_pfn(PCM990_CTRL_PHYS),
490 .length = PCM990_CTRL_SIZE,
491 .type = MT_DEVICE /* CPLD */
492 }, {
493 .virtual = PCM990_CF_PLD_BASE,
494 .pfn = __phys_to_pfn(PCM990_CF_PLD_PHYS),
495 .length = PCM990_CF_PLD_SIZE,
496 .type = MT_DEVICE /* CPLD */
497 }
498};
499
500/*
501 * system init for baseboard usage. Will be called by pcm027 init. 515 * system init for baseboard usage. Will be called by pcm027 init.
502 * 516 *
503 * Add platform devices present on this baseboard and init 517 * Add platform devices present on this baseboard and init
@@ -507,8 +521,11 @@ void __init pcm990_baseboard_init(void)
507{ 521{
508 pxa2xx_mfp_config(ARRAY_AND_SIZE(pcm990_pin_config)); 522 pxa2xx_mfp_config(ARRAY_AND_SIZE(pcm990_pin_config));
509 523
510 /* register CPLD access */ 524 pcm990_cpld_base = ioremap(PCM990_CTRL_PHYS, PCM990_CTRL_SIZE);
511 iotable_init(ARRAY_AND_SIZE(pcm990_io_desc)); 525 if (!pcm990_cpld_base) {
526 pr_err("pcm990: failed to ioremap cpld\n");
527 return;
528 }
512 529
513 /* register CPLD's IRQ controller */ 530 /* register CPLD's IRQ controller */
514 pcm990_init_irq(); 531 pcm990_init_irq();
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 6bce78edce7a..4726c246dcdc 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -421,8 +421,11 @@ void __init pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info)
421 pxa_register_device(&pxa27x_device_i2c_power, info); 421 pxa_register_device(&pxa27x_device_i2c_power, info);
422} 422}
423 423
424static struct pxa_gpio_platform_data pxa27x_gpio_info __initdata = {
425 .gpio_set_wake = gpio_set_wake,
426};
427
424static struct platform_device *devices[] __initdata = { 428static struct platform_device *devices[] __initdata = {
425 &pxa_device_gpio,
426 &pxa27x_device_udc, 429 &pxa27x_device_udc,
427 &pxa_device_pmu, 430 &pxa_device_pmu,
428 &pxa_device_i2s, 431 &pxa_device_i2s,
@@ -458,6 +461,7 @@ static int __init pxa27x_init(void)
458 register_syscore_ops(&pxa2xx_mfp_syscore_ops); 461 register_syscore_ops(&pxa2xx_mfp_syscore_ops);
459 register_syscore_ops(&pxa2xx_clock_syscore_ops); 462 register_syscore_ops(&pxa2xx_clock_syscore_ops);
460 463
464 pxa_register_device(&pxa_device_gpio, &pxa27x_gpio_info);
461 ret = platform_add_devices(devices, ARRAY_SIZE(devices)); 465 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
462 } 466 }
463 467
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index df2ab0fb2ace..363d91b44ecb 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -877,9 +877,7 @@ static struct i2c_board_info spitz_i2c_devs[] = {
877}; 877};
878 878
879static struct regulator_consumer_supply isl6271a_consumers[] = { 879static struct regulator_consumer_supply isl6271a_consumers[] = {
880 { 880 REGULATOR_SUPPLY("vcc_core", NULL),
881 .supply = "vcc_core",
882 }
883}; 881};
884 882
885static struct regulator_init_data isl6271a_info[] = { 883static struct regulator_init_data isl6271a_info[] = {
diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c
index 4cd645e29b64..30b1b0b3c7f7 100644
--- a/arch/arm/mach-pxa/stargate2.c
+++ b/arch/arm/mach-pxa/stargate2.c
@@ -151,10 +151,7 @@ static struct platform_device sht15 = {
151}; 151};
152 152
153static struct regulator_consumer_supply stargate2_sensor_3_con[] = { 153static struct regulator_consumer_supply stargate2_sensor_3_con[] = {
154 { 154 REGULATOR_SUPPLY("vcc", "sht15"),
155 .dev_name = "sht15",
156 .supply = "vcc",
157 },
158}; 155};
159 156
160enum stargate2_ldos{ 157enum stargate2_ldos{
diff --git a/arch/arm/mach-pxa/vpac270.c b/arch/arm/mach-pxa/vpac270.c
index c57ab636ea9c..e1740acd15f1 100644
--- a/arch/arm/mach-pxa/vpac270.c
+++ b/arch/arm/mach-pxa/vpac270.c
@@ -640,9 +640,7 @@ static inline void vpac270_ide_init(void) {}
640#if defined(CONFIG_REGULATOR_MAX1586) || \ 640#if defined(CONFIG_REGULATOR_MAX1586) || \
641 defined(CONFIG_REGULATOR_MAX1586_MODULE) 641 defined(CONFIG_REGULATOR_MAX1586_MODULE)
642static struct regulator_consumer_supply vpac270_max1587a_consumers[] = { 642static struct regulator_consumer_supply vpac270_max1587a_consumers[] = {
643 { 643 REGULATOR_SUPPLY("vcc_core", NULL),
644 .supply = "vcc_core",
645 }
646}; 644};
647 645
648static struct regulator_init_data vpac270_max1587a_v3_info = { 646static struct regulator_init_data vpac270_max1587a_v3_info = {
diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
index fa8619970841..b9320cb8a11f 100644
--- a/arch/arm/mach-pxa/z2.c
+++ b/arch/arm/mach-pxa/z2.c
@@ -615,9 +615,7 @@ static inline void z2_spi_init(void) {}
615#if defined(CONFIG_REGULATOR_TPS65023) || \ 615#if defined(CONFIG_REGULATOR_TPS65023) || \
616 defined(CONFIG_REGULATOR_TPS65023_MODULE) 616 defined(CONFIG_REGULATOR_TPS65023_MODULE)
617static struct regulator_consumer_supply z2_tps65021_consumers[] = { 617static struct regulator_consumer_supply z2_tps65021_consumers[] = {
618 { 618 REGULATOR_SUPPLY("vcc_core", NULL),
619 .supply = "vcc_core",
620 }
621}; 619};
622 620
623static struct regulator_init_data z2_tps65021_info[] = { 621static struct regulator_init_data z2_tps65021_info[] = {
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 0f3a327ebcaa..b34287ab5afd 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -111,10 +111,6 @@ config S3C24XX_SETUP_TS
111 help 111 help
112 Compile in platform device definition for Samsung TouchScreen. 112 Compile in platform device definition for Samsung TouchScreen.
113 113
114# cpu-specific sections
115
116if CPU_S3C2410
117
118config S3C2410_DMA 114config S3C2410_DMA
119 bool 115 bool
120 depends on S3C24XX_DMA && (CPU_S3C2410 || CPU_S3C2442) 116 depends on S3C24XX_DMA && (CPU_S3C2410 || CPU_S3C2442)
@@ -127,6 +123,10 @@ config S3C2410_PM
127 help 123 help
128 Power Management code common to S3C2410 and better 124 Power Management code common to S3C2410 and better
129 125
126# cpu-specific sections
127
128if CPU_S3C2410
129
130config S3C24XX_SIMTEC_NOR 130config S3C24XX_SIMTEC_NOR
131 bool 131 bool
132 help 132 help
diff --git a/arch/arm/mach-s3c24xx/bast-ide.c b/arch/arm/mach-s3c24xx/bast-ide.c
index 298ececfa366..ba02cf8d80a2 100644
--- a/arch/arm/mach-s3c24xx/bast-ide.c
+++ b/arch/arm/mach-s3c24xx/bast-ide.c
@@ -37,21 +37,9 @@ static struct pata_platform_info bast_ide_platdata = {
37#define IDE_CS S3C2410_CS5 37#define IDE_CS S3C2410_CS5
38 38
39static struct resource bast_ide0_resource[] = { 39static struct resource bast_ide0_resource[] = {
40 [0] = { 40 [0] = DEFINE_RES_MEM(IDE_CS + BAST_PA_IDEPRI, 8 * 0x20),
41 .start = IDE_CS + BAST_PA_IDEPRI, 41 [1] = DEFINE_RES_MEM(IDE_CS + BAST_PA_IDEPRIAUX + (6 * 0x20), 0x20),
42 .end = IDE_CS + BAST_PA_IDEPRI + (8 * 0x20) - 1, 42 [2] = DEFINE_RES_IRQ(IRQ_IDE0),
43 .flags = IORESOURCE_MEM,
44 },
45 [1] = {
46 .start = IDE_CS + BAST_PA_IDEPRIAUX + (6 * 0x20) ,
47 .end = IDE_CS + BAST_PA_IDEPRIAUX + (7 * 0x20) - 1,
48 .flags = IORESOURCE_MEM,
49 },
50 [2] = {
51 .start = IRQ_IDE0,
52 .end = IRQ_IDE0,
53 .flags = IORESOURCE_IRQ,
54 },
55}; 43};
56 44
57static struct platform_device bast_device_ide0 = { 45static struct platform_device bast_device_ide0 = {
@@ -67,21 +55,9 @@ static struct platform_device bast_device_ide0 = {
67}; 55};
68 56
69static struct resource bast_ide1_resource[] = { 57static struct resource bast_ide1_resource[] = {
70 [0] = { 58 [0] = DEFINE_RES_MEM(IDE_CS + BAST_PA_IDESEC, 8 * 0x20),
71 .start = IDE_CS + BAST_PA_IDESEC, 59 [1] = DEFINE_RES_MEM(IDE_CS + BAST_PA_IDESECAUX + (6 * 0x20), 0x20),
72 .end = IDE_CS + BAST_PA_IDESEC + (8 * 0x20) - 1, 60 [2] = DEFINE_RES_IRQ(IRQ_IDE1),
73 .flags = IORESOURCE_MEM,
74 },
75 [1] = {
76 .start = IDE_CS + BAST_PA_IDESECAUX + (6 * 0x20),
77 .end = IDE_CS + BAST_PA_IDESECAUX + (7 * 0x20) - 1,
78 .flags = IORESOURCE_MEM,
79 },
80 [2] = {
81 .start = IRQ_IDE1,
82 .end = IRQ_IDE1,
83 .flags = IORESOURCE_IRQ,
84 },
85}; 61};
86 62
87static struct platform_device bast_device_ide1 = { 63static struct platform_device bast_device_ide1 = {
diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c
index 4220cc60de3c..ea2c4b003d58 100644
--- a/arch/arm/mach-s3c24xx/mach-amlm5900.c
+++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c
@@ -65,13 +65,8 @@
65 65
66#include "common.h" 66#include "common.h"
67 67
68static struct resource amlm5900_nor_resource = { 68static struct resource amlm5900_nor_resource =
69 .start = 0x00000000, 69 DEFINE_RES_MEM(0x00000000, SZ_16M);
70 .end = 0x01000000 - 1,
71 .flags = IORESOURCE_MEM,
72};
73
74
75 70
76static struct mtd_partition amlm5900_mtd_partitions[] = { 71static struct mtd_partition amlm5900_mtd_partitions[] = {
77 { 72 {
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c
index 60c72c54c21e..5a7d0c0010f7 100644
--- a/arch/arm/mach-s3c24xx/mach-anubis.c
+++ b/arch/arm/mach-s3c24xx/mach-anubis.c
@@ -235,19 +235,9 @@ static struct pata_platform_info anubis_ide_platdata = {
235}; 235};
236 236
237static struct resource anubis_ide0_resource[] = { 237static struct resource anubis_ide0_resource[] = {
238 { 238 [0] = DEFINE_RES_MEM(S3C2410_CS3, 8 * 32),
239 .start = S3C2410_CS3, 239 [2] = DEFINE_RES_MEM(S3C2410_CS3 + (1 << 26) + (6 * 32), 32),
240 .end = S3C2410_CS3 + (8*32) - 1, 240 [3] = DEFINE_RES_IRQ(IRQ_IDE0),
241 .flags = IORESOURCE_MEM,
242 }, {
243 .start = S3C2410_CS3 + (1<<26) + (6*32),
244 .end = S3C2410_CS3 + (1<<26) + (7*32) - 1,
245 .flags = IORESOURCE_MEM,
246 }, {
247 .start = IRQ_IDE0,
248 .end = IRQ_IDE0,
249 .flags = IORESOURCE_IRQ,
250 },
251}; 241};
252 242
253static struct platform_device anubis_device_ide0 = { 243static struct platform_device anubis_device_ide0 = {
@@ -262,19 +252,9 @@ static struct platform_device anubis_device_ide0 = {
262}; 252};
263 253
264static struct resource anubis_ide1_resource[] = { 254static struct resource anubis_ide1_resource[] = {
265 { 255 [0] = DEFINE_RES_MEM(S3C2410_CS4, 8 * 32),
266 .start = S3C2410_CS4, 256 [1] = DEFINE_RES_MEM(S3C2410_CS4 + (1 << 26) + (6 * 32), 32),
267 .end = S3C2410_CS4 + (8*32) - 1, 257 [2] = DEFINE_RES_IRQ(IRQ_IDE0),
268 .flags = IORESOURCE_MEM,
269 }, {
270 .start = S3C2410_CS4 + (1<<26) + (6*32),
271 .end = S3C2410_CS4 + (1<<26) + (7*32) - 1,
272 .flags = IORESOURCE_MEM,
273 }, {
274 .start = IRQ_IDE0,
275 .end = IRQ_IDE0,
276 .flags = IORESOURCE_IRQ,
277 },
278}; 258};
279 259
280static struct platform_device anubis_device_ide1 = { 260static struct platform_device anubis_device_ide1 = {
@@ -298,16 +278,8 @@ static struct ax_plat_data anubis_asix_platdata = {
298}; 278};
299 279
300static struct resource anubis_asix_resource[] = { 280static struct resource anubis_asix_resource[] = {
301 [0] = { 281 [0] = DEFINE_RES_MEM(S3C2410_CS5, 0x20 * 0x20),
302 .start = S3C2410_CS5, 282 [1] = DEFINE_RES_IRQ(IRQ_ASIX),
303 .end = S3C2410_CS5 + (0x20 * 0x20) -1,
304 .flags = IORESOURCE_MEM
305 },
306 [1] = {
307 .start = IRQ_ASIX,
308 .end = IRQ_ASIX,
309 .flags = IORESOURCE_IRQ
310 }
311}; 283};
312 284
313static struct platform_device anubis_device_asix = { 285static struct platform_device anubis_device_asix = {
@@ -323,21 +295,9 @@ static struct platform_device anubis_device_asix = {
323/* SM501 */ 295/* SM501 */
324 296
325static struct resource anubis_sm501_resource[] = { 297static struct resource anubis_sm501_resource[] = {
326 [0] = { 298 [0] = DEFINE_RES_MEM(S3C2410_CS2, SZ_8M),
327 .start = S3C2410_CS2, 299 [1] = DEFINE_RES_MEM(S3C2410_CS2 + SZ_64M - SZ_2M, SZ_2M),
328 .end = S3C2410_CS2 + SZ_8M, 300 [2] = DEFINE_RES_IRQ(IRQ_EINT0),
329 .flags = IORESOURCE_MEM,
330 },
331 [1] = {
332 .start = S3C2410_CS2 + SZ_64M - SZ_2M,
333 .end = S3C2410_CS2 + SZ_64M - 1,
334 .flags = IORESOURCE_MEM,
335 },
336 [2] = {
337 .start = IRQ_EINT0,
338 .end = IRQ_EINT0,
339 .flags = IORESOURCE_IRQ,
340 },
341}; 301};
342 302
343static struct sm501_initdata anubis_sm501_initdata = { 303static struct sm501_initdata anubis_sm501_initdata = {
diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c
index d7ae49c90118..7a05abf1270b 100644
--- a/arch/arm/mach-s3c24xx/mach-at2440evb.c
+++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c
@@ -118,21 +118,10 @@ static struct s3c2410_platform_nand __initdata at2440evb_nand_info = {
118/* DM9000AEP 10/100 ethernet controller */ 118/* DM9000AEP 10/100 ethernet controller */
119 119
120static struct resource at2440evb_dm9k_resource[] = { 120static struct resource at2440evb_dm9k_resource[] = {
121 [0] = { 121 [0] = DEFINE_RES_MEM(S3C2410_CS3, 4),
122 .start = S3C2410_CS3, 122 [1] = DEFINE_RES_MEM(S3C2410_CS3 + 4, 4),
123 .end = S3C2410_CS3 + 3, 123 [2] = DEFINE_RES_NAMED(IRQ_EINT7, 1, NULL, IORESOURCE_IRQ \
124 .flags = IORESOURCE_MEM 124 | IORESOURCE_IRQ_HIGHEDGE),
125 },
126 [1] = {
127 .start = S3C2410_CS3 + 4,
128 .end = S3C2410_CS3 + 7,
129 .flags = IORESOURCE_MEM
130 },
131 [2] = {
132 .start = IRQ_EINT7,
133 .end = IRQ_EINT7,
134 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
135 }
136}; 125};
137 126
138static struct dm9000_plat_data at2440evb_dm9k_pdata = { 127static struct dm9000_plat_data at2440evb_dm9k_pdata = {
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c
index 53219c02eca0..1cf1720682d3 100644
--- a/arch/arm/mach-s3c24xx/mach-bast.c
+++ b/arch/arm/mach-s3c24xx/mach-bast.c
@@ -310,22 +310,10 @@ static struct s3c2410_platform_nand __initdata bast_nand_info = {
310/* DM9000 */ 310/* DM9000 */
311 311
312static struct resource bast_dm9k_resource[] = { 312static struct resource bast_dm9k_resource[] = {
313 [0] = { 313 [0] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_DM9000, 4),
314 .start = S3C2410_CS5 + BAST_PA_DM9000, 314 [1] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_DM9000 + 0x40, 0x40),
315 .end = S3C2410_CS5 + BAST_PA_DM9000 + 3, 315 [2] = DEFINE_RES_NAMED(IRQ_DM9000 , 1, NULL, IORESOURCE_IRQ \
316 .flags = IORESOURCE_MEM, 316 | IORESOURCE_IRQ_HIGHLEVEL),
317 },
318 [1] = {
319 .start = S3C2410_CS5 + BAST_PA_DM9000 + 0x40,
320 .end = S3C2410_CS5 + BAST_PA_DM9000 + 0x40 + 0x3f,
321 .flags = IORESOURCE_MEM,
322 },
323 [2] = {
324 .start = IRQ_DM9000,
325 .end = IRQ_DM9000,
326 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
327 }
328
329}; 317};
330 318
331/* for the moment we limit ourselves to 16bit IO until some 319/* for the moment we limit ourselves to 16bit IO until some
@@ -400,21 +388,9 @@ static struct ax_plat_data bast_asix_platdata = {
400}; 388};
401 389
402static struct resource bast_asix_resource[] = { 390static struct resource bast_asix_resource[] = {
403 [0] = { 391 [0] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_ASIXNET, 0x18 * 0x20),
404 .start = S3C2410_CS5 + BAST_PA_ASIXNET, 392 [1] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_ASIXNET + (0x1f * 0x20), 1),
405 .end = S3C2410_CS5 + BAST_PA_ASIXNET + (0x18 * 0x20) - 1, 393 [2] = DEFINE_RES_IRQ(IRQ_ASIX),
406 .flags = IORESOURCE_MEM,
407 },
408 [1] = {
409 .start = S3C2410_CS5 + BAST_PA_ASIXNET + (0x1f * 0x20),
410 .end = S3C2410_CS5 + BAST_PA_ASIXNET + (0x1f * 0x20),
411 .flags = IORESOURCE_MEM,
412 },
413 [2] = {
414 .start = IRQ_ASIX,
415 .end = IRQ_ASIX,
416 .flags = IORESOURCE_IRQ
417 }
418}; 394};
419 395
420static struct platform_device bast_device_asix = { 396static struct platform_device bast_device_asix = {
@@ -430,11 +406,8 @@ static struct platform_device bast_device_asix = {
430/* Asix AX88796 10/100 ethernet controller parallel port */ 406/* Asix AX88796 10/100 ethernet controller parallel port */
431 407
432static struct resource bast_asixpp_resource[] = { 408static struct resource bast_asixpp_resource[] = {
433 [0] = { 409 [0] = DEFINE_RES_MEM(S3C2410_CS5 + BAST_PA_ASIXNET + (0x18 * 0x20), \
434 .start = S3C2410_CS5 + BAST_PA_ASIXNET + (0x18 * 0x20), 410 0x30 * 0x20),
435 .end = S3C2410_CS5 + BAST_PA_ASIXNET + (0x1b * 0x20) - 1,
436 .flags = IORESOURCE_MEM,
437 }
438}; 411};
439 412
440static struct platform_device bast_device_axpp = { 413static struct platform_device bast_device_axpp = {
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c
index ba5d85394105..0f29f64a3eeb 100644
--- a/arch/arm/mach-s3c24xx/mach-gta02.c
+++ b/arch/arm/mach-s3c24xx/mach-gta02.c
@@ -387,11 +387,8 @@ static struct physmap_flash_data gta02_nor_flash_data = {
387 .width = 2, 387 .width = 2,
388}; 388};
389 389
390static struct resource gta02_nor_flash_resource = { 390static struct resource gta02_nor_flash_resource =
391 .start = GTA02_FLASH_BASE, 391 DEFINE_RES_MEM(GTA02_FLASH_BASE, GTA02_FLASH_SIZE);
392 .end = GTA02_FLASH_BASE + GTA02_FLASH_SIZE - 1,
393 .flags = IORESOURCE_MEM,
394};
395 392
396static struct platform_device gta02_nor_flash = { 393static struct platform_device gta02_nor_flash = {
397 .name = "physmap-flash", 394 .name = "physmap-flash",
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index 6b21ba107eab..bb8d008d5a5c 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -253,13 +253,8 @@ static struct pda_power_pdata power_supply_info = {
253}; 253};
254 254
255static struct resource power_supply_resources[] = { 255static struct resource power_supply_resources[] = {
256 [0] = { 256 [0] = DEFINE_RES_NAMED(IRQ_EINT2, 1, "ac", IORESOURCE_IRQ \
257 .name = "ac", 257 | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE),
258 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE |
259 IORESOURCE_IRQ_HIGHEDGE,
260 .start = IRQ_EINT2,
261 .end = IRQ_EINT2,
262 },
263}; 258};
264 259
265static struct platform_device power_supply = { 260static struct platform_device power_supply = {
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
index 5d66fb218a41..f092b188ab70 100644
--- a/arch/arm/mach-s3c24xx/mach-mini2440.c
+++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
@@ -292,21 +292,10 @@ static struct s3c2410_platform_nand mini2440_nand_info __initdata = {
292/* DM9000AEP 10/100 ethernet controller */ 292/* DM9000AEP 10/100 ethernet controller */
293 293
294static struct resource mini2440_dm9k_resource[] = { 294static struct resource mini2440_dm9k_resource[] = {
295 [0] = { 295 [0] = DEFINE_RES_MEM(MACH_MINI2440_DM9K_BASE, 4),
296 .start = MACH_MINI2440_DM9K_BASE, 296 [1] = DEFINE_RES_MEM(MACH_MINI2440_DM9K_BASE + 4, 4),
297 .end = MACH_MINI2440_DM9K_BASE + 3, 297 [2] = DEFINE_RES_NAMED(IRQ_EINT7, 1, NULL, IORESOURCE_IRQ \
298 .flags = IORESOURCE_MEM 298 | IORESOURCE_IRQ_HIGHEDGE),
299 },
300 [1] = {
301 .start = MACH_MINI2440_DM9K_BASE + 4,
302 .end = MACH_MINI2440_DM9K_BASE + 7,
303 .flags = IORESOURCE_MEM
304 },
305 [2] = {
306 .start = IRQ_EINT7,
307 .end = IRQ_EINT7,
308 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
309 }
310}; 299};
311 300
312/* 301/*
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c
index 5198e3e1c5be..5c05ba1c330f 100644
--- a/arch/arm/mach-s3c24xx/mach-nexcoder.c
+++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c
@@ -84,11 +84,7 @@ static struct s3c2410_uartcfg nexcoder_uartcfgs[] __initdata = {
84/* NOR Flash on NexVision NexCoder 2440 board */ 84/* NOR Flash on NexVision NexCoder 2440 board */
85 85
86static struct resource nexcoder_nor_resource[] = { 86static struct resource nexcoder_nor_resource[] = {
87 [0] = { 87 [0] = DEFINE_RES_MEM(S3C2410_CS0, SZ_8M),
88 .start = S3C2410_CS0,
89 .end = S3C2410_CS0 + (8*1024*1024) - 1,
90 .flags = IORESOURCE_MEM,
91 }
92}; 88};
93 89
94static struct map_info nexcoder_nor_map = { 90static struct map_info nexcoder_nor_map = {
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c
index c5daeb612a88..95d077255024 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris.c
@@ -244,16 +244,8 @@ static struct s3c2410_platform_nand __initdata osiris_nand_info = {
244/* PCMCIA control and configuration */ 244/* PCMCIA control and configuration */
245 245
246static struct resource osiris_pcmcia_resource[] = { 246static struct resource osiris_pcmcia_resource[] = {
247 [0] = { 247 [0] = DEFINE_RES_MEM(0x0f000000, SZ_1M),
248 .start = 0x0f000000, 248 [1] = DEFINE_RES_MEM(0x0c000000, SZ_1M),
249 .end = 0x0f100000,
250 .flags = IORESOURCE_MEM,
251 },
252 [1] = {
253 .start = 0x0c000000,
254 .end = 0x0c100000,
255 .flags = IORESOURCE_MEM,
256 }
257}; 249};
258 250
259static struct platform_device osiris_pcmcia = { 251static struct platform_device osiris_pcmcia = {
diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c
index 5f1e0eeb38a9..bc4b6efb3b27 100644
--- a/arch/arm/mach-s3c24xx/mach-otom.c
+++ b/arch/arm/mach-s3c24xx/mach-otom.c
@@ -77,11 +77,7 @@ static struct s3c2410_uartcfg otom11_uartcfgs[] __initdata = {
77/* NOR Flash on NexVision OTOM board */ 77/* NOR Flash on NexVision OTOM board */
78 78
79static struct resource otom_nor_resource[] = { 79static struct resource otom_nor_resource[] = {
80 [0] = { 80 [0] = DEFINE_RES_MEM(S3C2410_CS0, SZ_4M),
81 .start = S3C2410_CS0,
82 .end = S3C2410_CS0 + (4*1024*1024) - 1,
83 .flags = IORESOURCE_MEM,
84 }
85}; 81};
86 82
87static struct platform_device otom_device_nor = { 83static struct platform_device otom_device_nor = {
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c
index 91c16d9d2459..b868dddcb836 100644
--- a/arch/arm/mach-s3c24xx/mach-qt2410.c
+++ b/arch/arm/mach-s3c24xx/mach-qt2410.c
@@ -180,16 +180,8 @@ static struct s3c2410fb_mach_info qt2410_fb_info __initdata = {
180/* CS8900 */ 180/* CS8900 */
181 181
182static struct resource qt2410_cs89x0_resources[] = { 182static struct resource qt2410_cs89x0_resources[] = {
183 [0] = { 183 [0] = DEFINE_RES_MEM(0x19000000, 17),
184 .start = 0x19000000, 184 [1] = DEFINE_RES_IRQ(IRQ_EINT9),
185 .end = 0x19000000 + 16,
186 .flags = IORESOURCE_MEM,
187 },
188 [1] = {
189 .start = IRQ_EINT9,
190 .end = IRQ_EINT9,
191 .flags = IORESOURCE_IRQ,
192 },
193}; 185};
194 186
195static struct platform_device qt2410_cs89x0 = { 187static struct platform_device qt2410_cs89x0 = {
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index 200debb4c72d..a6762aae4727 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -152,13 +152,8 @@ static struct pda_power_pdata power_supply_info = {
152}; 152};
153 153
154static struct resource power_supply_resources[] = { 154static struct resource power_supply_resources[] = {
155 [0] = { 155 [0] = DEFINE_RES_NAMED(IRQ_EINT2, 1, "ac", IORESOURCE_IRQ \
156 .name = "ac", 156 | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE),
157 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE |
158 IORESOURCE_IRQ_HIGHEDGE,
159 .start = IRQ_EINT2,
160 .end = IRQ_EINT2,
161 },
162}; 157};
163 158
164static struct platform_device power_supply = { 159static struct platform_device power_supply = {
diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
index 1114666f0efb..fe990289ee7d 100644
--- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c
+++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
@@ -56,11 +56,8 @@
56 56
57#include "common.h" 57#include "common.h"
58 58
59static struct resource tct_hammer_nor_resource = { 59static struct resource tct_hammer_nor_resource =
60 .start = 0x00000000, 60 DEFINE_RES_MEM(0x00000000, SZ_16M);
61 .end = 0x01000000 - 1,
62 .flags = IORESOURCE_MEM,
63};
64 61
65static struct mtd_partition tct_hammer_mtd_partitions[] = { 62static struct mtd_partition tct_hammer_mtd_partitions[] = {
66 { 63 {
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c
index 87608d45dac4..bd5f189f0424 100644
--- a/arch/arm/mach-s3c24xx/mach-vr1000.c
+++ b/arch/arm/mach-s3c24xx/mach-vr1000.c
@@ -187,40 +187,17 @@ static struct platform_device serial_device = {
187/* DM9000 ethernet devices */ 187/* DM9000 ethernet devices */
188 188
189static struct resource vr1000_dm9k0_resource[] = { 189static struct resource vr1000_dm9k0_resource[] = {
190 [0] = { 190 [0] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000, 4),
191 .start = S3C2410_CS5 + VR1000_PA_DM9000, 191 [1] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0x40, 0x40),
192 .end = S3C2410_CS5 + VR1000_PA_DM9000 + 3, 192 [2] = DEFINE_RES_NAMED(IRQ_VR1000_DM9000A, 1, NULL, IORESOURCE_IRQ \
193 .flags = IORESOURCE_MEM 193 | IORESOURCE_IRQ_HIGHLEVEL),
194 },
195 [1] = {
196 .start = S3C2410_CS5 + VR1000_PA_DM9000 + 0x40,
197 .end = S3C2410_CS5 + VR1000_PA_DM9000 + 0x7f,
198 .flags = IORESOURCE_MEM
199 },
200 [2] = {
201 .start = IRQ_VR1000_DM9000A,
202 .end = IRQ_VR1000_DM9000A,
203 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
204 }
205
206}; 194};
207 195
208static struct resource vr1000_dm9k1_resource[] = { 196static struct resource vr1000_dm9k1_resource[] = {
209 [0] = { 197 [0] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0x80, 4),
210 .start = S3C2410_CS5 + VR1000_PA_DM9000 + 0x80, 198 [1] = DEFINE_RES_MEM(S3C2410_CS5 + VR1000_PA_DM9000 + 0xC0, 0x40),
211 .end = S3C2410_CS5 + VR1000_PA_DM9000 + 0x83, 199 [2] = DEFINE_RES_NAMED(IRQ_VR1000_DM9000N, 1, NULL, IORESOURCE_IRQ \
212 .flags = IORESOURCE_MEM 200 | IORESOURCE_IRQ_HIGHLEVEL),
213 },
214 [1] = {
215 .start = S3C2410_CS5 + VR1000_PA_DM9000 + 0xC0,
216 .end = S3C2410_CS5 + VR1000_PA_DM9000 + 0xFF,
217 .flags = IORESOURCE_MEM
218 },
219 [2] = {
220 .start = IRQ_VR1000_DM9000N,
221 .end = IRQ_VR1000_DM9000N,
222 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
223 }
224}; 201};
225 202
226/* for the moment we limit ourselves to 16bit IO until some 203/* for the moment we limit ourselves to 16bit IO until some
diff --git a/arch/arm/mach-s3c24xx/simtec-nor.c b/arch/arm/mach-s3c24xx/simtec-nor.c
index b9d6d4f92c03..029744fcaacb 100644
--- a/arch/arm/mach-s3c24xx/simtec-nor.c
+++ b/arch/arm/mach-s3c24xx/simtec-nor.c
@@ -55,11 +55,7 @@ static struct physmap_flash_data simtec_nor_pdata = {
55}; 55};
56 56
57static struct resource simtec_nor_resource[] = { 57static struct resource simtec_nor_resource[] = {
58 [0] = { 58 [0] = DEFINE_RES_MEM(S3C2410_CS1 + 0x4000000, SZ_8M),
59 .start = S3C2410_CS1 + 0x4000000,
60 .end = S3C2410_CS1 + 0x4000000 + SZ_8M - 1,
61 .flags = IORESOURCE_MEM,
62 }
63}; 59};
64 60
65static struct platform_device simtec_device_nor = { 61static struct platform_device simtec_device_nor = {
diff --git a/arch/arm/mach-s3c64xx/dev-audio.c b/arch/arm/mach-s3c64xx/dev-audio.c
index 93470b158a4e..124fd5d63006 100644
--- a/arch/arm/mach-s3c64xx/dev-audio.c
+++ b/arch/arm/mach-s3c64xx/dev-audio.c
@@ -57,21 +57,9 @@ static int s3c64xx_i2s_cfg_gpio(struct platform_device *pdev)
57} 57}
58 58
59static struct resource s3c64xx_iis0_resource[] = { 59static struct resource s3c64xx_iis0_resource[] = {
60 [0] = { 60 [0] = DEFINE_RES_MEM(S3C64XX_PA_IIS0, SZ_256),
61 .start = S3C64XX_PA_IIS0, 61 [1] = DEFINE_RES_DMA(DMACH_I2S0_OUT),
62 .end = S3C64XX_PA_IIS0 + 0x100 - 1, 62 [2] = DEFINE_RES_DMA(DMACH_I2S0_IN),
63 .flags = IORESOURCE_MEM,
64 },
65 [1] = {
66 .start = DMACH_I2S0_OUT,
67 .end = DMACH_I2S0_OUT,
68 .flags = IORESOURCE_DMA,
69 },
70 [2] = {
71 .start = DMACH_I2S0_IN,
72 .end = DMACH_I2S0_IN,
73 .flags = IORESOURCE_DMA,
74 },
75}; 63};
76 64
77static struct s3c_audio_pdata i2sv3_pdata = { 65static struct s3c_audio_pdata i2sv3_pdata = {
@@ -95,21 +83,9 @@ struct platform_device s3c64xx_device_iis0 = {
95EXPORT_SYMBOL(s3c64xx_device_iis0); 83EXPORT_SYMBOL(s3c64xx_device_iis0);
96 84
97static struct resource s3c64xx_iis1_resource[] = { 85static struct resource s3c64xx_iis1_resource[] = {
98 [0] = { 86 [0] = DEFINE_RES_MEM(S3C64XX_PA_IIS1, SZ_256),
99 .start = S3C64XX_PA_IIS1, 87 [1] = DEFINE_RES_DMA(DMACH_I2S1_OUT),
100 .end = S3C64XX_PA_IIS1 + 0x100 - 1, 88 [2] = DEFINE_RES_DMA(DMACH_I2S1_IN),
101 .flags = IORESOURCE_MEM,
102 },
103 [1] = {
104 .start = DMACH_I2S1_OUT,
105 .end = DMACH_I2S1_OUT,
106 .flags = IORESOURCE_DMA,
107 },
108 [2] = {
109 .start = DMACH_I2S1_IN,
110 .end = DMACH_I2S1_IN,
111 .flags = IORESOURCE_DMA,
112 },
113}; 89};
114 90
115struct platform_device s3c64xx_device_iis1 = { 91struct platform_device s3c64xx_device_iis1 = {
@@ -124,21 +100,9 @@ struct platform_device s3c64xx_device_iis1 = {
124EXPORT_SYMBOL(s3c64xx_device_iis1); 100EXPORT_SYMBOL(s3c64xx_device_iis1);
125 101
126static struct resource s3c64xx_iisv4_resource[] = { 102static struct resource s3c64xx_iisv4_resource[] = {
127 [0] = { 103 [0] = DEFINE_RES_MEM(S3C64XX_PA_IISV4, SZ_256),
128 .start = S3C64XX_PA_IISV4, 104 [1] = DEFINE_RES_DMA(DMACH_HSI_I2SV40_TX),
129 .end = S3C64XX_PA_IISV4 + 0x100 - 1, 105 [2] = DEFINE_RES_DMA(DMACH_HSI_I2SV40_RX),
130 .flags = IORESOURCE_MEM,
131 },
132 [1] = {
133 .start = DMACH_HSI_I2SV40_TX,
134 .end = DMACH_HSI_I2SV40_TX,
135 .flags = IORESOURCE_DMA,
136 },
137 [2] = {
138 .start = DMACH_HSI_I2SV40_RX,
139 .end = DMACH_HSI_I2SV40_RX,
140 .flags = IORESOURCE_DMA,
141 },
142}; 106};
143 107
144static struct s3c_audio_pdata i2sv4_pdata = { 108static struct s3c_audio_pdata i2sv4_pdata = {
@@ -187,21 +151,9 @@ static int s3c64xx_pcm_cfg_gpio(struct platform_device *pdev)
187} 151}
188 152
189static struct resource s3c64xx_pcm0_resource[] = { 153static struct resource s3c64xx_pcm0_resource[] = {
190 [0] = { 154 [0] = DEFINE_RES_MEM(S3C64XX_PA_PCM0, SZ_256),
191 .start = S3C64XX_PA_PCM0, 155 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX),
192 .end = S3C64XX_PA_PCM0 + 0x100 - 1, 156 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX),
193 .flags = IORESOURCE_MEM,
194 },
195 [1] = {
196 .start = DMACH_PCM0_TX,
197 .end = DMACH_PCM0_TX,
198 .flags = IORESOURCE_DMA,
199 },
200 [2] = {
201 .start = DMACH_PCM0_RX,
202 .end = DMACH_PCM0_RX,
203 .flags = IORESOURCE_DMA,
204 },
205}; 157};
206 158
207static struct s3c_audio_pdata s3c_pcm0_pdata = { 159static struct s3c_audio_pdata s3c_pcm0_pdata = {
@@ -220,21 +172,9 @@ struct platform_device s3c64xx_device_pcm0 = {
220EXPORT_SYMBOL(s3c64xx_device_pcm0); 172EXPORT_SYMBOL(s3c64xx_device_pcm0);
221 173
222static struct resource s3c64xx_pcm1_resource[] = { 174static struct resource s3c64xx_pcm1_resource[] = {
223 [0] = { 175 [0] = DEFINE_RES_MEM(S3C64XX_PA_PCM1, SZ_256),
224 .start = S3C64XX_PA_PCM1, 176 [1] = DEFINE_RES_DMA(DMACH_PCM1_TX),
225 .end = S3C64XX_PA_PCM1 + 0x100 - 1, 177 [2] = DEFINE_RES_DMA(DMACH_PCM1_RX),
226 .flags = IORESOURCE_MEM,
227 },
228 [1] = {
229 .start = DMACH_PCM1_TX,
230 .end = DMACH_PCM1_TX,
231 .flags = IORESOURCE_DMA,
232 },
233 [2] = {
234 .start = DMACH_PCM1_RX,
235 .end = DMACH_PCM1_RX,
236 .flags = IORESOURCE_DMA,
237 },
238}; 178};
239 179
240static struct s3c_audio_pdata s3c_pcm1_pdata = { 180static struct s3c_audio_pdata s3c_pcm1_pdata = {
@@ -265,31 +205,11 @@ static int s3c64xx_ac97_cfg_gpe(struct platform_device *pdev)
265} 205}
266 206
267static struct resource s3c64xx_ac97_resource[] = { 207static struct resource s3c64xx_ac97_resource[] = {
268 [0] = { 208 [0] = DEFINE_RES_MEM(S3C64XX_PA_AC97, SZ_256),
269 .start = S3C64XX_PA_AC97, 209 [1] = DEFINE_RES_DMA(DMACH_AC97_PCMOUT),
270 .end = S3C64XX_PA_AC97 + 0x100 - 1, 210 [2] = DEFINE_RES_DMA(DMACH_AC97_PCMIN),
271 .flags = IORESOURCE_MEM, 211 [3] = DEFINE_RES_DMA(DMACH_AC97_MICIN),
272 }, 212 [4] = DEFINE_RES_IRQ(IRQ_AC97),
273 [1] = {
274 .start = DMACH_AC97_PCMOUT,
275 .end = DMACH_AC97_PCMOUT,
276 .flags = IORESOURCE_DMA,
277 },
278 [2] = {
279 .start = DMACH_AC97_PCMIN,
280 .end = DMACH_AC97_PCMIN,
281 .flags = IORESOURCE_DMA,
282 },
283 [3] = {
284 .start = DMACH_AC97_MICIN,
285 .end = DMACH_AC97_MICIN,
286 .flags = IORESOURCE_DMA,
287 },
288 [4] = {
289 .start = IRQ_AC97,
290 .end = IRQ_AC97,
291 .flags = IORESOURCE_IRQ,
292 },
293}; 213};
294 214
295static struct s3c_audio_pdata s3c_ac97_pdata; 215static struct s3c_audio_pdata s3c_ac97_pdata;
diff --git a/arch/arm/mach-s3c64xx/dev-uart.c b/arch/arm/mach-s3c64xx/dev-uart.c
index c681b99eda08..46e18d77ea93 100644
--- a/arch/arm/mach-s3c64xx/dev-uart.c
+++ b/arch/arm/mach-s3c64xx/dev-uart.c
@@ -31,55 +31,23 @@
31/* 64xx uarts are closer together */ 31/* 64xx uarts are closer together */
32 32
33static struct resource s3c64xx_uart0_resource[] = { 33static struct resource s3c64xx_uart0_resource[] = {
34 [0] = { 34 [0] = DEFINE_RES_MEM(S3C_PA_UART0, SZ_256),
35 .start = S3C_PA_UART0, 35 [1] = DEFINE_RES_IRQ(IRQ_UART0),
36 .end = S3C_PA_UART0 + 0x100,
37 .flags = IORESOURCE_MEM,
38 },
39 [1] = {
40 .start = IRQ_UART0,
41 .end = IRQ_UART0,
42 .flags = IORESOURCE_IRQ,
43 },
44}; 36};
45 37
46static struct resource s3c64xx_uart1_resource[] = { 38static struct resource s3c64xx_uart1_resource[] = {
47 [0] = { 39 [0] = DEFINE_RES_MEM(S3C_PA_UART1, SZ_256),
48 .start = S3C_PA_UART1, 40 [1] = DEFINE_RES_IRQ(IRQ_UART1),
49 .end = S3C_PA_UART1 + 0x100,
50 .flags = IORESOURCE_MEM,
51 },
52 [1] = {
53 .start = IRQ_UART1,
54 .end = IRQ_UART1,
55 .flags = IORESOURCE_IRQ,
56 },
57}; 41};
58 42
59static struct resource s3c6xx_uart2_resource[] = { 43static struct resource s3c6xx_uart2_resource[] = {
60 [0] = { 44 [0] = DEFINE_RES_MEM(S3C_PA_UART2, SZ_256),
61 .start = S3C_PA_UART2, 45 [1] = DEFINE_RES_IRQ(IRQ_UART2),
62 .end = S3C_PA_UART2 + 0x100,
63 .flags = IORESOURCE_MEM,
64 },
65 [1] = {
66 .start = IRQ_UART2,
67 .end = IRQ_UART2,
68 .flags = IORESOURCE_IRQ,
69 },
70}; 46};
71 47
72static struct resource s3c64xx_uart3_resource[] = { 48static struct resource s3c64xx_uart3_resource[] = {
73 [0] = { 49 [0] = DEFINE_RES_MEM(S3C_PA_UART3, SZ_256),
74 .start = S3C_PA_UART3, 50 [1] = DEFINE_RES_IRQ(IRQ_UART3),
75 .end = S3C_PA_UART3 + 0x100,
76 .flags = IORESOURCE_MEM,
77 },
78 [1] = {
79 .start = IRQ_UART3,
80 .end = IRQ_UART3,
81 .flags = IORESOURCE_IRQ,
82 },
83}; 51};
84 52
85 53
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c
index b86f2779e4e6..f252691fb209 100644
--- a/arch/arm/mach-s3c64xx/mach-anw6410.c
+++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
@@ -165,21 +165,10 @@ static void __init anw6410_dm9000_enable(void)
165} 165}
166 166
167static struct resource anw6410_dm9000_resource[] = { 167static struct resource anw6410_dm9000_resource[] = {
168 [0] = { 168 [0] = DEFINE_RES_MEM(ANW6410_PA_DM9000, 4),
169 .start = ANW6410_PA_DM9000, 169 [1] = DEFINE_RES_MEM(ANW6410_PA_DM9000 + 4, 501),
170 .end = ANW6410_PA_DM9000 + 3, 170 [2] = DEFINE_RES_NAMED(IRQ_EINT(15), 1, NULL, IORESOURCE_IRQ \
171 .flags = IORESOURCE_MEM, 171 | IRQF_TRIGGER_HIGH),
172 },
173 [1] = {
174 .start = ANW6410_PA_DM9000 + 4,
175 .end = ANW6410_PA_DM9000 + 4 + 500,
176 .flags = IORESOURCE_MEM,
177 },
178 [2] = {
179 .start = IRQ_EINT(15),
180 .end = IRQ_EINT(15),
181 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
182 },
183}; 172};
184 173
185static struct dm9000_plat_data anw6410_dm9000_pdata = { 174static struct dm9000_plat_data anw6410_dm9000_pdata = {
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index e20bf5835365..aa1137fb47e6 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -31,6 +31,7 @@
31#include <linux/spi/spi.h> 31#include <linux/spi/spi.h>
32 32
33#include <linux/i2c/pca953x.h> 33#include <linux/i2c/pca953x.h>
34#include <linux/platform_data/s3c-hsotg.h>
34 35
35#include <video/platform_lcd.h> 36#include <video/platform_lcd.h>
36 37
@@ -61,7 +62,6 @@
61#include <plat/sdhci.h> 62#include <plat/sdhci.h>
62#include <plat/gpio-cfg.h> 63#include <plat/gpio-cfg.h>
63#include <plat/s3c64xx-spi.h> 64#include <plat/s3c64xx-spi.h>
64#include <plat/udc-hs.h>
65 65
66#include <plat/keypad.h> 66#include <plat/keypad.h>
67#include <plat/clock.h> 67#include <plat/clock.h>
@@ -232,21 +232,10 @@ static struct platform_device crag6410_gpio_keydev = {
232}; 232};
233 233
234static struct resource crag6410_dm9k_resource[] = { 234static struct resource crag6410_dm9k_resource[] = {
235 [0] = { 235 [0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN5, 2),
236 .start = S3C64XX_PA_XM0CSN5, 236 [1] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN5 + (1 << 8), 2),
237 .end = S3C64XX_PA_XM0CSN5 + 1, 237 [2] = DEFINE_RES_NAMED(S3C_EINT(17), 1, NULL, IORESOURCE_IRQ \
238 .flags = IORESOURCE_MEM, 238 | IORESOURCE_IRQ_HIGHLEVEL),
239 },
240 [1] = {
241 .start = S3C64XX_PA_XM0CSN5 + (1 << 8),
242 .end = S3C64XX_PA_XM0CSN5 + (1 << 8) + 1,
243 .flags = IORESOURCE_MEM,
244 },
245 [2] = {
246 .start = S3C_EINT(17),
247 .end = S3C_EINT(17),
248 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
249 },
250}; 239};
251 240
252static struct dm9000_plat_data mini6410_dm9k_pdata = { 241static struct dm9000_plat_data mini6410_dm9k_pdata = {
@@ -262,12 +251,7 @@ static struct platform_device crag6410_dm9k_device = {
262}; 251};
263 252
264static struct resource crag6410_mmgpio_resource[] = { 253static struct resource crag6410_mmgpio_resource[] = {
265 [0] = { 254 [0] = DEFINE_RES_MEM_NAMED(S3C64XX_PA_XM0CSN4, 1, "dat"),
266 .name = "dat",
267 .start = S3C64XX_PA_XM0CSN4 + 1,
268 .end = S3C64XX_PA_XM0CSN4 + 1,
269 .flags = IORESOURCE_MEM,
270 },
271}; 255};
272 256
273static struct platform_device crag6410_mmgpio = { 257static struct platform_device crag6410_mmgpio = {
@@ -306,6 +290,24 @@ static struct regulator_consumer_supply wallvdd_consumers[] = {
306 REGULATOR_SUPPLY("SPKVDD2", "1-001a"), 290 REGULATOR_SUPPLY("SPKVDD2", "1-001a"),
307 REGULATOR_SUPPLY("SPKVDDL", "1-001a"), 291 REGULATOR_SUPPLY("SPKVDDL", "1-001a"),
308 REGULATOR_SUPPLY("SPKVDDR", "1-001a"), 292 REGULATOR_SUPPLY("SPKVDDR", "1-001a"),
293
294 REGULATOR_SUPPLY("DC1VDD", "0-0034"),
295 REGULATOR_SUPPLY("DC2VDD", "0-0034"),
296 REGULATOR_SUPPLY("DC3VDD", "0-0034"),
297 REGULATOR_SUPPLY("LDO1VDD", "0-0034"),
298 REGULATOR_SUPPLY("LDO2VDD", "0-0034"),
299 REGULATOR_SUPPLY("LDO4VDD", "0-0034"),
300 REGULATOR_SUPPLY("LDO5VDD", "0-0034"),
301 REGULATOR_SUPPLY("LDO6VDD", "0-0034"),
302 REGULATOR_SUPPLY("LDO7VDD", "0-0034"),
303 REGULATOR_SUPPLY("LDO8VDD", "0-0034"),
304 REGULATOR_SUPPLY("LDO9VDD", "0-0034"),
305 REGULATOR_SUPPLY("LDO10VDD", "0-0034"),
306 REGULATOR_SUPPLY("LDO11VDD", "0-0034"),
307
308 REGULATOR_SUPPLY("DC1VDD", "1-0034"),
309 REGULATOR_SUPPLY("DC2VDD", "1-0034"),
310 REGULATOR_SUPPLY("DC3VDD", "1-0034"),
309}; 311};
310 312
311static struct regulator_init_data wallvdd_data = { 313static struct regulator_init_data wallvdd_data = {
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
index c34c2ab22ead..b2166d4a5538 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -85,21 +85,10 @@ static struct s3c2410_uartcfg mini6410_uartcfgs[] __initdata = {
85/* DM9000AEP 10/100 ethernet controller */ 85/* DM9000AEP 10/100 ethernet controller */
86 86
87static struct resource mini6410_dm9k_resource[] = { 87static struct resource mini6410_dm9k_resource[] = {
88 [0] = { 88 [0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1, 2),
89 .start = S3C64XX_PA_XM0CSN1, 89 [1] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1 + 4, 2),
90 .end = S3C64XX_PA_XM0CSN1 + 1, 90 [2] = DEFINE_RES_NAMED(S3C_EINT(7), 1, NULL, IORESOURCE_IRQ \
91 .flags = IORESOURCE_MEM 91 | IORESOURCE_IRQ_HIGHLEVEL),
92 },
93 [1] = {
94 .start = S3C64XX_PA_XM0CSN1 + 4,
95 .end = S3C64XX_PA_XM0CSN1 + 5,
96 .flags = IORESOURCE_MEM
97 },
98 [2] = {
99 .start = S3C_EINT(7),
100 .end = S3C_EINT(7),
101 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL
102 }
103}; 92};
104 93
105static struct dm9000_plat_data mini6410_dm9k_pdata = { 94static struct dm9000_plat_data mini6410_dm9k_pdata = {
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c
index be2a9a22ab74..5c08266cea21 100644
--- a/arch/arm/mach-s3c64xx/mach-real6410.c
+++ b/arch/arm/mach-s3c64xx/mach-real6410.c
@@ -86,21 +86,10 @@ static struct s3c2410_uartcfg real6410_uartcfgs[] __initdata = {
86/* DM9000AEP 10/100 ethernet controller */ 86/* DM9000AEP 10/100 ethernet controller */
87 87
88static struct resource real6410_dm9k_resource[] = { 88static struct resource real6410_dm9k_resource[] = {
89 [0] = { 89 [0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1, 2),
90 .start = S3C64XX_PA_XM0CSN1, 90 [1] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1 + 4, 2),
91 .end = S3C64XX_PA_XM0CSN1 + 1, 91 [2] = DEFINE_RES_NAMED(S3C_EINT(7), 1, NULL, IORESOURCE_IRQ \
92 .flags = IORESOURCE_MEM 92 | IORESOURCE_IRQ_HIGHLEVEL),
93 },
94 [1] = {
95 .start = S3C64XX_PA_XM0CSN1 + 4,
96 .end = S3C64XX_PA_XM0CSN1 + 5,
97 .flags = IORESOURCE_MEM
98 },
99 [2] = {
100 .start = S3C_EINT(7),
101 .end = S3C_EINT(7),
102 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL
103 }
104}; 93};
105 94
106static struct dm9000_plat_data real6410_dm9k_pdata = { 95static struct dm9000_plat_data real6410_dm9k_pdata = {
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index ce745e19aa27..ceeb1de40376 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -18,6 +18,7 @@
18#include <linux/serial_core.h> 18#include <linux/serial_core.h>
19#include <linux/spi/spi_gpio.h> 19#include <linux/spi/spi_gpio.h>
20#include <linux/usb/gpio_vbus.h> 20#include <linux/usb/gpio_vbus.h>
21#include <linux/platform_data/s3c-hsotg.h>
21 22
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/mach/map.h> 24#include <asm/mach/map.h>
@@ -33,7 +34,6 @@
33#include <plat/gpio-cfg.h> 34#include <plat/gpio-cfg.h>
34#include <plat/hwmon.h> 35#include <plat/hwmon.h>
35#include <plat/regs-serial.h> 36#include <plat/regs-serial.h>
36#include <plat/udc-hs.h>
37#include <plat/usb-control.h> 37#include <plat/usb-control.h>
38#include <plat/sdhci.h> 38#include <plat/sdhci.h>
39#include <plat/ts.h> 39#include <plat/ts.h>
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index d55bc96d9582..7da044f738ac 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -30,6 +30,7 @@
30#include <linux/regulator/fixed.h> 30#include <linux/regulator/fixed.h>
31#include <linux/regulator/machine.h> 31#include <linux/regulator/machine.h>
32#include <linux/pwm_backlight.h> 32#include <linux/pwm_backlight.h>
33#include <linux/platform_data/s3c-hsotg.h>
33 34
34#ifdef CONFIG_SMDK6410_WM1190_EV1 35#ifdef CONFIG_SMDK6410_WM1190_EV1
35#include <linux/mfd/wm8350/core.h> 36#include <linux/mfd/wm8350/core.h>
@@ -72,7 +73,6 @@
72#include <plat/keypad.h> 73#include <plat/keypad.h>
73#include <plat/backlight.h> 74#include <plat/backlight.h>
74#include <plat/regs-fb-v4.h> 75#include <plat/regs-fb-v4.h>
75#include <plat/udc-hs.h>
76 76
77#include "common.h" 77#include "common.h"
78 78
@@ -182,16 +182,9 @@ static struct s3c_fb_platdata smdk6410_lcd_pdata __initdata = {
182 */ 182 */
183 183
184static struct resource smdk6410_smsc911x_resources[] = { 184static struct resource smdk6410_smsc911x_resources[] = {
185 [0] = { 185 [0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN1, SZ_64K),
186 .start = S3C64XX_PA_XM0CSN1, 186 [1] = DEFINE_RES_NAMED(S3C_EINT(10), 1, NULL, IORESOURCE_IRQ \
187 .end = S3C64XX_PA_XM0CSN1 + SZ_64K - 1, 187 | IRQ_TYPE_LEVEL_LOW),
188 .flags = IORESOURCE_MEM,
189 },
190 [1] = {
191 .start = S3C_EINT(10),
192 .end = S3C_EINT(10),
193 .flags = IORESOURCE_IRQ | IRQ_TYPE_LEVEL_LOW,
194 },
195}; 188};
196 189
197static struct smsc911x_platform_config smdk6410_smsc911x_pdata = { 190static struct smsc911x_platform_config smdk6410_smsc911x_pdata = {
diff --git a/arch/arm/mach-s5p64x0/dev-audio.c b/arch/arm/mach-s5p64x0/dev-audio.c
index 35f1f226dabb..91113ddc51da 100644
--- a/arch/arm/mach-s5p64x0/dev-audio.c
+++ b/arch/arm/mach-s5p64x0/dev-audio.c
@@ -51,21 +51,9 @@ static struct s3c_audio_pdata s5p6440_i2s_pdata = {
51}; 51};
52 52
53static struct resource s5p64x0_i2s0_resource[] = { 53static struct resource s5p64x0_i2s0_resource[] = {
54 [0] = { 54 [0] = DEFINE_RES_MEM(S5P64X0_PA_I2S, SZ_256),
55 .start = S5P64X0_PA_I2S, 55 [1] = DEFINE_RES_DMA(DMACH_I2S0_TX),
56 .end = S5P64X0_PA_I2S + 0x100 - 1, 56 [2] = DEFINE_RES_DMA(DMACH_I2S0_RX),
57 .flags = IORESOURCE_MEM,
58 },
59 [1] = {
60 .start = DMACH_I2S0_TX,
61 .end = DMACH_I2S0_TX,
62 .flags = IORESOURCE_DMA,
63 },
64 [2] = {
65 .start = DMACH_I2S0_RX,
66 .end = DMACH_I2S0_RX,
67 .flags = IORESOURCE_DMA,
68 },
69}; 57};
70 58
71struct platform_device s5p6440_device_iis = { 59struct platform_device s5p6440_device_iis = {
@@ -130,21 +118,9 @@ static struct s3c_audio_pdata s5p6450_i2s_pdata = {
130}; 118};
131 119
132static struct resource s5p6450_i2s1_resource[] = { 120static struct resource s5p6450_i2s1_resource[] = {
133 [0] = { 121 [0] = DEFINE_RES_MEM(S5P6450_PA_I2S1, SZ_256),
134 .start = S5P6450_PA_I2S1, 122 [1] = DEFINE_RES_DMA(DMACH_I2S1_TX),
135 .end = S5P6450_PA_I2S1 + 0x100 - 1, 123 [2] = DEFINE_RES_DMA(DMACH_I2S1_RX),
136 .flags = IORESOURCE_MEM,
137 },
138 [1] = {
139 .start = DMACH_I2S1_TX,
140 .end = DMACH_I2S1_TX,
141 .flags = IORESOURCE_DMA,
142 },
143 [2] = {
144 .start = DMACH_I2S1_RX,
145 .end = DMACH_I2S1_RX,
146 .flags = IORESOURCE_DMA,
147 },
148}; 124};
149 125
150struct platform_device s5p6450_device_iis1 = { 126struct platform_device s5p6450_device_iis1 = {
@@ -158,21 +134,9 @@ struct platform_device s5p6450_device_iis1 = {
158}; 134};
159 135
160static struct resource s5p6450_i2s2_resource[] = { 136static struct resource s5p6450_i2s2_resource[] = {
161 [0] = { 137 [0] = DEFINE_RES_MEM(S5P6450_PA_I2S2, SZ_256),
162 .start = S5P6450_PA_I2S2, 138 [1] = DEFINE_RES_DMA(DMACH_I2S2_TX),
163 .end = S5P6450_PA_I2S2 + 0x100 - 1, 139 [2] = DEFINE_RES_DMA(DMACH_I2S2_RX),
164 .flags = IORESOURCE_MEM,
165 },
166 [1] = {
167 .start = DMACH_I2S2_TX,
168 .end = DMACH_I2S2_TX,
169 .flags = IORESOURCE_DMA,
170 },
171 [2] = {
172 .start = DMACH_I2S2_RX,
173 .end = DMACH_I2S2_RX,
174 .flags = IORESOURCE_DMA,
175 },
176}; 140};
177 141
178struct platform_device s5p6450_device_iis2 = { 142struct platform_device s5p6450_device_iis2 = {
@@ -208,21 +172,9 @@ static struct s3c_audio_pdata s5p6440_pcm_pdata = {
208}; 172};
209 173
210static struct resource s5p6440_pcm0_resource[] = { 174static struct resource s5p6440_pcm0_resource[] = {
211 [0] = { 175 [0] = DEFINE_RES_MEM(S5P64X0_PA_PCM, SZ_256),
212 .start = S5P64X0_PA_PCM, 176 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX),
213 .end = S5P64X0_PA_PCM + 0x100 - 1, 177 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX),
214 .flags = IORESOURCE_MEM,
215 },
216 [1] = {
217 .start = DMACH_PCM0_TX,
218 .end = DMACH_PCM0_TX,
219 .flags = IORESOURCE_DMA,
220 },
221 [2] = {
222 .start = DMACH_PCM0_RX,
223 .end = DMACH_PCM0_RX,
224 .flags = IORESOURCE_DMA,
225 },
226}; 178};
227 179
228struct platform_device s5p6440_device_pcm = { 180struct platform_device s5p6440_device_pcm = {
diff --git a/arch/arm/mach-s5pc100/dev-audio.c b/arch/arm/mach-s5pc100/dev-audio.c
index ab2d27172cbc..9d4bde3f1110 100644
--- a/arch/arm/mach-s5pc100/dev-audio.c
+++ b/arch/arm/mach-s5pc100/dev-audio.c
@@ -56,26 +56,10 @@ static struct s3c_audio_pdata i2sv5_pdata = {
56}; 56};
57 57
58static struct resource s5pc100_iis0_resource[] = { 58static struct resource s5pc100_iis0_resource[] = {
59 [0] = { 59 [0] = DEFINE_RES_MEM(S5PC100_PA_I2S0, SZ_256),
60 .start = S5PC100_PA_I2S0, 60 [1] = DEFINE_RES_DMA(DMACH_I2S0_TX),
61 .end = S5PC100_PA_I2S0 + 0x100 - 1, 61 [2] = DEFINE_RES_DMA(DMACH_I2S0_RX),
62 .flags = IORESOURCE_MEM, 62 [3] = DEFINE_RES_DMA(DMACH_I2S0S_TX),
63 },
64 [1] = {
65 .start = DMACH_I2S0_TX,
66 .end = DMACH_I2S0_TX,
67 .flags = IORESOURCE_DMA,
68 },
69 [2] = {
70 .start = DMACH_I2S0_RX,
71 .end = DMACH_I2S0_RX,
72 .flags = IORESOURCE_DMA,
73 },
74 [3] = {
75 .start = DMACH_I2S0S_TX,
76 .end = DMACH_I2S0S_TX,
77 .flags = IORESOURCE_DMA,
78 },
79}; 63};
80 64
81struct platform_device s5pc100_device_iis0 = { 65struct platform_device s5pc100_device_iis0 = {
@@ -103,21 +87,9 @@ static struct s3c_audio_pdata i2sv3_pdata = {
103}; 87};
104 88
105static struct resource s5pc100_iis1_resource[] = { 89static struct resource s5pc100_iis1_resource[] = {
106 [0] = { 90 [0] = DEFINE_RES_MEM(S5PC100_PA_I2S1, SZ_256),
107 .start = S5PC100_PA_I2S1, 91 [1] = DEFINE_RES_DMA(DMACH_I2S1_TX),
108 .end = S5PC100_PA_I2S1 + 0x100 - 1, 92 [2] = DEFINE_RES_DMA(DMACH_I2S1_RX),
109 .flags = IORESOURCE_MEM,
110 },
111 [1] = {
112 .start = DMACH_I2S1_TX,
113 .end = DMACH_I2S1_TX,
114 .flags = IORESOURCE_DMA,
115 },
116 [2] = {
117 .start = DMACH_I2S1_RX,
118 .end = DMACH_I2S1_RX,
119 .flags = IORESOURCE_DMA,
120 },
121}; 93};
122 94
123struct platform_device s5pc100_device_iis1 = { 95struct platform_device s5pc100_device_iis1 = {
@@ -131,21 +103,9 @@ struct platform_device s5pc100_device_iis1 = {
131}; 103};
132 104
133static struct resource s5pc100_iis2_resource[] = { 105static struct resource s5pc100_iis2_resource[] = {
134 [0] = { 106 [0] = DEFINE_RES_MEM(S5PC100_PA_I2S2, SZ_256),
135 .start = S5PC100_PA_I2S2, 107 [1] = DEFINE_RES_DMA(DMACH_I2S2_TX),
136 .end = S5PC100_PA_I2S2 + 0x100 - 1, 108 [2] = DEFINE_RES_DMA(DMACH_I2S2_RX),
137 .flags = IORESOURCE_MEM,
138 },
139 [1] = {
140 .start = DMACH_I2S2_TX,
141 .end = DMACH_I2S2_TX,
142 .flags = IORESOURCE_DMA,
143 },
144 [2] = {
145 .start = DMACH_I2S2_RX,
146 .end = DMACH_I2S2_RX,
147 .flags = IORESOURCE_DMA,
148 },
149}; 109};
150 110
151struct platform_device s5pc100_device_iis2 = { 111struct platform_device s5pc100_device_iis2 = {
@@ -184,21 +144,9 @@ static struct s3c_audio_pdata s3c_pcm_pdata = {
184}; 144};
185 145
186static struct resource s5pc100_pcm0_resource[] = { 146static struct resource s5pc100_pcm0_resource[] = {
187 [0] = { 147 [0] = DEFINE_RES_MEM(S5PC100_PA_PCM0, SZ_256),
188 .start = S5PC100_PA_PCM0, 148 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX),
189 .end = S5PC100_PA_PCM0 + 0x100 - 1, 149 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX),
190 .flags = IORESOURCE_MEM,
191 },
192 [1] = {
193 .start = DMACH_PCM0_TX,
194 .end = DMACH_PCM0_TX,
195 .flags = IORESOURCE_DMA,
196 },
197 [2] = {
198 .start = DMACH_PCM0_RX,
199 .end = DMACH_PCM0_RX,
200 .flags = IORESOURCE_DMA,
201 },
202}; 150};
203 151
204struct platform_device s5pc100_device_pcm0 = { 152struct platform_device s5pc100_device_pcm0 = {
@@ -212,21 +160,9 @@ struct platform_device s5pc100_device_pcm0 = {
212}; 160};
213 161
214static struct resource s5pc100_pcm1_resource[] = { 162static struct resource s5pc100_pcm1_resource[] = {
215 [0] = { 163 [0] = DEFINE_RES_MEM(S5PC100_PA_PCM1, SZ_256),
216 .start = S5PC100_PA_PCM1, 164 [1] = DEFINE_RES_DMA(DMACH_PCM1_TX),
217 .end = S5PC100_PA_PCM1 + 0x100 - 1, 165 [2] = DEFINE_RES_DMA(DMACH_PCM1_RX),
218 .flags = IORESOURCE_MEM,
219 },
220 [1] = {
221 .start = DMACH_PCM1_TX,
222 .end = DMACH_PCM1_TX,
223 .flags = IORESOURCE_DMA,
224 },
225 [2] = {
226 .start = DMACH_PCM1_RX,
227 .end = DMACH_PCM1_RX,
228 .flags = IORESOURCE_DMA,
229 },
230}; 166};
231 167
232struct platform_device s5pc100_device_pcm1 = { 168struct platform_device s5pc100_device_pcm1 = {
@@ -247,31 +183,11 @@ static int s5pc100_ac97_cfg_gpio(struct platform_device *pdev)
247} 183}
248 184
249static struct resource s5pc100_ac97_resource[] = { 185static struct resource s5pc100_ac97_resource[] = {
250 [0] = { 186 [0] = DEFINE_RES_MEM(S5PC100_PA_AC97, SZ_256),
251 .start = S5PC100_PA_AC97, 187 [1] = DEFINE_RES_DMA(DMACH_AC97_PCMOUT),
252 .end = S5PC100_PA_AC97 + 0x100 - 1, 188 [2] = DEFINE_RES_DMA(DMACH_AC97_PCMIN),
253 .flags = IORESOURCE_MEM, 189 [3] = DEFINE_RES_DMA(DMACH_AC97_MICIN),
254 }, 190 [4] = DEFINE_RES_IRQ(IRQ_AC97),
255 [1] = {
256 .start = DMACH_AC97_PCMOUT,
257 .end = DMACH_AC97_PCMOUT,
258 .flags = IORESOURCE_DMA,
259 },
260 [2] = {
261 .start = DMACH_AC97_PCMIN,
262 .end = DMACH_AC97_PCMIN,
263 .flags = IORESOURCE_DMA,
264 },
265 [3] = {
266 .start = DMACH_AC97_MICIN,
267 .end = DMACH_AC97_MICIN,
268 .flags = IORESOURCE_DMA,
269 },
270 [4] = {
271 .start = IRQ_AC97,
272 .end = IRQ_AC97,
273 .flags = IORESOURCE_IRQ,
274 },
275}; 191};
276 192
277static struct s3c_audio_pdata s3c_ac97_pdata = { 193static struct s3c_audio_pdata s3c_ac97_pdata = {
@@ -308,16 +224,8 @@ static int s5pc100_spdif_cfg_gpg3(struct platform_device *pdev)
308} 224}
309 225
310static struct resource s5pc100_spdif_resource[] = { 226static struct resource s5pc100_spdif_resource[] = {
311 [0] = { 227 [0] = DEFINE_RES_MEM(S5PC100_PA_SPDIF, SZ_256),
312 .start = S5PC100_PA_SPDIF, 228 [1] = DEFINE_RES_DMA(DMACH_SPDIF),
313 .end = S5PC100_PA_SPDIF + 0x100 - 1,
314 .flags = IORESOURCE_MEM,
315 },
316 [1] = {
317 .start = DMACH_SPDIF,
318 .end = DMACH_SPDIF,
319 .flags = IORESOURCE_DMA,
320 },
321}; 229};
322 230
323static struct s3c_audio_pdata s5p_spdif_pdata = { 231static struct s3c_audio_pdata s5p_spdif_pdata = {
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 29594fc4fdf4..88e983b0c82e 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -85,6 +85,7 @@ config MACH_AQUILA
85 select S5P_DEV_ONENAND 85 select S5P_DEV_ONENAND
86 select S5PV210_SETUP_FB_24BPP 86 select S5PV210_SETUP_FB_24BPP
87 select S5PV210_SETUP_SDHCI 87 select S5PV210_SETUP_SDHCI
88 select S5PV210_SETUP_USB_PHY
88 help 89 help
89 Machine support for the Samsung Aquila target based on S5PC110 SoC 90 Machine support for the Samsung Aquila target based on S5PC110 SoC
90 91
diff --git a/arch/arm/mach-s5pv210/dev-audio.c b/arch/arm/mach-s5pv210/dev-audio.c
index 63f5d82004b5..8367749c3eec 100644
--- a/arch/arm/mach-s5pv210/dev-audio.c
+++ b/arch/arm/mach-s5pv210/dev-audio.c
@@ -59,26 +59,10 @@ static struct s3c_audio_pdata i2sv5_pdata = {
59}; 59};
60 60
61static struct resource s5pv210_iis0_resource[] = { 61static struct resource s5pv210_iis0_resource[] = {
62 [0] = { 62 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS0, SZ_256),
63 .start = S5PV210_PA_IIS0, 63 [1] = DEFINE_RES_DMA(DMACH_I2S0_TX),
64 .end = S5PV210_PA_IIS0 + 0x100 - 1, 64 [2] = DEFINE_RES_DMA(DMACH_I2S0_RX),
65 .flags = IORESOURCE_MEM, 65 [3] = DEFINE_RES_DMA(DMACH_I2S0S_TX),
66 },
67 [1] = {
68 .start = DMACH_I2S0_TX,
69 .end = DMACH_I2S0_TX,
70 .flags = IORESOURCE_DMA,
71 },
72 [2] = {
73 .start = DMACH_I2S0_RX,
74 .end = DMACH_I2S0_RX,
75 .flags = IORESOURCE_DMA,
76 },
77 [3] = {
78 .start = DMACH_I2S0S_TX,
79 .end = DMACH_I2S0S_TX,
80 .flags = IORESOURCE_DMA,
81 },
82}; 66};
83 67
84struct platform_device s5pv210_device_iis0 = { 68struct platform_device s5pv210_device_iis0 = {
@@ -106,21 +90,9 @@ static struct s3c_audio_pdata i2sv3_pdata = {
106}; 90};
107 91
108static struct resource s5pv210_iis1_resource[] = { 92static struct resource s5pv210_iis1_resource[] = {
109 [0] = { 93 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS1, SZ_256),
110 .start = S5PV210_PA_IIS1, 94 [1] = DEFINE_RES_DMA(DMACH_I2S1_TX),
111 .end = S5PV210_PA_IIS1 + 0x100 - 1, 95 [2] = DEFINE_RES_DMA(DMACH_I2S1_RX),
112 .flags = IORESOURCE_MEM,
113 },
114 [1] = {
115 .start = DMACH_I2S1_TX,
116 .end = DMACH_I2S1_TX,
117 .flags = IORESOURCE_DMA,
118 },
119 [2] = {
120 .start = DMACH_I2S1_RX,
121 .end = DMACH_I2S1_RX,
122 .flags = IORESOURCE_DMA,
123 },
124}; 96};
125 97
126struct platform_device s5pv210_device_iis1 = { 98struct platform_device s5pv210_device_iis1 = {
@@ -134,21 +106,9 @@ struct platform_device s5pv210_device_iis1 = {
134}; 106};
135 107
136static struct resource s5pv210_iis2_resource[] = { 108static struct resource s5pv210_iis2_resource[] = {
137 [0] = { 109 [0] = DEFINE_RES_MEM(S5PV210_PA_IIS2, SZ_256),
138 .start = S5PV210_PA_IIS2, 110 [1] = DEFINE_RES_DMA(DMACH_I2S2_TX),
139 .end = S5PV210_PA_IIS2 + 0x100 - 1, 111 [2] = DEFINE_RES_DMA(DMACH_I2S2_RX),
140 .flags = IORESOURCE_MEM,
141 },
142 [1] = {
143 .start = DMACH_I2S2_TX,
144 .end = DMACH_I2S2_TX,
145 .flags = IORESOURCE_DMA,
146 },
147 [2] = {
148 .start = DMACH_I2S2_RX,
149 .end = DMACH_I2S2_RX,
150 .flags = IORESOURCE_DMA,
151 },
152}; 112};
153 113
154struct platform_device s5pv210_device_iis2 = { 114struct platform_device s5pv210_device_iis2 = {
@@ -188,21 +148,9 @@ static struct s3c_audio_pdata s3c_pcm_pdata = {
188}; 148};
189 149
190static struct resource s5pv210_pcm0_resource[] = { 150static struct resource s5pv210_pcm0_resource[] = {
191 [0] = { 151 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM0, SZ_256),
192 .start = S5PV210_PA_PCM0, 152 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX),
193 .end = S5PV210_PA_PCM0 + 0x100 - 1, 153 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX),
194 .flags = IORESOURCE_MEM,
195 },
196 [1] = {
197 .start = DMACH_PCM0_TX,
198 .end = DMACH_PCM0_TX,
199 .flags = IORESOURCE_DMA,
200 },
201 [2] = {
202 .start = DMACH_PCM0_RX,
203 .end = DMACH_PCM0_RX,
204 .flags = IORESOURCE_DMA,
205 },
206}; 154};
207 155
208struct platform_device s5pv210_device_pcm0 = { 156struct platform_device s5pv210_device_pcm0 = {
@@ -216,21 +164,9 @@ struct platform_device s5pv210_device_pcm0 = {
216}; 164};
217 165
218static struct resource s5pv210_pcm1_resource[] = { 166static struct resource s5pv210_pcm1_resource[] = {
219 [0] = { 167 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM1, SZ_256),
220 .start = S5PV210_PA_PCM1, 168 [1] = DEFINE_RES_DMA(DMACH_PCM1_TX),
221 .end = S5PV210_PA_PCM1 + 0x100 - 1, 169 [2] = DEFINE_RES_DMA(DMACH_PCM1_RX),
222 .flags = IORESOURCE_MEM,
223 },
224 [1] = {
225 .start = DMACH_PCM1_TX,
226 .end = DMACH_PCM1_TX,
227 .flags = IORESOURCE_DMA,
228 },
229 [2] = {
230 .start = DMACH_PCM1_RX,
231 .end = DMACH_PCM1_RX,
232 .flags = IORESOURCE_DMA,
233 },
234}; 170};
235 171
236struct platform_device s5pv210_device_pcm1 = { 172struct platform_device s5pv210_device_pcm1 = {
@@ -244,21 +180,9 @@ struct platform_device s5pv210_device_pcm1 = {
244}; 180};
245 181
246static struct resource s5pv210_pcm2_resource[] = { 182static struct resource s5pv210_pcm2_resource[] = {
247 [0] = { 183 [0] = DEFINE_RES_MEM(S5PV210_PA_PCM2, SZ_256),
248 .start = S5PV210_PA_PCM2, 184 [1] = DEFINE_RES_DMA(DMACH_PCM2_TX),
249 .end = S5PV210_PA_PCM2 + 0x100 - 1, 185 [2] = DEFINE_RES_DMA(DMACH_PCM2_RX),
250 .flags = IORESOURCE_MEM,
251 },
252 [1] = {
253 .start = DMACH_PCM2_TX,
254 .end = DMACH_PCM2_TX,
255 .flags = IORESOURCE_DMA,
256 },
257 [2] = {
258 .start = DMACH_PCM2_RX,
259 .end = DMACH_PCM2_RX,
260 .flags = IORESOURCE_DMA,
261 },
262}; 186};
263 187
264struct platform_device s5pv210_device_pcm2 = { 188struct platform_device s5pv210_device_pcm2 = {
@@ -279,31 +203,11 @@ static int s5pv210_ac97_cfg_gpio(struct platform_device *pdev)
279} 203}
280 204
281static struct resource s5pv210_ac97_resource[] = { 205static struct resource s5pv210_ac97_resource[] = {
282 [0] = { 206 [0] = DEFINE_RES_MEM(S5PV210_PA_AC97, SZ_256),
283 .start = S5PV210_PA_AC97, 207 [1] = DEFINE_RES_DMA(DMACH_AC97_PCMOUT),
284 .end = S5PV210_PA_AC97 + 0x100 - 1, 208 [2] = DEFINE_RES_DMA(DMACH_AC97_PCMIN),
285 .flags = IORESOURCE_MEM, 209 [3] = DEFINE_RES_DMA(DMACH_AC97_MICIN),
286 }, 210 [4] = DEFINE_RES_IRQ(IRQ_AC97),
287 [1] = {
288 .start = DMACH_AC97_PCMOUT,
289 .end = DMACH_AC97_PCMOUT,
290 .flags = IORESOURCE_DMA,
291 },
292 [2] = {
293 .start = DMACH_AC97_PCMIN,
294 .end = DMACH_AC97_PCMIN,
295 .flags = IORESOURCE_DMA,
296 },
297 [3] = {
298 .start = DMACH_AC97_MICIN,
299 .end = DMACH_AC97_MICIN,
300 .flags = IORESOURCE_DMA,
301 },
302 [4] = {
303 .start = IRQ_AC97,
304 .end = IRQ_AC97,
305 .flags = IORESOURCE_IRQ,
306 },
307}; 211};
308 212
309static struct s3c_audio_pdata s3c_ac97_pdata = { 213static struct s3c_audio_pdata s3c_ac97_pdata = {
@@ -334,16 +238,8 @@ static int s5pv210_spdif_cfg_gpio(struct platform_device *pdev)
334} 238}
335 239
336static struct resource s5pv210_spdif_resource[] = { 240static struct resource s5pv210_spdif_resource[] = {
337 [0] = { 241 [0] = DEFINE_RES_MEM(S5PV210_PA_SPDIF, SZ_256),
338 .start = S5PV210_PA_SPDIF, 242 [1] = DEFINE_RES_DMA(DMACH_SPDIF),
339 .end = S5PV210_PA_SPDIF + 0x100 - 1,
340 .flags = IORESOURCE_MEM,
341 },
342 [1] = {
343 .start = DMACH_SPDIF,
344 .end = DMACH_SPDIF,
345 .flags = IORESOURCE_DMA,
346 },
347}; 243};
348 244
349static struct s3c_audio_pdata samsung_spdif_pdata = { 245static struct s3c_audio_pdata samsung_spdif_pdata = {
diff --git a/arch/arm/mach-s5pv210/dma.c b/arch/arm/mach-s5pv210/dma.c
index 86ce62f66190..b8337e248b09 100644
--- a/arch/arm/mach-s5pv210/dma.c
+++ b/arch/arm/mach-s5pv210/dma.c
@@ -33,8 +33,6 @@
33#include <mach/irqs.h> 33#include <mach/irqs.h>
34#include <mach/dma.h> 34#include <mach/dma.h>
35 35
36static u64 dma_dmamask = DMA_BIT_MASK(32);
37
38static u8 pdma0_peri[] = { 36static u8 pdma0_peri[] = {
39 DMACH_UART0_RX, 37 DMACH_UART0_RX,
40 DMACH_UART0_TX, 38 DMACH_UART0_TX,
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
index a9ea64e0da0d..48d018f2332b 100644
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ b/arch/arm/mach-s5pv210/mach-aquila.c
@@ -484,8 +484,8 @@ static struct wm8994_pdata wm8994_platform_data = {
484 .gpio_defaults[8] = 0x0100, 484 .gpio_defaults[8] = 0x0100,
485 .gpio_defaults[9] = 0x0100, 485 .gpio_defaults[9] = 0x0100,
486 .gpio_defaults[10] = 0x0100, 486 .gpio_defaults[10] = 0x0100,
487 .ldo[0] = { S5PV210_MP03(6), NULL, &wm8994_ldo1_data }, /* XM0FRNB_2 */ 487 .ldo[0] = { S5PV210_MP03(6), &wm8994_ldo1_data }, /* XM0FRNB_2 */
488 .ldo[1] = { 0, NULL, &wm8994_ldo2_data }, 488 .ldo[1] = { 0, &wm8994_ldo2_data },
489}; 489};
490 490
491/* GPIO I2C PMIC */ 491/* GPIO I2C PMIC */
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index 2cf5ed75f390..f20a97c8e411 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -25,7 +25,9 @@
25#include <linux/gpio_keys.h> 25#include <linux/gpio_keys.h>
26#include <linux/input.h> 26#include <linux/input.h>
27#include <linux/gpio.h> 27#include <linux/gpio.h>
28#include <linux/mmc/host.h>
28#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/platform_data/s3c-hsotg.h>
29 31
30#include <asm/hardware/vic.h> 32#include <asm/hardware/vic.h>
31#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
@@ -277,6 +279,9 @@ static void __init goni_tsp_init(void)
277 i2c2_devs[0].irq = gpio_to_irq(gpio); 279 i2c2_devs[0].irq = gpio_to_irq(gpio);
278} 280}
279 281
282/* USB OTG */
283static struct s3c_hsotg_plat goni_hsotg_pdata;
284
280static void goni_camera_init(void) 285static void goni_camera_init(void)
281{ 286{
282 s5pv210_fimc_setup_gpio(S5P_CAMPORT_A); 287 s5pv210_fimc_setup_gpio(S5P_CAMPORT_A);
@@ -674,8 +679,8 @@ static struct wm8994_pdata wm8994_platform_data = {
674 .gpio_defaults[8] = 0x0100, 679 .gpio_defaults[8] = 0x0100,
675 .gpio_defaults[9] = 0x0100, 680 .gpio_defaults[9] = 0x0100,
676 .gpio_defaults[10] = 0x0100, 681 .gpio_defaults[10] = 0x0100,
677 .ldo[0] = { S5PV210_MP03(6), NULL, &wm8994_ldo1_data }, /* XM0FRNB_2 */ 682 .ldo[0] = { S5PV210_MP03(6), &wm8994_ldo1_data }, /* XM0FRNB_2 */
678 .ldo[1] = { 0, NULL, &wm8994_ldo2_data }, 683 .ldo[1] = { 0, &wm8994_ldo2_data },
679}; 684};
680 685
681/* GPIO I2C PMIC */ 686/* GPIO I2C PMIC */
@@ -765,6 +770,7 @@ static void __init goni_pmic_init(void)
765/* MoviNAND */ 770/* MoviNAND */
766static struct s3c_sdhci_platdata goni_hsmmc0_data __initdata = { 771static struct s3c_sdhci_platdata goni_hsmmc0_data __initdata = {
767 .max_width = 4, 772 .max_width = 4,
773 .host_caps2 = MMC_CAP2_BROKEN_VOLTAGE,
768 .cd_type = S3C_SDHCI_CD_PERMANENT, 774 .cd_type = S3C_SDHCI_CD_PERMANENT,
769}; 775};
770 776
@@ -939,6 +945,8 @@ static void __init goni_machine_init(void)
939 s3c_set_platdata(&goni_fimc_md_platdata, sizeof(goni_fimc_md_platdata), 945 s3c_set_platdata(&goni_fimc_md_platdata, sizeof(goni_fimc_md_platdata),
940 &s5p_device_fimc_md); 946 &s5p_device_fimc_md);
941 947
948 s3c_hsotg_set_platdata(&goni_hsotg_pdata);
949
942 goni_camera_init(); 950 goni_camera_init();
943 951
944 /* SPI */ 952 /* SPI */
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index 91d4ad8bcc73..fa1b61209fd9 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -119,21 +119,10 @@ static struct samsung_keypad_platdata smdkv210_keypad_data __initdata = {
119}; 119};
120 120
121static struct resource smdkv210_dm9000_resources[] = { 121static struct resource smdkv210_dm9000_resources[] = {
122 [0] = { 122 [0] = DEFINE_RES_MEM(S5PV210_PA_SROM_BANK5, 1),
123 .start = S5PV210_PA_SROM_BANK5, 123 [1] = DEFINE_RES_MEM(S5PV210_PA_SROM_BANK5 + 2, 1),
124 .end = S5PV210_PA_SROM_BANK5, 124 [2] = DEFINE_RES_NAMED(IRQ_EINT(9), 1, NULL, IORESOURCE_IRQ \
125 .flags = IORESOURCE_MEM, 125 | IORESOURCE_IRQ_HIGHLEVEL),
126 },
127 [1] = {
128 .start = S5PV210_PA_SROM_BANK5 + 2,
129 .end = S5PV210_PA_SROM_BANK5 + 2,
130 .flags = IORESOURCE_MEM,
131 },
132 [2] = {
133 .start = IRQ_EINT(9),
134 .end = IRQ_EINT(9),
135 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
136 },
137}; 126};
138 127
139static struct dm9000_plat_data smdkv210_dm9000_platdata = { 128static struct dm9000_plat_data smdkv210_dm9000_platdata = {
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 7c524b4e415d..16be4c56abe3 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -306,7 +306,7 @@ void sa11x0_register_irda(struct irda_platform_data *irda)
306} 306}
307 307
308static struct resource sa1100_rtc_resources[] = { 308static struct resource sa1100_rtc_resources[] = {
309 DEFINE_RES_MEM(0x90010000, 0x9001003f), 309 DEFINE_RES_MEM(0x90010000, 0x40),
310 DEFINE_RES_IRQ_NAMED(IRQ_RTC1Hz, "rtc 1Hz"), 310 DEFINE_RES_IRQ_NAMED(IRQ_RTC1Hz, "rtc 1Hz"),
311 DEFINE_RES_IRQ_NAMED(IRQ_RTCAlrm, "rtc alarm"), 311 DEFINE_RES_IRQ_NAMED(IRQ_RTCAlrm, "rtc alarm"),
312}; 312};
diff --git a/arch/arm/mach-sa1100/pci-nanoengine.c b/arch/arm/mach-sa1100/pci-nanoengine.c
index b49108b890a8..ff02e2da99f2 100644
--- a/arch/arm/mach-sa1100/pci-nanoengine.c
+++ b/arch/arm/mach-sa1100/pci-nanoengine.c
@@ -129,12 +129,6 @@ static int __init pci_nanoengine_map_irq(const struct pci_dev *dev, u8 slot,
129 return NANOENGINE_IRQ_GPIO_PCI; 129 return NANOENGINE_IRQ_GPIO_PCI;
130} 130}
131 131
132struct pci_bus * __init pci_nanoengine_scan_bus(int nr, struct pci_sys_data *sys)
133{
134 return pci_scan_root_bus(NULL, sys->busnr, &pci_nano_ops, sys,
135 &sys->resources);
136}
137
138static struct resource pci_io_ports = 132static struct resource pci_io_ports =
139 DEFINE_RES_IO_NAMED(0x400, 0x400, "PCI IO"); 133 DEFINE_RES_IO_NAMED(0x400, 0x400, "PCI IO");
140 134
@@ -274,7 +268,7 @@ int __init pci_nanoengine_setup(int nr, struct pci_sys_data *sys)
274static struct hw_pci nanoengine_pci __initdata = { 268static struct hw_pci nanoengine_pci __initdata = {
275 .map_irq = pci_nanoengine_map_irq, 269 .map_irq = pci_nanoengine_map_irq,
276 .nr_controllers = 1, 270 .nr_controllers = 1,
277 .scan = pci_nanoengine_scan_bus, 271 .ops = &pci_nano_ops,
278 .setup = pci_nanoengine_setup, 272 .setup = pci_nanoengine_setup,
279}; 273};
280 274
diff --git a/arch/arm/mach-shark/pci.c b/arch/arm/mach-shark/pci.c
index 7cb79a092f31..9089407d5326 100644
--- a/arch/arm/mach-shark/pci.c
+++ b/arch/arm/mach-shark/pci.c
@@ -29,10 +29,9 @@ extern void __init via82c505_preinit(void);
29 29
30static struct hw_pci shark_pci __initdata = { 30static struct hw_pci shark_pci __initdata = {
31 .setup = via82c505_setup, 31 .setup = via82c505_setup,
32 .swizzle = pci_std_swizzle,
33 .map_irq = shark_map_irq, 32 .map_irq = shark_map_irq,
34 .nr_controllers = 1, 33 .nr_controllers = 1,
35 .scan = via82c505_scan_bus, 34 .ops = &via82c505_ops,
36 .preinit = via82c505_preinit, 35 .preinit = via82c505_preinit,
37}; 36};
38 37
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 34560cab45d9..98327b7a503c 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -41,6 +41,12 @@ config ARCH_R8A7779
41 select ARM_GIC 41 select ARM_GIC
42 select ARCH_WANT_OPTIONAL_GPIOLIB 42 select ARCH_WANT_OPTIONAL_GPIOLIB
43 43
44config ARCH_EMEV2
45 bool "Emma Mobile EV2"
46 select CPU_V7
47 select ARM_GIC
48 select ARCH_WANT_OPTIONAL_GPIOLIB
49
44comment "SH-Mobile Board Type" 50comment "SH-Mobile Board Type"
45 51
46config MACH_G3EVM 52config MACH_G3EVM
@@ -93,11 +99,28 @@ config MACH_BONITO
93 select ARCH_REQUIRE_GPIOLIB 99 select ARCH_REQUIRE_GPIOLIB
94 depends on ARCH_R8A7740 100 depends on ARCH_R8A7740
95 101
102config MACH_ARMADILLO800EVA
103 bool "Armadillo-800 EVA board"
104 depends on ARCH_R8A7740
105 select ARCH_REQUIRE_GPIOLIB
106 select USE_OF
107
96config MACH_MARZEN 108config MACH_MARZEN
97 bool "MARZEN board" 109 bool "MARZEN board"
98 depends on ARCH_R8A7779 110 depends on ARCH_R8A7779
99 select ARCH_REQUIRE_GPIOLIB 111 select ARCH_REQUIRE_GPIOLIB
100 112
113config MACH_KZM9D
114 bool "KZM9D board"
115 depends on ARCH_EMEV2
116 select USE_OF
117
118config MACH_KZM9G
119 bool "KZM-A9-GT board"
120 depends on ARCH_SH73A0
121 select ARCH_REQUIRE_GPIOLIB
122 select USE_OF
123
101comment "SH-Mobile System Configuration" 124comment "SH-Mobile System Configuration"
102 125
103config CPU_HAS_INTEVT 126config CPU_HAS_INTEVT
@@ -110,7 +133,8 @@ config MEMORY_START
110 hex "Physical memory start address" 133 hex "Physical memory start address"
111 default "0x50000000" if MACH_G3EVM 134 default "0x50000000" if MACH_G3EVM
112 default "0x40000000" if MACH_G4EVM || MACH_AP4EVB || MACH_AG5EVM || \ 135 default "0x40000000" if MACH_G4EVM || MACH_AP4EVB || MACH_AG5EVM || \
113 MACH_MACKEREL || MACH_BONITO 136 MACH_MACKEREL || MACH_BONITO || \
137 MACH_ARMADILLO800EVA
114 default "0x41000000" if MACH_KOTA2 138 default "0x41000000" if MACH_KOTA2
115 default "0x00000000" 139 default "0x00000000"
116 ---help--- 140 ---help---
@@ -122,7 +146,8 @@ config MEMORY_SIZE
122 hex "Physical memory size" 146 hex "Physical memory size"
123 default "0x08000000" if MACH_G3EVM 147 default "0x08000000" if MACH_G3EVM
124 default "0x08000000" if MACH_G4EVM 148 default "0x08000000" if MACH_G4EVM
125 default "0x20000000" if MACH_AG5EVM || MACH_BONITO 149 default "0x20000000" if MACH_AG5EVM || MACH_BONITO || \
150 MACH_ARMADILLO800EVA
126 default "0x1e000000" if MACH_KOTA2 151 default "0x1e000000" if MACH_KOTA2
127 default "0x10000000" if MACH_AP4EVB || MACH_MACKEREL 152 default "0x10000000" if MACH_AP4EVB || MACH_MACKEREL
128 default "0x04000000" 153 default "0x04000000"
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index e7c2590b75d9..e6b177bc9410 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -12,12 +12,14 @@ obj-$(CONFIG_ARCH_SH7372) += setup-sh7372.o clock-sh7372.o intc-sh7372.o
12obj-$(CONFIG_ARCH_SH73A0) += setup-sh73a0.o clock-sh73a0.o intc-sh73a0.o 12obj-$(CONFIG_ARCH_SH73A0) += setup-sh73a0.o clock-sh73a0.o intc-sh73a0.o
13obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o clock-r8a7740.o intc-r8a7740.o 13obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o clock-r8a7740.o intc-r8a7740.o
14obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o clock-r8a7779.o intc-r8a7779.o 14obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o clock-r8a7779.o intc-r8a7779.o
15obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o clock-emev2.o
15 16
16# SMP objects 17# SMP objects
17smp-y := platsmp.o headsmp.o 18smp-y := platsmp.o headsmp.o
18smp-$(CONFIG_HOTPLUG_CPU) += hotplug.o 19smp-$(CONFIG_HOTPLUG_CPU) += hotplug.o
19smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o 20smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o
20smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o 21smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o
22smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o
21 23
22# Pinmux setup 24# Pinmux setup
23pfc-y := 25pfc-y :=
@@ -49,6 +51,9 @@ obj-$(CONFIG_MACH_MACKEREL) += board-mackerel.o
49obj-$(CONFIG_MACH_KOTA2) += board-kota2.o 51obj-$(CONFIG_MACH_KOTA2) += board-kota2.o
50obj-$(CONFIG_MACH_BONITO) += board-bonito.o 52obj-$(CONFIG_MACH_BONITO) += board-bonito.o
51obj-$(CONFIG_MACH_MARZEN) += board-marzen.o 53obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
54obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
55obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o
56obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o
52 57
53# Framework support 58# Framework support
54obj-$(CONFIG_SMP) += $(smp-y) 59obj-$(CONFIG_SMP) += $(smp-y)
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index cb224a344af0..0891ec6e27f5 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -365,23 +365,13 @@ static struct platform_device mipidsi0_device = {
365}; 365};
366 366
367/* SDHI0 */ 367/* SDHI0 */
368static irqreturn_t ag5evm_sdhi0_gpio_cd(int irq, void *arg)
369{
370 struct device *dev = arg;
371 struct sh_mobile_sdhi_info *info = dev->platform_data;
372 struct tmio_mmc_data *pdata = info->pdata;
373
374 tmio_mmc_cd_wakeup(pdata);
375
376 return IRQ_HANDLED;
377}
378
379static struct sh_mobile_sdhi_info sdhi0_info = { 368static struct sh_mobile_sdhi_info sdhi0_info = {
380 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 369 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
381 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 370 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
382 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, 371 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
383 .tmio_caps = MMC_CAP_SD_HIGHSPEED, 372 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
384 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29, 373 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
374 .cd_gpio = GPIO_PORT251,
385}; 375};
386 376
387static struct resource sdhi0_resources[] = { 377static struct resource sdhi0_resources[] = {
@@ -557,7 +547,6 @@ static void __init ag5evm_init(void)
557 lcd_backlight_reset(); 547 lcd_backlight_reset();
558 548
559 /* enable SDHI0 on CN15 [SD I/F] */ 549 /* enable SDHI0 on CN15 [SD I/F] */
560 gpio_request(GPIO_FN_SDHICD0, NULL);
561 gpio_request(GPIO_FN_SDHIWP0, NULL); 550 gpio_request(GPIO_FN_SDHIWP0, NULL);
562 gpio_request(GPIO_FN_SDHICMD0, NULL); 551 gpio_request(GPIO_FN_SDHICMD0, NULL);
563 gpio_request(GPIO_FN_SDHICLK0, NULL); 552 gpio_request(GPIO_FN_SDHICLK0, NULL);
@@ -566,13 +555,6 @@ static void __init ag5evm_init(void)
566 gpio_request(GPIO_FN_SDHID0_1, NULL); 555 gpio_request(GPIO_FN_SDHID0_1, NULL);
567 gpio_request(GPIO_FN_SDHID0_0, NULL); 556 gpio_request(GPIO_FN_SDHID0_0, NULL);
568 557
569 if (!request_irq(intcs_evt2irq(0x3c0), ag5evm_sdhi0_gpio_cd,
570 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
571 "sdhi0 cd", &sdhi0_device.dev))
572 sdhi0_info.tmio_flags |= TMIO_MMC_HAS_COLD_CD;
573 else
574 pr_warn("Unable to setup SDHI0 GPIO IRQ\n");
575
576 /* enable SDHI1 on CN4 [WLAN I/F] */ 558 /* enable SDHI1 on CN4 [WLAN I/F] */
577 gpio_request(GPIO_FN_SDHICLK1, NULL); 559 gpio_request(GPIO_FN_SDHICLK1, NULL);
578 gpio_request(GPIO_FN_SDHICMD1_PU, NULL); 560 gpio_request(GPIO_FN_SDHICMD1_PU, NULL);
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index b56dde2732bb..0c3caeba2f3e 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -997,6 +997,8 @@ static struct sh_mobile_ceu_companion csi2 = {
997 997
998static struct sh_mobile_ceu_info sh_mobile_ceu_info = { 998static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
999 .flags = SH_CEU_FLAG_USE_8BIT_BUS, 999 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
1000 .max_width = 8188,
1001 .max_height = 8188,
1000 .csi2 = &csi2, 1002 .csi2 = &csi2,
1001}; 1003};
1002 1004
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
new file mode 100644
index 000000000000..9e37026ef9dd
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -0,0 +1,784 @@
1/*
2 * armadillo 800 eva board support
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22#include <linux/clk.h>
23#include <linux/delay.h>
24#include <linux/err.h>
25#include <linux/kernel.h>
26#include <linux/input.h>
27#include <linux/irq.h>
28#include <linux/platform_device.h>
29#include <linux/gpio.h>
30#include <linux/gpio_keys.h>
31#include <linux/sh_eth.h>
32#include <linux/videodev2.h>
33#include <linux/usb/renesas_usbhs.h>
34#include <linux/mfd/tmio.h>
35#include <linux/mmc/host.h>
36#include <linux/mmc/sh_mmcif.h>
37#include <linux/mmc/sh_mobile_sdhi.h>
38#include <mach/common.h>
39#include <mach/irqs.h>
40#include <asm/page.h>
41#include <asm/mach-types.h>
42#include <asm/mach/arch.h>
43#include <asm/mach/map.h>
44#include <asm/mach/time.h>
45#include <asm/hardware/cache-l2x0.h>
46#include <mach/r8a7740.h>
47#include <video/sh_mobile_lcdc.h>
48
49/*
50 * CON1 Camera Module
51 * CON2 Extension Bus
52 * CON3 HDMI Output
53 * CON4 Composite Video Output
54 * CON5 H-UDI JTAG
55 * CON6 ARM JTAG
56 * CON7 SD1
57 * CON8 SD2
58 * CON9 RTC BackUp
59 * CON10 Monaural Mic Input
60 * CON11 Stereo Headphone Output
61 * CON12 Audio Line Output(L)
62 * CON13 Audio Line Output(R)
63 * CON14 AWL13 Module
64 * CON15 Extension
65 * CON16 LCD1
66 * CON17 LCD2
67 * CON19 Power Input
68 * CON20 USB1
69 * CON21 USB2
70 * CON22 Serial
71 * CON23 LAN
72 * CON24 USB3
73 * LED1 Camera LED(Yellow)
74 * LED2 Power LED (Green)
75 * ED3-LED6 User LED(Yellow)
76 * LED7 LAN link LED(Green)
77 * LED8 LAN activity LED(Yellow)
78 */
79
80/*
81 * DipSwitch
82 *
83 * SW1
84 *
85 * -12345678-+---------------+----------------------------
86 * 1 | boot | hermit
87 * 0 | boot | OS auto boot
88 * -12345678-+---------------+----------------------------
89 * 00 | boot device | eMMC
90 * 10 | boot device | SDHI0 (CON7)
91 * 01 | boot device | -
92 * 11 | boot device | Extension Buss (CS0)
93 * -12345678-+---------------+----------------------------
94 * 0 | Extension Bus | D8-D15 disable, eMMC enable
95 * 1 | Extension Bus | D8-D15 enable, eMMC disable
96 * -12345678-+---------------+----------------------------
97 * 0 | SDHI1 | COM8 disable, COM14 enable
98 * 1 | SDHI1 | COM8 enable, COM14 disable
99 * -12345678-+---------------+----------------------------
100 * 0 | USB0 | COM20 enable, COM24 disable
101 * 1 | USB0 | COM20 disable, COM24 enable
102 * -12345678-+---------------+----------------------------
103 * 00 | JTAG | SH-X2
104 * 10 | JTAG | ARM
105 * 01 | JTAG | -
106 * 11 | JTAG | Boundary Scan
107 *-----------+---------------+----------------------------
108 */
109
110/*
111 * USB function
112 *
113 * When you use USB Function,
114 * set SW1.6 ON, and connect cable to CN24.
115 *
116 * USBF needs workaround on R8A7740 chip.
117 * These are a little bit complex.
118 * see
119 * usbhsf_power_ctrl()
120 *
121 * CAUTION
122 *
123 * It uses autonomy mode for USB hotplug at this point
124 * (= usbhs_private.platform_callback.get_vbus is NULL),
125 * since we don't know what's happen on PM control
126 * on this workaround.
127 */
128#define USBCR1 0xe605810a
129#define USBH 0xC6700000
130#define USBH_USBCTR 0x10834
131
132struct usbhsf_private {
133 struct clk *phy;
134 struct clk *usb24;
135 struct clk *pci;
136 struct clk *func;
137 struct clk *host;
138 void __iomem *usbh_base;
139 struct renesas_usbhs_platform_info info;
140};
141
142#define usbhsf_get_priv(pdev) \
143 container_of(renesas_usbhs_get_info(pdev), \
144 struct usbhsf_private, info)
145
146static int usbhsf_get_id(struct platform_device *pdev)
147{
148 return USBHS_GADGET;
149}
150
151static void usbhsf_power_ctrl(struct platform_device *pdev,
152 void __iomem *base, int enable)
153{
154 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
155
156 /*
157 * Work around for USB Function.
158 * It needs USB host clock, and settings
159 */
160 if (enable) {
161 /*
162 * enable all the related usb clocks
163 * for usb workaround
164 */
165 clk_enable(priv->usb24);
166 clk_enable(priv->pci);
167 clk_enable(priv->host);
168 clk_enable(priv->func);
169 clk_enable(priv->phy);
170
171 /*
172 * set USBCR1
173 *
174 * Port1 is driven by USB function,
175 * Port2 is driven by USB HOST
176 * One HOST (Port1 or Port2 is HOST)
177 * USB PLL input clock = 24MHz
178 */
179 __raw_writew(0xd750, USBCR1);
180 mdelay(1);
181
182 /*
183 * start USB Host
184 */
185 __raw_writel(0x0000000c, priv->usbh_base + USBH_USBCTR);
186 __raw_writel(0x00000008, priv->usbh_base + USBH_USBCTR);
187 mdelay(10);
188
189 /*
190 * USB PHY Power ON
191 */
192 __raw_writew(0xd770, USBCR1);
193 __raw_writew(0x4000, base + 0x102); /* USBF :: SUSPMODE */
194
195 } else {
196 __raw_writel(0x0000010f, priv->usbh_base + USBH_USBCTR);
197 __raw_writew(0xd7c0, USBCR1); /* GPIO */
198
199 clk_disable(priv->phy);
200 clk_disable(priv->func); /* usb work around */
201 clk_disable(priv->host); /* usb work around */
202 clk_disable(priv->pci); /* usb work around */
203 clk_disable(priv->usb24); /* usb work around */
204 }
205}
206
207static void usbhsf_hardware_exit(struct platform_device *pdev)
208{
209 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
210
211 if (!IS_ERR(priv->phy))
212 clk_put(priv->phy);
213 if (!IS_ERR(priv->usb24))
214 clk_put(priv->usb24);
215 if (!IS_ERR(priv->pci))
216 clk_put(priv->pci);
217 if (!IS_ERR(priv->host))
218 clk_put(priv->host);
219 if (!IS_ERR(priv->func))
220 clk_put(priv->func);
221 if (priv->usbh_base)
222 iounmap(priv->usbh_base);
223
224 priv->phy = NULL;
225 priv->usb24 = NULL;
226 priv->pci = NULL;
227 priv->host = NULL;
228 priv->func = NULL;
229 priv->usbh_base = NULL;
230}
231
232static int usbhsf_hardware_init(struct platform_device *pdev)
233{
234 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
235
236 priv->phy = clk_get(&pdev->dev, "phy");
237 priv->usb24 = clk_get(&pdev->dev, "usb24");
238 priv->pci = clk_get(&pdev->dev, "pci");
239 priv->func = clk_get(&pdev->dev, "func");
240 priv->host = clk_get(&pdev->dev, "host");
241 priv->usbh_base = ioremap_nocache(USBH, 0x20000);
242
243 if (IS_ERR(priv->phy) ||
244 IS_ERR(priv->usb24) ||
245 IS_ERR(priv->pci) ||
246 IS_ERR(priv->host) ||
247 IS_ERR(priv->func) ||
248 !priv->usbh_base) {
249 dev_err(&pdev->dev, "USB clock setting failed\n");
250 usbhsf_hardware_exit(pdev);
251 return -EIO;
252 }
253
254 /* usb24 use 1/1 of parent clock (= usb24s = 24MHz) */
255 clk_set_rate(priv->usb24,
256 clk_get_rate(clk_get_parent(priv->usb24)));
257
258 return 0;
259}
260
261static struct usbhsf_private usbhsf_private = {
262 .info = {
263 .platform_callback = {
264 .get_id = usbhsf_get_id,
265 .hardware_init = usbhsf_hardware_init,
266 .hardware_exit = usbhsf_hardware_exit,
267 .power_ctrl = usbhsf_power_ctrl,
268 },
269 .driver_param = {
270 .buswait_bwait = 5,
271 .detection_delay = 5,
272 },
273 }
274};
275
276static struct resource usbhsf_resources[] = {
277 {
278 .name = "USBHS",
279 .start = 0xe6890000,
280 .end = 0xe6890104 - 1,
281 .flags = IORESOURCE_MEM,
282 },
283 {
284 .start = evt2irq(0x0A20),
285 .flags = IORESOURCE_IRQ,
286 },
287};
288
289static struct platform_device usbhsf_device = {
290 .name = "renesas_usbhs",
291 .dev = {
292 .platform_data = &usbhsf_private.info,
293 },
294 .id = -1,
295 .num_resources = ARRAY_SIZE(usbhsf_resources),
296 .resource = usbhsf_resources,
297};
298
299/* Ether */
300static struct sh_eth_plat_data sh_eth_platdata = {
301 .phy = 0x00, /* LAN8710A */
302 .edmac_endian = EDMAC_LITTLE_ENDIAN,
303 .register_type = SH_ETH_REG_GIGABIT,
304 .phy_interface = PHY_INTERFACE_MODE_MII,
305};
306
307static struct resource sh_eth_resources[] = {
308 {
309 .start = 0xe9a00000,
310 .end = 0xe9a00800 - 1,
311 .flags = IORESOURCE_MEM,
312 }, {
313 .start = 0xe9a01800,
314 .end = 0xe9a02000 - 1,
315 .flags = IORESOURCE_MEM,
316 }, {
317 .start = evt2irq(0x0500),
318 .flags = IORESOURCE_IRQ,
319 },
320};
321
322static struct platform_device sh_eth_device = {
323 .name = "sh-eth",
324 .id = -1,
325 .dev = {
326 .platform_data = &sh_eth_platdata,
327 },
328 .resource = sh_eth_resources,
329 .num_resources = ARRAY_SIZE(sh_eth_resources),
330};
331
332/* LCDC */
333static struct fb_videomode lcdc0_mode = {
334 .name = "AMPIER/AM-800480",
335 .xres = 800,
336 .yres = 480,
337 .left_margin = 88,
338 .right_margin = 40,
339 .hsync_len = 128,
340 .upper_margin = 20,
341 .lower_margin = 5,
342 .vsync_len = 5,
343 .sync = 0,
344};
345
346static struct sh_mobile_lcdc_info lcdc0_info = {
347 .clock_source = LCDC_CLK_BUS,
348 .ch[0] = {
349 .chan = LCDC_CHAN_MAINLCD,
350 .fourcc = V4L2_PIX_FMT_RGB565,
351 .interface_type = RGB24,
352 .clock_divider = 5,
353 .flags = 0,
354 .lcd_modes = &lcdc0_mode,
355 .num_modes = 1,
356 .panel_cfg = {
357 .width = 111,
358 .height = 68,
359 },
360 },
361};
362
363static struct resource lcdc0_resources[] = {
364 [0] = {
365 .name = "LCD0",
366 .start = 0xfe940000,
367 .end = 0xfe943fff,
368 .flags = IORESOURCE_MEM,
369 },
370 [1] = {
371 .start = intcs_evt2irq(0x580),
372 .flags = IORESOURCE_IRQ,
373 },
374};
375
376static struct platform_device lcdc0_device = {
377 .name = "sh_mobile_lcdc_fb",
378 .num_resources = ARRAY_SIZE(lcdc0_resources),
379 .resource = lcdc0_resources,
380 .id = 0,
381 .dev = {
382 .platform_data = &lcdc0_info,
383 .coherent_dma_mask = ~0,
384 },
385};
386
387/* GPIO KEY */
388#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
389
390static struct gpio_keys_button gpio_buttons[] = {
391 GPIO_KEY(KEY_POWER, GPIO_PORT99, "SW1"),
392 GPIO_KEY(KEY_BACK, GPIO_PORT100, "SW2"),
393 GPIO_KEY(KEY_MENU, GPIO_PORT97, "SW3"),
394 GPIO_KEY(KEY_HOME, GPIO_PORT98, "SW4"),
395};
396
397static struct gpio_keys_platform_data gpio_key_info = {
398 .buttons = gpio_buttons,
399 .nbuttons = ARRAY_SIZE(gpio_buttons),
400};
401
402static struct platform_device gpio_keys_device = {
403 .name = "gpio-keys",
404 .id = -1,
405 .dev = {
406 .platform_data = &gpio_key_info,
407 },
408};
409
410/* SDHI0 */
411/*
412 * FIXME
413 *
414 * It use polling mode here, since
415 * CD (= Card Detect) pin is not connected to SDHI0_CD.
416 * We can use IRQ31 as card detect irq,
417 * but it needs chattering removal operation
418 */
419#define IRQ31 evt2irq(0x33E0)
420static struct sh_mobile_sdhi_info sdhi0_info = {
421 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |\
422 MMC_CAP_NEEDS_POLL,
423 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
424 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
425};
426
427static struct resource sdhi0_resources[] = {
428 {
429 .name = "SDHI0",
430 .start = 0xe6850000,
431 .end = 0xe6850100 - 1,
432 .flags = IORESOURCE_MEM,
433 },
434 /*
435 * no SH_MOBILE_SDHI_IRQ_CARD_DETECT here
436 */
437 {
438 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
439 .start = evt2irq(0x0E20),
440 .flags = IORESOURCE_IRQ,
441 },
442 {
443 .name = SH_MOBILE_SDHI_IRQ_SDIO,
444 .start = evt2irq(0x0E40),
445 .flags = IORESOURCE_IRQ,
446 },
447};
448
449static struct platform_device sdhi0_device = {
450 .name = "sh_mobile_sdhi",
451 .id = 0,
452 .dev = {
453 .platform_data = &sdhi0_info,
454 },
455 .num_resources = ARRAY_SIZE(sdhi0_resources),
456 .resource = sdhi0_resources,
457};
458
459/* SDHI1 */
460static struct sh_mobile_sdhi_info sdhi1_info = {
461 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
462 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
463 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
464};
465
466static struct resource sdhi1_resources[] = {
467 [0] = {
468 .name = "SDHI1",
469 .start = 0xe6860000,
470 .end = 0xe6860100 - 1,
471 .flags = IORESOURCE_MEM,
472 },
473 [1] = {
474 .start = evt2irq(0x0E80),
475 .flags = IORESOURCE_IRQ,
476 },
477 [2] = {
478 .start = evt2irq(0x0EA0),
479 .flags = IORESOURCE_IRQ,
480 },
481 [3] = {
482 .start = evt2irq(0x0EC0),
483 .flags = IORESOURCE_IRQ,
484 },
485};
486
487static struct platform_device sdhi1_device = {
488 .name = "sh_mobile_sdhi",
489 .id = 1,
490 .dev = {
491 .platform_data = &sdhi1_info,
492 },
493 .num_resources = ARRAY_SIZE(sdhi1_resources),
494 .resource = sdhi1_resources,
495};
496
497/* MMCIF */
498static struct sh_mmcif_plat_data sh_mmcif_plat = {
499 .sup_pclk = 0,
500 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
501 .caps = MMC_CAP_4_BIT_DATA |
502 MMC_CAP_8_BIT_DATA |
503 MMC_CAP_NONREMOVABLE,
504};
505
506static struct resource sh_mmcif_resources[] = {
507 [0] = {
508 .name = "MMCIF",
509 .start = 0xe6bd0000,
510 .end = 0xe6bd0100 - 1,
511 .flags = IORESOURCE_MEM,
512 },
513 [1] = {
514 /* MMC ERR */
515 .start = evt2irq(0x1AC0),
516 .flags = IORESOURCE_IRQ,
517 },
518 [2] = {
519 /* MMC NOR */
520 .start = evt2irq(0x1AE0),
521 .flags = IORESOURCE_IRQ,
522 },
523};
524
525static struct platform_device sh_mmcif_device = {
526 .name = "sh_mmcif",
527 .id = -1,
528 .dev = {
529 .platform_data = &sh_mmcif_plat,
530 },
531 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
532 .resource = sh_mmcif_resources,
533};
534
535/* I2C */
536static struct i2c_board_info i2c0_devices[] = {
537 {
538 I2C_BOARD_INFO("st1232-ts", 0x55),
539 .irq = evt2irq(0x0340),
540 },
541};
542
543/*
544 * board devices
545 */
546static struct platform_device *eva_devices[] __initdata = {
547 &lcdc0_device,
548 &gpio_keys_device,
549 &sh_eth_device,
550 &sdhi0_device,
551 &sh_mmcif_device,
552};
553
554static void __init eva_clock_init(void)
555{
556 struct clk *system = clk_get(NULL, "system_clk");
557 struct clk *xtal1 = clk_get(NULL, "extal1");
558 struct clk *usb24s = clk_get(NULL, "usb24s");
559
560 if (IS_ERR(system) ||
561 IS_ERR(xtal1) ||
562 IS_ERR(usb24s)) {
563 pr_err("armadillo800eva board clock init failed\n");
564 goto clock_error;
565 }
566
567 /* armadillo 800 eva extal1 is 24MHz */
568 clk_set_rate(xtal1, 24000000);
569
570 /* usb24s use extal1 (= system) clock (= 24MHz) */
571 clk_set_parent(usb24s, system);
572
573clock_error:
574 if (!IS_ERR(system))
575 clk_put(system);
576 if (!IS_ERR(xtal1))
577 clk_put(xtal1);
578 if (!IS_ERR(usb24s))
579 clk_put(usb24s);
580}
581
582/*
583 * board init
584 */
585static void __init eva_init(void)
586{
587 eva_clock_init();
588
589 r8a7740_pinmux_init();
590
591 /* SCIFA1 */
592 gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
593 gpio_request(GPIO_FN_SCIFA1_TXD, NULL);
594
595 /* LCDC0 */
596 gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
597 gpio_request(GPIO_FN_LCD0_D0, NULL);
598 gpio_request(GPIO_FN_LCD0_D1, NULL);
599 gpio_request(GPIO_FN_LCD0_D2, NULL);
600 gpio_request(GPIO_FN_LCD0_D3, NULL);
601 gpio_request(GPIO_FN_LCD0_D4, NULL);
602 gpio_request(GPIO_FN_LCD0_D5, NULL);
603 gpio_request(GPIO_FN_LCD0_D6, NULL);
604 gpio_request(GPIO_FN_LCD0_D7, NULL);
605 gpio_request(GPIO_FN_LCD0_D8, NULL);
606 gpio_request(GPIO_FN_LCD0_D9, NULL);
607 gpio_request(GPIO_FN_LCD0_D10, NULL);
608 gpio_request(GPIO_FN_LCD0_D11, NULL);
609 gpio_request(GPIO_FN_LCD0_D12, NULL);
610 gpio_request(GPIO_FN_LCD0_D13, NULL);
611 gpio_request(GPIO_FN_LCD0_D14, NULL);
612 gpio_request(GPIO_FN_LCD0_D15, NULL);
613 gpio_request(GPIO_FN_LCD0_D16, NULL);
614 gpio_request(GPIO_FN_LCD0_D17, NULL);
615 gpio_request(GPIO_FN_LCD0_D18_PORT40, NULL);
616 gpio_request(GPIO_FN_LCD0_D19_PORT4, NULL);
617 gpio_request(GPIO_FN_LCD0_D20_PORT3, NULL);
618 gpio_request(GPIO_FN_LCD0_D21_PORT2, NULL);
619 gpio_request(GPIO_FN_LCD0_D22_PORT0, NULL);
620 gpio_request(GPIO_FN_LCD0_D23_PORT1, NULL);
621 gpio_request(GPIO_FN_LCD0_DCK, NULL);
622 gpio_request(GPIO_FN_LCD0_VSYN, NULL);
623 gpio_request(GPIO_FN_LCD0_HSYN, NULL);
624 gpio_request(GPIO_FN_LCD0_DISP, NULL);
625 gpio_request(GPIO_FN_LCD0_LCLK_PORT165, NULL);
626
627 gpio_request(GPIO_PORT61, NULL); /* LCDDON */
628 gpio_direction_output(GPIO_PORT61, 1);
629
630 gpio_request(GPIO_PORT202, NULL); /* LCD0_LED_CONT */
631 gpio_direction_output(GPIO_PORT202, 0);
632
633 /* Touchscreen */
634 gpio_request(GPIO_FN_IRQ10, NULL); /* TP_INT */
635 gpio_request(GPIO_PORT166, NULL); /* TP_RST_B */
636 gpio_direction_output(GPIO_PORT166, 1);
637
638 /* GETHER */
639 gpio_request(GPIO_FN_ET_CRS, NULL);
640 gpio_request(GPIO_FN_ET_MDC, NULL);
641 gpio_request(GPIO_FN_ET_MDIO, NULL);
642 gpio_request(GPIO_FN_ET_TX_ER, NULL);
643 gpio_request(GPIO_FN_ET_RX_ER, NULL);
644 gpio_request(GPIO_FN_ET_ERXD0, NULL);
645 gpio_request(GPIO_FN_ET_ERXD1, NULL);
646 gpio_request(GPIO_FN_ET_ERXD2, NULL);
647 gpio_request(GPIO_FN_ET_ERXD3, NULL);
648 gpio_request(GPIO_FN_ET_TX_CLK, NULL);
649 gpio_request(GPIO_FN_ET_TX_EN, NULL);
650 gpio_request(GPIO_FN_ET_ETXD0, NULL);
651 gpio_request(GPIO_FN_ET_ETXD1, NULL);
652 gpio_request(GPIO_FN_ET_ETXD2, NULL);
653 gpio_request(GPIO_FN_ET_ETXD3, NULL);
654 gpio_request(GPIO_FN_ET_PHY_INT, NULL);
655 gpio_request(GPIO_FN_ET_COL, NULL);
656 gpio_request(GPIO_FN_ET_RX_DV, NULL);
657 gpio_request(GPIO_FN_ET_RX_CLK, NULL);
658
659 gpio_request(GPIO_PORT18, NULL); /* PHY_RST */
660 gpio_direction_output(GPIO_PORT18, 1);
661
662 /* USB */
663 gpio_request(GPIO_PORT159, NULL); /* USB_DEVICE_MODE */
664 gpio_direction_input(GPIO_PORT159);
665
666 if (gpio_get_value(GPIO_PORT159)) {
667 /* USB Host */
668 } else {
669 /* USB Func */
670 gpio_request(GPIO_FN_VBUS, NULL);
671 platform_device_register(&usbhsf_device);
672 }
673
674 /* SDHI0 */
675 gpio_request(GPIO_FN_SDHI0_CMD, NULL);
676 gpio_request(GPIO_FN_SDHI0_CLK, NULL);
677 gpio_request(GPIO_FN_SDHI0_D0, NULL);
678 gpio_request(GPIO_FN_SDHI0_D1, NULL);
679 gpio_request(GPIO_FN_SDHI0_D2, NULL);
680 gpio_request(GPIO_FN_SDHI0_D3, NULL);
681 gpio_request(GPIO_FN_SDHI0_WP, NULL);
682
683 gpio_request(GPIO_PORT17, NULL); /* SDHI0_18/33_B */
684 gpio_request(GPIO_PORT74, NULL); /* SDHI0_PON */
685 gpio_request(GPIO_PORT75, NULL); /* SDSLOT1_PON */
686 gpio_direction_output(GPIO_PORT17, 0);
687 gpio_direction_output(GPIO_PORT74, 1);
688 gpio_direction_output(GPIO_PORT75, 1);
689
690 /* we can use GPIO_FN_IRQ31_PORT167 here for SDHI0 CD irq */
691
692 /*
693 * MMCIF
694 *
695 * Here doesn't care SW1.4 status,
696 * since CON2 is not mounted.
697 */
698 gpio_request(GPIO_FN_MMC1_CLK_PORT103, NULL);
699 gpio_request(GPIO_FN_MMC1_CMD_PORT104, NULL);
700 gpio_request(GPIO_FN_MMC1_D0_PORT149, NULL);
701 gpio_request(GPIO_FN_MMC1_D1_PORT148, NULL);
702 gpio_request(GPIO_FN_MMC1_D2_PORT147, NULL);
703 gpio_request(GPIO_FN_MMC1_D3_PORT146, NULL);
704 gpio_request(GPIO_FN_MMC1_D4_PORT145, NULL);
705 gpio_request(GPIO_FN_MMC1_D5_PORT144, NULL);
706 gpio_request(GPIO_FN_MMC1_D6_PORT143, NULL);
707 gpio_request(GPIO_FN_MMC1_D7_PORT142, NULL);
708
709 /*
710 * CAUTION
711 *
712 * DBGMD/LCDC0/FSIA MUX
713 * DBGMD_SELECT_B should be set after setting PFC Function.
714 */
715 gpio_request(GPIO_PORT176, NULL);
716 gpio_direction_output(GPIO_PORT176, 1);
717
718 /*
719 * We can switch CON8/CON14 by SW1.5,
720 * but it needs after DBGMD_SELECT_B
721 */
722 gpio_request(GPIO_PORT6, NULL);
723 gpio_direction_input(GPIO_PORT6);
724 if (gpio_get_value(GPIO_PORT6)) {
725 /* CON14 enable */
726 } else {
727 /* CON8 (SDHI1) enable */
728 gpio_request(GPIO_FN_SDHI1_CLK, NULL);
729 gpio_request(GPIO_FN_SDHI1_CMD, NULL);
730 gpio_request(GPIO_FN_SDHI1_D0, NULL);
731 gpio_request(GPIO_FN_SDHI1_D1, NULL);
732 gpio_request(GPIO_FN_SDHI1_D2, NULL);
733 gpio_request(GPIO_FN_SDHI1_D3, NULL);
734 gpio_request(GPIO_FN_SDHI1_CD, NULL);
735 gpio_request(GPIO_FN_SDHI1_WP, NULL);
736
737 gpio_request(GPIO_PORT16, NULL); /* SDSLOT2_PON */
738 gpio_direction_output(GPIO_PORT16, 1);
739
740 platform_device_register(&sdhi1_device);
741 }
742
743
744#ifdef CONFIG_CACHE_L2X0
745 /* Early BRESP enable, Shared attribute override enable, 32K*8way */
746 l2x0_init(__io(0xf0002000), 0x40440000, 0x82000fff);
747#endif
748
749 i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
750
751 r8a7740_add_standard_devices();
752
753 platform_add_devices(eva_devices,
754 ARRAY_SIZE(eva_devices));
755}
756
757static void __init eva_earlytimer_init(void)
758{
759 r8a7740_clock_init(MD_CK0 | MD_CK2);
760 shmobile_earlytimer_init();
761}
762
763static void __init eva_add_early_devices(void)
764{
765 r8a7740_add_early_devices();
766
767 /* override timer setup with board-specific code */
768 shmobile_timer.init = eva_earlytimer_init;
769}
770
771static const char *eva_boards_compat_dt[] __initdata = {
772 "renesas,armadillo800eva",
773 NULL,
774};
775
776DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva")
777 .map_io = r8a7740_map_io,
778 .init_early = eva_add_early_devices,
779 .init_irq = r8a7740_init_irq,
780 .handle_irq = shmobile_handle_irq_intc,
781 .init_machine = eva_init,
782 .timer = &shmobile_timer,
783 .dt_compat = eva_boards_compat_dt,
784MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c
index 81fd95f7f52a..63ab7062bee3 100644
--- a/arch/arm/mach-shmobile/board-bonito.c
+++ b/arch/arm/mach-shmobile/board-bonito.c
@@ -486,7 +486,7 @@ static void __init bonito_earlytimer_init(void)
486 shmobile_earlytimer_init(); 486 shmobile_earlytimer_init();
487} 487}
488 488
489void __init bonito_add_early_devices(void) 489static void __init bonito_add_early_devices(void)
490{ 490{
491 r8a7740_add_early_devices(); 491 r8a7740_add_early_devices();
492 492
diff --git a/arch/arm/mach-shmobile/board-kzm9d.c b/arch/arm/mach-shmobile/board-kzm9d.c
new file mode 100644
index 000000000000..7bc5e7d39f9b
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-kzm9d.c
@@ -0,0 +1,85 @@
1/*
2 * kzm9d board support
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 * Copyright (C) 2012 Magnus Damm
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <linux/kernel.h>
22#include <linux/interrupt.h>
23#include <linux/platform_device.h>
24#include <linux/smsc911x.h>
25#include <mach/common.h>
26#include <mach/emev2.h>
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/hardware/gic.h>
30
31/* Ether */
32static struct resource smsc911x_resources[] = {
33 [0] = {
34 .start = 0x20000000,
35 .end = 0x2000ffff,
36 .flags = IORESOURCE_MEM,
37 },
38 [1] = {
39 .start = EMEV2_GPIO_IRQ(1),
40 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
41 },
42};
43
44static struct smsc911x_platform_config smsc911x_platdata = {
45 .flags = SMSC911X_USE_32BIT,
46 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
47 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
48};
49
50static struct platform_device smsc91x_device = {
51 .name = "smsc911x",
52 .id = 0,
53 .dev = {
54 .platform_data = &smsc911x_platdata,
55 },
56 .num_resources = ARRAY_SIZE(smsc911x_resources),
57 .resource = smsc911x_resources,
58};
59
60static struct platform_device *kzm9d_devices[] __initdata = {
61 &smsc91x_device,
62};
63
64void __init kzm9d_add_standard_devices(void)
65{
66 emev2_add_standard_devices();
67
68 platform_add_devices(kzm9d_devices, ARRAY_SIZE(kzm9d_devices));
69}
70
71static const char *kzm9d_boards_compat_dt[] __initdata = {
72 "renesas,kzm9d",
73 NULL,
74};
75
76DT_MACHINE_START(KZM9D_DT, "kzm9d")
77 .map_io = emev2_map_io,
78 .init_early = emev2_add_early_devices,
79 .nr_irqs = NR_IRQS_LEGACY,
80 .init_irq = emev2_init_irq,
81 .handle_irq = gic_handle_irq,
82 .init_machine = kzm9d_add_standard_devices,
83 .timer = &shmobile_timer,
84 .dt_compat = kzm9d_boards_compat_dt,
85MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
new file mode 100644
index 000000000000..d8e33b682832
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -0,0 +1,460 @@
1/*
2 * KZM-A9-GT board support
3 *
4 * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#include <linux/delay.h>
21#include <linux/gpio.h>
22#include <linux/gpio_keys.h>
23#include <linux/io.h>
24#include <linux/irq.h>
25#include <linux/i2c.h>
26#include <linux/i2c/pcf857x.h>
27#include <linux/input.h>
28#include <linux/mmc/host.h>
29#include <linux/mmc/sh_mmcif.h>
30#include <linux/mmc/sh_mobile_sdhi.h>
31#include <linux/mfd/tmio.h>
32#include <linux/platform_device.h>
33#include <linux/smsc911x.h>
34#include <linux/usb/r8a66597.h>
35#include <linux/videodev2.h>
36#include <mach/irqs.h>
37#include <mach/sh73a0.h>
38#include <mach/common.h>
39#include <asm/hardware/cache-l2x0.h>
40#include <asm/hardware/gic.h>
41#include <asm/mach-types.h>
42#include <asm/mach/arch.h>
43#include <video/sh_mobile_lcdc.h>
44
45/*
46 * external GPIO
47 */
48#define GPIO_PCF8575_BASE (GPIO_NR)
49#define GPIO_PCF8575_PORT10 (GPIO_NR + 8)
50#define GPIO_PCF8575_PORT11 (GPIO_NR + 9)
51#define GPIO_PCF8575_PORT12 (GPIO_NR + 10)
52#define GPIO_PCF8575_PORT13 (GPIO_NR + 11)
53#define GPIO_PCF8575_PORT14 (GPIO_NR + 12)
54#define GPIO_PCF8575_PORT15 (GPIO_NR + 13)
55#define GPIO_PCF8575_PORT16 (GPIO_NR + 14)
56
57/* SMSC 9221 */
58static struct resource smsc9221_resources[] = {
59 [0] = {
60 .start = 0x10000000, /* CS4 */
61 .end = 0x100000ff,
62 .flags = IORESOURCE_MEM,
63 },
64 [1] = {
65 .start = intcs_evt2irq(0x260), /* IRQ3 */
66 .flags = IORESOURCE_IRQ,
67 },
68};
69
70static struct smsc911x_platform_config smsc9221_platdata = {
71 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
72 .phy_interface = PHY_INTERFACE_MODE_MII,
73 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
74 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
75};
76
77static struct platform_device smsc_device = {
78 .name = "smsc911x",
79 .dev = {
80 .platform_data = &smsc9221_platdata,
81 },
82 .resource = smsc9221_resources,
83 .num_resources = ARRAY_SIZE(smsc9221_resources),
84};
85
86/* USB external chip */
87static struct r8a66597_platdata usb_host_data = {
88 .on_chip = 0,
89 .xtal = R8A66597_PLATDATA_XTAL_48MHZ,
90};
91
92static struct resource usb_resources[] = {
93 [0] = {
94 .start = 0x10010000,
95 .end = 0x1001ffff - 1,
96 .flags = IORESOURCE_MEM,
97 },
98 [1] = {
99 .start = intcs_evt2irq(0x220), /* IRQ1 */
100 .flags = IORESOURCE_IRQ,
101 },
102};
103
104static struct platform_device usb_host_device = {
105 .name = "r8a66597_hcd",
106 .dev = {
107 .platform_data = &usb_host_data,
108 .dma_mask = NULL,
109 .coherent_dma_mask = 0xffffffff,
110 },
111 .num_resources = ARRAY_SIZE(usb_resources),
112 .resource = usb_resources,
113};
114
115/* LCDC */
116static struct fb_videomode kzm_lcdc_mode = {
117 .name = "WVGA Panel",
118 .xres = 800,
119 .yres = 480,
120 .left_margin = 220,
121 .right_margin = 110,
122 .hsync_len = 70,
123 .upper_margin = 20,
124 .lower_margin = 5,
125 .vsync_len = 5,
126 .sync = 0,
127};
128
129static struct sh_mobile_lcdc_info lcdc_info = {
130 .clock_source = LCDC_CLK_BUS,
131 .ch[0] = {
132 .chan = LCDC_CHAN_MAINLCD,
133 .fourcc = V4L2_PIX_FMT_RGB565,
134 .interface_type = RGB24,
135 .lcd_modes = &kzm_lcdc_mode,
136 .num_modes = 1,
137 .clock_divider = 5,
138 .flags = 0,
139 .panel_cfg = {
140 .width = 152,
141 .height = 91,
142 },
143 }
144};
145
146static struct resource lcdc_resources[] = {
147 [0] = {
148 .name = "LCDC",
149 .start = 0xfe940000,
150 .end = 0xfe943fff,
151 .flags = IORESOURCE_MEM,
152 },
153 [1] = {
154 .start = intcs_evt2irq(0x580),
155 .flags = IORESOURCE_IRQ,
156 },
157};
158
159static struct platform_device lcdc_device = {
160 .name = "sh_mobile_lcdc_fb",
161 .num_resources = ARRAY_SIZE(lcdc_resources),
162 .resource = lcdc_resources,
163 .dev = {
164 .platform_data = &lcdc_info,
165 .coherent_dma_mask = ~0,
166 },
167};
168
169/* MMCIF */
170static struct resource sh_mmcif_resources[] = {
171 [0] = {
172 .name = "MMCIF",
173 .start = 0xe6bd0000,
174 .end = 0xe6bd00ff,
175 .flags = IORESOURCE_MEM,
176 },
177 [1] = {
178 .start = gic_spi(141),
179 .flags = IORESOURCE_IRQ,
180 },
181 [2] = {
182 .start = gic_spi(140),
183 .flags = IORESOURCE_IRQ,
184 },
185};
186
187static struct sh_mmcif_plat_data sh_mmcif_platdata = {
188 .ocr = MMC_VDD_165_195,
189 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
190};
191
192static struct platform_device mmc_device = {
193 .name = "sh_mmcif",
194 .dev = {
195 .dma_mask = NULL,
196 .coherent_dma_mask = 0xffffffff,
197 .platform_data = &sh_mmcif_platdata,
198 },
199 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
200 .resource = sh_mmcif_resources,
201};
202
203/* SDHI */
204static struct sh_mobile_sdhi_info sdhi0_info = {
205 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
206 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
207 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
208};
209
210static struct resource sdhi0_resources[] = {
211 [0] = {
212 .name = "SDHI0",
213 .start = 0xee100000,
214 .end = 0xee1000ff,
215 .flags = IORESOURCE_MEM,
216 },
217 [1] = {
218 .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
219 .start = gic_spi(83),
220 .flags = IORESOURCE_IRQ,
221 },
222 [2] = {
223 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
224 .start = gic_spi(84),
225 .flags = IORESOURCE_IRQ,
226 },
227 [3] = {
228 .name = SH_MOBILE_SDHI_IRQ_SDIO,
229 .start = gic_spi(85),
230 .flags = IORESOURCE_IRQ,
231 },
232};
233
234static struct platform_device sdhi0_device = {
235 .name = "sh_mobile_sdhi",
236 .num_resources = ARRAY_SIZE(sdhi0_resources),
237 .resource = sdhi0_resources,
238 .dev = {
239 .platform_data = &sdhi0_info,
240 },
241};
242
243/* KEY */
244#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
245
246static struct gpio_keys_button gpio_buttons[] = {
247 GPIO_KEY(KEY_BACK, GPIO_PCF8575_PORT10, "SW3"),
248 GPIO_KEY(KEY_RIGHT, GPIO_PCF8575_PORT11, "SW2-R"),
249 GPIO_KEY(KEY_LEFT, GPIO_PCF8575_PORT12, "SW2-L"),
250 GPIO_KEY(KEY_ENTER, GPIO_PCF8575_PORT13, "SW2-P"),
251 GPIO_KEY(KEY_UP, GPIO_PCF8575_PORT14, "SW2-U"),
252 GPIO_KEY(KEY_DOWN, GPIO_PCF8575_PORT15, "SW2-D"),
253 GPIO_KEY(KEY_HOME, GPIO_PCF8575_PORT16, "SW1"),
254};
255
256static struct gpio_keys_platform_data gpio_key_info = {
257 .buttons = gpio_buttons,
258 .nbuttons = ARRAY_SIZE(gpio_buttons),
259 .poll_interval = 250, /* poling at this point */
260};
261
262static struct platform_device gpio_keys_device = {
263 /* gpio-pcf857x.c driver doesn't support gpio_to_irq() */
264 .name = "gpio-keys-polled",
265 .dev = {
266 .platform_data = &gpio_key_info,
267 },
268};
269
270/* I2C */
271static struct pcf857x_platform_data pcf8575_pdata = {
272 .gpio_base = GPIO_PCF8575_BASE,
273};
274
275static struct i2c_board_info i2c1_devices[] = {
276 {
277 I2C_BOARD_INFO("st1232-ts", 0x55),
278 .irq = intcs_evt2irq(0x300), /* IRQ8 */
279 },
280};
281
282static struct i2c_board_info i2c3_devices[] = {
283 {
284 I2C_BOARD_INFO("pcf8575", 0x20),
285 .platform_data = &pcf8575_pdata,
286 },
287};
288
289static struct platform_device *kzm_devices[] __initdata = {
290 &smsc_device,
291 &usb_host_device,
292 &lcdc_device,
293 &mmc_device,
294 &sdhi0_device,
295 &gpio_keys_device,
296};
297
298/*
299 * FIXME
300 *
301 * This is quick hack for enabling LCDC backlight
302 */
303static int __init as3711_enable_lcdc_backlight(void)
304{
305 struct i2c_adapter *a = i2c_get_adapter(0);
306 struct i2c_msg msg;
307 int i, ret;
308 __u8 magic[] = {
309 0x40, 0x2a,
310 0x43, 0x3c,
311 0x44, 0x3c,
312 0x45, 0x3c,
313 0x54, 0x03,
314 0x51, 0x00,
315 0x51, 0x01,
316 0xff, 0x00, /* wait */
317 0x43, 0xf0,
318 0x44, 0xf0,
319 0x45, 0xf0,
320 };
321
322 if (!machine_is_kzm9g())
323 return 0;
324
325 if (!a)
326 return 0;
327
328 msg.addr = 0x40;
329 msg.len = 2;
330 msg.flags = 0;
331
332 for (i = 0; i < ARRAY_SIZE(magic); i += 2) {
333 msg.buf = magic + i;
334
335 if (0xff == msg.buf[0]) {
336 udelay(500);
337 continue;
338 }
339
340 ret = i2c_transfer(a, &msg, 1);
341 if (ret < 0) {
342 pr_err("i2c transfer fail\n");
343 break;
344 }
345 }
346
347 return 0;
348}
349device_initcall(as3711_enable_lcdc_backlight);
350
351static void __init kzm_init(void)
352{
353 sh73a0_pinmux_init();
354
355 /* enable SCIFA4 */
356 gpio_request(GPIO_FN_SCIFA4_TXD, NULL);
357 gpio_request(GPIO_FN_SCIFA4_RXD, NULL);
358 gpio_request(GPIO_FN_SCIFA4_RTS_, NULL);
359 gpio_request(GPIO_FN_SCIFA4_CTS_, NULL);
360
361 /* CS4 for SMSC/USB */
362 gpio_request(GPIO_FN_CS4_, NULL); /* CS4 */
363
364 /* SMSC */
365 gpio_request(GPIO_PORT224, NULL); /* IRQ3 */
366 gpio_direction_input(GPIO_PORT224);
367
368 /* LCDC */
369 gpio_request(GPIO_FN_LCDD23, NULL);
370 gpio_request(GPIO_FN_LCDD22, NULL);
371 gpio_request(GPIO_FN_LCDD21, NULL);
372 gpio_request(GPIO_FN_LCDD20, NULL);
373 gpio_request(GPIO_FN_LCDD19, NULL);
374 gpio_request(GPIO_FN_LCDD18, NULL);
375 gpio_request(GPIO_FN_LCDD17, NULL);
376 gpio_request(GPIO_FN_LCDD16, NULL);
377 gpio_request(GPIO_FN_LCDD15, NULL);
378 gpio_request(GPIO_FN_LCDD14, NULL);
379 gpio_request(GPIO_FN_LCDD13, NULL);
380 gpio_request(GPIO_FN_LCDD12, NULL);
381 gpio_request(GPIO_FN_LCDD11, NULL);
382 gpio_request(GPIO_FN_LCDD10, NULL);
383 gpio_request(GPIO_FN_LCDD9, NULL);
384 gpio_request(GPIO_FN_LCDD8, NULL);
385 gpio_request(GPIO_FN_LCDD7, NULL);
386 gpio_request(GPIO_FN_LCDD6, NULL);
387 gpio_request(GPIO_FN_LCDD5, NULL);
388 gpio_request(GPIO_FN_LCDD4, NULL);
389 gpio_request(GPIO_FN_LCDD3, NULL);
390 gpio_request(GPIO_FN_LCDD2, NULL);
391 gpio_request(GPIO_FN_LCDD1, NULL);
392 gpio_request(GPIO_FN_LCDD0, NULL);
393 gpio_request(GPIO_FN_LCDDISP, NULL);
394 gpio_request(GPIO_FN_LCDDCK, NULL);
395
396 gpio_request(GPIO_PORT222, NULL); /* LCDCDON */
397 gpio_request(GPIO_PORT226, NULL); /* SC */
398 gpio_direction_output(GPIO_PORT222, 1);
399 gpio_direction_output(GPIO_PORT226, 1);
400
401 /* Touchscreen */
402 gpio_request(GPIO_PORT223, NULL); /* IRQ8 */
403 gpio_direction_input(GPIO_PORT223);
404
405 /* enable MMCIF */
406 gpio_request(GPIO_FN_MMCCLK0, NULL);
407 gpio_request(GPIO_FN_MMCCMD0_PU, NULL);
408 gpio_request(GPIO_FN_MMCD0_0_PU, NULL);
409 gpio_request(GPIO_FN_MMCD0_1_PU, NULL);
410 gpio_request(GPIO_FN_MMCD0_2_PU, NULL);
411 gpio_request(GPIO_FN_MMCD0_3_PU, NULL);
412 gpio_request(GPIO_FN_MMCD0_4_PU, NULL);
413 gpio_request(GPIO_FN_MMCD0_5_PU, NULL);
414 gpio_request(GPIO_FN_MMCD0_6_PU, NULL);
415 gpio_request(GPIO_FN_MMCD0_7_PU, NULL);
416
417 /* enable SD */
418 gpio_request(GPIO_FN_SDHIWP0, NULL);
419 gpio_request(GPIO_FN_SDHICD0, NULL);
420 gpio_request(GPIO_FN_SDHICMD0, NULL);
421 gpio_request(GPIO_FN_SDHICLK0, NULL);
422 gpio_request(GPIO_FN_SDHID0_3, NULL);
423 gpio_request(GPIO_FN_SDHID0_2, NULL);
424 gpio_request(GPIO_FN_SDHID0_1, NULL);
425 gpio_request(GPIO_FN_SDHID0_0, NULL);
426 gpio_request(GPIO_FN_SDHI0_VCCQ_MC0_ON, NULL);
427 gpio_request(GPIO_PORT15, NULL);
428 gpio_direction_output(GPIO_PORT15, 1); /* power */
429
430 /* I2C 3 */
431 gpio_request(GPIO_FN_PORT27_I2C_SCL3, NULL);
432 gpio_request(GPIO_FN_PORT28_I2C_SDA3, NULL);
433
434#ifdef CONFIG_CACHE_L2X0
435 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
436 l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff);
437#endif
438
439 i2c_register_board_info(1, i2c1_devices, ARRAY_SIZE(i2c1_devices));
440 i2c_register_board_info(3, i2c3_devices, ARRAY_SIZE(i2c3_devices));
441
442 sh73a0_add_standard_devices();
443 platform_add_devices(kzm_devices, ARRAY_SIZE(kzm_devices));
444}
445
446static const char *kzm9g_boards_compat_dt[] __initdata = {
447 "renesas,kzm9g",
448 NULL,
449};
450
451DT_MACHINE_START(KZM9G_DT, "kzm9g")
452 .map_io = sh73a0_map_io,
453 .init_early = sh73a0_add_early_devices,
454 .nr_irqs = NR_IRQS_LEGACY,
455 .init_irq = sh73a0_init_irq,
456 .handle_irq = gic_handle_irq,
457 .init_machine = kzm_init,
458 .timer = &shmobile_timer,
459 .dt_compat = kzm9g_boards_compat_dt,
460MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index f49e28abe0ab..aae2e24fde46 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -908,6 +908,8 @@ fsi_set_rate_end:
908static struct sh_fsi_platform_info fsi_info = { 908static struct sh_fsi_platform_info fsi_info = {
909 .port_a = { 909 .port_a = {
910 .flags = SH_FSI_BRS_INV, 910 .flags = SH_FSI_BRS_INV,
911 .tx_id = SHDMA_SLAVE_FSIA_TX,
912 .rx_id = SHDMA_SLAVE_FSIA_RX,
911 }, 913 },
912 .port_b = { 914 .port_b = {
913 .flags = SH_FSI_BRS_INV | 915 .flags = SH_FSI_BRS_INV |
@@ -920,9 +922,11 @@ static struct sh_fsi_platform_info fsi_info = {
920 922
921static struct resource fsi_resources[] = { 923static struct resource fsi_resources[] = {
922 [0] = { 924 [0] = {
925 /* we need 0xFE1F0000 to access DMA
926 * instead of 0xFE3C0000 */
923 .name = "FSI", 927 .name = "FSI",
924 .start = 0xFE3C0000, 928 .start = 0xFE1F0000,
925 .end = 0xFE3C0400 - 1, 929 .end = 0xFE1F0400 - 1,
926 .flags = IORESOURCE_MEM, 930 .flags = IORESOURCE_MEM,
927 }, 931 },
928 [1] = { 932 [1] = {
@@ -1011,21 +1015,12 @@ static int slot_cn7_get_cd(struct platform_device *pdev)
1011} 1015}
1012 1016
1013/* SDHI0 */ 1017/* SDHI0 */
1014static irqreturn_t mackerel_sdhi0_gpio_cd(int irq, void *arg)
1015{
1016 struct device *dev = arg;
1017 struct sh_mobile_sdhi_info *info = dev->platform_data;
1018 struct tmio_mmc_data *pdata = info->pdata;
1019
1020 tmio_mmc_cd_wakeup(pdata);
1021
1022 return IRQ_HANDLED;
1023}
1024
1025static struct sh_mobile_sdhi_info sdhi0_info = { 1018static struct sh_mobile_sdhi_info sdhi0_info = {
1026 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 1019 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
1027 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 1020 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
1021 .tmio_flags = TMIO_MMC_USE_GPIO_CD,
1028 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, 1022 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
1023 .cd_gpio = GPIO_PORT172,
1029}; 1024};
1030 1025
1031static struct resource sdhi0_resources[] = { 1026static struct resource sdhi0_resources[] = {
@@ -1257,6 +1252,8 @@ static void mackerel_camera_del(struct soc_camera_device *icd)
1257 1252
1258static struct sh_mobile_ceu_info sh_mobile_ceu_info = { 1253static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
1259 .flags = SH_CEU_FLAG_USE_8BIT_BUS, 1254 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
1255 .max_width = 8188,
1256 .max_height = 8188,
1260}; 1257};
1261 1258
1262static struct resource ceu_resources[] = { 1259static struct resource ceu_resources[] = {
@@ -1384,7 +1381,6 @@ static void __init mackerel_init(void)
1384{ 1381{
1385 u32 srcr4; 1382 u32 srcr4;
1386 struct clk *clk; 1383 struct clk *clk;
1387 int ret;
1388 1384
1389 /* External clock source */ 1385 /* External clock source */
1390 clk_set_rate(&sh7372_dv_clki_clk, 27000000); 1386 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
@@ -1481,7 +1477,6 @@ static void __init mackerel_init(void)
1481 irq_set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH); 1477 irq_set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH);
1482 1478
1483 /* enable SDHI0 */ 1479 /* enable SDHI0 */
1484 gpio_request(GPIO_FN_SDHICD0, NULL);
1485 gpio_request(GPIO_FN_SDHIWP0, NULL); 1480 gpio_request(GPIO_FN_SDHIWP0, NULL);
1486 gpio_request(GPIO_FN_SDHICMD0, NULL); 1481 gpio_request(GPIO_FN_SDHICMD0, NULL);
1487 gpio_request(GPIO_FN_SDHICLK0, NULL); 1482 gpio_request(GPIO_FN_SDHICLK0, NULL);
@@ -1490,13 +1485,6 @@ static void __init mackerel_init(void)
1490 gpio_request(GPIO_FN_SDHID0_1, NULL); 1485 gpio_request(GPIO_FN_SDHID0_1, NULL);
1491 gpio_request(GPIO_FN_SDHID0_0, NULL); 1486 gpio_request(GPIO_FN_SDHID0_0, NULL);
1492 1487
1493 ret = request_irq(evt2irq(0x3340), mackerel_sdhi0_gpio_cd,
1494 IRQF_TRIGGER_FALLING, "sdhi0 cd", &sdhi0_device.dev);
1495 if (!ret)
1496 sdhi0_info.tmio_flags |= TMIO_MMC_HAS_COLD_CD;
1497 else
1498 pr_err("Cannot get IRQ #%d: %d\n", evt2irq(0x3340), ret);
1499
1500#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) 1488#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1501 /* enable SDHI1 */ 1489 /* enable SDHI1 */
1502 gpio_request(GPIO_FN_SDHICMD1, NULL); 1490 gpio_request(GPIO_FN_SDHICMD1, NULL);
diff --git a/arch/arm/mach-shmobile/clock-emev2.c b/arch/arm/mach-shmobile/clock-emev2.c
new file mode 100644
index 000000000000..4710f1847bb7
--- /dev/null
+++ b/arch/arm/mach-shmobile/clock-emev2.c
@@ -0,0 +1,249 @@
1/*
2 * Emma Mobile EV2 clock framework support
3 *
4 * Copyright (C) 2012 Magnus Damm
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19#include <linux/init.h>
20#include <linux/kernel.h>
21#include <linux/io.h>
22#include <linux/sh_clk.h>
23#include <linux/clkdev.h>
24#include <mach/common.h>
25
26#define EMEV2_SMU_BASE 0xe0110000
27
28/* EMEV2 SMU registers */
29#define USIAU0_RSTCTRL 0x094
30#define USIBU1_RSTCTRL 0x0ac
31#define USIBU2_RSTCTRL 0x0b0
32#define USIBU3_RSTCTRL 0x0b4
33#define STI_RSTCTRL 0x124
34#define USIAU0GCLKCTRL 0x4a0
35#define USIBU1GCLKCTRL 0x4b8
36#define USIBU2GCLKCTRL 0x4bc
37#define USIBU3GCLKCTRL 0x04c0
38#define STIGCLKCTRL 0x528
39#define USIAU0SCLKDIV 0x61c
40#define USIB2SCLKDIV 0x65c
41#define USIB3SCLKDIV 0x660
42#define STI_CLKSEL 0x688
43#define SMU_GENERAL_REG0 0x7c0
44
45/* not pretty, but hey */
46static void __iomem *smu_base;
47
48static void emev2_smu_write(unsigned long value, int offs)
49{
50 BUG_ON(!smu_base || (offs >= PAGE_SIZE));
51 iowrite32(value, smu_base + offs);
52}
53
54void emev2_set_boot_vector(unsigned long value)
55{
56 emev2_smu_write(value, SMU_GENERAL_REG0);
57}
58
59static struct clk_mapping smu_mapping = {
60 .phys = EMEV2_SMU_BASE,
61 .len = PAGE_SIZE,
62};
63
64/* Fixed 32 KHz root clock from C32K pin */
65static struct clk c32k_clk = {
66 .rate = 32768,
67 .mapping = &smu_mapping,
68};
69
70/* PLL3 multiplies C32K with 7000 */
71static unsigned long pll3_recalc(struct clk *clk)
72{
73 return clk->parent->rate * 7000;
74}
75
76static struct sh_clk_ops pll3_clk_ops = {
77 .recalc = pll3_recalc,
78};
79
80static struct clk pll3_clk = {
81 .ops = &pll3_clk_ops,
82 .parent = &c32k_clk,
83};
84
85static struct clk *main_clks[] = {
86 &c32k_clk,
87 &pll3_clk,
88};
89
90enum { SCLKDIV_USIAU0, SCLKDIV_USIBU2, SCLKDIV_USIBU1, SCLKDIV_USIBU3,
91 SCLKDIV_NR };
92
93#define SCLKDIV(_reg, _shift) \
94{ \
95 .parent = &pll3_clk, \
96 .enable_reg = IOMEM(EMEV2_SMU_BASE + (_reg)), \
97 .enable_bit = _shift, \
98}
99
100static struct clk sclkdiv_clks[SCLKDIV_NR] = {
101 [SCLKDIV_USIAU0] = SCLKDIV(USIAU0SCLKDIV, 0),
102 [SCLKDIV_USIBU2] = SCLKDIV(USIB2SCLKDIV, 16),
103 [SCLKDIV_USIBU1] = SCLKDIV(USIB2SCLKDIV, 0),
104 [SCLKDIV_USIBU3] = SCLKDIV(USIB3SCLKDIV, 0),
105};
106
107enum { GCLK_USIAU0_SCLK, GCLK_USIBU1_SCLK, GCLK_USIBU2_SCLK, GCLK_USIBU3_SCLK,
108 GCLK_STI_SCLK,
109 GCLK_NR };
110
111#define GCLK_SCLK(_parent, _reg) \
112{ \
113 .parent = _parent, \
114 .enable_reg = IOMEM(EMEV2_SMU_BASE + (_reg)), \
115 .enable_bit = 1, /* SCLK_GCC */ \
116}
117
118static struct clk gclk_clks[GCLK_NR] = {
119 [GCLK_USIAU0_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIAU0],
120 USIAU0GCLKCTRL),
121 [GCLK_USIBU1_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIBU1],
122 USIBU1GCLKCTRL),
123 [GCLK_USIBU2_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIBU2],
124 USIBU2GCLKCTRL),
125 [GCLK_USIBU3_SCLK] = GCLK_SCLK(&sclkdiv_clks[SCLKDIV_USIBU3],
126 USIBU3GCLKCTRL),
127 [GCLK_STI_SCLK] = GCLK_SCLK(&c32k_clk, STIGCLKCTRL),
128};
129
130static int emev2_gclk_enable(struct clk *clk)
131{
132 iowrite32(ioread32(clk->mapped_reg) | (1 << clk->enable_bit),
133 clk->mapped_reg);
134 return 0;
135}
136
137static void emev2_gclk_disable(struct clk *clk)
138{
139 iowrite32(ioread32(clk->mapped_reg) & ~(1 << clk->enable_bit),
140 clk->mapped_reg);
141}
142
143static struct sh_clk_ops emev2_gclk_clk_ops = {
144 .enable = emev2_gclk_enable,
145 .disable = emev2_gclk_disable,
146 .recalc = followparent_recalc,
147};
148
149static int __init emev2_gclk_register(struct clk *clks, int nr)
150{
151 struct clk *clkp;
152 int ret = 0;
153 int k;
154
155 for (k = 0; !ret && (k < nr); k++) {
156 clkp = clks + k;
157 clkp->ops = &emev2_gclk_clk_ops;
158 ret |= clk_register(clkp);
159 }
160
161 return ret;
162}
163
164static unsigned long emev2_sclkdiv_recalc(struct clk *clk)
165{
166 unsigned int sclk_div;
167
168 sclk_div = (ioread32(clk->mapped_reg) >> clk->enable_bit) & 0xff;
169
170 return clk->parent->rate / (sclk_div + 1);
171}
172
173static struct sh_clk_ops emev2_sclkdiv_clk_ops = {
174 .recalc = emev2_sclkdiv_recalc,
175};
176
177static int __init emev2_sclkdiv_register(struct clk *clks, int nr)
178{
179 struct clk *clkp;
180 int ret = 0;
181 int k;
182
183 for (k = 0; !ret && (k < nr); k++) {
184 clkp = clks + k;
185 clkp->ops = &emev2_sclkdiv_clk_ops;
186 ret |= clk_register(clkp);
187 }
188
189 return ret;
190}
191
192static struct clk_lookup lookups[] = {
193 CLKDEV_DEV_ID("serial8250-em.0", &gclk_clks[GCLK_USIAU0_SCLK]),
194 CLKDEV_DEV_ID("e1020000.uart", &gclk_clks[GCLK_USIAU0_SCLK]),
195 CLKDEV_DEV_ID("serial8250-em.1", &gclk_clks[GCLK_USIBU1_SCLK]),
196 CLKDEV_DEV_ID("e1030000.uart", &gclk_clks[GCLK_USIBU1_SCLK]),
197 CLKDEV_DEV_ID("serial8250-em.2", &gclk_clks[GCLK_USIBU2_SCLK]),
198 CLKDEV_DEV_ID("e1040000.uart", &gclk_clks[GCLK_USIBU2_SCLK]),
199 CLKDEV_DEV_ID("serial8250-em.3", &gclk_clks[GCLK_USIBU3_SCLK]),
200 CLKDEV_DEV_ID("e1050000.uart", &gclk_clks[GCLK_USIBU3_SCLK]),
201 CLKDEV_DEV_ID("em_sti.0", &gclk_clks[GCLK_STI_SCLK]),
202 CLKDEV_DEV_ID("e0180000.sti", &gclk_clks[GCLK_STI_SCLK]),
203};
204
205void __init emev2_clock_init(void)
206{
207 int k, ret = 0;
208 static int is_setup;
209
210 /* yuck, this is ugly as hell, but the non-smp case of clocks
211 * code is now designed to rely on ioremap() instead of static
212 * entity maps. in the case of smp we need access to the SMU
213 * register earlier than ioremap() is actually working without
214 * any static maps. to enable SMP in ugly but with dynamic
215 * mappings we have to call emev2_clock_init() from different
216 * places depending on UP and SMP...
217 */
218 if (is_setup++)
219 return;
220
221 smu_base = ioremap(EMEV2_SMU_BASE, PAGE_SIZE);
222 BUG_ON(!smu_base);
223
224 /* setup STI timer to run on 37.768 kHz and deassert reset */
225 emev2_smu_write(0, STI_CLKSEL);
226 emev2_smu_write(1, STI_RSTCTRL);
227
228 /* deassert reset for UART0->UART3 */
229 emev2_smu_write(2, USIAU0_RSTCTRL);
230 emev2_smu_write(2, USIBU1_RSTCTRL);
231 emev2_smu_write(2, USIBU2_RSTCTRL);
232 emev2_smu_write(2, USIBU3_RSTCTRL);
233
234 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
235 ret = clk_register(main_clks[k]);
236
237 if (!ret)
238 ret = emev2_sclkdiv_register(sclkdiv_clks, SCLKDIV_NR);
239
240 if (!ret)
241 ret = emev2_gclk_register(gclk_clks, GCLK_NR);
242
243 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
244
245 if (!ret)
246 shmobile_clk_init();
247 else
248 panic("failed to setup emev2 clocks\n");
249}
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index 99c4d743a99c..26eea5f21054 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -47,6 +47,7 @@
47#define PLLC01CR 0xe6150028 47#define PLLC01CR 0xe6150028
48 48
49#define SUBCKCR 0xe6150080 49#define SUBCKCR 0xe6150080
50#define USBCKCR 0xe615008c
50 51
51#define MSTPSR0 0xe6150030 52#define MSTPSR0 0xe6150030
52#define MSTPSR1 0xe6150038 53#define MSTPSR1 0xe6150038
@@ -181,6 +182,95 @@ static struct clk pllc1_div2_clk = {
181 .parent = &pllc1_clk, 182 .parent = &pllc1_clk,
182}; 183};
183 184
185/* USB clock */
186static struct clk *usb24s_parents[] = {
187 [0] = &system_clk,
188 [1] = &extal2_clk
189};
190
191static int usb24s_enable(struct clk *clk)
192{
193 __raw_writel(__raw_readl(USBCKCR) & ~(1 << 8), USBCKCR);
194
195 return 0;
196}
197
198static void usb24s_disable(struct clk *clk)
199{
200 __raw_writel(__raw_readl(USBCKCR) | (1 << 8), USBCKCR);
201}
202
203static int usb24s_set_parent(struct clk *clk, struct clk *parent)
204{
205 int i, ret;
206 u32 val;
207
208 if (!clk->parent_table || !clk->parent_num)
209 return -EINVAL;
210
211 /* Search the parent */
212 for (i = 0; i < clk->parent_num; i++)
213 if (clk->parent_table[i] == parent)
214 break;
215
216 if (i == clk->parent_num)
217 return -ENODEV;
218
219 ret = clk_reparent(clk, parent);
220 if (ret < 0)
221 return ret;
222
223 val = __raw_readl(USBCKCR);
224 val &= ~(1 << 7);
225 val |= i << 7;
226 __raw_writel(val, USBCKCR);
227
228 return 0;
229}
230
231static struct sh_clk_ops usb24s_clk_ops = {
232 .recalc = followparent_recalc,
233 .enable = usb24s_enable,
234 .disable = usb24s_disable,
235 .set_parent = usb24s_set_parent,
236};
237
238static struct clk usb24s_clk = {
239 .ops = &usb24s_clk_ops,
240 .parent_table = usb24s_parents,
241 .parent_num = ARRAY_SIZE(usb24s_parents),
242 .parent = &system_clk,
243};
244
245static unsigned long usb24_recalc(struct clk *clk)
246{
247 return clk->parent->rate /
248 ((__raw_readl(USBCKCR) & (1 << 6)) ? 1 : 2);
249};
250
251static int usb24_set_rate(struct clk *clk, unsigned long rate)
252{
253 u32 val;
254
255 /* closer to which ? parent->rate or parent->rate/2 */
256 val = __raw_readl(USBCKCR);
257 val &= ~(1 << 6);
258 val |= (rate > (clk->parent->rate / 4) * 3) << 6;
259 __raw_writel(val, USBCKCR);
260
261 return 0;
262}
263
264static struct sh_clk_ops usb24_clk_ops = {
265 .recalc = usb24_recalc,
266 .set_rate = usb24_set_rate,
267};
268
269static struct clk usb24_clk = {
270 .ops = &usb24_clk_ops,
271 .parent = &usb24s_clk,
272};
273
184struct clk *main_clks[] = { 274struct clk *main_clks[] = {
185 &extalr_clk, 275 &extalr_clk,
186 &extal1_clk, 276 &extal1_clk,
@@ -196,6 +286,8 @@ struct clk *main_clks[] = {
196 &pllc0_clk, 286 &pllc0_clk,
197 &pllc1_clk, 287 &pllc1_clk,
198 &pllc1_div2_clk, 288 &pllc1_div2_clk,
289 &usb24s_clk,
290 &usb24_clk,
199}; 291};
200 292
201static void div4_kick(struct clk *clk) 293static void div4_kick(struct clk *clk)
@@ -223,7 +315,7 @@ static struct clk_div4_table div4_table = {
223 315
224enum { 316enum {
225 DIV4_I, DIV4_ZG, DIV4_B, DIV4_M1, DIV4_HP, 317 DIV4_I, DIV4_ZG, DIV4_B, DIV4_M1, DIV4_HP,
226 DIV4_HPP, DIV4_S, DIV4_ZB, DIV4_M3, DIV4_CP, 318 DIV4_HPP, DIV4_USBP, DIV4_S, DIV4_ZB, DIV4_M3, DIV4_CP,
227 DIV4_NR 319 DIV4_NR
228}; 320};
229 321
@@ -234,6 +326,7 @@ struct clk div4_clks[DIV4_NR] = {
234 [DIV4_M1] = SH_CLK_DIV4(&pllc1_clk, FRQCRA, 4, 0x6fff, CLK_ENABLE_ON_INIT), 326 [DIV4_M1] = SH_CLK_DIV4(&pllc1_clk, FRQCRA, 4, 0x6fff, CLK_ENABLE_ON_INIT),
235 [DIV4_HP] = SH_CLK_DIV4(&pllc1_clk, FRQCRB, 4, 0x6fff, 0), 327 [DIV4_HP] = SH_CLK_DIV4(&pllc1_clk, FRQCRB, 4, 0x6fff, 0),
236 [DIV4_HPP] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 20, 0x6fff, 0), 328 [DIV4_HPP] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 20, 0x6fff, 0),
329 [DIV4_USBP] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 16, 0x6fff, 0),
237 [DIV4_S] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 12, 0x6fff, 0), 330 [DIV4_S] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 12, 0x6fff, 0),
238 [DIV4_ZB] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 8, 0x6fff, 0), 331 [DIV4_ZB] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 8, 0x6fff, 0),
239 [DIV4_M3] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 4, 0x6fff, 0), 332 [DIV4_M3] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 4, 0x6fff, 0),
@@ -257,7 +350,11 @@ enum {
257 MSTP222, 350 MSTP222,
258 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, 351 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
259 352
260 MSTP329, MSTP323, 353 MSTP329, MSTP328, MSTP323, MSTP320,
354 MSTP314, MSTP313, MSTP312,
355 MSTP309,
356
357 MSTP416, MSTP415, MSTP407, MSTP406,
261 358
262 MSTP_NR 359 MSTP_NR
263}; 360};
@@ -280,7 +377,18 @@ static struct clk mstp_clks[MSTP_NR] = {
280 [MSTP200] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 0, 0), /* SCIFA4 */ 377 [MSTP200] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 0, 0), /* SCIFA4 */
281 378
282 [MSTP329] = SH_CLK_MSTP32(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */ 379 [MSTP329] = SH_CLK_MSTP32(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */
380 [MSTP328] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 28, 0), /* FSI */
283 [MSTP323] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR3, 23, 0), /* IIC1 */ 381 [MSTP323] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR3, 23, 0), /* IIC1 */
382 [MSTP320] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 20, 0), /* USBF */
383 [MSTP314] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 14, 0), /* SDHI0 */
384 [MSTP313] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 13, 0), /* SDHI1 */
385 [MSTP312] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMC */
386 [MSTP309] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 9, 0), /* GEther */
387
388 [MSTP416] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 16, 0), /* USBHOST */
389 [MSTP415] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 15, 0), /* SDHI2 */
390 [MSTP407] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 7, 0), /* USB-Func */
391 [MSTP406] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 6, 0), /* USB Phy */
284}; 392};
285 393
286static struct clk_lookup lookups[] = { 394static struct clk_lookup lookups[] = {
@@ -299,6 +407,7 @@ static struct clk_lookup lookups[] = {
299 CLKDEV_CON_ID("pllc0_clk", &pllc0_clk), 407 CLKDEV_CON_ID("pllc0_clk", &pllc0_clk),
300 CLKDEV_CON_ID("pllc1_clk", &pllc1_clk), 408 CLKDEV_CON_ID("pllc1_clk", &pllc1_clk),
301 CLKDEV_CON_ID("pllc1_div2_clk", &pllc1_div2_clk), 409 CLKDEV_CON_ID("pllc1_div2_clk", &pllc1_div2_clk),
410 CLKDEV_CON_ID("usb24s", &usb24s_clk),
302 411
303 /* DIV4 clocks */ 412 /* DIV4 clocks */
304 CLKDEV_CON_ID("i_clk", &div4_clks[DIV4_I]), 413 CLKDEV_CON_ID("i_clk", &div4_clks[DIV4_I]),
@@ -334,7 +443,22 @@ static struct clk_lookup lookups[] = {
334 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]), 443 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]),
335 444
336 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), 445 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]),
446 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]),
337 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), 447 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]),
448 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP320]),
449 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
450 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]),
451 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]),
452 CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP309]),
453
454 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP415]),
455
456 /* ICK */
457 CLKDEV_ICK_ID("host", "renesas_usbhs", &mstp_clks[MSTP416]),
458 CLKDEV_ICK_ID("func", "renesas_usbhs", &mstp_clks[MSTP407]),
459 CLKDEV_ICK_ID("phy", "renesas_usbhs", &mstp_clks[MSTP406]),
460 CLKDEV_ICK_ID("pci", "renesas_usbhs", &div4_clks[DIV4_USBP]),
461 CLKDEV_ICK_ID("usb24", "renesas_usbhs", &usb24_clk),
338}; 462};
339 463
340void __init r8a7740_clock_init(u8 md_ck) 464void __init r8a7740_clock_init(u8 md_ck)
diff --git a/arch/arm/mach-shmobile/headsmp.S b/arch/arm/mach-shmobile/headsmp.S
index 6ac015c89206..b202c1272526 100644
--- a/arch/arm/mach-shmobile/headsmp.S
+++ b/arch/arm/mach-shmobile/headsmp.S
@@ -16,6 +16,59 @@
16 16
17 __CPUINIT 17 __CPUINIT
18 18
19/* Cache invalidation nicked from arch/arm/mach-imx/head-v7.S, thanks!
20 *
21 * The secondary kernel init calls v7_flush_dcache_all before it enables
22 * the L1; however, the L1 comes out of reset in an undefined state, so
23 * the clean + invalidate performed by v7_flush_dcache_all causes a bunch
24 * of cache lines with uninitialized data and uninitialized tags to get
25 * written out to memory, which does really unpleasant things to the main
26 * processor. We fix this by performing an invalidate, rather than a
27 * clean + invalidate, before jumping into the kernel.
28 *
29 * This funciton is cloned from arch/arm/mach-tegra/headsmp.S, and needs
30 * to be called for both secondary cores startup and primary core resume
31 * procedures. Ideally, it should be moved into arch/arm/mm/cache-v7.S.
32 */
33ENTRY(v7_invalidate_l1)
34 mov r0, #0
35 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
36 mcr p15, 2, r0, c0, c0, 0
37 mrc p15, 1, r0, c0, c0, 0
38
39 ldr r1, =0x7fff
40 and r2, r1, r0, lsr #13
41
42 ldr r1, =0x3ff
43
44 and r3, r1, r0, lsr #3 @ NumWays - 1
45 add r2, r2, #1 @ NumSets
46
47 and r0, r0, #0x7
48 add r0, r0, #4 @ SetShift
49
50 clz r1, r3 @ WayShift
51 add r4, r3, #1 @ NumWays
521: sub r2, r2, #1 @ NumSets--
53 mov r3, r4 @ Temp = NumWays
542: subs r3, r3, #1 @ Temp--
55 mov r5, r3, lsl r1
56 mov r6, r2, lsl r0
57 orr r5, r5, r6 @ Reg = (Temp<<WayShift)|(NumSets<<SetShift)
58 mcr p15, 0, r5, c7, c6, 2
59 bgt 2b
60 cmp r2, #0
61 bgt 1b
62 dsb
63 isb
64 mov pc, lr
65ENDPROC(v7_invalidate_l1)
66
67ENTRY(shmobile_invalidate_start)
68 bl v7_invalidate_l1
69 b secondary_startup
70ENDPROC(shmobile_invalidate_start)
71
19/* 72/*
20 * Reset vector for secondary CPUs. 73 * Reset vector for secondary CPUs.
21 * This will be mapped at address 0 by SBAR register. 74 * This will be mapped at address 0 by SBAR register.
@@ -24,4 +77,5 @@
24 .align 12 77 .align 12
25ENTRY(shmobile_secondary_vector) 78ENTRY(shmobile_secondary_vector)
26 ldr pc, 1f 79 ldr pc, 1f
271: .long secondary_startup - PAGE_OFFSET + PLAT_PHYS_OFFSET 801: .long shmobile_invalidate_start - PAGE_OFFSET + PLAT_PHYS_OFFSET
81ENDPROC(shmobile_secondary_vector)
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 83ad3fe0a75f..ff5f12fd742f 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -3,8 +3,9 @@
3 3
4extern void shmobile_earlytimer_init(void); 4extern void shmobile_earlytimer_init(void);
5extern struct sys_timer shmobile_timer; 5extern struct sys_timer shmobile_timer;
6extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz,
7 unsigned int mult, unsigned int div);
6struct twd_local_timer; 8struct twd_local_timer;
7void shmobile_twd_init(struct twd_local_timer *twd_local_timer);
8extern void shmobile_setup_console(void); 9extern void shmobile_setup_console(void);
9extern void shmobile_secondary_vector(void); 10extern void shmobile_secondary_vector(void);
10extern int shmobile_platform_cpu_kill(unsigned int cpu); 11extern int shmobile_platform_cpu_kill(unsigned int cpu);
@@ -82,5 +83,6 @@ extern int r8a7779_platform_cpu_kill(unsigned int cpu);
82extern void r8a7779_secondary_init(unsigned int cpu); 83extern void r8a7779_secondary_init(unsigned int cpu);
83extern int r8a7779_boot_secondary(unsigned int cpu); 84extern int r8a7779_boot_secondary(unsigned int cpu);
84extern void r8a7779_smp_prepare_cpus(void); 85extern void r8a7779_smp_prepare_cpus(void);
86extern void r8a7779_register_twd(void);
85 87
86#endif /* __ARCH_MACH_COMMON_H */ 88#endif /* __ARCH_MACH_COMMON_H */
diff --git a/arch/arm/mach-shmobile/include/mach/emev2.h b/arch/arm/mach-shmobile/include/mach/emev2.h
new file mode 100644
index 000000000000..e6b0c1bf4b7e
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/emev2.h
@@ -0,0 +1,19 @@
1#ifndef __ASM_EMEV2_H__
2#define __ASM_EMEV2_H__
3
4extern void emev2_map_io(void);
5extern void emev2_init_irq(void);
6extern void emev2_add_early_devices(void);
7extern void emev2_add_standard_devices(void);
8extern void emev2_clock_init(void);
9extern void emev2_set_boot_vector(unsigned long value);
10extern unsigned int emev2_get_core_count(void);
11extern int emev2_platform_cpu_kill(unsigned int cpu);
12extern void emev2_secondary_init(unsigned int cpu);
13extern int emev2_boot_secondary(unsigned int cpu);
14extern void emev2_smp_prepare_cpus(void);
15
16#define EMEV2_GPIO_BASE 200
17#define EMEV2_GPIO_IRQ(n) (EMEV2_GPIO_BASE + (n))
18
19#endif /* __ASM_EMEV2_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/intc.h b/arch/arm/mach-shmobile/include/mach/intc.h
index 8b22258c8caa..a5603c76cfe0 100644
--- a/arch/arm/mach-shmobile/include/mach/intc.h
+++ b/arch/arm/mach-shmobile/include/mach/intc.h
@@ -142,6 +142,50 @@ static struct intc_desc p ## _desc __initdata = { \
142 p ## _sense_registers, p ## _ack_registers) \ 142 p ## _sense_registers, p ## _ack_registers) \
143} 143}
144 144
145#define INTC_IRQ_PINS_16H(p, base, vect, str) \
146 \
147static struct resource p ## _resources[] __initdata = { \
148 [0] = { \
149 .start = base, \
150 .end = base + 0x64, \
151 .flags = IORESOURCE_MEM, \
152 }, \
153}; \
154 \
155enum { \
156 p ## _UNUSED = 0, \
157 INTC_IRQ_PINS_ENUM_16H(p), \
158}; \
159 \
160static struct intc_vect p ## _vectors[] __initdata = { \
161 INTC_IRQ_PINS_VECT_16H(p, vect), \
162}; \
163 \
164static struct intc_mask_reg p ## _mask_registers[] __initdata = { \
165 INTC_IRQ_PINS_MASK_16H(p, base), \
166}; \
167 \
168static struct intc_prio_reg p ## _prio_registers[] __initdata = { \
169 INTC_IRQ_PINS_PRIO_16H(p, base), \
170}; \
171 \
172static struct intc_sense_reg p ## _sense_registers[] __initdata = { \
173 INTC_IRQ_PINS_SENSE_16H(p, base), \
174}; \
175 \
176static struct intc_mask_reg p ## _ack_registers[] __initdata = { \
177 INTC_IRQ_PINS_ACK_16H(p, base), \
178}; \
179 \
180static struct intc_desc p ## _desc __initdata = { \
181 .name = str, \
182 .resource = p ## _resources, \
183 .num_resources = ARRAY_SIZE(p ## _resources), \
184 .hw = INTC_HW_DESC(p ## _vectors, NULL, \
185 p ## _mask_registers, p ## _prio_registers, \
186 p ## _sense_registers, p ## _ack_registers) \
187}
188
145#define INTC_IRQ_PINS_32(p, base, vect, str) \ 189#define INTC_IRQ_PINS_32(p, base, vect, str) \
146 \ 190 \
147static struct resource p ## _resources[] __initdata = { \ 191static struct resource p ## _resources[] __initdata = { \
diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h
index 4e686cc201fc..06a5da3c3050 100644
--- a/arch/arm/mach-shmobile/include/mach/irqs.h
+++ b/arch/arm/mach-shmobile/include/mach/irqs.h
@@ -7,7 +7,7 @@
7#define gic_spi(nr) ((nr) + 32) 7#define gic_spi(nr) ((nr) + 32)
8 8
9/* INTCS */ 9/* INTCS */
10#define INTCS_VECT_BASE 0x2200 10#define INTCS_VECT_BASE 0x3400
11#define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect)) 11#define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect))
12#define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt)) 12#define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt))
13 13
diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/include/mach/sh7372.h
index 8254ab86f6cd..915d0093da08 100644
--- a/arch/arm/mach-shmobile/include/mach/sh7372.h
+++ b/arch/arm/mach-shmobile/include/mach/sh7372.h
@@ -457,6 +457,8 @@ enum {
457 SHDMA_SLAVE_SDHI1_TX, 457 SHDMA_SLAVE_SDHI1_TX,
458 SHDMA_SLAVE_SDHI2_RX, 458 SHDMA_SLAVE_SDHI2_RX,
459 SHDMA_SLAVE_SDHI2_TX, 459 SHDMA_SLAVE_SDHI2_TX,
460 SHDMA_SLAVE_FSIA_RX,
461 SHDMA_SLAVE_FSIA_TX,
460 SHDMA_SLAVE_MMCIF_RX, 462 SHDMA_SLAVE_MMCIF_RX,
461 SHDMA_SLAVE_MMCIF_TX, 463 SHDMA_SLAVE_MMCIF_TX,
462 SHDMA_SLAVE_USB0_TX, 464 SHDMA_SLAVE_USB0_TX,
diff --git a/arch/arm/mach-shmobile/include/mach/sh73a0.h b/arch/arm/mach-shmobile/include/mach/sh73a0.h
index cad57578ceed..398e2c10913b 100644
--- a/arch/arm/mach-shmobile/include/mach/sh73a0.h
+++ b/arch/arm/mach-shmobile/include/mach/sh73a0.h
@@ -482,6 +482,9 @@ enum {
482 GPIO_FN_FSIAILR_PU, 482 GPIO_FN_FSIAILR_PU,
483 GPIO_FN_FSIAIBT_PU, 483 GPIO_FN_FSIAIBT_PU,
484 GPIO_FN_FSIAISLD_PU, 484 GPIO_FN_FSIAISLD_PU,
485
486 /* end of GPIO */
487 GPIO_NR,
485}; 488};
486 489
487/* DMA slave IDs */ 490/* DMA slave IDs */
@@ -515,8 +518,36 @@ enum {
515 SHDMA_SLAVE_MMCIF_RX, 518 SHDMA_SLAVE_MMCIF_RX,
516}; 519};
517 520
518/* PINT interrupts are located at Linux IRQ 800 and up */ 521/*
519#define SH73A0_PINT0_IRQ(irq) ((irq) + 800) 522 * SH73A0 IRQ LOCATION TABLE
520#define SH73A0_PINT1_IRQ(irq) ((irq) + 832) 523 *
524 * 416 -----------------------------------------
525 * IRQ0-IRQ15
526 * 431 -----------------------------------------
527 * ...
528 * 448 -----------------------------------------
529 * sh73a0-intcs
530 * sh73a0-intca-irq-pins
531 * 680 -----------------------------------------
532 * ...
533 * 700 -----------------------------------------
534 * sh73a0-pint0
535 * 731 -----------------------------------------
536 * 732 -----------------------------------------
537 * sh73a0-pint1
538 * 739 -----------------------------------------
539 * ...
540 * 800 -----------------------------------------
541 * IRQ16-IRQ31
542 * 815 -----------------------------------------
543 * ...
544 * 928 -----------------------------------------
545 * sh73a0-intca-irq-pins
546 * 943 -----------------------------------------
547 */
548
549/* PINT interrupts are located at Linux IRQ 700 and up */
550#define SH73A0_PINT0_IRQ(irq) ((irq) + 700)
551#define SH73A0_PINT1_IRQ(irq) ((irq) + 732)
521 552
522#endif /* __ASM_SH73A0_H__ */ 553#endif /* __ASM_SH73A0_H__ */
diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c
index 6447e0af52d4..2587a22842f2 100644
--- a/arch/arm/mach-shmobile/intc-sh7372.c
+++ b/arch/arm/mach-shmobile/intc-sh7372.c
@@ -19,6 +19,7 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/module.h>
22#include <linux/irq.h> 23#include <linux/irq.h>
23#include <linux/io.h> 24#include <linux/io.h>
24#include <linux/sh_intc.h> 25#include <linux/sh_intc.h>
@@ -305,14 +306,16 @@ static DECLARE_INTC_DESC(intca_desc, "sh7372-intca",
305 intca_mask_registers, intca_prio_registers, 306 intca_mask_registers, intca_prio_registers,
306 NULL); 307 NULL);
307 308
308INTC_IRQ_PINS_32(intca_irq_pins, 0xe6900000, 309INTC_IRQ_PINS_16(intca_irq_pins_lo, 0xe6900000,
309 INTC_VECT, "sh7372-intca-irq-pins"); 310 INTC_VECT, "sh7372-intca-irq-lo");
311
312INTC_IRQ_PINS_16H(intca_irq_pins_hi, 0xe6900000,
313 INTC_VECT, "sh7372-intca-irq-hi");
314
310enum { 315enum {
311 UNUSED_INTCS = 0, 316 UNUSED_INTCS = 0,
312 ENABLED_INTCS, 317 ENABLED_INTCS,
313 318
314 INTCS,
315
316 /* interrupt sources INTCS */ 319 /* interrupt sources INTCS */
317 320
318 /* IRQ0S - IRQ31S */ 321 /* IRQ0S - IRQ31S */
@@ -426,8 +429,6 @@ static struct intc_vect intcs_vectors[] = {
426 INTCS_VECT(CPORTS2R, 0x1a20), 429 INTCS_VECT(CPORTS2R, 0x1a20),
427 /* CEC */ 430 /* CEC */
428 INTCS_VECT(JPU6E, 0x1a80), 431 INTCS_VECT(JPU6E, 0x1a80),
429
430 INTC_VECT(INTCS, 0xf80),
431}; 432};
432 433
433static struct intc_group intcs_groups[] __initdata = { 434static struct intc_group intcs_groups[] __initdata = {
@@ -490,9 +491,6 @@ static struct intc_mask_reg intcs_mask_registers[] = {
490 { 0xffd5019c, 0xffd501dc, 8, /* IMR7SA3 / IMCR7SA3 */ 491 { 0xffd5019c, 0xffd501dc, 8, /* IMR7SA3 / IMCR7SA3 */
491 { MFIS2_INTCS, CPORTS2R, 0, 0, 492 { MFIS2_INTCS, CPORTS2R, 0, 0,
492 JPU6E, 0, 0, 0 } }, 493 JPU6E, 0, 0, 0 } },
493 { 0xffd20104, 0, 16, /* INTAMASK */
494 { 0, 0, 0, 0, 0, 0, 0, 0,
495 0, 0, 0, 0, 0, 0, 0, INTCS } },
496}; 494};
497 495
498/* Priority is needed for INTCA to receive the INTCS interrupt */ 496/* Priority is needed for INTCA to receive the INTCS interrupt */
@@ -557,18 +555,30 @@ static void __iomem *intcs_ffd5;
557void __init sh7372_init_irq(void) 555void __init sh7372_init_irq(void)
558{ 556{
559 void __iomem *intevtsa; 557 void __iomem *intevtsa;
558 int n;
560 559
561 intcs_ffd2 = ioremap_nocache(0xffd20000, PAGE_SIZE); 560 intcs_ffd2 = ioremap_nocache(0xffd20000, PAGE_SIZE);
562 intevtsa = intcs_ffd2 + 0x100; 561 intevtsa = intcs_ffd2 + 0x100;
563 intcs_ffd5 = ioremap_nocache(0xffd50000, PAGE_SIZE); 562 intcs_ffd5 = ioremap_nocache(0xffd50000, PAGE_SIZE);
564 563
565 register_intc_controller(&intca_desc); 564 register_intc_controller(&intca_desc);
566 register_intc_controller(&intca_irq_pins_desc); 565 register_intc_controller(&intca_irq_pins_lo_desc);
566 register_intc_controller(&intca_irq_pins_hi_desc);
567 register_intc_controller(&intcs_desc); 567 register_intc_controller(&intcs_desc);
568 568
569 /* setup dummy cascade chip for INTCS */
570 n = evt2irq(0xf80);
571 irq_alloc_desc_at(n, numa_node_id());
572 irq_set_chip_and_handler_name(n, &dummy_irq_chip,
573 handle_level_irq, "level");
574 set_irq_flags(n, IRQF_VALID); /* yuck */
575
569 /* demux using INTEVTSA */ 576 /* demux using INTEVTSA */
570 irq_set_handler_data(evt2irq(0xf80), (void *)intevtsa); 577 irq_set_handler_data(n, (void *)intevtsa);
571 irq_set_chained_handler(evt2irq(0xf80), intcs_demux); 578 irq_set_chained_handler(n, intcs_demux);
579
580 /* unmask INTCS in INTAMASK */
581 iowrite16(0, intcs_ffd2 + 0x104);
572} 582}
573 583
574static unsigned short ffd2[0x200]; 584static unsigned short ffd2[0x200];
diff --git a/arch/arm/mach-shmobile/pfc-r8a7740.c b/arch/arm/mach-shmobile/pfc-r8a7740.c
index a4fff6950b03..670fe1869dbc 100644
--- a/arch/arm/mach-shmobile/pfc-r8a7740.c
+++ b/arch/arm/mach-shmobile/pfc-r8a7740.c
@@ -22,6 +22,7 @@
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/gpio.h> 23#include <linux/gpio.h>
24#include <mach/r8a7740.h> 24#include <mach/r8a7740.h>
25#include <mach/irqs.h>
25 26
26#define CPU_ALL_PORT(fn, pfx, sfx) \ 27#define CPU_ALL_PORT(fn, pfx, sfx) \
27 PORT_10(fn, pfx, sfx), PORT_90(fn, pfx, sfx), \ 28 PORT_10(fn, pfx, sfx), PORT_90(fn, pfx, sfx), \
@@ -2527,6 +2528,41 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
2527 { }, 2528 { },
2528}; 2529};
2529 2530
2531static struct pinmux_irq pinmux_irqs[] = {
2532 PINMUX_IRQ(evt2irq(0x0200), PORT2_FN0, PORT13_FN0), /* IRQ0A */
2533 PINMUX_IRQ(evt2irq(0x0220), PORT20_FN0), /* IRQ1A */
2534 PINMUX_IRQ(evt2irq(0x0240), PORT11_FN0, PORT12_FN0), /* IRQ2A */
2535 PINMUX_IRQ(evt2irq(0x0260), PORT10_FN0, PORT14_FN0), /* IRQ3A */
2536 PINMUX_IRQ(evt2irq(0x0280), PORT15_FN0, PORT172_FN0), /* IRQ4A */
2537 PINMUX_IRQ(evt2irq(0x02A0), PORT0_FN0, PORT1_FN0), /* IRQ5A */
2538 PINMUX_IRQ(evt2irq(0x02C0), PORT121_FN0, PORT173_FN0), /* IRQ6A */
2539 PINMUX_IRQ(evt2irq(0x02E0), PORT120_FN0, PORT209_FN0), /* IRQ7A */
2540 PINMUX_IRQ(evt2irq(0x0300), PORT119_FN0), /* IRQ8A */
2541 PINMUX_IRQ(evt2irq(0x0320), PORT118_FN0, PORT210_FN0), /* IRQ9A */
2542 PINMUX_IRQ(evt2irq(0x0340), PORT19_FN0), /* IRQ10A */
2543 PINMUX_IRQ(evt2irq(0x0360), PORT104_FN0), /* IRQ11A */
2544 PINMUX_IRQ(evt2irq(0x0380), PORT42_FN0, PORT97_FN0), /* IRQ12A */
2545 PINMUX_IRQ(evt2irq(0x03A0), PORT64_FN0, PORT98_FN0), /* IRQ13A */
2546 PINMUX_IRQ(evt2irq(0x03C0), PORT63_FN0, PORT99_FN0), /* IRQ14A */
2547 PINMUX_IRQ(evt2irq(0x03E0), PORT62_FN0, PORT100_FN0), /* IRQ15A */
2548 PINMUX_IRQ(evt2irq(0x3200), PORT68_FN0, PORT211_FN0), /* IRQ16A */
2549 PINMUX_IRQ(evt2irq(0x3220), PORT69_FN0), /* IRQ17A */
2550 PINMUX_IRQ(evt2irq(0x3240), PORT70_FN0), /* IRQ18A */
2551 PINMUX_IRQ(evt2irq(0x3260), PORT71_FN0), /* IRQ19A */
2552 PINMUX_IRQ(evt2irq(0x3280), PORT67_FN0), /* IRQ20A */
2553 PINMUX_IRQ(evt2irq(0x32A0), PORT202_FN0), /* IRQ21A */
2554 PINMUX_IRQ(evt2irq(0x32C0), PORT95_FN0), /* IRQ22A */
2555 PINMUX_IRQ(evt2irq(0x32E0), PORT96_FN0), /* IRQ23A */
2556 PINMUX_IRQ(evt2irq(0x3300), PORT180_FN0), /* IRQ24A */
2557 PINMUX_IRQ(evt2irq(0x3320), PORT38_FN0), /* IRQ25A */
2558 PINMUX_IRQ(evt2irq(0x3340), PORT58_FN0, PORT81_FN0), /* IRQ26A */
2559 PINMUX_IRQ(evt2irq(0x3360), PORT57_FN0, PORT168_FN0), /* IRQ27A */
2560 PINMUX_IRQ(evt2irq(0x3380), PORT56_FN0, PORT169_FN0), /* IRQ28A */
2561 PINMUX_IRQ(evt2irq(0x33A0), PORT50_FN0, PORT170_FN0), /* IRQ29A */
2562 PINMUX_IRQ(evt2irq(0x33C0), PORT49_FN0, PORT171_FN0), /* IRQ30A */
2563 PINMUX_IRQ(evt2irq(0x33E0), PORT41_FN0, PORT167_FN0), /* IRQ31A */
2564};
2565
2530static struct pinmux_info r8a7740_pinmux_info = { 2566static struct pinmux_info r8a7740_pinmux_info = {
2531 .name = "r8a7740_pfc", 2567 .name = "r8a7740_pfc",
2532 .reserved_id = PINMUX_RESERVED, 2568 .reserved_id = PINMUX_RESERVED,
@@ -2554,6 +2590,9 @@ static struct pinmux_info r8a7740_pinmux_info = {
2554 2590
2555 .gpio_data = pinmux_data, 2591 .gpio_data = pinmux_data,
2556 .gpio_data_size = ARRAY_SIZE(pinmux_data), 2592 .gpio_data_size = ARRAY_SIZE(pinmux_data),
2593
2594 .gpio_irq = pinmux_irqs,
2595 .gpio_irq_size = ARRAY_SIZE(pinmux_irqs),
2557}; 2596};
2558 2597
2559void r8a7740_pinmux_init(void) 2598void r8a7740_pinmux_init(void)
diff --git a/arch/arm/mach-shmobile/pfc-sh73a0.c b/arch/arm/mach-shmobile/pfc-sh73a0.c
index e05634ce2e0d..4a547b803268 100644
--- a/arch/arm/mach-shmobile/pfc-sh73a0.c
+++ b/arch/arm/mach-shmobile/pfc-sh73a0.c
@@ -829,14 +829,14 @@ static pinmux_enum_t pinmux_data[] = {
829 PINMUX_DATA(PORT27_I2C_SCL2_MARK, PORT27_FN2, MSEL2CR_MSEL17_0, 829 PINMUX_DATA(PORT27_I2C_SCL2_MARK, PORT27_FN2, MSEL2CR_MSEL17_0,
830 MSEL2CR_MSEL16_1), \ 830 MSEL2CR_MSEL16_1), \
831 PINMUX_DATA(PORT27_I2C_SCL3_MARK, PORT27_FN3, MSEL2CR_MSEL19_0, 831 PINMUX_DATA(PORT27_I2C_SCL3_MARK, PORT27_FN3, MSEL2CR_MSEL19_0,
832 MSEL2CR_MSEL18_0), \ 832 MSEL2CR_MSEL18_1), \
833 PINMUX_DATA(MFG0_OUT1_MARK, PORT27_FN4), \ 833 PINMUX_DATA(MFG0_OUT1_MARK, PORT27_FN4), \
834 PINMUX_DATA(PORT27_IROUT_MARK, PORT27_FN7), 834 PINMUX_DATA(PORT27_IROUT_MARK, PORT27_FN7),
835 PINMUX_DATA(XDVFS2_MARK, PORT28_FN1), \ 835 PINMUX_DATA(XDVFS2_MARK, PORT28_FN1), \
836 PINMUX_DATA(PORT28_I2C_SDA2_MARK, PORT28_FN2, MSEL2CR_MSEL17_0, 836 PINMUX_DATA(PORT28_I2C_SDA2_MARK, PORT28_FN2, MSEL2CR_MSEL17_0,
837 MSEL2CR_MSEL16_1), \ 837 MSEL2CR_MSEL16_1), \
838 PINMUX_DATA(PORT28_I2C_SDA3_MARK, PORT28_FN3, MSEL2CR_MSEL19_0, 838 PINMUX_DATA(PORT28_I2C_SDA3_MARK, PORT28_FN3, MSEL2CR_MSEL19_0,
839 MSEL2CR_MSEL18_0), \ 839 MSEL2CR_MSEL18_1), \
840 PINMUX_DATA(PORT28_TPU1TO1_MARK, PORT28_FN7), 840 PINMUX_DATA(PORT28_TPU1TO1_MARK, PORT28_FN7),
841 PINMUX_DATA(SIM_RST_MARK, PORT29_FN1), \ 841 PINMUX_DATA(SIM_RST_MARK, PORT29_FN1), \
842 PINMUX_DATA(PORT29_TPU1TO1_MARK, PORT29_FN4), 842 PINMUX_DATA(PORT29_TPU1TO1_MARK, PORT29_FN4),
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c
index 45fa3924c6a1..bacdd667e3b1 100644
--- a/arch/arm/mach-shmobile/platsmp.c
+++ b/arch/arm/mach-shmobile/platsmp.c
@@ -16,12 +16,16 @@
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/smp.h> 17#include <linux/smp.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/of.h>
19#include <asm/hardware/gic.h> 20#include <asm/hardware/gic.h>
20#include <asm/mach-types.h> 21#include <asm/mach-types.h>
21#include <mach/common.h> 22#include <mach/common.h>
23#include <mach/emev2.h>
22 24
23#define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2()) 25#define is_sh73a0() (machine_is_ag5evm() || machine_is_kota2() || \
26 of_machine_is_compatible("renesas,sh73a0"))
24#define is_r8a7779() machine_is_marzen() 27#define is_r8a7779() machine_is_marzen()
28#define is_emev2() of_machine_is_compatible("renesas,emev2")
25 29
26static unsigned int __init shmobile_smp_get_core_count(void) 30static unsigned int __init shmobile_smp_get_core_count(void)
27{ 31{
@@ -31,6 +35,9 @@ static unsigned int __init shmobile_smp_get_core_count(void)
31 if (is_r8a7779()) 35 if (is_r8a7779())
32 return r8a7779_get_core_count(); 36 return r8a7779_get_core_count();
33 37
38 if (is_emev2())
39 return emev2_get_core_count();
40
34 return 1; 41 return 1;
35} 42}
36 43
@@ -41,6 +48,9 @@ static void __init shmobile_smp_prepare_cpus(void)
41 48
42 if (is_r8a7779()) 49 if (is_r8a7779())
43 r8a7779_smp_prepare_cpus(); 50 r8a7779_smp_prepare_cpus();
51
52 if (is_emev2())
53 emev2_smp_prepare_cpus();
44} 54}
45 55
46int shmobile_platform_cpu_kill(unsigned int cpu) 56int shmobile_platform_cpu_kill(unsigned int cpu)
@@ -48,6 +58,9 @@ int shmobile_platform_cpu_kill(unsigned int cpu)
48 if (is_r8a7779()) 58 if (is_r8a7779())
49 return r8a7779_platform_cpu_kill(cpu); 59 return r8a7779_platform_cpu_kill(cpu);
50 60
61 if (is_emev2())
62 return emev2_platform_cpu_kill(cpu);
63
51 return 1; 64 return 1;
52} 65}
53 66
@@ -60,6 +73,9 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
60 73
61 if (is_r8a7779()) 74 if (is_r8a7779())
62 r8a7779_secondary_init(cpu); 75 r8a7779_secondary_init(cpu);
76
77 if (is_emev2())
78 emev2_secondary_init(cpu);
63} 79}
64 80
65int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) 81int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
@@ -70,6 +86,9 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
70 if (is_r8a7779()) 86 if (is_r8a7779())
71 return r8a7779_boot_secondary(cpu); 87 return r8a7779_boot_secondary(cpu);
72 88
89 if (is_emev2())
90 return emev2_boot_secondary(cpu);
91
73 return -ENOSYS; 92 return -ENOSYS;
74} 93}
75 94
diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
new file mode 100644
index 000000000000..dae9aa68bb09
--- /dev/null
+++ b/arch/arm/mach-shmobile/setup-emev2.c
@@ -0,0 +1,452 @@
1/*
2 * Emma Mobile EV2 processor support
3 *
4 * Copyright (C) 2012 Magnus Damm
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/interrupt.h>
22#include <linux/irq.h>
23#include <linux/platform_device.h>
24#include <linux/platform_data/gpio-em.h>
25#include <linux/of_platform.h>
26#include <linux/delay.h>
27#include <linux/input.h>
28#include <linux/io.h>
29#include <linux/of_irq.h>
30#include <mach/hardware.h>
31#include <mach/common.h>
32#include <mach/emev2.h>
33#include <mach/irqs.h>
34#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
36#include <asm/mach/map.h>
37#include <asm/mach/time.h>
38#include <asm/hardware/gic.h>
39
40static struct map_desc emev2_io_desc[] __initdata = {
41#ifdef CONFIG_SMP
42 /* 128K entity map for 0xe0100000 (SMU) */
43 {
44 .virtual = 0xe0100000,
45 .pfn = __phys_to_pfn(0xe0100000),
46 .length = SZ_128K,
47 .type = MT_DEVICE
48 },
49 /* 2M mapping for SCU + L2 controller */
50 {
51 .virtual = 0xf0000000,
52 .pfn = __phys_to_pfn(0x1e000000),
53 .length = SZ_2M,
54 .type = MT_DEVICE
55 },
56#endif
57};
58
59void __init emev2_map_io(void)
60{
61 iotable_init(emev2_io_desc, ARRAY_SIZE(emev2_io_desc));
62}
63
64/* UART */
65static struct resource uart0_resources[] = {
66 [0] = {
67 .start = 0xe1020000,
68 .end = 0xe1020037,
69 .flags = IORESOURCE_MEM,
70 },
71 [1] = {
72 .start = 40,
73 .flags = IORESOURCE_IRQ,
74 }
75};
76
77static struct platform_device uart0_device = {
78 .name = "serial8250-em",
79 .id = 0,
80 .num_resources = ARRAY_SIZE(uart0_resources),
81 .resource = uart0_resources,
82};
83
84static struct resource uart1_resources[] = {
85 [0] = {
86 .start = 0xe1030000,
87 .end = 0xe1030037,
88 .flags = IORESOURCE_MEM,
89 },
90 [1] = {
91 .start = 41,
92 .flags = IORESOURCE_IRQ,
93 }
94};
95
96static struct platform_device uart1_device = {
97 .name = "serial8250-em",
98 .id = 1,
99 .num_resources = ARRAY_SIZE(uart1_resources),
100 .resource = uart1_resources,
101};
102
103static struct resource uart2_resources[] = {
104 [0] = {
105 .start = 0xe1040000,
106 .end = 0xe1040037,
107 .flags = IORESOURCE_MEM,
108 },
109 [1] = {
110 .start = 42,
111 .flags = IORESOURCE_IRQ,
112 }
113};
114
115static struct platform_device uart2_device = {
116 .name = "serial8250-em",
117 .id = 2,
118 .num_resources = ARRAY_SIZE(uart2_resources),
119 .resource = uart2_resources,
120};
121
122static struct resource uart3_resources[] = {
123 [0] = {
124 .start = 0xe1050000,
125 .end = 0xe1050037,
126 .flags = IORESOURCE_MEM,
127 },
128 [1] = {
129 .start = 43,
130 .flags = IORESOURCE_IRQ,
131 }
132};
133
134static struct platform_device uart3_device = {
135 .name = "serial8250-em",
136 .id = 3,
137 .num_resources = ARRAY_SIZE(uart3_resources),
138 .resource = uart3_resources,
139};
140
141/* STI */
142static struct resource sti_resources[] = {
143 [0] = {
144 .name = "STI",
145 .start = 0xe0180000,
146 .end = 0xe0180053,
147 .flags = IORESOURCE_MEM,
148 },
149 [1] = {
150 .start = 157,
151 .flags = IORESOURCE_IRQ,
152 },
153};
154
155static struct platform_device sti_device = {
156 .name = "em_sti",
157 .id = 0,
158 .resource = sti_resources,
159 .num_resources = ARRAY_SIZE(sti_resources),
160};
161
162
163/* GIO */
164static struct gpio_em_config gio0_config = {
165 .gpio_base = 0,
166 .irq_base = EMEV2_GPIO_IRQ(0),
167 .number_of_pins = 32,
168};
169
170static struct resource gio0_resources[] = {
171 [0] = {
172 .name = "GIO_000",
173 .start = 0xe0050000,
174 .end = 0xe005002b,
175 .flags = IORESOURCE_MEM,
176 },
177 [1] = {
178 .name = "GIO_000",
179 .start = 0xe0050040,
180 .end = 0xe005005f,
181 .flags = IORESOURCE_MEM,
182 },
183 [2] = {
184 .start = 99,
185 .flags = IORESOURCE_IRQ,
186 },
187 [3] = {
188 .start = 100,
189 .flags = IORESOURCE_IRQ,
190 },
191};
192
193static struct platform_device gio0_device = {
194 .name = "em_gio",
195 .id = 0,
196 .resource = gio0_resources,
197 .num_resources = ARRAY_SIZE(gio0_resources),
198 .dev = {
199 .platform_data = &gio0_config,
200 },
201};
202
203static struct gpio_em_config gio1_config = {
204 .gpio_base = 32,
205 .irq_base = EMEV2_GPIO_IRQ(32),
206 .number_of_pins = 32,
207};
208
209static struct resource gio1_resources[] = {
210 [0] = {
211 .name = "GIO_032",
212 .start = 0xe0050080,
213 .end = 0xe00500ab,
214 .flags = IORESOURCE_MEM,
215 },
216 [1] = {
217 .name = "GIO_032",
218 .start = 0xe00500c0,
219 .end = 0xe00500df,
220 .flags = IORESOURCE_MEM,
221 },
222 [2] = {
223 .start = 101,
224 .flags = IORESOURCE_IRQ,
225 },
226 [3] = {
227 .start = 102,
228 .flags = IORESOURCE_IRQ,
229 },
230};
231
232static struct platform_device gio1_device = {
233 .name = "em_gio",
234 .id = 1,
235 .resource = gio1_resources,
236 .num_resources = ARRAY_SIZE(gio1_resources),
237 .dev = {
238 .platform_data = &gio1_config,
239 },
240};
241
242static struct gpio_em_config gio2_config = {
243 .gpio_base = 64,
244 .irq_base = EMEV2_GPIO_IRQ(64),
245 .number_of_pins = 32,
246};
247
248static struct resource gio2_resources[] = {
249 [0] = {
250 .name = "GIO_064",
251 .start = 0xe0050100,
252 .end = 0xe005012b,
253 .flags = IORESOURCE_MEM,
254 },
255 [1] = {
256 .name = "GIO_064",
257 .start = 0xe0050140,
258 .end = 0xe005015f,
259 .flags = IORESOURCE_MEM,
260 },
261 [2] = {
262 .start = 103,
263 .flags = IORESOURCE_IRQ,
264 },
265 [3] = {
266 .start = 104,
267 .flags = IORESOURCE_IRQ,
268 },
269};
270
271static struct platform_device gio2_device = {
272 .name = "em_gio",
273 .id = 2,
274 .resource = gio2_resources,
275 .num_resources = ARRAY_SIZE(gio2_resources),
276 .dev = {
277 .platform_data = &gio2_config,
278 },
279};
280
281static struct gpio_em_config gio3_config = {
282 .gpio_base = 96,
283 .irq_base = EMEV2_GPIO_IRQ(96),
284 .number_of_pins = 32,
285};
286
287static struct resource gio3_resources[] = {
288 [0] = {
289 .name = "GIO_096",
290 .start = 0xe0050100,
291 .end = 0xe005012b,
292 .flags = IORESOURCE_MEM,
293 },
294 [1] = {
295 .name = "GIO_096",
296 .start = 0xe0050140,
297 .end = 0xe005015f,
298 .flags = IORESOURCE_MEM,
299 },
300 [2] = {
301 .start = 105,
302 .flags = IORESOURCE_IRQ,
303 },
304 [3] = {
305 .start = 106,
306 .flags = IORESOURCE_IRQ,
307 },
308};
309
310static struct platform_device gio3_device = {
311 .name = "em_gio",
312 .id = 3,
313 .resource = gio3_resources,
314 .num_resources = ARRAY_SIZE(gio3_resources),
315 .dev = {
316 .platform_data = &gio3_config,
317 },
318};
319
320static struct gpio_em_config gio4_config = {
321 .gpio_base = 128,
322 .irq_base = EMEV2_GPIO_IRQ(128),
323 .number_of_pins = 31,
324};
325
326static struct resource gio4_resources[] = {
327 [0] = {
328 .name = "GIO_128",
329 .start = 0xe0050200,
330 .end = 0xe005022b,
331 .flags = IORESOURCE_MEM,
332 },
333 [1] = {
334 .name = "GIO_128",
335 .start = 0xe0050240,
336 .end = 0xe005025f,
337 .flags = IORESOURCE_MEM,
338 },
339 [2] = {
340 .start = 107,
341 .flags = IORESOURCE_IRQ,
342 },
343 [3] = {
344 .start = 108,
345 .flags = IORESOURCE_IRQ,
346 },
347};
348
349static struct platform_device gio4_device = {
350 .name = "em_gio",
351 .id = 4,
352 .resource = gio4_resources,
353 .num_resources = ARRAY_SIZE(gio4_resources),
354 .dev = {
355 .platform_data = &gio4_config,
356 },
357};
358
359static struct platform_device *emev2_early_devices[] __initdata = {
360 &uart0_device,
361 &uart1_device,
362 &uart2_device,
363 &uart3_device,
364};
365
366static struct platform_device *emev2_late_devices[] __initdata = {
367 &sti_device,
368 &gio0_device,
369 &gio1_device,
370 &gio2_device,
371 &gio3_device,
372 &gio4_device,
373};
374
375void __init emev2_add_standard_devices(void)
376{
377 emev2_clock_init();
378
379 platform_add_devices(emev2_early_devices,
380 ARRAY_SIZE(emev2_early_devices));
381
382 platform_add_devices(emev2_late_devices,
383 ARRAY_SIZE(emev2_late_devices));
384}
385
386void __init emev2_init_delay(void)
387{
388 shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
389}
390
391void __init emev2_add_early_devices(void)
392{
393 emev2_init_delay();
394
395 early_platform_add_devices(emev2_early_devices,
396 ARRAY_SIZE(emev2_early_devices));
397
398 /* setup early console here as well */
399 shmobile_setup_console();
400}
401
402void __init emev2_init_irq(void)
403{
404 void __iomem *gic_dist_base;
405 void __iomem *gic_cpu_base;
406
407 /* Static mappings, never released */
408 gic_dist_base = ioremap(0xe0028000, PAGE_SIZE);
409 gic_cpu_base = ioremap(0xe0020000, PAGE_SIZE);
410 BUG_ON(!gic_dist_base || !gic_cpu_base);
411
412 /* Use GIC to handle interrupts */
413 gic_init(0, 29, gic_dist_base, gic_cpu_base);
414}
415
416#ifdef CONFIG_USE_OF
417static const struct of_dev_auxdata emev2_auxdata_lookup[] __initconst = {
418 { }
419};
420
421void __init emev2_add_standard_devices_dt(void)
422{
423 of_platform_populate(NULL, of_default_bus_match_table,
424 emev2_auxdata_lookup, NULL);
425}
426
427static const struct of_device_id emev2_dt_irq_match[] = {
428 { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
429 {},
430};
431
432static const char *emev2_boards_compat_dt[] __initdata = {
433 "renesas,emev2",
434 NULL,
435};
436
437void __init emev2_init_irq_dt(void)
438{
439 of_irq_init(emev2_dt_irq_match);
440}
441
442DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)")
443 .init_early = emev2_init_delay,
444 .nr_irqs = NR_IRQS_LEGACY,
445 .init_irq = emev2_init_irq_dt,
446 .handle_irq = gic_handle_irq,
447 .init_machine = emev2_add_standard_devices_dt,
448 .timer = &shmobile_timer,
449 .dt_compat = emev2_boards_compat_dt,
450MACHINE_END
451
452#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 14edb5cffa7f..ec4eb49c1693 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -18,6 +18,7 @@
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */ 19 */
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/dma-mapping.h>
21#include <linux/kernel.h> 22#include <linux/kernel.h>
22#include <linux/init.h> 23#include <linux/init.h>
23#include <linux/io.h> 24#include <linux/io.h>
@@ -60,6 +61,12 @@ static struct map_desc r8a7740_io_desc[] __initdata = {
60void __init r8a7740_map_io(void) 61void __init r8a7740_map_io(void)
61{ 62{
62 iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc)); 63 iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc));
64
65 /*
66 * DMA memory at 0xff200000 - 0xffdfffff. The default 2MB size isn't
67 * enough to allocate the frame buffer memory.
68 */
69 init_consistent_dma_size(12 << 20);
63} 70}
64 71
65/* SCIFA0 */ 72/* SCIFA0 */
@@ -350,19 +357,19 @@ static void r8a7740_i2c_workaround(struct platform_device *pdev)
350 i2c_write(reg, ICSTART, i2c_read(reg, ICSTART) | 0x10); 357 i2c_write(reg, ICSTART, i2c_read(reg, ICSTART) | 0x10);
351 i2c_read(reg, ICSTART); /* dummy read */ 358 i2c_read(reg, ICSTART); /* dummy read */
352 359
353 mdelay(100); 360 udelay(10);
354 361
355 i2c_write(reg, ICCR, 0x01); 362 i2c_write(reg, ICCR, 0x01);
356 i2c_read(reg, ICCR);
357 i2c_write(reg, ICSTART, 0x00); 363 i2c_write(reg, ICSTART, 0x00);
358 i2c_read(reg, ICSTART); 364
365 udelay(10);
359 366
360 i2c_write(reg, ICCR, 0x10); 367 i2c_write(reg, ICCR, 0x10);
361 mdelay(100); 368 udelay(10);
362 i2c_write(reg, ICCR, 0x00); 369 i2c_write(reg, ICCR, 0x00);
363 mdelay(100); 370 udelay(10);
364 i2c_write(reg, ICCR, 0x10); 371 i2c_write(reg, ICCR, 0x10);
365 mdelay(100); 372 udelay(10);
366 373
367 iounmap(reg); 374 iounmap(reg);
368} 375}
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 12c6f529ab89..e98e46f6cf55 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -262,10 +262,14 @@ void __init r8a7779_add_standard_devices(void)
262 ARRAY_SIZE(r8a7779_late_devices)); 262 ARRAY_SIZE(r8a7779_late_devices));
263} 263}
264 264
265/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
266void __init __weak r8a7779_register_twd(void) { }
267
265static void __init r8a7779_earlytimer_init(void) 268static void __init r8a7779_earlytimer_init(void)
266{ 269{
267 r8a7779_clock_init(); 270 r8a7779_clock_init();
268 shmobile_earlytimer_init(); 271 shmobile_earlytimer_init();
272 r8a7779_register_twd();
269} 273}
270 274
271void __init r8a7779_add_early_devices(void) 275void __init r8a7779_add_early_devices(void)
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 2fe8f83ca124..6a4bd582c028 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -22,6 +22,7 @@
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/of_platform.h>
25#include <linux/uio_driver.h> 26#include <linux/uio_driver.h>
26#include <linux/delay.h> 27#include <linux/delay.h>
27#include <linux/input.h> 28#include <linux/input.h>
@@ -461,6 +462,16 @@ static const struct sh_dmae_slave_config sh7372_dmae_slaves[] = {
461 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT), 462 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_16BIT),
462 .mid_rid = 0xce, 463 .mid_rid = 0xce,
463 }, { 464 }, {
465 .slave_id = SHDMA_SLAVE_FSIA_TX,
466 .addr = 0xfe1f0024,
467 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
468 .mid_rid = 0xb1,
469 }, {
470 .slave_id = SHDMA_SLAVE_FSIA_RX,
471 .addr = 0xfe1f0020,
472 .chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
473 .mid_rid = 0xb2,
474 }, {
464 .slave_id = SHDMA_SLAVE_MMCIF_TX, 475 .slave_id = SHDMA_SLAVE_MMCIF_TX,
465 .addr = 0xe6bd0034, 476 .addr = 0xe6bd0034,
466 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT), 477 .chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
@@ -1092,3 +1103,50 @@ void __init sh7372_add_early_devices(void)
1092 /* override timer setup with soc-specific code */ 1103 /* override timer setup with soc-specific code */
1093 shmobile_timer.init = sh7372_earlytimer_init; 1104 shmobile_timer.init = sh7372_earlytimer_init;
1094} 1105}
1106
1107#ifdef CONFIG_USE_OF
1108
1109void __init sh7372_add_early_devices_dt(void)
1110{
1111 shmobile_setup_delay(800, 1, 3); /* Cortex-A8 @ 800MHz */
1112
1113 early_platform_add_devices(sh7372_early_devices,
1114 ARRAY_SIZE(sh7372_early_devices));
1115
1116 /* setup early console here as well */
1117 shmobile_setup_console();
1118}
1119
1120static const struct of_dev_auxdata sh7372_auxdata_lookup[] __initconst = {
1121 { }
1122};
1123
1124void __init sh7372_add_standard_devices_dt(void)
1125{
1126 /* clocks are setup late during boot in the case of DT */
1127 sh7372_clock_init();
1128
1129 platform_add_devices(sh7372_early_devices,
1130 ARRAY_SIZE(sh7372_early_devices));
1131
1132 of_platform_populate(NULL, of_default_bus_match_table,
1133 sh7372_auxdata_lookup, NULL);
1134}
1135
1136static const char *sh7372_boards_compat_dt[] __initdata = {
1137 "renesas,sh7372",
1138 NULL,
1139};
1140
1141DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)")
1142 .map_io = sh7372_map_io,
1143 .init_early = sh7372_add_early_devices_dt,
1144 .nr_irqs = NR_IRQS_LEGACY,
1145 .init_irq = sh7372_init_irq,
1146 .handle_irq = shmobile_handle_irq_intc,
1147 .init_machine = sh7372_add_standard_devices_dt,
1148 .timer = &shmobile_timer,
1149 .dt_compat = sh7372_boards_compat_dt,
1150MACHINE_END
1151
1152#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index 5bebffc10455..04a0dfe75493 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -688,10 +688,14 @@ void __init sh73a0_add_standard_devices(void)
688 ARRAY_SIZE(sh73a0_late_devices)); 688 ARRAY_SIZE(sh73a0_late_devices));
689} 689}
690 690
691/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
692void __init __weak sh73a0_register_twd(void) { }
693
691static void __init sh73a0_earlytimer_init(void) 694static void __init sh73a0_earlytimer_init(void)
692{ 695{
693 sh73a0_clock_init(); 696 sh73a0_clock_init();
694 shmobile_earlytimer_init(); 697 shmobile_earlytimer_init();
698 sh73a0_register_twd();
695} 699}
696 700
697void __init sh73a0_add_early_devices(void) 701void __init sh73a0_add_early_devices(void)
diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
new file mode 100644
index 000000000000..6a35c4a31e6c
--- /dev/null
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -0,0 +1,97 @@
1/*
2 * SMP support for Emma Mobile EV2
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 * Copyright (C) 2012 Magnus Damm
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/smp.h>
23#include <linux/spinlock.h>
24#include <linux/io.h>
25#include <linux/delay.h>
26#include <mach/common.h>
27#include <mach/emev2.h>
28#include <asm/smp_plat.h>
29#include <asm/smp_scu.h>
30#include <asm/hardware/gic.h>
31#include <asm/cacheflush.h>
32
33#define EMEV2_SCU_BASE 0x1e000000
34
35static DEFINE_SPINLOCK(scu_lock);
36static void __iomem *scu_base;
37
38static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
39{
40 unsigned long tmp;
41
42 /* we assume this code is running on a different cpu
43 * than the one that is changing coherency setting */
44 spin_lock(&scu_lock);
45 tmp = readl(scu_base + 8);
46 tmp &= ~clr;
47 tmp |= set;
48 writel(tmp, scu_base + 8);
49 spin_unlock(&scu_lock);
50
51}
52
53unsigned int __init emev2_get_core_count(void)
54{
55 if (!scu_base) {
56 scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
57 emev2_clock_init(); /* need ioremapped SMU */
58 }
59
60 WARN_ON_ONCE(!scu_base);
61
62 return scu_base ? scu_get_core_count(scu_base) : 1;
63}
64
65int emev2_platform_cpu_kill(unsigned int cpu)
66{
67 return 0; /* not supported yet */
68}
69
70void __cpuinit emev2_secondary_init(unsigned int cpu)
71{
72 gic_secondary_init(0);
73}
74
75int __cpuinit emev2_boot_secondary(unsigned int cpu)
76{
77 cpu = cpu_logical_map(cpu);
78
79 /* enable cache coherency */
80 modify_scu_cpu_psr(0, 3 << (cpu * 8));
81
82 /* Tell ROM loader about our vector (in headsmp.S) */
83 emev2_set_boot_vector(__pa(shmobile_secondary_vector));
84
85 gic_raise_softirq(cpumask_of(cpu), 1);
86 return 0;
87}
88
89void __init emev2_smp_prepare_cpus(void)
90{
91 int cpu = cpu_logical_map(0);
92
93 scu_enable(scu_base);
94
95 /* enable cache coherency on CPU0 */
96 modify_scu_cpu_psr(0, 3 << (cpu * 8));
97}
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index b62e19d4c9af..6d1d0238cbf7 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -64,8 +64,15 @@ static void __iomem *scu_base_addr(void)
64static DEFINE_SPINLOCK(scu_lock); 64static DEFINE_SPINLOCK(scu_lock);
65static unsigned long tmp; 65static unsigned long tmp;
66 66
67#ifdef CONFIG_HAVE_ARM_TWD
67static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29); 68static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29);
68 69
70void __init r8a7779_register_twd(void)
71{
72 twd_local_timer_register(&twd_local_timer);
73}
74#endif
75
69static void modify_scu_cpu_psr(unsigned long set, unsigned long clr) 76static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
70{ 77{
71 void __iomem *scu_base = scu_base_addr(); 78 void __iomem *scu_base = scu_base_addr();
@@ -84,7 +91,6 @@ unsigned int __init r8a7779_get_core_count(void)
84{ 91{
85 void __iomem *scu_base = scu_base_addr(); 92 void __iomem *scu_base = scu_base_addr();
86 93
87 shmobile_twd_init(&twd_local_timer);
88 return scu_get_core_count(scu_base); 94 return scu_get_core_count(scu_base);
89} 95}
90 96
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index 14ad8b052f1a..e36c41c4ab40 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -42,7 +42,13 @@ static void __iomem *scu_base_addr(void)
42static DEFINE_SPINLOCK(scu_lock); 42static DEFINE_SPINLOCK(scu_lock);
43static unsigned long tmp; 43static unsigned long tmp;
44 44
45#ifdef CONFIG_HAVE_ARM_TWD
45static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29); 46static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29);
47void __init sh73a0_register_twd(void)
48{
49 twd_local_timer_register(&twd_local_timer);
50}
51#endif
46 52
47static void modify_scu_cpu_psr(unsigned long set, unsigned long clr) 53static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
48{ 54{
@@ -62,7 +68,6 @@ unsigned int __init sh73a0_get_core_count(void)
62{ 68{
63 void __iomem *scu_base = scu_base_addr(); 69 void __iomem *scu_base = scu_base_addr();
64 70
65 shmobile_twd_init(&twd_local_timer);
66 return scu_get_core_count(scu_base); 71 return scu_get_core_count(scu_base);
67} 72}
68 73
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
index 2fba5f3d1c8a..a68919727e24 100644
--- a/arch/arm/mach-shmobile/timer.c
+++ b/arch/arm/mach-shmobile/timer.c
@@ -19,9 +19,27 @@
19 * 19 *
20 */ 20 */
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/delay.h>
22#include <asm/mach/time.h> 23#include <asm/mach/time.h>
23#include <asm/smp_twd.h> 24#include <asm/smp_twd.h>
24 25
26void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz,
27 unsigned int mult, unsigned int div)
28{
29 /* calculate a worst-case loops-per-jiffy value
30 * based on maximum cpu core mhz setting and the
31 * __delay() implementation in arch/arm/lib/delay.S
32 *
33 * this will result in a longer delay than expected
34 * when the cpu core runs on lower frequencies.
35 */
36
37 unsigned int value = (1000000 * mult) / (HZ * div);
38
39 if (!preset_lpj)
40 preset_lpj = max_cpu_core_mhz * value;
41}
42
25static void __init shmobile_late_time_init(void) 43static void __init shmobile_late_time_init(void)
26{ 44{
27 /* 45 /*
@@ -46,15 +64,6 @@ static void __init shmobile_timer_init(void)
46{ 64{
47} 65}
48 66
49void __init shmobile_twd_init(struct twd_local_timer *twd_local_timer)
50{
51#ifdef CONFIG_HAVE_ARM_TWD
52 int err = twd_local_timer_register(twd_local_timer);
53 if (err)
54 pr_err("twd_local_timer_register failed %d\n", err);
55#endif
56}
57
58struct sys_timer shmobile_timer = { 67struct sys_timer shmobile_timer = {
59 .init = shmobile_timer_init, 68 .init = shmobile_timer_init,
60}; 69};
diff --git a/arch/arm/mach-spear3xx/Kconfig b/arch/arm/mach-spear3xx/Kconfig
index 2cee6b0de371..8bd37291fa4f 100644
--- a/arch/arm/mach-spear3xx/Kconfig
+++ b/arch/arm/mach-spear3xx/Kconfig
@@ -5,39 +5,22 @@
5if ARCH_SPEAR3XX 5if ARCH_SPEAR3XX
6 6
7menu "SPEAr3xx Implementations" 7menu "SPEAr3xx Implementations"
8config BOARD_SPEAR300_EVB
9 bool "SPEAr300 Evaluation Board"
10 select MACH_SPEAR300
11 help
12 Supports ST SPEAr300 Evaluation Board
13
14config BOARD_SPEAR310_EVB
15 bool "SPEAr310 Evaluation Board"
16 select MACH_SPEAR310
17 help
18 Supports ST SPEAr310 Evaluation Board
19
20config BOARD_SPEAR320_EVB
21 bool "SPEAr320 Evaluation Board"
22 select MACH_SPEAR320
23 help
24 Supports ST SPEAr320 Evaluation Board
25
26endmenu
27
28config MACH_SPEAR300 8config MACH_SPEAR300
29 bool "SPEAr300" 9 bool "SPEAr300 Machine support with Device Tree"
10 select PINCTRL_SPEAR300
30 help 11 help
31 Supports ST SPEAr300 Machine 12 Supports ST SPEAr300 machine configured via the device-tree
32 13
33config MACH_SPEAR310 14config MACH_SPEAR310
34 bool "SPEAr310" 15 bool "SPEAr310 Machine support with Device Tree"
16 select PINCTRL_SPEAR310
35 help 17 help
36 Supports ST SPEAr310 Machine 18 Supports ST SPEAr310 machine configured via the device-tree
37 19
38config MACH_SPEAR320 20config MACH_SPEAR320
39 bool "SPEAr320" 21 bool "SPEAr320 Machine support with Device Tree"
22 select PINCTRL_SPEAR320
40 help 23 help
41 Supports ST SPEAr320 Machine 24 Supports ST SPEAr320 machine configured via the device-tree
42 25endmenu
43endif #ARCH_SPEAR3XX 26endif #ARCH_SPEAR3XX
diff --git a/arch/arm/mach-spear3xx/Makefile b/arch/arm/mach-spear3xx/Makefile
index b24862489704..17b5d83cf2d5 100644
--- a/arch/arm/mach-spear3xx/Makefile
+++ b/arch/arm/mach-spear3xx/Makefile
@@ -3,24 +3,13 @@
3# 3#
4 4
5# common files 5# common files
6obj-y += spear3xx.o clock.o 6obj-$(CONFIG_ARCH_SPEAR3XX) += spear3xx.o clock.o
7 7
8# spear300 specific files 8# spear300 specific files
9obj-$(CONFIG_MACH_SPEAR300) += spear300.o 9obj-$(CONFIG_MACH_SPEAR300) += spear300.o
10 10
11# spear300 boards files
12obj-$(CONFIG_BOARD_SPEAR300_EVB) += spear300_evb.o
13
14
15# spear310 specific files 11# spear310 specific files
16obj-$(CONFIG_MACH_SPEAR310) += spear310.o 12obj-$(CONFIG_MACH_SPEAR310) += spear310.o
17 13
18# spear310 boards files
19obj-$(CONFIG_BOARD_SPEAR310_EVB) += spear310_evb.o
20
21
22# spear320 specific files 14# spear320 specific files
23obj-$(CONFIG_MACH_SPEAR320) += spear320.o 15obj-$(CONFIG_MACH_SPEAR320) += spear320.o
24
25# spear320 boards files
26obj-$(CONFIG_BOARD_SPEAR320_EVB) += spear320_evb.o
diff --git a/arch/arm/mach-spear3xx/Makefile.boot b/arch/arm/mach-spear3xx/Makefile.boot
index 4674a4c221db..d93e2177e6ec 100644
--- a/arch/arm/mach-spear3xx/Makefile.boot
+++ b/arch/arm/mach-spear3xx/Makefile.boot
@@ -1,3 +1,7 @@
1zreladdr-y += 0x00008000 1zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4
5dtb-$(CONFIG_MACH_SPEAR300) += spear300-evb.dtb
6dtb-$(CONFIG_MACH_SPEAR310) += spear310-evb.dtb
7dtb-$(CONFIG_MACH_SPEAR320) += spear320-evb.dtb
diff --git a/arch/arm/mach-spear3xx/clock.c b/arch/arm/mach-spear3xx/clock.c
index 6c4841f55223..cd6c11099083 100644
--- a/arch/arm/mach-spear3xx/clock.c
+++ b/arch/arm/mach-spear3xx/clock.c
@@ -11,12 +11,112 @@
11 * warranty of any kind, whether express or implied. 11 * warranty of any kind, whether express or implied.
12 */ 12 */
13 13
14#include <linux/clkdev.h>
14#include <linux/init.h> 15#include <linux/init.h>
15#include <linux/io.h> 16#include <linux/io.h>
16#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/of_platform.h>
17#include <asm/mach-types.h> 19#include <asm/mach-types.h>
18#include <plat/clock.h> 20#include <plat/clock.h>
19#include <mach/misc_regs.h> 21#include <mach/misc_regs.h>
22#include <mach/spear.h>
23
24#define PLL1_CTR (MISC_BASE + 0x008)
25#define PLL1_FRQ (MISC_BASE + 0x00C)
26#define PLL1_MOD (MISC_BASE + 0x010)
27#define PLL2_CTR (MISC_BASE + 0x014)
28/* PLL_CTR register masks */
29#define PLL_ENABLE 2
30#define PLL_MODE_SHIFT 4
31#define PLL_MODE_MASK 0x3
32#define PLL_MODE_NORMAL 0
33#define PLL_MODE_FRACTION 1
34#define PLL_MODE_DITH_DSB 2
35#define PLL_MODE_DITH_SSB 3
36
37#define PLL2_FRQ (MISC_BASE + 0x018)
38/* PLL FRQ register masks */
39#define PLL_DIV_N_SHIFT 0
40#define PLL_DIV_N_MASK 0xFF
41#define PLL_DIV_P_SHIFT 8
42#define PLL_DIV_P_MASK 0x7
43#define PLL_NORM_FDBK_M_SHIFT 24
44#define PLL_NORM_FDBK_M_MASK 0xFF
45#define PLL_DITH_FDBK_M_SHIFT 16
46#define PLL_DITH_FDBK_M_MASK 0xFFFF
47
48#define PLL2_MOD (MISC_BASE + 0x01C)
49#define PLL_CLK_CFG (MISC_BASE + 0x020)
50#define CORE_CLK_CFG (MISC_BASE + 0x024)
51/* CORE CLK CFG register masks */
52#define PLL_HCLK_RATIO_SHIFT 10
53#define PLL_HCLK_RATIO_MASK 0x3
54#define HCLK_PCLK_RATIO_SHIFT 8
55#define HCLK_PCLK_RATIO_MASK 0x3
56
57#define PERIP_CLK_CFG (MISC_BASE + 0x028)
58/* PERIP_CLK_CFG register masks */
59#define UART_CLK_SHIFT 4
60#define UART_CLK_MASK 0x1
61#define FIRDA_CLK_SHIFT 5
62#define FIRDA_CLK_MASK 0x3
63#define GPT0_CLK_SHIFT 8
64#define GPT1_CLK_SHIFT 11
65#define GPT2_CLK_SHIFT 12
66#define GPT_CLK_MASK 0x1
67#define AUX_CLK_PLL3_VAL 0
68#define AUX_CLK_PLL1_VAL 1
69
70#define PERIP1_CLK_ENB (MISC_BASE + 0x02C)
71/* PERIP1_CLK_ENB register masks */
72#define UART_CLK_ENB 3
73#define SSP_CLK_ENB 5
74#define I2C_CLK_ENB 7
75#define JPEG_CLK_ENB 8
76#define FIRDA_CLK_ENB 10
77#define GPT1_CLK_ENB 11
78#define GPT2_CLK_ENB 12
79#define ADC_CLK_ENB 15
80#define RTC_CLK_ENB 17
81#define GPIO_CLK_ENB 18
82#define DMA_CLK_ENB 19
83#define SMI_CLK_ENB 21
84#define GMAC_CLK_ENB 23
85#define USBD_CLK_ENB 24
86#define USBH_CLK_ENB 25
87#define C3_CLK_ENB 31
88
89#define RAS_CLK_ENB (MISC_BASE + 0x034)
90
91#define PRSC1_CLK_CFG (MISC_BASE + 0x044)
92#define PRSC2_CLK_CFG (MISC_BASE + 0x048)
93#define PRSC3_CLK_CFG (MISC_BASE + 0x04C)
94/* gpt synthesizer register masks */
95#define GPT_MSCALE_SHIFT 0
96#define GPT_MSCALE_MASK 0xFFF
97#define GPT_NSCALE_SHIFT 12
98#define GPT_NSCALE_MASK 0xF
99
100#define AMEM_CLK_CFG (MISC_BASE + 0x050)
101#define EXPI_CLK_CFG (MISC_BASE + 0x054)
102#define CLCD_CLK_SYNT (MISC_BASE + 0x05C)
103#define FIRDA_CLK_SYNT (MISC_BASE + 0x060)
104#define UART_CLK_SYNT (MISC_BASE + 0x064)
105#define GMAC_CLK_SYNT (MISC_BASE + 0x068)
106#define RAS1_CLK_SYNT (MISC_BASE + 0x06C)
107#define RAS2_CLK_SYNT (MISC_BASE + 0x070)
108#define RAS3_CLK_SYNT (MISC_BASE + 0x074)
109#define RAS4_CLK_SYNT (MISC_BASE + 0x078)
110/* aux clk synthesiser register masks for irda to ras4 */
111#define AUX_SYNT_ENB 31
112#define AUX_EQ_SEL_SHIFT 30
113#define AUX_EQ_SEL_MASK 1
114#define AUX_EQ1_SEL 0
115#define AUX_EQ2_SEL 1
116#define AUX_XSCALE_SHIFT 16
117#define AUX_XSCALE_MASK 0xFFF
118#define AUX_YSCALE_SHIFT 0
119#define AUX_YSCALE_MASK 0xFFF
20 120
21/* root clks */ 121/* root clks */
22/* 32 KHz oscillator clock */ 122/* 32 KHz oscillator clock */
@@ -411,6 +511,21 @@ static struct clk usbd_clk = {
411 .recalc = &follow_parent, 511 .recalc = &follow_parent,
412}; 512};
413 513
514/* clock derived from usbh clk */
515/* usbh0 clock */
516static struct clk usbh0_clk = {
517 .flags = ALWAYS_ENABLED,
518 .pclk = &usbh_clk,
519 .recalc = &follow_parent,
520};
521
522/* usbh1 clock */
523static struct clk usbh1_clk = {
524 .flags = ALWAYS_ENABLED,
525 .pclk = &usbh_clk,
526 .recalc = &follow_parent,
527};
528
414/* clock derived from ahb clk */ 529/* clock derived from ahb clk */
415/* apb masks structure */ 530/* apb masks structure */
416static struct bus_clk_masks apb_masks = { 531static struct bus_clk_masks apb_masks = {
@@ -652,109 +767,126 @@ static struct clk pwm_clk = {
652 767
653/* array of all spear 3xx clock lookups */ 768/* array of all spear 3xx clock lookups */
654static struct clk_lookup spear_clk_lookups[] = { 769static struct clk_lookup spear_clk_lookups[] = {
655 { .con_id = "apb_pclk", .clk = &dummy_apb_pclk}, 770 CLKDEV_INIT(NULL, "apb_pclk", &dummy_apb_pclk),
656 /* root clks */ 771 /* root clks */
657 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk}, 772 CLKDEV_INIT(NULL, "osc_32k_clk", &osc_32k_clk),
658 { .con_id = "osc_24m_clk", .clk = &osc_24m_clk}, 773 CLKDEV_INIT(NULL, "osc_24m_clk", &osc_24m_clk),
659 /* clock derived from 32 KHz osc clk */ 774 /* clock derived from 32 KHz osc clk */
660 { .dev_id = "rtc-spear", .clk = &rtc_clk}, 775 CLKDEV_INIT("fc900000.rtc", NULL, &rtc_clk),
661 /* clock derived from 24 MHz osc clk */ 776 /* clock derived from 24 MHz osc clk */
662 { .con_id = "pll1_clk", .clk = &pll1_clk}, 777 CLKDEV_INIT(NULL, "pll1_clk", &pll1_clk),
663 { .con_id = "pll3_48m_clk", .clk = &pll3_48m_clk}, 778 CLKDEV_INIT(NULL, "pll3_48m_clk", &pll3_48m_clk),
664 { .dev_id = "wdt", .clk = &wdt_clk}, 779 CLKDEV_INIT("fc880000.wdt", NULL, &wdt_clk),
665 /* clock derived from pll1 clk */ 780 /* clock derived from pll1 clk */
666 { .con_id = "cpu_clk", .clk = &cpu_clk}, 781 CLKDEV_INIT(NULL, "cpu_clk", &cpu_clk),
667 { .con_id = "ahb_clk", .clk = &ahb_clk}, 782 CLKDEV_INIT(NULL, "ahb_clk", &ahb_clk),
668 { .con_id = "uart_synth_clk", .clk = &uart_synth_clk}, 783 CLKDEV_INIT(NULL, "uart_synth_clk", &uart_synth_clk),
669 { .con_id = "firda_synth_clk", .clk = &firda_synth_clk}, 784 CLKDEV_INIT(NULL, "firda_synth_clk", &firda_synth_clk),
670 { .con_id = "gpt0_synth_clk", .clk = &gpt0_synth_clk}, 785 CLKDEV_INIT(NULL, "gpt0_synth_clk", &gpt0_synth_clk),
671 { .con_id = "gpt1_synth_clk", .clk = &gpt1_synth_clk}, 786 CLKDEV_INIT(NULL, "gpt1_synth_clk", &gpt1_synth_clk),
672 { .con_id = "gpt2_synth_clk", .clk = &gpt2_synth_clk}, 787 CLKDEV_INIT(NULL, "gpt2_synth_clk", &gpt2_synth_clk),
673 { .dev_id = "uart", .clk = &uart_clk}, 788 CLKDEV_INIT("d0000000.serial", NULL, &uart_clk),
674 { .dev_id = "firda", .clk = &firda_clk}, 789 CLKDEV_INIT("firda", NULL, &firda_clk),
675 { .dev_id = "gpt0", .clk = &gpt0_clk}, 790 CLKDEV_INIT("gpt0", NULL, &gpt0_clk),
676 { .dev_id = "gpt1", .clk = &gpt1_clk}, 791 CLKDEV_INIT("gpt1", NULL, &gpt1_clk),
677 { .dev_id = "gpt2", .clk = &gpt2_clk}, 792 CLKDEV_INIT("gpt2", NULL, &gpt2_clk),
678 /* clock derived from pll3 clk */ 793 /* clock derived from pll3 clk */
679 { .dev_id = "designware_udc", .clk = &usbd_clk}, 794 CLKDEV_INIT("designware_udc", NULL, &usbd_clk),
680 { .con_id = "usbh_clk", .clk = &usbh_clk}, 795 CLKDEV_INIT(NULL, "usbh_clk", &usbh_clk),
796 /* clock derived from usbh clk */
797 CLKDEV_INIT(NULL, "usbh.0_clk", &usbh0_clk),
798 CLKDEV_INIT(NULL, "usbh.1_clk", &usbh1_clk),
681 /* clock derived from ahb clk */ 799 /* clock derived from ahb clk */
682 { .con_id = "apb_clk", .clk = &apb_clk}, 800 CLKDEV_INIT(NULL, "apb_clk", &apb_clk),
683 { .dev_id = "i2c_designware.0", .clk = &i2c_clk}, 801 CLKDEV_INIT("d0180000.i2c", NULL, &i2c_clk),
684 { .dev_id = "dma", .clk = &dma_clk}, 802 CLKDEV_INIT("fc400000.dma", NULL, &dma_clk),
685 { .dev_id = "jpeg", .clk = &jpeg_clk}, 803 CLKDEV_INIT("jpeg", NULL, &jpeg_clk),
686 { .dev_id = "gmac", .clk = &gmac_clk}, 804 CLKDEV_INIT("e0800000.eth", NULL, &gmac_clk),
687 { .dev_id = "smi", .clk = &smi_clk}, 805 CLKDEV_INIT("fc000000.flash", NULL, &smi_clk),
688 { .dev_id = "c3", .clk = &c3_clk}, 806 CLKDEV_INIT("c3", NULL, &c3_clk),
689 /* clock derived from apb clk */ 807 /* clock derived from apb clk */
690 { .dev_id = "adc", .clk = &adc_clk}, 808 CLKDEV_INIT("adc", NULL, &adc_clk),
691 { .dev_id = "ssp-pl022.0", .clk = &ssp0_clk}, 809 CLKDEV_INIT("d0100000.spi", NULL, &ssp0_clk),
692 { .dev_id = "gpio", .clk = &gpio_clk}, 810 CLKDEV_INIT("fc980000.gpio", NULL, &gpio_clk),
693}; 811};
694 812
695/* array of all spear 300 clock lookups */ 813/* array of all spear 300 clock lookups */
696#ifdef CONFIG_MACH_SPEAR300 814#ifdef CONFIG_MACH_SPEAR300
697static struct clk_lookup spear300_clk_lookups[] = { 815static struct clk_lookup spear300_clk_lookups[] = {
698 { .dev_id = "clcd", .clk = &clcd_clk}, 816 CLKDEV_INIT("60000000.clcd", NULL, &clcd_clk),
699 { .con_id = "fsmc", .clk = &fsmc_clk}, 817 CLKDEV_INIT("94000000.flash", NULL, &fsmc_clk),
700 { .dev_id = "gpio1", .clk = &gpio1_clk}, 818 CLKDEV_INIT("a9000000.gpio", NULL, &gpio1_clk),
701 { .dev_id = "keyboard", .clk = &kbd_clk}, 819 CLKDEV_INIT("a0000000.kbd", NULL, &kbd_clk),
702 { .dev_id = "sdhci", .clk = &sdhci_clk}, 820 CLKDEV_INIT("70000000.sdhci", NULL, &sdhci_clk),
703}; 821};
822
823void __init spear300_clk_init(void)
824{
825 int i;
826
827 for (i = 0; i < ARRAY_SIZE(spear_clk_lookups); i++)
828 clk_register(&spear_clk_lookups[i]);
829
830 for (i = 0; i < ARRAY_SIZE(spear300_clk_lookups); i++)
831 clk_register(&spear300_clk_lookups[i]);
832
833 clk_init();
834}
704#endif 835#endif
705 836
706/* array of all spear 310 clock lookups */ 837/* array of all spear 310 clock lookups */
707#ifdef CONFIG_MACH_SPEAR310 838#ifdef CONFIG_MACH_SPEAR310
708static struct clk_lookup spear310_clk_lookups[] = { 839static struct clk_lookup spear310_clk_lookups[] = {
709 { .con_id = "fsmc", .clk = &fsmc_clk}, 840 CLKDEV_INIT("44000000.flash", NULL, &fsmc_clk),
710 { .con_id = "emi", .clk = &emi_clk}, 841 CLKDEV_INIT(NULL, "emi", &emi_clk),
711 { .dev_id = "uart1", .clk = &uart1_clk}, 842 CLKDEV_INIT("b2000000.serial", NULL, &uart1_clk),
712 { .dev_id = "uart2", .clk = &uart2_clk}, 843 CLKDEV_INIT("b2080000.serial", NULL, &uart2_clk),
713 { .dev_id = "uart3", .clk = &uart3_clk}, 844 CLKDEV_INIT("b2100000.serial", NULL, &uart3_clk),
714 { .dev_id = "uart4", .clk = &uart4_clk}, 845 CLKDEV_INIT("b2180000.serial", NULL, &uart4_clk),
715 { .dev_id = "uart5", .clk = &uart5_clk}, 846 CLKDEV_INIT("b2200000.serial", NULL, &uart5_clk),
716}; 847};
848
849void __init spear310_clk_init(void)
850{
851 int i;
852
853 for (i = 0; i < ARRAY_SIZE(spear_clk_lookups); i++)
854 clk_register(&spear_clk_lookups[i]);
855
856 for (i = 0; i < ARRAY_SIZE(spear310_clk_lookups); i++)
857 clk_register(&spear310_clk_lookups[i]);
858
859 clk_init();
860}
717#endif 861#endif
718 862
719/* array of all spear 320 clock lookups */ 863/* array of all spear 320 clock lookups */
720#ifdef CONFIG_MACH_SPEAR320 864#ifdef CONFIG_MACH_SPEAR320
721static struct clk_lookup spear320_clk_lookups[] = { 865static struct clk_lookup spear320_clk_lookups[] = {
722 { .dev_id = "clcd", .clk = &clcd_clk}, 866 CLKDEV_INIT("90000000.clcd", NULL, &clcd_clk),
723 { .con_id = "fsmc", .clk = &fsmc_clk}, 867 CLKDEV_INIT("4c000000.flash", NULL, &fsmc_clk),
724 { .dev_id = "i2c_designware.1", .clk = &i2c1_clk}, 868 CLKDEV_INIT("a7000000.i2c", NULL, &i2c1_clk),
725 { .con_id = "emi", .clk = &emi_clk}, 869 CLKDEV_INIT(NULL, "emi", &emi_clk),
726 { .dev_id = "pwm", .clk = &pwm_clk}, 870 CLKDEV_INIT("pwm", NULL, &pwm_clk),
727 { .dev_id = "sdhci", .clk = &sdhci_clk}, 871 CLKDEV_INIT("70000000.sdhci", NULL, &sdhci_clk),
728 { .dev_id = "c_can_platform.0", .clk = &can0_clk}, 872 CLKDEV_INIT("c_can_platform.0", NULL, &can0_clk),
729 { .dev_id = "c_can_platform.1", .clk = &can1_clk}, 873 CLKDEV_INIT("c_can_platform.1", NULL, &can1_clk),
730 { .dev_id = "ssp-pl022.1", .clk = &ssp1_clk}, 874 CLKDEV_INIT("a5000000.spi", NULL, &ssp1_clk),
731 { .dev_id = "ssp-pl022.2", .clk = &ssp2_clk}, 875 CLKDEV_INIT("a6000000.spi", NULL, &ssp2_clk),
732 { .dev_id = "uart1", .clk = &uart1_clk}, 876 CLKDEV_INIT("a3000000.serial", NULL, &uart1_clk),
733 { .dev_id = "uart2", .clk = &uart2_clk}, 877 CLKDEV_INIT("a4000000.serial", NULL, &uart2_clk),
734}; 878};
735#endif 879
736 880void __init spear320_clk_init(void)
737void __init spear3xx_clk_init(void)
738{ 881{
739 int i, cnt; 882 int i;
740 struct clk_lookup *lookups;
741
742 if (machine_is_spear300()) {
743 cnt = ARRAY_SIZE(spear300_clk_lookups);
744 lookups = spear300_clk_lookups;
745 } else if (machine_is_spear310()) {
746 cnt = ARRAY_SIZE(spear310_clk_lookups);
747 lookups = spear310_clk_lookups;
748 } else {
749 cnt = ARRAY_SIZE(spear320_clk_lookups);
750 lookups = spear320_clk_lookups;
751 }
752 883
753 for (i = 0; i < ARRAY_SIZE(spear_clk_lookups); i++) 884 for (i = 0; i < ARRAY_SIZE(spear_clk_lookups); i++)
754 clk_register(&spear_clk_lookups[i]); 885 clk_register(&spear_clk_lookups[i]);
755 886
756 for (i = 0; i < cnt; i++) 887 for (i = 0; i < ARRAY_SIZE(spear320_clk_lookups); i++)
757 clk_register(&lookups[i]); 888 clk_register(&spear320_clk_lookups[i]);
758 889
759 clk_init(); 890 clk_init();
760} 891}
892#endif
diff --git a/arch/arm/mach-spear3xx/include/mach/generic.h b/arch/arm/mach-spear3xx/include/mach/generic.h
index 14276e5a98d2..bdb304551caf 100644
--- a/arch/arm/mach-spear3xx/include/mach/generic.h
+++ b/arch/arm/mach-spear3xx/include/mach/generic.h
@@ -14,188 +14,40 @@
14#ifndef __MACH_GENERIC_H 14#ifndef __MACH_GENERIC_H
15#define __MACH_GENERIC_H 15#define __MACH_GENERIC_H
16 16
17#include <linux/amba/pl08x.h>
17#include <linux/init.h> 18#include <linux/init.h>
18#include <linux/platform_device.h> 19#include <linux/platform_device.h>
19#include <linux/amba/bus.h> 20#include <linux/amba/bus.h>
20#include <asm/mach/time.h> 21#include <asm/mach/time.h>
21#include <asm/mach/map.h> 22#include <asm/mach/map.h>
22#include <plat/padmux.h>
23
24/* spear3xx declarations */
25/*
26 * Each GPT has 2 timer channels
27 * Following GPT channels will be used as clock source and clockevent
28 */
29#define SPEAR_GPT0_BASE SPEAR3XX_ML1_TMR_BASE
30#define SPEAR_GPT0_CHAN0_IRQ SPEAR3XX_IRQ_CPU_GPT1_1
31#define SPEAR_GPT0_CHAN1_IRQ SPEAR3XX_IRQ_CPU_GPT1_2
32 23
33/* Add spear3xx family device structure declarations here */ 24/* Add spear3xx family device structure declarations here */
34extern struct amba_device spear3xx_gpio_device;
35extern struct amba_device spear3xx_uart_device;
36extern struct sys_timer spear3xx_timer; 25extern struct sys_timer spear3xx_timer;
26extern struct pl022_ssp_controller pl022_plat_data;
27extern struct pl08x_platform_data pl080_plat_data;
37 28
38/* Add spear3xx family function declarations here */ 29/* Add spear3xx family function declarations here */
39void __init spear3xx_clk_init(void); 30void __init spear_setup_timer(resource_size_t base, int irq);
40void __init spear_setup_timer(void);
41void __init spear3xx_map_io(void); 31void __init spear3xx_map_io(void);
42void __init spear3xx_init_irq(void); 32void __init spear3xx_dt_init_irq(void);
43void __init spear3xx_init(void);
44 33
45void spear_restart(char, const char *); 34void spear_restart(char, const char *);
46 35
47/* pad mux declarations */
48#define PMX_FIRDA_MASK (1 << 14)
49#define PMX_I2C_MASK (1 << 13)
50#define PMX_SSP_CS_MASK (1 << 12)
51#define PMX_SSP_MASK (1 << 11)
52#define PMX_MII_MASK (1 << 10)
53#define PMX_GPIO_PIN0_MASK (1 << 9)
54#define PMX_GPIO_PIN1_MASK (1 << 8)
55#define PMX_GPIO_PIN2_MASK (1 << 7)
56#define PMX_GPIO_PIN3_MASK (1 << 6)
57#define PMX_GPIO_PIN4_MASK (1 << 5)
58#define PMX_GPIO_PIN5_MASK (1 << 4)
59#define PMX_UART0_MODEM_MASK (1 << 3)
60#define PMX_UART0_MASK (1 << 2)
61#define PMX_TIMER_3_4_MASK (1 << 1)
62#define PMX_TIMER_1_2_MASK (1 << 0)
63
64/* pad mux devices */
65extern struct pmx_dev spear3xx_pmx_firda;
66extern struct pmx_dev spear3xx_pmx_i2c;
67extern struct pmx_dev spear3xx_pmx_ssp_cs;
68extern struct pmx_dev spear3xx_pmx_ssp;
69extern struct pmx_dev spear3xx_pmx_mii;
70extern struct pmx_dev spear3xx_pmx_gpio_pin0;
71extern struct pmx_dev spear3xx_pmx_gpio_pin1;
72extern struct pmx_dev spear3xx_pmx_gpio_pin2;
73extern struct pmx_dev spear3xx_pmx_gpio_pin3;
74extern struct pmx_dev spear3xx_pmx_gpio_pin4;
75extern struct pmx_dev spear3xx_pmx_gpio_pin5;
76extern struct pmx_dev spear3xx_pmx_uart0_modem;
77extern struct pmx_dev spear3xx_pmx_uart0;
78extern struct pmx_dev spear3xx_pmx_timer_3_4;
79extern struct pmx_dev spear3xx_pmx_timer_1_2;
80
81#if defined(CONFIG_MACH_SPEAR310) || defined(CONFIG_MACH_SPEAR320)
82/* padmux plgpio devices */
83extern struct pmx_dev spear3xx_pmx_plgpio_0_1;
84extern struct pmx_dev spear3xx_pmx_plgpio_2_3;
85extern struct pmx_dev spear3xx_pmx_plgpio_4_5;
86extern struct pmx_dev spear3xx_pmx_plgpio_6_9;
87extern struct pmx_dev spear3xx_pmx_plgpio_10_27;
88extern struct pmx_dev spear3xx_pmx_plgpio_28;
89extern struct pmx_dev spear3xx_pmx_plgpio_29;
90extern struct pmx_dev spear3xx_pmx_plgpio_30;
91extern struct pmx_dev spear3xx_pmx_plgpio_31;
92extern struct pmx_dev spear3xx_pmx_plgpio_32;
93extern struct pmx_dev spear3xx_pmx_plgpio_33;
94extern struct pmx_dev spear3xx_pmx_plgpio_34_36;
95extern struct pmx_dev spear3xx_pmx_plgpio_37_42;
96extern struct pmx_dev spear3xx_pmx_plgpio_43_44_47_48;
97extern struct pmx_dev spear3xx_pmx_plgpio_45_46_49_50;
98#endif
99
100/* spear300 declarations */ 36/* spear300 declarations */
101#ifdef CONFIG_MACH_SPEAR300 37#ifdef CONFIG_MACH_SPEAR300
102/* Add spear300 machine device structure declarations here */ 38void __init spear300_clk_init(void);
103extern struct amba_device spear300_gpio1_device;
104
105/* pad mux modes */
106extern struct pmx_mode spear300_nand_mode;
107extern struct pmx_mode spear300_nor_mode;
108extern struct pmx_mode spear300_photo_frame_mode;
109extern struct pmx_mode spear300_lend_ip_phone_mode;
110extern struct pmx_mode spear300_hend_ip_phone_mode;
111extern struct pmx_mode spear300_lend_wifi_phone_mode;
112extern struct pmx_mode spear300_hend_wifi_phone_mode;
113extern struct pmx_mode spear300_ata_pabx_wi2s_mode;
114extern struct pmx_mode spear300_ata_pabx_i2s_mode;
115extern struct pmx_mode spear300_caml_lcdw_mode;
116extern struct pmx_mode spear300_camu_lcd_mode;
117extern struct pmx_mode spear300_camu_wlcd_mode;
118extern struct pmx_mode spear300_caml_lcd_mode;
119
120/* pad mux devices */
121extern struct pmx_dev spear300_pmx_fsmc_2_chips;
122extern struct pmx_dev spear300_pmx_fsmc_4_chips;
123extern struct pmx_dev spear300_pmx_keyboard;
124extern struct pmx_dev spear300_pmx_clcd;
125extern struct pmx_dev spear300_pmx_telecom_gpio;
126extern struct pmx_dev spear300_pmx_telecom_tdm;
127extern struct pmx_dev spear300_pmx_telecom_spi_cs_i2c_clk;
128extern struct pmx_dev spear300_pmx_telecom_camera;
129extern struct pmx_dev spear300_pmx_telecom_dac;
130extern struct pmx_dev spear300_pmx_telecom_i2s;
131extern struct pmx_dev spear300_pmx_telecom_boot_pins;
132extern struct pmx_dev spear300_pmx_telecom_sdhci_4bit;
133extern struct pmx_dev spear300_pmx_telecom_sdhci_8bit;
134extern struct pmx_dev spear300_pmx_gpio1;
135
136/* Add spear300 machine function declarations here */
137void __init spear300_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
138 u8 pmx_dev_count);
139 39
140#endif /* CONFIG_MACH_SPEAR300 */ 40#endif /* CONFIG_MACH_SPEAR300 */
141 41
142/* spear310 declarations */ 42/* spear310 declarations */
143#ifdef CONFIG_MACH_SPEAR310 43#ifdef CONFIG_MACH_SPEAR310
144/* Add spear310 machine device structure declarations here */ 44void __init spear310_clk_init(void);
145
146/* pad mux devices */
147extern struct pmx_dev spear310_pmx_emi_cs_0_1_4_5;
148extern struct pmx_dev spear310_pmx_emi_cs_2_3;
149extern struct pmx_dev spear310_pmx_uart1;
150extern struct pmx_dev spear310_pmx_uart2;
151extern struct pmx_dev spear310_pmx_uart3_4_5;
152extern struct pmx_dev spear310_pmx_fsmc;
153extern struct pmx_dev spear310_pmx_rs485_0_1;
154extern struct pmx_dev spear310_pmx_tdm0;
155
156/* Add spear310 machine function declarations here */
157void __init spear310_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
158 u8 pmx_dev_count);
159 45
160#endif /* CONFIG_MACH_SPEAR310 */ 46#endif /* CONFIG_MACH_SPEAR310 */
161 47
162/* spear320 declarations */ 48/* spear320 declarations */
163#ifdef CONFIG_MACH_SPEAR320 49#ifdef CONFIG_MACH_SPEAR320
164/* Add spear320 machine device structure declarations here */ 50void __init spear320_clk_init(void);
165
166/* pad mux modes */
167extern struct pmx_mode spear320_auto_net_smii_mode;
168extern struct pmx_mode spear320_auto_net_mii_mode;
169extern struct pmx_mode spear320_auto_exp_mode;
170extern struct pmx_mode spear320_small_printers_mode;
171
172/* pad mux devices */
173extern struct pmx_dev spear320_pmx_clcd;
174extern struct pmx_dev spear320_pmx_emi;
175extern struct pmx_dev spear320_pmx_fsmc;
176extern struct pmx_dev spear320_pmx_spp;
177extern struct pmx_dev spear320_pmx_sdhci;
178extern struct pmx_dev spear320_pmx_i2s;
179extern struct pmx_dev spear320_pmx_uart1;
180extern struct pmx_dev spear320_pmx_uart1_modem;
181extern struct pmx_dev spear320_pmx_uart2;
182extern struct pmx_dev spear320_pmx_touchscreen;
183extern struct pmx_dev spear320_pmx_can;
184extern struct pmx_dev spear320_pmx_sdhci_led;
185extern struct pmx_dev spear320_pmx_pwm0;
186extern struct pmx_dev spear320_pmx_pwm1;
187extern struct pmx_dev spear320_pmx_pwm2;
188extern struct pmx_dev spear320_pmx_pwm3;
189extern struct pmx_dev spear320_pmx_ssp1;
190extern struct pmx_dev spear320_pmx_ssp2;
191extern struct pmx_dev spear320_pmx_mii1;
192extern struct pmx_dev spear320_pmx_smii0;
193extern struct pmx_dev spear320_pmx_smii1;
194extern struct pmx_dev spear320_pmx_i2c1;
195
196/* Add spear320 machine function declarations here */
197void __init spear320_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
198 u8 pmx_dev_count);
199 51
200#endif /* CONFIG_MACH_SPEAR320 */ 52#endif /* CONFIG_MACH_SPEAR320 */
201 53
diff --git a/arch/arm/mach-spear3xx/include/mach/hardware.h b/arch/arm/mach-spear3xx/include/mach/hardware.h
index 4660c0d8ec0d..40a8c178f10d 100644
--- a/arch/arm/mach-spear3xx/include/mach/hardware.h
+++ b/arch/arm/mach-spear3xx/include/mach/hardware.h
@@ -1,23 +1 @@
1/* /* empty */
2 * arch/arm/mach-spear3xx/include/mach/hardware.h
3 *
4 * Hardware definitions for SPEAr3xx machine family
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_HARDWARE_H
15#define __MACH_HARDWARE_H
16
17#include <plat/hardware.h>
18#include <mach/spear.h>
19
20/* Vitual to physical translation of statically mapped space */
21#define IO_ADDRESS(x) (x | 0xF0000000)
22
23#endif /* __MACH_HARDWARE_H */
diff --git a/arch/arm/mach-spear3xx/include/mach/irqs.h b/arch/arm/mach-spear3xx/include/mach/irqs.h
index 6e265442808e..319620a1afb4 100644
--- a/arch/arm/mach-spear3xx/include/mach/irqs.h
+++ b/arch/arm/mach-spear3xx/include/mach/irqs.h
@@ -14,141 +14,15 @@
14#ifndef __MACH_IRQS_H 14#ifndef __MACH_IRQS_H
15#define __MACH_IRQS_H 15#define __MACH_IRQS_H
16 16
17/* SPEAr3xx IRQ definitions */ 17/* FIXME: probe all these from DT */
18#define SPEAR3XX_IRQ_HW_ACCEL_MOD_0 0
19#define SPEAR3XX_IRQ_INTRCOMM_RAS_ARM 1 18#define SPEAR3XX_IRQ_INTRCOMM_RAS_ARM 1
20#define SPEAR3XX_IRQ_CPU_GPT1_1 2 19#define SPEAR3XX_IRQ_CPU_GPT1_1 2
21#define SPEAR3XX_IRQ_CPU_GPT1_2 3
22#define SPEAR3XX_IRQ_BASIC_GPT1_1 4
23#define SPEAR3XX_IRQ_BASIC_GPT1_2 5
24#define SPEAR3XX_IRQ_BASIC_GPT2_1 6
25#define SPEAR3XX_IRQ_BASIC_GPT2_2 7
26#define SPEAR3XX_IRQ_BASIC_DMA 8
27#define SPEAR3XX_IRQ_BASIC_SMI 9
28#define SPEAR3XX_IRQ_BASIC_RTC 10
29#define SPEAR3XX_IRQ_BASIC_GPIO 11
30#define SPEAR3XX_IRQ_BASIC_WDT 12
31#define SPEAR3XX_IRQ_DDR_CONTROLLER 13
32#define SPEAR3XX_IRQ_SYS_ERROR 14
33#define SPEAR3XX_IRQ_WAKEUP_RCV 15
34#define SPEAR3XX_IRQ_JPEG 16
35#define SPEAR3XX_IRQ_IRDA 17
36#define SPEAR3XX_IRQ_ADC 18
37#define SPEAR3XX_IRQ_UART 19
38#define SPEAR3XX_IRQ_SSP 20
39#define SPEAR3XX_IRQ_I2C 21
40#define SPEAR3XX_IRQ_MAC_1 22
41#define SPEAR3XX_IRQ_MAC_2 23
42#define SPEAR3XX_IRQ_USB_DEV 24
43#define SPEAR3XX_IRQ_USB_H_OHCI_0 25
44#define SPEAR3XX_IRQ_USB_H_EHCI_0 26
45#define SPEAR3XX_IRQ_USB_H_EHCI_1 SPEAR3XX_IRQ_USB_H_EHCI_0
46#define SPEAR3XX_IRQ_USB_H_OHCI_1 27
47#define SPEAR3XX_IRQ_GEN_RAS_1 28 20#define SPEAR3XX_IRQ_GEN_RAS_1 28
48#define SPEAR3XX_IRQ_GEN_RAS_2 29 21#define SPEAR3XX_IRQ_GEN_RAS_2 29
49#define SPEAR3XX_IRQ_GEN_RAS_3 30 22#define SPEAR3XX_IRQ_GEN_RAS_3 30
50#define SPEAR3XX_IRQ_HW_ACCEL_MOD_1 31
51#define SPEAR3XX_IRQ_VIC_END 32 23#define SPEAR3XX_IRQ_VIC_END 32
52
53#define SPEAR3XX_VIRQ_START SPEAR3XX_IRQ_VIC_END 24#define SPEAR3XX_VIRQ_START SPEAR3XX_IRQ_VIC_END
54 25
55/* SPEAr300 Virtual irq definitions */ 26#define NR_IRQS 160
56/* IRQs sharing IRQ_GEN_RAS_1 */
57#define SPEAR300_VIRQ_IT_PERS_S (SPEAR3XX_VIRQ_START + 0)
58#define SPEAR300_VIRQ_IT_CHANGE_S (SPEAR3XX_VIRQ_START + 1)
59#define SPEAR300_VIRQ_I2S (SPEAR3XX_VIRQ_START + 2)
60#define SPEAR300_VIRQ_TDM (SPEAR3XX_VIRQ_START + 3)
61#define SPEAR300_VIRQ_CAMERA_L (SPEAR3XX_VIRQ_START + 4)
62#define SPEAR300_VIRQ_CAMERA_F (SPEAR3XX_VIRQ_START + 5)
63#define SPEAR300_VIRQ_CAMERA_V (SPEAR3XX_VIRQ_START + 6)
64#define SPEAR300_VIRQ_KEYBOARD (SPEAR3XX_VIRQ_START + 7)
65#define SPEAR300_VIRQ_GPIO1 (SPEAR3XX_VIRQ_START + 8)
66
67/* IRQs sharing IRQ_GEN_RAS_3 */
68#define SPEAR300_IRQ_CLCD SPEAR3XX_IRQ_GEN_RAS_3
69
70/* IRQs sharing IRQ_INTRCOMM_RAS_ARM */
71#define SPEAR300_IRQ_SDHCI SPEAR3XX_IRQ_INTRCOMM_RAS_ARM
72
73/* SPEAr310 Virtual irq definitions */
74/* IRQs sharing IRQ_GEN_RAS_1 */
75#define SPEAR310_VIRQ_SMII0 (SPEAR3XX_VIRQ_START + 0)
76#define SPEAR310_VIRQ_SMII1 (SPEAR3XX_VIRQ_START + 1)
77#define SPEAR310_VIRQ_SMII2 (SPEAR3XX_VIRQ_START + 2)
78#define SPEAR310_VIRQ_SMII3 (SPEAR3XX_VIRQ_START + 3)
79#define SPEAR310_VIRQ_WAKEUP_SMII0 (SPEAR3XX_VIRQ_START + 4)
80#define SPEAR310_VIRQ_WAKEUP_SMII1 (SPEAR3XX_VIRQ_START + 5)
81#define SPEAR310_VIRQ_WAKEUP_SMII2 (SPEAR3XX_VIRQ_START + 6)
82#define SPEAR310_VIRQ_WAKEUP_SMII3 (SPEAR3XX_VIRQ_START + 7)
83
84/* IRQs sharing IRQ_GEN_RAS_2 */
85#define SPEAR310_VIRQ_UART1 (SPEAR3XX_VIRQ_START + 8)
86#define SPEAR310_VIRQ_UART2 (SPEAR3XX_VIRQ_START + 9)
87#define SPEAR310_VIRQ_UART3 (SPEAR3XX_VIRQ_START + 10)
88#define SPEAR310_VIRQ_UART4 (SPEAR3XX_VIRQ_START + 11)
89#define SPEAR310_VIRQ_UART5 (SPEAR3XX_VIRQ_START + 12)
90
91/* IRQs sharing IRQ_GEN_RAS_3 */
92#define SPEAR310_VIRQ_EMI (SPEAR3XX_VIRQ_START + 13)
93#define SPEAR310_VIRQ_PLGPIO (SPEAR3XX_VIRQ_START + 14)
94
95/* IRQs sharing IRQ_INTRCOMM_RAS_ARM */
96#define SPEAR310_VIRQ_TDM_HDLC (SPEAR3XX_VIRQ_START + 15)
97#define SPEAR310_VIRQ_RS485_0 (SPEAR3XX_VIRQ_START + 16)
98#define SPEAR310_VIRQ_RS485_1 (SPEAR3XX_VIRQ_START + 17)
99
100/* SPEAr320 Virtual irq definitions */
101/* IRQs sharing IRQ_GEN_RAS_1 */
102#define SPEAR320_VIRQ_EMI (SPEAR3XX_VIRQ_START + 0)
103#define SPEAR320_VIRQ_CLCD (SPEAR3XX_VIRQ_START + 1)
104#define SPEAR320_VIRQ_SPP (SPEAR3XX_VIRQ_START + 2)
105
106/* IRQs sharing IRQ_GEN_RAS_2 */
107#define SPEAR320_IRQ_SDHCI SPEAR3XX_IRQ_GEN_RAS_2
108
109/* IRQs sharing IRQ_GEN_RAS_3 */
110#define SPEAR320_VIRQ_PLGPIO (SPEAR3XX_VIRQ_START + 3)
111#define SPEAR320_VIRQ_I2S_PLAY (SPEAR3XX_VIRQ_START + 4)
112#define SPEAR320_VIRQ_I2S_REC (SPEAR3XX_VIRQ_START + 5)
113
114/* IRQs sharing IRQ_INTRCOMM_RAS_ARM */
115#define SPEAR320_VIRQ_CANU (SPEAR3XX_VIRQ_START + 6)
116#define SPEAR320_VIRQ_CANL (SPEAR3XX_VIRQ_START + 7)
117#define SPEAR320_VIRQ_UART1 (SPEAR3XX_VIRQ_START + 8)
118#define SPEAR320_VIRQ_UART2 (SPEAR3XX_VIRQ_START + 9)
119#define SPEAR320_VIRQ_SSP1 (SPEAR3XX_VIRQ_START + 10)
120#define SPEAR320_VIRQ_SSP2 (SPEAR3XX_VIRQ_START + 11)
121#define SPEAR320_VIRQ_SMII0 (SPEAR3XX_VIRQ_START + 12)
122#define SPEAR320_VIRQ_MII1_SMII1 (SPEAR3XX_VIRQ_START + 13)
123#define SPEAR320_VIRQ_WAKEUP_SMII0 (SPEAR3XX_VIRQ_START + 14)
124#define SPEAR320_VIRQ_WAKEUP_MII1_SMII1 (SPEAR3XX_VIRQ_START + 15)
125#define SPEAR320_VIRQ_I2C1 (SPEAR3XX_VIRQ_START + 16)
126
127/*
128 * GPIO pins virtual irqs
129 * Use the lowest number for the GPIO virtual IRQs base on which subarchs
130 * we have compiled in
131 */
132#if defined(CONFIG_MACH_SPEAR310)
133#define SPEAR3XX_GPIO_INT_BASE (SPEAR3XX_VIRQ_START + 18)
134#elif defined(CONFIG_MACH_SPEAR320)
135#define SPEAR3XX_GPIO_INT_BASE (SPEAR3XX_VIRQ_START + 17)
136#else
137#define SPEAR3XX_GPIO_INT_BASE (SPEAR3XX_VIRQ_START + 9)
138#endif
139
140#define SPEAR300_GPIO1_INT_BASE (SPEAR3XX_GPIO_INT_BASE + 8)
141#define SPEAR3XX_PLGPIO_COUNT 102
142
143#if defined(CONFIG_MACH_SPEAR310) || defined(CONFIG_MACH_SPEAR320)
144#define SPEAR3XX_PLGPIO_INT_BASE (SPEAR3XX_GPIO_INT_BASE + 8)
145#define SPEAR3XX_GPIO_INT_END (SPEAR3XX_PLGPIO_INT_BASE + \
146 SPEAR3XX_PLGPIO_COUNT)
147#else
148#define SPEAR3XX_GPIO_INT_END (SPEAR300_GPIO1_INT_BASE + 8)
149#endif
150
151#define SPEAR3XX_VIRQ_END SPEAR3XX_GPIO_INT_END
152#define NR_IRQS SPEAR3XX_VIRQ_END
153 27
154#endif /* __MACH_IRQS_H */ 28#endif /* __MACH_IRQS_H */
diff --git a/arch/arm/mach-spear3xx/include/mach/misc_regs.h b/arch/arm/mach-spear3xx/include/mach/misc_regs.h
index 5bd8cd8d4852..e0ab72e61507 100644
--- a/arch/arm/mach-spear3xx/include/mach/misc_regs.h
+++ b/arch/arm/mach-spear3xx/include/mach/misc_regs.h
@@ -14,151 +14,7 @@
14#ifndef __MACH_MISC_REGS_H 14#ifndef __MACH_MISC_REGS_H
15#define __MACH_MISC_REGS_H 15#define __MACH_MISC_REGS_H
16 16
17#include <mach/hardware.h>
18
19#define MISC_BASE IOMEM(VA_SPEAR3XX_ICM3_MISC_REG_BASE) 17#define MISC_BASE IOMEM(VA_SPEAR3XX_ICM3_MISC_REG_BASE)
20
21#define SOC_CFG_CTR (MISC_BASE + 0x000)
22#define DIAG_CFG_CTR (MISC_BASE + 0x004)
23#define PLL1_CTR (MISC_BASE + 0x008)
24#define PLL1_FRQ (MISC_BASE + 0x00C)
25#define PLL1_MOD (MISC_BASE + 0x010)
26#define PLL2_CTR (MISC_BASE + 0x014)
27/* PLL_CTR register masks */
28#define PLL_ENABLE 2
29#define PLL_MODE_SHIFT 4
30#define PLL_MODE_MASK 0x3
31#define PLL_MODE_NORMAL 0
32#define PLL_MODE_FRACTION 1
33#define PLL_MODE_DITH_DSB 2
34#define PLL_MODE_DITH_SSB 3
35
36#define PLL2_FRQ (MISC_BASE + 0x018)
37/* PLL FRQ register masks */
38#define PLL_DIV_N_SHIFT 0
39#define PLL_DIV_N_MASK 0xFF
40#define PLL_DIV_P_SHIFT 8
41#define PLL_DIV_P_MASK 0x7
42#define PLL_NORM_FDBK_M_SHIFT 24
43#define PLL_NORM_FDBK_M_MASK 0xFF
44#define PLL_DITH_FDBK_M_SHIFT 16
45#define PLL_DITH_FDBK_M_MASK 0xFFFF
46
47#define PLL2_MOD (MISC_BASE + 0x01C)
48#define PLL_CLK_CFG (MISC_BASE + 0x020)
49#define CORE_CLK_CFG (MISC_BASE + 0x024)
50/* CORE CLK CFG register masks */
51#define PLL_HCLK_RATIO_SHIFT 10
52#define PLL_HCLK_RATIO_MASK 0x3
53#define HCLK_PCLK_RATIO_SHIFT 8
54#define HCLK_PCLK_RATIO_MASK 0x3
55
56#define PERIP_CLK_CFG (MISC_BASE + 0x028)
57/* PERIP_CLK_CFG register masks */
58#define UART_CLK_SHIFT 4
59#define UART_CLK_MASK 0x1
60#define FIRDA_CLK_SHIFT 5
61#define FIRDA_CLK_MASK 0x3
62#define GPT0_CLK_SHIFT 8
63#define GPT1_CLK_SHIFT 11
64#define GPT2_CLK_SHIFT 12
65#define GPT_CLK_MASK 0x1
66#define AUX_CLK_PLL3_VAL 0
67#define AUX_CLK_PLL1_VAL 1
68
69#define PERIP1_CLK_ENB (MISC_BASE + 0x02C)
70/* PERIP1_CLK_ENB register masks */
71#define UART_CLK_ENB 3
72#define SSP_CLK_ENB 5
73#define I2C_CLK_ENB 7
74#define JPEG_CLK_ENB 8
75#define FIRDA_CLK_ENB 10
76#define GPT1_CLK_ENB 11
77#define GPT2_CLK_ENB 12
78#define ADC_CLK_ENB 15
79#define RTC_CLK_ENB 17
80#define GPIO_CLK_ENB 18
81#define DMA_CLK_ENB 19
82#define SMI_CLK_ENB 21
83#define GMAC_CLK_ENB 23
84#define USBD_CLK_ENB 24
85#define USBH_CLK_ENB 25
86#define C3_CLK_ENB 31
87
88#define SOC_CORE_ID (MISC_BASE + 0x030)
89#define RAS_CLK_ENB (MISC_BASE + 0x034)
90#define PERIP1_SOF_RST (MISC_BASE + 0x038)
91/* PERIP1_SOF_RST register masks */
92#define JPEG_SOF_RST 8
93
94#define SOC_USER_ID (MISC_BASE + 0x03C)
95#define RAS_SOF_RST (MISC_BASE + 0x040)
96#define PRSC1_CLK_CFG (MISC_BASE + 0x044)
97#define PRSC2_CLK_CFG (MISC_BASE + 0x048)
98#define PRSC3_CLK_CFG (MISC_BASE + 0x04C)
99/* gpt synthesizer register masks */
100#define GPT_MSCALE_SHIFT 0
101#define GPT_MSCALE_MASK 0xFFF
102#define GPT_NSCALE_SHIFT 12
103#define GPT_NSCALE_MASK 0xF
104
105#define AMEM_CLK_CFG (MISC_BASE + 0x050)
106#define EXPI_CLK_CFG (MISC_BASE + 0x054)
107#define CLCD_CLK_SYNT (MISC_BASE + 0x05C)
108#define FIRDA_CLK_SYNT (MISC_BASE + 0x060)
109#define UART_CLK_SYNT (MISC_BASE + 0x064)
110#define GMAC_CLK_SYNT (MISC_BASE + 0x068)
111#define RAS1_CLK_SYNT (MISC_BASE + 0x06C)
112#define RAS2_CLK_SYNT (MISC_BASE + 0x070)
113#define RAS3_CLK_SYNT (MISC_BASE + 0x074)
114#define RAS4_CLK_SYNT (MISC_BASE + 0x078)
115/* aux clk synthesiser register masks for irda to ras4 */
116#define AUX_SYNT_ENB 31
117#define AUX_EQ_SEL_SHIFT 30
118#define AUX_EQ_SEL_MASK 1
119#define AUX_EQ1_SEL 0
120#define AUX_EQ2_SEL 1
121#define AUX_XSCALE_SHIFT 16
122#define AUX_XSCALE_MASK 0xFFF
123#define AUX_YSCALE_SHIFT 0
124#define AUX_YSCALE_MASK 0xFFF
125
126#define ICM1_ARB_CFG (MISC_BASE + 0x07C)
127#define ICM2_ARB_CFG (MISC_BASE + 0x080)
128#define ICM3_ARB_CFG (MISC_BASE + 0x084)
129#define ICM4_ARB_CFG (MISC_BASE + 0x088)
130#define ICM5_ARB_CFG (MISC_BASE + 0x08C)
131#define ICM6_ARB_CFG (MISC_BASE + 0x090)
132#define ICM7_ARB_CFG (MISC_BASE + 0x094)
133#define ICM8_ARB_CFG (MISC_BASE + 0x098)
134#define ICM9_ARB_CFG (MISC_BASE + 0x09C)
135#define DMA_CHN_CFG (MISC_BASE + 0x0A0) 18#define DMA_CHN_CFG (MISC_BASE + 0x0A0)
136#define USB2_PHY_CFG (MISC_BASE + 0x0A4)
137#define GMAC_CFG_CTR (MISC_BASE + 0x0A8)
138#define EXPI_CFG_CTR (MISC_BASE + 0x0AC)
139#define PRC1_LOCK_CTR (MISC_BASE + 0x0C0)
140#define PRC2_LOCK_CTR (MISC_BASE + 0x0C4)
141#define PRC3_LOCK_CTR (MISC_BASE + 0x0C8)
142#define PRC4_LOCK_CTR (MISC_BASE + 0x0CC)
143#define PRC1_IRQ_CTR (MISC_BASE + 0x0D0)
144#define PRC2_IRQ_CTR (MISC_BASE + 0x0D4)
145#define PRC3_IRQ_CTR (MISC_BASE + 0x0D8)
146#define PRC4_IRQ_CTR (MISC_BASE + 0x0DC)
147#define PWRDOWN_CFG_CTR (MISC_BASE + 0x0E0)
148#define COMPSSTL_1V8_CFG (MISC_BASE + 0x0E4)
149#define COMPSSTL_2V5_CFG (MISC_BASE + 0x0E8)
150#define COMPCOR_3V3_CFG (MISC_BASE + 0x0EC)
151#define SSTLPAD_CFG_CTR (MISC_BASE + 0x0F0)
152#define BIST1_CFG_CTR (MISC_BASE + 0x0F4)
153#define BIST2_CFG_CTR (MISC_BASE + 0x0F8)
154#define BIST3_CFG_CTR (MISC_BASE + 0x0FC)
155#define BIST4_CFG_CTR (MISC_BASE + 0x100)
156#define BIST5_CFG_CTR (MISC_BASE + 0x104)
157#define BIST1_STS_RES (MISC_BASE + 0x108)
158#define BIST2_STS_RES (MISC_BASE + 0x10C)
159#define BIST3_STS_RES (MISC_BASE + 0x110)
160#define BIST4_STS_RES (MISC_BASE + 0x114)
161#define BIST5_STS_RES (MISC_BASE + 0x118)
162#define SYSERR_CFG_CTR (MISC_BASE + 0x11C)
163 19
164#endif /* __MACH_MISC_REGS_H */ 20#endif /* __MACH_MISC_REGS_H */
diff --git a/arch/arm/mach-spear3xx/include/mach/spear.h b/arch/arm/mach-spear3xx/include/mach/spear.h
index 63fd98356919..6d4dadc67633 100644
--- a/arch/arm/mach-spear3xx/include/mach/spear.h
+++ b/arch/arm/mach-spear3xx/include/mach/spear.h
@@ -15,60 +15,27 @@
15#define __MACH_SPEAR3XX_H 15#define __MACH_SPEAR3XX_H
16 16
17#include <asm/memory.h> 17#include <asm/memory.h>
18#include <mach/spear300.h>
19#include <mach/spear310.h>
20#include <mach/spear320.h>
21
22#define SPEAR3XX_ML_SDRAM_BASE UL(0x00000000)
23
24#define SPEAR3XX_ICM9_BASE UL(0xC0000000)
25 18
26/* ICM1 - Low speed connection */ 19/* ICM1 - Low speed connection */
27#define SPEAR3XX_ICM1_2_BASE UL(0xD0000000) 20#define SPEAR3XX_ICM1_2_BASE UL(0xD0000000)
21#define VA_SPEAR3XX_ICM1_2_BASE UL(0xFD000000)
28#define SPEAR3XX_ICM1_UART_BASE UL(0xD0000000) 22#define SPEAR3XX_ICM1_UART_BASE UL(0xD0000000)
29#define VA_SPEAR3XX_ICM1_UART_BASE IO_ADDRESS(SPEAR3XX_ICM1_UART_BASE) 23#define VA_SPEAR3XX_ICM1_UART_BASE (VA_SPEAR3XX_ICM1_2_BASE | SPEAR3XX_ICM1_UART_BASE)
30#define SPEAR3XX_ICM1_ADC_BASE UL(0xD0080000)
31#define SPEAR3XX_ICM1_SSP_BASE UL(0xD0100000) 24#define SPEAR3XX_ICM1_SSP_BASE UL(0xD0100000)
32#define SPEAR3XX_ICM1_I2C_BASE UL(0xD0180000)
33#define SPEAR3XX_ICM1_JPEG_BASE UL(0xD0800000)
34#define SPEAR3XX_ICM1_IRDA_BASE UL(0xD1000000)
35#define SPEAR3XX_ICM1_SRAM_BASE UL(0xD2800000)
36
37/* ICM2 - Application Subsystem */
38#define SPEAR3XX_ICM2_HWACCEL0_BASE UL(0xD8800000)
39#define SPEAR3XX_ICM2_HWACCEL1_BASE UL(0xD9000000)
40
41/* ICM4 - High Speed Connection */
42#define SPEAR3XX_ICM4_BASE UL(0xE0000000)
43#define SPEAR3XX_ICM4_MII_BASE UL(0xE0800000)
44#define SPEAR3XX_ICM4_USBD_FIFO_BASE UL(0xE1000000)
45#define SPEAR3XX_ICM4_USBD_CSR_BASE UL(0xE1100000)
46#define SPEAR3XX_ICM4_USBD_PLDT_BASE UL(0xE1200000)
47#define SPEAR3XX_ICM4_USB_EHCI0_1_BASE UL(0xE1800000)
48#define SPEAR3XX_ICM4_USB_OHCI0_BASE UL(0xE1900000)
49#define SPEAR3XX_ICM4_USB_OHCI1_BASE UL(0xE2100000)
50#define SPEAR3XX_ICM4_USB_ARB_BASE UL(0xE2800000)
51 25
52/* ML1 - Multi Layer CPU Subsystem */ 26/* ML1 - Multi Layer CPU Subsystem */
53#define SPEAR3XX_ICM3_ML1_2_BASE UL(0xF0000000) 27#define SPEAR3XX_ICM3_ML1_2_BASE UL(0xF0000000)
54#define SPEAR3XX_ML1_TMR_BASE UL(0xF0000000) 28#define VA_SPEAR6XX_ML_CPU_BASE UL(0xF0000000)
55#define SPEAR3XX_ML1_VIC_BASE UL(0xF1100000) 29#define SPEAR3XX_CPU_TMR_BASE UL(0xF0000000)
56#define VA_SPEAR3XX_ML1_VIC_BASE IO_ADDRESS(SPEAR3XX_ML1_VIC_BASE)
57 30
58/* ICM3 - Basic Subsystem */ 31/* ICM3 - Basic Subsystem */
59#define SPEAR3XX_ICM3_SMEM_BASE UL(0xF8000000)
60#define SPEAR3XX_ICM3_SMI_CTRL_BASE UL(0xFC000000) 32#define SPEAR3XX_ICM3_SMI_CTRL_BASE UL(0xFC000000)
33#define VA_SPEAR3XX_ICM3_SMI_CTRL_BASE UL(0xFC000000)
61#define SPEAR3XX_ICM3_DMA_BASE UL(0xFC400000) 34#define SPEAR3XX_ICM3_DMA_BASE UL(0xFC400000)
62#define SPEAR3XX_ICM3_SDRAM_CTRL_BASE UL(0xFC600000)
63#define SPEAR3XX_ICM3_TMR0_BASE UL(0xFC800000)
64#define SPEAR3XX_ICM3_WDT_BASE UL(0xFC880000)
65#define SPEAR3XX_ICM3_RTC_BASE UL(0xFC900000)
66#define SPEAR3XX_ICM3_GPIO_BASE UL(0xFC980000)
67#define SPEAR3XX_ICM3_SYS_CTRL_BASE UL(0xFCA00000) 35#define SPEAR3XX_ICM3_SYS_CTRL_BASE UL(0xFCA00000)
68#define VA_SPEAR3XX_ICM3_SYS_CTRL_BASE IO_ADDRESS(SPEAR3XX_ICM3_SYS_CTRL_BASE) 36#define VA_SPEAR3XX_ICM3_SYS_CTRL_BASE (VA_SPEAR3XX_ICM3_SMI_CTRL_BASE | SPEAR3XX_ICM3_SYS_CTRL_BASE)
69#define SPEAR3XX_ICM3_MISC_REG_BASE UL(0xFCA80000) 37#define SPEAR3XX_ICM3_MISC_REG_BASE UL(0xFCA80000)
70#define VA_SPEAR3XX_ICM3_MISC_REG_BASE IO_ADDRESS(SPEAR3XX_ICM3_MISC_REG_BASE) 38#define VA_SPEAR3XX_ICM3_MISC_REG_BASE (VA_SPEAR3XX_ICM3_SMI_CTRL_BASE | SPEAR3XX_ICM3_MISC_REG_BASE)
71#define SPEAR3XX_ICM3_TMR1_BASE UL(0xFCB00000)
72 39
73/* Debug uart for linux, will be used for debug and uncompress messages */ 40/* Debug uart for linux, will be used for debug and uncompress messages */
74#define SPEAR_DBG_UART_BASE SPEAR3XX_ICM1_UART_BASE 41#define SPEAR_DBG_UART_BASE SPEAR3XX_ICM1_UART_BASE
diff --git a/arch/arm/mach-spear3xx/include/mach/spear300.h b/arch/arm/mach-spear3xx/include/mach/spear300.h
deleted file mode 100644
index 3b6ea0729040..000000000000
--- a/arch/arm/mach-spear3xx/include/mach/spear300.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/include/mach/spear300.h
3 *
4 * SPEAr300 Machine specific definition
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifdef CONFIG_MACH_SPEAR300
15
16#ifndef __MACH_SPEAR300_H
17#define __MACH_SPEAR300_H
18
19/* Base address of various IPs */
20#define SPEAR300_TELECOM_BASE UL(0x50000000)
21
22/* Interrupt registers offsets and masks */
23#define SPEAR300_INT_ENB_MASK_REG 0x54
24#define SPEAR300_INT_STS_MASK_REG 0x58
25#define SPEAR300_IT_PERS_S_IRQ_MASK (1 << 0)
26#define SPEAR300_IT_CHANGE_S_IRQ_MASK (1 << 1)
27#define SPEAR300_I2S_IRQ_MASK (1 << 2)
28#define SPEAR300_TDM_IRQ_MASK (1 << 3)
29#define SPEAR300_CAMERA_L_IRQ_MASK (1 << 4)
30#define SPEAR300_CAMERA_F_IRQ_MASK (1 << 5)
31#define SPEAR300_CAMERA_V_IRQ_MASK (1 << 6)
32#define SPEAR300_KEYBOARD_IRQ_MASK (1 << 7)
33#define SPEAR300_GPIO1_IRQ_MASK (1 << 8)
34
35#define SPEAR300_SHIRQ_RAS1_MASK 0x1FF
36
37#define SPEAR300_CLCD_BASE UL(0x60000000)
38#define SPEAR300_SDHCI_BASE UL(0x70000000)
39#define SPEAR300_NAND_0_BASE UL(0x80000000)
40#define SPEAR300_NAND_1_BASE UL(0x84000000)
41#define SPEAR300_NAND_2_BASE UL(0x88000000)
42#define SPEAR300_NAND_3_BASE UL(0x8c000000)
43#define SPEAR300_NOR_0_BASE UL(0x90000000)
44#define SPEAR300_NOR_1_BASE UL(0x91000000)
45#define SPEAR300_NOR_2_BASE UL(0x92000000)
46#define SPEAR300_NOR_3_BASE UL(0x93000000)
47#define SPEAR300_FSMC_BASE UL(0x94000000)
48#define SPEAR300_SOC_CONFIG_BASE UL(0x99000000)
49#define SPEAR300_KEYBOARD_BASE UL(0xA0000000)
50#define SPEAR300_GPIO_BASE UL(0xA9000000)
51
52#endif /* __MACH_SPEAR300_H */
53
54#endif /* CONFIG_MACH_SPEAR300 */
diff --git a/arch/arm/mach-spear3xx/include/mach/spear310.h b/arch/arm/mach-spear3xx/include/mach/spear310.h
deleted file mode 100644
index 1567d0da725f..000000000000
--- a/arch/arm/mach-spear3xx/include/mach/spear310.h
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/include/mach/spear310.h
3 *
4 * SPEAr310 Machine specific definition
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifdef CONFIG_MACH_SPEAR310
15
16#ifndef __MACH_SPEAR310_H
17#define __MACH_SPEAR310_H
18
19#define SPEAR310_NAND_BASE UL(0x40000000)
20#define SPEAR310_FSMC_BASE UL(0x44000000)
21#define SPEAR310_UART1_BASE UL(0xB2000000)
22#define SPEAR310_UART2_BASE UL(0xB2080000)
23#define SPEAR310_UART3_BASE UL(0xB2100000)
24#define SPEAR310_UART4_BASE UL(0xB2180000)
25#define SPEAR310_UART5_BASE UL(0xB2200000)
26#define SPEAR310_HDLC_BASE UL(0xB2800000)
27#define SPEAR310_RS485_0_BASE UL(0xB3000000)
28#define SPEAR310_RS485_1_BASE UL(0xB3800000)
29#define SPEAR310_SOC_CONFIG_BASE UL(0xB4000000)
30
31/* Interrupt registers offsets and masks */
32#define SPEAR310_INT_STS_MASK_REG 0x04
33#define SPEAR310_SMII0_IRQ_MASK (1 << 0)
34#define SPEAR310_SMII1_IRQ_MASK (1 << 1)
35#define SPEAR310_SMII2_IRQ_MASK (1 << 2)
36#define SPEAR310_SMII3_IRQ_MASK (1 << 3)
37#define SPEAR310_WAKEUP_SMII0_IRQ_MASK (1 << 4)
38#define SPEAR310_WAKEUP_SMII1_IRQ_MASK (1 << 5)
39#define SPEAR310_WAKEUP_SMII2_IRQ_MASK (1 << 6)
40#define SPEAR310_WAKEUP_SMII3_IRQ_MASK (1 << 7)
41#define SPEAR310_UART1_IRQ_MASK (1 << 8)
42#define SPEAR310_UART2_IRQ_MASK (1 << 9)
43#define SPEAR310_UART3_IRQ_MASK (1 << 10)
44#define SPEAR310_UART4_IRQ_MASK (1 << 11)
45#define SPEAR310_UART5_IRQ_MASK (1 << 12)
46#define SPEAR310_EMI_IRQ_MASK (1 << 13)
47#define SPEAR310_TDM_HDLC_IRQ_MASK (1 << 14)
48#define SPEAR310_RS485_0_IRQ_MASK (1 << 15)
49#define SPEAR310_RS485_1_IRQ_MASK (1 << 16)
50
51#define SPEAR310_SHIRQ_RAS1_MASK 0x000FF
52#define SPEAR310_SHIRQ_RAS2_MASK 0x01F00
53#define SPEAR310_SHIRQ_RAS3_MASK 0x02000
54#define SPEAR310_SHIRQ_INTRCOMM_RAS_MASK 0x1C000
55
56#endif /* __MACH_SPEAR310_H */
57
58#endif /* CONFIG_MACH_SPEAR310 */
diff --git a/arch/arm/mach-spear3xx/include/mach/spear320.h b/arch/arm/mach-spear3xx/include/mach/spear320.h
deleted file mode 100644
index 8cfa83fa1296..000000000000
--- a/arch/arm/mach-spear3xx/include/mach/spear320.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/include/mach/spear320.h
3 *
4 * SPEAr320 Machine specific definition
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifdef CONFIG_MACH_SPEAR320
15
16#ifndef __MACH_SPEAR320_H
17#define __MACH_SPEAR320_H
18
19#define SPEAR320_EMI_CTRL_BASE UL(0x40000000)
20#define SPEAR320_FSMC_BASE UL(0x4C000000)
21#define SPEAR320_NAND_BASE UL(0x50000000)
22#define SPEAR320_I2S_BASE UL(0x60000000)
23#define SPEAR320_SDHCI_BASE UL(0x70000000)
24#define SPEAR320_CLCD_BASE UL(0x90000000)
25#define SPEAR320_PAR_PORT_BASE UL(0xA0000000)
26#define SPEAR320_CAN0_BASE UL(0xA1000000)
27#define SPEAR320_CAN1_BASE UL(0xA2000000)
28#define SPEAR320_UART1_BASE UL(0xA3000000)
29#define SPEAR320_UART2_BASE UL(0xA4000000)
30#define SPEAR320_SSP0_BASE UL(0xA5000000)
31#define SPEAR320_SSP1_BASE UL(0xA6000000)
32#define SPEAR320_I2C_BASE UL(0xA7000000)
33#define SPEAR320_PWM_BASE UL(0xA8000000)
34#define SPEAR320_SMII0_BASE UL(0xAA000000)
35#define SPEAR320_SMII1_BASE UL(0xAB000000)
36#define SPEAR320_SOC_CONFIG_BASE UL(0xB3000000)
37
38/* Interrupt registers offsets and masks */
39#define SPEAR320_INT_STS_MASK_REG 0x04
40#define SPEAR320_INT_CLR_MASK_REG 0x04
41#define SPEAR320_INT_ENB_MASK_REG 0x08
42#define SPEAR320_GPIO_IRQ_MASK (1 << 0)
43#define SPEAR320_I2S_PLAY_IRQ_MASK (1 << 1)
44#define SPEAR320_I2S_REC_IRQ_MASK (1 << 2)
45#define SPEAR320_EMI_IRQ_MASK (1 << 7)
46#define SPEAR320_CLCD_IRQ_MASK (1 << 8)
47#define SPEAR320_SPP_IRQ_MASK (1 << 9)
48#define SPEAR320_SDHCI_IRQ_MASK (1 << 10)
49#define SPEAR320_CAN_U_IRQ_MASK (1 << 11)
50#define SPEAR320_CAN_L_IRQ_MASK (1 << 12)
51#define SPEAR320_UART1_IRQ_MASK (1 << 13)
52#define SPEAR320_UART2_IRQ_MASK (1 << 14)
53#define SPEAR320_SSP1_IRQ_MASK (1 << 15)
54#define SPEAR320_SSP2_IRQ_MASK (1 << 16)
55#define SPEAR320_SMII0_IRQ_MASK (1 << 17)
56#define SPEAR320_MII1_SMII1_IRQ_MASK (1 << 18)
57#define SPEAR320_WAKEUP_SMII0_IRQ_MASK (1 << 19)
58#define SPEAR320_WAKEUP_MII1_SMII1_IRQ_MASK (1 << 20)
59#define SPEAR320_I2C1_IRQ_MASK (1 << 21)
60
61#define SPEAR320_SHIRQ_RAS1_MASK 0x000380
62#define SPEAR320_SHIRQ_RAS3_MASK 0x000007
63#define SPEAR320_SHIRQ_INTRCOMM_RAS_MASK 0x3FF800
64
65#endif /* __MACH_SPEAR320_H */
66
67#endif /* CONFIG_MACH_SPEAR320 */
diff --git a/arch/arm/mach-spear3xx/spear300.c b/arch/arm/mach-spear3xx/spear300.c
index f7db66812abb..f75fe25a620c 100644
--- a/arch/arm/mach-spear3xx/spear300.c
+++ b/arch/arm/mach-spear3xx/spear300.c
@@ -3,372 +3,62 @@
3 * 3 *
4 * SPEAr300 machine source file 4 * SPEAr300 machine source file
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.kumar@st.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied. 11 * warranty of any kind, whether express or implied.
12 */ 12 */
13 13
14#include <linux/types.h> 14#define pr_fmt(fmt) "SPEAr300: " fmt
15#include <linux/amba/pl061.h> 15
16#include <linux/ptrace.h> 16#include <linux/amba/pl08x.h>
17#include <asm/irq.h> 17#include <linux/of_platform.h>
18#include <asm/hardware/vic.h>
19#include <asm/mach/arch.h>
18#include <plat/shirq.h> 20#include <plat/shirq.h>
19#include <mach/generic.h> 21#include <mach/generic.h>
20#include <mach/hardware.h> 22#include <mach/spear.h>
21 23
22/* pad multiplexing support */ 24/* Base address of various IPs */
23/* muxing registers */ 25#define SPEAR300_TELECOM_BASE UL(0x50000000)
24#define PAD_MUX_CONFIG_REG 0x00 26
25#define MODE_CONFIG_REG 0x04 27/* Interrupt registers offsets and masks */
26 28#define SPEAR300_INT_ENB_MASK_REG 0x54
27/* modes */ 29#define SPEAR300_INT_STS_MASK_REG 0x58
28#define NAND_MODE (1 << 0) 30#define SPEAR300_IT_PERS_S_IRQ_MASK (1 << 0)
29#define NOR_MODE (1 << 1) 31#define SPEAR300_IT_CHANGE_S_IRQ_MASK (1 << 1)
30#define PHOTO_FRAME_MODE (1 << 2) 32#define SPEAR300_I2S_IRQ_MASK (1 << 2)
31#define LEND_IP_PHONE_MODE (1 << 3) 33#define SPEAR300_TDM_IRQ_MASK (1 << 3)
32#define HEND_IP_PHONE_MODE (1 << 4) 34#define SPEAR300_CAMERA_L_IRQ_MASK (1 << 4)
33#define LEND_WIFI_PHONE_MODE (1 << 5) 35#define SPEAR300_CAMERA_F_IRQ_MASK (1 << 5)
34#define HEND_WIFI_PHONE_MODE (1 << 6) 36#define SPEAR300_CAMERA_V_IRQ_MASK (1 << 6)
35#define ATA_PABX_WI2S_MODE (1 << 7) 37#define SPEAR300_KEYBOARD_IRQ_MASK (1 << 7)
36#define ATA_PABX_I2S_MODE (1 << 8) 38#define SPEAR300_GPIO1_IRQ_MASK (1 << 8)
37#define CAML_LCDW_MODE (1 << 9) 39
38#define CAMU_LCD_MODE (1 << 10) 40#define SPEAR300_SHIRQ_RAS1_MASK 0x1FF
39#define CAMU_WLCD_MODE (1 << 11) 41
40#define CAML_LCD_MODE (1 << 12) 42#define SPEAR300_SOC_CONFIG_BASE UL(0x99000000)
41#define ALL_MODES 0x1FFF 43
42 44
43struct pmx_mode spear300_nand_mode = { 45/* SPEAr300 Virtual irq definitions */
44 .id = NAND_MODE, 46/* IRQs sharing IRQ_GEN_RAS_1 */
45 .name = "nand mode", 47#define SPEAR300_VIRQ_IT_PERS_S (SPEAR3XX_VIRQ_START + 0)
46 .mask = 0x00, 48#define SPEAR300_VIRQ_IT_CHANGE_S (SPEAR3XX_VIRQ_START + 1)
47}; 49#define SPEAR300_VIRQ_I2S (SPEAR3XX_VIRQ_START + 2)
48 50#define SPEAR300_VIRQ_TDM (SPEAR3XX_VIRQ_START + 3)
49struct pmx_mode spear300_nor_mode = { 51#define SPEAR300_VIRQ_CAMERA_L (SPEAR3XX_VIRQ_START + 4)
50 .id = NOR_MODE, 52#define SPEAR300_VIRQ_CAMERA_F (SPEAR3XX_VIRQ_START + 5)
51 .name = "nor mode", 53#define SPEAR300_VIRQ_CAMERA_V (SPEAR3XX_VIRQ_START + 6)
52 .mask = 0x01, 54#define SPEAR300_VIRQ_KEYBOARD (SPEAR3XX_VIRQ_START + 7)
53}; 55#define SPEAR300_VIRQ_GPIO1 (SPEAR3XX_VIRQ_START + 8)
54 56
55struct pmx_mode spear300_photo_frame_mode = { 57/* IRQs sharing IRQ_GEN_RAS_3 */
56 .id = PHOTO_FRAME_MODE, 58#define SPEAR300_IRQ_CLCD SPEAR3XX_IRQ_GEN_RAS_3
57 .name = "photo frame mode", 59
58 .mask = 0x02, 60/* IRQs sharing IRQ_INTRCOMM_RAS_ARM */
59}; 61#define SPEAR300_IRQ_SDHCI SPEAR3XX_IRQ_INTRCOMM_RAS_ARM
60
61struct pmx_mode spear300_lend_ip_phone_mode = {
62 .id = LEND_IP_PHONE_MODE,
63 .name = "lend ip phone mode",
64 .mask = 0x03,
65};
66
67struct pmx_mode spear300_hend_ip_phone_mode = {
68 .id = HEND_IP_PHONE_MODE,
69 .name = "hend ip phone mode",
70 .mask = 0x04,
71};
72
73struct pmx_mode spear300_lend_wifi_phone_mode = {
74 .id = LEND_WIFI_PHONE_MODE,
75 .name = "lend wifi phone mode",
76 .mask = 0x05,
77};
78
79struct pmx_mode spear300_hend_wifi_phone_mode = {
80 .id = HEND_WIFI_PHONE_MODE,
81 .name = "hend wifi phone mode",
82 .mask = 0x06,
83};
84
85struct pmx_mode spear300_ata_pabx_wi2s_mode = {
86 .id = ATA_PABX_WI2S_MODE,
87 .name = "ata pabx wi2s mode",
88 .mask = 0x07,
89};
90
91struct pmx_mode spear300_ata_pabx_i2s_mode = {
92 .id = ATA_PABX_I2S_MODE,
93 .name = "ata pabx i2s mode",
94 .mask = 0x08,
95};
96
97struct pmx_mode spear300_caml_lcdw_mode = {
98 .id = CAML_LCDW_MODE,
99 .name = "caml lcdw mode",
100 .mask = 0x0C,
101};
102
103struct pmx_mode spear300_camu_lcd_mode = {
104 .id = CAMU_LCD_MODE,
105 .name = "camu lcd mode",
106 .mask = 0x0D,
107};
108
109struct pmx_mode spear300_camu_wlcd_mode = {
110 .id = CAMU_WLCD_MODE,
111 .name = "camu wlcd mode",
112 .mask = 0x0E,
113};
114
115struct pmx_mode spear300_caml_lcd_mode = {
116 .id = CAML_LCD_MODE,
117 .name = "caml lcd mode",
118 .mask = 0x0F,
119};
120
121/* devices */
122static struct pmx_dev_mode pmx_fsmc_2_chips_modes[] = {
123 {
124 .ids = NAND_MODE | NOR_MODE | PHOTO_FRAME_MODE |
125 ATA_PABX_WI2S_MODE | ATA_PABX_I2S_MODE,
126 .mask = PMX_FIRDA_MASK,
127 },
128};
129
130struct pmx_dev spear300_pmx_fsmc_2_chips = {
131 .name = "fsmc_2_chips",
132 .modes = pmx_fsmc_2_chips_modes,
133 .mode_count = ARRAY_SIZE(pmx_fsmc_2_chips_modes),
134 .enb_on_reset = 1,
135};
136
137static struct pmx_dev_mode pmx_fsmc_4_chips_modes[] = {
138 {
139 .ids = NAND_MODE | NOR_MODE | PHOTO_FRAME_MODE |
140 ATA_PABX_WI2S_MODE | ATA_PABX_I2S_MODE,
141 .mask = PMX_FIRDA_MASK | PMX_UART0_MASK,
142 },
143};
144
145struct pmx_dev spear300_pmx_fsmc_4_chips = {
146 .name = "fsmc_4_chips",
147 .modes = pmx_fsmc_4_chips_modes,
148 .mode_count = ARRAY_SIZE(pmx_fsmc_4_chips_modes),
149 .enb_on_reset = 1,
150};
151
152static struct pmx_dev_mode pmx_keyboard_modes[] = {
153 {
154 .ids = LEND_IP_PHONE_MODE | HEND_IP_PHONE_MODE |
155 LEND_WIFI_PHONE_MODE | HEND_WIFI_PHONE_MODE |
156 CAML_LCDW_MODE | CAMU_LCD_MODE | CAMU_WLCD_MODE |
157 CAML_LCD_MODE,
158 .mask = 0x0,
159 },
160};
161
162struct pmx_dev spear300_pmx_keyboard = {
163 .name = "keyboard",
164 .modes = pmx_keyboard_modes,
165 .mode_count = ARRAY_SIZE(pmx_keyboard_modes),
166 .enb_on_reset = 1,
167};
168
169static struct pmx_dev_mode pmx_clcd_modes[] = {
170 {
171 .ids = PHOTO_FRAME_MODE,
172 .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK ,
173 }, {
174 .ids = HEND_IP_PHONE_MODE | HEND_WIFI_PHONE_MODE |
175 CAMU_LCD_MODE | CAML_LCD_MODE,
176 .mask = PMX_TIMER_3_4_MASK,
177 },
178};
179
180struct pmx_dev spear300_pmx_clcd = {
181 .name = "clcd",
182 .modes = pmx_clcd_modes,
183 .mode_count = ARRAY_SIZE(pmx_clcd_modes),
184 .enb_on_reset = 1,
185};
186
187static struct pmx_dev_mode pmx_telecom_gpio_modes[] = {
188 {
189 .ids = PHOTO_FRAME_MODE | CAMU_LCD_MODE | CAML_LCD_MODE,
190 .mask = PMX_MII_MASK,
191 }, {
192 .ids = LEND_IP_PHONE_MODE | LEND_WIFI_PHONE_MODE,
193 .mask = PMX_MII_MASK | PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK,
194 }, {
195 .ids = ATA_PABX_I2S_MODE | CAML_LCDW_MODE | CAMU_WLCD_MODE,
196 .mask = PMX_MII_MASK | PMX_TIMER_3_4_MASK,
197 }, {
198 .ids = HEND_IP_PHONE_MODE | HEND_WIFI_PHONE_MODE,
199 .mask = PMX_MII_MASK | PMX_TIMER_1_2_MASK,
200 }, {
201 .ids = ATA_PABX_WI2S_MODE,
202 .mask = PMX_MII_MASK | PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK
203 | PMX_UART0_MODEM_MASK,
204 },
205};
206
207struct pmx_dev spear300_pmx_telecom_gpio = {
208 .name = "telecom_gpio",
209 .modes = pmx_telecom_gpio_modes,
210 .mode_count = ARRAY_SIZE(pmx_telecom_gpio_modes),
211 .enb_on_reset = 1,
212};
213
214static struct pmx_dev_mode pmx_telecom_tdm_modes[] = {
215 {
216 .ids = PHOTO_FRAME_MODE | LEND_IP_PHONE_MODE |
217 HEND_IP_PHONE_MODE | LEND_WIFI_PHONE_MODE
218 | HEND_WIFI_PHONE_MODE | ATA_PABX_WI2S_MODE
219 | ATA_PABX_I2S_MODE | CAML_LCDW_MODE | CAMU_LCD_MODE
220 | CAMU_WLCD_MODE | CAML_LCD_MODE,
221 .mask = PMX_UART0_MODEM_MASK | PMX_SSP_CS_MASK,
222 },
223};
224
225struct pmx_dev spear300_pmx_telecom_tdm = {
226 .name = "telecom_tdm",
227 .modes = pmx_telecom_tdm_modes,
228 .mode_count = ARRAY_SIZE(pmx_telecom_tdm_modes),
229 .enb_on_reset = 1,
230};
231
232static struct pmx_dev_mode pmx_telecom_spi_cs_i2c_clk_modes[] = {
233 {
234 .ids = LEND_IP_PHONE_MODE | HEND_IP_PHONE_MODE |
235 LEND_WIFI_PHONE_MODE | HEND_WIFI_PHONE_MODE
236 | ATA_PABX_WI2S_MODE | ATA_PABX_I2S_MODE |
237 CAML_LCDW_MODE | CAML_LCD_MODE,
238 .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK,
239 },
240};
241
242struct pmx_dev spear300_pmx_telecom_spi_cs_i2c_clk = {
243 .name = "telecom_spi_cs_i2c_clk",
244 .modes = pmx_telecom_spi_cs_i2c_clk_modes,
245 .mode_count = ARRAY_SIZE(pmx_telecom_spi_cs_i2c_clk_modes),
246 .enb_on_reset = 1,
247};
248
249static struct pmx_dev_mode pmx_telecom_camera_modes[] = {
250 {
251 .ids = CAML_LCDW_MODE | CAML_LCD_MODE,
252 .mask = PMX_MII_MASK,
253 }, {
254 .ids = CAMU_LCD_MODE | CAMU_WLCD_MODE,
255 .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK | PMX_MII_MASK,
256 },
257};
258
259struct pmx_dev spear300_pmx_telecom_camera = {
260 .name = "telecom_camera",
261 .modes = pmx_telecom_camera_modes,
262 .mode_count = ARRAY_SIZE(pmx_telecom_camera_modes),
263 .enb_on_reset = 1,
264};
265
266static struct pmx_dev_mode pmx_telecom_dac_modes[] = {
267 {
268 .ids = ATA_PABX_I2S_MODE | CAML_LCDW_MODE | CAMU_LCD_MODE
269 | CAMU_WLCD_MODE | CAML_LCD_MODE,
270 .mask = PMX_TIMER_1_2_MASK,
271 },
272};
273
274struct pmx_dev spear300_pmx_telecom_dac = {
275 .name = "telecom_dac",
276 .modes = pmx_telecom_dac_modes,
277 .mode_count = ARRAY_SIZE(pmx_telecom_dac_modes),
278 .enb_on_reset = 1,
279};
280
281static struct pmx_dev_mode pmx_telecom_i2s_modes[] = {
282 {
283 .ids = LEND_IP_PHONE_MODE | HEND_IP_PHONE_MODE
284 | LEND_WIFI_PHONE_MODE | HEND_WIFI_PHONE_MODE |
285 ATA_PABX_I2S_MODE | CAML_LCDW_MODE | CAMU_LCD_MODE
286 | CAMU_WLCD_MODE | CAML_LCD_MODE,
287 .mask = PMX_UART0_MODEM_MASK,
288 },
289};
290
291struct pmx_dev spear300_pmx_telecom_i2s = {
292 .name = "telecom_i2s",
293 .modes = pmx_telecom_i2s_modes,
294 .mode_count = ARRAY_SIZE(pmx_telecom_i2s_modes),
295 .enb_on_reset = 1,
296};
297
298static struct pmx_dev_mode pmx_telecom_boot_pins_modes[] = {
299 {
300 .ids = NAND_MODE | NOR_MODE,
301 .mask = PMX_UART0_MODEM_MASK | PMX_TIMER_1_2_MASK |
302 PMX_TIMER_3_4_MASK,
303 },
304};
305
306struct pmx_dev spear300_pmx_telecom_boot_pins = {
307 .name = "telecom_boot_pins",
308 .modes = pmx_telecom_boot_pins_modes,
309 .mode_count = ARRAY_SIZE(pmx_telecom_boot_pins_modes),
310 .enb_on_reset = 1,
311};
312
313static struct pmx_dev_mode pmx_telecom_sdhci_4bit_modes[] = {
314 {
315 .ids = PHOTO_FRAME_MODE | LEND_IP_PHONE_MODE |
316 HEND_IP_PHONE_MODE | LEND_WIFI_PHONE_MODE |
317 HEND_WIFI_PHONE_MODE | CAML_LCDW_MODE | CAMU_LCD_MODE |
318 CAMU_WLCD_MODE | CAML_LCD_MODE | ATA_PABX_WI2S_MODE |
319 ATA_PABX_I2S_MODE,
320 .mask = PMX_GPIO_PIN0_MASK | PMX_GPIO_PIN1_MASK |
321 PMX_GPIO_PIN2_MASK | PMX_GPIO_PIN3_MASK |
322 PMX_GPIO_PIN4_MASK | PMX_GPIO_PIN5_MASK,
323 },
324};
325
326struct pmx_dev spear300_pmx_telecom_sdhci_4bit = {
327 .name = "telecom_sdhci_4bit",
328 .modes = pmx_telecom_sdhci_4bit_modes,
329 .mode_count = ARRAY_SIZE(pmx_telecom_sdhci_4bit_modes),
330 .enb_on_reset = 1,
331};
332
333static struct pmx_dev_mode pmx_telecom_sdhci_8bit_modes[] = {
334 {
335 .ids = PHOTO_FRAME_MODE | LEND_IP_PHONE_MODE |
336 HEND_IP_PHONE_MODE | LEND_WIFI_PHONE_MODE |
337 HEND_WIFI_PHONE_MODE | CAML_LCDW_MODE | CAMU_LCD_MODE |
338 CAMU_WLCD_MODE | CAML_LCD_MODE,
339 .mask = PMX_GPIO_PIN0_MASK | PMX_GPIO_PIN1_MASK |
340 PMX_GPIO_PIN2_MASK | PMX_GPIO_PIN3_MASK |
341 PMX_GPIO_PIN4_MASK | PMX_GPIO_PIN5_MASK | PMX_MII_MASK,
342 },
343};
344
345struct pmx_dev spear300_pmx_telecom_sdhci_8bit = {
346 .name = "telecom_sdhci_8bit",
347 .modes = pmx_telecom_sdhci_8bit_modes,
348 .mode_count = ARRAY_SIZE(pmx_telecom_sdhci_8bit_modes),
349 .enb_on_reset = 1,
350};
351
352static struct pmx_dev_mode pmx_gpio1_modes[] = {
353 {
354 .ids = PHOTO_FRAME_MODE,
355 .mask = PMX_UART0_MODEM_MASK | PMX_TIMER_1_2_MASK |
356 PMX_TIMER_3_4_MASK,
357 },
358};
359
360struct pmx_dev spear300_pmx_gpio1 = {
361 .name = "arm gpio1",
362 .modes = pmx_gpio1_modes,
363 .mode_count = ARRAY_SIZE(pmx_gpio1_modes),
364 .enb_on_reset = 1,
365};
366
367/* pmx driver structure */
368static struct pmx_driver pmx_driver = {
369 .mode_reg = {.offset = MODE_CONFIG_REG, .mask = 0x0000000f},
370 .mux_reg = {.offset = PAD_MUX_CONFIG_REG, .mask = 0x00007fff},
371};
372 62
373/* spear3xx shared irq */ 63/* spear3xx shared irq */
374static struct shirq_dev_config shirq_ras1_config[] = { 64static struct shirq_dev_config shirq_ras1_config[] = {
@@ -423,45 +113,239 @@ static struct spear_shirq shirq_ras1 = {
423 }, 113 },
424}; 114};
425 115
426/* Add spear300 specific devices here */ 116/* DMAC platform data's slave info */
427/* arm gpio1 device registration */ 117struct pl08x_channel_data spear300_dma_info[] = {
428static struct pl061_platform_data gpio1_plat_data = { 118 {
429 .gpio_base = 8, 119 .bus_id = "uart0_rx",
430 .irq_base = SPEAR300_GPIO1_INT_BASE, 120 .min_signal = 2,
121 .max_signal = 2,
122 .muxval = 0,
123 .cctl = 0,
124 .periph_buses = PL08X_AHB1,
125 }, {
126 .bus_id = "uart0_tx",
127 .min_signal = 3,
128 .max_signal = 3,
129 .muxval = 0,
130 .cctl = 0,
131 .periph_buses = PL08X_AHB1,
132 }, {
133 .bus_id = "ssp0_rx",
134 .min_signal = 8,
135 .max_signal = 8,
136 .muxval = 0,
137 .cctl = 0,
138 .periph_buses = PL08X_AHB1,
139 }, {
140 .bus_id = "ssp0_tx",
141 .min_signal = 9,
142 .max_signal = 9,
143 .muxval = 0,
144 .cctl = 0,
145 .periph_buses = PL08X_AHB1,
146 }, {
147 .bus_id = "i2c_rx",
148 .min_signal = 10,
149 .max_signal = 10,
150 .muxval = 0,
151 .cctl = 0,
152 .periph_buses = PL08X_AHB1,
153 }, {
154 .bus_id = "i2c_tx",
155 .min_signal = 11,
156 .max_signal = 11,
157 .muxval = 0,
158 .cctl = 0,
159 .periph_buses = PL08X_AHB1,
160 }, {
161 .bus_id = "irda",
162 .min_signal = 12,
163 .max_signal = 12,
164 .muxval = 0,
165 .cctl = 0,
166 .periph_buses = PL08X_AHB1,
167 }, {
168 .bus_id = "adc",
169 .min_signal = 13,
170 .max_signal = 13,
171 .muxval = 0,
172 .cctl = 0,
173 .periph_buses = PL08X_AHB1,
174 }, {
175 .bus_id = "to_jpeg",
176 .min_signal = 14,
177 .max_signal = 14,
178 .muxval = 0,
179 .cctl = 0,
180 .periph_buses = PL08X_AHB1,
181 }, {
182 .bus_id = "from_jpeg",
183 .min_signal = 15,
184 .max_signal = 15,
185 .muxval = 0,
186 .cctl = 0,
187 .periph_buses = PL08X_AHB1,
188 }, {
189 .bus_id = "ras0_rx",
190 .min_signal = 0,
191 .max_signal = 0,
192 .muxval = 1,
193 .cctl = 0,
194 .periph_buses = PL08X_AHB1,
195 }, {
196 .bus_id = "ras0_tx",
197 .min_signal = 1,
198 .max_signal = 1,
199 .muxval = 1,
200 .cctl = 0,
201 .periph_buses = PL08X_AHB1,
202 }, {
203 .bus_id = "ras1_rx",
204 .min_signal = 2,
205 .max_signal = 2,
206 .muxval = 1,
207 .cctl = 0,
208 .periph_buses = PL08X_AHB1,
209 }, {
210 .bus_id = "ras1_tx",
211 .min_signal = 3,
212 .max_signal = 3,
213 .muxval = 1,
214 .cctl = 0,
215 .periph_buses = PL08X_AHB1,
216 }, {
217 .bus_id = "ras2_rx",
218 .min_signal = 4,
219 .max_signal = 4,
220 .muxval = 1,
221 .cctl = 0,
222 .periph_buses = PL08X_AHB1,
223 }, {
224 .bus_id = "ras2_tx",
225 .min_signal = 5,
226 .max_signal = 5,
227 .muxval = 1,
228 .cctl = 0,
229 .periph_buses = PL08X_AHB1,
230 }, {
231 .bus_id = "ras3_rx",
232 .min_signal = 6,
233 .max_signal = 6,
234 .muxval = 1,
235 .cctl = 0,
236 .periph_buses = PL08X_AHB1,
237 }, {
238 .bus_id = "ras3_tx",
239 .min_signal = 7,
240 .max_signal = 7,
241 .muxval = 1,
242 .cctl = 0,
243 .periph_buses = PL08X_AHB1,
244 }, {
245 .bus_id = "ras4_rx",
246 .min_signal = 8,
247 .max_signal = 8,
248 .muxval = 1,
249 .cctl = 0,
250 .periph_buses = PL08X_AHB1,
251 }, {
252 .bus_id = "ras4_tx",
253 .min_signal = 9,
254 .max_signal = 9,
255 .muxval = 1,
256 .cctl = 0,
257 .periph_buses = PL08X_AHB1,
258 }, {
259 .bus_id = "ras5_rx",
260 .min_signal = 10,
261 .max_signal = 10,
262 .muxval = 1,
263 .cctl = 0,
264 .periph_buses = PL08X_AHB1,
265 }, {
266 .bus_id = "ras5_tx",
267 .min_signal = 11,
268 .max_signal = 11,
269 .muxval = 1,
270 .cctl = 0,
271 .periph_buses = PL08X_AHB1,
272 }, {
273 .bus_id = "ras6_rx",
274 .min_signal = 12,
275 .max_signal = 12,
276 .muxval = 1,
277 .cctl = 0,
278 .periph_buses = PL08X_AHB1,
279 }, {
280 .bus_id = "ras6_tx",
281 .min_signal = 13,
282 .max_signal = 13,
283 .muxval = 1,
284 .cctl = 0,
285 .periph_buses = PL08X_AHB1,
286 }, {
287 .bus_id = "ras7_rx",
288 .min_signal = 14,
289 .max_signal = 14,
290 .muxval = 1,
291 .cctl = 0,
292 .periph_buses = PL08X_AHB1,
293 }, {
294 .bus_id = "ras7_tx",
295 .min_signal = 15,
296 .max_signal = 15,
297 .muxval = 1,
298 .cctl = 0,
299 .periph_buses = PL08X_AHB1,
300 },
431}; 301};
432 302
433AMBA_APB_DEVICE(spear300_gpio1, "gpio1", 0, SPEAR300_GPIO_BASE, 303/* Add SPEAr300 auxdata to pass platform data */
434 {SPEAR300_VIRQ_GPIO1}, &gpio1_plat_data); 304static struct of_dev_auxdata spear300_auxdata_lookup[] __initdata = {
305 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
306 &pl022_plat_data),
307 OF_DEV_AUXDATA("arm,pl080", SPEAR3XX_ICM3_DMA_BASE, NULL,
308 &pl080_plat_data),
309 {}
310};
435 311
436/* spear300 routines */ 312static void __init spear300_dt_init(void)
437void __init spear300_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
438 u8 pmx_dev_count)
439{ 313{
440 int ret = 0; 314 int ret;
315
316 pl080_plat_data.slave_channels = spear300_dma_info;
317 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear300_dma_info);
441 318
442 /* call spear3xx family common init function */ 319 of_platform_populate(NULL, of_default_bus_match_table,
443 spear3xx_init(); 320 spear300_auxdata_lookup, NULL);
444 321
445 /* shared irq registration */ 322 /* shared irq registration */
446 shirq_ras1.regs.base = ioremap(SPEAR300_TELECOM_BASE, SZ_4K); 323 shirq_ras1.regs.base = ioremap(SPEAR300_TELECOM_BASE, SZ_4K);
447 if (shirq_ras1.regs.base) { 324 if (shirq_ras1.regs.base) {
448 ret = spear_shirq_register(&shirq_ras1); 325 ret = spear_shirq_register(&shirq_ras1);
449 if (ret) 326 if (ret)
450 printk(KERN_ERR "Error registering Shared IRQ\n"); 327 pr_err("Error registering Shared IRQ\n");
451 } 328 }
329}
452 330
453 /* pmx initialization */ 331static const char * const spear300_dt_board_compat[] = {
454 pmx_driver.mode = pmx_mode; 332 "st,spear300",
455 pmx_driver.devs = pmx_devs; 333 "st,spear300-evb",
456 pmx_driver.devs_count = pmx_dev_count; 334 NULL,
335};
457 336
458 pmx_driver.base = ioremap(SPEAR300_SOC_CONFIG_BASE, SZ_4K); 337static void __init spear300_map_io(void)
459 if (pmx_driver.base) { 338{
460 ret = pmx_register(&pmx_driver); 339 spear3xx_map_io();
461 if (ret) 340 spear300_clk_init();
462 printk(KERN_ERR "padmux: registration failed. err no"
463 ": %d\n", ret);
464 /* Free Mapping, device selection already done */
465 iounmap(pmx_driver.base);
466 }
467} 341}
342
343DT_MACHINE_START(SPEAR300_DT, "ST SPEAr300 SoC with Flattened Device Tree")
344 .map_io = spear300_map_io,
345 .init_irq = spear3xx_dt_init_irq,
346 .handle_irq = vic_handle_irq,
347 .timer = &spear3xx_timer,
348 .init_machine = spear300_dt_init,
349 .restart = spear_restart,
350 .dt_compat = spear300_dt_board_compat,
351MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear300_evb.c b/arch/arm/mach-spear3xx/spear300_evb.c
deleted file mode 100644
index 3462ab9d6122..000000000000
--- a/arch/arm/mach-spear3xx/spear300_evb.c
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/spear300_evb.c
3 *
4 * SPEAr300 evaluation board source file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <asm/hardware/vic.h>
15#include <asm/mach/arch.h>
16#include <asm/mach-types.h>
17#include <mach/generic.h>
18#include <mach/hardware.h>
19
20/* padmux devices to enable */
21static struct pmx_dev *pmx_devs[] = {
22 /* spear3xx specific devices */
23 &spear3xx_pmx_i2c,
24 &spear3xx_pmx_ssp_cs,
25 &spear3xx_pmx_ssp,
26 &spear3xx_pmx_mii,
27 &spear3xx_pmx_uart0,
28
29 /* spear300 specific devices */
30 &spear300_pmx_fsmc_2_chips,
31 &spear300_pmx_clcd,
32 &spear300_pmx_telecom_sdhci_4bit,
33 &spear300_pmx_gpio1,
34};
35
36static struct amba_device *amba_devs[] __initdata = {
37 /* spear3xx specific devices */
38 &spear3xx_gpio_device,
39 &spear3xx_uart_device,
40
41 /* spear300 specific devices */
42 &spear300_gpio1_device,
43};
44
45static struct platform_device *plat_devs[] __initdata = {
46 /* spear3xx specific devices */
47
48 /* spear300 specific devices */
49};
50
51static void __init spear300_evb_init(void)
52{
53 unsigned int i;
54
55 /* call spear300 machine init function */
56 spear300_init(&spear300_photo_frame_mode, pmx_devs,
57 ARRAY_SIZE(pmx_devs));
58
59 /* Add Platform Devices */
60 platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
61
62 /* Add Amba Devices */
63 for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
64 amba_device_register(amba_devs[i], &iomem_resource);
65}
66
67MACHINE_START(SPEAR300, "ST-SPEAR300-EVB")
68 .atag_offset = 0x100,
69 .map_io = spear3xx_map_io,
70 .init_irq = spear3xx_init_irq,
71 .handle_irq = vic_handle_irq,
72 .timer = &spear3xx_timer,
73 .init_machine = spear300_evb_init,
74 .restart = spear_restart,
75MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear310.c b/arch/arm/mach-spear3xx/spear310.c
index febaa6fcfb6a..f0842a58dc02 100644
--- a/arch/arm/mach-spear3xx/spear310.c
+++ b/arch/arm/mach-spear3xx/spear310.c
@@ -3,141 +3,84 @@
3 * 3 *
4 * SPEAr310 machine source file 4 * SPEAr310 machine source file
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.kumar@st.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied. 11 * warranty of any kind, whether express or implied.
12 */ 12 */
13 13
14#include <linux/ptrace.h> 14#define pr_fmt(fmt) "SPEAr310: " fmt
15#include <asm/irq.h> 15
16#include <linux/amba/pl08x.h>
17#include <linux/amba/serial.h>
18#include <linux/of_platform.h>
19#include <asm/hardware/vic.h>
20#include <asm/mach/arch.h>
16#include <plat/shirq.h> 21#include <plat/shirq.h>
17#include <mach/generic.h> 22#include <mach/generic.h>
18#include <mach/hardware.h> 23#include <mach/spear.h>
19 24
20/* pad multiplexing support */ 25#define SPEAR310_UART1_BASE UL(0xB2000000)
21/* muxing registers */ 26#define SPEAR310_UART2_BASE UL(0xB2080000)
22#define PAD_MUX_CONFIG_REG 0x08 27#define SPEAR310_UART3_BASE UL(0xB2100000)
23 28#define SPEAR310_UART4_BASE UL(0xB2180000)
24/* devices */ 29#define SPEAR310_UART5_BASE UL(0xB2200000)
25static struct pmx_dev_mode pmx_emi_cs_0_1_4_5_modes[] = { 30#define SPEAR310_SOC_CONFIG_BASE UL(0xB4000000)
26 { 31
27 .ids = 0x00, 32/* Interrupt registers offsets and masks */
28 .mask = PMX_TIMER_3_4_MASK, 33#define SPEAR310_INT_STS_MASK_REG 0x04
29 }, 34#define SPEAR310_SMII0_IRQ_MASK (1 << 0)
30}; 35#define SPEAR310_SMII1_IRQ_MASK (1 << 1)
31 36#define SPEAR310_SMII2_IRQ_MASK (1 << 2)
32struct pmx_dev spear310_pmx_emi_cs_0_1_4_5 = { 37#define SPEAR310_SMII3_IRQ_MASK (1 << 3)
33 .name = "emi_cs_0_1_4_5", 38#define SPEAR310_WAKEUP_SMII0_IRQ_MASK (1 << 4)
34 .modes = pmx_emi_cs_0_1_4_5_modes, 39#define SPEAR310_WAKEUP_SMII1_IRQ_MASK (1 << 5)
35 .mode_count = ARRAY_SIZE(pmx_emi_cs_0_1_4_5_modes), 40#define SPEAR310_WAKEUP_SMII2_IRQ_MASK (1 << 6)
36 .enb_on_reset = 1, 41#define SPEAR310_WAKEUP_SMII3_IRQ_MASK (1 << 7)
37}; 42#define SPEAR310_UART1_IRQ_MASK (1 << 8)
38 43#define SPEAR310_UART2_IRQ_MASK (1 << 9)
39static struct pmx_dev_mode pmx_emi_cs_2_3_modes[] = { 44#define SPEAR310_UART3_IRQ_MASK (1 << 10)
40 { 45#define SPEAR310_UART4_IRQ_MASK (1 << 11)
41 .ids = 0x00, 46#define SPEAR310_UART5_IRQ_MASK (1 << 12)
42 .mask = PMX_TIMER_1_2_MASK, 47#define SPEAR310_EMI_IRQ_MASK (1 << 13)
43 }, 48#define SPEAR310_TDM_HDLC_IRQ_MASK (1 << 14)
44}; 49#define SPEAR310_RS485_0_IRQ_MASK (1 << 15)
45 50#define SPEAR310_RS485_1_IRQ_MASK (1 << 16)
46struct pmx_dev spear310_pmx_emi_cs_2_3 = { 51
47 .name = "emi_cs_2_3", 52#define SPEAR310_SHIRQ_RAS1_MASK 0x000FF
48 .modes = pmx_emi_cs_2_3_modes, 53#define SPEAR310_SHIRQ_RAS2_MASK 0x01F00
49 .mode_count = ARRAY_SIZE(pmx_emi_cs_2_3_modes), 54#define SPEAR310_SHIRQ_RAS3_MASK 0x02000
50 .enb_on_reset = 1, 55#define SPEAR310_SHIRQ_INTRCOMM_RAS_MASK 0x1C000
51}; 56
52 57/* SPEAr310 Virtual irq definitions */
53static struct pmx_dev_mode pmx_uart1_modes[] = { 58/* IRQs sharing IRQ_GEN_RAS_1 */
54 { 59#define SPEAR310_VIRQ_SMII0 (SPEAR3XX_VIRQ_START + 0)
55 .ids = 0x00, 60#define SPEAR310_VIRQ_SMII1 (SPEAR3XX_VIRQ_START + 1)
56 .mask = PMX_FIRDA_MASK, 61#define SPEAR310_VIRQ_SMII2 (SPEAR3XX_VIRQ_START + 2)
57 }, 62#define SPEAR310_VIRQ_SMII3 (SPEAR3XX_VIRQ_START + 3)
58}; 63#define SPEAR310_VIRQ_WAKEUP_SMII0 (SPEAR3XX_VIRQ_START + 4)
59 64#define SPEAR310_VIRQ_WAKEUP_SMII1 (SPEAR3XX_VIRQ_START + 5)
60struct pmx_dev spear310_pmx_uart1 = { 65#define SPEAR310_VIRQ_WAKEUP_SMII2 (SPEAR3XX_VIRQ_START + 6)
61 .name = "uart1", 66#define SPEAR310_VIRQ_WAKEUP_SMII3 (SPEAR3XX_VIRQ_START + 7)
62 .modes = pmx_uart1_modes, 67
63 .mode_count = ARRAY_SIZE(pmx_uart1_modes), 68/* IRQs sharing IRQ_GEN_RAS_2 */
64 .enb_on_reset = 1, 69#define SPEAR310_VIRQ_UART1 (SPEAR3XX_VIRQ_START + 8)
65}; 70#define SPEAR310_VIRQ_UART2 (SPEAR3XX_VIRQ_START + 9)
66 71#define SPEAR310_VIRQ_UART3 (SPEAR3XX_VIRQ_START + 10)
67static struct pmx_dev_mode pmx_uart2_modes[] = { 72#define SPEAR310_VIRQ_UART4 (SPEAR3XX_VIRQ_START + 11)
68 { 73#define SPEAR310_VIRQ_UART5 (SPEAR3XX_VIRQ_START + 12)
69 .ids = 0x00, 74
70 .mask = PMX_TIMER_1_2_MASK, 75/* IRQs sharing IRQ_GEN_RAS_3 */
71 }, 76#define SPEAR310_VIRQ_EMI (SPEAR3XX_VIRQ_START + 13)
72}; 77#define SPEAR310_VIRQ_PLGPIO (SPEAR3XX_VIRQ_START + 14)
73 78
74struct pmx_dev spear310_pmx_uart2 = { 79/* IRQs sharing IRQ_INTRCOMM_RAS_ARM */
75 .name = "uart2", 80#define SPEAR310_VIRQ_TDM_HDLC (SPEAR3XX_VIRQ_START + 15)
76 .modes = pmx_uart2_modes, 81#define SPEAR310_VIRQ_RS485_0 (SPEAR3XX_VIRQ_START + 16)
77 .mode_count = ARRAY_SIZE(pmx_uart2_modes), 82#define SPEAR310_VIRQ_RS485_1 (SPEAR3XX_VIRQ_START + 17)
78 .enb_on_reset = 1,
79};
80
81static struct pmx_dev_mode pmx_uart3_4_5_modes[] = {
82 {
83 .ids = 0x00,
84 .mask = PMX_UART0_MODEM_MASK,
85 },
86};
87
88struct pmx_dev spear310_pmx_uart3_4_5 = {
89 .name = "uart3_4_5",
90 .modes = pmx_uart3_4_5_modes,
91 .mode_count = ARRAY_SIZE(pmx_uart3_4_5_modes),
92 .enb_on_reset = 1,
93};
94
95static struct pmx_dev_mode pmx_fsmc_modes[] = {
96 {
97 .ids = 0x00,
98 .mask = PMX_SSP_CS_MASK,
99 },
100};
101
102struct pmx_dev spear310_pmx_fsmc = {
103 .name = "fsmc",
104 .modes = pmx_fsmc_modes,
105 .mode_count = ARRAY_SIZE(pmx_fsmc_modes),
106 .enb_on_reset = 1,
107};
108
109static struct pmx_dev_mode pmx_rs485_0_1_modes[] = {
110 {
111 .ids = 0x00,
112 .mask = PMX_MII_MASK,
113 },
114};
115
116struct pmx_dev spear310_pmx_rs485_0_1 = {
117 .name = "rs485_0_1",
118 .modes = pmx_rs485_0_1_modes,
119 .mode_count = ARRAY_SIZE(pmx_rs485_0_1_modes),
120 .enb_on_reset = 1,
121};
122
123static struct pmx_dev_mode pmx_tdm0_modes[] = {
124 {
125 .ids = 0x00,
126 .mask = PMX_MII_MASK,
127 },
128};
129
130struct pmx_dev spear310_pmx_tdm0 = {
131 .name = "tdm0",
132 .modes = pmx_tdm0_modes,
133 .mode_count = ARRAY_SIZE(pmx_tdm0_modes),
134 .enb_on_reset = 1,
135};
136 83
137/* pmx driver structure */
138static struct pmx_driver pmx_driver = {
139 .mux_reg = {.offset = PAD_MUX_CONFIG_REG, .mask = 0x00007fff},
140};
141 84
142/* spear3xx shared irq */ 85/* spear3xx shared irq */
143static struct shirq_dev_config shirq_ras1_config[] = { 86static struct shirq_dev_config shirq_ras1_config[] = {
@@ -255,17 +198,247 @@ static struct spear_shirq shirq_intrcomm_ras = {
255 }, 198 },
256}; 199};
257 200
258/* Add spear310 specific devices here */ 201/* DMAC platform data's slave info */
202struct pl08x_channel_data spear310_dma_info[] = {
203 {
204 .bus_id = "uart0_rx",
205 .min_signal = 2,
206 .max_signal = 2,
207 .muxval = 0,
208 .cctl = 0,
209 .periph_buses = PL08X_AHB1,
210 }, {
211 .bus_id = "uart0_tx",
212 .min_signal = 3,
213 .max_signal = 3,
214 .muxval = 0,
215 .cctl = 0,
216 .periph_buses = PL08X_AHB1,
217 }, {
218 .bus_id = "ssp0_rx",
219 .min_signal = 8,
220 .max_signal = 8,
221 .muxval = 0,
222 .cctl = 0,
223 .periph_buses = PL08X_AHB1,
224 }, {
225 .bus_id = "ssp0_tx",
226 .min_signal = 9,
227 .max_signal = 9,
228 .muxval = 0,
229 .cctl = 0,
230 .periph_buses = PL08X_AHB1,
231 }, {
232 .bus_id = "i2c_rx",
233 .min_signal = 10,
234 .max_signal = 10,
235 .muxval = 0,
236 .cctl = 0,
237 .periph_buses = PL08X_AHB1,
238 }, {
239 .bus_id = "i2c_tx",
240 .min_signal = 11,
241 .max_signal = 11,
242 .muxval = 0,
243 .cctl = 0,
244 .periph_buses = PL08X_AHB1,
245 }, {
246 .bus_id = "irda",
247 .min_signal = 12,
248 .max_signal = 12,
249 .muxval = 0,
250 .cctl = 0,
251 .periph_buses = PL08X_AHB1,
252 }, {
253 .bus_id = "adc",
254 .min_signal = 13,
255 .max_signal = 13,
256 .muxval = 0,
257 .cctl = 0,
258 .periph_buses = PL08X_AHB1,
259 }, {
260 .bus_id = "to_jpeg",
261 .min_signal = 14,
262 .max_signal = 14,
263 .muxval = 0,
264 .cctl = 0,
265 .periph_buses = PL08X_AHB1,
266 }, {
267 .bus_id = "from_jpeg",
268 .min_signal = 15,
269 .max_signal = 15,
270 .muxval = 0,
271 .cctl = 0,
272 .periph_buses = PL08X_AHB1,
273 }, {
274 .bus_id = "uart1_rx",
275 .min_signal = 0,
276 .max_signal = 0,
277 .muxval = 1,
278 .cctl = 0,
279 .periph_buses = PL08X_AHB1,
280 }, {
281 .bus_id = "uart1_tx",
282 .min_signal = 1,
283 .max_signal = 1,
284 .muxval = 1,
285 .cctl = 0,
286 .periph_buses = PL08X_AHB1,
287 }, {
288 .bus_id = "uart2_rx",
289 .min_signal = 2,
290 .max_signal = 2,
291 .muxval = 1,
292 .cctl = 0,
293 .periph_buses = PL08X_AHB1,
294 }, {
295 .bus_id = "uart2_tx",
296 .min_signal = 3,
297 .max_signal = 3,
298 .muxval = 1,
299 .cctl = 0,
300 .periph_buses = PL08X_AHB1,
301 }, {
302 .bus_id = "uart3_rx",
303 .min_signal = 4,
304 .max_signal = 4,
305 .muxval = 1,
306 .cctl = 0,
307 .periph_buses = PL08X_AHB1,
308 }, {
309 .bus_id = "uart3_tx",
310 .min_signal = 5,
311 .max_signal = 5,
312 .muxval = 1,
313 .cctl = 0,
314 .periph_buses = PL08X_AHB1,
315 }, {
316 .bus_id = "uart4_rx",
317 .min_signal = 6,
318 .max_signal = 6,
319 .muxval = 1,
320 .cctl = 0,
321 .periph_buses = PL08X_AHB1,
322 }, {
323 .bus_id = "uart4_tx",
324 .min_signal = 7,
325 .max_signal = 7,
326 .muxval = 1,
327 .cctl = 0,
328 .periph_buses = PL08X_AHB1,
329 }, {
330 .bus_id = "uart5_rx",
331 .min_signal = 8,
332 .max_signal = 8,
333 .muxval = 1,
334 .cctl = 0,
335 .periph_buses = PL08X_AHB1,
336 }, {
337 .bus_id = "uart5_tx",
338 .min_signal = 9,
339 .max_signal = 9,
340 .muxval = 1,
341 .cctl = 0,
342 .periph_buses = PL08X_AHB1,
343 }, {
344 .bus_id = "ras5_rx",
345 .min_signal = 10,
346 .max_signal = 10,
347 .muxval = 1,
348 .cctl = 0,
349 .periph_buses = PL08X_AHB1,
350 }, {
351 .bus_id = "ras5_tx",
352 .min_signal = 11,
353 .max_signal = 11,
354 .muxval = 1,
355 .cctl = 0,
356 .periph_buses = PL08X_AHB1,
357 }, {
358 .bus_id = "ras6_rx",
359 .min_signal = 12,
360 .max_signal = 12,
361 .muxval = 1,
362 .cctl = 0,
363 .periph_buses = PL08X_AHB1,
364 }, {
365 .bus_id = "ras6_tx",
366 .min_signal = 13,
367 .max_signal = 13,
368 .muxval = 1,
369 .cctl = 0,
370 .periph_buses = PL08X_AHB1,
371 }, {
372 .bus_id = "ras7_rx",
373 .min_signal = 14,
374 .max_signal = 14,
375 .muxval = 1,
376 .cctl = 0,
377 .periph_buses = PL08X_AHB1,
378 }, {
379 .bus_id = "ras7_tx",
380 .min_signal = 15,
381 .max_signal = 15,
382 .muxval = 1,
383 .cctl = 0,
384 .periph_buses = PL08X_AHB1,
385 },
386};
259 387
260/* spear310 routines */ 388/* uart devices plat data */
261void __init spear310_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, 389static struct amba_pl011_data spear310_uart_data[] = {
262 u8 pmx_dev_count) 390 {
391 .dma_filter = pl08x_filter_id,
392 .dma_tx_param = "uart1_tx",
393 .dma_rx_param = "uart1_rx",
394 }, {
395 .dma_filter = pl08x_filter_id,
396 .dma_tx_param = "uart2_tx",
397 .dma_rx_param = "uart2_rx",
398 }, {
399 .dma_filter = pl08x_filter_id,
400 .dma_tx_param = "uart3_tx",
401 .dma_rx_param = "uart3_rx",
402 }, {
403 .dma_filter = pl08x_filter_id,
404 .dma_tx_param = "uart4_tx",
405 .dma_rx_param = "uart4_rx",
406 }, {
407 .dma_filter = pl08x_filter_id,
408 .dma_tx_param = "uart5_tx",
409 .dma_rx_param = "uart5_rx",
410 },
411};
412
413/* Add SPEAr310 auxdata to pass platform data */
414static struct of_dev_auxdata spear310_auxdata_lookup[] __initdata = {
415 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
416 &pl022_plat_data),
417 OF_DEV_AUXDATA("arm,pl080", SPEAR3XX_ICM3_DMA_BASE, NULL,
418 &pl080_plat_data),
419 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART1_BASE, NULL,
420 &spear310_uart_data[0]),
421 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART2_BASE, NULL,
422 &spear310_uart_data[1]),
423 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART3_BASE, NULL,
424 &spear310_uart_data[2]),
425 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART4_BASE, NULL,
426 &spear310_uart_data[3]),
427 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART5_BASE, NULL,
428 &spear310_uart_data[4]),
429 {}
430};
431
432static void __init spear310_dt_init(void)
263{ 433{
264 void __iomem *base; 434 void __iomem *base;
265 int ret = 0; 435 int ret;
266 436
267 /* call spear3xx family common init function */ 437 pl080_plat_data.slave_channels = spear310_dma_info;
268 spear3xx_init(); 438 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear310_dma_info);
439
440 of_platform_populate(NULL, of_default_bus_match_table,
441 spear310_auxdata_lookup, NULL);
269 442
270 /* shared irq registration */ 443 /* shared irq registration */
271 base = ioremap(SPEAR310_SOC_CONFIG_BASE, SZ_4K); 444 base = ioremap(SPEAR310_SOC_CONFIG_BASE, SZ_4K);
@@ -274,35 +447,46 @@ void __init spear310_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
274 shirq_ras1.regs.base = base; 447 shirq_ras1.regs.base = base;
275 ret = spear_shirq_register(&shirq_ras1); 448 ret = spear_shirq_register(&shirq_ras1);
276 if (ret) 449 if (ret)
277 printk(KERN_ERR "Error registering Shared IRQ 1\n"); 450 pr_err("Error registering Shared IRQ 1\n");
278 451
279 /* shirq 2 */ 452 /* shirq 2 */
280 shirq_ras2.regs.base = base; 453 shirq_ras2.regs.base = base;
281 ret = spear_shirq_register(&shirq_ras2); 454 ret = spear_shirq_register(&shirq_ras2);
282 if (ret) 455 if (ret)
283 printk(KERN_ERR "Error registering Shared IRQ 2\n"); 456 pr_err("Error registering Shared IRQ 2\n");
284 457
285 /* shirq 3 */ 458 /* shirq 3 */
286 shirq_ras3.regs.base = base; 459 shirq_ras3.regs.base = base;
287 ret = spear_shirq_register(&shirq_ras3); 460 ret = spear_shirq_register(&shirq_ras3);
288 if (ret) 461 if (ret)
289 printk(KERN_ERR "Error registering Shared IRQ 3\n"); 462 pr_err("Error registering Shared IRQ 3\n");
290 463
291 /* shirq 4 */ 464 /* shirq 4 */
292 shirq_intrcomm_ras.regs.base = base; 465 shirq_intrcomm_ras.regs.base = base;
293 ret = spear_shirq_register(&shirq_intrcomm_ras); 466 ret = spear_shirq_register(&shirq_intrcomm_ras);
294 if (ret) 467 if (ret)
295 printk(KERN_ERR "Error registering Shared IRQ 4\n"); 468 pr_err("Error registering Shared IRQ 4\n");
296 } 469 }
470}
297 471
298 /* pmx initialization */ 472static const char * const spear310_dt_board_compat[] = {
299 pmx_driver.base = base; 473 "st,spear310",
300 pmx_driver.mode = pmx_mode; 474 "st,spear310-evb",
301 pmx_driver.devs = pmx_devs; 475 NULL,
302 pmx_driver.devs_count = pmx_dev_count; 476};
303 477
304 ret = pmx_register(&pmx_driver); 478static void __init spear310_map_io(void)
305 if (ret) 479{
306 printk(KERN_ERR "padmux: registration failed. err no: %d\n", 480 spear3xx_map_io();
307 ret); 481 spear310_clk_init();
308} 482}
483
484DT_MACHINE_START(SPEAR310_DT, "ST SPEAr310 SoC with Flattened Device Tree")
485 .map_io = spear310_map_io,
486 .init_irq = spear3xx_dt_init_irq,
487 .handle_irq = vic_handle_irq,
488 .timer = &spear3xx_timer,
489 .init_machine = spear310_dt_init,
490 .restart = spear_restart,
491 .dt_compat = spear310_dt_board_compat,
492MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear310_evb.c b/arch/arm/mach-spear3xx/spear310_evb.c
deleted file mode 100644
index f92c4993f65a..000000000000
--- a/arch/arm/mach-spear3xx/spear310_evb.c
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/spear310_evb.c
3 *
4 * SPEAr310 evaluation board source file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <asm/hardware/vic.h>
15#include <asm/mach/arch.h>
16#include <asm/mach-types.h>
17#include <mach/generic.h>
18#include <mach/hardware.h>
19
20/* padmux devices to enable */
21static struct pmx_dev *pmx_devs[] = {
22 /* spear3xx specific devices */
23 &spear3xx_pmx_i2c,
24 &spear3xx_pmx_ssp,
25 &spear3xx_pmx_gpio_pin0,
26 &spear3xx_pmx_gpio_pin1,
27 &spear3xx_pmx_gpio_pin2,
28 &spear3xx_pmx_gpio_pin3,
29 &spear3xx_pmx_gpio_pin4,
30 &spear3xx_pmx_gpio_pin5,
31 &spear3xx_pmx_uart0,
32
33 /* spear310 specific devices */
34 &spear310_pmx_emi_cs_0_1_4_5,
35 &spear310_pmx_emi_cs_2_3,
36 &spear310_pmx_uart1,
37 &spear310_pmx_uart2,
38 &spear310_pmx_uart3_4_5,
39 &spear310_pmx_fsmc,
40 &spear310_pmx_rs485_0_1,
41 &spear310_pmx_tdm0,
42};
43
44static struct amba_device *amba_devs[] __initdata = {
45 /* spear3xx specific devices */
46 &spear3xx_gpio_device,
47 &spear3xx_uart_device,
48
49 /* spear310 specific devices */
50};
51
52static struct platform_device *plat_devs[] __initdata = {
53 /* spear3xx specific devices */
54
55 /* spear310 specific devices */
56};
57
58static void __init spear310_evb_init(void)
59{
60 unsigned int i;
61
62 /* call spear310 machine init function */
63 spear310_init(NULL, pmx_devs, ARRAY_SIZE(pmx_devs));
64
65 /* Add Platform Devices */
66 platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
67
68 /* Add Amba Devices */
69 for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
70 amba_device_register(amba_devs[i], &iomem_resource);
71}
72
73MACHINE_START(SPEAR310, "ST-SPEAR310-EVB")
74 .atag_offset = 0x100,
75 .map_io = spear3xx_map_io,
76 .init_irq = spear3xx_init_irq,
77 .handle_irq = vic_handle_irq,
78 .timer = &spear3xx_timer,
79 .init_machine = spear310_evb_init,
80 .restart = spear_restart,
81MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear320.c b/arch/arm/mach-spear3xx/spear320.c
index deaaf199612c..e8caeef50a5c 100644
--- a/arch/arm/mach-spear3xx/spear320.c
+++ b/arch/arm/mach-spear3xx/spear320.c
@@ -3,386 +3,85 @@
3 * 3 *
4 * SPEAr320 machine source file 4 * SPEAr320 machine source file
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.kumar@st.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied. 11 * warranty of any kind, whether express or implied.
12 */ 12 */
13 13
14#include <linux/ptrace.h> 14#define pr_fmt(fmt) "SPEAr320: " fmt
15#include <asm/irq.h> 15
16#include <linux/amba/pl022.h>
17#include <linux/amba/pl08x.h>
18#include <linux/amba/serial.h>
19#include <linux/of_platform.h>
20#include <asm/hardware/vic.h>
21#include <asm/mach/arch.h>
16#include <plat/shirq.h> 22#include <plat/shirq.h>
17#include <mach/generic.h> 23#include <mach/generic.h>
18#include <mach/hardware.h> 24#include <mach/spear.h>
19 25
20/* pad multiplexing support */ 26#define SPEAR320_UART1_BASE UL(0xA3000000)
21/* muxing registers */ 27#define SPEAR320_UART2_BASE UL(0xA4000000)
22#define PAD_MUX_CONFIG_REG 0x0C 28#define SPEAR320_SSP0_BASE UL(0xA5000000)
23#define MODE_CONFIG_REG 0x10 29#define SPEAR320_SSP1_BASE UL(0xA6000000)
24 30#define SPEAR320_SOC_CONFIG_BASE UL(0xB3000000)
25/* modes */ 31
26#define AUTO_NET_SMII_MODE (1 << 0) 32/* Interrupt registers offsets and masks */
27#define AUTO_NET_MII_MODE (1 << 1) 33#define SPEAR320_INT_STS_MASK_REG 0x04
28#define AUTO_EXP_MODE (1 << 2) 34#define SPEAR320_INT_CLR_MASK_REG 0x04
29#define SMALL_PRINTERS_MODE (1 << 3) 35#define SPEAR320_INT_ENB_MASK_REG 0x08
30#define ALL_MODES 0xF 36#define SPEAR320_GPIO_IRQ_MASK (1 << 0)
31 37#define SPEAR320_I2S_PLAY_IRQ_MASK (1 << 1)
32struct pmx_mode spear320_auto_net_smii_mode = { 38#define SPEAR320_I2S_REC_IRQ_MASK (1 << 2)
33 .id = AUTO_NET_SMII_MODE, 39#define SPEAR320_EMI_IRQ_MASK (1 << 7)
34 .name = "Automation Networking SMII Mode", 40#define SPEAR320_CLCD_IRQ_MASK (1 << 8)
35 .mask = 0x00, 41#define SPEAR320_SPP_IRQ_MASK (1 << 9)
36}; 42#define SPEAR320_SDHCI_IRQ_MASK (1 << 10)
37 43#define SPEAR320_CAN_U_IRQ_MASK (1 << 11)
38struct pmx_mode spear320_auto_net_mii_mode = { 44#define SPEAR320_CAN_L_IRQ_MASK (1 << 12)
39 .id = AUTO_NET_MII_MODE, 45#define SPEAR320_UART1_IRQ_MASK (1 << 13)
40 .name = "Automation Networking MII Mode", 46#define SPEAR320_UART2_IRQ_MASK (1 << 14)
41 .mask = 0x01, 47#define SPEAR320_SSP1_IRQ_MASK (1 << 15)
42}; 48#define SPEAR320_SSP2_IRQ_MASK (1 << 16)
43 49#define SPEAR320_SMII0_IRQ_MASK (1 << 17)
44struct pmx_mode spear320_auto_exp_mode = { 50#define SPEAR320_MII1_SMII1_IRQ_MASK (1 << 18)
45 .id = AUTO_EXP_MODE, 51#define SPEAR320_WAKEUP_SMII0_IRQ_MASK (1 << 19)
46 .name = "Automation Expanded Mode", 52#define SPEAR320_WAKEUP_MII1_SMII1_IRQ_MASK (1 << 20)
47 .mask = 0x02, 53#define SPEAR320_I2C1_IRQ_MASK (1 << 21)
48}; 54
49 55#define SPEAR320_SHIRQ_RAS1_MASK 0x000380
50struct pmx_mode spear320_small_printers_mode = { 56#define SPEAR320_SHIRQ_RAS3_MASK 0x000007
51 .id = SMALL_PRINTERS_MODE, 57#define SPEAR320_SHIRQ_INTRCOMM_RAS_MASK 0x3FF800
52 .name = "Small Printers Mode", 58
53 .mask = 0x03, 59/* SPEAr320 Virtual irq definitions */
54}; 60/* IRQs sharing IRQ_GEN_RAS_1 */
55 61#define SPEAR320_VIRQ_EMI (SPEAR3XX_VIRQ_START + 0)
56/* devices */ 62#define SPEAR320_VIRQ_CLCD (SPEAR3XX_VIRQ_START + 1)
57static struct pmx_dev_mode pmx_clcd_modes[] = { 63#define SPEAR320_VIRQ_SPP (SPEAR3XX_VIRQ_START + 2)
58 { 64
59 .ids = AUTO_NET_SMII_MODE, 65/* IRQs sharing IRQ_GEN_RAS_2 */
60 .mask = 0x0, 66#define SPEAR320_IRQ_SDHCI SPEAR3XX_IRQ_GEN_RAS_2
61 }, 67
62}; 68/* IRQs sharing IRQ_GEN_RAS_3 */
63 69#define SPEAR320_VIRQ_PLGPIO (SPEAR3XX_VIRQ_START + 3)
64struct pmx_dev spear320_pmx_clcd = { 70#define SPEAR320_VIRQ_I2S_PLAY (SPEAR3XX_VIRQ_START + 4)
65 .name = "clcd", 71#define SPEAR320_VIRQ_I2S_REC (SPEAR3XX_VIRQ_START + 5)
66 .modes = pmx_clcd_modes, 72
67 .mode_count = ARRAY_SIZE(pmx_clcd_modes), 73/* IRQs sharing IRQ_INTRCOMM_RAS_ARM */
68 .enb_on_reset = 1, 74#define SPEAR320_VIRQ_CANU (SPEAR3XX_VIRQ_START + 6)
69}; 75#define SPEAR320_VIRQ_CANL (SPEAR3XX_VIRQ_START + 7)
70 76#define SPEAR320_VIRQ_UART1 (SPEAR3XX_VIRQ_START + 8)
71static struct pmx_dev_mode pmx_emi_modes[] = { 77#define SPEAR320_VIRQ_UART2 (SPEAR3XX_VIRQ_START + 9)
72 { 78#define SPEAR320_VIRQ_SSP1 (SPEAR3XX_VIRQ_START + 10)
73 .ids = AUTO_EXP_MODE, 79#define SPEAR320_VIRQ_SSP2 (SPEAR3XX_VIRQ_START + 11)
74 .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK, 80#define SPEAR320_VIRQ_SMII0 (SPEAR3XX_VIRQ_START + 12)
75 }, 81#define SPEAR320_VIRQ_MII1_SMII1 (SPEAR3XX_VIRQ_START + 13)
76}; 82#define SPEAR320_VIRQ_WAKEUP_SMII0 (SPEAR3XX_VIRQ_START + 14)
77 83#define SPEAR320_VIRQ_WAKEUP_MII1_SMII1 (SPEAR3XX_VIRQ_START + 15)
78struct pmx_dev spear320_pmx_emi = { 84#define SPEAR320_VIRQ_I2C1 (SPEAR3XX_VIRQ_START + 16)
79 .name = "emi",
80 .modes = pmx_emi_modes,
81 .mode_count = ARRAY_SIZE(pmx_emi_modes),
82 .enb_on_reset = 1,
83};
84
85static struct pmx_dev_mode pmx_fsmc_modes[] = {
86 {
87 .ids = ALL_MODES,
88 .mask = 0x0,
89 },
90};
91
92struct pmx_dev spear320_pmx_fsmc = {
93 .name = "fsmc",
94 .modes = pmx_fsmc_modes,
95 .mode_count = ARRAY_SIZE(pmx_fsmc_modes),
96 .enb_on_reset = 1,
97};
98
99static struct pmx_dev_mode pmx_spp_modes[] = {
100 {
101 .ids = SMALL_PRINTERS_MODE,
102 .mask = 0x0,
103 },
104};
105
106struct pmx_dev spear320_pmx_spp = {
107 .name = "spp",
108 .modes = pmx_spp_modes,
109 .mode_count = ARRAY_SIZE(pmx_spp_modes),
110 .enb_on_reset = 1,
111};
112
113static struct pmx_dev_mode pmx_sdhci_modes[] = {
114 {
115 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE |
116 SMALL_PRINTERS_MODE,
117 .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK,
118 },
119};
120
121struct pmx_dev spear320_pmx_sdhci = {
122 .name = "sdhci",
123 .modes = pmx_sdhci_modes,
124 .mode_count = ARRAY_SIZE(pmx_sdhci_modes),
125 .enb_on_reset = 1,
126};
127
128static struct pmx_dev_mode pmx_i2s_modes[] = {
129 {
130 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE,
131 .mask = PMX_UART0_MODEM_MASK,
132 },
133};
134
135struct pmx_dev spear320_pmx_i2s = {
136 .name = "i2s",
137 .modes = pmx_i2s_modes,
138 .mode_count = ARRAY_SIZE(pmx_i2s_modes),
139 .enb_on_reset = 1,
140};
141
142static struct pmx_dev_mode pmx_uart1_modes[] = {
143 {
144 .ids = ALL_MODES,
145 .mask = PMX_GPIO_PIN0_MASK | PMX_GPIO_PIN1_MASK,
146 },
147};
148
149struct pmx_dev spear320_pmx_uart1 = {
150 .name = "uart1",
151 .modes = pmx_uart1_modes,
152 .mode_count = ARRAY_SIZE(pmx_uart1_modes),
153 .enb_on_reset = 1,
154};
155
156static struct pmx_dev_mode pmx_uart1_modem_modes[] = {
157 {
158 .ids = AUTO_EXP_MODE,
159 .mask = PMX_TIMER_1_2_MASK | PMX_TIMER_3_4_MASK |
160 PMX_SSP_CS_MASK,
161 }, {
162 .ids = SMALL_PRINTERS_MODE,
163 .mask = PMX_GPIO_PIN3_MASK | PMX_GPIO_PIN4_MASK |
164 PMX_GPIO_PIN5_MASK | PMX_SSP_CS_MASK,
165 },
166};
167
168struct pmx_dev spear320_pmx_uart1_modem = {
169 .name = "uart1_modem",
170 .modes = pmx_uart1_modem_modes,
171 .mode_count = ARRAY_SIZE(pmx_uart1_modem_modes),
172 .enb_on_reset = 1,
173};
174
175static struct pmx_dev_mode pmx_uart2_modes[] = {
176 {
177 .ids = ALL_MODES,
178 .mask = PMX_FIRDA_MASK,
179 },
180};
181
182struct pmx_dev spear320_pmx_uart2 = {
183 .name = "uart2",
184 .modes = pmx_uart2_modes,
185 .mode_count = ARRAY_SIZE(pmx_uart2_modes),
186 .enb_on_reset = 1,
187};
188
189static struct pmx_dev_mode pmx_touchscreen_modes[] = {
190 {
191 .ids = AUTO_NET_SMII_MODE,
192 .mask = PMX_SSP_CS_MASK,
193 },
194};
195
196struct pmx_dev spear320_pmx_touchscreen = {
197 .name = "touchscreen",
198 .modes = pmx_touchscreen_modes,
199 .mode_count = ARRAY_SIZE(pmx_touchscreen_modes),
200 .enb_on_reset = 1,
201};
202
203static struct pmx_dev_mode pmx_can_modes[] = {
204 {
205 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE | AUTO_EXP_MODE,
206 .mask = PMX_GPIO_PIN2_MASK | PMX_GPIO_PIN3_MASK |
207 PMX_GPIO_PIN4_MASK | PMX_GPIO_PIN5_MASK,
208 },
209};
210
211struct pmx_dev spear320_pmx_can = {
212 .name = "can",
213 .modes = pmx_can_modes,
214 .mode_count = ARRAY_SIZE(pmx_can_modes),
215 .enb_on_reset = 1,
216};
217
218static struct pmx_dev_mode pmx_sdhci_led_modes[] = {
219 {
220 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE,
221 .mask = PMX_SSP_CS_MASK,
222 },
223};
224
225struct pmx_dev spear320_pmx_sdhci_led = {
226 .name = "sdhci_led",
227 .modes = pmx_sdhci_led_modes,
228 .mode_count = ARRAY_SIZE(pmx_sdhci_led_modes),
229 .enb_on_reset = 1,
230};
231
232static struct pmx_dev_mode pmx_pwm0_modes[] = {
233 {
234 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE,
235 .mask = PMX_UART0_MODEM_MASK,
236 }, {
237 .ids = AUTO_EXP_MODE | SMALL_PRINTERS_MODE,
238 .mask = PMX_MII_MASK,
239 },
240};
241
242struct pmx_dev spear320_pmx_pwm0 = {
243 .name = "pwm0",
244 .modes = pmx_pwm0_modes,
245 .mode_count = ARRAY_SIZE(pmx_pwm0_modes),
246 .enb_on_reset = 1,
247};
248
249static struct pmx_dev_mode pmx_pwm1_modes[] = {
250 {
251 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE,
252 .mask = PMX_UART0_MODEM_MASK,
253 }, {
254 .ids = AUTO_EXP_MODE | SMALL_PRINTERS_MODE,
255 .mask = PMX_MII_MASK,
256 },
257};
258
259struct pmx_dev spear320_pmx_pwm1 = {
260 .name = "pwm1",
261 .modes = pmx_pwm1_modes,
262 .mode_count = ARRAY_SIZE(pmx_pwm1_modes),
263 .enb_on_reset = 1,
264};
265
266static struct pmx_dev_mode pmx_pwm2_modes[] = {
267 {
268 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE,
269 .mask = PMX_SSP_CS_MASK,
270 }, {
271 .ids = AUTO_EXP_MODE | SMALL_PRINTERS_MODE,
272 .mask = PMX_MII_MASK,
273 },
274};
275
276struct pmx_dev spear320_pmx_pwm2 = {
277 .name = "pwm2",
278 .modes = pmx_pwm2_modes,
279 .mode_count = ARRAY_SIZE(pmx_pwm2_modes),
280 .enb_on_reset = 1,
281};
282
283static struct pmx_dev_mode pmx_pwm3_modes[] = {
284 {
285 .ids = AUTO_EXP_MODE | SMALL_PRINTERS_MODE | AUTO_NET_SMII_MODE,
286 .mask = PMX_MII_MASK,
287 },
288};
289
290struct pmx_dev spear320_pmx_pwm3 = {
291 .name = "pwm3",
292 .modes = pmx_pwm3_modes,
293 .mode_count = ARRAY_SIZE(pmx_pwm3_modes),
294 .enb_on_reset = 1,
295};
296
297static struct pmx_dev_mode pmx_ssp1_modes[] = {
298 {
299 .ids = SMALL_PRINTERS_MODE | AUTO_NET_SMII_MODE,
300 .mask = PMX_MII_MASK,
301 },
302};
303
304struct pmx_dev spear320_pmx_ssp1 = {
305 .name = "ssp1",
306 .modes = pmx_ssp1_modes,
307 .mode_count = ARRAY_SIZE(pmx_ssp1_modes),
308 .enb_on_reset = 1,
309};
310
311static struct pmx_dev_mode pmx_ssp2_modes[] = {
312 {
313 .ids = AUTO_NET_SMII_MODE,
314 .mask = PMX_MII_MASK,
315 },
316};
317
318struct pmx_dev spear320_pmx_ssp2 = {
319 .name = "ssp2",
320 .modes = pmx_ssp2_modes,
321 .mode_count = ARRAY_SIZE(pmx_ssp2_modes),
322 .enb_on_reset = 1,
323};
324
325static struct pmx_dev_mode pmx_mii1_modes[] = {
326 {
327 .ids = AUTO_NET_MII_MODE,
328 .mask = 0x0,
329 },
330};
331
332struct pmx_dev spear320_pmx_mii1 = {
333 .name = "mii1",
334 .modes = pmx_mii1_modes,
335 .mode_count = ARRAY_SIZE(pmx_mii1_modes),
336 .enb_on_reset = 1,
337};
338
339static struct pmx_dev_mode pmx_smii0_modes[] = {
340 {
341 .ids = AUTO_NET_SMII_MODE | AUTO_EXP_MODE | SMALL_PRINTERS_MODE,
342 .mask = PMX_MII_MASK,
343 },
344};
345
346struct pmx_dev spear320_pmx_smii0 = {
347 .name = "smii0",
348 .modes = pmx_smii0_modes,
349 .mode_count = ARRAY_SIZE(pmx_smii0_modes),
350 .enb_on_reset = 1,
351};
352
353static struct pmx_dev_mode pmx_smii1_modes[] = {
354 {
355 .ids = AUTO_NET_SMII_MODE | SMALL_PRINTERS_MODE,
356 .mask = PMX_MII_MASK,
357 },
358};
359
360struct pmx_dev spear320_pmx_smii1 = {
361 .name = "smii1",
362 .modes = pmx_smii1_modes,
363 .mode_count = ARRAY_SIZE(pmx_smii1_modes),
364 .enb_on_reset = 1,
365};
366
367static struct pmx_dev_mode pmx_i2c1_modes[] = {
368 {
369 .ids = AUTO_EXP_MODE,
370 .mask = 0x0,
371 },
372};
373
374struct pmx_dev spear320_pmx_i2c1 = {
375 .name = "i2c1",
376 .modes = pmx_i2c1_modes,
377 .mode_count = ARRAY_SIZE(pmx_i2c1_modes),
378 .enb_on_reset = 1,
379};
380
381/* pmx driver structure */
382static struct pmx_driver pmx_driver = {
383 .mode_reg = {.offset = MODE_CONFIG_REG, .mask = 0x00000007},
384 .mux_reg = {.offset = PAD_MUX_CONFIG_REG, .mask = 0x00007fff},
385};
386 85
387/* spear3xx shared irq */ 86/* spear3xx shared irq */
388static struct shirq_dev_config shirq_ras1_config[] = { 87static struct shirq_dev_config shirq_ras1_config[] = {
@@ -508,17 +207,250 @@ static struct spear_shirq shirq_intrcomm_ras = {
508 }, 207 },
509}; 208};
510 209
511/* Add spear320 specific devices here */ 210/* DMAC platform data's slave info */
211struct pl08x_channel_data spear320_dma_info[] = {
212 {
213 .bus_id = "uart0_rx",
214 .min_signal = 2,
215 .max_signal = 2,
216 .muxval = 0,
217 .cctl = 0,
218 .periph_buses = PL08X_AHB1,
219 }, {
220 .bus_id = "uart0_tx",
221 .min_signal = 3,
222 .max_signal = 3,
223 .muxval = 0,
224 .cctl = 0,
225 .periph_buses = PL08X_AHB1,
226 }, {
227 .bus_id = "ssp0_rx",
228 .min_signal = 8,
229 .max_signal = 8,
230 .muxval = 0,
231 .cctl = 0,
232 .periph_buses = PL08X_AHB1,
233 }, {
234 .bus_id = "ssp0_tx",
235 .min_signal = 9,
236 .max_signal = 9,
237 .muxval = 0,
238 .cctl = 0,
239 .periph_buses = PL08X_AHB1,
240 }, {
241 .bus_id = "i2c0_rx",
242 .min_signal = 10,
243 .max_signal = 10,
244 .muxval = 0,
245 .cctl = 0,
246 .periph_buses = PL08X_AHB1,
247 }, {
248 .bus_id = "i2c0_tx",
249 .min_signal = 11,
250 .max_signal = 11,
251 .muxval = 0,
252 .cctl = 0,
253 .periph_buses = PL08X_AHB1,
254 }, {
255 .bus_id = "irda",
256 .min_signal = 12,
257 .max_signal = 12,
258 .muxval = 0,
259 .cctl = 0,
260 .periph_buses = PL08X_AHB1,
261 }, {
262 .bus_id = "adc",
263 .min_signal = 13,
264 .max_signal = 13,
265 .muxval = 0,
266 .cctl = 0,
267 .periph_buses = PL08X_AHB1,
268 }, {
269 .bus_id = "to_jpeg",
270 .min_signal = 14,
271 .max_signal = 14,
272 .muxval = 0,
273 .cctl = 0,
274 .periph_buses = PL08X_AHB1,
275 }, {
276 .bus_id = "from_jpeg",
277 .min_signal = 15,
278 .max_signal = 15,
279 .muxval = 0,
280 .cctl = 0,
281 .periph_buses = PL08X_AHB1,
282 }, {
283 .bus_id = "ssp1_rx",
284 .min_signal = 0,
285 .max_signal = 0,
286 .muxval = 1,
287 .cctl = 0,
288 .periph_buses = PL08X_AHB2,
289 }, {
290 .bus_id = "ssp1_tx",
291 .min_signal = 1,
292 .max_signal = 1,
293 .muxval = 1,
294 .cctl = 0,
295 .periph_buses = PL08X_AHB2,
296 }, {
297 .bus_id = "ssp2_rx",
298 .min_signal = 2,
299 .max_signal = 2,
300 .muxval = 1,
301 .cctl = 0,
302 .periph_buses = PL08X_AHB2,
303 }, {
304 .bus_id = "ssp2_tx",
305 .min_signal = 3,
306 .max_signal = 3,
307 .muxval = 1,
308 .cctl = 0,
309 .periph_buses = PL08X_AHB2,
310 }, {
311 .bus_id = "uart1_rx",
312 .min_signal = 4,
313 .max_signal = 4,
314 .muxval = 1,
315 .cctl = 0,
316 .periph_buses = PL08X_AHB2,
317 }, {
318 .bus_id = "uart1_tx",
319 .min_signal = 5,
320 .max_signal = 5,
321 .muxval = 1,
322 .cctl = 0,
323 .periph_buses = PL08X_AHB2,
324 }, {
325 .bus_id = "uart2_rx",
326 .min_signal = 6,
327 .max_signal = 6,
328 .muxval = 1,
329 .cctl = 0,
330 .periph_buses = PL08X_AHB2,
331 }, {
332 .bus_id = "uart2_tx",
333 .min_signal = 7,
334 .max_signal = 7,
335 .muxval = 1,
336 .cctl = 0,
337 .periph_buses = PL08X_AHB2,
338 }, {
339 .bus_id = "i2c1_rx",
340 .min_signal = 8,
341 .max_signal = 8,
342 .muxval = 1,
343 .cctl = 0,
344 .periph_buses = PL08X_AHB2,
345 }, {
346 .bus_id = "i2c1_tx",
347 .min_signal = 9,
348 .max_signal = 9,
349 .muxval = 1,
350 .cctl = 0,
351 .periph_buses = PL08X_AHB2,
352 }, {
353 .bus_id = "i2c2_rx",
354 .min_signal = 10,
355 .max_signal = 10,
356 .muxval = 1,
357 .cctl = 0,
358 .periph_buses = PL08X_AHB2,
359 }, {
360 .bus_id = "i2c2_tx",
361 .min_signal = 11,
362 .max_signal = 11,
363 .muxval = 1,
364 .cctl = 0,
365 .periph_buses = PL08X_AHB2,
366 }, {
367 .bus_id = "i2s_rx",
368 .min_signal = 12,
369 .max_signal = 12,
370 .muxval = 1,
371 .cctl = 0,
372 .periph_buses = PL08X_AHB2,
373 }, {
374 .bus_id = "i2s_tx",
375 .min_signal = 13,
376 .max_signal = 13,
377 .muxval = 1,
378 .cctl = 0,
379 .periph_buses = PL08X_AHB2,
380 }, {
381 .bus_id = "rs485_rx",
382 .min_signal = 14,
383 .max_signal = 14,
384 .muxval = 1,
385 .cctl = 0,
386 .periph_buses = PL08X_AHB2,
387 }, {
388 .bus_id = "rs485_tx",
389 .min_signal = 15,
390 .max_signal = 15,
391 .muxval = 1,
392 .cctl = 0,
393 .periph_buses = PL08X_AHB2,
394 },
395};
396
397static struct pl022_ssp_controller spear320_ssp_data[] = {
398 {
399 .bus_id = 1,
400 .enable_dma = 1,
401 .dma_filter = pl08x_filter_id,
402 .dma_tx_param = "ssp1_tx",
403 .dma_rx_param = "ssp1_rx",
404 .num_chipselect = 2,
405 }, {
406 .bus_id = 2,
407 .enable_dma = 1,
408 .dma_filter = pl08x_filter_id,
409 .dma_tx_param = "ssp2_tx",
410 .dma_rx_param = "ssp2_rx",
411 .num_chipselect = 2,
412 }
413};
414
415static struct amba_pl011_data spear320_uart_data[] = {
416 {
417 .dma_filter = pl08x_filter_id,
418 .dma_tx_param = "uart1_tx",
419 .dma_rx_param = "uart1_rx",
420 }, {
421 .dma_filter = pl08x_filter_id,
422 .dma_tx_param = "uart2_tx",
423 .dma_rx_param = "uart2_rx",
424 },
425};
512 426
513/* spear320 routines */ 427/* Add SPEAr310 auxdata to pass platform data */
514void __init spear320_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, 428static struct of_dev_auxdata spear320_auxdata_lookup[] __initdata = {
515 u8 pmx_dev_count) 429 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
430 &pl022_plat_data),
431 OF_DEV_AUXDATA("arm,pl080", SPEAR3XX_ICM3_DMA_BASE, NULL,
432 &pl080_plat_data),
433 OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP0_BASE, NULL,
434 &spear320_ssp_data[0]),
435 OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP1_BASE, NULL,
436 &spear320_ssp_data[1]),
437 OF_DEV_AUXDATA("arm,pl011", SPEAR320_UART1_BASE, NULL,
438 &spear320_uart_data[0]),
439 OF_DEV_AUXDATA("arm,pl011", SPEAR320_UART2_BASE, NULL,
440 &spear320_uart_data[1]),
441 {}
442};
443
444static void __init spear320_dt_init(void)
516{ 445{
517 void __iomem *base; 446 void __iomem *base;
518 int ret = 0; 447 int ret;
448
449 pl080_plat_data.slave_channels = spear320_dma_info;
450 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear320_dma_info);
519 451
520 /* call spear3xx family common init function */ 452 of_platform_populate(NULL, of_default_bus_match_table,
521 spear3xx_init(); 453 spear320_auxdata_lookup, NULL);
522 454
523 /* shared irq registration */ 455 /* shared irq registration */
524 base = ioremap(SPEAR320_SOC_CONFIG_BASE, SZ_4K); 456 base = ioremap(SPEAR320_SOC_CONFIG_BASE, SZ_4K);
@@ -527,29 +459,40 @@ void __init spear320_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
527 shirq_ras1.regs.base = base; 459 shirq_ras1.regs.base = base;
528 ret = spear_shirq_register(&shirq_ras1); 460 ret = spear_shirq_register(&shirq_ras1);
529 if (ret) 461 if (ret)
530 printk(KERN_ERR "Error registering Shared IRQ 1\n"); 462 pr_err("Error registering Shared IRQ 1\n");
531 463
532 /* shirq 3 */ 464 /* shirq 3 */
533 shirq_ras3.regs.base = base; 465 shirq_ras3.regs.base = base;
534 ret = spear_shirq_register(&shirq_ras3); 466 ret = spear_shirq_register(&shirq_ras3);
535 if (ret) 467 if (ret)
536 printk(KERN_ERR "Error registering Shared IRQ 3\n"); 468 pr_err("Error registering Shared IRQ 3\n");
537 469
538 /* shirq 4 */ 470 /* shirq 4 */
539 shirq_intrcomm_ras.regs.base = base; 471 shirq_intrcomm_ras.regs.base = base;
540 ret = spear_shirq_register(&shirq_intrcomm_ras); 472 ret = spear_shirq_register(&shirq_intrcomm_ras);
541 if (ret) 473 if (ret)
542 printk(KERN_ERR "Error registering Shared IRQ 4\n"); 474 pr_err("Error registering Shared IRQ 4\n");
543 } 475 }
476}
544 477
545 /* pmx initialization */ 478static const char * const spear320_dt_board_compat[] = {
546 pmx_driver.base = base; 479 "st,spear320",
547 pmx_driver.mode = pmx_mode; 480 "st,spear320-evb",
548 pmx_driver.devs = pmx_devs; 481 NULL,
549 pmx_driver.devs_count = pmx_dev_count; 482};
550 483
551 ret = pmx_register(&pmx_driver); 484static void __init spear320_map_io(void)
552 if (ret) 485{
553 printk(KERN_ERR "padmux: registration failed. err no: %d\n", 486 spear3xx_map_io();
554 ret); 487 spear320_clk_init();
555} 488}
489
490DT_MACHINE_START(SPEAR320_DT, "ST SPEAr320 SoC with Flattened Device Tree")
491 .map_io = spear320_map_io,
492 .init_irq = spear3xx_dt_init_irq,
493 .handle_irq = vic_handle_irq,
494 .timer = &spear3xx_timer,
495 .init_machine = spear320_dt_init,
496 .restart = spear_restart,
497 .dt_compat = spear320_dt_board_compat,
498MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear320_evb.c b/arch/arm/mach-spear3xx/spear320_evb.c
deleted file mode 100644
index 105334ab7021..000000000000
--- a/arch/arm/mach-spear3xx/spear320_evb.c
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/spear320_evb.c
3 *
4 * SPEAr320 evaluation board source file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <asm/hardware/vic.h>
15#include <asm/mach/arch.h>
16#include <asm/mach-types.h>
17#include <mach/generic.h>
18#include <mach/hardware.h>
19
20/* padmux devices to enable */
21static struct pmx_dev *pmx_devs[] = {
22 /* spear3xx specific devices */
23 &spear3xx_pmx_i2c,
24 &spear3xx_pmx_ssp,
25 &spear3xx_pmx_mii,
26 &spear3xx_pmx_uart0,
27
28 /* spear320 specific devices */
29 &spear320_pmx_fsmc,
30 &spear320_pmx_sdhci,
31 &spear320_pmx_i2s,
32 &spear320_pmx_uart1,
33 &spear320_pmx_uart2,
34 &spear320_pmx_can,
35 &spear320_pmx_pwm0,
36 &spear320_pmx_pwm1,
37 &spear320_pmx_pwm2,
38 &spear320_pmx_mii1,
39};
40
41static struct amba_device *amba_devs[] __initdata = {
42 /* spear3xx specific devices */
43 &spear3xx_gpio_device,
44 &spear3xx_uart_device,
45
46 /* spear320 specific devices */
47};
48
49static struct platform_device *plat_devs[] __initdata = {
50 /* spear3xx specific devices */
51
52 /* spear320 specific devices */
53};
54
55static void __init spear320_evb_init(void)
56{
57 unsigned int i;
58
59 /* call spear320 machine init function */
60 spear320_init(&spear320_auto_net_mii_mode, pmx_devs,
61 ARRAY_SIZE(pmx_devs));
62
63 /* Add Platform Devices */
64 platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
65
66 /* Add Amba Devices */
67 for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
68 amba_device_register(amba_devs[i], &iomem_resource);
69}
70
71MACHINE_START(SPEAR320, "ST-SPEAR320-EVB")
72 .atag_offset = 0x100,
73 .map_io = spear3xx_map_io,
74 .init_irq = spear3xx_init_irq,
75 .handle_irq = vic_handle_irq,
76 .timer = &spear3xx_timer,
77 .init_machine = spear320_evb_init,
78 .restart = spear_restart,
79MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear3xx.c b/arch/arm/mach-spear3xx/spear3xx.c
index b1733c37f209..826ac20ef1e7 100644
--- a/arch/arm/mach-spear3xx/spear3xx.c
+++ b/arch/arm/mach-spear3xx/spear3xx.c
@@ -3,71 +3,78 @@
3 * 3 *
4 * SPEAr3XX machines common source file 4 * SPEAr3XX machines common source file
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com> 7 * Viresh Kumar <viresh.kumar@st.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied. 11 * warranty of any kind, whether express or implied.
12 */ 12 */
13 13
14#include <linux/types.h> 14#define pr_fmt(fmt) "SPEAr3xx: " fmt
15#include <linux/amba/pl061.h> 15
16#include <linux/ptrace.h> 16#include <linux/amba/pl022.h>
17#include <linux/amba/pl08x.h>
18#include <linux/of_irq.h>
17#include <linux/io.h> 19#include <linux/io.h>
20#include <asm/hardware/pl080.h>
18#include <asm/hardware/vic.h> 21#include <asm/hardware/vic.h>
19#include <asm/irq.h> 22#include <plat/pl080.h>
20#include <asm/mach/arch.h>
21#include <mach/generic.h> 23#include <mach/generic.h>
22#include <mach/hardware.h> 24#include <mach/spear.h>
23 25
24/* Add spear3xx machines common devices here */ 26/* ssp device registration */
25/* gpio device registration */ 27struct pl022_ssp_controller pl022_plat_data = {
26static struct pl061_platform_data gpio_plat_data = { 28 .bus_id = 0,
27 .gpio_base = 0, 29 .enable_dma = 1,
28 .irq_base = SPEAR3XX_GPIO_INT_BASE, 30 .dma_filter = pl08x_filter_id,
31 .dma_tx_param = "ssp0_tx",
32 .dma_rx_param = "ssp0_rx",
33 /*
34 * This is number of spi devices that can be connected to spi. There are
35 * two type of chipselects on which slave devices can work. One is chip
36 * select provided by spi masters other is controlled through external
37 * gpio's. We can't use chipselect provided from spi master (because as
38 * soon as FIFO becomes empty, CS is disabled and transfer ends). So
39 * this number now depends on number of gpios available for spi. each
40 * slave on each master requires a separate gpio pin.
41 */
42 .num_chipselect = 2,
43};
44
45/* dmac device registration */
46struct pl08x_platform_data pl080_plat_data = {
47 .memcpy_channel = {
48 .bus_id = "memcpy",
49 .cctl = (PL080_BSIZE_16 << PL080_CONTROL_SB_SIZE_SHIFT | \
50 PL080_BSIZE_16 << PL080_CONTROL_DB_SIZE_SHIFT | \
51 PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT | \
52 PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT | \
53 PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE | \
54 PL080_CONTROL_PROT_SYS),
55 },
56 .lli_buses = PL08X_AHB1,
57 .mem_buses = PL08X_AHB1,
58 .get_signal = pl080_get_signal,
59 .put_signal = pl080_put_signal,
29}; 60};
30 61
31AMBA_APB_DEVICE(spear3xx_gpio, "gpio", 0, SPEAR3XX_ICM3_GPIO_BASE, 62/*
32 {SPEAR3XX_IRQ_BASIC_GPIO}, &gpio_plat_data); 63 * Following will create 16MB static virtual/physical mappings
33 64 * PHYSICAL VIRTUAL
34/* uart device registration */ 65 * 0xD0000000 0xFD000000
35AMBA_APB_DEVICE(spear3xx_uart, "uart", 0, SPEAR3XX_ICM1_UART_BASE, 66 * 0xFC000000 0xFC000000
36 {SPEAR3XX_IRQ_UART}, NULL); 67 */
37
38/* Do spear3xx familiy common initialization part here */
39void __init spear3xx_init(void)
40{
41 /* nothing to do for now */
42}
43
44/* This will initialize vic */
45void __init spear3xx_init_irq(void)
46{
47 vic_init((void __iomem *)VA_SPEAR3XX_ML1_VIC_BASE, 0, ~0, 0);
48}
49
50/* Following will create static virtual/physical mappings */
51struct map_desc spear3xx_io_desc[] __initdata = { 68struct map_desc spear3xx_io_desc[] __initdata = {
52 { 69 {
53 .virtual = VA_SPEAR3XX_ICM1_UART_BASE, 70 .virtual = VA_SPEAR3XX_ICM1_2_BASE,
54 .pfn = __phys_to_pfn(SPEAR3XX_ICM1_UART_BASE), 71 .pfn = __phys_to_pfn(SPEAR3XX_ICM1_2_BASE),
55 .length = SZ_4K, 72 .length = SZ_16M,
56 .type = MT_DEVICE
57 }, {
58 .virtual = VA_SPEAR3XX_ML1_VIC_BASE,
59 .pfn = __phys_to_pfn(SPEAR3XX_ML1_VIC_BASE),
60 .length = SZ_4K,
61 .type = MT_DEVICE
62 }, {
63 .virtual = VA_SPEAR3XX_ICM3_SYS_CTRL_BASE,
64 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_SYS_CTRL_BASE),
65 .length = SZ_4K,
66 .type = MT_DEVICE 73 .type = MT_DEVICE
67 }, { 74 }, {
68 .virtual = VA_SPEAR3XX_ICM3_MISC_REG_BASE, 75 .virtual = VA_SPEAR3XX_ICM3_SMI_CTRL_BASE,
69 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_MISC_REG_BASE), 76 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_SMI_CTRL_BASE),
70 .length = SZ_4K, 77 .length = SZ_16M,
71 .type = MT_DEVICE 78 .type = MT_DEVICE
72 }, 79 },
73}; 80};
@@ -76,436 +83,8 @@ struct map_desc spear3xx_io_desc[] __initdata = {
76void __init spear3xx_map_io(void) 83void __init spear3xx_map_io(void)
77{ 84{
78 iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc)); 85 iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc));
79
80 /* This will initialize clock framework */
81 spear3xx_clk_init();
82} 86}
83 87
84/* pad multiplexing support */
85/* devices */
86static struct pmx_dev_mode pmx_firda_modes[] = {
87 {
88 .ids = 0xffffffff,
89 .mask = PMX_FIRDA_MASK,
90 },
91};
92
93struct pmx_dev spear3xx_pmx_firda = {
94 .name = "firda",
95 .modes = pmx_firda_modes,
96 .mode_count = ARRAY_SIZE(pmx_firda_modes),
97 .enb_on_reset = 0,
98};
99
100static struct pmx_dev_mode pmx_i2c_modes[] = {
101 {
102 .ids = 0xffffffff,
103 .mask = PMX_I2C_MASK,
104 },
105};
106
107struct pmx_dev spear3xx_pmx_i2c = {
108 .name = "i2c",
109 .modes = pmx_i2c_modes,
110 .mode_count = ARRAY_SIZE(pmx_i2c_modes),
111 .enb_on_reset = 0,
112};
113
114static struct pmx_dev_mode pmx_ssp_cs_modes[] = {
115 {
116 .ids = 0xffffffff,
117 .mask = PMX_SSP_CS_MASK,
118 },
119};
120
121struct pmx_dev spear3xx_pmx_ssp_cs = {
122 .name = "ssp_chip_selects",
123 .modes = pmx_ssp_cs_modes,
124 .mode_count = ARRAY_SIZE(pmx_ssp_cs_modes),
125 .enb_on_reset = 0,
126};
127
128static struct pmx_dev_mode pmx_ssp_modes[] = {
129 {
130 .ids = 0xffffffff,
131 .mask = PMX_SSP_MASK,
132 },
133};
134
135struct pmx_dev spear3xx_pmx_ssp = {
136 .name = "ssp",
137 .modes = pmx_ssp_modes,
138 .mode_count = ARRAY_SIZE(pmx_ssp_modes),
139 .enb_on_reset = 0,
140};
141
142static struct pmx_dev_mode pmx_mii_modes[] = {
143 {
144 .ids = 0xffffffff,
145 .mask = PMX_MII_MASK,
146 },
147};
148
149struct pmx_dev spear3xx_pmx_mii = {
150 .name = "mii",
151 .modes = pmx_mii_modes,
152 .mode_count = ARRAY_SIZE(pmx_mii_modes),
153 .enb_on_reset = 0,
154};
155
156static struct pmx_dev_mode pmx_gpio_pin0_modes[] = {
157 {
158 .ids = 0xffffffff,
159 .mask = PMX_GPIO_PIN0_MASK,
160 },
161};
162
163struct pmx_dev spear3xx_pmx_gpio_pin0 = {
164 .name = "gpio_pin0",
165 .modes = pmx_gpio_pin0_modes,
166 .mode_count = ARRAY_SIZE(pmx_gpio_pin0_modes),
167 .enb_on_reset = 0,
168};
169
170static struct pmx_dev_mode pmx_gpio_pin1_modes[] = {
171 {
172 .ids = 0xffffffff,
173 .mask = PMX_GPIO_PIN1_MASK,
174 },
175};
176
177struct pmx_dev spear3xx_pmx_gpio_pin1 = {
178 .name = "gpio_pin1",
179 .modes = pmx_gpio_pin1_modes,
180 .mode_count = ARRAY_SIZE(pmx_gpio_pin1_modes),
181 .enb_on_reset = 0,
182};
183
184static struct pmx_dev_mode pmx_gpio_pin2_modes[] = {
185 {
186 .ids = 0xffffffff,
187 .mask = PMX_GPIO_PIN2_MASK,
188 },
189};
190
191struct pmx_dev spear3xx_pmx_gpio_pin2 = {
192 .name = "gpio_pin2",
193 .modes = pmx_gpio_pin2_modes,
194 .mode_count = ARRAY_SIZE(pmx_gpio_pin2_modes),
195 .enb_on_reset = 0,
196};
197
198static struct pmx_dev_mode pmx_gpio_pin3_modes[] = {
199 {
200 .ids = 0xffffffff,
201 .mask = PMX_GPIO_PIN3_MASK,
202 },
203};
204
205struct pmx_dev spear3xx_pmx_gpio_pin3 = {
206 .name = "gpio_pin3",
207 .modes = pmx_gpio_pin3_modes,
208 .mode_count = ARRAY_SIZE(pmx_gpio_pin3_modes),
209 .enb_on_reset = 0,
210};
211
212static struct pmx_dev_mode pmx_gpio_pin4_modes[] = {
213 {
214 .ids = 0xffffffff,
215 .mask = PMX_GPIO_PIN4_MASK,
216 },
217};
218
219struct pmx_dev spear3xx_pmx_gpio_pin4 = {
220 .name = "gpio_pin4",
221 .modes = pmx_gpio_pin4_modes,
222 .mode_count = ARRAY_SIZE(pmx_gpio_pin4_modes),
223 .enb_on_reset = 0,
224};
225
226static struct pmx_dev_mode pmx_gpio_pin5_modes[] = {
227 {
228 .ids = 0xffffffff,
229 .mask = PMX_GPIO_PIN5_MASK,
230 },
231};
232
233struct pmx_dev spear3xx_pmx_gpio_pin5 = {
234 .name = "gpio_pin5",
235 .modes = pmx_gpio_pin5_modes,
236 .mode_count = ARRAY_SIZE(pmx_gpio_pin5_modes),
237 .enb_on_reset = 0,
238};
239
240static struct pmx_dev_mode pmx_uart0_modem_modes[] = {
241 {
242 .ids = 0xffffffff,
243 .mask = PMX_UART0_MODEM_MASK,
244 },
245};
246
247struct pmx_dev spear3xx_pmx_uart0_modem = {
248 .name = "uart0_modem",
249 .modes = pmx_uart0_modem_modes,
250 .mode_count = ARRAY_SIZE(pmx_uart0_modem_modes),
251 .enb_on_reset = 0,
252};
253
254static struct pmx_dev_mode pmx_uart0_modes[] = {
255 {
256 .ids = 0xffffffff,
257 .mask = PMX_UART0_MASK,
258 },
259};
260
261struct pmx_dev spear3xx_pmx_uart0 = {
262 .name = "uart0",
263 .modes = pmx_uart0_modes,
264 .mode_count = ARRAY_SIZE(pmx_uart0_modes),
265 .enb_on_reset = 0,
266};
267
268static struct pmx_dev_mode pmx_timer_3_4_modes[] = {
269 {
270 .ids = 0xffffffff,
271 .mask = PMX_TIMER_3_4_MASK,
272 },
273};
274
275struct pmx_dev spear3xx_pmx_timer_3_4 = {
276 .name = "timer_3_4",
277 .modes = pmx_timer_3_4_modes,
278 .mode_count = ARRAY_SIZE(pmx_timer_3_4_modes),
279 .enb_on_reset = 0,
280};
281
282static struct pmx_dev_mode pmx_timer_1_2_modes[] = {
283 {
284 .ids = 0xffffffff,
285 .mask = PMX_TIMER_1_2_MASK,
286 },
287};
288
289struct pmx_dev spear3xx_pmx_timer_1_2 = {
290 .name = "timer_1_2",
291 .modes = pmx_timer_1_2_modes,
292 .mode_count = ARRAY_SIZE(pmx_timer_1_2_modes),
293 .enb_on_reset = 0,
294};
295
296#if defined(CONFIG_MACH_SPEAR310) || defined(CONFIG_MACH_SPEAR320)
297/* plgpios devices */
298static struct pmx_dev_mode pmx_plgpio_0_1_modes[] = {
299 {
300 .ids = 0x00,
301 .mask = PMX_FIRDA_MASK,
302 },
303};
304
305struct pmx_dev spear3xx_pmx_plgpio_0_1 = {
306 .name = "plgpio 0 and 1",
307 .modes = pmx_plgpio_0_1_modes,
308 .mode_count = ARRAY_SIZE(pmx_plgpio_0_1_modes),
309 .enb_on_reset = 1,
310};
311
312static struct pmx_dev_mode pmx_plgpio_2_3_modes[] = {
313 {
314 .ids = 0x00,
315 .mask = PMX_UART0_MASK,
316 },
317};
318
319struct pmx_dev spear3xx_pmx_plgpio_2_3 = {
320 .name = "plgpio 2 and 3",
321 .modes = pmx_plgpio_2_3_modes,
322 .mode_count = ARRAY_SIZE(pmx_plgpio_2_3_modes),
323 .enb_on_reset = 1,
324};
325
326static struct pmx_dev_mode pmx_plgpio_4_5_modes[] = {
327 {
328 .ids = 0x00,
329 .mask = PMX_I2C_MASK,
330 },
331};
332
333struct pmx_dev spear3xx_pmx_plgpio_4_5 = {
334 .name = "plgpio 4 and 5",
335 .modes = pmx_plgpio_4_5_modes,
336 .mode_count = ARRAY_SIZE(pmx_plgpio_4_5_modes),
337 .enb_on_reset = 1,
338};
339
340static struct pmx_dev_mode pmx_plgpio_6_9_modes[] = {
341 {
342 .ids = 0x00,
343 .mask = PMX_SSP_MASK,
344 },
345};
346
347struct pmx_dev spear3xx_pmx_plgpio_6_9 = {
348 .name = "plgpio 6 to 9",
349 .modes = pmx_plgpio_6_9_modes,
350 .mode_count = ARRAY_SIZE(pmx_plgpio_6_9_modes),
351 .enb_on_reset = 1,
352};
353
354static struct pmx_dev_mode pmx_plgpio_10_27_modes[] = {
355 {
356 .ids = 0x00,
357 .mask = PMX_MII_MASK,
358 },
359};
360
361struct pmx_dev spear3xx_pmx_plgpio_10_27 = {
362 .name = "plgpio 10 to 27",
363 .modes = pmx_plgpio_10_27_modes,
364 .mode_count = ARRAY_SIZE(pmx_plgpio_10_27_modes),
365 .enb_on_reset = 1,
366};
367
368static struct pmx_dev_mode pmx_plgpio_28_modes[] = {
369 {
370 .ids = 0x00,
371 .mask = PMX_GPIO_PIN0_MASK,
372 },
373};
374
375struct pmx_dev spear3xx_pmx_plgpio_28 = {
376 .name = "plgpio 28",
377 .modes = pmx_plgpio_28_modes,
378 .mode_count = ARRAY_SIZE(pmx_plgpio_28_modes),
379 .enb_on_reset = 1,
380};
381
382static struct pmx_dev_mode pmx_plgpio_29_modes[] = {
383 {
384 .ids = 0x00,
385 .mask = PMX_GPIO_PIN1_MASK,
386 },
387};
388
389struct pmx_dev spear3xx_pmx_plgpio_29 = {
390 .name = "plgpio 29",
391 .modes = pmx_plgpio_29_modes,
392 .mode_count = ARRAY_SIZE(pmx_plgpio_29_modes),
393 .enb_on_reset = 1,
394};
395
396static struct pmx_dev_mode pmx_plgpio_30_modes[] = {
397 {
398 .ids = 0x00,
399 .mask = PMX_GPIO_PIN2_MASK,
400 },
401};
402
403struct pmx_dev spear3xx_pmx_plgpio_30 = {
404 .name = "plgpio 30",
405 .modes = pmx_plgpio_30_modes,
406 .mode_count = ARRAY_SIZE(pmx_plgpio_30_modes),
407 .enb_on_reset = 1,
408};
409
410static struct pmx_dev_mode pmx_plgpio_31_modes[] = {
411 {
412 .ids = 0x00,
413 .mask = PMX_GPIO_PIN3_MASK,
414 },
415};
416
417struct pmx_dev spear3xx_pmx_plgpio_31 = {
418 .name = "plgpio 31",
419 .modes = pmx_plgpio_31_modes,
420 .mode_count = ARRAY_SIZE(pmx_plgpio_31_modes),
421 .enb_on_reset = 1,
422};
423
424static struct pmx_dev_mode pmx_plgpio_32_modes[] = {
425 {
426 .ids = 0x00,
427 .mask = PMX_GPIO_PIN4_MASK,
428 },
429};
430
431struct pmx_dev spear3xx_pmx_plgpio_32 = {
432 .name = "plgpio 32",
433 .modes = pmx_plgpio_32_modes,
434 .mode_count = ARRAY_SIZE(pmx_plgpio_32_modes),
435 .enb_on_reset = 1,
436};
437
438static struct pmx_dev_mode pmx_plgpio_33_modes[] = {
439 {
440 .ids = 0x00,
441 .mask = PMX_GPIO_PIN5_MASK,
442 },
443};
444
445struct pmx_dev spear3xx_pmx_plgpio_33 = {
446 .name = "plgpio 33",
447 .modes = pmx_plgpio_33_modes,
448 .mode_count = ARRAY_SIZE(pmx_plgpio_33_modes),
449 .enb_on_reset = 1,
450};
451
452static struct pmx_dev_mode pmx_plgpio_34_36_modes[] = {
453 {
454 .ids = 0x00,
455 .mask = PMX_SSP_CS_MASK,
456 },
457};
458
459struct pmx_dev spear3xx_pmx_plgpio_34_36 = {
460 .name = "plgpio 34 to 36",
461 .modes = pmx_plgpio_34_36_modes,
462 .mode_count = ARRAY_SIZE(pmx_plgpio_34_36_modes),
463 .enb_on_reset = 1,
464};
465
466static struct pmx_dev_mode pmx_plgpio_37_42_modes[] = {
467 {
468 .ids = 0x00,
469 .mask = PMX_UART0_MODEM_MASK,
470 },
471};
472
473struct pmx_dev spear3xx_pmx_plgpio_37_42 = {
474 .name = "plgpio 37 to 42",
475 .modes = pmx_plgpio_37_42_modes,
476 .mode_count = ARRAY_SIZE(pmx_plgpio_37_42_modes),
477 .enb_on_reset = 1,
478};
479
480static struct pmx_dev_mode pmx_plgpio_43_44_47_48_modes[] = {
481 {
482 .ids = 0x00,
483 .mask = PMX_TIMER_1_2_MASK,
484 },
485};
486
487struct pmx_dev spear3xx_pmx_plgpio_43_44_47_48 = {
488 .name = "plgpio 43, 44, 47 and 48",
489 .modes = pmx_plgpio_43_44_47_48_modes,
490 .mode_count = ARRAY_SIZE(pmx_plgpio_43_44_47_48_modes),
491 .enb_on_reset = 1,
492};
493
494static struct pmx_dev_mode pmx_plgpio_45_46_49_50_modes[] = {
495 {
496 .ids = 0x00,
497 .mask = PMX_TIMER_3_4_MASK,
498 },
499};
500
501struct pmx_dev spear3xx_pmx_plgpio_45_46_49_50 = {
502 .name = "plgpio 45, 46, 49 and 50",
503 .modes = pmx_plgpio_45_46_49_50_modes,
504 .mode_count = ARRAY_SIZE(pmx_plgpio_45_46_49_50_modes),
505 .enb_on_reset = 1,
506};
507#endif /* CONFIG_MACH_SPEAR310 || CONFIG_MACH_SPEAR320 */
508
509static void __init spear3xx_timer_init(void) 88static void __init spear3xx_timer_init(void)
510{ 89{
511 char pclk_name[] = "pll3_48m_clk"; 90 char pclk_name[] = "pll3_48m_clk";
@@ -530,9 +109,19 @@ static void __init spear3xx_timer_init(void)
530 clk_put(gpt_clk); 109 clk_put(gpt_clk);
531 clk_put(pclk); 110 clk_put(pclk);
532 111
533 spear_setup_timer(); 112 spear_setup_timer(SPEAR3XX_CPU_TMR_BASE, SPEAR3XX_IRQ_CPU_GPT1_1);
534} 113}
535 114
536struct sys_timer spear3xx_timer = { 115struct sys_timer spear3xx_timer = {
537 .init = spear3xx_timer_init, 116 .init = spear3xx_timer_init,
538}; 117};
118
119static const struct of_device_id vic_of_match[] __initconst = {
120 { .compatible = "arm,pl190-vic", .data = vic_of_init, },
121 { /* Sentinel */ }
122};
123
124void __init spear3xx_dt_init_irq(void)
125{
126 of_irq_init(vic_of_match);
127}
diff --git a/arch/arm/mach-spear6xx/Kconfig b/arch/arm/mach-spear6xx/Kconfig
index fbe298bd1d92..339f397dea70 100644
--- a/arch/arm/mach-spear6xx/Kconfig
+++ b/arch/arm/mach-spear6xx/Kconfig
@@ -2,21 +2,9 @@
2# SPEAr6XX Machine configuration file 2# SPEAr6XX Machine configuration file
3# 3#
4 4
5if ARCH_SPEAR6XX 5config MACH_SPEAR600
6 6 def_bool y
7menu "SPEAr6xx Implementations" 7 depends on ARCH_SPEAR6XX
8config BOARD_SPEAR600_DT
9 bool "SPEAr600 generic board configured via device-tree"
10 select MACH_SPEAR600
11 select USE_OF 8 select USE_OF
12 help 9 help
13 Supports ST SPEAr600 boards configured via the device-tree 10 Supports ST SPEAr600 boards configured via the device-tree
14
15endmenu
16
17config MACH_SPEAR600
18 bool "SPEAr600"
19 help
20 Supports ST SPEAr600 Machine
21
22endif #ARCH_SPEAR6XX
diff --git a/arch/arm/mach-spear6xx/Makefile.boot b/arch/arm/mach-spear6xx/Makefile.boot
index 4674a4c221db..af493da37ab6 100644
--- a/arch/arm/mach-spear6xx/Makefile.boot
+++ b/arch/arm/mach-spear6xx/Makefile.boot
@@ -1,3 +1,5 @@
1zreladdr-y += 0x00008000 1zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4
5dtb-$(CONFIG_BOARD_SPEAR600_DT) += spear600-evb.dtb
diff --git a/arch/arm/mach-spear6xx/clock.c b/arch/arm/mach-spear6xx/clock.c
index a86499a8a15f..bef77d43db87 100644
--- a/arch/arm/mach-spear6xx/clock.c
+++ b/arch/arm/mach-spear6xx/clock.c
@@ -16,6 +16,112 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <plat/clock.h> 17#include <plat/clock.h>
18#include <mach/misc_regs.h> 18#include <mach/misc_regs.h>
19#include <mach/spear.h>
20
21#define PLL1_CTR (MISC_BASE + 0x008)
22#define PLL1_FRQ (MISC_BASE + 0x00C)
23#define PLL1_MOD (MISC_BASE + 0x010)
24#define PLL2_CTR (MISC_BASE + 0x014)
25/* PLL_CTR register masks */
26#define PLL_ENABLE 2
27#define PLL_MODE_SHIFT 4
28#define PLL_MODE_MASK 0x3
29#define PLL_MODE_NORMAL 0
30#define PLL_MODE_FRACTION 1
31#define PLL_MODE_DITH_DSB 2
32#define PLL_MODE_DITH_SSB 3
33
34#define PLL2_FRQ (MISC_BASE + 0x018)
35/* PLL FRQ register masks */
36#define PLL_DIV_N_SHIFT 0
37#define PLL_DIV_N_MASK 0xFF
38#define PLL_DIV_P_SHIFT 8
39#define PLL_DIV_P_MASK 0x7
40#define PLL_NORM_FDBK_M_SHIFT 24
41#define PLL_NORM_FDBK_M_MASK 0xFF
42#define PLL_DITH_FDBK_M_SHIFT 16
43#define PLL_DITH_FDBK_M_MASK 0xFFFF
44
45#define PLL2_MOD (MISC_BASE + 0x01C)
46#define PLL_CLK_CFG (MISC_BASE + 0x020)
47#define CORE_CLK_CFG (MISC_BASE + 0x024)
48/* CORE CLK CFG register masks */
49#define PLL_HCLK_RATIO_SHIFT 10
50#define PLL_HCLK_RATIO_MASK 0x3
51#define HCLK_PCLK_RATIO_SHIFT 8
52#define HCLK_PCLK_RATIO_MASK 0x3
53
54#define PERIP_CLK_CFG (MISC_BASE + 0x028)
55/* PERIP_CLK_CFG register masks */
56#define CLCD_CLK_SHIFT 2
57#define CLCD_CLK_MASK 0x3
58#define UART_CLK_SHIFT 4
59#define UART_CLK_MASK 0x1
60#define FIRDA_CLK_SHIFT 5
61#define FIRDA_CLK_MASK 0x3
62#define GPT0_CLK_SHIFT 8
63#define GPT1_CLK_SHIFT 10
64#define GPT2_CLK_SHIFT 11
65#define GPT3_CLK_SHIFT 12
66#define GPT_CLK_MASK 0x1
67#define AUX_CLK_PLL3_VAL 0
68#define AUX_CLK_PLL1_VAL 1
69
70#define PERIP1_CLK_ENB (MISC_BASE + 0x02C)
71/* PERIP1_CLK_ENB register masks */
72#define UART0_CLK_ENB 3
73#define UART1_CLK_ENB 4
74#define SSP0_CLK_ENB 5
75#define SSP1_CLK_ENB 6
76#define I2C_CLK_ENB 7
77#define JPEG_CLK_ENB 8
78#define FSMC_CLK_ENB 9
79#define FIRDA_CLK_ENB 10
80#define GPT2_CLK_ENB 11
81#define GPT3_CLK_ENB 12
82#define GPIO2_CLK_ENB 13
83#define SSP2_CLK_ENB 14
84#define ADC_CLK_ENB 15
85#define GPT1_CLK_ENB 11
86#define RTC_CLK_ENB 17
87#define GPIO1_CLK_ENB 18
88#define DMA_CLK_ENB 19
89#define SMI_CLK_ENB 21
90#define CLCD_CLK_ENB 22
91#define GMAC_CLK_ENB 23
92#define USBD_CLK_ENB 24
93#define USBH0_CLK_ENB 25
94#define USBH1_CLK_ENB 26
95
96#define PRSC1_CLK_CFG (MISC_BASE + 0x044)
97#define PRSC2_CLK_CFG (MISC_BASE + 0x048)
98#define PRSC3_CLK_CFG (MISC_BASE + 0x04C)
99/* gpt synthesizer register masks */
100#define GPT_MSCALE_SHIFT 0
101#define GPT_MSCALE_MASK 0xFFF
102#define GPT_NSCALE_SHIFT 12
103#define GPT_NSCALE_MASK 0xF
104
105#define AMEM_CLK_CFG (MISC_BASE + 0x050)
106#define EXPI_CLK_CFG (MISC_BASE + 0x054)
107#define CLCD_CLK_SYNT (MISC_BASE + 0x05C)
108#define FIRDA_CLK_SYNT (MISC_BASE + 0x060)
109#define UART_CLK_SYNT (MISC_BASE + 0x064)
110#define GMAC_CLK_SYNT (MISC_BASE + 0x068)
111#define RAS1_CLK_SYNT (MISC_BASE + 0x06C)
112#define RAS2_CLK_SYNT (MISC_BASE + 0x070)
113#define RAS3_CLK_SYNT (MISC_BASE + 0x074)
114#define RAS4_CLK_SYNT (MISC_BASE + 0x078)
115/* aux clk synthesiser register masks for irda to ras4 */
116#define AUX_SYNT_ENB 31
117#define AUX_EQ_SEL_SHIFT 30
118#define AUX_EQ_SEL_MASK 1
119#define AUX_EQ1_SEL 0
120#define AUX_EQ2_SEL 1
121#define AUX_XSCALE_SHIFT 16
122#define AUX_XSCALE_MASK 0xFFF
123#define AUX_YSCALE_SHIFT 0
124#define AUX_YSCALE_MASK 0xFFF
19 125
20/* root clks */ 126/* root clks */
21/* 32 KHz oscillator clock */ 127/* 32 KHz oscillator clock */
@@ -623,53 +729,53 @@ static struct clk dummy_apb_pclk;
623 729
624/* array of all spear 6xx clock lookups */ 730/* array of all spear 6xx clock lookups */
625static struct clk_lookup spear_clk_lookups[] = { 731static struct clk_lookup spear_clk_lookups[] = {
626 { .con_id = "apb_pclk", .clk = &dummy_apb_pclk}, 732 CLKDEV_INIT(NULL, "apb_pclk", &dummy_apb_pclk),
627 /* root clks */ 733 /* root clks */
628 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk}, 734 CLKDEV_INIT(NULL, "osc_32k_clk", &osc_32k_clk),
629 { .con_id = "osc_30m_clk", .clk = &osc_30m_clk}, 735 CLKDEV_INIT(NULL, "osc_30m_clk", &osc_30m_clk),
630 /* clock derived from 32 KHz os clk */ 736 /* clock derived from 32 KHz os clk */
631 { .dev_id = "rtc-spear", .clk = &rtc_clk}, 737 CLKDEV_INIT("rtc-spear", NULL, &rtc_clk),
632 /* clock derived from 30 MHz os clk */ 738 /* clock derived from 30 MHz os clk */
633 { .con_id = "pll1_clk", .clk = &pll1_clk}, 739 CLKDEV_INIT(NULL, "pll1_clk", &pll1_clk),
634 { .con_id = "pll3_48m_clk", .clk = &pll3_48m_clk}, 740 CLKDEV_INIT(NULL, "pll3_48m_clk", &pll3_48m_clk),
635 { .dev_id = "wdt", .clk = &wdt_clk}, 741 CLKDEV_INIT("wdt", NULL, &wdt_clk),
636 /* clock derived from pll1 clk */ 742 /* clock derived from pll1 clk */
637 { .con_id = "cpu_clk", .clk = &cpu_clk}, 743 CLKDEV_INIT(NULL, "cpu_clk", &cpu_clk),
638 { .con_id = "ahb_clk", .clk = &ahb_clk}, 744 CLKDEV_INIT(NULL, "ahb_clk", &ahb_clk),
639 { .con_id = "uart_synth_clk", .clk = &uart_synth_clk}, 745 CLKDEV_INIT(NULL, "uart_synth_clk", &uart_synth_clk),
640 { .con_id = "firda_synth_clk", .clk = &firda_synth_clk}, 746 CLKDEV_INIT(NULL, "firda_synth_clk", &firda_synth_clk),
641 { .con_id = "clcd_synth_clk", .clk = &clcd_synth_clk}, 747 CLKDEV_INIT(NULL, "clcd_synth_clk", &clcd_synth_clk),
642 { .con_id = "gpt0_synth_clk", .clk = &gpt0_synth_clk}, 748 CLKDEV_INIT(NULL, "gpt0_synth_clk", &gpt0_synth_clk),
643 { .con_id = "gpt2_synth_clk", .clk = &gpt2_synth_clk}, 749 CLKDEV_INIT(NULL, "gpt2_synth_clk", &gpt2_synth_clk),
644 { .con_id = "gpt3_synth_clk", .clk = &gpt3_synth_clk}, 750 CLKDEV_INIT(NULL, "gpt3_synth_clk", &gpt3_synth_clk),
645 { .dev_id = "d0000000.serial", .clk = &uart0_clk}, 751 CLKDEV_INIT("d0000000.serial", NULL, &uart0_clk),
646 { .dev_id = "d0080000.serial", .clk = &uart1_clk}, 752 CLKDEV_INIT("d0080000.serial", NULL, &uart1_clk),
647 { .dev_id = "firda", .clk = &firda_clk}, 753 CLKDEV_INIT("firda", NULL, &firda_clk),
648 { .dev_id = "clcd", .clk = &clcd_clk}, 754 CLKDEV_INIT("clcd", NULL, &clcd_clk),
649 { .dev_id = "gpt0", .clk = &gpt0_clk}, 755 CLKDEV_INIT("gpt0", NULL, &gpt0_clk),
650 { .dev_id = "gpt1", .clk = &gpt1_clk}, 756 CLKDEV_INIT("gpt1", NULL, &gpt1_clk),
651 { .dev_id = "gpt2", .clk = &gpt2_clk}, 757 CLKDEV_INIT("gpt2", NULL, &gpt2_clk),
652 { .dev_id = "gpt3", .clk = &gpt3_clk}, 758 CLKDEV_INIT("gpt3", NULL, &gpt3_clk),
653 /* clock derived from pll3 clk */ 759 /* clock derived from pll3 clk */
654 { .dev_id = "designware_udc", .clk = &usbd_clk}, 760 CLKDEV_INIT("designware_udc", NULL, &usbd_clk),
655 { .con_id = "usbh.0_clk", .clk = &usbh0_clk}, 761 CLKDEV_INIT(NULL, "usbh.0_clk", &usbh0_clk),
656 { .con_id = "usbh.1_clk", .clk = &usbh1_clk}, 762 CLKDEV_INIT(NULL, "usbh.1_clk", &usbh1_clk),
657 /* clock derived from ahb clk */ 763 /* clock derived from ahb clk */
658 { .con_id = "apb_clk", .clk = &apb_clk}, 764 CLKDEV_INIT(NULL, "apb_clk", &apb_clk),
659 { .dev_id = "d0200000.i2c", .clk = &i2c_clk}, 765 CLKDEV_INIT("d0200000.i2c", NULL, &i2c_clk),
660 { .dev_id = "dma", .clk = &dma_clk}, 766 CLKDEV_INIT("fc400000.dma", NULL, &dma_clk),
661 { .dev_id = "jpeg", .clk = &jpeg_clk}, 767 CLKDEV_INIT("jpeg", NULL, &jpeg_clk),
662 { .dev_id = "gmac", .clk = &gmac_clk}, 768 CLKDEV_INIT("gmac", NULL, &gmac_clk),
663 { .dev_id = "smi", .clk = &smi_clk}, 769 CLKDEV_INIT("fc000000.flash", NULL, &smi_clk),
664 { .dev_id = "fsmc-nand", .clk = &fsmc_clk}, 770 CLKDEV_INIT("d1800000.flash", NULL, &fsmc_clk),
665 /* clock derived from apb clk */ 771 /* clock derived from apb clk */
666 { .dev_id = "adc", .clk = &adc_clk}, 772 CLKDEV_INIT("adc", NULL, &adc_clk),
667 { .dev_id = "ssp-pl022.0", .clk = &ssp0_clk}, 773 CLKDEV_INIT("ssp-pl022.0", NULL, &ssp0_clk),
668 { .dev_id = "ssp-pl022.1", .clk = &ssp1_clk}, 774 CLKDEV_INIT("ssp-pl022.1", NULL, &ssp1_clk),
669 { .dev_id = "ssp-pl022.2", .clk = &ssp2_clk}, 775 CLKDEV_INIT("ssp-pl022.2", NULL, &ssp2_clk),
670 { .dev_id = "f0100000.gpio", .clk = &gpio0_clk}, 776 CLKDEV_INIT("f0100000.gpio", NULL, &gpio0_clk),
671 { .dev_id = "fc980000.gpio", .clk = &gpio1_clk}, 777 CLKDEV_INIT("fc980000.gpio", NULL, &gpio1_clk),
672 { .dev_id = "d8100000.gpio", .clk = &gpio2_clk}, 778 CLKDEV_INIT("d8100000.gpio", NULL, &gpio2_clk),
673}; 779};
674 780
675void __init spear6xx_clk_init(void) 781void __init spear6xx_clk_init(void)
diff --git a/arch/arm/mach-spear6xx/include/mach/generic.h b/arch/arm/mach-spear6xx/include/mach/generic.h
index 116b99301cf5..7167fd331d86 100644
--- a/arch/arm/mach-spear6xx/include/mach/generic.h
+++ b/arch/arm/mach-spear6xx/include/mach/generic.h
@@ -15,34 +15,9 @@
15#define __MACH_GENERIC_H 15#define __MACH_GENERIC_H
16 16
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/amba/bus.h>
20#include <asm/mach/time.h>
21#include <asm/mach/map.h>
22
23/*
24 * Each GPT has 2 timer channels
25 * Following GPT channels will be used as clock source and clockevent
26 */
27#define SPEAR_GPT0_BASE SPEAR6XX_CPU_TMR_BASE
28#define SPEAR_GPT0_CHAN0_IRQ IRQ_CPU_GPT1_1
29#define SPEAR_GPT0_CHAN1_IRQ IRQ_CPU_GPT1_2
30
31/* Add spear6xx family device structure declarations here */
32extern struct amba_device gpio_device[];
33extern struct amba_device uart_device[];
34extern struct sys_timer spear6xx_timer;
35
36/* Add spear6xx family function declarations here */
37void __init spear_setup_timer(void);
38void __init spear6xx_map_io(void);
39void __init spear6xx_init_irq(void);
40void __init spear6xx_init(void);
41void __init spear600_init(void);
42void __init spear6xx_clk_init(void);
43 18
19void __init spear_setup_timer(resource_size_t base, int irq);
44void spear_restart(char, const char *); 20void spear_restart(char, const char *);
45 21void __init spear6xx_clk_init(void);
46/* Add spear600 machine device structure declarations here */
47 22
48#endif /* __MACH_GENERIC_H */ 23#endif /* __MACH_GENERIC_H */
diff --git a/arch/arm/mach-spear6xx/include/mach/hardware.h b/arch/arm/mach-spear6xx/include/mach/hardware.h
index 0b3f96ae2848..40a8c178f10d 100644
--- a/arch/arm/mach-spear6xx/include/mach/hardware.h
+++ b/arch/arm/mach-spear6xx/include/mach/hardware.h
@@ -1,23 +1 @@
1/* /* empty */
2 * arch/arm/mach-spear6xx/include/mach/hardware.h
3 *
4 * Hardware definitions for SPEAr6xx machine family
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Rajeev Kumar<rajeev-dlh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_HARDWARE_H
15#define __MACH_HARDWARE_H
16
17#include <plat/hardware.h>
18#include <mach/spear.h>
19
20/* Vitual to physical translation of statically mapped space */
21#define IO_ADDRESS(x) (x | 0xF0000000)
22
23#endif /* __MACH_HARDWARE_H */
diff --git a/arch/arm/mach-spear6xx/include/mach/irqs.h b/arch/arm/mach-spear6xx/include/mach/irqs.h
index 8f214b03d75d..2b735389e74b 100644
--- a/arch/arm/mach-spear6xx/include/mach/irqs.h
+++ b/arch/arm/mach-spear6xx/include/mach/irqs.h
@@ -16,82 +16,13 @@
16 16
17/* IRQ definitions */ 17/* IRQ definitions */
18/* VIC 1 */ 18/* VIC 1 */
19#define IRQ_INTRCOMM_SW_IRQ 0 19/* FIXME: probe this from DT */
20#define IRQ_INTRCOMM_CPU_1 1
21#define IRQ_INTRCOMM_CPU_2 2
22#define IRQ_INTRCOMM_RAS2A11_1 3
23#define IRQ_INTRCOMM_RAS2A11_2 4
24#define IRQ_INTRCOMM_RAS2A12_1 5
25#define IRQ_INTRCOMM_RAS2A12_2 6
26#define IRQ_GEN_RAS_0 7
27#define IRQ_GEN_RAS_1 8
28#define IRQ_GEN_RAS_2 9
29#define IRQ_GEN_RAS_3 10
30#define IRQ_GEN_RAS_4 11
31#define IRQ_GEN_RAS_5 12
32#define IRQ_GEN_RAS_6 13
33#define IRQ_GEN_RAS_7 14
34#define IRQ_GEN_RAS_8 15
35#define IRQ_CPU_GPT1_1 16 20#define IRQ_CPU_GPT1_1 16
36#define IRQ_CPU_GPT1_2 17
37#define IRQ_LOCAL_GPIO 18
38#define IRQ_PLL_UNLOCK 19
39#define IRQ_JPEG 20
40#define IRQ_FSMC 21
41#define IRQ_IRDA 22
42#define IRQ_RESERVED 23
43#define IRQ_UART_0 24
44#define IRQ_UART_1 25
45#define IRQ_SSP_1 26
46#define IRQ_SSP_2 27
47#define IRQ_I2C 28
48#define IRQ_GEN_RAS_9 29
49#define IRQ_GEN_RAS_10 30
50#define IRQ_GEN_RAS_11 31
51
52/* VIC 2 */
53#define IRQ_APPL_GPT1_1 32
54#define IRQ_APPL_GPT1_2 33
55#define IRQ_APPL_GPT2_1 34
56#define IRQ_APPL_GPT2_2 35
57#define IRQ_APPL_GPIO 36
58#define IRQ_APPL_SSP 37
59#define IRQ_APPL_ADC 38
60#define IRQ_APPL_RESERVED 39
61#define IRQ_AHB_EXP_MASTER 40
62#define IRQ_DDR_CONTROLLER 41
63#define IRQ_BASIC_DMA 42
64#define IRQ_BASIC_RESERVED1 43
65#define IRQ_BASIC_SMI 44
66#define IRQ_BASIC_CLCD 45
67#define IRQ_EXP_AHB_1 46
68#define IRQ_EXP_AHB_2 47
69#define IRQ_BASIC_GPT1_1 48
70#define IRQ_BASIC_GPT1_2 49
71#define IRQ_BASIC_RTC 50
72#define IRQ_BASIC_GPIO 51
73#define IRQ_BASIC_WDT 52
74#define IRQ_BASIC_RESERVED 53
75#define IRQ_AHB_EXP_SLAVE 54
76#define IRQ_GMAC_1 55
77#define IRQ_GMAC_2 56
78#define IRQ_USB_DEV 57
79#define IRQ_USB_H_OHCI_0 58
80#define IRQ_USB_H_EHCI_0 59
81#define IRQ_USB_H_OHCI_1 60
82#define IRQ_USB_H_EHCI_1 61
83#define IRQ_EXP_AHB_3 62
84#define IRQ_EXP_AHB_4 63
85 21
86#define IRQ_VIC_END 64 22#define IRQ_VIC_END 64
87 23
88/* GPIO pins virtual irqs */ 24/* GPIO pins virtual irqs */
89#define SPEAR_GPIO_INT_BASE IRQ_VIC_END 25#define VIRTUAL_IRQS 24
90#define SPEAR_GPIO0_INT_BASE SPEAR_GPIO_INT_BASE 26#define NR_IRQS (IRQ_VIC_END + VIRTUAL_IRQS)
91#define SPEAR_GPIO1_INT_BASE (SPEAR_GPIO0_INT_BASE + 8)
92#define SPEAR_GPIO2_INT_BASE (SPEAR_GPIO1_INT_BASE + 8)
93#define SPEAR_GPIO_INT_END (SPEAR_GPIO2_INT_BASE + 8)
94#define VIRTUAL_IRQS (SPEAR_GPIO_INT_END - IRQ_VIC_END)
95#define NR_IRQS (IRQ_VIC_END + VIRTUAL_IRQS)
96 27
97#endif /* __MACH_IRQS_H */ 28#endif /* __MACH_IRQS_H */
diff --git a/arch/arm/mach-spear6xx/include/mach/misc_regs.h b/arch/arm/mach-spear6xx/include/mach/misc_regs.h
index 68c20a007b0d..2b9aaa6cdd11 100644
--- a/arch/arm/mach-spear6xx/include/mach/misc_regs.h
+++ b/arch/arm/mach-spear6xx/include/mach/misc_regs.h
@@ -14,161 +14,7 @@
14#ifndef __MACH_MISC_REGS_H 14#ifndef __MACH_MISC_REGS_H
15#define __MACH_MISC_REGS_H 15#define __MACH_MISC_REGS_H
16 16
17#include <mach/hardware.h>
18
19#define MISC_BASE IOMEM(VA_SPEAR6XX_ICM3_MISC_REG_BASE) 17#define MISC_BASE IOMEM(VA_SPEAR6XX_ICM3_MISC_REG_BASE)
20
21#define SOC_CFG_CTR (MISC_BASE + 0x000)
22#define DIAG_CFG_CTR (MISC_BASE + 0x004)
23#define PLL1_CTR (MISC_BASE + 0x008)
24#define PLL1_FRQ (MISC_BASE + 0x00C)
25#define PLL1_MOD (MISC_BASE + 0x010)
26#define PLL2_CTR (MISC_BASE + 0x014)
27/* PLL_CTR register masks */
28#define PLL_ENABLE 2
29#define PLL_MODE_SHIFT 4
30#define PLL_MODE_MASK 0x3
31#define PLL_MODE_NORMAL 0
32#define PLL_MODE_FRACTION 1
33#define PLL_MODE_DITH_DSB 2
34#define PLL_MODE_DITH_SSB 3
35
36#define PLL2_FRQ (MISC_BASE + 0x018)
37/* PLL FRQ register masks */
38#define PLL_DIV_N_SHIFT 0
39#define PLL_DIV_N_MASK 0xFF
40#define PLL_DIV_P_SHIFT 8
41#define PLL_DIV_P_MASK 0x7
42#define PLL_NORM_FDBK_M_SHIFT 24
43#define PLL_NORM_FDBK_M_MASK 0xFF
44#define PLL_DITH_FDBK_M_SHIFT 16
45#define PLL_DITH_FDBK_M_MASK 0xFFFF
46
47#define PLL2_MOD (MISC_BASE + 0x01C)
48#define PLL_CLK_CFG (MISC_BASE + 0x020)
49#define CORE_CLK_CFG (MISC_BASE + 0x024)
50/* CORE CLK CFG register masks */
51#define PLL_HCLK_RATIO_SHIFT 10
52#define PLL_HCLK_RATIO_MASK 0x3
53#define HCLK_PCLK_RATIO_SHIFT 8
54#define HCLK_PCLK_RATIO_MASK 0x3
55
56#define PERIP_CLK_CFG (MISC_BASE + 0x028)
57/* PERIP_CLK_CFG register masks */
58#define CLCD_CLK_SHIFT 2
59#define CLCD_CLK_MASK 0x3
60#define UART_CLK_SHIFT 4
61#define UART_CLK_MASK 0x1
62#define FIRDA_CLK_SHIFT 5
63#define FIRDA_CLK_MASK 0x3
64#define GPT0_CLK_SHIFT 8
65#define GPT1_CLK_SHIFT 10
66#define GPT2_CLK_SHIFT 11
67#define GPT3_CLK_SHIFT 12
68#define GPT_CLK_MASK 0x1
69#define AUX_CLK_PLL3_VAL 0
70#define AUX_CLK_PLL1_VAL 1
71
72#define PERIP1_CLK_ENB (MISC_BASE + 0x02C)
73/* PERIP1_CLK_ENB register masks */
74#define UART0_CLK_ENB 3
75#define UART1_CLK_ENB 4
76#define SSP0_CLK_ENB 5
77#define SSP1_CLK_ENB 6
78#define I2C_CLK_ENB 7
79#define JPEG_CLK_ENB 8
80#define FSMC_CLK_ENB 9
81#define FIRDA_CLK_ENB 10
82#define GPT2_CLK_ENB 11
83#define GPT3_CLK_ENB 12
84#define GPIO2_CLK_ENB 13
85#define SSP2_CLK_ENB 14
86#define ADC_CLK_ENB 15
87#define GPT1_CLK_ENB 11
88#define RTC_CLK_ENB 17
89#define GPIO1_CLK_ENB 18
90#define DMA_CLK_ENB 19
91#define SMI_CLK_ENB 21
92#define CLCD_CLK_ENB 22
93#define GMAC_CLK_ENB 23
94#define USBD_CLK_ENB 24
95#define USBH0_CLK_ENB 25
96#define USBH1_CLK_ENB 26
97
98#define SOC_CORE_ID (MISC_BASE + 0x030)
99#define RAS_CLK_ENB (MISC_BASE + 0x034)
100#define PERIP1_SOF_RST (MISC_BASE + 0x038)
101/* PERIP1_SOF_RST register masks */
102#define JPEG_SOF_RST 8
103
104#define SOC_USER_ID (MISC_BASE + 0x03C)
105#define RAS_SOF_RST (MISC_BASE + 0x040)
106#define PRSC1_CLK_CFG (MISC_BASE + 0x044)
107#define PRSC2_CLK_CFG (MISC_BASE + 0x048)
108#define PRSC3_CLK_CFG (MISC_BASE + 0x04C)
109/* gpt synthesizer register masks */
110#define GPT_MSCALE_SHIFT 0
111#define GPT_MSCALE_MASK 0xFFF
112#define GPT_NSCALE_SHIFT 12
113#define GPT_NSCALE_MASK 0xF
114
115#define AMEM_CLK_CFG (MISC_BASE + 0x050)
116#define EXPI_CLK_CFG (MISC_BASE + 0x054)
117#define CLCD_CLK_SYNT (MISC_BASE + 0x05C)
118#define FIRDA_CLK_SYNT (MISC_BASE + 0x060)
119#define UART_CLK_SYNT (MISC_BASE + 0x064)
120#define GMAC_CLK_SYNT (MISC_BASE + 0x068)
121#define RAS1_CLK_SYNT (MISC_BASE + 0x06C)
122#define RAS2_CLK_SYNT (MISC_BASE + 0x070)
123#define RAS3_CLK_SYNT (MISC_BASE + 0x074)
124#define RAS4_CLK_SYNT (MISC_BASE + 0x078)
125/* aux clk synthesiser register masks for irda to ras4 */
126#define AUX_SYNT_ENB 31
127#define AUX_EQ_SEL_SHIFT 30
128#define AUX_EQ_SEL_MASK 1
129#define AUX_EQ1_SEL 0
130#define AUX_EQ2_SEL 1
131#define AUX_XSCALE_SHIFT 16
132#define AUX_XSCALE_MASK 0xFFF
133#define AUX_YSCALE_SHIFT 0
134#define AUX_YSCALE_MASK 0xFFF
135
136#define ICM1_ARB_CFG (MISC_BASE + 0x07C)
137#define ICM2_ARB_CFG (MISC_BASE + 0x080)
138#define ICM3_ARB_CFG (MISC_BASE + 0x084)
139#define ICM4_ARB_CFG (MISC_BASE + 0x088)
140#define ICM5_ARB_CFG (MISC_BASE + 0x08C)
141#define ICM6_ARB_CFG (MISC_BASE + 0x090)
142#define ICM7_ARB_CFG (MISC_BASE + 0x094)
143#define ICM8_ARB_CFG (MISC_BASE + 0x098)
144#define ICM9_ARB_CFG (MISC_BASE + 0x09C)
145#define DMA_CHN_CFG (MISC_BASE + 0x0A0) 18#define DMA_CHN_CFG (MISC_BASE + 0x0A0)
146#define USB2_PHY_CFG (MISC_BASE + 0x0A4)
147#define GMAC_CFG_CTR (MISC_BASE + 0x0A8)
148#define EXPI_CFG_CTR (MISC_BASE + 0x0AC)
149#define PRC1_LOCK_CTR (MISC_BASE + 0x0C0)
150#define PRC2_LOCK_CTR (MISC_BASE + 0x0C4)
151#define PRC3_LOCK_CTR (MISC_BASE + 0x0C8)
152#define PRC4_LOCK_CTR (MISC_BASE + 0x0CC)
153#define PRC1_IRQ_CTR (MISC_BASE + 0x0D0)
154#define PRC2_IRQ_CTR (MISC_BASE + 0x0D4)
155#define PRC3_IRQ_CTR (MISC_BASE + 0x0D8)
156#define PRC4_IRQ_CTR (MISC_BASE + 0x0DC)
157#define PWRDOWN_CFG_CTR (MISC_BASE + 0x0E0)
158#define COMPSSTL_1V8_CFG (MISC_BASE + 0x0E4)
159#define COMPSSTL_2V5_CFG (MISC_BASE + 0x0E8)
160#define COMPCOR_3V3_CFG (MISC_BASE + 0x0EC)
161#define SSTLPAD_CFG_CTR (MISC_BASE + 0x0F0)
162#define BIST1_CFG_CTR (MISC_BASE + 0x0F4)
163#define BIST2_CFG_CTR (MISC_BASE + 0x0F8)
164#define BIST3_CFG_CTR (MISC_BASE + 0x0FC)
165#define BIST4_CFG_CTR (MISC_BASE + 0x100)
166#define BIST5_CFG_CTR (MISC_BASE + 0x104)
167#define BIST1_STS_RES (MISC_BASE + 0x108)
168#define BIST2_STS_RES (MISC_BASE + 0x10C)
169#define BIST3_STS_RES (MISC_BASE + 0x110)
170#define BIST4_STS_RES (MISC_BASE + 0x114)
171#define BIST5_STS_RES (MISC_BASE + 0x118)
172#define SYSERR_CFG_CTR (MISC_BASE + 0x11C)
173 19
174#endif /* __MACH_MISC_REGS_H */ 20#endif /* __MACH_MISC_REGS_H */
diff --git a/arch/arm/mach-spear6xx/include/mach/spear.h b/arch/arm/mach-spear6xx/include/mach/spear.h
index 7fd621532def..d278ed047a53 100644
--- a/arch/arm/mach-spear6xx/include/mach/spear.h
+++ b/arch/arm/mach-spear6xx/include/mach/spear.h
@@ -15,69 +15,26 @@
15#define __MACH_SPEAR6XX_H 15#define __MACH_SPEAR6XX_H
16 16
17#include <asm/memory.h> 17#include <asm/memory.h>
18#include <mach/spear600.h>
19 18
20#define SPEAR6XX_ML_SDRAM_BASE UL(0x00000000)
21/* ICM1 - Low speed connection */ 19/* ICM1 - Low speed connection */
22#define SPEAR6XX_ICM1_BASE UL(0xD0000000) 20#define SPEAR6XX_ICM1_BASE UL(0xD0000000)
23 21#define VA_SPEAR6XX_ICM1_BASE UL(0xFD000000)
24#define SPEAR6XX_ICM1_UART0_BASE UL(0xD0000000) 22#define SPEAR6XX_ICM1_UART0_BASE UL(0xD0000000)
25#define VA_SPEAR6XX_ICM1_UART0_BASE IO_ADDRESS(SPEAR6XX_ICM1_UART0_BASE) 23#define VA_SPEAR6XX_ICM1_UART0_BASE (VA_SPEAR6XX_ICM1_2_BASE | SPEAR6XX_ICM1_UART0_BASE)
26
27#define SPEAR6XX_ICM1_UART1_BASE UL(0xD0080000)
28#define SPEAR6XX_ICM1_SSP0_BASE UL(0xD0100000)
29#define SPEAR6XX_ICM1_SSP1_BASE UL(0xD0180000)
30#define SPEAR6XX_ICM1_I2C_BASE UL(0xD0200000)
31#define SPEAR6XX_ICM1_JPEG_BASE UL(0xD0800000)
32#define SPEAR6XX_ICM1_IRDA_BASE UL(0xD1000000)
33#define SPEAR6XX_ICM1_FSMC_BASE UL(0xD1800000)
34#define SPEAR6XX_ICM1_NAND_BASE UL(0xD2000000)
35#define SPEAR6XX_ICM1_SRAM_BASE UL(0xD2800000)
36
37/* ICM2 - Application Subsystem */
38#define SPEAR6XX_ICM2_BASE UL(0xD8000000)
39#define SPEAR6XX_ICM2_TMR0_BASE UL(0xD8000000)
40#define SPEAR6XX_ICM2_TMR1_BASE UL(0xD8080000)
41#define SPEAR6XX_ICM2_GPIO_BASE UL(0xD8100000)
42#define SPEAR6XX_ICM2_SSP2_BASE UL(0xD8180000)
43#define SPEAR6XX_ICM2_ADC_BASE UL(0xD8200000)
44 24
45/* ML-1, 2 - Multi Layer CPU Subsystem */ 25/* ML-1, 2 - Multi Layer CPU Subsystem */
46#define SPEAR6XX_ML_CPU_BASE UL(0xF0000000) 26#define SPEAR6XX_ML_CPU_BASE UL(0xF0000000)
27#define VA_SPEAR6XX_ML_CPU_BASE UL(0xF0000000)
47#define SPEAR6XX_CPU_TMR_BASE UL(0xF0000000) 28#define SPEAR6XX_CPU_TMR_BASE UL(0xF0000000)
48#define SPEAR6XX_CPU_GPIO_BASE UL(0xF0100000)
49#define SPEAR6XX_CPU_VIC_SEC_BASE UL(0xF1000000)
50#define VA_SPEAR6XX_CPU_VIC_SEC_BASE IO_ADDRESS(SPEAR6XX_CPU_VIC_SEC_BASE)
51#define SPEAR6XX_CPU_VIC_PRI_BASE UL(0xF1100000)
52#define VA_SPEAR6XX_CPU_VIC_PRI_BASE IO_ADDRESS(SPEAR6XX_CPU_VIC_PRI_BASE)
53 29
54/* ICM3 - Basic Subsystem */ 30/* ICM3 - Basic Subsystem */
55#define SPEAR6XX_ICM3_BASE UL(0xF8000000)
56#define SPEAR6XX_ICM3_SMEM_BASE UL(0xF8000000)
57#define SPEAR6XX_ICM3_SMI_CTRL_BASE UL(0xFC000000) 31#define SPEAR6XX_ICM3_SMI_CTRL_BASE UL(0xFC000000)
58#define SPEAR6XX_ICM3_CLCD_BASE UL(0xFC200000) 32#define VA_SPEAR6XX_ICM3_SMI_CTRL_BASE UL(0xFC000000)
59#define SPEAR6XX_ICM3_DMA_BASE UL(0xFC400000) 33#define SPEAR6XX_ICM3_DMA_BASE UL(0xFC400000)
60#define SPEAR6XX_ICM3_SDRAM_CTRL_BASE UL(0xFC600000)
61#define SPEAR6XX_ICM3_TMR_BASE UL(0xFC800000)
62#define SPEAR6XX_ICM3_WDT_BASE UL(0xFC880000)
63#define SPEAR6XX_ICM3_RTC_BASE UL(0xFC900000)
64#define SPEAR6XX_ICM3_GPIO_BASE UL(0xFC980000)
65#define SPEAR6XX_ICM3_SYS_CTRL_BASE UL(0xFCA00000) 34#define SPEAR6XX_ICM3_SYS_CTRL_BASE UL(0xFCA00000)
66#define VA_SPEAR6XX_ICM3_SYS_CTRL_BASE IO_ADDRESS(SPEAR6XX_ICM3_SYS_CTRL_BASE) 35#define VA_SPEAR6XX_ICM3_SYS_CTRL_BASE (VA_SPEAR6XX_ICM3_SMI_CTRL_BASE | SPEAR6XX_ICM3_SYS_CTRL_BASE)
67#define SPEAR6XX_ICM3_MISC_REG_BASE UL(0xFCA80000) 36#define SPEAR6XX_ICM3_MISC_REG_BASE UL(0xFCA80000)
68#define VA_SPEAR6XX_ICM3_MISC_REG_BASE IO_ADDRESS(SPEAR6XX_ICM3_MISC_REG_BASE) 37#define VA_SPEAR6XX_ICM3_MISC_REG_BASE (VA_SPEAR6XX_ICM3_SMI_CTRL_BASE | SPEAR6XX_ICM3_MISC_REG_BASE)
69
70/* ICM4 - High Speed Connection */
71#define SPEAR6XX_ICM4_BASE UL(0xE0000000)
72#define SPEAR6XX_ICM4_GMAC_BASE UL(0xE0800000)
73#define SPEAR6XX_ICM4_USBD_FIFO_BASE UL(0xE1000000)
74#define SPEAR6XX_ICM4_USBD_CSR_BASE UL(0xE1100000)
75#define SPEAR6XX_ICM4_USBD_PLDT_BASE UL(0xE1200000)
76#define SPEAR6XX_ICM4_USB_EHCI0_BASE UL(0xE1800000)
77#define SPEAR6XX_ICM4_USB_OHCI0_BASE UL(0xE1900000)
78#define SPEAR6XX_ICM4_USB_EHCI1_BASE UL(0xE2000000)
79#define SPEAR6XX_ICM4_USB_OHCI1_BASE UL(0xE2100000)
80#define SPEAR6XX_ICM4_USB_ARB_BASE UL(0xE2800000)
81 38
82/* Debug uart for linux, will be used for debug and uncompress messages */ 39/* Debug uart for linux, will be used for debug and uncompress messages */
83#define SPEAR_DBG_UART_BASE SPEAR6XX_ICM1_UART0_BASE 40#define SPEAR_DBG_UART_BASE SPEAR6XX_ICM1_UART0_BASE
diff --git a/arch/arm/mach-spear6xx/include/mach/spear600.h b/arch/arm/mach-spear6xx/include/mach/spear600.h
deleted file mode 100644
index c068cc50b0fb..000000000000
--- a/arch/arm/mach-spear6xx/include/mach/spear600.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * arch/arm/mach-spear66xx/include/mach/spear600.h
3 *
4 * SPEAr600 Machine specific definition
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifdef CONFIG_MACH_SPEAR600
15
16#ifndef __MACH_SPEAR600_H
17#define __MACH_SPEAR600_H
18
19#endif /* __MACH_SPEAR600_H */
20
21#endif /* CONFIG_MACH_SPEAR600 */
diff --git a/arch/arm/mach-spear6xx/spear6xx.c b/arch/arm/mach-spear6xx/spear6xx.c
index 2ed8b14c82c8..de194dbb8371 100644
--- a/arch/arm/mach-spear6xx/spear6xx.c
+++ b/arch/arm/mach-spear6xx/spear6xx.c
@@ -13,41 +13,404 @@
13 * warranty of any kind, whether express or implied. 13 * warranty of any kind, whether express or implied.
14 */ 14 */
15 15
16#include <linux/amba/pl08x.h>
17#include <linux/clk.h>
18#include <linux/err.h>
16#include <linux/of.h> 19#include <linux/of.h>
17#include <linux/of_address.h> 20#include <linux/of_address.h>
18#include <linux/of_irq.h> 21#include <linux/of_irq.h>
19#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <asm/hardware/pl080.h>
20#include <asm/hardware/vic.h> 24#include <asm/hardware/vic.h>
21#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/time.h>
27#include <asm/mach/map.h>
28#include <plat/pl080.h>
22#include <mach/generic.h> 29#include <mach/generic.h>
23#include <mach/hardware.h> 30#include <mach/spear.h>
24 31
25/* Following will create static virtual/physical mappings */ 32/* dmac device registration */
26static struct map_desc spear6xx_io_desc[] __initdata = { 33static struct pl08x_channel_data spear600_dma_info[] = {
27 { 34 {
28 .virtual = VA_SPEAR6XX_ICM1_UART0_BASE, 35 .bus_id = "ssp1_rx",
29 .pfn = __phys_to_pfn(SPEAR6XX_ICM1_UART0_BASE), 36 .min_signal = 0,
30 .length = SZ_4K, 37 .max_signal = 0,
31 .type = MT_DEVICE 38 .muxval = 0,
39 .cctl = 0,
40 .periph_buses = PL08X_AHB1,
32 }, { 41 }, {
33 .virtual = VA_SPEAR6XX_CPU_VIC_PRI_BASE, 42 .bus_id = "ssp1_tx",
34 .pfn = __phys_to_pfn(SPEAR6XX_CPU_VIC_PRI_BASE), 43 .min_signal = 1,
35 .length = SZ_4K, 44 .max_signal = 1,
36 .type = MT_DEVICE 45 .muxval = 0,
46 .cctl = 0,
47 .periph_buses = PL08X_AHB1,
37 }, { 48 }, {
38 .virtual = VA_SPEAR6XX_CPU_VIC_SEC_BASE, 49 .bus_id = "uart0_rx",
39 .pfn = __phys_to_pfn(SPEAR6XX_CPU_VIC_SEC_BASE), 50 .min_signal = 2,
40 .length = SZ_4K, 51 .max_signal = 2,
41 .type = MT_DEVICE 52 .muxval = 0,
53 .cctl = 0,
54 .periph_buses = PL08X_AHB1,
55 }, {
56 .bus_id = "uart0_tx",
57 .min_signal = 3,
58 .max_signal = 3,
59 .muxval = 0,
60 .cctl = 0,
61 .periph_buses = PL08X_AHB1,
62 }, {
63 .bus_id = "uart1_rx",
64 .min_signal = 4,
65 .max_signal = 4,
66 .muxval = 0,
67 .cctl = 0,
68 .periph_buses = PL08X_AHB1,
69 }, {
70 .bus_id = "uart1_tx",
71 .min_signal = 5,
72 .max_signal = 5,
73 .muxval = 0,
74 .cctl = 0,
75 .periph_buses = PL08X_AHB1,
76 }, {
77 .bus_id = "ssp2_rx",
78 .min_signal = 6,
79 .max_signal = 6,
80 .muxval = 0,
81 .cctl = 0,
82 .periph_buses = PL08X_AHB2,
83 }, {
84 .bus_id = "ssp2_tx",
85 .min_signal = 7,
86 .max_signal = 7,
87 .muxval = 0,
88 .cctl = 0,
89 .periph_buses = PL08X_AHB2,
90 }, {
91 .bus_id = "ssp0_rx",
92 .min_signal = 8,
93 .max_signal = 8,
94 .muxval = 0,
95 .cctl = 0,
96 .periph_buses = PL08X_AHB1,
97 }, {
98 .bus_id = "ssp0_tx",
99 .min_signal = 9,
100 .max_signal = 9,
101 .muxval = 0,
102 .cctl = 0,
103 .periph_buses = PL08X_AHB1,
104 }, {
105 .bus_id = "i2c_rx",
106 .min_signal = 10,
107 .max_signal = 10,
108 .muxval = 0,
109 .cctl = 0,
110 .periph_buses = PL08X_AHB1,
111 }, {
112 .bus_id = "i2c_tx",
113 .min_signal = 11,
114 .max_signal = 11,
115 .muxval = 0,
116 .cctl = 0,
117 .periph_buses = PL08X_AHB1,
118 }, {
119 .bus_id = "irda",
120 .min_signal = 12,
121 .max_signal = 12,
122 .muxval = 0,
123 .cctl = 0,
124 .periph_buses = PL08X_AHB1,
125 }, {
126 .bus_id = "adc",
127 .min_signal = 13,
128 .max_signal = 13,
129 .muxval = 0,
130 .cctl = 0,
131 .periph_buses = PL08X_AHB2,
132 }, {
133 .bus_id = "to_jpeg",
134 .min_signal = 14,
135 .max_signal = 14,
136 .muxval = 0,
137 .cctl = 0,
138 .periph_buses = PL08X_AHB1,
139 }, {
140 .bus_id = "from_jpeg",
141 .min_signal = 15,
142 .max_signal = 15,
143 .muxval = 0,
144 .cctl = 0,
145 .periph_buses = PL08X_AHB1,
146 }, {
147 .bus_id = "ras0_rx",
148 .min_signal = 0,
149 .max_signal = 0,
150 .muxval = 1,
151 .cctl = 0,
152 .periph_buses = PL08X_AHB1,
153 }, {
154 .bus_id = "ras0_tx",
155 .min_signal = 1,
156 .max_signal = 1,
157 .muxval = 1,
158 .cctl = 0,
159 .periph_buses = PL08X_AHB1,
160 }, {
161 .bus_id = "ras1_rx",
162 .min_signal = 2,
163 .max_signal = 2,
164 .muxval = 1,
165 .cctl = 0,
166 .periph_buses = PL08X_AHB1,
167 }, {
168 .bus_id = "ras1_tx",
169 .min_signal = 3,
170 .max_signal = 3,
171 .muxval = 1,
172 .cctl = 0,
173 .periph_buses = PL08X_AHB1,
174 }, {
175 .bus_id = "ras2_rx",
176 .min_signal = 4,
177 .max_signal = 4,
178 .muxval = 1,
179 .cctl = 0,
180 .periph_buses = PL08X_AHB1,
181 }, {
182 .bus_id = "ras2_tx",
183 .min_signal = 5,
184 .max_signal = 5,
185 .muxval = 1,
186 .cctl = 0,
187 .periph_buses = PL08X_AHB1,
188 }, {
189 .bus_id = "ras3_rx",
190 .min_signal = 6,
191 .max_signal = 6,
192 .muxval = 1,
193 .cctl = 0,
194 .periph_buses = PL08X_AHB1,
195 }, {
196 .bus_id = "ras3_tx",
197 .min_signal = 7,
198 .max_signal = 7,
199 .muxval = 1,
200 .cctl = 0,
201 .periph_buses = PL08X_AHB1,
202 }, {
203 .bus_id = "ras4_rx",
204 .min_signal = 8,
205 .max_signal = 8,
206 .muxval = 1,
207 .cctl = 0,
208 .periph_buses = PL08X_AHB1,
209 }, {
210 .bus_id = "ras4_tx",
211 .min_signal = 9,
212 .max_signal = 9,
213 .muxval = 1,
214 .cctl = 0,
215 .periph_buses = PL08X_AHB1,
216 }, {
217 .bus_id = "ras5_rx",
218 .min_signal = 10,
219 .max_signal = 10,
220 .muxval = 1,
221 .cctl = 0,
222 .periph_buses = PL08X_AHB1,
223 }, {
224 .bus_id = "ras5_tx",
225 .min_signal = 11,
226 .max_signal = 11,
227 .muxval = 1,
228 .cctl = 0,
229 .periph_buses = PL08X_AHB1,
230 }, {
231 .bus_id = "ras6_rx",
232 .min_signal = 12,
233 .max_signal = 12,
234 .muxval = 1,
235 .cctl = 0,
236 .periph_buses = PL08X_AHB1,
237 }, {
238 .bus_id = "ras6_tx",
239 .min_signal = 13,
240 .max_signal = 13,
241 .muxval = 1,
242 .cctl = 0,
243 .periph_buses = PL08X_AHB1,
42 }, { 244 }, {
43 .virtual = VA_SPEAR6XX_ICM3_SYS_CTRL_BASE, 245 .bus_id = "ras7_rx",
44 .pfn = __phys_to_pfn(SPEAR6XX_ICM3_SYS_CTRL_BASE), 246 .min_signal = 14,
45 .length = SZ_4K, 247 .max_signal = 14,
248 .muxval = 1,
249 .cctl = 0,
250 .periph_buses = PL08X_AHB1,
251 }, {
252 .bus_id = "ras7_tx",
253 .min_signal = 15,
254 .max_signal = 15,
255 .muxval = 1,
256 .cctl = 0,
257 .periph_buses = PL08X_AHB1,
258 }, {
259 .bus_id = "ext0_rx",
260 .min_signal = 0,
261 .max_signal = 0,
262 .muxval = 2,
263 .cctl = 0,
264 .periph_buses = PL08X_AHB2,
265 }, {
266 .bus_id = "ext0_tx",
267 .min_signal = 1,
268 .max_signal = 1,
269 .muxval = 2,
270 .cctl = 0,
271 .periph_buses = PL08X_AHB2,
272 }, {
273 .bus_id = "ext1_rx",
274 .min_signal = 2,
275 .max_signal = 2,
276 .muxval = 2,
277 .cctl = 0,
278 .periph_buses = PL08X_AHB2,
279 }, {
280 .bus_id = "ext1_tx",
281 .min_signal = 3,
282 .max_signal = 3,
283 .muxval = 2,
284 .cctl = 0,
285 .periph_buses = PL08X_AHB2,
286 }, {
287 .bus_id = "ext2_rx",
288 .min_signal = 4,
289 .max_signal = 4,
290 .muxval = 2,
291 .cctl = 0,
292 .periph_buses = PL08X_AHB2,
293 }, {
294 .bus_id = "ext2_tx",
295 .min_signal = 5,
296 .max_signal = 5,
297 .muxval = 2,
298 .cctl = 0,
299 .periph_buses = PL08X_AHB2,
300 }, {
301 .bus_id = "ext3_rx",
302 .min_signal = 6,
303 .max_signal = 6,
304 .muxval = 2,
305 .cctl = 0,
306 .periph_buses = PL08X_AHB2,
307 }, {
308 .bus_id = "ext3_tx",
309 .min_signal = 7,
310 .max_signal = 7,
311 .muxval = 2,
312 .cctl = 0,
313 .periph_buses = PL08X_AHB2,
314 }, {
315 .bus_id = "ext4_rx",
316 .min_signal = 8,
317 .max_signal = 8,
318 .muxval = 2,
319 .cctl = 0,
320 .periph_buses = PL08X_AHB2,
321 }, {
322 .bus_id = "ext4_tx",
323 .min_signal = 9,
324 .max_signal = 9,
325 .muxval = 2,
326 .cctl = 0,
327 .periph_buses = PL08X_AHB2,
328 }, {
329 .bus_id = "ext5_rx",
330 .min_signal = 10,
331 .max_signal = 10,
332 .muxval = 2,
333 .cctl = 0,
334 .periph_buses = PL08X_AHB2,
335 }, {
336 .bus_id = "ext5_tx",
337 .min_signal = 11,
338 .max_signal = 11,
339 .muxval = 2,
340 .cctl = 0,
341 .periph_buses = PL08X_AHB2,
342 }, {
343 .bus_id = "ext6_rx",
344 .min_signal = 12,
345 .max_signal = 12,
346 .muxval = 2,
347 .cctl = 0,
348 .periph_buses = PL08X_AHB2,
349 }, {
350 .bus_id = "ext6_tx",
351 .min_signal = 13,
352 .max_signal = 13,
353 .muxval = 2,
354 .cctl = 0,
355 .periph_buses = PL08X_AHB2,
356 }, {
357 .bus_id = "ext7_rx",
358 .min_signal = 14,
359 .max_signal = 14,
360 .muxval = 2,
361 .cctl = 0,
362 .periph_buses = PL08X_AHB2,
363 }, {
364 .bus_id = "ext7_tx",
365 .min_signal = 15,
366 .max_signal = 15,
367 .muxval = 2,
368 .cctl = 0,
369 .periph_buses = PL08X_AHB2,
370 },
371};
372
373struct pl08x_platform_data pl080_plat_data = {
374 .memcpy_channel = {
375 .bus_id = "memcpy",
376 .cctl = (PL080_BSIZE_16 << PL080_CONTROL_SB_SIZE_SHIFT | \
377 PL080_BSIZE_16 << PL080_CONTROL_DB_SIZE_SHIFT | \
378 PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT | \
379 PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT | \
380 PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE | \
381 PL080_CONTROL_PROT_SYS),
382 },
383 .lli_buses = PL08X_AHB1,
384 .mem_buses = PL08X_AHB1,
385 .get_signal = pl080_get_signal,
386 .put_signal = pl080_put_signal,
387 .slave_channels = spear600_dma_info,
388 .num_slave_channels = ARRAY_SIZE(spear600_dma_info),
389};
390
391/*
392 * Following will create 16MB static virtual/physical mappings
393 * PHYSICAL VIRTUAL
394 * 0xF0000000 0xF0000000
395 * 0xF1000000 0xF1000000
396 * 0xD0000000 0xFD000000
397 * 0xFC000000 0xFC000000
398 */
399struct map_desc spear6xx_io_desc[] __initdata = {
400 {
401 .virtual = VA_SPEAR6XX_ML_CPU_BASE,
402 .pfn = __phys_to_pfn(SPEAR6XX_ML_CPU_BASE),
403 .length = 2 * SZ_16M,
404 .type = MT_DEVICE
405 }, {
406 .virtual = VA_SPEAR6XX_ICM1_BASE,
407 .pfn = __phys_to_pfn(SPEAR6XX_ICM1_BASE),
408 .length = SZ_16M,
46 .type = MT_DEVICE 409 .type = MT_DEVICE
47 }, { 410 }, {
48 .virtual = VA_SPEAR6XX_ICM3_MISC_REG_BASE, 411 .virtual = VA_SPEAR6XX_ICM3_SMI_CTRL_BASE,
49 .pfn = __phys_to_pfn(SPEAR6XX_ICM3_MISC_REG_BASE), 412 .pfn = __phys_to_pfn(SPEAR6XX_ICM3_SMI_CTRL_BASE),
50 .length = SZ_4K, 413 .length = SZ_16M,
51 .type = MT_DEVICE 414 .type = MT_DEVICE
52 }, 415 },
53}; 416};
@@ -85,16 +448,24 @@ static void __init spear6xx_timer_init(void)
85 clk_put(gpt_clk); 448 clk_put(gpt_clk);
86 clk_put(pclk); 449 clk_put(pclk);
87 450
88 spear_setup_timer(); 451 spear_setup_timer(SPEAR6XX_CPU_TMR_BASE, IRQ_CPU_GPT1_1);
89} 452}
90 453
91struct sys_timer spear6xx_timer = { 454struct sys_timer spear6xx_timer = {
92 .init = spear6xx_timer_init, 455 .init = spear6xx_timer_init,
93}; 456};
94 457
458/* Add auxdata to pass platform data */
459struct of_dev_auxdata spear6xx_auxdata_lookup[] __initdata = {
460 OF_DEV_AUXDATA("arm,pl080", SPEAR6XX_ICM3_DMA_BASE, NULL,
461 &pl080_plat_data),
462 {}
463};
464
95static void __init spear600_dt_init(void) 465static void __init spear600_dt_init(void)
96{ 466{
97 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 467 of_platform_populate(NULL, of_default_bus_match_table,
468 spear6xx_auxdata_lookup, NULL);
98} 469}
99 470
100static const char *spear600_dt_board_compat[] = { 471static const char *spear600_dt_board_compat[] = {
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index d87d968115ec..2eb4445ddb14 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -5,7 +5,6 @@ obj-y += io.o
5obj-y += irq.o 5obj-y += irq.o
6obj-y += clock.o 6obj-y += clock.o
7obj-y += timer.o 7obj-y += timer.o
8obj-y += pinmux.o
9obj-y += fuse.o 8obj-y += fuse.o
10obj-y += pmc.o 9obj-y += pmc.o
11obj-y += flowctrl.o 10obj-y += flowctrl.o
@@ -14,8 +13,6 @@ obj-$(CONFIG_CPU_IDLE) += sleep.o
14obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += powergate.o 13obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += powergate.o
15obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_clocks.o 14obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_clocks.o
16obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o 15obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o
17obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += pinmux-tegra20-tables.o
18obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += pinmux-tegra30-tables.o
19obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o 16obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o
20obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += tegra30_clocks.o 17obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += tegra30_clocks.o
21obj-$(CONFIG_SMP) += platsmp.o headsmp.o 18obj-$(CONFIG_SMP) += platsmp.o headsmp.o
diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c
index 0952494f481a..8351c4c147ad 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -37,7 +37,6 @@
37#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
38#include <asm/mach/time.h> 38#include <asm/mach/time.h>
39#include <asm/setup.h> 39#include <asm/setup.h>
40#include <asm/hardware/gic.h>
41 40
42#include <mach/iomap.h> 41#include <mach/iomap.h>
43#include <mach/irqs.h> 42#include <mach/irqs.h>
@@ -47,15 +46,7 @@
47#include "clock.h" 46#include "clock.h"
48#include "devices.h" 47#include "devices.h"
49 48
50void harmony_pinmux_init(void);
51void paz00_pinmux_init(void);
52void seaboard_pinmux_init(void);
53void trimslice_pinmux_init(void);
54void ventana_pinmux_init(void);
55
56struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { 49struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
57 OF_DEV_AUXDATA("nvidia,tegra20-pinmux", TEGRA_APB_MISC_BASE + 0x14, "tegra-pinmux", NULL),
58 OF_DEV_AUXDATA("nvidia,tegra20-gpio", TEGRA_GPIO_BASE, "tegra-gpio", NULL),
59 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, "sdhci-tegra.0", NULL), 50 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, "sdhci-tegra.0", NULL),
60 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC2_BASE, "sdhci-tegra.1", NULL), 51 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC2_BASE, "sdhci-tegra.1", NULL),
61 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC3_BASE, "sdhci-tegra.2", NULL), 52 OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC3_BASE, "sdhci-tegra.2", NULL),
@@ -95,33 +86,10 @@ static struct of_device_id tegra_dt_match_table[] __initdata = {
95 {} 86 {}
96}; 87};
97 88
98static struct {
99 char *machine;
100 void (*init)(void);
101} pinmux_configs[] = {
102 { "compulab,trimslice", trimslice_pinmux_init },
103 { "nvidia,harmony", harmony_pinmux_init },
104 { "compal,paz00", paz00_pinmux_init },
105 { "nvidia,seaboard", seaboard_pinmux_init },
106 { "nvidia,ventana", ventana_pinmux_init },
107};
108
109static void __init tegra_dt_init(void) 89static void __init tegra_dt_init(void)
110{ 90{
111 int i;
112
113 tegra_clk_init_from_table(tegra_dt_clk_init_table); 91 tegra_clk_init_from_table(tegra_dt_clk_init_table);
114 92
115 for (i = 0; i < ARRAY_SIZE(pinmux_configs); i++) {
116 if (of_machine_is_compatible(pinmux_configs[i].machine)) {
117 pinmux_configs[i].init();
118 break;
119 }
120 }
121
122 WARN(i == ARRAY_SIZE(pinmux_configs),
123 "Unknown platform! Pinmuxing not initialized\n");
124
125 /* 93 /*
126 * Finished with the static registrations now; fill in the missing 94 * Finished with the static registrations now; fill in the missing
127 * devices 95 * devices
diff --git a/arch/arm/mach-tegra/board-harmony-pinmux.c b/arch/arm/mach-tegra/board-harmony-pinmux.c
index 1af85bccc0f1..83d420fbc58c 100644
--- a/arch/arm/mach-tegra/board-harmony-pinmux.c
+++ b/arch/arm/mach-tegra/board-harmony-pinmux.c
@@ -2,6 +2,7 @@
2 * arch/arm/mach-tegra/board-harmony-pinmux.c 2 * arch/arm/mach-tegra/board-harmony-pinmux.c
3 * 3 *
4 * Copyright (C) 2010 Google, Inc. 4 * Copyright (C) 2010 Google, Inc.
5 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
5 * 6 *
6 * This software is licensed under the terms of the GNU General Public 7 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 8 * License version 2, as published by the Free Software Foundation, and
@@ -15,153 +16,138 @@
15 */ 16 */
16 17
17#include <linux/kernel.h> 18#include <linux/kernel.h>
18#include <linux/gpio.h>
19#include <linux/of.h>
20 19
21#include <mach/pinmux.h>
22#include <mach/pinmux-tegra20.h>
23
24#include "gpio-names.h"
25#include "board-harmony.h" 20#include "board-harmony.h"
26#include "board-pinmux.h" 21#include "board-pinmux.h"
27 22
28static struct tegra_pingroup_config harmony_pinmux[] = { 23static struct pinctrl_map harmony_map[] = {
29 {TEGRA_PINGROUP_ATA, TEGRA_MUX_IDE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 24 TEGRA_MAP_MUXCONF("ata", "ide", none, driven),
30 {TEGRA_PINGROUP_ATB, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 25 TEGRA_MAP_MUXCONF("atb", "sdio4", none, driven),
31 {TEGRA_PINGROUP_ATC, TEGRA_MUX_NAND, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 26 TEGRA_MAP_MUXCONF("atc", "nand", none, driven),
32 {TEGRA_PINGROUP_ATD, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 27 TEGRA_MAP_MUXCONF("atd", "gmi", none, driven),
33 {TEGRA_PINGROUP_ATE, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 28 TEGRA_MAP_MUXCONF("ate", "gmi", none, driven),
34 {TEGRA_PINGROUP_CDEV1, TEGRA_MUX_PLLA_OUT, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 29 TEGRA_MAP_MUXCONF("cdev1", "plla_out", none, driven),
35 {TEGRA_PINGROUP_CDEV2, TEGRA_MUX_PLLP_OUT4, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 30 TEGRA_MAP_MUXCONF("cdev2", "pllp_out4", down, tristate),
36 {TEGRA_PINGROUP_CRTP, TEGRA_MUX_CRT, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 31 TEGRA_MAP_MUXCONF("crtp", "crt", none, tristate),
37 {TEGRA_PINGROUP_CSUS, TEGRA_MUX_VI_SENSOR_CLK, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 32 TEGRA_MAP_MUXCONF("csus", "vi_sensor_clk", down, tristate),
38 {TEGRA_PINGROUP_DAP1, TEGRA_MUX_DAP1, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 33 TEGRA_MAP_MUXCONF("dap1", "dap1", none, driven),
39 {TEGRA_PINGROUP_DAP2, TEGRA_MUX_DAP2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 34 TEGRA_MAP_MUXCONF("dap2", "dap2", none, tristate),
40 {TEGRA_PINGROUP_DAP3, TEGRA_MUX_DAP3, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 35 TEGRA_MAP_MUXCONF("dap3", "dap3", none, tristate),
41 {TEGRA_PINGROUP_DAP4, TEGRA_MUX_DAP4, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 36 TEGRA_MAP_MUXCONF("dap4", "dap4", none, tristate),
42 {TEGRA_PINGROUP_DDC, TEGRA_MUX_I2C2, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 37 TEGRA_MAP_MUXCONF("ddc", "i2c2", up, driven),
43 {TEGRA_PINGROUP_DTA, TEGRA_MUX_SDIO2, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 38 TEGRA_MAP_MUXCONF("dta", "sdio2", up, driven),
44 {TEGRA_PINGROUP_DTB, TEGRA_MUX_RSVD1, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 39 TEGRA_MAP_MUXCONF("dtb", "rsvd1", none, driven),
45 {TEGRA_PINGROUP_DTC, TEGRA_MUX_RSVD1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 40 TEGRA_MAP_MUXCONF("dtc", "rsvd1", none, tristate),
46 {TEGRA_PINGROUP_DTD, TEGRA_MUX_SDIO2, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 41 TEGRA_MAP_MUXCONF("dtd", "sdio2", up, driven),
47 {TEGRA_PINGROUP_DTE, TEGRA_MUX_RSVD1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 42 TEGRA_MAP_MUXCONF("dte", "rsvd1", none, tristate),
48 {TEGRA_PINGROUP_DTF, TEGRA_MUX_I2C3, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 43 TEGRA_MAP_MUXCONF("dtf", "i2c3", none, tristate),
49 {TEGRA_PINGROUP_GMA, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 44 TEGRA_MAP_MUXCONF("gma", "sdio4", none, driven),
50 {TEGRA_PINGROUP_GMB, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 45 TEGRA_MAP_MUXCONF("gmb", "gmi", none, driven),
51 {TEGRA_PINGROUP_GMC, TEGRA_MUX_UARTD, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 46 TEGRA_MAP_MUXCONF("gmc", "uartd", none, driven),
52 {TEGRA_PINGROUP_GMD, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 47 TEGRA_MAP_MUXCONF("gmd", "gmi", none, driven),
53 {TEGRA_PINGROUP_GME, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 48 TEGRA_MAP_MUXCONF("gme", "sdio4", none, driven),
54 {TEGRA_PINGROUP_GPU, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 49 TEGRA_MAP_MUXCONF("gpu", "gmi", none, tristate),
55 {TEGRA_PINGROUP_GPU7, TEGRA_MUX_RTCK, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 50 TEGRA_MAP_MUXCONF("gpu7", "rtck", none, driven),
56 {TEGRA_PINGROUP_GPV, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 51 TEGRA_MAP_MUXCONF("gpv", "pcie", none, driven),
57 {TEGRA_PINGROUP_HDINT, TEGRA_MUX_HDMI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 52 TEGRA_MAP_MUXCONF("hdint", "hdmi", na, tristate),
58 {TEGRA_PINGROUP_I2CP, TEGRA_MUX_I2C, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 53 TEGRA_MAP_MUXCONF("i2cp", "i2cp", none, driven),
59 {TEGRA_PINGROUP_IRRX, TEGRA_MUX_UARTA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 54 TEGRA_MAP_MUXCONF("irrx", "uarta", up, tristate),
60 {TEGRA_PINGROUP_IRTX, TEGRA_MUX_UARTA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 55 TEGRA_MAP_MUXCONF("irtx", "uarta", up, tristate),
61 {TEGRA_PINGROUP_KBCA, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 56 TEGRA_MAP_MUXCONF("kbca", "kbc", up, driven),
62 {TEGRA_PINGROUP_KBCB, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 57 TEGRA_MAP_MUXCONF("kbcb", "kbc", up, driven),
63 {TEGRA_PINGROUP_KBCC, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 58 TEGRA_MAP_MUXCONF("kbcc", "kbc", up, driven),
64 {TEGRA_PINGROUP_KBCD, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 59 TEGRA_MAP_MUXCONF("kbcd", "kbc", up, driven),
65 {TEGRA_PINGROUP_KBCE, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 60 TEGRA_MAP_MUXCONF("kbce", "kbc", up, driven),
66 {TEGRA_PINGROUP_KBCF, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 61 TEGRA_MAP_MUXCONF("kbcf", "kbc", up, driven),
67 {TEGRA_PINGROUP_LCSN, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 62 TEGRA_MAP_MUXCONF("lcsn", "displaya", na, tristate),
68 {TEGRA_PINGROUP_LD0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 63 TEGRA_MAP_MUXCONF("ld0", "displaya", na, driven),
69 {TEGRA_PINGROUP_LD1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 64 TEGRA_MAP_MUXCONF("ld1", "displaya", na, driven),
70 {TEGRA_PINGROUP_LD10, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 65 TEGRA_MAP_MUXCONF("ld10", "displaya", na, driven),
71 {TEGRA_PINGROUP_LD11, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 66 TEGRA_MAP_MUXCONF("ld11", "displaya", na, driven),
72 {TEGRA_PINGROUP_LD12, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 67 TEGRA_MAP_MUXCONF("ld12", "displaya", na, driven),
73 {TEGRA_PINGROUP_LD13, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 68 TEGRA_MAP_MUXCONF("ld13", "displaya", na, driven),
74 {TEGRA_PINGROUP_LD14, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 69 TEGRA_MAP_MUXCONF("ld14", "displaya", na, driven),
75 {TEGRA_PINGROUP_LD15, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 70 TEGRA_MAP_MUXCONF("ld15", "displaya", na, driven),
76 {TEGRA_PINGROUP_LD16, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 71 TEGRA_MAP_MUXCONF("ld16", "displaya", na, driven),
77 {TEGRA_PINGROUP_LD17, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 72 TEGRA_MAP_MUXCONF("ld17", "displaya", na, driven),
78 {TEGRA_PINGROUP_LD2, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 73 TEGRA_MAP_MUXCONF("ld2", "displaya", na, driven),
79 {TEGRA_PINGROUP_LD3, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 74 TEGRA_MAP_MUXCONF("ld3", "displaya", na, driven),
80 {TEGRA_PINGROUP_LD4, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 75 TEGRA_MAP_MUXCONF("ld4", "displaya", na, driven),
81 {TEGRA_PINGROUP_LD5, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 76 TEGRA_MAP_MUXCONF("ld5", "displaya", na, driven),
82 {TEGRA_PINGROUP_LD6, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 77 TEGRA_MAP_MUXCONF("ld6", "displaya", na, driven),
83 {TEGRA_PINGROUP_LD7, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 78 TEGRA_MAP_MUXCONF("ld7", "displaya", na, driven),
84 {TEGRA_PINGROUP_LD8, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 79 TEGRA_MAP_MUXCONF("ld8", "displaya", na, driven),
85 {TEGRA_PINGROUP_LD9, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 80 TEGRA_MAP_MUXCONF("ld9", "displaya", na, driven),
86 {TEGRA_PINGROUP_LDC, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 81 TEGRA_MAP_MUXCONF("ldc", "displaya", na, tristate),
87 {TEGRA_PINGROUP_LDI, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 82 TEGRA_MAP_MUXCONF("ldi", "displaya", na, driven),
88 {TEGRA_PINGROUP_LHP0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 83 TEGRA_MAP_MUXCONF("lhp0", "displaya", na, driven),
89 {TEGRA_PINGROUP_LHP1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 84 TEGRA_MAP_MUXCONF("lhp1", "displaya", na, driven),
90 {TEGRA_PINGROUP_LHP2, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 85 TEGRA_MAP_MUXCONF("lhp2", "displaya", na, driven),
91 {TEGRA_PINGROUP_LHS, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 86 TEGRA_MAP_MUXCONF("lhs", "displaya", na, driven),
92 {TEGRA_PINGROUP_LM0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 87 TEGRA_MAP_MUXCONF("lm0", "displaya", na, driven),
93 {TEGRA_PINGROUP_LM1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 88 TEGRA_MAP_MUXCONF("lm1", "displaya", na, tristate),
94 {TEGRA_PINGROUP_LPP, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 89 TEGRA_MAP_MUXCONF("lpp", "displaya", na, driven),
95 {TEGRA_PINGROUP_LPW0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 90 TEGRA_MAP_MUXCONF("lpw0", "displaya", na, driven),
96 {TEGRA_PINGROUP_LPW1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 91 TEGRA_MAP_MUXCONF("lpw1", "displaya", na, tristate),
97 {TEGRA_PINGROUP_LPW2, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 92 TEGRA_MAP_MUXCONF("lpw2", "displaya", na, driven),
98 {TEGRA_PINGROUP_LSC0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 93 TEGRA_MAP_MUXCONF("lsc0", "displaya", na, driven),
99 {TEGRA_PINGROUP_LSC1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 94 TEGRA_MAP_MUXCONF("lsc1", "displaya", na, tristate),
100 {TEGRA_PINGROUP_LSCK, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 95 TEGRA_MAP_MUXCONF("lsck", "displaya", na, tristate),
101 {TEGRA_PINGROUP_LSDA, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 96 TEGRA_MAP_MUXCONF("lsda", "displaya", na, tristate),
102 {TEGRA_PINGROUP_LSDI, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 97 TEGRA_MAP_MUXCONF("lsdi", "displaya", na, tristate),
103 {TEGRA_PINGROUP_LSPI, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 98 TEGRA_MAP_MUXCONF("lspi", "displaya", na, driven),
104 {TEGRA_PINGROUP_LVP0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 99 TEGRA_MAP_MUXCONF("lvp0", "displaya", na, tristate),
105 {TEGRA_PINGROUP_LVP1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 100 TEGRA_MAP_MUXCONF("lvp1", "displaya", na, driven),
106 {TEGRA_PINGROUP_LVS, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 101 TEGRA_MAP_MUXCONF("lvs", "displaya", na, driven),
107 {TEGRA_PINGROUP_OWC, TEGRA_MUX_RSVD2, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 102 TEGRA_MAP_MUXCONF("owc", "rsvd2", na, tristate),
108 {TEGRA_PINGROUP_PMC, TEGRA_MUX_PWR_ON, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 103 TEGRA_MAP_MUXCONF("pmc", "pwr_on", na, driven),
109 {TEGRA_PINGROUP_PTA, TEGRA_MUX_HDMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 104 TEGRA_MAP_MUXCONF("pta", "hdmi", none, driven),
110 {TEGRA_PINGROUP_RM, TEGRA_MUX_I2C, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 105 TEGRA_MAP_MUXCONF("rm", "i2c1", none, driven),
111 {TEGRA_PINGROUP_SDB, TEGRA_MUX_PWM, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 106 TEGRA_MAP_MUXCONF("sdb", "pwm", na, tristate),
112 {TEGRA_PINGROUP_SDC, TEGRA_MUX_PWM, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 107 TEGRA_MAP_MUXCONF("sdc", "pwm", up, driven),
113 {TEGRA_PINGROUP_SDD, TEGRA_MUX_PWM, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 108 TEGRA_MAP_MUXCONF("sdd", "pwm", up, tristate),
114 {TEGRA_PINGROUP_SDIO1, TEGRA_MUX_SDIO1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 109 TEGRA_MAP_MUXCONF("sdio1", "sdio1", none, tristate),
115 {TEGRA_PINGROUP_SLXA, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 110 TEGRA_MAP_MUXCONF("slxa", "pcie", none, driven),
116 {TEGRA_PINGROUP_SLXC, TEGRA_MUX_SPDIF, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 111 TEGRA_MAP_MUXCONF("slxc", "spdif", none, tristate),
117 {TEGRA_PINGROUP_SLXD, TEGRA_MUX_SPDIF, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 112 TEGRA_MAP_MUXCONF("slxd", "spdif", none, tristate),
118 {TEGRA_PINGROUP_SLXK, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 113 TEGRA_MAP_MUXCONF("slxk", "pcie", none, driven),
119 {TEGRA_PINGROUP_SPDI, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 114 TEGRA_MAP_MUXCONF("spdi", "rsvd2", none, tristate),
120 {TEGRA_PINGROUP_SPDO, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 115 TEGRA_MAP_MUXCONF("spdo", "rsvd2", none, tristate),
121 {TEGRA_PINGROUP_SPIA, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 116 TEGRA_MAP_MUXCONF("spia", "gmi", none, driven),
122 {TEGRA_PINGROUP_SPIB, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 117 TEGRA_MAP_MUXCONF("spib", "gmi", none, driven),
123 {TEGRA_PINGROUP_SPIC, TEGRA_MUX_GMI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 118 TEGRA_MAP_MUXCONF("spic", "gmi", up, tristate),
124 {TEGRA_PINGROUP_SPID, TEGRA_MUX_SPI1, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 119 TEGRA_MAP_MUXCONF("spid", "spi1", down, tristate),
125 {TEGRA_PINGROUP_SPIE, TEGRA_MUX_SPI1, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 120 TEGRA_MAP_MUXCONF("spie", "spi1", up, tristate),
126 {TEGRA_PINGROUP_SPIF, TEGRA_MUX_SPI1, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 121 TEGRA_MAP_MUXCONF("spif", "spi1", down, tristate),
127 {TEGRA_PINGROUP_SPIG, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 122 TEGRA_MAP_MUXCONF("spig", "spi2_alt", none, tristate),
128 {TEGRA_PINGROUP_SPIH, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 123 TEGRA_MAP_MUXCONF("spih", "spi2_alt", up, tristate),
129 {TEGRA_PINGROUP_UAA, TEGRA_MUX_ULPI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 124 TEGRA_MAP_MUXCONF("uaa", "ulpi", up, tristate),
130 {TEGRA_PINGROUP_UAB, TEGRA_MUX_ULPI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 125 TEGRA_MAP_MUXCONF("uab", "ulpi", up, tristate),
131 {TEGRA_PINGROUP_UAC, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 126 TEGRA_MAP_MUXCONF("uac", "rsvd2", none, tristate),
132 {TEGRA_PINGROUP_UAD, TEGRA_MUX_IRDA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 127 TEGRA_MAP_MUXCONF("uad", "irda", up, tristate),
133 {TEGRA_PINGROUP_UCA, TEGRA_MUX_UARTC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 128 TEGRA_MAP_MUXCONF("uca", "uartc", up, tristate),
134 {TEGRA_PINGROUP_UCB, TEGRA_MUX_UARTC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 129 TEGRA_MAP_MUXCONF("ucb", "uartc", up, tristate),
135 {TEGRA_PINGROUP_UDA, TEGRA_MUX_ULPI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 130 TEGRA_MAP_MUXCONF("uda", "ulpi", none, tristate),
136 {TEGRA_PINGROUP_CK32, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 131 TEGRA_MAP_CONF("ck32", none, na),
137 {TEGRA_PINGROUP_DDRC, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 132 TEGRA_MAP_CONF("ddrc", none, na),
138 {TEGRA_PINGROUP_PMCA, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 133 TEGRA_MAP_CONF("pmca", none, na),
139 {TEGRA_PINGROUP_PMCB, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 134 TEGRA_MAP_CONF("pmcb", none, na),
140 {TEGRA_PINGROUP_PMCC, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 135 TEGRA_MAP_CONF("pmcc", none, na),
141 {TEGRA_PINGROUP_PMCD, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 136 TEGRA_MAP_CONF("pmcd", none, na),
142 {TEGRA_PINGROUP_PMCE, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 137 TEGRA_MAP_CONF("pmce", none, na),
143 {TEGRA_PINGROUP_XM2C, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 138 TEGRA_MAP_CONF("xm2c", none, na),
144 {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 139 TEGRA_MAP_CONF("xm2d", none, na),
145}; 140 TEGRA_MAP_CONF("ls", up, na),
146 141 TEGRA_MAP_CONF("lc", up, na),
147static struct tegra_gpio_table gpio_table[] = { 142 TEGRA_MAP_CONF("ld17_0", down, na),
148 { .gpio = TEGRA_GPIO_SD2_CD, .enable = true }, 143 TEGRA_MAP_CONF("ld19_18", down, na),
149 { .gpio = TEGRA_GPIO_SD2_WP, .enable = true }, 144 TEGRA_MAP_CONF("ld21_20", down, na),
150 { .gpio = TEGRA_GPIO_SD2_POWER, .enable = true }, 145 TEGRA_MAP_CONF("ld23_22", down, na),
151 { .gpio = TEGRA_GPIO_SD4_CD, .enable = true },
152 { .gpio = TEGRA_GPIO_SD4_WP, .enable = true },
153 { .gpio = TEGRA_GPIO_SD4_POWER, .enable = true },
154 { .gpio = TEGRA_GPIO_CDC_IRQ, .enable = true },
155 { .gpio = TEGRA_GPIO_HP_DET, .enable = true },
156 { .gpio = TEGRA_GPIO_INT_MIC_EN, .enable = true },
157 { .gpio = TEGRA_GPIO_EXT_MIC_EN, .enable = true },
158}; 146};
159 147
160static struct tegra_board_pinmux_conf conf = { 148static struct tegra_board_pinmux_conf conf = {
161 .pgs = harmony_pinmux, 149 .maps = harmony_map,
162 .pg_count = ARRAY_SIZE(harmony_pinmux), 150 .map_count = ARRAY_SIZE(harmony_map),
163 .gpios = gpio_table,
164 .gpio_count = ARRAY_SIZE(gpio_table),
165}; 151};
166 152
167void harmony_pinmux_init(void) 153void harmony_pinmux_init(void)
diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c
index c00aadb01e09..222182e00226 100644
--- a/arch/arm/mach-tegra/board-harmony.c
+++ b/arch/arm/mach-tegra/board-harmony.c
@@ -19,6 +19,7 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/serial_8250.h> 21#include <linux/serial_8250.h>
22#include <linux/of_serial.h>
22#include <linux/clk.h> 23#include <linux/clk.h>
23#include <linux/dma-mapping.h> 24#include <linux/dma-mapping.h>
24#include <linux/pda_power.h> 25#include <linux/pda_power.h>
@@ -52,6 +53,7 @@ static struct plat_serial8250_port debug_uart_platform_data[] = {
52 .irq = INT_UARTD, 53 .irq = INT_UARTD,
53 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE, 54 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
54 .type = PORT_TEGRA, 55 .type = PORT_TEGRA,
56 .handle_break = tegra_serial_handle_break,
55 .iotype = UPIO_MEM, 57 .iotype = UPIO_MEM,
56 .regshift = 2, 58 .regshift = 2,
57 .uartclk = 216000000, 59 .uartclk = 216000000,
diff --git a/arch/arm/mach-tegra/board-paz00-pinmux.c b/arch/arm/mach-tegra/board-paz00-pinmux.c
index c775572dcea4..6f1111b48e7c 100644
--- a/arch/arm/mach-tegra/board-paz00-pinmux.c
+++ b/arch/arm/mach-tegra/board-paz00-pinmux.c
@@ -2,6 +2,7 @@
2 * arch/arm/mach-tegra/board-paz00-pinmux.c 2 * arch/arm/mach-tegra/board-paz00-pinmux.c
3 * 3 *
4 * Copyright (C) 2010 Marc Dietrich <marvin24@gmx.de> 4 * Copyright (C) 2010 Marc Dietrich <marvin24@gmx.de>
5 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
5 * 6 *
6 * This software is licensed under the terms of the GNU General Public 7 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 8 * License version 2, as published by the Free Software Foundation, and
@@ -15,150 +16,138 @@
15 */ 16 */
16 17
17#include <linux/kernel.h> 18#include <linux/kernel.h>
18#include <linux/gpio.h>
19#include <linux/of.h>
20 19
21#include <mach/pinmux.h>
22#include <mach/pinmux-tegra20.h>
23
24#include "gpio-names.h"
25#include "board-paz00.h" 20#include "board-paz00.h"
26#include "board-pinmux.h" 21#include "board-pinmux.h"
27 22
28static struct tegra_pingroup_config paz00_pinmux[] = { 23static struct pinctrl_map paz00_map[] = {
29 {TEGRA_PINGROUP_ATA, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 24 TEGRA_MAP_MUXCONF("ata", "gmi", none, driven),
30 {TEGRA_PINGROUP_ATB, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 25 TEGRA_MAP_MUXCONF("atb", "sdio4", none, driven),
31 {TEGRA_PINGROUP_ATC, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 26 TEGRA_MAP_MUXCONF("atc", "gmi", none, driven),
32 {TEGRA_PINGROUP_ATD, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 27 TEGRA_MAP_MUXCONF("atd", "gmi", none, driven),
33 {TEGRA_PINGROUP_ATE, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 28 TEGRA_MAP_MUXCONF("ate", "gmi", none, driven),
34 {TEGRA_PINGROUP_CDEV1, TEGRA_MUX_PLLA_OUT, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 29 TEGRA_MAP_MUXCONF("cdev1", "plla_out", none, driven),
35 {TEGRA_PINGROUP_CDEV2, TEGRA_MUX_PLLP_OUT4, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 30 TEGRA_MAP_MUXCONF("cdev2", "pllp_out4", down, driven),
36 {TEGRA_PINGROUP_CRTP, TEGRA_MUX_CRT, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 31 TEGRA_MAP_MUXCONF("crtp", "crt", none, tristate),
37 {TEGRA_PINGROUP_CSUS, TEGRA_MUX_PLLC_OUT1, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 32 TEGRA_MAP_MUXCONF("csus", "pllc_out1", down, tristate),
38 {TEGRA_PINGROUP_DAP1, TEGRA_MUX_DAP1, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 33 TEGRA_MAP_MUXCONF("dap1", "dap1", none, driven),
39 {TEGRA_PINGROUP_DAP2, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 34 TEGRA_MAP_MUXCONF("dap2", "gmi", none, driven),
40 {TEGRA_PINGROUP_DAP3, TEGRA_MUX_DAP3, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 35 TEGRA_MAP_MUXCONF("dap3", "dap3", none, tristate),
41 {TEGRA_PINGROUP_DAP4, TEGRA_MUX_DAP4, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 36 TEGRA_MAP_MUXCONF("dap4", "dap4", none, tristate),
42 {TEGRA_PINGROUP_DDC, TEGRA_MUX_I2C2, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 37 TEGRA_MAP_MUXCONF("ddc", "i2c2", up, driven),
43 {TEGRA_PINGROUP_DTA, TEGRA_MUX_RSVD1, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 38 TEGRA_MAP_MUXCONF("dta", "rsvd1", up, tristate),
44 {TEGRA_PINGROUP_DTB, TEGRA_MUX_RSVD1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 39 TEGRA_MAP_MUXCONF("dtb", "rsvd1", none, tristate),
45 {TEGRA_PINGROUP_DTC, TEGRA_MUX_RSVD1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 40 TEGRA_MAP_MUXCONF("dtc", "rsvd1", none, tristate),
46 {TEGRA_PINGROUP_DTD, TEGRA_MUX_RSVD1, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 41 TEGRA_MAP_MUXCONF("dtd", "rsvd1", up, tristate),
47 {TEGRA_PINGROUP_DTE, TEGRA_MUX_RSVD1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 42 TEGRA_MAP_MUXCONF("dte", "rsvd1", none, tristate),
48 {TEGRA_PINGROUP_DTF, TEGRA_MUX_I2C3, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 43 TEGRA_MAP_MUXCONF("dtf", "i2c3", none, driven),
49 {TEGRA_PINGROUP_GMA, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 44 TEGRA_MAP_MUXCONF("gma", "sdio4", none, driven),
50 {TEGRA_PINGROUP_GMB, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 45 TEGRA_MAP_MUXCONF("gmb", "gmi", none, driven),
51 {TEGRA_PINGROUP_GMC, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 46 TEGRA_MAP_MUXCONF("gmc", "gmi", none, driven),
52 {TEGRA_PINGROUP_GMD, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 47 TEGRA_MAP_MUXCONF("gmd", "gmi", none, driven),
53 {TEGRA_PINGROUP_GME, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 48 TEGRA_MAP_MUXCONF("gme", "sdio4", none, driven),
54 {TEGRA_PINGROUP_GPU, TEGRA_MUX_PWM, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 49 TEGRA_MAP_MUXCONF("gpu", "pwm", none, driven),
55 {TEGRA_PINGROUP_GPU7, TEGRA_MUX_RTCK, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 50 TEGRA_MAP_MUXCONF("gpu7", "rtck", none, driven),
56 {TEGRA_PINGROUP_GPV, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 51 TEGRA_MAP_MUXCONF("gpv", "pcie", none, driven),
57 {TEGRA_PINGROUP_HDINT, TEGRA_MUX_HDMI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 52 TEGRA_MAP_MUXCONF("hdint", "hdmi", na, driven),
58 {TEGRA_PINGROUP_I2CP, TEGRA_MUX_I2C, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 53 TEGRA_MAP_MUXCONF("i2cp", "i2cp", none, driven),
59 {TEGRA_PINGROUP_IRRX, TEGRA_MUX_UARTA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 54 TEGRA_MAP_MUXCONF("irrx", "uarta", up, driven),
60 {TEGRA_PINGROUP_IRTX, TEGRA_MUX_UARTA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 55 TEGRA_MAP_MUXCONF("irtx", "uarta", up, driven),
61 {TEGRA_PINGROUP_KBCA, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 56 TEGRA_MAP_MUXCONF("kbca", "kbc", up, driven),
62 {TEGRA_PINGROUP_KBCB, TEGRA_MUX_SDIO2, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 57 TEGRA_MAP_MUXCONF("kbcb", "sdio2", up, driven),
63 {TEGRA_PINGROUP_KBCC, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 58 TEGRA_MAP_MUXCONF("kbcc", "kbc", up, driven),
64 {TEGRA_PINGROUP_KBCD, TEGRA_MUX_SDIO2, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 59 TEGRA_MAP_MUXCONF("kbcd", "sdio2", up, driven),
65 {TEGRA_PINGROUP_KBCE, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 60 TEGRA_MAP_MUXCONF("kbce", "kbc", up, driven),
66 {TEGRA_PINGROUP_KBCF, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 61 TEGRA_MAP_MUXCONF("kbcf", "kbc", up, driven),
67 {TEGRA_PINGROUP_LCSN, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 62 TEGRA_MAP_MUXCONF("lcsn", "displaya", na, tristate),
68 {TEGRA_PINGROUP_LD0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 63 TEGRA_MAP_MUXCONF("ld0", "displaya", na, driven),
69 {TEGRA_PINGROUP_LD1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 64 TEGRA_MAP_MUXCONF("ld1", "displaya", na, driven),
70 {TEGRA_PINGROUP_LD10, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 65 TEGRA_MAP_MUXCONF("ld10", "displaya", na, driven),
71 {TEGRA_PINGROUP_LD11, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 66 TEGRA_MAP_MUXCONF("ld11", "displaya", na, driven),
72 {TEGRA_PINGROUP_LD12, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 67 TEGRA_MAP_MUXCONF("ld12", "displaya", na, driven),
73 {TEGRA_PINGROUP_LD13, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 68 TEGRA_MAP_MUXCONF("ld13", "displaya", na, driven),
74 {TEGRA_PINGROUP_LD14, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 69 TEGRA_MAP_MUXCONF("ld14", "displaya", na, driven),
75 {TEGRA_PINGROUP_LD15, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 70 TEGRA_MAP_MUXCONF("ld15", "displaya", na, driven),
76 {TEGRA_PINGROUP_LD16, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 71 TEGRA_MAP_MUXCONF("ld16", "displaya", na, driven),
77 {TEGRA_PINGROUP_LD17, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 72 TEGRA_MAP_MUXCONF("ld17", "displaya", na, driven),
78 {TEGRA_PINGROUP_LD2, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 73 TEGRA_MAP_MUXCONF("ld2", "displaya", na, driven),
79 {TEGRA_PINGROUP_LD3, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 74 TEGRA_MAP_MUXCONF("ld3", "displaya", na, driven),
80 {TEGRA_PINGROUP_LD4, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 75 TEGRA_MAP_MUXCONF("ld4", "displaya", na, driven),
81 {TEGRA_PINGROUP_LD5, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 76 TEGRA_MAP_MUXCONF("ld5", "displaya", na, driven),
82 {TEGRA_PINGROUP_LD6, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 77 TEGRA_MAP_MUXCONF("ld6", "displaya", na, driven),
83 {TEGRA_PINGROUP_LD7, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 78 TEGRA_MAP_MUXCONF("ld7", "displaya", na, driven),
84 {TEGRA_PINGROUP_LD8, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 79 TEGRA_MAP_MUXCONF("ld8", "displaya", na, driven),
85 {TEGRA_PINGROUP_LD9, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 80 TEGRA_MAP_MUXCONF("ld9", "displaya", na, driven),
86 {TEGRA_PINGROUP_LDC, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 81 TEGRA_MAP_MUXCONF("ldc", "displaya", na, driven),
87 {TEGRA_PINGROUP_LDI, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 82 TEGRA_MAP_MUXCONF("ldi", "displaya", na, driven),
88 {TEGRA_PINGROUP_LHP0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 83 TEGRA_MAP_MUXCONF("lhp0", "displaya", na, tristate),
89 {TEGRA_PINGROUP_LHP1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 84 TEGRA_MAP_MUXCONF("lhp1", "displaya", na, tristate),
90 {TEGRA_PINGROUP_LHP2, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 85 TEGRA_MAP_MUXCONF("lhp2", "displaya", na, tristate),
91 {TEGRA_PINGROUP_LHS, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 86 TEGRA_MAP_MUXCONF("lhs", "displaya", na, driven),
92 {TEGRA_PINGROUP_LM0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 87 TEGRA_MAP_MUXCONF("lm0", "displaya", na, tristate),
93 {TEGRA_PINGROUP_LM1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 88 TEGRA_MAP_MUXCONF("lm1", "displaya", na, tristate),
94 {TEGRA_PINGROUP_LPP, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 89 TEGRA_MAP_MUXCONF("lpp", "displaya", na, tristate),
95 {TEGRA_PINGROUP_LPW0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 90 TEGRA_MAP_MUXCONF("lpw0", "displaya", na, tristate),
96 {TEGRA_PINGROUP_LPW1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 91 TEGRA_MAP_MUXCONF("lpw1", "displaya", na, tristate),
97 {TEGRA_PINGROUP_LPW2, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 92 TEGRA_MAP_MUXCONF("lpw2", "displaya", na, tristate),
98 {TEGRA_PINGROUP_LSC0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 93 TEGRA_MAP_MUXCONF("lsc0", "displaya", na, driven),
99 {TEGRA_PINGROUP_LSC1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 94 TEGRA_MAP_MUXCONF("lsc1", "displaya", na, tristate),
100 {TEGRA_PINGROUP_LSCK, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 95 TEGRA_MAP_MUXCONF("lsck", "displaya", na, tristate),
101 {TEGRA_PINGROUP_LSDA, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 96 TEGRA_MAP_MUXCONF("lsda", "displaya", na, tristate),
102 {TEGRA_PINGROUP_LSDI, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 97 TEGRA_MAP_MUXCONF("lsdi", "displaya", na, tristate),
103 {TEGRA_PINGROUP_LSPI, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 98 TEGRA_MAP_MUXCONF("lspi", "displaya", na, driven),
104 {TEGRA_PINGROUP_LVP0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 99 TEGRA_MAP_MUXCONF("lvp0", "displaya", na, tristate),
105 {TEGRA_PINGROUP_LVP1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 100 TEGRA_MAP_MUXCONF("lvp1", "displaya", na, tristate),
106 {TEGRA_PINGROUP_LVS, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 101 TEGRA_MAP_MUXCONF("lvs", "displaya", na, driven),
107 {TEGRA_PINGROUP_OWC, TEGRA_MUX_OWR, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 102 TEGRA_MAP_MUXCONF("owc", "owr", up, tristate),
108 {TEGRA_PINGROUP_PMC, TEGRA_MUX_PWR_ON, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 103 TEGRA_MAP_MUXCONF("pmc", "pwr_on", na, driven),
109 {TEGRA_PINGROUP_PTA, TEGRA_MUX_HDMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 104 TEGRA_MAP_MUXCONF("pta", "hdmi", none, driven),
110 {TEGRA_PINGROUP_RM, TEGRA_MUX_I2C, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 105 TEGRA_MAP_MUXCONF("rm", "i2c1", none, driven),
111 {TEGRA_PINGROUP_SDB, TEGRA_MUX_PWM, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 106 TEGRA_MAP_MUXCONF("sdb", "pwm", na, tristate),
112 {TEGRA_PINGROUP_SDC, TEGRA_MUX_TWC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 107 TEGRA_MAP_MUXCONF("sdc", "twc", up, tristate),
113 {TEGRA_PINGROUP_SDD, TEGRA_MUX_PWM, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 108 TEGRA_MAP_MUXCONF("sdd", "pwm", up, tristate),
114 {TEGRA_PINGROUP_SDIO1, TEGRA_MUX_SDIO1, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 109 TEGRA_MAP_MUXCONF("sdio1", "sdio1", none, driven),
115 {TEGRA_PINGROUP_SLXA, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 110 TEGRA_MAP_MUXCONF("slxa", "pcie", none, tristate),
116 {TEGRA_PINGROUP_SLXC, TEGRA_MUX_SPI4, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 111 TEGRA_MAP_MUXCONF("slxc", "spi4", none, tristate),
117 {TEGRA_PINGROUP_SLXD, TEGRA_MUX_SPI4, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 112 TEGRA_MAP_MUXCONF("slxd", "spi4", none, tristate),
118 {TEGRA_PINGROUP_SLXK, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 113 TEGRA_MAP_MUXCONF("slxk", "pcie", none, driven),
119 {TEGRA_PINGROUP_SPDI, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 114 TEGRA_MAP_MUXCONF("spdi", "rsvd2", none, tristate),
120 {TEGRA_PINGROUP_SPDO, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 115 TEGRA_MAP_MUXCONF("spdo", "rsvd2", none, driven),
121 {TEGRA_PINGROUP_SPIA, TEGRA_MUX_GMI, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 116 TEGRA_MAP_MUXCONF("spia", "gmi", down, tristate),
122 {TEGRA_PINGROUP_SPIB, TEGRA_MUX_GMI, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 117 TEGRA_MAP_MUXCONF("spib", "gmi", down, tristate),
123 {TEGRA_PINGROUP_SPIC, TEGRA_MUX_GMI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 118 TEGRA_MAP_MUXCONF("spic", "gmi", up, driven),
124 {TEGRA_PINGROUP_SPID, TEGRA_MUX_GMI, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 119 TEGRA_MAP_MUXCONF("spid", "gmi", down, tristate),
125 {TEGRA_PINGROUP_SPIE, TEGRA_MUX_GMI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 120 TEGRA_MAP_MUXCONF("spie", "gmi", up, tristate),
126 {TEGRA_PINGROUP_SPIF, TEGRA_MUX_RSVD4, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 121 TEGRA_MAP_MUXCONF("spif", "rsvd4", down, tristate),
127 {TEGRA_PINGROUP_SPIG, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 122 TEGRA_MAP_MUXCONF("spig", "spi2_alt", up, driven),
128 {TEGRA_PINGROUP_SPIH, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 123 TEGRA_MAP_MUXCONF("spih", "spi2_alt", up, tristate),
129 {TEGRA_PINGROUP_UAA, TEGRA_MUX_ULPI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 124 TEGRA_MAP_MUXCONF("uaa", "ulpi", up, driven),
130 {TEGRA_PINGROUP_UAB, TEGRA_MUX_ULPI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 125 TEGRA_MAP_MUXCONF("uab", "ulpi", up, driven),
131 {TEGRA_PINGROUP_UAC, TEGRA_MUX_RSVD4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 126 TEGRA_MAP_MUXCONF("uac", "rsvd4", none, driven),
132 {TEGRA_PINGROUP_UAD, TEGRA_MUX_SPDIF, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 127 TEGRA_MAP_MUXCONF("uad", "spdif", up, tristate),
133 {TEGRA_PINGROUP_UCA, TEGRA_MUX_UARTC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 128 TEGRA_MAP_MUXCONF("uca", "uartc", up, tristate),
134 {TEGRA_PINGROUP_UCB, TEGRA_MUX_UARTC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 129 TEGRA_MAP_MUXCONF("ucb", "uartc", up, tristate),
135 {TEGRA_PINGROUP_UDA, TEGRA_MUX_ULPI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 130 TEGRA_MAP_MUXCONF("uda", "ulpi", none, driven),
136 {TEGRA_PINGROUP_CK32, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 131 TEGRA_MAP_CONF("ck32", none, na),
137 {TEGRA_PINGROUP_DDRC, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 132 TEGRA_MAP_CONF("ddrc", none, na),
138 {TEGRA_PINGROUP_PMCA, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 133 TEGRA_MAP_CONF("pmca", none, na),
139 {TEGRA_PINGROUP_PMCB, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 134 TEGRA_MAP_CONF("pmcb", none, na),
140 {TEGRA_PINGROUP_PMCC, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 135 TEGRA_MAP_CONF("pmcc", none, na),
141 {TEGRA_PINGROUP_PMCD, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 136 TEGRA_MAP_CONF("pmcd", none, na),
142 {TEGRA_PINGROUP_PMCE, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 137 TEGRA_MAP_CONF("pmce", none, na),
143 {TEGRA_PINGROUP_XM2C, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 138 TEGRA_MAP_CONF("xm2c", none, na),
144 {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 139 TEGRA_MAP_CONF("xm2d", none, na),
145}; 140 TEGRA_MAP_CONF("ls", up, na),
146 141 TEGRA_MAP_CONF("lc", up, na),
147static struct tegra_gpio_table gpio_table[] = { 142 TEGRA_MAP_CONF("ld17_0", down, na),
148 { .gpio = TEGRA_GPIO_SD1_CD, .enable = true }, 143 TEGRA_MAP_CONF("ld19_18", down, na),
149 { .gpio = TEGRA_GPIO_SD1_WP, .enable = true }, 144 TEGRA_MAP_CONF("ld21_20", down, na),
150 { .gpio = TEGRA_GPIO_SD1_POWER, .enable = true }, 145 TEGRA_MAP_CONF("ld23_22", down, na),
151 { .gpio = TEGRA_ULPI_RST, .enable = true },
152 { .gpio = TEGRA_WIFI_PWRN, .enable = true },
153 { .gpio = TEGRA_WIFI_RST, .enable = true },
154 { .gpio = TEGRA_WIFI_LED, .enable = true },
155}; 146};
156 147
157static struct tegra_board_pinmux_conf conf = { 148static struct tegra_board_pinmux_conf conf = {
158 .pgs = paz00_pinmux, 149 .maps = paz00_map,
159 .pg_count = ARRAY_SIZE(paz00_pinmux), 150 .map_count = ARRAY_SIZE(paz00_map),
160 .gpios = gpio_table,
161 .gpio_count = ARRAY_SIZE(gpio_table),
162}; 151};
163 152
164void paz00_pinmux_init(void) 153void paz00_pinmux_init(void)
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 330afdfa2475..d0735c70d688 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -21,6 +21,7 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/serial_8250.h> 23#include <linux/serial_8250.h>
24#include <linux/of_serial.h>
24#include <linux/clk.h> 25#include <linux/clk.h>
25#include <linux/dma-mapping.h> 26#include <linux/dma-mapping.h>
26#include <linux/gpio_keys.h> 27#include <linux/gpio_keys.h>
@@ -55,6 +56,7 @@ static struct plat_serial8250_port debug_uart_platform_data[] = {
55 .irq = INT_UARTA, 56 .irq = INT_UARTA,
56 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE, 57 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
57 .type = PORT_TEGRA, 58 .type = PORT_TEGRA,
59 .handle_break = tegra_serial_handle_break,
58 .iotype = UPIO_MEM, 60 .iotype = UPIO_MEM,
59 .regshift = 2, 61 .regshift = 2,
60 .uartclk = 216000000, 62 .uartclk = 216000000,
@@ -65,6 +67,7 @@ static struct plat_serial8250_port debug_uart_platform_data[] = {
65 .irq = INT_UARTC, 67 .irq = INT_UARTC,
66 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE, 68 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
67 .type = PORT_TEGRA, 69 .type = PORT_TEGRA,
70 .handle_break = tegra_serial_handle_break,
68 .iotype = UPIO_MEM, 71 .iotype = UPIO_MEM,
69 .regshift = 2, 72 .regshift = 2,
70 .uartclk = 216000000, 73 .uartclk = 216000000,
diff --git a/arch/arm/mach-tegra/board-pinmux.c b/arch/arm/mach-tegra/board-pinmux.c
index adc3efe979b3..a5574c71b931 100644
--- a/arch/arm/mach-tegra/board-pinmux.c
+++ b/arch/arm/mach-tegra/board-pinmux.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2011,2012, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This software is licensed under the terms of the GNU General Public 4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and 5 * License version 2, as published by the Free Software Foundation, and
@@ -15,75 +15,59 @@
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/notifier.h> 17#include <linux/notifier.h>
18#include <linux/of.h>
19#include <linux/string.h> 18#include <linux/string.h>
20 19
21#include <mach/gpio-tegra.h>
22#include <mach/pinmux.h>
23
24#include "board-pinmux.h" 20#include "board-pinmux.h"
25#include "devices.h" 21#include "devices.h"
26 22
27struct tegra_board_pinmux_conf *confs[2]; 23unsigned long tegra_pincfg_pullnone_driven[2] = {
28 24 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE),
29static void tegra_board_pinmux_setup_gpios(void) 25 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN),
30{ 26};
31 int i;
32
33 for (i = 0; i < ARRAY_SIZE(confs); i++) {
34 if (!confs[i])
35 continue;
36
37 tegra_gpio_config(confs[i]->gpios, confs[i]->gpio_count);
38 }
39}
40
41static void tegra_board_pinmux_setup_pinmux(void)
42{
43 int i;
44 27
45 for (i = 0; i < ARRAY_SIZE(confs); i++) { 28unsigned long tegra_pincfg_pullnone_tristate[2] = {
46 if (!confs[i]) 29 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE),
47 continue; 30 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE),
31};
48 32
49 tegra_pinmux_config_table(confs[i]->pgs, confs[i]->pg_count); 33unsigned long tegra_pincfg_pullnone_na[1] = {
34 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE),
35};
50 36
51 if (confs[i]->drives) 37unsigned long tegra_pincfg_pullup_driven[2] = {
52 tegra_drive_pinmux_config_table(confs[i]->drives, 38 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP),
53 confs[i]->drive_count); 39 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN),
54 } 40};
55}
56 41
57static int tegra_board_pinmux_bus_notify(struct notifier_block *nb, 42unsigned long tegra_pincfg_pullup_tristate[2] = {
58 unsigned long event, void *vdev) 43 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP),
59{ 44 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE),
60 static bool had_gpio; 45};
61 static bool had_pinmux;
62 46
63 struct device *dev = vdev; 47unsigned long tegra_pincfg_pullup_na[1] = {
64 const char *devname; 48 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP),
49};
65 50
66 if (event != BUS_NOTIFY_BOUND_DRIVER) 51unsigned long tegra_pincfg_pulldown_driven[2] = {
67 return NOTIFY_DONE; 52 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN),
53 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN),
54};
68 55
69 devname = dev_name(dev); 56unsigned long tegra_pincfg_pulldown_tristate[2] = {
57 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN),
58 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE),
59};
70 60
71 if (!had_gpio && !strcmp(devname, GPIO_DEV)) { 61unsigned long tegra_pincfg_pulldown_na[1] = {
72 tegra_board_pinmux_setup_gpios(); 62 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN),
73 had_gpio = true; 63};
74 } else if (!had_pinmux && !strcmp(devname, PINMUX_DEV)) {
75 tegra_board_pinmux_setup_pinmux();
76 had_pinmux = true;
77 }
78 64
79 if (had_gpio && had_pinmux) 65unsigned long tegra_pincfg_pullna_driven[1] = {
80 return NOTIFY_STOP_MASK; 66 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN),
81 else 67};
82 return NOTIFY_DONE;
83}
84 68
85static struct notifier_block nb = { 69unsigned long tegra_pincfg_pullna_tristate[1] = {
86 .notifier_call = tegra_board_pinmux_bus_notify, 70 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE),
87}; 71};
88 72
89static struct platform_device *devices[] = { 73static struct platform_device *devices[] = {
@@ -94,11 +78,10 @@ static struct platform_device *devices[] = {
94void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a, 78void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a,
95 struct tegra_board_pinmux_conf *conf_b) 79 struct tegra_board_pinmux_conf *conf_b)
96{ 80{
97 confs[0] = conf_a; 81 if (conf_a)
98 confs[1] = conf_b; 82 pinctrl_register_mappings(conf_a->maps, conf_a->map_count);
99 83 if (conf_b)
100 bus_register_notifier(&platform_bus_type, &nb); 84 pinctrl_register_mappings(conf_b->maps, conf_b->map_count);
101 85
102 if (!of_machine_is_compatible("nvidia,tegra20")) 86 platform_add_devices(devices, ARRAY_SIZE(devices));
103 platform_add_devices(devices, ARRAY_SIZE(devices));
104} 87}
diff --git a/arch/arm/mach-tegra/board-pinmux.h b/arch/arm/mach-tegra/board-pinmux.h
index 4aac73546f54..c5f3f3381e86 100644
--- a/arch/arm/mach-tegra/board-pinmux.h
+++ b/arch/arm/mach-tegra/board-pinmux.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2011,2012, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This software is licensed under the terms of the GNU General Public 4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and 5 * License version 2, as published by the Free Software Foundation, and
@@ -15,21 +15,37 @@
15#ifndef __MACH_TEGRA_BOARD_PINMUX_H 15#ifndef __MACH_TEGRA_BOARD_PINMUX_H
16#define __MACH_TEGRA_BOARD_PINMUX_H 16#define __MACH_TEGRA_BOARD_PINMUX_H
17 17
18#define GPIO_DEV "tegra-gpio" 18#include <linux/pinctrl/machine.h>
19#define PINMUX_DEV "tegra-pinmux"
20 19
21struct tegra_pingroup_config; 20#include <mach/pinconf-tegra.h>
22struct tegra_gpio_table;
23 21
24struct tegra_board_pinmux_conf { 22#define PINMUX_DEV "tegra20-pinctrl"
25 struct tegra_pingroup_config *pgs; 23
26 int pg_count; 24#define TEGRA_MAP_MUX(_group_, _function_) \
25 PIN_MAP_MUX_GROUP_HOG_DEFAULT(PINMUX_DEV, _group_, _function_)
26
27#define TEGRA_MAP_CONF(_group_, _pull_, _drive_) \
28 PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(PINMUX_DEV, _group_, tegra_pincfg_pull##_pull_##_##_drive_)
27 29
28 struct tegra_drive_pingroup_config *drives; 30#define TEGRA_MAP_MUXCONF(_group_, _function_, _pull_, _drive_) \
29 int drive_count; 31 TEGRA_MAP_MUX(_group_, _function_), \
32 TEGRA_MAP_CONF(_group_, _pull_, _drive_)
30 33
31 struct tegra_gpio_table *gpios; 34extern unsigned long tegra_pincfg_pullnone_driven[2];
32 int gpio_count; 35extern unsigned long tegra_pincfg_pullnone_tristate[2];
36extern unsigned long tegra_pincfg_pullnone_na[1];
37extern unsigned long tegra_pincfg_pullup_driven[2];
38extern unsigned long tegra_pincfg_pullup_tristate[2];
39extern unsigned long tegra_pincfg_pullup_na[1];
40extern unsigned long tegra_pincfg_pulldown_driven[2];
41extern unsigned long tegra_pincfg_pulldown_tristate[2];
42extern unsigned long tegra_pincfg_pulldown_na[1];
43extern unsigned long tegra_pincfg_pullna_driven[1];
44extern unsigned long tegra_pincfg_pullna_tristate[1];
45
46struct tegra_board_pinmux_conf {
47 struct pinctrl_map *maps;
48 int map_count;
33}; 49};
34 50
35void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a, 51void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a,
diff --git a/arch/arm/mach-tegra/board-seaboard-pinmux.c b/arch/arm/mach-tegra/board-seaboard-pinmux.c
index 55e7e43a14ad..11fc8a568c64 100644
--- a/arch/arm/mach-tegra/board-seaboard-pinmux.c
+++ b/arch/arm/mach-tegra/board-seaboard-pinmux.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2010,2011 NVIDIA Corporation 2 * Copyright (C) 2010-2012 NVIDIA Corporation
3 * Copyright (C) 2011 Google, Inc. 3 * Copyright (C) 2011 Google, Inc.
4 * 4 *
5 * This software is licensed under the terms of the GNU General Public 5 * This software is licensed under the terms of the GNU General Public
@@ -14,216 +14,176 @@
14 */ 14 */
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/gpio.h>
19#include <linux/of.h>
20 17
21#include <mach/pinmux.h>
22#include <mach/pinmux-tegra20.h>
23
24#include "gpio-names.h"
25#include "board-pinmux.h"
26#include "board-seaboard.h" 18#include "board-seaboard.h"
19#include "board-pinmux.h"
27 20
28#define DEFAULT_DRIVE(_name) \ 21static unsigned long seaboard_pincfg_drive_sdio1[] = {
29 { \ 22 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_HIGH_SPEED_MODE, 0),
30 .pingroup = TEGRA_DRIVE_PINGROUP_##_name, \ 23 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_SCHMITT, 0),
31 .hsm = TEGRA_HSM_DISABLE, \ 24 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_LOW_POWER_MODE, 3),
32 .schmitt = TEGRA_SCHMITT_ENABLE, \ 25 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_DRIVE_DOWN_STRENGTH, 31),
33 .drive = TEGRA_DRIVE_DIV_1, \ 26 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_DRIVE_UP_STRENGTH, 31),
34 .pull_down = TEGRA_PULL_31, \ 27 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_SLEW_RATE_FALLING, 3),
35 .pull_up = TEGRA_PULL_31, \ 28 TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_SLEW_RATE_RISING, 3),
36 .slew_rising = TEGRA_SLEW_SLOWEST, \
37 .slew_falling = TEGRA_SLEW_SLOWEST, \
38 }
39
40static struct tegra_drive_pingroup_config seaboard_drive_pinmux[] = {
41 DEFAULT_DRIVE(SDIO1),
42};
43
44static struct tegra_pingroup_config common_pinmux[] = {
45 {TEGRA_PINGROUP_ATA, TEGRA_MUX_IDE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
46 {TEGRA_PINGROUP_ATB, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
47 {TEGRA_PINGROUP_ATC, TEGRA_MUX_NAND, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
48 {TEGRA_PINGROUP_ATD, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
49 {TEGRA_PINGROUP_ATE, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
50 {TEGRA_PINGROUP_CDEV1, TEGRA_MUX_PLLA_OUT, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
51 {TEGRA_PINGROUP_CDEV2, TEGRA_MUX_PLLP_OUT4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
52 {TEGRA_PINGROUP_CRTP, TEGRA_MUX_CRT, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE},
53 {TEGRA_PINGROUP_CSUS, TEGRA_MUX_VI_SENSOR_CLK, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
54 {TEGRA_PINGROUP_DAP1, TEGRA_MUX_DAP1, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
55 {TEGRA_PINGROUP_DAP2, TEGRA_MUX_DAP2, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
56 {TEGRA_PINGROUP_DAP3, TEGRA_MUX_DAP3, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
57 {TEGRA_PINGROUP_DAP4, TEGRA_MUX_DAP4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
58 {TEGRA_PINGROUP_DTA, TEGRA_MUX_VI, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL},
59 {TEGRA_PINGROUP_DTB, TEGRA_MUX_VI, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL},
60 {TEGRA_PINGROUP_DTC, TEGRA_MUX_VI, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL},
61 {TEGRA_PINGROUP_DTD, TEGRA_MUX_VI, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL},
62 {TEGRA_PINGROUP_DTE, TEGRA_MUX_VI, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE},
63 {TEGRA_PINGROUP_DTF, TEGRA_MUX_I2C3, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
64 {TEGRA_PINGROUP_GMA, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
65 {TEGRA_PINGROUP_GMB, TEGRA_MUX_GMI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE},
66 {TEGRA_PINGROUP_GMC, TEGRA_MUX_UARTD, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
67 {TEGRA_PINGROUP_GME, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
68 {TEGRA_PINGROUP_GPU, TEGRA_MUX_PWM, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
69 {TEGRA_PINGROUP_GPU7, TEGRA_MUX_RTCK, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
70 {TEGRA_PINGROUP_GPV, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
71 {TEGRA_PINGROUP_HDINT, TEGRA_MUX_HDMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
72 {TEGRA_PINGROUP_I2CP, TEGRA_MUX_I2C, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
73 {TEGRA_PINGROUP_IRRX, TEGRA_MUX_UARTB, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
74 {TEGRA_PINGROUP_IRTX, TEGRA_MUX_UARTB, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
75 {TEGRA_PINGROUP_KBCA, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL},
76 {TEGRA_PINGROUP_KBCB, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL},
77 {TEGRA_PINGROUP_KBCC, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL},
78 {TEGRA_PINGROUP_KBCD, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL},
79 {TEGRA_PINGROUP_KBCE, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL},
80 {TEGRA_PINGROUP_KBCF, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL},
81 {TEGRA_PINGROUP_LCSN, TEGRA_MUX_RSVD4, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
82 {TEGRA_PINGROUP_LD0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
83 {TEGRA_PINGROUP_LD1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
84 {TEGRA_PINGROUP_LD10, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
85 {TEGRA_PINGROUP_LD11, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
86 {TEGRA_PINGROUP_LD12, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
87 {TEGRA_PINGROUP_LD13, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
88 {TEGRA_PINGROUP_LD14, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
89 {TEGRA_PINGROUP_LD15, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
90 {TEGRA_PINGROUP_LD16, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
91 {TEGRA_PINGROUP_LD17, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
92 {TEGRA_PINGROUP_LD2, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
93 {TEGRA_PINGROUP_LD3, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
94 {TEGRA_PINGROUP_LD4, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
95 {TEGRA_PINGROUP_LD5, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
96 {TEGRA_PINGROUP_LD6, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
97 {TEGRA_PINGROUP_LD7, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
98 {TEGRA_PINGROUP_LD8, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
99 {TEGRA_PINGROUP_LD9, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
100 {TEGRA_PINGROUP_LDC, TEGRA_MUX_RSVD4, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
101 {TEGRA_PINGROUP_LDI, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
102 {TEGRA_PINGROUP_LHP0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
103 {TEGRA_PINGROUP_LHP1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
104 {TEGRA_PINGROUP_LHP2, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
105 {TEGRA_PINGROUP_LHS, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
106 {TEGRA_PINGROUP_LM0, TEGRA_MUX_RSVD4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
107 {TEGRA_PINGROUP_LM1, TEGRA_MUX_CRT, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
108 {TEGRA_PINGROUP_LPP, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
109 {TEGRA_PINGROUP_LPW1, TEGRA_MUX_RSVD4, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
110 {TEGRA_PINGROUP_LSC0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
111 {TEGRA_PINGROUP_LSDI, TEGRA_MUX_RSVD4, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
112 {TEGRA_PINGROUP_LSPI, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
113 {TEGRA_PINGROUP_LVP0, TEGRA_MUX_RSVD4, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
114 {TEGRA_PINGROUP_LVP1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
115 {TEGRA_PINGROUP_LVS, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
116 {TEGRA_PINGROUP_OWC, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
117 {TEGRA_PINGROUP_PMC, TEGRA_MUX_PWR_ON, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
118 {TEGRA_PINGROUP_RM, TEGRA_MUX_I2C, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
119 {TEGRA_PINGROUP_SDB, TEGRA_MUX_SDIO3, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
120 {TEGRA_PINGROUP_SDC, TEGRA_MUX_SDIO3, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
121 {TEGRA_PINGROUP_SDD, TEGRA_MUX_SDIO3, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
122 {TEGRA_PINGROUP_SDIO1, TEGRA_MUX_SDIO1, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL},
123 {TEGRA_PINGROUP_SLXA, TEGRA_MUX_PCIE, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE},
124 {TEGRA_PINGROUP_SLXD, TEGRA_MUX_SPDIF, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
125 {TEGRA_PINGROUP_SPDI, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
126 {TEGRA_PINGROUP_SPDO, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
127 {TEGRA_PINGROUP_SPIB, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
128 {TEGRA_PINGROUP_SPID, TEGRA_MUX_SPI1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
129 {TEGRA_PINGROUP_SPIE, TEGRA_MUX_SPI1, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
130 {TEGRA_PINGROUP_SPIF, TEGRA_MUX_SPI1, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE},
131 {TEGRA_PINGROUP_SPIH, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE},
132 {TEGRA_PINGROUP_UAA, TEGRA_MUX_ULPI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL},
133 {TEGRA_PINGROUP_UAB, TEGRA_MUX_ULPI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL},
134 {TEGRA_PINGROUP_UAC, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
135 {TEGRA_PINGROUP_UAD, TEGRA_MUX_IRDA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
136 {TEGRA_PINGROUP_UCA, TEGRA_MUX_UARTC, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
137 {TEGRA_PINGROUP_UCB, TEGRA_MUX_UARTC, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
138 {TEGRA_PINGROUP_UDA, TEGRA_MUX_ULPI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
139 {TEGRA_PINGROUP_CK32, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
140 {TEGRA_PINGROUP_DDRC, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
141 {TEGRA_PINGROUP_PMCA, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
142 {TEGRA_PINGROUP_PMCB, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
143 {TEGRA_PINGROUP_PMCC, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
144 {TEGRA_PINGROUP_PMCD, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
145 {TEGRA_PINGROUP_PMCE, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
146 {TEGRA_PINGROUP_XM2C, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
147 {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
148};
149
150static struct tegra_pingroup_config seaboard_pinmux[] = {
151 {TEGRA_PINGROUP_DDC, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
152 {TEGRA_PINGROUP_GMD, TEGRA_MUX_SFLASH, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
153 {TEGRA_PINGROUP_LPW0, TEGRA_MUX_HDMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
154 {TEGRA_PINGROUP_LPW2, TEGRA_MUX_HDMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
155 {TEGRA_PINGROUP_LSC1, TEGRA_MUX_HDMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
156 {TEGRA_PINGROUP_LSCK, TEGRA_MUX_HDMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
157 {TEGRA_PINGROUP_LSDA, TEGRA_MUX_HDMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
158 {TEGRA_PINGROUP_PTA, TEGRA_MUX_HDMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
159 {TEGRA_PINGROUP_SLXC, TEGRA_MUX_SPDIF, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
160 {TEGRA_PINGROUP_SLXK, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
161 {TEGRA_PINGROUP_SPIA, TEGRA_MUX_GMI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE},
162 {TEGRA_PINGROUP_SPIC, TEGRA_MUX_GMI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL},
163 {TEGRA_PINGROUP_SPIG, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE},
164};
165
166static struct tegra_pingroup_config ventana_pinmux[] = {
167 {TEGRA_PINGROUP_DDC, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
168 {TEGRA_PINGROUP_GMD, TEGRA_MUX_SFLASH, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
169 {TEGRA_PINGROUP_LPW0, TEGRA_MUX_RSVD4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
170 {TEGRA_PINGROUP_LPW2, TEGRA_MUX_RSVD4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
171 {TEGRA_PINGROUP_LSC1, TEGRA_MUX_RSVD4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
172 {TEGRA_PINGROUP_LSCK, TEGRA_MUX_RSVD4, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
173 {TEGRA_PINGROUP_LSDA, TEGRA_MUX_RSVD4, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
174 {TEGRA_PINGROUP_PTA, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
175 {TEGRA_PINGROUP_SLXC, TEGRA_MUX_SDIO3, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
176 {TEGRA_PINGROUP_SLXK, TEGRA_MUX_SDIO3, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL},
177 {TEGRA_PINGROUP_SPIA, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
178 {TEGRA_PINGROUP_SPIC, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
179 {TEGRA_PINGROUP_SPIG, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE},
180}; 29};
181 30
182static struct tegra_gpio_table common_gpio_table[] = { 31static struct pinctrl_map common_map[] = {
183 { .gpio = TEGRA_GPIO_SD2_CD, .enable = true }, 32 TEGRA_MAP_MUXCONF("ata", "ide", none, driven),
184 { .gpio = TEGRA_GPIO_SD2_WP, .enable = true }, 33 TEGRA_MAP_MUXCONF("atb", "sdio4", none, driven),
185 { .gpio = TEGRA_GPIO_SD2_POWER, .enable = true }, 34 TEGRA_MAP_MUXCONF("atc", "nand", none, driven),
186 { .gpio = TEGRA_GPIO_CDC_IRQ, .enable = true }, 35 TEGRA_MAP_MUXCONF("atd", "gmi", none, driven),
36 TEGRA_MAP_MUXCONF("ate", "gmi", none, tristate),
37 TEGRA_MAP_MUXCONF("cdev1", "plla_out", none, driven),
38 TEGRA_MAP_MUXCONF("cdev2", "pllp_out4", none, driven),
39 TEGRA_MAP_MUXCONF("crtp", "crt", up, tristate),
40 TEGRA_MAP_MUXCONF("csus", "vi_sensor_clk", none, tristate),
41 TEGRA_MAP_MUXCONF("dap1", "dap1", none, driven),
42 TEGRA_MAP_MUXCONF("dap2", "dap2", none, driven),
43 TEGRA_MAP_MUXCONF("dap3", "dap3", none, tristate),
44 TEGRA_MAP_MUXCONF("dap4", "dap4", none, driven),
45 TEGRA_MAP_MUXCONF("dta", "vi", down, driven),
46 TEGRA_MAP_MUXCONF("dtb", "vi", down, driven),
47 TEGRA_MAP_MUXCONF("dtc", "vi", down, driven),
48 TEGRA_MAP_MUXCONF("dtd", "vi", down, driven),
49 TEGRA_MAP_MUXCONF("dte", "vi", down, tristate),
50 TEGRA_MAP_MUXCONF("dtf", "i2c3", none, driven),
51 TEGRA_MAP_MUXCONF("gma", "sdio4", none, driven),
52 TEGRA_MAP_MUXCONF("gmb", "gmi", up, tristate),
53 TEGRA_MAP_MUXCONF("gmc", "uartd", none, driven),
54 TEGRA_MAP_MUXCONF("gme", "sdio4", none, driven),
55 TEGRA_MAP_MUXCONF("gpu", "pwm", none, driven),
56 TEGRA_MAP_MUXCONF("gpu7", "rtck", none, driven),
57 TEGRA_MAP_MUXCONF("gpv", "pcie", none, tristate),
58 TEGRA_MAP_MUXCONF("hdint", "hdmi", na, tristate),
59 TEGRA_MAP_MUXCONF("i2cp", "i2cp", none, driven),
60 TEGRA_MAP_MUXCONF("irrx", "uartb", none, driven),
61 TEGRA_MAP_MUXCONF("irtx", "uartb", none, driven),
62 TEGRA_MAP_MUXCONF("kbca", "kbc", up, driven),
63 TEGRA_MAP_MUXCONF("kbcb", "kbc", up, driven),
64 TEGRA_MAP_MUXCONF("kbcc", "kbc", up, driven),
65 TEGRA_MAP_MUXCONF("kbcd", "kbc", up, driven),
66 TEGRA_MAP_MUXCONF("kbce", "kbc", up, driven),
67 TEGRA_MAP_MUXCONF("kbcf", "kbc", up, driven),
68 TEGRA_MAP_MUXCONF("lcsn", "rsvd4", na, tristate),
69 TEGRA_MAP_MUXCONF("ld0", "displaya", na, driven),
70 TEGRA_MAP_MUXCONF("ld1", "displaya", na, driven),
71 TEGRA_MAP_MUXCONF("ld10", "displaya", na, driven),
72 TEGRA_MAP_MUXCONF("ld11", "displaya", na, driven),
73 TEGRA_MAP_MUXCONF("ld12", "displaya", na, driven),
74 TEGRA_MAP_MUXCONF("ld13", "displaya", na, driven),
75 TEGRA_MAP_MUXCONF("ld14", "displaya", na, driven),
76 TEGRA_MAP_MUXCONF("ld15", "displaya", na, driven),
77 TEGRA_MAP_MUXCONF("ld16", "displaya", na, driven),
78 TEGRA_MAP_MUXCONF("ld17", "displaya", na, driven),
79 TEGRA_MAP_MUXCONF("ld2", "displaya", na, driven),
80 TEGRA_MAP_MUXCONF("ld3", "displaya", na, driven),
81 TEGRA_MAP_MUXCONF("ld4", "displaya", na, driven),
82 TEGRA_MAP_MUXCONF("ld5", "displaya", na, driven),
83 TEGRA_MAP_MUXCONF("ld6", "displaya", na, driven),
84 TEGRA_MAP_MUXCONF("ld7", "displaya", na, driven),
85 TEGRA_MAP_MUXCONF("ld8", "displaya", na, driven),
86 TEGRA_MAP_MUXCONF("ld9", "displaya", na, driven),
87 TEGRA_MAP_MUXCONF("ldc", "rsvd4", na, tristate),
88 TEGRA_MAP_MUXCONF("ldi", "displaya", na, driven),
89 TEGRA_MAP_MUXCONF("lhp0", "displaya", na, driven),
90 TEGRA_MAP_MUXCONF("lhp1", "displaya", na, driven),
91 TEGRA_MAP_MUXCONF("lhp2", "displaya", na, driven),
92 TEGRA_MAP_MUXCONF("lhs", "displaya", na, driven),
93 TEGRA_MAP_MUXCONF("lm0", "rsvd4", na, driven),
94 TEGRA_MAP_MUXCONF("lm1", "crt", na, tristate),
95 TEGRA_MAP_MUXCONF("lpp", "displaya", na, driven),
96 TEGRA_MAP_MUXCONF("lpw1", "rsvd4", na, tristate),
97 TEGRA_MAP_MUXCONF("lsc0", "displaya", na, driven),
98 TEGRA_MAP_MUXCONF("lsdi", "rsvd4", na, tristate),
99 TEGRA_MAP_MUXCONF("lspi", "displaya", na, driven),
100 TEGRA_MAP_MUXCONF("lvp0", "rsvd4", na, tristate),
101 TEGRA_MAP_MUXCONF("lvp1", "displaya", na, driven),
102 TEGRA_MAP_MUXCONF("lvs", "displaya", na, driven),
103 TEGRA_MAP_MUXCONF("owc", "rsvd2", none, tristate),
104 TEGRA_MAP_MUXCONF("pmc", "pwr_on", na, driven),
105 TEGRA_MAP_MUXCONF("pta", "hdmi", none, driven),
106 TEGRA_MAP_MUXCONF("rm", "i2c1", none, driven),
107 TEGRA_MAP_MUXCONF("sdb", "sdio3", na, driven),
108 TEGRA_MAP_MUXCONF("sdc", "sdio3", none, driven),
109 TEGRA_MAP_MUXCONF("sdd", "sdio3", none, driven),
110 TEGRA_MAP_MUXCONF("sdio1", "sdio1", up, driven),
111 TEGRA_MAP_MUXCONF("slxa", "pcie", up, tristate),
112 TEGRA_MAP_MUXCONF("slxd", "spdif", none, driven),
113 TEGRA_MAP_MUXCONF("slxk", "pcie", none, driven),
114 TEGRA_MAP_MUXCONF("spdi", "rsvd2", none, driven),
115 TEGRA_MAP_MUXCONF("spdo", "rsvd2", none, driven),
116 TEGRA_MAP_MUXCONF("spib", "gmi", none, tristate),
117 TEGRA_MAP_MUXCONF("spid", "spi1", none, tristate),
118 TEGRA_MAP_MUXCONF("spie", "spi1", none, tristate),
119 TEGRA_MAP_MUXCONF("spif", "spi1", down, tristate),
120 TEGRA_MAP_MUXCONF("spih", "spi2_alt", up, tristate),
121 TEGRA_MAP_MUXCONF("uaa", "ulpi", up, driven),
122 TEGRA_MAP_MUXCONF("uab", "ulpi", up, driven),
123 TEGRA_MAP_MUXCONF("uac", "rsvd2", none, driven),
124 TEGRA_MAP_MUXCONF("uad", "irda", none, driven),
125 TEGRA_MAP_MUXCONF("uca", "uartc", none, driven),
126 TEGRA_MAP_MUXCONF("ucb", "uartc", none, driven),
127 TEGRA_MAP_MUXCONF("uda", "ulpi", none, driven),
128 TEGRA_MAP_CONF("ck32", none, na),
129 TEGRA_MAP_CONF("ddrc", none, na),
130 TEGRA_MAP_CONF("pmca", none, na),
131 TEGRA_MAP_CONF("pmcb", none, na),
132 TEGRA_MAP_CONF("pmcc", none, na),
133 TEGRA_MAP_CONF("pmcd", none, na),
134 TEGRA_MAP_CONF("pmce", none, na),
135 TEGRA_MAP_CONF("xm2c", none, na),
136 TEGRA_MAP_CONF("xm2d", none, na),
137 TEGRA_MAP_CONF("ls", up, na),
138 TEGRA_MAP_CONF("lc", up, na),
139 TEGRA_MAP_CONF("ld17_0", down, na),
140 TEGRA_MAP_CONF("ld19_18", down, na),
141 TEGRA_MAP_CONF("ld21_20", down, na),
142 TEGRA_MAP_CONF("ld23_22", down, na),
187}; 143};
188 144
189static struct tegra_gpio_table seaboard_gpio_table[] = { 145static struct pinctrl_map seaboard_map[] = {
190 { .gpio = TEGRA_GPIO_LIDSWITCH, .enable = true }, 146 TEGRA_MAP_MUXCONF("ddc", "rsvd2", none, tristate),
191 { .gpio = TEGRA_GPIO_POWERKEY, .enable = true }, 147 TEGRA_MAP_MUXCONF("gmd", "sflash", none, driven),
192 { .gpio = TEGRA_GPIO_HP_DET, .enable = true }, 148 TEGRA_MAP_MUXCONF("lpw0", "hdmi", na, driven),
193 { .gpio = TEGRA_GPIO_ISL29018_IRQ, .enable = true }, 149 TEGRA_MAP_MUXCONF("lpw2", "hdmi", na, driven),
194 { .gpio = TEGRA_GPIO_USB1, .enable = true }, 150 TEGRA_MAP_MUXCONF("lsc1", "hdmi", na, tristate),
151 TEGRA_MAP_MUXCONF("lsck", "hdmi", na, tristate),
152 TEGRA_MAP_MUXCONF("lsda", "hdmi", na, tristate),
153 TEGRA_MAP_MUXCONF("slxc", "spdif", none, tristate),
154 TEGRA_MAP_MUXCONF("spia", "gmi", up, tristate),
155 TEGRA_MAP_MUXCONF("spic", "gmi", up, driven),
156 TEGRA_MAP_MUXCONF("spig", "spi2_alt", up, tristate),
157 PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(PINMUX_DEV, "drive_sdio1", seaboard_pincfg_drive_sdio1),
195}; 158};
196 159
197static struct tegra_gpio_table ventana_gpio_table[] = { 160static struct pinctrl_map ventana_map[] = {
198 /* hp_det */ 161 TEGRA_MAP_MUXCONF("ddc", "rsvd2", none, driven),
199 { .gpio = TEGRA_GPIO_PW2, .enable = true }, 162 TEGRA_MAP_MUXCONF("gmd", "sflash", none, tristate),
200 /* int_mic_en */ 163 TEGRA_MAP_MUXCONF("lpw0", "displaya", na, driven),
201 { .gpio = TEGRA_GPIO_PX0, .enable = true }, 164 TEGRA_MAP_MUXCONF("lpw2", "displaya", na, driven),
202 /* ext_mic_en */ 165 TEGRA_MAP_MUXCONF("lsc1", "displaya", na, driven),
203 { .gpio = TEGRA_GPIO_PX1, .enable = true }, 166 TEGRA_MAP_MUXCONF("lsck", "displaya", na, tristate),
167 TEGRA_MAP_MUXCONF("lsda", "displaya", na, tristate),
168 TEGRA_MAP_MUXCONF("slxc", "sdio3", none, driven),
169 TEGRA_MAP_MUXCONF("spia", "gmi", none, tristate),
170 TEGRA_MAP_MUXCONF("spic", "gmi", none, tristate),
171 TEGRA_MAP_MUXCONF("spig", "spi2_alt", none, tristate),
204}; 172};
205 173
206static struct tegra_board_pinmux_conf common_conf = { 174static struct tegra_board_pinmux_conf common_conf = {
207 .pgs = common_pinmux, 175 .maps = common_map,
208 .pg_count = ARRAY_SIZE(common_pinmux), 176 .map_count = ARRAY_SIZE(common_map),
209 .gpios = common_gpio_table,
210 .gpio_count = ARRAY_SIZE(common_gpio_table),
211}; 177};
212 178
213static struct tegra_board_pinmux_conf seaboard_conf = { 179static struct tegra_board_pinmux_conf seaboard_conf = {
214 .pgs = seaboard_pinmux, 180 .maps = seaboard_map,
215 .pg_count = ARRAY_SIZE(seaboard_pinmux), 181 .map_count = ARRAY_SIZE(seaboard_map),
216 .drives = seaboard_drive_pinmux,
217 .drive_count = ARRAY_SIZE(seaboard_drive_pinmux),
218 .gpios = seaboard_gpio_table,
219 .gpio_count = ARRAY_SIZE(seaboard_gpio_table),
220}; 182};
221 183
222static struct tegra_board_pinmux_conf ventana_conf = { 184static struct tegra_board_pinmux_conf ventana_conf = {
223 .pgs = ventana_pinmux, 185 .maps = ventana_map,
224 .pg_count = ARRAY_SIZE(ventana_pinmux), 186 .map_count = ARRAY_SIZE(ventana_map),
225 .gpios = ventana_gpio_table,
226 .gpio_count = ARRAY_SIZE(ventana_gpio_table),
227}; 187};
228 188
229void seaboard_pinmux_init(void) 189void seaboard_pinmux_init(void)
diff --git a/arch/arm/mach-tegra/board-seaboard.c b/arch/arm/mach-tegra/board-seaboard.c
index d669847f0485..20743bcec03a 100644
--- a/arch/arm/mach-tegra/board-seaboard.c
+++ b/arch/arm/mach-tegra/board-seaboard.c
@@ -18,12 +18,14 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/serial_8250.h> 20#include <linux/serial_8250.h>
21#include <linux/of_serial.h>
21#include <linux/i2c.h> 22#include <linux/i2c.h>
22#include <linux/delay.h> 23#include <linux/delay.h>
23#include <linux/input.h> 24#include <linux/input.h>
24#include <linux/io.h> 25#include <linux/io.h>
25#include <linux/gpio.h> 26#include <linux/gpio.h>
26#include <linux/gpio_keys.h> 27#include <linux/gpio_keys.h>
28#include <linux/platform_data/tegra_usb.h>
27 29
28#include <sound/wm8903.h> 30#include <sound/wm8903.h>
29 31
@@ -47,6 +49,7 @@ static struct plat_serial8250_port debug_uart_platform_data[] = {
47 /* Memory and IRQ filled in before registration */ 49 /* Memory and IRQ filled in before registration */
48 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE, 50 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
49 .type = PORT_TEGRA, 51 .type = PORT_TEGRA,
52 .handle_break = tegra_serial_handle_break,
50 .iotype = UPIO_MEM, 53 .iotype = UPIO_MEM,
51 .regshift = 2, 54 .regshift = 2,
52 .uartclk = 216000000, 55 .uartclk = 216000000,
@@ -186,20 +189,10 @@ static struct i2c_board_info __initdata wm8903_device = {
186 189
187static int seaboard_ehci_init(void) 190static int seaboard_ehci_init(void)
188{ 191{
189 int gpio_status; 192 struct tegra_ehci_platform_data *pdata;
190 193
191 gpio_status = gpio_request(TEGRA_GPIO_USB1, "VBUS_USB1"); 194 pdata = tegra_ehci1_device.dev.platform_data;
192 if (gpio_status < 0) { 195 pdata->vbus_gpio = TEGRA_GPIO_USB1;
193 pr_err("VBUS_USB1 request GPIO FAILED\n");
194 WARN_ON(1);
195 }
196
197 gpio_status = gpio_direction_output(TEGRA_GPIO_USB1, 1);
198 if (gpio_status < 0) {
199 pr_err("VBUS_USB1 request GPIO DIRECTION FAILED\n");
200 WARN_ON(1);
201 }
202 gpio_set_value(TEGRA_GPIO_USB1, 1);
203 196
204 platform_device_register(&tegra_ehci1_device); 197 platform_device_register(&tegra_ehci1_device);
205 platform_device_register(&tegra_ehci3_device); 198 platform_device_register(&tegra_ehci3_device);
@@ -209,9 +202,6 @@ static int seaboard_ehci_init(void)
209 202
210static void __init seaboard_i2c_init(void) 203static void __init seaboard_i2c_init(void)
211{ 204{
212 gpio_request(TEGRA_GPIO_ISL29018_IRQ, "isl29018");
213 gpio_direction_input(TEGRA_GPIO_ISL29018_IRQ);
214
215 isl29018_device.irq = gpio_to_irq(TEGRA_GPIO_ISL29018_IRQ); 205 isl29018_device.irq = gpio_to_irq(TEGRA_GPIO_ISL29018_IRQ);
216 i2c_register_board_info(0, &isl29018_device, 1); 206 i2c_register_board_info(0, &isl29018_device, 1);
217 207
@@ -261,7 +251,6 @@ static void __init tegra_kaen_init(void)
261 debug_uart_platform_data[0].irq = INT_UARTB; 251 debug_uart_platform_data[0].irq = INT_UARTB;
262 252
263 seaboard_audio_pdata.gpio_hp_mute = TEGRA_GPIO_KAEN_HP_MUTE; 253 seaboard_audio_pdata.gpio_hp_mute = TEGRA_GPIO_KAEN_HP_MUTE;
264 tegra_gpio_enable(TEGRA_GPIO_KAEN_HP_MUTE);
265 254
266 seaboard_common_init(); 255 seaboard_common_init();
267 256
diff --git a/arch/arm/mach-tegra/board-trimslice-pinmux.c b/arch/arm/mach-tegra/board-trimslice-pinmux.c
index a21a2be57cb6..7b39511c0d4d 100644
--- a/arch/arm/mach-tegra/board-trimslice-pinmux.c
+++ b/arch/arm/mach-tegra/board-trimslice-pinmux.c
@@ -2,6 +2,7 @@
2 * arch/arm/mach-tegra/board-trimslice-pinmux.c 2 * arch/arm/mach-tegra/board-trimslice-pinmux.c
3 * 3 *
4 * Copyright (C) 2011 CompuLab, Ltd. 4 * Copyright (C) 2011 CompuLab, Ltd.
5 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
5 * 6 *
6 * This software is licensed under the terms of the GNU General Public 7 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 8 * License version 2, as published by the Free Software Foundation, and
@@ -13,150 +14,139 @@
13 * GNU General Public License for more details. 14 * GNU General Public License for more details.
14 * 15 *
15 */ 16 */
16#include <linux/gpio.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/of.h>
20 18
21#include <mach/pinmux.h>
22#include <mach/pinmux-tegra20.h>
23
24#include "gpio-names.h"
25#include "board-pinmux.h"
26#include "board-trimslice.h" 19#include "board-trimslice.h"
20#include "board-pinmux.h"
27 21
28static struct tegra_pingroup_config trimslice_pinmux[] = { 22static struct pinctrl_map trimslice_map[] = {
29 {TEGRA_PINGROUP_ATA, TEGRA_MUX_IDE, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 23 TEGRA_MAP_MUXCONF("ata", "ide", none, tristate),
30 {TEGRA_PINGROUP_ATB, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 24 TEGRA_MAP_MUXCONF("atb", "sdio4", none, driven),
31 {TEGRA_PINGROUP_ATC, TEGRA_MUX_NAND, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 25 TEGRA_MAP_MUXCONF("atc", "nand", none, tristate),
32 {TEGRA_PINGROUP_ATD, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 26 TEGRA_MAP_MUXCONF("atd", "gmi", none, tristate),
33 {TEGRA_PINGROUP_ATE, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 27 TEGRA_MAP_MUXCONF("ate", "gmi", none, tristate),
34 {TEGRA_PINGROUP_CDEV1, TEGRA_MUX_PLLA_OUT, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 28 TEGRA_MAP_MUXCONF("cdev1", "plla_out", none, driven),
35 {TEGRA_PINGROUP_CDEV2, TEGRA_MUX_PLLP_OUT4, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 29 TEGRA_MAP_MUXCONF("cdev2", "pllp_out4", down, tristate),
36 {TEGRA_PINGROUP_CRTP, TEGRA_MUX_CRT, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 30 TEGRA_MAP_MUXCONF("crtp", "crt", none, tristate),
37 {TEGRA_PINGROUP_CSUS, TEGRA_MUX_VI_SENSOR_CLK, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 31 TEGRA_MAP_MUXCONF("csus", "vi_sensor_clk", down, tristate),
38 {TEGRA_PINGROUP_DAP1, TEGRA_MUX_DAP1, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 32 TEGRA_MAP_MUXCONF("dap1", "dap1", none, driven),
39 {TEGRA_PINGROUP_DAP2, TEGRA_MUX_DAP2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 33 TEGRA_MAP_MUXCONF("dap2", "dap2", none, tristate),
40 {TEGRA_PINGROUP_DAP3, TEGRA_MUX_DAP3, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 34 TEGRA_MAP_MUXCONF("dap3", "dap3", none, tristate),
41 {TEGRA_PINGROUP_DAP4, TEGRA_MUX_DAP4, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 35 TEGRA_MAP_MUXCONF("dap4", "dap4", none, tristate),
42 {TEGRA_PINGROUP_DDC, TEGRA_MUX_I2C2, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 36 TEGRA_MAP_MUXCONF("ddc", "i2c2", up, driven),
43 {TEGRA_PINGROUP_DTA, TEGRA_MUX_VI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 37 TEGRA_MAP_MUXCONF("dta", "vi", none, tristate),
44 {TEGRA_PINGROUP_DTB, TEGRA_MUX_VI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 38 TEGRA_MAP_MUXCONF("dtb", "vi", none, tristate),
45 {TEGRA_PINGROUP_DTC, TEGRA_MUX_VI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 39 TEGRA_MAP_MUXCONF("dtc", "vi", none, tristate),
46 {TEGRA_PINGROUP_DTD, TEGRA_MUX_VI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 40 TEGRA_MAP_MUXCONF("dtd", "vi", none, tristate),
47 {TEGRA_PINGROUP_DTE, TEGRA_MUX_VI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 41 TEGRA_MAP_MUXCONF("dte", "vi", none, tristate),
48 {TEGRA_PINGROUP_DTF, TEGRA_MUX_I2C3, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 42 TEGRA_MAP_MUXCONF("dtf", "i2c3", up, driven),
49 {TEGRA_PINGROUP_GMA, TEGRA_MUX_SDIO4, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 43 TEGRA_MAP_MUXCONF("gma", "sdio4", none, driven),
50 {TEGRA_PINGROUP_GMB, TEGRA_MUX_NAND, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 44 TEGRA_MAP_MUXCONF("gmb", "nand", none, tristate),
51 {TEGRA_PINGROUP_GMC, TEGRA_MUX_SFLASH, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 45 TEGRA_MAP_MUXCONF("gmc", "sflash", none, driven),
52 {TEGRA_PINGROUP_GMD, TEGRA_MUX_SFLASH, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 46 TEGRA_MAP_MUXCONF("gmd", "sflash", none, driven),
53 {TEGRA_PINGROUP_GME, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 47 TEGRA_MAP_MUXCONF("gme", "gmi", none, tristate),
54 {TEGRA_PINGROUP_GPU, TEGRA_MUX_UARTA, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 48 TEGRA_MAP_MUXCONF("gpu", "uarta", none, driven),
55 {TEGRA_PINGROUP_GPU7, TEGRA_MUX_RTCK, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 49 TEGRA_MAP_MUXCONF("gpu7", "rtck", none, driven),
56 {TEGRA_PINGROUP_GPV, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 50 TEGRA_MAP_MUXCONF("gpv", "pcie", none, driven),
57 {TEGRA_PINGROUP_HDINT, TEGRA_MUX_HDMI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 51 TEGRA_MAP_MUXCONF("hdint", "hdmi", na, tristate),
58 {TEGRA_PINGROUP_I2CP, TEGRA_MUX_I2C, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 52 TEGRA_MAP_MUXCONF("i2cp", "i2cp", none, tristate),
59 {TEGRA_PINGROUP_IRRX, TEGRA_MUX_UARTB, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 53 TEGRA_MAP_MUXCONF("irrx", "uartb", up, tristate),
60 {TEGRA_PINGROUP_IRTX, TEGRA_MUX_UARTB, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 54 TEGRA_MAP_MUXCONF("irtx", "uartb", up, tristate),
61 {TEGRA_PINGROUP_KBCA, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 55 TEGRA_MAP_MUXCONF("kbca", "kbc", up, tristate),
62 {TEGRA_PINGROUP_KBCB, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 56 TEGRA_MAP_MUXCONF("kbcb", "kbc", up, tristate),
63 {TEGRA_PINGROUP_KBCC, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 57 TEGRA_MAP_MUXCONF("kbcc", "kbc", up, tristate),
64 {TEGRA_PINGROUP_KBCD, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 58 TEGRA_MAP_MUXCONF("kbcd", "kbc", up, tristate),
65 {TEGRA_PINGROUP_KBCE, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 59 TEGRA_MAP_MUXCONF("kbce", "kbc", up, tristate),
66 {TEGRA_PINGROUP_KBCF, TEGRA_MUX_KBC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 60 TEGRA_MAP_MUXCONF("kbcf", "kbc", up, tristate),
67 {TEGRA_PINGROUP_LCSN, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 61 TEGRA_MAP_MUXCONF("lcsn", "displaya", na, tristate),
68 {TEGRA_PINGROUP_LD0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 62 TEGRA_MAP_MUXCONF("ld0", "displaya", na, driven),
69 {TEGRA_PINGROUP_LD1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 63 TEGRA_MAP_MUXCONF("ld1", "displaya", na, driven),
70 {TEGRA_PINGROUP_LD2, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 64 TEGRA_MAP_MUXCONF("ld10", "displaya", na, driven),
71 {TEGRA_PINGROUP_LD3, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 65 TEGRA_MAP_MUXCONF("ld11", "displaya", na, driven),
72 {TEGRA_PINGROUP_LD4, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 66 TEGRA_MAP_MUXCONF("ld12", "displaya", na, driven),
73 {TEGRA_PINGROUP_LD5, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 67 TEGRA_MAP_MUXCONF("ld13", "displaya", na, driven),
74 {TEGRA_PINGROUP_LD6, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 68 TEGRA_MAP_MUXCONF("ld14", "displaya", na, driven),
75 {TEGRA_PINGROUP_LD7, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 69 TEGRA_MAP_MUXCONF("ld15", "displaya", na, driven),
76 {TEGRA_PINGROUP_LD8, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 70 TEGRA_MAP_MUXCONF("ld16", "displaya", na, driven),
77 {TEGRA_PINGROUP_LD9, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 71 TEGRA_MAP_MUXCONF("ld17", "displaya", na, driven),
78 {TEGRA_PINGROUP_LD10, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 72 TEGRA_MAP_MUXCONF("ld2", "displaya", na, driven),
79 {TEGRA_PINGROUP_LD11, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 73 TEGRA_MAP_MUXCONF("ld3", "displaya", na, driven),
80 {TEGRA_PINGROUP_LD12, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 74 TEGRA_MAP_MUXCONF("ld4", "displaya", na, driven),
81 {TEGRA_PINGROUP_LD13, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 75 TEGRA_MAP_MUXCONF("ld5", "displaya", na, driven),
82 {TEGRA_PINGROUP_LD14, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 76 TEGRA_MAP_MUXCONF("ld6", "displaya", na, driven),
83 {TEGRA_PINGROUP_LD15, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 77 TEGRA_MAP_MUXCONF("ld7", "displaya", na, driven),
84 {TEGRA_PINGROUP_LD16, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 78 TEGRA_MAP_MUXCONF("ld8", "displaya", na, driven),
85 {TEGRA_PINGROUP_LD17, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 79 TEGRA_MAP_MUXCONF("ld9", "displaya", na, driven),
86 {TEGRA_PINGROUP_LDC, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 80 TEGRA_MAP_MUXCONF("ldc", "displaya", na, tristate),
87 {TEGRA_PINGROUP_LDI, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 81 TEGRA_MAP_MUXCONF("ldi", "displaya", na, driven),
88 {TEGRA_PINGROUP_LHP0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 82 TEGRA_MAP_MUXCONF("lhp0", "displaya", na, driven),
89 {TEGRA_PINGROUP_LHP1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 83 TEGRA_MAP_MUXCONF("lhp1", "displaya", na, driven),
90 {TEGRA_PINGROUP_LHP2, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 84 TEGRA_MAP_MUXCONF("lhp2", "displaya", na, driven),
91 {TEGRA_PINGROUP_LHS, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 85 TEGRA_MAP_MUXCONF("lhs", "displaya", na, driven),
92 {TEGRA_PINGROUP_LM0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 86 TEGRA_MAP_MUXCONF("lm0", "displaya", na, driven),
93 {TEGRA_PINGROUP_LM1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 87 TEGRA_MAP_MUXCONF("lm1", "displaya", na, tristate),
94 {TEGRA_PINGROUP_LPP, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 88 TEGRA_MAP_MUXCONF("lpp", "displaya", na, driven),
95 {TEGRA_PINGROUP_LPW0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 89 TEGRA_MAP_MUXCONF("lpw0", "displaya", na, driven),
96 {TEGRA_PINGROUP_LPW1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 90 TEGRA_MAP_MUXCONF("lpw1", "displaya", na, tristate),
97 {TEGRA_PINGROUP_LPW2, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 91 TEGRA_MAP_MUXCONF("lpw2", "displaya", na, driven),
98 {TEGRA_PINGROUP_LSC0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 92 TEGRA_MAP_MUXCONF("lsc0", "displaya", na, driven),
99 {TEGRA_PINGROUP_LSC1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 93 TEGRA_MAP_MUXCONF("lsc1", "displaya", na, tristate),
100 {TEGRA_PINGROUP_LSCK, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 94 TEGRA_MAP_MUXCONF("lsck", "displaya", na, tristate),
101 {TEGRA_PINGROUP_LSDA, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 95 TEGRA_MAP_MUXCONF("lsda", "displaya", na, tristate),
102 {TEGRA_PINGROUP_LSDI, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 96 TEGRA_MAP_MUXCONF("lsdi", "displaya", na, tristate),
103 {TEGRA_PINGROUP_LSPI, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 97 TEGRA_MAP_MUXCONF("lspi", "displaya", na, driven),
104 {TEGRA_PINGROUP_LVP0, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 98 TEGRA_MAP_MUXCONF("lvp0", "displaya", na, tristate),
105 {TEGRA_PINGROUP_LVP1, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_NORMAL}, 99 TEGRA_MAP_MUXCONF("lvp1", "displaya", na, driven),
106 {TEGRA_PINGROUP_LVS, TEGRA_MUX_DISPLAYA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 100 TEGRA_MAP_MUXCONF("lvs", "displaya", na, driven),
107 {TEGRA_PINGROUP_OWC, TEGRA_MUX_RSVD2, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 101 TEGRA_MAP_MUXCONF("owc", "rsvd2", up, tristate),
108 {TEGRA_PINGROUP_PMC, TEGRA_MUX_PWR_ON, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 102 TEGRA_MAP_MUXCONF("pmc", "pwr_on", na, tristate),
109 {TEGRA_PINGROUP_PTA, TEGRA_MUX_GMI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 103 TEGRA_MAP_MUXCONF("pta", "gmi", none, tristate),
110 {TEGRA_PINGROUP_RM, TEGRA_MUX_I2C, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 104 TEGRA_MAP_MUXCONF("rm", "i2c1", up, driven),
111 {TEGRA_PINGROUP_SDB, TEGRA_MUX_PWM, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 105 TEGRA_MAP_MUXCONF("sdb", "pwm", na, driven),
112 {TEGRA_PINGROUP_SDC, TEGRA_MUX_PWM, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 106 TEGRA_MAP_MUXCONF("sdc", "pwm", up, driven),
113 {TEGRA_PINGROUP_SDD, TEGRA_MUX_PWM, TEGRA_PUPD_PULL_UP, TEGRA_TRI_NORMAL}, 107 TEGRA_MAP_MUXCONF("sdd", "pwm", up, driven),
114 {TEGRA_PINGROUP_SDIO1, TEGRA_MUX_SDIO1, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 108 TEGRA_MAP_MUXCONF("sdio1", "sdio1", none, driven),
115 {TEGRA_PINGROUP_SLXA, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 109 TEGRA_MAP_MUXCONF("slxa", "pcie", none, driven),
116 {TEGRA_PINGROUP_SLXC, TEGRA_MUX_SDIO3, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 110 TEGRA_MAP_MUXCONF("slxc", "sdio3", none, tristate),
117 {TEGRA_PINGROUP_SLXD, TEGRA_MUX_SDIO3, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 111 TEGRA_MAP_MUXCONF("slxd", "sdio3", none, tristate),
118 {TEGRA_PINGROUP_SLXK, TEGRA_MUX_PCIE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 112 TEGRA_MAP_MUXCONF("slxk", "pcie", none, driven),
119 {TEGRA_PINGROUP_SPDI, TEGRA_MUX_SPDIF, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 113 TEGRA_MAP_MUXCONF("spdi", "spdif", none, tristate),
120 {TEGRA_PINGROUP_SPDO, TEGRA_MUX_SPDIF, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 114 TEGRA_MAP_MUXCONF("spdo", "spdif", none, tristate),
121 {TEGRA_PINGROUP_SPIA, TEGRA_MUX_SPI2, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 115 TEGRA_MAP_MUXCONF("spia", "spi2", down, tristate),
122 {TEGRA_PINGROUP_SPIB, TEGRA_MUX_SPI2, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 116 TEGRA_MAP_MUXCONF("spib", "spi2", down, tristate),
123 {TEGRA_PINGROUP_SPIC, TEGRA_MUX_SPI2, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 117 TEGRA_MAP_MUXCONF("spic", "spi2", up, tristate),
124 {TEGRA_PINGROUP_SPID, TEGRA_MUX_SPI1, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 118 TEGRA_MAP_MUXCONF("spid", "spi1", down, tristate),
125 {TEGRA_PINGROUP_SPIE, TEGRA_MUX_SPI1, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 119 TEGRA_MAP_MUXCONF("spie", "spi1", up, tristate),
126 {TEGRA_PINGROUP_SPIF, TEGRA_MUX_SPI1, TEGRA_PUPD_PULL_DOWN, TEGRA_TRI_TRISTATE}, 120 TEGRA_MAP_MUXCONF("spif", "spi1", down, tristate),
127 {TEGRA_PINGROUP_SPIG, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 121 TEGRA_MAP_MUXCONF("spig", "spi2_alt", up, tristate),
128 {TEGRA_PINGROUP_SPIH, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 122 TEGRA_MAP_MUXCONF("spih", "spi2_alt", up, tristate),
129 {TEGRA_PINGROUP_UAA, TEGRA_MUX_ULPI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 123 TEGRA_MAP_MUXCONF("uaa", "ulpi", up, tristate),
130 {TEGRA_PINGROUP_UAB, TEGRA_MUX_ULPI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 124 TEGRA_MAP_MUXCONF("uab", "ulpi", up, tristate),
131 {TEGRA_PINGROUP_UAC, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 125 TEGRA_MAP_MUXCONF("uac", "rsvd2", none, driven),
132 {TEGRA_PINGROUP_UAD, TEGRA_MUX_IRDA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 126 TEGRA_MAP_MUXCONF("uad", "irda", up, tristate),
133 {TEGRA_PINGROUP_UCA, TEGRA_MUX_UARTC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 127 TEGRA_MAP_MUXCONF("uca", "uartc", up, tristate),
134 {TEGRA_PINGROUP_UCB, TEGRA_MUX_UARTC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, 128 TEGRA_MAP_MUXCONF("ucb", "uartc", up, tristate),
135 {TEGRA_PINGROUP_UDA, TEGRA_MUX_ULPI, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, 129 TEGRA_MAP_MUXCONF("uda", "ulpi", none, tristate),
136 {TEGRA_PINGROUP_CK32, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 130 TEGRA_MAP_CONF("ck32", none, na),
137 {TEGRA_PINGROUP_DDRC, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 131 TEGRA_MAP_CONF("ddrc", none, na),
138 {TEGRA_PINGROUP_PMCA, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 132 TEGRA_MAP_CONF("pmca", none, na),
139 {TEGRA_PINGROUP_PMCB, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 133 TEGRA_MAP_CONF("pmcb", none, na),
140 {TEGRA_PINGROUP_PMCC, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 134 TEGRA_MAP_CONF("pmcc", none, na),
141 {TEGRA_PINGROUP_PMCD, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 135 TEGRA_MAP_CONF("pmcd", none, na),
142 {TEGRA_PINGROUP_PMCE, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 136 TEGRA_MAP_CONF("pmce", none, na),
143 {TEGRA_PINGROUP_XM2C, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 137 TEGRA_MAP_CONF("xm2c", none, na),
144 {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, 138 TEGRA_MAP_CONF("xm2d", none, na),
145}; 139 TEGRA_MAP_CONF("ls", up, na),
146 140 TEGRA_MAP_CONF("lc", up, na),
147static struct tegra_gpio_table gpio_table[] = { 141 TEGRA_MAP_CONF("ld17_0", down, na),
148 { .gpio = TRIMSLICE_GPIO_SD4_CD, .enable = true }, /* mmc4 cd */ 142 TEGRA_MAP_CONF("ld19_18", down, na),
149 { .gpio = TRIMSLICE_GPIO_SD4_WP, .enable = true }, /* mmc4 wp */ 143 TEGRA_MAP_CONF("ld21_20", down, na),
150 144 TEGRA_MAP_CONF("ld23_22", down, na),
151 { .gpio = TRIMSLICE_GPIO_USB1_MODE, .enable = true }, /* USB1 mode */
152 { .gpio = TRIMSLICE_GPIO_USB2_RST, .enable = true }, /* USB2 PHY rst */
153}; 145};
154 146
155static struct tegra_board_pinmux_conf conf = { 147static struct tegra_board_pinmux_conf conf = {
156 .pgs = trimslice_pinmux, 148 .maps = trimslice_map,
157 .pg_count = ARRAY_SIZE(trimslice_pinmux), 149 .map_count = ARRAY_SIZE(trimslice_map),
158 .gpios = gpio_table,
159 .gpio_count = ARRAY_SIZE(gpio_table),
160}; 150};
161 151
162void trimslice_pinmux_init(void) 152void trimslice_pinmux_init(void)
diff --git a/arch/arm/mach-tegra/board-trimslice.c b/arch/arm/mach-tegra/board-trimslice.c
index cd52820a3e37..0a00183feeec 100644
--- a/arch/arm/mach-tegra/board-trimslice.c
+++ b/arch/arm/mach-tegra/board-trimslice.c
@@ -22,9 +22,11 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/serial_8250.h> 24#include <linux/serial_8250.h>
25#include <linux/of_serial.h>
25#include <linux/io.h> 26#include <linux/io.h>
26#include <linux/i2c.h> 27#include <linux/i2c.h>
27#include <linux/gpio.h> 28#include <linux/gpio.h>
29#include <linux/platform_data/tegra_usb.h>
28 30
29#include <asm/hardware/gic.h> 31#include <asm/hardware/gic.h>
30#include <asm/mach-types.h> 32#include <asm/mach-types.h>
@@ -48,6 +50,7 @@ static struct plat_serial8250_port debug_uart_platform_data[] = {
48 .irq = INT_UARTA, 50 .irq = INT_UARTA,
49 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE, 51 .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
50 .type = PORT_TEGRA, 52 .type = PORT_TEGRA,
53 .handle_break = tegra_serial_handle_break,
51 .iotype = UPIO_MEM, 54 .iotype = UPIO_MEM,
52 .regshift = 2, 55 .regshift = 2,
53 .uartclk = 216000000, 56 .uartclk = 216000000,
@@ -111,19 +114,13 @@ static void trimslice_i2c_init(void)
111 114
112static void trimslice_usb_init(void) 115static void trimslice_usb_init(void)
113{ 116{
114 int err; 117 struct tegra_ehci_platform_data *pdata;
115 118
116 platform_device_register(&tegra_ehci3_device); 119 pdata = tegra_ehci1_device.dev.platform_data;
120 pdata->vbus_gpio = TRIMSLICE_GPIO_USB1_MODE;
117 121
122 platform_device_register(&tegra_ehci3_device);
118 platform_device_register(&tegra_ehci2_device); 123 platform_device_register(&tegra_ehci2_device);
119
120 err = gpio_request_one(TRIMSLICE_GPIO_USB1_MODE, GPIOF_OUT_INIT_HIGH,
121 "usb1mode");
122 if (err) {
123 pr_err("TrimSlice: failed to obtain USB1 mode gpio: %d\n", err);
124 return;
125 }
126
127 platform_device_register(&tegra_ehci1_device); 124 platform_device_register(&tegra_ehci1_device);
128} 125}
129 126
diff --git a/arch/arm/mach-tegra/devices.c b/arch/arm/mach-tegra/devices.c
index 5f6b867e20b4..bd3035e0cea1 100644
--- a/arch/arm/mach-tegra/devices.c
+++ b/arch/arm/mach-tegra/devices.c
@@ -110,7 +110,7 @@ static struct resource pinmux_resource[] = {
110}; 110};
111 111
112struct platform_device tegra_pinmux_device = { 112struct platform_device tegra_pinmux_device = {
113 .name = "tegra-pinmux", 113 .name = "tegra20-pinctrl",
114 .id = -1, 114 .id = -1,
115 .resource = pinmux_resource, 115 .resource = pinmux_resource,
116 .num_resources = ARRAY_SIZE(pinmux_resource), 116 .num_resources = ARRAY_SIZE(pinmux_resource),
@@ -448,17 +448,20 @@ static struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config = {
448struct tegra_ehci_platform_data tegra_ehci1_pdata = { 448struct tegra_ehci_platform_data tegra_ehci1_pdata = {
449 .operating_mode = TEGRA_USB_OTG, 449 .operating_mode = TEGRA_USB_OTG,
450 .power_down_on_bus_suspend = 1, 450 .power_down_on_bus_suspend = 1,
451 .vbus_gpio = -1,
451}; 452};
452 453
453struct tegra_ehci_platform_data tegra_ehci2_pdata = { 454struct tegra_ehci_platform_data tegra_ehci2_pdata = {
454 .phy_config = &tegra_ehci2_ulpi_phy_config, 455 .phy_config = &tegra_ehci2_ulpi_phy_config,
455 .operating_mode = TEGRA_USB_HOST, 456 .operating_mode = TEGRA_USB_HOST,
456 .power_down_on_bus_suspend = 1, 457 .power_down_on_bus_suspend = 1,
458 .vbus_gpio = -1,
457}; 459};
458 460
459struct tegra_ehci_platform_data tegra_ehci3_pdata = { 461struct tegra_ehci_platform_data tegra_ehci3_pdata = {
460 .operating_mode = TEGRA_USB_HOST, 462 .operating_mode = TEGRA_USB_HOST,
461 .power_down_on_bus_suspend = 1, 463 .power_down_on_bus_suspend = 1,
464 .vbus_gpio = -1,
462}; 465};
463 466
464static u64 tegra_ehci_dmamask = DMA_BIT_MASK(32); 467static u64 tegra_ehci_dmamask = DMA_BIT_MASK(32);
diff --git a/arch/arm/mach-tegra/flowctrl.c b/arch/arm/mach-tegra/flowctrl.c
index fef66a7486ed..f07488e0bd32 100644
--- a/arch/arm/mach-tegra/flowctrl.c
+++ b/arch/arm/mach-tegra/flowctrl.c
@@ -53,10 +53,10 @@ static void flowctrl_update(u8 offset, u32 value)
53 53
54void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value) 54void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value)
55{ 55{
56 return flowctrl_update(flowctrl_offset_halt_cpu[cpuid], value); 56 return flowctrl_update(flowctrl_offset_cpu_csr[cpuid], value);
57} 57}
58 58
59void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value) 59void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value)
60{ 60{
61 return flowctrl_update(flowctrl_offset_cpu_csr[cpuid], value); 61 return flowctrl_update(flowctrl_offset_halt_cpu[cpuid], value);
62} 62}
diff --git a/arch/arm/mach-tegra/include/mach/dma.h b/arch/arm/mach-tegra/include/mach/dma.h
index 3c9339058bec..9077092812c0 100644
--- a/arch/arm/mach-tegra/include/mach/dma.h
+++ b/arch/arm/mach-tegra/include/mach/dma.h
@@ -51,8 +51,6 @@
51#define TEGRA_DMA_REQ_SEL_OWR 25 51#define TEGRA_DMA_REQ_SEL_OWR 25
52#define TEGRA_DMA_REQ_SEL_INVALID 31 52#define TEGRA_DMA_REQ_SEL_INVALID 31
53 53
54#if defined(CONFIG_TEGRA_SYSTEM_DMA)
55
56struct tegra_dma_req; 54struct tegra_dma_req;
57struct tegra_dma_channel; 55struct tegra_dma_channel;
58 56
@@ -151,5 +149,3 @@ void tegra_dma_free_channel(struct tegra_dma_channel *ch);
151int __init tegra_dma_init(void); 149int __init tegra_dma_init(void);
152 150
153#endif 151#endif
154
155#endif
diff --git a/arch/arm/mach-tegra/include/mach/gpio-tegra.h b/arch/arm/mach-tegra/include/mach/gpio-tegra.h
index 6140820555e1..a978b3cc3a8d 100644
--- a/arch/arm/mach-tegra/include/mach/gpio-tegra.h
+++ b/arch/arm/mach-tegra/include/mach/gpio-tegra.h
@@ -25,13 +25,4 @@
25 25
26#define TEGRA_NR_GPIOS INT_GPIO_NR 26#define TEGRA_NR_GPIOS INT_GPIO_NR
27 27
28struct tegra_gpio_table {
29 int gpio; /* GPIO number */
30 bool enable; /* Enable for GPIO at init? */
31};
32
33void tegra_gpio_config(struct tegra_gpio_table *table, int num);
34void tegra_gpio_enable(int gpio);
35void tegra_gpio_disable(int gpio);
36
37#endif 28#endif
diff --git a/arch/arm/mach-tegra/include/mach/pinmux-tegra20.h b/arch/arm/mach-tegra/include/mach/pinmux-tegra20.h
deleted file mode 100644
index 6a40c1dbab17..000000000000
--- a/arch/arm/mach-tegra/include/mach/pinmux-tegra20.h
+++ /dev/null
@@ -1,184 +0,0 @@
1/*
2 * linux/arch/arm/mach-tegra/include/mach/pinmux-tegra20.h
3 *
4 * Copyright (C) 2010 Google, Inc.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef __MACH_TEGRA_PINMUX_TEGRA20_H
18#define __MACH_TEGRA_PINMUX_TEGRA20_H
19
20enum tegra_pingroup {
21 TEGRA_PINGROUP_ATA = 0,
22 TEGRA_PINGROUP_ATB,
23 TEGRA_PINGROUP_ATC,
24 TEGRA_PINGROUP_ATD,
25 TEGRA_PINGROUP_ATE,
26 TEGRA_PINGROUP_CDEV1,
27 TEGRA_PINGROUP_CDEV2,
28 TEGRA_PINGROUP_CRTP,
29 TEGRA_PINGROUP_CSUS,
30 TEGRA_PINGROUP_DAP1,
31 TEGRA_PINGROUP_DAP2,
32 TEGRA_PINGROUP_DAP3,
33 TEGRA_PINGROUP_DAP4,
34 TEGRA_PINGROUP_DDC,
35 TEGRA_PINGROUP_DTA,
36 TEGRA_PINGROUP_DTB,
37 TEGRA_PINGROUP_DTC,
38 TEGRA_PINGROUP_DTD,
39 TEGRA_PINGROUP_DTE,
40 TEGRA_PINGROUP_DTF,
41 TEGRA_PINGROUP_GMA,
42 TEGRA_PINGROUP_GMB,
43 TEGRA_PINGROUP_GMC,
44 TEGRA_PINGROUP_GMD,
45 TEGRA_PINGROUP_GME,
46 TEGRA_PINGROUP_GPU,
47 TEGRA_PINGROUP_GPU7,
48 TEGRA_PINGROUP_GPV,
49 TEGRA_PINGROUP_HDINT,
50 TEGRA_PINGROUP_I2CP,
51 TEGRA_PINGROUP_IRRX,
52 TEGRA_PINGROUP_IRTX,
53 TEGRA_PINGROUP_KBCA,
54 TEGRA_PINGROUP_KBCB,
55 TEGRA_PINGROUP_KBCC,
56 TEGRA_PINGROUP_KBCD,
57 TEGRA_PINGROUP_KBCE,
58 TEGRA_PINGROUP_KBCF,
59 TEGRA_PINGROUP_LCSN,
60 TEGRA_PINGROUP_LD0,
61 TEGRA_PINGROUP_LD1,
62 TEGRA_PINGROUP_LD10,
63 TEGRA_PINGROUP_LD11,
64 TEGRA_PINGROUP_LD12,
65 TEGRA_PINGROUP_LD13,
66 TEGRA_PINGROUP_LD14,
67 TEGRA_PINGROUP_LD15,
68 TEGRA_PINGROUP_LD16,
69 TEGRA_PINGROUP_LD17,
70 TEGRA_PINGROUP_LD2,
71 TEGRA_PINGROUP_LD3,
72 TEGRA_PINGROUP_LD4,
73 TEGRA_PINGROUP_LD5,
74 TEGRA_PINGROUP_LD6,
75 TEGRA_PINGROUP_LD7,
76 TEGRA_PINGROUP_LD8,
77 TEGRA_PINGROUP_LD9,
78 TEGRA_PINGROUP_LDC,
79 TEGRA_PINGROUP_LDI,
80 TEGRA_PINGROUP_LHP0,
81 TEGRA_PINGROUP_LHP1,
82 TEGRA_PINGROUP_LHP2,
83 TEGRA_PINGROUP_LHS,
84 TEGRA_PINGROUP_LM0,
85 TEGRA_PINGROUP_LM1,
86 TEGRA_PINGROUP_LPP,
87 TEGRA_PINGROUP_LPW0,
88 TEGRA_PINGROUP_LPW1,
89 TEGRA_PINGROUP_LPW2,
90 TEGRA_PINGROUP_LSC0,
91 TEGRA_PINGROUP_LSC1,
92 TEGRA_PINGROUP_LSCK,
93 TEGRA_PINGROUP_LSDA,
94 TEGRA_PINGROUP_LSDI,
95 TEGRA_PINGROUP_LSPI,
96 TEGRA_PINGROUP_LVP0,
97 TEGRA_PINGROUP_LVP1,
98 TEGRA_PINGROUP_LVS,
99 TEGRA_PINGROUP_OWC,
100 TEGRA_PINGROUP_PMC,
101 TEGRA_PINGROUP_PTA,
102 TEGRA_PINGROUP_RM,
103 TEGRA_PINGROUP_SDB,
104 TEGRA_PINGROUP_SDC,
105 TEGRA_PINGROUP_SDD,
106 TEGRA_PINGROUP_SDIO1,
107 TEGRA_PINGROUP_SLXA,
108 TEGRA_PINGROUP_SLXC,
109 TEGRA_PINGROUP_SLXD,
110 TEGRA_PINGROUP_SLXK,
111 TEGRA_PINGROUP_SPDI,
112 TEGRA_PINGROUP_SPDO,
113 TEGRA_PINGROUP_SPIA,
114 TEGRA_PINGROUP_SPIB,
115 TEGRA_PINGROUP_SPIC,
116 TEGRA_PINGROUP_SPID,
117 TEGRA_PINGROUP_SPIE,
118 TEGRA_PINGROUP_SPIF,
119 TEGRA_PINGROUP_SPIG,
120 TEGRA_PINGROUP_SPIH,
121 TEGRA_PINGROUP_UAA,
122 TEGRA_PINGROUP_UAB,
123 TEGRA_PINGROUP_UAC,
124 TEGRA_PINGROUP_UAD,
125 TEGRA_PINGROUP_UCA,
126 TEGRA_PINGROUP_UCB,
127 TEGRA_PINGROUP_UDA,
128 /* these pin groups only have pullup and pull down control */
129 TEGRA_PINGROUP_CK32,
130 TEGRA_PINGROUP_DDRC,
131 TEGRA_PINGROUP_PMCA,
132 TEGRA_PINGROUP_PMCB,
133 TEGRA_PINGROUP_PMCC,
134 TEGRA_PINGROUP_PMCD,
135 TEGRA_PINGROUP_PMCE,
136 TEGRA_PINGROUP_XM2C,
137 TEGRA_PINGROUP_XM2D,
138 TEGRA_MAX_PINGROUP,
139};
140
141enum tegra_drive_pingroup {
142 TEGRA_DRIVE_PINGROUP_AO1 = 0,
143 TEGRA_DRIVE_PINGROUP_AO2,
144 TEGRA_DRIVE_PINGROUP_AT1,
145 TEGRA_DRIVE_PINGROUP_AT2,
146 TEGRA_DRIVE_PINGROUP_CDEV1,
147 TEGRA_DRIVE_PINGROUP_CDEV2,
148 TEGRA_DRIVE_PINGROUP_CSUS,
149 TEGRA_DRIVE_PINGROUP_DAP1,
150 TEGRA_DRIVE_PINGROUP_DAP2,
151 TEGRA_DRIVE_PINGROUP_DAP3,
152 TEGRA_DRIVE_PINGROUP_DAP4,
153 TEGRA_DRIVE_PINGROUP_DBG,
154 TEGRA_DRIVE_PINGROUP_LCD1,
155 TEGRA_DRIVE_PINGROUP_LCD2,
156 TEGRA_DRIVE_PINGROUP_SDMMC2,
157 TEGRA_DRIVE_PINGROUP_SDMMC3,
158 TEGRA_DRIVE_PINGROUP_SPI,
159 TEGRA_DRIVE_PINGROUP_UAA,
160 TEGRA_DRIVE_PINGROUP_UAB,
161 TEGRA_DRIVE_PINGROUP_UART2,
162 TEGRA_DRIVE_PINGROUP_UART3,
163 TEGRA_DRIVE_PINGROUP_VI1,
164 TEGRA_DRIVE_PINGROUP_VI2,
165 TEGRA_DRIVE_PINGROUP_XM2A,
166 TEGRA_DRIVE_PINGROUP_XM2C,
167 TEGRA_DRIVE_PINGROUP_XM2D,
168 TEGRA_DRIVE_PINGROUP_XM2CLK,
169 TEGRA_DRIVE_PINGROUP_MEMCOMP,
170 TEGRA_DRIVE_PINGROUP_SDIO1,
171 TEGRA_DRIVE_PINGROUP_CRT,
172 TEGRA_DRIVE_PINGROUP_DDC,
173 TEGRA_DRIVE_PINGROUP_GMA,
174 TEGRA_DRIVE_PINGROUP_GMB,
175 TEGRA_DRIVE_PINGROUP_GMC,
176 TEGRA_DRIVE_PINGROUP_GMD,
177 TEGRA_DRIVE_PINGROUP_GME,
178 TEGRA_DRIVE_PINGROUP_OWR,
179 TEGRA_DRIVE_PINGROUP_UAD,
180 TEGRA_MAX_DRIVE_PINGROUP,
181};
182
183#endif
184
diff --git a/arch/arm/mach-tegra/include/mach/pinmux-tegra30.h b/arch/arm/mach-tegra/include/mach/pinmux-tegra30.h
deleted file mode 100644
index c1aee3eb2df1..000000000000
--- a/arch/arm/mach-tegra/include/mach/pinmux-tegra30.h
+++ /dev/null
@@ -1,320 +0,0 @@
1/*
2 * linux/arch/arm/mach-tegra/include/mach/pinmux-tegra30.h
3 *
4 * Copyright (C) 2010 Google, Inc.
5 * Copyright (C) 2010,2011 Nvidia, Inc.
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef __MACH_TEGRA_PINMUX_TEGRA30_H
19#define __MACH_TEGRA_PINMUX_TEGRA30_H
20
21enum tegra_pingroup {
22 TEGRA_PINGROUP_ULPI_DATA0 = 0,
23 TEGRA_PINGROUP_ULPI_DATA1,
24 TEGRA_PINGROUP_ULPI_DATA2,
25 TEGRA_PINGROUP_ULPI_DATA3,
26 TEGRA_PINGROUP_ULPI_DATA4,
27 TEGRA_PINGROUP_ULPI_DATA5,
28 TEGRA_PINGROUP_ULPI_DATA6,
29 TEGRA_PINGROUP_ULPI_DATA7,
30 TEGRA_PINGROUP_ULPI_CLK,
31 TEGRA_PINGROUP_ULPI_DIR,
32 TEGRA_PINGROUP_ULPI_NXT,
33 TEGRA_PINGROUP_ULPI_STP,
34 TEGRA_PINGROUP_DAP3_FS,
35 TEGRA_PINGROUP_DAP3_DIN,
36 TEGRA_PINGROUP_DAP3_DOUT,
37 TEGRA_PINGROUP_DAP3_SCLK,
38 TEGRA_PINGROUP_GPIO_PV0,
39 TEGRA_PINGROUP_GPIO_PV1,
40 TEGRA_PINGROUP_SDMMC1_CLK,
41 TEGRA_PINGROUP_SDMMC1_CMD,
42 TEGRA_PINGROUP_SDMMC1_DAT3,
43 TEGRA_PINGROUP_SDMMC1_DAT2,
44 TEGRA_PINGROUP_SDMMC1_DAT1,
45 TEGRA_PINGROUP_SDMMC1_DAT0,
46 TEGRA_PINGROUP_GPIO_PV2,
47 TEGRA_PINGROUP_GPIO_PV3,
48 TEGRA_PINGROUP_CLK2_OUT,
49 TEGRA_PINGROUP_CLK2_REQ,
50 TEGRA_PINGROUP_LCD_PWR1,
51 TEGRA_PINGROUP_LCD_PWR2,
52 TEGRA_PINGROUP_LCD_SDIN,
53 TEGRA_PINGROUP_LCD_SDOUT,
54 TEGRA_PINGROUP_LCD_WR_N,
55 TEGRA_PINGROUP_LCD_CS0_N,
56 TEGRA_PINGROUP_LCD_DC0,
57 TEGRA_PINGROUP_LCD_SCK,
58 TEGRA_PINGROUP_LCD_PWR0,
59 TEGRA_PINGROUP_LCD_PCLK,
60 TEGRA_PINGROUP_LCD_DE,
61 TEGRA_PINGROUP_LCD_HSYNC,
62 TEGRA_PINGROUP_LCD_VSYNC,
63 TEGRA_PINGROUP_LCD_D0,
64 TEGRA_PINGROUP_LCD_D1,
65 TEGRA_PINGROUP_LCD_D2,
66 TEGRA_PINGROUP_LCD_D3,
67 TEGRA_PINGROUP_LCD_D4,
68 TEGRA_PINGROUP_LCD_D5,
69 TEGRA_PINGROUP_LCD_D6,
70 TEGRA_PINGROUP_LCD_D7,
71 TEGRA_PINGROUP_LCD_D8,
72 TEGRA_PINGROUP_LCD_D9,
73 TEGRA_PINGROUP_LCD_D10,
74 TEGRA_PINGROUP_LCD_D11,
75 TEGRA_PINGROUP_LCD_D12,
76 TEGRA_PINGROUP_LCD_D13,
77 TEGRA_PINGROUP_LCD_D14,
78 TEGRA_PINGROUP_LCD_D15,
79 TEGRA_PINGROUP_LCD_D16,
80 TEGRA_PINGROUP_LCD_D17,
81 TEGRA_PINGROUP_LCD_D18,
82 TEGRA_PINGROUP_LCD_D19,
83 TEGRA_PINGROUP_LCD_D20,
84 TEGRA_PINGROUP_LCD_D21,
85 TEGRA_PINGROUP_LCD_D22,
86 TEGRA_PINGROUP_LCD_D23,
87 TEGRA_PINGROUP_LCD_CS1_N,
88 TEGRA_PINGROUP_LCD_M1,
89 TEGRA_PINGROUP_LCD_DC1,
90 TEGRA_PINGROUP_HDMI_INT,
91 TEGRA_PINGROUP_DDC_SCL,
92 TEGRA_PINGROUP_DDC_SDA,
93 TEGRA_PINGROUP_CRT_HSYNC,
94 TEGRA_PINGROUP_CRT_VSYNC,
95 TEGRA_PINGROUP_VI_D0,
96 TEGRA_PINGROUP_VI_D1,
97 TEGRA_PINGROUP_VI_D2,
98 TEGRA_PINGROUP_VI_D3,
99 TEGRA_PINGROUP_VI_D4,
100 TEGRA_PINGROUP_VI_D5,
101 TEGRA_PINGROUP_VI_D6,
102 TEGRA_PINGROUP_VI_D7,
103 TEGRA_PINGROUP_VI_D8,
104 TEGRA_PINGROUP_VI_D9,
105 TEGRA_PINGROUP_VI_D10,
106 TEGRA_PINGROUP_VI_D11,
107 TEGRA_PINGROUP_VI_PCLK,
108 TEGRA_PINGROUP_VI_MCLK,
109 TEGRA_PINGROUP_VI_VSYNC,
110 TEGRA_PINGROUP_VI_HSYNC,
111 TEGRA_PINGROUP_UART2_RXD,
112 TEGRA_PINGROUP_UART2_TXD,
113 TEGRA_PINGROUP_UART2_RTS_N,
114 TEGRA_PINGROUP_UART2_CTS_N,
115 TEGRA_PINGROUP_UART3_TXD,
116 TEGRA_PINGROUP_UART3_RXD,
117 TEGRA_PINGROUP_UART3_CTS_N,
118 TEGRA_PINGROUP_UART3_RTS_N,
119 TEGRA_PINGROUP_GPIO_PU0,
120 TEGRA_PINGROUP_GPIO_PU1,
121 TEGRA_PINGROUP_GPIO_PU2,
122 TEGRA_PINGROUP_GPIO_PU3,
123 TEGRA_PINGROUP_GPIO_PU4,
124 TEGRA_PINGROUP_GPIO_PU5,
125 TEGRA_PINGROUP_GPIO_PU6,
126 TEGRA_PINGROUP_GEN1_I2C_SDA,
127 TEGRA_PINGROUP_GEN1_I2C_SCL,
128 TEGRA_PINGROUP_DAP4_FS,
129 TEGRA_PINGROUP_DAP4_DIN,
130 TEGRA_PINGROUP_DAP4_DOUT,
131 TEGRA_PINGROUP_DAP4_SCLK,
132 TEGRA_PINGROUP_CLK3_OUT,
133 TEGRA_PINGROUP_CLK3_REQ,
134 TEGRA_PINGROUP_GMI_WP_N,
135 TEGRA_PINGROUP_GMI_IORDY,
136 TEGRA_PINGROUP_GMI_WAIT,
137 TEGRA_PINGROUP_GMI_ADV_N,
138 TEGRA_PINGROUP_GMI_CLK,
139 TEGRA_PINGROUP_GMI_CS0_N,
140 TEGRA_PINGROUP_GMI_CS1_N,
141 TEGRA_PINGROUP_GMI_CS2_N,
142 TEGRA_PINGROUP_GMI_CS3_N,
143 TEGRA_PINGROUP_GMI_CS4_N,
144 TEGRA_PINGROUP_GMI_CS6_N,
145 TEGRA_PINGROUP_GMI_CS7_N,
146 TEGRA_PINGROUP_GMI_AD0,
147 TEGRA_PINGROUP_GMI_AD1,
148 TEGRA_PINGROUP_GMI_AD2,
149 TEGRA_PINGROUP_GMI_AD3,
150 TEGRA_PINGROUP_GMI_AD4,
151 TEGRA_PINGROUP_GMI_AD5,
152 TEGRA_PINGROUP_GMI_AD6,
153 TEGRA_PINGROUP_GMI_AD7,
154 TEGRA_PINGROUP_GMI_AD8,
155 TEGRA_PINGROUP_GMI_AD9,
156 TEGRA_PINGROUP_GMI_AD10,
157 TEGRA_PINGROUP_GMI_AD11,
158 TEGRA_PINGROUP_GMI_AD12,
159 TEGRA_PINGROUP_GMI_AD13,
160 TEGRA_PINGROUP_GMI_AD14,
161 TEGRA_PINGROUP_GMI_AD15,
162 TEGRA_PINGROUP_GMI_A16,
163 TEGRA_PINGROUP_GMI_A17,
164 TEGRA_PINGROUP_GMI_A18,
165 TEGRA_PINGROUP_GMI_A19,
166 TEGRA_PINGROUP_GMI_WR_N,
167 TEGRA_PINGROUP_GMI_OE_N,
168 TEGRA_PINGROUP_GMI_DQS,
169 TEGRA_PINGROUP_GMI_RST_N,
170 TEGRA_PINGROUP_GEN2_I2C_SCL,
171 TEGRA_PINGROUP_GEN2_I2C_SDA,
172 TEGRA_PINGROUP_SDMMC4_CLK,
173 TEGRA_PINGROUP_SDMMC4_CMD,
174 TEGRA_PINGROUP_SDMMC4_DAT0,
175 TEGRA_PINGROUP_SDMMC4_DAT1,
176 TEGRA_PINGROUP_SDMMC4_DAT2,
177 TEGRA_PINGROUP_SDMMC4_DAT3,
178 TEGRA_PINGROUP_SDMMC4_DAT4,
179 TEGRA_PINGROUP_SDMMC4_DAT5,
180 TEGRA_PINGROUP_SDMMC4_DAT6,
181 TEGRA_PINGROUP_SDMMC4_DAT7,
182 TEGRA_PINGROUP_SDMMC4_RST_N,
183 TEGRA_PINGROUP_CAM_MCLK,
184 TEGRA_PINGROUP_GPIO_PCC1,
185 TEGRA_PINGROUP_GPIO_PBB0,
186 TEGRA_PINGROUP_CAM_I2C_SCL,
187 TEGRA_PINGROUP_CAM_I2C_SDA,
188 TEGRA_PINGROUP_GPIO_PBB3,
189 TEGRA_PINGROUP_GPIO_PBB4,
190 TEGRA_PINGROUP_GPIO_PBB5,
191 TEGRA_PINGROUP_GPIO_PBB6,
192 TEGRA_PINGROUP_GPIO_PBB7,
193 TEGRA_PINGROUP_GPIO_PCC2,
194 TEGRA_PINGROUP_JTAG_RTCK,
195 TEGRA_PINGROUP_PWR_I2C_SCL,
196 TEGRA_PINGROUP_PWR_I2C_SDA,
197 TEGRA_PINGROUP_KB_ROW0,
198 TEGRA_PINGROUP_KB_ROW1,
199 TEGRA_PINGROUP_KB_ROW2,
200 TEGRA_PINGROUP_KB_ROW3,
201 TEGRA_PINGROUP_KB_ROW4,
202 TEGRA_PINGROUP_KB_ROW5,
203 TEGRA_PINGROUP_KB_ROW6,
204 TEGRA_PINGROUP_KB_ROW7,
205 TEGRA_PINGROUP_KB_ROW8,
206 TEGRA_PINGROUP_KB_ROW9,
207 TEGRA_PINGROUP_KB_ROW10,
208 TEGRA_PINGROUP_KB_ROW11,
209 TEGRA_PINGROUP_KB_ROW12,
210 TEGRA_PINGROUP_KB_ROW13,
211 TEGRA_PINGROUP_KB_ROW14,
212 TEGRA_PINGROUP_KB_ROW15,
213 TEGRA_PINGROUP_KB_COL0,
214 TEGRA_PINGROUP_KB_COL1,
215 TEGRA_PINGROUP_KB_COL2,
216 TEGRA_PINGROUP_KB_COL3,
217 TEGRA_PINGROUP_KB_COL4,
218 TEGRA_PINGROUP_KB_COL5,
219 TEGRA_PINGROUP_KB_COL6,
220 TEGRA_PINGROUP_KB_COL7,
221 TEGRA_PINGROUP_CLK_32K_OUT,
222 TEGRA_PINGROUP_SYS_CLK_REQ,
223 TEGRA_PINGROUP_CORE_PWR_REQ,
224 TEGRA_PINGROUP_CPU_PWR_REQ,
225 TEGRA_PINGROUP_PWR_INT_N,
226 TEGRA_PINGROUP_CLK_32K_IN,
227 TEGRA_PINGROUP_OWR,
228 TEGRA_PINGROUP_DAP1_FS,
229 TEGRA_PINGROUP_DAP1_DIN,
230 TEGRA_PINGROUP_DAP1_DOUT,
231 TEGRA_PINGROUP_DAP1_SCLK,
232 TEGRA_PINGROUP_CLK1_REQ,
233 TEGRA_PINGROUP_CLK1_OUT,
234 TEGRA_PINGROUP_SPDIF_IN,
235 TEGRA_PINGROUP_SPDIF_OUT,
236 TEGRA_PINGROUP_DAP2_FS,
237 TEGRA_PINGROUP_DAP2_DIN,
238 TEGRA_PINGROUP_DAP2_DOUT,
239 TEGRA_PINGROUP_DAP2_SCLK,
240 TEGRA_PINGROUP_SPI2_MOSI,
241 TEGRA_PINGROUP_SPI2_MISO,
242 TEGRA_PINGROUP_SPI2_CS0_N,
243 TEGRA_PINGROUP_SPI2_SCK,
244 TEGRA_PINGROUP_SPI1_MOSI,
245 TEGRA_PINGROUP_SPI1_SCK,
246 TEGRA_PINGROUP_SPI1_CS0_N,
247 TEGRA_PINGROUP_SPI1_MISO,
248 TEGRA_PINGROUP_SPI2_CS1_N,
249 TEGRA_PINGROUP_SPI2_CS2_N,
250 TEGRA_PINGROUP_SDMMC3_CLK,
251 TEGRA_PINGROUP_SDMMC3_CMD,
252 TEGRA_PINGROUP_SDMMC3_DAT0,
253 TEGRA_PINGROUP_SDMMC3_DAT1,
254 TEGRA_PINGROUP_SDMMC3_DAT2,
255 TEGRA_PINGROUP_SDMMC3_DAT3,
256 TEGRA_PINGROUP_SDMMC3_DAT4,
257 TEGRA_PINGROUP_SDMMC3_DAT5,
258 TEGRA_PINGROUP_SDMMC3_DAT6,
259 TEGRA_PINGROUP_SDMMC3_DAT7,
260 TEGRA_PINGROUP_PEX_L0_PRSNT_N,
261 TEGRA_PINGROUP_PEX_L0_RST_N,
262 TEGRA_PINGROUP_PEX_L0_CLKREQ_N,
263 TEGRA_PINGROUP_PEX_WAKE_N,
264 TEGRA_PINGROUP_PEX_L1_PRSNT_N,
265 TEGRA_PINGROUP_PEX_L1_RST_N,
266 TEGRA_PINGROUP_PEX_L1_CLKREQ_N,
267 TEGRA_PINGROUP_PEX_L2_PRSNT_N,
268 TEGRA_PINGROUP_PEX_L2_RST_N,
269 TEGRA_PINGROUP_PEX_L2_CLKREQ_N,
270 TEGRA_PINGROUP_HDMI_CEC,
271 TEGRA_MAX_PINGROUP,
272};
273
274enum tegra_drive_pingroup {
275 TEGRA_DRIVE_PINGROUP_AO1 = 0,
276 TEGRA_DRIVE_PINGROUP_AO2,
277 TEGRA_DRIVE_PINGROUP_AT1,
278 TEGRA_DRIVE_PINGROUP_AT2,
279 TEGRA_DRIVE_PINGROUP_AT3,
280 TEGRA_DRIVE_PINGROUP_AT4,
281 TEGRA_DRIVE_PINGROUP_AT5,
282 TEGRA_DRIVE_PINGROUP_CDEV1,
283 TEGRA_DRIVE_PINGROUP_CDEV2,
284 TEGRA_DRIVE_PINGROUP_CSUS,
285 TEGRA_DRIVE_PINGROUP_DAP1,
286 TEGRA_DRIVE_PINGROUP_DAP2,
287 TEGRA_DRIVE_PINGROUP_DAP3,
288 TEGRA_DRIVE_PINGROUP_DAP4,
289 TEGRA_DRIVE_PINGROUP_DBG,
290 TEGRA_DRIVE_PINGROUP_LCD1,
291 TEGRA_DRIVE_PINGROUP_LCD2,
292 TEGRA_DRIVE_PINGROUP_SDIO2,
293 TEGRA_DRIVE_PINGROUP_SDIO3,
294 TEGRA_DRIVE_PINGROUP_SPI,
295 TEGRA_DRIVE_PINGROUP_UAA,
296 TEGRA_DRIVE_PINGROUP_UAB,
297 TEGRA_DRIVE_PINGROUP_UART2,
298 TEGRA_DRIVE_PINGROUP_UART3,
299 TEGRA_DRIVE_PINGROUP_VI1,
300 TEGRA_DRIVE_PINGROUP_SDIO1,
301 TEGRA_DRIVE_PINGROUP_CRT,
302 TEGRA_DRIVE_PINGROUP_DDC,
303 TEGRA_DRIVE_PINGROUP_GMA,
304 TEGRA_DRIVE_PINGROUP_GMB,
305 TEGRA_DRIVE_PINGROUP_GMC,
306 TEGRA_DRIVE_PINGROUP_GMD,
307 TEGRA_DRIVE_PINGROUP_GME,
308 TEGRA_DRIVE_PINGROUP_GMF,
309 TEGRA_DRIVE_PINGROUP_GMG,
310 TEGRA_DRIVE_PINGROUP_GMH,
311 TEGRA_DRIVE_PINGROUP_OWR,
312 TEGRA_DRIVE_PINGROUP_UAD,
313 TEGRA_DRIVE_PINGROUP_GPV,
314 TEGRA_DRIVE_PINGROUP_DEV3,
315 TEGRA_DRIVE_PINGROUP_CEC,
316 TEGRA_MAX_DRIVE_PINGROUP,
317};
318
319#endif
320
diff --git a/arch/arm/mach-tegra/include/mach/pinmux.h b/arch/arm/mach-tegra/include/mach/pinmux.h
deleted file mode 100644
index 055f1792c8ff..000000000000
--- a/arch/arm/mach-tegra/include/mach/pinmux.h
+++ /dev/null
@@ -1,302 +0,0 @@
1/*
2 * linux/arch/arm/mach-tegra/include/mach/pinmux.h
3 *
4 * Copyright (C) 2010 Google, Inc.
5 * Copyright (C) 2010,2011 Nvidia, Inc.
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef __MACH_TEGRA_PINMUX_H
19#define __MACH_TEGRA_PINMUX_H
20
21enum tegra_mux_func {
22 TEGRA_MUX_RSVD = 0x8000,
23 TEGRA_MUX_RSVD1 = 0x8000,
24 TEGRA_MUX_RSVD2 = 0x8001,
25 TEGRA_MUX_RSVD3 = 0x8002,
26 TEGRA_MUX_RSVD4 = 0x8003,
27 TEGRA_MUX_INVALID = 0x4000,
28 TEGRA_MUX_NONE = -1,
29 TEGRA_MUX_AHB_CLK,
30 TEGRA_MUX_APB_CLK,
31 TEGRA_MUX_AUDIO_SYNC,
32 TEGRA_MUX_CRT,
33 TEGRA_MUX_DAP1,
34 TEGRA_MUX_DAP2,
35 TEGRA_MUX_DAP3,
36 TEGRA_MUX_DAP4,
37 TEGRA_MUX_DAP5,
38 TEGRA_MUX_DISPLAYA,
39 TEGRA_MUX_DISPLAYB,
40 TEGRA_MUX_EMC_TEST0_DLL,
41 TEGRA_MUX_EMC_TEST1_DLL,
42 TEGRA_MUX_GMI,
43 TEGRA_MUX_GMI_INT,
44 TEGRA_MUX_HDMI,
45 TEGRA_MUX_I2C,
46 TEGRA_MUX_I2C2,
47 TEGRA_MUX_I2C3,
48 TEGRA_MUX_IDE,
49 TEGRA_MUX_IRDA,
50 TEGRA_MUX_KBC,
51 TEGRA_MUX_MIO,
52 TEGRA_MUX_MIPI_HS,
53 TEGRA_MUX_NAND,
54 TEGRA_MUX_OSC,
55 TEGRA_MUX_OWR,
56 TEGRA_MUX_PCIE,
57 TEGRA_MUX_PLLA_OUT,
58 TEGRA_MUX_PLLC_OUT1,
59 TEGRA_MUX_PLLM_OUT1,
60 TEGRA_MUX_PLLP_OUT2,
61 TEGRA_MUX_PLLP_OUT3,
62 TEGRA_MUX_PLLP_OUT4,
63 TEGRA_MUX_PWM,
64 TEGRA_MUX_PWR_INTR,
65 TEGRA_MUX_PWR_ON,
66 TEGRA_MUX_RTCK,
67 TEGRA_MUX_SDIO1,
68 TEGRA_MUX_SDIO2,
69 TEGRA_MUX_SDIO3,
70 TEGRA_MUX_SDIO4,
71 TEGRA_MUX_SFLASH,
72 TEGRA_MUX_SPDIF,
73 TEGRA_MUX_SPI1,
74 TEGRA_MUX_SPI2,
75 TEGRA_MUX_SPI2_ALT,
76 TEGRA_MUX_SPI3,
77 TEGRA_MUX_SPI4,
78 TEGRA_MUX_TRACE,
79 TEGRA_MUX_TWC,
80 TEGRA_MUX_UARTA,
81 TEGRA_MUX_UARTB,
82 TEGRA_MUX_UARTC,
83 TEGRA_MUX_UARTD,
84 TEGRA_MUX_UARTE,
85 TEGRA_MUX_ULPI,
86 TEGRA_MUX_VI,
87 TEGRA_MUX_VI_SENSOR_CLK,
88 TEGRA_MUX_XIO,
89 TEGRA_MUX_BLINK,
90 TEGRA_MUX_CEC,
91 TEGRA_MUX_CLK12,
92 TEGRA_MUX_DAP,
93 TEGRA_MUX_DAPSDMMC2,
94 TEGRA_MUX_DDR,
95 TEGRA_MUX_DEV3,
96 TEGRA_MUX_DTV,
97 TEGRA_MUX_VI_ALT1,
98 TEGRA_MUX_VI_ALT2,
99 TEGRA_MUX_VI_ALT3,
100 TEGRA_MUX_EMC_DLL,
101 TEGRA_MUX_EXTPERIPH1,
102 TEGRA_MUX_EXTPERIPH2,
103 TEGRA_MUX_EXTPERIPH3,
104 TEGRA_MUX_GMI_ALT,
105 TEGRA_MUX_HDA,
106 TEGRA_MUX_HSI,
107 TEGRA_MUX_I2C4,
108 TEGRA_MUX_I2C5,
109 TEGRA_MUX_I2CPWR,
110 TEGRA_MUX_I2S0,
111 TEGRA_MUX_I2S1,
112 TEGRA_MUX_I2S2,
113 TEGRA_MUX_I2S3,
114 TEGRA_MUX_I2S4,
115 TEGRA_MUX_NAND_ALT,
116 TEGRA_MUX_POPSDIO4,
117 TEGRA_MUX_POPSDMMC4,
118 TEGRA_MUX_PWM0,
119 TEGRA_MUX_PWM1,
120 TEGRA_MUX_PWM2,
121 TEGRA_MUX_PWM3,
122 TEGRA_MUX_SATA,
123 TEGRA_MUX_SPI5,
124 TEGRA_MUX_SPI6,
125 TEGRA_MUX_SYSCLK,
126 TEGRA_MUX_VGP1,
127 TEGRA_MUX_VGP2,
128 TEGRA_MUX_VGP3,
129 TEGRA_MUX_VGP4,
130 TEGRA_MUX_VGP5,
131 TEGRA_MUX_VGP6,
132 TEGRA_MUX_SAFE,
133 TEGRA_MAX_MUX,
134};
135
136enum tegra_pullupdown {
137 TEGRA_PUPD_NORMAL = 0,
138 TEGRA_PUPD_PULL_DOWN,
139 TEGRA_PUPD_PULL_UP,
140};
141
142enum tegra_tristate {
143 TEGRA_TRI_NORMAL = 0,
144 TEGRA_TRI_TRISTATE = 1,
145};
146
147enum tegra_pin_io {
148 TEGRA_PIN_OUTPUT = 0,
149 TEGRA_PIN_INPUT = 1,
150};
151
152enum tegra_vddio {
153 TEGRA_VDDIO_BB = 0,
154 TEGRA_VDDIO_LCD,
155 TEGRA_VDDIO_VI,
156 TEGRA_VDDIO_UART,
157 TEGRA_VDDIO_DDR,
158 TEGRA_VDDIO_NAND,
159 TEGRA_VDDIO_SYS,
160 TEGRA_VDDIO_AUDIO,
161 TEGRA_VDDIO_SD,
162 TEGRA_VDDIO_CAM,
163 TEGRA_VDDIO_GMI,
164 TEGRA_VDDIO_PEXCTL,
165 TEGRA_VDDIO_SDMMC1,
166 TEGRA_VDDIO_SDMMC3,
167 TEGRA_VDDIO_SDMMC4,
168};
169
170struct tegra_pingroup_config {
171 int pingroup;
172 enum tegra_mux_func func;
173 enum tegra_pullupdown pupd;
174 enum tegra_tristate tristate;
175};
176
177enum tegra_slew {
178 TEGRA_SLEW_FASTEST = 0,
179 TEGRA_SLEW_FAST,
180 TEGRA_SLEW_SLOW,
181 TEGRA_SLEW_SLOWEST,
182 TEGRA_MAX_SLEW,
183};
184
185enum tegra_pull_strength {
186 TEGRA_PULL_0 = 0,
187 TEGRA_PULL_1,
188 TEGRA_PULL_2,
189 TEGRA_PULL_3,
190 TEGRA_PULL_4,
191 TEGRA_PULL_5,
192 TEGRA_PULL_6,
193 TEGRA_PULL_7,
194 TEGRA_PULL_8,
195 TEGRA_PULL_9,
196 TEGRA_PULL_10,
197 TEGRA_PULL_11,
198 TEGRA_PULL_12,
199 TEGRA_PULL_13,
200 TEGRA_PULL_14,
201 TEGRA_PULL_15,
202 TEGRA_PULL_16,
203 TEGRA_PULL_17,
204 TEGRA_PULL_18,
205 TEGRA_PULL_19,
206 TEGRA_PULL_20,
207 TEGRA_PULL_21,
208 TEGRA_PULL_22,
209 TEGRA_PULL_23,
210 TEGRA_PULL_24,
211 TEGRA_PULL_25,
212 TEGRA_PULL_26,
213 TEGRA_PULL_27,
214 TEGRA_PULL_28,
215 TEGRA_PULL_29,
216 TEGRA_PULL_30,
217 TEGRA_PULL_31,
218 TEGRA_MAX_PULL,
219};
220
221enum tegra_drive {
222 TEGRA_DRIVE_DIV_8 = 0,
223 TEGRA_DRIVE_DIV_4,
224 TEGRA_DRIVE_DIV_2,
225 TEGRA_DRIVE_DIV_1,
226 TEGRA_MAX_DRIVE,
227};
228
229enum tegra_hsm {
230 TEGRA_HSM_DISABLE = 0,
231 TEGRA_HSM_ENABLE,
232};
233
234enum tegra_schmitt {
235 TEGRA_SCHMITT_DISABLE = 0,
236 TEGRA_SCHMITT_ENABLE,
237};
238
239struct tegra_drive_pingroup_config {
240 int pingroup;
241 enum tegra_hsm hsm;
242 enum tegra_schmitt schmitt;
243 enum tegra_drive drive;
244 enum tegra_pull_strength pull_down;
245 enum tegra_pull_strength pull_up;
246 enum tegra_slew slew_rising;
247 enum tegra_slew slew_falling;
248};
249
250struct tegra_drive_pingroup_desc {
251 const char *name;
252 s16 reg_bank;
253 s16 reg;
254};
255
256struct tegra_pingroup_desc {
257 const char *name;
258 int funcs[4];
259 int func_safe;
260 int vddio;
261 enum tegra_pin_io io_default;
262 s16 tri_bank; /* Register bank the tri_reg exists within */
263 s16 mux_bank; /* Register bank the mux_reg exists within */
264 s16 pupd_bank; /* Register bank the pupd_reg exists within */
265 s16 tri_reg; /* offset into the TRISTATE_REG_* register bank */
266 s16 mux_reg; /* offset into the PIN_MUX_CTL_* register bank */
267 s16 pupd_reg; /* offset into the PULL_UPDOWN_REG_* register bank */
268 s8 tri_bit; /* offset into the TRISTATE_REG_* register bit */
269 s8 mux_bit; /* offset into the PIN_MUX_CTL_* register bit */
270 s8 pupd_bit; /* offset into the PULL_UPDOWN_REG_* register bit */
271 s8 lock_bit; /* offset of the LOCK bit into mux register bit */
272 s8 od_bit; /* offset of the OD bit into mux register bit */
273 s8 ioreset_bit; /* offset of the IO_RESET bit into mux register bit */
274};
275
276typedef void (*pinmux_init) (const struct tegra_pingroup_desc **pg,
277 int *pg_max, const struct tegra_drive_pingroup_desc **pgdrive,
278 int *pgdrive_max);
279
280void tegra20_pinmux_init(const struct tegra_pingroup_desc **pg, int *pg_max,
281 const struct tegra_drive_pingroup_desc **pgdrive, int *pgdrive_max);
282
283void tegra30_pinmux_init(const struct tegra_pingroup_desc **pg, int *pg_max,
284 const struct tegra_drive_pingroup_desc **pgdrive, int *pgdrive_max);
285
286int tegra_pinmux_set_tristate(int pg, enum tegra_tristate tristate);
287int tegra_pinmux_set_pullupdown(int pg, enum tegra_pullupdown pupd);
288
289void tegra_pinmux_config_table(const struct tegra_pingroup_config *config,
290 int len);
291
292void tegra_drive_pinmux_config_table(struct tegra_drive_pingroup_config *config,
293 int len);
294void tegra_pinmux_set_safe_pinmux_table(const struct tegra_pingroup_config *config,
295 int len);
296void tegra_pinmux_config_pinmux_table(const struct tegra_pingroup_config *config,
297 int len);
298void tegra_pinmux_config_tristate_table(const struct tegra_pingroup_config *config,
299 int len, enum tegra_tristate tristate);
300void tegra_pinmux_config_pullupdown_table(const struct tegra_pingroup_config *config,
301 int len, enum tegra_pullupdown pupd);
302#endif
diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c
index 54a816ff3847..0e09137506ec 100644
--- a/arch/arm/mach-tegra/pcie.c
+++ b/arch/arm/mach-tegra/pcie.c
@@ -475,7 +475,6 @@ static struct hw_pci tegra_pcie_hw __initdata = {
475 .nr_controllers = 2, 475 .nr_controllers = 2,
476 .setup = tegra_pcie_setup, 476 .setup = tegra_pcie_setup,
477 .scan = tegra_pcie_scan_bus, 477 .scan = tegra_pcie_scan_bus,
478 .swizzle = pci_std_swizzle,
479 .map_irq = tegra_pcie_map_irq, 478 .map_irq = tegra_pcie_map_irq,
480}; 479};
481 480
diff --git a/arch/arm/mach-tegra/pinmux-tegra20-tables.c b/arch/arm/mach-tegra/pinmux-tegra20-tables.c
deleted file mode 100644
index 734add1280b7..000000000000
--- a/arch/arm/mach-tegra/pinmux-tegra20-tables.c
+++ /dev/null
@@ -1,244 +0,0 @@
1/*
2 * linux/arch/arm/mach-tegra/pinmux-tegra20-tables.c
3 *
4 * Common pinmux configurations for Tegra20 SoCs
5 *
6 * Copyright (C) 2010 NVIDIA Corporation
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23#include <linux/kernel.h>
24#include <linux/errno.h>
25#include <linux/spinlock.h>
26#include <linux/io.h>
27#include <linux/init.h>
28#include <linux/string.h>
29
30#include <mach/iomap.h>
31#include <mach/pinmux.h>
32#include <mach/pinmux-tegra20.h>
33#include <mach/suspend.h>
34
35#define TRISTATE_REG_A 0x14
36#define PIN_MUX_CTL_REG_A 0x80
37#define PULLUPDOWN_REG_A 0xa0
38#define PINGROUP_REG_A 0x868
39
40#define DRIVE_PINGROUP(pg_name, r) \
41 [TEGRA_DRIVE_PINGROUP_ ## pg_name] = { \
42 .name = #pg_name, \
43 .reg_bank = 3, \
44 .reg = ((r) - PINGROUP_REG_A) \
45 }
46
47static const struct tegra_drive_pingroup_desc tegra_soc_drive_pingroups[TEGRA_MAX_DRIVE_PINGROUP] = {
48 DRIVE_PINGROUP(AO1, 0x868),
49 DRIVE_PINGROUP(AO2, 0x86c),
50 DRIVE_PINGROUP(AT1, 0x870),
51 DRIVE_PINGROUP(AT2, 0x874),
52 DRIVE_PINGROUP(CDEV1, 0x878),
53 DRIVE_PINGROUP(CDEV2, 0x87c),
54 DRIVE_PINGROUP(CSUS, 0x880),
55 DRIVE_PINGROUP(DAP1, 0x884),
56 DRIVE_PINGROUP(DAP2, 0x888),
57 DRIVE_PINGROUP(DAP3, 0x88c),
58 DRIVE_PINGROUP(DAP4, 0x890),
59 DRIVE_PINGROUP(DBG, 0x894),
60 DRIVE_PINGROUP(LCD1, 0x898),
61 DRIVE_PINGROUP(LCD2, 0x89c),
62 DRIVE_PINGROUP(SDMMC2, 0x8a0),
63 DRIVE_PINGROUP(SDMMC3, 0x8a4),
64 DRIVE_PINGROUP(SPI, 0x8a8),
65 DRIVE_PINGROUP(UAA, 0x8ac),
66 DRIVE_PINGROUP(UAB, 0x8b0),
67 DRIVE_PINGROUP(UART2, 0x8b4),
68 DRIVE_PINGROUP(UART3, 0x8b8),
69 DRIVE_PINGROUP(VI1, 0x8bc),
70 DRIVE_PINGROUP(VI2, 0x8c0),
71 DRIVE_PINGROUP(XM2A, 0x8c4),
72 DRIVE_PINGROUP(XM2C, 0x8c8),
73 DRIVE_PINGROUP(XM2D, 0x8cc),
74 DRIVE_PINGROUP(XM2CLK, 0x8d0),
75 DRIVE_PINGROUP(MEMCOMP, 0x8d4),
76 DRIVE_PINGROUP(SDIO1, 0x8e0),
77 DRIVE_PINGROUP(CRT, 0x8ec),
78 DRIVE_PINGROUP(DDC, 0x8f0),
79 DRIVE_PINGROUP(GMA, 0x8f4),
80 DRIVE_PINGROUP(GMB, 0x8f8),
81 DRIVE_PINGROUP(GMC, 0x8fc),
82 DRIVE_PINGROUP(GMD, 0x900),
83 DRIVE_PINGROUP(GME, 0x904),
84 DRIVE_PINGROUP(OWR, 0x908),
85 DRIVE_PINGROUP(UAD, 0x90c),
86};
87
88#define PINGROUP(pg_name, vdd, f0, f1, f2, f3, f_safe, \
89 tri_r, tri_b, mux_r, mux_b, pupd_r, pupd_b) \
90 [TEGRA_PINGROUP_ ## pg_name] = { \
91 .name = #pg_name, \
92 .vddio = TEGRA_VDDIO_ ## vdd, \
93 .funcs = { \
94 TEGRA_MUX_ ## f0, \
95 TEGRA_MUX_ ## f1, \
96 TEGRA_MUX_ ## f2, \
97 TEGRA_MUX_ ## f3, \
98 }, \
99 .func_safe = TEGRA_MUX_ ## f_safe, \
100 .tri_bank = 0, \
101 .tri_reg = ((tri_r) - TRISTATE_REG_A), \
102 .tri_bit = tri_b, \
103 .mux_bank = 1, \
104 .mux_reg = ((mux_r) - PIN_MUX_CTL_REG_A), \
105 .mux_bit = mux_b, \
106 .pupd_bank = 2, \
107 .pupd_reg = ((pupd_r) - PULLUPDOWN_REG_A), \
108 .pupd_bit = pupd_b, \
109 .lock_bit = -1, \
110 .od_bit = -1, \
111 .ioreset_bit = -1, \
112 .io_default = -1, \
113 }
114
115static const struct tegra_pingroup_desc tegra_soc_pingroups[TEGRA_MAX_PINGROUP] = {
116 PINGROUP(ATA, NAND, IDE, NAND, GMI, RSVD, IDE, 0x14, 0, 0x80, 24, 0xA0, 0),
117 PINGROUP(ATB, NAND, IDE, NAND, GMI, SDIO4, IDE, 0x14, 1, 0x80, 16, 0xA0, 2),
118 PINGROUP(ATC, NAND, IDE, NAND, GMI, SDIO4, IDE, 0x14, 2, 0x80, 22, 0xA0, 4),
119 PINGROUP(ATD, NAND, IDE, NAND, GMI, SDIO4, IDE, 0x14, 3, 0x80, 20, 0xA0, 6),
120 PINGROUP(ATE, NAND, IDE, NAND, GMI, RSVD, IDE, 0x18, 25, 0x80, 12, 0xA0, 8),
121 PINGROUP(CDEV1, AUDIO, OSC, PLLA_OUT, PLLM_OUT1, AUDIO_SYNC, OSC, 0x14, 4, 0x88, 2, 0xA8, 0),
122 PINGROUP(CDEV2, AUDIO, OSC, AHB_CLK, APB_CLK, PLLP_OUT4, OSC, 0x14, 5, 0x88, 4, 0xA8, 2),
123 PINGROUP(CRTP, LCD, CRT, RSVD, RSVD, RSVD, RSVD, 0x20, 14, 0x98, 20, 0xA4, 24),
124 PINGROUP(CSUS, VI, PLLC_OUT1, PLLP_OUT2, PLLP_OUT3, VI_SENSOR_CLK, PLLC_OUT1, 0x14, 6, 0x88, 6, 0xAC, 24),
125 PINGROUP(DAP1, AUDIO, DAP1, RSVD, GMI, SDIO2, DAP1, 0x14, 7, 0x88, 20, 0xA0, 10),
126 PINGROUP(DAP2, AUDIO, DAP2, TWC, RSVD, GMI, DAP2, 0x14, 8, 0x88, 22, 0xA0, 12),
127 PINGROUP(DAP3, BB, DAP3, RSVD, RSVD, RSVD, DAP3, 0x14, 9, 0x88, 24, 0xA0, 14),
128 PINGROUP(DAP4, UART, DAP4, RSVD, GMI, RSVD, DAP4, 0x14, 10, 0x88, 26, 0xA0, 16),
129 PINGROUP(DDC, LCD, I2C2, RSVD, RSVD, RSVD, RSVD4, 0x18, 31, 0x88, 0, 0xB0, 28),
130 PINGROUP(DTA, VI, RSVD, SDIO2, VI, RSVD, RSVD4, 0x14, 11, 0x84, 20, 0xA0, 18),
131 PINGROUP(DTB, VI, RSVD, RSVD, VI, SPI1, RSVD1, 0x14, 12, 0x84, 22, 0xA0, 20),
132 PINGROUP(DTC, VI, RSVD, RSVD, VI, RSVD, RSVD1, 0x14, 13, 0x84, 26, 0xA0, 22),
133 PINGROUP(DTD, VI, RSVD, SDIO2, VI, RSVD, RSVD1, 0x14, 14, 0x84, 28, 0xA0, 24),
134 PINGROUP(DTE, VI, RSVD, RSVD, VI, SPI1, RSVD1, 0x14, 15, 0x84, 30, 0xA0, 26),
135 PINGROUP(DTF, VI, I2C3, RSVD, VI, RSVD, RSVD4, 0x20, 12, 0x98, 30, 0xA0, 28),
136 PINGROUP(GMA, NAND, UARTE, SPI3, GMI, SDIO4, SPI3, 0x14, 28, 0x84, 0, 0xB0, 20),
137 PINGROUP(GMB, NAND, IDE, NAND, GMI, GMI_INT, GMI, 0x18, 29, 0x88, 28, 0xB0, 22),
138 PINGROUP(GMC, NAND, UARTD, SPI4, GMI, SFLASH, SPI4, 0x14, 29, 0x84, 2, 0xB0, 24),
139 PINGROUP(GMD, NAND, RSVD, NAND, GMI, SFLASH, GMI, 0x18, 30, 0x88, 30, 0xB0, 26),
140 PINGROUP(GME, NAND, RSVD, DAP5, GMI, SDIO4, GMI, 0x18, 0, 0x8C, 0, 0xA8, 24),
141 PINGROUP(GPU, UART, PWM, UARTA, GMI, RSVD, RSVD4, 0x14, 16, 0x8C, 4, 0xA4, 20),
142 PINGROUP(GPU7, SYS, RTCK, RSVD, RSVD, RSVD, RTCK, 0x20, 11, 0x98, 28, 0xA4, 6),
143 PINGROUP(GPV, SD, PCIE, RSVD, RSVD, RSVD, PCIE, 0x14, 17, 0x8C, 2, 0xA0, 30),
144 PINGROUP(HDINT, LCD, HDMI, RSVD, RSVD, RSVD, HDMI, 0x1C, 23, 0x84, 4, 0xAC, 22),
145 PINGROUP(I2CP, SYS, I2C, RSVD, RSVD, RSVD, RSVD4, 0x14, 18, 0x88, 8, 0xA4, 2),
146 PINGROUP(IRRX, UART, UARTA, UARTB, GMI, SPI4, UARTB, 0x14, 20, 0x88, 18, 0xA8, 22),
147 PINGROUP(IRTX, UART, UARTA, UARTB, GMI, SPI4, UARTB, 0x14, 19, 0x88, 16, 0xA8, 20),
148 PINGROUP(KBCA, SYS, KBC, NAND, SDIO2, EMC_TEST0_DLL, KBC, 0x14, 22, 0x88, 10, 0xA4, 8),
149 PINGROUP(KBCB, SYS, KBC, NAND, SDIO2, MIO, KBC, 0x14, 21, 0x88, 12, 0xA4, 10),
150 PINGROUP(KBCC, SYS, KBC, NAND, TRACE, EMC_TEST1_DLL, KBC, 0x18, 26, 0x88, 14, 0xA4, 12),
151 PINGROUP(KBCD, SYS, KBC, NAND, SDIO2, MIO, KBC, 0x20, 10, 0x98, 26, 0xA4, 14),
152 PINGROUP(KBCE, SYS, KBC, NAND, OWR, RSVD, KBC, 0x14, 26, 0x80, 28, 0xB0, 2),
153 PINGROUP(KBCF, SYS, KBC, NAND, TRACE, MIO, KBC, 0x14, 27, 0x80, 26, 0xB0, 0),
154 PINGROUP(LCSN, LCD, DISPLAYA, DISPLAYB, SPI3, RSVD, RSVD4, 0x1C, 31, 0x90, 12, 0xAC, 20),
155 PINGROUP(LD0, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 0, 0x94, 0, 0xAC, 12),
156 PINGROUP(LD1, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 1, 0x94, 2, 0xAC, 12),
157 PINGROUP(LD10, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 10, 0x94, 20, 0xAC, 12),
158 PINGROUP(LD11, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 11, 0x94, 22, 0xAC, 12),
159 PINGROUP(LD12, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 12, 0x94, 24, 0xAC, 12),
160 PINGROUP(LD13, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 13, 0x94, 26, 0xAC, 12),
161 PINGROUP(LD14, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 14, 0x94, 28, 0xAC, 12),
162 PINGROUP(LD15, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 15, 0x94, 30, 0xAC, 12),
163 PINGROUP(LD16, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 16, 0x98, 0, 0xAC, 12),
164 PINGROUP(LD17, LCD, DISPLAYA, DISPLAYB, RSVD, RSVD, RSVD4, 0x1C, 17, 0x98, 2, 0xAC, 12),
165 PINGROUP(LD2, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 2, 0x94, 4, 0xAC, 12),
166 PINGROUP(LD3, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 3, 0x94, 6, 0xAC, 12),
167 PINGROUP(LD4, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 4, 0x94, 8, 0xAC, 12),
168 PINGROUP(LD5, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 5, 0x94, 10, 0xAC, 12),
169 PINGROUP(LD6, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 6, 0x94, 12, 0xAC, 12),
170 PINGROUP(LD7, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 7, 0x94, 14, 0xAC, 12),
171 PINGROUP(LD8, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 8, 0x94, 16, 0xAC, 12),
172 PINGROUP(LD9, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 9, 0x94, 18, 0xAC, 12),
173 PINGROUP(LDC, LCD, DISPLAYA, DISPLAYB, RSVD, RSVD, RSVD4, 0x1C, 30, 0x90, 14, 0xAC, 20),
174 PINGROUP(LDI, LCD, DISPLAYA, DISPLAYB, RSVD, RSVD, RSVD4, 0x20, 6, 0x98, 16, 0xAC, 18),
175 PINGROUP(LHP0, LCD, DISPLAYA, DISPLAYB, RSVD, RSVD, RSVD4, 0x1C, 18, 0x98, 10, 0xAC, 16),
176 PINGROUP(LHP1, LCD, DISPLAYA, DISPLAYB, RSVD, RSVD, RSVD4, 0x1C, 19, 0x98, 4, 0xAC, 14),
177 PINGROUP(LHP2, LCD, DISPLAYA, DISPLAYB, RSVD, RSVD, RSVD4, 0x1C, 20, 0x98, 6, 0xAC, 14),
178 PINGROUP(LHS, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x20, 7, 0x90, 22, 0xAC, 22),
179 PINGROUP(LM0, LCD, DISPLAYA, DISPLAYB, SPI3, RSVD, RSVD4, 0x1C, 24, 0x90, 26, 0xAC, 22),
180 PINGROUP(LM1, LCD, DISPLAYA, DISPLAYB, RSVD, CRT, RSVD3, 0x1C, 25, 0x90, 28, 0xAC, 22),
181 PINGROUP(LPP, LCD, DISPLAYA, DISPLAYB, RSVD, RSVD, RSVD4, 0x20, 8, 0x98, 14, 0xAC, 18),
182 PINGROUP(LPW0, LCD, DISPLAYA, DISPLAYB, SPI3, HDMI, DISPLAYA, 0x20, 3, 0x90, 0, 0xAC, 20),
183 PINGROUP(LPW1, LCD, DISPLAYA, DISPLAYB, RSVD, RSVD, RSVD4, 0x20, 4, 0x90, 2, 0xAC, 20),
184 PINGROUP(LPW2, LCD, DISPLAYA, DISPLAYB, SPI3, HDMI, DISPLAYA, 0x20, 5, 0x90, 4, 0xAC, 20),
185 PINGROUP(LSC0, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 27, 0x90, 18, 0xAC, 22),
186 PINGROUP(LSC1, LCD, DISPLAYA, DISPLAYB, SPI3, HDMI, DISPLAYA, 0x1C, 28, 0x90, 20, 0xAC, 20),
187 PINGROUP(LSCK, LCD, DISPLAYA, DISPLAYB, SPI3, HDMI, DISPLAYA, 0x1C, 29, 0x90, 16, 0xAC, 20),
188 PINGROUP(LSDA, LCD, DISPLAYA, DISPLAYB, SPI3, HDMI, DISPLAYA, 0x20, 1, 0x90, 8, 0xAC, 20),
189 PINGROUP(LSDI, LCD, DISPLAYA, DISPLAYB, SPI3, RSVD, DISPLAYA, 0x20, 2, 0x90, 6, 0xAC, 20),
190 PINGROUP(LSPI, LCD, DISPLAYA, DISPLAYB, XIO, HDMI, DISPLAYA, 0x20, 0, 0x90, 10, 0xAC, 22),
191 PINGROUP(LVP0, LCD, DISPLAYA, DISPLAYB, RSVD, RSVD, RSVD4, 0x1C, 21, 0x90, 30, 0xAC, 22),
192 PINGROUP(LVP1, LCD, DISPLAYA, DISPLAYB, RSVD, RSVD, RSVD4, 0x1C, 22, 0x98, 8, 0xAC, 16),
193 PINGROUP(LVS, LCD, DISPLAYA, DISPLAYB, XIO, RSVD, RSVD4, 0x1C, 26, 0x90, 24, 0xAC, 22),
194 PINGROUP(OWC, SYS, OWR, RSVD, RSVD, RSVD, OWR, 0x14, 31, 0x84, 8, 0xB0, 30),
195 PINGROUP(PMC, SYS, PWR_ON, PWR_INTR, RSVD, RSVD, PWR_ON, 0x14, 23, 0x98, 18, -1, -1),
196 PINGROUP(PTA, NAND, I2C2, HDMI, GMI, RSVD, RSVD4, 0x14, 24, 0x98, 22, 0xA4, 4),
197 PINGROUP(RM, UART, I2C, RSVD, RSVD, RSVD, RSVD4, 0x14, 25, 0x80, 14, 0xA4, 0),
198 PINGROUP(SDB, SD, UARTA, PWM, SDIO3, SPI2, PWM, 0x20, 15, 0x8C, 10, -1, -1),
199 PINGROUP(SDC, SD, PWM, TWC, SDIO3, SPI3, TWC, 0x18, 1, 0x8C, 12, 0xAC, 28),
200 PINGROUP(SDD, SD, UARTA, PWM, SDIO3, SPI3, PWM, 0x18, 2, 0x8C, 14, 0xAC, 30),
201 PINGROUP(SDIO1, BB, SDIO1, RSVD, UARTE, UARTA, RSVD2, 0x14, 30, 0x80, 30, 0xB0, 18),
202 PINGROUP(SLXA, SD, PCIE, SPI4, SDIO3, SPI2, PCIE, 0x18, 3, 0x84, 6, 0xA4, 22),
203 PINGROUP(SLXC, SD, SPDIF, SPI4, SDIO3, SPI2, SPI4, 0x18, 5, 0x84, 10, 0xA4, 26),
204 PINGROUP(SLXD, SD, SPDIF, SPI4, SDIO3, SPI2, SPI4, 0x18, 6, 0x84, 12, 0xA4, 28),
205 PINGROUP(SLXK, SD, PCIE, SPI4, SDIO3, SPI2, PCIE, 0x18, 7, 0x84, 14, 0xA4, 30),
206 PINGROUP(SPDI, AUDIO, SPDIF, RSVD, I2C, SDIO2, RSVD2, 0x18, 8, 0x8C, 8, 0xA4, 16),
207 PINGROUP(SPDO, AUDIO, SPDIF, RSVD, I2C, SDIO2, RSVD2, 0x18, 9, 0x8C, 6, 0xA4, 18),
208 PINGROUP(SPIA, AUDIO, SPI1, SPI2, SPI3, GMI, GMI, 0x18, 10, 0x8C, 30, 0xA8, 4),
209 PINGROUP(SPIB, AUDIO, SPI1, SPI2, SPI3, GMI, GMI, 0x18, 11, 0x8C, 28, 0xA8, 6),
210 PINGROUP(SPIC, AUDIO, SPI1, SPI2, SPI3, GMI, GMI, 0x18, 12, 0x8C, 26, 0xA8, 8),
211 PINGROUP(SPID, AUDIO, SPI2, SPI1, SPI2_ALT, GMI, GMI, 0x18, 13, 0x8C, 24, 0xA8, 10),
212 PINGROUP(SPIE, AUDIO, SPI2, SPI1, SPI2_ALT, GMI, GMI, 0x18, 14, 0x8C, 22, 0xA8, 12),
213 PINGROUP(SPIF, AUDIO, SPI3, SPI1, SPI2, RSVD, RSVD4, 0x18, 15, 0x8C, 20, 0xA8, 14),
214 PINGROUP(SPIG, AUDIO, SPI3, SPI2, SPI2_ALT, I2C, SPI2_ALT, 0x18, 16, 0x8C, 18, 0xA8, 16),
215 PINGROUP(SPIH, AUDIO, SPI3, SPI2, SPI2_ALT, I2C, SPI2_ALT, 0x18, 17, 0x8C, 16, 0xA8, 18),
216 PINGROUP(UAA, BB, SPI3, MIPI_HS, UARTA, ULPI, MIPI_HS, 0x18, 18, 0x80, 0, 0xAC, 0),
217 PINGROUP(UAB, BB, SPI2, MIPI_HS, UARTA, ULPI, MIPI_HS, 0x18, 19, 0x80, 2, 0xAC, 2),
218 PINGROUP(UAC, BB, OWR, RSVD, RSVD, RSVD, RSVD4, 0x18, 20, 0x80, 4, 0xAC, 4),
219 PINGROUP(UAD, UART, IRDA, SPDIF, UARTA, SPI4, SPDIF, 0x18, 21, 0x80, 6, 0xAC, 6),
220 PINGROUP(UCA, UART, UARTC, RSVD, GMI, RSVD, RSVD4, 0x18, 22, 0x84, 16, 0xAC, 8),
221 PINGROUP(UCB, UART, UARTC, PWM, GMI, RSVD, RSVD4, 0x18, 23, 0x84, 18, 0xAC, 10),
222 PINGROUP(UDA, BB, SPI1, RSVD, UARTD, ULPI, RSVD2, 0x20, 13, 0x80, 8, 0xB0, 16),
223 /* these pin groups only have pullup and pull down control */
224 PINGROUP(CK32, SYS, RSVD, RSVD, RSVD, RSVD, RSVD, -1, -1, -1, -1, 0xB0, 14),
225 PINGROUP(DDRC, DDR, RSVD, RSVD, RSVD, RSVD, RSVD, -1, -1, -1, -1, 0xAC, 26),
226 PINGROUP(PMCA, SYS, RSVD, RSVD, RSVD, RSVD, RSVD, -1, -1, -1, -1, 0xB0, 4),
227 PINGROUP(PMCB, SYS, RSVD, RSVD, RSVD, RSVD, RSVD, -1, -1, -1, -1, 0xB0, 6),
228 PINGROUP(PMCC, SYS, RSVD, RSVD, RSVD, RSVD, RSVD, -1, -1, -1, -1, 0xB0, 8),
229 PINGROUP(PMCD, SYS, RSVD, RSVD, RSVD, RSVD, RSVD, -1, -1, -1, -1, 0xB0, 10),
230 PINGROUP(PMCE, SYS, RSVD, RSVD, RSVD, RSVD, RSVD, -1, -1, -1, -1, 0xB0, 12),
231 PINGROUP(XM2C, DDR, RSVD, RSVD, RSVD, RSVD, RSVD, -1, -1, -1, -1, 0xA8, 30),
232 PINGROUP(XM2D, DDR, RSVD, RSVD, RSVD, RSVD, RSVD, -1, -1, -1, -1, 0xA8, 28),
233};
234
235void __devinit tegra20_pinmux_init(const struct tegra_pingroup_desc **pg,
236 int *pg_max, const struct tegra_drive_pingroup_desc **pgdrive,
237 int *pgdrive_max)
238{
239 *pg = tegra_soc_pingroups;
240 *pg_max = TEGRA_MAX_PINGROUP;
241 *pgdrive = tegra_soc_drive_pingroups;
242 *pgdrive_max = TEGRA_MAX_DRIVE_PINGROUP;
243}
244
diff --git a/arch/arm/mach-tegra/pinmux-tegra30-tables.c b/arch/arm/mach-tegra/pinmux-tegra30-tables.c
deleted file mode 100644
index 14fc0e4c1c44..000000000000
--- a/arch/arm/mach-tegra/pinmux-tegra30-tables.c
+++ /dev/null
@@ -1,376 +0,0 @@
1/*
2 * linux/arch/arm/mach-tegra/pinmux-tegra30-tables.c
3 *
4 * Common pinmux configurations for Tegra30 SoCs
5 *
6 * Copyright (C) 2010,2011 NVIDIA Corporation
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21
22#include <linux/kernel.h>
23#include <linux/errno.h>
24#include <linux/spinlock.h>
25#include <linux/io.h>
26#include <linux/init.h>
27#include <linux/string.h>
28
29#include <mach/iomap.h>
30#include <mach/pinmux.h>
31#include <mach/pinmux-tegra30.h>
32#include <mach/suspend.h>
33
34#define PINGROUP_REG_A 0x868
35#define MUXCTL_REG_A 0x3000
36
37#define DRIVE_PINGROUP(pg_name, r) \
38 [TEGRA_DRIVE_PINGROUP_ ## pg_name] = { \
39 .name = #pg_name, \
40 .reg_bank = 0, \
41 .reg = ((r) - PINGROUP_REG_A) \
42 }
43
44static const struct tegra_drive_pingroup_desc tegra_soc_drive_pingroups[TEGRA_MAX_DRIVE_PINGROUP] = {
45 DRIVE_PINGROUP(AO1, 0x868),
46 DRIVE_PINGROUP(AO2, 0x86c),
47 DRIVE_PINGROUP(AT1, 0x870),
48 DRIVE_PINGROUP(AT2, 0x874),
49 DRIVE_PINGROUP(AT3, 0x878),
50 DRIVE_PINGROUP(AT4, 0x87c),
51 DRIVE_PINGROUP(AT5, 0x880),
52 DRIVE_PINGROUP(CDEV1, 0x884),
53 DRIVE_PINGROUP(CDEV2, 0x888),
54 DRIVE_PINGROUP(CSUS, 0x88c),
55 DRIVE_PINGROUP(DAP1, 0x890),
56 DRIVE_PINGROUP(DAP2, 0x894),
57 DRIVE_PINGROUP(DAP3, 0x898),
58 DRIVE_PINGROUP(DAP4, 0x89c),
59 DRIVE_PINGROUP(DBG, 0x8a0),
60 DRIVE_PINGROUP(LCD1, 0x8a4),
61 DRIVE_PINGROUP(LCD2, 0x8a8),
62 DRIVE_PINGROUP(SDIO2, 0x8ac),
63 DRIVE_PINGROUP(SDIO3, 0x8b0),
64 DRIVE_PINGROUP(SPI, 0x8b4),
65 DRIVE_PINGROUP(UAA, 0x8b8),
66 DRIVE_PINGROUP(UAB, 0x8bc),
67 DRIVE_PINGROUP(UART2, 0x8c0),
68 DRIVE_PINGROUP(UART3, 0x8c4),
69 DRIVE_PINGROUP(VI1, 0x8c8),
70 DRIVE_PINGROUP(SDIO1, 0x8ec),
71 DRIVE_PINGROUP(CRT, 0x8f8),
72 DRIVE_PINGROUP(DDC, 0x8fc),
73 DRIVE_PINGROUP(GMA, 0x900),
74 DRIVE_PINGROUP(GMB, 0x904),
75 DRIVE_PINGROUP(GMC, 0x908),
76 DRIVE_PINGROUP(GMD, 0x90c),
77 DRIVE_PINGROUP(GME, 0x910),
78 DRIVE_PINGROUP(GMF, 0x914),
79 DRIVE_PINGROUP(GMG, 0x918),
80 DRIVE_PINGROUP(GMH, 0x91c),
81 DRIVE_PINGROUP(OWR, 0x920),
82 DRIVE_PINGROUP(UAD, 0x924),
83 DRIVE_PINGROUP(GPV, 0x928),
84 DRIVE_PINGROUP(DEV3, 0x92c),
85 DRIVE_PINGROUP(CEC, 0x938),
86};
87
88#define PINGROUP(pg_name, vdd, f0, f1, f2, f3, fs, iod, reg) \
89 [TEGRA_PINGROUP_ ## pg_name] = { \
90 .name = #pg_name, \
91 .vddio = TEGRA_VDDIO_ ## vdd, \
92 .funcs = { \
93 TEGRA_MUX_ ## f0, \
94 TEGRA_MUX_ ## f1, \
95 TEGRA_MUX_ ## f2, \
96 TEGRA_MUX_ ## f3, \
97 }, \
98 .func_safe = TEGRA_MUX_ ## fs, \
99 .tri_bank = 1, \
100 .tri_reg = ((reg) - MUXCTL_REG_A), \
101 .tri_bit = 4, \
102 .mux_bank = 1, \
103 .mux_reg = ((reg) - MUXCTL_REG_A), \
104 .mux_bit = 0, \
105 .pupd_bank = 1, \
106 .pupd_reg = ((reg) - MUXCTL_REG_A), \
107 .pupd_bit = 2, \
108 .io_default = TEGRA_PIN_ ## iod, \
109 .od_bit = 6, \
110 .lock_bit = 7, \
111 .ioreset_bit = 8, \
112 }
113
114static const struct tegra_pingroup_desc tegra_soc_pingroups[TEGRA_MAX_PINGROUP] = {
115 /* NAME VDD f0 f1 f2 f3 fSafe io reg */
116 PINGROUP(ULPI_DATA0, BB, SPI3, HSI, UARTA, ULPI, RSVD, INPUT, 0x3000),
117 PINGROUP(ULPI_DATA1, BB, SPI3, HSI, UARTA, ULPI, RSVD, INPUT, 0x3004),
118 PINGROUP(ULPI_DATA2, BB, SPI3, HSI, UARTA, ULPI, RSVD, INPUT, 0x3008),
119 PINGROUP(ULPI_DATA3, BB, SPI3, HSI, UARTA, ULPI, RSVD, INPUT, 0x300c),
120 PINGROUP(ULPI_DATA4, BB, SPI2, HSI, UARTA, ULPI, RSVD, INPUT, 0x3010),
121 PINGROUP(ULPI_DATA5, BB, SPI2, HSI, UARTA, ULPI, RSVD, INPUT, 0x3014),
122 PINGROUP(ULPI_DATA6, BB, SPI2, HSI, UARTA, ULPI, RSVD, INPUT, 0x3018),
123 PINGROUP(ULPI_DATA7, BB, SPI2, HSI, UARTA, ULPI, RSVD, INPUT, 0x301c),
124 PINGROUP(ULPI_CLK, BB, SPI1, RSVD, UARTD, ULPI, RSVD, INPUT, 0x3020),
125 PINGROUP(ULPI_DIR, BB, SPI1, RSVD, UARTD, ULPI, RSVD, INPUT, 0x3024),
126 PINGROUP(ULPI_NXT, BB, SPI1, RSVD, UARTD, ULPI, RSVD, INPUT, 0x3028),
127 PINGROUP(ULPI_STP, BB, SPI1, RSVD, UARTD, ULPI, RSVD, INPUT, 0x302c),
128 PINGROUP(DAP3_FS, BB, I2S2, RSVD1, DISPLAYA, DISPLAYB, RSVD, INPUT, 0x3030),
129 PINGROUP(DAP3_DIN, BB, I2S2, RSVD1, DISPLAYA, DISPLAYB, RSVD, INPUT, 0x3034),
130 PINGROUP(DAP3_DOUT, BB, I2S2, RSVD1, DISPLAYA, DISPLAYB, RSVD, INPUT, 0x3038),
131 PINGROUP(DAP3_SCLK, BB, I2S2, RSVD1, DISPLAYA, DISPLAYB, RSVD, INPUT, 0x303c),
132 PINGROUP(GPIO_PV0, BB, RSVD, RSVD, RSVD, RSVD, RSVD, INPUT, 0x3040),
133 PINGROUP(GPIO_PV1, BB, RSVD, RSVD, RSVD, RSVD, RSVD, INPUT, 0x3044),
134 PINGROUP(SDMMC1_CLK, SDMMC1, SDIO1, RSVD1, RSVD2, INVALID, RSVD, INPUT, 0x3048),
135 PINGROUP(SDMMC1_CMD, SDMMC1, SDIO1, RSVD1, RSVD2, INVALID, RSVD, INPUT, 0x304c),
136 PINGROUP(SDMMC1_DAT3, SDMMC1, SDIO1, RSVD1, UARTE, INVALID, RSVD, INPUT, 0x3050),
137 PINGROUP(SDMMC1_DAT2, SDMMC1, SDIO1, RSVD1, UARTE, INVALID, RSVD, INPUT, 0x3054),
138 PINGROUP(SDMMC1_DAT1, SDMMC1, SDIO1, RSVD1, UARTE, INVALID, RSVD, INPUT, 0x3058),
139 PINGROUP(SDMMC1_DAT0, SDMMC1, SDIO1, RSVD1, UARTE, INVALID, RSVD, INPUT, 0x305c),
140 PINGROUP(GPIO_PV2, SDMMC1, OWR, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x3060),
141 PINGROUP(GPIO_PV3, SDMMC1, INVALID, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x3064),
142 PINGROUP(CLK2_OUT, SDMMC1, EXTPERIPH2, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x3068),
143 PINGROUP(CLK2_REQ, SDMMC1, DAP, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x306c),
144 PINGROUP(LCD_PWR1, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x3070),
145 PINGROUP(LCD_PWR2, LCD, DISPLAYA, DISPLAYB, SPI5, INVALID, RSVD, OUTPUT, 0x3074),
146 PINGROUP(LCD_SDIN, LCD, DISPLAYA, DISPLAYB, SPI5, RSVD, RSVD, OUTPUT, 0x3078),
147 PINGROUP(LCD_SDOUT, LCD, DISPLAYA, DISPLAYB, SPI5, INVALID, RSVD, OUTPUT, 0x307c),
148 PINGROUP(LCD_WR_N, LCD, DISPLAYA, DISPLAYB, SPI5, INVALID, RSVD, OUTPUT, 0x3080),
149 PINGROUP(LCD_CS0_N, LCD, DISPLAYA, DISPLAYB, SPI5, RSVD, RSVD, OUTPUT, 0x3084),
150 PINGROUP(LCD_DC0, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x3088),
151 PINGROUP(LCD_SCK, LCD, DISPLAYA, DISPLAYB, SPI5, INVALID, RSVD, OUTPUT, 0x308c),
152 PINGROUP(LCD_PWR0, LCD, DISPLAYA, DISPLAYB, SPI5, INVALID, RSVD, OUTPUT, 0x3090),
153 PINGROUP(LCD_PCLK, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x3094),
154 PINGROUP(LCD_DE, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x3098),
155 PINGROUP(LCD_HSYNC, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x309c),
156 PINGROUP(LCD_VSYNC, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30a0),
157 PINGROUP(LCD_D0, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30a4),
158 PINGROUP(LCD_D1, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30a8),
159 PINGROUP(LCD_D2, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30ac),
160 PINGROUP(LCD_D3, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30b0),
161 PINGROUP(LCD_D4, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30b4),
162 PINGROUP(LCD_D5, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30b8),
163 PINGROUP(LCD_D6, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30bc),
164 PINGROUP(LCD_D7, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30c0),
165 PINGROUP(LCD_D8, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30c4),
166 PINGROUP(LCD_D9, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30c8),
167 PINGROUP(LCD_D10, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30cc),
168 PINGROUP(LCD_D11, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30d0),
169 PINGROUP(LCD_D12, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30d4),
170 PINGROUP(LCD_D13, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30d8),
171 PINGROUP(LCD_D14, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30dc),
172 PINGROUP(LCD_D15, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30e0),
173 PINGROUP(LCD_D16, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30e4),
174 PINGROUP(LCD_D17, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30e8),
175 PINGROUP(LCD_D18, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30ec),
176 PINGROUP(LCD_D19, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30f0),
177 PINGROUP(LCD_D20, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30f4),
178 PINGROUP(LCD_D21, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30f8),
179 PINGROUP(LCD_D22, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x30fc),
180 PINGROUP(LCD_D23, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x3100),
181 PINGROUP(LCD_CS1_N, LCD, DISPLAYA, DISPLAYB, SPI5, RSVD2, RSVD, OUTPUT, 0x3104),
182 PINGROUP(LCD_M1, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x3108),
183 PINGROUP(LCD_DC1, LCD, DISPLAYA, DISPLAYB, RSVD1, RSVD2, RSVD, OUTPUT, 0x310c),
184 PINGROUP(HDMI_INT, LCD, RSVD, RSVD, RSVD, RSVD, RSVD, INPUT, 0x3110),
185 PINGROUP(DDC_SCL, LCD, I2C4, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x3114),
186 PINGROUP(DDC_SDA, LCD, I2C4, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x3118),
187 PINGROUP(CRT_HSYNC, LCD, CRT, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x311c),
188 PINGROUP(CRT_VSYNC, LCD, CRT, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x3120),
189 PINGROUP(VI_D0, VI, INVALID, RSVD1, VI, RSVD2, RSVD, INPUT, 0x3124),
190 PINGROUP(VI_D1, VI, INVALID, SDIO2, VI, RSVD1, RSVD, INPUT, 0x3128),
191 PINGROUP(VI_D2, VI, INVALID, SDIO2, VI, RSVD1, RSVD, INPUT, 0x312c),
192 PINGROUP(VI_D3, VI, INVALID, SDIO2, VI, RSVD1, RSVD, INPUT, 0x3130),
193 PINGROUP(VI_D4, VI, INVALID, SDIO2, VI, RSVD1, RSVD, INPUT, 0x3134),
194 PINGROUP(VI_D5, VI, INVALID, SDIO2, VI, RSVD1, RSVD, INPUT, 0x3138),
195 PINGROUP(VI_D6, VI, INVALID, SDIO2, VI, RSVD1, RSVD, INPUT, 0x313c),
196 PINGROUP(VI_D7, VI, INVALID, SDIO2, VI, RSVD1, RSVD, INPUT, 0x3140),
197 PINGROUP(VI_D8, VI, INVALID, SDIO2, VI, RSVD1, RSVD, INPUT, 0x3144),
198 PINGROUP(VI_D9, VI, INVALID, SDIO2, VI, RSVD1, RSVD, INPUT, 0x3148),
199 PINGROUP(VI_D10, VI, INVALID, RSVD1, VI, RSVD2, RSVD, INPUT, 0x314c),
200 PINGROUP(VI_D11, VI, INVALID, RSVD1, VI, RSVD2, RSVD, INPUT, 0x3150),
201 PINGROUP(VI_PCLK, VI, RSVD1, SDIO2, VI, RSVD2, RSVD, INPUT, 0x3154),
202 PINGROUP(VI_MCLK, VI, VI, INVALID, INVALID, INVALID, RSVD, INPUT, 0x3158),
203 PINGROUP(VI_VSYNC, VI, INVALID, RSVD1, VI, RSVD2, RSVD, INPUT, 0x315c),
204 PINGROUP(VI_HSYNC, VI, INVALID, RSVD1, VI, RSVD2, RSVD, INPUT, 0x3160),
205 PINGROUP(UART2_RXD, UART, IRDA, SPDIF, UARTA, SPI4, RSVD, INPUT, 0x3164),
206 PINGROUP(UART2_TXD, UART, IRDA, SPDIF, UARTA, SPI4, RSVD, INPUT, 0x3168),
207 PINGROUP(UART2_RTS_N, UART, UARTA, UARTB, GMI, SPI4, RSVD, INPUT, 0x316c),
208 PINGROUP(UART2_CTS_N, UART, UARTA, UARTB, GMI, SPI4, RSVD, INPUT, 0x3170),
209 PINGROUP(UART3_TXD, UART, UARTC, RSVD1, GMI, RSVD2, RSVD, INPUT, 0x3174),
210 PINGROUP(UART3_RXD, UART, UARTC, RSVD1, GMI, RSVD2, RSVD, INPUT, 0x3178),
211 PINGROUP(UART3_CTS_N, UART, UARTC, RSVD1, GMI, RSVD2, RSVD, INPUT, 0x317c),
212 PINGROUP(UART3_RTS_N, UART, UARTC, PWM0, GMI, RSVD2, RSVD, INPUT, 0x3180),
213 PINGROUP(GPIO_PU0, UART, OWR, UARTA, GMI, RSVD1, RSVD, INPUT, 0x3184),
214 PINGROUP(GPIO_PU1, UART, RSVD1, UARTA, GMI, RSVD2, RSVD, INPUT, 0x3188),
215 PINGROUP(GPIO_PU2, UART, RSVD1, UARTA, GMI, RSVD2, RSVD, INPUT, 0x318c),
216 PINGROUP(GPIO_PU3, UART, PWM0, UARTA, GMI, RSVD1, RSVD, INPUT, 0x3190),
217 PINGROUP(GPIO_PU4, UART, PWM1, UARTA, GMI, RSVD1, RSVD, INPUT, 0x3194),
218 PINGROUP(GPIO_PU5, UART, PWM2, UARTA, GMI, RSVD1, RSVD, INPUT, 0x3198),
219 PINGROUP(GPIO_PU6, UART, PWM3, UARTA, GMI, RSVD1, RSVD, INPUT, 0x319c),
220 PINGROUP(GEN1_I2C_SDA, UART, I2C, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x31a0),
221 PINGROUP(GEN1_I2C_SCL, UART, I2C, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x31a4),
222 PINGROUP(DAP4_FS, UART, I2S3, RSVD1, GMI, RSVD2, RSVD, INPUT, 0x31a8),
223 PINGROUP(DAP4_DIN, UART, I2S3, RSVD1, GMI, RSVD2, RSVD, INPUT, 0x31ac),
224 PINGROUP(DAP4_DOUT, UART, I2S3, RSVD1, GMI, RSVD2, RSVD, INPUT, 0x31b0),
225 PINGROUP(DAP4_SCLK, UART, I2S3, RSVD1, GMI, RSVD2, RSVD, INPUT, 0x31b4),
226 PINGROUP(CLK3_OUT, UART, EXTPERIPH3, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x31b8),
227 PINGROUP(CLK3_REQ, UART, DEV3, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x31bc),
228 PINGROUP(GMI_WP_N, GMI, RSVD1, NAND, GMI, GMI_ALT, RSVD, INPUT, 0x31c0),
229 PINGROUP(GMI_IORDY, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x31c4),
230 PINGROUP(GMI_WAIT, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x31c8),
231 PINGROUP(GMI_ADV_N, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x31cc),
232 PINGROUP(GMI_CLK, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x31d0),
233 PINGROUP(GMI_CS0_N, GMI, RSVD1, NAND, GMI, INVALID, RSVD, INPUT, 0x31d4),
234 PINGROUP(GMI_CS1_N, GMI, RSVD1, NAND, GMI, DTV, RSVD, INPUT, 0x31d8),
235 PINGROUP(GMI_CS2_N, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x31dc),
236 PINGROUP(GMI_CS3_N, GMI, RSVD1, NAND, GMI, GMI_ALT, RSVD, INPUT, 0x31e0),
237 PINGROUP(GMI_CS4_N, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x31e4),
238 PINGROUP(GMI_CS6_N, GMI, NAND, NAND_ALT, GMI, SATA, RSVD, INPUT, 0x31e8),
239 PINGROUP(GMI_CS7_N, GMI, NAND, NAND_ALT, GMI, GMI_ALT, RSVD, INPUT, 0x31ec),
240 PINGROUP(GMI_AD0, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x31f0),
241 PINGROUP(GMI_AD1, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x31f4),
242 PINGROUP(GMI_AD2, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x31f8),
243 PINGROUP(GMI_AD3, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x31fc),
244 PINGROUP(GMI_AD4, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x3200),
245 PINGROUP(GMI_AD5, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x3204),
246 PINGROUP(GMI_AD6, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x3208),
247 PINGROUP(GMI_AD7, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x320c),
248 PINGROUP(GMI_AD8, GMI, PWM0, NAND, GMI, RSVD2, RSVD, INPUT, 0x3210),
249 PINGROUP(GMI_AD9, GMI, PWM1, NAND, GMI, RSVD2, RSVD, INPUT, 0x3214),
250 PINGROUP(GMI_AD10, GMI, PWM2, NAND, GMI, RSVD2, RSVD, INPUT, 0x3218),
251 PINGROUP(GMI_AD11, GMI, PWM3, NAND, GMI, RSVD2, RSVD, INPUT, 0x321c),
252 PINGROUP(GMI_AD12, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x3220),
253 PINGROUP(GMI_AD13, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x3224),
254 PINGROUP(GMI_AD14, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x3228),
255 PINGROUP(GMI_AD15, GMI, RSVD1, NAND, GMI, RSVD2, RSVD, INPUT, 0x322c),
256 PINGROUP(GMI_A16, GMI, UARTD, SPI4, GMI, GMI_ALT, RSVD, INPUT, 0x3230),
257 PINGROUP(GMI_A17, GMI, UARTD, SPI4, GMI, INVALID, RSVD, INPUT, 0x3234),
258 PINGROUP(GMI_A18, GMI, UARTD, SPI4, GMI, INVALID, RSVD, INPUT, 0x3238),
259 PINGROUP(GMI_A19, GMI, UARTD, SPI4, GMI, RSVD3, RSVD, INPUT, 0x323c),
260 PINGROUP(GMI_WR_N, GMI, RSVD1, NAND, GMI, RSVD3, RSVD, INPUT, 0x3240),
261 PINGROUP(GMI_OE_N, GMI, RSVD1, NAND, GMI, RSVD3, RSVD, INPUT, 0x3244),
262 PINGROUP(GMI_DQS, GMI, RSVD1, NAND, GMI, RSVD3, RSVD, INPUT, 0x3248),
263 PINGROUP(GMI_RST_N, GMI, NAND, NAND_ALT, GMI, RSVD3, RSVD, INPUT, 0x324c),
264 PINGROUP(GEN2_I2C_SCL, GMI, I2C2, INVALID, GMI, RSVD3, RSVD, INPUT, 0x3250),
265 PINGROUP(GEN2_I2C_SDA, GMI, I2C2, INVALID, GMI, RSVD3, RSVD, INPUT, 0x3254),
266 PINGROUP(SDMMC4_CLK, SDMMC4, INVALID, NAND, GMI, SDIO4, RSVD, INPUT, 0x3258),
267 PINGROUP(SDMMC4_CMD, SDMMC4, I2C3, NAND, GMI, SDIO4, RSVD, INPUT, 0x325c),
268 PINGROUP(SDMMC4_DAT0, SDMMC4, UARTE, SPI3, GMI, SDIO4, RSVD, INPUT, 0x3260),
269 PINGROUP(SDMMC4_DAT1, SDMMC4, UARTE, SPI3, GMI, SDIO4, RSVD, INPUT, 0x3264),
270 PINGROUP(SDMMC4_DAT2, SDMMC4, UARTE, SPI3, GMI, SDIO4, RSVD, INPUT, 0x3268),
271 PINGROUP(SDMMC4_DAT3, SDMMC4, UARTE, SPI3, GMI, SDIO4, RSVD, INPUT, 0x326c),
272 PINGROUP(SDMMC4_DAT4, SDMMC4, I2C3, I2S4, GMI, SDIO4, RSVD, INPUT, 0x3270),
273 PINGROUP(SDMMC4_DAT5, SDMMC4, VGP3, I2S4, GMI, SDIO4, RSVD, INPUT, 0x3274),
274 PINGROUP(SDMMC4_DAT6, SDMMC4, VGP4, I2S4, GMI, SDIO4, RSVD, INPUT, 0x3278),
275 PINGROUP(SDMMC4_DAT7, SDMMC4, VGP5, I2S4, GMI, SDIO4, RSVD, INPUT, 0x327c),
276 PINGROUP(SDMMC4_RST_N, SDMMC4, VGP6, RSVD1, RSVD2, POPSDMMC4, RSVD, INPUT, 0x3280),
277 PINGROUP(CAM_MCLK, CAM, VI, INVALID, VI_ALT2, POPSDMMC4, RSVD, INPUT, 0x3284),
278 PINGROUP(GPIO_PCC1, CAM, I2S4, RSVD1, RSVD2, POPSDMMC4, RSVD, INPUT, 0x3288),
279 PINGROUP(GPIO_PBB0, CAM, I2S4, RSVD1, RSVD2, POPSDMMC4, RSVD, INPUT, 0x328c),
280 PINGROUP(CAM_I2C_SCL, CAM, INVALID, I2C3, RSVD2, POPSDMMC4, RSVD, INPUT, 0x3290),
281 PINGROUP(CAM_I2C_SDA, CAM, INVALID, I2C3, RSVD2, POPSDMMC4, RSVD, INPUT, 0x3294),
282 PINGROUP(GPIO_PBB3, CAM, VGP3, DISPLAYA, DISPLAYB, POPSDMMC4, RSVD, INPUT, 0x3298),
283 PINGROUP(GPIO_PBB4, CAM, VGP4, DISPLAYA, DISPLAYB, POPSDMMC4, RSVD, INPUT, 0x329c),
284 PINGROUP(GPIO_PBB5, CAM, VGP5, DISPLAYA, DISPLAYB, POPSDMMC4, RSVD, INPUT, 0x32a0),
285 PINGROUP(GPIO_PBB6, CAM, VGP6, DISPLAYA, DISPLAYB, POPSDMMC4, RSVD, INPUT, 0x32a4),
286 PINGROUP(GPIO_PBB7, CAM, I2S4, RSVD1, RSVD2, POPSDMMC4, RSVD, INPUT, 0x32a8),
287 PINGROUP(GPIO_PCC2, CAM, I2S4, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x32ac),
288 PINGROUP(JTAG_RTCK, SYS, RTCK, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x32b0),
289 PINGROUP(PWR_I2C_SCL, SYS, I2CPWR, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x32b4),
290 PINGROUP(PWR_I2C_SDA, SYS, I2CPWR, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x32b8),
291 PINGROUP(KB_ROW0, SYS, KBC, INVALID, RSVD2, RSVD3, RSVD, INPUT, 0x32bc),
292 PINGROUP(KB_ROW1, SYS, KBC, INVALID, RSVD2, RSVD3, RSVD, INPUT, 0x32c0),
293 PINGROUP(KB_ROW2, SYS, KBC, INVALID, RSVD2, RSVD3, RSVD, INPUT, 0x32c4),
294 PINGROUP(KB_ROW3, SYS, KBC, INVALID, RSVD2, INVALID, RSVD, INPUT, 0x32c8),
295 PINGROUP(KB_ROW4, SYS, KBC, INVALID, TRACE, RSVD3, RSVD, INPUT, 0x32cc),
296 PINGROUP(KB_ROW5, SYS, KBC, INVALID, TRACE, OWR, RSVD, INPUT, 0x32d0),
297 PINGROUP(KB_ROW6, SYS, KBC, INVALID, SDIO2, INVALID, RSVD, INPUT, 0x32d4),
298 PINGROUP(KB_ROW7, SYS, KBC, INVALID, SDIO2, INVALID, RSVD, INPUT, 0x32d8),
299 PINGROUP(KB_ROW8, SYS, KBC, INVALID, SDIO2, INVALID, RSVD, INPUT, 0x32dc),
300 PINGROUP(KB_ROW9, SYS, KBC, INVALID, SDIO2, INVALID, RSVD, INPUT, 0x32e0),
301 PINGROUP(KB_ROW10, SYS, KBC, INVALID, SDIO2, INVALID, RSVD, INPUT, 0x32e4),
302 PINGROUP(KB_ROW11, SYS, KBC, INVALID, SDIO2, INVALID, RSVD, INPUT, 0x32e8),
303 PINGROUP(KB_ROW12, SYS, KBC, INVALID, SDIO2, INVALID, RSVD, INPUT, 0x32ec),
304 PINGROUP(KB_ROW13, SYS, KBC, INVALID, SDIO2, INVALID, RSVD, INPUT, 0x32f0),
305 PINGROUP(KB_ROW14, SYS, KBC, INVALID, SDIO2, INVALID, RSVD, INPUT, 0x32f4),
306 PINGROUP(KB_ROW15, SYS, KBC, INVALID, SDIO2, INVALID, RSVD, INPUT, 0x32f8),
307 PINGROUP(KB_COL0, SYS, KBC, INVALID, TRACE, INVALID, RSVD, INPUT, 0x32fc),
308 PINGROUP(KB_COL1, SYS, KBC, INVALID, TRACE, INVALID, RSVD, INPUT, 0x3300),
309 PINGROUP(KB_COL2, SYS, KBC, INVALID, TRACE, RSVD, RSVD, INPUT, 0x3304),
310 PINGROUP(KB_COL3, SYS, KBC, INVALID, TRACE, RSVD, RSVD, INPUT, 0x3308),
311 PINGROUP(KB_COL4, SYS, KBC, INVALID, TRACE, RSVD, RSVD, INPUT, 0x330c),
312 PINGROUP(KB_COL5, SYS, KBC, INVALID, TRACE, RSVD, RSVD, INPUT, 0x3310),
313 PINGROUP(KB_COL6, SYS, KBC, INVALID, TRACE, INVALID, RSVD, INPUT, 0x3314),
314 PINGROUP(KB_COL7, SYS, KBC, INVALID, TRACE, INVALID, RSVD, INPUT, 0x3318),
315 PINGROUP(CLK_32K_OUT, SYS, BLINK, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x331c),
316 PINGROUP(SYS_CLK_REQ, SYS, SYSCLK, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x3320),
317 PINGROUP(CORE_PWR_REQ, SYS, RSVD, RSVD, RSVD, RSVD, RSVD, INPUT, 0x3324),
318 PINGROUP(CPU_PWR_REQ, SYS, RSVD, RSVD, RSVD, RSVD, RSVD, INPUT, 0x3328),
319 PINGROUP(PWR_INT_N, SYS, RSVD, RSVD, RSVD, RSVD, RSVD, INPUT, 0x332c),
320 PINGROUP(CLK_32K_IN, SYS, RSVD, RSVD, RSVD, RSVD, RSVD, INPUT, 0x3330),
321 PINGROUP(OWR, SYS, OWR, RSVD, RSVD, RSVD, RSVD, INPUT, 0x3334),
322 PINGROUP(DAP1_FS, AUDIO, I2S0, HDA, GMI, SDIO2, RSVD, INPUT, 0x3338),
323 PINGROUP(DAP1_DIN, AUDIO, I2S0, HDA, GMI, SDIO2, RSVD, INPUT, 0x333c),
324 PINGROUP(DAP1_DOUT, AUDIO, I2S0, HDA, GMI, SDIO2, RSVD, INPUT, 0x3340),
325 PINGROUP(DAP1_SCLK, AUDIO, I2S0, HDA, GMI, SDIO2, RSVD, INPUT, 0x3344),
326 PINGROUP(CLK1_REQ, AUDIO, DAP, HDA, RSVD2, RSVD3, RSVD, INPUT, 0x3348),
327 PINGROUP(CLK1_OUT, AUDIO, EXTPERIPH1, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x334c),
328 PINGROUP(SPDIF_IN, AUDIO, SPDIF, HDA, INVALID, DAPSDMMC2, RSVD, INPUT, 0x3350),
329 PINGROUP(SPDIF_OUT, AUDIO, SPDIF, RSVD1, INVALID, DAPSDMMC2, RSVD, INPUT, 0x3354),
330 PINGROUP(DAP2_FS, AUDIO, I2S1, HDA, RSVD2, GMI, RSVD, INPUT, 0x3358),
331 PINGROUP(DAP2_DIN, AUDIO, I2S1, HDA, RSVD2, GMI, RSVD, INPUT, 0x335c),
332 PINGROUP(DAP2_DOUT, AUDIO, I2S1, HDA, RSVD2, GMI, RSVD, INPUT, 0x3360),
333 PINGROUP(DAP2_SCLK, AUDIO, I2S1, HDA, RSVD2, GMI, RSVD, INPUT, 0x3364),
334 PINGROUP(SPI2_MOSI, AUDIO, SPI6, SPI2, INVALID, GMI, RSVD, INPUT, 0x3368),
335 PINGROUP(SPI2_MISO, AUDIO, SPI6, SPI2, INVALID, GMI, RSVD, INPUT, 0x336c),
336 PINGROUP(SPI2_CS0_N, AUDIO, SPI6, SPI2, INVALID, GMI, RSVD, INPUT, 0x3370),
337 PINGROUP(SPI2_SCK, AUDIO, SPI6, SPI2, INVALID, GMI, RSVD, INPUT, 0x3374),
338 PINGROUP(SPI1_MOSI, AUDIO, SPI2, SPI1, INVALID, GMI, RSVD, INPUT, 0x3378),
339 PINGROUP(SPI1_SCK, AUDIO, SPI2, SPI1, INVALID, GMI, RSVD, INPUT, 0x337c),
340 PINGROUP(SPI1_CS0_N, AUDIO, SPI2, SPI1, INVALID, GMI, RSVD, INPUT, 0x3380),
341 PINGROUP(SPI1_MISO, AUDIO, INVALID, SPI1, INVALID, RSVD3, RSVD, INPUT, 0x3384),
342 PINGROUP(SPI2_CS1_N, AUDIO, INVALID, SPI2, INVALID, INVALID, RSVD, INPUT, 0x3388),
343 PINGROUP(SPI2_CS2_N, AUDIO, INVALID, SPI2, INVALID, INVALID, RSVD, INPUT, 0x338c),
344 PINGROUP(SDMMC3_CLK, SDMMC3, UARTA, PWM2, SDIO3, INVALID, RSVD, INPUT, 0x3390),
345 PINGROUP(SDMMC3_CMD, SDMMC3, UARTA, PWM3, SDIO3, INVALID, RSVD, INPUT, 0x3394),
346 PINGROUP(SDMMC3_DAT0, SDMMC3, RSVD, RSVD1, SDIO3, INVALID, RSVD, INPUT, 0x3398),
347 PINGROUP(SDMMC3_DAT1, SDMMC3, RSVD, RSVD1, SDIO3, INVALID, RSVD, INPUT, 0x339c),
348 PINGROUP(SDMMC3_DAT2, SDMMC3, RSVD, PWM1, SDIO3, INVALID, RSVD, INPUT, 0x33a0),
349 PINGROUP(SDMMC3_DAT3, SDMMC3, RSVD, PWM0, SDIO3, INVALID, RSVD, INPUT, 0x33a4),
350 PINGROUP(SDMMC3_DAT4, SDMMC3, PWM1, INVALID, SDIO3, INVALID, RSVD, INPUT, 0x33a8),
351 PINGROUP(SDMMC3_DAT5, SDMMC3, PWM0, INVALID, SDIO3, INVALID, RSVD, INPUT, 0x33ac),
352 PINGROUP(SDMMC3_DAT6, SDMMC3, SPDIF, INVALID, SDIO3, INVALID, RSVD, INPUT, 0x33b0),
353 PINGROUP(SDMMC3_DAT7, SDMMC3, SPDIF, INVALID, SDIO3, INVALID, RSVD, INPUT, 0x33b4),
354 PINGROUP(PEX_L0_PRSNT_N, PEXCTL, PCIE, HDA, RSVD2, RSVD3, RSVD, INPUT, 0x33b8),
355 PINGROUP(PEX_L0_RST_N, PEXCTL, PCIE, HDA, RSVD2, RSVD3, RSVD, INPUT, 0x33bc),
356 PINGROUP(PEX_L0_CLKREQ_N, PEXCTL, PCIE, HDA, RSVD2, RSVD3, RSVD, INPUT, 0x33c0),
357 PINGROUP(PEX_WAKE_N, PEXCTL, PCIE, HDA, RSVD2, RSVD3, RSVD, INPUT, 0x33c4),
358 PINGROUP(PEX_L1_PRSNT_N, PEXCTL, PCIE, HDA, RSVD2, RSVD3, RSVD, INPUT, 0x33c8),
359 PINGROUP(PEX_L1_RST_N, PEXCTL, PCIE, HDA, RSVD2, RSVD3, RSVD, INPUT, 0x33cc),
360 PINGROUP(PEX_L1_CLKREQ_N, PEXCTL, PCIE, HDA, RSVD2, RSVD3, RSVD, INPUT, 0x33d0),
361 PINGROUP(PEX_L2_PRSNT_N, PEXCTL, PCIE, HDA, RSVD2, RSVD3, RSVD, INPUT, 0x33d4),
362 PINGROUP(PEX_L2_RST_N, PEXCTL, PCIE, HDA, RSVD2, RSVD3, RSVD, INPUT, 0x33d8),
363 PINGROUP(PEX_L2_CLKREQ_N, PEXCTL, PCIE, HDA, RSVD2, RSVD3, RSVD, INPUT, 0x33dc),
364 PINGROUP(HDMI_CEC, SYS, CEC, RSVD1, RSVD2, RSVD3, RSVD, INPUT, 0x33e0),
365};
366
367void __devinit tegra30_pinmux_init(const struct tegra_pingroup_desc **pg,
368 int *pg_max, const struct tegra_drive_pingroup_desc **pgdrive,
369 int *pgdrive_max)
370{
371 *pg = tegra_soc_pingroups;
372 *pg_max = TEGRA_MAX_PINGROUP;
373 *pgdrive = tegra_soc_drive_pingroups;
374 *pgdrive_max = TEGRA_MAX_DRIVE_PINGROUP;
375}
376
diff --git a/arch/arm/mach-tegra/pinmux.c b/arch/arm/mach-tegra/pinmux.c
deleted file mode 100644
index ac35d2b76850..000000000000
--- a/arch/arm/mach-tegra/pinmux.c
+++ /dev/null
@@ -1,987 +0,0 @@
1/*
2 * linux/arch/arm/mach-tegra/pinmux.c
3 *
4 * Copyright (C) 2010 Google, Inc.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#include <linux/init.h>
18#include <linux/module.h>
19#include <linux/kernel.h>
20#include <linux/errno.h>
21#include <linux/spinlock.h>
22#include <linux/io.h>
23#include <linux/platform_device.h>
24#include <linux/of_device.h>
25
26#include <mach/iomap.h>
27#include <mach/pinmux.h>
28
29#define HSM_EN(reg) (((reg) >> 2) & 0x1)
30#define SCHMT_EN(reg) (((reg) >> 3) & 0x1)
31#define LPMD(reg) (((reg) >> 4) & 0x3)
32#define DRVDN(reg) (((reg) >> 12) & 0x1f)
33#define DRVUP(reg) (((reg) >> 20) & 0x1f)
34#define SLWR(reg) (((reg) >> 28) & 0x3)
35#define SLWF(reg) (((reg) >> 30) & 0x3)
36
37static const struct tegra_pingroup_desc *pingroups;
38static const struct tegra_drive_pingroup_desc *drive_pingroups;
39static int pingroup_max;
40static int drive_max;
41
42static char *tegra_mux_names[TEGRA_MAX_MUX] = {
43 [TEGRA_MUX_AHB_CLK] = "AHB_CLK",
44 [TEGRA_MUX_APB_CLK] = "APB_CLK",
45 [TEGRA_MUX_AUDIO_SYNC] = "AUDIO_SYNC",
46 [TEGRA_MUX_CRT] = "CRT",
47 [TEGRA_MUX_DAP1] = "DAP1",
48 [TEGRA_MUX_DAP2] = "DAP2",
49 [TEGRA_MUX_DAP3] = "DAP3",
50 [TEGRA_MUX_DAP4] = "DAP4",
51 [TEGRA_MUX_DAP5] = "DAP5",
52 [TEGRA_MUX_DISPLAYA] = "DISPLAYA",
53 [TEGRA_MUX_DISPLAYB] = "DISPLAYB",
54 [TEGRA_MUX_EMC_TEST0_DLL] = "EMC_TEST0_DLL",
55 [TEGRA_MUX_EMC_TEST1_DLL] = "EMC_TEST1_DLL",
56 [TEGRA_MUX_GMI] = "GMI",
57 [TEGRA_MUX_GMI_INT] = "GMI_INT",
58 [TEGRA_MUX_HDMI] = "HDMI",
59 [TEGRA_MUX_I2C] = "I2C",
60 [TEGRA_MUX_I2C2] = "I2C2",
61 [TEGRA_MUX_I2C3] = "I2C3",
62 [TEGRA_MUX_IDE] = "IDE",
63 [TEGRA_MUX_IRDA] = "IRDA",
64 [TEGRA_MUX_KBC] = "KBC",
65 [TEGRA_MUX_MIO] = "MIO",
66 [TEGRA_MUX_MIPI_HS] = "MIPI_HS",
67 [TEGRA_MUX_NAND] = "NAND",
68 [TEGRA_MUX_OSC] = "OSC",
69 [TEGRA_MUX_OWR] = "OWR",
70 [TEGRA_MUX_PCIE] = "PCIE",
71 [TEGRA_MUX_PLLA_OUT] = "PLLA_OUT",
72 [TEGRA_MUX_PLLC_OUT1] = "PLLC_OUT1",
73 [TEGRA_MUX_PLLM_OUT1] = "PLLM_OUT1",
74 [TEGRA_MUX_PLLP_OUT2] = "PLLP_OUT2",
75 [TEGRA_MUX_PLLP_OUT3] = "PLLP_OUT3",
76 [TEGRA_MUX_PLLP_OUT4] = "PLLP_OUT4",
77 [TEGRA_MUX_PWM] = "PWM",
78 [TEGRA_MUX_PWR_INTR] = "PWR_INTR",
79 [TEGRA_MUX_PWR_ON] = "PWR_ON",
80 [TEGRA_MUX_RTCK] = "RTCK",
81 [TEGRA_MUX_SDIO1] = "SDIO1",
82 [TEGRA_MUX_SDIO2] = "SDIO2",
83 [TEGRA_MUX_SDIO3] = "SDIO3",
84 [TEGRA_MUX_SDIO4] = "SDIO4",
85 [TEGRA_MUX_SFLASH] = "SFLASH",
86 [TEGRA_MUX_SPDIF] = "SPDIF",
87 [TEGRA_MUX_SPI1] = "SPI1",
88 [TEGRA_MUX_SPI2] = "SPI2",
89 [TEGRA_MUX_SPI2_ALT] = "SPI2_ALT",
90 [TEGRA_MUX_SPI3] = "SPI3",
91 [TEGRA_MUX_SPI4] = "SPI4",
92 [TEGRA_MUX_TRACE] = "TRACE",
93 [TEGRA_MUX_TWC] = "TWC",
94 [TEGRA_MUX_UARTA] = "UARTA",
95 [TEGRA_MUX_UARTB] = "UARTB",
96 [TEGRA_MUX_UARTC] = "UARTC",
97 [TEGRA_MUX_UARTD] = "UARTD",
98 [TEGRA_MUX_UARTE] = "UARTE",
99 [TEGRA_MUX_ULPI] = "ULPI",
100 [TEGRA_MUX_VI] = "VI",
101 [TEGRA_MUX_VI_SENSOR_CLK] = "VI_SENSOR_CLK",
102 [TEGRA_MUX_XIO] = "XIO",
103 [TEGRA_MUX_BLINK] = "BLINK",
104 [TEGRA_MUX_CEC] = "CEC",
105 [TEGRA_MUX_CLK12] = "CLK12",
106 [TEGRA_MUX_DAP] = "DAP",
107 [TEGRA_MUX_DAPSDMMC2] = "DAPSDMMC2",
108 [TEGRA_MUX_DDR] = "DDR",
109 [TEGRA_MUX_DEV3] = "DEV3",
110 [TEGRA_MUX_DTV] = "DTV",
111 [TEGRA_MUX_VI_ALT1] = "VI_ALT1",
112 [TEGRA_MUX_VI_ALT2] = "VI_ALT2",
113 [TEGRA_MUX_VI_ALT3] = "VI_ALT3",
114 [TEGRA_MUX_EMC_DLL] = "EMC_DLL",
115 [TEGRA_MUX_EXTPERIPH1] = "EXTPERIPH1",
116 [TEGRA_MUX_EXTPERIPH2] = "EXTPERIPH2",
117 [TEGRA_MUX_EXTPERIPH3] = "EXTPERIPH3",
118 [TEGRA_MUX_GMI_ALT] = "GMI_ALT",
119 [TEGRA_MUX_HDA] = "HDA",
120 [TEGRA_MUX_HSI] = "HSI",
121 [TEGRA_MUX_I2C4] = "I2C4",
122 [TEGRA_MUX_I2C5] = "I2C5",
123 [TEGRA_MUX_I2CPWR] = "I2CPWR",
124 [TEGRA_MUX_I2S0] = "I2S0",
125 [TEGRA_MUX_I2S1] = "I2S1",
126 [TEGRA_MUX_I2S2] = "I2S2",
127 [TEGRA_MUX_I2S3] = "I2S3",
128 [TEGRA_MUX_I2S4] = "I2S4",
129 [TEGRA_MUX_NAND_ALT] = "NAND_ALT",
130 [TEGRA_MUX_POPSDIO4] = "POPSDIO4",
131 [TEGRA_MUX_POPSDMMC4] = "POPSDMMC4",
132 [TEGRA_MUX_PWM0] = "PWM0",
133 [TEGRA_MUX_PWM1] = "PWM2",
134 [TEGRA_MUX_PWM2] = "PWM2",
135 [TEGRA_MUX_PWM3] = "PWM3",
136 [TEGRA_MUX_SATA] = "SATA",
137 [TEGRA_MUX_SPI5] = "SPI5",
138 [TEGRA_MUX_SPI6] = "SPI6",
139 [TEGRA_MUX_SYSCLK] = "SYSCLK",
140 [TEGRA_MUX_VGP1] = "VGP1",
141 [TEGRA_MUX_VGP2] = "VGP2",
142 [TEGRA_MUX_VGP3] = "VGP3",
143 [TEGRA_MUX_VGP4] = "VGP4",
144 [TEGRA_MUX_VGP5] = "VGP5",
145 [TEGRA_MUX_VGP6] = "VGP6",
146 [TEGRA_MUX_SAFE] = "<safe>",
147};
148
149static const char *tegra_drive_names[TEGRA_MAX_DRIVE] = {
150 [TEGRA_DRIVE_DIV_8] = "DIV_8",
151 [TEGRA_DRIVE_DIV_4] = "DIV_4",
152 [TEGRA_DRIVE_DIV_2] = "DIV_2",
153 [TEGRA_DRIVE_DIV_1] = "DIV_1",
154};
155
156static const char *tegra_slew_names[TEGRA_MAX_SLEW] = {
157 [TEGRA_SLEW_FASTEST] = "FASTEST",
158 [TEGRA_SLEW_FAST] = "FAST",
159 [TEGRA_SLEW_SLOW] = "SLOW",
160 [TEGRA_SLEW_SLOWEST] = "SLOWEST",
161};
162
163static DEFINE_SPINLOCK(mux_lock);
164
165static const char *pingroup_name(int pg)
166{
167 if (pg < 0 || pg >= pingroup_max)
168 return "<UNKNOWN>";
169
170 return pingroups[pg].name;
171}
172
173static const char *func_name(enum tegra_mux_func func)
174{
175 if (func == TEGRA_MUX_RSVD1)
176 return "RSVD1";
177
178 if (func == TEGRA_MUX_RSVD2)
179 return "RSVD2";
180
181 if (func == TEGRA_MUX_RSVD3)
182 return "RSVD3";
183
184 if (func == TEGRA_MUX_RSVD4)
185 return "RSVD4";
186
187 if (func == TEGRA_MUX_NONE)
188 return "NONE";
189
190 if (func < 0 || func >= TEGRA_MAX_MUX)
191 return "<UNKNOWN>";
192
193 return tegra_mux_names[func];
194}
195
196
197static const char *tri_name(unsigned long val)
198{
199 return val ? "TRISTATE" : "NORMAL";
200}
201
202static const char *pupd_name(unsigned long val)
203{
204 switch (val) {
205 case 0:
206 return "NORMAL";
207
208 case 1:
209 return "PULL_DOWN";
210
211 case 2:
212 return "PULL_UP";
213
214 default:
215 return "RSVD";
216 }
217}
218
219static int nbanks;
220static void __iomem **regs;
221
222static inline u32 pg_readl(u32 bank, u32 reg)
223{
224 return readl(regs[bank] + reg);
225}
226
227static inline void pg_writel(u32 val, u32 bank, u32 reg)
228{
229 writel(val, regs[bank] + reg);
230}
231
232static int tegra_pinmux_set_func(const struct tegra_pingroup_config *config)
233{
234 int mux = -1;
235 int i;
236 unsigned long reg;
237 unsigned long flags;
238 int pg = config->pingroup;
239 enum tegra_mux_func func = config->func;
240
241 if (pg < 0 || pg >= pingroup_max)
242 return -ERANGE;
243
244 if (pingroups[pg].mux_reg < 0)
245 return -EINVAL;
246
247 if (func < 0)
248 return -ERANGE;
249
250 if (func == TEGRA_MUX_SAFE)
251 func = pingroups[pg].func_safe;
252
253 if (func & TEGRA_MUX_RSVD) {
254 mux = func & 0x3;
255 } else {
256 for (i = 0; i < 4; i++) {
257 if (pingroups[pg].funcs[i] == func) {
258 mux = i;
259 break;
260 }
261 }
262 }
263
264 if (mux < 0)
265 return -EINVAL;
266
267 spin_lock_irqsave(&mux_lock, flags);
268
269 reg = pg_readl(pingroups[pg].mux_bank, pingroups[pg].mux_reg);
270 reg &= ~(0x3 << pingroups[pg].mux_bit);
271 reg |= mux << pingroups[pg].mux_bit;
272 pg_writel(reg, pingroups[pg].mux_bank, pingroups[pg].mux_reg);
273
274 spin_unlock_irqrestore(&mux_lock, flags);
275
276 return 0;
277}
278
279int tegra_pinmux_set_tristate(int pg, enum tegra_tristate tristate)
280{
281 unsigned long reg;
282 unsigned long flags;
283
284 if (pg < 0 || pg >= pingroup_max)
285 return -ERANGE;
286
287 if (pingroups[pg].tri_reg < 0)
288 return -EINVAL;
289
290 spin_lock_irqsave(&mux_lock, flags);
291
292 reg = pg_readl(pingroups[pg].tri_bank, pingroups[pg].tri_reg);
293 reg &= ~(0x1 << pingroups[pg].tri_bit);
294 if (tristate)
295 reg |= 1 << pingroups[pg].tri_bit;
296 pg_writel(reg, pingroups[pg].tri_bank, pingroups[pg].tri_reg);
297
298 spin_unlock_irqrestore(&mux_lock, flags);
299
300 return 0;
301}
302
303int tegra_pinmux_set_pullupdown(int pg, enum tegra_pullupdown pupd)
304{
305 unsigned long reg;
306 unsigned long flags;
307
308 if (pg < 0 || pg >= pingroup_max)
309 return -ERANGE;
310
311 if (pingroups[pg].pupd_reg < 0)
312 return -EINVAL;
313
314 if (pupd != TEGRA_PUPD_NORMAL &&
315 pupd != TEGRA_PUPD_PULL_DOWN &&
316 pupd != TEGRA_PUPD_PULL_UP)
317 return -EINVAL;
318
319
320 spin_lock_irqsave(&mux_lock, flags);
321
322 reg = pg_readl(pingroups[pg].pupd_bank, pingroups[pg].pupd_reg);
323 reg &= ~(0x3 << pingroups[pg].pupd_bit);
324 reg |= pupd << pingroups[pg].pupd_bit;
325 pg_writel(reg, pingroups[pg].pupd_bank, pingroups[pg].pupd_reg);
326
327 spin_unlock_irqrestore(&mux_lock, flags);
328
329 return 0;
330}
331
332static void tegra_pinmux_config_pingroup(const struct tegra_pingroup_config *config)
333{
334 int pingroup = config->pingroup;
335 enum tegra_mux_func func = config->func;
336 enum tegra_pullupdown pupd = config->pupd;
337 enum tegra_tristate tristate = config->tristate;
338 int err;
339
340 if (pingroups[pingroup].mux_reg >= 0) {
341 err = tegra_pinmux_set_func(config);
342 if (err < 0)
343 pr_err("pinmux: can't set pingroup %s func to %s: %d\n",
344 pingroup_name(pingroup), func_name(func), err);
345 }
346
347 if (pingroups[pingroup].pupd_reg >= 0) {
348 err = tegra_pinmux_set_pullupdown(pingroup, pupd);
349 if (err < 0)
350 pr_err("pinmux: can't set pingroup %s pullupdown to %s: %d\n",
351 pingroup_name(pingroup), pupd_name(pupd), err);
352 }
353
354 if (pingroups[pingroup].tri_reg >= 0) {
355 err = tegra_pinmux_set_tristate(pingroup, tristate);
356 if (err < 0)
357 pr_err("pinmux: can't set pingroup %s tristate to %s: %d\n",
358 pingroup_name(pingroup), tri_name(func), err);
359 }
360}
361
362void tegra_pinmux_config_table(const struct tegra_pingroup_config *config, int len)
363{
364 int i;
365
366 for (i = 0; i < len; i++)
367 tegra_pinmux_config_pingroup(&config[i]);
368}
369
370static const char *drive_pinmux_name(int pg)
371{
372 if (pg < 0 || pg >= drive_max)
373 return "<UNKNOWN>";
374
375 return drive_pingroups[pg].name;
376}
377
378static const char *enable_name(unsigned long val)
379{
380 return val ? "ENABLE" : "DISABLE";
381}
382
383static const char *drive_name(unsigned long val)
384{
385 if (val >= TEGRA_MAX_DRIVE)
386 return "<UNKNOWN>";
387
388 return tegra_drive_names[val];
389}
390
391static const char *slew_name(unsigned long val)
392{
393 if (val >= TEGRA_MAX_SLEW)
394 return "<UNKNOWN>";
395
396 return tegra_slew_names[val];
397}
398
399static int tegra_drive_pinmux_set_hsm(int pg, enum tegra_hsm hsm)
400{
401 unsigned long flags;
402 u32 reg;
403 if (pg < 0 || pg >= drive_max)
404 return -ERANGE;
405
406 if (hsm != TEGRA_HSM_ENABLE && hsm != TEGRA_HSM_DISABLE)
407 return -EINVAL;
408
409 spin_lock_irqsave(&mux_lock, flags);
410
411 reg = pg_readl(drive_pingroups[pg].reg_bank, drive_pingroups[pg].reg);
412 if (hsm == TEGRA_HSM_ENABLE)
413 reg |= (1 << 2);
414 else
415 reg &= ~(1 << 2);
416 pg_writel(reg, drive_pingroups[pg].reg_bank, drive_pingroups[pg].reg);
417
418 spin_unlock_irqrestore(&mux_lock, flags);
419
420 return 0;
421}
422
423static int tegra_drive_pinmux_set_schmitt(int pg, enum tegra_schmitt schmitt)
424{
425 unsigned long flags;
426 u32 reg;
427 if (pg < 0 || pg >= drive_max)
428 return -ERANGE;
429
430 if (schmitt != TEGRA_SCHMITT_ENABLE && schmitt != TEGRA_SCHMITT_DISABLE)
431 return -EINVAL;
432
433 spin_lock_irqsave(&mux_lock, flags);
434
435 reg = pg_readl(drive_pingroups[pg].reg_bank, drive_pingroups[pg].reg);
436 if (schmitt == TEGRA_SCHMITT_ENABLE)
437 reg |= (1 << 3);
438 else
439 reg &= ~(1 << 3);
440 pg_writel(reg, drive_pingroups[pg].reg_bank, drive_pingroups[pg].reg);
441
442 spin_unlock_irqrestore(&mux_lock, flags);
443
444 return 0;
445}
446
447static int tegra_drive_pinmux_set_drive(int pg, enum tegra_drive drive)
448{
449 unsigned long flags;
450 u32 reg;
451 if (pg < 0 || pg >= drive_max)
452 return -ERANGE;
453
454 if (drive < 0 || drive >= TEGRA_MAX_DRIVE)
455 return -EINVAL;
456
457 spin_lock_irqsave(&mux_lock, flags);
458
459 reg = pg_readl(drive_pingroups[pg].reg_bank, drive_pingroups[pg].reg);
460 reg &= ~(0x3 << 4);
461 reg |= drive << 4;
462 pg_writel(reg, drive_pingroups[pg].reg_bank, drive_pingroups[pg].reg);
463
464 spin_unlock_irqrestore(&mux_lock, flags);
465
466 return 0;
467}
468
469static int tegra_drive_pinmux_set_pull_down(int pg,
470 enum tegra_pull_strength pull_down)
471{
472 unsigned long flags;
473 u32 reg;
474 if (pg < 0 || pg >= drive_max)
475 return -ERANGE;
476
477 if (pull_down < 0 || pull_down >= TEGRA_MAX_PULL)
478 return -EINVAL;
479
480 spin_lock_irqsave(&mux_lock, flags);
481
482 reg = pg_readl(drive_pingroups[pg].reg_bank, drive_pingroups[pg].reg);
483 reg &= ~(0x1f << 12);
484 reg |= pull_down << 12;
485 pg_writel(reg, drive_pingroups[pg].reg_bank, drive_pingroups[pg].reg);
486
487 spin_unlock_irqrestore(&mux_lock, flags);
488
489 return 0;
490}
491
492static int tegra_drive_pinmux_set_pull_up(int pg,
493 enum tegra_pull_strength pull_up)
494{
495 unsigned long flags;
496 u32 reg;
497 if (pg < 0 || pg >= drive_max)
498 return -ERANGE;
499
500 if (pull_up < 0 || pull_up >= TEGRA_MAX_PULL)
501 return -EINVAL;
502
503 spin_lock_irqsave(&mux_lock, flags);
504
505 reg = pg_readl(drive_pingroups[pg].reg_bank, drive_pingroups[pg].reg);
506 reg &= ~(0x1f << 12);
507 reg |= pull_up << 12;
508 pg_writel(reg, drive_pingroups[pg].reg_bank, drive_pingroups[pg].reg);
509
510 spin_unlock_irqrestore(&mux_lock, flags);
511
512 return 0;
513}
514
515static int tegra_drive_pinmux_set_slew_rising(int pg,
516 enum tegra_slew slew_rising)
517{
518 unsigned long flags;
519 u32 reg;
520 if (pg < 0 || pg >= drive_max)
521 return -ERANGE;
522
523 if (slew_rising < 0 || slew_rising >= TEGRA_MAX_SLEW)
524 return -EINVAL;
525
526 spin_lock_irqsave(&mux_lock, flags);
527
528 reg = pg_readl(drive_pingroups[pg].reg_bank, drive_pingroups[pg].reg);
529 reg &= ~(0x3 << 28);
530 reg |= slew_rising << 28;
531 pg_writel(reg, drive_pingroups[pg].reg_bank, drive_pingroups[pg].reg);
532
533 spin_unlock_irqrestore(&mux_lock, flags);
534
535 return 0;
536}
537
538static int tegra_drive_pinmux_set_slew_falling(int pg,
539 enum tegra_slew slew_falling)
540{
541 unsigned long flags;
542 u32 reg;
543 if (pg < 0 || pg >= drive_max)
544 return -ERANGE;
545
546 if (slew_falling < 0 || slew_falling >= TEGRA_MAX_SLEW)
547 return -EINVAL;
548
549 spin_lock_irqsave(&mux_lock, flags);
550
551 reg = pg_readl(drive_pingroups[pg].reg_bank, drive_pingroups[pg].reg);
552 reg &= ~(0x3 << 30);
553 reg |= slew_falling << 30;
554 pg_writel(reg, drive_pingroups[pg].reg_bank, drive_pingroups[pg].reg);
555
556 spin_unlock_irqrestore(&mux_lock, flags);
557
558 return 0;
559}
560
561static void tegra_drive_pinmux_config_pingroup(int pingroup,
562 enum tegra_hsm hsm,
563 enum tegra_schmitt schmitt,
564 enum tegra_drive drive,
565 enum tegra_pull_strength pull_down,
566 enum tegra_pull_strength pull_up,
567 enum tegra_slew slew_rising,
568 enum tegra_slew slew_falling)
569{
570 int err;
571
572 err = tegra_drive_pinmux_set_hsm(pingroup, hsm);
573 if (err < 0)
574 pr_err("pinmux: can't set pingroup %s hsm to %s: %d\n",
575 drive_pinmux_name(pingroup),
576 enable_name(hsm), err);
577
578 err = tegra_drive_pinmux_set_schmitt(pingroup, schmitt);
579 if (err < 0)
580 pr_err("pinmux: can't set pingroup %s schmitt to %s: %d\n",
581 drive_pinmux_name(pingroup),
582 enable_name(schmitt), err);
583
584 err = tegra_drive_pinmux_set_drive(pingroup, drive);
585 if (err < 0)
586 pr_err("pinmux: can't set pingroup %s drive to %s: %d\n",
587 drive_pinmux_name(pingroup),
588 drive_name(drive), err);
589
590 err = tegra_drive_pinmux_set_pull_down(pingroup, pull_down);
591 if (err < 0)
592 pr_err("pinmux: can't set pingroup %s pull down to %d: %d\n",
593 drive_pinmux_name(pingroup),
594 pull_down, err);
595
596 err = tegra_drive_pinmux_set_pull_up(pingroup, pull_up);
597 if (err < 0)
598 pr_err("pinmux: can't set pingroup %s pull up to %d: %d\n",
599 drive_pinmux_name(pingroup),
600 pull_up, err);
601
602 err = tegra_drive_pinmux_set_slew_rising(pingroup, slew_rising);
603 if (err < 0)
604 pr_err("pinmux: can't set pingroup %s rising slew to %s: %d\n",
605 drive_pinmux_name(pingroup),
606 slew_name(slew_rising), err);
607
608 err = tegra_drive_pinmux_set_slew_falling(pingroup, slew_falling);
609 if (err < 0)
610 pr_err("pinmux: can't set pingroup %s falling slew to %s: %d\n",
611 drive_pinmux_name(pingroup),
612 slew_name(slew_falling), err);
613}
614
615void tegra_drive_pinmux_config_table(struct tegra_drive_pingroup_config *config,
616 int len)
617{
618 int i;
619
620 for (i = 0; i < len; i++)
621 tegra_drive_pinmux_config_pingroup(config[i].pingroup,
622 config[i].hsm,
623 config[i].schmitt,
624 config[i].drive,
625 config[i].pull_down,
626 config[i].pull_up,
627 config[i].slew_rising,
628 config[i].slew_falling);
629}
630
631void tegra_pinmux_set_safe_pinmux_table(const struct tegra_pingroup_config *config,
632 int len)
633{
634 int i;
635 struct tegra_pingroup_config c;
636
637 for (i = 0; i < len; i++) {
638 int err;
639 c = config[i];
640 if (c.pingroup < 0 || c.pingroup >= pingroup_max) {
641 WARN_ON(1);
642 continue;
643 }
644 c.func = pingroups[c.pingroup].func_safe;
645 err = tegra_pinmux_set_func(&c);
646 if (err < 0)
647 pr_err("%s: tegra_pinmux_set_func returned %d setting "
648 "%s to %s\n", __func__, err,
649 pingroup_name(c.pingroup), func_name(c.func));
650 }
651}
652
653void tegra_pinmux_config_pinmux_table(const struct tegra_pingroup_config *config,
654 int len)
655{
656 int i;
657
658 for (i = 0; i < len; i++) {
659 int err;
660 if (config[i].pingroup < 0 ||
661 config[i].pingroup >= pingroup_max) {
662 WARN_ON(1);
663 continue;
664 }
665 err = tegra_pinmux_set_func(&config[i]);
666 if (err < 0)
667 pr_err("%s: tegra_pinmux_set_func returned %d setting "
668 "%s to %s\n", __func__, err,
669 pingroup_name(config[i].pingroup),
670 func_name(config[i].func));
671 }
672}
673
674void tegra_pinmux_config_tristate_table(const struct tegra_pingroup_config *config,
675 int len, enum tegra_tristate tristate)
676{
677 int i;
678 int err;
679 int pingroup;
680
681 for (i = 0; i < len; i++) {
682 pingroup = config[i].pingroup;
683 if (pingroups[pingroup].tri_reg >= 0) {
684 err = tegra_pinmux_set_tristate(pingroup, tristate);
685 if (err < 0)
686 pr_err("pinmux: can't set pingroup %s tristate"
687 " to %s: %d\n", pingroup_name(pingroup),
688 tri_name(tristate), err);
689 }
690 }
691}
692
693void tegra_pinmux_config_pullupdown_table(const struct tegra_pingroup_config *config,
694 int len, enum tegra_pullupdown pupd)
695{
696 int i;
697 int err;
698 int pingroup;
699
700 for (i = 0; i < len; i++) {
701 pingroup = config[i].pingroup;
702 if (pingroups[pingroup].pupd_reg >= 0) {
703 err = tegra_pinmux_set_pullupdown(pingroup, pupd);
704 if (err < 0)
705 pr_err("pinmux: can't set pingroup %s pullupdown"
706 " to %s: %d\n", pingroup_name(pingroup),
707 pupd_name(pupd), err);
708 }
709 }
710}
711
712static struct of_device_id tegra_pinmux_of_match[] __devinitdata = {
713#ifdef CONFIG_ARCH_TEGRA_2x_SOC
714 { .compatible = "nvidia,tegra20-pinmux", tegra20_pinmux_init },
715#endif
716#ifdef CONFIG_ARCH_TEGRA_3x_SOC
717 { .compatible = "nvidia,tegra30-pinmux", tegra30_pinmux_init },
718#endif
719 { },
720};
721
722static int __devinit tegra_pinmux_probe(struct platform_device *pdev)
723{
724 struct resource *res;
725 int i;
726 int config_bad = 0;
727 const struct of_device_id *match;
728
729 match = of_match_device(tegra_pinmux_of_match, &pdev->dev);
730
731 if (match)
732 ((pinmux_init)(match->data))(&pingroups, &pingroup_max,
733 &drive_pingroups, &drive_max);
734#ifdef CONFIG_ARCH_TEGRA_2x_SOC
735 else
736 /* no device tree available, so we must be on tegra20 */
737 tegra20_pinmux_init(&pingroups, &pingroup_max,
738 &drive_pingroups, &drive_max);
739#else
740 pr_warn("non Tegra20 platform requires pinmux devicetree node\n");
741#endif
742
743 for (i = 0; ; i++) {
744 res = platform_get_resource(pdev, IORESOURCE_MEM, i);
745 if (!res)
746 break;
747 }
748 nbanks = i;
749
750 for (i = 0; i < pingroup_max; i++) {
751 if (pingroups[i].tri_bank >= nbanks) {
752 dev_err(&pdev->dev, "pingroup %d: bad tri_bank\n", i);
753 config_bad = 1;
754 }
755
756 if (pingroups[i].mux_bank >= nbanks) {
757 dev_err(&pdev->dev, "pingroup %d: bad mux_bank\n", i);
758 config_bad = 1;
759 }
760
761 if (pingroups[i].pupd_bank >= nbanks) {
762 dev_err(&pdev->dev, "pingroup %d: bad pupd_bank\n", i);
763 config_bad = 1;
764 }
765 }
766
767 for (i = 0; i < drive_max; i++) {
768 if (drive_pingroups[i].reg_bank >= nbanks) {
769 dev_err(&pdev->dev,
770 "drive pingroup %d: bad reg_bank\n", i);
771 config_bad = 1;
772 }
773 }
774
775 if (config_bad)
776 return -ENODEV;
777
778 regs = devm_kzalloc(&pdev->dev, nbanks * sizeof(*regs), GFP_KERNEL);
779 if (!regs) {
780 dev_err(&pdev->dev, "Can't alloc regs pointer\n");
781 return -ENODEV;
782 }
783
784 for (i = 0; i < nbanks; i++) {
785 res = platform_get_resource(pdev, IORESOURCE_MEM, i);
786 if (!res) {
787 dev_err(&pdev->dev, "Missing MEM resource\n");
788 return -ENODEV;
789 }
790
791 if (!devm_request_mem_region(&pdev->dev, res->start,
792 resource_size(res),
793 dev_name(&pdev->dev))) {
794 dev_err(&pdev->dev,
795 "Couldn't request MEM resource %d\n", i);
796 return -ENODEV;
797 }
798
799 regs[i] = devm_ioremap(&pdev->dev, res->start,
800 resource_size(res));
801 if (!regs) {
802 dev_err(&pdev->dev, "Couldn't ioremap regs %d\n", i);
803 return -ENODEV;
804 }
805 }
806
807 return 0;
808}
809
810static struct platform_driver tegra_pinmux_driver = {
811 .driver = {
812 .name = "tegra-pinmux",
813 .owner = THIS_MODULE,
814 .of_match_table = tegra_pinmux_of_match,
815 },
816 .probe = tegra_pinmux_probe,
817};
818
819static int __init tegra_pinmux_init(void)
820{
821 return platform_driver_register(&tegra_pinmux_driver);
822}
823postcore_initcall(tegra_pinmux_init);
824
825#ifdef CONFIG_DEBUG_FS
826
827#include <linux/debugfs.h>
828#include <linux/seq_file.h>
829
830static void dbg_pad_field(struct seq_file *s, int len)
831{
832 seq_putc(s, ',');
833
834 while (len-- > -1)
835 seq_putc(s, ' ');
836}
837
838static int dbg_pinmux_show(struct seq_file *s, void *unused)
839{
840 int i;
841 int len;
842
843 for (i = 0; i < pingroup_max; i++) {
844 unsigned long reg;
845 unsigned long tri;
846 unsigned long mux;
847 unsigned long pupd;
848
849 seq_printf(s, "\t{TEGRA_PINGROUP_%s", pingroups[i].name);
850 len = strlen(pingroups[i].name);
851 dbg_pad_field(s, 5 - len);
852
853 if (pingroups[i].mux_reg < 0) {
854 seq_printf(s, "TEGRA_MUX_NONE");
855 len = strlen("NONE");
856 } else {
857 reg = pg_readl(pingroups[i].mux_bank,
858 pingroups[i].mux_reg);
859 mux = (reg >> pingroups[i].mux_bit) & 0x3;
860 if (pingroups[i].funcs[mux] == TEGRA_MUX_RSVD) {
861 seq_printf(s, "TEGRA_MUX_RSVD%1lu", mux+1);
862 len = 5;
863 } else {
864 seq_printf(s, "TEGRA_MUX_%s",
865 tegra_mux_names[pingroups[i].funcs[mux]]);
866 len = strlen(tegra_mux_names[pingroups[i].funcs[mux]]);
867 }
868 }
869 dbg_pad_field(s, 13-len);
870
871 if (pingroups[i].pupd_reg < 0) {
872 seq_printf(s, "TEGRA_PUPD_NORMAL");
873 len = strlen("NORMAL");
874 } else {
875 reg = pg_readl(pingroups[i].pupd_bank,
876 pingroups[i].pupd_reg);
877 pupd = (reg >> pingroups[i].pupd_bit) & 0x3;
878 seq_printf(s, "TEGRA_PUPD_%s", pupd_name(pupd));
879 len = strlen(pupd_name(pupd));
880 }
881 dbg_pad_field(s, 9 - len);
882
883 if (pingroups[i].tri_reg < 0) {
884 seq_printf(s, "TEGRA_TRI_NORMAL");
885 } else {
886 reg = pg_readl(pingroups[i].tri_bank,
887 pingroups[i].tri_reg);
888 tri = (reg >> pingroups[i].tri_bit) & 0x1;
889
890 seq_printf(s, "TEGRA_TRI_%s", tri_name(tri));
891 }
892 seq_printf(s, "},\n");
893 }
894 return 0;
895}
896
897static int dbg_pinmux_open(struct inode *inode, struct file *file)
898{
899 return single_open(file, dbg_pinmux_show, &inode->i_private);
900}
901
902static const struct file_operations debug_fops = {
903 .open = dbg_pinmux_open,
904 .read = seq_read,
905 .llseek = seq_lseek,
906 .release = single_release,
907};
908
909static int dbg_drive_pinmux_show(struct seq_file *s, void *unused)
910{
911 int i;
912 int len;
913
914 for (i = 0; i < drive_max; i++) {
915 u32 reg;
916
917 seq_printf(s, "\t{TEGRA_DRIVE_PINGROUP_%s",
918 drive_pingroups[i].name);
919 len = strlen(drive_pingroups[i].name);
920 dbg_pad_field(s, 7 - len);
921
922
923 reg = pg_readl(drive_pingroups[i].reg_bank,
924 drive_pingroups[i].reg);
925 if (HSM_EN(reg)) {
926 seq_printf(s, "TEGRA_HSM_ENABLE");
927 len = 16;
928 } else {
929 seq_printf(s, "TEGRA_HSM_DISABLE");
930 len = 17;
931 }
932 dbg_pad_field(s, 17 - len);
933
934 if (SCHMT_EN(reg)) {
935 seq_printf(s, "TEGRA_SCHMITT_ENABLE");
936 len = 21;
937 } else {
938 seq_printf(s, "TEGRA_SCHMITT_DISABLE");
939 len = 22;
940 }
941 dbg_pad_field(s, 22 - len);
942
943 seq_printf(s, "TEGRA_DRIVE_%s", drive_name(LPMD(reg)));
944 len = strlen(drive_name(LPMD(reg)));
945 dbg_pad_field(s, 5 - len);
946
947 seq_printf(s, "TEGRA_PULL_%d", DRVDN(reg));
948 len = DRVDN(reg) < 10 ? 1 : 2;
949 dbg_pad_field(s, 2 - len);
950
951 seq_printf(s, "TEGRA_PULL_%d", DRVUP(reg));
952 len = DRVUP(reg) < 10 ? 1 : 2;
953 dbg_pad_field(s, 2 - len);
954
955 seq_printf(s, "TEGRA_SLEW_%s", slew_name(SLWR(reg)));
956 len = strlen(slew_name(SLWR(reg)));
957 dbg_pad_field(s, 7 - len);
958
959 seq_printf(s, "TEGRA_SLEW_%s", slew_name(SLWF(reg)));
960
961 seq_printf(s, "},\n");
962 }
963 return 0;
964}
965
966static int dbg_drive_pinmux_open(struct inode *inode, struct file *file)
967{
968 return single_open(file, dbg_drive_pinmux_show, &inode->i_private);
969}
970
971static const struct file_operations debug_drive_fops = {
972 .open = dbg_drive_pinmux_open,
973 .read = seq_read,
974 .llseek = seq_lseek,
975 .release = single_release,
976};
977
978static int __init tegra_pinmux_debuginit(void)
979{
980 (void) debugfs_create_file("tegra_pinmux", S_IRUGO,
981 NULL, NULL, &debug_fops);
982 (void) debugfs_create_file("tegra_pinmux_drive", S_IRUGO,
983 NULL, NULL, &debug_drive_fops);
984 return 0;
985}
986late_initcall(tegra_pinmux_debuginit);
987#endif
diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c
index 592a4eeb5328..2cae5cbc20ba 100644
--- a/arch/arm/mach-tegra/tegra2_clocks.c
+++ b/arch/arm/mach-tegra/tegra2_clocks.c
@@ -1764,6 +1764,12 @@ static struct clk_pll_freq_table tegra_pll_x_freq_table[] = {
1764 { 19200000, 760000000, 950, 24, 1, 8}, 1764 { 19200000, 760000000, 950, 24, 1, 8},
1765 { 26000000, 760000000, 760, 26, 1, 12}, 1765 { 26000000, 760000000, 760, 26, 1, 12},
1766 1766
1767 /* 750 MHz */
1768 { 12000000, 750000000, 750, 12, 1, 12},
1769 { 13000000, 750000000, 750, 13, 1, 12},
1770 { 19200000, 750000000, 625, 16, 1, 8},
1771 { 26000000, 750000000, 750, 26, 1, 12},
1772
1767 /* 608 MHz */ 1773 /* 608 MHz */
1768 { 12000000, 608000000, 608, 12, 1, 12}, 1774 { 12000000, 608000000, 608, 12, 1, 12},
1769 { 13000000, 608000000, 608, 13, 1, 12}, 1775 { 13000000, 608000000, 608, 13, 1, 12},
diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
index 1eed8d4a80ef..315672c7bd48 100644
--- a/arch/arm/mach-tegra/timer.c
+++ b/arch/arm/mach-tegra/timer.c
@@ -124,7 +124,7 @@ static u64 tegra_rtc_read_ms(void)
124} 124}
125 125
126/* 126/*
127 * read_persistent_clock - Return time from a persistent clock. 127 * tegra_read_persistent_clock - Return time from a persistent clock.
128 * 128 *
129 * Reads the time from a source which isn't disabled during PM, the 129 * Reads the time from a source which isn't disabled during PM, the
130 * 32k sync timer. Convert the cycles elapsed since last read into 130 * 32k sync timer. Convert the cycles elapsed since last read into
@@ -133,7 +133,7 @@ static u64 tegra_rtc_read_ms(void)
133 * tegra_rtc driver could be executing to avoid race conditions 133 * tegra_rtc driver could be executing to avoid race conditions
134 * on the RTC shadow register 134 * on the RTC shadow register
135 */ 135 */
136void read_persistent_clock(struct timespec *ts) 136static void tegra_read_persistent_clock(struct timespec *ts)
137{ 137{
138 u64 delta; 138 u64 delta;
139 struct timespec *tsp = &persistent_ts; 139 struct timespec *tsp = &persistent_ts;
@@ -243,6 +243,7 @@ static void __init tegra_init_timer(void)
243 tegra_clockevent.irq = tegra_timer_irq.irq; 243 tegra_clockevent.irq = tegra_timer_irq.irq;
244 clockevents_register_device(&tegra_clockevent); 244 clockevents_register_device(&tegra_clockevent);
245 tegra_twd_init(); 245 tegra_twd_init();
246 register_persistent_clock(NULL, tegra_read_persistent_clock);
246} 247}
247 248
248struct sys_timer tegra_timer = { 249struct sys_timer tegra_timer = {
diff --git a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c
index c5b2ac04e2a0..d71d2fed6721 100644
--- a/arch/arm/mach-tegra/usb_phy.c
+++ b/arch/arm/mach-tegra/usb_phy.c
@@ -711,7 +711,6 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
711 err = -ENXIO; 711 err = -ENXIO;
712 goto err1; 712 goto err1;
713 } 713 }
714 tegra_gpio_enable(ulpi_config->reset_gpio);
715 gpio_request(ulpi_config->reset_gpio, "ulpi_phy_reset_b"); 714 gpio_request(ulpi_config->reset_gpio, "ulpi_phy_reset_b");
716 gpio_direction_output(ulpi_config->reset_gpio, 0); 715 gpio_direction_output(ulpi_config->reset_gpio, 0);
717 phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0); 716 phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0);
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index 1621ad07d284..33339745d432 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -1667,8 +1667,10 @@ void __init u300_init_irq(void)
1667 1667
1668 for (i = 0; i < U300_VIC_IRQS_END; i++) 1668 for (i = 0; i < U300_VIC_IRQS_END; i++)
1669 set_bit(i, (unsigned long *) &mask[0]); 1669 set_bit(i, (unsigned long *) &mask[0]);
1670 vic_init((void __iomem *) U300_INTCON0_VBASE, 0, mask[0], mask[0]); 1670 vic_init((void __iomem *) U300_INTCON0_VBASE, IRQ_U300_INTCON0_START,
1671 vic_init((void __iomem *) U300_INTCON1_VBASE, 32, mask[1], mask[1]); 1671 mask[0], mask[0]);
1672 vic_init((void __iomem *) U300_INTCON1_VBASE, IRQ_U300_INTCON1_START,
1673 mask[1], mask[1]);
1672} 1674}
1673 1675
1674 1676
diff --git a/arch/arm/mach-u300/i2c.c b/arch/arm/mach-u300/i2c.c
index a38f80238ea9..cb04bd6ab3e7 100644
--- a/arch/arm/mach-u300/i2c.c
+++ b/arch/arm/mach-u300/i2c.c
@@ -146,9 +146,6 @@ static struct ab3100_platform_data ab3100_plf_data = {
146 .min_uV = 1800000, 146 .min_uV = 1800000,
147 .max_uV = 1800000, 147 .max_uV = 1800000,
148 .valid_modes_mask = REGULATOR_MODE_NORMAL, 148 .valid_modes_mask = REGULATOR_MODE_NORMAL,
149 .valid_ops_mask =
150 REGULATOR_CHANGE_VOLTAGE |
151 REGULATOR_CHANGE_STATUS,
152 .always_on = 1, 149 .always_on = 1,
153 .boot_on = 1, 150 .boot_on = 1,
154 }, 151 },
@@ -160,9 +157,6 @@ static struct ab3100_platform_data ab3100_plf_data = {
160 .min_uV = 2500000, 157 .min_uV = 2500000,
161 .max_uV = 2500000, 158 .max_uV = 2500000,
162 .valid_modes_mask = REGULATOR_MODE_NORMAL, 159 .valid_modes_mask = REGULATOR_MODE_NORMAL,
163 .valid_ops_mask =
164 REGULATOR_CHANGE_VOLTAGE |
165 REGULATOR_CHANGE_STATUS,
166 .always_on = 1, 160 .always_on = 1,
167 .boot_on = 1, 161 .boot_on = 1,
168 }, 162 },
@@ -230,8 +224,7 @@ static struct ab3100_platform_data ab3100_plf_data = {
230 .max_uV = 1800000, 224 .max_uV = 1800000,
231 .valid_modes_mask = REGULATOR_MODE_NORMAL, 225 .valid_modes_mask = REGULATOR_MODE_NORMAL,
232 .valid_ops_mask = 226 .valid_ops_mask =
233 REGULATOR_CHANGE_VOLTAGE | 227 REGULATOR_CHANGE_VOLTAGE,
234 REGULATOR_CHANGE_STATUS,
235 .always_on = 1, 228 .always_on = 1,
236 .boot_on = 1, 229 .boot_on = 1,
237 }, 230 },
diff --git a/arch/arm/mach-u300/include/mach/irqs.h b/arch/arm/mach-u300/include/mach/irqs.h
index ee78a26707eb..ec09c1e07b1a 100644
--- a/arch/arm/mach-u300/include/mach/irqs.h
+++ b/arch/arm/mach-u300/include/mach/irqs.h
@@ -12,101 +12,101 @@
12#ifndef __MACH_IRQS_H 12#ifndef __MACH_IRQS_H
13#define __MACH_IRQS_H 13#define __MACH_IRQS_H
14 14
15#define IRQ_U300_INTCON0_START 0 15#define IRQ_U300_INTCON0_START 1
16#define IRQ_U300_INTCON1_START 32 16#define IRQ_U300_INTCON1_START 33
17/* These are on INTCON0 - 30 lines */ 17/* These are on INTCON0 - 30 lines */
18#define IRQ_U300_IRQ0_EXT 0 18#define IRQ_U300_IRQ0_EXT 1
19#define IRQ_U300_IRQ1_EXT 1 19#define IRQ_U300_IRQ1_EXT 2
20#define IRQ_U300_DMA 2 20#define IRQ_U300_DMA 3
21#define IRQ_U300_VIDEO_ENC_0 3 21#define IRQ_U300_VIDEO_ENC_0 4
22#define IRQ_U300_VIDEO_ENC_1 4 22#define IRQ_U300_VIDEO_ENC_1 5
23#define IRQ_U300_AAIF_RX 5 23#define IRQ_U300_AAIF_RX 6
24#define IRQ_U300_AAIF_TX 6 24#define IRQ_U300_AAIF_TX 7
25#define IRQ_U300_AAIF_VGPIO 7 25#define IRQ_U300_AAIF_VGPIO 8
26#define IRQ_U300_AAIF_WAKEUP 8 26#define IRQ_U300_AAIF_WAKEUP 9
27#define IRQ_U300_PCM_I2S0_FRAME 9 27#define IRQ_U300_PCM_I2S0_FRAME 10
28#define IRQ_U300_PCM_I2S0_FIFO 10 28#define IRQ_U300_PCM_I2S0_FIFO 11
29#define IRQ_U300_PCM_I2S1_FRAME 11 29#define IRQ_U300_PCM_I2S1_FRAME 12
30#define IRQ_U300_PCM_I2S1_FIFO 12 30#define IRQ_U300_PCM_I2S1_FIFO 13
31#define IRQ_U300_XGAM_GAMCON 13 31#define IRQ_U300_XGAM_GAMCON 14
32#define IRQ_U300_XGAM_CDI 14 32#define IRQ_U300_XGAM_CDI 15
33#define IRQ_U300_XGAM_CDICON 15 33#define IRQ_U300_XGAM_CDICON 16
34#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330) 34#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
35/* MMIACC not used on the DB3210 or DB3350 chips */ 35/* MMIACC not used on the DB3210 or DB3350 chips */
36#define IRQ_U300_XGAM_MMIACC 16 36#define IRQ_U300_XGAM_MMIACC 17
37#endif 37#endif
38#define IRQ_U300_XGAM_PDI 17 38#define IRQ_U300_XGAM_PDI 18
39#define IRQ_U300_XGAM_PDICON 18 39#define IRQ_U300_XGAM_PDICON 19
40#define IRQ_U300_XGAM_GAMEACC 19 40#define IRQ_U300_XGAM_GAMEACC 20
41#define IRQ_U300_XGAM_MCIDCT 20 41#define IRQ_U300_XGAM_MCIDCT 21
42#define IRQ_U300_APEX 21 42#define IRQ_U300_APEX 22
43#define IRQ_U300_UART0 22 43#define IRQ_U300_UART0 23
44#define IRQ_U300_SPI 23 44#define IRQ_U300_SPI 24
45#define IRQ_U300_TIMER_APP_OS 24 45#define IRQ_U300_TIMER_APP_OS 25
46#define IRQ_U300_TIMER_APP_DD 25 46#define IRQ_U300_TIMER_APP_DD 26
47#define IRQ_U300_TIMER_APP_GP1 26 47#define IRQ_U300_TIMER_APP_GP1 27
48#define IRQ_U300_TIMER_APP_GP2 27 48#define IRQ_U300_TIMER_APP_GP2 28
49#define IRQ_U300_TIMER_OS 28 49#define IRQ_U300_TIMER_OS 29
50#define IRQ_U300_TIMER_MS 29 50#define IRQ_U300_TIMER_MS 30
51#define IRQ_U300_KEYPAD_KEYBF 30 51#define IRQ_U300_KEYPAD_KEYBF 31
52#define IRQ_U300_KEYPAD_KEYBR 31 52#define IRQ_U300_KEYPAD_KEYBR 32
53/* These are on INTCON1 - 32 lines */ 53/* These are on INTCON1 - 32 lines */
54#define IRQ_U300_GPIO_PORT0 32 54#define IRQ_U300_GPIO_PORT0 33
55#define IRQ_U300_GPIO_PORT1 33 55#define IRQ_U300_GPIO_PORT1 34
56#define IRQ_U300_GPIO_PORT2 34 56#define IRQ_U300_GPIO_PORT2 35
57 57
58#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330) || \ 58#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330) || \
59 defined(CONFIG_MACH_U300_BS335) 59 defined(CONFIG_MACH_U300_BS335)
60/* These are for DB3150, DB3200 and DB3350 */ 60/* These are for DB3150, DB3200 and DB3350 */
61#define IRQ_U300_WDOG 35 61#define IRQ_U300_WDOG 36
62#define IRQ_U300_EVHIST 36 62#define IRQ_U300_EVHIST 37
63#define IRQ_U300_MSPRO 37 63#define IRQ_U300_MSPRO 38
64#define IRQ_U300_MMCSD_MCIINTR0 38 64#define IRQ_U300_MMCSD_MCIINTR0 39
65#define IRQ_U300_MMCSD_MCIINTR1 39 65#define IRQ_U300_MMCSD_MCIINTR1 40
66#define IRQ_U300_I2C0 40 66#define IRQ_U300_I2C0 41
67#define IRQ_U300_I2C1 41 67#define IRQ_U300_I2C1 42
68#define IRQ_U300_RTC 42 68#define IRQ_U300_RTC 43
69#define IRQ_U300_NFIF 43 69#define IRQ_U300_NFIF 44
70#define IRQ_U300_NFIF2 44 70#define IRQ_U300_NFIF2 45
71#endif 71#endif
72 72
73/* DB3150 and DB3200 have only 45 IRQs */ 73/* DB3150 and DB3200 have only 45 IRQs */
74#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330) 74#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
75#define U300_VIC_IRQS_END 45 75#define U300_VIC_IRQS_END 46
76#endif 76#endif
77 77
78/* The DB3350-specific interrupt lines */ 78/* The DB3350-specific interrupt lines */
79#ifdef CONFIG_MACH_U300_BS335 79#ifdef CONFIG_MACH_U300_BS335
80#define IRQ_U300_ISP_F0 45 80#define IRQ_U300_ISP_F0 46
81#define IRQ_U300_ISP_F1 46 81#define IRQ_U300_ISP_F1 47
82#define IRQ_U300_ISP_F2 47 82#define IRQ_U300_ISP_F2 48
83#define IRQ_U300_ISP_F3 48 83#define IRQ_U300_ISP_F3 49
84#define IRQ_U300_ISP_F4 49 84#define IRQ_U300_ISP_F4 50
85#define IRQ_U300_GPIO_PORT3 50 85#define IRQ_U300_GPIO_PORT3 51
86#define IRQ_U300_SYSCON_PLL_LOCK 51 86#define IRQ_U300_SYSCON_PLL_LOCK 52
87#define IRQ_U300_UART1 52 87#define IRQ_U300_UART1 53
88#define IRQ_U300_GPIO_PORT4 53 88#define IRQ_U300_GPIO_PORT4 54
89#define IRQ_U300_GPIO_PORT5 54 89#define IRQ_U300_GPIO_PORT5 55
90#define IRQ_U300_GPIO_PORT6 55 90#define IRQ_U300_GPIO_PORT6 56
91#define U300_VIC_IRQS_END 56 91#define U300_VIC_IRQS_END 57
92#endif 92#endif
93 93
94/* The DB3210-specific interrupt lines */ 94/* The DB3210-specific interrupt lines */
95#ifdef CONFIG_MACH_U300_BS365 95#ifdef CONFIG_MACH_U300_BS365
96#define IRQ_U300_GPIO_PORT3 35 96#define IRQ_U300_GPIO_PORT3 36
97#define IRQ_U300_GPIO_PORT4 36 97#define IRQ_U300_GPIO_PORT4 37
98#define IRQ_U300_WDOG 37 98#define IRQ_U300_WDOG 38
99#define IRQ_U300_EVHIST 38 99#define IRQ_U300_EVHIST 39
100#define IRQ_U300_MSPRO 39 100#define IRQ_U300_MSPRO 40
101#define IRQ_U300_MMCSD_MCIINTR0 40 101#define IRQ_U300_MMCSD_MCIINTR0 41
102#define IRQ_U300_MMCSD_MCIINTR1 41 102#define IRQ_U300_MMCSD_MCIINTR1 42
103#define IRQ_U300_I2C0 42 103#define IRQ_U300_I2C0 43
104#define IRQ_U300_I2C1 43 104#define IRQ_U300_I2C1 44
105#define IRQ_U300_RTC 44 105#define IRQ_U300_RTC 45
106#define IRQ_U300_NFIF 45 106#define IRQ_U300_NFIF 46
107#define IRQ_U300_NFIF2 46 107#define IRQ_U300_NFIF2 47
108#define IRQ_U300_SYSCON_PLL_LOCK 47 108#define IRQ_U300_SYSCON_PLL_LOCK 48
109#define U300_VIC_IRQS_END 48 109#define U300_VIC_IRQS_END 49
110#endif 110#endif
111 111
112/* Maximum 8*7 GPIO lines */ 112/* Maximum 8*7 GPIO lines */
@@ -117,6 +117,6 @@
117#define IRQ_U300_GPIO_END (U300_VIC_IRQS_END) 117#define IRQ_U300_GPIO_END (U300_VIC_IRQS_END)
118#endif 118#endif
119 119
120#define NR_IRQS (IRQ_U300_GPIO_END) 120#define NR_IRQS (IRQ_U300_GPIO_END - IRQ_U300_INTCON0_START)
121 121
122#endif 122#endif
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index 880d02ec89d4..53d3d46dec12 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -9,16 +9,16 @@ config UX500_SOC_COMMON
9 select ARM_ERRATA_754322 9 select ARM_ERRATA_754322
10 select ARM_ERRATA_764369 10 select ARM_ERRATA_764369
11 select CACHE_L2X0 11 select CACHE_L2X0
12 12 select PINCTRL
13config UX500_SOC_DB5500 13 select PINCTRL_NOMADIK
14 bool
15 select MFD_DB5500_PRCMU
16 14
17config UX500_SOC_DB8500 15config UX500_SOC_DB8500
18 bool 16 bool
19 select MFD_DB8500_PRCMU 17 select MFD_DB8500_PRCMU
18 select REGULATOR
20 select REGULATOR_DB8500_PRCMU 19 select REGULATOR_DB8500_PRCMU
21 select CPU_FREQ_TABLE if CPU_FREQ 20 select CPU_FREQ_TABLE if CPU_FREQ
21 select PINCTRL_DB8500
22 22
23menu "Ux500 target platform (boards)" 23menu "Ux500 target platform (boards)"
24 24
@@ -44,15 +44,8 @@ config MACH_SNOWBALL
44 help 44 help
45 Include support for the snowball development platform. 45 Include support for the snowball development platform.
46 46
47config MACH_U5500
48 bool "U5500 Development platform"
49 select UX500_SOC_DB5500
50 help
51 Include support for the U5500 development platform.
52
53config UX500_AUTO_PLATFORM 47config UX500_AUTO_PLATFORM
54 def_bool y 48 def_bool y
55 depends on !MACH_U5500
56 select MACH_MOP500 49 select MACH_MOP500
57 help 50 help
58 At least one platform needs to be selected in order to build 51 At least one platform needs to be selected in order to build
@@ -73,18 +66,4 @@ config UX500_DEBUG_UART
73 Choose the UART on which kernel low-level debug messages should be 66 Choose the UART on which kernel low-level debug messages should be
74 output. 67 output.
75 68
76config U5500_MODEM_IRQ
77 bool "Modem IRQ support"
78 depends on UX500_SOC_DB5500
79 default y
80 help
81 Add support for handling IRQ:s from modem side
82
83config U5500_MBOX
84 bool "Mailbox support"
85 depends on U5500_MODEM_IRQ
86 default y
87 help
88 Add support for U5500 mailbox communication with modem side
89
90endif 69endif
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index 465b9ec9510a..026086ff9e6c 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -4,17 +4,14 @@
4 4
5obj-y := clock.o cpu.o devices.o devices-common.o \ 5obj-y := clock.o cpu.o devices.o devices-common.o \
6 id.o usb.o timer.o 6 id.o usb.o timer.o
7obj-$(CONFIG_CPU_IDLE) += cpuidle.o
7obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o 8obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o
8obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o dma-db5500.o
9obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o 9obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o
10obj-$(CONFIG_MACH_MOP500) += board-mop500.o board-mop500-sdi.o \ 10obj-$(CONFIG_MACH_MOP500) += board-mop500.o board-mop500-sdi.o \
11 board-mop500-regulators.o \ 11 board-mop500-regulators.o \
12 board-mop500-uib.o board-mop500-stuib.o \ 12 board-mop500-uib.o board-mop500-stuib.o \
13 board-mop500-u8500uib.o \ 13 board-mop500-u8500uib.o \
14 board-mop500-pins.o 14 board-mop500-pins.o \
15obj-$(CONFIG_MACH_U5500) += board-u5500.o board-u5500-sdi.o 15 board-mop500-msp.o
16obj-$(CONFIG_SMP) += platsmp.o headsmp.o 16obj-$(CONFIG_SMP) += platsmp.o headsmp.o
17obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 17obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
18obj-$(CONFIG_U5500_MODEM_IRQ) += modem-irq-db5500.o
19obj-$(CONFIG_U5500_MBOX) += mbox-db5500.o
20
diff --git a/arch/arm/mach-ux500/board-mop500-msp.c b/arch/arm/mach-ux500/board-mop500-msp.c
new file mode 100644
index 000000000000..996048038743
--- /dev/null
+++ b/arch/arm/mach-ux500/board-mop500-msp.c
@@ -0,0 +1,267 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License terms: GNU General Public License (GPL), version 2
5 */
6
7#include <linux/platform_device.h>
8#include <linux/init.h>
9#include <linux/gpio.h>
10#include <linux/pinctrl/consumer.h>
11
12#include <plat/gpio-nomadik.h>
13#include <plat/pincfg.h>
14#include <plat/ste_dma40.h>
15
16#include <mach/devices.h>
17#include <mach/hardware.h>
18#include <mach/irqs.h>
19#include <mach/msp.h>
20
21#include "ste-dma40-db8500.h"
22#include "board-mop500.h"
23#include "devices-db8500.h"
24#include "pins-db8500.h"
25
26/* MSP1/3 Tx/Rx usage protection */
27static DEFINE_SPINLOCK(msp_rxtx_lock);
28
29/* Reference Count */
30static int msp_rxtx_ref;
31
32/* Pin modes */
33struct pinctrl *msp1_p;
34struct pinctrl_state *msp1_def;
35struct pinctrl_state *msp1_sleep;
36
37int msp13_i2s_init(void)
38{
39 int retval = 0;
40 unsigned long flags;
41
42 spin_lock_irqsave(&msp_rxtx_lock, flags);
43 if (msp_rxtx_ref == 0 && !(IS_ERR(msp1_p) || IS_ERR(msp1_def))) {
44 retval = pinctrl_select_state(msp1_p, msp1_def);
45 if (retval)
46 pr_err("could not set MSP1 defstate\n");
47 }
48 if (!retval)
49 msp_rxtx_ref++;
50 spin_unlock_irqrestore(&msp_rxtx_lock, flags);
51
52 return retval;
53}
54
55int msp13_i2s_exit(void)
56{
57 int retval = 0;
58 unsigned long flags;
59
60 spin_lock_irqsave(&msp_rxtx_lock, flags);
61 WARN_ON(!msp_rxtx_ref);
62 msp_rxtx_ref--;
63 if (msp_rxtx_ref == 0 && !(IS_ERR(msp1_p) || IS_ERR(msp1_sleep))) {
64 retval = pinctrl_select_state(msp1_p, msp1_sleep);
65 if (retval)
66 pr_err("could not set MSP1 sleepstate\n");
67 }
68 spin_unlock_irqrestore(&msp_rxtx_lock, flags);
69
70 return retval;
71}
72
73static struct stedma40_chan_cfg msp0_dma_rx = {
74 .high_priority = true,
75 .dir = STEDMA40_PERIPH_TO_MEM,
76
77 .src_dev_type = DB8500_DMA_DEV31_MSP0_RX_SLIM0_CH0_RX,
78 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
79
80 .src_info.psize = STEDMA40_PSIZE_LOG_4,
81 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
82
83 /* data_width is set during configuration */
84};
85
86static struct stedma40_chan_cfg msp0_dma_tx = {
87 .high_priority = true,
88 .dir = STEDMA40_MEM_TO_PERIPH,
89
90 .src_dev_type = STEDMA40_DEV_DST_MEMORY,
91 .dst_dev_type = DB8500_DMA_DEV31_MSP0_TX_SLIM0_CH0_TX,
92
93 .src_info.psize = STEDMA40_PSIZE_LOG_4,
94 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
95
96 /* data_width is set during configuration */
97};
98
99static struct msp_i2s_platform_data msp0_platform_data = {
100 .id = MSP_I2S_0,
101 .msp_i2s_dma_rx = &msp0_dma_rx,
102 .msp_i2s_dma_tx = &msp0_dma_tx,
103};
104
105static struct stedma40_chan_cfg msp1_dma_rx = {
106 .high_priority = true,
107 .dir = STEDMA40_PERIPH_TO_MEM,
108
109 .src_dev_type = DB8500_DMA_DEV30_MSP3_RX,
110 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
111
112 .src_info.psize = STEDMA40_PSIZE_LOG_4,
113 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
114
115 /* data_width is set during configuration */
116};
117
118static struct stedma40_chan_cfg msp1_dma_tx = {
119 .high_priority = true,
120 .dir = STEDMA40_MEM_TO_PERIPH,
121
122 .src_dev_type = STEDMA40_DEV_DST_MEMORY,
123 .dst_dev_type = DB8500_DMA_DEV30_MSP1_TX,
124
125 .src_info.psize = STEDMA40_PSIZE_LOG_4,
126 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
127
128 /* data_width is set during configuration */
129};
130
131static struct msp_i2s_platform_data msp1_platform_data = {
132 .id = MSP_I2S_1,
133 .msp_i2s_dma_rx = NULL,
134 .msp_i2s_dma_tx = &msp1_dma_tx,
135 .msp_i2s_init = msp13_i2s_init,
136 .msp_i2s_exit = msp13_i2s_exit,
137};
138
139static struct stedma40_chan_cfg msp2_dma_rx = {
140 .high_priority = true,
141 .dir = STEDMA40_PERIPH_TO_MEM,
142
143 .src_dev_type = DB8500_DMA_DEV14_MSP2_RX,
144 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
145
146 /* MSP2 DMA doesn't work with PSIZE == 4 on DB8500v2 */
147 .src_info.psize = STEDMA40_PSIZE_LOG_1,
148 .dst_info.psize = STEDMA40_PSIZE_LOG_1,
149
150 /* data_width is set during configuration */
151};
152
153static struct stedma40_chan_cfg msp2_dma_tx = {
154 .high_priority = true,
155 .dir = STEDMA40_MEM_TO_PERIPH,
156
157 .src_dev_type = STEDMA40_DEV_DST_MEMORY,
158 .dst_dev_type = DB8500_DMA_DEV14_MSP2_TX,
159
160 .src_info.psize = STEDMA40_PSIZE_LOG_4,
161 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
162
163 .use_fixed_channel = true,
164 .phy_channel = 1,
165
166 /* data_width is set during configuration */
167};
168
169static struct platform_device *db8500_add_msp_i2s(struct device *parent,
170 int id,
171 resource_size_t base, int irq,
172 struct msp_i2s_platform_data *pdata)
173{
174 struct platform_device *pdev;
175 struct resource res[] = {
176 DEFINE_RES_MEM(base, SZ_4K),
177 DEFINE_RES_IRQ(irq),
178 };
179
180 pr_info("Register platform-device 'ux500-msp-i2s', id %d, irq %d\n",
181 id, irq);
182 pdev = platform_device_register_resndata(parent, "ux500-msp-i2s", id,
183 res, ARRAY_SIZE(res),
184 pdata, sizeof(*pdata));
185 if (!pdev) {
186 pr_err("Failed to register platform-device 'ux500-msp-i2s.%d'!\n",
187 id);
188 return NULL;
189 }
190
191 return pdev;
192}
193
194/* Platform device for ASoC U8500 machine */
195static struct platform_device snd_soc_u8500 = {
196 .name = "snd-soc-u8500",
197 .id = 0,
198 .dev = {
199 .platform_data = NULL,
200 },
201};
202
203/* Platform device for Ux500-PCM */
204static struct platform_device ux500_pcm = {
205 .name = "ux500-pcm",
206 .id = 0,
207 .dev = {
208 .platform_data = NULL,
209 },
210};
211
212static struct msp_i2s_platform_data msp2_platform_data = {
213 .id = MSP_I2S_2,
214 .msp_i2s_dma_rx = &msp2_dma_rx,
215 .msp_i2s_dma_tx = &msp2_dma_tx,
216};
217
218static struct msp_i2s_platform_data msp3_platform_data = {
219 .id = MSP_I2S_3,
220 .msp_i2s_dma_rx = &msp1_dma_rx,
221 .msp_i2s_dma_tx = NULL,
222 .msp_i2s_init = msp13_i2s_init,
223 .msp_i2s_exit = msp13_i2s_exit,
224};
225
226int mop500_msp_init(struct device *parent)
227{
228 struct platform_device *msp1;
229
230 pr_info("%s: Register platform-device 'snd-soc-u8500'.\n", __func__);
231 platform_device_register(&snd_soc_u8500);
232
233 pr_info("Initialize MSP I2S-devices.\n");
234 db8500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0,
235 &msp0_platform_data);
236 msp1 = db8500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1,
237 &msp1_platform_data);
238 db8500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2,
239 &msp2_platform_data);
240 db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1,
241 &msp3_platform_data);
242
243 /* Get the pinctrl handle for MSP1 */
244 if (msp1) {
245 msp1_p = pinctrl_get(&msp1->dev);
246 if (IS_ERR(msp1_p))
247 dev_err(&msp1->dev, "could not get MSP1 pinctrl\n");
248 else {
249 msp1_def = pinctrl_lookup_state(msp1_p,
250 PINCTRL_STATE_DEFAULT);
251 if (IS_ERR(msp1_def)) {
252 dev_err(&msp1->dev,
253 "could not get MSP1 defstate\n");
254 }
255 msp1_sleep = pinctrl_lookup_state(msp1_p,
256 PINCTRL_STATE_SLEEP);
257 if (IS_ERR(msp1_sleep))
258 dev_err(&msp1->dev,
259 "could not get MSP1 idlestate\n");
260 }
261 }
262
263 pr_info("%s: Register platform-device 'ux500-pcm'\n", __func__);
264 platform_device_register(&ux500_pcm);
265
266 return 0;
267}
diff --git a/arch/arm/mach-ux500/board-mop500-msp.h b/arch/arm/mach-ux500/board-mop500-msp.h
new file mode 100644
index 000000000000..6fcfb5e2cc94
--- /dev/null
+++ b/arch/arm/mach-ux500/board-mop500-msp.h
@@ -0,0 +1,14 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2012
3 *
4 * Author: Ola Lilja <ola.o.lilja@stericsson.com>,
5 * for ST-Ericsson.
6 *
7 * License terms:
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
12 */
13
14void mop500_msp_init(struct device *parent);
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c
index f5413dca532c..32fd99204464 100644
--- a/arch/arm/mach-ux500/board-mop500-pins.c
+++ b/arch/arm/mach-ux500/board-mop500-pins.c
@@ -7,299 +7,508 @@
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/bug.h> 9#include <linux/bug.h>
10#include <linux/string.h>
11#include <linux/pinctrl/machine.h>
10 12
11#include <asm/mach-types.h> 13#include <asm/mach-types.h>
12#include <plat/pincfg.h> 14#include <plat/pincfg.h>
13#include <plat/gpio-nomadik.h> 15#include <plat/gpio-nomadik.h>
16
14#include <mach/hardware.h> 17#include <mach/hardware.h>
15 18
16#include "pins-db8500.h" 19#include "pins-db8500.h"
20#include "board-mop500.h"
17 21
18static pin_cfg_t mop500_pins_common[] = { 22enum custom_pin_cfg_t {
19 /* I2C */ 23 PINS_FOR_DEFAULT,
20 GPIO147_I2C0_SCL, 24 PINS_FOR_U9500,
21 GPIO148_I2C0_SDA, 25};
22 GPIO16_I2C1_SCL,
23 GPIO17_I2C1_SDA,
24 GPIO10_I2C2_SDA,
25 GPIO11_I2C2_SCL,
26 GPIO229_I2C3_SDA,
27 GPIO230_I2C3_SCL,
28
29 /* MSP0 */
30 GPIO12_MSP0_TXD,
31 GPIO13_MSP0_TFS,
32 GPIO14_MSP0_TCK,
33 GPIO15_MSP0_RXD,
34
35 /* MSP2: HDMI */
36 GPIO193_MSP2_TXD,
37 GPIO194_MSP2_TCK,
38 GPIO195_MSP2_TFS,
39 GPIO196_MSP2_RXD | PIN_OUTPUT_LOW,
40
41 /* Touch screen INTERFACE */
42 GPIO84_GPIO | PIN_INPUT_PULLUP, /* TOUCH_INT1 */
43
44 /* STMPE1601/tc35893 keypad IRQ */
45 GPIO218_GPIO | PIN_INPUT_PULLUP,
46
47 /* MMC0 (MicroSD card) */
48 GPIO18_MC0_CMDDIR | PIN_OUTPUT_HIGH,
49 GPIO19_MC0_DAT0DIR | PIN_OUTPUT_HIGH,
50 GPIO20_MC0_DAT2DIR | PIN_OUTPUT_HIGH,
51
52 GPIO22_MC0_FBCLK | PIN_INPUT_NOPULL,
53 GPIO23_MC0_CLK | PIN_OUTPUT_LOW,
54 GPIO24_MC0_CMD | PIN_INPUT_PULLUP,
55 GPIO25_MC0_DAT0 | PIN_INPUT_PULLUP,
56 GPIO26_MC0_DAT1 | PIN_INPUT_PULLUP,
57 GPIO27_MC0_DAT2 | PIN_INPUT_PULLUP,
58 GPIO28_MC0_DAT3 | PIN_INPUT_PULLUP,
59
60 /* SDI1 (SDIO) */
61 GPIO208_MC1_CLK | PIN_OUTPUT_LOW,
62 GPIO209_MC1_FBCLK | PIN_INPUT_NOPULL,
63 GPIO210_MC1_CMD | PIN_INPUT_PULLUP,
64 GPIO211_MC1_DAT0 | PIN_INPUT_PULLUP,
65 GPIO212_MC1_DAT1 | PIN_INPUT_PULLUP,
66 GPIO213_MC1_DAT2 | PIN_INPUT_PULLUP,
67 GPIO214_MC1_DAT3 | PIN_INPUT_PULLUP,
68
69 /* MMC2 (On-board DATA INTERFACE eMMC) */
70 GPIO128_MC2_CLK | PIN_OUTPUT_LOW,
71 GPIO129_MC2_CMD | PIN_INPUT_PULLUP,
72 GPIO130_MC2_FBCLK | PIN_INPUT_NOPULL,
73 GPIO131_MC2_DAT0 | PIN_INPUT_PULLUP,
74 GPIO132_MC2_DAT1 | PIN_INPUT_PULLUP,
75 GPIO133_MC2_DAT2 | PIN_INPUT_PULLUP,
76 GPIO134_MC2_DAT3 | PIN_INPUT_PULLUP,
77 GPIO135_MC2_DAT4 | PIN_INPUT_PULLUP,
78 GPIO136_MC2_DAT5 | PIN_INPUT_PULLUP,
79 GPIO137_MC2_DAT6 | PIN_INPUT_PULLUP,
80 GPIO138_MC2_DAT7 | PIN_INPUT_PULLUP,
81
82 /* MMC4 (On-board STORAGE INTERFACE eMMC) */
83 GPIO197_MC4_DAT3 | PIN_INPUT_PULLUP,
84 GPIO198_MC4_DAT2 | PIN_INPUT_PULLUP,
85 GPIO199_MC4_DAT1 | PIN_INPUT_PULLUP,
86 GPIO200_MC4_DAT0 | PIN_INPUT_PULLUP,
87 GPIO201_MC4_CMD | PIN_INPUT_PULLUP,
88 GPIO202_MC4_FBCLK | PIN_INPUT_NOPULL,
89 GPIO203_MC4_CLK | PIN_OUTPUT_LOW,
90 GPIO204_MC4_DAT7 | PIN_INPUT_PULLUP,
91 GPIO205_MC4_DAT6 | PIN_INPUT_PULLUP,
92 GPIO206_MC4_DAT5 | PIN_INPUT_PULLUP,
93 GPIO207_MC4_DAT4 | PIN_INPUT_PULLUP,
94
95 /* SKE keypad */
96 GPIO153_KP_I7,
97 GPIO154_KP_I6,
98 GPIO155_KP_I5,
99 GPIO156_KP_I4,
100 GPIO157_KP_O7,
101 GPIO158_KP_O6,
102 GPIO159_KP_O5,
103 GPIO160_KP_O4,
104 GPIO161_KP_I3,
105 GPIO162_KP_I2,
106 GPIO163_KP_I1,
107 GPIO164_KP_I0,
108 GPIO165_KP_O3,
109 GPIO166_KP_O2,
110 GPIO167_KP_O1,
111 GPIO168_KP_O0,
112 26
113 /* UART */ 27static enum custom_pin_cfg_t pinsfor;
114 /* uart-0 pins gpio configuration should be 28
115 * kept intact to prevent glitch in tx line 29/* These simply sets bias for pins */
116 * when tty dev is opened. Later these pins 30#define BIAS(a,b) static unsigned long a[] = { b }
31
32BIAS(pd, PIN_PULL_DOWN);
33BIAS(slpm_gpio_nopull, PIN_SLPM_GPIO|PIN_SLPM_INPUT_NOPULL);
34BIAS(in_nopull, PIN_INPUT_NOPULL);
35BIAS(in_nopull_sleep_nowkup, PIN_INPUT_NOPULL|PIN_SLPM_WAKEUP_DISABLE);
36BIAS(in_pu, PIN_INPUT_PULLUP);
37BIAS(in_pd, PIN_INPUT_PULLDOWN);
38BIAS(in_pd_slpm_in_pu, PIN_INPUT_PULLDOWN|PIN_SLPM_INPUT_PULLUP);
39BIAS(in_pu_slpm_out_lo, PIN_INPUT_PULLUP|PIN_SLPM_OUTPUT_LOW);
40BIAS(out_hi, PIN_OUTPUT_HIGH);
41BIAS(out_lo, PIN_OUTPUT_LOW);
42BIAS(out_lo_sleep_nowkup, PIN_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE);
43/* These also force them into GPIO mode */
44BIAS(gpio_in_pu, PIN_INPUT_PULLUP|PIN_GPIOMODE_ENABLED);
45BIAS(gpio_in_pd, PIN_INPUT_PULLDOWN|PIN_GPIOMODE_ENABLED);
46BIAS(gpio_in_pu_slpm_gpio_nopull, PIN_INPUT_PULLUP|PIN_GPIOMODE_ENABLED|PIN_SLPM_GPIO|PIN_SLPM_INPUT_NOPULL);
47BIAS(gpio_in_pd_slpm_gpio_nopull, PIN_INPUT_PULLDOWN|PIN_GPIOMODE_ENABLED|PIN_SLPM_GPIO|PIN_SLPM_INPUT_NOPULL);
48BIAS(gpio_out_hi, PIN_OUTPUT_HIGH|PIN_GPIOMODE_ENABLED);
49BIAS(gpio_out_lo, PIN_OUTPUT_LOW|PIN_GPIOMODE_ENABLED);
50/* Sleep modes */
51BIAS(sleep_in_wkup_pdis, PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
52BIAS(sleep_in_nopull_wkup, PIN_INPUT_NOPULL|PIN_SLPM_WAKEUP_ENABLE);
53BIAS(sleep_out_hi_wkup_pdis, PIN_SLPM_OUTPUT_HIGH|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
54BIAS(sleep_out_lo_wkup, PIN_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE);
55BIAS(sleep_out_wkup_pdis, PIN_SLPM_DIR_OUTPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
56
57/* We use these to define hog settings that are always done on boot */
58#define DB8500_MUX_HOG(group,func) \
59 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-db8500", group, func)
60#define DB8500_PIN_HOG(pin,conf) \
61 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-db8500", pin, conf)
62
63/* These are default states associated with device and changed runtime */
64#define DB8500_MUX(group,func,dev) \
65 PIN_MAP_MUX_GROUP_DEFAULT(dev, "pinctrl-db8500", group, func)
66#define DB8500_PIN(pin,conf,dev) \
67 PIN_MAP_CONFIGS_PIN_DEFAULT(dev, "pinctrl-db8500", pin, conf)
68
69#define DB8500_PIN_SLEEP(pin,conf,dev) \
70 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \
71 pin, conf)
72
73/* Pin control settings */
74static struct pinctrl_map __initdata mop500_family_pinmap[] = {
75 /*
76 * uMSP0, mux in 4 pins, regular placement of RX/TX
77 * explicitly set the pins to no pull
78 */
79 DB8500_MUX_HOG("msp0txrx_a_1", "msp0"),
80 DB8500_MUX_HOG("msp0tfstck_a_1", "msp0"),
81 DB8500_PIN_HOG("GPIO12_AC4", in_nopull), /* TXD */
82 DB8500_PIN_HOG("GPIO15_AC3", in_nopull), /* RXD */
83 DB8500_PIN_HOG("GPIO13_AF3", in_nopull), /* TFS */
84 DB8500_PIN_HOG("GPIO14_AE3", in_nopull), /* TCK */
85 /* MSP2 for HDMI, pull down TXD, TCK, TFS */
86 DB8500_MUX_HOG("msp2_a_1", "msp2"),
87 DB8500_PIN_HOG("GPIO193_AH27", in_pd), /* TXD */
88 DB8500_PIN_HOG("GPIO194_AF27", in_pd), /* TCK */
89 DB8500_PIN_HOG("GPIO195_AG28", in_pd), /* TFS */
90 DB8500_PIN_HOG("GPIO196_AG26", out_lo), /* RXD */
91 /*
92 * LCD, set TE0 (using LCD VSI0) and D14 (touch screen interrupt) to
93 * pull-up
94 * TODO: is this really correct? Snowball doesn't have a LCD.
95 */
96 DB8500_MUX_HOG("lcdvsi0_a_1", "lcd"),
97 DB8500_PIN_HOG("GPIO68_E1", in_pu),
98 DB8500_PIN_HOG("GPIO84_C2", gpio_in_pu),
99 /*
100 * STMPE1601/tc35893 keypad IRQ GPIO 218
101 * TODO: set for snowball and HREF really??
102 */
103 DB8500_PIN_HOG("GPIO218_AH11", gpio_in_pu),
104 /*
105 * UART0, we do not mux in u0 here.
106 * uart-0 pins gpio configuration should be kept intact to prevent
107 * a glitch in tx line when the tty dev is opened. Later these pins
117 * are configured to uart mop500_pins_uart0 108 * are configured to uart mop500_pins_uart0
118 *
119 * It will be replaced with uart configuration
120 * once the issue is solved.
121 */ 109 */
122 GPIO0_GPIO | PIN_INPUT_PULLUP, 110 DB8500_PIN_HOG("GPIO0_AJ5", in_pu), /* CTS */
123 GPIO1_GPIO | PIN_OUTPUT_HIGH, 111 DB8500_PIN_HOG("GPIO1_AJ3", out_hi), /* RTS */
124 GPIO2_GPIO | PIN_INPUT_PULLUP, 112 DB8500_PIN_HOG("GPIO2_AH4", in_pu), /* RXD */
125 GPIO3_GPIO | PIN_OUTPUT_HIGH, 113 DB8500_PIN_HOG("GPIO3_AH3", out_hi), /* TXD */
126 114 /*
127 GPIO29_U2_RXD | PIN_INPUT_PULLUP, 115 * Mux in UART2 on altfunction C and set pull-ups.
128 GPIO30_U2_TXD | PIN_OUTPUT_HIGH, 116 * TODO: is this used on U8500 variants and Snowball really?
129 GPIO31_U2_CTSn | PIN_INPUT_PULLUP, 117 * The setting on GPIO31 conflicts with magnetometer use on hrefv60
130 GPIO32_U2_RTSn | PIN_OUTPUT_HIGH, 118 */
131 119 DB8500_MUX_HOG("u2rxtx_c_1", "u2"),
132 /* Display & HDMI HW sync */ 120 DB8500_MUX_HOG("u2ctsrts_c_1", "u2"),
133 GPIO68_LCD_VSI0 | PIN_INPUT_PULLUP, 121 DB8500_PIN_HOG("GPIO29_W2", in_pu), /* RXD */
134 GPIO69_LCD_VSI1 | PIN_INPUT_PULLUP, 122 DB8500_PIN_HOG("GPIO30_W3", out_hi), /* TXD */
123 DB8500_PIN_HOG("GPIO31_V3", in_pu), /* CTS */
124 DB8500_PIN_HOG("GPIO32_V2", out_hi), /* RTS */
125 /*
126 * The following pin sets were known as "runtime pins" before being
127 * converted to the pinctrl model. Here we model them as "default"
128 * states.
129 */
130 /* Mux in UART0 after initialization */
131 DB8500_MUX("u0_a_1", "u0", "uart0"),
132 DB8500_PIN("GPIO0_AJ5", in_pu, "uart0"), /* CTS */
133 DB8500_PIN("GPIO1_AJ3", out_hi, "uart0"), /* RTS */
134 DB8500_PIN("GPIO2_AH4", in_pu, "uart0"), /* RXD */
135 DB8500_PIN("GPIO3_AH3", out_hi, "uart0"), /* TXD */
136 /* UART0 sleep state */
137 DB8500_PIN_SLEEP("GPIO0_AJ5", sleep_in_wkup_pdis, "uart0"),
138 DB8500_PIN_SLEEP("GPIO1_AJ3", sleep_out_hi_wkup_pdis, "uart0"),
139 DB8500_PIN_SLEEP("GPIO2_AH4", sleep_in_wkup_pdis, "uart0"),
140 DB8500_PIN_SLEEP("GPIO3_AH3", sleep_out_wkup_pdis, "uart0"),
141 /* MSP1 for ALSA codec */
142 DB8500_MUX("msp1txrx_a_1", "msp1", "ux500-msp-i2s.1"),
143 DB8500_MUX("msp1_a_1", "msp1", "ux500-msp-i2s.1"),
144 DB8500_PIN("GPIO33_AF2", out_lo_sleep_nowkup, "ux500-msp-i2s.1"),
145 DB8500_PIN("GPIO34_AE1", in_nopull_sleep_nowkup, "ux500-msp-i2s.1"),
146 DB8500_PIN("GPIO35_AE2", in_nopull_sleep_nowkup, "ux500-msp-i2s.1"),
147 DB8500_PIN("GPIO36_AG2", in_nopull_sleep_nowkup, "ux500-msp-i2s.1"),
148 /* MSP1 sleep state */
149 DB8500_PIN_SLEEP("GPIO33_AF2", sleep_out_lo_wkup, "ux500-msp-i2s.1"),
150 DB8500_PIN_SLEEP("GPIO34_AE1", sleep_in_nopull_wkup, "ux500-msp-i2s.1"),
151 DB8500_PIN_SLEEP("GPIO35_AE2", sleep_in_nopull_wkup, "ux500-msp-i2s.1"),
152 DB8500_PIN_SLEEP("GPIO36_AG2", sleep_in_nopull_wkup, "ux500-msp-i2s.1"),
153 /* Mux in LCD data lines 8 thru 11 and LCDA CLK for MCDE TVOUT */
154 DB8500_MUX("lcd_d8_d11_a_1", "lcd", "mcde-tvout"),
155 DB8500_MUX("lcdaclk_b_1", "lcda", "mcde-tvout"),
156 /* Mux in LCD VSI1 and pull it up for MCDE HDMI output */
157 DB8500_MUX("lcdvsi1_a_1", "lcd", "av8100-hdmi"),
158 /* Mux in I2C blocks, put pins into GPIO in sleepmode no pull-up */
159 DB8500_MUX("i2c0_a_1", "i2c0", "nmk-i2c.0"),
160 DB8500_PIN("GPIO147_C15", slpm_gpio_nopull, "nmk-i2c.0"),
161 DB8500_PIN("GPIO148_B16", slpm_gpio_nopull, "nmk-i2c.0"),
162 DB8500_MUX("i2c1_b_2", "i2c1", "nmk-i2c.1"),
163 DB8500_PIN("GPIO16_AD3", slpm_gpio_nopull, "nmk-i2c.1"),
164 DB8500_PIN("GPIO17_AD4", slpm_gpio_nopull, "nmk-i2c.1"),
165 DB8500_MUX("i2c2_b_2", "i2c2", "nmk-i2c.2"),
166 DB8500_PIN("GPIO10_AF5", slpm_gpio_nopull, "nmk-i2c.2"),
167 DB8500_PIN("GPIO11_AG4", slpm_gpio_nopull, "nmk-i2c.2"),
168 DB8500_MUX("i2c3_c_2", "i2c3", "nmk-i2c.3"),
169 DB8500_PIN("GPIO229_AG7", slpm_gpio_nopull, "nmk-i2c.3"),
170 DB8500_PIN("GPIO230_AF7", slpm_gpio_nopull, "nmk-i2c.3"),
171 /* Mux in SDI0 (here called MC0) used for removable MMC/SD/SDIO cards */
172 DB8500_MUX("mc0_a_1", "mc0", "sdi0"),
173 DB8500_PIN("GPIO18_AC2", out_hi, "sdi0"), /* CMDDIR */
174 DB8500_PIN("GPIO19_AC1", out_hi, "sdi0"), /* DAT0DIR */
175 DB8500_PIN("GPIO20_AB4", out_hi, "sdi0"), /* DAT2DIR */
176 DB8500_PIN("GPIO22_AA3", in_nopull, "sdi0"), /* FBCLK */
177 DB8500_PIN("GPIO23_AA4", out_lo, "sdi0"), /* CLK */
178 DB8500_PIN("GPIO24_AB2", in_pu, "sdi0"), /* CMD */
179 DB8500_PIN("GPIO25_Y4", in_pu, "sdi0"), /* DAT0 */
180 DB8500_PIN("GPIO26_Y2", in_pu, "sdi0"), /* DAT1 */
181 DB8500_PIN("GPIO27_AA2", in_pu, "sdi0"), /* DAT2 */
182 DB8500_PIN("GPIO28_AA1", in_pu, "sdi0"), /* DAT3 */
183 /* Mux in SDI1 (here called MC1) used for SDIO for CW1200 WLAN */
184 DB8500_MUX("mc1_a_1", "mc1", "sdi1"),
185 DB8500_PIN("GPIO208_AH16", out_lo, "sdi1"), /* CLK */
186 DB8500_PIN("GPIO209_AG15", in_nopull, "sdi1"), /* FBCLK */
187 DB8500_PIN("GPIO210_AJ15", in_pu, "sdi1"), /* CMD */
188 DB8500_PIN("GPIO211_AG14", in_pu, "sdi1"), /* DAT0 */
189 DB8500_PIN("GPIO212_AF13", in_pu, "sdi1"), /* DAT1 */
190 DB8500_PIN("GPIO213_AG13", in_pu, "sdi1"), /* DAT2 */
191 DB8500_PIN("GPIO214_AH15", in_pu, "sdi1"), /* DAT3 */
192 /* Mux in SDI2 (here called MC2) used for for PoP eMMC */
193 DB8500_MUX("mc2_a_1", "mc2", "sdi2"),
194 DB8500_PIN("GPIO128_A5", out_lo, "sdi2"), /* CLK */
195 DB8500_PIN("GPIO129_B4", in_pu, "sdi2"), /* CMD */
196 DB8500_PIN("GPIO130_C8", in_nopull, "sdi2"), /* FBCLK */
197 DB8500_PIN("GPIO131_A12", in_pu, "sdi2"), /* DAT0 */
198 DB8500_PIN("GPIO132_C10", in_pu, "sdi2"), /* DAT1 */
199 DB8500_PIN("GPIO133_B10", in_pu, "sdi2"), /* DAT2 */
200 DB8500_PIN("GPIO134_B9", in_pu, "sdi2"), /* DAT3 */
201 DB8500_PIN("GPIO135_A9", in_pu, "sdi2"), /* DAT4 */
202 DB8500_PIN("GPIO136_C7", in_pu, "sdi2"), /* DAT5 */
203 DB8500_PIN("GPIO137_A7", in_pu, "sdi2"), /* DAT6 */
204 DB8500_PIN("GPIO138_C5", in_pu, "sdi2"), /* DAT7 */
205 /* Mux in SDI4 (here called MC4) used for for PCB-mounted eMMC */
206 DB8500_MUX("mc4_a_1", "mc4", "sdi4"),
207 DB8500_PIN("GPIO197_AH24", in_pu, "sdi4"), /* DAT3 */
208 DB8500_PIN("GPIO198_AG25", in_pu, "sdi4"), /* DAT2 */
209 DB8500_PIN("GPIO199_AH23", in_pu, "sdi4"), /* DAT1 */
210 DB8500_PIN("GPIO200_AH26", in_pu, "sdi4"), /* DAT0 */
211 DB8500_PIN("GPIO201_AF24", in_pu, "sdi4"), /* CMD */
212 DB8500_PIN("GPIO202_AF25", in_nopull, "sdi4"), /* FBCLK */
213 DB8500_PIN("GPIO203_AE23", out_lo, "sdi4"), /* CLK */
214 DB8500_PIN("GPIO204_AF23", in_pu, "sdi4"), /* DAT7 */
215 DB8500_PIN("GPIO205_AG23", in_pu, "sdi4"), /* DAT6 */
216 DB8500_PIN("GPIO206_AG24", in_pu, "sdi4"), /* DAT5 */
217 DB8500_PIN("GPIO207_AJ23", in_pu, "sdi4"), /* DAT4 */
218 /* Mux in USB pins, drive STP high */
219 DB8500_MUX("usb_a_1", "usb", "musb-ux500.0"),
220 DB8500_PIN("GPIO257_AE29", out_hi, "musb-ux500.0"), /* STP */
221 /* Mux in SPI2 pins on the "other C1" altfunction */
222 DB8500_MUX("spi2_oc1_1", "spi2", "spi2"),
223 DB8500_PIN("GPIO216_AG12", gpio_out_hi, "spi2"), /* FRM */
224 DB8500_PIN("GPIO218_AH11", in_pd, "spi2"), /* RXD */
225 DB8500_PIN("GPIO215_AH13", out_lo, "spi2"), /* TXD */
226 DB8500_PIN("GPIO217_AH12", out_lo, "spi2"), /* CLK */
135}; 227};
136 228
137static pin_cfg_t mop500_pins_default[] = { 229/*
138 /* SSP0 */ 230 * These are specifically for the MOP500 and HREFP (pre-v60) version of the
139 GPIO143_SSP0_CLK, 231 * board, which utilized a TC35892 GPIO expander instead of using a lot of
140 GPIO144_SSP0_FRM, 232 * on-chip pins as the HREFv60 and later does.
141 GPIO145_SSP0_RXD | PIN_PULL_DOWN, 233 */
142 GPIO146_SSP0_TXD, 234static struct pinctrl_map __initdata mop500_pinmap[] = {
143 235 /* Mux in SSP0, pull down RXD pin */
144 236 DB8500_MUX_HOG("ssp0_a_1", "ssp0"),
145 GPIO217_GPIO | PIN_INPUT_PULLUP, /* TC35892 IRQ */ 237 DB8500_PIN_HOG("GPIO145_C13", pd),
146 238 /*
147 /* SDI0 (MicroSD card) */ 239 * XENON Flashgun on image processor GPIO (controlled from image
148 GPIO21_MC0_DAT31DIR | PIN_OUTPUT_HIGH, 240 * processor firmware), mux in these image processor GPIO lines 0
149 241 * (XENON_FLASH_ID) and 1 (XENON_READY) on altfunction C and pull up
150 /* UART */ 242 * the pins.
151 GPIO4_U1_RXD | PIN_INPUT_PULLUP, 243 */
152 GPIO5_U1_TXD | PIN_OUTPUT_HIGH, 244 DB8500_MUX_HOG("ipgpio0_c_1", "ipgpio"),
153 GPIO6_U1_CTSn | PIN_INPUT_PULLUP, 245 DB8500_MUX_HOG("ipgpio1_c_1", "ipgpio"),
154 GPIO7_U1_RTSn | PIN_OUTPUT_HIGH, 246 DB8500_PIN_HOG("GPIO6_AF6", in_pu),
247 DB8500_PIN_HOG("GPIO7_AG5", in_pu),
248 /* TC35892 IRQ, pull up the line, let the driver mux in the pin */
249 DB8500_PIN_HOG("GPIO217_AH12", gpio_in_pu),
250 /* Mux in UART1 and set the pull-ups */
251 DB8500_MUX_HOG("u1rxtx_a_1", "u1"),
252 DB8500_MUX_HOG("u1ctsrts_a_1", "u1"),
253 DB8500_PIN_HOG("GPIO4_AH6", in_pu), /* RXD */
254 DB8500_PIN_HOG("GPIO5_AG6", out_hi), /* TXD */
255 DB8500_PIN_HOG("GPIO6_AF6", in_pu), /* CTS */
256 DB8500_PIN_HOG("GPIO7_AG5", out_hi), /* RTS */
257 /*
258 * Runtime stuff: make it possible to mux in the SKE keypad
259 * and bias the pins
260 */
261 DB8500_MUX("kp_a_2", "kp", "ske"),
262 DB8500_PIN("GPIO153_B17", in_pd_slpm_in_pu, "ske"), /* I7 */
263 DB8500_PIN("GPIO154_C16", in_pd_slpm_in_pu, "ske"), /* I6 */
264 DB8500_PIN("GPIO155_C19", in_pd_slpm_in_pu, "ske"), /* I5 */
265 DB8500_PIN("GPIO156_C17", in_pd_slpm_in_pu, "ske"), /* I4 */
266 DB8500_PIN("GPIO161_D21", in_pd_slpm_in_pu, "ske"), /* I3 */
267 DB8500_PIN("GPIO162_D20", in_pd_slpm_in_pu, "ske"), /* I2 */
268 DB8500_PIN("GPIO163_C20", in_pd_slpm_in_pu, "ske"), /* I1 */
269 DB8500_PIN("GPIO164_B21", in_pd_slpm_in_pu, "ske"), /* I0 */
270 DB8500_PIN("GPIO157_A18", in_pu_slpm_out_lo, "ske"), /* O7 */
271 DB8500_PIN("GPIO158_C18", in_pu_slpm_out_lo, "ske"), /* O6 */
272 DB8500_PIN("GPIO159_B19", in_pu_slpm_out_lo, "ske"), /* O5 */
273 DB8500_PIN("GPIO160_B20", in_pu_slpm_out_lo, "ske"), /* O4 */
274 DB8500_PIN("GPIO165_C21", in_pu_slpm_out_lo, "ske"), /* O3 */
275 DB8500_PIN("GPIO166_A22", in_pu_slpm_out_lo, "ske"), /* O2 */
276 DB8500_PIN("GPIO167_B24", in_pu_slpm_out_lo, "ske"), /* O1 */
277 DB8500_PIN("GPIO168_C22", in_pu_slpm_out_lo, "ske"), /* O0 */
278 /* Mux in and drive the SDI0 DAT31DIR line high at runtime */
279 DB8500_MUX("mc0dat31dir_a_1", "mc0", "sdi0"),
280 DB8500_PIN("GPIO21_AB3", out_hi, "sdi0"),
155}; 281};
156 282
157static pin_cfg_t hrefv60_pins[] = { 283/*
158 /* WLAN */ 284 * The HREFv60 series of platforms is using available pins on the DB8500
159 GPIO4_GPIO | PIN_INPUT_PULLUP,/* WLAN_IRQ */ 285 * insteaf of the Toshiba I2C GPIO expander, reusing some pins like the SSP0
160 GPIO85_GPIO | PIN_OUTPUT_LOW,/* WLAN_ENA */ 286 * and SSP1 ports (previously connected to the AB8500) as generic GPIO lines.
161 287 */
162 /* XENON Flashgun INTERFACE */ 288static struct pinctrl_map __initdata hrefv60_pinmap[] = {
163 GPIO6_IP_GPIO0 | PIN_INPUT_PULLUP,/* XENON_FLASH_ID */ 289 /* Drive WLAN_ENA low */
164 GPIO7_IP_GPIO1 | PIN_INPUT_PULLUP,/* XENON_READY */ 290 DB8500_PIN_HOG("GPIO85_D5", gpio_out_lo), /* WLAN_ENA */
165 GPIO170_GPIO | PIN_OUTPUT_LOW, /* XENON_CHARGE */ 291 /*
166 292 * XENON Flashgun on image processor GPIO (controlled from image
167 /* Assistant LED INTERFACE */ 293 * processor firmware), mux in these image processor GPIO lines 0
168 GPIO21_GPIO | PIN_OUTPUT_LOW, /* XENON_EN1 */ 294 * (XENON_FLASH_ID), 1 (XENON_READY) and there is an assistant
169 GPIO64_IP_GPIO4 | PIN_OUTPUT_LOW, /* XENON_EN2 */ 295 * LED on IP GPIO 4 (XENON_EN2) on altfunction C, that need bias
170 296 * from GPIO21 so pull up 0, 1 and drive 4 and GPIO21 low as output.
171 /* Magnetometer */ 297 */
172 GPIO31_GPIO | PIN_INPUT_PULLUP, /* magnetometer_INT */ 298 DB8500_MUX_HOG("ipgpio0_c_1", "ipgpio"),
173 GPIO32_GPIO | PIN_INPUT_PULLDOWN, /* Magnetometer DRDY */ 299 DB8500_MUX_HOG("ipgpio1_c_1", "ipgpio"),
174 300 DB8500_MUX_HOG("ipgpio4_c_1", "ipgpio"),
175 /* Display Interface */ 301 DB8500_PIN_HOG("GPIO6_AF6", in_pu), /* XENON_FLASH_ID */
176 GPIO65_GPIO | PIN_OUTPUT_LOW, /* DISP1 RST */ 302 DB8500_PIN_HOG("GPIO7_AG5", in_pu), /* XENON_READY */
177 GPIO66_GPIO | PIN_OUTPUT_LOW, /* DISP2 RST */ 303 DB8500_PIN_HOG("GPIO21_AB3", gpio_out_lo), /* XENON_EN1 */
178 304 DB8500_PIN_HOG("GPIO64_F3", out_lo), /* XENON_EN2 */
179 /* Touch screen INTERFACE */ 305 /* Magnetometer uses GPIO 31 and 32, pull these up/down respectively */
180 GPIO143_GPIO | PIN_OUTPUT_LOW,/*TOUCH_RST1 */ 306 DB8500_PIN_HOG("GPIO31_V3", gpio_in_pu), /* EN1 */
181 307 DB8500_PIN_HOG("GPIO32_V2", gpio_in_pd), /* DRDY */
182 /* Touch screen INTERFACE 2 */ 308 /*
183 GPIO67_GPIO | PIN_INPUT_PULLUP, /* TOUCH_INT2 */ 309 * Display Interface 1 uses GPIO 65 for RST (reset).
184 GPIO146_GPIO | PIN_OUTPUT_LOW,/*TOUCH_RST2 */ 310 * Display Interface 2 uses GPIO 66 for RST (reset).
185 311 * Drive DISP1 reset high (not reset), driver DISP2 reset low (reset)
186 /* ETM_PTM_TRACE INTERFACE */ 312 */
187 GPIO70_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA23 */ 313 DB8500_PIN_HOG("GPIO65_F1", gpio_out_hi), /* DISP1 NO RST */
188 GPIO71_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA22 */ 314 DB8500_PIN_HOG("GPIO66_G3", gpio_out_lo), /* DISP2 RST */
189 GPIO72_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA21 */ 315 /*
190 GPIO73_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA20 */ 316 * Touch screen uses GPIO 143 for RST1, GPIO 146 for RST2 and
191 GPIO74_GPIO | PIN_OUTPUT_LOW,/* ETM_PTM_DATA19 */ 317 * GPIO 67 for interrupts. Pull-up the IRQ line and drive both
192 318 * reset signals low.
193 /* NAHJ INTERFACE */ 319 */
194 GPIO76_GPIO | PIN_OUTPUT_LOW,/* NAHJ_CTRL */ 320 DB8500_PIN_HOG("GPIO143_D12", gpio_out_lo), /* TOUCH_RST1 */
195 GPIO216_GPIO | PIN_OUTPUT_HIGH,/* NAHJ_CTRL_INV */ 321 DB8500_PIN_HOG("GPIO67_G2", gpio_in_pu), /* TOUCH_INT2 */
196 322 DB8500_PIN_HOG("GPIO146_D13", gpio_out_lo), /* TOUCH_RST2 */
197 /* NFC INTERFACE */ 323 /*
198 GPIO77_GPIO | PIN_OUTPUT_LOW, /* NFC_ENA */ 324 * Drive D19-D23 for the ETM PTM trace interface low,
199 GPIO144_GPIO | PIN_INPUT_PULLDOWN, /* NFC_IRQ */ 325 * (presumably pins are unconnected therefore grounded here,
200 GPIO142_GPIO | PIN_OUTPUT_LOW, /* NFC_RESET */ 326 * the "other alt C1" setting enables these pins)
201 327 */
202 /* Keyboard MATRIX INTERFACE */ 328 DB8500_PIN_HOG("GPIO70_G5", gpio_out_lo),
203 GPIO90_MC5_CMD | PIN_OUTPUT_LOW, /* KP_O_1 */ 329 DB8500_PIN_HOG("GPIO71_G4", gpio_out_lo),
204 GPIO87_MC5_DAT1 | PIN_OUTPUT_LOW, /* KP_O_2 */ 330 DB8500_PIN_HOG("GPIO72_H4", gpio_out_lo),
205 GPIO86_MC5_DAT0 | PIN_OUTPUT_LOW, /* KP_O_3 */ 331 DB8500_PIN_HOG("GPIO73_H3", gpio_out_lo),
206 GPIO96_KP_O6 | PIN_OUTPUT_LOW, /* KP_O_6 */ 332 DB8500_PIN_HOG("GPIO74_J3", gpio_out_lo),
207 GPIO94_KP_O7 | PIN_OUTPUT_LOW, /* KP_O_7 */ 333 /* NAHJ CTRL on GPIO 76 to low, CTRL_INV on GPIO216 to high */
208 GPIO93_MC5_DAT4 | PIN_INPUT_PULLUP, /* KP_I_0 */ 334 DB8500_PIN_HOG("GPIO76_J2", gpio_out_lo), /* CTRL */
209 GPIO89_MC5_DAT3 | PIN_INPUT_PULLUP, /* KP_I_2 */ 335 DB8500_PIN_HOG("GPIO216_AG12", gpio_out_hi), /* CTRL_INV */
210 GPIO88_MC5_DAT2 | PIN_INPUT_PULLUP, /* KP_I_3 */ 336 /* NFC ENA and RESET to low, pulldown IRQ line */
211 GPIO91_GPIO | PIN_INPUT_PULLUP, /* FORCE_SENSING_INT */ 337 DB8500_PIN_HOG("GPIO77_H1", gpio_out_lo), /* NFC_ENA */
212 GPIO92_GPIO | PIN_OUTPUT_LOW, /* FORCE_SENSING_RST */ 338 DB8500_PIN_HOG("GPIO144_B13", gpio_in_pd), /* NFC_IRQ */
213 GPIO97_GPIO | PIN_OUTPUT_LOW, /* FORCE_SENSING_WU */ 339 DB8500_PIN_HOG("GPIO142_C11", gpio_out_lo), /* NFC_RESET */
214 340 /*
215 /* DiPro Sensor Interface */ 341 * SKE keyboard partly on alt A and partly on "Other alt C1"
216 GPIO139_GPIO | PIN_INPUT_PULLUP, /* DIPRO_INT */ 342 * Driver KP_O1,2,3,6,7 low and pull up KP_I 0,2,3 for three
217 343 * rows of 6 keys, then pull up force sensing interrup and
218 /* HAL SWITCH INTERFACE */ 344 * drive reset and force sensing WU low.
219 GPIO145_GPIO | PIN_INPUT_PULLDOWN,/* HAL_SW */ 345 */
220 346 DB8500_MUX_HOG("kp_a_1", "kp"),
221 /* Audio Amplifier Interface */ 347 DB8500_MUX_HOG("kp_oc1_1", "kp"),
222 GPIO149_GPIO | PIN_OUTPUT_LOW, /* VAUDIO_HF_EN */ 348 DB8500_PIN_HOG("GPIO90_A3", out_lo), /* KP_O1 */
223 349 DB8500_PIN_HOG("GPIO87_B3", out_lo), /* KP_O2 */
224 /* GBF INTERFACE */ 350 DB8500_PIN_HOG("GPIO86_C6", out_lo), /* KP_O3 */
225 GPIO171_GPIO | PIN_OUTPUT_LOW, /* GBF_ENA_RESET */ 351 DB8500_PIN_HOG("GPIO96_D8", out_lo), /* KP_O6 */
226 352 DB8500_PIN_HOG("GPIO94_D7", out_lo), /* KP_O7 */
227 /* MSP : HDTV INTERFACE */ 353 DB8500_PIN_HOG("GPIO93_B7", in_pu), /* KP_I0 */
228 GPIO192_GPIO | PIN_INPUT_PULLDOWN, 354 DB8500_PIN_HOG("GPIO89_E6", in_pu), /* KP_I2 */
229 355 DB8500_PIN_HOG("GPIO88_C4", in_pu), /* KP_I3 */
230 /* ACCELEROMETER_INTERFACE */ 356 DB8500_PIN_HOG("GPIO91_B6", gpio_in_pu), /* FORCE_SENSING_INT */
231 GPIO82_GPIO | PIN_INPUT_PULLUP, /* ACC_INT1 */ 357 DB8500_PIN_HOG("GPIO92_D6", gpio_out_lo), /* FORCE_SENSING_RST */
232 GPIO83_GPIO | PIN_INPUT_PULLUP, /* ACC_INT2 */ 358 DB8500_PIN_HOG("GPIO97_D9", gpio_out_lo), /* FORCE_SENSING_WU */
233 359 /* DiPro Sensor interrupt */
234 /* Proximity Sensor */ 360 DB8500_PIN_HOG("GPIO139_C9", gpio_in_pu), /* DIPRO_INT */
235 GPIO217_GPIO | PIN_INPUT_PULLUP, 361 /* Audio Amplifier HF enable */
236 362 DB8500_PIN_HOG("GPIO149_B14", gpio_out_hi), /* VAUDIO_HF_EN, enable MAX8968 */
237 363 /* GBF interface, pull low to reset state */
364 DB8500_PIN_HOG("GPIO171_D23", gpio_out_lo), /* GBF_ENA_RESET */
365 /* MSP : HDTV INTERFACE GPIO line */
366 DB8500_PIN_HOG("GPIO192_AJ27", gpio_in_pd),
367 /* Accelerometer interrupt lines */
368 DB8500_PIN_HOG("GPIO82_C1", gpio_in_pu), /* ACC_INT1 */
369 DB8500_PIN_HOG("GPIO83_D3", gpio_in_pu), /* ACC_INT2 */
370 /* SD card detect GPIO pin */
371 DB8500_PIN_HOG("GPIO95_E8", gpio_in_pu),
372 /*
373 * Runtime stuff
374 * Pull up/down of some sensor GPIO pins, for proximity, HAL sensor
375 * etc.
376 */
377 DB8500_PIN("GPIO217_AH12", gpio_in_pu_slpm_gpio_nopull, "gpio-keys.0"),
378 DB8500_PIN("GPIO145_C13", gpio_in_pd_slpm_gpio_nopull, "gpio-keys.0"),
379 DB8500_PIN("GPIO139_C9", gpio_in_pu_slpm_gpio_nopull, "gpio-keys.0"),
380 /*
381 * Make it possible to mux in the SKE keypad and bias the pins
382 * FIXME: what's the point with this on HREFv60? KP/SKE is already
383 * muxed in at another place! Enabling this will bork.
384 */
385 DB8500_MUX("kp_a_2", "kp", "ske"),
386 DB8500_PIN("GPIO153_B17", in_pd_slpm_in_pu, "ske"), /* I7 */
387 DB8500_PIN("GPIO154_C16", in_pd_slpm_in_pu, "ske"), /* I6 */
388 DB8500_PIN("GPIO155_C19", in_pd_slpm_in_pu, "ske"), /* I5 */
389 DB8500_PIN("GPIO156_C17", in_pd_slpm_in_pu, "ske"), /* I4 */
390 DB8500_PIN("GPIO161_D21", in_pd_slpm_in_pu, "ske"), /* I3 */
391 DB8500_PIN("GPIO162_D20", in_pd_slpm_in_pu, "ske"), /* I2 */
392 DB8500_PIN("GPIO163_C20", in_pd_slpm_in_pu, "ske"), /* I1 */
393 DB8500_PIN("GPIO164_B21", in_pd_slpm_in_pu, "ske"), /* I0 */
394 DB8500_PIN("GPIO157_A18", in_pu_slpm_out_lo, "ske"), /* O7 */
395 DB8500_PIN("GPIO158_C18", in_pu_slpm_out_lo, "ske"), /* O6 */
396 DB8500_PIN("GPIO159_B19", in_pu_slpm_out_lo, "ske"), /* O5 */
397 DB8500_PIN("GPIO160_B20", in_pu_slpm_out_lo, "ske"), /* O4 */
398 DB8500_PIN("GPIO165_C21", in_pu_slpm_out_lo, "ske"), /* O3 */
399 DB8500_PIN("GPIO166_A22", in_pu_slpm_out_lo, "ske"), /* O2 */
400 DB8500_PIN("GPIO167_B24", in_pu_slpm_out_lo, "ske"), /* O1 */
401 DB8500_PIN("GPIO168_C22", in_pu_slpm_out_lo, "ske"), /* O0 */
238}; 402};
239 403
240static pin_cfg_t snowball_pins[] = { 404static struct pinctrl_map __initdata u9500_pinmap[] = {
241 /* SSP0, to AB8500 */ 405 /* Mux in UART1 (just RX/TX) and set the pull-ups */
242 GPIO143_SSP0_CLK, 406 DB8500_MUX_HOG("u1rxtx_a_1", "u1"),
243 GPIO144_SSP0_FRM, 407 DB8500_PIN_HOG("GPIO4_AH6", in_pu),
244 GPIO145_SSP0_RXD | PIN_PULL_DOWN, 408 DB8500_PIN_HOG("GPIO5_AG6", out_hi),
245 GPIO146_SSP0_TXD, 409 /* WLAN_IRQ line */
410 DB8500_PIN_HOG("GPIO144_B13", gpio_in_pu),
411 /* HSI */
412 DB8500_MUX_HOG("hsir_a_1", "hsi"),
413 DB8500_MUX_HOG("hsit_a_1", "hsi"),
414 DB8500_PIN_HOG("GPIO219_AG10", in_pd), /* RX FLA0 */
415 DB8500_PIN_HOG("GPIO220_AH10", in_pd), /* RX DAT0 */
416 DB8500_PIN_HOG("GPIO221_AJ11", out_lo), /* RX RDY0 */
417 DB8500_PIN_HOG("GPIO222_AJ9", out_lo), /* TX FLA0 */
418 DB8500_PIN_HOG("GPIO223_AH9", out_lo), /* TX DAT0 */
419 DB8500_PIN_HOG("GPIO224_AG9", in_pd), /* TX RDY0 */
420 DB8500_PIN_HOG("GPIO225_AG8", in_pd), /* CAWAKE0 */
421 DB8500_PIN_HOG("GPIO226_AF8", out_hi), /* ACWAKE0 */
422};
246 423
247 /* MMC0: MicroSD card */ 424static struct pinctrl_map __initdata u8500_pinmap[] = {
248 GPIO21_MC0_DAT31DIR | PIN_OUTPUT_HIGH, 425 DB8500_PIN_HOG("GPIO226_AF8", gpio_out_lo), /* WLAN_PMU_EN */
426 DB8500_PIN_HOG("GPIO4_AH6", gpio_in_pu), /* WLAN_IRQ */
427};
249 428
250 /* MMC2: LAN */ 429static struct pinctrl_map __initdata snowball_pinmap[] = {
251 GPIO86_SM_ADQ0, 430 /* Mux in SSP0 connected to AB8500, pull down RXD pin */
252 GPIO87_SM_ADQ1, 431 DB8500_MUX_HOG("ssp0_a_1", "ssp0"),
253 GPIO88_SM_ADQ2, 432 DB8500_PIN_HOG("GPIO145_C13", pd),
254 GPIO89_SM_ADQ3, 433 /* Always drive the MC0 DAT31DIR line high on these boards */
255 GPIO90_SM_ADQ4, 434 DB8500_PIN_HOG("GPIO21_AB3", out_hi),
256 GPIO91_SM_ADQ5, 435 /* Mux in "SM" which is used for the SMSC911x Ethernet adapter */
257 GPIO92_SM_ADQ6, 436 DB8500_MUX_HOG("sm_b_1", "sm"),
258 GPIO93_SM_ADQ7, 437 /* Drive RSTn_LAN high */
438 DB8500_PIN_HOG("GPIO141_C12", gpio_out_hi),
439 /* Accelerometer/Magnetometer */
440 DB8500_PIN_HOG("GPIO163_C20", gpio_in_pu), /* ACCEL_IRQ1 */
441 DB8500_PIN_HOG("GPIO164_B21", gpio_in_pu), /* ACCEL_IRQ2 */
442 DB8500_PIN_HOG("GPIO165_C21", gpio_in_pu), /* MAG_DRDY */
443 /* WLAN/GBF */
444 DB8500_PIN_HOG("GPIO161_D21", gpio_out_lo), /* WLAN_PMU_EN */
445 DB8500_PIN_HOG("GPIO171_D23", gpio_out_hi), /* GBF_ENA */
446 DB8500_PIN_HOG("GPIO215_AH13", gpio_out_lo), /* WLAN_ENA */
447 DB8500_PIN_HOG("GPIO216_AG12", gpio_in_pu), /* WLAN_IRQ */
448};
259 449
260 GPIO94_SM_ADVn, 450/*
261 GPIO95_SM_CS0n, 451 * passing "pinsfor=" in kernel cmdline allows for custom
262 GPIO96_SM_OEn, 452 * configuration of GPIOs on u8500 derived boards.
263 GPIO97_SM_WEn, 453 */
454static int __init early_pinsfor(char *p)
455{
456 pinsfor = PINS_FOR_DEFAULT;
264 457
265 GPIO128_SM_CKO, 458 if (strcmp(p, "u9500-21") == 0)
266 GPIO130_SM_FBCLK, 459 pinsfor = PINS_FOR_U9500;
267 GPIO131_SM_ADQ8,
268 GPIO132_SM_ADQ9,
269 GPIO133_SM_ADQ10,
270 GPIO134_SM_ADQ11,
271 GPIO135_SM_ADQ12,
272 GPIO136_SM_ADQ13,
273 GPIO137_SM_ADQ14,
274 GPIO138_SM_ADQ15,
275 460
276 /* RSTn_LAN */ 461 return 0;
277 GPIO141_GPIO | PIN_OUTPUT_HIGH, 462}
278}; 463early_param("pinsfor", early_pinsfor);
279 464
280void __init mop500_pins_init(void) 465int pins_for_u9500(void)
281{ 466{
282 nmk_config_pins(mop500_pins_common, 467 if (pinsfor == PINS_FOR_U9500)
283 ARRAY_SIZE(mop500_pins_common)); 468 return 1;
284 469
285 nmk_config_pins(mop500_pins_default, 470 return 0;
286 ARRAY_SIZE(mop500_pins_default));
287} 471}
288 472
289void __init snowball_pins_init(void) 473static void __init mop500_href_family_pinmaps_init(void)
290{ 474{
291 nmk_config_pins(mop500_pins_common, 475 switch (pinsfor) {
292 ARRAY_SIZE(mop500_pins_common)); 476 case PINS_FOR_U9500:
477 pinctrl_register_mappings(u9500_pinmap,
478 ARRAY_SIZE(u9500_pinmap));
479 break;
480 case PINS_FOR_DEFAULT:
481 pinctrl_register_mappings(u8500_pinmap,
482 ARRAY_SIZE(u8500_pinmap));
483 default:
484 break;
485 }
486}
293 487
294 nmk_config_pins(snowball_pins, 488void __init mop500_pinmaps_init(void)
295 ARRAY_SIZE(snowball_pins)); 489{
490 pinctrl_register_mappings(mop500_family_pinmap,
491 ARRAY_SIZE(mop500_family_pinmap));
492 pinctrl_register_mappings(mop500_pinmap,
493 ARRAY_SIZE(mop500_pinmap));
494 mop500_href_family_pinmaps_init();
296} 495}
297 496
298void __init hrefv60_pins_init(void) 497void __init snowball_pinmaps_init(void)
299{ 498{
300 nmk_config_pins(mop500_pins_common, 499 pinctrl_register_mappings(mop500_family_pinmap,
301 ARRAY_SIZE(mop500_pins_common)); 500 ARRAY_SIZE(mop500_family_pinmap));
501 pinctrl_register_mappings(snowball_pinmap,
502 ARRAY_SIZE(snowball_pinmap));
503 pinctrl_register_mappings(u8500_pinmap,
504 ARRAY_SIZE(u8500_pinmap));
505}
302 506
303 nmk_config_pins(hrefv60_pins, 507void __init hrefv60_pinmaps_init(void)
304 ARRAY_SIZE(hrefv60_pins)); 508{
509 pinctrl_register_mappings(mop500_family_pinmap,
510 ARRAY_SIZE(mop500_family_pinmap));
511 pinctrl_register_mappings(hrefv60_pinmap,
512 ARRAY_SIZE(hrefv60_pinmap));
513 mop500_href_family_pinmaps_init();
305} 514}
diff --git a/arch/arm/mach-ux500/board-mop500-uib.c b/arch/arm/mach-ux500/board-mop500-uib.c
index 5af36aa56c08..b29a788f498c 100644
--- a/arch/arm/mach-ux500/board-mop500-uib.c
+++ b/arch/arm/mach-ux500/board-mop500-uib.c
@@ -102,7 +102,7 @@ static int __init mop500_uib_init(void)
102 struct i2c_adapter *i2c0; 102 struct i2c_adapter *i2c0;
103 int ret; 103 int ret;
104 104
105 if (!cpu_is_u8500()) 105 if (!cpu_is_u8500_family())
106 return -ENODEV; 106 return -ENODEV;
107 107
108 if (uib) { 108 if (uib) {
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 77d03c1fbd04..4bc0cbc5f071 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -1,3 +1,4 @@
1
1/* 2/*
2 * Copyright (C) 2008-2009 ST-Ericsson 3 * Copyright (C) 2008-2009 ST-Ericsson
3 * 4 *
@@ -29,18 +30,17 @@
29#include <linux/smsc911x.h> 30#include <linux/smsc911x.h>
30#include <linux/gpio_keys.h> 31#include <linux/gpio_keys.h>
31#include <linux/delay.h> 32#include <linux/delay.h>
32
33#include <linux/of.h> 33#include <linux/of.h>
34#include <linux/of_platform.h> 34#include <linux/of_platform.h>
35
36#include <linux/leds.h> 35#include <linux/leds.h>
36#include <linux/pinctrl/consumer.h>
37
37#include <asm/mach-types.h> 38#include <asm/mach-types.h>
38#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
39#include <asm/hardware/gic.h> 40#include <asm/hardware/gic.h>
40 41
41#include <plat/i2c.h> 42#include <plat/i2c.h>
42#include <plat/ste_dma40.h> 43#include <plat/ste_dma40.h>
43#include <plat/pincfg.h>
44#include <plat/gpio-nomadik.h> 44#include <plat/gpio-nomadik.h>
45 45
46#include <mach/hardware.h> 46#include <mach/hardware.h>
@@ -48,11 +48,11 @@
48#include <mach/devices.h> 48#include <mach/devices.h>
49#include <mach/irqs.h> 49#include <mach/irqs.h>
50 50
51#include "pins-db8500.h"
52#include "ste-dma40-db8500.h" 51#include "ste-dma40-db8500.h"
53#include "devices-db8500.h" 52#include "devices-db8500.h"
54#include "board-mop500.h" 53#include "board-mop500.h"
55#include "board-mop500-regulators.h" 54#include "board-mop500-regulators.h"
55#include "board-mop500-msp.h"
56 56
57static struct gpio_led snowball_led_array[] = { 57static struct gpio_led snowball_led_array[] = {
58 { 58 {
@@ -520,14 +520,6 @@ static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
520}; 520};
521#endif 521#endif
522 522
523
524static pin_cfg_t mop500_pins_uart0[] = {
525 GPIO0_U0_CTSn | PIN_INPUT_PULLUP,
526 GPIO1_U0_RTSn | PIN_OUTPUT_HIGH,
527 GPIO2_U0_RXD | PIN_INPUT_PULLUP,
528 GPIO3_U0_TXD | PIN_OUTPUT_HIGH,
529};
530
531#define PRCC_K_SOFTRST_SET 0x18 523#define PRCC_K_SOFTRST_SET 0x18
532#define PRCC_K_SOFTRST_CLEAR 0x1C 524#define PRCC_K_SOFTRST_CLEAR 0x1C
533static void ux500_uart0_reset(void) 525static void ux500_uart0_reset(void)
@@ -548,24 +540,33 @@ static void ux500_uart0_reset(void)
548 udelay(1); 540 udelay(1);
549} 541}
550 542
543/* This needs to be referenced by callbacks */
544struct pinctrl *u0_p;
545struct pinctrl_state *u0_def;
546struct pinctrl_state *u0_sleep;
547
551static void ux500_uart0_init(void) 548static void ux500_uart0_init(void)
552{ 549{
553 int ret; 550 int ret;
554 551
555 ret = nmk_config_pins(mop500_pins_uart0, 552 if (IS_ERR(u0_p) || IS_ERR(u0_def))
556 ARRAY_SIZE(mop500_pins_uart0)); 553 return;
557 if (ret < 0) 554
558 pr_err("pl011: uart pins_enable failed\n"); 555 ret = pinctrl_select_state(u0_p, u0_def);
556 if (ret)
557 pr_err("could not set UART0 defstate\n");
559} 558}
560 559
561static void ux500_uart0_exit(void) 560static void ux500_uart0_exit(void)
562{ 561{
563 int ret; 562 int ret;
564 563
565 ret = nmk_config_pins_sleep(mop500_pins_uart0, 564 if (IS_ERR(u0_p) || IS_ERR(u0_sleep))
566 ARRAY_SIZE(mop500_pins_uart0)); 565 return;
567 if (ret < 0) 566
568 pr_err("pl011: uart pins_disable failed\n"); 567 ret = pinctrl_select_state(u0_p, u0_sleep);
568 if (ret)
569 pr_err("could not set UART0 idlestate\n");
569} 570}
570 571
571static struct amba_pl011_data uart0_plat = { 572static struct amba_pl011_data uart0_plat = {
@@ -597,7 +598,28 @@ static struct amba_pl011_data uart2_plat = {
597 598
598static void __init mop500_uart_init(struct device *parent) 599static void __init mop500_uart_init(struct device *parent)
599{ 600{
600 db8500_add_uart0(parent, &uart0_plat); 601 struct amba_device *uart0_device;
602
603 uart0_device = db8500_add_uart0(parent, &uart0_plat);
604 if (uart0_device) {
605 u0_p = pinctrl_get(&uart0_device->dev);
606 if (IS_ERR(u0_p))
607 dev_err(&uart0_device->dev,
608 "could not get UART0 pinctrl\n");
609 else {
610 u0_def = pinctrl_lookup_state(u0_p,
611 PINCTRL_STATE_DEFAULT);
612 if (IS_ERR(u0_def)) {
613 dev_err(&uart0_device->dev,
614 "could not get UART0 defstate\n");
615 }
616 u0_sleep = pinctrl_lookup_state(u0_p,
617 PINCTRL_STATE_SLEEP);
618 if (IS_ERR(u0_sleep))
619 dev_err(&uart0_device->dev,
620 "could not get UART0 idlestate\n");
621 }
622 }
601 db8500_add_uart1(parent, &uart1_plat); 623 db8500_add_uart1(parent, &uart1_plat);
602 db8500_add_uart2(parent, &uart2_plat); 624 db8500_add_uart2(parent, &uart2_plat);
603} 625}
@@ -605,7 +627,6 @@ static void __init mop500_uart_init(struct device *parent)
605static struct platform_device *snowball_platform_devs[] __initdata = { 627static struct platform_device *snowball_platform_devs[] __initdata = {
606 &snowball_led_dev, 628 &snowball_led_dev,
607 &snowball_key_dev, 629 &snowball_key_dev,
608 &snowball_sbnet_dev,
609 &ab8500_device, 630 &ab8500_device,
610}; 631};
611 632
@@ -617,10 +638,9 @@ static void __init mop500_init_machine(void)
617 638
618 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; 639 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
619 640
641 mop500_pinmaps_init();
620 parent = u8500_init_devices(); 642 parent = u8500_init_devices();
621 643
622 mop500_pins_init();
623
624 /* FIXME: parent of ab8500 should be prcmu */ 644 /* FIXME: parent of ab8500 should be prcmu */
625 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++) 645 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
626 mop500_platform_devs[i]->dev.parent = parent; 646 mop500_platform_devs[i]->dev.parent = parent;
@@ -631,6 +651,7 @@ static void __init mop500_init_machine(void)
631 mop500_i2c_init(parent); 651 mop500_i2c_init(parent);
632 mop500_sdi_init(parent); 652 mop500_sdi_init(parent);
633 mop500_spi_init(parent); 653 mop500_spi_init(parent);
654 mop500_msp_init(parent);
634 mop500_uart_init(parent); 655 mop500_uart_init(parent);
635 656
636 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); 657 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
@@ -646,13 +667,11 @@ static void __init mop500_init_machine(void)
646static void __init snowball_init_machine(void) 667static void __init snowball_init_machine(void)
647{ 668{
648 struct device *parent = NULL; 669 struct device *parent = NULL;
649 int i2c0_devs;
650 int i; 670 int i;
651 671
672 snowball_pinmaps_init();
652 parent = u8500_init_devices(); 673 parent = u8500_init_devices();
653 674
654 snowball_pins_init();
655
656 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++) 675 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
657 snowball_platform_devs[i]->dev.parent = parent; 676 snowball_platform_devs[i]->dev.parent = parent;
658 677
@@ -662,13 +681,9 @@ static void __init snowball_init_machine(void)
662 mop500_i2c_init(parent); 681 mop500_i2c_init(parent);
663 snowball_sdi_init(parent); 682 snowball_sdi_init(parent);
664 mop500_spi_init(parent); 683 mop500_spi_init(parent);
684 mop500_msp_init(parent);
665 mop500_uart_init(parent); 685 mop500_uart_init(parent);
666 686
667 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
668 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
669 i2c_register_board_info(2, mop500_i2c2_devices,
670 ARRAY_SIZE(mop500_i2c2_devices));
671
672 /* This board has full regulator constraints */ 687 /* This board has full regulator constraints */
673 regulator_has_full_constraints(); 688 regulator_has_full_constraints();
674} 689}
@@ -686,10 +701,9 @@ static void __init hrefv60_init_machine(void)
686 */ 701 */
687 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; 702 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
688 703
704 hrefv60_pinmaps_init();
689 parent = u8500_init_devices(); 705 parent = u8500_init_devices();
690 706
691 hrefv60_pins_init();
692
693 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++) 707 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
694 mop500_platform_devs[i]->dev.parent = parent; 708 mop500_platform_devs[i]->dev.parent = parent;
695 709
@@ -699,6 +713,7 @@ static void __init hrefv60_init_machine(void)
699 mop500_i2c_init(parent); 713 mop500_i2c_init(parent);
700 hrefv60_sdi_init(parent); 714 hrefv60_sdi_init(parent);
701 mop500_spi_init(parent); 715 mop500_spi_init(parent);
716 mop500_msp_init(parent);
702 mop500_uart_init(parent); 717 mop500_uart_init(parent);
703 718
704 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); 719 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
@@ -746,16 +761,29 @@ MACHINE_END
746#ifdef CONFIG_MACH_UX500_DT 761#ifdef CONFIG_MACH_UX500_DT
747 762
748struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { 763struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
764 /* Requires DMA and call-back bindings. */
749 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat), 765 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
750 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat), 766 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat),
751 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat), 767 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat),
768 /* Requires DMA bindings. */
752 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat), 769 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat),
770 /* Requires clock name bindings. */
771 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL),
772 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e080, "gpio.1", NULL),
773 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e000, "gpio.2", NULL),
774 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e080, "gpio.3", NULL),
775 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e100, "gpio.4", NULL),
776 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8000e180, "gpio.5", NULL),
777 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e000, "gpio.6", NULL),
778 OF_DEV_AUXDATA("st,nomadik-gpio", 0x8011e080, "gpio.7", NULL),
779 OF_DEV_AUXDATA("st,nomadik-gpio", 0xa03fe000, "gpio.8", NULL),
753 {}, 780 {},
754}; 781};
755 782
756static const struct of_device_id u8500_soc_node[] = { 783static const struct of_device_id u8500_local_bus_nodes[] = {
757 /* only create devices below soc node */ 784 /* only create devices below soc node */
758 { .compatible = "stericsson,db8500", }, 785 { .compatible = "stericsson,db8500", },
786 { .compatible = "simple-bus"},
759 { }, 787 { },
760}; 788};
761 789
@@ -765,8 +793,15 @@ static void __init u8500_init_machine(void)
765 int i2c0_devs; 793 int i2c0_devs;
766 int i; 794 int i;
767 795
796 /* Pinmaps must be in place before devices register */
797 if (of_machine_is_compatible("st-ericsson,mop500"))
798 mop500_pinmaps_init();
799 else if (of_machine_is_compatible("calaosystems,snowball-a9500"))
800 snowball_pinmaps_init();
801 else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
802 hrefv60_pinmaps_init();
803
768 parent = u8500_init_devices(); 804 parent = u8500_init_devices();
769 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
770 805
771 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++) 806 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
772 mop500_platform_devs[i]->dev.parent = parent; 807 mop500_platform_devs[i]->dev.parent = parent;
@@ -774,18 +809,22 @@ static void __init u8500_init_machine(void)
774 snowball_platform_devs[i]->dev.parent = parent; 809 snowball_platform_devs[i]->dev.parent = parent;
775 810
776 /* automatically probe child nodes of db8500 device */ 811 /* automatically probe child nodes of db8500 device */
777 of_platform_populate(NULL, u8500_soc_node, u8500_auxdata_lookup, parent); 812 of_platform_populate(NULL, u8500_local_bus_nodes, u8500_auxdata_lookup, parent);
778 813
779 if (of_machine_is_compatible("st-ericsson,mop500")) { 814 if (of_machine_is_compatible("st-ericsson,mop500")) {
780 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; 815 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
781 mop500_pins_init();
782 816
783 platform_add_devices(mop500_platform_devs, 817 platform_add_devices(mop500_platform_devs,
784 ARRAY_SIZE(mop500_platform_devs)); 818 ARRAY_SIZE(mop500_platform_devs));
785 819
786 mop500_sdi_init(parent); 820 mop500_sdi_init(parent);
821
822 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
823 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
824 i2c_register_board_info(2, mop500_i2c2_devices,
825 ARRAY_SIZE(mop500_i2c2_devices));
826
787 } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) { 827 } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
788 snowball_pins_init();
789 platform_add_devices(snowball_platform_devs, 828 platform_add_devices(snowball_platform_devs,
790 ARRAY_SIZE(snowball_platform_devs)); 829 ARRAY_SIZE(snowball_platform_devs));
791 830
@@ -797,19 +836,20 @@ static void __init u8500_init_machine(void)
797 * instead. 836 * instead.
798 */ 837 */
799 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; 838 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
800 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
801 hrefv60_pins_init();
802 platform_add_devices(mop500_platform_devs, 839 platform_add_devices(mop500_platform_devs,
803 ARRAY_SIZE(mop500_platform_devs)); 840 ARRAY_SIZE(mop500_platform_devs));
804 841
805 hrefv60_sdi_init(parent); 842 hrefv60_sdi_init(parent);
843
844 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
845 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
846
847 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
848 i2c_register_board_info(2, mop500_i2c2_devices,
849 ARRAY_SIZE(mop500_i2c2_devices));
806 } 850 }
807 mop500_i2c_init(parent); 851 mop500_i2c_init(parent);
808 852
809 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
810 i2c_register_board_info(2, mop500_i2c2_devices,
811 ARRAY_SIZE(mop500_i2c2_devices));
812
813 /* This board has full regulator constraints */ 853 /* This board has full regulator constraints */
814 regulator_has_full_constraints(); 854 regulator_has_full_constraints();
815} 855}
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h
index fdcfa8721bb4..bc44c07c71a9 100644
--- a/arch/arm/mach-ux500/board-mop500.h
+++ b/arch/arm/mach-ux500/board-mop500.h
@@ -7,6 +7,9 @@
7#ifndef __BOARD_MOP500_H 7#ifndef __BOARD_MOP500_H
8#define __BOARD_MOP500_H 8#define __BOARD_MOP500_H
9 9
10/* For NOMADIK_NR_GPIO */
11#include <mach/irqs.h>
12
10/* Snowball specific GPIO assignments, this board has no GPIO expander */ 13/* Snowball specific GPIO assignments, this board has no GPIO expander */
11#define SNOWBALL_ACCEL_INT1_GPIO 163 14#define SNOWBALL_ACCEL_INT1_GPIO 163
12#define SNOWBALL_ACCEL_INT2_GPIO 164 15#define SNOWBALL_ACCEL_INT2_GPIO 164
@@ -73,6 +76,7 @@
73#define SNOWBALL_PME_ETH_GPIO MOP500_AB8500_PIN_GPIO(24) /* SYSCLKREQ7/GPIO24 */ 76#define SNOWBALL_PME_ETH_GPIO MOP500_AB8500_PIN_GPIO(24) /* SYSCLKREQ7/GPIO24 */
74#define SNOWBALL_EN_3V3_ETH_GPIO MOP500_AB8500_PIN_GPIO(26) /* GPIO26 */ 77#define SNOWBALL_EN_3V3_ETH_GPIO MOP500_AB8500_PIN_GPIO(26) /* GPIO26 */
75 78
79struct device;
76struct i2c_board_info; 80struct i2c_board_info;
77 81
78extern void mop500_sdi_init(struct device *parent); 82extern void mop500_sdi_init(struct device *parent);
@@ -81,9 +85,9 @@ extern void hrefv60_sdi_init(struct device *parent);
81extern void mop500_sdi_tc35892_init(struct device *parent); 85extern void mop500_sdi_tc35892_init(struct device *parent);
82void __init mop500_u8500uib_init(void); 86void __init mop500_u8500uib_init(void);
83void __init mop500_stuib_init(void); 87void __init mop500_stuib_init(void);
84void __init mop500_pins_init(void); 88void __init mop500_pinmaps_init(void);
85void __init hrefv60_pins_init(void); 89void __init snowball_pinmaps_init(void);
86void __init snowball_pins_init(void); 90void __init hrefv60_pinmaps_init(void);
87 91
88void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info, 92void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info,
89 unsigned n); 93 unsigned n);
diff --git a/arch/arm/mach-ux500/board-u5500-sdi.c b/arch/arm/mach-ux500/board-u5500-sdi.c
deleted file mode 100644
index 836112eedde7..000000000000
--- a/arch/arm/mach-ux500/board-u5500-sdi.c
+++ /dev/null
@@ -1,74 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Hanumath Prasad <ulf.hansson@stericsson.com>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#include <linux/amba/mmci.h>
9#include <linux/mmc/host.h>
10
11#include <plat/pincfg.h>
12#include <plat/gpio-nomadik.h>
13#include <mach/db5500-regs.h>
14#include <plat/ste_dma40.h>
15
16#include "pins-db5500.h"
17#include "devices-db5500.h"
18#include "ste-dma40-db5500.h"
19
20static pin_cfg_t u5500_sdi_pins[] = {
21 /* SDI0 (POP eMMC) */
22 GPIO5_MC0_DAT0 | PIN_DIR_INPUT | PIN_PULL_UP,
23 GPIO6_MC0_DAT1 | PIN_DIR_INPUT | PIN_PULL_UP,
24 GPIO7_MC0_DAT2 | PIN_DIR_INPUT | PIN_PULL_UP,
25 GPIO8_MC0_DAT3 | PIN_DIR_INPUT | PIN_PULL_UP,
26 GPIO9_MC0_DAT4 | PIN_DIR_INPUT | PIN_PULL_UP,
27 GPIO10_MC0_DAT5 | PIN_DIR_INPUT | PIN_PULL_UP,
28 GPIO11_MC0_DAT6 | PIN_DIR_INPUT | PIN_PULL_UP,
29 GPIO12_MC0_DAT7 | PIN_DIR_INPUT | PIN_PULL_UP,
30 GPIO13_MC0_CMD | PIN_DIR_INPUT | PIN_PULL_UP,
31 GPIO14_MC0_CLK | PIN_DIR_OUTPUT | PIN_VAL_LOW,
32};
33
34#ifdef CONFIG_STE_DMA40
35struct stedma40_chan_cfg u5500_sdi0_dma_cfg_rx = {
36 .mode = STEDMA40_MODE_LOGICAL,
37 .dir = STEDMA40_PERIPH_TO_MEM,
38 .src_dev_type = DB5500_DMA_DEV24_SDMMC0_RX,
39 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
40 .src_info.data_width = STEDMA40_WORD_WIDTH,
41 .dst_info.data_width = STEDMA40_WORD_WIDTH,
42};
43
44static struct stedma40_chan_cfg u5500_sdi0_dma_cfg_tx = {
45 .mode = STEDMA40_MODE_LOGICAL,
46 .dir = STEDMA40_MEM_TO_PERIPH,
47 .src_dev_type = STEDMA40_DEV_SRC_MEMORY,
48 .dst_dev_type = DB5500_DMA_DEV24_SDMMC0_TX,
49 .src_info.data_width = STEDMA40_WORD_WIDTH,
50 .dst_info.data_width = STEDMA40_WORD_WIDTH,
51};
52#endif
53
54static struct mmci_platform_data u5500_sdi0_data = {
55 .ocr_mask = MMC_VDD_165_195,
56 .f_max = 50000000,
57 .capabilities = MMC_CAP_4_BIT_DATA |
58 MMC_CAP_8_BIT_DATA |
59 MMC_CAP_MMC_HIGHSPEED,
60 .gpio_cd = -1,
61 .gpio_wp = -1,
62#ifdef CONFIG_STE_DMA40
63 .dma_filter = stedma40_filter,
64 .dma_rx_param = &u5500_sdi0_dma_cfg_rx,
65 .dma_tx_param = &u5500_sdi0_dma_cfg_tx,
66#endif
67};
68
69void __init u5500_sdi_init(struct device *parent)
70{
71 nmk_config_pins(u5500_sdi_pins, ARRAY_SIZE(u5500_sdi_pins));
72
73 db5500_add_sdi0(parent, &u5500_sdi0_data);
74}
diff --git a/arch/arm/mach-ux500/board-u5500.c b/arch/arm/mach-ux500/board-u5500.c
deleted file mode 100644
index 0ff4be72a809..000000000000
--- a/arch/arm/mach-ux500/board-u5500.c
+++ /dev/null
@@ -1,162 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#include <linux/init.h>
9#include <linux/platform_device.h>
10#include <linux/amba/bus.h>
11#include <linux/irq.h>
12#include <linux/i2c.h>
13#include <linux/mfd/abx500/ab5500.h>
14
15#include <asm/hardware/gic.h>
16#include <asm/mach/arch.h>
17#include <asm/mach-types.h>
18
19#include <plat/pincfg.h>
20#include <plat/i2c.h>
21#include <plat/gpio-nomadik.h>
22
23#include <mach/hardware.h>
24#include <mach/devices.h>
25#include <mach/setup.h>
26
27#include "pins-db5500.h"
28#include "devices-db5500.h"
29#include <linux/led-lm3530.h>
30
31/*
32 * GPIO
33 */
34
35static pin_cfg_t u5500_pins[] = {
36 /* I2C */
37 GPIO218_I2C2_SCL | PIN_INPUT_PULLUP,
38 GPIO219_I2C2_SDA | PIN_INPUT_PULLUP,
39
40 /* DISPLAY_ENABLE */
41 GPIO226_GPIO | PIN_OUTPUT_LOW,
42
43 /* Backlight Enbale */
44 GPIO224_GPIO | PIN_OUTPUT_HIGH,
45};
46/*
47 * I2C
48 */
49
50#define U5500_I2C_CONTROLLER(id, _slsu, _tft, _rft, clk, _sm) \
51static struct nmk_i2c_controller u5500_i2c##id##_data = { \
52 /* \
53 * slave data setup time, which is \
54 * 250 ns,100ns,10ns which is 14,6,2 \
55 * respectively for a 48 Mhz \
56 * i2c clock \
57 */ \
58 .slsu = _slsu, \
59 /* Tx FIFO threshold */ \
60 .tft = _tft, \
61 /* Rx FIFO threshold */ \
62 .rft = _rft, \
63 /* std. mode operation */ \
64 .clk_freq = clk, \
65 .sm = _sm, \
66}
67/*
68 * The board uses TODO <3> i2c controllers, initialize all of
69 * them with slave data setup time of 250 ns,
70 * Tx & Rx FIFO threshold values as 1 and standard
71 * mode of operation
72 */
73
74U5500_I2C_CONTROLLER(2, 0xe, 1, 1, 400000, I2C_FREQ_MODE_FAST);
75
76static struct lm3530_platform_data u5500_als_platform_data = {
77 .mode = LM3530_BL_MODE_MANUAL,
78 .als_input_mode = LM3530_INPUT_ALS1,
79 .max_current = LM3530_FS_CURR_26mA,
80 .pwm_pol_hi = true,
81 .als_avrg_time = LM3530_ALS_AVRG_TIME_512ms,
82 .brt_ramp_law = 1, /* Linear */
83 .brt_ramp_fall = LM3530_RAMP_TIME_8s,
84 .brt_ramp_rise = LM3530_RAMP_TIME_8s,
85 .als1_resistor_sel = LM3530_ALS_IMPD_13_53kOhm,
86 .als2_resistor_sel = LM3530_ALS_IMPD_Z,
87 .als_vmin = 730, /* mV */
88 .als_vmax = 1020, /* mV */
89 .brt_val = 0x7F, /* Max brightness */
90};
91
92static struct i2c_board_info __initdata u5500_i2c2_devices[] = {
93 {
94 /* Backlight */
95 I2C_BOARD_INFO("lm3530-led", 0x36),
96 .platform_data = &u5500_als_platform_data,
97 },
98};
99
100static void __init u5500_i2c_init(struct device *parent)
101{
102 db5500_add_i2c2(parent, &u5500_i2c2_data);
103 i2c_register_board_info(2, ARRAY_AND_SIZE(u5500_i2c2_devices));
104}
105
106static struct ab5500_platform_data ab5500_plf_data = {
107 .irq = {
108 .base = 0,
109 .count = 0,
110 },
111 .init_settings = NULL,
112 .init_settings_sz = 0,
113 .pm_power_off = false,
114};
115
116static struct platform_device ab5500_device = {
117 .name = "ab5500-core",
118 .id = 0,
119 .dev = {
120 .platform_data = &ab5500_plf_data,
121 },
122 .num_resources = 0,
123};
124
125static struct platform_device *u5500_platform_devices[] __initdata = {
126 &ab5500_device,
127};
128
129static void __init u5500_uart_init(struct device *parent)
130{
131 db5500_add_uart0(parent, NULL);
132 db5500_add_uart1(parent, NULL);
133 db5500_add_uart2(parent, NULL);
134}
135
136static void __init u5500_init_machine(void)
137{
138 struct device *parent = NULL;
139 int i;
140
141 parent = u5500_init_devices();
142 nmk_config_pins(u5500_pins, ARRAY_SIZE(u5500_pins));
143
144 u5500_i2c_init(parent);
145 u5500_sdi_init(parent);
146 u5500_uart_init(parent);
147
148 for (i = 0; i < ARRAY_SIZE(u5500_platform_devices); i++)
149 u5500_platform_devices[i]->dev.parent = parent;
150
151 platform_add_devices(u5500_platform_devices,
152 ARRAY_SIZE(u5500_platform_devices));
153}
154
155MACHINE_START(U5500, "ST-Ericsson U5500 Platform")
156 .atag_offset = 0x100,
157 .map_io = u5500_map_io,
158 .init_irq = ux500_init_irq,
159 .timer = &ux500_timer,
160 .handle_irq = gic_handle_irq,
161 .init_machine = u5500_init_machine,
162MACHINE_END
diff --git a/arch/arm/mach-ux500/cache-l2x0.c b/arch/arm/mach-ux500/cache-l2x0.c
index 77a75ed0df67..dc12394295d5 100644
--- a/arch/arm/mach-ux500/cache-l2x0.c
+++ b/arch/arm/mach-ux500/cache-l2x0.c
@@ -36,9 +36,9 @@ static int __init ux500_l2x0_unlock(void)
36 36
37static int __init ux500_l2x0_init(void) 37static int __init ux500_l2x0_init(void)
38{ 38{
39 if (cpu_is_u5500()) 39 u32 aux_val = 0x3e000000;
40 l2x0_base = __io_address(U5500_L2CC_BASE); 40
41 else if (cpu_is_u8500()) 41 if (cpu_is_u8500_family())
42 l2x0_base = __io_address(U8500_L2CC_BASE); 42 l2x0_base = __io_address(U8500_L2CC_BASE);
43 else 43 else
44 ux500_unknown_soc(); 44 ux500_unknown_soc();
@@ -46,11 +46,19 @@ static int __init ux500_l2x0_init(void)
46 /* Unlock before init */ 46 /* Unlock before init */
47 ux500_l2x0_unlock(); 47 ux500_l2x0_unlock();
48 48
49 /* DB9540's L2 has 128KB way size */
50 if (cpu_is_u9540())
51 /* 128KB way size */
52 aux_val |= (0x4 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT);
53 else
54 /* 64KB way size */
55 aux_val |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT);
56
49 /* 64KB way size, 8 way associativity, force WA */ 57 /* 64KB way size, 8 way associativity, force WA */
50 if (of_have_populated_dt()) 58 if (of_have_populated_dt())
51 l2x0_of_init(0x3e060000, 0xc0000fff); 59 l2x0_of_init(aux_val, 0xc0000fff);
52 else 60 else
53 l2x0_init(l2x0_base, 0x3e060000, 0xc0000fff); 61 l2x0_init(l2x0_base, aux_val, 0xc0000fff);
54 62
55 /* 63 /*
56 * We can't disable l2 as we are in non secure mode, currently 64 * We can't disable l2 as we are in non secure mode, currently
diff --git a/arch/arm/mach-ux500/clock.c b/arch/arm/mach-ux500/clock.c
index ec35f0aa5665..a121cb472dd6 100644
--- a/arch/arm/mach-ux500/clock.c
+++ b/arch/arm/mach-ux500/clock.c
@@ -149,9 +149,7 @@ static unsigned long clk_mtu_get_rate(struct clk *clk)
149 unsigned long mturate; 149 unsigned long mturate;
150 unsigned long retclk; 150 unsigned long retclk;
151 151
152 if (cpu_is_u5500()) 152 if (cpu_is_u8500_family())
153 addr = __io_address(U5500_PRCMU_BASE);
154 else if (cpu_is_u8500())
155 addr = __io_address(U8500_PRCMU_BASE); 153 addr = __io_address(U8500_PRCMU_BASE);
156 else 154 else
157 ux500_unknown_soc(); 155 ux500_unknown_soc();
@@ -336,6 +334,7 @@ static DEFINE_PRCMU_CLK(uiccclk, 0x4, 1, UICCCLK); /* v1 */
336 */ 334 */
337 335
338/* Peripheral Cluster #1 */ 336/* Peripheral Cluster #1 */
337static DEFINE_PRCC_CLK(1, msp3, 11, 10, &clk_msp1clk);
339static DEFINE_PRCC_CLK(1, i2c4, 10, 9, &clk_i2cclk); 338static DEFINE_PRCC_CLK(1, i2c4, 10, 9, &clk_i2cclk);
340static DEFINE_PRCC_CLK(1, gpio0, 9, -1, NULL); 339static DEFINE_PRCC_CLK(1, gpio0, 9, -1, NULL);
341static DEFINE_PRCC_CLK(1, slimbus0, 8, 8, &clk_slimclk); 340static DEFINE_PRCC_CLK(1, slimbus0, 8, 8, &clk_slimclk);
@@ -405,7 +404,7 @@ static struct clk_lookup u8500_clks[] = {
405 CLK(slimbus0, "slimbus0", NULL), 404 CLK(slimbus0, "slimbus0", NULL),
406 CLK(i2c2, "nmk-i2c.2", NULL), 405 CLK(i2c2, "nmk-i2c.2", NULL),
407 CLK(sdi0, "sdi0", NULL), 406 CLK(sdi0, "sdi0", NULL),
408 CLK(msp0, "msp0", NULL), 407 CLK(msp0, "ux500-msp-i2s.0", NULL),
409 CLK(i2c1, "nmk-i2c.1", NULL), 408 CLK(i2c1, "nmk-i2c.1", NULL),
410 CLK(uart1, "uart1", NULL), 409 CLK(uart1, "uart1", NULL),
411 CLK(uart0, "uart0", NULL), 410 CLK(uart0, "uart0", NULL),
@@ -455,7 +454,8 @@ static struct clk_lookup u8500_clks[] = {
455 /* Peripheral Cluster #1 */ 454 /* Peripheral Cluster #1 */
456 CLK(i2c4, "nmk-i2c.4", NULL), 455 CLK(i2c4, "nmk-i2c.4", NULL),
457 CLK(spi3, "spi3", NULL), 456 CLK(spi3, "spi3", NULL),
458 CLK(msp1, "msp1", NULL), 457 CLK(msp1, "ux500-msp-i2s.1", NULL),
458 CLK(msp3, "ux500-msp-i2s.3", NULL),
459 459
460 /* Peripheral Cluster #2 */ 460 /* Peripheral Cluster #2 */
461 CLK(gpio1, "gpio.6", NULL), 461 CLK(gpio1, "gpio.6", NULL),
@@ -465,7 +465,7 @@ static struct clk_lookup u8500_clks[] = {
465 CLK(spi0, "spi0", NULL), 465 CLK(spi0, "spi0", NULL),
466 CLK(sdi3, "sdi3", NULL), 466 CLK(sdi3, "sdi3", NULL),
467 CLK(sdi1, "sdi1", NULL), 467 CLK(sdi1, "sdi1", NULL),
468 CLK(msp2, "msp2", NULL), 468 CLK(msp2, "ux500-msp-i2s.2", NULL),
469 CLK(sdi4, "sdi4", NULL), 469 CLK(sdi4, "sdi4", NULL),
470 CLK(pwl, "pwl", NULL), 470 CLK(pwl, "pwl", NULL),
471 CLK(spi1, "spi1", NULL), 471 CLK(spi1, "spi1", NULL),
@@ -705,14 +705,6 @@ late_initcall(clk_init_smp_twd_cpufreq);
705 705
706int __init clk_init(void) 706int __init clk_init(void)
707{ 707{
708 if (cpu_is_u5500()) {
709 /* Clock tree for U5500 not implemented yet */
710 clk_prcc_ops.enable = clk_prcc_ops.disable = NULL;
711 clk_prcmu_ops.enable = clk_prcmu_ops.disable = NULL;
712 clk_uartclk.rate = 36360000;
713 clk_sdmmcclk.rate = 99900000;
714 }
715
716 clkdev_add_table(u8500_clks, ARRAY_SIZE(u8500_clks)); 708 clkdev_add_table(u8500_clks, ARRAY_SIZE(u8500_clks));
717 clkdev_add(&clk_smp_twd_lookup); 709 clkdev_add(&clk_smp_twd_lookup);
718 710
diff --git a/arch/arm/mach-ux500/cpu-db5500.c b/arch/arm/mach-ux500/cpu-db5500.c
deleted file mode 100644
index bca47f32082f..000000000000
--- a/arch/arm/mach-ux500/cpu-db5500.c
+++ /dev/null
@@ -1,247 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#include <linux/platform_device.h>
9#include <linux/amba/bus.h>
10#include <linux/io.h>
11#include <linux/irq.h>
12
13#include <asm/mach/map.h>
14#include <asm/pmu.h>
15
16#include <plat/gpio-nomadik.h>
17
18#include <mach/hardware.h>
19#include <mach/devices.h>
20#include <mach/setup.h>
21#include <mach/irqs.h>
22#include <mach/usb.h>
23
24#include "devices-db5500.h"
25#include "ste-dma40-db5500.h"
26
27static struct map_desc u5500_uart_io_desc[] __initdata = {
28 __IO_DEV_DESC(U5500_UART0_BASE, SZ_4K),
29 __IO_DEV_DESC(U5500_UART2_BASE, SZ_4K),
30};
31
32static struct map_desc u5500_io_desc[] __initdata = {
33 /* SCU base also covers GIC CPU BASE and TWD with its 4K page */
34 __IO_DEV_DESC(U5500_SCU_BASE, SZ_4K),
35 __IO_DEV_DESC(U5500_GIC_DIST_BASE, SZ_4K),
36 __IO_DEV_DESC(U5500_L2CC_BASE, SZ_4K),
37 __IO_DEV_DESC(U5500_MTU0_BASE, SZ_4K),
38 __IO_DEV_DESC(U5500_BACKUPRAM0_BASE, SZ_8K),
39
40 __IO_DEV_DESC(U5500_GPIO0_BASE, SZ_4K),
41 __IO_DEV_DESC(U5500_GPIO1_BASE, SZ_4K),
42 __IO_DEV_DESC(U5500_GPIO2_BASE, SZ_4K),
43 __IO_DEV_DESC(U5500_GPIO3_BASE, SZ_4K),
44 __IO_DEV_DESC(U5500_GPIO4_BASE, SZ_4K),
45 __IO_DEV_DESC(U5500_PRCMU_BASE, SZ_4K),
46 __IO_DEV_DESC(U5500_PRCMU_TCDM_BASE, SZ_4K),
47};
48
49static struct resource mbox0_resources[] = {
50 {
51 .name = "mbox_peer",
52 .start = U5500_MBOX0_PEER_START,
53 .end = U5500_MBOX0_PEER_END,
54 .flags = IORESOURCE_MEM,
55 },
56 {
57 .name = "mbox_local",
58 .start = U5500_MBOX0_LOCAL_START,
59 .end = U5500_MBOX0_LOCAL_END,
60 .flags = IORESOURCE_MEM,
61 },
62 {
63 .name = "mbox_irq",
64 .start = MBOX_PAIR0_VIRT_IRQ,
65 .end = MBOX_PAIR0_VIRT_IRQ,
66 .flags = IORESOURCE_IRQ,
67 }
68};
69
70static struct resource mbox1_resources[] = {
71 {
72 .name = "mbox_peer",
73 .start = U5500_MBOX1_PEER_START,
74 .end = U5500_MBOX1_PEER_END,
75 .flags = IORESOURCE_MEM,
76 },
77 {
78 .name = "mbox_local",
79 .start = U5500_MBOX1_LOCAL_START,
80 .end = U5500_MBOX1_LOCAL_END,
81 .flags = IORESOURCE_MEM,
82 },
83 {
84 .name = "mbox_irq",
85 .start = MBOX_PAIR1_VIRT_IRQ,
86 .end = MBOX_PAIR1_VIRT_IRQ,
87 .flags = IORESOURCE_IRQ,
88 }
89};
90
91static struct resource mbox2_resources[] = {
92 {
93 .name = "mbox_peer",
94 .start = U5500_MBOX2_PEER_START,
95 .end = U5500_MBOX2_PEER_END,
96 .flags = IORESOURCE_MEM,
97 },
98 {
99 .name = "mbox_local",
100 .start = U5500_MBOX2_LOCAL_START,
101 .end = U5500_MBOX2_LOCAL_END,
102 .flags = IORESOURCE_MEM,
103 },
104 {
105 .name = "mbox_irq",
106 .start = MBOX_PAIR2_VIRT_IRQ,
107 .end = MBOX_PAIR2_VIRT_IRQ,
108 .flags = IORESOURCE_IRQ,
109 }
110};
111
112static struct platform_device mbox0_device = {
113 .id = 0,
114 .name = "mbox",
115 .resource = mbox0_resources,
116 .num_resources = ARRAY_SIZE(mbox0_resources),
117};
118
119static struct platform_device mbox1_device = {
120 .id = 1,
121 .name = "mbox",
122 .resource = mbox1_resources,
123 .num_resources = ARRAY_SIZE(mbox1_resources),
124};
125
126static struct platform_device mbox2_device = {
127 .id = 2,
128 .name = "mbox",
129 .resource = mbox2_resources,
130 .num_resources = ARRAY_SIZE(mbox2_resources),
131};
132
133static struct platform_device *db5500_platform_devs[] __initdata = {
134 &mbox0_device,
135 &mbox1_device,
136 &mbox2_device,
137};
138
139static resource_size_t __initdata db5500_gpio_base[] = {
140 U5500_GPIOBANK0_BASE,
141 U5500_GPIOBANK1_BASE,
142 U5500_GPIOBANK2_BASE,
143 U5500_GPIOBANK3_BASE,
144 U5500_GPIOBANK4_BASE,
145 U5500_GPIOBANK5_BASE,
146 U5500_GPIOBANK6_BASE,
147 U5500_GPIOBANK7_BASE,
148};
149
150static void __init db5500_add_gpios(struct device *parent)
151{
152 struct nmk_gpio_platform_data pdata = {
153 /* No custom data yet */
154 };
155
156 dbx500_add_gpios(parent, ARRAY_AND_SIZE(db5500_gpio_base),
157 IRQ_DB5500_GPIO0, &pdata);
158}
159
160void __init u5500_map_io(void)
161{
162 /*
163 * Map the UARTs early so that the DEBUG_LL stuff continues to work.
164 */
165 iotable_init(u5500_uart_io_desc, ARRAY_SIZE(u5500_uart_io_desc));
166
167 ux500_map_io();
168
169 iotable_init(u5500_io_desc, ARRAY_SIZE(u5500_io_desc));
170
171 _PRCMU_BASE = __io_address(U5500_PRCMU_BASE);
172}
173
174static void __init db5500_pmu_init(void)
175{
176 struct resource res[] = {
177 [0] = {
178 .start = IRQ_DB5500_PMU0,
179 .end = IRQ_DB5500_PMU0,
180 .flags = IORESOURCE_IRQ,
181 },
182 [1] = {
183 .start = IRQ_DB5500_PMU1,
184 .end = IRQ_DB5500_PMU1,
185 .flags = IORESOURCE_IRQ,
186 },
187 };
188
189 platform_device_register_simple("arm-pmu", ARM_PMU_DEVICE_CPU,
190 res, ARRAY_SIZE(res));
191}
192
193static int usb_db5500_rx_dma_cfg[] = {
194 DB5500_DMA_DEV4_USB_OTG_IEP_1_9,
195 DB5500_DMA_DEV5_USB_OTG_IEP_2_10,
196 DB5500_DMA_DEV6_USB_OTG_IEP_3_11,
197 DB5500_DMA_DEV20_USB_OTG_IEP_4_12,
198 DB5500_DMA_DEV21_USB_OTG_IEP_5_13,
199 DB5500_DMA_DEV22_USB_OTG_IEP_6_14,
200 DB5500_DMA_DEV23_USB_OTG_IEP_7_15,
201 DB5500_DMA_DEV38_USB_OTG_IEP_8
202};
203
204static int usb_db5500_tx_dma_cfg[] = {
205 DB5500_DMA_DEV4_USB_OTG_OEP_1_9,
206 DB5500_DMA_DEV5_USB_OTG_OEP_2_10,
207 DB5500_DMA_DEV6_USB_OTG_OEP_3_11,
208 DB5500_DMA_DEV20_USB_OTG_OEP_4_12,
209 DB5500_DMA_DEV21_USB_OTG_OEP_5_13,
210 DB5500_DMA_DEV22_USB_OTG_OEP_6_14,
211 DB5500_DMA_DEV23_USB_OTG_OEP_7_15,
212 DB5500_DMA_DEV38_USB_OTG_OEP_8
213};
214
215static const char *db5500_read_soc_id(void)
216{
217 return kasprintf(GFP_KERNEL, "u5500 currently unsupported\n");
218}
219
220static struct device * __init db5500_soc_device_init(void)
221{
222 const char *soc_id = db5500_read_soc_id();
223
224 return ux500_soc_device_init(soc_id);
225}
226
227struct device * __init u5500_init_devices(void)
228{
229 struct device *parent;
230 int i;
231
232 parent = db5500_soc_device_init();
233
234 db5500_add_gpios(parent);
235 db5500_pmu_init();
236 db5500_dma_init(parent);
237 db5500_add_rtc(parent);
238 db5500_add_usb(parent, usb_db5500_rx_dma_cfg, usb_db5500_tx_dma_cfg);
239
240 for (i = 0; i < ARRAY_SIZE(db5500_platform_devs); i++)
241 db5500_platform_devs[i]->dev.parent = parent;
242
243 platform_add_devices(db5500_platform_devs,
244 ARRAY_SIZE(db5500_platform_devs));
245
246 return parent;
247}
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index 9bd8163896cf..16169c4bf6ca 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -34,8 +34,8 @@ static struct map_desc u8500_uart_io_desc[] __initdata = {
34 __IO_DEV_DESC(U8500_UART0_BASE, SZ_4K), 34 __IO_DEV_DESC(U8500_UART0_BASE, SZ_4K),
35 __IO_DEV_DESC(U8500_UART2_BASE, SZ_4K), 35 __IO_DEV_DESC(U8500_UART2_BASE, SZ_4K),
36}; 36};
37 37/* U8500 and U9540 common io_desc */
38static struct map_desc u8500_io_desc[] __initdata = { 38static struct map_desc u8500_common_io_desc[] __initdata = {
39 /* SCU base also covers GIC CPU BASE and TWD with its 4K page */ 39 /* SCU base also covers GIC CPU BASE and TWD with its 4K page */
40 __IO_DEV_DESC(U8500_SCU_BASE, SZ_4K), 40 __IO_DEV_DESC(U8500_SCU_BASE, SZ_4K),
41 __IO_DEV_DESC(U8500_GIC_DIST_BASE, SZ_4K), 41 __IO_DEV_DESC(U8500_GIC_DIST_BASE, SZ_4K),
@@ -49,12 +49,23 @@ static struct map_desc u8500_io_desc[] __initdata = {
49 __IO_DEV_DESC(U8500_CLKRST5_BASE, SZ_4K), 49 __IO_DEV_DESC(U8500_CLKRST5_BASE, SZ_4K),
50 __IO_DEV_DESC(U8500_CLKRST6_BASE, SZ_4K), 50 __IO_DEV_DESC(U8500_CLKRST6_BASE, SZ_4K),
51 51
52 __IO_DEV_DESC(U8500_PRCMU_BASE, SZ_4K),
53 __IO_DEV_DESC(U8500_GPIO0_BASE, SZ_4K), 52 __IO_DEV_DESC(U8500_GPIO0_BASE, SZ_4K),
54 __IO_DEV_DESC(U8500_GPIO1_BASE, SZ_4K), 53 __IO_DEV_DESC(U8500_GPIO1_BASE, SZ_4K),
55 __IO_DEV_DESC(U8500_GPIO2_BASE, SZ_4K), 54 __IO_DEV_DESC(U8500_GPIO2_BASE, SZ_4K),
56 __IO_DEV_DESC(U8500_GPIO3_BASE, SZ_4K), 55 __IO_DEV_DESC(U8500_GPIO3_BASE, SZ_4K),
56};
57
58/* U8500 IO map specific description */
59static struct map_desc u8500_io_desc[] __initdata = {
60 __IO_DEV_DESC(U8500_PRCMU_BASE, SZ_4K),
57 __IO_DEV_DESC(U8500_PRCMU_TCDM_BASE, SZ_4K), 61 __IO_DEV_DESC(U8500_PRCMU_TCDM_BASE, SZ_4K),
62
63};
64
65/* U9540 IO map specific description */
66static struct map_desc u9540_io_desc[] __initdata = {
67 __IO_DEV_DESC(U8500_PRCMU_BASE, SZ_4K + SZ_8K),
68 __IO_DEV_DESC(U8500_PRCMU_TCDM_BASE, SZ_4K + SZ_8K),
58}; 69};
59 70
60void __init u8500_map_io(void) 71void __init u8500_map_io(void)
@@ -66,7 +77,12 @@ void __init u8500_map_io(void)
66 77
67 ux500_map_io(); 78 ux500_map_io();
68 79
69 iotable_init(u8500_io_desc, ARRAY_SIZE(u8500_io_desc)); 80 iotable_init(u8500_common_io_desc, ARRAY_SIZE(u8500_common_io_desc));
81
82 if (cpu_is_u9540())
83 iotable_init(u9540_io_desc, ARRAY_SIZE(u9540_io_desc));
84 else
85 iotable_init(u8500_io_desc, ARRAY_SIZE(u8500_io_desc));
70 86
71 _PRCMU_BASE = __io_address(U8500_PRCMU_BASE); 87 _PRCMU_BASE = __io_address(U8500_PRCMU_BASE);
72} 88}
@@ -121,6 +137,12 @@ static struct platform_device *platform_devs[] __initdata = {
121 &db8500_prcmu_device, 137 &db8500_prcmu_device,
122}; 138};
123 139
140static struct platform_device *of_platform_devs[] __initdata = {
141 &u8500_dma40_device,
142 &db8500_pmu_device,
143 &db8500_prcmu_device,
144};
145
124static resource_size_t __initdata db8500_gpio_base[] = { 146static resource_size_t __initdata db8500_gpio_base[] = {
125 U8500_GPIOBANK0_BASE, 147 U8500_GPIOBANK0_BASE,
126 U8500_GPIOBANK1_BASE, 148 U8500_GPIOBANK1_BASE,
@@ -141,6 +163,7 @@ static void __init db8500_add_gpios(struct device *parent)
141 163
142 dbx500_add_gpios(parent, ARRAY_AND_SIZE(db8500_gpio_base), 164 dbx500_add_gpios(parent, ARRAY_AND_SIZE(db8500_gpio_base),
143 IRQ_DB8500_GPIO0, &pdata); 165 IRQ_DB8500_GPIO0, &pdata);
166 dbx500_add_pinctrl(parent, "pinctrl-db8500");
144} 167}
145 168
146static int usb_db8500_rx_dma_cfg[] = { 169static int usb_db8500_rx_dma_cfg[] = {
@@ -199,10 +222,16 @@ struct device * __init u8500_init_devices(void)
199 platform_device_register_data(parent, 222 platform_device_register_data(parent,
200 "cpufreq-u8500", -1, NULL, 0); 223 "cpufreq-u8500", -1, NULL, 0);
201 224
202 for (i = 0; i < ARRAY_SIZE(platform_devs); i++) 225 for (i = 0; i < ARRAY_SIZE(of_platform_devs); i++)
203 platform_devs[i]->dev.parent = parent; 226 of_platform_devs[i]->dev.parent = parent;
204 227
205 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs)); 228 /*
229 * Devices to be DT:ed:
230 * u8500_dma40_device = todo
231 * db8500_pmu_device = todo
232 * db8500_prcmu_device = todo
233 */
234 platform_add_devices(of_platform_devs, ARRAY_SIZE(of_platform_devs));
206 235
207 return parent; 236 return parent;
208} 237}
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c
index d11f3892a27d..a29a0e3adcf9 100644
--- a/arch/arm/mach-ux500/cpu.c
+++ b/arch/arm/mach-ux500/cpu.c
@@ -10,7 +10,6 @@
10#include <linux/io.h> 10#include <linux/io.h>
11#include <linux/clk.h> 11#include <linux/clk.h>
12#include <linux/mfd/db8500-prcmu.h> 12#include <linux/mfd/db8500-prcmu.h>
13#include <linux/mfd/db5500-prcmu.h>
14#include <linux/clksrc-dbx500-prcmu.h> 13#include <linux/clksrc-dbx500-prcmu.h>
15#include <linux/sys_soc.h> 14#include <linux/sys_soc.h>
16#include <linux/err.h> 15#include <linux/err.h>
@@ -30,6 +29,18 @@
30 29
31void __iomem *_PRCMU_BASE; 30void __iomem *_PRCMU_BASE;
32 31
32/*
33 * FIXME: Should we set up the GPIO domain here?
34 *
35 * The problem is that we cannot put the interrupt resources into the platform
36 * device until the irqdomain has been added. Right now, we set the GIC interrupt
37 * domain from init_irq(), then load the gpio driver from
38 * core_initcall(nmk_gpio_init) and add the platform devices from
39 * arch_initcall(customize_machine).
40 *
41 * This feels fragile because it depends on the gpio device getting probed
42 * _before_ any device uses the gpio interrupts.
43*/
33static const struct of_device_id ux500_dt_irq_match[] = { 44static const struct of_device_id ux500_dt_irq_match[] = {
34 { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, }, 45 { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
35 {}, 46 {},
@@ -40,10 +51,7 @@ void __init ux500_init_irq(void)
40 void __iomem *dist_base; 51 void __iomem *dist_base;
41 void __iomem *cpu_base; 52 void __iomem *cpu_base;
42 53
43 if (cpu_is_u5500()) { 54 if (cpu_is_u8500_family()) {
44 dist_base = __io_address(U5500_GIC_DIST_BASE);
45 cpu_base = __io_address(U5500_GIC_CPU_BASE);
46 } else if (cpu_is_u8500()) {
47 dist_base = __io_address(U8500_GIC_DIST_BASE); 55 dist_base = __io_address(U8500_GIC_DIST_BASE);
48 cpu_base = __io_address(U8500_GIC_CPU_BASE); 56 cpu_base = __io_address(U8500_GIC_CPU_BASE);
49 } else 57 } else
@@ -60,9 +68,7 @@ void __init ux500_init_irq(void)
60 * Init clocks here so that they are available for system timer 68 * Init clocks here so that they are available for system timer
61 * initialization. 69 * initialization.
62 */ 70 */
63 if (cpu_is_u5500()) 71 if (cpu_is_u8500_family())
64 db5500_prcmu_early_init();
65 if (cpu_is_u8500())
66 db8500_prcmu_early_init(); 72 db8500_prcmu_early_init();
67 clk_init(); 73 clk_init();
68} 74}
diff --git a/arch/arm/mach-ux500/cpuidle.c b/arch/arm/mach-ux500/cpuidle.c
new file mode 100644
index 000000000000..b54884bd2549
--- /dev/null
+++ b/arch/arm/mach-ux500/cpuidle.c
@@ -0,0 +1,171 @@
1/*
2 * Copyright (c) 2012 Linaro : Daniel Lezcano <daniel.lezcano@linaro.org> (IBM)
3 *
4 * Based on the work of Rickard Andersson <rickard.andersson@stericsson.com>
5 * and Jonas Aaberg <jonas.aberg@stericsson.com>.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/module.h>
13#include <linux/cpuidle.h>
14#include <linux/clockchips.h>
15#include <linux/spinlock.h>
16#include <linux/atomic.h>
17#include <linux/smp.h>
18#include <linux/mfd/dbx500-prcmu.h>
19
20#include <asm/cpuidle.h>
21#include <asm/proc-fns.h>
22
23static atomic_t master = ATOMIC_INIT(0);
24static DEFINE_SPINLOCK(master_lock);
25static DEFINE_PER_CPU(struct cpuidle_device, ux500_cpuidle_device);
26
27static inline int ux500_enter_idle(struct cpuidle_device *dev,
28 struct cpuidle_driver *drv, int index)
29{
30 int this_cpu = smp_processor_id();
31 bool recouple = false;
32
33 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &this_cpu);
34
35 if (atomic_inc_return(&master) == num_online_cpus()) {
36
37 /* With this lock, we prevent the other cpu to exit and enter
38 * this function again and become the master */
39 if (!spin_trylock(&master_lock))
40 goto wfi;
41
42 /* decouple the gic from the A9 cores */
43 if (prcmu_gic_decouple())
44 goto out;
45
46 /* If an error occur, we will have to recouple the gic
47 * manually */
48 recouple = true;
49
50 /* At this state, as the gic is decoupled, if the other
51 * cpu is in WFI, we have the guarantee it won't be wake
52 * up, so we can safely go to retention */
53 if (!prcmu_is_cpu_in_wfi(this_cpu ? 0 : 1))
54 goto out;
55
56 /* The prcmu will be in charge of watching the interrupts
57 * and wake up the cpus */
58 if (prcmu_copy_gic_settings())
59 goto out;
60
61 /* Check in the meantime an interrupt did
62 * not occur on the gic ... */
63 if (prcmu_gic_pending_irq())
64 goto out;
65
66 /* ... and the prcmu */
67 if (prcmu_pending_irq())
68 goto out;
69
70 /* Go to the retention state, the prcmu will wait for the
71 * cpu to go WFI and this is what happens after exiting this
72 * 'master' critical section */
73 if (prcmu_set_power_state(PRCMU_AP_IDLE, true, true))
74 goto out;
75
76 /* When we switch to retention, the prcmu is in charge
77 * of recoupling the gic automatically */
78 recouple = false;
79
80 spin_unlock(&master_lock);
81 }
82wfi:
83 cpu_do_idle();
84out:
85 atomic_dec(&master);
86
87 if (recouple) {
88 prcmu_gic_recouple();
89 spin_unlock(&master_lock);
90 }
91
92 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &this_cpu);
93
94 return index;
95}
96
97static struct cpuidle_driver ux500_idle_driver = {
98 .name = "ux500_idle",
99 .owner = THIS_MODULE,
100 .en_core_tk_irqen = 1,
101 .states = {
102 ARM_CPUIDLE_WFI_STATE,
103 {
104 .enter = ux500_enter_idle,
105 .exit_latency = 70,
106 .target_residency = 260,
107 .flags = CPUIDLE_FLAG_TIME_VALID,
108 .name = "ApIdle",
109 .desc = "ARM Retention",
110 },
111 },
112 .safe_state_index = 0,
113 .state_count = 2,
114};
115
116/*
117 * For each cpu, setup the broadcast timer because we will
118 * need to migrate the timers for the states >= ApIdle.
119 */
120static void ux500_setup_broadcast_timer(void *arg)
121{
122 int cpu = smp_processor_id();
123 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu);
124}
125
126int __init ux500_idle_init(void)
127{
128 int ret, cpu;
129 struct cpuidle_device *device;
130
131 /* Configure wake up reasons */
132 prcmu_enable_wakeups(PRCMU_WAKEUP(ARM) | PRCMU_WAKEUP(RTC) |
133 PRCMU_WAKEUP(ABB));
134
135 /*
136 * Configure the timer broadcast for each cpu, that must
137 * be done from the cpu context, so we use a smp cross
138 * call with 'on_each_cpu'.
139 */
140 on_each_cpu(ux500_setup_broadcast_timer, NULL, 1);
141
142 ret = cpuidle_register_driver(&ux500_idle_driver);
143 if (ret) {
144 printk(KERN_ERR "failed to register ux500 idle driver\n");
145 return ret;
146 }
147
148 for_each_online_cpu(cpu) {
149 device = &per_cpu(ux500_cpuidle_device, cpu);
150 device->cpu = cpu;
151 ret = cpuidle_register_device(device);
152 if (ret) {
153 printk(KERN_ERR "Failed to register cpuidle "
154 "device for cpu%d\n", cpu);
155 goto out_unregister;
156 }
157 }
158out:
159 return ret;
160
161out_unregister:
162 for_each_online_cpu(cpu) {
163 device = &per_cpu(ux500_cpuidle_device, cpu);
164 cpuidle_unregister_device(device);
165 }
166
167 cpuidle_unregister_driver(&ux500_idle_driver);
168 goto out;
169}
170
171device_initcall(ux500_idle_init);
diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c
index c5312a4b49f5..dfdd4a54668d 100644
--- a/arch/arm/mach-ux500/devices-common.c
+++ b/arch/arm/mach-ux500/devices-common.c
@@ -11,7 +11,6 @@
11#include <linux/irq.h> 11#include <linux/irq.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/amba/bus.h>
15 14
16#include <plat/gpio-nomadik.h> 15#include <plat/gpio-nomadik.h>
17 16
@@ -19,38 +18,6 @@
19 18
20#include "devices-common.h" 19#include "devices-common.h"
21 20
22struct amba_device *
23dbx500_add_amba_device(struct device *parent, const char *name,
24 resource_size_t base, int irq, void *pdata,
25 unsigned int periphid)
26{
27 struct amba_device *dev;
28 int ret;
29
30 dev = amba_device_alloc(name, base, SZ_4K);
31 if (!dev)
32 return ERR_PTR(-ENOMEM);
33
34 dev->dma_mask = DMA_BIT_MASK(32);
35 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
36
37 dev->irq[0] = irq;
38
39 dev->periphid = periphid;
40
41 dev->dev.platform_data = pdata;
42
43 dev->dev.parent = parent;
44
45 ret = amba_device_add(dev, &iomem_resource);
46 if (ret) {
47 amba_device_put(dev);
48 return ERR_PTR(ret);
49 }
50
51 return dev;
52}
53
54static struct platform_device * 21static struct platform_device *
55dbx500_add_gpio(struct device *parent, int id, resource_size_t addr, int irq, 22dbx500_add_gpio(struct device *parent, int id, resource_size_t addr, int irq,
56 struct nmk_gpio_platform_data *pdata) 23 struct nmk_gpio_platform_data *pdata)
diff --git a/arch/arm/mach-ux500/devices-common.h b/arch/arm/mach-ux500/devices-common.h
index 39c74ec82add..7cbccfd9e158 100644
--- a/arch/arm/mach-ux500/devices-common.h
+++ b/arch/arm/mach-ux500/devices-common.h
@@ -11,13 +11,9 @@
11#include <linux/platform_device.h> 11#include <linux/platform_device.h>
12#include <linux/dma-mapping.h> 12#include <linux/dma-mapping.h>
13#include <linux/sys_soc.h> 13#include <linux/sys_soc.h>
14#include <linux/amba/bus.h>
14#include <plat/i2c.h> 15#include <plat/i2c.h>
15 16
16extern struct amba_device *
17dbx500_add_amba_device(struct device *parent, const char *name,
18 resource_size_t base, int irq, void *pdata,
19 unsigned int periphid);
20
21struct spi_master_cntlr; 17struct spi_master_cntlr;
22 18
23static inline struct amba_device * 19static inline struct amba_device *
@@ -25,8 +21,8 @@ dbx500_add_msp_spi(struct device *parent, const char *name,
25 resource_size_t base, int irq, 21 resource_size_t base, int irq,
26 struct spi_master_cntlr *pdata) 22 struct spi_master_cntlr *pdata)
27{ 23{
28 return dbx500_add_amba_device(parent, name, base, irq, 24 return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0,
29 pdata, 0); 25 pdata, 0);
30} 26}
31 27
32static inline struct amba_device * 28static inline struct amba_device *
@@ -34,8 +30,8 @@ dbx500_add_spi(struct device *parent, const char *name, resource_size_t base,
34 int irq, struct spi_master_cntlr *pdata, 30 int irq, struct spi_master_cntlr *pdata,
35 u32 periphid) 31 u32 periphid)
36{ 32{
37 return dbx500_add_amba_device(parent, name, base, irq, 33 return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0,
38 pdata, periphid); 34 pdata, periphid);
39} 35}
40 36
41struct mmci_platform_data; 37struct mmci_platform_data;
@@ -44,8 +40,8 @@ static inline struct amba_device *
44dbx500_add_sdi(struct device *parent, const char *name, resource_size_t base, 40dbx500_add_sdi(struct device *parent, const char *name, resource_size_t base,
45 int irq, struct mmci_platform_data *pdata, u32 periphid) 41 int irq, struct mmci_platform_data *pdata, u32 periphid)
46{ 42{
47 return dbx500_add_amba_device(parent, name, base, irq, 43 return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0,
48 pdata, periphid); 44 pdata, periphid);
49} 45}
50 46
51struct amba_pl011_data; 47struct amba_pl011_data;
@@ -54,7 +50,7 @@ static inline struct amba_device *
54dbx500_add_uart(struct device *parent, const char *name, resource_size_t base, 50dbx500_add_uart(struct device *parent, const char *name, resource_size_t base,
55 int irq, struct amba_pl011_data *pdata) 51 int irq, struct amba_pl011_data *pdata)
56{ 52{
57 return dbx500_add_amba_device(parent, name, base, irq, pdata, 0); 53 return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0, pdata, 0);
58} 54}
59 55
60struct nmk_i2c_controller; 56struct nmk_i2c_controller;
@@ -85,7 +81,8 @@ dbx500_add_i2c(struct device *parent, int id, resource_size_t base, int irq,
85static inline struct amba_device * 81static inline struct amba_device *
86dbx500_add_rtc(struct device *parent, resource_size_t base, int irq) 82dbx500_add_rtc(struct device *parent, resource_size_t base, int irq)
87{ 83{
88 return dbx500_add_amba_device(parent, "rtc-pl031", base, irq, NULL, 0); 84 return amba_apb_device_add(parent, "rtc-pl031", base, SZ_4K, irq,
85 0, NULL, 0);
89} 86}
90 87
91struct nmk_gpio_platform_data; 88struct nmk_gpio_platform_data;
@@ -93,4 +90,16 @@ struct nmk_gpio_platform_data;
93void dbx500_add_gpios(struct device *parent, resource_size_t *base, int num, 90void dbx500_add_gpios(struct device *parent, resource_size_t *base, int num,
94 int irq, struct nmk_gpio_platform_data *pdata); 91 int irq, struct nmk_gpio_platform_data *pdata);
95 92
93static inline void
94dbx500_add_pinctrl(struct device *parent, const char *name)
95{
96 struct platform_device_info pdevinfo = {
97 .parent = parent,
98 .name = name,
99 .id = -1,
100 };
101
102 platform_device_register_full(&pdevinfo);
103}
104
96#endif 105#endif
diff --git a/arch/arm/mach-ux500/devices-db5500.h b/arch/arm/mach-ux500/devices-db5500.h
deleted file mode 100644
index e70955502c35..000000000000
--- a/arch/arm/mach-ux500/devices-db5500.h
+++ /dev/null
@@ -1,99 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL), version 2.
6 */
7
8#ifndef __DEVICES_DB5500_H
9#define __DEVICES_DB5500_H
10
11#include "devices-common.h"
12
13#define db5500_add_i2c1(parent, pdata) \
14 dbx500_add_i2c(parent, 1, U5500_I2C1_BASE, IRQ_DB5500_I2C1, pdata)
15#define db5500_add_i2c2(parent, pdata) \
16 dbx500_add_i2c(parent, 2, U5500_I2C2_BASE, IRQ_DB5500_I2C2, pdata)
17#define db5500_add_i2c3(parent, pdata) \
18 dbx500_add_i2c(parent, 3, U5500_I2C3_BASE, IRQ_DB5500_I2C3, pdata)
19
20#define db5500_add_msp0_spi(parent, pdata) \
21 dbx500_add_msp_spi(parent, "msp0", U5500_MSP0_BASE, \
22 IRQ_DB5500_MSP0, pdata)
23#define db5500_add_msp1_spi(parent, pdata) \
24 dbx500_add_msp_spi(parent, "msp1", U5500_MSP1_BASE, \
25 IRQ_DB5500_MSP1, pdata)
26#define db5500_add_msp2_spi(parent, pdata) \
27 dbx500_add_msp_spi(parent, "msp2", U5500_MSP2_BASE, \
28 IRQ_DB5500_MSP2, pdata)
29
30#define db5500_add_msp0_spi(parent, pdata) \
31 dbx500_add_msp_spi(parent, "msp0", U5500_MSP0_BASE, \
32 IRQ_DB5500_MSP0, pdata)
33#define db5500_add_msp1_spi(parent, pdata) \
34 dbx500_add_msp_spi(parent, "msp1", U5500_MSP1_BASE, \
35 IRQ_DB5500_MSP1, pdata)
36#define db5500_add_msp2_spi(parent, pdata) \
37 dbx500_add_msp_spi(parent, "msp2", U5500_MSP2_BASE, \
38 IRQ_DB5500_MSP2, pdata)
39
40#define db5500_add_rtc(parent) \
41 dbx500_add_rtc(parent, U5500_RTC_BASE, IRQ_DB5500_RTC);
42
43#define db5500_add_usb(parent, rx_cfg, tx_cfg) \
44 ux500_add_usb(parent, U5500_USBOTG_BASE, \
45 IRQ_DB5500_USBOTG, rx_cfg, tx_cfg)
46
47#define db5500_add_sdi0(parent, pdata) \
48 dbx500_add_sdi(parent, "sdi0", U5500_SDI0_BASE, \
49 IRQ_DB5500_SDMMC0, pdata, \
50 0x10480180)
51#define db5500_add_sdi1(parent, pdata) \
52 dbx500_add_sdi(parent, "sdi1", U5500_SDI1_BASE, \
53 IRQ_DB5500_SDMMC1, pdata, \
54 0x10480180)
55#define db5500_add_sdi2(parent, pdata) \
56 dbx500_add_sdi(parent, "sdi2", U5500_SDI2_BASE, \
57 IRQ_DB5500_SDMMC2, pdata \
58 0x10480180)
59#define db5500_add_sdi3(parent, pdata) \
60 dbx500_add_sdi(parent, "sdi3", U5500_SDI3_BASE, \
61 IRQ_DB5500_SDMMC3, pdata \
62 0x10480180)
63#define db5500_add_sdi4(parent, pdata) \
64 dbx500_add_sdi(parent, "sdi4", U5500_SDI4_BASE, \
65 IRQ_DB5500_SDMMC4, pdata \
66 0x10480180)
67
68/* This one has a bad peripheral ID in the U5500 silicon */
69#define db5500_add_spi0(parent, pdata) \
70 dbx500_add_spi(parent, "spi0", U5500_SPI0_BASE, \
71 IRQ_DB5500_SPI0, pdata, \
72 0x10080023)
73#define db5500_add_spi1(parent, pdata) \
74 dbx500_add_spi(parent, "spi1", U5500_SPI1_BASE, \
75 IRQ_DB5500_SPI1, pdata, \
76 0x10080023)
77#define db5500_add_spi2(parent, pdata) \
78 dbx500_add_spi(parent, "spi2", U5500_SPI2_BASE, \
79 IRQ_DB5500_SPI2, pdata \
80 0x10080023)
81#define db5500_add_spi3(parent, pdata) \
82 dbx500_add_spi(parent, "spi3", U5500_SPI3_BASE, \
83 IRQ_DB5500_SPI3, pdata \
84 0x10080023)
85
86#define db5500_add_uart0(parent, plat) \
87 dbx500_add_uart(parent, "uart0", U5500_UART0_BASE, \
88 IRQ_DB5500_UART0, plat)
89#define db5500_add_uart1(parent, plat) \
90 dbx500_add_uart(parent, "uart1", U5500_UART1_BASE, \
91 IRQ_DB5500_UART1, plat)
92#define db5500_add_uart2(parent, plat) \
93 dbx500_add_uart(parent, "uart2", U5500_UART2_BASE, \
94 IRQ_DB5500_UART2, plat)
95#define db5500_add_uart3(parent, plat) \
96 dbx500_add_uart(parent, "uart3", U5500_UART3_BASE, \
97 IRQ_DB5500_UART3, plat)
98
99#endif
diff --git a/arch/arm/mach-ux500/devices-db8500.h b/arch/arm/mach-ux500/devices-db8500.h
index 9fd93e9da529..0b9677a95bbc 100644
--- a/arch/arm/mach-ux500/devices-db8500.h
+++ b/arch/arm/mach-ux500/devices-db8500.h
@@ -31,10 +31,9 @@ static inline struct amba_device *
31db8500_add_ssp(struct device *parent, const char *name, resource_size_t base, 31db8500_add_ssp(struct device *parent, const char *name, resource_size_t base,
32 int irq, struct pl022_ssp_controller *pdata) 32 int irq, struct pl022_ssp_controller *pdata)
33{ 33{
34 return dbx500_add_amba_device(parent, name, base, irq, pdata, 0); 34 return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0, pdata, 0);
35} 35}
36 36
37
38#define db8500_add_i2c0(parent, pdata) \ 37#define db8500_add_i2c0(parent, pdata) \
39 dbx500_add_i2c(parent, 0, U8500_I2C0_BASE, IRQ_DB8500_I2C0, pdata) 38 dbx500_add_i2c(parent, 0, U8500_I2C0_BASE, IRQ_DB8500_I2C0, pdata)
40#define db8500_add_i2c1(parent, pdata) \ 39#define db8500_add_i2c1(parent, pdata) \
@@ -46,15 +45,6 @@ db8500_add_ssp(struct device *parent, const char *name, resource_size_t base,
46#define db8500_add_i2c4(parent, pdata) \ 45#define db8500_add_i2c4(parent, pdata) \
47 dbx500_add_i2c(parent, 4, U8500_I2C4_BASE, IRQ_DB8500_I2C4, pdata) 46 dbx500_add_i2c(parent, 4, U8500_I2C4_BASE, IRQ_DB8500_I2C4, pdata)
48 47
49#define db8500_add_msp0_i2s(parent, pdata) \
50 dbx500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0, pdata)
51#define db8500_add_msp1_i2s(parent, pdata) \
52 dbx500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1, pdata)
53#define db8500_add_msp2_i2s(parent, pdata) \
54 dbx500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2, pdata)
55#define db8500_add_msp3_i2s(parent, pdata) \
56 dbx500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1, pdata)
57
58#define db8500_add_msp0_spi(parent, pdata) \ 48#define db8500_add_msp0_spi(parent, pdata) \
59 dbx500_add_msp_spi(parent, "msp0", U8500_MSP0_BASE, \ 49 dbx500_add_msp_spi(parent, "msp0", U8500_MSP0_BASE, \
60 IRQ_DB8500_MSP0, pdata) 50 IRQ_DB8500_MSP0, pdata)
diff --git a/arch/arm/mach-ux500/dma-db5500.c b/arch/arm/mach-ux500/dma-db5500.c
deleted file mode 100644
index 41e9470fa0e6..000000000000
--- a/arch/arm/mach-ux500/dma-db5500.c
+++ /dev/null
@@ -1,137 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Per Forlin <per.forlin@stericsson.com> for ST-Ericsson
5 * Author: Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson
6 * Author: Rabin Vincent <rabinv.vincent@stericsson.com> for ST-Ericsson
7 *
8 * License terms: GNU General Public License (GPL), version 2
9 */
10
11#include <linux/kernel.h>
12#include <linux/platform_device.h>
13
14#include <plat/ste_dma40.h>
15#include <mach/setup.h>
16#include <mach/hardware.h>
17
18#include "ste-dma40-db5500.h"
19
20static struct resource dma40_resources[] = {
21 [0] = {
22 .start = U5500_DMA_BASE,
23 .end = U5500_DMA_BASE + SZ_4K - 1,
24 .flags = IORESOURCE_MEM,
25 .name = "base",
26 },
27 [1] = {
28 .start = U5500_DMA_LCPA_BASE,
29 .end = U5500_DMA_LCPA_BASE + 2 * SZ_1K - 1,
30 .flags = IORESOURCE_MEM,
31 .name = "lcpa",
32 },
33 [2] = {
34 .start = IRQ_DB5500_DMA,
35 .end = IRQ_DB5500_DMA,
36 .flags = IORESOURCE_IRQ
37 }
38};
39
40/* Default configuration for physical memcpy */
41static struct stedma40_chan_cfg dma40_memcpy_conf_phy = {
42 .mode = STEDMA40_MODE_PHYSICAL,
43 .dir = STEDMA40_MEM_TO_MEM,
44
45 .src_info.data_width = STEDMA40_BYTE_WIDTH,
46 .src_info.psize = STEDMA40_PSIZE_PHY_1,
47 .src_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
48
49 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
50 .dst_info.psize = STEDMA40_PSIZE_PHY_1,
51 .dst_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
52};
53
54/* Default configuration for logical memcpy */
55static struct stedma40_chan_cfg dma40_memcpy_conf_log = {
56 .dir = STEDMA40_MEM_TO_MEM,
57
58 .src_info.data_width = STEDMA40_BYTE_WIDTH,
59 .src_info.psize = STEDMA40_PSIZE_LOG_1,
60 .src_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
61
62 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
63 .dst_info.psize = STEDMA40_PSIZE_LOG_1,
64 .dst_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
65};
66
67/*
68 * Mapping between soruce event lines and physical device address This was
69 * created assuming that the event line is tied to a device and therefore the
70 * address is constant, however this is not true for at least USB, and the
71 * values are just placeholders for USB. This table is preserved and used for
72 * now.
73 */
74static const dma_addr_t dma40_rx_map[DB5500_DMA_NR_DEV] = {
75 [DB5500_DMA_DEV24_SDMMC0_RX] = -1,
76 [DB5500_DMA_DEV38_USB_OTG_IEP_8] = -1,
77 [DB5500_DMA_DEV23_USB_OTG_IEP_7_15] = -1,
78 [DB5500_DMA_DEV22_USB_OTG_IEP_6_14] = -1,
79 [DB5500_DMA_DEV21_USB_OTG_IEP_5_13] = -1,
80 [DB5500_DMA_DEV20_USB_OTG_IEP_4_12] = -1,
81 [DB5500_DMA_DEV6_USB_OTG_IEP_3_11] = -1,
82 [DB5500_DMA_DEV5_USB_OTG_IEP_2_10] = -1,
83 [DB5500_DMA_DEV4_USB_OTG_IEP_1_9] = -1,
84};
85
86/* Mapping between destination event lines and physical device address */
87static const dma_addr_t dma40_tx_map[DB5500_DMA_NR_DEV] = {
88 [DB5500_DMA_DEV24_SDMMC0_TX] = -1,
89 [DB5500_DMA_DEV38_USB_OTG_OEP_8] = -1,
90 [DB5500_DMA_DEV23_USB_OTG_OEP_7_15] = -1,
91 [DB5500_DMA_DEV22_USB_OTG_OEP_6_14] = -1,
92 [DB5500_DMA_DEV21_USB_OTG_OEP_5_13] = -1,
93 [DB5500_DMA_DEV20_USB_OTG_OEP_4_12] = -1,
94 [DB5500_DMA_DEV6_USB_OTG_OEP_3_11] = -1,
95 [DB5500_DMA_DEV5_USB_OTG_OEP_2_10] = -1,
96 [DB5500_DMA_DEV4_USB_OTG_OEP_1_9] = -1,
97};
98
99static int dma40_memcpy_event[] = {
100 DB5500_DMA_MEMCPY_TX_1,
101 DB5500_DMA_MEMCPY_TX_2,
102 DB5500_DMA_MEMCPY_TX_3,
103 DB5500_DMA_MEMCPY_TX_4,
104 DB5500_DMA_MEMCPY_TX_5,
105};
106
107static struct stedma40_platform_data dma40_plat_data = {
108 .dev_len = ARRAY_SIZE(dma40_rx_map),
109 .dev_rx = dma40_rx_map,
110 .dev_tx = dma40_tx_map,
111 .memcpy = dma40_memcpy_event,
112 .memcpy_len = ARRAY_SIZE(dma40_memcpy_event),
113 .memcpy_conf_phy = &dma40_memcpy_conf_phy,
114 .memcpy_conf_log = &dma40_memcpy_conf_log,
115 .disabled_channels = {-1},
116};
117
118static struct platform_device dma40_device = {
119 .dev = {
120 .platform_data = &dma40_plat_data,
121 },
122 .name = "dma40",
123 .id = 0,
124 .num_resources = ARRAY_SIZE(dma40_resources),
125 .resource = dma40_resources
126};
127
128void __init db5500_dma_init(struct device *parent)
129{
130 int ret;
131
132 dma40_device.dev.parent = parent;
133 ret = platform_device_register(&dma40_device);
134 if (ret)
135 dev_err(&dma40_device.dev, "unable to register device: %d\n", ret);
136
137}
diff --git a/arch/arm/mach-ux500/id.c b/arch/arm/mach-ux500/id.c
index 15a0f63b2e2b..d1579920139f 100644
--- a/arch/arm/mach-ux500/id.c
+++ b/arch/arm/mach-ux500/id.c
@@ -23,7 +23,7 @@ static unsigned int ux500_read_asicid(phys_addr_t addr)
23{ 23{
24 phys_addr_t base = addr & ~0xfff; 24 phys_addr_t base = addr & ~0xfff;
25 struct map_desc desc = { 25 struct map_desc desc = {
26 .virtual = IO_ADDRESS(base), 26 .virtual = UX500_VIRT_ROM,
27 .pfn = __phys_to_pfn(base), 27 .pfn = __phys_to_pfn(base),
28 .length = SZ_16K, 28 .length = SZ_16K,
29 .type = MT_DEVICE, 29 .type = MT_DEVICE,
@@ -35,7 +35,7 @@ static unsigned int ux500_read_asicid(phys_addr_t addr)
35 local_flush_tlb_all(); 35 local_flush_tlb_all();
36 flush_cache_all(); 36 flush_cache_all();
37 37
38 return readl(__io_address(addr)); 38 return readl(IOMEM(UX500_VIRT_ROM + (addr & 0xfff)));
39} 39}
40 40
41static void ux500_print_soc_info(unsigned int asicid) 41static void ux500_print_soc_info(unsigned int asicid)
@@ -67,6 +67,7 @@ static unsigned int partnumber(unsigned int asicid)
67 * DB8500v2 0x412fc091 0x9001DBF4 0x008500B0 67 * DB8500v2 0x412fc091 0x9001DBF4 0x008500B0
68 * DB8520v2.2 0x412fc091 0x9001DBF4 0x008500B2 68 * DB8520v2.2 0x412fc091 0x9001DBF4 0x008500B2
69 * DB5500v1 0x412fc091 0x9001FFF4 0x005500A0 69 * DB5500v1 0x412fc091 0x9001FFF4 0x005500A0
70 * DB9540 0x413fc090 0xFFFFDBF4 0x009540xx
70 */ 71 */
71 72
72void __init ux500_map_io(void) 73void __init ux500_map_io(void)
@@ -91,6 +92,10 @@ void __init ux500_map_io(void)
91 /* DB5500v1 */ 92 /* DB5500v1 */
92 addr = 0x9001FFF4; 93 addr = 0x9001FFF4;
93 break; 94 break;
95
96 case 0x413fc090: /* DB9540 */
97 addr = 0xFFFFDBF4;
98 break;
94 } 99 }
95 100
96 if (addr) 101 if (addr)
diff --git a/arch/arm/mach-ux500/include/mach/db5500-regs.h b/arch/arm/mach-ux500/include/mach/db5500-regs.h
deleted file mode 100644
index 8e714bcb099f..000000000000
--- a/arch/arm/mach-ux500/include/mach/db5500-regs.h
+++ /dev/null
@@ -1,143 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef __MACH_DB5500_REGS_H
8#define __MACH_DB5500_REGS_H
9
10#define U5500_PER1_BASE 0xA0020000
11#define U5500_PER2_BASE 0xA0010000
12#define U5500_PER3_BASE 0x80140000
13#define U5500_PER4_BASE 0x80150000
14#define U5500_PER5_BASE 0x80100000
15#define U5500_PER6_BASE 0x80120000
16
17#define U5500_GIC_DIST_BASE 0xA0411000
18#define U5500_GIC_CPU_BASE 0xA0410100
19#define U5500_DMA_BASE 0x90030000
20#define U5500_STM_BASE 0x90020000
21#define U5500_STM_REG_BASE (U5500_STM_BASE + 0xF000)
22#define U5500_MCDE_BASE 0xA0400000
23#define U5500_MODEM_BASE 0xB0000000
24#define U5500_L2CC_BASE 0xA0412000
25#define U5500_SCU_BASE 0xA0410000
26#define U5500_DSI1_BASE 0xA0401000
27#define U5500_DSI2_BASE 0xA0402000
28#define U5500_SIA_BASE 0xA0100000
29#define U5500_SVA_BASE 0x80200000
30#define U5500_HSEM_BASE 0xA0000000
31#define U5500_NAND0_BASE 0x60000000
32#define U5500_NAND1_BASE 0x70000000
33#define U5500_TWD_BASE 0xa0410600
34#define U5500_ICN_BASE 0xA0040000
35#define U5500_B2R2_BASE 0xa0200000
36#define U5500_BOOT_ROM_BASE 0x90000000
37
38#define U5500_FSMC_BASE (U5500_PER1_BASE + 0x0000)
39#define U5500_SDI0_BASE (U5500_PER1_BASE + 0x1000)
40#define U5500_SDI2_BASE (U5500_PER1_BASE + 0x2000)
41#define U5500_UART0_BASE (U5500_PER1_BASE + 0x3000)
42#define U5500_I2C1_BASE (U5500_PER1_BASE + 0x4000)
43#define U5500_MSP0_BASE (U5500_PER1_BASE + 0x5000)
44#define U5500_GPIO0_BASE (U5500_PER1_BASE + 0xE000)
45#define U5500_CLKRST1_BASE (U5500_PER1_BASE + 0xF000)
46
47#define U5500_USBOTG_BASE (U5500_PER2_BASE + 0x0000)
48#define U5500_GPIO1_BASE (U5500_PER2_BASE + 0xE000)
49#define U5500_CLKRST2_BASE (U5500_PER2_BASE + 0xF000)
50
51#define U5500_KEYPAD_BASE (U5500_PER3_BASE + 0x0000)
52#define U5500_PWM_BASE (U5500_PER3_BASE + 0x1000)
53#define U5500_GPIO3_BASE (U5500_PER3_BASE + 0xE000)
54#define U5500_CLKRST3_BASE (U5500_PER3_BASE + 0xF000)
55
56#define U5500_BACKUPRAM0_BASE (U5500_PER4_BASE + 0x0000)
57#define U5500_BACKUPRAM1_BASE (U5500_PER4_BASE + 0x1000)
58#define U5500_RTT0_BASE (U5500_PER4_BASE + 0x2000)
59#define U5500_RTT1_BASE (U5500_PER4_BASE + 0x3000)
60#define U5500_RTC_BASE (U5500_PER4_BASE + 0x4000)
61#define U5500_SCR_BASE (U5500_PER4_BASE + 0x5000)
62#define U5500_DMC_BASE (U5500_PER4_BASE + 0x6000)
63#define U5500_PRCMU_BASE (U5500_PER4_BASE + 0x7000)
64#define U5500_PRCMU_TIMER_3_BASE (U5500_PER4_BASE + 0x07338)
65#define U5500_PRCMU_TIMER_4_BASE (U5500_PER4_BASE + 0x07450)
66#define U5500_MSP1_BASE (U5500_PER4_BASE + 0x9000)
67#define U5500_GPIO2_BASE (U5500_PER4_BASE + 0xA000)
68#define U5500_MTIMER_BASE (U5500_PER4_BASE + 0xC000)
69#define U5500_CDETECT_BASE (U5500_PER4_BASE + 0xF000)
70#define U5500_PRCMU_TCDM_BASE (U5500_PER4_BASE + 0x18000)
71#define U5500_PRCMU_TCPM_BASE (U5500_PER4_BASE + 0x10000)
72#define U5500_TPIU_BASE (U5500_PER4_BASE + 0x50000)
73
74#define U5500_SPI0_BASE (U5500_PER5_BASE + 0x0000)
75#define U5500_SPI1_BASE (U5500_PER5_BASE + 0x1000)
76#define U5500_SPI2_BASE (U5500_PER5_BASE + 0x2000)
77#define U5500_SPI3_BASE (U5500_PER5_BASE + 0x3000)
78#define U5500_UART1_BASE (U5500_PER5_BASE + 0x4000)
79#define U5500_UART2_BASE (U5500_PER5_BASE + 0x5000)
80#define U5500_UART3_BASE (U5500_PER5_BASE + 0x6000)
81#define U5500_SDI1_BASE (U5500_PER5_BASE + 0x7000)
82#define U5500_SDI3_BASE (U5500_PER5_BASE + 0x8000)
83#define U5500_SDI4_BASE (U5500_PER5_BASE + 0x9000)
84#define U5500_I2C2_BASE (U5500_PER5_BASE + 0xA000)
85#define U5500_I2C3_BASE (U5500_PER5_BASE + 0xB000)
86#define U5500_MSP2_BASE (U5500_PER5_BASE + 0xC000)
87#define U5500_IRDA_BASE (U5500_PER5_BASE + 0xD000)
88#define U5500_IRRC_BASE (U5500_PER5_BASE + 0x10000)
89#define U5500_GPIO4_BASE (U5500_PER5_BASE + 0x1E000)
90#define U5500_CLKRST5_BASE (U5500_PER5_BASE + 0x1F000)
91
92#define U5500_RNG_BASE (U5500_PER6_BASE + 0x0000)
93#define U5500_HASH0_BASE (U5500_PER6_BASE + 0x1000)
94#define U5500_HASH1_BASE (U5500_PER6_BASE + 0x2000)
95#define U5500_PKA_BASE (U5500_PER6_BASE + 0x4000)
96#define U5500_PKAM_BASE (U5500_PER6_BASE + 0x5100)
97#define U5500_MTU0_BASE (U5500_PER6_BASE + 0x6000)
98#define U5500_MTU1_BASE (U5500_PER6_BASE + 0x7000)
99#define U5500_CR_BASE (U5500_PER6_BASE + 0x8000)
100#define U5500_CRYP0_BASE (U5500_PER6_BASE + 0xA000)
101#define U5500_CRYP1_BASE (U5500_PER6_BASE + 0xB000)
102#define U5500_CLKRST6_BASE (U5500_PER6_BASE + 0xF000)
103
104#define U5500_GPIOBANK0_BASE U5500_GPIO0_BASE
105#define U5500_GPIOBANK1_BASE (U5500_GPIO0_BASE + 0x80)
106#define U5500_GPIOBANK2_BASE U5500_GPIO1_BASE
107#define U5500_GPIOBANK3_BASE U5500_GPIO2_BASE
108#define U5500_GPIOBANK4_BASE U5500_GPIO3_BASE
109#define U5500_GPIOBANK5_BASE U5500_GPIO4_BASE
110#define U5500_GPIOBANK6_BASE (U5500_GPIO4_BASE + 0x80)
111#define U5500_GPIOBANK7_BASE (U5500_GPIO4_BASE + 0x100)
112
113#define U5500_MBOX_BASE (U5500_MODEM_BASE + 0xFFD1000)
114#define U5500_MBOX0_PEER_START (U5500_MBOX_BASE + 0x40)
115#define U5500_MBOX0_PEER_END (U5500_MBOX_BASE + 0x5F)
116#define U5500_MBOX0_LOCAL_START (U5500_MBOX_BASE + 0x60)
117#define U5500_MBOX0_LOCAL_END (U5500_MBOX_BASE + 0x7F)
118#define U5500_MBOX1_PEER_START (U5500_MBOX_BASE + 0x80)
119#define U5500_MBOX1_PEER_END (U5500_MBOX_BASE + 0x9F)
120#define U5500_MBOX1_LOCAL_START (U5500_MBOX_BASE + 0xA0)
121#define U5500_MBOX1_LOCAL_END (U5500_MBOX_BASE + 0xBF)
122#define U5500_MBOX2_PEER_START (U5500_MBOX_BASE + 0x00)
123#define U5500_MBOX2_PEER_END (U5500_MBOX_BASE + 0x1F)
124#define U5500_MBOX2_LOCAL_START (U5500_MBOX_BASE + 0x20)
125#define U5500_MBOX2_LOCAL_END (U5500_MBOX_BASE + 0x3F)
126
127#define U5500_ACCCON_BASE_SEC (0xBFFF0000)
128#define U5500_ACCCON_BASE (0xBFFF1000)
129#define U5500_ACCCON_CPUVEC_RESET_ADDR_OFFSET (0x00000020)
130#define U5500_ACCCON_ACC_CPU_CTRL_OFFSET (0x000000BC)
131#define U5500_INTCON_MBOX1_INT_RESET_ADDR (0xBFFD31A4)
132
133#define U5500_ESRAM_BASE 0x40000000
134#define U5500_ESRAM_DMA_LCPA_OFFSET 0x10000
135#define U5500_DMA_LCPA_BASE (U5500_ESRAM_BASE + U5500_ESRAM_DMA_LCPA_OFFSET)
136
137#define U5500_MCDE_SIZE 0x1000
138#define U5500_DSI_LINK_SIZE 0x1000
139#define U5500_DSI_LINK_COUNT 0x2
140#define U5500_DSI_LINK1_BASE (U5500_MCDE_BASE + U5500_MCDE_SIZE)
141#define U5500_DSI_LINK2_BASE (U5500_DSI_LINK1_BASE + U5500_DSI_LINK_SIZE)
142
143#endif
diff --git a/arch/arm/mach-ux500/include/mach/db8500-regs.h b/arch/arm/mach-ux500/include/mach/db8500-regs.h
index 9ec20b96d8f2..1530d493879d 100644
--- a/arch/arm/mach-ux500/include/mach/db8500-regs.h
+++ b/arch/arm/mach-ux500/include/mach/db8500-regs.h
@@ -41,6 +41,10 @@
41/* ASIC ID is at 0xbf4 offset within this region */ 41/* ASIC ID is at 0xbf4 offset within this region */
42#define U8500_ASIC_ID_BASE 0x9001D000 42#define U8500_ASIC_ID_BASE 0x9001D000
43 43
44#define U9540_BOOT_ROM_BASE 0xFFFE0000
45/* ASIC ID is at 0xbf4 offset within this region */
46#define U9540_ASIC_ID_BASE 0xFFFFD000
47
44#define U8500_PER6_BASE 0xa03c0000 48#define U8500_PER6_BASE 0xa03c0000
45#define U8500_PER7_BASE 0xa03d0000 49#define U8500_PER7_BASE 0xa03d0000
46#define U8500_PER5_BASE 0xa03e0000 50#define U8500_PER5_BASE 0xa03e0000
@@ -96,7 +100,9 @@
96#define U8500_SCR_BASE (U8500_PER4_BASE + 0x05000) 100#define U8500_SCR_BASE (U8500_PER4_BASE + 0x05000)
97#define U8500_DMC_BASE (U8500_PER4_BASE + 0x06000) 101#define U8500_DMC_BASE (U8500_PER4_BASE + 0x06000)
98#define U8500_PRCMU_BASE (U8500_PER4_BASE + 0x07000) 102#define U8500_PRCMU_BASE (U8500_PER4_BASE + 0x07000)
103#define U9540_DMC1_BASE (U8500_PER4_BASE + 0x0A000)
99#define U8500_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x68000) 104#define U8500_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x68000)
105#define U9540_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x6A000)
100#define U8500_PRCMU_TCPM_BASE (U8500_PER4_BASE + 0x60000) 106#define U8500_PRCMU_TCPM_BASE (U8500_PER4_BASE + 0x60000)
101#define U8500_PRCMU_TIMER_3_BASE (U8500_PER4_BASE + 0x07338) 107#define U8500_PRCMU_TIMER_3_BASE (U8500_PER4_BASE + 0x07338)
102#define U8500_PRCMU_TIMER_4_BASE (U8500_PER4_BASE + 0x07450) 108#define U8500_PRCMU_TIMER_4_BASE (U8500_PER4_BASE + 0x07450)
diff --git a/arch/arm/mach-ux500/include/mach/debug-macro.S b/arch/arm/mach-ux500/include/mach/debug-macro.S
index 8d74d927d4e2..67035223334a 100644
--- a/arch/arm/mach-ux500/include/mach/debug-macro.S
+++ b/arch/arm/mach-ux500/include/mach/debug-macro.S
@@ -20,10 +20,6 @@
20 * built, so that there's some hint during the build that something is wrong. 20 * built, so that there's some hint during the build that something is wrong.
21 */ 21 */
22 22
23#ifdef CONFIG_UX500_SOC_DB5500
24#define __UX500_UART(n) U5500_UART##n##_BASE
25#endif
26
27#ifdef CONFIG_UX500_SOC_DB8500 23#ifdef CONFIG_UX500_SOC_DB8500
28#define __UX500_UART(n) U8500_UART##n##_BASE 24#define __UX500_UART(n) U8500_UART##n##_BASE
29#endif 25#endif
diff --git a/arch/arm/mach-ux500/include/mach/devices.h b/arch/arm/mach-ux500/include/mach/devices.h
index 5f6cb71fc62d..9b5eb69a0154 100644
--- a/arch/arm/mach-ux500/include/mach/devices.h
+++ b/arch/arm/mach-ux500/include/mach/devices.h
@@ -10,7 +10,6 @@
10struct platform_device; 10struct platform_device;
11struct amba_device; 11struct amba_device;
12 12
13extern struct platform_device u5500_gpio_devs[];
14extern struct platform_device u8500_gpio_devs[]; 13extern struct platform_device u8500_gpio_devs[];
15 14
16extern struct amba_device ux500_pl031_device; 15extern struct amba_device ux500_pl031_device;
diff --git a/arch/arm/mach-ux500/include/mach/hardware.h b/arch/arm/mach-ux500/include/mach/hardware.h
index f84698936d36..808c1d6601c5 100644
--- a/arch/arm/mach-ux500/include/mach/hardware.h
+++ b/arch/arm/mach-ux500/include/mach/hardware.h
@@ -17,6 +17,8 @@
17 */ 17 */
18#define U8500_IO_VIRTUAL 0xf0000000 18#define U8500_IO_VIRTUAL 0xf0000000
19#define U8500_IO_PHYSICAL 0xa0000000 19#define U8500_IO_PHYSICAL 0xa0000000
20/* This is where we map in the ROM to check ASIC IDs */
21#define UX500_VIRT_ROM 0xf0000000
20 22
21/* This macro is used in assembly, so no cast */ 23/* This macro is used in assembly, so no cast */
22#define IO_ADDRESS(x) \ 24#define IO_ADDRESS(x) \
@@ -24,11 +26,11 @@
24 26
25/* typesafe io address */ 27/* typesafe io address */
26#define __io_address(n) IOMEM(IO_ADDRESS(n)) 28#define __io_address(n) IOMEM(IO_ADDRESS(n))
29
27/* Used by some plat-nomadik code */ 30/* Used by some plat-nomadik code */
28#define io_p2v(n) __io_address(n) 31#define io_p2v(n) __io_address(n)
29 32
30#include <mach/db8500-regs.h> 33#include <mach/db8500-regs.h>
31#include <mach/db5500-regs.h>
32 34
33#define MSP_TX_RX_REG_OFFSET 0 35#define MSP_TX_RX_REG_OFFSET 0
34 36
diff --git a/arch/arm/mach-ux500/include/mach/id.h b/arch/arm/mach-ux500/include/mach/id.h
index 833d6a6edc9b..c6e2db9e9e51 100644
--- a/arch/arm/mach-ux500/include/mach/id.h
+++ b/arch/arm/mach-ux500/include/mach/id.h
@@ -41,6 +41,16 @@ static inline bool __attribute_const__ cpu_is_u8500(void)
41 return dbx500_partnumber() == 0x8500; 41 return dbx500_partnumber() == 0x8500;
42} 42}
43 43
44static inline bool __attribute_const__ cpu_is_u9540(void)
45{
46 return dbx500_partnumber() == 0x9540;
47}
48
49static inline bool cpu_is_u8500_family(void)
50{
51 return cpu_is_u8500() || cpu_is_u9540();
52}
53
44static inline bool __attribute_const__ cpu_is_u5500(void) 54static inline bool __attribute_const__ cpu_is_u5500(void)
45{ 55{
46 return dbx500_partnumber() == 0x5500; 56 return dbx500_partnumber() == 0x5500;
@@ -111,7 +121,12 @@ static inline bool cpu_is_u8500v21(void)
111 121
112static inline bool cpu_is_u8500v20_or_later(void) 122static inline bool cpu_is_u8500v20_or_later(void)
113{ 123{
114 return cpu_is_u8500() && !cpu_is_u8500v10() && !cpu_is_u8500v11(); 124 /*
125 * U9540 has so much in common with U8500 that is is considered a
126 * U8500 variant.
127 */
128 return cpu_is_u9540() ||
129 (cpu_is_u8500() && !cpu_is_u8500v10() && !cpu_is_u8500v11());
115} 130}
116 131
117static inline bool ux500_is_svp(void) 132static inline bool ux500_is_svp(void)
diff --git a/arch/arm/mach-ux500/include/mach/irqs-board-u5500.h b/arch/arm/mach-ux500/include/mach/irqs-board-u5500.h
deleted file mode 100644
index 29d972c7717b..000000000000
--- a/arch/arm/mach-ux500/include/mach/irqs-board-u5500.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef __MACH_IRQS_BOARD_U5500_H
8#define __MACH_IRQS_BOARD_U5500_H
9
10#define AB5500_NR_IRQS 5
11#define IRQ_AB5500_BASE IRQ_BOARD_START
12#define IRQ_AB5500_END (IRQ_AB5500_BASE + AB5500_NR_IRQS)
13
14#define U5500_IRQ_END IRQ_AB5500_END
15
16#if IRQ_BOARD_END < U5500_IRQ_END
17#undef IRQ_BOARD_END
18#define IRQ_BOARD_END U5500_IRQ_END
19#endif
20
21#endif
diff --git a/arch/arm/mach-ux500/include/mach/irqs-db5500.h b/arch/arm/mach-ux500/include/mach/irqs-db5500.h
deleted file mode 100644
index 77239776a6f2..000000000000
--- a/arch/arm/mach-ux500/include/mach/irqs-db5500.h
+++ /dev/null
@@ -1,113 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef __MACH_IRQS_DB5500_H
9#define __MACH_IRQS_DB5500_H
10
11#define IRQ_DB5500_MTU0 (IRQ_SHPI_START + 4)
12#define IRQ_DB5500_SPI2 (IRQ_SHPI_START + 6)
13#define IRQ_DB5500_PMU0 (IRQ_SHPI_START + 7)
14#define IRQ_DB5500_SPI0 (IRQ_SHPI_START + 8)
15#define IRQ_DB5500_RTT (IRQ_SHPI_START + 9)
16#define IRQ_DB5500_PKA (IRQ_SHPI_START + 10)
17#define IRQ_DB5500_UART0 (IRQ_SHPI_START + 11)
18#define IRQ_DB5500_I2C3 (IRQ_SHPI_START + 12)
19#define IRQ_DB5500_L2CC (IRQ_SHPI_START + 13)
20#define IRQ_DB5500_MSP0 (IRQ_SHPI_START + 14)
21#define IRQ_DB5500_CRYP1 (IRQ_SHPI_START + 15)
22#define IRQ_DB5500_PMU1 (IRQ_SHPI_START + 16)
23#define IRQ_DB5500_MTU1 (IRQ_SHPI_START + 17)
24#define IRQ_DB5500_RTC (IRQ_SHPI_START + 18)
25#define IRQ_DB5500_UART1 (IRQ_SHPI_START + 19)
26#define IRQ_DB5500_USB_WAKEUP (IRQ_SHPI_START + 20)
27#define IRQ_DB5500_I2C0 (IRQ_SHPI_START + 21)
28#define IRQ_DB5500_I2C1 (IRQ_SHPI_START + 22)
29#define IRQ_DB5500_USBOTG (IRQ_SHPI_START + 23)
30#define IRQ_DB5500_DMA_SECURE (IRQ_SHPI_START + 24)
31#define IRQ_DB5500_DMA (IRQ_SHPI_START + 25)
32#define IRQ_DB5500_UART2 (IRQ_SHPI_START + 26)
33#define IRQ_DB5500_ICN_PMU1 (IRQ_SHPI_START + 27)
34#define IRQ_DB5500_ICN_PMU2 (IRQ_SHPI_START + 28)
35#define IRQ_DB5500_UART3 (IRQ_SHPI_START + 29)
36#define IRQ_DB5500_SPI3 (IRQ_SHPI_START + 30)
37#define IRQ_DB5500_SDMMC4 (IRQ_SHPI_START + 31)
38#define IRQ_DB5500_IRRC (IRQ_SHPI_START + 33)
39#define IRQ_DB5500_IRDA_FT (IRQ_SHPI_START + 34)
40#define IRQ_DB5500_IRDA_SD (IRQ_SHPI_START + 35)
41#define IRQ_DB5500_IRDA_FI (IRQ_SHPI_START + 36)
42#define IRQ_DB5500_IRDA_FD (IRQ_SHPI_START + 37)
43#define IRQ_DB5500_FSMC_CODEREADY (IRQ_SHPI_START + 38)
44#define IRQ_DB5500_FSMC_NANDWAIT (IRQ_SHPI_START + 39)
45#define IRQ_DB5500_AB5500 (IRQ_SHPI_START + 40)
46#define IRQ_DB5500_SDMMC2 (IRQ_SHPI_START + 41)
47#define IRQ_DB5500_SIA (IRQ_SHPI_START + 42)
48#define IRQ_DB5500_SIA2 (IRQ_SHPI_START + 43)
49#define IRQ_DB5500_HVA (IRQ_SHPI_START + 44)
50#define IRQ_DB5500_HVA2 (IRQ_SHPI_START + 45)
51#define IRQ_DB5500_PRCMU0 (IRQ_SHPI_START + 46)
52#define IRQ_DB5500_PRCMU1 (IRQ_SHPI_START + 47)
53#define IRQ_DB5500_DISP (IRQ_SHPI_START + 48)
54#define IRQ_DB5500_SDMMC1 (IRQ_SHPI_START + 50)
55#define IRQ_DB5500_MSP1 (IRQ_SHPI_START + 52)
56#define IRQ_DB5500_KBD (IRQ_SHPI_START + 53)
57#define IRQ_DB5500_I2C2 (IRQ_SHPI_START + 55)
58#define IRQ_DB5500_B2R2 (IRQ_SHPI_START + 56)
59#define IRQ_DB5500_CRYP0 (IRQ_SHPI_START + 57)
60#define IRQ_DB5500_SDMMC3 (IRQ_SHPI_START + 59)
61#define IRQ_DB5500_SDMMC0 (IRQ_SHPI_START + 60)
62#define IRQ_DB5500_HSEM (IRQ_SHPI_START + 61)
63#define IRQ_DB5500_SBAG (IRQ_SHPI_START + 63)
64#define IRQ_DB5500_MODEM (IRQ_SHPI_START + 65)
65#define IRQ_DB5500_SPI1 (IRQ_SHPI_START + 96)
66#define IRQ_DB5500_MSP2 (IRQ_SHPI_START + 98)
67#define IRQ_DB5500_SRPTIMER (IRQ_SHPI_START + 101)
68#define IRQ_DB5500_CTI0 (IRQ_SHPI_START + 108)
69#define IRQ_DB5500_CTI1 (IRQ_SHPI_START + 109)
70#define IRQ_DB5500_ICN_ERR (IRQ_SHPI_START + 110)
71#define IRQ_DB5500_MALI_PPMMU (IRQ_SHPI_START + 112)
72#define IRQ_DB5500_MALI_PP (IRQ_SHPI_START + 113)
73#define IRQ_DB5500_MALI_GPMMU (IRQ_SHPI_START + 114)
74#define IRQ_DB5500_MALI_GP (IRQ_SHPI_START + 115)
75#define IRQ_DB5500_MALI (IRQ_SHPI_START + 116)
76#define IRQ_DB5500_PRCMU_SEM (IRQ_SHPI_START + 118)
77#define IRQ_DB5500_GPIO0 (IRQ_SHPI_START + 119)
78#define IRQ_DB5500_GPIO1 (IRQ_SHPI_START + 120)
79#define IRQ_DB5500_GPIO2 (IRQ_SHPI_START + 121)
80#define IRQ_DB5500_GPIO3 (IRQ_SHPI_START + 122)
81#define IRQ_DB5500_GPIO4 (IRQ_SHPI_START + 123)
82#define IRQ_DB5500_GPIO5 (IRQ_SHPI_START + 124)
83#define IRQ_DB5500_GPIO6 (IRQ_SHPI_START + 125)
84#define IRQ_DB5500_GPIO7 (IRQ_SHPI_START + 126)
85
86#ifdef CONFIG_UX500_SOC_DB5500
87
88/*
89 * After the GPIO ones we reserve a range of IRQ:s in which virtual
90 * IRQ:s representing modem IRQ:s can be allocated
91 */
92#define IRQ_MODEM_EVENTS_BASE IRQ_SOC_START
93#define IRQ_MODEM_EVENTS_NBR 72
94#define IRQ_MODEM_EVENTS_END (IRQ_MODEM_EVENTS_BASE + IRQ_MODEM_EVENTS_NBR)
95
96/* List of virtual IRQ:s that are allocated from the range above */
97#define MBOX_PAIR0_VIRT_IRQ (IRQ_MODEM_EVENTS_BASE + 43)
98#define MBOX_PAIR1_VIRT_IRQ (IRQ_MODEM_EVENTS_BASE + 45)
99#define MBOX_PAIR2_VIRT_IRQ (IRQ_MODEM_EVENTS_BASE + 41)
100
101/*
102 * We may have several SoCs, but only one will run at a
103 * time, so the one with most IRQs will bump this ahead,
104 * but the IRQ_SOC_START remains the same for either SoC.
105 */
106#if IRQ_SOC_END < IRQ_MODEM_EVENTS_END
107#undef IRQ_SOC_END
108#define IRQ_SOC_END IRQ_MODEM_EVENTS_END
109#endif
110
111#endif /* CONFIG_UX500_SOC_DB5500 */
112
113#endif
diff --git a/arch/arm/mach-ux500/include/mach/irqs.h b/arch/arm/mach-ux500/include/mach/irqs.h
index c23a6b5f0c4e..e8928548b6a3 100644
--- a/arch/arm/mach-ux500/include/mach/irqs.h
+++ b/arch/arm/mach-ux500/include/mach/irqs.h
@@ -24,7 +24,7 @@
24 */ 24 */
25#define IRQ_MTU0 (IRQ_SHPI_START + 4) 25#define IRQ_MTU0 (IRQ_SHPI_START + 4)
26 26
27#define DBX500_NR_INTERNAL_IRQS 160 27#define DBX500_NR_INTERNAL_IRQS 166
28 28
29/* After chip-specific IRQ numbers we have the GPIO ones */ 29/* After chip-specific IRQ numbers we have the GPIO ones */
30#define NOMADIK_NR_GPIO 288 30#define NOMADIK_NR_GPIO 288
@@ -36,7 +36,6 @@
36/* This will be overridden by SoC-specific irq headers */ 36/* This will be overridden by SoC-specific irq headers */
37#define IRQ_SOC_END IRQ_SOC_START 37#define IRQ_SOC_END IRQ_SOC_START
38 38
39#include <mach/irqs-db5500.h>
40#include <mach/irqs-db8500.h> 39#include <mach/irqs-db8500.h>
41 40
42#define IRQ_BOARD_START IRQ_SOC_END 41#define IRQ_BOARD_START IRQ_SOC_END
@@ -47,10 +46,6 @@
47#include <mach/irqs-board-mop500.h> 46#include <mach/irqs-board-mop500.h>
48#endif 47#endif
49 48
50#ifdef CONFIG_MACH_U5500
51#include <mach/irqs-board-u5500.h>
52#endif
53
54#define NR_IRQS IRQ_BOARD_END 49#define NR_IRQS IRQ_BOARD_END
55 50
56#endif /* ASM_ARCH_IRQS_H */ 51#endif /* ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-ux500/include/mach/mbox-db5500.h b/arch/arm/mach-ux500/include/mach/mbox-db5500.h
deleted file mode 100644
index 7f9da4d2fbda..000000000000
--- a/arch/arm/mach-ux500/include/mach/mbox-db5500.h
+++ /dev/null
@@ -1,88 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 * Author: Stefan Nilsson <stefan.xk.nilsson@stericsson.com> for ST-Ericsson.
4 * Author: Martin Persson <martin.persson@stericsson.com> for ST-Ericsson.
5 * License terms: GNU General Public License (GPL), version 2.
6 */
7
8#ifndef __INC_STE_MBOX_H
9#define __INC_STE_MBOX_H
10
11#define MBOX_BUF_SIZE 16
12#define MBOX_NAME_SIZE 8
13
14/**
15 * mbox_recv_cb_t - Definition of the mailbox callback.
16 * @mbox_msg: The mailbox message.
17 * @priv: The clients private data as specified in the call to mbox_setup.
18 *
19 * This function will be called upon reception of new mailbox messages.
20 */
21typedef void mbox_recv_cb_t (u32 mbox_msg, void *priv);
22
23/**
24 * struct mbox - Mailbox instance struct
25 * @list: Linked list head.
26 * @pdev: Pointer to device struct.
27 * @cb: Callback function. Will be called
28 * when new data is received.
29 * @client_data: Clients private data. Will be sent back
30 * in the callback function.
31 * @virtbase_peer: Virtual address for outgoing mailbox.
32 * @virtbase_local: Virtual address for incoming mailbox.
33 * @buffer: Then internal queue for outgoing messages.
34 * @name: Name of this mailbox.
35 * @buffer_available: Completion variable to achieve "blocking send".
36 * This variable will be signaled when there is
37 * internal buffer space available.
38 * @client_blocked: To keep track if any client is currently
39 * blocked.
40 * @lock: Spinlock to protect this mailbox instance.
41 * @write_index: Index in internal buffer to write to.
42 * @read_index: Index in internal buffer to read from.
43 * @allocated: Indicates whether this particular mailbox
44 * id has been allocated by someone.
45 */
46struct mbox {
47 struct list_head list;
48 struct platform_device *pdev;
49 mbox_recv_cb_t *cb;
50 void *client_data;
51 void __iomem *virtbase_peer;
52 void __iomem *virtbase_local;
53 u32 buffer[MBOX_BUF_SIZE];
54 char name[MBOX_NAME_SIZE];
55 struct completion buffer_available;
56 u8 client_blocked;
57 spinlock_t lock;
58 u8 write_index;
59 u8 read_index;
60 bool allocated;
61};
62
63/**
64 * mbox_setup - Set up a mailbox and return its instance.
65 * @mbox_id: The ID number of the mailbox. 0 or 1 for modem CPU,
66 * 2 for modem DSP.
67 * @mbox_cb: Pointer to the callback function to be called when a new message
68 * is received.
69 * @priv: Client user data which will be returned in the callback.
70 *
71 * Returns a mailbox instance to be specified in subsequent calls to mbox_send.
72 */
73struct mbox *mbox_setup(u8 mbox_id, mbox_recv_cb_t *mbox_cb, void *priv);
74
75/**
76 * mbox_send - Send a mailbox message.
77 * @mbox: Mailbox instance (returned by mbox_setup)
78 * @mbox_msg: The mailbox message to send.
79 * @block: Specifies whether this call will block until send is possible,
80 * or return an error if the mailbox buffer is full.
81 *
82 * Returns 0 on success or a negative error code on error. -ENOMEM indicates
83 * that the internal buffer is full and you have to try again later (or
84 * specify "block" in order to block until send is possible).
85 */
86int mbox_send(struct mbox *mbox, u32 mbox_msg, bool block);
87
88#endif /*INC_STE_MBOX_H*/
diff --git a/arch/arm/mach-ux500/include/mach/msp.h b/arch/arm/mach-ux500/include/mach/msp.h
new file mode 100644
index 000000000000..798be19129ef
--- /dev/null
+++ b/arch/arm/mach-ux500/include/mach/msp.h
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL), version 2.
6 */
7
8#ifndef __MSP_H
9#define __MSP_H
10
11#include <plat/ste_dma40.h>
12
13enum msp_i2s_id {
14 MSP_I2S_0 = 0,
15 MSP_I2S_1,
16 MSP_I2S_2,
17 MSP_I2S_3,
18};
19
20/* Platform data structure for a MSP I2S-device */
21struct msp_i2s_platform_data {
22 enum msp_i2s_id id;
23 struct stedma40_chan_cfg *msp_i2s_dma_rx;
24 struct stedma40_chan_cfg *msp_i2s_dma_tx;
25 int (*msp_i2s_init) (void);
26 int (*msp_i2s_exit) (void);
27};
28
29#endif
diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h
index 3dc00ffa7bfa..4e369f1645ec 100644
--- a/arch/arm/mach-ux500/include/mach/setup.h
+++ b/arch/arm/mach-ux500/include/mach/setup.h
@@ -15,18 +15,12 @@
15#include <linux/init.h> 15#include <linux/init.h>
16 16
17void __init ux500_map_io(void); 17void __init ux500_map_io(void);
18extern void __init u5500_map_io(void);
19extern void __init u8500_map_io(void); 18extern void __init u8500_map_io(void);
20 19
21extern struct device * __init u5500_init_devices(void);
22extern struct device * __init u8500_init_devices(void); 20extern struct device * __init u8500_init_devices(void);
23 21
24extern void __init ux500_init_irq(void); 22extern void __init ux500_init_irq(void);
25 23
26extern void __init u5500_sdi_init(struct device *parent);
27
28extern void __init db5500_dma_init(struct device *parent);
29
30extern struct device *ux500_soc_device_init(const char *soc_id); 24extern struct device *ux500_soc_device_init(const char *soc_id);
31 25
32struct amba_device; 26struct amba_device;
diff --git a/arch/arm/mach-ux500/include/mach/uncompress.h b/arch/arm/mach-ux500/include/mach/uncompress.h
index 6fb3c4b0105d..34775baadaea 100644
--- a/arch/arm/mach-ux500/include/mach/uncompress.h
+++ b/arch/arm/mach-ux500/include/mach/uncompress.h
@@ -50,11 +50,8 @@ static void flush(void)
50 50
51static inline void arch_decomp_setup(void) 51static inline void arch_decomp_setup(void)
52{ 52{
53 /* Check in run time if we run on an U8500 or U5500 */ 53 /* Use machine_is_foo() macro if you need to switch base someday */
54 if (machine_is_u5500()) 54 ux500_uart_base = U8500_UART2_BASE;
55 ux500_uart_base = U5500_UART0_BASE;
56 else
57 ux500_uart_base = U8500_UART2_BASE;
58} 55}
59 56
60#define arch_decomp_wdog() /* nothing to do here */ 57#define arch_decomp_wdog() /* nothing to do here */
diff --git a/arch/arm/mach-ux500/mbox-db5500.c b/arch/arm/mach-ux500/mbox-db5500.c
deleted file mode 100644
index 2b2d51caf9d8..000000000000
--- a/arch/arm/mach-ux500/mbox-db5500.c
+++ /dev/null
@@ -1,565 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 * Author: Stefan Nilsson <stefan.xk.nilsson@stericsson.com> for ST-Ericsson.
4 * Author: Martin Persson <martin.persson@stericsson.com> for ST-Ericsson.
5 * License terms: GNU General Public License (GPL), version 2.
6 */
7
8/*
9 * Mailbox nomenclature:
10 *
11 * APE MODEM
12 * mbox pairX
13 * ..........................
14 * . .
15 * . peer .
16 * . send ---- .
17 * . --> | | .
18 * . | | .
19 * . ---- .
20 * . .
21 * . local .
22 * . rec ---- .
23 * . | | <-- .
24 * . | | .
25 * . ---- .
26 * .........................
27 */
28
29#include <linux/init.h>
30#include <linux/module.h>
31#include <linux/device.h>
32#include <linux/interrupt.h>
33#include <linux/spinlock.h>
34#include <linux/errno.h>
35#include <linux/io.h>
36#include <linux/irq.h>
37#include <linux/platform_device.h>
38#include <linux/debugfs.h>
39#include <linux/seq_file.h>
40#include <linux/completion.h>
41#include <mach/mbox-db5500.h>
42
43#define MBOX_NAME "mbox"
44
45#define MBOX_FIFO_DATA 0x000
46#define MBOX_FIFO_ADD 0x004
47#define MBOX_FIFO_REMOVE 0x008
48#define MBOX_FIFO_THRES_FREE 0x00C
49#define MBOX_FIFO_THRES_OCCUP 0x010
50#define MBOX_FIFO_STATUS 0x014
51
52#define MBOX_DISABLE_IRQ 0x4
53#define MBOX_ENABLE_IRQ 0x0
54#define MBOX_LATCH 1
55
56/* Global list of all mailboxes */
57static struct list_head mboxs = LIST_HEAD_INIT(mboxs);
58
59static struct mbox *get_mbox_with_id(u8 id)
60{
61 u8 i;
62 struct list_head *pos = &mboxs;
63 for (i = 0; i <= id; i++)
64 pos = pos->next;
65
66 return (struct mbox *) list_entry(pos, struct mbox, list);
67}
68
69int mbox_send(struct mbox *mbox, u32 mbox_msg, bool block)
70{
71 int res = 0;
72
73 spin_lock(&mbox->lock);
74
75 dev_dbg(&(mbox->pdev->dev),
76 "About to buffer 0x%X to mailbox 0x%X."
77 " ri = %d, wi = %d\n",
78 mbox_msg, (u32)mbox, mbox->read_index,
79 mbox->write_index);
80
81 /* Check if write buffer is full */
82 while (((mbox->write_index + 1) % MBOX_BUF_SIZE) == mbox->read_index) {
83 if (!block) {
84 dev_dbg(&(mbox->pdev->dev),
85 "Buffer full in non-blocking call! "
86 "Returning -ENOMEM!\n");
87 res = -ENOMEM;
88 goto exit;
89 }
90 spin_unlock(&mbox->lock);
91 dev_dbg(&(mbox->pdev->dev),
92 "Buffer full in blocking call! Sleeping...\n");
93 mbox->client_blocked = 1;
94 wait_for_completion(&mbox->buffer_available);
95 dev_dbg(&(mbox->pdev->dev),
96 "Blocking send was woken up! Trying again...\n");
97 spin_lock(&mbox->lock);
98 }
99
100 mbox->buffer[mbox->write_index] = mbox_msg;
101 mbox->write_index = (mbox->write_index + 1) % MBOX_BUF_SIZE;
102
103 /*
104 * Indicate that we want an IRQ as soon as there is a slot
105 * in the FIFO
106 */
107 writel(MBOX_ENABLE_IRQ, mbox->virtbase_peer + MBOX_FIFO_THRES_FREE);
108
109exit:
110 spin_unlock(&mbox->lock);
111 return res;
112}
113EXPORT_SYMBOL(mbox_send);
114
115#if defined(CONFIG_DEBUG_FS)
116/*
117 * Expected input: <value> <nbr sends>
118 * Example: "echo 0xdeadbeef 4 > mbox-node" sends 0xdeadbeef 4 times
119 */
120static ssize_t mbox_write_fifo(struct device *dev,
121 struct device_attribute *attr,
122 const char *buf,
123 size_t count)
124{
125 unsigned long mbox_mess;
126 unsigned long nbr_sends;
127 unsigned long i;
128 char int_buf[16];
129 char *token;
130 char *val;
131
132 struct mbox *mbox = (struct mbox *) dev->platform_data;
133
134 strncpy((char *) &int_buf, buf, sizeof(int_buf));
135 token = (char *) &int_buf;
136
137 /* Parse message */
138 val = strsep(&token, " ");
139 if ((val == NULL) || (strict_strtoul(val, 16, &mbox_mess) != 0))
140 mbox_mess = 0xDEADBEEF;
141
142 val = strsep(&token, " ");
143 if ((val == NULL) || (strict_strtoul(val, 10, &nbr_sends) != 0))
144 nbr_sends = 1;
145
146 dev_dbg(dev, "Will write 0x%lX %ld times using data struct at 0x%X\n",
147 mbox_mess, nbr_sends, (u32) mbox);
148
149 for (i = 0; i < nbr_sends; i++)
150 mbox_send(mbox, mbox_mess, true);
151
152 return count;
153}
154
155static ssize_t mbox_read_fifo(struct device *dev,
156 struct device_attribute *attr,
157 char *buf)
158{
159 int mbox_value;
160 struct mbox *mbox = (struct mbox *) dev->platform_data;
161
162 if ((readl(mbox->virtbase_local + MBOX_FIFO_STATUS) & 0x7) <= 0)
163 return sprintf(buf, "Mailbox is empty\n");
164
165 mbox_value = readl(mbox->virtbase_local + MBOX_FIFO_DATA);
166 writel(MBOX_LATCH, (mbox->virtbase_local + MBOX_FIFO_REMOVE));
167
168 return sprintf(buf, "0x%X\n", mbox_value);
169}
170
171static DEVICE_ATTR(fifo, S_IWUGO | S_IRUGO, mbox_read_fifo, mbox_write_fifo);
172
173static int mbox_show(struct seq_file *s, void *data)
174{
175 struct list_head *pos;
176 u8 mbox_index = 0;
177
178 list_for_each(pos, &mboxs) {
179 struct mbox *m =
180 (struct mbox *) list_entry(pos, struct mbox, list);
181 if (m == NULL) {
182 seq_printf(s,
183 "Unable to retrieve mailbox %d\n",
184 mbox_index);
185 continue;
186 }
187
188 spin_lock(&m->lock);
189 if ((m->virtbase_peer == NULL) || (m->virtbase_local == NULL)) {
190 seq_printf(s, "MAILBOX %d not setup or corrupt\n",
191 mbox_index);
192 spin_unlock(&m->lock);
193 continue;
194 }
195
196 seq_printf(s,
197 "===========================\n"
198 " MAILBOX %d\n"
199 " PEER MAILBOX DUMP\n"
200 "---------------------------\n"
201 "FIFO: 0x%X (%d)\n"
202 "Free Threshold: 0x%.2X (%d)\n"
203 "Occupied Threshold: 0x%.2X (%d)\n"
204 "Status: 0x%.2X (%d)\n"
205 " Free spaces (ot): %d (%d)\n"
206 " Occup spaces (ot): %d (%d)\n"
207 "===========================\n"
208 " LOCAL MAILBOX DUMP\n"
209 "---------------------------\n"
210 "FIFO: 0x%.X (%d)\n"
211 "Free Threshold: 0x%.2X (%d)\n"
212 "Occupied Threshold: 0x%.2X (%d)\n"
213 "Status: 0x%.2X (%d)\n"
214 " Free spaces (ot): %d (%d)\n"
215 " Occup spaces (ot): %d (%d)\n"
216 "===========================\n"
217 "write_index: %d\n"
218 "read_index : %d\n"
219 "===========================\n"
220 "\n",
221 mbox_index,
222 readl(m->virtbase_peer + MBOX_FIFO_DATA),
223 readl(m->virtbase_peer + MBOX_FIFO_DATA),
224 readl(m->virtbase_peer + MBOX_FIFO_THRES_FREE),
225 readl(m->virtbase_peer + MBOX_FIFO_THRES_FREE),
226 readl(m->virtbase_peer + MBOX_FIFO_THRES_OCCUP),
227 readl(m->virtbase_peer + MBOX_FIFO_THRES_OCCUP),
228 readl(m->virtbase_peer + MBOX_FIFO_STATUS),
229 readl(m->virtbase_peer + MBOX_FIFO_STATUS),
230 (readl(m->virtbase_peer + MBOX_FIFO_STATUS) >> 4) & 0x7,
231 (readl(m->virtbase_peer + MBOX_FIFO_STATUS) >> 7) & 0x1,
232 (readl(m->virtbase_peer + MBOX_FIFO_STATUS) >> 0) & 0x7,
233 (readl(m->virtbase_peer + MBOX_FIFO_STATUS) >> 3) & 0x1,
234 readl(m->virtbase_local + MBOX_FIFO_DATA),
235 readl(m->virtbase_local + MBOX_FIFO_DATA),
236 readl(m->virtbase_local + MBOX_FIFO_THRES_FREE),
237 readl(m->virtbase_local + MBOX_FIFO_THRES_FREE),
238 readl(m->virtbase_local + MBOX_FIFO_THRES_OCCUP),
239 readl(m->virtbase_local + MBOX_FIFO_THRES_OCCUP),
240 readl(m->virtbase_local + MBOX_FIFO_STATUS),
241 readl(m->virtbase_local + MBOX_FIFO_STATUS),
242 (readl(m->virtbase_local + MBOX_FIFO_STATUS) >> 4) & 0x7,
243 (readl(m->virtbase_local + MBOX_FIFO_STATUS) >> 7) & 0x1,
244 (readl(m->virtbase_local + MBOX_FIFO_STATUS) >> 0) & 0x7,
245 (readl(m->virtbase_local + MBOX_FIFO_STATUS) >> 3) & 0x1,
246 m->write_index, m->read_index);
247 mbox_index++;
248 spin_unlock(&m->lock);
249 }
250
251 return 0;
252}
253
254static int mbox_open(struct inode *inode, struct file *file)
255{
256 return single_open(file, mbox_show, NULL);
257}
258
259static const struct file_operations mbox_operations = {
260 .owner = THIS_MODULE,
261 .open = mbox_open,
262 .read = seq_read,
263 .llseek = seq_lseek,
264 .release = single_release,
265};
266#endif
267
268static irqreturn_t mbox_irq(int irq, void *arg)
269{
270 u32 mbox_value;
271 int nbr_occup;
272 int nbr_free;
273 struct mbox *mbox = (struct mbox *) arg;
274
275 spin_lock(&mbox->lock);
276
277 dev_dbg(&(mbox->pdev->dev),
278 "mbox IRQ [%d] received. ri = %d, wi = %d\n",
279 irq, mbox->read_index, mbox->write_index);
280
281 /*
282 * Check if we have any outgoing messages, and if there is space for
283 * them in the FIFO.
284 */
285 if (mbox->read_index != mbox->write_index) {
286 /*
287 * Check by reading FREE for LOCAL since that indicates
288 * OCCUP for PEER
289 */
290 nbr_free = (readl(mbox->virtbase_local + MBOX_FIFO_STATUS)
291 >> 4) & 0x7;
292 dev_dbg(&(mbox->pdev->dev),
293 "Status indicates %d empty spaces in the FIFO!\n",
294 nbr_free);
295
296 while ((nbr_free > 0) &&
297 (mbox->read_index != mbox->write_index)) {
298 /* Write the message and latch it into the FIFO */
299 writel(mbox->buffer[mbox->read_index],
300 (mbox->virtbase_peer + MBOX_FIFO_DATA));
301 writel(MBOX_LATCH,
302 (mbox->virtbase_peer + MBOX_FIFO_ADD));
303 dev_dbg(&(mbox->pdev->dev),
304 "Wrote message 0x%X to addr 0x%X\n",
305 mbox->buffer[mbox->read_index],
306 (u32) (mbox->virtbase_peer + MBOX_FIFO_DATA));
307
308 nbr_free--;
309 mbox->read_index =
310 (mbox->read_index + 1) % MBOX_BUF_SIZE;
311 }
312
313 /*
314 * Check if we still want IRQ:s when there is free
315 * space to send
316 */
317 if (mbox->read_index != mbox->write_index) {
318 dev_dbg(&(mbox->pdev->dev),
319 "Still have messages to send, but FIFO full. "
320 "Request IRQ again!\n");
321 writel(MBOX_ENABLE_IRQ,
322 mbox->virtbase_peer + MBOX_FIFO_THRES_FREE);
323 } else {
324 dev_dbg(&(mbox->pdev->dev),
325 "No more messages to send. "
326 "Do not request IRQ again!\n");
327 writel(MBOX_DISABLE_IRQ,
328 mbox->virtbase_peer + MBOX_FIFO_THRES_FREE);
329 }
330
331 /*
332 * Check if we can signal any blocked clients that it is OK to
333 * start buffering again
334 */
335 if (mbox->client_blocked &&
336 (((mbox->write_index + 1) % MBOX_BUF_SIZE)
337 != mbox->read_index)) {
338 dev_dbg(&(mbox->pdev->dev),
339 "Waking up blocked client\n");
340 complete(&mbox->buffer_available);
341 mbox->client_blocked = 0;
342 }
343 }
344
345 /* Check if we have any incoming messages */
346 nbr_occup = readl(mbox->virtbase_local + MBOX_FIFO_STATUS) & 0x7;
347 if (nbr_occup == 0)
348 goto exit;
349
350 if (mbox->cb == NULL) {
351 dev_dbg(&(mbox->pdev->dev), "No receive callback registered, "
352 "leaving %d incoming messages in fifo!\n", nbr_occup);
353 goto exit;
354 }
355
356 /* Read and acknowledge the message */
357 mbox_value = readl(mbox->virtbase_local + MBOX_FIFO_DATA);
358 writel(MBOX_LATCH, (mbox->virtbase_local + MBOX_FIFO_REMOVE));
359
360 /* Notify consumer of new mailbox message */
361 dev_dbg(&(mbox->pdev->dev), "Calling callback for message 0x%X!\n",
362 mbox_value);
363 mbox->cb(mbox_value, mbox->client_data);
364
365exit:
366 dev_dbg(&(mbox->pdev->dev), "Exit mbox IRQ. ri = %d, wi = %d\n",
367 mbox->read_index, mbox->write_index);
368 spin_unlock(&mbox->lock);
369
370 return IRQ_HANDLED;
371}
372
373/* Setup is executed once for each mbox pair */
374struct mbox *mbox_setup(u8 mbox_id, mbox_recv_cb_t *mbox_cb, void *priv)
375{
376 struct resource *resource;
377 int irq;
378 int res;
379 struct mbox *mbox;
380
381 mbox = get_mbox_with_id(mbox_id);
382 if (mbox == NULL) {
383 dev_err(&(mbox->pdev->dev), "Incorrect mailbox id: %d!\n",
384 mbox_id);
385 goto exit;
386 }
387
388 /*
389 * Check if mailbox has been allocated to someone else,
390 * otherwise allocate it
391 */
392 if (mbox->allocated) {
393 dev_err(&(mbox->pdev->dev), "Mailbox number %d is busy!\n",
394 mbox_id);
395 mbox = NULL;
396 goto exit;
397 }
398 mbox->allocated = true;
399
400 dev_dbg(&(mbox->pdev->dev), "Initiating mailbox number %d: 0x%X...\n",
401 mbox_id, (u32)mbox);
402
403 mbox->client_data = priv;
404 mbox->cb = mbox_cb;
405
406 /* Get addr for peer mailbox and ioremap it */
407 resource = platform_get_resource_byname(mbox->pdev,
408 IORESOURCE_MEM,
409 "mbox_peer");
410 if (resource == NULL) {
411 dev_err(&(mbox->pdev->dev),
412 "Unable to retrieve mbox peer resource\n");
413 mbox = NULL;
414 goto exit;
415 }
416 dev_dbg(&(mbox->pdev->dev),
417 "Resource name: %s start: 0x%X, end: 0x%X\n",
418 resource->name, resource->start, resource->end);
419 mbox->virtbase_peer = ioremap(resource->start, resource_size(resource));
420 if (!mbox->virtbase_peer) {
421 dev_err(&(mbox->pdev->dev), "Unable to ioremap peer mbox\n");
422 mbox = NULL;
423 goto exit;
424 }
425 dev_dbg(&(mbox->pdev->dev),
426 "ioremapped peer physical: (0x%X-0x%X) to virtual: 0x%X\n",
427 resource->start, resource->end, (u32) mbox->virtbase_peer);
428
429 /* Get addr for local mailbox and ioremap it */
430 resource = platform_get_resource_byname(mbox->pdev,
431 IORESOURCE_MEM,
432 "mbox_local");
433 if (resource == NULL) {
434 dev_err(&(mbox->pdev->dev),
435 "Unable to retrieve mbox local resource\n");
436 mbox = NULL;
437 goto exit;
438 }
439 dev_dbg(&(mbox->pdev->dev),
440 "Resource name: %s start: 0x%X, end: 0x%X\n",
441 resource->name, resource->start, resource->end);
442 mbox->virtbase_local = ioremap(resource->start, resource_size(resource));
443 if (!mbox->virtbase_local) {
444 dev_err(&(mbox->pdev->dev), "Unable to ioremap local mbox\n");
445 mbox = NULL;
446 goto exit;
447 }
448 dev_dbg(&(mbox->pdev->dev),
449 "ioremapped local physical: (0x%X-0x%X) to virtual: 0x%X\n",
450 resource->start, resource->end, (u32) mbox->virtbase_peer);
451
452 init_completion(&mbox->buffer_available);
453 mbox->client_blocked = 0;
454
455 /* Get IRQ for mailbox and allocate it */
456 irq = platform_get_irq_byname(mbox->pdev, "mbox_irq");
457 if (irq < 0) {
458 dev_err(&(mbox->pdev->dev),
459 "Unable to retrieve mbox irq resource\n");
460 mbox = NULL;
461 goto exit;
462 }
463
464 dev_dbg(&(mbox->pdev->dev), "Allocating irq %d...\n", irq);
465 res = request_irq(irq, mbox_irq, 0, mbox->name, (void *) mbox);
466 if (res < 0) {
467 dev_err(&(mbox->pdev->dev),
468 "Unable to allocate mbox irq %d\n", irq);
469 mbox = NULL;
470 goto exit;
471 }
472
473 /* Set up mailbox to not launch IRQ on free space in mailbox */
474 writel(MBOX_DISABLE_IRQ, mbox->virtbase_peer + MBOX_FIFO_THRES_FREE);
475
476 /*
477 * Set up mailbox to launch IRQ on new message if we have
478 * a callback set. If not, do not raise IRQ, but keep message
479 * in FIFO for manual retrieval
480 */
481 if (mbox_cb != NULL)
482 writel(MBOX_ENABLE_IRQ,
483 mbox->virtbase_local + MBOX_FIFO_THRES_OCCUP);
484 else
485 writel(MBOX_DISABLE_IRQ,
486 mbox->virtbase_local + MBOX_FIFO_THRES_OCCUP);
487
488#if defined(CONFIG_DEBUG_FS)
489 res = device_create_file(&(mbox->pdev->dev), &dev_attr_fifo);
490 if (res != 0)
491 dev_warn(&(mbox->pdev->dev),
492 "Unable to create mbox sysfs entry");
493
494 (void) debugfs_create_file("mbox", S_IFREG | S_IRUGO, NULL,
495 NULL, &mbox_operations);
496#endif
497
498 dev_info(&(mbox->pdev->dev),
499 "Mailbox driver with index %d initiated!\n", mbox_id);
500
501exit:
502 return mbox;
503}
504EXPORT_SYMBOL(mbox_setup);
505
506
507int __init mbox_probe(struct platform_device *pdev)
508{
509 struct mbox local_mbox;
510 struct mbox *mbox;
511 int res = 0;
512 dev_dbg(&(pdev->dev), "Probing mailbox (pdev = 0x%X)...\n", (u32) pdev);
513
514 memset(&local_mbox, 0x0, sizeof(struct mbox));
515
516 /* Associate our mbox data with the platform device */
517 res = platform_device_add_data(pdev,
518 (void *) &local_mbox,
519 sizeof(struct mbox));
520 if (res != 0) {
521 dev_err(&(pdev->dev),
522 "Unable to allocate driver platform data!\n");
523 goto exit;
524 }
525
526 mbox = (struct mbox *) pdev->dev.platform_data;
527 mbox->pdev = pdev;
528 mbox->write_index = 0;
529 mbox->read_index = 0;
530
531 INIT_LIST_HEAD(&(mbox->list));
532 list_add_tail(&(mbox->list), &mboxs);
533
534 sprintf(mbox->name, "%s", MBOX_NAME);
535 spin_lock_init(&mbox->lock);
536
537 dev_info(&(pdev->dev), "Mailbox driver loaded\n");
538
539exit:
540 return res;
541}
542
543static struct platform_driver mbox_driver = {
544 .driver = {
545 .name = MBOX_NAME,
546 .owner = THIS_MODULE,
547 },
548};
549
550static int __init mbox_init(void)
551{
552 return platform_driver_probe(&mbox_driver, mbox_probe);
553}
554
555module_init(mbox_init);
556
557void __exit mbox_exit(void)
558{
559 platform_driver_unregister(&mbox_driver);
560}
561
562module_exit(mbox_exit);
563
564MODULE_LICENSE("GPL");
565MODULE_DESCRIPTION("MBOX driver");
diff --git a/arch/arm/mach-ux500/modem-irq-db5500.c b/arch/arm/mach-ux500/modem-irq-db5500.c
deleted file mode 100644
index 6b86416c94c9..000000000000
--- a/arch/arm/mach-ux500/modem-irq-db5500.c
+++ /dev/null
@@ -1,143 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 * Author: Stefan Nilsson <stefan.xk.nilsson@stericsson.com> for ST-Ericsson.
4 * Author: Martin Persson <martin.persson@stericsson.com> for ST-Ericsson.
5 * License terms: GNU General Public License (GPL), version 2.
6 */
7
8#include <linux/module.h>
9#include <linux/kernel.h>
10#include <linux/irq.h>
11#include <linux/interrupt.h>
12#include <linux/io.h>
13#include <linux/slab.h>
14
15#include <mach/id.h>
16
17#define MODEM_INTCON_BASE_ADDR 0xBFFD3000
18#define MODEM_INTCON_SIZE 0xFFF
19
20#define DEST_IRQ41_OFFSET 0x2A4
21#define DEST_IRQ43_OFFSET 0x2AC
22#define DEST_IRQ45_OFFSET 0x2B4
23
24#define PRIO_IRQ41_OFFSET 0x6A4
25#define PRIO_IRQ43_OFFSET 0x6AC
26#define PRIO_IRQ45_OFFSET 0x6B4
27
28#define ALLOW_IRQ_OFFSET 0x104
29
30#define MODEM_INTCON_CPU_NBR 0x1
31#define MODEM_INTCON_PRIO_HIGH 0x0
32
33#define MODEM_INTCON_ALLOW_IRQ41 0x0200
34#define MODEM_INTCON_ALLOW_IRQ43 0x0800
35#define MODEM_INTCON_ALLOW_IRQ45 0x2000
36
37#define MODEM_IRQ_REG_OFFSET 0x4
38
39struct modem_irq {
40 void __iomem *modem_intcon_base;
41};
42
43
44static void setup_modem_intcon(void __iomem *modem_intcon_base)
45{
46 /* IC_DESTINATION_BASE_ARRAY - Which CPU to receive the IRQ */
47 writel(MODEM_INTCON_CPU_NBR, modem_intcon_base + DEST_IRQ41_OFFSET);
48 writel(MODEM_INTCON_CPU_NBR, modem_intcon_base + DEST_IRQ43_OFFSET);
49 writel(MODEM_INTCON_CPU_NBR, modem_intcon_base + DEST_IRQ45_OFFSET);
50
51 /* IC_PRIORITY_BASE_ARRAY - IRQ priority in modem IRQ controller */
52 writel(MODEM_INTCON_PRIO_HIGH, modem_intcon_base + PRIO_IRQ41_OFFSET);
53 writel(MODEM_INTCON_PRIO_HIGH, modem_intcon_base + PRIO_IRQ43_OFFSET);
54 writel(MODEM_INTCON_PRIO_HIGH, modem_intcon_base + PRIO_IRQ45_OFFSET);
55
56 /* IC_ALLOW_ARRAY - IRQ enable */
57 writel(MODEM_INTCON_ALLOW_IRQ41 |
58 MODEM_INTCON_ALLOW_IRQ43 |
59 MODEM_INTCON_ALLOW_IRQ45,
60 modem_intcon_base + ALLOW_IRQ_OFFSET);
61}
62
63static irqreturn_t modem_cpu_irq_handler(int irq, void *data)
64{
65 int real_irq;
66 int virt_irq;
67 struct modem_irq *mi = (struct modem_irq *)data;
68
69 /* Read modem side IRQ number from modem IRQ controller */
70 real_irq = readl(mi->modem_intcon_base + MODEM_IRQ_REG_OFFSET) & 0xFF;
71 virt_irq = IRQ_MODEM_EVENTS_BASE + real_irq;
72
73 pr_debug("modem_irq: Worker read addr 0x%X and got value 0x%X "
74 "which will be 0x%X (%d) which translates to "
75 "virtual IRQ 0x%X (%d)!\n",
76 (u32)mi->modem_intcon_base + MODEM_IRQ_REG_OFFSET,
77 real_irq,
78 real_irq & 0xFF,
79 real_irq & 0xFF,
80 virt_irq,
81 virt_irq);
82
83 if (virt_irq != 0)
84 generic_handle_irq(virt_irq);
85
86 pr_debug("modem_irq: Done handling virtual IRQ %d!\n", virt_irq);
87
88 return IRQ_HANDLED;
89}
90
91static void create_virtual_irq(int irq, struct irq_chip *modem_irq_chip)
92{
93 irq_set_chip_and_handler(irq, modem_irq_chip, handle_simple_irq);
94 set_irq_flags(irq, IRQF_VALID);
95
96 pr_debug("modem_irq: Created virtual IRQ %d\n", irq);
97}
98
99static int modem_irq_init(void)
100{
101 int err;
102 static struct irq_chip modem_irq_chip;
103 struct modem_irq *mi;
104
105 if (!cpu_is_u5500())
106 return -ENODEV;
107
108 pr_info("modem_irq: Set up IRQ handler for incoming modem IRQ %d\n",
109 IRQ_DB5500_MODEM);
110
111 mi = kmalloc(sizeof(struct modem_irq), GFP_KERNEL);
112 if (!mi) {
113 pr_err("modem_irq: Could not allocate device\n");
114 return -ENOMEM;
115 }
116
117 mi->modem_intcon_base =
118 ioremap(MODEM_INTCON_BASE_ADDR, MODEM_INTCON_SIZE);
119 pr_debug("modem_irq: ioremapped modem_intcon_base from "
120 "phy 0x%x to virt 0x%x\n", MODEM_INTCON_BASE_ADDR,
121 (u32)mi->modem_intcon_base);
122
123 setup_modem_intcon(mi->modem_intcon_base);
124
125 modem_irq_chip = dummy_irq_chip;
126 modem_irq_chip.name = "modem_irq";
127
128 /* Create the virtual IRQ:s needed */
129 create_virtual_irq(MBOX_PAIR0_VIRT_IRQ, &modem_irq_chip);
130 create_virtual_irq(MBOX_PAIR1_VIRT_IRQ, &modem_irq_chip);
131 create_virtual_irq(MBOX_PAIR2_VIRT_IRQ, &modem_irq_chip);
132
133 err = request_threaded_irq(IRQ_DB5500_MODEM, NULL,
134 modem_cpu_irq_handler, IRQF_ONESHOT,
135 "modem_irq", mi);
136 if (err)
137 pr_err("modem_irq: Could not register IRQ %d\n",
138 IRQ_DB5500_MODEM);
139
140 return 0;
141}
142
143arch_initcall(modem_irq_init);
diff --git a/arch/arm/mach-ux500/pins-db5500.h b/arch/arm/mach-ux500/pins-db5500.h
deleted file mode 100644
index bf50c21fe69d..000000000000
--- a/arch/arm/mach-ux500/pins-db5500.h
+++ /dev/null
@@ -1,620 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License terms: GNU General Public License, version 2
5 * Author: Rabin Vincent <rabin.vincent@stericsson.com>
6 */
7
8#ifndef __MACH_DB5500_PINS_H
9#define __MACH_DB5500_PINS_H
10
11#define GPIO0_GPIO PIN_CFG(0, GPIO)
12#define GPIO0_SM_CS3n PIN_CFG(0, ALT_A)
13
14#define GPIO1_GPIO PIN_CFG(1, GPIO)
15#define GPIO1_SM_A3 PIN_CFG(1, ALT_A)
16
17#define GPIO2_GPIO PIN_CFG(2, GPIO)
18#define GPIO2_SM_A4 PIN_CFG(2, ALT_A)
19#define GPIO2_SM_AVD PIN_CFG(2, ALT_B)
20
21#define GPIO3_GPIO PIN_CFG(3, GPIO)
22#define GPIO3_I2C1_SCL PIN_CFG(3, ALT_A)
23
24#define GPIO4_GPIO PIN_CFG(4, GPIO)
25#define GPIO4_I2C1_SDA PIN_CFG(4, ALT_A)
26
27#define GPIO5_GPIO PIN_CFG(5, GPIO)
28#define GPIO5_MC0_DAT0 PIN_CFG(5, ALT_A)
29#define GPIO5_SM_ADQ8 PIN_CFG(5, ALT_B)
30
31#define GPIO6_GPIO PIN_CFG(6, GPIO)
32#define GPIO6_MC0_DAT1 PIN_CFG(6, ALT_A)
33#define GPIO6_SM_ADQ0 PIN_CFG(6, ALT_B)
34
35#define GPIO7_GPIO PIN_CFG(7, GPIO)
36#define GPIO7_MC0_DAT2 PIN_CFG(7, ALT_A)
37#define GPIO7_SM_ADQ9 PIN_CFG(7, ALT_B)
38
39#define GPIO8_GPIO PIN_CFG(8, GPIO)
40#define GPIO8_MC0_DAT3 PIN_CFG(8, ALT_A)
41#define GPIO8_SM_ADQ1 PIN_CFG(8, ALT_B)
42
43#define GPIO9_GPIO PIN_CFG(9, GPIO)
44#define GPIO9_MC0_DAT4 PIN_CFG(9, ALT_A)
45#define GPIO9_SM_ADQ10 PIN_CFG(9, ALT_B)
46
47#define GPIO10_GPIO PIN_CFG(10, GPIO)
48#define GPIO10_MC0_DAT5 PIN_CFG(10, ALT_A)
49#define GPIO10_SM_ADQ2 PIN_CFG(10, ALT_B)
50
51#define GPIO11_GPIO PIN_CFG(11, GPIO)
52#define GPIO11_MC0_DAT6 PIN_CFG(11, ALT_A)
53#define GPIO11_SM_ADQ11 PIN_CFG(11, ALT_B)
54
55#define GPIO12_GPIO PIN_CFG(12, GPIO)
56#define GPIO12_MC0_DAT7 PIN_CFG(12, ALT_A)
57#define GPIO12_SM_ADQ3 PIN_CFG(12, ALT_B)
58
59#define GPIO13_GPIO PIN_CFG(13, GPIO)
60#define GPIO13_MC0_CMD PIN_CFG(13, ALT_A)
61#define GPIO13_SM_BUSY0n PIN_CFG(13, ALT_B)
62#define GPIO13_SM_WAIT0n PIN_CFG(13, ALT_C)
63
64#define GPIO14_GPIO PIN_CFG(14, GPIO)
65#define GPIO14_MC0_CLK PIN_CFG(14, ALT_A)
66#define GPIO14_SM_CS1n PIN_CFG(14, ALT_B)
67#define GPIO14_SM_CKO PIN_CFG(14, ALT_C)
68
69#define GPIO15_GPIO PIN_CFG(15, GPIO)
70#define GPIO15_SM_A5 PIN_CFG(15, ALT_A)
71#define GPIO15_SM_CLE PIN_CFG(15, ALT_B)
72
73#define GPIO16_GPIO PIN_CFG(16, GPIO)
74#define GPIO16_MC2_CMD PIN_CFG(16, ALT_A)
75#define GPIO16_SM_OEn PIN_CFG(16, ALT_B)
76
77#define GPIO17_GPIO PIN_CFG(17, GPIO)
78#define GPIO17_MC2_CLK PIN_CFG(17, ALT_A)
79#define GPIO17_SM_WEn PIN_CFG(17, ALT_B)
80
81#define GPIO18_GPIO PIN_CFG(18, GPIO)
82#define GPIO18_SM_A6 PIN_CFG(18, ALT_A)
83#define GPIO18_SM_ALE PIN_CFG(18, ALT_B)
84#define GPIO18_SM_AVDn PIN_CFG(18, ALT_C)
85
86#define GPIO19_GPIO PIN_CFG(19, GPIO)
87#define GPIO19_MC2_DAT1 PIN_CFG(19, ALT_A)
88#define GPIO19_SM_ADQ4 PIN_CFG(19, ALT_B)
89
90#define GPIO20_GPIO PIN_CFG(20, GPIO)
91#define GPIO20_MC2_DAT3 PIN_CFG(20, ALT_A)
92#define GPIO20_SM_ADQ5 PIN_CFG(20, ALT_B)
93
94#define GPIO21_GPIO PIN_CFG(21, GPIO)
95#define GPIO21_MC2_DAT5 PIN_CFG(21, ALT_A)
96#define GPIO21_SM_ADQ6 PIN_CFG(21, ALT_B)
97
98#define GPIO22_GPIO PIN_CFG(22, GPIO)
99#define GPIO22_MC2_DAT7 PIN_CFG(22, ALT_A)
100#define GPIO22_SM_ADQ7 PIN_CFG(22, ALT_B)
101
102#define GPIO23_GPIO PIN_CFG(23, GPIO)
103#define GPIO23_MC2_DAT0 PIN_CFG(23, ALT_A)
104#define GPIO23_SM_ADQ12 PIN_CFG(23, ALT_B)
105#define GPIO23_MC0_DAT1 PIN_CFG(23, ALT_C)
106
107#define GPIO24_GPIO PIN_CFG(24, GPIO)
108#define GPIO24_MC2_DAT2 PIN_CFG(24, ALT_A)
109#define GPIO24_SM_ADQ13 PIN_CFG(24, ALT_B)
110#define GPIO24_MC0_DAT3 PIN_CFG(24, ALT_C)
111
112#define GPIO25_GPIO PIN_CFG(25, GPIO)
113#define GPIO25_MC2_DAT4 PIN_CFG(25, ALT_A)
114#define GPIO25_SM_ADQ14 PIN_CFG(25, ALT_B)
115#define GPIO25_MC0_CMD PIN_CFG(25, ALT_C)
116
117#define GPIO26_GPIO PIN_CFG(26, GPIO)
118#define GPIO26_MC2_DAT6 PIN_CFG(26, ALT_A)
119#define GPIO26_SM_ADQ15 PIN_CFG(26, ALT_B)
120
121#define GPIO27_GPIO PIN_CFG(27, GPIO)
122#define GPIO27_SM_CS0n PIN_CFG(27, ALT_A)
123#define GPIO27_SM_PS0n PIN_CFG(27, ALT_B)
124
125#define GPIO28_GPIO PIN_CFG(28, GPIO)
126#define GPIO28_U0_TXD PIN_CFG(28, ALT_A)
127#define GPIO28_SM_A0 PIN_CFG(28, ALT_B)
128
129#define GPIO29_GPIO PIN_CFG(29, GPIO)
130#define GPIO29_U0_RXD PIN_CFG(29, ALT_A)
131#define GPIO29_SM_A1 PIN_CFG(29, ALT_B)
132#define GPIO29_PWM_0 PIN_CFG(29, ALT_C)
133
134#define GPIO30_GPIO PIN_CFG(30, GPIO)
135#define GPIO30_MC0_DAT5 PIN_CFG(30, ALT_A)
136#define GPIO30_SM_A2 PIN_CFG(30, ALT_B)
137#define GPIO30_PWM_1 PIN_CFG(30, ALT_C)
138
139#define GPIO31_GPIO PIN_CFG(31, GPIO)
140#define GPIO31_MC0_DAT7 PIN_CFG(31, ALT_A)
141#define GPIO31_SM_CS2n PIN_CFG(31, ALT_B)
142#define GPIO31_PWM_2 PIN_CFG(31, ALT_C)
143
144#define GPIO32_GPIO PIN_CFG(32, GPIO)
145#define GPIO32_MSP0_TCK PIN_CFG(32, ALT_A)
146#define GPIO32_ACCI2S0_SCK PIN_CFG(32, ALT_B)
147
148#define GPIO33_GPIO PIN_CFG(33, GPIO)
149#define GPIO33_MSP0_TFS PIN_CFG(33, ALT_A)
150#define GPIO33_ACCI2S0_WS PIN_CFG(33, ALT_B)
151
152#define GPIO34_GPIO PIN_CFG(34, GPIO)
153#define GPIO34_MSP0_TXD PIN_CFG(34, ALT_A)
154#define GPIO34_ACCI2S0_DLD PIN_CFG(34, ALT_B)
155
156#define GPIO35_GPIO PIN_CFG(35, GPIO)
157#define GPIO35_MSP0_RXD PIN_CFG(35, ALT_A)
158#define GPIO35_ACCI2S0_ULD PIN_CFG(35, ALT_B)
159
160#define GPIO64_GPIO PIN_CFG(64, GPIO)
161#define GPIO64_USB_DAT0 PIN_CFG(64, ALT_A)
162#define GPIO64_U0_TXD PIN_CFG(64, ALT_B)
163
164#define GPIO65_GPIO PIN_CFG(65, GPIO)
165#define GPIO65_USB_DAT1 PIN_CFG(65, ALT_A)
166#define GPIO65_U0_RXD PIN_CFG(65, ALT_B)
167
168#define GPIO66_GPIO PIN_CFG(66, GPIO)
169#define GPIO66_USB_DAT2 PIN_CFG(66, ALT_A)
170
171#define GPIO67_GPIO PIN_CFG(67, GPIO)
172#define GPIO67_USB_DAT3 PIN_CFG(67, ALT_A)
173
174#define GPIO68_GPIO PIN_CFG(68, GPIO)
175#define GPIO68_USB_DAT4 PIN_CFG(68, ALT_A)
176
177#define GPIO69_GPIO PIN_CFG(69, GPIO)
178#define GPIO69_USB_DAT5 PIN_CFG(69, ALT_A)
179
180#define GPIO70_GPIO PIN_CFG(70, GPIO)
181#define GPIO70_USB_DAT6 PIN_CFG(70, ALT_A)
182
183#define GPIO71_GPIO PIN_CFG(71, GPIO)
184#define GPIO71_USB_DAT7 PIN_CFG(71, ALT_A)
185
186#define GPIO72_GPIO PIN_CFG(72, GPIO)
187#define GPIO72_USB_STP PIN_CFG(72, ALT_A)
188
189#define GPIO73_GPIO PIN_CFG(73, GPIO)
190#define GPIO73_USB_DIR PIN_CFG(73, ALT_A)
191
192#define GPIO74_GPIO PIN_CFG(74, GPIO)
193#define GPIO74_USB_NXT PIN_CFG(74, ALT_A)
194
195#define GPIO75_GPIO PIN_CFG(75, GPIO)
196#define GPIO75_USB_XCLK PIN_CFG(75, ALT_A)
197
198#define GPIO76_GPIO PIN_CFG(76, GPIO)
199
200#define GPIO77_GPIO PIN_CFG(77, GPIO)
201#define GPIO77_ACCTX_ON PIN_CFG(77, ALT_A)
202
203#define GPIO78_GPIO PIN_CFG(78, GPIO)
204#define GPIO78_IRQn PIN_CFG(78, ALT_A)
205
206#define GPIO79_GPIO PIN_CFG(79, GPIO)
207#define GPIO79_ACCSIM_Clk PIN_CFG(79, ALT_A)
208
209#define GPIO80_GPIO PIN_CFG(80, GPIO)
210#define GPIO80_ACCSIM_Da PIN_CFG(80, ALT_A)
211
212#define GPIO81_GPIO PIN_CFG(81, GPIO)
213#define GPIO81_ACCSIM_Reset PIN_CFG(81, ALT_A)
214
215#define GPIO82_GPIO PIN_CFG(82, GPIO)
216#define GPIO82_ACCSIM_DDir PIN_CFG(82, ALT_A)
217
218#define GPIO96_GPIO PIN_CFG(96, GPIO)
219#define GPIO96_MSP1_TCK PIN_CFG(96, ALT_A)
220#define GPIO96_PRCMU_DEBUG3 PIN_CFG(96, ALT_B)
221#define GPIO96_PRCMU_DEBUG7 PIN_CFG(96, ALT_C)
222
223#define GPIO97_GPIO PIN_CFG(97, GPIO)
224#define GPIO97_MSP1_TFS PIN_CFG(97, ALT_A)
225#define GPIO97_PRCMU_DEBUG2 PIN_CFG(97, ALT_B)
226#define GPIO97_PRCMU_DEBUG6 PIN_CFG(97, ALT_C)
227
228#define GPIO98_GPIO PIN_CFG(98, GPIO)
229#define GPIO98_MSP1_TXD PIN_CFG(98, ALT_A)
230#define GPIO98_PRCMU_DEBUG1 PIN_CFG(98, ALT_B)
231#define GPIO98_PRCMU_DEBUG5 PIN_CFG(98, ALT_C)
232
233#define GPIO99_GPIO PIN_CFG(99, GPIO)
234#define GPIO99_MSP1_RXD PIN_CFG(99, ALT_A)
235#define GPIO99_PRCMU_DEBUG0 PIN_CFG(99, ALT_B)
236#define GPIO99_PRCMU_DEBUG4 PIN_CFG(99, ALT_C)
237
238#define GPIO100_GPIO PIN_CFG(100, GPIO)
239#define GPIO100_I2C0_SCL PIN_CFG(100, ALT_A)
240
241#define GPIO101_GPIO PIN_CFG(101, GPIO)
242#define GPIO101_I2C0_SDA PIN_CFG(101, ALT_A)
243
244#define GPIO128_GPIO PIN_CFG(128, GPIO)
245#define GPIO128_KP_I0 PIN_CFG(128, ALT_A)
246#define GPIO128_BUSMON_D0 PIN_CFG(128, ALT_B)
247
248#define GPIO129_GPIO PIN_CFG(129, GPIO)
249#define GPIO129_KP_O0 PIN_CFG(129, ALT_A)
250#define GPIO129_BUSMON_D1 PIN_CFG(129, ALT_B)
251
252#define GPIO130_GPIO PIN_CFG(130, GPIO)
253#define GPIO130_KP_I1 PIN_CFG(130, ALT_A)
254#define GPIO130_BUSMON_D2 PIN_CFG(130, ALT_B)
255
256#define GPIO131_GPIO PIN_CFG(131, GPIO)
257#define GPIO131_KP_O1 PIN_CFG(131, ALT_A)
258#define GPIO131_BUSMON_D3 PIN_CFG(131, ALT_B)
259
260#define GPIO132_GPIO PIN_CFG(132, GPIO)
261#define GPIO132_KP_I2 PIN_CFG(132, ALT_A)
262#define GPIO132_ETM_D15 PIN_CFG(132, ALT_B)
263#define GPIO132_STMAPE_CLK PIN_CFG(132, ALT_C)
264
265#define GPIO133_GPIO PIN_CFG(133, GPIO)
266#define GPIO133_KP_O2 PIN_CFG(133, ALT_A)
267#define GPIO133_ETM_D14 PIN_CFG(133, ALT_B)
268#define GPIO133_U0_RXD PIN_CFG(133, ALT_C)
269
270#define GPIO134_GPIO PIN_CFG(134, GPIO)
271#define GPIO134_KP_I3 PIN_CFG(134, ALT_A)
272#define GPIO134_ETM_D13 PIN_CFG(134, ALT_B)
273#define GPIO134_STMAPE_DAT0 PIN_CFG(134, ALT_C)
274
275#define GPIO135_GPIO PIN_CFG(135, GPIO)
276#define GPIO135_KP_O3 PIN_CFG(135, ALT_A)
277#define GPIO135_ETM_D12 PIN_CFG(135, ALT_B)
278#define GPIO135_STMAPE_DAT1 PIN_CFG(135, ALT_C)
279
280#define GPIO136_GPIO PIN_CFG(136, GPIO)
281#define GPIO136_KP_I4 PIN_CFG(136, ALT_A)
282#define GPIO136_ETM_D11 PIN_CFG(136, ALT_B)
283#define GPIO136_STMAPE_DAT2 PIN_CFG(136, ALT_C)
284
285#define GPIO137_GPIO PIN_CFG(137, GPIO)
286#define GPIO137_KP_O4 PIN_CFG(137, ALT_A)
287#define GPIO137_ETM_D10 PIN_CFG(137, ALT_B)
288#define GPIO137_STMAPE_DAT3 PIN_CFG(137, ALT_C)
289
290#define GPIO138_GPIO PIN_CFG(138, GPIO)
291#define GPIO138_KP_I5 PIN_CFG(138, ALT_A)
292#define GPIO138_ETM_D9 PIN_CFG(138, ALT_B)
293#define GPIO138_U0_TXD PIN_CFG(138, ALT_C)
294
295#define GPIO139_GPIO PIN_CFG(139, GPIO)
296#define GPIO139_KP_O5 PIN_CFG(139, ALT_A)
297#define GPIO139_ETM_D8 PIN_CFG(139, ALT_B)
298#define GPIO139_BUSMON_D11 PIN_CFG(139, ALT_C)
299
300#define GPIO140_GPIO PIN_CFG(140, GPIO)
301#define GPIO140_KP_I6 PIN_CFG(140, ALT_A)
302#define GPIO140_ETM_D7 PIN_CFG(140, ALT_B)
303#define GPIO140_STMAPE_CLK PIN_CFG(140, ALT_C)
304
305#define GPIO141_GPIO PIN_CFG(141, GPIO)
306#define GPIO141_KP_O6 PIN_CFG(141, ALT_A)
307#define GPIO141_ETM_D6 PIN_CFG(141, ALT_B)
308#define GPIO141_U0_RXD PIN_CFG(141, ALT_C)
309
310#define GPIO142_GPIO PIN_CFG(142, GPIO)
311#define GPIO142_KP_I7 PIN_CFG(142, ALT_A)
312#define GPIO142_ETM_D5 PIN_CFG(142, ALT_B)
313#define GPIO142_STMAPE_DAT0 PIN_CFG(142, ALT_C)
314
315#define GPIO143_GPIO PIN_CFG(143, GPIO)
316#define GPIO143_KP_O7 PIN_CFG(143, ALT_A)
317#define GPIO143_ETM_D4 PIN_CFG(143, ALT_B)
318#define GPIO143_STMAPE_DAT1 PIN_CFG(143, ALT_C)
319
320#define GPIO144_GPIO PIN_CFG(144, GPIO)
321#define GPIO144_I2C3_SCL PIN_CFG(144, ALT_A)
322#define GPIO144_ETM_D3 PIN_CFG(144, ALT_B)
323#define GPIO144_STMAPE_DAT2 PIN_CFG(144, ALT_C)
324
325#define GPIO145_GPIO PIN_CFG(145, GPIO)
326#define GPIO145_I2C3_SDA PIN_CFG(145, ALT_A)
327#define GPIO145_ETM_D2 PIN_CFG(145, ALT_B)
328#define GPIO145_STMAPE_DAT3 PIN_CFG(145, ALT_C)
329
330#define GPIO146_GPIO PIN_CFG(146, GPIO)
331#define GPIO146_PWM_0 PIN_CFG(146, ALT_A)
332#define GPIO146_ETM_D1 PIN_CFG(146, ALT_B)
333
334#define GPIO147_GPIO PIN_CFG(147, GPIO)
335#define GPIO147_PWM_1 PIN_CFG(147, ALT_A)
336#define GPIO147_ETM_D0 PIN_CFG(147, ALT_B)
337
338#define GPIO148_GPIO PIN_CFG(148, GPIO)
339#define GPIO148_PWM_2 PIN_CFG(148, ALT_A)
340#define GPIO148_ETM_CLK PIN_CFG(148, ALT_B)
341
342#define GPIO160_GPIO PIN_CFG(160, GPIO)
343#define GPIO160_CLKOUT_REQn PIN_CFG(160, ALT_A)
344
345#define GPIO161_GPIO PIN_CFG(161, GPIO)
346#define GPIO161_CLKOUT_0 PIN_CFG(161, ALT_A)
347
348#define GPIO162_GPIO PIN_CFG(162, GPIO)
349#define GPIO162_CLKOUT_1 PIN_CFG(162, ALT_A)
350
351#define GPIO163_GPIO PIN_CFG(163, GPIO)
352
353#define GPIO164_GPIO PIN_CFG(164, GPIO)
354#define GPIO164_GPS_START PIN_CFG(164, ALT_A)
355
356#define GPIO165_GPIO PIN_CFG(165, GPIO)
357#define GPIO165_SPI1_CS2n PIN_CFG(165, ALT_A)
358#define GPIO165_U3_RXD PIN_CFG(165, ALT_B)
359#define GPIO165_BUSMON_D20 PIN_CFG(165, ALT_C)
360
361#define GPIO166_GPIO PIN_CFG(166, GPIO)
362#define GPIO166_SPI1_CS1n PIN_CFG(166, ALT_A)
363#define GPIO166_U3_TXD PIN_CFG(166, ALT_B)
364#define GPIO166_BUSMON_D21 PIN_CFG(166, ALT_C)
365
366#define GPIO167_GPIO PIN_CFG(167, GPIO)
367#define GPIO167_SPI1_CS0n PIN_CFG(167, ALT_A)
368#define GPIO167_U3_RTSn PIN_CFG(167, ALT_B)
369#define GPIO167_BUSMON_D22 PIN_CFG(167, ALT_C)
370
371#define GPIO168_GPIO PIN_CFG(168, GPIO)
372#define GPIO168_SPI1_RXD PIN_CFG(168, ALT_A)
373#define GPIO168_U3_CTSn PIN_CFG(168, ALT_B)
374#define GPIO168_BUSMON_D23 PIN_CFG(168, ALT_C)
375
376#define GPIO169_GPIO PIN_CFG(169, GPIO)
377#define GPIO169_SPI1_TXD PIN_CFG(169, ALT_A)
378#define GPIO169_DDR_RC PIN_CFG(169, ALT_B)
379#define GPIO169_BUSMON_D24 PIN_CFG(169, ALT_C)
380
381#define GPIO170_GPIO PIN_CFG(170, GPIO)
382#define GPIO170_SPI1_CLK PIN_CFG(170, ALT_A)
383
384#define GPIO171_GPIO PIN_CFG(171, GPIO)
385#define GPIO171_MC3_DAT0 PIN_CFG(171, ALT_A)
386#define GPIO171_SPI3_RXD PIN_CFG(171, ALT_B)
387#define GPIO171_BUSMON_D25 PIN_CFG(171, ALT_C)
388
389#define GPIO172_GPIO PIN_CFG(172, GPIO)
390#define GPIO172_MC3_DAT1 PIN_CFG(172, ALT_A)
391#define GPIO172_SPI3_CS1n PIN_CFG(172, ALT_B)
392#define GPIO172_BUSMON_D26 PIN_CFG(172, ALT_C)
393
394#define GPIO173_GPIO PIN_CFG(173, GPIO)
395#define GPIO173_MC3_DAT2 PIN_CFG(173, ALT_A)
396#define GPIO173_SPI3_CS2n PIN_CFG(173, ALT_B)
397#define GPIO173_BUSMON_D27 PIN_CFG(173, ALT_C)
398
399#define GPIO174_GPIO PIN_CFG(174, GPIO)
400#define GPIO174_MC3_DAT3 PIN_CFG(174, ALT_A)
401#define GPIO174_SPI3_CS0n PIN_CFG(174, ALT_B)
402#define GPIO174_BUSMON_D28 PIN_CFG(174, ALT_C)
403
404#define GPIO175_GPIO PIN_CFG(175, GPIO)
405#define GPIO175_MC3_CMD PIN_CFG(175, ALT_A)
406#define GPIO175_SPI3_TXD PIN_CFG(175, ALT_B)
407#define GPIO175_BUSMON_D29 PIN_CFG(175, ALT_C)
408
409#define GPIO176_GPIO PIN_CFG(176, GPIO)
410#define GPIO176_MC3_CLK PIN_CFG(176, ALT_A)
411#define GPIO176_SPI3_CLK PIN_CFG(176, ALT_B)
412
413#define GPIO177_GPIO PIN_CFG(177, GPIO)
414#define GPIO177_U2_RXD PIN_CFG(177, ALT_A)
415#define GPIO177_I2C3_SCL PIN_CFG(177, ALT_B)
416#define GPIO177_BUSMON_D30 PIN_CFG(177, ALT_C)
417
418#define GPIO178_GPIO PIN_CFG(178, GPIO)
419#define GPIO178_U2_TXD PIN_CFG(178, ALT_A)
420#define GPIO178_I2C3_SDA PIN_CFG(178, ALT_B)
421#define GPIO178_BUSMON_D31 PIN_CFG(178, ALT_C)
422
423#define GPIO179_GPIO PIN_CFG(179, GPIO)
424#define GPIO179_U2_CTSn PIN_CFG(179, ALT_A)
425#define GPIO179_U3_RXD PIN_CFG(179, ALT_B)
426#define GPIO179_BUSMON_D32 PIN_CFG(179, ALT_C)
427
428#define GPIO180_GPIO PIN_CFG(180, GPIO)
429#define GPIO180_U2_RTSn PIN_CFG(180, ALT_A)
430#define GPIO180_U3_TXD PIN_CFG(180, ALT_B)
431#define GPIO180_BUSMON_D33 PIN_CFG(180, ALT_C)
432
433#define GPIO185_GPIO PIN_CFG(185, GPIO)
434#define GPIO185_SPI3_CS2n PIN_CFG(185, ALT_A)
435#define GPIO185_MC4_DAT0 PIN_CFG(185, ALT_B)
436
437#define GPIO186_GPIO PIN_CFG(186, GPIO)
438#define GPIO186_SPI3_CS1n PIN_CFG(186, ALT_A)
439#define GPIO186_MC4_DAT1 PIN_CFG(186, ALT_B)
440
441#define GPIO187_GPIO PIN_CFG(187, GPIO)
442#define GPIO187_SPI3_CS0n PIN_CFG(187, ALT_A)
443#define GPIO187_MC4_DAT2 PIN_CFG(187, ALT_B)
444
445#define GPIO188_GPIO PIN_CFG(188, GPIO)
446#define GPIO188_SPI3_RXD PIN_CFG(188, ALT_A)
447#define GPIO188_MC4_DAT3 PIN_CFG(188, ALT_B)
448
449#define GPIO189_GPIO PIN_CFG(189, GPIO)
450#define GPIO189_SPI3_TXD PIN_CFG(189, ALT_A)
451#define GPIO189_MC4_CMD PIN_CFG(189, ALT_B)
452
453#define GPIO190_GPIO PIN_CFG(190, GPIO)
454#define GPIO190_SPI3_CLK PIN_CFG(190, ALT_A)
455#define GPIO190_MC4_CLK PIN_CFG(190, ALT_B)
456
457#define GPIO191_GPIO PIN_CFG(191, GPIO)
458#define GPIO191_MC1_DAT0 PIN_CFG(191, ALT_A)
459#define GPIO191_MC4_DAT4 PIN_CFG(191, ALT_B)
460#define GPIO191_STMAPE_DAT0 PIN_CFG(191, ALT_C)
461
462#define GPIO192_GPIO PIN_CFG(192, GPIO)
463#define GPIO192_MC1_DAT1 PIN_CFG(192, ALT_A)
464#define GPIO192_MC4_DAT5 PIN_CFG(192, ALT_B)
465#define GPIO192_STMAPE_DAT1 PIN_CFG(192, ALT_C)
466
467#define GPIO193_GPIO PIN_CFG(193, GPIO)
468#define GPIO193_MC1_DAT2 PIN_CFG(193, ALT_A)
469#define GPIO193_MC4_DAT6 PIN_CFG(193, ALT_B)
470#define GPIO193_STMAPE_DAT2 PIN_CFG(193, ALT_C)
471
472#define GPIO194_GPIO PIN_CFG(194, GPIO)
473#define GPIO194_MC1_DAT3 PIN_CFG(194, ALT_A)
474#define GPIO194_MC4_DAT7 PIN_CFG(194, ALT_B)
475#define GPIO194_STMAPE_DAT3 PIN_CFG(194, ALT_C)
476
477#define GPIO195_GPIO PIN_CFG(195, GPIO)
478#define GPIO195_MC1_CLK PIN_CFG(195, ALT_A)
479#define GPIO195_STMAPE_CLK PIN_CFG(195, ALT_B)
480#define GPIO195_BUSMON_CLK PIN_CFG(195, ALT_C)
481
482#define GPIO196_GPIO PIN_CFG(196, GPIO)
483#define GPIO196_MC1_CMD PIN_CFG(196, ALT_A)
484#define GPIO196_U0_RXD PIN_CFG(196, ALT_B)
485#define GPIO196_BUSMON_D38 PIN_CFG(196, ALT_C)
486
487#define GPIO197_GPIO PIN_CFG(197, GPIO)
488#define GPIO197_MC1_CMDDIR PIN_CFG(197, ALT_A)
489#define GPIO197_BUSMON_D39 PIN_CFG(197, ALT_B)
490
491#define GPIO198_GPIO PIN_CFG(198, GPIO)
492#define GPIO198_MC1_FBCLK PIN_CFG(198, ALT_A)
493
494#define GPIO199_GPIO PIN_CFG(199, GPIO)
495#define GPIO199_MC1_DAT0DIR PIN_CFG(199, ALT_A)
496#define GPIO199_BUSMON_D40 PIN_CFG(199, ALT_B)
497
498#define GPIO200_GPIO PIN_CFG(200, GPIO)
499#define GPIO200_U1_TXD PIN_CFG(200, ALT_A)
500#define GPIO200_ACCU0_RTSn PIN_CFG(200, ALT_B)
501
502#define GPIO201_GPIO PIN_CFG(201, GPIO)
503#define GPIO201_U1_RXD PIN_CFG(201, ALT_A)
504#define GPIO201_ACCU0_CTSn PIN_CFG(201, ALT_B)
505
506#define GPIO202_GPIO PIN_CFG(202, GPIO)
507#define GPIO202_U1_CTSn PIN_CFG(202, ALT_A)
508#define GPIO202_ACCU0_RXD PIN_CFG(202, ALT_B)
509
510#define GPIO203_GPIO PIN_CFG(203, GPIO)
511#define GPIO203_U1_RTSn PIN_CFG(203, ALT_A)
512#define GPIO203_ACCU0_TXD PIN_CFG(203, ALT_B)
513
514#define GPIO204_GPIO PIN_CFG(204, GPIO)
515#define GPIO204_SPI0_CS2n PIN_CFG(204, ALT_A)
516#define GPIO204_ACCGPIO_000 PIN_CFG(204, ALT_B)
517#define GPIO204_LCD_VSI1 PIN_CFG(204, ALT_C)
518
519#define GPIO205_GPIO PIN_CFG(205, GPIO)
520#define GPIO205_SPI0_CS1n PIN_CFG(205, ALT_A)
521#define GPIO205_ACCGPIO_001 PIN_CFG(205, ALT_B)
522#define GPIO205_LCD_D3 PIN_CFG(205, ALT_C)
523
524#define GPIO206_GPIO PIN_CFG(206, GPIO)
525#define GPIO206_SPI0_CS0n PIN_CFG(206, ALT_A)
526#define GPIO206_ACCGPIO_002 PIN_CFG(206, ALT_B)
527#define GPIO206_LCD_D2 PIN_CFG(206, ALT_C)
528
529#define GPIO207_GPIO PIN_CFG(207, GPIO)
530#define GPIO207_SPI0_RXD PIN_CFG(207, ALT_A)
531#define GPIO207_ACCGPIO_003 PIN_CFG(207, ALT_B)
532#define GPIO207_LCD_D1 PIN_CFG(207, ALT_C)
533
534#define GPIO208_GPIO PIN_CFG(208, GPIO)
535#define GPIO208_SPI0_TXD PIN_CFG(208, ALT_A)
536#define GPIO208_ACCGPIO_004 PIN_CFG(208, ALT_B)
537#define GPIO208_LCD_D0 PIN_CFG(208, ALT_C)
538
539#define GPIO209_GPIO PIN_CFG(209, GPIO)
540#define GPIO209_SPI0_CLK PIN_CFG(209, ALT_A)
541#define GPIO209_ACCGPIO_005 PIN_CFG(209, ALT_B)
542#define GPIO209_LCD_CLK PIN_CFG(209, ALT_C)
543
544#define GPIO210_GPIO PIN_CFG(210, GPIO)
545#define GPIO210_LCD_VSO PIN_CFG(210, ALT_A)
546#define GPIO210_PRCMU_PWRCTRL1 PIN_CFG(210, ALT_B)
547
548#define GPIO211_GPIO PIN_CFG(211, GPIO)
549#define GPIO211_LCD_VSI0 PIN_CFG(211, ALT_A)
550#define GPIO211_PRCMU_PWRCTRL2 PIN_CFG(211, ALT_B)
551
552#define GPIO212_GPIO PIN_CFG(212, GPIO)
553#define GPIO212_SPI2_CS2n PIN_CFG(212, ALT_A)
554#define GPIO212_LCD_HSO PIN_CFG(212, ALT_B)
555
556#define GPIO213_GPIO PIN_CFG(213, GPIO)
557#define GPIO213_SPI2_CS1n PIN_CFG(213, ALT_A)
558#define GPIO213_LCD_DE PIN_CFG(213, ALT_B)
559#define GPIO213_BUSMON_D16 PIN_CFG(213, ALT_C)
560
561#define GPIO214_GPIO PIN_CFG(214, GPIO)
562#define GPIO214_SPI2_CS0n PIN_CFG(214, ALT_A)
563#define GPIO214_LCD_D7 PIN_CFG(214, ALT_B)
564#define GPIO214_BUSMON_D17 PIN_CFG(214, ALT_C)
565
566#define GPIO215_GPIO PIN_CFG(215, GPIO)
567#define GPIO215_SPI2_RXD PIN_CFG(215, ALT_A)
568#define GPIO215_LCD_D6 PIN_CFG(215, ALT_B)
569#define GPIO215_BUSMON_D18 PIN_CFG(215, ALT_C)
570
571#define GPIO216_GPIO PIN_CFG(216, GPIO)
572#define GPIO216_SPI2_CLK PIN_CFG(216, ALT_A)
573#define GPIO216_LCD_D5 PIN_CFG(216, ALT_B)
574
575#define GPIO217_GPIO PIN_CFG(217, GPIO)
576#define GPIO217_SPI2_TXD PIN_CFG(217, ALT_A)
577#define GPIO217_LCD_D4 PIN_CFG(217, ALT_B)
578#define GPIO217_BUSMON_D19 PIN_CFG(217, ALT_C)
579
580#define GPIO218_GPIO PIN_CFG(218, GPIO)
581#define GPIO218_I2C2_SCL PIN_CFG(218, ALT_A)
582#define GPIO218_LCD_VSO PIN_CFG(218, ALT_B)
583
584#define GPIO219_GPIO PIN_CFG(219, GPIO)
585#define GPIO219_I2C2_SDA PIN_CFG(219, ALT_A)
586#define GPIO219_LCD_D3 PIN_CFG(219, ALT_B)
587
588#define GPIO220_GPIO PIN_CFG(220, GPIO)
589#define GPIO220_MSP2_TCK PIN_CFG(220, ALT_A)
590#define GPIO220_LCD_D2 PIN_CFG(220, ALT_B)
591
592#define GPIO221_GPIO PIN_CFG(221, GPIO)
593#define GPIO221_MSP2_TFS PIN_CFG(221, ALT_A)
594#define GPIO221_LCD_D1 PIN_CFG(221, ALT_B)
595
596#define GPIO222_GPIO PIN_CFG(222, GPIO)
597#define GPIO222_MSP2_TXD PIN_CFG(222, ALT_A)
598#define GPIO222_LCD_D0 PIN_CFG(222, ALT_B)
599
600#define GPIO223_GPIO PIN_CFG(223, GPIO)
601#define GPIO223_MSP2_RXD PIN_CFG(223, ALT_A)
602#define GPIO223_LCD_CLK PIN_CFG(223, ALT_B)
603
604#define GPIO224_GPIO PIN_CFG(224, GPIO)
605#define GPIO224_PRCMU_PWRCTRL0 PIN_CFG(224, ALT_A)
606#define GPIO224_LCD_VSI1 PIN_CFG(224, ALT_B)
607
608#define GPIO225_GPIO PIN_CFG(225, GPIO)
609#define GPIO225_PRCMU_PWRCTRL1 PIN_CFG(225, ALT_A)
610#define GPIO225_IRDA_RXD PIN_CFG(225, ALT_B)
611
612#define GPIO226_GPIO PIN_CFG(226, GPIO)
613#define GPIO226_PRCMU_PWRCTRL2 PIN_CFG(226, ALT_A)
614#define GPIO226_IRRC_DAT PIN_CFG(226, ALT_B)
615
616#define GPIO227_GPIO PIN_CFG(227, GPIO)
617#define GPIO227_IRRC_DAT PIN_CFG(227, ALT_A)
618#define GPIO227_IRDA_TXD PIN_CFG(227, ALT_B)
619
620#endif
diff --git a/arch/arm/mach-ux500/pins-db8500.h b/arch/arm/mach-ux500/pins-db8500.h
index 8b1d1a7a679e..062c7acf4576 100644
--- a/arch/arm/mach-ux500/pins-db8500.h
+++ b/arch/arm/mach-ux500/pins-db8500.h
@@ -35,40 +35,40 @@
35 35
36#define GPIO4_GPIO PIN_CFG(4, GPIO) 36#define GPIO4_GPIO PIN_CFG(4, GPIO)
37#define GPIO4_U1_RXD PIN_CFG(4, ALT_A) 37#define GPIO4_U1_RXD PIN_CFG(4, ALT_A)
38#define GPIO4_I2C4_SCL PIN_CFG_INPUT(4, ALT_B, PULLUP) 38#define GPIO4_I2C4_SCL PIN_CFG(4, ALT_B)
39#define GPIO4_IP_TRSTn PIN_CFG(4, ALT_C) 39#define GPIO4_IP_TRSTn PIN_CFG(4, ALT_C)
40 40
41#define GPIO5_GPIO PIN_CFG(5, GPIO) 41#define GPIO5_GPIO PIN_CFG(5, GPIO)
42#define GPIO5_U1_TXD PIN_CFG(5, ALT_A) 42#define GPIO5_U1_TXD PIN_CFG(5, ALT_A)
43#define GPIO5_I2C4_SDA PIN_CFG_INPUT(5, ALT_B, PULLUP) 43#define GPIO5_I2C4_SDA PIN_CFG(5, ALT_B)
44#define GPIO5_IP_GPIO6 PIN_CFG(5, ALT_C) 44#define GPIO5_IP_GPIO6 PIN_CFG(5, ALT_C)
45 45
46#define GPIO6_GPIO PIN_CFG(6, GPIO) 46#define GPIO6_GPIO PIN_CFG(6, GPIO)
47#define GPIO6_U1_CTSn PIN_CFG(6, ALT_A) 47#define GPIO6_U1_CTSn PIN_CFG(6, ALT_A)
48#define GPIO6_I2C1_SCL PIN_CFG_INPUT(6, ALT_B, PULLUP) 48#define GPIO6_I2C1_SCL PIN_CFG(6, ALT_B)
49#define GPIO6_IP_GPIO0 PIN_CFG(6, ALT_C) 49#define GPIO6_IP_GPIO0 PIN_CFG(6, ALT_C)
50 50
51#define GPIO7_GPIO PIN_CFG(7, GPIO) 51#define GPIO7_GPIO PIN_CFG(7, GPIO)
52#define GPIO7_U1_RTSn PIN_CFG(7, ALT_A) 52#define GPIO7_U1_RTSn PIN_CFG(7, ALT_A)
53#define GPIO7_I2C1_SDA PIN_CFG_INPUT(7, ALT_B, PULLUP) 53#define GPIO7_I2C1_SDA PIN_CFG(7, ALT_B)
54#define GPIO7_IP_GPIO1 PIN_CFG(7, ALT_C) 54#define GPIO7_IP_GPIO1 PIN_CFG(7, ALT_C)
55 55
56#define GPIO8_GPIO PIN_CFG(8, GPIO) 56#define GPIO8_GPIO PIN_CFG(8, GPIO)
57#define GPIO8_IPI2C_SDA PIN_CFG_INPUT(8, ALT_A, PULLUP) 57#define GPIO8_IPI2C_SDA PIN_CFG(8, ALT_A)
58#define GPIO8_I2C2_SDA PIN_CFG_INPUT(8, ALT_B, PULLUP) 58#define GPIO8_I2C2_SDA PIN_CFG(8, ALT_B)
59 59
60#define GPIO9_GPIO PIN_CFG(9, GPIO) 60#define GPIO9_GPIO PIN_CFG(9, GPIO)
61#define GPIO9_IPI2C_SCL PIN_CFG_INPUT(9, ALT_A, PULLUP) 61#define GPIO9_IPI2C_SCL PIN_CFG(9, ALT_A)
62#define GPIO9_I2C2_SCL PIN_CFG_INPUT(9, ALT_B, PULLUP) 62#define GPIO9_I2C2_SCL PIN_CFG(9, ALT_B)
63 63
64#define GPIO10_GPIO PIN_CFG(10, GPIO) 64#define GPIO10_GPIO PIN_CFG(10, GPIO)
65#define GPIO10_IPI2C_SDA PIN_CFG_INPUT(10, ALT_A, PULLUP) 65#define GPIO10_IPI2C_SDA PIN_CFG(10, ALT_A)
66#define GPIO10_I2C2_SDA PIN_CFG_INPUT(10, ALT_B, PULLUP) 66#define GPIO10_I2C2_SDA PIN_CFG(10, ALT_B)
67#define GPIO10_IP_GPIO3 PIN_CFG(10, ALT_C) 67#define GPIO10_IP_GPIO3 PIN_CFG(10, ALT_C)
68 68
69#define GPIO11_GPIO PIN_CFG(11, GPIO) 69#define GPIO11_GPIO PIN_CFG(11, GPIO)
70#define GPIO11_IPI2C_SCL PIN_CFG_INPUT(11, ALT_A, PULLUP) 70#define GPIO11_IPI2C_SCL PIN_CFG(11, ALT_A)
71#define GPIO11_I2C2_SCL PIN_CFG_INPUT(11, ALT_B, PULLUP) 71#define GPIO11_I2C2_SCL PIN_CFG(11, ALT_B)
72#define GPIO11_IP_GPIO2 PIN_CFG(11, ALT_C) 72#define GPIO11_IP_GPIO2 PIN_CFG(11, ALT_C)
73 73
74#define GPIO12_GPIO PIN_CFG(12, GPIO) 74#define GPIO12_GPIO PIN_CFG(12, GPIO)
@@ -87,12 +87,12 @@
87 87
88#define GPIO16_GPIO PIN_CFG(16, GPIO) 88#define GPIO16_GPIO PIN_CFG(16, GPIO)
89#define GPIO16_MSP0_RFS PIN_CFG(16, ALT_A) 89#define GPIO16_MSP0_RFS PIN_CFG(16, ALT_A)
90#define GPIO16_I2C1_SCL PIN_CFG_INPUT(16, ALT_B, PULLUP) 90#define GPIO16_I2C1_SCL PIN_CFG(16, ALT_B)
91#define GPIO16_SLIM0_DAT PIN_CFG(16, ALT_C) 91#define GPIO16_SLIM0_DAT PIN_CFG(16, ALT_C)
92 92
93#define GPIO17_GPIO PIN_CFG(17, GPIO) 93#define GPIO17_GPIO PIN_CFG(17, GPIO)
94#define GPIO17_MSP0_RCK PIN_CFG(17, ALT_A) 94#define GPIO17_MSP0_RCK PIN_CFG(17, ALT_A)
95#define GPIO17_I2C1_SDA PIN_CFG_INPUT(17, ALT_B, PULLUP) 95#define GPIO17_I2C1_SDA PIN_CFG(17, ALT_B)
96#define GPIO17_SLIM0_CLK PIN_CFG(17, ALT_C) 96#define GPIO17_SLIM0_CLK PIN_CFG(17, ALT_C)
97 97
98#define GPIO18_GPIO PIN_CFG(18, GPIO) 98#define GPIO18_GPIO PIN_CFG(18, GPIO)
@@ -434,10 +434,10 @@
434#define GPIO146_SSP0_TXD PIN_CFG(146, ALT_A) 434#define GPIO146_SSP0_TXD PIN_CFG(146, ALT_A)
435 435
436#define GPIO147_GPIO PIN_CFG(147, GPIO) 436#define GPIO147_GPIO PIN_CFG(147, GPIO)
437#define GPIO147_I2C0_SCL PIN_CFG_INPUT(147, ALT_A, PULLUP) 437#define GPIO147_I2C0_SCL PIN_CFG(147, ALT_A)
438 438
439#define GPIO148_GPIO PIN_CFG(148, GPIO) 439#define GPIO148_GPIO PIN_CFG(148, GPIO)
440#define GPIO148_I2C0_SDA PIN_CFG_INPUT(148, ALT_A, PULLUP) 440#define GPIO148_I2C0_SDA PIN_CFG(148, ALT_A)
441 441
442#define GPIO149_GPIO PIN_CFG(149, GPIO) 442#define GPIO149_GPIO PIN_CFG(149, GPIO)
443#define GPIO149_IP_GPIO0 PIN_CFG(149, ALT_A) 443#define GPIO149_IP_GPIO0 PIN_CFG(149, ALT_A)
@@ -459,82 +459,82 @@
459#define GPIO152_KP_O9 PIN_CFG(152, ALT_C) 459#define GPIO152_KP_O9 PIN_CFG(152, ALT_C)
460 460
461#define GPIO153_GPIO PIN_CFG(153, GPIO) 461#define GPIO153_GPIO PIN_CFG(153, GPIO)
462#define GPIO153_KP_I7 PIN_CFG_INPUT(153, ALT_A, PULLDOWN) 462#define GPIO153_KP_I7 PIN_CFG(153, ALT_A)
463#define GPIO153_LCD_D24 PIN_CFG(153, ALT_B) 463#define GPIO153_LCD_D24 PIN_CFG(153, ALT_B)
464#define GPIO153_U2_RXD PIN_CFG(153, ALT_C) 464#define GPIO153_U2_RXD PIN_CFG(153, ALT_C)
465 465
466#define GPIO154_GPIO PIN_CFG(154, GPIO) 466#define GPIO154_GPIO PIN_CFG(154, GPIO)
467#define GPIO154_KP_I6 PIN_CFG_INPUT(154, ALT_A, PULLDOWN) 467#define GPIO154_KP_I6 PIN_CFG(154, ALT_A)
468#define GPIO154_LCD_D25 PIN_CFG(154, ALT_B) 468#define GPIO154_LCD_D25 PIN_CFG(154, ALT_B)
469#define GPIO154_U2_TXD PIN_CFG(154, ALT_C) 469#define GPIO154_U2_TXD PIN_CFG(154, ALT_C)
470 470
471#define GPIO155_GPIO PIN_CFG(155, GPIO) 471#define GPIO155_GPIO PIN_CFG(155, GPIO)
472#define GPIO155_KP_I5 PIN_CFG_INPUT(155, ALT_A, PULLDOWN) 472#define GPIO155_KP_I5 PIN_CFG(155, ALT_A)
473#define GPIO155_LCD_D26 PIN_CFG(155, ALT_B) 473#define GPIO155_LCD_D26 PIN_CFG(155, ALT_B)
474#define GPIO155_STMAPE_CLK PIN_CFG(155, ALT_C) 474#define GPIO155_STMAPE_CLK PIN_CFG(155, ALT_C)
475 475
476#define GPIO156_GPIO PIN_CFG(156, GPIO) 476#define GPIO156_GPIO PIN_CFG(156, GPIO)
477#define GPIO156_KP_I4 PIN_CFG_INPUT(156, ALT_A, PULLDOWN) 477#define GPIO156_KP_I4 PIN_CFG(156, ALT_A)
478#define GPIO156_LCD_D27 PIN_CFG(156, ALT_B) 478#define GPIO156_LCD_D27 PIN_CFG(156, ALT_B)
479#define GPIO156_STMAPE_DAT3 PIN_CFG(156, ALT_C) 479#define GPIO156_STMAPE_DAT3 PIN_CFG(156, ALT_C)
480 480
481#define GPIO157_GPIO PIN_CFG(157, GPIO) 481#define GPIO157_GPIO PIN_CFG(157, GPIO)
482#define GPIO157_KP_O7 PIN_CFG_INPUT(157, ALT_A, PULLUP) 482#define GPIO157_KP_O7 PIN_CFG(157, ALT_A)
483#define GPIO157_LCD_D28 PIN_CFG(157, ALT_B) 483#define GPIO157_LCD_D28 PIN_CFG(157, ALT_B)
484#define GPIO157_STMAPE_DAT2 PIN_CFG(157, ALT_C) 484#define GPIO157_STMAPE_DAT2 PIN_CFG(157, ALT_C)
485 485
486#define GPIO158_GPIO PIN_CFG(158, GPIO) 486#define GPIO158_GPIO PIN_CFG(158, GPIO)
487#define GPIO158_KP_O6 PIN_CFG_INPUT(158, ALT_A, PULLUP) 487#define GPIO158_KP_O6 PIN_CFG(158, ALT_A)
488#define GPIO158_LCD_D29 PIN_CFG(158, ALT_B) 488#define GPIO158_LCD_D29 PIN_CFG(158, ALT_B)
489#define GPIO158_STMAPE_DAT1 PIN_CFG(158, ALT_C) 489#define GPIO158_STMAPE_DAT1 PIN_CFG(158, ALT_C)
490 490
491#define GPIO159_GPIO PIN_CFG(159, GPIO) 491#define GPIO159_GPIO PIN_CFG(159, GPIO)
492#define GPIO159_KP_O5 PIN_CFG_INPUT(159, ALT_A, PULLUP) 492#define GPIO159_KP_O5 PIN_CFG(159, ALT_A)
493#define GPIO159_LCD_D30 PIN_CFG(159, ALT_B) 493#define GPIO159_LCD_D30 PIN_CFG(159, ALT_B)
494#define GPIO159_STMAPE_DAT0 PIN_CFG(159, ALT_C) 494#define GPIO159_STMAPE_DAT0 PIN_CFG(159, ALT_C)
495 495
496#define GPIO160_GPIO PIN_CFG(160, GPIO) 496#define GPIO160_GPIO PIN_CFG(160, GPIO)
497#define GPIO160_KP_O4 PIN_CFG_INPUT(160, ALT_A, PULLUP) 497#define GPIO160_KP_O4 PIN_CFG(160, ALT_A)
498#define GPIO160_LCD_D31 PIN_CFG(160, ALT_B) 498#define GPIO160_LCD_D31 PIN_CFG(160, ALT_B)
499#define GPIO160_NONE PIN_CFG(160, ALT_C) 499#define GPIO160_NONE PIN_CFG(160, ALT_C)
500 500
501#define GPIO161_GPIO PIN_CFG(161, GPIO) 501#define GPIO161_GPIO PIN_CFG(161, GPIO)
502#define GPIO161_KP_I3 PIN_CFG_INPUT(161, ALT_A, PULLDOWN) 502#define GPIO161_KP_I3 PIN_CFG(161, ALT_A)
503#define GPIO161_LCD_D32 PIN_CFG(161, ALT_B) 503#define GPIO161_LCD_D32 PIN_CFG(161, ALT_B)
504#define GPIO161_UARTMOD_RXD PIN_CFG(161, ALT_C) 504#define GPIO161_UARTMOD_RXD PIN_CFG(161, ALT_C)
505 505
506#define GPIO162_GPIO PIN_CFG(162, GPIO) 506#define GPIO162_GPIO PIN_CFG(162, GPIO)
507#define GPIO162_KP_I2 PIN_CFG_INPUT(162, ALT_A, PULLDOWN) 507#define GPIO162_KP_I2 PIN_CFG(162, ALT_A)
508#define GPIO162_LCD_D33 PIN_CFG(162, ALT_B) 508#define GPIO162_LCD_D33 PIN_CFG(162, ALT_B)
509#define GPIO162_UARTMOD_TXD PIN_CFG(162, ALT_C) 509#define GPIO162_UARTMOD_TXD PIN_CFG(162, ALT_C)
510 510
511#define GPIO163_GPIO PIN_CFG(163, GPIO) 511#define GPIO163_GPIO PIN_CFG(163, GPIO)
512#define GPIO163_KP_I1 PIN_CFG_INPUT(163, ALT_A, PULLDOWN) 512#define GPIO163_KP_I1 PIN_CFG(163, ALT_A)
513#define GPIO163_LCD_D34 PIN_CFG(163, ALT_B) 513#define GPIO163_LCD_D34 PIN_CFG(163, ALT_B)
514#define GPIO163_STMMOD_CLK PIN_CFG(163, ALT_C) 514#define GPIO163_STMMOD_CLK PIN_CFG(163, ALT_C)
515 515
516#define GPIO164_GPIO PIN_CFG(164, GPIO) 516#define GPIO164_GPIO PIN_CFG(164, GPIO)
517#define GPIO164_KP_I0 PIN_CFG_INPUT(164, ALT_A, PULLUP) 517#define GPIO164_KP_I0 PIN_CFG(164, ALT_A)
518#define GPIO164_LCD_D35 PIN_CFG(164, ALT_B) 518#define GPIO164_LCD_D35 PIN_CFG(164, ALT_B)
519#define GPIO164_STMMOD_DAT3 PIN_CFG(164, ALT_C) 519#define GPIO164_STMMOD_DAT3 PIN_CFG(164, ALT_C)
520 520
521#define GPIO165_GPIO PIN_CFG(165, GPIO) 521#define GPIO165_GPIO PIN_CFG(165, GPIO)
522#define GPIO165_KP_O3 PIN_CFG_INPUT(165, ALT_A, PULLUP) 522#define GPIO165_KP_O3 PIN_CFG(165, ALT_A)
523#define GPIO165_LCD_D36 PIN_CFG(165, ALT_B) 523#define GPIO165_LCD_D36 PIN_CFG(165, ALT_B)
524#define GPIO165_STMMOD_DAT2 PIN_CFG(165, ALT_C) 524#define GPIO165_STMMOD_DAT2 PIN_CFG(165, ALT_C)
525 525
526#define GPIO166_GPIO PIN_CFG(166, GPIO) 526#define GPIO166_GPIO PIN_CFG(166, GPIO)
527#define GPIO166_KP_O2 PIN_CFG_INPUT(166, ALT_A, PULLUP) 527#define GPIO166_KP_O2 PIN_CFG(166, ALT_A)
528#define GPIO166_LCD_D37 PIN_CFG(166, ALT_B) 528#define GPIO166_LCD_D37 PIN_CFG(166, ALT_B)
529#define GPIO166_STMMOD_DAT1 PIN_CFG(166, ALT_C) 529#define GPIO166_STMMOD_DAT1 PIN_CFG(166, ALT_C)
530 530
531#define GPIO167_GPIO PIN_CFG(167, GPIO) 531#define GPIO167_GPIO PIN_CFG(167, GPIO)
532#define GPIO167_KP_O1 PIN_CFG_INPUT(167, ALT_A, PULLUP) 532#define GPIO167_KP_O1 PIN_CFG(167, ALT_A)
533#define GPIO167_LCD_D38 PIN_CFG(167, ALT_B) 533#define GPIO167_LCD_D38 PIN_CFG(167, ALT_B)
534#define GPIO167_STMMOD_DAT0 PIN_CFG(167, ALT_C) 534#define GPIO167_STMMOD_DAT0 PIN_CFG(167, ALT_C)
535 535
536#define GPIO168_GPIO PIN_CFG(168, GPIO) 536#define GPIO168_GPIO PIN_CFG(168, GPIO)
537#define GPIO168_KP_O0 PIN_CFG_INPUT(168, ALT_A, PULLUP) 537#define GPIO168_KP_O0 PIN_CFG(168, ALT_A)
538#define GPIO168_LCD_D39 PIN_CFG(168, ALT_B) 538#define GPIO168_LCD_D39 PIN_CFG(168, ALT_B)
539#define GPIO168_NONE PIN_CFG(168, ALT_C) 539#define GPIO168_NONE PIN_CFG(168, ALT_C)
540 540
@@ -637,7 +637,7 @@
637#define GPIO216_GPIO PIN_CFG(216, GPIO) 637#define GPIO216_GPIO PIN_CFG(216, GPIO)
638#define GPIO216_MC1_DAT2DIR PIN_CFG(216, ALT_A) 638#define GPIO216_MC1_DAT2DIR PIN_CFG(216, ALT_A)
639#define GPIO216_MC3_CMDDIR PIN_CFG(216, ALT_B) 639#define GPIO216_MC3_CMDDIR PIN_CFG(216, ALT_B)
640#define GPIO216_I2C3_SDA PIN_CFG_INPUT(216, ALT_C, PULLUP) 640#define GPIO216_I2C3_SDA PIN_CFG(216, ALT_C)
641#define GPIO216_SPI2_FRM PIN_CFG(216, ALT_C) 641#define GPIO216_SPI2_FRM PIN_CFG(216, ALT_C)
642 642
643#define GPIO217_GPIO PIN_CFG(217, GPIO) 643#define GPIO217_GPIO PIN_CFG(217, GPIO)
@@ -649,7 +649,7 @@
649#define GPIO218_GPIO PIN_CFG(218, GPIO) 649#define GPIO218_GPIO PIN_CFG(218, GPIO)
650#define GPIO218_MC1_DAT31DIR PIN_CFG(218, ALT_A) 650#define GPIO218_MC1_DAT31DIR PIN_CFG(218, ALT_A)
651#define GPIO218_MC3_DAT0DIR PIN_CFG(218, ALT_B) 651#define GPIO218_MC3_DAT0DIR PIN_CFG(218, ALT_B)
652#define GPIO218_I2C3_SCL PIN_CFG_INPUT(218, ALT_C, PULLUP) 652#define GPIO218_I2C3_SCL PIN_CFG(218, ALT_C)
653#define GPIO218_SPI2_RXD PIN_CFG(218, ALT_C) 653#define GPIO218_SPI2_RXD PIN_CFG(218, ALT_C)
654 654
655#define GPIO219_GPIO PIN_CFG(219, GPIO) 655#define GPIO219_GPIO PIN_CFG(219, GPIO)
@@ -698,12 +698,12 @@
698#define GPIO229_GPIO PIN_CFG(229, GPIO) 698#define GPIO229_GPIO PIN_CFG(229, GPIO)
699#define GPIO229_CLKOUT1 PIN_CFG(229, ALT_A) 699#define GPIO229_CLKOUT1 PIN_CFG(229, ALT_A)
700#define GPIO229_PWL PIN_CFG(229, ALT_B) 700#define GPIO229_PWL PIN_CFG(229, ALT_B)
701#define GPIO229_I2C3_SDA PIN_CFG_INPUT(229, ALT_C, PULLUP) 701#define GPIO229_I2C3_SDA PIN_CFG(229, ALT_C)
702 702
703#define GPIO230_GPIO PIN_CFG(230, GPIO) 703#define GPIO230_GPIO PIN_CFG(230, GPIO)
704#define GPIO230_CLKOUT2 PIN_CFG(230, ALT_A) 704#define GPIO230_CLKOUT2 PIN_CFG(230, ALT_A)
705#define GPIO230_PWL PIN_CFG(230, ALT_B) 705#define GPIO230_PWL PIN_CFG(230, ALT_B)
706#define GPIO230_I2C3_SCL PIN_CFG_INPUT(230, ALT_C, PULLUP) 706#define GPIO230_I2C3_SCL PIN_CFG(230, ALT_C)
707 707
708#define GPIO256_GPIO PIN_CFG(256, GPIO) 708#define GPIO256_GPIO PIN_CFG(256, GPIO)
709#define GPIO256_USB_NXT PIN_CFG(256, ALT_A) 709#define GPIO256_USB_NXT PIN_CFG(256, ALT_A)
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index d2058ef8345f..da1d5ad5bd45 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -48,9 +48,7 @@ static void write_pen_release(int val)
48 48
49static void __iomem *scu_base_addr(void) 49static void __iomem *scu_base_addr(void)
50{ 50{
51 if (cpu_is_u5500()) 51 if (cpu_is_u8500_family())
52 return __io_address(U5500_SCU_BASE);
53 else if (cpu_is_u8500())
54 return __io_address(U8500_SCU_BASE); 52 return __io_address(U8500_SCU_BASE);
55 else 53 else
56 ux500_unknown_soc(); 54 ux500_unknown_soc();
@@ -99,7 +97,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
99 */ 97 */
100 write_pen_release(cpu_logical_map(cpu)); 98 write_pen_release(cpu_logical_map(cpu));
101 99
102 gic_raise_softirq(cpumask_of(cpu), 1); 100 smp_send_reschedule(cpu);
103 101
104 timeout = jiffies + (1 * HZ); 102 timeout = jiffies + (1 * HZ);
105 while (time_before(jiffies, timeout)) { 103 while (time_before(jiffies, timeout)) {
@@ -120,9 +118,7 @@ static void __init wakeup_secondary(void)
120{ 118{
121 void __iomem *backupram; 119 void __iomem *backupram;
122 120
123 if (cpu_is_u5500()) 121 if (cpu_is_u8500_family())
124 backupram = __io_address(U5500_BACKUPRAM0_BASE);
125 else if (cpu_is_u8500())
126 backupram = __io_address(U8500_BACKUPRAM0_BASE); 122 backupram = __io_address(U8500_BACKUPRAM0_BASE);
127 else 123 else
128 ux500_unknown_soc(); 124 ux500_unknown_soc();
diff --git a/arch/arm/mach-ux500/ste-dma40-db5500.h b/arch/arm/mach-ux500/ste-dma40-db5500.h
deleted file mode 100644
index cb2110c32858..000000000000
--- a/arch/arm/mach-ux500/ste-dma40-db5500.h
+++ /dev/null
@@ -1,135 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL) version 2
6 *
7 * DB5500-SoC-specific configuration for DMA40
8 */
9
10#ifndef STE_DMA40_DB5500_H
11#define STE_DMA40_DB5500_H
12
13#define DB5500_DMA_NR_DEV 64
14
15enum dma_src_dev_type {
16 DB5500_DMA_DEV0_SPI0_RX = 0,
17 DB5500_DMA_DEV1_SPI1_RX = 1,
18 DB5500_DMA_DEV2_SPI2_RX = 2,
19 DB5500_DMA_DEV3_SPI3_RX = 3,
20 DB5500_DMA_DEV4_USB_OTG_IEP_1_9 = 4,
21 DB5500_DMA_DEV5_USB_OTG_IEP_2_10 = 5,
22 DB5500_DMA_DEV6_USB_OTG_IEP_3_11 = 6,
23 DB5500_DMA_DEV7_IRDA_RFS = 7,
24 DB5500_DMA_DEV8_IRDA_FIFO_RX = 8,
25 DB5500_DMA_DEV9_MSP0_RX = 9,
26 DB5500_DMA_DEV10_MSP1_RX = 10,
27 DB5500_DMA_DEV11_MSP2_RX = 11,
28 DB5500_DMA_DEV12_UART0_RX = 12,
29 DB5500_DMA_DEV13_UART1_RX = 13,
30 DB5500_DMA_DEV14_UART2_RX = 14,
31 DB5500_DMA_DEV15_UART3_RX = 15,
32 DB5500_DMA_DEV16_USB_OTG_IEP_8 = 16,
33 DB5500_DMA_DEV17_USB_OTG_IEP_1_9 = 17,
34 DB5500_DMA_DEV18_USB_OTG_IEP_2_10 = 18,
35 DB5500_DMA_DEV19_USB_OTG_IEP_3_11 = 19,
36 DB5500_DMA_DEV20_USB_OTG_IEP_4_12 = 20,
37 DB5500_DMA_DEV21_USB_OTG_IEP_5_13 = 21,
38 DB5500_DMA_DEV22_USB_OTG_IEP_6_14 = 22,
39 DB5500_DMA_DEV23_USB_OTG_IEP_7_15 = 23,
40 DB5500_DMA_DEV24_SDMMC0_RX = 24,
41 DB5500_DMA_DEV25_SDMMC1_RX = 25,
42 DB5500_DMA_DEV26_SDMMC2_RX = 26,
43 DB5500_DMA_DEV27_SDMMC3_RX = 27,
44 DB5500_DMA_DEV28_SDMMC4_RX = 28,
45 /* 29 - 32 not used */
46 DB5500_DMA_DEV33_SDMMC0_RX = 33,
47 DB5500_DMA_DEV34_SDMMC1_RX = 34,
48 DB5500_DMA_DEV35_SDMMC2_RX = 35,
49 DB5500_DMA_DEV36_SDMMC3_RX = 36,
50 DB5500_DMA_DEV37_SDMMC4_RX = 37,
51 DB5500_DMA_DEV38_USB_OTG_IEP_8 = 38,
52 DB5500_DMA_DEV39_USB_OTG_IEP_1_9 = 39,
53 DB5500_DMA_DEV40_USB_OTG_IEP_2_10 = 40,
54 DB5500_DMA_DEV41_USB_OTG_IEP_3_11 = 41,
55 DB5500_DMA_DEV42_USB_OTG_IEP_4_12 = 42,
56 DB5500_DMA_DEV43_USB_OTG_IEP_5_13 = 43,
57 DB5500_DMA_DEV44_USB_OTG_IEP_6_14 = 44,
58 DB5500_DMA_DEV45_USB_OTG_IEP_7_15 = 45,
59 /* 46 not used */
60 DB5500_DMA_DEV47_MCDE_RX = 47,
61 DB5500_DMA_DEV48_CRYPTO1_RX = 48,
62 /* 49, 50 not used */
63 DB5500_DMA_DEV49_I2C1_RX = 51,
64 DB5500_DMA_DEV50_I2C3_RX = 52,
65 DB5500_DMA_DEV51_I2C2_RX = 53,
66 /* 54 - 60 not used */
67 DB5500_DMA_DEV61_CRYPTO0_RX = 61,
68 /* 62, 63 not used */
69};
70
71enum dma_dest_dev_type {
72 DB5500_DMA_DEV0_SPI0_TX = 0,
73 DB5500_DMA_DEV1_SPI1_TX = 1,
74 DB5500_DMA_DEV2_SPI2_TX = 2,
75 DB5500_DMA_DEV3_SPI3_TX = 3,
76 DB5500_DMA_DEV4_USB_OTG_OEP_1_9 = 4,
77 DB5500_DMA_DEV5_USB_OTG_OEP_2_10 = 5,
78 DB5500_DMA_DEV6_USB_OTG_OEP_3_11 = 6,
79 DB5500_DMA_DEV7_IRRC_TX = 7,
80 DB5500_DMA_DEV8_IRDA_FIFO_TX = 8,
81 DB5500_DMA_DEV9_MSP0_TX = 9,
82 DB5500_DMA_DEV10_MSP1_TX = 10,
83 DB5500_DMA_DEV11_MSP2_TX = 11,
84 DB5500_DMA_DEV12_UART0_TX = 12,
85 DB5500_DMA_DEV13_UART1_TX = 13,
86 DB5500_DMA_DEV14_UART2_TX = 14,
87 DB5500_DMA_DEV15_UART3_TX = 15,
88 DB5500_DMA_DEV16_USB_OTG_OEP_8 = 16,
89 DB5500_DMA_DEV17_USB_OTG_OEP_1_9 = 17,
90 DB5500_DMA_DEV18_USB_OTG_OEP_2_10 = 18,
91 DB5500_DMA_DEV19_USB_OTG_OEP_3_11 = 19,
92 DB5500_DMA_DEV20_USB_OTG_OEP_4_12 = 20,
93 DB5500_DMA_DEV21_USB_OTG_OEP_5_13 = 21,
94 DB5500_DMA_DEV22_USB_OTG_OEP_6_14 = 22,
95 DB5500_DMA_DEV23_USB_OTG_OEP_7_15 = 23,
96 DB5500_DMA_DEV24_SDMMC0_TX = 24,
97 DB5500_DMA_DEV25_SDMMC1_TX = 25,
98 DB5500_DMA_DEV26_SDMMC2_TX = 26,
99 DB5500_DMA_DEV27_SDMMC3_TX = 27,
100 DB5500_DMA_DEV28_SDMMC4_TX = 28,
101 /* 29 - 31 not used */
102 DB5500_DMA_DEV32_FSMC_TX = 32,
103 DB5500_DMA_DEV33_SDMMC0_TX = 33,
104 DB5500_DMA_DEV34_SDMMC1_TX = 34,
105 DB5500_DMA_DEV35_SDMMC2_TX = 35,
106 DB5500_DMA_DEV36_SDMMC3_TX = 36,
107 DB5500_DMA_DEV37_SDMMC4_TX = 37,
108 DB5500_DMA_DEV38_USB_OTG_OEP_8 = 38,
109 DB5500_DMA_DEV39_USB_OTG_OEP_1_9 = 39,
110 DB5500_DMA_DEV40_USB_OTG_OEP_2_10 = 40,
111 DB5500_DMA_DEV41_USB_OTG_OEP_3_11 = 41,
112 DB5500_DMA_DEV42_USB_OTG_OEP_4_12 = 42,
113 DB5500_DMA_DEV43_USB_OTG_OEP_5_13 = 43,
114 DB5500_DMA_DEV44_USB_OTG_OEP_6_14 = 44,
115 DB5500_DMA_DEV45_USB_OTG_OEP_7_15 = 45,
116 /* 46 not used */
117 DB5500_DMA_DEV47_STM_TX = 47,
118 DB5500_DMA_DEV48_CRYPTO1_TX = 48,
119 DB5500_DMA_DEV49_CRYPTO1_TX_HASH1_TX = 49,
120 DB5500_DMA_DEV50_HASH1_TX = 50,
121 DB5500_DMA_DEV51_I2C1_TX = 51,
122 DB5500_DMA_DEV52_I2C3_TX = 52,
123 DB5500_DMA_DEV53_I2C2_TX = 53,
124 /* 54, 55 not used */
125 DB5500_DMA_MEMCPY_TX_1 = 56,
126 DB5500_DMA_MEMCPY_TX_2 = 57,
127 DB5500_DMA_MEMCPY_TX_3 = 58,
128 DB5500_DMA_MEMCPY_TX_4 = 59,
129 DB5500_DMA_MEMCPY_TX_5 = 60,
130 DB5500_DMA_DEV61_CRYPTO0_TX = 61,
131 DB5500_DMA_DEV62_CRYPTO0_TX_HASH0_TX = 62,
132 DB5500_DMA_DEV63_HASH0_TX = 63,
133};
134
135#endif
diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c
index d37df98b5c32..741e71feca78 100644
--- a/arch/arm/mach-ux500/timer.c
+++ b/arch/arm/mach-ux500/timer.c
@@ -8,6 +8,7 @@
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/clksrc-dbx500-prcmu.h> 9#include <linux/clksrc-dbx500-prcmu.h>
10#include <linux/of.h> 10#include <linux/of.h>
11#include <linux/of_address.h>
11 12
12#include <asm/smp_twd.h> 13#include <asm/smp_twd.h>
13 14
@@ -18,8 +19,6 @@
18#include <mach/irqs.h> 19#include <mach/irqs.h>
19 20
20#ifdef CONFIG_HAVE_ARM_TWD 21#ifdef CONFIG_HAVE_ARM_TWD
21static DEFINE_TWD_LOCAL_TIMER(u5500_twd_local_timer,
22 U5500_TWD_BASE, IRQ_LOCALTIMER);
23static DEFINE_TWD_LOCAL_TIMER(u8500_twd_local_timer, 22static DEFINE_TWD_LOCAL_TIMER(u8500_twd_local_timer,
24 U8500_TWD_BASE, IRQ_LOCALTIMER); 23 U8500_TWD_BASE, IRQ_LOCALTIMER);
25 24
@@ -28,8 +27,8 @@ static void __init ux500_twd_init(void)
28 struct twd_local_timer *twd_local_timer; 27 struct twd_local_timer *twd_local_timer;
29 int err; 28 int err;
30 29
31 twd_local_timer = cpu_is_u5500() ? &u5500_twd_local_timer : 30 /* Use this to switch local timer base if changed in new ASICs */
32 &u8500_twd_local_timer; 31 twd_local_timer = &u8500_twd_local_timer;
33 32
34 if (of_have_populated_dt()) 33 if (of_have_populated_dt())
35 twd_local_timer_of_register(); 34 twd_local_timer_of_register();
@@ -43,21 +42,41 @@ static void __init ux500_twd_init(void)
43#define ux500_twd_init() do { } while(0) 42#define ux500_twd_init() do { } while(0)
44#endif 43#endif
45 44
45const static struct of_device_id prcmu_timer_of_match[] __initconst = {
46 { .compatible = "stericsson,db8500-prcmu-timer-4", },
47 { },
48};
49
46static void __init ux500_timer_init(void) 50static void __init ux500_timer_init(void)
47{ 51{
48 void __iomem *mtu_timer_base; 52 void __iomem *mtu_timer_base;
49 void __iomem *prcmu_timer_base; 53 void __iomem *prcmu_timer_base;
54 void __iomem *tmp_base;
55 struct device_node *np;
50 56
51 if (cpu_is_u5500()) { 57 if (cpu_is_u8500_family()) {
52 mtu_timer_base = __io_address(U5500_MTU0_BASE);
53 prcmu_timer_base = __io_address(U5500_PRCMU_TIMER_3_BASE);
54 } else if (cpu_is_u8500()) {
55 mtu_timer_base = __io_address(U8500_MTU0_BASE); 58 mtu_timer_base = __io_address(U8500_MTU0_BASE);
56 prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE); 59 prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE);
57 } else { 60 } else {
58 ux500_unknown_soc(); 61 ux500_unknown_soc();
59 } 62 }
60 63
64 /* TODO: Once MTU has been DT:ed place code above into else. */
65 if (of_have_populated_dt()) {
66 np = of_find_matching_node(NULL, prcmu_timer_of_match);
67 if (!np)
68 goto dt_fail;
69
70 tmp_base = of_iomap(np, 0);
71 if (!tmp_base)
72 goto dt_fail;
73
74 prcmu_timer_base = tmp_base;
75 }
76
77dt_fail:
78 /* Doing it the old fashioned way. */
79
61 /* 80 /*
62 * Here we register the timerblocks active in the system. 81 * Here we register the timerblocks active in the system.
63 * Localtimers (twd) is started when both cpu is up and running. 82 * Localtimers (twd) is started when both cpu is up and running.
@@ -70,7 +89,7 @@ static void __init ux500_timer_init(void)
70 * depending on delay which is not yet calibrated. RTC-RTT is in the 89 * depending on delay which is not yet calibrated. RTC-RTT is in the
71 * always-on powerdomain and is used as clockevent instead of twd when 90 * always-on powerdomain and is used as clockevent instead of twd when
72 * sleeping. 91 * sleeping.
73 * The PRCMU timer 4(3 for DB5500) register a clocksource and 92 * The PRCMU timer 4 register a clocksource and
74 * sched_clock with higher rating then MTU since is always-on. 93 * sched_clock with higher rating then MTU since is always-on.
75 * 94 *
76 */ 95 */
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 6bbd74e950ab..cf4687ee2a7b 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -66,12 +66,6 @@
66#define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE) 66#define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE)
67#define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE) 67#define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE)
68 68
69static struct fpga_irq_data sic_irq = {
70 .base = VA_SIC_BASE,
71 .irq_start = IRQ_SIC_START,
72 .chip.name = "SIC",
73};
74
75#if 1 69#if 1
76#define IRQ_MMCI0A IRQ_VICSOURCE22 70#define IRQ_MMCI0A IRQ_VICSOURCE22
77#define IRQ_AACI IRQ_VICSOURCE24 71#define IRQ_AACI IRQ_VICSOURCE24
@@ -105,8 +99,11 @@ void __init versatile_init_irq(void)
105 99
106 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); 100 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR);
107 101
108 fpga_irq_init(IRQ_VICSOURCE31, ~PIC_MASK, &sic_irq); 102 np = of_find_matching_node_by_address(NULL, sic_of_match,
109 irq_domain_generate_simple(sic_of_match, VERSATILE_SIC_BASE, IRQ_SIC_START); 103 VERSATILE_SIC_BASE);
104
105 fpga_irq_init(VA_SIC_BASE, "SIC", IRQ_SIC_START,
106 IRQ_VICSOURCE31, ~PIC_MASK, np);
110 107
111 /* 108 /*
112 * Interrupts on secondary controller from 0 to 8 are routed to 109 * Interrupts on secondary controller from 0 to 8 are routed to
@@ -666,17 +663,18 @@ static struct amba_device *amba_devs[] __initdata = {
666 * having a specific name. 663 * having a specific name.
667 */ 664 */
668struct of_dev_auxdata versatile_auxdata_lookup[] __initdata = { 665struct of_dev_auxdata versatile_auxdata_lookup[] __initdata = {
669 OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI0_BASE, "fpga:05", NULL), 666 OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI0_BASE, "fpga:05", &mmc0_plat_data),
670 OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI0_BASE, "fpga:06", NULL), 667 OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI0_BASE, "fpga:06", NULL),
671 OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI1_BASE, "fpga:07", NULL), 668 OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI1_BASE, "fpga:07", NULL),
672 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART3_BASE, "fpga:09", NULL), 669 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART3_BASE, "fpga:09", NULL),
670 /* FIXME: this is buggy, the platform data is needed for this MMC instance too */
673 OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI1_BASE, "fpga:0b", NULL), 671 OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI1_BASE, "fpga:0b", NULL),
674 672
675 OF_DEV_AUXDATA("arm,primecell", VERSATILE_CLCD_BASE, "dev:20", &clcd_plat_data), 673 OF_DEV_AUXDATA("arm,primecell", VERSATILE_CLCD_BASE, "dev:20", &clcd_plat_data),
676 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART0_BASE, "dev:f1", NULL), 674 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART0_BASE, "dev:f1", NULL),
677 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART1_BASE, "dev:f2", NULL), 675 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART1_BASE, "dev:f2", NULL),
678 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART2_BASE, "dev:f3", NULL), 676 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART2_BASE, "dev:f3", NULL),
679 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SSP_BASE, "dev:f4", NULL), 677 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SSP_BASE, "dev:f4", &ssp0_plat_data),
680 678
681#if 0 679#if 0
682 /* 680 /*
diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c
index d2268be8c34c..15c6a00000ec 100644
--- a/arch/arm/mach-versatile/pci.c
+++ b/arch/arm/mach-versatile/pci.c
@@ -303,12 +303,6 @@ int __init pci_versatile_setup(int nr, struct pci_sys_data *sys)
303} 303}
304 304
305 305
306struct pci_bus * __init pci_versatile_scan_bus(int nr, struct pci_sys_data *sys)
307{
308 return pci_scan_root_bus(NULL, sys->busnr, &pci_versatile_ops, sys,
309 &sys->resources);
310}
311
312void __init pci_versatile_preinit(void) 306void __init pci_versatile_preinit(void)
313{ 307{
314 pcibios_min_io = 0x44000000; 308 pcibios_min_io = 0x44000000;
@@ -339,19 +333,16 @@ static int __init versatile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
339 * 26 1 29 333 * 26 1 29
340 * 27 1 30 334 * 27 1 30
341 */ 335 */
342 irq = 27 + ((slot + pin - 1) & 3); 336 irq = 27 + ((slot - 24 + pin - 1) & 3);
343
344 printk("PCI map irq: slot %d, pin %d, devslot %d, irq: %d\n",slot,pin,devslot,irq);
345 337
346 return irq; 338 return irq;
347} 339}
348 340
349static struct hw_pci versatile_pci __initdata = { 341static struct hw_pci versatile_pci __initdata = {
350 .swizzle = NULL,
351 .map_irq = versatile_map_irq, 342 .map_irq = versatile_map_irq,
352 .nr_controllers = 1, 343 .nr_controllers = 1,
344 .ops = &pci_versatile_ops,
353 .setup = pci_versatile_setup, 345 .setup = pci_versatile_setup,
354 .scan = pci_versatile_scan_bus,
355 .preinit = pci_versatile_preinit, 346 .preinit = pci_versatile_preinit,
356}; 347};
357 348
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 47cdcca5a7e7..04dd092211b8 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -19,8 +19,10 @@
19#include <linux/clkdev.h> 19#include <linux/clkdev.h>
20#include <linux/mtd/physmap.h> 20#include <linux/mtd/physmap.h>
21 21
22#include <asm/arch_timer.h>
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/sizes.h> 24#include <asm/sizes.h>
25#include <asm/smp_twd.h>
24#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
25#include <asm/mach/map.h> 27#include <asm/mach/map.h>
26#include <asm/mach/time.h> 28#include <asm/mach/time.h>
@@ -616,7 +618,6 @@ void __init v2m_dt_init_early(void)
616 } 618 }
617 619
618 clkdev_add_table(v2m_dt_lookups, ARRAY_SIZE(v2m_dt_lookups)); 620 clkdev_add_table(v2m_dt_lookups, ARRAY_SIZE(v2m_dt_lookups));
619 versatile_sched_clock_init(v2m_sysreg_base + V2M_SYS_24MHZ, 24000000);
620} 621}
621 622
622static struct of_device_id vexpress_irq_match[] __initdata = { 623static struct of_device_id vexpress_irq_match[] __initdata = {
@@ -643,6 +644,11 @@ static void __init v2m_dt_timer_init(void)
643 return; 644 return;
644 node = of_find_node_by_path(path); 645 node = of_find_node_by_path(path);
645 v2m_sp804_init(of_iomap(node, 0), irq_of_parse_and_map(node, 0)); 646 v2m_sp804_init(of_iomap(node, 0), irq_of_parse_and_map(node, 0));
647 if (arch_timer_of_register() != 0)
648 twd_local_timer_of_register();
649
650 if (arch_timer_sched_clock_init() != 0)
651 versatile_sched_clock_init(v2m_sysreg_base + V2M_SYS_24MHZ, 24000000);
646} 652}
647 653
648static struct sys_timer v2m_dt_timer = { 654static struct sys_timer v2m_dt_timer = {
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 7edef9121632..101b9681c08c 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -4,23 +4,6 @@ comment "Processor Type"
4# which CPUs we support in the kernel image, and the compiler instruction 4# which CPUs we support in the kernel image, and the compiler instruction
5# optimiser behaviour. 5# optimiser behaviour.
6 6
7# ARM610
8config CPU_ARM610
9 bool "Support ARM610 processor" if ARCH_RPC
10 select CPU_32v3
11 select CPU_CACHE_V3
12 select CPU_CACHE_VIVT
13 select CPU_CP15_MMU
14 select CPU_COPY_V3 if MMU
15 select CPU_TLB_V3 if MMU
16 select CPU_PABRT_LEGACY
17 help
18 The ARM610 is the successor to the ARM3 processor
19 and was produced by VLSI Technology Inc.
20
21 Say Y if you want support for the ARM610 processor.
22 Otherwise, say N.
23
24# ARM7TDMI 7# ARM7TDMI
25config CPU_ARM7TDMI 8config CPU_ARM7TDMI
26 bool "Support ARM7TDMI processor" 9 bool "Support ARM7TDMI processor"
@@ -36,25 +19,6 @@ config CPU_ARM7TDMI
36 Say Y if you want support for the ARM7TDMI processor. 19 Say Y if you want support for the ARM7TDMI processor.
37 Otherwise, say N. 20 Otherwise, say N.
38 21
39# ARM710
40config CPU_ARM710
41 bool "Support ARM710 processor" if ARCH_RPC
42 select CPU_32v3
43 select CPU_CACHE_V3
44 select CPU_CACHE_VIVT
45 select CPU_CP15_MMU
46 select CPU_COPY_V3 if MMU
47 select CPU_TLB_V3 if MMU
48 select CPU_PABRT_LEGACY
49 help
50 A 32-bit RISC microprocessor based on the ARM7 processor core
51 designed by Advanced RISC Machines Ltd. The ARM710 is the
52 successor to the ARM610 processor. It was released in
53 July 1994 by VLSI Technology Inc.
54
55 Say Y if you want support for the ARM710 processor.
56 Otherwise, say N.
57
58# ARM720T 22# ARM720T
59config CPU_ARM720T 23config CPU_ARM720T
60 bool "Support ARM720T processor" if ARCH_INTEGRATOR 24 bool "Support ARM720T processor" if ARCH_INTEGRATOR
@@ -530,9 +494,6 @@ config CPU_CACHE_FA
530 494
531if MMU 495if MMU
532# The copy-page model 496# The copy-page model
533config CPU_COPY_V3
534 bool
535
536config CPU_COPY_V4WT 497config CPU_COPY_V4WT
537 bool 498 bool
538 499
@@ -549,11 +510,6 @@ config CPU_COPY_V6
549 bool 510 bool
550 511
551# This selects the TLB model 512# This selects the TLB model
552config CPU_TLB_V3
553 bool
554 help
555 ARM Architecture Version 3 TLB.
556
557config CPU_TLB_V4WT 513config CPU_TLB_V4WT
558 bool 514 bool
559 help 515 help
@@ -723,7 +679,7 @@ config CPU_HIGH_VECTOR
723 bool "Select the High exception vector" 679 bool "Select the High exception vector"
724 help 680 help
725 Say Y here to select high exception vector(0xFFFF0000~). 681 Say Y here to select high exception vector(0xFFFF0000~).
726 The exception vector can be vary depending on the platform 682 The exception vector can vary depending on the platform
727 design in nommu mode. If your platform needs to select 683 design in nommu mode. If your platform needs to select
728 high exception vector, say Y. 684 high exception vector, say Y.
729 Otherwise or if you are unsure, say N, and the low exception 685 Otherwise or if you are unsure, say N, and the low exception
@@ -731,7 +687,7 @@ config CPU_HIGH_VECTOR
731 687
732config CPU_ICACHE_DISABLE 688config CPU_ICACHE_DISABLE
733 bool "Disable I-Cache (I-bit)" 689 bool "Disable I-Cache (I-bit)"
734 depends on CPU_CP15 && !(CPU_ARM610 || CPU_ARM710 || CPU_ARM720T || CPU_ARM740T || CPU_XSCALE || CPU_XSC3) 690 depends on CPU_CP15 && !(CPU_ARM720T || CPU_ARM740T || CPU_XSCALE || CPU_XSC3)
735 help 691 help
736 Say Y here to disable the processor instruction cache. Unless 692 Say Y here to disable the processor instruction cache. Unless
737 you have a reason not to or are unsure, say N. 693 you have a reason not to or are unsure, say N.
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index bca7e61928c7..8a9c4cb50a93 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -44,7 +44,6 @@ obj-$(CONFIG_CPU_CACHE_FA) += cache-fa.o
44AFLAGS_cache-v6.o :=-Wa,-march=armv6 44AFLAGS_cache-v6.o :=-Wa,-march=armv6
45AFLAGS_cache-v7.o :=-Wa,-march=armv7-a 45AFLAGS_cache-v7.o :=-Wa,-march=armv7-a
46 46
47obj-$(CONFIG_CPU_COPY_V3) += copypage-v3.o
48obj-$(CONFIG_CPU_COPY_V4WT) += copypage-v4wt.o 47obj-$(CONFIG_CPU_COPY_V4WT) += copypage-v4wt.o
49obj-$(CONFIG_CPU_COPY_V4WB) += copypage-v4wb.o 48obj-$(CONFIG_CPU_COPY_V4WB) += copypage-v4wb.o
50obj-$(CONFIG_CPU_COPY_FEROCEON) += copypage-feroceon.o 49obj-$(CONFIG_CPU_COPY_FEROCEON) += copypage-feroceon.o
@@ -54,7 +53,6 @@ obj-$(CONFIG_CPU_XSCALE) += copypage-xscale.o
54obj-$(CONFIG_CPU_XSC3) += copypage-xsc3.o 53obj-$(CONFIG_CPU_XSC3) += copypage-xsc3.o
55obj-$(CONFIG_CPU_COPY_FA) += copypage-fa.o 54obj-$(CONFIG_CPU_COPY_FA) += copypage-fa.o
56 55
57obj-$(CONFIG_CPU_TLB_V3) += tlb-v3.o
58obj-$(CONFIG_CPU_TLB_V4WT) += tlb-v4.o 56obj-$(CONFIG_CPU_TLB_V4WT) += tlb-v4.o
59obj-$(CONFIG_CPU_TLB_V4WB) += tlb-v4wb.o 57obj-$(CONFIG_CPU_TLB_V4WB) += tlb-v4wb.o
60obj-$(CONFIG_CPU_TLB_V4WBI) += tlb-v4wbi.o 58obj-$(CONFIG_CPU_TLB_V4WBI) += tlb-v4wbi.o
@@ -66,8 +64,6 @@ obj-$(CONFIG_CPU_TLB_FA) += tlb-fa.o
66AFLAGS_tlb-v6.o :=-Wa,-march=armv6 64AFLAGS_tlb-v6.o :=-Wa,-march=armv6
67AFLAGS_tlb-v7.o :=-Wa,-march=armv7-a 65AFLAGS_tlb-v7.o :=-Wa,-march=armv7-a
68 66
69obj-$(CONFIG_CPU_ARM610) += proc-arm6_7.o
70obj-$(CONFIG_CPU_ARM710) += proc-arm6_7.o
71obj-$(CONFIG_CPU_ARM7TDMI) += proc-arm7tdmi.o 67obj-$(CONFIG_CPU_ARM7TDMI) += proc-arm7tdmi.o
72obj-$(CONFIG_CPU_ARM720T) += proc-arm720.o 68obj-$(CONFIG_CPU_ARM720T) += proc-arm720.o
73obj-$(CONFIG_CPU_ARM740T) += proc-arm740.o 69obj-$(CONFIG_CPU_ARM740T) += proc-arm740.o
diff --git a/arch/arm/mm/abort-ev6.S b/arch/arm/mm/abort-ev6.S
index ff1f7cc11f87..80741992a9fc 100644
--- a/arch/arm/mm/abort-ev6.S
+++ b/arch/arm/mm/abort-ev6.S
@@ -26,18 +26,23 @@ ENTRY(v6_early_abort)
26 mrc p15, 0, r1, c5, c0, 0 @ get FSR 26 mrc p15, 0, r1, c5, c0, 0 @ get FSR
27 mrc p15, 0, r0, c6, c0, 0 @ get FAR 27 mrc p15, 0, r0, c6, c0, 0 @ get FAR
28/* 28/*
29 * Faulty SWP instruction on 1136 doesn't set bit 11 in DFSR (erratum 326103). 29 * Faulty SWP instruction on 1136 doesn't set bit 11 in DFSR.
30 * The test below covers all the write situations, including Java bytecodes
31 */ 30 */
32 bic r1, r1, #1 << 11 @ clear bit 11 of FSR 31#ifdef CONFIG_ARM_ERRATA_326103
32 ldr ip, =0x4107b36
33 mrc p15, 0, r3, c0, c0, 0 @ get processor id
34 teq ip, r3, lsr #4 @ r0 ARM1136?
35 bne do_DataAbort
33 tst r5, #PSR_J_BIT @ Java? 36 tst r5, #PSR_J_BIT @ Java?
37 tsteq r5, #PSR_T_BIT @ Thumb?
34 bne do_DataAbort 38 bne do_DataAbort
35 do_thumb_abort fsr=r1, pc=r4, psr=r5, tmp=r3 39 bic r1, r1, #1 << 11 @ clear bit 11 of FSR
36 ldreq r3, [r4] @ read aborted ARM instruction 40 ldr r3, [r4] @ read aborted ARM instruction
37#ifdef CONFIG_CPU_ENDIAN_BE8 41#ifdef CONFIG_CPU_ENDIAN_BE8
38 reveq r3, r3 42 rev r3, r3
39#endif 43#endif
40 do_ldrd_abort tmp=ip, insn=r3 44 do_ldrd_abort tmp=ip, insn=r3
41 tst r3, #1 << 20 @ L = 0 -> write 45 tst r3, #1 << 20 @ L = 0 -> write
42 orreq r1, r1, #1 << 11 @ yes. 46 orreq r1, r1, #1 << 11 @ yes.
47#endif
43 b do_DataAbort 48 b do_DataAbort
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index a53fd2aaa2f4..2a8e380501e8 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -32,6 +32,7 @@ static void __iomem *l2x0_base;
32static DEFINE_RAW_SPINLOCK(l2x0_lock); 32static DEFINE_RAW_SPINLOCK(l2x0_lock);
33static u32 l2x0_way_mask; /* Bitmask of active ways */ 33static u32 l2x0_way_mask; /* Bitmask of active ways */
34static u32 l2x0_size; 34static u32 l2x0_size;
35static unsigned long sync_reg_offset = L2X0_CACHE_SYNC;
35 36
36struct l2x0_regs l2x0_saved_regs; 37struct l2x0_regs l2x0_saved_regs;
37 38
@@ -61,12 +62,7 @@ static inline void cache_sync(void)
61{ 62{
62 void __iomem *base = l2x0_base; 63 void __iomem *base = l2x0_base;
63 64
64#ifdef CONFIG_PL310_ERRATA_753970 65 writel_relaxed(0, base + sync_reg_offset);
65 /* write to an unmmapped register */
66 writel_relaxed(0, base + L2X0_DUMMY_REG);
67#else
68 writel_relaxed(0, base + L2X0_CACHE_SYNC);
69#endif
70 cache_wait(base + L2X0_CACHE_SYNC, 1); 66 cache_wait(base + L2X0_CACHE_SYNC, 1);
71} 67}
72 68
@@ -85,10 +81,13 @@ static inline void l2x0_inv_line(unsigned long addr)
85} 81}
86 82
87#if defined(CONFIG_PL310_ERRATA_588369) || defined(CONFIG_PL310_ERRATA_727915) 83#if defined(CONFIG_PL310_ERRATA_588369) || defined(CONFIG_PL310_ERRATA_727915)
84static inline void debug_writel(unsigned long val)
85{
86 if (outer_cache.set_debug)
87 outer_cache.set_debug(val);
88}
88 89
89#define debug_writel(val) outer_cache.set_debug(val) 90static void pl310_set_debug(unsigned long val)
90
91static void l2x0_set_debug(unsigned long val)
92{ 91{
93 writel_relaxed(val, l2x0_base + L2X0_DEBUG_CTRL); 92 writel_relaxed(val, l2x0_base + L2X0_DEBUG_CTRL);
94} 93}
@@ -98,7 +97,7 @@ static inline void debug_writel(unsigned long val)
98{ 97{
99} 98}
100 99
101#define l2x0_set_debug NULL 100#define pl310_set_debug NULL
102#endif 101#endif
103 102
104#ifdef CONFIG_PL310_ERRATA_588369 103#ifdef CONFIG_PL310_ERRATA_588369
@@ -331,6 +330,11 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
331 else 330 else
332 ways = 8; 331 ways = 8;
333 type = "L310"; 332 type = "L310";
333#ifdef CONFIG_PL310_ERRATA_753970
334 /* Unmapped register. */
335 sync_reg_offset = L2X0_DUMMY_REG;
336#endif
337 outer_cache.set_debug = pl310_set_debug;
334 break; 338 break;
335 case L2X0_CACHE_ID_PART_L210: 339 case L2X0_CACHE_ID_PART_L210:
336 ways = (aux >> 13) & 0xf; 340 ways = (aux >> 13) & 0xf;
@@ -379,7 +383,6 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
379 outer_cache.flush_all = l2x0_flush_all; 383 outer_cache.flush_all = l2x0_flush_all;
380 outer_cache.inv_all = l2x0_inv_all; 384 outer_cache.inv_all = l2x0_inv_all;
381 outer_cache.disable = l2x0_disable; 385 outer_cache.disable = l2x0_disable;
382 outer_cache.set_debug = l2x0_set_debug;
383 386
384 printk(KERN_INFO "%s cache controller enabled\n", type); 387 printk(KERN_INFO "%s cache controller enabled\n", type);
385 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n", 388 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n",
diff --git a/arch/arm/mm/cache-tauros2.c b/arch/arm/mm/cache-tauros2.c
index 1fbca05fe906..23a7643e9a87 100644
--- a/arch/arm/mm/cache-tauros2.c
+++ b/arch/arm/mm/cache-tauros2.c
@@ -108,6 +108,26 @@ static void tauros2_flush_range(unsigned long start, unsigned long end)
108 108
109 dsb(); 109 dsb();
110} 110}
111
112static void tauros2_disable(void)
113{
114 __asm__ __volatile__ (
115 "mcr p15, 1, %0, c7, c11, 0 @L2 Cache Clean All\n\t"
116 "mrc p15, 0, %0, c1, c0, 0\n\t"
117 "bic %0, %0, #(1 << 26)\n\t"
118 "mcr p15, 0, %0, c1, c0, 0 @Disable L2 Cache\n\t"
119 : : "r" (0x0));
120}
121
122static void tauros2_resume(void)
123{
124 __asm__ __volatile__ (
125 "mcr p15, 1, %0, c7, c7, 0 @L2 Cache Invalidate All\n\t"
126 "mrc p15, 0, %0, c1, c0, 0\n\t"
127 "orr %0, %0, #(1 << 26)\n\t"
128 "mcr p15, 0, %0, c1, c0, 0 @Enable L2 Cache\n\t"
129 : : "r" (0x0));
130}
111#endif 131#endif
112 132
113static inline u32 __init read_extra_features(void) 133static inline u32 __init read_extra_features(void)
@@ -194,6 +214,8 @@ void __init tauros2_init(void)
194 outer_cache.inv_range = tauros2_inv_range; 214 outer_cache.inv_range = tauros2_inv_range;
195 outer_cache.clean_range = tauros2_clean_range; 215 outer_cache.clean_range = tauros2_clean_range;
196 outer_cache.flush_range = tauros2_flush_range; 216 outer_cache.flush_range = tauros2_flush_range;
217 outer_cache.disable = tauros2_disable;
218 outer_cache.resume = tauros2_resume;
197 } 219 }
198#endif 220#endif
199 221
@@ -219,6 +241,8 @@ void __init tauros2_init(void)
219 outer_cache.inv_range = tauros2_inv_range; 241 outer_cache.inv_range = tauros2_inv_range;
220 outer_cache.clean_range = tauros2_clean_range; 242 outer_cache.clean_range = tauros2_clean_range;
221 outer_cache.flush_range = tauros2_flush_range; 243 outer_cache.flush_range = tauros2_flush_range;
244 outer_cache.disable = tauros2_disable;
245 outer_cache.resume = tauros2_resume;
222 } 246 }
223#endif 247#endif
224 248
diff --git a/arch/arm/mm/cache-v3.S b/arch/arm/mm/cache-v3.S
index c2301f226100..52e35f32eefb 100644
--- a/arch/arm/mm/cache-v3.S
+++ b/arch/arm/mm/cache-v3.S
@@ -78,6 +78,7 @@ ENTRY(v3_coherent_kern_range)
78 * - end - virtual end address 78 * - end - virtual end address
79 */ 79 */
80ENTRY(v3_coherent_user_range) 80ENTRY(v3_coherent_user_range)
81 mov r0, #0
81 mov pc, lr 82 mov pc, lr
82 83
83/* 84/*
diff --git a/arch/arm/mm/cache-v4.S b/arch/arm/mm/cache-v4.S
index fd9bb7addc8d..022135d2b7e4 100644
--- a/arch/arm/mm/cache-v4.S
+++ b/arch/arm/mm/cache-v4.S
@@ -88,6 +88,7 @@ ENTRY(v4_coherent_kern_range)
88 * - end - virtual end address 88 * - end - virtual end address
89 */ 89 */
90ENTRY(v4_coherent_user_range) 90ENTRY(v4_coherent_user_range)
91 mov r0, #0
91 mov pc, lr 92 mov pc, lr
92 93
93/* 94/*
diff --git a/arch/arm/mm/cache-v4wb.S b/arch/arm/mm/cache-v4wb.S
index 4f2c14151ccb..8f1eeae340c8 100644
--- a/arch/arm/mm/cache-v4wb.S
+++ b/arch/arm/mm/cache-v4wb.S
@@ -167,9 +167,9 @@ ENTRY(v4wb_coherent_user_range)
167 add r0, r0, #CACHE_DLINESIZE 167 add r0, r0, #CACHE_DLINESIZE
168 cmp r0, r1 168 cmp r0, r1
169 blo 1b 169 blo 1b
170 mov ip, #0 170 mov r0, #0
171 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache 171 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
172 mcr p15, 0, ip, c7, c10, 4 @ drain WB 172 mcr p15, 0, r0, c7, c10, 4 @ drain WB
173 mov pc, lr 173 mov pc, lr
174 174
175 175
diff --git a/arch/arm/mm/cache-v4wt.S b/arch/arm/mm/cache-v4wt.S
index 4d7b467631ce..b34a5f908a82 100644
--- a/arch/arm/mm/cache-v4wt.S
+++ b/arch/arm/mm/cache-v4wt.S
@@ -125,6 +125,7 @@ ENTRY(v4wt_coherent_user_range)
125 add r0, r0, #CACHE_DLINESIZE 125 add r0, r0, #CACHE_DLINESIZE
126 cmp r0, r1 126 cmp r0, r1
127 blo 1b 127 blo 1b
128 mov r0, #0
128 mov pc, lr 129 mov pc, lr
129 130
130/* 131/*
diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S
index 74c2e5a33a4d..4b10760c56d6 100644
--- a/arch/arm/mm/cache-v6.S
+++ b/arch/arm/mm/cache-v6.S
@@ -12,6 +12,7 @@
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <asm/assembler.h> 14#include <asm/assembler.h>
15#include <asm/errno.h>
15#include <asm/unwind.h> 16#include <asm/unwind.h>
16 17
17#include "proc-macros.S" 18#include "proc-macros.S"
@@ -135,7 +136,6 @@ ENTRY(v6_coherent_user_range)
1351: 1361:
136 USER( mcr p15, 0, r0, c7, c10, 1 ) @ clean D line 137 USER( mcr p15, 0, r0, c7, c10, 1 ) @ clean D line
137 add r0, r0, #CACHE_LINE_SIZE 138 add r0, r0, #CACHE_LINE_SIZE
1382:
139 cmp r0, r1 139 cmp r0, r1
140 blo 1b 140 blo 1b
141#endif 141#endif
@@ -154,13 +154,11 @@ ENTRY(v6_coherent_user_range)
154 154
155/* 155/*
156 * Fault handling for the cache operation above. If the virtual address in r0 156 * Fault handling for the cache operation above. If the virtual address in r0
157 * isn't mapped, just try the next page. 157 * isn't mapped, fail with -EFAULT.
158 */ 158 */
1599001: 1599001:
160 mov r0, r0, lsr #12 160 mov r0, #-EFAULT
161 mov r0, r0, lsl #12 161 mov pc, lr
162 add r0, r0, #4096
163 b 2b
164 UNWIND(.fnend ) 162 UNWIND(.fnend )
165ENDPROC(v6_coherent_user_range) 163ENDPROC(v6_coherent_user_range)
166ENDPROC(v6_coherent_kern_range) 164ENDPROC(v6_coherent_kern_range)
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S
index a655d3da386d..39e3fb3db801 100644
--- a/arch/arm/mm/cache-v7.S
+++ b/arch/arm/mm/cache-v7.S
@@ -13,6 +13,7 @@
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <asm/assembler.h> 15#include <asm/assembler.h>
16#include <asm/errno.h>
16#include <asm/unwind.h> 17#include <asm/unwind.h>
17 18
18#include "proc-macros.S" 19#include "proc-macros.S"
@@ -198,7 +199,6 @@ ENTRY(v7_coherent_user_range)
198 add r12, r12, r2 199 add r12, r12, r2
199 cmp r12, r1 200 cmp r12, r1
200 blo 2b 201 blo 2b
2013:
202 mov r0, #0 202 mov r0, #0
203 ALT_SMP(mcr p15, 0, r0, c7, c1, 6) @ invalidate BTB Inner Shareable 203 ALT_SMP(mcr p15, 0, r0, c7, c1, 6) @ invalidate BTB Inner Shareable
204 ALT_UP(mcr p15, 0, r0, c7, c5, 6) @ invalidate BTB 204 ALT_UP(mcr p15, 0, r0, c7, c5, 6) @ invalidate BTB
@@ -208,13 +208,11 @@ ENTRY(v7_coherent_user_range)
208 208
209/* 209/*
210 * Fault handling for the cache operation above. If the virtual address in r0 210 * Fault handling for the cache operation above. If the virtual address in r0
211 * isn't mapped, just try the next page. 211 * isn't mapped, fail with -EFAULT.
212 */ 212 */
2139001: 2139001:
214 mov r12, r12, lsr #12 214 mov r0, #-EFAULT
215 mov r12, r12, lsl #12 215 mov pc, lr
216 add r12, r12, #4096
217 b 3b
218 UNWIND(.fnend ) 216 UNWIND(.fnend )
219ENDPROC(v7_coherent_kern_range) 217ENDPROC(v7_coherent_kern_range)
220ENDPROC(v7_coherent_user_range) 218ENDPROC(v7_coherent_user_range)
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
index ee9bb363d606..806cc4f63516 100644
--- a/arch/arm/mm/context.c
+++ b/arch/arm/mm/context.c
@@ -18,30 +18,39 @@
18 18
19static DEFINE_RAW_SPINLOCK(cpu_asid_lock); 19static DEFINE_RAW_SPINLOCK(cpu_asid_lock);
20unsigned int cpu_last_asid = ASID_FIRST_VERSION; 20unsigned int cpu_last_asid = ASID_FIRST_VERSION;
21#ifdef CONFIG_SMP
22DEFINE_PER_CPU(struct mm_struct *, current_mm);
23#endif
24 21
25#ifdef CONFIG_ARM_LPAE 22#ifdef CONFIG_ARM_LPAE
26#define cpu_set_asid(asid) { \ 23void cpu_set_reserved_ttbr0(void)
27 unsigned long ttbl, ttbh; \ 24{
28 asm volatile( \ 25 unsigned long ttbl = __pa(swapper_pg_dir);
29 " mrrc p15, 0, %0, %1, c2 @ read TTBR0\n" \ 26 unsigned long ttbh = 0;
30 " mov %1, %2, lsl #(48 - 32) @ set ASID\n" \ 27
31 " mcrr p15, 0, %0, %1, c2 @ set TTBR0\n" \ 28 /*
32 : "=&r" (ttbl), "=&r" (ttbh) \ 29 * Set TTBR0 to swapper_pg_dir which contains only global entries. The
33 : "r" (asid & ~ASID_MASK)); \ 30 * ASID is set to 0.
31 */
32 asm volatile(
33 " mcrr p15, 0, %0, %1, c2 @ set TTBR0\n"
34 :
35 : "r" (ttbl), "r" (ttbh));
36 isb();
34} 37}
35#else 38#else
36#define cpu_set_asid(asid) \ 39void cpu_set_reserved_ttbr0(void)
37 asm(" mcr p15, 0, %0, c13, c0, 1\n" : : "r" (asid)) 40{
41 u32 ttb;
42 /* Copy TTBR1 into TTBR0 */
43 asm volatile(
44 " mrc p15, 0, %0, c2, c0, 1 @ read TTBR1\n"
45 " mcr p15, 0, %0, c2, c0, 0 @ set TTBR0\n"
46 : "=r" (ttb));
47 isb();
48}
38#endif 49#endif
39 50
40/* 51/*
41 * We fork()ed a process, and we need a new context for the child 52 * We fork()ed a process, and we need a new context for the child
42 * to run in. We reserve version 0 for initial tasks so we will 53 * to run in.
43 * always allocate an ASID. The ASID 0 is reserved for the TTBR
44 * register changing sequence.
45 */ 54 */
46void __init_new_context(struct task_struct *tsk, struct mm_struct *mm) 55void __init_new_context(struct task_struct *tsk, struct mm_struct *mm)
47{ 56{
@@ -51,9 +60,7 @@ void __init_new_context(struct task_struct *tsk, struct mm_struct *mm)
51 60
52static void flush_context(void) 61static void flush_context(void)
53{ 62{
54 /* set the reserved ASID before flushing the TLB */ 63 cpu_set_reserved_ttbr0();
55 cpu_set_asid(0);
56 isb();
57 local_flush_tlb_all(); 64 local_flush_tlb_all();
58 if (icache_is_vivt_asid_tagged()) { 65 if (icache_is_vivt_asid_tagged()) {
59 __flush_icache_all(); 66 __flush_icache_all();
@@ -98,14 +105,7 @@ static void reset_context(void *info)
98{ 105{
99 unsigned int asid; 106 unsigned int asid;
100 unsigned int cpu = smp_processor_id(); 107 unsigned int cpu = smp_processor_id();
101 struct mm_struct *mm = per_cpu(current_mm, cpu); 108 struct mm_struct *mm = current->active_mm;
102
103 /*
104 * Check if a current_mm was set on this CPU as it might still
105 * be in the early booting stages and using the reserved ASID.
106 */
107 if (!mm)
108 return;
109 109
110 smp_rmb(); 110 smp_rmb();
111 asid = cpu_last_asid + cpu + 1; 111 asid = cpu_last_asid + cpu + 1;
@@ -114,8 +114,7 @@ static void reset_context(void *info)
114 set_mm_context(mm, asid); 114 set_mm_context(mm, asid);
115 115
116 /* set the new ASID */ 116 /* set the new ASID */
117 cpu_set_asid(mm->context.id); 117 cpu_switch_mm(mm->pgd, mm);
118 isb();
119} 118}
120 119
121#else 120#else
diff --git a/arch/arm/mm/copypage-v3.c b/arch/arm/mm/copypage-v3.c
deleted file mode 100644
index 3935bddd4769..000000000000
--- a/arch/arm/mm/copypage-v3.c
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * linux/arch/arm/mm/copypage-v3.c
3 *
4 * Copyright (C) 1995-1999 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/init.h>
11#include <linux/highmem.h>
12
13/*
14 * ARMv3 optimised copy_user_highpage
15 *
16 * FIXME: do we need to handle cache stuff...
17 */
18static void __naked
19v3_copy_user_page(void *kto, const void *kfrom)
20{
21 asm("\n\
22 stmfd sp!, {r4, lr} @ 2\n\
23 mov r2, %2 @ 1\n\
24 ldmia %0!, {r3, r4, ip, lr} @ 4+1\n\
251: stmia %1!, {r3, r4, ip, lr} @ 4\n\
26 ldmia %0!, {r3, r4, ip, lr} @ 4+1\n\
27 stmia %1!, {r3, r4, ip, lr} @ 4\n\
28 ldmia %0!, {r3, r4, ip, lr} @ 4+1\n\
29 stmia %1!, {r3, r4, ip, lr} @ 4\n\
30 ldmia %0!, {r3, r4, ip, lr} @ 4\n\
31 subs r2, r2, #1 @ 1\n\
32 stmia %1!, {r3, r4, ip, lr} @ 4\n\
33 ldmneia %0!, {r3, r4, ip, lr} @ 4\n\
34 bne 1b @ 1\n\
35 ldmfd sp!, {r4, pc} @ 3"
36 :
37 : "r" (kfrom), "r" (kto), "I" (PAGE_SIZE / 64));
38}
39
40void v3_copy_user_highpage(struct page *to, struct page *from,
41 unsigned long vaddr, struct vm_area_struct *vma)
42{
43 void *kto, *kfrom;
44
45 kto = kmap_atomic(to);
46 kfrom = kmap_atomic(from);
47 v3_copy_user_page(kto, kfrom);
48 kunmap_atomic(kfrom);
49 kunmap_atomic(kto);
50}
51
52/*
53 * ARMv3 optimised clear_user_page
54 *
55 * FIXME: do we need to handle cache stuff...
56 */
57void v3_clear_user_highpage(struct page *page, unsigned long vaddr)
58{
59 void *ptr, *kaddr = kmap_atomic(page);
60 asm volatile("\n\
61 mov r1, %2 @ 1\n\
62 mov r2, #0 @ 1\n\
63 mov r3, #0 @ 1\n\
64 mov ip, #0 @ 1\n\
65 mov lr, #0 @ 1\n\
661: stmia %0!, {r2, r3, ip, lr} @ 4\n\
67 stmia %0!, {r2, r3, ip, lr} @ 4\n\
68 stmia %0!, {r2, r3, ip, lr} @ 4\n\
69 stmia %0!, {r2, r3, ip, lr} @ 4\n\
70 subs r1, r1, #1 @ 1\n\
71 bne 1b @ 1"
72 : "=r" (ptr)
73 : "0" (kaddr), "I" (PAGE_SIZE / 64)
74 : "r1", "r2", "r3", "ip", "lr");
75 kunmap_atomic(kaddr);
76}
77
78struct cpu_user_fns v3_user_fns __initdata = {
79 .cpu_clear_user_highpage = v3_clear_user_highpage,
80 .cpu_copy_user_highpage = v3_copy_user_highpage,
81};
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index 9055b5a84ec5..c3bd83450227 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -247,7 +247,9 @@ good_area:
247 return handle_mm_fault(mm, vma, addr & PAGE_MASK, flags); 247 return handle_mm_fault(mm, vma, addr & PAGE_MASK, flags);
248 248
249check_stack: 249check_stack:
250 if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr)) 250 /* Don't allow expansion below FIRST_USER_ADDRESS */
251 if (vma->vm_flags & VM_GROWSDOWN &&
252 addr >= FIRST_USER_ADDRESS && !expand_stack(vma, addr))
251 goto good_area; 253 goto good_area;
252out: 254out:
253 return fault; 255 return fault;
@@ -320,7 +322,7 @@ retry:
320 */ 322 */
321 323
322 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr); 324 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr);
323 if (flags & FAULT_FLAG_ALLOW_RETRY) { 325 if (!(fault & VM_FAULT_ERROR) && flags & FAULT_FLAG_ALLOW_RETRY) {
324 if (fault & VM_FAULT_MAJOR) { 326 if (fault & VM_FAULT_MAJOR) {
325 tsk->maj_flt++; 327 tsk->maj_flt++;
326 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 328 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
@@ -430,9 +432,6 @@ do_translation_fault(unsigned long addr, unsigned int fsr,
430 432
431 index = pgd_index(addr); 433 index = pgd_index(addr);
432 434
433 /*
434 * FIXME: CP15 C1 is write only on ARMv3 architectures.
435 */
436 pgd = cpu_get_pgd() + index; 435 pgd = cpu_get_pgd() + index;
437 pgd_k = init_mm.pgd + index; 436 pgd_k = init_mm.pgd + index;
438 437
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 595079fa9d1d..8f5813bbffb5 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -293,11 +293,11 @@ EXPORT_SYMBOL(pfn_valid);
293#endif 293#endif
294 294
295#ifndef CONFIG_SPARSEMEM 295#ifndef CONFIG_SPARSEMEM
296static void arm_memory_present(void) 296static void __init arm_memory_present(void)
297{ 297{
298} 298}
299#else 299#else
300static void arm_memory_present(void) 300static void __init arm_memory_present(void)
301{ 301{
302 struct memblock_region *reg; 302 struct memblock_region *reg;
303 303
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index b86f8933ff91..aa78de8bfdd3 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -489,7 +489,8 @@ static void __init build_mem_type_table(void)
489 */ 489 */
490 for (i = 0; i < ARRAY_SIZE(mem_types); i++) { 490 for (i = 0; i < ARRAY_SIZE(mem_types); i++) {
491 mem_types[i].prot_pte |= PTE_EXT_AF; 491 mem_types[i].prot_pte |= PTE_EXT_AF;
492 mem_types[i].prot_sect |= PMD_SECT_AF; 492 if (mem_types[i].prot_sect)
493 mem_types[i].prot_sect |= PMD_SECT_AF;
493 } 494 }
494 kern_pgprot |= PTE_EXT_AF; 495 kern_pgprot |= PTE_EXT_AF;
495 vecs_pgprot |= PTE_EXT_AF; 496 vecs_pgprot |= PTE_EXT_AF;
@@ -618,8 +619,8 @@ static void __init alloc_init_section(pud_t *pud, unsigned long addr,
618 } 619 }
619} 620}
620 621
621static void alloc_init_pud(pgd_t *pgd, unsigned long addr, unsigned long end, 622static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr,
622 unsigned long phys, const struct mem_type *type) 623 unsigned long end, unsigned long phys, const struct mem_type *type)
623{ 624{
624 pud_t *pud = pud_offset(pgd, addr); 625 pud_t *pud = pud_offset(pgd, addr);
625 unsigned long next; 626 unsigned long next;
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 6486d2f253cd..d51225f90ae2 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -13,6 +13,7 @@
13#include <asm/sections.h> 13#include <asm/sections.h>
14#include <asm/page.h> 14#include <asm/page.h>
15#include <asm/setup.h> 15#include <asm/setup.h>
16#include <asm/traps.h>
16#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
17 18
18#include "mm.h" 19#include "mm.h"
@@ -39,6 +40,7 @@ void __init sanity_check_meminfo(void)
39 */ 40 */
40void __init paging_init(struct machine_desc *mdesc) 41void __init paging_init(struct machine_desc *mdesc)
41{ 42{
43 early_trap_init((void *)CONFIG_VECTORS_BASE);
42 bootmem_init(); 44 bootmem_init();
43} 45}
44 46
diff --git a/arch/arm/mm/proc-arm1020.S b/arch/arm/mm/proc-arm1020.S
index 234951345eb3..0650bb87c1e3 100644
--- a/arch/arm/mm/proc-arm1020.S
+++ b/arch/arm/mm/proc-arm1020.S
@@ -241,6 +241,7 @@ ENTRY(arm1020_coherent_user_range)
241 cmp r0, r1 241 cmp r0, r1
242 blo 1b 242 blo 1b
243 mcr p15, 0, ip, c7, c10, 4 @ drain WB 243 mcr p15, 0, ip, c7, c10, 4 @ drain WB
244 mov r0, #0
244 mov pc, lr 245 mov pc, lr
245 246
246/* 247/*
diff --git a/arch/arm/mm/proc-arm1020e.S b/arch/arm/mm/proc-arm1020e.S
index c244b06caac9..4188478325a6 100644
--- a/arch/arm/mm/proc-arm1020e.S
+++ b/arch/arm/mm/proc-arm1020e.S
@@ -235,6 +235,7 @@ ENTRY(arm1020e_coherent_user_range)
235 cmp r0, r1 235 cmp r0, r1
236 blo 1b 236 blo 1b
237 mcr p15, 0, ip, c7, c10, 4 @ drain WB 237 mcr p15, 0, ip, c7, c10, 4 @ drain WB
238 mov r0, #0
238 mov pc, lr 239 mov pc, lr
239 240
240/* 241/*
diff --git a/arch/arm/mm/proc-arm1022.S b/arch/arm/mm/proc-arm1022.S
index 38fe22efd18f..33c68824bff0 100644
--- a/arch/arm/mm/proc-arm1022.S
+++ b/arch/arm/mm/proc-arm1022.S
@@ -224,6 +224,7 @@ ENTRY(arm1022_coherent_user_range)
224 cmp r0, r1 224 cmp r0, r1
225 blo 1b 225 blo 1b
226 mcr p15, 0, ip, c7, c10, 4 @ drain WB 226 mcr p15, 0, ip, c7, c10, 4 @ drain WB
227 mov r0, #0
227 mov pc, lr 228 mov pc, lr
228 229
229/* 230/*
diff --git a/arch/arm/mm/proc-arm1026.S b/arch/arm/mm/proc-arm1026.S
index 3eb9c3c26c75..fbc1d5fc24dc 100644
--- a/arch/arm/mm/proc-arm1026.S
+++ b/arch/arm/mm/proc-arm1026.S
@@ -218,6 +218,7 @@ ENTRY(arm1026_coherent_user_range)
218 cmp r0, r1 218 cmp r0, r1
219 blo 1b 219 blo 1b
220 mcr p15, 0, ip, c7, c10, 4 @ drain WB 220 mcr p15, 0, ip, c7, c10, 4 @ drain WB
221 mov r0, #0
221 mov pc, lr 222 mov pc, lr
222 223
223/* 224/*
diff --git a/arch/arm/mm/proc-arm6_7.S b/arch/arm/mm/proc-arm6_7.S
deleted file mode 100644
index 4fbeb5b8e6c2..000000000000
--- a/arch/arm/mm/proc-arm6_7.S
+++ /dev/null
@@ -1,327 +0,0 @@
1/*
2 * linux/arch/arm/mm/proc-arm6,7.S
3 *
4 * Copyright (C) 1997-2000 Russell King
5 * hacked for non-paged-MM by Hyok S. Choi, 2003.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * These are the low level assembler for performing cache and TLB
12 * functions on the ARM610 & ARM710.
13 */
14#include <linux/linkage.h>
15#include <linux/init.h>
16#include <asm/assembler.h>
17#include <asm/asm-offsets.h>
18#include <asm/hwcap.h>
19#include <asm/pgtable-hwdef.h>
20#include <asm/pgtable.h>
21#include <asm/ptrace.h>
22
23#include "proc-macros.S"
24
25ENTRY(cpu_arm6_dcache_clean_area)
26ENTRY(cpu_arm7_dcache_clean_area)
27 mov pc, lr
28
29/*
30 * Function: arm6_7_data_abort ()
31 *
32 * Params : r2 = pt_regs
33 * : r4 = aborted context pc
34 * : r5 = aborted context psr
35 *
36 * Purpose : obtain information about current aborted instruction
37 *
38 * Returns : r4-r5, r10-r11, r13 preserved
39 */
40
41ENTRY(cpu_arm7_data_abort)
42 mrc p15, 0, r1, c5, c0, 0 @ get FSR
43 mrc p15, 0, r0, c6, c0, 0 @ get FAR
44 ldr r8, [r4] @ read arm instruction
45 tst r8, #1 << 20 @ L = 0 -> write?
46 orreq r1, r1, #1 << 11 @ yes.
47 and r7, r8, #15 << 24
48 add pc, pc, r7, lsr #22 @ Now branch to the relevant processing routine
49 nop
50
51/* 0 */ b .data_unknown
52/* 1 */ b do_DataAbort @ swp
53/* 2 */ b .data_unknown
54/* 3 */ b .data_unknown
55/* 4 */ b .data_arm_lateldrpostconst @ ldr rd, [rn], #m
56/* 5 */ b .data_arm_lateldrpreconst @ ldr rd, [rn, #m]
57/* 6 */ b .data_arm_lateldrpostreg @ ldr rd, [rn], rm
58/* 7 */ b .data_arm_lateldrprereg @ ldr rd, [rn, rm]
59/* 8 */ b .data_arm_ldmstm @ ldm*a rn, <rlist>
60/* 9 */ b .data_arm_ldmstm @ ldm*b rn, <rlist>
61/* a */ b .data_unknown
62/* b */ b .data_unknown
63/* c */ b do_DataAbort @ ldc rd, [rn], #m @ Same as ldr rd, [rn], #m
64/* d */ b do_DataAbort @ ldc rd, [rn, #m]
65/* e */ b .data_unknown
66/* f */
67.data_unknown: @ Part of jumptable
68 mov r0, r4
69 mov r1, r8
70 b baddataabort
71
72ENTRY(cpu_arm6_data_abort)
73 mrc p15, 0, r1, c5, c0, 0 @ get FSR
74 mrc p15, 0, r0, c6, c0, 0 @ get FAR
75 ldr r8, [r4] @ read arm instruction
76 tst r8, #1 << 20 @ L = 0 -> write?
77 orreq r1, r1, #1 << 11 @ yes.
78 and r7, r8, #14 << 24
79 teq r7, #8 << 24 @ was it ldm/stm
80 bne do_DataAbort
81
82.data_arm_ldmstm:
83 tst r8, #1 << 21 @ check writeback bit
84 beq do_DataAbort @ no writeback -> no fixup
85 mov r7, #0x11
86 orr r7, r7, #0x1100
87 and r6, r8, r7
88 and r9, r8, r7, lsl #1
89 add r6, r6, r9, lsr #1
90 and r9, r8, r7, lsl #2
91 add r6, r6, r9, lsr #2
92 and r9, r8, r7, lsl #3
93 add r6, r6, r9, lsr #3
94 add r6, r6, r6, lsr #8
95 add r6, r6, r6, lsr #4
96 and r6, r6, #15 @ r6 = no. of registers to transfer.
97 and r9, r8, #15 << 16 @ Extract 'n' from instruction
98 ldr r7, [r2, r9, lsr #14] @ Get register 'Rn'
99 tst r8, #1 << 23 @ Check U bit
100 subne r7, r7, r6, lsl #2 @ Undo increment
101 addeq r7, r7, r6, lsl #2 @ Undo decrement
102 str r7, [r2, r9, lsr #14] @ Put register 'Rn'
103 b do_DataAbort
104
105.data_arm_apply_r6_and_rn:
106 and r9, r8, #15 << 16 @ Extract 'n' from instruction
107 ldr r7, [r2, r9, lsr #14] @ Get register 'Rn'
108 tst r8, #1 << 23 @ Check U bit
109 subne r7, r7, r6 @ Undo incrmenet
110 addeq r7, r7, r6 @ Undo decrement
111 str r7, [r2, r9, lsr #14] @ Put register 'Rn'
112 b do_DataAbort
113
114.data_arm_lateldrpreconst:
115 tst r8, #1 << 21 @ check writeback bit
116 beq do_DataAbort @ no writeback -> no fixup
117.data_arm_lateldrpostconst:
118 movs r6, r8, lsl #20 @ Get offset
119 beq do_DataAbort @ zero -> no fixup
120 and r9, r8, #15 << 16 @ Extract 'n' from instruction
121 ldr r7, [r2, r9, lsr #14] @ Get register 'Rn'
122 tst r8, #1 << 23 @ Check U bit
123 subne r7, r7, r6, lsr #20 @ Undo increment
124 addeq r7, r7, r6, lsr #20 @ Undo decrement
125 str r7, [r2, r9, lsr #14] @ Put register 'Rn'
126 b do_DataAbort
127
128.data_arm_lateldrprereg:
129 tst r8, #1 << 21 @ check writeback bit
130 beq do_DataAbort @ no writeback -> no fixup
131.data_arm_lateldrpostreg:
132 and r7, r8, #15 @ Extract 'm' from instruction
133 ldr r6, [r2, r7, lsl #2] @ Get register 'Rm'
134 mov r9, r8, lsr #7 @ get shift count
135 ands r9, r9, #31
136 and r7, r8, #0x70 @ get shift type
137 orreq r7, r7, #8 @ shift count = 0
138 add pc, pc, r7
139 nop
140
141 mov r6, r6, lsl r9 @ 0: LSL #!0
142 b .data_arm_apply_r6_and_rn
143 b .data_arm_apply_r6_and_rn @ 1: LSL #0
144 nop
145 b .data_unknown @ 2: MUL?
146 nop
147 b .data_unknown @ 3: MUL?
148 nop
149 mov r6, r6, lsr r9 @ 4: LSR #!0
150 b .data_arm_apply_r6_and_rn
151 mov r6, r6, lsr #32 @ 5: LSR #32
152 b .data_arm_apply_r6_and_rn
153 b .data_unknown @ 6: MUL?
154 nop
155 b .data_unknown @ 7: MUL?
156 nop
157 mov r6, r6, asr r9 @ 8: ASR #!0
158 b .data_arm_apply_r6_and_rn
159 mov r6, r6, asr #32 @ 9: ASR #32
160 b .data_arm_apply_r6_and_rn
161 b .data_unknown @ A: MUL?
162 nop
163 b .data_unknown @ B: MUL?
164 nop
165 mov r6, r6, ror r9 @ C: ROR #!0
166 b .data_arm_apply_r6_and_rn
167 mov r6, r6, rrx @ D: RRX
168 b .data_arm_apply_r6_and_rn
169 b .data_unknown @ E: MUL?
170 nop
171 b .data_unknown @ F: MUL?
172
173/*
174 * Function: arm6_7_proc_init (void)
175 * : arm6_7_proc_fin (void)
176 *
177 * Notes : This processor does not require these
178 */
179ENTRY(cpu_arm6_proc_init)
180ENTRY(cpu_arm7_proc_init)
181 mov pc, lr
182
183ENTRY(cpu_arm6_proc_fin)
184ENTRY(cpu_arm7_proc_fin)
185 mov r0, #0x31 @ ....S..DP...M
186 mcr p15, 0, r0, c1, c0, 0 @ disable caches
187 mov pc, lr
188
189ENTRY(cpu_arm6_do_idle)
190ENTRY(cpu_arm7_do_idle)
191 mov pc, lr
192
193/*
194 * Function: arm6_7_switch_mm(unsigned long pgd_phys)
195 * Params : pgd_phys Physical address of page table
196 * Purpose : Perform a task switch, saving the old processes state, and restoring
197 * the new.
198 */
199ENTRY(cpu_arm6_switch_mm)
200ENTRY(cpu_arm7_switch_mm)
201#ifdef CONFIG_MMU
202 mov r1, #0
203 mcr p15, 0, r1, c7, c0, 0 @ flush cache
204 mcr p15, 0, r0, c2, c0, 0 @ update page table ptr
205 mcr p15, 0, r1, c5, c0, 0 @ flush TLBs
206#endif
207 mov pc, lr
208
209/*
210 * Function: arm6_7_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext)
211 * Params : r0 = Address to set
212 * : r1 = value to set
213 * Purpose : Set a PTE and flush it out of any WB cache
214 */
215 .align 5
216ENTRY(cpu_arm6_set_pte_ext)
217ENTRY(cpu_arm7_set_pte_ext)
218#ifdef CONFIG_MMU
219 armv3_set_pte_ext wc_disable=0
220#endif /* CONFIG_MMU */
221 mov pc, lr
222
223/*
224 * Function: _arm6_7_reset
225 * Params : r0 = address to jump to
226 * Notes : This sets up everything for a reset
227 */
228 .pushsection .idmap.text, "ax"
229ENTRY(cpu_arm6_reset)
230ENTRY(cpu_arm7_reset)
231 mov r1, #0
232 mcr p15, 0, r1, c7, c0, 0 @ flush cache
233#ifdef CONFIG_MMU
234 mcr p15, 0, r1, c5, c0, 0 @ flush TLB
235#endif
236 mov r1, #0x30
237 mcr p15, 0, r1, c1, c0, 0 @ turn off MMU etc
238 mov pc, r0
239ENDPROC(cpu_arm6_reset)
240ENDPROC(cpu_arm7_reset)
241 .popsection
242
243 __CPUINIT
244
245 .type __arm6_setup, #function
246__arm6_setup: mov r0, #0
247 mcr p15, 0, r0, c7, c0 @ flush caches on v3
248#ifdef CONFIG_MMU
249 mcr p15, 0, r0, c5, c0 @ flush TLBs on v3
250 mov r0, #0x3d @ . ..RS BLDP WCAM
251 orr r0, r0, #0x100 @ . ..01 0011 1101
252#else
253 mov r0, #0x3c @ . ..RS BLDP WCA.
254#endif
255 mov pc, lr
256 .size __arm6_setup, . - __arm6_setup
257
258 .type __arm7_setup, #function
259__arm7_setup: mov r0, #0
260 mcr p15, 0, r0, c7, c0 @ flush caches on v3
261#ifdef CONFIG_MMU
262 mcr p15, 0, r0, c5, c0 @ flush TLBs on v3
263 mcr p15, 0, r0, c3, c0 @ load domain access register
264 mov r0, #0x7d @ . ..RS BLDP WCAM
265 orr r0, r0, #0x100 @ . ..01 0111 1101
266#else
267 mov r0, #0x7c @ . ..RS BLDP WCA.
268#endif
269 mov pc, lr
270 .size __arm7_setup, . - __arm7_setup
271
272 __INITDATA
273
274 @ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
275 define_processor_functions arm6, dabort=cpu_arm6_data_abort, pabort=legacy_pabort
276 define_processor_functions arm7, dabort=cpu_arm7_data_abort, pabort=legacy_pabort
277
278 .section ".rodata"
279
280 string cpu_arch_name, "armv3"
281 string cpu_elf_name, "v3"
282 string cpu_arm6_name, "ARM6"
283 string cpu_arm610_name, "ARM610"
284 string cpu_arm7_name, "ARM7"
285 string cpu_arm710_name, "ARM710"
286
287 .align
288
289 .section ".proc.info.init", #alloc, #execinstr
290
291.macro arm67_proc_info name:req, cpu_val:req, cpu_mask:req, cpu_name:req, \
292 cpu_mm_mmu_flags:req, cpu_flush:req, cpu_proc_funcs:req
293 .type __\name\()_proc_info, #object
294__\name\()_proc_info:
295 .long \cpu_val
296 .long \cpu_mask
297 .long \cpu_mm_mmu_flags
298 .long PMD_TYPE_SECT | \
299 PMD_BIT4 | \
300 PMD_SECT_AP_WRITE | \
301 PMD_SECT_AP_READ
302 b \cpu_flush
303 .long cpu_arch_name
304 .long cpu_elf_name
305 .long HWCAP_SWP | HWCAP_26BIT
306 .long \cpu_name
307 .long \cpu_proc_funcs
308 .long v3_tlb_fns
309 .long v3_user_fns
310 .long v3_cache_fns
311 .size __\name\()_proc_info, . - __\name\()_proc_info
312.endm
313
314 arm67_proc_info arm6, 0x41560600, 0xfffffff0, cpu_arm6_name, \
315 0x00000c1e, __arm6_setup, arm6_processor_functions
316 arm67_proc_info arm610, 0x41560610, 0xfffffff0, cpu_arm610_name, \
317 0x00000c1e, __arm6_setup, arm6_processor_functions
318 arm67_proc_info arm7, 0x41007000, 0xffffff00, cpu_arm7_name, \
319 0x00000c1e, __arm7_setup, arm7_processor_functions
320 arm67_proc_info arm710, 0x41007100, 0xfff8ff00, cpu_arm710_name, \
321 PMD_TYPE_SECT | \
322 PMD_SECT_BUFFERABLE | \
323 PMD_SECT_CACHEABLE | \
324 PMD_BIT4 | \
325 PMD_SECT_AP_WRITE | \
326 PMD_SECT_AP_READ, \
327 __arm7_setup, arm7_processor_functions
diff --git a/arch/arm/mm/proc-arm920.S b/arch/arm/mm/proc-arm920.S
index cb941ae95f66..1a8c138eb897 100644
--- a/arch/arm/mm/proc-arm920.S
+++ b/arch/arm/mm/proc-arm920.S
@@ -210,6 +210,7 @@ ENTRY(arm920_coherent_user_range)
210 cmp r0, r1 210 cmp r0, r1
211 blo 1b 211 blo 1b
212 mcr p15, 0, r0, c7, c10, 4 @ drain WB 212 mcr p15, 0, r0, c7, c10, 4 @ drain WB
213 mov r0, #0
213 mov pc, lr 214 mov pc, lr
214 215
215/* 216/*
diff --git a/arch/arm/mm/proc-arm922.S b/arch/arm/mm/proc-arm922.S
index 4ec0e074dd55..4c44d7e1c3ca 100644
--- a/arch/arm/mm/proc-arm922.S
+++ b/arch/arm/mm/proc-arm922.S
@@ -212,6 +212,7 @@ ENTRY(arm922_coherent_user_range)
212 cmp r0, r1 212 cmp r0, r1
213 blo 1b 213 blo 1b
214 mcr p15, 0, r0, c7, c10, 4 @ drain WB 214 mcr p15, 0, r0, c7, c10, 4 @ drain WB
215 mov r0, #0
215 mov pc, lr 216 mov pc, lr
216 217
217/* 218/*
diff --git a/arch/arm/mm/proc-arm925.S b/arch/arm/mm/proc-arm925.S
index 9dccd9a365b3..ec5b1180994f 100644
--- a/arch/arm/mm/proc-arm925.S
+++ b/arch/arm/mm/proc-arm925.S
@@ -258,6 +258,7 @@ ENTRY(arm925_coherent_user_range)
258 cmp r0, r1 258 cmp r0, r1
259 blo 1b 259 blo 1b
260 mcr p15, 0, r0, c7, c10, 4 @ drain WB 260 mcr p15, 0, r0, c7, c10, 4 @ drain WB
261 mov r0, #0
261 mov pc, lr 262 mov pc, lr
262 263
263/* 264/*
diff --git a/arch/arm/mm/proc-arm926.S b/arch/arm/mm/proc-arm926.S
index 820259b81a1f..c31e62c606c0 100644
--- a/arch/arm/mm/proc-arm926.S
+++ b/arch/arm/mm/proc-arm926.S
@@ -221,6 +221,7 @@ ENTRY(arm926_coherent_user_range)
221 cmp r0, r1 221 cmp r0, r1
222 blo 1b 222 blo 1b
223 mcr p15, 0, r0, c7, c10, 4 @ drain WB 223 mcr p15, 0, r0, c7, c10, 4 @ drain WB
224 mov r0, #0
224 mov pc, lr 225 mov pc, lr
225 226
226/* 227/*
diff --git a/arch/arm/mm/proc-arm940.S b/arch/arm/mm/proc-arm940.S
index 9fdc0a170974..a613a7dd7146 100644
--- a/arch/arm/mm/proc-arm940.S
+++ b/arch/arm/mm/proc-arm940.S
@@ -160,7 +160,7 @@ ENTRY(arm940_coherent_user_range)
160 * - size - region size 160 * - size - region size
161 */ 161 */
162ENTRY(arm940_flush_kern_dcache_area) 162ENTRY(arm940_flush_kern_dcache_area)
163 mov ip, #0 163 mov r0, #0
164 mov r1, #(CACHE_DSEGMENTS - 1) << 4 @ 4 segments 164 mov r1, #(CACHE_DSEGMENTS - 1) << 4 @ 4 segments
1651: orr r3, r1, #(CACHE_DENTRIES - 1) << 26 @ 64 entries 1651: orr r3, r1, #(CACHE_DENTRIES - 1) << 26 @ 64 entries
1662: mcr p15, 0, r3, c7, c14, 2 @ clean/flush D index 1662: mcr p15, 0, r3, c7, c14, 2 @ clean/flush D index
@@ -168,8 +168,8 @@ ENTRY(arm940_flush_kern_dcache_area)
168 bcs 2b @ entries 63 to 0 168 bcs 2b @ entries 63 to 0
169 subs r1, r1, #1 << 4 169 subs r1, r1, #1 << 4
170 bcs 1b @ segments 7 to 0 170 bcs 1b @ segments 7 to 0
171 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache 171 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
172 mcr p15, 0, ip, c7, c10, 4 @ drain WB 172 mcr p15, 0, r0, c7, c10, 4 @ drain WB
173 mov pc, lr 173 mov pc, lr
174 174
175/* 175/*
diff --git a/arch/arm/mm/proc-arm946.S b/arch/arm/mm/proc-arm946.S
index f684cfedcca9..9f4f2999fdd0 100644
--- a/arch/arm/mm/proc-arm946.S
+++ b/arch/arm/mm/proc-arm946.S
@@ -190,6 +190,7 @@ ENTRY(arm946_coherent_user_range)
190 cmp r0, r1 190 cmp r0, r1
191 blo 1b 191 blo 1b
192 mcr p15, 0, r0, c7, c10, 4 @ drain WB 192 mcr p15, 0, r0, c7, c10, 4 @ drain WB
193 mov r0, #0
193 mov pc, lr 194 mov pc, lr
194 195
195/* 196/*
diff --git a/arch/arm/mm/proc-feroceon.S b/arch/arm/mm/proc-feroceon.S
index ba3c500584ac..23a8e4c7f2bd 100644
--- a/arch/arm/mm/proc-feroceon.S
+++ b/arch/arm/mm/proc-feroceon.S
@@ -232,6 +232,7 @@ ENTRY(feroceon_coherent_user_range)
232 cmp r0, r1 232 cmp r0, r1
233 blo 1b 233 blo 1b
234 mcr p15, 0, r0, c7, c10, 4 @ drain WB 234 mcr p15, 0, r0, c7, c10, 4 @ drain WB
235 mov r0, #0
235 mov pc, lr 236 mov pc, lr
236 237
237/* 238/*
diff --git a/arch/arm/mm/proc-mohawk.S b/arch/arm/mm/proc-mohawk.S
index cdfedc5b8ad8..fbb2124a547d 100644
--- a/arch/arm/mm/proc-mohawk.S
+++ b/arch/arm/mm/proc-mohawk.S
@@ -193,6 +193,7 @@ ENTRY(mohawk_coherent_user_range)
193 cmp r0, r1 193 cmp r0, r1
194 blo 1b 194 blo 1b
195 mcr p15, 0, r0, c7, c10, 4 @ drain WB 195 mcr p15, 0, r0, c7, c10, 4 @ drain WB
196 mov r0, #0
196 mov pc, lr 197 mov pc, lr
197 198
198/* 199/*
@@ -344,6 +345,41 @@ ENTRY(cpu_mohawk_set_pte_ext)
344 mcr p15, 0, r0, c7, c10, 4 @ drain WB 345 mcr p15, 0, r0, c7, c10, 4 @ drain WB
345 mov pc, lr 346 mov pc, lr
346 347
348.globl cpu_mohawk_suspend_size
349.equ cpu_mohawk_suspend_size, 4 * 6
350#ifdef CONFIG_PM_SLEEP
351ENTRY(cpu_mohawk_do_suspend)
352 stmfd sp!, {r4 - r9, lr}
353 mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode
354 mrc p15, 0, r5, c15, c1, 0 @ CP access reg
355 mrc p15, 0, r6, c13, c0, 0 @ PID
356 mrc p15, 0, r7, c3, c0, 0 @ domain ID
357 mrc p15, 0, r8, c1, c0, 1 @ auxiliary control reg
358 mrc p15, 0, r9, c1, c0, 0 @ control reg
359 bic r4, r4, #2 @ clear frequency change bit
360 stmia r0, {r4 - r9} @ store cp regs
361 ldmia sp!, {r4 - r9, pc}
362ENDPROC(cpu_mohawk_do_suspend)
363
364ENTRY(cpu_mohawk_do_resume)
365 ldmia r0, {r4 - r9} @ load cp regs
366 mov ip, #0
367 mcr p15, 0, ip, c7, c7, 0 @ invalidate I & D caches, BTB
368 mcr p15, 0, ip, c7, c10, 4 @ drain write (&fill) buffer
369 mcr p15, 0, ip, c7, c5, 4 @ flush prefetch buffer
370 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
371 mcr p14, 0, r4, c6, c0, 0 @ clock configuration, turbo mode.
372 mcr p15, 0, r5, c15, c1, 0 @ CP access reg
373 mcr p15, 0, r6, c13, c0, 0 @ PID
374 mcr p15, 0, r7, c3, c0, 0 @ domain ID
375 orr r1, r1, #0x18 @ cache the page table in L2
376 mcr p15, 0, r1, c2, c0, 0 @ translation table base addr
377 mcr p15, 0, r8, c1, c0, 1 @ auxiliary control reg
378 mov r0, r9 @ control register
379 b cpu_resume_mmu
380ENDPROC(cpu_mohawk_do_resume)
381#endif
382
347 __CPUINIT 383 __CPUINIT
348 384
349 .type __mohawk_setup, #function 385 .type __mohawk_setup, #function
diff --git a/arch/arm/mm/proc-v7-2level.S b/arch/arm/mm/proc-v7-2level.S
index 3a4b3e7b888c..42ac069c8012 100644
--- a/arch/arm/mm/proc-v7-2level.S
+++ b/arch/arm/mm/proc-v7-2level.S
@@ -49,15 +49,10 @@ ENTRY(cpu_v7_switch_mm)
49#ifdef CONFIG_ARM_ERRATA_754322 49#ifdef CONFIG_ARM_ERRATA_754322
50 dsb 50 dsb
51#endif 51#endif
52 mcr p15, 0, r2, c13, c0, 1 @ set reserved context ID
53 isb
541: mcr p15, 0, r0, c2, c0, 0 @ set TTB 0
55 isb
56#ifdef CONFIG_ARM_ERRATA_754322
57 dsb
58#endif
59 mcr p15, 0, r1, c13, c0, 1 @ set context ID 52 mcr p15, 0, r1, c13, c0, 1 @ set context ID
60 isb 53 isb
54 mcr p15, 0, r0, c2, c0, 0 @ set TTB 0
55 isb
61#endif 56#endif
62 mov pc, lr 57 mov pc, lr
63ENDPROC(cpu_v7_switch_mm) 58ENDPROC(cpu_v7_switch_mm)
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index f1c8486f7501..c2e2b66f72b5 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -255,6 +255,18 @@ __v7_setup:
255 mcr p15, 0, r5, c10, c2, 0 @ write PRRR 255 mcr p15, 0, r5, c10, c2, 0 @ write PRRR
256 mcr p15, 0, r6, c10, c2, 1 @ write NMRR 256 mcr p15, 0, r6, c10, c2, 1 @ write NMRR
257#endif 257#endif
258#ifndef CONFIG_ARM_THUMBEE
259 mrc p15, 0, r0, c0, c1, 0 @ read ID_PFR0 for ThumbEE
260 and r0, r0, #(0xf << 12) @ ThumbEE enabled field
261 teq r0, #(1 << 12) @ check if ThumbEE is present
262 bne 1f
263 mov r5, #0
264 mcr p14, 6, r5, c1, c0, 0 @ Initialize TEEHBR to 0
265 mrc p14, 6, r0, c0, c0, 0 @ load TEECR
266 orr r0, r0, #1 @ set the 1st bit in order to
267 mcr p14, 6, r0, c0, c0, 0 @ stop userspace TEEHBR access
2681:
269#endif
258 adr r5, v7_crval 270 adr r5, v7_crval
259 ldmia r5, {r5, r6} 271 ldmia r5, {r5, r6}
260#ifdef CONFIG_CPU_ENDIAN_BE8 272#ifdef CONFIG_CPU_ENDIAN_BE8
diff --git a/arch/arm/mm/tlb-v3.S b/arch/arm/mm/tlb-v3.S
deleted file mode 100644
index d253995ec4ca..000000000000
--- a/arch/arm/mm/tlb-v3.S
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * linux/arch/arm/mm/tlbv3.S
3 *
4 * Copyright (C) 1997-2002 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ARM architecture version 3 TLB handling functions.
11 *
12 * Processors: ARM610, ARM710.
13 */
14#include <linux/linkage.h>
15#include <linux/init.h>
16#include <asm/asm-offsets.h>
17#include <asm/tlbflush.h>
18#include "proc-macros.S"
19
20 .align 5
21/*
22 * v3_flush_user_tlb_range(start, end, mm)
23 *
24 * Invalidate a range of TLB entries in the specified address space.
25 *
26 * - start - range start address
27 * - end - range end address
28 * - mm - mm_struct describing address space
29 */
30 .align 5
31ENTRY(v3_flush_user_tlb_range)
32 vma_vm_mm r2, r2
33 act_mm r3 @ get current->active_mm
34 teq r2, r3 @ == mm ?
35 movne pc, lr @ no, we dont do anything
36ENTRY(v3_flush_kern_tlb_range)
37 bic r0, r0, #0x0ff
38 bic r0, r0, #0xf00
391: mcr p15, 0, r0, c6, c0, 0 @ invalidate TLB entry
40 add r0, r0, #PAGE_SZ
41 cmp r0, r1
42 blo 1b
43 mov pc, lr
44
45 __INITDATA
46
47 /* define struct cpu_tlb_fns (see <asm/tlbflush.h> and proc-macros.S) */
48 define_tlb_functions v3, v3_tlb_flags
diff --git a/arch/arm/plat-iop/pci.c b/arch/arm/plat-iop/pci.c
index 0da42058a20f..8daae9b230ea 100644
--- a/arch/arm/plat-iop/pci.c
+++ b/arch/arm/plat-iop/pci.c
@@ -160,7 +160,7 @@ iop3xx_write_config(struct pci_bus *bus, unsigned int devfn, int where,
160 return PCIBIOS_SUCCESSFUL; 160 return PCIBIOS_SUCCESSFUL;
161} 161}
162 162
163static struct pci_ops iop3xx_ops = { 163struct pci_ops iop3xx_ops = {
164 .read = iop3xx_read_config, 164 .read = iop3xx_read_config,
165 .write = iop3xx_write_config, 165 .write = iop3xx_write_config,
166}; 166};
@@ -220,12 +220,6 @@ int iop3xx_pci_setup(int nr, struct pci_sys_data *sys)
220 return 1; 220 return 1;
221} 221}
222 222
223struct pci_bus *iop3xx_pci_scan_bus(int nr, struct pci_sys_data *sys)
224{
225 return pci_scan_root_bus(NULL, sys->busnr, &iop3xx_ops, sys,
226 &sys->resources);
227}
228
229void __init iop3xx_atu_setup(void) 223void __init iop3xx_atu_setup(void)
230{ 224{
231 /* BAR 0 ( Disabled ) */ 225 /* BAR 0 ( Disabled ) */
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx51.h b/arch/arm/plat-mxc/include/mach/iomux-mx51.h
index c7f5169a6a54..36c8989d9de6 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx51.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx51.h
@@ -256,13 +256,13 @@
256#define MX51_PAD_NANDF_RB1__GPIO3_9 IOMUX_PAD(0x4fc, 0x120, 3, __NA_, 0, MX51_GPIO_PAD_CTRL) 256#define MX51_PAD_NANDF_RB1__GPIO3_9 IOMUX_PAD(0x4fc, 0x120, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
257#define MX51_PAD_NANDF_RB1__NANDF_RB1 IOMUX_PAD(0x4fc, 0x120, 0, __NA_, 0, NO_PAD_CTRL) 257#define MX51_PAD_NANDF_RB1__NANDF_RB1 IOMUX_PAD(0x4fc, 0x120, 0, __NA_, 0, NO_PAD_CTRL)
258#define MX51_PAD_NANDF_RB1__PATA_IORDY IOMUX_PAD(0x4fc, 0x120, 1, __NA_, 0, NO_PAD_CTRL) 258#define MX51_PAD_NANDF_RB1__PATA_IORDY IOMUX_PAD(0x4fc, 0x120, 1, __NA_, 0, NO_PAD_CTRL)
259#define MX51_PAD_NANDF_RB1__SD4_CMD IOMUX_PAD(0x4fc, 0x120, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL) 259#define MX51_PAD_NANDF_RB1__SD4_CMD IOMUX_PAD(0x4fc, 0x120, 0x15, __NA_, 0, MX51_SDHCI_PAD_CTRL)
260#define MX51_PAD_NANDF_RB2__DISP2_WAIT IOMUX_PAD(0x500, 0x124, 5, 0x9a8, 0, NO_PAD_CTRL) 260#define MX51_PAD_NANDF_RB2__DISP2_WAIT IOMUX_PAD(0x500, 0x124, 5, 0x9a8, 0, NO_PAD_CTRL)
261#define MX51_PAD_NANDF_RB2__ECSPI2_SCLK IOMUX_PAD(0x500, 0x124, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL) 261#define MX51_PAD_NANDF_RB2__ECSPI2_SCLK IOMUX_PAD(0x500, 0x124, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL)
262#define MX51_PAD_NANDF_RB2__FEC_COL IOMUX_PAD(0x500, 0x124, 1, 0x94c, 0, MX51_PAD_CTRL_2) 262#define MX51_PAD_NANDF_RB2__FEC_COL IOMUX_PAD(0x500, 0x124, 1, 0x94c, 0, MX51_PAD_CTRL_2)
263#define MX51_PAD_NANDF_RB2__GPIO3_10 IOMUX_PAD(0x500, 0x124, 3, __NA_, 0, MX51_GPIO_PAD_CTRL) 263#define MX51_PAD_NANDF_RB2__GPIO3_10 IOMUX_PAD(0x500, 0x124, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
264#define MX51_PAD_NANDF_RB2__NANDF_RB2 IOMUX_PAD(0x500, 0x124, 0, __NA_, 0, NO_PAD_CTRL) 264#define MX51_PAD_NANDF_RB2__NANDF_RB2 IOMUX_PAD(0x500, 0x124, 0, __NA_, 0, NO_PAD_CTRL)
265#define MX51_PAD_NANDF_RB2__USBH3_H3_DP IOMUX_PAD(0x500, 0x124, 7, __NA_, 0, NO_PAD_CTRL) 265#define MX51_PAD_NANDF_RB2__USBH3_H3_DP IOMUX_PAD(0x500, 0x124, 0x17, __NA_, 0, NO_PAD_CTRL)
266#define MX51_PAD_NANDF_RB2__USBH3_NXT IOMUX_PAD(0x500, 0x124, 6, 0xa20, 0, NO_PAD_CTRL) 266#define MX51_PAD_NANDF_RB2__USBH3_NXT IOMUX_PAD(0x500, 0x124, 6, 0xa20, 0, NO_PAD_CTRL)
267#define MX51_PAD_NANDF_RB3__DISP1_WAIT IOMUX_PAD(0x504, 0x128, 5, __NA_, 0, NO_PAD_CTRL) 267#define MX51_PAD_NANDF_RB3__DISP1_WAIT IOMUX_PAD(0x504, 0x128, 5, __NA_, 0, NO_PAD_CTRL)
268#define MX51_PAD_NANDF_RB3__ECSPI2_MISO IOMUX_PAD(0x504, 0x128, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL) 268#define MX51_PAD_NANDF_RB3__ECSPI2_MISO IOMUX_PAD(0x504, 0x128, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL)
@@ -270,7 +270,7 @@
270#define MX51_PAD_NANDF_RB3__GPIO3_11 IOMUX_PAD(0x504, 0x128, 3, __NA_, 0, MX51_GPIO_PAD_CTRL) 270#define MX51_PAD_NANDF_RB3__GPIO3_11 IOMUX_PAD(0x504, 0x128, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
271#define MX51_PAD_NANDF_RB3__NANDF_RB3 IOMUX_PAD(0x504, 0x128, 0, __NA_, 0, NO_PAD_CTRL) 271#define MX51_PAD_NANDF_RB3__NANDF_RB3 IOMUX_PAD(0x504, 0x128, 0, __NA_, 0, NO_PAD_CTRL)
272#define MX51_PAD_NANDF_RB3__USBH3_CLK IOMUX_PAD(0x504, 0x128, 6, 0x9f8, 0, NO_PAD_CTRL) 272#define MX51_PAD_NANDF_RB3__USBH3_CLK IOMUX_PAD(0x504, 0x128, 6, 0x9f8, 0, NO_PAD_CTRL)
273#define MX51_PAD_NANDF_RB3__USBH3_H3_DM IOMUX_PAD(0x504, 0x128, 7, __NA_, 0, NO_PAD_CTRL) 273#define MX51_PAD_NANDF_RB3__USBH3_H3_DM IOMUX_PAD(0x504, 0x128, 0x17, __NA_, 0, NO_PAD_CTRL)
274#define MX51_PAD_GPIO_NAND__GPIO_NAND IOMUX_PAD(0x514, 0x12c, 0, 0x998, 0, MX51_GPIO_PAD_CTRL) 274#define MX51_PAD_GPIO_NAND__GPIO_NAND IOMUX_PAD(0x514, 0x12c, 0, 0x998, 0, MX51_GPIO_PAD_CTRL)
275#define MX51_PAD_GPIO_NAND__PATA_INTRQ IOMUX_PAD(0x514, 0x12c, 1, __NA_, 0, NO_PAD_CTRL) 275#define MX51_PAD_GPIO_NAND__PATA_INTRQ IOMUX_PAD(0x514, 0x12c, 1, __NA_, 0, NO_PAD_CTRL)
276#define MX51_PAD_NANDF_CS0__GPIO3_16 IOMUX_PAD(0x518, 0x130, 3, __NA_, 0, MX51_GPIO_PAD_CTRL) 276#define MX51_PAD_NANDF_CS0__GPIO3_16 IOMUX_PAD(0x518, 0x130, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
@@ -283,13 +283,13 @@
283#define MX51_PAD_NANDF_CS2__NANDF_CS2 IOMUX_PAD(0x520, 0x138, 0, __NA_, 0, NO_PAD_CTRL) 283#define MX51_PAD_NANDF_CS2__NANDF_CS2 IOMUX_PAD(0x520, 0x138, 0, __NA_, 0, NO_PAD_CTRL)
284#define MX51_PAD_NANDF_CS2__PATA_CS_0 IOMUX_PAD(0x520, 0x138, 1, __NA_, 0, NO_PAD_CTRL) 284#define MX51_PAD_NANDF_CS2__PATA_CS_0 IOMUX_PAD(0x520, 0x138, 1, __NA_, 0, NO_PAD_CTRL)
285#define MX51_PAD_NANDF_CS2__SD4_CLK IOMUX_PAD(0x520, 0x138, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS) 285#define MX51_PAD_NANDF_CS2__SD4_CLK IOMUX_PAD(0x520, 0x138, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL | PAD_CTL_HYS)
286#define MX51_PAD_NANDF_CS2__USBH3_H1_DP IOMUX_PAD(0x520, 0x138, 7, __NA_, 0, NO_PAD_CTRL) 286#define MX51_PAD_NANDF_CS2__USBH3_H1_DP IOMUX_PAD(0x520, 0x138, 0x17, __NA_, 0, NO_PAD_CTRL)
287#define MX51_PAD_NANDF_CS3__FEC_MDC IOMUX_PAD(0x524, 0x13c, 2, __NA_, 0, MX51_PAD_CTRL_5) 287#define MX51_PAD_NANDF_CS3__FEC_MDC IOMUX_PAD(0x524, 0x13c, 2, __NA_, 0, MX51_PAD_CTRL_5)
288#define MX51_PAD_NANDF_CS3__GPIO3_19 IOMUX_PAD(0x524, 0x13c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL) 288#define MX51_PAD_NANDF_CS3__GPIO3_19 IOMUX_PAD(0x524, 0x13c, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
289#define MX51_PAD_NANDF_CS3__NANDF_CS3 IOMUX_PAD(0x524, 0x13c, 0, __NA_, 0, NO_PAD_CTRL) 289#define MX51_PAD_NANDF_CS3__NANDF_CS3 IOMUX_PAD(0x524, 0x13c, 0, __NA_, 0, NO_PAD_CTRL)
290#define MX51_PAD_NANDF_CS3__PATA_CS_1 IOMUX_PAD(0x524, 0x13c, 1, __NA_, 0, NO_PAD_CTRL) 290#define MX51_PAD_NANDF_CS3__PATA_CS_1 IOMUX_PAD(0x524, 0x13c, 1, __NA_, 0, NO_PAD_CTRL)
291#define MX51_PAD_NANDF_CS3__SD4_DAT0 IOMUX_PAD(0x524, 0x13c, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL) 291#define MX51_PAD_NANDF_CS3__SD4_DAT0 IOMUX_PAD(0x524, 0x13c, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL)
292#define MX51_PAD_NANDF_CS3__USBH3_H1_DM IOMUX_PAD(0x524, 0x13c, 7, __NA_, 0, NO_PAD_CTRL) 292#define MX51_PAD_NANDF_CS3__USBH3_H1_DM IOMUX_PAD(0x524, 0x13c, 0x17, __NA_, 0, NO_PAD_CTRL)
293#define MX51_PAD_NANDF_CS4__FEC_TDATA1 IOMUX_PAD(0x528, 0x140, 2, __NA_, 0, MX51_PAD_CTRL_5) 293#define MX51_PAD_NANDF_CS4__FEC_TDATA1 IOMUX_PAD(0x528, 0x140, 2, __NA_, 0, MX51_PAD_CTRL_5)
294#define MX51_PAD_NANDF_CS4__GPIO3_20 IOMUX_PAD(0x528, 0x140, 3, __NA_, 0, MX51_GPIO_PAD_CTRL) 294#define MX51_PAD_NANDF_CS4__GPIO3_20 IOMUX_PAD(0x528, 0x140, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
295#define MX51_PAD_NANDF_CS4__NANDF_CS4 IOMUX_PAD(0x528, 0x140, 0, __NA_, 0, NO_PAD_CTRL) 295#define MX51_PAD_NANDF_CS4__NANDF_CS4 IOMUX_PAD(0x528, 0x140, 0, __NA_, 0, NO_PAD_CTRL)
@@ -316,7 +316,7 @@
316#define MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK IOMUX_PAD(0x538, 0x150, 1, 0x974, 0, MX51_PAD_CTRL_4) 316#define MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK IOMUX_PAD(0x538, 0x150, 1, 0x974, 0, MX51_PAD_CTRL_4)
317#define MX51_PAD_NANDF_RDY_INT__GPIO3_24 IOMUX_PAD(0x538, 0x150, 3, __NA_, 0, MX51_GPIO_PAD_CTRL) 317#define MX51_PAD_NANDF_RDY_INT__GPIO3_24 IOMUX_PAD(0x538, 0x150, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
318#define MX51_PAD_NANDF_RDY_INT__NANDF_RDY_INT IOMUX_PAD(0x538, 0x150, 0, 0x938, 0, NO_PAD_CTRL) 318#define MX51_PAD_NANDF_RDY_INT__NANDF_RDY_INT IOMUX_PAD(0x538, 0x150, 0, 0x938, 0, NO_PAD_CTRL)
319#define MX51_PAD_NANDF_RDY_INT__SD3_CMD IOMUX_PAD(0x538, 0x150, 5, __NA_, 0, MX51_SDHCI_PAD_CTRL) 319#define MX51_PAD_NANDF_RDY_INT__SD3_CMD IOMUX_PAD(0x538, 0x150, 0x15, __NA_, 0, MX51_SDHCI_PAD_CTRL)
320#define MX51_PAD_NANDF_D15__ECSPI2_MOSI IOMUX_PAD(0x53c, 0x154, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL) 320#define MX51_PAD_NANDF_D15__ECSPI2_MOSI IOMUX_PAD(0x53c, 0x154, 2, __NA_, 0, MX51_ECSPI_PAD_CTRL)
321#define MX51_PAD_NANDF_D15__GPIO3_25 IOMUX_PAD(0x53c, 0x154, 3, __NA_, 0, MX51_GPIO_PAD_CTRL) 321#define MX51_PAD_NANDF_D15__GPIO3_25 IOMUX_PAD(0x53c, 0x154, 3, __NA_, 0, MX51_GPIO_PAD_CTRL)
322#define MX51_PAD_NANDF_D15__NANDF_D15 IOMUX_PAD(0x53c, 0x154, 0, __NA_, 0, NO_PAD_CTRL) 322#define MX51_PAD_NANDF_D15__NANDF_D15 IOMUX_PAD(0x53c, 0x154, 0, __NA_, 0, NO_PAD_CTRL)
@@ -672,23 +672,23 @@
672#define MX51_PAD_DISP2_DAT5__DISP2_DAT5 IOMUX_PAD(0x770, 0x368, 0, __NA_, 0, NO_PAD_CTRL) 672#define MX51_PAD_DISP2_DAT5__DISP2_DAT5 IOMUX_PAD(0x770, 0x368, 0, __NA_, 0, NO_PAD_CTRL)
673#define MX51_PAD_DISP2_DAT6__DISP2_DAT6 IOMUX_PAD(0x774, 0x36c, 0, __NA_, 0, NO_PAD_CTRL) 673#define MX51_PAD_DISP2_DAT6__DISP2_DAT6 IOMUX_PAD(0x774, 0x36c, 0, __NA_, 0, NO_PAD_CTRL)
674#define MX51_PAD_DISP2_DAT6__FEC_TDATA1 IOMUX_PAD(0x774, 0x36c, 2, __NA_, 0, MX51_PAD_CTRL_5) 674#define MX51_PAD_DISP2_DAT6__FEC_TDATA1 IOMUX_PAD(0x774, 0x36c, 2, __NA_, 0, MX51_PAD_CTRL_5)
675#define MX51_PAD_DISP2_DAT6__GPIO1_19 IOMUX_PAD(0x774, 0x36c, 5, __NA_, 0, NO_PAD_CTRL) 675#define MX51_PAD_DISP2_DAT6__GPIO1_19 IOMUX_PAD(0x774, 0x36c, 5, __NA_, 0, MX51_GPIO_PAD_CTRL)
676#define MX51_PAD_DISP2_DAT6__KEY_ROW4 IOMUX_PAD(0x774, 0x36c, 4, 0x9d0, 1, NO_PAD_CTRL) 676#define MX51_PAD_DISP2_DAT6__KEY_ROW4 IOMUX_PAD(0x774, 0x36c, 4, 0x9d0, 1, NO_PAD_CTRL)
677#define MX51_PAD_DISP2_DAT6__USBH3_STP IOMUX_PAD(0x774, 0x36c, 3, 0xa24, 1, NO_PAD_CTRL) 677#define MX51_PAD_DISP2_DAT6__USBH3_STP IOMUX_PAD(0x774, 0x36c, 3, 0xa24, 1, NO_PAD_CTRL)
678#define MX51_PAD_DISP2_DAT7__DISP2_DAT7 IOMUX_PAD(0x778, 0x370, 0, __NA_, 0, NO_PAD_CTRL) 678#define MX51_PAD_DISP2_DAT7__DISP2_DAT7 IOMUX_PAD(0x778, 0x370, 0, __NA_, 0, NO_PAD_CTRL)
679#define MX51_PAD_DISP2_DAT7__FEC_TDATA2 IOMUX_PAD(0x778, 0x370, 2, __NA_, 0, MX51_PAD_CTRL_5) 679#define MX51_PAD_DISP2_DAT7__FEC_TDATA2 IOMUX_PAD(0x778, 0x370, 2, __NA_, 0, MX51_PAD_CTRL_5)
680#define MX51_PAD_DISP2_DAT7__GPIO1_29 IOMUX_PAD(0x778, 0x370, 5, __NA_, 0, NO_PAD_CTRL) 680#define MX51_PAD_DISP2_DAT7__GPIO1_29 IOMUX_PAD(0x778, 0x370, 5, __NA_, 0, MX51_GPIO_PAD_CTRL)
681#define MX51_PAD_DISP2_DAT7__KEY_ROW5 IOMUX_PAD(0x778, 0x370, 4, 0x9d4, 1, NO_PAD_CTRL) 681#define MX51_PAD_DISP2_DAT7__KEY_ROW5 IOMUX_PAD(0x778, 0x370, 4, 0x9d4, 1, NO_PAD_CTRL)
682#define MX51_PAD_DISP2_DAT7__USBH3_NXT IOMUX_PAD(0x778, 0x370, 3, 0xa20, 1, NO_PAD_CTRL) 682#define MX51_PAD_DISP2_DAT7__USBH3_NXT IOMUX_PAD(0x778, 0x370, 3, 0xa20, 1, NO_PAD_CTRL)
683#define MX51_PAD_DISP2_DAT8__DISP2_DAT8 IOMUX_PAD(0x77c, 0x374, 0, __NA_, 0, NO_PAD_CTRL) 683#define MX51_PAD_DISP2_DAT8__DISP2_DAT8 IOMUX_PAD(0x77c, 0x374, 0, __NA_, 0, NO_PAD_CTRL)
684#define MX51_PAD_DISP2_DAT8__FEC_TDATA3 IOMUX_PAD(0x77c, 0x374, 2, __NA_, 0, MX51_PAD_CTRL_5) 684#define MX51_PAD_DISP2_DAT8__FEC_TDATA3 IOMUX_PAD(0x77c, 0x374, 2, __NA_, 0, MX51_PAD_CTRL_5)
685#define MX51_PAD_DISP2_DAT8__GPIO1_30 IOMUX_PAD(0x77c, 0x374, 5, __NA_, 0, NO_PAD_CTRL) 685#define MX51_PAD_DISP2_DAT8__GPIO1_30 IOMUX_PAD(0x77c, 0x374, 5, __NA_, 0, MX51_GPIO_PAD_CTRL)
686#define MX51_PAD_DISP2_DAT8__KEY_ROW6 IOMUX_PAD(0x77c, 0x374, 4, 0x9d8, 1, NO_PAD_CTRL) 686#define MX51_PAD_DISP2_DAT8__KEY_ROW6 IOMUX_PAD(0x77c, 0x374, 4, 0x9d8, 1, NO_PAD_CTRL)
687#define MX51_PAD_DISP2_DAT8__USBH3_DATA0 IOMUX_PAD(0x77c, 0x374, 3, 0x9fc, 1, NO_PAD_CTRL) 687#define MX51_PAD_DISP2_DAT8__USBH3_DATA0 IOMUX_PAD(0x77c, 0x374, 3, 0x9fc, 1, NO_PAD_CTRL)
688#define MX51_PAD_DISP2_DAT9__AUD6_RXC IOMUX_PAD(0x780, 0x378, 4, 0x8f4, 1, NO_PAD_CTRL) 688#define MX51_PAD_DISP2_DAT9__AUD6_RXC IOMUX_PAD(0x780, 0x378, 4, 0x8f4, 1, NO_PAD_CTRL)
689#define MX51_PAD_DISP2_DAT9__DISP2_DAT9 IOMUX_PAD(0x780, 0x378, 0, __NA_, 0, NO_PAD_CTRL) 689#define MX51_PAD_DISP2_DAT9__DISP2_DAT9 IOMUX_PAD(0x780, 0x378, 0, __NA_, 0, NO_PAD_CTRL)
690#define MX51_PAD_DISP2_DAT9__FEC_TX_EN IOMUX_PAD(0x780, 0x378, 2, __NA_, 0, MX51_PAD_CTRL_5) 690#define MX51_PAD_DISP2_DAT9__FEC_TX_EN IOMUX_PAD(0x780, 0x378, 2, __NA_, 0, MX51_PAD_CTRL_5)
691#define MX51_PAD_DISP2_DAT9__GPIO1_31 IOMUX_PAD(0x780, 0x378, 5, __NA_, 0, NO_PAD_CTRL) 691#define MX51_PAD_DISP2_DAT9__GPIO1_31 IOMUX_PAD(0x780, 0x378, 5, __NA_, 0, MX51_GPIO_PAD_CTRL)
692#define MX51_PAD_DISP2_DAT9__USBH3_DATA1 IOMUX_PAD(0x780, 0x378, 3, 0xa00, 1, NO_PAD_CTRL) 692#define MX51_PAD_DISP2_DAT9__USBH3_DATA1 IOMUX_PAD(0x780, 0x378, 3, 0xa00, 1, NO_PAD_CTRL)
693#define MX51_PAD_DISP2_DAT10__DISP2_DAT10 IOMUX_PAD(0x784, 0x37c, 0, __NA_, 0, NO_PAD_CTRL) 693#define MX51_PAD_DISP2_DAT10__DISP2_DAT10 IOMUX_PAD(0x784, 0x37c, 0, __NA_, 0, NO_PAD_CTRL)
694#define MX51_PAD_DISP2_DAT10__DISP2_SER_CS IOMUX_PAD(0x784, 0x37c, 5, __NA_, 0, NO_PAD_CTRL) 694#define MX51_PAD_DISP2_DAT10__DISP2_SER_CS IOMUX_PAD(0x784, 0x37c, 5, __NA_, 0, NO_PAD_CTRL)
@@ -698,7 +698,7 @@
698#define MX51_PAD_DISP2_DAT11__AUD6_TXD IOMUX_PAD(0x788, 0x380, 4, 0x8f0, 1, NO_PAD_CTRL) 698#define MX51_PAD_DISP2_DAT11__AUD6_TXD IOMUX_PAD(0x788, 0x380, 4, 0x8f0, 1, NO_PAD_CTRL)
699#define MX51_PAD_DISP2_DAT11__DISP2_DAT11 IOMUX_PAD(0x788, 0x380, 0, __NA_, 0, NO_PAD_CTRL) 699#define MX51_PAD_DISP2_DAT11__DISP2_DAT11 IOMUX_PAD(0x788, 0x380, 0, __NA_, 0, NO_PAD_CTRL)
700#define MX51_PAD_DISP2_DAT11__FEC_RX_CLK IOMUX_PAD(0x788, 0x380, 2, 0x968, 1, NO_PAD_CTRL) 700#define MX51_PAD_DISP2_DAT11__FEC_RX_CLK IOMUX_PAD(0x788, 0x380, 2, 0x968, 1, NO_PAD_CTRL)
701#define MX51_PAD_DISP2_DAT11__GPIO1_10 IOMUX_PAD(0x788, 0x380, 7, __NA_, 0, NO_PAD_CTRL) 701#define MX51_PAD_DISP2_DAT11__GPIO1_10 IOMUX_PAD(0x788, 0x380, 7, __NA_, 0, MX51_GPIO_PAD_CTRL)
702#define MX51_PAD_DISP2_DAT11__USBH3_DATA3 IOMUX_PAD(0x788, 0x380, 3, 0xa08, 1, NO_PAD_CTRL) 702#define MX51_PAD_DISP2_DAT11__USBH3_DATA3 IOMUX_PAD(0x788, 0x380, 3, 0xa08, 1, NO_PAD_CTRL)
703#define MX51_PAD_DISP2_DAT12__AUD6_RXD IOMUX_PAD(0x78c, 0x384, 4, 0x8ec, 1, NO_PAD_CTRL) 703#define MX51_PAD_DISP2_DAT12__AUD6_RXD IOMUX_PAD(0x78c, 0x384, 4, 0x8ec, 1, NO_PAD_CTRL)
704#define MX51_PAD_DISP2_DAT12__DISP2_DAT12 IOMUX_PAD(0x78c, 0x384, 0, __NA_, 0, NO_PAD_CTRL) 704#define MX51_PAD_DISP2_DAT12__DISP2_DAT12 IOMUX_PAD(0x78c, 0x384, 0, __NA_, 0, NO_PAD_CTRL)
@@ -746,16 +746,16 @@
746#define MX51_PAD_SD1_DATA3__CSPI_SS1 IOMUX_PAD(0x7b0, 0x3a8, 2, 0x920, 1, MX51_ECSPI_PAD_CTRL) 746#define MX51_PAD_SD1_DATA3__CSPI_SS1 IOMUX_PAD(0x7b0, 0x3a8, 2, 0x920, 1, MX51_ECSPI_PAD_CTRL)
747#define MX51_PAD_SD1_DATA3__SD1_DATA3 IOMUX_PAD(0x7b0, 0x3a8, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL) 747#define MX51_PAD_SD1_DATA3__SD1_DATA3 IOMUX_PAD(0x7b0, 0x3a8, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
748#define MX51_PAD_GPIO1_0__CSPI_SS2 IOMUX_PAD(0x7b4, 0x3ac, 2, 0x924, 0, MX51_ECSPI_PAD_CTRL) 748#define MX51_PAD_GPIO1_0__CSPI_SS2 IOMUX_PAD(0x7b4, 0x3ac, 2, 0x924, 0, MX51_ECSPI_PAD_CTRL)
749#define MX51_PAD_GPIO1_0__GPIO1_0 IOMUX_PAD(0x7b4, 0x3ac, 1, __NA_, 0, NO_PAD_CTRL) 749#define MX51_PAD_GPIO1_0__GPIO1_0 IOMUX_PAD(0x7b4, 0x3ac, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
750#define MX51_PAD_GPIO1_0__SD1_CD IOMUX_PAD(0x7b4, 0x3ac, 0, __NA_, 0, MX51_ESDHC_PAD_CTRL) 750#define MX51_PAD_GPIO1_0__SD1_CD IOMUX_PAD(0x7b4, 0x3ac, 0, __NA_, 0, MX51_ESDHC_PAD_CTRL)
751#define MX51_PAD_GPIO1_1__CSPI_MISO IOMUX_PAD(0x7b8, 0x3b0, 2, 0x918, 2, MX51_ECSPI_PAD_CTRL) 751#define MX51_PAD_GPIO1_1__CSPI_MISO IOMUX_PAD(0x7b8, 0x3b0, 2, 0x918, 2, MX51_ECSPI_PAD_CTRL)
752#define MX51_PAD_GPIO1_1__GPIO1_1 IOMUX_PAD(0x7b8, 0x3b0, 1, __NA_, 0, NO_PAD_CTRL) 752#define MX51_PAD_GPIO1_1__GPIO1_1 IOMUX_PAD(0x7b8, 0x3b0, 1, __NA_, 0, MX51_GPIO_PAD_CTRL)
753#define MX51_PAD_GPIO1_1__SD1_WP IOMUX_PAD(0x7b8, 0x3b0, 0, __NA_, 0, MX51_ESDHC_PAD_CTRL) 753#define MX51_PAD_GPIO1_1__SD1_WP IOMUX_PAD(0x7b8, 0x3b0, 0, __NA_, 0, MX51_ESDHC_PAD_CTRL)
754#define MX51_PAD_EIM_DA12__EIM_DA12 IOMUX_PAD(__NA_, 0x04c, 0, 0x000, 0, NO_PAD_CTRL) 754#define MX51_PAD_EIM_DA12__EIM_DA12 IOMUX_PAD(__NA_, 0x04c, 0, 0x000, 0, NO_PAD_CTRL)
755#define MX51_PAD_EIM_DA13__EIM_DA13 IOMUX_PAD(__NA_, 0x050, 0, 0x000, 0, NO_PAD_CTRL) 755#define MX51_PAD_EIM_DA13__EIM_DA13 IOMUX_PAD(__NA_, 0x050, 0, 0x000, 0, NO_PAD_CTRL)
756#define MX51_PAD_EIM_DA14__EIM_DA14 IOMUX_PAD(__NA_, 0x054, 0, 0x000, 0, NO_PAD_CTRL) 756#define MX51_PAD_EIM_DA14__EIM_DA14 IOMUX_PAD(__NA_, 0x054, 0, 0x000, 0, NO_PAD_CTRL)
757#define MX51_PAD_EIM_DA15__EIM_DA15 IOMUX_PAD(__NA_, 0x058, 0, 0x000, 0, NO_PAD_CTRL) 757#define MX51_PAD_EIM_DA15__EIM_DA15 IOMUX_PAD(__NA_, 0x058, 0, 0x000, 0, NO_PAD_CTRL)
758#define MX51_PAD_SD2_CMD__CSPI_MOSI IOMUX_PAD(__NA_, 0x3b4, 2, 0x91c, 3, MX51_ECSPI_PAD_CTRL) 758#define MX51_PAD_SD2_CMD__CSPI_MOSI IOMUX_PAD(0x7bc, 0x3b4, 2, 0x91c, 3, MX51_ECSPI_PAD_CTRL)
759#define MX51_PAD_SD2_CMD__I2C1_SCL IOMUX_PAD(0x7bc, 0x3b4, 0x11, 0x9b0, 2, MX51_I2C_PAD_CTRL) 759#define MX51_PAD_SD2_CMD__I2C1_SCL IOMUX_PAD(0x7bc, 0x3b4, 0x11, 0x9b0, 2, MX51_I2C_PAD_CTRL)
760#define MX51_PAD_SD2_CMD__SD2_CMD IOMUX_PAD(0x7bc, 0x3b4, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL) 760#define MX51_PAD_SD2_CMD__SD2_CMD IOMUX_PAD(0x7bc, 0x3b4, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
761#define MX51_PAD_SD2_CLK__CSPI_SCLK IOMUX_PAD(0x7c0, 0x3b8, 2, 0x914, 3, MX51_ECSPI_PAD_CTRL) 761#define MX51_PAD_SD2_CLK__CSPI_SCLK IOMUX_PAD(0x7c0, 0x3b8, 2, 0x914, 3, MX51_ECSPI_PAD_CTRL)
@@ -766,19 +766,19 @@
766#define MX51_PAD_SD2_DATA0__SD2_DATA0 IOMUX_PAD(0x7c4, 0x3bc, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL) 766#define MX51_PAD_SD2_DATA0__SD2_DATA0 IOMUX_PAD(0x7c4, 0x3bc, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
767#define MX51_PAD_SD2_DATA1__SD1_DAT5 IOMUX_PAD(0x7c8, 0x3c0, 1, __NA_, 0, NO_PAD_CTRL) 767#define MX51_PAD_SD2_DATA1__SD1_DAT5 IOMUX_PAD(0x7c8, 0x3c0, 1, __NA_, 0, NO_PAD_CTRL)
768#define MX51_PAD_SD2_DATA1__SD2_DATA1 IOMUX_PAD(0x7c8, 0x3c0, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL) 768#define MX51_PAD_SD2_DATA1__SD2_DATA1 IOMUX_PAD(0x7c8, 0x3c0, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
769#define MX51_PAD_SD2_DATA1__USBH3_H2_DP IOMUX_PAD(0x7c8, 0x3c0, 2, __NA_, 0, NO_PAD_CTRL) 769#define MX51_PAD_SD2_DATA1__USBH3_H2_DP IOMUX_PAD(0x7c8, 0x3c0, 0x12, __NA_, 0, NO_PAD_CTRL)
770#define MX51_PAD_SD2_DATA2__SD1_DAT6 IOMUX_PAD(0x7cc, 0x3c4, 1, __NA_, 0, NO_PAD_CTRL) 770#define MX51_PAD_SD2_DATA2__SD1_DAT6 IOMUX_PAD(0x7cc, 0x3c4, 1, __NA_, 0, NO_PAD_CTRL)
771#define MX51_PAD_SD2_DATA2__SD2_DATA2 IOMUX_PAD(0x7cc, 0x3c4, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL) 771#define MX51_PAD_SD2_DATA2__SD2_DATA2 IOMUX_PAD(0x7cc, 0x3c4, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
772#define MX51_PAD_SD2_DATA2__USBH3_H2_DM IOMUX_PAD(0x7cc, 0x3c4, 2, __NA_, 0, NO_PAD_CTRL) 772#define MX51_PAD_SD2_DATA2__USBH3_H2_DM IOMUX_PAD(0x7cc, 0x3c4, 0x12, __NA_, 0, NO_PAD_CTRL)
773#define MX51_PAD_SD2_DATA3__CSPI_SS2 IOMUX_PAD(0x7d0, 0x3c8, 2, 0x924, 1, MX51_ECSPI_PAD_CTRL) 773#define MX51_PAD_SD2_DATA3__CSPI_SS2 IOMUX_PAD(0x7d0, 0x3c8, 2, 0x924, 1, MX51_ECSPI_PAD_CTRL)
774#define MX51_PAD_SD2_DATA3__SD1_DAT7 IOMUX_PAD(0x7d0, 0x3c8, 1, __NA_, 0, NO_PAD_CTRL) 774#define MX51_PAD_SD2_DATA3__SD1_DAT7 IOMUX_PAD(0x7d0, 0x3c8, 1, __NA_, 0, NO_PAD_CTRL)
775#define MX51_PAD_SD2_DATA3__SD2_DATA3 IOMUX_PAD(0x7d0, 0x3c8, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL) 775#define MX51_PAD_SD2_DATA3__SD2_DATA3 IOMUX_PAD(0x7d0, 0x3c8, 0x10, __NA_, 0, MX51_SDHCI_PAD_CTRL)
776#define MX51_PAD_GPIO1_2__CCM_OUT_2 IOMUX_PAD(0x7d4, 0x3cc, 5, __NA_, 0, NO_PAD_CTRL) 776#define MX51_PAD_GPIO1_2__CCM_OUT_2 IOMUX_PAD(0x7d4, 0x3cc, 5, __NA_, 0, NO_PAD_CTRL)
777#define MX51_PAD_GPIO1_2__GPIO1_2 IOMUX_PAD(0x7d4, 0x3cc, 0, __NA_, 0, NO_PAD_CTRL) 777#define MX51_PAD_GPIO1_2__GPIO1_2 IOMUX_PAD(0x7d4, 0x3cc, 0, __NA_, 0, MX51_GPIO_PAD_CTRL)
778#define MX51_PAD_GPIO1_2__I2C2_SCL IOMUX_PAD(0x7d4, 0x3cc, 0x12, 0x9b8, 3, MX51_I2C_PAD_CTRL) 778#define MX51_PAD_GPIO1_2__I2C2_SCL IOMUX_PAD(0x7d4, 0x3cc, 0x12, 0x9b8, 3, MX51_I2C_PAD_CTRL)
779#define MX51_PAD_GPIO1_2__PLL1_BYP IOMUX_PAD(0x7d4, 0x3cc, 7, 0x90c, 1, NO_PAD_CTRL) 779#define MX51_PAD_GPIO1_2__PLL1_BYP IOMUX_PAD(0x7d4, 0x3cc, 7, 0x90c, 1, NO_PAD_CTRL)
780#define MX51_PAD_GPIO1_2__PWM1_PWMO IOMUX_PAD(0x7d4, 0x3cc, 1, __NA_, 0, NO_PAD_CTRL) 780#define MX51_PAD_GPIO1_2__PWM1_PWMO IOMUX_PAD(0x7d4, 0x3cc, 1, __NA_, 0, NO_PAD_CTRL)
781#define MX51_PAD_GPIO1_3__GPIO1_3 IOMUX_PAD(0x7d8, 0x3d0, 0, __NA_, 0, NO_PAD_CTRL) 781#define MX51_PAD_GPIO1_3__GPIO1_3 IOMUX_PAD(0x7d8, 0x3d0, 0, __NA_, 0, MX51_GPIO_PAD_CTRL)
782#define MX51_PAD_GPIO1_3__I2C2_SDA IOMUX_PAD(0x7d8, 0x3d0, 0x12, 0x9bc, 3, MX51_I2C_PAD_CTRL) 782#define MX51_PAD_GPIO1_3__I2C2_SDA IOMUX_PAD(0x7d8, 0x3d0, 0x12, 0x9bc, 3, MX51_I2C_PAD_CTRL)
783#define MX51_PAD_GPIO1_3__PLL2_BYP IOMUX_PAD(0x7d8, 0x3d0, 7, 0x910, 1, NO_PAD_CTRL) 783#define MX51_PAD_GPIO1_3__PLL2_BYP IOMUX_PAD(0x7d8, 0x3d0, 7, 0x910, 1, NO_PAD_CTRL)
784#define MX51_PAD_GPIO1_3__PWM2_PWMO IOMUX_PAD(0x7d8, 0x3d0, 1, __NA_, 0, NO_PAD_CTRL) 784#define MX51_PAD_GPIO1_3__PWM2_PWMO IOMUX_PAD(0x7d8, 0x3d0, 1, __NA_, 0, NO_PAD_CTRL)
@@ -786,27 +786,27 @@
786#define MX51_PAD_PMIC_INT_REQ__PMIC_PMU_IRQ_B IOMUX_PAD(0x7fc, 0x3d4, 1, __NA_, 0, NO_PAD_CTRL) 786#define MX51_PAD_PMIC_INT_REQ__PMIC_PMU_IRQ_B IOMUX_PAD(0x7fc, 0x3d4, 1, __NA_, 0, NO_PAD_CTRL)
787#define MX51_PAD_GPIO1_4__DISP2_EXT_CLK IOMUX_PAD(0x804, 0x3d8, 4, 0x908, 1, NO_PAD_CTRL) 787#define MX51_PAD_GPIO1_4__DISP2_EXT_CLK IOMUX_PAD(0x804, 0x3d8, 4, 0x908, 1, NO_PAD_CTRL)
788#define MX51_PAD_GPIO1_4__EIM_RDY IOMUX_PAD(0x804, 0x3d8, 3, 0x938, 1, NO_PAD_CTRL) 788#define MX51_PAD_GPIO1_4__EIM_RDY IOMUX_PAD(0x804, 0x3d8, 3, 0x938, 1, NO_PAD_CTRL)
789#define MX51_PAD_GPIO1_4__GPIO1_4 IOMUX_PAD(0x804, 0x3d8, 0, __NA_, 0, NO_PAD_CTRL) 789#define MX51_PAD_GPIO1_4__GPIO1_4 IOMUX_PAD(0x804, 0x3d8, 0, __NA_, 0, MX51_GPIO_PAD_CTRL)
790#define MX51_PAD_GPIO1_4__WDOG1_WDOG_B IOMUX_PAD(0x804, 0x3d8, 2, __NA_, 0, NO_PAD_CTRL) 790#define MX51_PAD_GPIO1_4__WDOG1_WDOG_B IOMUX_PAD(0x804, 0x3d8, 2, __NA_, 0, NO_PAD_CTRL)
791#define MX51_PAD_GPIO1_5__CSI2_MCLK IOMUX_PAD(0x808, 0x3dc, 6, __NA_, 0, NO_PAD_CTRL) 791#define MX51_PAD_GPIO1_5__CSI2_MCLK IOMUX_PAD(0x808, 0x3dc, 6, __NA_, 0, NO_PAD_CTRL)
792#define MX51_PAD_GPIO1_5__DISP2_PIN16 IOMUX_PAD(0x808, 0x3dc, 3, __NA_, 0, NO_PAD_CTRL) 792#define MX51_PAD_GPIO1_5__DISP2_PIN16 IOMUX_PAD(0x808, 0x3dc, 3, __NA_, 0, NO_PAD_CTRL)
793#define MX51_PAD_GPIO1_5__GPIO1_5 IOMUX_PAD(0x808, 0x3dc, 0, __NA_, 0, NO_PAD_CTRL) 793#define MX51_PAD_GPIO1_5__GPIO1_5 IOMUX_PAD(0x808, 0x3dc, 0, __NA_, 0, MX51_GPIO_PAD_CTRL)
794#define MX51_PAD_GPIO1_5__WDOG2_WDOG_B IOMUX_PAD(0x808, 0x3dc, 2, __NA_, 0, NO_PAD_CTRL) 794#define MX51_PAD_GPIO1_5__WDOG2_WDOG_B IOMUX_PAD(0x808, 0x3dc, 2, __NA_, 0, NO_PAD_CTRL)
795#define MX51_PAD_GPIO1_6__DISP2_PIN17 IOMUX_PAD(0x80c, 0x3e0, 4, __NA_, 0, NO_PAD_CTRL) 795#define MX51_PAD_GPIO1_6__DISP2_PIN17 IOMUX_PAD(0x80c, 0x3e0, 4, __NA_, 0, NO_PAD_CTRL)
796#define MX51_PAD_GPIO1_6__GPIO1_6 IOMUX_PAD(0x80c, 0x3e0, 0, __NA_, 0, NO_PAD_CTRL) 796#define MX51_PAD_GPIO1_6__GPIO1_6 IOMUX_PAD(0x80c, 0x3e0, 0, __NA_, 0, MX51_GPIO_PAD_CTRL)
797#define MX51_PAD_GPIO1_6__REF_EN_B IOMUX_PAD(0x80c, 0x3e0, 3, __NA_, 0, NO_PAD_CTRL) 797#define MX51_PAD_GPIO1_6__REF_EN_B IOMUX_PAD(0x80c, 0x3e0, 3, __NA_, 0, NO_PAD_CTRL)
798#define MX51_PAD_GPIO1_7__CCM_OUT_0 IOMUX_PAD(0x810, 0x3e4, 3, __NA_, 0, NO_PAD_CTRL) 798#define MX51_PAD_GPIO1_7__CCM_OUT_0 IOMUX_PAD(0x810, 0x3e4, 3, __NA_, 0, NO_PAD_CTRL)
799#define MX51_PAD_GPIO1_7__GPIO1_7 IOMUX_PAD(0x810, 0x3e4, 0, __NA_, 0, NO_PAD_CTRL) 799#define MX51_PAD_GPIO1_7__GPIO1_7 IOMUX_PAD(0x810, 0x3e4, 0, __NA_, 0, MX51_GPIO_PAD_CTRL)
800#define MX51_PAD_GPIO1_7__SD2_WP IOMUX_PAD(0x810, 0x3e4, 6, __NA_, 0, MX51_ESDHC_PAD_CTRL) 800#define MX51_PAD_GPIO1_7__SD2_WP IOMUX_PAD(0x810, 0x3e4, 6, __NA_, 0, MX51_ESDHC_PAD_CTRL)
801#define MX51_PAD_GPIO1_7__SPDIF_OUT1 IOMUX_PAD(0x810, 0x3e4, 2, __NA_, 0, NO_PAD_CTRL) 801#define MX51_PAD_GPIO1_7__SPDIF_OUT1 IOMUX_PAD(0x810, 0x3e4, 2, __NA_, 0, NO_PAD_CTRL)
802#define MX51_PAD_GPIO1_8__CSI2_DATA_EN IOMUX_PAD(0x814, 0x3e8, 2, 0x99c, 2, NO_PAD_CTRL) 802#define MX51_PAD_GPIO1_8__CSI2_DATA_EN IOMUX_PAD(0x814, 0x3e8, 2, 0x99c, 2, NO_PAD_CTRL)
803#define MX51_PAD_GPIO1_8__GPIO1_8 IOMUX_PAD(0x814, 0x3e8, 0, __NA_, 0, NO_PAD_CTRL) 803#define MX51_PAD_GPIO1_8__GPIO1_8 IOMUX_PAD(0x814, 0x3e8, 0, __NA_, 0, MX51_GPIO_PAD_CTRL)
804#define MX51_PAD_GPIO1_8__SD2_CD IOMUX_PAD(0x814, 0x3e8, 6, __NA_, 0, MX51_ESDHC_PAD_CTRL) 804#define MX51_PAD_GPIO1_8__SD2_CD IOMUX_PAD(0x814, 0x3e8, 6, __NA_, 0, MX51_ESDHC_PAD_CTRL)
805#define MX51_PAD_GPIO1_8__USBH3_PWR IOMUX_PAD(0x814, 0x3e8, 1, __NA_, 0, NO_PAD_CTRL) 805#define MX51_PAD_GPIO1_8__USBH3_PWR IOMUX_PAD(0x814, 0x3e8, 1, __NA_, 0, NO_PAD_CTRL)
806#define MX51_PAD_GPIO1_9__CCM_OUT_1 IOMUX_PAD(0x818, 0x3ec, 3, __NA_, 0, NO_PAD_CTRL) 806#define MX51_PAD_GPIO1_9__CCM_OUT_1 IOMUX_PAD(0x818, 0x3ec, 3, __NA_, 0, NO_PAD_CTRL)
807#define MX51_PAD_GPIO1_9__DISP2_D1_CS IOMUX_PAD(0x818, 0x3ec, 2, __NA_, 0, NO_PAD_CTRL) 807#define MX51_PAD_GPIO1_9__DISP2_D1_CS IOMUX_PAD(0x818, 0x3ec, 2, __NA_, 0, NO_PAD_CTRL)
808#define MX51_PAD_GPIO1_9__DISP2_SER_CS IOMUX_PAD(0x818, 0x3ec, 7, __NA_, 0, NO_PAD_CTRL) 808#define MX51_PAD_GPIO1_9__DISP2_SER_CS IOMUX_PAD(0x818, 0x3ec, 7, __NA_, 0, NO_PAD_CTRL)
809#define MX51_PAD_GPIO1_9__GPIO1_9 IOMUX_PAD(0x818, 0x3ec, 0, __NA_, 0, NO_PAD_CTRL) 809#define MX51_PAD_GPIO1_9__GPIO1_9 IOMUX_PAD(0x818, 0x3ec, 0, __NA_, 0, MX51_GPIO_PAD_CTRL)
810#define MX51_PAD_GPIO1_9__SD2_LCTL IOMUX_PAD(0x818, 0x3ec, 6, __NA_, 0, NO_PAD_CTRL) 810#define MX51_PAD_GPIO1_9__SD2_LCTL IOMUX_PAD(0x818, 0x3ec, 6, __NA_, 0, NO_PAD_CTRL)
811#define MX51_PAD_GPIO1_9__USBH3_OC IOMUX_PAD(0x818, 0x3ec, 1, __NA_, 0, NO_PAD_CTRL) 811#define MX51_PAD_GPIO1_9__USBH3_OC IOMUX_PAD(0x818, 0x3ec, 1, __NA_, 0, NO_PAD_CTRL)
812 812
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx53.h b/arch/arm/plat-mxc/include/mach/iomux-mx53.h
index 527f8fe3e31b..9761e003bde2 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx53.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx53.h
@@ -573,7 +573,7 @@
573#define MX53_PAD_EIM_D28__UART2_CTS IOMUX_PAD(0x494, 0x14C, 2, __NA_, 0, MX53_UART_PAD_CTRL) 573#define MX53_PAD_EIM_D28__UART2_CTS IOMUX_PAD(0x494, 0x14C, 2, __NA_, 0, MX53_UART_PAD_CTRL)
574#define MX53_PAD_EIM_D28__IPU_DISPB0_SER_DIO IOMUX_PAD(0x494, 0x14C, 3, 0x82C, 1, NO_PAD_CTRL) 574#define MX53_PAD_EIM_D28__IPU_DISPB0_SER_DIO IOMUX_PAD(0x494, 0x14C, 3, 0x82C, 1, NO_PAD_CTRL)
575#define MX53_PAD_EIM_D28__CSPI_MOSI IOMUX_PAD(0x494, 0x14C, 4, 0x788, 1, NO_PAD_CTRL) 575#define MX53_PAD_EIM_D28__CSPI_MOSI IOMUX_PAD(0x494, 0x14C, 4, 0x788, 1, NO_PAD_CTRL)
576#define MX53_PAD_EIM_D28__I2C1_SDA IOMUX_PAD(0x494, 0x14C, 5 | IOMUX_CONFIG_SION, 0x818, 1, PAD_CTRL_I2C) 576#define MX53_PAD_EIM_D28__I2C1_SDA IOMUX_PAD(0x494, 0x14C, 5 | IOMUX_CONFIG_SION, 0x818, 1, NO_PAD_CTRL)
577#define MX53_PAD_EIM_D28__IPU_EXT_TRIG IOMUX_PAD(0x494, 0x14C, 6, __NA_, 0, NO_PAD_CTRL) 577#define MX53_PAD_EIM_D28__IPU_EXT_TRIG IOMUX_PAD(0x494, 0x14C, 6, __NA_, 0, NO_PAD_CTRL)
578#define MX53_PAD_EIM_D28__IPU_DI0_PIN13 IOMUX_PAD(0x494, 0x14C, 7, __NA_, 0, NO_PAD_CTRL) 578#define MX53_PAD_EIM_D28__IPU_DI0_PIN13 IOMUX_PAD(0x494, 0x14C, 7, __NA_, 0, NO_PAD_CTRL)
579#define MX53_PAD_EIM_D29__EMI_WEIM_D_29 IOMUX_PAD(0x498, 0x150, 0, __NA_, 0, NO_PAD_CTRL) 579#define MX53_PAD_EIM_D29__EMI_WEIM_D_29 IOMUX_PAD(0x498, 0x150, 0, __NA_, 0, NO_PAD_CTRL)
@@ -1187,7 +1187,7 @@
1187#define MX53_PAD_GPIO_8__ESAI1_TX5_RX0 IOMUX_PAD(0x6C8, 0x338, 0, 0x7F8, 1, NO_PAD_CTRL) 1187#define MX53_PAD_GPIO_8__ESAI1_TX5_RX0 IOMUX_PAD(0x6C8, 0x338, 0, 0x7F8, 1, NO_PAD_CTRL)
1188#define MX53_PAD_GPIO_8__GPIO1_8 IOMUX_PAD(0x6C8, 0x338, 1, __NA_, 0, NO_PAD_CTRL) 1188#define MX53_PAD_GPIO_8__GPIO1_8 IOMUX_PAD(0x6C8, 0x338, 1, __NA_, 0, NO_PAD_CTRL)
1189#define MX53_PAD_GPIO_8__EPIT2_EPITO IOMUX_PAD(0x6C8, 0x338, 2, __NA_, 0, NO_PAD_CTRL) 1189#define MX53_PAD_GPIO_8__EPIT2_EPITO IOMUX_PAD(0x6C8, 0x338, 2, __NA_, 0, NO_PAD_CTRL)
1190#define MX53_PAD_GPIO_8__CAN1_RXCAN IOMUX_PAD(0x6C8, 0x338, 3, 0x760, 3, NO_PAD_CTRL) 1190#define MX53_PAD_GPIO_8__CAN1_RXCAN IOMUX_PAD(0x6C8, 0x338, 3, 0x760, 2, NO_PAD_CTRL)
1191#define MX53_PAD_GPIO_8__UART2_RXD_MUX IOMUX_PAD(0x6C8, 0x338, 4, 0x880, 5, MX53_UART_PAD_CTRL) 1191#define MX53_PAD_GPIO_8__UART2_RXD_MUX IOMUX_PAD(0x6C8, 0x338, 4, 0x880, 5, MX53_UART_PAD_CTRL)
1192#define MX53_PAD_GPIO_8__FIRI_TXD IOMUX_PAD(0x6C8, 0x338, 5, __NA_, 0, NO_PAD_CTRL) 1192#define MX53_PAD_GPIO_8__FIRI_TXD IOMUX_PAD(0x6C8, 0x338, 5, __NA_, 0, NO_PAD_CTRL)
1193#define MX53_PAD_GPIO_8__SPDIF_SRCLK IOMUX_PAD(0x6C8, 0x338, 6, __NA_, 0, NO_PAD_CTRL) 1193#define MX53_PAD_GPIO_8__SPDIF_SRCLK IOMUX_PAD(0x6C8, 0x338, 6, __NA_, 0, NO_PAD_CTRL)
diff --git a/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h b/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h
index 9605bf227df9..826de74bfdd1 100644
--- a/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h
+++ b/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h
@@ -29,6 +29,7 @@
29#define NMK_GPIO_SLPC 0x1c 29#define NMK_GPIO_SLPC 0x1c
30#define NMK_GPIO_AFSLA 0x20 30#define NMK_GPIO_AFSLA 0x20
31#define NMK_GPIO_AFSLB 0x24 31#define NMK_GPIO_AFSLB 0x24
32#define NMK_GPIO_LOWEMI 0x28
32 33
33#define NMK_GPIO_RIMSC 0x40 34#define NMK_GPIO_RIMSC 0x40
34#define NMK_GPIO_FIMSC 0x44 35#define NMK_GPIO_FIMSC 0x44
@@ -61,7 +62,14 @@ enum nmk_gpio_slpm {
61 62
62extern int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode); 63extern int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode);
63extern int nmk_gpio_set_pull(int gpio, enum nmk_gpio_pull pull); 64extern int nmk_gpio_set_pull(int gpio, enum nmk_gpio_pull pull);
65#ifdef CONFIG_PINCTRL_NOMADIK
64extern int nmk_gpio_set_mode(int gpio, int gpio_mode); 66extern int nmk_gpio_set_mode(int gpio, int gpio_mode);
67#else
68static inline int nmk_gpio_set_mode(int gpio, int gpio_mode)
69{
70 return -ENODEV;
71}
72#endif
65extern int nmk_gpio_get_mode(int gpio); 73extern int nmk_gpio_get_mode(int gpio);
66 74
67extern void nmk_gpio_wakeups_suspend(void); 75extern void nmk_gpio_wakeups_suspend(void);
diff --git a/arch/arm/plat-nomadik/include/plat/pincfg.h b/arch/arm/plat-nomadik/include/plat/pincfg.h
index 22cb97d2d8ad..9c949c7c98a7 100644
--- a/arch/arm/plat-nomadik/include/plat/pincfg.h
+++ b/arch/arm/plat-nomadik/include/plat/pincfg.h
@@ -24,6 +24,7 @@
24 * bit 16..18 - SLPM pull up/down state 24 * bit 16..18 - SLPM pull up/down state
25 * bit 19..20 - SLPM direction 25 * bit 19..20 - SLPM direction
26 * bit 21..22 - SLPM Value (if output) 26 * bit 21..22 - SLPM Value (if output)
27 * bit 23..25 - PDIS value (if input)
27 * 28 *
28 * to facilitate the definition, the following macros are provided 29 * to facilitate the definition, the following macros are provided
29 * 30 *
@@ -67,6 +68,10 @@ typedef unsigned long pin_cfg_t;
67/* These two replace the above in DB8500v2+ */ 68/* These two replace the above in DB8500v2+ */
68#define PIN_SLPM_WAKEUP_ENABLE (NMK_GPIO_SLPM_WAKEUP_ENABLE << PIN_SLPM_SHIFT) 69#define PIN_SLPM_WAKEUP_ENABLE (NMK_GPIO_SLPM_WAKEUP_ENABLE << PIN_SLPM_SHIFT)
69#define PIN_SLPM_WAKEUP_DISABLE (NMK_GPIO_SLPM_WAKEUP_DISABLE << PIN_SLPM_SHIFT) 70#define PIN_SLPM_WAKEUP_DISABLE (NMK_GPIO_SLPM_WAKEUP_DISABLE << PIN_SLPM_SHIFT)
71#define PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP PIN_SLPM_WAKEUP_DISABLE
72
73#define PIN_SLPM_GPIO PIN_SLPM_WAKEUP_ENABLE /* In SLPM, pin is a gpio */
74#define PIN_SLPM_ALTFUNC PIN_SLPM_WAKEUP_DISABLE /* In SLPM, pin is altfunc */
70 75
71#define PIN_DIR_SHIFT 14 76#define PIN_DIR_SHIFT 14
72#define PIN_DIR_MASK (0x1 << PIN_DIR_SHIFT) 77#define PIN_DIR_MASK (0x1 << PIN_DIR_SHIFT)
@@ -105,6 +110,33 @@ typedef unsigned long pin_cfg_t;
105#define PIN_SLPM_VAL_LOW ((1 + 0) << PIN_SLPM_VAL_SHIFT) 110#define PIN_SLPM_VAL_LOW ((1 + 0) << PIN_SLPM_VAL_SHIFT)
106#define PIN_SLPM_VAL_HIGH ((1 + 1) << PIN_SLPM_VAL_SHIFT) 111#define PIN_SLPM_VAL_HIGH ((1 + 1) << PIN_SLPM_VAL_SHIFT)
107 112
113#define PIN_SLPM_PDIS_SHIFT 23
114#define PIN_SLPM_PDIS_MASK (0x3 << PIN_SLPM_PDIS_SHIFT)
115#define PIN_SLPM_PDIS(x) \
116 (((x) & PIN_SLPM_PDIS_MASK) >> PIN_SLPM_PDIS_SHIFT)
117#define PIN_SLPM_PDIS_NO_CHANGE (0 << PIN_SLPM_PDIS_SHIFT)
118#define PIN_SLPM_PDIS_DISABLED (1 << PIN_SLPM_PDIS_SHIFT)
119#define PIN_SLPM_PDIS_ENABLED (2 << PIN_SLPM_PDIS_SHIFT)
120
121#define PIN_LOWEMI_SHIFT 25
122#define PIN_LOWEMI_MASK (0x1 << PIN_LOWEMI_SHIFT)
123#define PIN_LOWEMI(x) (((x) & PIN_LOWEMI_MASK) >> PIN_LOWEMI_SHIFT)
124#define PIN_LOWEMI_DISABLED (0 << PIN_LOWEMI_SHIFT)
125#define PIN_LOWEMI_ENABLED (1 << PIN_LOWEMI_SHIFT)
126
127#define PIN_GPIOMODE_SHIFT 26
128#define PIN_GPIOMODE_MASK (0x1 << PIN_GPIOMODE_SHIFT)
129#define PIN_GPIOMODE(x) (((x) & PIN_GPIOMODE_MASK) >> PIN_GPIOMODE_SHIFT)
130#define PIN_GPIOMODE_DISABLED (0 << PIN_GPIOMODE_SHIFT)
131#define PIN_GPIOMODE_ENABLED (1 << PIN_GPIOMODE_SHIFT)
132
133#define PIN_SLEEPMODE_SHIFT 27
134#define PIN_SLEEPMODE_MASK (0x1 << PIN_SLEEPMODE_SHIFT)
135#define PIN_SLEEPMODE(x) (((x) & PIN_SLEEPMODE_MASK) >> PIN_SLEEPMODE_SHIFT)
136#define PIN_SLEEPMODE_DISABLED (0 << PIN_SLEEPMODE_SHIFT)
137#define PIN_SLEEPMODE_ENABLED (1 << PIN_SLEEPMODE_SHIFT)
138
139
108/* Shortcuts. Use these instead of separate DIR, PULL, and VAL. */ 140/* Shortcuts. Use these instead of separate DIR, PULL, and VAL. */
109#define PIN_INPUT_PULLDOWN (PIN_DIR_INPUT | PIN_PULL_DOWN) 141#define PIN_INPUT_PULLDOWN (PIN_DIR_INPUT | PIN_PULL_DOWN)
110#define PIN_INPUT_PULLUP (PIN_DIR_INPUT | PIN_PULL_UP) 142#define PIN_INPUT_PULLUP (PIN_DIR_INPUT | PIN_PULL_UP)
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index c0fe2757b695..ed8605f01155 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -9,9 +9,6 @@ obj-m :=
9obj-n := 9obj-n :=
10obj- := 10obj- :=
11 11
12# OCPI interconnect support for 1710, 1610 and 5912
13obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
14
15# omap_device support (OMAP2+ only at the moment) 12# omap_device support (OMAP2+ only at the moment)
16obj-$(CONFIG_ARCH_OMAP2) += omap_device.o 13obj-$(CONFIG_ARCH_OMAP2) += omap_device.o
17obj-$(CONFIG_ARCH_OMAP3) += omap_device.o 14obj-$(CONFIG_ARCH_OMAP3) += omap_device.o
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 8506cbb7fea4..62ec5c452792 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -398,32 +398,6 @@ struct clk dummy_ck = {
398 .ops = &clkops_null, 398 .ops = &clkops_null,
399}; 399};
400 400
401#ifdef CONFIG_CPU_FREQ
402void clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
403{
404 unsigned long flags;
405
406 if (!arch_clock || !arch_clock->clk_init_cpufreq_table)
407 return;
408
409 spin_lock_irqsave(&clockfw_lock, flags);
410 arch_clock->clk_init_cpufreq_table(table);
411 spin_unlock_irqrestore(&clockfw_lock, flags);
412}
413
414void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table)
415{
416 unsigned long flags;
417
418 if (!arch_clock || !arch_clock->clk_exit_cpufreq_table)
419 return;
420
421 spin_lock_irqsave(&clockfw_lock, flags);
422 arch_clock->clk_exit_cpufreq_table(table);
423 spin_unlock_irqrestore(&clockfw_lock, flags);
424}
425#endif
426
427/* 401/*
428 * 402 *
429 */ 403 */
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index f1e46ea6b81d..0a9b9a970113 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -20,6 +20,7 @@
20#include <plat/board.h> 20#include <plat/board.h>
21#include <plat/vram.h> 21#include <plat/vram.h>
22#include <plat/dsp.h> 22#include <plat/dsp.h>
23#include <plat/dma.h>
23 24
24#include <plat/omap-secure.h> 25#include <plat/omap-secure.h>
25 26
diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
index 5068fe5a6910..44ae077dbc28 100644
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -19,6 +19,7 @@
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/clocksource.h> 20#include <linux/clocksource.h>
21 21
22#include <asm/mach/time.h>
22#include <asm/sched_clock.h> 23#include <asm/sched_clock.h>
23 24
24#include <plat/hardware.h> 25#include <plat/hardware.h>
@@ -43,7 +44,7 @@ static u32 notrace omap_32k_read_sched_clock(void)
43} 44}
44 45
45/** 46/**
46 * read_persistent_clock - Return time from a persistent clock. 47 * omap_read_persistent_clock - Return time from a persistent clock.
47 * 48 *
48 * Reads the time from a source which isn't disabled during PM, the 49 * Reads the time from a source which isn't disabled during PM, the
49 * 32k sync timer. Convert the cycles elapsed since last read into 50 * 32k sync timer. Convert the cycles elapsed since last read into
@@ -52,7 +53,7 @@ static u32 notrace omap_32k_read_sched_clock(void)
52static struct timespec persistent_ts; 53static struct timespec persistent_ts;
53static cycles_t cycles, last_cycles; 54static cycles_t cycles, last_cycles;
54static unsigned int persistent_mult, persistent_shift; 55static unsigned int persistent_mult, persistent_shift;
55void read_persistent_clock(struct timespec *ts) 56static void omap_read_persistent_clock(struct timespec *ts)
56{ 57{
57 unsigned long long nsecs; 58 unsigned long long nsecs;
58 cycles_t delta; 59 cycles_t delta;
@@ -116,6 +117,7 @@ int __init omap_init_clocksource_32k(void)
116 printk(err, "32k_counter"); 117 printk(err, "32k_counter");
117 118
118 setup_sched_clock(omap_32k_read_sched_clock, 32, 32768); 119 setup_sched_clock(omap_32k_read_sched_clock, 32, 32768);
120 register_persistent_clock(NULL, omap_read_persistent_clock);
119 } 121 }
120 return 0; 122 return 0;
121} 123}
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index 60278f47c0bd..09b07d252892 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -167,8 +167,8 @@ void __init omap_dsp_reserve_sdram_memblock(void)
167 167
168 paddr = arm_memblock_steal(size, SZ_1M); 168 paddr = arm_memblock_steal(size, SZ_1M);
169 if (!paddr) { 169 if (!paddr) {
170 pr_err("%s: failed to reserve %x bytes\n", 170 pr_err("%s: failed to reserve %llx bytes\n",
171 __func__, size); 171 __func__, (unsigned long long)size);
172 return; 172 return;
173 } 173 }
174 174
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index ecdb3da0dea9..987e6101267d 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -41,6 +41,15 @@
41 41
42#include <plat/tc.h> 42#include <plat/tc.h>
43 43
44/*
45 * MAX_LOGICAL_DMA_CH_COUNT: the maximum number of logical DMA
46 * channels that an instance of the SDMA IP block can support. Used
47 * to size arrays. (The actual maximum on a particular SoC may be less
48 * than this -- for example, OMAP1 SDMA instances only support 17 logical
49 * DMA channels.)
50 */
51#define MAX_LOGICAL_DMA_CH_COUNT 32
52
44#undef DEBUG 53#undef DEBUG
45 54
46#ifndef CONFIG_ARCH_OMAP1 55#ifndef CONFIG_ARCH_OMAP1
@@ -883,7 +892,7 @@ void omap_start_dma(int lch)
883 892
884 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { 893 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) {
885 int next_lch, cur_lch; 894 int next_lch, cur_lch;
886 char dma_chan_link_map[dma_lch_count]; 895 char dma_chan_link_map[MAX_LOGICAL_DMA_CH_COUNT];
887 896
888 dma_chan_link_map[lch] = 1; 897 dma_chan_link_map[lch] = 1;
889 /* Set the link register of the first channel */ 898 /* Set the link register of the first channel */
@@ -916,6 +925,13 @@ void omap_start_dma(int lch)
916 l |= OMAP_DMA_CCR_BUFFERING_DISABLE; 925 l |= OMAP_DMA_CCR_BUFFERING_DISABLE;
917 l |= OMAP_DMA_CCR_EN; 926 l |= OMAP_DMA_CCR_EN;
918 927
928 /*
929 * As dma_write() uses IO accessors which are weakly ordered, there
930 * is no guarantee that data in coherent DMA memory will be visible
931 * to the DMA device. Add a memory barrier here to ensure that any
932 * such data is visible prior to enabling DMA.
933 */
934 mb();
919 p->dma_write(l, CCR, lch); 935 p->dma_write(l, CCR, lch);
920 936
921 dma_chan[lch].flags |= OMAP_DMA_ACTIVE; 937 dma_chan[lch].flags |= OMAP_DMA_ACTIVE;
@@ -965,9 +981,16 @@ void omap_stop_dma(int lch)
965 p->dma_write(l, CCR, lch); 981 p->dma_write(l, CCR, lch);
966 } 982 }
967 983
984 /*
985 * Ensure that data transferred by DMA is visible to any access
986 * after DMA has been disabled. This is important for coherent
987 * DMA regions.
988 */
989 mb();
990
968 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { 991 if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) {
969 int next_lch, cur_lch = lch; 992 int next_lch, cur_lch = lch;
970 char dma_chan_link_map[dma_lch_count]; 993 char dma_chan_link_map[MAX_LOGICAL_DMA_CH_COUNT];
971 994
972 memset(dma_chan_link_map, 0, sizeof(dma_chan_link_map)); 995 memset(dma_chan_link_map, 0, sizeof(dma_chan_link_map));
973 do { 996 do {
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 652139c0339e..c4ed35e89fbd 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -349,11 +349,12 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_start);
349int omap_dm_timer_stop(struct omap_dm_timer *timer) 349int omap_dm_timer_stop(struct omap_dm_timer *timer)
350{ 350{
351 unsigned long rate = 0; 351 unsigned long rate = 0;
352 struct dmtimer_platform_data *pdata = timer->pdev->dev.platform_data; 352 struct dmtimer_platform_data *pdata;
353 353
354 if (unlikely(!timer)) 354 if (unlikely(!timer))
355 return -EINVAL; 355 return -EINVAL;
356 356
357 pdata = timer->pdev->dev.platform_data;
357 if (!pdata->needs_manual_reset) 358 if (!pdata->needs_manual_reset)
358 rate = clk_get_rate(timer->fclk); 359 rate = clk_get_rate(timer->fclk);
359 360
diff --git a/arch/arm/plat-omap/include/plat/board.h b/arch/arm/plat-omap/include/plat/board.h
index d5eb4c87db9d..4814c5b65306 100644
--- a/arch/arm/plat-omap/include/plat/board.h
+++ b/arch/arm/plat-omap/include/plat/board.h
@@ -91,6 +91,8 @@ struct omap_usb_config {
91 u32 (*usb0_init)(unsigned nwires, unsigned is_device); 91 u32 (*usb0_init)(unsigned nwires, unsigned is_device);
92 u32 (*usb1_init)(unsigned nwires); 92 u32 (*usb1_init)(unsigned nwires);
93 u32 (*usb2_init)(unsigned nwires, unsigned alt_pingroup); 93 u32 (*usb2_init)(unsigned nwires, unsigned alt_pingroup);
94
95 int (*ocpi_enable)(void);
94}; 96};
95 97
96struct omap_lcd_config { 98struct omap_lcd_config {
diff --git a/arch/arm/plat-omap/include/plat/clkdev_omap.h b/arch/arm/plat-omap/include/plat/clkdev_omap.h
index b299b8d201c8..d0ed8c443a63 100644
--- a/arch/arm/plat-omap/include/plat/clkdev_omap.h
+++ b/arch/arm/plat-omap/include/plat/clkdev_omap.h
@@ -34,8 +34,7 @@ struct omap_clk {
34#define CK_243X (1 << 5) /* 243x, 253x */ 34#define CK_243X (1 << 5) /* 243x, 253x */
35#define CK_3430ES1 (1 << 6) /* 34xxES1 only */ 35#define CK_3430ES1 (1 << 6) /* 34xxES1 only */
36#define CK_3430ES2PLUS (1 << 7) /* 34xxES2, ES3, non-Sitara 35xx only */ 36#define CK_3430ES2PLUS (1 << 7) /* 34xxES2, ES3, non-Sitara 35xx only */
37#define CK_3505 (1 << 8) 37#define CK_AM35XX (1 << 9) /* Sitara AM35xx */
38#define CK_3517 (1 << 9)
39#define CK_36XX (1 << 10) /* 36xx/37xx-specific clocks */ 38#define CK_36XX (1 << 10) /* 36xx/37xx-specific clocks */
40#define CK_443X (1 << 11) 39#define CK_443X (1 << 11)
41#define CK_TI816X (1 << 12) 40#define CK_TI816X (1 << 12)
@@ -44,7 +43,6 @@ struct omap_clk {
44 43
45 44
46#define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS) 45#define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS)
47#define CK_AM35XX (CK_3505 | CK_3517) /* all Sitara AM35xx */
48#define CK_3XXX (CK_34XX | CK_AM35XX | CK_36XX) 46#define CK_3XXX (CK_34XX | CK_AM35XX | CK_36XX)
49 47
50 48
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h
index 240a7b9fd946..d0ef57c1d71b 100644
--- a/arch/arm/plat-omap/include/plat/clock.h
+++ b/arch/arm/plat-omap/include/plat/clock.h
@@ -272,8 +272,6 @@ struct clk {
272#endif 272#endif
273}; 273};
274 274
275struct cpufreq_frequency_table;
276
277struct clk_functions { 275struct clk_functions {
278 int (*clk_enable)(struct clk *clk); 276 int (*clk_enable)(struct clk *clk);
279 void (*clk_disable)(struct clk *clk); 277 void (*clk_disable)(struct clk *clk);
@@ -283,10 +281,6 @@ struct clk_functions {
283 void (*clk_allow_idle)(struct clk *clk); 281 void (*clk_allow_idle)(struct clk *clk);
284 void (*clk_deny_idle)(struct clk *clk); 282 void (*clk_deny_idle)(struct clk *clk);
285 void (*clk_disable_unused)(struct clk *clk); 283 void (*clk_disable_unused)(struct clk *clk);
286#ifdef CONFIG_CPU_FREQ
287 void (*clk_init_cpufreq_table)(struct cpufreq_frequency_table **);
288 void (*clk_exit_cpufreq_table)(struct cpufreq_frequency_table **);
289#endif
290}; 284};
291 285
292extern int mpurate; 286extern int mpurate;
@@ -301,10 +295,6 @@ extern void recalculate_root_clocks(void);
301extern unsigned long followparent_recalc(struct clk *clk); 295extern unsigned long followparent_recalc(struct clk *clk);
302extern void clk_enable_init_clocks(void); 296extern void clk_enable_init_clocks(void);
303unsigned long omap_fixed_divisor_recalc(struct clk *clk); 297unsigned long omap_fixed_divisor_recalc(struct clk *clk);
304#ifdef CONFIG_CPU_FREQ
305extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
306extern void clk_exit_cpufreq_table(struct cpufreq_frequency_table **table);
307#endif
308extern struct clk *omap_clk_get_by_name(const char *name); 298extern struct clk *omap_clk_get_by_name(const char *name);
309extern int omap_clk_enable_autoidle_all(void); 299extern int omap_clk_enable_autoidle_all(void);
310extern int omap_clk_disable_autoidle_all(void); 300extern int omap_clk_disable_autoidle_all(void);
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index b4d7ec3fbfbe..a557b8484e6c 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -32,6 +32,8 @@
32 32
33extern int __init omap_init_clocksource_32k(void); 33extern int __init omap_init_clocksource_32k(void);
34 34
35extern void __init omap_check_revision(void);
36
35extern void omap_reserve(void); 37extern void omap_reserve(void);
36extern int omap_dss_reset(struct omap_hwmod *); 38extern int omap_dss_reset(struct omap_hwmod *);
37 39
diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h
index dc6a86bf2172..4bdf14ec6747 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -445,6 +445,7 @@ IS_OMAP_TYPE(3517, 0x3517)
445 445
446#define OMAP446X_CLASS 0x44600044 446#define OMAP446X_CLASS 0x44600044
447#define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8)) 447#define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8))
448#define OMAP4460_REV_ES1_1 (OMAP446X_CLASS | (0x11 << 8))
448 449
449#define OMAP447X_CLASS 0x44700044 450#define OMAP447X_CLASS 0x44700044
450#define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8)) 451#define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8))
diff --git a/arch/arm/plat-omap/include/plat/dma.h b/arch/arm/plat-omap/include/plat/dma.h
index dc562a5c0a8a..42afb4c45517 100644
--- a/arch/arm/plat-omap/include/plat/dma.h
+++ b/arch/arm/plat-omap/include/plat/dma.h
@@ -442,6 +442,7 @@ struct omap_system_dma_plat_info {
442 u32 (*dma_read)(int reg, int lch); 442 u32 (*dma_read)(int reg, int lch);
443}; 443};
444 444
445extern void __init omap_init_consistent_dma_size(void);
445extern void omap_set_dma_priority(int lch, int dst_port, int priority); 446extern void omap_set_dma_priority(int lch, int dst_port, int priority);
446extern int omap_request_dma(int dev_id, const char *dev_name, 447extern int omap_request_dma(int dev_id, const char *dev_name,
447 void (*callback)(int lch, u16 ch_status, void *data), 448 void (*callback)(int lch, u16 ch_status, void *data),
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index 9418f00b6c38..bdf871a84d62 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -259,7 +259,7 @@ struct omap_dm_timer {
259 unsigned long phys_base; 259 unsigned long phys_base;
260 int id; 260 int id;
261 int irq; 261 int irq;
262 struct clk *iclk, *fclk; 262 struct clk *fclk;
263 263
264 void __iomem *io_base; 264 void __iomem *io_base;
265 void __iomem *sys_stat; /* TISTAT timer status */ 265 void __iomem *sys_stat; /* TISTAT timer status */
@@ -316,12 +316,12 @@ static inline void __omap_dm_timer_init_regs(struct omap_dm_timer *timer)
316 OMAP_TIMER_V1_SYS_STAT_OFFSET; 316 OMAP_TIMER_V1_SYS_STAT_OFFSET;
317 timer->irq_stat = timer->io_base + OMAP_TIMER_V1_STAT_OFFSET; 317 timer->irq_stat = timer->io_base + OMAP_TIMER_V1_STAT_OFFSET;
318 timer->irq_ena = timer->io_base + OMAP_TIMER_V1_INT_EN_OFFSET; 318 timer->irq_ena = timer->io_base + OMAP_TIMER_V1_INT_EN_OFFSET;
319 timer->irq_dis = 0; 319 timer->irq_dis = NULL;
320 timer->pend = timer->io_base + _OMAP_TIMER_WRITE_PEND_OFFSET; 320 timer->pend = timer->io_base + _OMAP_TIMER_WRITE_PEND_OFFSET;
321 timer->func_base = timer->io_base; 321 timer->func_base = timer->io_base;
322 } else { 322 } else {
323 timer->revision = 2; 323 timer->revision = 2;
324 timer->sys_stat = 0; 324 timer->sys_stat = NULL;
325 timer->irq_stat = timer->io_base + OMAP_TIMER_V2_IRQSTATUS; 325 timer->irq_stat = timer->io_base + OMAP_TIMER_V2_IRQSTATUS;
326 timer->irq_ena = timer->io_base + OMAP_TIMER_V2_IRQENABLE_SET; 326 timer->irq_ena = timer->io_base + OMAP_TIMER_V2_IRQENABLE_SET;
327 timer->irq_dis = timer->io_base + OMAP_TIMER_V2_IRQENABLE_CLR; 327 timer->irq_dis = timer->io_base + OMAP_TIMER_V2_IRQENABLE_CLR;
diff --git a/arch/arm/plat-omap/include/plat/hdq1w.h b/arch/arm/plat-omap/include/plat/hdq1w.h
new file mode 100644
index 000000000000..0c1efc846d8d
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/hdq1w.h
@@ -0,0 +1,36 @@
1/*
2 * Shared macros and function prototypes for the HDQ1W/1-wire IP block
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 */
21#ifndef ARCH_ARM_MACH_OMAP2_HDQ1W_H
22#define ARCH_ARM_MACH_OMAP2_HDQ1W_H
23
24#include <plat/omap_hwmod.h>
25
26/*
27 * XXX A future cleanup patch should modify
28 * drivers/w1/masters/omap_hdq.c to use these macros
29 */
30#define HDQ_CTRL_STATUS_OFFSET 0x0c
31#define HDQ_CTRL_STATUS_CLOCKENABLE_SHIFT 5
32
33
34extern int omap_hdq1w_reset(struct omap_hwmod *oh);
35
36#endif
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
index 7a38750c0079..3e7ae0f0215f 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -16,6 +16,7 @@
16#include <linux/mmc/host.h> 16#include <linux/mmc/host.h>
17 17
18#include <plat/board.h> 18#include <plat/board.h>
19#include <plat/omap_hwmod.h>
19 20
20#define OMAP15XX_NR_MMC 1 21#define OMAP15XX_NR_MMC 1
21#define OMAP16XX_NR_MMC 2 22#define OMAP16XX_NR_MMC 2
@@ -195,4 +196,7 @@ static inline int omap_mmc_add(const char *name, int id, unsigned long base,
195} 196}
196 197
197#endif 198#endif
199
200extern int omap_msdi_reset(struct omap_hwmod *oh);
201
198#endif 202#endif
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
index 9ff444469f3d..1a52725ffcf2 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -65,7 +65,6 @@ struct omap_uart_port_info {
65 bool dma_enabled; /* To specify DMA Mode */ 65 bool dma_enabled; /* To specify DMA Mode */
66 unsigned int uartclk; /* UART clock rate */ 66 unsigned int uartclk; /* UART clock rate */
67 upf_t flags; /* UPF_* flags */ 67 upf_t flags; /* UPF_* flags */
68 u32 errata;
69 unsigned int dma_rx_buf_size; 68 unsigned int dma_rx_buf_size;
70 unsigned int dma_rx_timeout; 69 unsigned int dma_rx_timeout;
71 unsigned int autosuspend_timeout; 70 unsigned int autosuspend_timeout;
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 8070145ccb98..c835b7194ff5 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -213,11 +213,17 @@ struct omap_hwmod_addr_space {
213 */ 213 */
214#define OCP_USER_MPU (1 << 0) 214#define OCP_USER_MPU (1 << 0)
215#define OCP_USER_SDMA (1 << 1) 215#define OCP_USER_SDMA (1 << 1)
216#define OCP_USER_DSP (1 << 2)
217#define OCP_USER_IVA (1 << 3)
216 218
217/* omap_hwmod_ocp_if.flags bits */ 219/* omap_hwmod_ocp_if.flags bits */
218#define OCPIF_SWSUP_IDLE (1 << 0) 220#define OCPIF_SWSUP_IDLE (1 << 0)
219#define OCPIF_CAN_BURST (1 << 1) 221#define OCPIF_CAN_BURST (1 << 1)
220 222
223/* omap_hwmod_ocp_if._int_flags possibilities */
224#define _OCPIF_INT_FLAGS_REGISTERED (1 << 0)
225
226
221/** 227/**
222 * struct omap_hwmod_ocp_if - OCP interface data 228 * struct omap_hwmod_ocp_if - OCP interface data
223 * @master: struct omap_hwmod that initiates OCP transactions on this link 229 * @master: struct omap_hwmod that initiates OCP transactions on this link
@@ -229,6 +235,7 @@ struct omap_hwmod_addr_space {
229 * @width: OCP data width 235 * @width: OCP data width
230 * @user: initiators using this interface (see OCP_USER_* macros above) 236 * @user: initiators using this interface (see OCP_USER_* macros above)
231 * @flags: OCP interface flags (see OCPIF_* macros above) 237 * @flags: OCP interface flags (see OCPIF_* macros above)
238 * @_int_flags: internal flags (see _OCPIF_INT_FLAGS* macros above)
232 * 239 *
233 * It may also be useful to add a tag_cnt field for OCP2.x devices. 240 * It may also be useful to add a tag_cnt field for OCP2.x devices.
234 * 241 *
@@ -247,6 +254,7 @@ struct omap_hwmod_ocp_if {
247 u8 width; 254 u8 width;
248 u8 user; 255 u8 user;
249 u8 flags; 256 u8 flags;
257 u8 _int_flags;
250}; 258};
251 259
252 260
@@ -305,6 +313,7 @@ struct omap_hwmod_sysc_fields {
305 * @rev_offs: IP block revision register offset (from module base addr) 313 * @rev_offs: IP block revision register offset (from module base addr)
306 * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr) 314 * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr)
307 * @syss_offs: OCP_SYSSTATUS register offset (from module base addr) 315 * @syss_offs: OCP_SYSSTATUS register offset (from module base addr)
316 * @srst_udelay: Delay needed after doing a softreset in usecs
308 * @idlemodes: One or more of {SIDLE,MSTANDBY}_{OFF,FORCE,SMART} 317 * @idlemodes: One or more of {SIDLE,MSTANDBY}_{OFF,FORCE,SMART}
309 * @sysc_flags: SYS{C,S}_HAS* flags indicating SYSCONFIG bits supported 318 * @sysc_flags: SYS{C,S}_HAS* flags indicating SYSCONFIG bits supported
310 * @clockact: the default value of the module CLOCKACTIVITY bits 319 * @clockact: the default value of the module CLOCKACTIVITY bits
@@ -326,13 +335,14 @@ struct omap_hwmod_sysc_fields {
326 * then this field has to be populated with the correct offset structure. 335 * then this field has to be populated with the correct offset structure.
327 */ 336 */
328struct omap_hwmod_class_sysconfig { 337struct omap_hwmod_class_sysconfig {
329 u16 rev_offs; 338 u32 rev_offs;
330 u16 sysc_offs; 339 u32 sysc_offs;
331 u16 syss_offs; 340 u32 syss_offs;
332 u16 sysc_flags; 341 u16 sysc_flags;
342 struct omap_hwmod_sysc_fields *sysc_fields;
343 u8 srst_udelay;
333 u8 idlemodes; 344 u8 idlemodes;
334 u8 clockact; 345 u8 clockact;
335 struct omap_hwmod_sysc_fields *sysc_fields;
336}; 346};
337 347
338/** 348/**
@@ -474,6 +484,16 @@ struct omap_hwmod_class {
474}; 484};
475 485
476/** 486/**
487 * struct omap_hwmod_link - internal structure linking hwmods with ocp_ifs
488 * @ocp_if: OCP interface structure record pointer
489 * @node: list_head pointing to next struct omap_hwmod_link in a list
490 */
491struct omap_hwmod_link {
492 struct omap_hwmod_ocp_if *ocp_if;
493 struct list_head node;
494};
495
496/**
477 * struct omap_hwmod - integration data for OMAP hardware "modules" (IP blocks) 497 * struct omap_hwmod - integration data for OMAP hardware "modules" (IP blocks)
478 * @name: name of the hwmod 498 * @name: name of the hwmod
479 * @class: struct omap_hwmod_class * to the class of this hwmod 499 * @class: struct omap_hwmod_class * to the class of this hwmod
@@ -485,12 +505,10 @@ struct omap_hwmod_class {
485 * @_clk: pointer to the main struct clk (filled in at runtime) 505 * @_clk: pointer to the main struct clk (filled in at runtime)
486 * @opt_clks: other device clocks that drivers can request (0..*) 506 * @opt_clks: other device clocks that drivers can request (0..*)
487 * @voltdm: pointer to voltage domain (filled in at runtime) 507 * @voltdm: pointer to voltage domain (filled in at runtime)
488 * @masters: ptr to array of OCP ifs that this hwmod can initiate on
489 * @slaves: ptr to array of OCP ifs that this hwmod can respond on
490 * @dev_attr: arbitrary device attributes that can be passed to the driver 508 * @dev_attr: arbitrary device attributes that can be passed to the driver
491 * @_sysc_cache: internal-use hwmod flags 509 * @_sysc_cache: internal-use hwmod flags
492 * @_mpu_rt_va: cached register target start address (internal use) 510 * @_mpu_rt_va: cached register target start address (internal use)
493 * @_mpu_port_index: cached MPU register target slave ID (internal use) 511 * @_mpu_port: cached MPU register target slave (internal use)
494 * @opt_clks_cnt: number of @opt_clks 512 * @opt_clks_cnt: number of @opt_clks
495 * @master_cnt: number of @master entries 513 * @master_cnt: number of @master entries
496 * @slaves_cnt: number of @slave entries 514 * @slaves_cnt: number of @slave entries
@@ -509,6 +527,8 @@ struct omap_hwmod_class {
509 * 527 *
510 * Parameter names beginning with an underscore are managed internally by 528 * Parameter names beginning with an underscore are managed internally by
511 * the omap_hwmod code and should not be set during initialization. 529 * the omap_hwmod code and should not be set during initialization.
530 *
531 * @masters and @slaves are now deprecated.
512 */ 532 */
513struct omap_hwmod { 533struct omap_hwmod {
514 const char *name; 534 const char *name;
@@ -527,15 +547,15 @@ struct omap_hwmod {
527 struct omap_hwmod_opt_clk *opt_clks; 547 struct omap_hwmod_opt_clk *opt_clks;
528 char *clkdm_name; 548 char *clkdm_name;
529 struct clockdomain *clkdm; 549 struct clockdomain *clkdm;
530 struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ 550 struct list_head master_ports; /* connect to *_IA */
531 struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */ 551 struct list_head slave_ports; /* connect to *_TA */
532 void *dev_attr; 552 void *dev_attr;
533 u32 _sysc_cache; 553 u32 _sysc_cache;
534 void __iomem *_mpu_rt_va; 554 void __iomem *_mpu_rt_va;
535 spinlock_t _lock; 555 spinlock_t _lock;
536 struct list_head node; 556 struct list_head node;
557 struct omap_hwmod_ocp_if *_mpu_port;
537 u16 flags; 558 u16 flags;
538 u8 _mpu_port_index;
539 u8 response_lat; 559 u8 response_lat;
540 u8 rst_lines_cnt; 560 u8 rst_lines_cnt;
541 u8 opt_clks_cnt; 561 u8 opt_clks_cnt;
@@ -547,7 +567,6 @@ struct omap_hwmod {
547 u8 _postsetup_state; 567 u8 _postsetup_state;
548}; 568};
549 569
550int omap_hwmod_register(struct omap_hwmod **ohs);
551struct omap_hwmod *omap_hwmod_lookup(const char *name); 570struct omap_hwmod *omap_hwmod_lookup(const char *name);
552int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data), 571int omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data),
553 void *data); 572 void *data);
@@ -579,6 +598,8 @@ int omap_hwmod_softreset(struct omap_hwmod *oh);
579 598
580int omap_hwmod_count_resources(struct omap_hwmod *oh); 599int omap_hwmod_count_resources(struct omap_hwmod *oh);
581int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res); 600int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res);
601int omap_hwmod_get_resource_byname(struct omap_hwmod *oh, unsigned int type,
602 const char *name, struct resource *res);
582 603
583struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh); 604struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh);
584void __iomem *omap_hwmod_get_mpu_rt_va(struct omap_hwmod *oh); 605void __iomem *omap_hwmod_get_mpu_rt_va(struct omap_hwmod *oh);
@@ -617,4 +638,6 @@ extern int omap2430_hwmod_init(void);
617extern int omap3xxx_hwmod_init(void); 638extern int omap3xxx_hwmod_init(void);
618extern int omap44xx_hwmod_init(void); 639extern int omap44xx_hwmod_init(void);
619 640
641extern int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois);
642
620#endif 643#endif
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index d50cbc6385bd..c490240bb82c 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -475,13 +475,11 @@ static int omap_device_count_resources(struct omap_device *od)
475static int omap_device_fill_resources(struct omap_device *od, 475static int omap_device_fill_resources(struct omap_device *od,
476 struct resource *res) 476 struct resource *res)
477{ 477{
478 int c = 0;
479 int i, r; 478 int i, r;
480 479
481 for (i = 0; i < od->hwmods_cnt; i++) { 480 for (i = 0; i < od->hwmods_cnt; i++) {
482 r = omap_hwmod_fill_resources(od->hwmods[i], res); 481 r = omap_hwmod_fill_resources(od->hwmods[i], res);
483 res += r; 482 res += r;
484 c += r;
485 } 483 }
486 484
487 return 0; 485 return 0;
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index eec98afa0f83..477363c163ec 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -196,8 +196,8 @@ static void __init omap_map_sram(void)
196 * Looks like we need to preserve some bootloader code at the 196 * Looks like we need to preserve some bootloader code at the
197 * beginning of SRAM for jumping to flash for reboot to work... 197 * beginning of SRAM for jumping to flash for reboot to work...
198 */ 198 */
199 memset((void *)omap_sram_base + SRAM_BOOTLOADER_SZ, 0, 199 memset_io(omap_sram_base + SRAM_BOOTLOADER_SZ, 0,
200 omap_sram_size - SRAM_BOOTLOADER_SZ); 200 omap_sram_size - SRAM_BOOTLOADER_SZ);
201} 201}
202 202
203/* 203/*
@@ -348,7 +348,6 @@ u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32 f, u32 inc,
348 sdrc_actim_ctrl_b_1, sdrc_mr_1); 348 sdrc_actim_ctrl_b_1, sdrc_mr_1);
349} 349}
350 350
351#ifdef CONFIG_PM
352void omap3_sram_restore_context(void) 351void omap3_sram_restore_context(void)
353{ 352{
354 omap_sram_ceil = omap_sram_base + omap_sram_size; 353 omap_sram_ceil = omap_sram_base + omap_sram_size;
@@ -358,17 +357,18 @@ void omap3_sram_restore_context(void)
358 omap3_sram_configure_core_dpll_sz); 357 omap3_sram_configure_core_dpll_sz);
359 omap_push_sram_idle(); 358 omap_push_sram_idle();
360} 359}
361#endif /* CONFIG_PM */
362
363#endif /* CONFIG_ARCH_OMAP3 */
364 360
365static inline int omap34xx_sram_init(void) 361static inline int omap34xx_sram_init(void)
366{ 362{
367#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
368 omap3_sram_restore_context(); 363 omap3_sram_restore_context();
369#endif
370 return 0; 364 return 0;
371} 365}
366#else
367static inline int omap34xx_sram_init(void)
368{
369 return 0;
370}
371#endif /* CONFIG_ARCH_OMAP3 */
372 372
373static inline int am33xx_sram_init(void) 373static inline int am33xx_sram_init(void)
374{ 374{
diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c
index d2bbfd1cb0b5..daa0327381b5 100644
--- a/arch/arm/plat-omap/usb.c
+++ b/arch/arm/plat-omap/usb.c
@@ -31,15 +31,12 @@
31 31
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33 33
34#include "../mach-omap2/common.h"
35
36#ifdef CONFIG_ARCH_OMAP_OTG 34#ifdef CONFIG_ARCH_OMAP_OTG
37 35
38void __init 36void __init
39omap_otg_init(struct omap_usb_config *config) 37omap_otg_init(struct omap_usb_config *config)
40{ 38{
41 u32 syscon; 39 u32 syscon;
42 int status;
43 int alt_pingroup = 0; 40 int alt_pingroup = 0;
44 41
45 /* NOTE: no bus or clock setup (yet?) */ 42 /* NOTE: no bus or clock setup (yet?) */
@@ -104,6 +101,7 @@ omap_otg_init(struct omap_usb_config *config)
104#ifdef CONFIG_USB_GADGET_OMAP 101#ifdef CONFIG_USB_GADGET_OMAP
105 if (config->otg || config->register_dev) { 102 if (config->otg || config->register_dev) {
106 struct platform_device *udc_device = config->udc_device; 103 struct platform_device *udc_device = config->udc_device;
104 int status;
107 105
108 syscon &= ~DEV_IDLE_EN; 106 syscon &= ~DEV_IDLE_EN;
109 udc_device->dev.platform_data = config; 107 udc_device->dev.platform_data = config;
@@ -116,6 +114,7 @@ omap_otg_init(struct omap_usb_config *config)
116#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 114#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
117 if (config->otg || config->register_host) { 115 if (config->otg || config->register_host) {
118 struct platform_device *ohci_device = config->ohci_device; 116 struct platform_device *ohci_device = config->ohci_device;
117 int status;
119 118
120 syscon &= ~HST_IDLE_EN; 119 syscon &= ~HST_IDLE_EN;
121 ohci_device->dev.platform_data = config; 120 ohci_device->dev.platform_data = config;
@@ -128,6 +127,7 @@ omap_otg_init(struct omap_usb_config *config)
128#ifdef CONFIG_USB_OTG 127#ifdef CONFIG_USB_OTG
129 if (config->otg) { 128 if (config->otg) {
130 struct platform_device *otg_device = config->otg_device; 129 struct platform_device *otg_device = config->otg_device;
130 int status;
131 131
132 syscon &= ~OTG_IDLE_EN; 132 syscon &= ~OTG_IDLE_EN;
133 otg_device->dev.platform_data = config; 133 otg_device->dev.platform_data = config;
@@ -138,8 +138,6 @@ omap_otg_init(struct omap_usb_config *config)
138#endif 138#endif
139 pr_debug("OTG_SYSCON_1 = %08x\n", omap_readl(OTG_SYSCON_1)); 139 pr_debug("OTG_SYSCON_1 = %08x\n", omap_readl(OTG_SYSCON_1));
140 omap_writel(syscon, OTG_SYSCON_1); 140 omap_writel(syscon, OTG_SYSCON_1);
141
142 status = 0;
143} 141}
144 142
145#else 143#else
diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c
index 10d160888133..af95af257301 100644
--- a/arch/arm/plat-orion/gpio.c
+++ b/arch/arm/plat-orion/gpio.c
@@ -16,6 +16,7 @@
16#include <linux/bitops.h> 16#include <linux/bitops.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/leds.h>
19 20
20/* 21/*
21 * GPIO unit register offsets. 22 * GPIO unit register offsets.
@@ -289,12 +290,34 @@ void orion_gpio_set_blink(unsigned pin, int blink)
289 return; 290 return;
290 291
291 spin_lock_irqsave(&ochip->lock, flags); 292 spin_lock_irqsave(&ochip->lock, flags);
292 __set_level(ochip, pin, 0); 293 __set_level(ochip, pin & 31, 0);
293 __set_blinking(ochip, pin, blink); 294 __set_blinking(ochip, pin & 31, blink);
294 spin_unlock_irqrestore(&ochip->lock, flags); 295 spin_unlock_irqrestore(&ochip->lock, flags);
295} 296}
296EXPORT_SYMBOL(orion_gpio_set_blink); 297EXPORT_SYMBOL(orion_gpio_set_blink);
297 298
299#define ORION_BLINK_HALF_PERIOD 100 /* ms */
300
301int orion_gpio_led_blink_set(unsigned gpio, int state,
302 unsigned long *delay_on, unsigned long *delay_off)
303{
304
305 if (delay_on && delay_off && !*delay_on && !*delay_off)
306 *delay_on = *delay_off = ORION_BLINK_HALF_PERIOD;
307
308 switch (state) {
309 case GPIO_LED_NO_BLINK_LOW:
310 case GPIO_LED_NO_BLINK_HIGH:
311 orion_gpio_set_blink(gpio, 0);
312 gpio_set_value(gpio, state);
313 break;
314 case GPIO_LED_BLINK:
315 orion_gpio_set_blink(gpio, 1);
316 }
317 return 0;
318}
319EXPORT_SYMBOL_GPL(orion_gpio_led_blink_set);
320
298 321
299/***************************************************************************** 322/*****************************************************************************
300 * Orion GPIO IRQ 323 * Orion GPIO IRQ
diff --git a/arch/arm/plat-orion/include/plat/gpio.h b/arch/arm/plat-orion/include/plat/gpio.h
index 3abf30428bee..bec0c98ce41f 100644
--- a/arch/arm/plat-orion/include/plat/gpio.h
+++ b/arch/arm/plat-orion/include/plat/gpio.h
@@ -19,6 +19,8 @@
19 */ 19 */
20void orion_gpio_set_unused(unsigned pin); 20void orion_gpio_set_unused(unsigned pin);
21void orion_gpio_set_blink(unsigned pin, int blink); 21void orion_gpio_set_blink(unsigned pin, int blink);
22int orion_gpio_led_blink_set(unsigned gpio, int state,
23 unsigned long *delay_on, unsigned long *delay_off);
22 24
23#define GPIO_INPUT_OK (1 << 0) 25#define GPIO_INPUT_OK (1 << 0)
24#define GPIO_OUTPUT_OK (1 << 1) 26#define GPIO_OUTPUT_OK (1 << 1)
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 71553f410016..a0ffc77da809 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -302,6 +302,7 @@ comment "Power management"
302config SAMSUNG_PM_DEBUG 302config SAMSUNG_PM_DEBUG
303 bool "S3C2410 PM Suspend debug" 303 bool "S3C2410 PM Suspend debug"
304 depends on PM 304 depends on PM
305 select DEBUG_LL
305 help 306 help
306 Say Y here if you want verbose debugging from the PM Suspend and 307 Say Y here if you want verbose debugging from the PM Suspend and
307 Resume code. See <file:Documentation/arm/Samsung-S3C24XX/Suspend.txt> 308 Resume code. See <file:Documentation/arm/Samsung-S3C24XX/Suspend.txt>
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 8b928f9bc1c3..1d214cb9d770 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -30,6 +30,7 @@
30#include <linux/mmc/host.h> 30#include <linux/mmc/host.h>
31#include <linux/ioport.h> 31#include <linux/ioport.h>
32#include <linux/platform_data/s3c-hsudc.h> 32#include <linux/platform_data/s3c-hsudc.h>
33#include <linux/platform_data/s3c-hsotg.h>
33 34
34#include <asm/irq.h> 35#include <asm/irq.h>
35#include <asm/pmu.h> 36#include <asm/pmu.h>
@@ -57,7 +58,6 @@
57#include <plat/sdhci.h> 58#include <plat/sdhci.h>
58#include <plat/ts.h> 59#include <plat/ts.h>
59#include <plat/udc.h> 60#include <plat/udc.h>
60#include <plat/udc-hs.h>
61#include <plat/usb-control.h> 61#include <plat/usb-control.h>
62#include <plat/usb-phy.h> 62#include <plat/usb-phy.h>
63#include <plat/regs-iic.h> 63#include <plat/regs-iic.h>
@@ -272,16 +272,8 @@ struct platform_device s5p_device_fimc3 = {
272 272
273#ifdef CONFIG_S5P_DEV_G2D 273#ifdef CONFIG_S5P_DEV_G2D
274static struct resource s5p_g2d_resource[] = { 274static struct resource s5p_g2d_resource[] = {
275 [0] = { 275 [0] = DEFINE_RES_MEM(S5P_PA_G2D, SZ_4K),
276 .start = S5P_PA_G2D, 276 [1] = DEFINE_RES_IRQ(IRQ_2D),
277 .end = S5P_PA_G2D + SZ_4K - 1,
278 .flags = IORESOURCE_MEM,
279 },
280 [1] = {
281 .start = IRQ_2D,
282 .end = IRQ_2D,
283 .flags = IORESOURCE_IRQ,
284 },
285}; 277};
286 278
287struct platform_device s5p_device_g2d = { 279struct platform_device s5p_device_g2d = {
@@ -370,7 +362,6 @@ struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata = {
370 .max_width = 4, 362 .max_width = 4,
371 .host_caps = (MMC_CAP_4_BIT_DATA | 363 .host_caps = (MMC_CAP_4_BIT_DATA |
372 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), 364 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
373 .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
374}; 365};
375 366
376struct platform_device s3c_device_hsmmc0 = { 367struct platform_device s3c_device_hsmmc0 = {
@@ -401,7 +392,6 @@ struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata = {
401 .max_width = 4, 392 .max_width = 4,
402 .host_caps = (MMC_CAP_4_BIT_DATA | 393 .host_caps = (MMC_CAP_4_BIT_DATA |
403 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), 394 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
404 .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
405}; 395};
406 396
407struct platform_device s3c_device_hsmmc1 = { 397struct platform_device s3c_device_hsmmc1 = {
@@ -434,7 +424,6 @@ struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata = {
434 .max_width = 4, 424 .max_width = 4,
435 .host_caps = (MMC_CAP_4_BIT_DATA | 425 .host_caps = (MMC_CAP_4_BIT_DATA |
436 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), 426 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
437 .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
438}; 427};
439 428
440struct platform_device s3c_device_hsmmc2 = { 429struct platform_device s3c_device_hsmmc2 = {
@@ -465,7 +454,6 @@ struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata = {
465 .max_width = 4, 454 .max_width = 4,
466 .host_caps = (MMC_CAP_4_BIT_DATA | 455 .host_caps = (MMC_CAP_4_BIT_DATA |
467 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), 456 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
468 .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
469}; 457};
470 458
471struct platform_device s3c_device_hsmmc3 = { 459struct platform_device s3c_device_hsmmc3 = {
diff --git a/arch/arm/plat-samsung/include/plat/regs-usb-hsotg.h b/arch/arm/plat-samsung/include/plat/regs-usb-hsotg.h
deleted file mode 100644
index dc90f5ede88f..000000000000
--- a/arch/arm/plat-samsung/include/plat/regs-usb-hsotg.h
+++ /dev/null
@@ -1,379 +0,0 @@
1/* arch/arm/plat-s3c/include/plat/regs-usb-hsotg.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C - USB2.0 Highspeed/OtG device block registers
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef __PLAT_S3C64XX_REGS_USB_HSOTG_H
16#define __PLAT_S3C64XX_REGS_USB_HSOTG_H __FILE__
17
18#define S3C_HSOTG_REG(x) (x)
19
20#define S3C_GOTGCTL S3C_HSOTG_REG(0x000)
21#define S3C_GOTGCTL_BSESVLD (1 << 19)
22#define S3C_GOTGCTL_ASESVLD (1 << 18)
23#define S3C_GOTGCTL_DBNC_SHORT (1 << 17)
24#define S3C_GOTGCTL_CONID_B (1 << 16)
25#define S3C_GOTGCTL_DEVHNPEN (1 << 11)
26#define S3C_GOTGCTL_HSSETHNPEN (1 << 10)
27#define S3C_GOTGCTL_HNPREQ (1 << 9)
28#define S3C_GOTGCTL_HSTNEGSCS (1 << 8)
29#define S3C_GOTGCTL_SESREQ (1 << 1)
30#define S3C_GOTGCTL_SESREQSCS (1 << 0)
31
32#define S3C_GOTGINT S3C_HSOTG_REG(0x004)
33#define S3C_GOTGINT_DbnceDone (1 << 19)
34#define S3C_GOTGINT_ADevTOUTChg (1 << 18)
35#define S3C_GOTGINT_HstNegDet (1 << 17)
36#define S3C_GOTGINT_HstnegSucStsChng (1 << 9)
37#define S3C_GOTGINT_SesReqSucStsChng (1 << 8)
38#define S3C_GOTGINT_SesEndDet (1 << 2)
39
40#define S3C_GAHBCFG S3C_HSOTG_REG(0x008)
41#define S3C_GAHBCFG_PTxFEmpLvl (1 << 8)
42#define S3C_GAHBCFG_NPTxFEmpLvl (1 << 7)
43#define S3C_GAHBCFG_DMAEn (1 << 5)
44#define S3C_GAHBCFG_HBstLen_MASK (0xf << 1)
45#define S3C_GAHBCFG_HBstLen_SHIFT (1)
46#define S3C_GAHBCFG_HBstLen_Single (0x0 << 1)
47#define S3C_GAHBCFG_HBstLen_Incr (0x1 << 1)
48#define S3C_GAHBCFG_HBstLen_Incr4 (0x3 << 1)
49#define S3C_GAHBCFG_HBstLen_Incr8 (0x5 << 1)
50#define S3C_GAHBCFG_HBstLen_Incr16 (0x7 << 1)
51#define S3C_GAHBCFG_GlblIntrEn (1 << 0)
52
53#define S3C_GUSBCFG S3C_HSOTG_REG(0x00C)
54#define S3C_GUSBCFG_PHYLPClkSel (1 << 15)
55#define S3C_GUSBCFG_HNPCap (1 << 9)
56#define S3C_GUSBCFG_SRPCap (1 << 8)
57#define S3C_GUSBCFG_PHYIf16 (1 << 3)
58#define S3C_GUSBCFG_TOutCal_MASK (0x7 << 0)
59#define S3C_GUSBCFG_TOutCal_SHIFT (0)
60#define S3C_GUSBCFG_TOutCal_LIMIT (0x7)
61#define S3C_GUSBCFG_TOutCal(_x) ((_x) << 0)
62
63#define S3C_GRSTCTL S3C_HSOTG_REG(0x010)
64
65#define S3C_GRSTCTL_AHBIdle (1 << 31)
66#define S3C_GRSTCTL_DMAReq (1 << 30)
67#define S3C_GRSTCTL_TxFNum_MASK (0x1f << 6)
68#define S3C_GRSTCTL_TxFNum_SHIFT (6)
69#define S3C_GRSTCTL_TxFNum_LIMIT (0x1f)
70#define S3C_GRSTCTL_TxFNum(_x) ((_x) << 6)
71#define S3C_GRSTCTL_TxFFlsh (1 << 5)
72#define S3C_GRSTCTL_RxFFlsh (1 << 4)
73#define S3C_GRSTCTL_INTknQFlsh (1 << 3)
74#define S3C_GRSTCTL_FrmCntrRst (1 << 2)
75#define S3C_GRSTCTL_HSftRst (1 << 1)
76#define S3C_GRSTCTL_CSftRst (1 << 0)
77
78#define S3C_GINTSTS S3C_HSOTG_REG(0x014)
79#define S3C_GINTMSK S3C_HSOTG_REG(0x018)
80
81#define S3C_GINTSTS_WkUpInt (1 << 31)
82#define S3C_GINTSTS_SessReqInt (1 << 30)
83#define S3C_GINTSTS_DisconnInt (1 << 29)
84#define S3C_GINTSTS_ConIDStsChng (1 << 28)
85#define S3C_GINTSTS_PTxFEmp (1 << 26)
86#define S3C_GINTSTS_HChInt (1 << 25)
87#define S3C_GINTSTS_PrtInt (1 << 24)
88#define S3C_GINTSTS_FetSusp (1 << 22)
89#define S3C_GINTSTS_incompIP (1 << 21)
90#define S3C_GINTSTS_IncomplSOIN (1 << 20)
91#define S3C_GINTSTS_OEPInt (1 << 19)
92#define S3C_GINTSTS_IEPInt (1 << 18)
93#define S3C_GINTSTS_EPMis (1 << 17)
94#define S3C_GINTSTS_EOPF (1 << 15)
95#define S3C_GINTSTS_ISOutDrop (1 << 14)
96#define S3C_GINTSTS_EnumDone (1 << 13)
97#define S3C_GINTSTS_USBRst (1 << 12)
98#define S3C_GINTSTS_USBSusp (1 << 11)
99#define S3C_GINTSTS_ErlySusp (1 << 10)
100#define S3C_GINTSTS_GOUTNakEff (1 << 7)
101#define S3C_GINTSTS_GINNakEff (1 << 6)
102#define S3C_GINTSTS_NPTxFEmp (1 << 5)
103#define S3C_GINTSTS_RxFLvl (1 << 4)
104#define S3C_GINTSTS_SOF (1 << 3)
105#define S3C_GINTSTS_OTGInt (1 << 2)
106#define S3C_GINTSTS_ModeMis (1 << 1)
107#define S3C_GINTSTS_CurMod_Host (1 << 0)
108
109#define S3C_GRXSTSR S3C_HSOTG_REG(0x01C)
110#define S3C_GRXSTSP S3C_HSOTG_REG(0x020)
111
112#define S3C_GRXSTS_FN_MASK (0x7f << 25)
113#define S3C_GRXSTS_FN_SHIFT (25)
114
115#define S3C_GRXSTS_PktSts_MASK (0xf << 17)
116#define S3C_GRXSTS_PktSts_SHIFT (17)
117#define S3C_GRXSTS_PktSts_GlobalOutNAK (0x1 << 17)
118#define S3C_GRXSTS_PktSts_OutRX (0x2 << 17)
119#define S3C_GRXSTS_PktSts_OutDone (0x3 << 17)
120#define S3C_GRXSTS_PktSts_SetupDone (0x4 << 17)
121#define S3C_GRXSTS_PktSts_SetupRX (0x6 << 17)
122
123#define S3C_GRXSTS_DPID_MASK (0x3 << 15)
124#define S3C_GRXSTS_DPID_SHIFT (15)
125#define S3C_GRXSTS_ByteCnt_MASK (0x7ff << 4)
126#define S3C_GRXSTS_ByteCnt_SHIFT (4)
127#define S3C_GRXSTS_EPNum_MASK (0xf << 0)
128#define S3C_GRXSTS_EPNum_SHIFT (0)
129
130#define S3C_GRXFSIZ S3C_HSOTG_REG(0x024)
131
132#define S3C_GNPTXFSIZ S3C_HSOTG_REG(0x028)
133
134#define S3C_GNPTXFSIZ_NPTxFDep_MASK (0xffff << 16)
135#define S3C_GNPTXFSIZ_NPTxFDep_SHIFT (16)
136#define S3C_GNPTXFSIZ_NPTxFDep_LIMIT (0xffff)
137#define S3C_GNPTXFSIZ_NPTxFDep(_x) ((_x) << 16)
138#define S3C_GNPTXFSIZ_NPTxFStAddr_MASK (0xffff << 0)
139#define S3C_GNPTXFSIZ_NPTxFStAddr_SHIFT (0)
140#define S3C_GNPTXFSIZ_NPTxFStAddr_LIMIT (0xffff)
141#define S3C_GNPTXFSIZ_NPTxFStAddr(_x) ((_x) << 0)
142
143#define S3C_GNPTXSTS S3C_HSOTG_REG(0x02C)
144
145#define S3C_GNPTXSTS_NPtxQTop_MASK (0x7f << 24)
146#define S3C_GNPTXSTS_NPtxQTop_SHIFT (24)
147
148#define S3C_GNPTXSTS_NPTxQSpcAvail_MASK (0xff << 16)
149#define S3C_GNPTXSTS_NPTxQSpcAvail_SHIFT (16)
150#define S3C_GNPTXSTS_NPTxQSpcAvail_GET(_v) (((_v) >> 16) & 0xff)
151
152#define S3C_GNPTXSTS_NPTxFSpcAvail_MASK (0xffff << 0)
153#define S3C_GNPTXSTS_NPTxFSpcAvail_SHIFT (0)
154#define S3C_GNPTXSTS_NPTxFSpcAvail_GET(_v) (((_v) >> 0) & 0xffff)
155
156
157#define S3C_HPTXFSIZ S3C_HSOTG_REG(0x100)
158
159#define S3C_DPTXFSIZn(_a) S3C_HSOTG_REG(0x104 + (((_a) - 1) * 4))
160
161#define S3C_DPTXFSIZn_DPTxFSize_MASK (0xffff << 16)
162#define S3C_DPTXFSIZn_DPTxFSize_SHIFT (16)
163#define S3C_DPTXFSIZn_DPTxFSize_GET(_v) (((_v) >> 16) & 0xffff)
164#define S3C_DPTXFSIZn_DPTxFSize_LIMIT (0xffff)
165#define S3C_DPTXFSIZn_DPTxFSize(_x) ((_x) << 16)
166
167#define S3C_DPTXFSIZn_DPTxFStAddr_MASK (0xffff << 0)
168#define S3C_DPTXFSIZn_DPTxFStAddr_SHIFT (0)
169
170/* Device mode registers */
171#define S3C_DCFG S3C_HSOTG_REG(0x800)
172
173#define S3C_DCFG_EPMisCnt_MASK (0x1f << 18)
174#define S3C_DCFG_EPMisCnt_SHIFT (18)
175#define S3C_DCFG_EPMisCnt_LIMIT (0x1f)
176#define S3C_DCFG_EPMisCnt(_x) ((_x) << 18)
177
178#define S3C_DCFG_PerFrInt_MASK (0x3 << 11)
179#define S3C_DCFG_PerFrInt_SHIFT (11)
180#define S3C_DCFG_PerFrInt_LIMIT (0x3)
181#define S3C_DCFG_PerFrInt(_x) ((_x) << 11)
182
183#define S3C_DCFG_DevAddr_MASK (0x7f << 4)
184#define S3C_DCFG_DevAddr_SHIFT (4)
185#define S3C_DCFG_DevAddr_LIMIT (0x7f)
186#define S3C_DCFG_DevAddr(_x) ((_x) << 4)
187
188#define S3C_DCFG_NZStsOUTHShk (1 << 2)
189
190#define S3C_DCFG_DevSpd_MASK (0x3 << 0)
191#define S3C_DCFG_DevSpd_SHIFT (0)
192#define S3C_DCFG_DevSpd_HS (0x0 << 0)
193#define S3C_DCFG_DevSpd_FS (0x1 << 0)
194#define S3C_DCFG_DevSpd_LS (0x2 << 0)
195#define S3C_DCFG_DevSpd_FS48 (0x3 << 0)
196
197#define S3C_DCTL S3C_HSOTG_REG(0x804)
198
199#define S3C_DCTL_PWROnPrgDone (1 << 11)
200#define S3C_DCTL_CGOUTNak (1 << 10)
201#define S3C_DCTL_SGOUTNak (1 << 9)
202#define S3C_DCTL_CGNPInNAK (1 << 8)
203#define S3C_DCTL_SGNPInNAK (1 << 7)
204#define S3C_DCTL_TstCtl_MASK (0x7 << 4)
205#define S3C_DCTL_TstCtl_SHIFT (4)
206#define S3C_DCTL_GOUTNakSts (1 << 3)
207#define S3C_DCTL_GNPINNakSts (1 << 2)
208#define S3C_DCTL_SftDiscon (1 << 1)
209#define S3C_DCTL_RmtWkUpSig (1 << 0)
210
211#define S3C_DSTS S3C_HSOTG_REG(0x808)
212
213#define S3C_DSTS_SOFFN_MASK (0x3fff << 8)
214#define S3C_DSTS_SOFFN_SHIFT (8)
215#define S3C_DSTS_SOFFN_LIMIT (0x3fff)
216#define S3C_DSTS_SOFFN(_x) ((_x) << 8)
217#define S3C_DSTS_ErraticErr (1 << 3)
218#define S3C_DSTS_EnumSpd_MASK (0x3 << 1)
219#define S3C_DSTS_EnumSpd_SHIFT (1)
220#define S3C_DSTS_EnumSpd_HS (0x0 << 1)
221#define S3C_DSTS_EnumSpd_FS (0x1 << 1)
222#define S3C_DSTS_EnumSpd_LS (0x2 << 1)
223#define S3C_DSTS_EnumSpd_FS48 (0x3 << 1)
224
225#define S3C_DSTS_SuspSts (1 << 0)
226
227#define S3C_DIEPMSK S3C_HSOTG_REG(0x810)
228
229#define S3C_DIEPMSK_TxFIFOEmpty (1 << 7)
230#define S3C_DIEPMSK_INEPNakEffMsk (1 << 6)
231#define S3C_DIEPMSK_INTknEPMisMsk (1 << 5)
232#define S3C_DIEPMSK_INTknTXFEmpMsk (1 << 4)
233#define S3C_DIEPMSK_TimeOUTMsk (1 << 3)
234#define S3C_DIEPMSK_AHBErrMsk (1 << 2)
235#define S3C_DIEPMSK_EPDisbldMsk (1 << 1)
236#define S3C_DIEPMSK_XferComplMsk (1 << 0)
237
238#define S3C_DOEPMSK S3C_HSOTG_REG(0x814)
239
240#define S3C_DOEPMSK_Back2BackSetup (1 << 6)
241#define S3C_DOEPMSK_OUTTknEPdisMsk (1 << 4)
242#define S3C_DOEPMSK_SetupMsk (1 << 3)
243#define S3C_DOEPMSK_AHBErrMsk (1 << 2)
244#define S3C_DOEPMSK_EPDisbldMsk (1 << 1)
245#define S3C_DOEPMSK_XferComplMsk (1 << 0)
246
247#define S3C_DAINT S3C_HSOTG_REG(0x818)
248#define S3C_DAINTMSK S3C_HSOTG_REG(0x81C)
249
250#define S3C_DAINT_OutEP_SHIFT (16)
251#define S3C_DAINT_OutEP(x) (1 << ((x) + 16))
252#define S3C_DAINT_InEP(x) (1 << (x))
253
254#define S3C_DTKNQR1 S3C_HSOTG_REG(0x820)
255#define S3C_DTKNQR2 S3C_HSOTG_REG(0x824)
256#define S3C_DTKNQR3 S3C_HSOTG_REG(0x830)
257#define S3C_DTKNQR4 S3C_HSOTG_REG(0x834)
258
259#define S3C_DVBUSDIS S3C_HSOTG_REG(0x828)
260#define S3C_DVBUSPULSE S3C_HSOTG_REG(0x82C)
261
262#define S3C_DIEPCTL0 S3C_HSOTG_REG(0x900)
263#define S3C_DOEPCTL0 S3C_HSOTG_REG(0xB00)
264#define S3C_DIEPCTL(_a) S3C_HSOTG_REG(0x900 + ((_a) * 0x20))
265#define S3C_DOEPCTL(_a) S3C_HSOTG_REG(0xB00 + ((_a) * 0x20))
266
267/* EP0 specialness:
268 * bits[29..28] - reserved (no SetD0PID, SetD1PID)
269 * bits[25..22] - should always be zero, this isn't a periodic endpoint
270 * bits[10..0] - MPS setting differenct for EP0
271*/
272#define S3C_D0EPCTL_MPS_MASK (0x3 << 0)
273#define S3C_D0EPCTL_MPS_SHIFT (0)
274#define S3C_D0EPCTL_MPS_64 (0x0 << 0)
275#define S3C_D0EPCTL_MPS_32 (0x1 << 0)
276#define S3C_D0EPCTL_MPS_16 (0x2 << 0)
277#define S3C_D0EPCTL_MPS_8 (0x3 << 0)
278
279#define S3C_DxEPCTL_EPEna (1 << 31)
280#define S3C_DxEPCTL_EPDis (1 << 30)
281#define S3C_DxEPCTL_SetD1PID (1 << 29)
282#define S3C_DxEPCTL_SetOddFr (1 << 29)
283#define S3C_DxEPCTL_SetD0PID (1 << 28)
284#define S3C_DxEPCTL_SetEvenFr (1 << 28)
285#define S3C_DxEPCTL_SNAK (1 << 27)
286#define S3C_DxEPCTL_CNAK (1 << 26)
287#define S3C_DxEPCTL_TxFNum_MASK (0xf << 22)
288#define S3C_DxEPCTL_TxFNum_SHIFT (22)
289#define S3C_DxEPCTL_TxFNum_LIMIT (0xf)
290#define S3C_DxEPCTL_TxFNum(_x) ((_x) << 22)
291
292#define S3C_DxEPCTL_Stall (1 << 21)
293#define S3C_DxEPCTL_Snp (1 << 20)
294#define S3C_DxEPCTL_EPType_MASK (0x3 << 18)
295#define S3C_DxEPCTL_EPType_SHIFT (18)
296#define S3C_DxEPCTL_EPType_Control (0x0 << 18)
297#define S3C_DxEPCTL_EPType_Iso (0x1 << 18)
298#define S3C_DxEPCTL_EPType_Bulk (0x2 << 18)
299#define S3C_DxEPCTL_EPType_Intterupt (0x3 << 18)
300
301#define S3C_DxEPCTL_NAKsts (1 << 17)
302#define S3C_DxEPCTL_DPID (1 << 16)
303#define S3C_DxEPCTL_EOFrNum (1 << 16)
304#define S3C_DxEPCTL_USBActEp (1 << 15)
305#define S3C_DxEPCTL_NextEp_MASK (0xf << 11)
306#define S3C_DxEPCTL_NextEp_SHIFT (11)
307#define S3C_DxEPCTL_NextEp_LIMIT (0xf)
308#define S3C_DxEPCTL_NextEp(_x) ((_x) << 11)
309
310#define S3C_DxEPCTL_MPS_MASK (0x7ff << 0)
311#define S3C_DxEPCTL_MPS_SHIFT (0)
312#define S3C_DxEPCTL_MPS_LIMIT (0x7ff)
313#define S3C_DxEPCTL_MPS(_x) ((_x) << 0)
314
315#define S3C_DIEPINT(_a) S3C_HSOTG_REG(0x908 + ((_a) * 0x20))
316#define S3C_DOEPINT(_a) S3C_HSOTG_REG(0xB08 + ((_a) * 0x20))
317
318#define S3C_DxEPINT_INEPNakEff (1 << 6)
319#define S3C_DxEPINT_Back2BackSetup (1 << 6)
320#define S3C_DxEPINT_INTknEPMis (1 << 5)
321#define S3C_DxEPINT_INTknTXFEmp (1 << 4)
322#define S3C_DxEPINT_OUTTknEPdis (1 << 4)
323#define S3C_DxEPINT_Timeout (1 << 3)
324#define S3C_DxEPINT_Setup (1 << 3)
325#define S3C_DxEPINT_AHBErr (1 << 2)
326#define S3C_DxEPINT_EPDisbld (1 << 1)
327#define S3C_DxEPINT_XferCompl (1 << 0)
328
329#define S3C_DIEPTSIZ0 S3C_HSOTG_REG(0x910)
330
331#define S3C_DIEPTSIZ0_PktCnt_MASK (0x3 << 19)
332#define S3C_DIEPTSIZ0_PktCnt_SHIFT (19)
333#define S3C_DIEPTSIZ0_PktCnt_LIMIT (0x3)
334#define S3C_DIEPTSIZ0_PktCnt(_x) ((_x) << 19)
335
336#define S3C_DIEPTSIZ0_XferSize_MASK (0x7f << 0)
337#define S3C_DIEPTSIZ0_XferSize_SHIFT (0)
338#define S3C_DIEPTSIZ0_XferSize_LIMIT (0x7f)
339#define S3C_DIEPTSIZ0_XferSize(_x) ((_x) << 0)
340
341
342#define DOEPTSIZ0 S3C_HSOTG_REG(0xB10)
343#define S3C_DOEPTSIZ0_SUPCnt_MASK (0x3 << 29)
344#define S3C_DOEPTSIZ0_SUPCnt_SHIFT (29)
345#define S3C_DOEPTSIZ0_SUPCnt_LIMIT (0x3)
346#define S3C_DOEPTSIZ0_SUPCnt(_x) ((_x) << 29)
347
348#define S3C_DOEPTSIZ0_PktCnt (1 << 19)
349#define S3C_DOEPTSIZ0_XferSize_MASK (0x7f << 0)
350#define S3C_DOEPTSIZ0_XferSize_SHIFT (0)
351
352#define S3C_DIEPTSIZ(_a) S3C_HSOTG_REG(0x910 + ((_a) * 0x20))
353#define S3C_DOEPTSIZ(_a) S3C_HSOTG_REG(0xB10 + ((_a) * 0x20))
354
355#define S3C_DxEPTSIZ_MC_MASK (0x3 << 29)
356#define S3C_DxEPTSIZ_MC_SHIFT (29)
357#define S3C_DxEPTSIZ_MC_LIMIT (0x3)
358#define S3C_DxEPTSIZ_MC(_x) ((_x) << 29)
359
360#define S3C_DxEPTSIZ_PktCnt_MASK (0x3ff << 19)
361#define S3C_DxEPTSIZ_PktCnt_SHIFT (19)
362#define S3C_DxEPTSIZ_PktCnt_GET(_v) (((_v) >> 19) & 0x3ff)
363#define S3C_DxEPTSIZ_PktCnt_LIMIT (0x3ff)
364#define S3C_DxEPTSIZ_PktCnt(_x) ((_x) << 19)
365
366#define S3C_DxEPTSIZ_XferSize_MASK (0x7ffff << 0)
367#define S3C_DxEPTSIZ_XferSize_SHIFT (0)
368#define S3C_DxEPTSIZ_XferSize_GET(_v) (((_v) >> 0) & 0x7ffff)
369#define S3C_DxEPTSIZ_XferSize_LIMIT (0x7ffff)
370#define S3C_DxEPTSIZ_XferSize(_x) ((_x) << 0)
371
372
373#define S3C_DIEPDMA(_a) S3C_HSOTG_REG(0x914 + ((_a) * 0x20))
374#define S3C_DOEPDMA(_a) S3C_HSOTG_REG(0xB14 + ((_a) * 0x20))
375#define S3C_DTXFSTS(_a) S3C_HSOTG_REG(0x918 + ((_a) * 0x20))
376
377#define S3C_EPFIFO(_a) S3C_HSOTG_REG(0x1000 + ((_a) * 0x1000))
378
379#endif /* __PLAT_S3C64XX_REGS_USB_HSOTG_H */
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h
index 317e246ffc56..151cc9195cf6 100644
--- a/arch/arm/plat-samsung/include/plat/sdhci.h
+++ b/arch/arm/plat-samsung/include/plat/sdhci.h
@@ -18,6 +18,8 @@
18#ifndef __PLAT_S3C_SDHCI_H 18#ifndef __PLAT_S3C_SDHCI_H
19#define __PLAT_S3C_SDHCI_H __FILE__ 19#define __PLAT_S3C_SDHCI_H __FILE__
20 20
21#include <plat/devs.h>
22
21struct platform_device; 23struct platform_device;
22struct mmc_host; 24struct mmc_host;
23struct mmc_card; 25struct mmc_card;
@@ -31,18 +33,12 @@ enum cd_types {
31 S3C_SDHCI_CD_PERMANENT, /* no CD line, card permanently wired to host */ 33 S3C_SDHCI_CD_PERMANENT, /* no CD line, card permanently wired to host */
32}; 34};
33 35
34enum clk_types {
35 S3C_SDHCI_CLK_DIV_INTERNAL, /* use mmc internal clock divider */
36 S3C_SDHCI_CLK_DIV_EXTERNAL, /* use external clock divider */
37};
38
39/** 36/**
40 * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI 37 * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
41 * @max_width: The maximum number of data bits supported. 38 * @max_width: The maximum number of data bits supported.
42 * @host_caps: Standard MMC host capabilities bit field. 39 * @host_caps: Standard MMC host capabilities bit field.
43 * @host_caps2: The second standard MMC host capabilities bit field. 40 * @host_caps2: The second standard MMC host capabilities bit field.
44 * @cd_type: Type of Card Detection method (see cd_types enum above) 41 * @cd_type: Type of Card Detection method (see cd_types enum above)
45 * @clk_type: Type of clock divider method (see clk_types enum above)
46 * @ext_cd_init: Initialize external card detect subsystem. Called on 42 * @ext_cd_init: Initialize external card detect subsystem. Called on
47 * sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL. 43 * sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL.
48 * notify_func argument is a callback to the sdhci-s3c driver 44 * notify_func argument is a callback to the sdhci-s3c driver
@@ -67,7 +63,6 @@ struct s3c_sdhci_platdata {
67 unsigned int host_caps2; 63 unsigned int host_caps2;
68 unsigned int pm_caps; 64 unsigned int pm_caps;
69 enum cd_types cd_type; 65 enum cd_types cd_type;
70 enum clk_types clk_type;
71 66
72 int ext_cd_gpio; 67 int ext_cd_gpio;
73 bool ext_cd_gpio_invert; 68 bool ext_cd_gpio_invert;
@@ -356,4 +351,30 @@ static inline void exynos4_default_sdhci3(void) { }
356 351
357#endif /* CONFIG_EXYNOS4_SETUP_SDHCI */ 352#endif /* CONFIG_EXYNOS4_SETUP_SDHCI */
358 353
354static inline void s3c_sdhci_setname(int id, char *name)
355{
356 switch (id) {
357#ifdef CONFIG_S3C_DEV_HSMMC
358 case 0:
359 s3c_device_hsmmc0.name = name;
360 break;
361#endif
362#ifdef CONFIG_S3C_DEV_HSMMC1
363 case 1:
364 s3c_device_hsmmc1.name = name;
365 break;
366#endif
367#ifdef CONFIG_S3C_DEV_HSMMC2
368 case 2:
369 s3c_device_hsmmc2.name = name;
370 break;
371#endif
372#ifdef CONFIG_S3C_DEV_HSMMC3
373 case 3:
374 s3c_device_hsmmc3.name = name;
375 break;
376#endif
377 }
378}
379
359#endif /* __PLAT_S3C_SDHCI_H */ 380#endif /* __PLAT_S3C_SDHCI_H */
diff --git a/arch/arm/plat-samsung/include/plat/udc-hs.h b/arch/arm/plat-samsung/include/plat/udc-hs.h
deleted file mode 100644
index c9e3667cb2b1..000000000000
--- a/arch/arm/plat-samsung/include/plat/udc-hs.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/* arch/arm/plat-s3c/include/plat/udc-hs.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C USB2.0 High-speed / OtG platform information
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15enum s3c_hsotg_dmamode {
16 S3C_HSOTG_DMA_NONE, /* do not use DMA at-all */
17 S3C_HSOTG_DMA_ONLY, /* always use DMA */
18 S3C_HSOTG_DMA_DRV, /* DMA is chosen by driver */
19};
20
21/**
22 * struct s3c_hsotg_plat - platform data for high-speed otg/udc
23 * @dma: Whether to use DMA or not.
24 * @is_osc: The clock source is an oscillator, not a crystal
25 */
26struct s3c_hsotg_plat {
27 enum s3c_hsotg_dmamode dma;
28 unsigned int is_osc : 1;
29
30 int (*phy_init)(struct platform_device *pdev, int type);
31 int (*phy_exit)(struct platform_device *pdev, int type);
32};
33
34extern void s3c_hsotg_set_platdata(struct s3c_hsotg_plat *pd);
diff --git a/arch/arm/plat-samsung/platformdata.c b/arch/arm/plat-samsung/platformdata.c
index fa78aa710ed1..b430e9946287 100644
--- a/arch/arm/plat-samsung/platformdata.c
+++ b/arch/arm/plat-samsung/platformdata.c
@@ -57,6 +57,4 @@ void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
57 set->host_caps2 |= pd->host_caps2; 57 set->host_caps2 |= pd->host_caps2;
58 if (pd->pm_caps) 58 if (pd->pm_caps)
59 set->pm_caps |= pd->pm_caps; 59 set->pm_caps |= pd->pm_caps;
60 if (pd->clk_type)
61 set->clk_type = pd->clk_type;
62} 60}
diff --git a/arch/arm/plat-spear/Kconfig b/arch/arm/plat-spear/Kconfig
index 1bb3dbce8810..387655b5ce05 100644
--- a/arch/arm/plat-spear/Kconfig
+++ b/arch/arm/plat-spear/Kconfig
@@ -9,9 +9,11 @@ choice
9 default ARCH_SPEAR3XX 9 default ARCH_SPEAR3XX
10 10
11config ARCH_SPEAR3XX 11config ARCH_SPEAR3XX
12 bool "SPEAr3XX" 12 bool "ST SPEAr3xx with Device Tree"
13 select ARM_VIC 13 select ARM_VIC
14 select CPU_ARM926T 14 select CPU_ARM926T
15 select USE_OF
16 select PINCTRL
15 help 17 help
16 Supports for ARM's SPEAR3XX family 18 Supports for ARM's SPEAR3XX family
17 19
diff --git a/arch/arm/plat-spear/Makefile b/arch/arm/plat-spear/Makefile
index e0f2e5b9530c..7744802c83e7 100644
--- a/arch/arm/plat-spear/Makefile
+++ b/arch/arm/plat-spear/Makefile
@@ -3,6 +3,6 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := clock.o restart.o time.o 6obj-y := clock.o restart.o time.o pl080.o
7 7
8obj-$(CONFIG_ARCH_SPEAR3XX) += shirq.o padmux.o 8obj-$(CONFIG_ARCH_SPEAR3XX) += shirq.o
diff --git a/arch/arm/plat-spear/include/plat/debug-macro.S b/arch/arm/plat-spear/include/plat/debug-macro.S
index 02b160a1ec9b..ab3de721c5db 100644
--- a/arch/arm/plat-spear/include/plat/debug-macro.S
+++ b/arch/arm/plat-spear/include/plat/debug-macro.S
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include <linux/amba/serial.h> 14#include <linux/amba/serial.h>
15#include <mach/hardware.h> 15#include <mach/spear.h>
16 16
17 .macro addruart, rp, rv, tmp 17 .macro addruart, rp, rv, tmp
18 mov \rp, #SPEAR_DBG_UART_BASE @ Physical base 18 mov \rp, #SPEAR_DBG_UART_BASE @ Physical base
diff --git a/arch/arm/plat-spear/include/plat/hardware.h b/arch/arm/plat-spear/include/plat/hardware.h
deleted file mode 100644
index 70187d763e26..000000000000
--- a/arch/arm/plat-spear/include/plat/hardware.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * arch/arm/plat-spear/include/plat/hardware.h
3 *
4 * Hardware definitions for SPEAr
5 *
6 * Copyright (C) 2010 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __PLAT_HARDWARE_H
15#define __PLAT_HARDWARE_H
16
17#endif /* __PLAT_HARDWARE_H */
diff --git a/arch/arm/plat-spear/include/plat/padmux.h b/arch/arm/plat-spear/include/plat/padmux.h
deleted file mode 100644
index 877f3adcf610..000000000000
--- a/arch/arm/plat-spear/include/plat/padmux.h
+++ /dev/null
@@ -1,92 +0,0 @@
1/*
2 * arch/arm/plat-spear/include/plat/padmux.h
3 *
4 * SPEAr platform specific gpio pads muxing file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __PLAT_PADMUX_H
15#define __PLAT_PADMUX_H
16
17#include <linux/types.h>
18
19/*
20 * struct pmx_reg: configuration structure for mode reg and mux reg
21 *
22 * offset: offset of mode reg
23 * mask: mask of mode reg
24 */
25struct pmx_reg {
26 u32 offset;
27 u32 mask;
28};
29
30/*
31 * struct pmx_dev_mode: configuration structure every group of modes of a device
32 *
33 * ids: all modes for this configuration
34 * mask: mask for supported mode
35 */
36struct pmx_dev_mode {
37 u32 ids;
38 u32 mask;
39};
40
41/*
42 * struct pmx_mode: mode definition structure
43 *
44 * name: mode name
45 * mask: mode mask
46 */
47struct pmx_mode {
48 char *name;
49 u32 id;
50 u32 mask;
51};
52
53/*
54 * struct pmx_dev: device definition structure
55 *
56 * name: device name
57 * modes: device configuration array for different modes supported
58 * mode_count: size of modes array
59 * is_active: is peripheral active/enabled
60 * enb_on_reset: if 1, mask bits to be cleared in reg otherwise to be set in reg
61 */
62struct pmx_dev {
63 char *name;
64 struct pmx_dev_mode *modes;
65 u8 mode_count;
66 bool is_active;
67 bool enb_on_reset;
68};
69
70/*
71 * struct pmx_driver: driver definition structure
72 *
73 * mode: mode to be set
74 * devs: array of pointer to pmx devices
75 * devs_count: ARRAY_SIZE of devs
76 * base: base address of soc config registers
77 * mode_reg: structure of mode config register
78 * mux_reg: structure of device mux config register
79 */
80struct pmx_driver {
81 struct pmx_mode *mode;
82 struct pmx_dev **devs;
83 u8 devs_count;
84 u32 *base;
85 struct pmx_reg mode_reg;
86 struct pmx_reg mux_reg;
87};
88
89/* pmx functions */
90int pmx_register(struct pmx_driver *driver);
91
92#endif /* __PLAT_PADMUX_H */
diff --git a/arch/arm/plat-spear/include/plat/pl080.h b/arch/arm/plat-spear/include/plat/pl080.h
new file mode 100644
index 000000000000..e14a3e4932f9
--- /dev/null
+++ b/arch/arm/plat-spear/include/plat/pl080.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/plat-spear/include/plat/pl080.h
3 *
4 * DMAC pl080 definitions for SPEAr platform
5 *
6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __PLAT_PL080_H
15#define __PLAT_PL080_H
16
17struct pl08x_dma_chan;
18int pl080_get_signal(struct pl08x_dma_chan *ch);
19void pl080_put_signal(struct pl08x_dma_chan *ch);
20
21#endif /* __PLAT_PL080_H */
diff --git a/arch/arm/plat-spear/include/plat/uncompress.h b/arch/arm/plat-spear/include/plat/uncompress.h
index 1bf84527aee4..6dd455bafdfd 100644
--- a/arch/arm/plat-spear/include/plat/uncompress.h
+++ b/arch/arm/plat-spear/include/plat/uncompress.h
@@ -13,7 +13,7 @@
13 13
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/amba/serial.h> 15#include <linux/amba/serial.h>
16#include <mach/hardware.h> 16#include <mach/spear.h>
17 17
18#ifndef __PLAT_UNCOMPRESS_H 18#ifndef __PLAT_UNCOMPRESS_H
19#define __PLAT_UNCOMPRESS_H 19#define __PLAT_UNCOMPRESS_H
diff --git a/arch/arm/plat-spear/padmux.c b/arch/arm/plat-spear/padmux.c
deleted file mode 100644
index 555eec6dc1cb..000000000000
--- a/arch/arm/plat-spear/padmux.c
+++ /dev/null
@@ -1,164 +0,0 @@
1/*
2 * arch/arm/plat-spear/include/plat/padmux.c
3 *
4 * SPEAr platform specific gpio pads muxing source file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <linux/err.h>
15#include <linux/io.h>
16#include <linux/slab.h>
17#include <plat/padmux.h>
18
19/*
20 * struct pmx: pmx definition structure
21 *
22 * base: base address of configuration registers
23 * mode_reg: mode configurations
24 * mux_reg: muxing configurations
25 * active_mode: pointer to current active mode
26 */
27struct pmx {
28 u32 base;
29 struct pmx_reg mode_reg;
30 struct pmx_reg mux_reg;
31 struct pmx_mode *active_mode;
32};
33
34static struct pmx *pmx;
35
36/**
37 * pmx_mode_set - Enables an multiplexing mode
38 * @mode - pointer to pmx mode
39 *
40 * It will set mode of operation in hardware.
41 * Returns -ve on Err otherwise 0
42 */
43static int pmx_mode_set(struct pmx_mode *mode)
44{
45 u32 val;
46
47 if (!mode->name)
48 return -EFAULT;
49
50 pmx->active_mode = mode;
51
52 val = readl(pmx->base + pmx->mode_reg.offset);
53 val &= ~pmx->mode_reg.mask;
54 val |= mode->mask & pmx->mode_reg.mask;
55 writel(val, pmx->base + pmx->mode_reg.offset);
56
57 return 0;
58}
59
60/**
61 * pmx_devs_enable - Enables list of devices
62 * @devs - pointer to pmx device array
63 * @count - number of devices to enable
64 *
65 * It will enable pads for all required peripherals once and only once.
66 * If peripheral is not supported by current mode then request is rejected.
67 * Conflicts between peripherals are not handled and peripherals will be
68 * enabled in the order they are present in pmx_dev array.
69 * In case of conflicts last peripheral enabled will be present.
70 * Returns -ve on Err otherwise 0
71 */
72static int pmx_devs_enable(struct pmx_dev **devs, u8 count)
73{
74 u32 val, i, mask;
75
76 if (!count)
77 return -EINVAL;
78
79 val = readl(pmx->base + pmx->mux_reg.offset);
80 for (i = 0; i < count; i++) {
81 u8 j = 0;
82
83 if (!devs[i]->name || !devs[i]->modes) {
84 printk(KERN_ERR "padmux: dev name or modes is null\n");
85 continue;
86 }
87 /* check if peripheral exists in active mode */
88 if (pmx->active_mode) {
89 bool found = false;
90 for (j = 0; j < devs[i]->mode_count; j++) {
91 if (devs[i]->modes[j].ids &
92 pmx->active_mode->id) {
93 found = true;
94 break;
95 }
96 }
97 if (found == false) {
98 printk(KERN_ERR "%s device not available in %s"\
99 "mode\n", devs[i]->name,
100 pmx->active_mode->name);
101 continue;
102 }
103 }
104
105 /* enable peripheral */
106 mask = devs[i]->modes[j].mask & pmx->mux_reg.mask;
107 if (devs[i]->enb_on_reset)
108 val &= ~mask;
109 else
110 val |= mask;
111
112 devs[i]->is_active = true;
113 }
114 writel(val, pmx->base + pmx->mux_reg.offset);
115 kfree(pmx);
116
117 /* this will ensure that multiplexing can't be changed now */
118 pmx = (struct pmx *)-1;
119
120 return 0;
121}
122
123/**
124 * pmx_register - registers a platform requesting pad mux feature
125 * @driver - pointer to driver structure containing driver specific parameters
126 *
127 * Also this must be called only once. This will allocate memory for pmx
128 * structure, will call pmx_mode_set, will call pmx_devs_enable.
129 * Returns -ve on Err otherwise 0
130 */
131int pmx_register(struct pmx_driver *driver)
132{
133 int ret = 0;
134
135 if (pmx)
136 return -EPERM;
137 if (!driver->base || !driver->devs)
138 return -EFAULT;
139
140 pmx = kzalloc(sizeof(*pmx), GFP_KERNEL);
141 if (!pmx)
142 return -ENOMEM;
143
144 pmx->base = (u32)driver->base;
145 pmx->mode_reg.offset = driver->mode_reg.offset;
146 pmx->mode_reg.mask = driver->mode_reg.mask;
147 pmx->mux_reg.offset = driver->mux_reg.offset;
148 pmx->mux_reg.mask = driver->mux_reg.mask;
149
150 /* choose mode to enable */
151 if (driver->mode) {
152 ret = pmx_mode_set(driver->mode);
153 if (ret)
154 goto pmx_fail;
155 }
156 ret = pmx_devs_enable(driver->devs, driver->devs_count);
157 if (ret)
158 goto pmx_fail;
159
160 return 0;
161
162pmx_fail:
163 return ret;
164}
diff --git a/arch/arm/plat-spear/pl080.c b/arch/arm/plat-spear/pl080.c
new file mode 100644
index 000000000000..a56a067717c1
--- /dev/null
+++ b/arch/arm/plat-spear/pl080.c
@@ -0,0 +1,80 @@
1/*
2 * arch/arm/plat-spear/pl080.c
3 *
4 * DMAC pl080 definitions for SPEAr platform
5 *
6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <linux/amba/pl08x.h>
15#include <linux/amba/bus.h>
16#include <linux/bug.h>
17#include <linux/err.h>
18#include <linux/io.h>
19#include <linux/spinlock_types.h>
20#include <mach/spear.h>
21#include <mach/misc_regs.h>
22
23static spinlock_t lock = __SPIN_LOCK_UNLOCKED(x);
24
25struct {
26 unsigned char busy;
27 unsigned char val;
28} signals[16] = {{0, 0}, };
29
30int pl080_get_signal(struct pl08x_dma_chan *ch)
31{
32 const struct pl08x_channel_data *cd = ch->cd;
33 unsigned int signal = cd->min_signal, val;
34 unsigned long flags;
35
36 spin_lock_irqsave(&lock, flags);
37
38 /* Return if signal is already acquired by somebody else */
39 if (signals[signal].busy &&
40 (signals[signal].val != cd->muxval)) {
41 spin_unlock_irqrestore(&lock, flags);
42 return -EBUSY;
43 }
44
45 /* If acquiring for the first time, configure it */
46 if (!signals[signal].busy) {
47 val = readl(DMA_CHN_CFG);
48
49 /*
50 * Each request line has two bits in DMA_CHN_CFG register. To
51 * goto the bits of current request line, do left shift of
52 * value by 2 * signal number.
53 */
54 val &= ~(0x3 << (signal * 2));
55 val |= cd->muxval << (signal * 2);
56 writel(val, DMA_CHN_CFG);
57 }
58
59 signals[signal].busy++;
60 signals[signal].val = cd->muxval;
61 spin_unlock_irqrestore(&lock, flags);
62
63 return signal;
64}
65
66void pl080_put_signal(struct pl08x_dma_chan *ch)
67{
68 const struct pl08x_channel_data *cd = ch->cd;
69 unsigned long flags;
70
71 spin_lock_irqsave(&lock, flags);
72
73 /* if signal is not used */
74 if (!signals[cd->min_signal].busy)
75 BUG();
76
77 signals[cd->min_signal].busy--;
78
79 spin_unlock_irqrestore(&lock, flags);
80}
diff --git a/arch/arm/plat-spear/restart.c b/arch/arm/plat-spear/restart.c
index 16f203e78d89..4471a232713a 100644
--- a/arch/arm/plat-spear/restart.c
+++ b/arch/arm/plat-spear/restart.c
@@ -13,7 +13,7 @@
13#include <linux/io.h> 13#include <linux/io.h>
14#include <asm/system_misc.h> 14#include <asm/system_misc.h>
15#include <asm/hardware/sp810.h> 15#include <asm/hardware/sp810.h>
16#include <mach/hardware.h> 16#include <mach/spear.h>
17#include <mach/generic.h> 17#include <mach/generic.h>
18 18
19void spear_restart(char mode, const char *cmd) 19void spear_restart(char mode, const char *cmd)
diff --git a/arch/arm/plat-spear/time.c b/arch/arm/plat-spear/time.c
index abb5bdecd509..a3164d1647fd 100644
--- a/arch/arm/plat-spear/time.c
+++ b/arch/arm/plat-spear/time.c
@@ -15,14 +15,13 @@
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/ioport.h>
18#include <linux/io.h> 19#include <linux/io.h>
19#include <linux/kernel.h> 20#include <linux/kernel.h>
20#include <linux/time.h> 21#include <linux/time.h>
21#include <linux/irq.h> 22#include <linux/irq.h>
22#include <asm/mach/time.h> 23#include <asm/mach/time.h>
23#include <mach/generic.h> 24#include <mach/generic.h>
24#include <mach/hardware.h>
25#include <mach/irqs.h>
26 25
27/* 26/*
28 * We would use TIMER0 and TIMER1 as clockevent and clocksource. 27 * We would use TIMER0 and TIMER1 as clockevent and clocksource.
@@ -175,7 +174,7 @@ static struct irqaction spear_timer_irq = {
175 .handler = spear_timer_interrupt 174 .handler = spear_timer_interrupt
176}; 175};
177 176
178static void __init spear_clockevent_init(void) 177static void __init spear_clockevent_init(int irq)
179{ 178{
180 u32 tick_rate; 179 u32 tick_rate;
181 180
@@ -195,19 +194,19 @@ static void __init spear_clockevent_init(void)
195 194
196 clockevents_register_device(&clkevt); 195 clockevents_register_device(&clkevt);
197 196
198 setup_irq(SPEAR_GPT0_CHAN0_IRQ, &spear_timer_irq); 197 setup_irq(irq, &spear_timer_irq);
199} 198}
200 199
201void __init spear_setup_timer(void) 200void __init spear_setup_timer(resource_size_t base, int irq)
202{ 201{
203 int ret; 202 int ret;
204 203
205 if (!request_mem_region(SPEAR_GPT0_BASE, SZ_1K, "gpt0")) { 204 if (!request_mem_region(base, SZ_1K, "gpt0")) {
206 pr_err("%s:cannot get IO addr\n", __func__); 205 pr_err("%s:cannot get IO addr\n", __func__);
207 return; 206 return;
208 } 207 }
209 208
210 gpt_base = (void __iomem *)ioremap(SPEAR_GPT0_BASE, SZ_1K); 209 gpt_base = ioremap(base, SZ_1K);
211 if (!gpt_base) { 210 if (!gpt_base) {
212 pr_err("%s:ioremap failed for gpt\n", __func__); 211 pr_err("%s:ioremap failed for gpt\n", __func__);
213 goto err_mem; 212 goto err_mem;
@@ -225,7 +224,7 @@ void __init spear_setup_timer(void)
225 goto err_clk; 224 goto err_clk;
226 } 225 }
227 226
228 spear_clockevent_init(); 227 spear_clockevent_init(irq);
229 spear_clocksource_init(); 228 spear_clocksource_init();
230 229
231 return; 230 return;
@@ -235,5 +234,5 @@ err_clk:
235err_iomap: 234err_iomap:
236 iounmap(gpt_base); 235 iounmap(gpt_base);
237err_mem: 236err_mem:
238 release_mem_region(SPEAR_GPT0_BASE, SZ_1K); 237 release_mem_region(base, SZ_1K);
239} 238}
diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig
index 043f7b02a9e7..81ee7cc34457 100644
--- a/arch/arm/plat-versatile/Kconfig
+++ b/arch/arm/plat-versatile/Kconfig
@@ -5,6 +5,12 @@ config PLAT_VERSATILE_CLCD
5 5
6config PLAT_VERSATILE_FPGA_IRQ 6config PLAT_VERSATILE_FPGA_IRQ
7 bool 7 bool
8 select IRQ_DOMAIN
9
10config PLAT_VERSATILE_FPGA_IRQ_NR
11 int
12 default 4
13 depends on PLAT_VERSATILE_FPGA_IRQ
8 14
9config PLAT_VERSATILE_LEDS 15config PLAT_VERSATILE_LEDS
10 def_bool y if LEDS_CLASS 16 def_bool y if LEDS_CLASS
diff --git a/arch/arm/plat-versatile/fpga-irq.c b/arch/arm/plat-versatile/fpga-irq.c
index f0cc8e19b094..6e70d03824a1 100644
--- a/arch/arm/plat-versatile/fpga-irq.c
+++ b/arch/arm/plat-versatile/fpga-irq.c
@@ -3,7 +3,10 @@
3 */ 3 */
4#include <linux/irq.h> 4#include <linux/irq.h>
5#include <linux/io.h> 5#include <linux/io.h>
6#include <linux/irqdomain.h>
7#include <linux/module.h>
6 8
9#include <asm/exception.h>
7#include <asm/mach/irq.h> 10#include <asm/mach/irq.h>
8#include <plat/fpga-irq.h> 11#include <plat/fpga-irq.h>
9 12
@@ -12,10 +15,32 @@
12#define IRQ_ENABLE_SET 0x08 15#define IRQ_ENABLE_SET 0x08
13#define IRQ_ENABLE_CLEAR 0x0c 16#define IRQ_ENABLE_CLEAR 0x0c
14 17
18/**
19 * struct fpga_irq_data - irq data container for the FPGA IRQ controller
20 * @base: memory offset in virtual memory
21 * @irq_start: first IRQ number handled by this instance
22 * @chip: chip container for this instance
23 * @domain: IRQ domain for this instance
24 * @valid: mask for valid IRQs on this controller
25 * @used_irqs: number of active IRQs on this controller
26 */
27struct fpga_irq_data {
28 void __iomem *base;
29 unsigned int irq_start;
30 struct irq_chip chip;
31 u32 valid;
32 struct irq_domain *domain;
33 u8 used_irqs;
34};
35
36/* we cannot allocate memory when the controllers are initially registered */
37static struct fpga_irq_data fpga_irq_devices[CONFIG_PLAT_VERSATILE_FPGA_IRQ_NR];
38static int fpga_irq_id;
39
15static void fpga_irq_mask(struct irq_data *d) 40static void fpga_irq_mask(struct irq_data *d)
16{ 41{
17 struct fpga_irq_data *f = irq_data_get_irq_chip_data(d); 42 struct fpga_irq_data *f = irq_data_get_irq_chip_data(d);
18 u32 mask = 1 << (d->irq - f->irq_start); 43 u32 mask = 1 << d->hwirq;
19 44
20 writel(mask, f->base + IRQ_ENABLE_CLEAR); 45 writel(mask, f->base + IRQ_ENABLE_CLEAR);
21} 46}
@@ -23,7 +48,7 @@ static void fpga_irq_mask(struct irq_data *d)
23static void fpga_irq_unmask(struct irq_data *d) 48static void fpga_irq_unmask(struct irq_data *d)
24{ 49{
25 struct fpga_irq_data *f = irq_data_get_irq_chip_data(d); 50 struct fpga_irq_data *f = irq_data_get_irq_chip_data(d);
26 u32 mask = 1 << (d->irq - f->irq_start); 51 u32 mask = 1 << d->hwirq;
27 52
28 writel(mask, f->base + IRQ_ENABLE_SET); 53 writel(mask, f->base + IRQ_ENABLE_SET);
29} 54}
@@ -41,32 +66,93 @@ static void fpga_irq_handle(unsigned int irq, struct irq_desc *desc)
41 do { 66 do {
42 irq = ffs(status) - 1; 67 irq = ffs(status) - 1;
43 status &= ~(1 << irq); 68 status &= ~(1 << irq);
44 69 generic_handle_irq(irq_find_mapping(f->domain, irq));
45 generic_handle_irq(irq + f->irq_start);
46 } while (status); 70 } while (status);
47} 71}
48 72
49void __init fpga_irq_init(int parent_irq, u32 valid, struct fpga_irq_data *f) 73/*
74 * Handle each interrupt in a single FPGA IRQ controller. Returns non-zero
75 * if we've handled at least one interrupt. This does a single read of the
76 * status register and handles all interrupts in order from LSB first.
77 */
78static int handle_one_fpga(struct fpga_irq_data *f, struct pt_regs *regs)
79{
80 int handled = 0;
81 int irq;
82 u32 status;
83
84 while ((status = readl(f->base + IRQ_STATUS))) {
85 irq = ffs(status) - 1;
86 handle_IRQ(irq_find_mapping(f->domain, irq), regs);
87 handled = 1;
88 }
89
90 return handled;
91}
92
93/*
94 * Keep iterating over all registered FPGA IRQ controllers until there are
95 * no pending interrupts.
96 */
97asmlinkage void __exception_irq_entry fpga_handle_irq(struct pt_regs *regs)
50{ 98{
51 unsigned int i; 99 int i, handled;
52 100
101 do {
102 for (i = 0, handled = 0; i < fpga_irq_id; ++i)
103 handled |= handle_one_fpga(&fpga_irq_devices[i], regs);
104 } while (handled);
105}
106
107static int fpga_irqdomain_map(struct irq_domain *d, unsigned int irq,
108 irq_hw_number_t hwirq)
109{
110 struct fpga_irq_data *f = d->host_data;
111
112 /* Skip invalid IRQs, only register handlers for the real ones */
113 if (!(f->valid & (1 << hwirq)))
114 return -ENOTSUPP;
115 irq_set_chip_data(irq, f);
116 irq_set_chip_and_handler(irq, &f->chip,
117 handle_level_irq);
118 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
119 f->used_irqs++;
120 return 0;
121}
122
123static struct irq_domain_ops fpga_irqdomain_ops = {
124 .map = fpga_irqdomain_map,
125 .xlate = irq_domain_xlate_onetwocell,
126};
127
128void __init fpga_irq_init(void __iomem *base, const char *name, int irq_start,
129 int parent_irq, u32 valid, struct device_node *node)
130{
131 struct fpga_irq_data *f;
132
133 if (fpga_irq_id >= ARRAY_SIZE(fpga_irq_devices)) {
134 printk(KERN_ERR "%s: too few FPGA IRQ controllers, increase CONFIG_PLAT_VERSATILE_FPGA_IRQ_NR\n", __func__);
135 return;
136 }
137
138 f = &fpga_irq_devices[fpga_irq_id];
139 f->base = base;
140 f->irq_start = irq_start;
141 f->chip.name = name;
53 f->chip.irq_ack = fpga_irq_mask; 142 f->chip.irq_ack = fpga_irq_mask;
54 f->chip.irq_mask = fpga_irq_mask; 143 f->chip.irq_mask = fpga_irq_mask;
55 f->chip.irq_unmask = fpga_irq_unmask; 144 f->chip.irq_unmask = fpga_irq_unmask;
145 f->valid = valid;
56 146
57 if (parent_irq != -1) { 147 if (parent_irq != -1) {
58 irq_set_handler_data(parent_irq, f); 148 irq_set_handler_data(parent_irq, f);
59 irq_set_chained_handler(parent_irq, fpga_irq_handle); 149 irq_set_chained_handler(parent_irq, fpga_irq_handle);
60 } 150 }
61 151
62 for (i = 0; i < 32; i++) { 152 f->domain = irq_domain_add_legacy(node, fls(valid), f->irq_start, 0,
63 if (valid & (1 << i)) { 153 &fpga_irqdomain_ops, f);
64 unsigned int irq = f->irq_start + i; 154 pr_info("FPGA IRQ chip %d \"%s\" @ %p, %u irqs\n",
155 fpga_irq_id, name, base, f->used_irqs);
65 156
66 irq_set_chip_data(irq, f); 157 fpga_irq_id++;
67 irq_set_chip_and_handler(irq, &f->chip,
68 handle_level_irq);
69 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
70 }
71 }
72} 158}
diff --git a/arch/arm/plat-versatile/include/plat/fpga-irq.h b/arch/arm/plat-versatile/include/plat/fpga-irq.h
index 627fafd1e595..91bcfb67551d 100644
--- a/arch/arm/plat-versatile/include/plat/fpga-irq.h
+++ b/arch/arm/plat-versatile/include/plat/fpga-irq.h
@@ -1,12 +1,11 @@
1#ifndef PLAT_FPGA_IRQ_H 1#ifndef PLAT_FPGA_IRQ_H
2#define PLAT_FPGA_IRQ_H 2#define PLAT_FPGA_IRQ_H
3 3
4struct fpga_irq_data { 4struct device_node;
5 void __iomem *base; 5struct pt_regs;
6 unsigned int irq_start;
7 struct irq_chip chip;
8};
9 6
10void fpga_irq_init(int, u32, struct fpga_irq_data *); 7void fpga_handle_irq(struct pt_regs *regs);
8void fpga_irq_init(void __iomem *, const char *, int, int, u32,
9 struct device_node *node);
11 10
12#endif 11#endif
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index f9c9f33f8cbe..2997e56ce0dd 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -16,7 +16,7 @@
16# are merged into mainline or have been edited in the machine database 16# are merged into mainline or have been edited in the machine database
17# within the last 12 months. References to machine_is_NAME() do not count! 17# within the last 12 months. References to machine_is_NAME() do not count!
18# 18#
19# Last update: Tue Dec 6 11:07:38 2011 19# Last update: Thu Apr 26 08:44:23 2012
20# 20#
21# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number 21# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
22# 22#
@@ -205,6 +205,7 @@ omap_fsample MACH_OMAP_FSAMPLE OMAP_FSAMPLE 970
205snapper_cl15 MACH_SNAPPER_CL15 SNAPPER_CL15 986 205snapper_cl15 MACH_SNAPPER_CL15 SNAPPER_CL15 986
206omap_palmz71 MACH_OMAP_PALMZ71 OMAP_PALMZ71 993 206omap_palmz71 MACH_OMAP_PALMZ71 OMAP_PALMZ71 993
207smdk2412 MACH_SMDK2412 SMDK2412 1009 207smdk2412 MACH_SMDK2412 SMDK2412 1009
208bkde303 MACH_BKDE303 BKDE303 1021
208smdk2413 MACH_SMDK2413 SMDK2413 1022 209smdk2413 MACH_SMDK2413 SMDK2413 1022
209aml_m5900 MACH_AML_M5900 AML_M5900 1024 210aml_m5900 MACH_AML_M5900 AML_M5900 1024
210balloon3 MACH_BALLOON3 BALLOON3 1029 211balloon3 MACH_BALLOON3 BALLOON3 1029
@@ -381,8 +382,6 @@ davinci_da850_evm MACH_DAVINCI_DA850_EVM DAVINCI_DA850_EVM 2157
381at91sam9g10ek MACH_AT91SAM9G10EK AT91SAM9G10EK 2159 382at91sam9g10ek MACH_AT91SAM9G10EK AT91SAM9G10EK 2159
382omap_4430sdp MACH_OMAP_4430SDP OMAP_4430SDP 2160 383omap_4430sdp MACH_OMAP_4430SDP OMAP_4430SDP 2160
383magx_zn5 MACH_MAGX_ZN5 MAGX_ZN5 2162 384magx_zn5 MACH_MAGX_ZN5 MAGX_ZN5 2162
384btmavb101 MACH_BTMAVB101 BTMAVB101 2172
385btmawb101 MACH_BTMAWB101 BTMAWB101 2173
386tx25 MACH_TX25 TX25 2177 385tx25 MACH_TX25 TX25 2177
387omap3_torpedo MACH_OMAP3_TORPEDO OMAP3_TORPEDO 2178 386omap3_torpedo MACH_OMAP3_TORPEDO OMAP3_TORPEDO 2178
388anw6410 MACH_ANW6410 ANW6410 2183 387anw6410 MACH_ANW6410 ANW6410 2183
@@ -397,7 +396,6 @@ net2big_v2 MACH_NET2BIG_V2 NET2BIG_V2 2204
397net5big_v2 MACH_NET5BIG_V2 NET5BIG_V2 2206 396net5big_v2 MACH_NET5BIG_V2 NET5BIG_V2 2206
398inetspace_v2 MACH_INETSPACE_V2 INETSPACE_V2 2208 397inetspace_v2 MACH_INETSPACE_V2 INETSPACE_V2 2208
399at91sam9g45ekes MACH_AT91SAM9G45EKES AT91SAM9G45EKES 2212 398at91sam9g45ekes MACH_AT91SAM9G45EKES AT91SAM9G45EKES 2212
400pc7302 MACH_PC7302 PC7302 2220
401spear600 MACH_SPEAR600 SPEAR600 2236 399spear600 MACH_SPEAR600 SPEAR600 2236
402spear300 MACH_SPEAR300 SPEAR300 2237 400spear300 MACH_SPEAR300 SPEAR300 2237
403lilly1131 MACH_LILLY1131 LILLY1131 2239 401lilly1131 MACH_LILLY1131 LILLY1131 2239
@@ -407,7 +405,6 @@ d2net MACH_D2NET D2NET 2282
407bigdisk MACH_BIGDISK BIGDISK 2283 405bigdisk MACH_BIGDISK BIGDISK 2283
408at91sam9g20ek_2mmc MACH_AT91SAM9G20EK_2MMC AT91SAM9G20EK_2MMC 2288 406at91sam9g20ek_2mmc MACH_AT91SAM9G20EK_2MMC AT91SAM9G20EK_2MMC 2288
409bcmring MACH_BCMRING BCMRING 2289 407bcmring MACH_BCMRING BCMRING 2289
410dp6xx MACH_DP6XX DP6XX 2302
411mahimahi MACH_MAHIMAHI MAHIMAHI 2304 408mahimahi MACH_MAHIMAHI MAHIMAHI 2304
412smdk6442 MACH_SMDK6442 SMDK6442 2324 409smdk6442 MACH_SMDK6442 SMDK6442 2324
413openrd_base MACH_OPENRD_BASE OPENRD_BASE 2325 410openrd_base MACH_OPENRD_BASE OPENRD_BASE 2325
@@ -444,8 +441,6 @@ mx28evk MACH_MX28EVK MX28EVK 2531
444smartq5 MACH_SMARTQ5 SMARTQ5 2534 441smartq5 MACH_SMARTQ5 SMARTQ5 2534
445davinci_dm6467tevm MACH_DAVINCI_DM6467TEVM DAVINCI_DM6467TEVM 2548 442davinci_dm6467tevm MACH_DAVINCI_DM6467TEVM DAVINCI_DM6467TEVM 2548
446mxt_td60 MACH_MXT_TD60 MXT_TD60 2550 443mxt_td60 MACH_MXT_TD60 MXT_TD60 2550
447riot_bei2 MACH_RIOT_BEI2 RIOT_BEI2 2576
448riot_x37 MACH_RIOT_X37 RIOT_X37 2578
449pca101 MACH_PCA101 PCA101 2595 444pca101 MACH_PCA101 PCA101 2595
450capc7117 MACH_CAPC7117 CAPC7117 2612 445capc7117 MACH_CAPC7117 CAPC7117 2612
451icontrol MACH_ICONTROL ICONTROL 2624 446icontrol MACH_ICONTROL ICONTROL 2624
@@ -460,7 +455,6 @@ spear320 MACH_SPEAR320 SPEAR320 2661
460aquila MACH_AQUILA AQUILA 2676 455aquila MACH_AQUILA AQUILA 2676
461esata_sheevaplug MACH_ESATA_SHEEVAPLUG ESATA_SHEEVAPLUG 2678 456esata_sheevaplug MACH_ESATA_SHEEVAPLUG ESATA_SHEEVAPLUG 2678
462msm7x30_surf MACH_MSM7X30_SURF MSM7X30_SURF 2679 457msm7x30_surf MACH_MSM7X30_SURF MSM7X30_SURF 2679
463ea2478devkit MACH_EA2478DEVKIT EA2478DEVKIT 2683
464terastation_wxl MACH_TERASTATION_WXL TERASTATION_WXL 2697 458terastation_wxl MACH_TERASTATION_WXL TERASTATION_WXL 2697
465msm7x25_surf MACH_MSM7X25_SURF MSM7X25_SURF 2703 459msm7x25_surf MACH_MSM7X25_SURF MSM7X25_SURF 2703
466msm7x25_ffa MACH_MSM7X25_FFA MSM7X25_FFA 2704 460msm7x25_ffa MACH_MSM7X25_FFA MSM7X25_FFA 2704
@@ -479,8 +473,6 @@ wbd222 MACH_WBD222 WBD222 2753
479msm8x60_surf MACH_MSM8X60_SURF MSM8X60_SURF 2755 473msm8x60_surf MACH_MSM8X60_SURF MSM8X60_SURF 2755
480msm8x60_sim MACH_MSM8X60_SIM MSM8X60_SIM 2756 474msm8x60_sim MACH_MSM8X60_SIM MSM8X60_SIM 2756
481tcc8000_sdk MACH_TCC8000_SDK TCC8000_SDK 2758 475tcc8000_sdk MACH_TCC8000_SDK TCC8000_SDK 2758
482nanos MACH_NANOS NANOS 2759
483stamp9g45 MACH_STAMP9G45 STAMP9G45 2761
484cns3420vb MACH_CNS3420VB CNS3420VB 2776 476cns3420vb MACH_CNS3420VB CNS3420VB 2776
485omap4_panda MACH_OMAP4_PANDA OMAP4_PANDA 2791 477omap4_panda MACH_OMAP4_PANDA OMAP4_PANDA 2791
486ti8168evm MACH_TI8168EVM TI8168EVM 2800 478ti8168evm MACH_TI8168EVM TI8168EVM 2800
@@ -490,12 +482,9 @@ eukrea_cpuimx35sd MACH_EUKREA_CPUIMX35SD EUKREA_CPUIMX35SD 2821
490eukrea_cpuimx51sd MACH_EUKREA_CPUIMX51SD EUKREA_CPUIMX51SD 2822 482eukrea_cpuimx51sd MACH_EUKREA_CPUIMX51SD EUKREA_CPUIMX51SD 2822
491eukrea_cpuimx51 MACH_EUKREA_CPUIMX51 EUKREA_CPUIMX51 2823 483eukrea_cpuimx51 MACH_EUKREA_CPUIMX51 EUKREA_CPUIMX51 2823
492smdkc210 MACH_SMDKC210 SMDKC210 2838 484smdkc210 MACH_SMDKC210 SMDKC210 2838
493pca102 MACH_PCA102 PCA102 2843 485pcaal1 MACH_PCAAL1 PCAAL1 2843
494t5325 MACH_T5325 T5325 2846 486t5325 MACH_T5325 T5325 2846
495income MACH_INCOME INCOME 2849 487income MACH_INCOME INCOME 2849
496vvbox_sdorig2 MACH_VVBOX_SDORIG2 VVBOX_SDORIG2 2857
497vvbox_sdlite2 MACH_VVBOX_SDLITE2 VVBOX_SDLITE2 2858
498vvbox_sdpro4 MACH_VVBOX_SDPRO4 VVBOX_SDPRO4 2859
499mx257sx MACH_MX257SX MX257SX 2861 488mx257sx MACH_MX257SX MX257SX 2861
500goni MACH_GONI GONI 2862 489goni MACH_GONI GONI 2862
501bv07 MACH_BV07 BV07 2882 490bv07 MACH_BV07 BV07 2882
@@ -504,6 +493,7 @@ devixp MACH_DEVIXP DEVIXP 2885
504miccpt MACH_MICCPT MICCPT 2886 493miccpt MACH_MICCPT MICCPT 2886
505mic256 MACH_MIC256 MIC256 2887 494mic256 MACH_MIC256 MIC256 2887
506u5500 MACH_U5500 U5500 2890 495u5500 MACH_U5500 U5500 2890
496pov15hd MACH_POV15HD POV15HD 2910
507linkstation_lschl MACH_LINKSTATION_LSCHL LINKSTATION_LSCHL 2913 497linkstation_lschl MACH_LINKSTATION_LSCHL LINKSTATION_LSCHL 2913
508smdkv310 MACH_SMDKV310 SMDKV310 2925 498smdkv310 MACH_SMDKV310 SMDKV310 2925
509wm8505_7in_netbook MACH_WM8505_7IN_NETBOOK WM8505_7IN_NETBOOK 2928 499wm8505_7in_netbook MACH_WM8505_7IN_NETBOOK WM8505_7IN_NETBOOK 2928
@@ -537,243 +527,24 @@ trimslice MACH_TRIMSLICE TRIMSLICE 3209
537mackerel MACH_MACKEREL MACKEREL 3211 527mackerel MACH_MACKEREL MACKEREL 3211
538kaen MACH_KAEN KAEN 3217 528kaen MACH_KAEN KAEN 3217
539nokia_rm680 MACH_NOKIA_RM680 NOKIA_RM680 3220 529nokia_rm680 MACH_NOKIA_RM680 NOKIA_RM680 3220
540dm6446_adbox MACH_DM6446_ADBOX DM6446_ADBOX 3226
541quad_salsa MACH_QUAD_SALSA QUAD_SALSA 3227
542abb_gma_1_1 MACH_ABB_GMA_1_1 ABB_GMA_1_1 3228
543svcid MACH_SVCID SVCID 3229
544msm8960_sim MACH_MSM8960_SIM MSM8960_SIM 3230 530msm8960_sim MACH_MSM8960_SIM MSM8960_SIM 3230
545msm8960_rumi3 MACH_MSM8960_RUMI3 MSM8960_RUMI3 3231 531msm8960_rumi3 MACH_MSM8960_RUMI3 MSM8960_RUMI3 3231
546icon_g MACH_ICON_G ICON_G 3232
547mb3 MACH_MB3 MB3 3233
548gsia18s MACH_GSIA18S GSIA18S 3234 532gsia18s MACH_GSIA18S GSIA18S 3234
549pivicc MACH_PIVICC PIVICC 3235
550pcm048 MACH_PCM048 PCM048 3236
551dds MACH_DDS DDS 3237
552chalten_xa1 MACH_CHALTEN_XA1 CHALTEN_XA1 3238
553ts48xx MACH_TS48XX TS48XX 3239
554tonga2_tfttimer MACH_TONGA2_TFTTIMER TONGA2_TFTTIMER 3240
555whistler MACH_WHISTLER WHISTLER 3241
556asl_phoenix MACH_ASL_PHOENIX ASL_PHOENIX 3242
557at91sam9263otlite MACH_AT91SAM9263OTLITE AT91SAM9263OTLITE 3243
558ddplug MACH_DDPLUG DDPLUG 3244
559d2plug MACH_D2PLUG D2PLUG 3245
560kzm9d MACH_KZM9D KZM9D 3246
561verdi_lte MACH_VERDI_LTE VERDI_LTE 3247
562nanozoom MACH_NANOZOOM NANOZOOM 3248
563dm3730_som_lv MACH_DM3730_SOM_LV DM3730_SOM_LV 3249
564dm3730_torpedo MACH_DM3730_TORPEDO DM3730_TORPEDO 3250
565anchovy MACH_ANCHOVY ANCHOVY 3251
566re2rev20 MACH_RE2REV20 RE2REV20 3253
567re2rev21 MACH_RE2REV21 RE2REV21 3254
568cns21xx MACH_CNS21XX CNS21XX 3255
569rider MACH_RIDER RIDER 3257
570nsk330 MACH_NSK330 NSK330 3258
571cns2133evb MACH_CNS2133EVB CNS2133EVB 3259
572z3_816x_mod MACH_Z3_816X_MOD Z3_816X_MOD 3260
573z3_814x_mod MACH_Z3_814X_MOD Z3_814X_MOD 3261
574beect MACH_BEECT BEECT 3262
575dma_thunderbug MACH_DMA_THUNDERBUG DMA_THUNDERBUG 3263
576omn_at91sam9g20 MACH_OMN_AT91SAM9G20 OMN_AT91SAM9G20 3264
577mx25_e2s_uc MACH_MX25_E2S_UC MX25_E2S_UC 3265
578mione MACH_MIONE MIONE 3266
579top9000_tcu MACH_TOP9000_TCU TOP9000_TCU 3267
580top9000_bsl MACH_TOP9000_BSL TOP9000_BSL 3268
581kingdom MACH_KINGDOM KINGDOM 3269
582armadillo460 MACH_ARMADILLO460 ARMADILLO460 3270
583lq2 MACH_LQ2 LQ2 3271
584sweda_tms2 MACH_SWEDA_TMS2 SWEDA_TMS2 3272
585mx53_loco MACH_MX53_LOCO MX53_LOCO 3273 533mx53_loco MACH_MX53_LOCO MX53_LOCO 3273
586acer_a8 MACH_ACER_A8 ACER_A8 3275
587acer_gauguin MACH_ACER_GAUGUIN ACER_GAUGUIN 3276
588guppy MACH_GUPPY GUPPY 3277
589mx61_ard MACH_MX61_ARD MX61_ARD 3278
590tx53 MACH_TX53 TX53 3279 534tx53 MACH_TX53 TX53 3279
591omapl138_case_a3 MACH_OMAPL138_CASE_A3 OMAPL138_CASE_A3 3280
592uemd MACH_UEMD UEMD 3281
593ccwmx51mut MACH_CCWMX51MUT CCWMX51MUT 3282
594rockhopper MACH_ROCKHOPPER ROCKHOPPER 3283
595encore MACH_ENCORE ENCORE 3284 535encore MACH_ENCORE ENCORE 3284
596hkdkc100 MACH_HKDKC100 HKDKC100 3285
597ts42xx MACH_TS42XX TS42XX 3286
598aebl MACH_AEBL AEBL 3287
599wario MACH_WARIO WARIO 3288 536wario MACH_WARIO WARIO 3288
600gfs_spm MACH_GFS_SPM GFS_SPM 3289
601cm_t3730 MACH_CM_T3730 CM_T3730 3290 537cm_t3730 MACH_CM_T3730 CM_T3730 3290
602isc3 MACH_ISC3 ISC3 3291
603rascal MACH_RASCAL RASCAL 3292
604hrefv60 MACH_HREFV60 HREFV60 3293 538hrefv60 MACH_HREFV60 HREFV60 3293
605tpt_2_0 MACH_TPT_2_0 TPT_2_0 3294
606splendor MACH_SPLENDOR SPLENDOR 3296
607msm8x60_qt MACH_MSM8X60_QT MSM8X60_QT 3298
608htc_hd_mini MACH_HTC_HD_MINI HTC_HD_MINI 3299
609athene MACH_ATHENE ATHENE 3300
610deep_r_ek_1 MACH_DEEP_R_EK_1 DEEP_R_EK_1 3301
611vivow_ct MACH_VIVOW_CT VIVOW_CT 3302
612nery_1000 MACH_NERY_1000 NERY_1000 3303
613rfl109145_ssrv MACH_RFL109145_SSRV RFL109145_SSRV 3304
614nmh MACH_NMH NMH 3305
615wn802t MACH_WN802T WN802T 3306
616dragonet MACH_DRAGONET DRAGONET 3307
617at91sam9263desk16l MACH_AT91SAM9263DESK16L AT91SAM9263DESK16L 3309
618bcmhana_sv MACH_BCMHANA_SV BCMHANA_SV 3310
619bcmhana_tablet MACH_BCMHANA_TABLET BCMHANA_TABLET 3311
620koi MACH_KOI KOI 3312
621ts4800 MACH_TS4800 TS4800 3313
622tqma9263 MACH_TQMA9263 TQMA9263 3314
623holiday MACH_HOLIDAY HOLIDAY 3315
624pcats_overlay MACH_PCATS_OVERLAY PCATS_OVERLAY 3317
625hwgw6410 MACH_HWGW6410 HWGW6410 3318
626shenzhou MACH_SHENZHOU SHENZHOU 3319
627cwme9210 MACH_CWME9210 CWME9210 3320
628cwme9210js MACH_CWME9210JS CWME9210JS 3321
629colibri_tegra2 MACH_COLIBRI_TEGRA2 COLIBRI_TEGRA2 3323
630w21 MACH_W21 W21 3324
631polysat1 MACH_POLYSAT1 POLYSAT1 3325
632dataway MACH_DATAWAY DATAWAY 3326
633cobral138 MACH_COBRAL138 COBRAL138 3327
634roverpcs8 MACH_ROVERPCS8 ROVERPCS8 3328
635marvelc MACH_MARVELC MARVELC 3329
636navefihid MACH_NAVEFIHID NAVEFIHID 3330
637dm365_cv100 MACH_DM365_CV100 DM365_CV100 3331
638able MACH_ABLE ABLE 3332
639legacy MACH_LEGACY LEGACY 3333
640icong MACH_ICONG ICONG 3334
641rover_g8 MACH_ROVER_G8 ROVER_G8 3335
642t5388p MACH_T5388P T5388P 3336
643dingo MACH_DINGO DINGO 3337
644goflexhome MACH_GOFLEXHOME GOFLEXHOME 3338
645lanreadyfn511 MACH_LANREADYFN511 LANREADYFN511 3340
646omap3_baia MACH_OMAP3_BAIA OMAP3_BAIA 3341
647omap3smartdisplay MACH_OMAP3SMARTDISPLAY OMAP3SMARTDISPLAY 3342
648xilinx MACH_XILINX XILINX 3343
649a2f MACH_A2F A2F 3344
650sky25 MACH_SKY25 SKY25 3345
651ccmx53 MACH_CCMX53 CCMX53 3346
652ccmx53js MACH_CCMX53JS CCMX53JS 3347
653ccwmx53 MACH_CCWMX53 CCWMX53 3348
654ccwmx53js MACH_CCWMX53JS CCWMX53JS 3349
655frisms MACH_FRISMS FRISMS 3350
656msm7x27a_ffa MACH_MSM7X27A_FFA MSM7X27A_FFA 3351
657msm7x27a_surf MACH_MSM7X27A_SURF MSM7X27A_SURF 3352
658msm7x27a_rumi3 MACH_MSM7X27A_RUMI3 MSM7X27A_RUMI3 3353
659dimmsam9g20 MACH_DIMMSAM9G20 DIMMSAM9G20 3354
660dimm_imx28 MACH_DIMM_IMX28 DIMM_IMX28 3355
661amk_a4 MACH_AMK_A4 AMK_A4 3356
662gnet_sgme MACH_GNET_SGME GNET_SGME 3357
663shooter_u MACH_SHOOTER_U SHOOTER_U 3358
664vmx53 MACH_VMX53 VMX53 3359
665rhino MACH_RHINO RHINO 3360
666armlex4210 MACH_ARMLEX4210 ARMLEX4210 3361 539armlex4210 MACH_ARMLEX4210 ARMLEX4210 3361
667swarcoextmodem MACH_SWARCOEXTMODEM SWARCOEXTMODEM 3362
668snowball MACH_SNOWBALL SNOWBALL 3363 540snowball MACH_SNOWBALL SNOWBALL 3363
669pcm049 MACH_PCM049 PCM049 3364
670vigor MACH_VIGOR VIGOR 3365
671oslo_amundsen MACH_OSLO_AMUNDSEN OSLO_AMUNDSEN 3366
672gsl_diamond MACH_GSL_DIAMOND GSL_DIAMOND 3367
673cv2201 MACH_CV2201 CV2201 3368
674cv2202 MACH_CV2202 CV2202 3369
675cv2203 MACH_CV2203 CV2203 3370
676vit_ibox MACH_VIT_IBOX VIT_IBOX 3371
677dm6441_esp MACH_DM6441_ESP DM6441_ESP 3372
678at91sam9x5ek MACH_AT91SAM9X5EK AT91SAM9X5EK 3373
679libra MACH_LIBRA LIBRA 3374
680easycrrh MACH_EASYCRRH EASYCRRH 3375
681tripel MACH_TRIPEL TRIPEL 3376
682endian_mini MACH_ENDIAN_MINI ENDIAN_MINI 3377
683xilinx_ep107 MACH_XILINX_EP107 XILINX_EP107 3378 541xilinx_ep107 MACH_XILINX_EP107 XILINX_EP107 3378
684nuri MACH_NURI NURI 3379 542nuri MACH_NURI NURI 3379
685janus MACH_JANUS JANUS 3380
686ddnas MACH_DDNAS DDNAS 3381
687tag MACH_TAG TAG 3382
688tagw MACH_TAGW TAGW 3383
689nitrogen_vm_imx51 MACH_NITROGEN_VM_IMX51 NITROGEN_VM_IMX51 3384
690viprinet MACH_VIPRINET VIPRINET 3385
691bockw MACH_BOCKW BOCKW 3386
692eva2000 MACH_EVA2000 EVA2000 3387
693steelyard MACH_STEELYARD STEELYARD 3388
694nsslsboard MACH_NSSLSBOARD NSSLSBOARD 3392
695geneva_b5 MACH_GENEVA_B5 GENEVA_B5 3393
696spear1340 MACH_SPEAR1340 SPEAR1340 3394
697rexmas MACH_REXMAS REXMAS 3395
698msm8960_cdp MACH_MSM8960_CDP MSM8960_CDP 3396
699msm8960_fluid MACH_MSM8960_FLUID MSM8960_FLUID 3398
700msm8960_apq MACH_MSM8960_APQ MSM8960_APQ 3399
701helios_v2 MACH_HELIOS_V2 HELIOS_V2 3400
702mif10p MACH_MIF10P MIF10P 3401
703iam28 MACH_IAM28 IAM28 3402
704picasso MACH_PICASSO PICASSO 3403
705mr301a MACH_MR301A MR301A 3404
706notle MACH_NOTLE NOTLE 3405
707eelx2 MACH_EELX2 EELX2 3406
708moon MACH_MOON MOON 3407
709ruby MACH_RUBY RUBY 3408
710goldengate MACH_GOLDENGATE GOLDENGATE 3409
711ctbu_gen2 MACH_CTBU_GEN2 CTBU_GEN2 3410
712kmp_am17_01 MACH_KMP_AM17_01 KMP_AM17_01 3411
713wtplug MACH_WTPLUG WTPLUG 3412 543wtplug MACH_WTPLUG WTPLUG 3412
714mx27su2 MACH_MX27SU2 MX27SU2 3413
715nb31 MACH_NB31 NB31 3414
716hjsdu MACH_HJSDU HJSDU 3415
717td3_rev1 MACH_TD3_REV1 TD3_REV1 3416
718eag_ci4000 MACH_EAG_CI4000 EAG_CI4000 3417
719net5big_nand_v2 MACH_NET5BIG_NAND_V2 NET5BIG_NAND_V2 3418
720cpx2 MACH_CPX2 CPX2 3419
721net2big_nand_v2 MACH_NET2BIG_NAND_V2 NET2BIG_NAND_V2 3420
722ecuv5 MACH_ECUV5 ECUV5 3421
723hsgx6d MACH_HSGX6D HSGX6D 3422
724dawad7 MACH_DAWAD7 DAWAD7 3423
725sam9repeater MACH_SAM9REPEATER SAM9REPEATER 3424
726gt_i5700 MACH_GT_I5700 GT_I5700 3425
727ctera_plug_c2 MACH_CTERA_PLUG_C2 CTERA_PLUG_C2 3426
728marvelct MACH_MARVELCT MARVELCT 3427
729ag11005 MACH_AG11005 AG11005 3428
730vangogh MACH_VANGOGH VANGOGH 3430
731matrix505 MACH_MATRIX505 MATRIX505 3431
732oce_nigma MACH_OCE_NIGMA OCE_NIGMA 3432
733t55 MACH_T55 T55 3433
734bio3k MACH_BIO3K BIO3K 3434
735expressct MACH_EXPRESSCT EXPRESSCT 3435
736cardhu MACH_CARDHU CARDHU 3436
737aruba MACH_ARUBA ARUBA 3437
738bonaire MACH_BONAIRE BONAIRE 3438
739nuc700evb MACH_NUC700EVB NUC700EVB 3439
740nuc710evb MACH_NUC710EVB NUC710EVB 3440
741nuc740evb MACH_NUC740EVB NUC740EVB 3441
742nuc745evb MACH_NUC745EVB NUC745EVB 3442
743transcede MACH_TRANSCEDE TRANSCEDE 3443
744mora MACH_MORA MORA 3444
745nda_evm MACH_NDA_EVM NDA_EVM 3445
746timu MACH_TIMU TIMU 3446
747expressh MACH_EXPRESSH EXPRESSH 3447
748veridis_a300 MACH_VERIDIS_A300 VERIDIS_A300 3448 544veridis_a300 MACH_VERIDIS_A300 VERIDIS_A300 3448
749dm368_leopard MACH_DM368_LEOPARD DM368_LEOPARD 3449
750omap_mcop MACH_OMAP_MCOP OMAP_MCOP 3450
751tritip MACH_TRITIP TRITIP 3451
752sm1k MACH_SM1K SM1K 3452
753monch MACH_MONCH MONCH 3453
754curacao MACH_CURACAO CURACAO 3454
755origen MACH_ORIGEN ORIGEN 3455 545origen MACH_ORIGEN ORIGEN 3455
756epc10 MACH_EPC10 EPC10 3456
757sgh_i740 MACH_SGH_I740 SGH_I740 3457
758tuna MACH_TUNA TUNA 3458
759mx51_tulip MACH_MX51_TULIP MX51_TULIP 3459
760mx51_aster7 MACH_MX51_ASTER7 MX51_ASTER7 3460
761acro37xbrd MACH_ACRO37XBRD ACRO37XBRD 3461
762elke MACH_ELKE ELKE 3462
763sbc6000x MACH_SBC6000X SBC6000X 3463
764r1801e MACH_R1801E R1801E 3464
765h1600 MACH_H1600 H1600 3465
766mini210 MACH_MINI210 MINI210 3466
767mini8168 MACH_MINI8168 MINI8168 3467
768pc7308 MACH_PC7308 PC7308 3468
769kmm2m01 MACH_KMM2M01 KMM2M01 3470
770mx51erebus MACH_MX51EREBUS MX51EREBUS 3471
771wm8650refboard MACH_WM8650REFBOARD WM8650REFBOARD 3472 546wm8650refboard MACH_WM8650REFBOARD WM8650REFBOARD 3472
772tuxrail MACH_TUXRAIL TUXRAIL 3473
773arthur MACH_ARTHUR ARTHUR 3474
774doorboy MACH_DOORBOY DOORBOY 3475
775xarina MACH_XARINA XARINA 3476 547xarina MACH_XARINA XARINA 3476
776roverx7 MACH_ROVERX7 ROVERX7 3477
777sdvr MACH_SDVR SDVR 3478 548sdvr MACH_SDVR SDVR 3478
778acer_maya MACH_ACER_MAYA ACER_MAYA 3479 549acer_maya MACH_ACER_MAYA ACER_MAYA 3479
779pico MACH_PICO PICO 3480 550pico MACH_PICO PICO 3480
@@ -999,6 +770,7 @@ promwad_jade MACH_PROMWAD_JADE PROMWAD_JADE 3708
999amp MACH_AMP AMP 3709 770amp MACH_AMP AMP 3709
1000gnet_amp MACH_GNET_AMP GNET_AMP 3710 771gnet_amp MACH_GNET_AMP GNET_AMP 3710
1001toques MACH_TOQUES TOQUES 3711 772toques MACH_TOQUES TOQUES 3711
773apx4devkit MACH_APX4DEVKIT APX4DEVKIT 3712
1002dct_storm MACH_DCT_STORM DCT_STORM 3713 774dct_storm MACH_DCT_STORM DCT_STORM 3713
1003owl MACH_OWL OWL 3715 775owl MACH_OWL OWL 3715
1004cogent_csb1741 MACH_COGENT_CSB1741 COGENT_CSB1741 3716 776cogent_csb1741 MACH_COGENT_CSB1741 COGENT_CSB1741 3716
@@ -1063,7 +835,6 @@ shelter MACH_SHELTER SHELTER 3778
1063omap3_devkit8500 MACH_OMAP3_DEVKIT8500 OMAP3_DEVKIT8500 3779 835omap3_devkit8500 MACH_OMAP3_DEVKIT8500 OMAP3_DEVKIT8500 3779
1064edgetd MACH_EDGETD EDGETD 3780 836edgetd MACH_EDGETD EDGETD 3780
1065copperyard MACH_COPPERYARD COPPERYARD 3781 837copperyard MACH_COPPERYARD COPPERYARD 3781
1066edge MACH_EDGE EDGE 3782
1067edge_u MACH_EDGE_U EDGE_U 3783 838edge_u MACH_EDGE_U EDGE_U 3783
1068edge_td MACH_EDGE_TD EDGE_TD 3784 839edge_td MACH_EDGE_TD EDGE_TD 3784
1069wdss MACH_WDSS WDSS 3785 840wdss MACH_WDSS WDSS 3785
@@ -1169,3 +940,269 @@ elite_ulk MACH_ELITE_ULK ELITE_ULK 3888
1169pov2 MACH_POV2 POV2 3889 940pov2 MACH_POV2 POV2 3889
1170ipod_touch_2g MACH_IPOD_TOUCH_2G IPOD_TOUCH_2G 3890 941ipod_touch_2g MACH_IPOD_TOUCH_2G IPOD_TOUCH_2G 3890
1171da850_pqab MACH_DA850_PQAB DA850_PQAB 3891 942da850_pqab MACH_DA850_PQAB DA850_PQAB 3891
943fermi MACH_FERMI FERMI 3892
944ccardwmx28 MACH_CCARDWMX28 CCARDWMX28 3893
945ccardmx28 MACH_CCARDMX28 CCARDMX28 3894
946fs20_fcm2050 MACH_FS20_FCM2050 FS20_FCM2050 3895
947kinetis MACH_KINETIS KINETIS 3896
948kai MACH_KAI KAI 3897
949bcthb2 MACH_BCTHB2 BCTHB2 3898
950inels3_cu MACH_INELS3_CU INELS3_CU 3899
951da850_apollo MACH_DA850_APOLLO DA850_APOLLO 3901
952tracnas MACH_TRACNAS TRACNAS 3902
953mityarm335x MACH_MITYARM335X MITYARM335X 3903
954xcgz7x MACH_XCGZ7X XCGZ7X 3904
955cubox MACH_CUBOX CUBOX 3905
956terminator MACH_TERMINATOR TERMINATOR 3906
957eye03 MACH_EYE03 EYE03 3907
958kota3 MACH_KOTA3 KOTA3 3908
959pscpe MACH_PSCPE PSCPE 3910
960akt1100 MACH_AKT1100 AKT1100 3911
961pcaaxl2 MACH_PCAAXL2 PCAAXL2 3912
962primodd_ct MACH_PRIMODD_CT PRIMODD_CT 3913
963nsbc MACH_NSBC NSBC 3914
964meson2_skt MACH_MESON2_SKT MESON2_SKT 3915
965meson2_ref MACH_MESON2_REF MESON2_REF 3916
966ccardwmx28js MACH_CCARDWMX28JS CCARDWMX28JS 3917
967ccardmx28js MACH_CCARDMX28JS CCARDMX28JS 3918
968indico MACH_INDICO INDICO 3919
969msm8960dt MACH_MSM8960DT MSM8960DT 3920
970primods MACH_PRIMODS PRIMODS 3921
971beluga_m1388 MACH_BELUGA_M1388 BELUGA_M1388 3922
972primotd MACH_PRIMOTD PRIMOTD 3923
973varan_master MACH_VARAN_MASTER VARAN_MASTER 3924
974primodd MACH_PRIMODD PRIMODD 3925
975jetduo MACH_JETDUO JETDUO 3926
976mx53_umobo MACH_MX53_UMOBO MX53_UMOBO 3927
977trats MACH_TRATS TRATS 3928
978starcraft MACH_STARCRAFT STARCRAFT 3929
979qseven_tegra2 MACH_QSEVEN_TEGRA2 QSEVEN_TEGRA2 3930
980lichee_sun4i_devbd MACH_LICHEE_SUN4I_DEVBD LICHEE_SUN4I_DEVBD 3931
981movenow MACH_MOVENOW MOVENOW 3932
982golf_u MACH_GOLF_U GOLF_U 3933
983msm7627a_evb MACH_MSM7627A_EVB MSM7627A_EVB 3934
984rambo MACH_RAMBO RAMBO 3935
985golfu MACH_GOLFU GOLFU 3936
986mango310 MACH_MANGO310 MANGO310 3937
987dns343 MACH_DNS343 DNS343 3938
988var_som_om44 MACH_VAR_SOM_OM44 VAR_SOM_OM44 3939
989naon MACH_NAON NAON 3940
990vp4000 MACH_VP4000 VP4000 3941
991impcard MACH_IMPCARD IMPCARD 3942
992smoovcam MACH_SMOOVCAM SMOOVCAM 3943
993cobham3725 MACH_COBHAM3725 COBHAM3725 3944
994cobham3730 MACH_COBHAM3730 COBHAM3730 3945
995cobham3703 MACH_COBHAM3703 COBHAM3703 3946
996quetzal MACH_QUETZAL QUETZAL 3947
997apq8064_cdp MACH_APQ8064_CDP APQ8064_CDP 3948
998apq8064_mtp MACH_APQ8064_MTP APQ8064_MTP 3949
999apq8064_fluid MACH_APQ8064_FLUID APQ8064_FLUID 3950
1000apq8064_liquid MACH_APQ8064_LIQUID APQ8064_LIQUID 3951
1001mango210 MACH_MANGO210 MANGO210 3952
1002mango100 MACH_MANGO100 MANGO100 3953
1003mango24 MACH_MANGO24 MANGO24 3954
1004mango64 MACH_MANGO64 MANGO64 3955
1005nsa320 MACH_NSA320 NSA320 3956
1006elv_ccu2 MACH_ELV_CCU2 ELV_CCU2 3957
1007triton_x00 MACH_TRITON_X00 TRITON_X00 3958
1008triton_1500_2000 MACH_TRITON_1500_2000 TRITON_1500_2000 3959
1009pogoplugv4 MACH_POGOPLUGV4 POGOPLUGV4 3960
1010venus_cl MACH_VENUS_CL VENUS_CL 3961
1011vulcano_g20 MACH_VULCANO_G20 VULCANO_G20 3962
1012sgs_i9100 MACH_SGS_I9100 SGS_I9100 3963
1013stsv2 MACH_STSV2 STSV2 3964
1014csb1724 MACH_CSB1724 CSB1724 3965
1015omapl138_lcdk MACH_OMAPL138_LCDK OMAPL138_LCDK 3966
1016pvd_mx25 MACH_PVD_MX25 PVD_MX25 3968
1017meson6_skt MACH_MESON6_SKT MESON6_SKT 3969
1018meson6_ref MACH_MESON6_REF MESON6_REF 3970
1019pxm MACH_PXM PXM 3971
1020pogoplugv3 MACH_POGOPLUGV3 POGOPLUGV3 3973
1021mlp89626 MACH_MLP89626 MLP89626 3974
1022iomegahmndce MACH_IOMEGAHMNDCE IOMEGAHMNDCE 3975
1023pogoplugv3pci MACH_POGOPLUGV3PCI POGOPLUGV3PCI 3976
1024bntv250 MACH_BNTV250 BNTV250 3977
1025mx53_qseven MACH_MX53_QSEVEN MX53_QSEVEN 3978
1026gtl_it1100 MACH_GTL_IT1100 GTL_IT1100 3979
1027mx6q_sabresd MACH_MX6Q_SABRESD MX6Q_SABRESD 3980
1028mt4 MACH_MT4 MT4 3981
1029jumbo_d MACH_JUMBO_D JUMBO_D 3982
1030jumbo_i MACH_JUMBO_I JUMBO_I 3983
1031fs20_dmp MACH_FS20_DMP FS20_DMP 3984
1032dns320 MACH_DNS320 DNS320 3985
1033mx28bacos MACH_MX28BACOS MX28BACOS 3986
1034tl80 MACH_TL80 TL80 3987
1035polatis_nic_1001 MACH_POLATIS_NIC_1001 POLATIS_NIC_1001 3988
1036tely MACH_TELY TELY 3989
1037u8520 MACH_U8520 U8520 3990
1038manta MACH_MANTA MANTA 3991
1039mpq8064_cdp MACH_MPQ8064_CDP MPQ8064_CDP 3993
1040mpq8064_dtv MACH_MPQ8064_DTV MPQ8064_DTV 3995
1041dm368som MACH_DM368SOM DM368SOM 3996
1042gprisb2 MACH_GPRISB2 GPRISB2 3997
1043chammid MACH_CHAMMID CHAMMID 3998
1044seoul2 MACH_SEOUL2 SEOUL2 3999
1045omap4_nooktablet MACH_OMAP4_NOOKTABLET OMAP4_NOOKTABLET 4000
1046aalto MACH_AALTO AALTO 4001
1047metro MACH_METRO METRO 4002
1048cydm3730 MACH_CYDM3730 CYDM3730 4003
1049tqma53 MACH_TQMA53 TQMA53 4004
1050msm7627a_qrd3 MACH_MSM7627A_QRD3 MSM7627A_QRD3 4005
1051mx28_canby MACH_MX28_CANBY MX28_CANBY 4006
1052tiger MACH_TIGER TIGER 4007
1053pcats_9307_type_a MACH_PCATS_9307_TYPE_A PCATS_9307_TYPE_A 4008
1054pcats_9307_type_o MACH_PCATS_9307_TYPE_O PCATS_9307_TYPE_O 4009
1055pcats_9307_type_r MACH_PCATS_9307_TYPE_R PCATS_9307_TYPE_R 4010
1056streamplug MACH_STREAMPLUG STREAMPLUG 4011
1057icechicken_dev MACH_ICECHICKEN_DEV ICECHICKEN_DEV 4012
1058hedgehog MACH_HEDGEHOG HEDGEHOG 4013
1059yusend_obc MACH_YUSEND_OBC YUSEND_OBC 4014
1060imxninja MACH_IMXNINJA IMXNINJA 4015
1061omap4_jarod MACH_OMAP4_JAROD OMAP4_JAROD 4016
1062eco5_pk MACH_ECO5_PK ECO5_PK 4017
1063qj2440 MACH_QJ2440 QJ2440 4018
1064mx6q_mercury MACH_MX6Q_MERCURY MX6Q_MERCURY 4019
1065cm6810 MACH_CM6810 CM6810 4020
1066omap4_torpedo MACH_OMAP4_TORPEDO OMAP4_TORPEDO 4021
1067nsa310 MACH_NSA310 NSA310 4022
1068tmx536 MACH_TMX536 TMX536 4023
1069ktt20 MACH_KTT20 KTT20 4024
1070dragonix MACH_DRAGONIX DRAGONIX 4025
1071lungching MACH_LUNGCHING LUNGCHING 4026
1072bulogics MACH_BULOGICS BULOGICS 4027
1073mx535_sx MACH_MX535_SX MX535_SX 4028
1074ngui3250 MACH_NGUI3250 NGUI3250 4029
1075salutec_dac MACH_SALUTEC_DAC SALUTEC_DAC 4030
1076loco MACH_LOCO LOCO 4031
1077ctera_plug_usi MACH_CTERA_PLUG_USI CTERA_PLUG_USI 4032
1078scepter MACH_SCEPTER SCEPTER 4033
1079sga MACH_SGA SGA 4034
1080p_81_j5 MACH_P_81_J5 P_81_J5 4035
1081p_81_o4 MACH_P_81_O4 P_81_O4 4036
1082msm8625_surf MACH_MSM8625_SURF MSM8625_SURF 4037
1083carallon_shark MACH_CARALLON_SHARK CARALLON_SHARK 4038
1084ordog MACH_ORDOG ORDOG 4040
1085puente_io MACH_PUENTE_IO PUENTE_IO 4041
1086msm8625_evb MACH_MSM8625_EVB MSM8625_EVB 4042
1087ev_am1707 MACH_EV_AM1707 EV_AM1707 4043
1088ev_am1707e2 MACH_EV_AM1707E2 EV_AM1707E2 4044
1089ev_am3517e2 MACH_EV_AM3517E2 EV_AM3517E2 4045
1090calabria MACH_CALABRIA CALABRIA 4046
1091ev_imx287 MACH_EV_IMX287 EV_IMX287 4047
1092erau MACH_ERAU ERAU 4048
1093sichuan MACH_SICHUAN SICHUAN 4049
1094davinci_da850 MACH_DAVINCI_DA850 DAVINCI_DA850 4051
1095omap138_trunarc MACH_OMAP138_TRUNARC OMAP138_TRUNARC 4052
1096bcm4761 MACH_BCM4761 BCM4761 4053
1097picasso_e2 MACH_PICASSO_E2 PICASSO_E2 4054
1098picasso_mf MACH_PICASSO_MF PICASSO_MF 4055
1099miro MACH_MIRO MIRO 4056
1100at91sam9g20ewon3 MACH_AT91SAM9G20EWON3 AT91SAM9G20EWON3 4057
1101yoyo MACH_YOYO YOYO 4058
1102windjkl MACH_WINDJKL WINDJKL 4059
1103monarudo MACH_MONARUDO MONARUDO 4060
1104batan MACH_BATAN BATAN 4061
1105tadao MACH_TADAO TADAO 4062
1106baso MACH_BASO BASO 4063
1107mahon MACH_MAHON MAHON 4064
1108villec2 MACH_VILLEC2 VILLEC2 4065
1109asi1230 MACH_ASI1230 ASI1230 4066
1110alaska MACH_ALASKA ALASKA 4067
1111swarco_shdsl2 MACH_SWARCO_SHDSL2 SWARCO_SHDSL2 4068
1112oxrtu MACH_OXRTU OXRTU 4069
1113omap5_panda MACH_OMAP5_PANDA OMAP5_PANDA 4070
1114c8000 MACH_C8000 C8000 4072
1115bje_display3_5 MACH_BJE_DISPLAY3_5 BJE_DISPLAY3_5 4073
1116picomod7 MACH_PICOMOD7 PICOMOD7 4074
1117picocom5 MACH_PICOCOM5 PICOCOM5 4075
1118qblissa8 MACH_QBLISSA8 QBLISSA8 4076
1119armstonea8 MACH_ARMSTONEA8 ARMSTONEA8 4077
1120netdcu14 MACH_NETDCU14 NETDCU14 4078
1121at91sam9x5_epiphan MACH_AT91SAM9X5_EPIPHAN AT91SAM9X5_EPIPHAN 4079
1122p2u MACH_P2U P2U 4080
1123doris MACH_DORIS DORIS 4081
1124j49 MACH_J49 J49 4082
1125vdss2e MACH_VDSS2E VDSS2E 4083
1126vc300 MACH_VC300 VC300 4084
1127ns115_pad_test MACH_NS115_PAD_TEST NS115_PAD_TEST 4085
1128ns115_pad_ref MACH_NS115_PAD_REF NS115_PAD_REF 4086
1129ns115_phone_test MACH_NS115_PHONE_TEST NS115_PHONE_TEST 4087
1130ns115_phone_ref MACH_NS115_PHONE_REF NS115_PHONE_REF 4088
1131golfc MACH_GOLFC GOLFC 4089
1132xerox_olympus MACH_XEROX_OLYMPUS XEROX_OLYMPUS 4090
1133mx6sl_arm2 MACH_MX6SL_ARM2 MX6SL_ARM2 4091
1134csb1701_csb1726 MACH_CSB1701_CSB1726 CSB1701_CSB1726 4092
1135at91sam9xeek MACH_AT91SAM9XEEK AT91SAM9XEEK 4093
1136ebv210 MACH_EBV210 EBV210 4094
1137msm7627a_qrd7 MACH_MSM7627A_QRD7 MSM7627A_QRD7 4095
1138svthin MACH_SVTHIN SVTHIN 4096
1139duovero MACH_DUOVERO DUOVERO 4097
1140chupacabra MACH_CHUPACABRA CHUPACABRA 4098
1141scorpion MACH_SCORPION SCORPION 4099
1142davinci_he_hmi10 MACH_DAVINCI_HE_HMI10 DAVINCI_HE_HMI10 4100
1143topkick MACH_TOPKICK TOPKICK 4101
1144m3_auguestrush MACH_M3_AUGUESTRUSH M3_AUGUESTRUSH 4102
1145ipc335x MACH_IPC335X IPC335X 4103
1146sun4i MACH_SUN4I SUN4I 4104
1147imx233_olinuxino MACH_IMX233_OLINUXINO IMX233_OLINUXINO 4105
1148k2_wl MACH_K2_WL K2_WL 4106
1149k2_ul MACH_K2_UL K2_UL 4107
1150k2_cl MACH_K2_CL K2_CL 4108
1151minbari_w MACH_MINBARI_W MINBARI_W 4109
1152minbari_m MACH_MINBARI_M MINBARI_M 4110
1153k035 MACH_K035 K035 4111
1154ariel MACH_ARIEL ARIEL 4112
1155arielsaarc MACH_ARIELSAARC ARIELSAARC 4113
1156arieldkb MACH_ARIELDKB ARIELDKB 4114
1157armadillo810 MACH_ARMADILLO810 ARMADILLO810 4115
1158tam335x MACH_TAM335X TAM335X 4116
1159grouper MACH_GROUPER GROUPER 4117
1160mpcsa21_9g20 MACH_MPCSA21_9G20 MPCSA21_9G20 4118
1161m6u_cpu MACH_M6U_CPU M6U_CPU 4119
1162davinci_dp10 MACH_DAVINCI_DP10 DAVINCI_DP10 4120
1163ginkgo MACH_GINKGO GINKGO 4121
1164cgt_qmx6 MACH_CGT_QMX6 CGT_QMX6 4122
1165profpga MACH_PROFPGA PROFPGA 4123
1166acfx100oc MACH_ACFX100OC ACFX100OC 4124
1167acfx100nb MACH_ACFX100NB ACFX100NB 4125
1168capricorn MACH_CAPRICORN CAPRICORN 4126
1169pisces MACH_PISCES PISCES 4127
1170aries MACH_ARIES ARIES 4128
1171cancer MACH_CANCER CANCER 4129
1172leo MACH_LEO LEO 4130
1173virgo MACH_VIRGO VIRGO 4131
1174sagittarius MACH_SAGITTARIUS SAGITTARIUS 4132
1175devil MACH_DEVIL DEVIL 4133
1176ballantines MACH_BALLANTINES BALLANTINES 4134
1177omap3_procerusvpu MACH_OMAP3_PROCERUSVPU OMAP3_PROCERUSVPU 4135
1178my27 MACH_MY27 MY27 4136
1179sun6i MACH_SUN6I SUN6I 4137
1180sun5i MACH_SUN5I SUN5I 4138
1181mx512_mx MACH_MX512_MX MX512_MX 4139
1182kzm9g MACH_KZM9G KZM9G 4140
1183vdstbn MACH_VDSTBN VDSTBN 4141
1184cfa10036 MACH_CFA10036 CFA10036 4142
1185cfa10049 MACH_CFA10049 CFA10049 4143
1186pcm051 MACH_PCM051 PCM051 4144
1187vybrid_vf7xx MACH_VYBRID_VF7XX VYBRID_VF7XX 4145
1188vybrid_vf6xx MACH_VYBRID_VF6XX VYBRID_VF6XX 4146
1189vybrid_vf5xx MACH_VYBRID_VF5XX VYBRID_VF5XX 4147
1190vybrid_vf4xx MACH_VYBRID_VF4XX VYBRID_VF4XX 4148
1191aria_g25 MACH_ARIA_G25 ARIA_G25 4149
1192bcm21553 MACH_BCM21553 BCM21553 4150
1193smdk5410 MACH_SMDK5410 SMDK5410 4151
1194lpc18xx MACH_LPC18XX LPC18XX 4152
1195oratisparty MACH_ORATISPARTY ORATISPARTY 4153
1196qseven MACH_QSEVEN QSEVEN 4154
1197gmv_generic MACH_GMV_GENERIC GMV_GENERIC 4155
1198th_link_eth MACH_TH_LINK_ETH TH_LINK_ETH 4156
1199tn_muninn MACH_TN_MUNINN TN_MUNINN 4157
1200rampage MACH_RAMPAGE RAMPAGE 4158
1201visstrim_mv10 MACH_VISSTRIM_MV10 VISSTRIM_MV10 4159
1202mx28_wilma MACH_MX28_WILMA MX28_WILMA 4164
1203msm8625_ffa MACH_MSM8625_FFA MSM8625_FFA 4166
1204vpu101 MACH_VPU101 VPU101 4167
1205baileys MACH_BAILEYS BAILEYS 4169
1206familybox MACH_FAMILYBOX FAMILYBOX 4170
1207ensemble_mx35 MACH_ENSEMBLE_MX35 ENSEMBLE_MX35 4171
1208sc_sps_1 MACH_SC_SPS_1 SC_SPS_1 4172
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 858748eaa144..586961929e96 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -11,12 +11,15 @@
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/cpu.h> 12#include <linux/cpu.h>
13#include <linux/cpu_pm.h> 13#include <linux/cpu_pm.h>
14#include <linux/hardirq.h>
14#include <linux/kernel.h> 15#include <linux/kernel.h>
15#include <linux/notifier.h> 16#include <linux/notifier.h>
16#include <linux/signal.h> 17#include <linux/signal.h>
17#include <linux/sched.h> 18#include <linux/sched.h>
18#include <linux/smp.h> 19#include <linux/smp.h>
19#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/uaccess.h>
22#include <linux/user.h>
20 23
21#include <asm/cp15.h> 24#include <asm/cp15.h>
22#include <asm/cputype.h> 25#include <asm/cputype.h>
@@ -238,11 +241,11 @@ static void vfp_panic(char *reason, u32 inst)
238{ 241{
239 int i; 242 int i;
240 243
241 printk(KERN_ERR "VFP: Error: %s\n", reason); 244 pr_err("VFP: Error: %s\n", reason);
242 printk(KERN_ERR "VFP: EXC 0x%08x SCR 0x%08x INST 0x%08x\n", 245 pr_err("VFP: EXC 0x%08x SCR 0x%08x INST 0x%08x\n",
243 fmrx(FPEXC), fmrx(FPSCR), inst); 246 fmrx(FPEXC), fmrx(FPSCR), inst);
244 for (i = 0; i < 32; i += 2) 247 for (i = 0; i < 32; i += 2)
245 printk(KERN_ERR "VFP: s%2u: 0x%08x s%2u: 0x%08x\n", 248 pr_err("VFP: s%2u: 0x%08x s%2u: 0x%08x\n",
246 i, vfp_get_float(i), i+1, vfp_get_float(i+1)); 249 i, vfp_get_float(i), i+1, vfp_get_float(i+1));
247} 250}
248 251
@@ -430,7 +433,10 @@ void VFP_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs)
430 433
431static void vfp_enable(void *unused) 434static void vfp_enable(void *unused)
432{ 435{
433 u32 access = get_copro_access(); 436 u32 access;
437
438 BUG_ON(preemptible());
439 access = get_copro_access();
434 440
435 /* 441 /*
436 * Enable full access to VFP (cp10 and cp11) 442 * Enable full access to VFP (cp10 and cp11)
@@ -446,7 +452,7 @@ static int vfp_pm_suspend(void)
446 452
447 /* if vfp is on, then save state for resumption */ 453 /* if vfp is on, then save state for resumption */
448 if (fpexc & FPEXC_EN) { 454 if (fpexc & FPEXC_EN) {
449 printk(KERN_DEBUG "%s: saving vfp state\n", __func__); 455 pr_debug("%s: saving vfp state\n", __func__);
450 vfp_save_state(&ti->vfpstate, fpexc); 456 vfp_save_state(&ti->vfpstate, fpexc);
451 457
452 /* disable, just in case */ 458 /* disable, just in case */
@@ -529,6 +535,93 @@ void vfp_flush_hwstate(struct thread_info *thread)
529} 535}
530 536
531/* 537/*
538 * Save the current VFP state into the provided structures and prepare
539 * for entry into a new function (signal handler).
540 */
541int vfp_preserve_user_clear_hwstate(struct user_vfp __user *ufp,
542 struct user_vfp_exc __user *ufp_exc)
543{
544 struct thread_info *thread = current_thread_info();
545 struct vfp_hard_struct *hwstate = &thread->vfpstate.hard;
546 int err = 0;
547
548 /* Ensure that the saved hwstate is up-to-date. */
549 vfp_sync_hwstate(thread);
550
551 /*
552 * Copy the floating point registers. There can be unused
553 * registers see asm/hwcap.h for details.
554 */
555 err |= __copy_to_user(&ufp->fpregs, &hwstate->fpregs,
556 sizeof(hwstate->fpregs));
557 /*
558 * Copy the status and control register.
559 */
560 __put_user_error(hwstate->fpscr, &ufp->fpscr, err);
561
562 /*
563 * Copy the exception registers.
564 */
565 __put_user_error(hwstate->fpexc, &ufp_exc->fpexc, err);
566 __put_user_error(hwstate->fpinst, &ufp_exc->fpinst, err);
567 __put_user_error(hwstate->fpinst2, &ufp_exc->fpinst2, err);
568
569 if (err)
570 return -EFAULT;
571
572 /* Ensure that VFP is disabled. */
573 vfp_flush_hwstate(thread);
574
575 /*
576 * As per the PCS, clear the length and stride bits for function
577 * entry.
578 */
579 hwstate->fpscr &= ~(FPSCR_LENGTH_MASK | FPSCR_STRIDE_MASK);
580 return 0;
581}
582
583/* Sanitise and restore the current VFP state from the provided structures. */
584int vfp_restore_user_hwstate(struct user_vfp __user *ufp,
585 struct user_vfp_exc __user *ufp_exc)
586{
587 struct thread_info *thread = current_thread_info();
588 struct vfp_hard_struct *hwstate = &thread->vfpstate.hard;
589 unsigned long fpexc;
590 int err = 0;
591
592 /* Disable VFP to avoid corrupting the new thread state. */
593 vfp_flush_hwstate(thread);
594
595 /*
596 * Copy the floating point registers. There can be unused
597 * registers see asm/hwcap.h for details.
598 */
599 err |= __copy_from_user(&hwstate->fpregs, &ufp->fpregs,
600 sizeof(hwstate->fpregs));
601 /*
602 * Copy the status and control register.
603 */
604 __get_user_error(hwstate->fpscr, &ufp->fpscr, err);
605
606 /*
607 * Sanitise and restore the exception registers.
608 */
609 __get_user_error(fpexc, &ufp_exc->fpexc, err);
610
611 /* Ensure the VFP is enabled. */
612 fpexc |= FPEXC_EN;
613
614 /* Ensure FPINST2 is invalid and the exception flag is cleared. */
615 fpexc &= ~(FPEXC_EX | FPEXC_FP2V);
616 hwstate->fpexc = fpexc;
617
618 __get_user_error(hwstate->fpinst, &ufp_exc->fpinst, err);
619 __get_user_error(hwstate->fpinst2, &ufp_exc->fpinst2, err);
620
621 return err ? -EFAULT : 0;
622}
623
624/*
532 * VFP hardware can lose all context when a CPU goes offline. 625 * VFP hardware can lose all context when a CPU goes offline.
533 * As we will be running in SMP mode with CPU hotplug, we will save the 626 * As we will be running in SMP mode with CPU hotplug, we will save the
534 * hardware state at every thread switch. We clear our held state when 627 * hardware state at every thread switch. We clear our held state when
@@ -558,7 +651,7 @@ static int __init vfp_init(void)
558 unsigned int cpu_arch = cpu_architecture(); 651 unsigned int cpu_arch = cpu_architecture();
559 652
560 if (cpu_arch >= CPU_ARCH_ARMv6) 653 if (cpu_arch >= CPU_ARCH_ARMv6)
561 vfp_enable(NULL); 654 on_each_cpu(vfp_enable, NULL, 1);
562 655
563 /* 656 /*
564 * First check that there is a VFP that we can use. 657 * First check that there is a VFP that we can use.
@@ -571,18 +664,16 @@ static int __init vfp_init(void)
571 barrier(); 664 barrier();
572 vfp_vector = vfp_null_entry; 665 vfp_vector = vfp_null_entry;
573 666
574 printk(KERN_INFO "VFP support v0.3: "); 667 pr_info("VFP support v0.3: ");
575 if (VFP_arch) 668 if (VFP_arch)
576 printk("not present\n"); 669 pr_cont("not present\n");
577 else if (vfpsid & FPSID_NODOUBLE) { 670 else if (vfpsid & FPSID_NODOUBLE) {
578 printk("no double precision support\n"); 671 pr_cont("no double precision support\n");
579 } else { 672 } else {
580 hotcpu_notifier(vfp_hotplug, 0); 673 hotcpu_notifier(vfp_hotplug, 0);
581 674
582 smp_call_function(vfp_enable, NULL, 1);
583
584 VFP_arch = (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT; /* Extract the architecture version */ 675 VFP_arch = (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT; /* Extract the architecture version */
585 printk("implementor %02x architecture %d part %02x variant %x rev %x\n", 676 pr_cont("implementor %02x architecture %d part %02x variant %x rev %x\n",
586 (vfpsid & FPSID_IMPLEMENTER_MASK) >> FPSID_IMPLEMENTER_BIT, 677 (vfpsid & FPSID_IMPLEMENTER_MASK) >> FPSID_IMPLEMENTER_BIT,
587 (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT, 678 (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT,
588 (vfpsid & FPSID_PART_MASK) >> FPSID_PART_BIT, 679 (vfpsid & FPSID_PART_MASK) >> FPSID_PART_BIT,
diff --git a/arch/avr32/kernel/Makefile b/arch/avr32/kernel/Makefile
index 18229d0d1861..9e2c465ef3a6 100644
--- a/arch/avr32/kernel/Makefile
+++ b/arch/avr32/kernel/Makefile
@@ -8,7 +8,7 @@ obj-$(CONFIG_SUBARCH_AVR32B) += entry-avr32b.o
8obj-y += syscall_table.o syscall-stubs.o irq.o 8obj-y += syscall_table.o syscall-stubs.o irq.o
9obj-y += setup.o traps.o ocd.o ptrace.o 9obj-y += setup.o traps.o ocd.o ptrace.o
10obj-y += signal.o sys_avr32.o process.o time.o 10obj-y += signal.o sys_avr32.o process.o time.o
11obj-y += init_task.o switch_to.o cpu.o 11obj-y += switch_to.o cpu.o
12obj-$(CONFIG_MODULES) += module.o avr32_ksyms.o 12obj-$(CONFIG_MODULES) += module.o avr32_ksyms.o
13obj-$(CONFIG_KPROBES) += kprobes.o 13obj-$(CONFIG_KPROBES) += kprobes.o
14obj-$(CONFIG_STACKTRACE) += stacktrace.o 14obj-$(CONFIG_STACKTRACE) += stacktrace.o
diff --git a/arch/avr32/kernel/init_task.c b/arch/avr32/kernel/init_task.c
deleted file mode 100644
index 6b2343e6fe33..000000000000
--- a/arch/avr32/kernel/init_task.c
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#include <linux/module.h>
9#include <linux/fs.h>
10#include <linux/sched.h>
11#include <linux/init_task.h>
12#include <linux/mqueue.h>
13
14#include <asm/pgtable.h>
15
16static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
17static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
18/*
19 * Initial thread structure. Must be aligned on an 8192-byte boundary.
20 */
21union thread_union init_thread_union __init_task_data =
22 { INIT_THREAD_INFO(init_task) };
23
24/*
25 * Initial task structure.
26 *
27 * All other task structs will be allocated on slabs in fork.c
28 */
29struct task_struct init_task = INIT_TASK(init_task);
30
31EXPORT_SYMBOL(init_task);
diff --git a/arch/blackfin/ADI_BSD.txt b/arch/blackfin/ADI_BSD.txt
deleted file mode 100644
index 501d0b645943..000000000000
--- a/arch/blackfin/ADI_BSD.txt
+++ /dev/null
@@ -1,41 +0,0 @@
1This BSD-Style License applies to a few files in ./arch/blackfin directory,
2and is included here, so people understand which code they can use outside
3the Linux kernel, in non-GPL based projects.
4
5Using the files released under the "ADI BSD" license, must comply with
6these license terms.
7
8--------------------------------------------------------------------------
9
10Copyright Analog Devices, Inc.
11
12All rights reserved.
13
14Redistribution and use in source and binary forms, with or without
15modification, are permitted provided that the following conditions
16are met:
17 - Redistributions of source code must retain the above copyright
18 notice, this list of conditions and the following disclaimer.
19 - Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in
21 the documentation and/or other materials provided with the
22 distribution.
23 - Neither the name of Analog Devices, Inc. nor the names of its
24 contributors may be used to endorse or promote products derived
25 from this software without specific prior written permission.
26 - The use of this software may or may not infringe the patent rights
27 of one or more patent holders. This license does not release you
28 from the requirement that you obtain separate licenses from these
29 patent holders to use this software.
30
31THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
32IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
33MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
34IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
35INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
36BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF
37SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
38BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
39WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
40OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
41ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
diff --git a/arch/blackfin/Clear_BSD.txt b/arch/blackfin/Clear_BSD.txt
new file mode 100644
index 000000000000..bfa4b378a368
--- /dev/null
+++ b/arch/blackfin/Clear_BSD.txt
@@ -0,0 +1,33 @@
1The Clear BSD license:
2
3Copyright (c) 2012, Analog Devices, Inc. All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted (subject to the limitations in the
7disclaimer below) provided that the following conditions are met:
8
9* Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11
12* Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the
15 distribution.
16
17* Neither the name of Analog Devices, Inc. nor the names of its
18 contributors may be used to endorse or promote products derived
19 from this software without specific prior written permission.
20
21NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
22GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
23HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
24WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
32OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
33IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index b83e89ced988..79cfe2614bcc 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -37,6 +37,7 @@ config BLACKFIN
37 select GENERIC_IRQ_PROBE 37 select GENERIC_IRQ_PROBE
38 select IRQ_PER_CPU if SMP 38 select IRQ_PER_CPU if SMP
39 select HAVE_NMI_WATCHDOG if NMI_WATCHDOG 39 select HAVE_NMI_WATCHDOG if NMI_WATCHDOG
40 select GENERIC_SMP_IDLE_THREAD
40 41
41config GENERIC_CSUM 42config GENERIC_CSUM
42 def_bool y 43 def_bool y
@@ -226,6 +227,12 @@ config BF561
226 help 227 help
227 BF561 Processor Support. 228 BF561 Processor Support.
228 229
230config BF609
231 bool "BF609"
232 select CLKDEV_LOOKUP
233 help
234 BF609 Processor Support.
235
229endchoice 236endchoice
230 237
231config SMP 238config SMP
@@ -251,27 +258,27 @@ config HOTPLUG_CPU
251 258
252config BF_REV_MIN 259config BF_REV_MIN
253 int 260 int
254 default 0 if (BF51x || BF52x || (BF54x && !BF54xM)) 261 default 0 if (BF51x || BF52x || (BF54x && !BF54xM)) || BF60x
255 default 2 if (BF537 || BF536 || BF534) 262 default 2 if (BF537 || BF536 || BF534)
256 default 3 if (BF561 || BF533 || BF532 || BF531 || BF54xM) 263 default 3 if (BF561 || BF533 || BF532 || BF531 || BF54xM)
257 default 4 if (BF538 || BF539) 264 default 4 if (BF538 || BF539)
258 265
259config BF_REV_MAX 266config BF_REV_MAX
260 int 267 int
261 default 2 if (BF51x || BF52x || (BF54x && !BF54xM)) 268 default 2 if (BF51x || BF52x || (BF54x && !BF54xM)) || BF60x
262 default 3 if (BF537 || BF536 || BF534 || BF54xM) 269 default 3 if (BF537 || BF536 || BF534 || BF54xM)
263 default 5 if (BF561 || BF538 || BF539) 270 default 5 if (BF561 || BF538 || BF539)
264 default 6 if (BF533 || BF532 || BF531) 271 default 6 if (BF533 || BF532 || BF531)
265 272
266choice 273choice
267 prompt "Silicon Rev" 274 prompt "Silicon Rev"
268 default BF_REV_0_0 if (BF51x || BF52x) 275 default BF_REV_0_0 if (BF51x || BF52x || BF60x)
269 default BF_REV_0_2 if (BF534 || BF536 || BF537 || (BF54x && !BF54xM)) 276 default BF_REV_0_2 if (BF534 || BF536 || BF537 || (BF54x && !BF54xM))
270 default BF_REV_0_3 if (BF531 || BF532 || BF533 || BF54xM || BF561) 277 default BF_REV_0_3 if (BF531 || BF532 || BF533 || BF54xM || BF561)
271 278
272config BF_REV_0_0 279config BF_REV_0_0
273 bool "0.0" 280 bool "0.0"
274 depends on (BF51x || BF52x || (BF54x && !BF54xM)) 281 depends on (BF51x || BF52x || (BF54x && !BF54xM) || BF60x)
275 282
276config BF_REV_0_1 283config BF_REV_0_1
277 bool "0.1" 284 bool "0.1"
@@ -350,6 +357,7 @@ source "arch/blackfin/mach-bf561/Kconfig"
350source "arch/blackfin/mach-bf537/Kconfig" 357source "arch/blackfin/mach-bf537/Kconfig"
351source "arch/blackfin/mach-bf538/Kconfig" 358source "arch/blackfin/mach-bf538/Kconfig"
352source "arch/blackfin/mach-bf548/Kconfig" 359source "arch/blackfin/mach-bf548/Kconfig"
360source "arch/blackfin/mach-bf609/Kconfig"
353 361
354menu "Board customizations" 362menu "Board customizations"
355 363
@@ -379,6 +387,12 @@ config BOOT_LOAD
379 memory region is used to capture NULL pointer references as well 387 memory region is used to capture NULL pointer references as well
380 as some core kernel functions. 388 as some core kernel functions.
381 389
390config PHY_RAM_BASE_ADDRESS
391 hex "Physical RAM Base"
392 default 0x0
393 help
394 set BF609 FPGA physical SRAM base address
395
382config ROM_BASE 396config ROM_BASE
383 hex "Kernel ROM Base" 397 hex "Kernel ROM Base"
384 depends on ROMKERNEL 398 depends on ROMKERNEL
@@ -422,7 +436,7 @@ config BFIN_KERNEL_CLOCK
422 436
423config PLL_BYPASS 437config PLL_BYPASS
424 bool "Bypass PLL" 438 bool "Bypass PLL"
425 depends on BFIN_KERNEL_CLOCK 439 depends on BFIN_KERNEL_CLOCK && (!BF60x)
426 default n 440 default n
427 441
428config CLKIN_HALF 442config CLKIN_HALF
@@ -441,7 +455,7 @@ config VCO_MULT
441 default "20" if (BFIN537_STAMP || BFIN527_EZKIT || BFIN527_EZKIT_V2 || BFIN548_EZKIT || BFIN548_BLUETECHNIX_CM || BFIN538_EZKIT) 455 default "20" if (BFIN537_STAMP || BFIN527_EZKIT || BFIN527_EZKIT_V2 || BFIN548_EZKIT || BFIN548_BLUETECHNIX_CM || BFIN538_EZKIT)
442 default "22" if BFIN533_BLUETECHNIX_CM 456 default "22" if BFIN533_BLUETECHNIX_CM
443 default "20" if (BFIN537_BLUETECHNIX_CM_E || BFIN537_BLUETECHNIX_CM_U || BFIN527_BLUETECHNIX_CM || BFIN561_BLUETECHNIX_CM) 457 default "20" if (BFIN537_BLUETECHNIX_CM_E || BFIN537_BLUETECHNIX_CM_U || BFIN527_BLUETECHNIX_CM || BFIN561_BLUETECHNIX_CM)
444 default "20" if BFIN561_EZKIT 458 default "20" if (BFIN561_EZKIT || BF609)
445 default "16" if (H8606_HVSISTEMAS || BLACKSTAMP || BFIN526_EZBRD || BFIN518F_EZBRD) 459 default "16" if (H8606_HVSISTEMAS || BLACKSTAMP || BFIN526_EZBRD || BFIN518F_EZBRD)
446 default "25" if BFIN527_AD7160EVAL 460 default "25" if BFIN527_AD7160EVAL
447 help 461 help
@@ -473,12 +487,45 @@ config SCLK_DIV
473 int "System Clock Divider" 487 int "System Clock Divider"
474 depends on BFIN_KERNEL_CLOCK 488 depends on BFIN_KERNEL_CLOCK
475 range 1 15 489 range 1 15
476 default 5 490 default 4
477 help 491 help
478 This sets the frequency of the system clock (including SDRAM or DDR). 492 This sets the frequency of the system clock (including SDRAM or DDR) on
493 !BF60x else it set the clock for system buses and provides the
494 source from which SCLK0 and SCLK1 are derived.
479 This can be between 1 and 15 495 This can be between 1 and 15
480 System Clock = (PLL frequency) / (this setting) 496 System Clock = (PLL frequency) / (this setting)
481 497
498config SCLK0_DIV
499 int "System Clock0 Divider"
500 depends on BFIN_KERNEL_CLOCK && BF60x
501 range 1 15
502 default 1
503 help
504 This sets the frequency of the system clock0 for PVP and all other
505 peripherals not clocked by SCLK1.
506 This can be between 1 and 15
507 System Clock0 = (System Clock) / (this setting)
508
509config SCLK1_DIV
510 int "System Clock1 Divider"
511 depends on BFIN_KERNEL_CLOCK && BF60x
512 range 1 15
513 default 1
514 help
515 This sets the frequency of the system clock1 (including SPORT, SPI and ACM).
516 This can be between 1 and 15
517 System Clock1 = (System Clock) / (this setting)
518
519config DCLK_DIV
520 int "DDR Clock Divider"
521 depends on BFIN_KERNEL_CLOCK && BF60x
522 range 1 15
523 default 2
524 help
525 This sets the frequency of the DDR memory.
526 This can be between 1 and 15
527 DDR Clock = (PLL frequency) / (this setting)
528
482choice 529choice
483 prompt "DDR SDRAM Chip Type" 530 prompt "DDR SDRAM Chip Type"
484 depends on BFIN_KERNEL_CLOCK 531 depends on BFIN_KERNEL_CLOCK
@@ -494,7 +541,7 @@ endchoice
494 541
495choice 542choice
496 prompt "DDR/SDRAM Timing" 543 prompt "DDR/SDRAM Timing"
497 depends on BFIN_KERNEL_CLOCK 544 depends on BFIN_KERNEL_CLOCK && !BF60x
498 default BFIN_KERNEL_CLOCK_MEMINIT_CALC 545 default BFIN_KERNEL_CLOCK_MEMINIT_CALC
499 help 546 help
500 This option allows you to specify Blackfin SDRAM/DDR Timing parameters 547 This option allows you to specify Blackfin SDRAM/DDR Timing parameters
@@ -576,6 +623,7 @@ config MAX_VCO_HZ
576 default 600000000 if BF548 623 default 600000000 if BF548
577 default 533333333 if BF549 624 default 533333333 if BF549
578 default 600000000 if BF561 625 default 600000000 if BF561
626 default 800000000 if BF609
579 627
580config MIN_VCO_HZ 628config MIN_VCO_HZ
581 int 629 int
@@ -583,6 +631,7 @@ config MIN_VCO_HZ
583 631
584config MAX_SCLK_HZ 632config MAX_SCLK_HZ
585 int 633 int
634 default 200000000 if BF609
586 default 133333333 635 default 133333333
587 636
588config MIN_SCLK_HZ 637config MIN_SCLK_HZ
@@ -1051,7 +1100,7 @@ endchoice
1051config BFIN_L2_DCACHEABLE 1100config BFIN_L2_DCACHEABLE
1052 bool "Enable DCACHE for L2 SRAM" 1101 bool "Enable DCACHE for L2 SRAM"
1053 depends on BFIN_DCACHE 1102 depends on BFIN_DCACHE
1054 depends on (BF54x || BF561) && !SMP 1103 depends on (BF54x || BF561 || BF60x) && !SMP
1055 default n 1104 default n
1056choice 1105choice
1057 prompt "L2 SRAM DCACHE policy" 1106 prompt "L2 SRAM DCACHE policy"
@@ -1077,6 +1126,7 @@ config MPU
1077comment "Asynchronous Memory Configuration" 1126comment "Asynchronous Memory Configuration"
1078 1127
1079menu "EBIU_AMGCTL Global Control" 1128menu "EBIU_AMGCTL Global Control"
1129 depends on !BF60x
1080config C_AMCKEN 1130config C_AMCKEN
1081 bool "Enable CLKOUT" 1131 bool "Enable CLKOUT"
1082 default y 1132 default y
@@ -1127,6 +1177,7 @@ endchoice
1127endmenu 1177endmenu
1128 1178
1129menu "EBIU_AMBCTL Control" 1179menu "EBIU_AMBCTL Control"
1180 depends on !BF60x
1130config BANK_0 1181config BANK_0
1131 hex "Bank 0 (AMBCTL0.L)" 1182 hex "Bank 0 (AMBCTL0.L)"
1132 default 0x7BB0 1183 default 0x7BB0
@@ -1206,7 +1257,7 @@ config ARCH_SUSPEND_POSSIBLE
1206 1257
1207choice 1258choice
1208 prompt "Standby Power Saving Mode" 1259 prompt "Standby Power Saving Mode"
1209 depends on PM 1260 depends on PM && !BF60x
1210 default PM_BFIN_SLEEP_DEEPER 1261 default PM_BFIN_SLEEP_DEEPER
1211config PM_BFIN_SLEEP_DEEPER 1262config PM_BFIN_SLEEP_DEEPER
1212 bool "Sleep Deeper" 1263 bool "Sleep Deeper"
@@ -1261,6 +1312,118 @@ config PM_BFIN_WAKE_GP
1261 On ADSP-BF549 this option enables the same functionality on the 1312 On ADSP-BF549 this option enables the same functionality on the
1262 /MRXON pin also PH7. 1313 /MRXON pin also PH7.
1263 1314
1315config PM_BFIN_WAKE_PA15
1316 bool "Allow Wake-Up from PA15"
1317 depends on PM && BF60x
1318 default n
1319 help
1320 Enable PA15 Wake-Up
1321
1322config PM_BFIN_WAKE_PA15_POL
1323 int "Wake-up priority"
1324 depends on PM_BFIN_WAKE_PA15
1325 default 0
1326 help
1327 Wake-Up priority 0(low) 1(high)
1328
1329config PM_BFIN_WAKE_PB15
1330 bool "Allow Wake-Up from PB15"
1331 depends on PM && BF60x
1332 default n
1333 help
1334 Enable PB15 Wake-Up
1335
1336config PM_BFIN_WAKE_PB15_POL
1337 int "Wake-up priority"
1338 depends on PM_BFIN_WAKE_PB15
1339 default 0
1340 help
1341 Wake-Up priority 0(low) 1(high)
1342
1343config PM_BFIN_WAKE_PC15
1344 bool "Allow Wake-Up from PC15"
1345 depends on PM && BF60x
1346 default n
1347 help
1348 Enable PC15 Wake-Up
1349
1350config PM_BFIN_WAKE_PC15_POL
1351 int "Wake-up priority"
1352 depends on PM_BFIN_WAKE_PC15
1353 default 0
1354 help
1355 Wake-Up priority 0(low) 1(high)
1356
1357config PM_BFIN_WAKE_PD06
1358 bool "Allow Wake-Up from PD06(ETH0_PHYINT)"
1359 depends on PM && BF60x
1360 default n
1361 help
1362 Enable PD06(ETH0_PHYINT) Wake-up
1363
1364config PM_BFIN_WAKE_PD06_POL
1365 int "Wake-up priority"
1366 depends on PM_BFIN_WAKE_PD06
1367 default 0
1368 help
1369 Wake-Up priority 0(low) 1(high)
1370
1371config PM_BFIN_WAKE_PE12
1372 bool "Allow Wake-Up from PE12(ETH1_PHYINT, PUSH BUTTON)"
1373 depends on PM && BF60x
1374 default n
1375 help
1376 Enable PE12(ETH1_PHYINT, PUSH BUTTON) Wake-up
1377
1378config PM_BFIN_WAKE_PE12_POL
1379 int "Wake-up priority"
1380 depends on PM_BFIN_WAKE_PE12
1381 default 0
1382 help
1383 Wake-Up priority 0(low) 1(high)
1384
1385config PM_BFIN_WAKE_PG04
1386 bool "Allow Wake-Up from PG04(CAN0_RX)"
1387 depends on PM && BF60x
1388 default n
1389 help
1390 Enable PG04(CAN0_RX) Wake-up
1391
1392config PM_BFIN_WAKE_PG04_POL
1393 int "Wake-up priority"
1394 depends on PM_BFIN_WAKE_PG04
1395 default 0
1396 help
1397 Wake-Up priority 0(low) 1(high)
1398
1399config PM_BFIN_WAKE_PG13
1400 bool "Allow Wake-Up from PG13"
1401 depends on PM && BF60x
1402 default n
1403 help
1404 Enable PG13 Wake-Up
1405
1406config PM_BFIN_WAKE_PG13_POL
1407 int "Wake-up priority"
1408 depends on PM_BFIN_WAKE_PG13
1409 default 0
1410 help
1411 Wake-Up priority 0(low) 1(high)
1412
1413config PM_BFIN_WAKE_USB
1414 bool "Allow Wake-Up from (USB)"
1415 depends on PM && BF60x
1416 default n
1417 help
1418 Enable (USB) Wake-up
1419
1420config PM_BFIN_WAKE_USB_POL
1421 int "Wake-up priority"
1422 depends on PM_BFIN_WAKE_USB
1423 default 0
1424 help
1425 Wake-Up priority 0(low) 1(high)
1426
1264endmenu 1427endmenu
1265 1428
1266menu "CPU Frequency scaling" 1429menu "CPU Frequency scaling"
diff --git a/arch/blackfin/Kconfig.debug b/arch/blackfin/Kconfig.debug
index e2a3d4c8ab9a..79594694ee90 100644
--- a/arch/blackfin/Kconfig.debug
+++ b/arch/blackfin/Kconfig.debug
@@ -253,4 +253,11 @@ config BFIN_PSEUDODBG_INSNS
253 253
254 Most people should say N here. 254 Most people should say N here.
255 255
256config BFIN_PM_WAKEUP_TIME_BENCH
257 bool "Display the total time for kernel to resume from power saving mode"
258 default n
259 help
260 Display the total time when kernel resumes normal from standby or
261 suspend to mem mode.
262
256endmenu 263endmenu
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index 46f42b2066e5..d3d7e64ca96d 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -54,6 +54,7 @@ machine-$(CONFIG_BF548M) := bf548
54machine-$(CONFIG_BF549) := bf548 54machine-$(CONFIG_BF549) := bf548
55machine-$(CONFIG_BF549M) := bf548 55machine-$(CONFIG_BF549M) := bf548
56machine-$(CONFIG_BF561) := bf561 56machine-$(CONFIG_BF561) := bf561
57machine-$(CONFIG_BF609) := bf609
57MACHINE := $(machine-y) 58MACHINE := $(machine-y)
58export MACHINE 59export MACHINE
59 60
@@ -86,6 +87,7 @@ cpu-$(CONFIG_BF548M) := bf548m
86cpu-$(CONFIG_BF549) := bf549 87cpu-$(CONFIG_BF549) := bf549
87cpu-$(CONFIG_BF549M) := bf549m 88cpu-$(CONFIG_BF549M) := bf549m
88cpu-$(CONFIG_BF561) := bf561 89cpu-$(CONFIG_BF561) := bf561
90cpu-$(CONFIG_BF609) := bf609
89 91
90rev-$(CONFIG_BF_REV_0_0) := 0.0 92rev-$(CONFIG_BF_REV_0_0) := 0.0
91rev-$(CONFIG_BF_REV_0_1) := 0.1 93rev-$(CONFIG_BF_REV_0_1) := 0.1
@@ -107,8 +109,6 @@ KBUILD_AFLAGS += -mcpu=$(CPU_REV)
107CHECKFLAGS_SILICON = $(shell echo "" | $(CPP) $(KBUILD_CFLAGS) -dD - 2>/dev/null | awk '$$2 == "__SILICON_REVISION__" { print $$3 }') 109CHECKFLAGS_SILICON = $(shell echo "" | $(CPP) $(KBUILD_CFLAGS) -dD - 2>/dev/null | awk '$$2 == "__SILICON_REVISION__" { print $$3 }')
108CHECKFLAGS += -D__SILICON_REVISION__=$(CHECKFLAGS_SILICON) -D__bfin__ 110CHECKFLAGS += -D__SILICON_REVISION__=$(CHECKFLAGS_SILICON) -D__bfin__
109 111
110head-y := arch/$(ARCH)/kernel/init_task.o
111
112core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/ arch/$(ARCH)/mach-common/ 112core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/ arch/$(ARCH)/mach-common/
113 113
114# If we have a machine-specific directory, then include it in the build. 114# If we have a machine-specific directory, then include it in the build.
diff --git a/arch/blackfin/configs/BF561-EZKIT-SMP_defconfig b/arch/blackfin/configs/BF561-EZKIT-SMP_defconfig
index 680730eeaf23..e2a2fa5935ce 100644
--- a/arch/blackfin/configs/BF561-EZKIT-SMP_defconfig
+++ b/arch/blackfin/configs/BF561-EZKIT-SMP_defconfig
@@ -21,14 +21,12 @@ CONFIG_MODULE_UNLOAD=y
21# CONFIG_IOSCHED_CFQ is not set 21# CONFIG_IOSCHED_CFQ is not set
22CONFIG_PREEMPT_VOLUNTARY=y 22CONFIG_PREEMPT_VOLUNTARY=y
23CONFIG_BF561=y 23CONFIG_BF561=y
24CONFIG_SMP=y
24CONFIG_IRQ_TIMER0=10 25CONFIG_IRQ_TIMER0=10
25CONFIG_CLKIN_HZ=30000000 26CONFIG_CLKIN_HZ=30000000
26CONFIG_HIGH_RES_TIMERS=y 27CONFIG_HIGH_RES_TIMERS=y
27CONFIG_NOMMU_INITIAL_TRIM_EXCESS=0 28CONFIG_NOMMU_INITIAL_TRIM_EXCESS=0
28CONFIG_BFIN_GPTIMERS=m 29CONFIG_BFIN_GPTIMERS=m
29CONFIG_BFIN_EXTMEM_WRITETHROUGH=y
30CONFIG_BFIN_L2_DCACHEABLE=y
31CONFIG_BFIN_L2_WRITETHROUGH=y
32CONFIG_C_CDPRIO=y 30CONFIG_C_CDPRIO=y
33CONFIG_BANK_3=0xAAC2 31CONFIG_BANK_3=0xAAC2
34CONFIG_BINFMT_FLAT=y 32CONFIG_BINFMT_FLAT=y
diff --git a/arch/blackfin/configs/BF609-EZKIT_defconfig b/arch/blackfin/configs/BF609-EZKIT_defconfig
new file mode 100644
index 000000000000..be9526bee4fb
--- /dev/null
+++ b/arch/blackfin/configs/BF609-EZKIT_defconfig
@@ -0,0 +1,155 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y
7CONFIG_EXPERT=y
8# CONFIG_ELF_CORE is not set
9# CONFIG_FUTEX is not set
10# CONFIG_SIGNALFD is not set
11# CONFIG_TIMERFD is not set
12# CONFIG_EVENTFD is not set
13# CONFIG_AIO is not set
14CONFIG_SLAB=y
15CONFIG_MMAP_ALLOW_UNINITIALIZED=y
16CONFIG_MODULES=y
17CONFIG_MODULE_UNLOAD=y
18# CONFIG_LBDAF is not set
19# CONFIG_BLK_DEV_BSG is not set
20# CONFIG_IOSCHED_DEADLINE is not set
21# CONFIG_IOSCHED_CFQ is not set
22CONFIG_PREEMPT_VOLUNTARY=y
23CONFIG_BF609=y
24CONFIG_PINT1_ASSIGN=0x01010000
25CONFIG_PINT2_ASSIGN=0x07000101
26CONFIG_PINT3_ASSIGN=0x02020303
27CONFIG_HIGH_RES_TIMERS=y
28CONFIG_IP_CHECKSUM_L1=y
29CONFIG_SYSCALL_TAB_L1=y
30CONFIG_CPLB_SWITCH_TAB_L1=y
31# CONFIG_APP_STACK_L1 is not set
32# CONFIG_BFIN_INS_LOWOVERHEAD is not set
33CONFIG_NOMMU_INITIAL_TRIM_EXCESS=0
34CONFIG_BINFMT_FLAT=y
35CONFIG_BINFMT_ZFLAT=y
36CONFIG_PM_BFIN_WAKE_PE12=y
37CONFIG_PM_BFIN_WAKE_PE12_POL=1
38CONFIG_CPU_FREQ=y
39CONFIG_CPU_FREQ_GOV_POWERSAVE=y
40CONFIG_CPU_FREQ_GOV_ONDEMAND=y
41CONFIG_NET=y
42CONFIG_PACKET=y
43CONFIG_UNIX=y
44CONFIG_INET=y
45CONFIG_IP_PNP=y
46CONFIG_IP_PNP_DHCP=y
47CONFIG_IP_PNP_BOOTP=y
48CONFIG_IP_PNP_RARP=y
49# CONFIG_IPV6 is not set
50CONFIG_NETFILTER=y
51CONFIG_CAN=y
52CONFIG_CAN_BFIN=y
53CONFIG_IRDA=y
54CONFIG_IRTTY_SIR=y
55# CONFIG_WIRELESS is not set
56CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
57CONFIG_FW_LOADER=m
58CONFIG_MTD=y
59CONFIG_MTD_CMDLINE_PARTS=y
60CONFIG_MTD_CHAR=y
61CONFIG_MTD_BLOCK=y
62CONFIG_MTD_CFI=y
63CONFIG_MTD_CFI_INTELEXT=y
64CONFIG_MTD_CFI_STAA=y
65CONFIG_MTD_COMPLEX_MAPPINGS=y
66CONFIG_MTD_PHYSMAP=y
67CONFIG_MTD_M25P80=y
68CONFIG_MTD_UBI=m
69CONFIG_SCSI=y
70CONFIG_BLK_DEV_SD=y
71CONFIG_NETDEVICES=y
72# CONFIG_NET_VENDOR_BROADCOM is not set
73# CONFIG_NET_VENDOR_CHELSIO is not set
74# CONFIG_NET_VENDOR_INTEL is not set
75# CONFIG_NET_VENDOR_MARVELL is not set
76# CONFIG_NET_VENDOR_MICREL is not set
77# CONFIG_NET_VENDOR_MICROCHIP is not set
78# CONFIG_NET_VENDOR_NATSEMI is not set
79# CONFIG_NET_VENDOR_SEEQ is not set
80# CONFIG_NET_VENDOR_SMSC is not set
81CONFIG_STMMAC_ETH=y
82CONFIG_STMMAC_IEEE1588=y
83# CONFIG_WLAN is not set
84# CONFIG_INPUT_MOUSEDEV is not set
85CONFIG_INPUT_EVDEV=y
86# CONFIG_INPUT_KEYBOARD is not set
87# CONFIG_INPUT_MOUSE is not set
88CONFIG_INPUT_MISC=y
89CONFIG_INPUT_BFIN_ROTARY=y
90# CONFIG_SERIO is not set
91# CONFIG_LEGACY_PTYS is not set
92CONFIG_BFIN_SIMPLE_TIMER=m
93CONFIG_BFIN_LINKPORT=y
94# CONFIG_DEVKMEM is not set
95CONFIG_SERIAL_BFIN=y
96CONFIG_SERIAL_BFIN_CONSOLE=y
97CONFIG_SERIAL_BFIN_UART0=y
98# CONFIG_HW_RANDOM is not set
99CONFIG_I2C=y
100CONFIG_I2C_CHARDEV=y
101CONFIG_I2C_BLACKFIN_TWI=y
102CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
103CONFIG_SPI=y
104CONFIG_SPI_BFIN6XX=y
105CONFIG_GPIOLIB=y
106CONFIG_GPIO_SYSFS=y
107# CONFIG_HWMON is not set
108CONFIG_WATCHDOG=y
109CONFIG_BFIN_WDT=y
110CONFIG_SOUND=m
111CONFIG_SND=m
112CONFIG_SND_MIXER_OSS=m
113CONFIG_SND_PCM_OSS=m
114# CONFIG_SND_DRIVERS is not set
115# CONFIG_SND_SPI is not set
116# CONFIG_SND_USB is not set
117CONFIG_SND_SOC=m
118CONFIG_SND_BF6XX_I2S=m
119CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61=m
120CONFIG_SND_SOC_ALL_CODECS=m
121CONFIG_USB=y
122CONFIG_USB_MUSB_HDRC=y
123CONFIG_USB_MUSB_BLACKFIN=m
124CONFIG_USB_STORAGE=y
125CONFIG_USB_GADGET=y
126CONFIG_USB_GADGET_MUSB_HDRC=y
127CONFIG_USB_ZERO=y
128CONFIG_MMC=y
129CONFIG_SDH_BFIN=y
130# CONFIG_IOMMU_SUPPORT is not set
131CONFIG_EXT2_FS=y
132# CONFIG_DNOTIFY is not set
133CONFIG_MSDOS_FS=y
134CONFIG_VFAT_FS=y
135CONFIG_JFFS2_FS=m
136CONFIG_UBIFS_FS=m
137CONFIG_NFS_FS=m
138CONFIG_NFS_V3=y
139CONFIG_NLS_CODEPAGE_437=y
140CONFIG_NLS_ISO8859_1=y
141CONFIG_DEBUG_FS=y
142CONFIG_DEBUG_SHIRQ=y
143CONFIG_DETECT_HUNG_TASK=y
144CONFIG_DEBUG_INFO=y
145CONFIG_FRAME_POINTER=y
146# CONFIG_FTRACE is not set
147CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_ONE=y
148CONFIG_EARLY_PRINTK=y
149CONFIG_CPLB_INFO=y
150CONFIG_BFIN_PSEUDODBG_INSNS=y
151CONFIG_CRYPTO_HMAC=y
152CONFIG_CRYPTO_MD4=y
153CONFIG_CRYPTO_MD5=y
154CONFIG_CRYPTO_ARC4=y
155# CONFIG_CRYPTO_ANSI_CPRNG is not set
diff --git a/arch/blackfin/include/asm/bfin-global.h b/arch/blackfin/include/asm/bfin-global.h
index 17bcbf60bcae..608be5e6d25c 100644
--- a/arch/blackfin/include/asm/bfin-global.h
+++ b/arch/blackfin/include/asm/bfin-global.h
@@ -35,6 +35,11 @@ extern void bfin_setup_cpudata(unsigned int cpu);
35 35
36extern unsigned long get_cclk(void); 36extern unsigned long get_cclk(void);
37extern unsigned long get_sclk(void); 37extern unsigned long get_sclk(void);
38#ifdef CONFIG_BF60x
39extern unsigned long get_sclk0(void);
40extern unsigned long get_sclk1(void);
41extern unsigned long get_dclk(void);
42#endif
38extern unsigned long sclk_to_usecs(unsigned long sclk); 43extern unsigned long sclk_to_usecs(unsigned long sclk);
39extern unsigned long usecs_to_sclk(unsigned long usecs); 44extern unsigned long usecs_to_sclk(unsigned long usecs);
40 45
diff --git a/arch/blackfin/include/asm/bfin6xx_spi.h b/arch/blackfin/include/asm/bfin6xx_spi.h
new file mode 100644
index 000000000000..89370b653dcd
--- /dev/null
+++ b/arch/blackfin/include/asm/bfin6xx_spi.h
@@ -0,0 +1,258 @@
1/*
2 * Analog Devices SPI3 controller driver
3 *
4 * Copyright (c) 2011 Analog Devices Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20#ifndef _SPI_CHANNEL_H_
21#define _SPI_CHANNEL_H_
22
23#include <linux/types.h>
24
25/* SPI_CONTROL */
26#define SPI_CTL_EN 0x00000001 /* Enable */
27#define SPI_CTL_MSTR 0x00000002 /* Master/Slave */
28#define SPI_CTL_PSSE 0x00000004 /* controls modf error in master mode */
29#define SPI_CTL_ODM 0x00000008 /* Open Drain Mode */
30#define SPI_CTL_CPHA 0x00000010 /* Clock Phase */
31#define SPI_CTL_CPOL 0x00000020 /* Clock Polarity */
32#define SPI_CTL_ASSEL 0x00000040 /* Slave Select Pin Control */
33#define SPI_CTL_SELST 0x00000080 /* Slave Select Polarity in-between transfers */
34#define SPI_CTL_EMISO 0x00000100 /* Enable MISO */
35#define SPI_CTL_SIZE 0x00000600 /* Word Transfer Size */
36#define SPI_CTL_SIZE08 0x00000000 /* SIZE: 8 bits */
37#define SPI_CTL_SIZE16 0x00000200 /* SIZE: 16 bits */
38#define SPI_CTL_SIZE32 0x00000400 /* SIZE: 32 bits */
39#define SPI_CTL_LSBF 0x00001000 /* LSB First */
40#define SPI_CTL_FCEN 0x00002000 /* Flow-Control Enable */
41#define SPI_CTL_FCCH 0x00004000 /* Flow-Control Channel Selection */
42#define SPI_CTL_FCPL 0x00008000 /* Flow-Control Polarity */
43#define SPI_CTL_FCWM 0x00030000 /* Flow-Control Water-Mark */
44#define SPI_CTL_FIFO0 0x00000000 /* FCWM: TFIFO empty or RFIFO Full */
45#define SPI_CTL_FIFO1 0x00010000 /* FCWM: TFIFO 75% or more empty or RFIFO 75% or more full */
46#define SPI_CTL_FIFO2 0x00020000 /* FCWM: TFIFO 50% or more empty or RFIFO 50% or more full */
47#define SPI_CTL_FMODE 0x00040000 /* Fast-mode Enable */
48#define SPI_CTL_MIOM 0x00300000 /* Multiple I/O Mode */
49#define SPI_CTL_MIO_DIS 0x00000000 /* MIOM: Disable */
50#define SPI_CTL_MIO_DUAL 0x00100000 /* MIOM: Enable DIOM (Dual I/O Mode) */
51#define SPI_CTL_MIO_QUAD 0x00200000 /* MIOM: Enable QUAD (Quad SPI Mode) */
52#define SPI_CTL_SOSI 0x00400000 /* Start on MOSI */
53/* SPI_RX_CONTROL */
54#define SPI_RXCTL_REN 0x00000001 /* Receive Channel Enable */
55#define SPI_RXCTL_RTI 0x00000004 /* Receive Transfer Initiate */
56#define SPI_RXCTL_RWCEN 0x00000008 /* Receive Word Counter Enable */
57#define SPI_RXCTL_RDR 0x00000070 /* Receive Data Request */
58#define SPI_RXCTL_RDR_DIS 0x00000000 /* RDR: Disabled */
59#define SPI_RXCTL_RDR_NE 0x00000010 /* RDR: RFIFO not empty */
60#define SPI_RXCTL_RDR_25 0x00000020 /* RDR: RFIFO 25% full */
61#define SPI_RXCTL_RDR_50 0x00000030 /* RDR: RFIFO 50% full */
62#define SPI_RXCTL_RDR_75 0x00000040 /* RDR: RFIFO 75% full */
63#define SPI_RXCTL_RDR_FULL 0x00000050 /* RDR: RFIFO full */
64#define SPI_RXCTL_RDO 0x00000100 /* Receive Data Over-Run */
65#define SPI_RXCTL_RRWM 0x00003000 /* FIFO Regular Water-Mark */
66#define SPI_RXCTL_RWM_0 0x00000000 /* RRWM: RFIFO Empty */
67#define SPI_RXCTL_RWM_25 0x00001000 /* RRWM: RFIFO 25% full */
68#define SPI_RXCTL_RWM_50 0x00002000 /* RRWM: RFIFO 50% full */
69#define SPI_RXCTL_RWM_75 0x00003000 /* RRWM: RFIFO 75% full */
70#define SPI_RXCTL_RUWM 0x00070000 /* FIFO Urgent Water-Mark */
71#define SPI_RXCTL_UWM_DIS 0x00000000 /* RUWM: Disabled */
72#define SPI_RXCTL_UWM_25 0x00010000 /* RUWM: RFIFO 25% full */
73#define SPI_RXCTL_UWM_50 0x00020000 /* RUWM: RFIFO 50% full */
74#define SPI_RXCTL_UWM_75 0x00030000 /* RUWM: RFIFO 75% full */
75#define SPI_RXCTL_UWM_FULL 0x00040000 /* RUWM: RFIFO full */
76/* SPI_TX_CONTROL */
77#define SPI_TXCTL_TEN 0x00000001 /* Transmit Channel Enable */
78#define SPI_TXCTL_TTI 0x00000004 /* Transmit Transfer Initiate */
79#define SPI_TXCTL_TWCEN 0x00000008 /* Transmit Word Counter Enable */
80#define SPI_TXCTL_TDR 0x00000070 /* Transmit Data Request */
81#define SPI_TXCTL_TDR_DIS 0x00000000 /* TDR: Disabled */
82#define SPI_TXCTL_TDR_NF 0x00000010 /* TDR: TFIFO not full */
83#define SPI_TXCTL_TDR_25 0x00000020 /* TDR: TFIFO 25% empty */
84#define SPI_TXCTL_TDR_50 0x00000030 /* TDR: TFIFO 50% empty */
85#define SPI_TXCTL_TDR_75 0x00000040 /* TDR: TFIFO 75% empty */
86#define SPI_TXCTL_TDR_EMPTY 0x00000050 /* TDR: TFIFO empty */
87#define SPI_TXCTL_TDU 0x00000100 /* Transmit Data Under-Run */
88#define SPI_TXCTL_TRWM 0x00003000 /* FIFO Regular Water-Mark */
89#define SPI_TXCTL_RWM_FULL 0x00000000 /* TRWM: TFIFO full */
90#define SPI_TXCTL_RWM_25 0x00001000 /* TRWM: TFIFO 25% empty */
91#define SPI_TXCTL_RWM_50 0x00002000 /* TRWM: TFIFO 50% empty */
92#define SPI_TXCTL_RWM_75 0x00003000 /* TRWM: TFIFO 75% empty */
93#define SPI_TXCTL_TUWM 0x00070000 /* FIFO Urgent Water-Mark */
94#define SPI_TXCTL_UWM_DIS 0x00000000 /* TUWM: Disabled */
95#define SPI_TXCTL_UWM_25 0x00010000 /* TUWM: TFIFO 25% empty */
96#define SPI_TXCTL_UWM_50 0x00020000 /* TUWM: TFIFO 50% empty */
97#define SPI_TXCTL_UWM_75 0x00030000 /* TUWM: TFIFO 75% empty */
98#define SPI_TXCTL_UWM_EMPTY 0x00040000 /* TUWM: TFIFO empty */
99/* SPI_CLOCK */
100#define SPI_CLK_BAUD 0x0000FFFF /* Baud Rate */
101/* SPI_DELAY */
102#define SPI_DLY_STOP 0x000000FF /* Transfer delay time in multiples of SCK period */
103#define SPI_DLY_LEADX 0x00000100 /* Extended (1 SCK) LEAD Control */
104#define SPI_DLY_LAGX 0x00000200 /* Extended (1 SCK) LAG control */
105/* SPI_SSEL */
106#define SPI_SLVSEL_SSE1 0x00000002 /* SPISSEL1 Enable */
107#define SPI_SLVSEL_SSE2 0x00000004 /* SPISSEL2 Enable */
108#define SPI_SLVSEL_SSE3 0x00000008 /* SPISSEL3 Enable */
109#define SPI_SLVSEL_SSE4 0x00000010 /* SPISSEL4 Enable */
110#define SPI_SLVSEL_SSE5 0x00000020 /* SPISSEL5 Enable */
111#define SPI_SLVSEL_SSE6 0x00000040 /* SPISSEL6 Enable */
112#define SPI_SLVSEL_SSE7 0x00000080 /* SPISSEL7 Enable */
113#define SPI_SLVSEL_SSEL1 0x00000200 /* SPISSEL1 Value */
114#define SPI_SLVSEL_SSEL2 0x00000400 /* SPISSEL2 Value */
115#define SPI_SLVSEL_SSEL3 0x00000800 /* SPISSEL3 Value */
116#define SPI_SLVSEL_SSEL4 0x00001000 /* SPISSEL4 Value */
117#define SPI_SLVSEL_SSEL5 0x00002000 /* SPISSEL5 Value */
118#define SPI_SLVSEL_SSEL6 0x00004000 /* SPISSEL6 Value */
119#define SPI_SLVSEL_SSEL7 0x00008000 /* SPISSEL7 Value */
120/* SPI_RWC */
121#define SPI_RWC_VALUE 0x0000FFFF /* Received Word-Count */
122/* SPI_RWCR */
123#define SPI_RWCR_VALUE 0x0000FFFF /* Received Word-Count Reload */
124/* SPI_TWC */
125#define SPI_TWC_VALUE 0x0000FFFF /* Transmitted Word-Count */
126/* SPI_TWCR */
127#define SPI_TWCR_VALUE 0x0000FFFF /* Transmitted Word-Count Reload */
128/* SPI_IMASK */
129#define SPI_IMSK_RUWM 0x00000002 /* Receive Urgent Water-Mark Interrupt Mask */
130#define SPI_IMSK_TUWM 0x00000004 /* Transmit Urgent Water-Mark Interrupt Mask */
131#define SPI_IMSK_ROM 0x00000010 /* Receive Over-Run Error Interrupt Mask */
132#define SPI_IMSK_TUM 0x00000020 /* Transmit Under-Run Error Interrupt Mask */
133#define SPI_IMSK_TCM 0x00000040 /* Transmit Collision Error Interrupt Mask */
134#define SPI_IMSK_MFM 0x00000080 /* Mode Fault Error Interrupt Mask */
135#define SPI_IMSK_RSM 0x00000100 /* Receive Start Interrupt Mask */
136#define SPI_IMSK_TSM 0x00000200 /* Transmit Start Interrupt Mask */
137#define SPI_IMSK_RFM 0x00000400 /* Receive Finish Interrupt Mask */
138#define SPI_IMSK_TFM 0x00000800 /* Transmit Finish Interrupt Mask */
139/* SPI_IMASKCL */
140#define SPI_IMSK_CLR_RUW 0x00000002 /* Receive Urgent Water-Mark Interrupt Mask */
141#define SPI_IMSK_CLR_TUWM 0x00000004 /* Transmit Urgent Water-Mark Interrupt Mask */
142#define SPI_IMSK_CLR_ROM 0x00000010 /* Receive Over-Run Error Interrupt Mask */
143#define SPI_IMSK_CLR_TUM 0x00000020 /* Transmit Under-Run Error Interrupt Mask */
144#define SPI_IMSK_CLR_TCM 0x00000040 /* Transmit Collision Error Interrupt Mask */
145#define SPI_IMSK_CLR_MFM 0x00000080 /* Mode Fault Error Interrupt Mask */
146#define SPI_IMSK_CLR_RSM 0x00000100 /* Receive Start Interrupt Mask */
147#define SPI_IMSK_CLR_TSM 0x00000200 /* Transmit Start Interrupt Mask */
148#define SPI_IMSK_CLR_RFM 0x00000400 /* Receive Finish Interrupt Mask */
149#define SPI_IMSK_CLR_TFM 0x00000800 /* Transmit Finish Interrupt Mask */
150/* SPI_IMASKST */
151#define SPI_IMSK_SET_RUWM 0x00000002 /* Receive Urgent Water-Mark Interrupt Mask */
152#define SPI_IMSK_SET_TUWM 0x00000004 /* Transmit Urgent Water-Mark Interrupt Mask */
153#define SPI_IMSK_SET_ROM 0x00000010 /* Receive Over-Run Error Interrupt Mask */
154#define SPI_IMSK_SET_TUM 0x00000020 /* Transmit Under-Run Error Interrupt Mask */
155#define SPI_IMSK_SET_TCM 0x00000040 /* Transmit Collision Error Interrupt Mask */
156#define SPI_IMSK_SET_MFM 0x00000080 /* Mode Fault Error Interrupt Mask */
157#define SPI_IMSK_SET_RSM 0x00000100 /* Receive Start Interrupt Mask */
158#define SPI_IMSK_SET_TSM 0x00000200 /* Transmit Start Interrupt Mask */
159#define SPI_IMSK_SET_RFM 0x00000400 /* Receive Finish Interrupt Mask */
160#define SPI_IMSK_SET_TFM 0x00000800 /* Transmit Finish Interrupt Mask */
161/* SPI_STATUS */
162#define SPI_STAT_SPIF 0x00000001 /* SPI Finished */
163#define SPI_STAT_RUWM 0x00000002 /* Receive Urgent Water-Mark Breached */
164#define SPI_STAT_TUWM 0x00000004 /* Transmit Urgent Water-Mark Breached */
165#define SPI_STAT_ROE 0x00000010 /* Receive Over-Run Error Indication */
166#define SPI_STAT_TUE 0x00000020 /* Transmit Under-Run Error Indication */
167#define SPI_STAT_TCE 0x00000040 /* Transmit Collision Error Indication */
168#define SPI_STAT_MODF 0x00000080 /* Mode Fault Error Indication */
169#define SPI_STAT_RS 0x00000100 /* Receive Start Indication */
170#define SPI_STAT_TS 0x00000200 /* Transmit Start Indication */
171#define SPI_STAT_RF 0x00000400 /* Receive Finish Indication */
172#define SPI_STAT_TF 0x00000800 /* Transmit Finish Indication */
173#define SPI_STAT_RFS 0x00007000 /* SPI_RFIFO status */
174#define SPI_STAT_RFIFO_EMPTY 0x00000000 /* RFS: RFIFO Empty */
175#define SPI_STAT_RFIFO_25 0x00001000 /* RFS: RFIFO 25% Full */
176#define SPI_STAT_RFIFO_50 0x00002000 /* RFS: RFIFO 50% Full */
177#define SPI_STAT_RFIFO_75 0x00003000 /* RFS: RFIFO 75% Full */
178#define SPI_STAT_RFIFO_FULL 0x00004000 /* RFS: RFIFO Full */
179#define SPI_STAT_TFS 0x00070000 /* SPI_TFIFO status */
180#define SPI_STAT_TFIFO_FULL 0x00000000 /* TFS: TFIFO full */
181#define SPI_STAT_TFIFO_25 0x00010000 /* TFS: TFIFO 25% empty */
182#define SPI_STAT_TFIFO_50 0x00020000 /* TFS: TFIFO 50% empty */
183#define SPI_STAT_TFIFO_75 0x00030000 /* TFS: TFIFO 75% empty */
184#define SPI_STAT_TFIFO_EMPTY 0x00040000 /* TFS: TFIFO empty */
185#define SPI_STAT_FCS 0x00100000 /* Flow-Control Stall Indication */
186#define SPI_STAT_RFE 0x00400000 /* SPI_RFIFO Empty */
187#define SPI_STAT_TFF 0x00800000 /* SPI_TFIFO Full */
188/* SPI_ILAT */
189#define SPI_ILAT_RUWMI 0x00000002 /* Receive Urgent Water Mark Interrupt */
190#define SPI_ILAT_TUWMI 0x00000004 /* Transmit Urgent Water Mark Interrupt */
191#define SPI_ILAT_ROI 0x00000010 /* Receive Over-Run Error Indication */
192#define SPI_ILAT_TUI 0x00000020 /* Transmit Under-Run Error Indication */
193#define SPI_ILAT_TCI 0x00000040 /* Transmit Collision Error Indication */
194#define SPI_ILAT_MFI 0x00000080 /* Mode Fault Error Indication */
195#define SPI_ILAT_RSI 0x00000100 /* Receive Start Indication */
196#define SPI_ILAT_TSI 0x00000200 /* Transmit Start Indication */
197#define SPI_ILAT_RFI 0x00000400 /* Receive Finish Indication */
198#define SPI_ILAT_TFI 0x00000800 /* Transmit Finish Indication */
199/* SPI_ILATCL */
200#define SPI_ILAT_CLR_RUWMI 0x00000002 /* Receive Urgent Water Mark Interrupt */
201#define SPI_ILAT_CLR_TUWMI 0x00000004 /* Transmit Urgent Water Mark Interrupt */
202#define SPI_ILAT_CLR_ROI 0x00000010 /* Receive Over-Run Error Indication */
203#define SPI_ILAT_CLR_TUI 0x00000020 /* Transmit Under-Run Error Indication */
204#define SPI_ILAT_CLR_TCI 0x00000040 /* Transmit Collision Error Indication */
205#define SPI_ILAT_CLR_MFI 0x00000080 /* Mode Fault Error Indication */
206#define SPI_ILAT_CLR_RSI 0x00000100 /* Receive Start Indication */
207#define SPI_ILAT_CLR_TSI 0x00000200 /* Transmit Start Indication */
208#define SPI_ILAT_CLR_RFI 0x00000400 /* Receive Finish Indication */
209#define SPI_ILAT_CLR_TFI 0x00000800 /* Transmit Finish Indication */
210
211/*
212 * bfin spi3 registers layout
213 */
214struct bfin_spi_regs {
215 u32 revid;
216 u32 control;
217 u32 rx_control;
218 u32 tx_control;
219 u32 clock;
220 u32 delay;
221 u32 ssel;
222 u32 rwc;
223 u32 rwcr;
224 u32 twc;
225 u32 twcr;
226 u32 reserved0;
227 u32 emask;
228 u32 emaskcl;
229 u32 emaskst;
230 u32 reserved1;
231 u32 status;
232 u32 elat;
233 u32 elatcl;
234 u32 reserved2;
235 u32 rfifo;
236 u32 reserved3;
237 u32 tfifo;
238};
239
240#define MAX_CTRL_CS 8 /* cs in spi controller */
241
242/* device.platform_data for SSP controller devices */
243struct bfin6xx_spi_master {
244 u16 num_chipselect;
245 u16 pin_req[7];
246};
247
248/* spi_board_info.controller_data for SPI slave devices,
249 * copied to spi_device.platform_data ... mostly for dma tuning
250 */
251struct bfin6xx_spi_chip {
252 u32 control;
253 u16 cs_chg_udelay; /* Some devices require 16-bit delays */
254 u32 tx_dummy_val; /* tx value for rx only transfer */
255 bool enable_dma;
256};
257
258#endif /* _SPI_CHANNEL_H_ */
diff --git a/arch/blackfin/include/asm/bfin_crc.h b/arch/blackfin/include/asm/bfin_crc.h
new file mode 100644
index 000000000000..3deb4452ceed
--- /dev/null
+++ b/arch/blackfin/include/asm/bfin_crc.h
@@ -0,0 +1,139 @@
1/*
2 * bfin_crc.h - interface to Blackfin CRC controllers
3 *
4 * Copyright 2012 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __BFIN_CRC_H__
10#define __BFIN_CRC_H__
11
12/* Function driver which use hardware crc must initialize the structure */
13struct crc_info {
14 /* Input data address */
15 unsigned char *in_addr;
16 /* Output data address */
17 unsigned char *out_addr;
18 /* Input or output bytes */
19 unsigned long datasize;
20 union {
21 /* CRC to compare with that of input buffer */
22 unsigned long crc_compare;
23 /* Value to compare with input data */
24 unsigned long val_verify;
25 /* Value to fill */
26 unsigned long val_fill;
27 };
28 /* Value to program the 32b CRC Polynomial */
29 unsigned long crc_poly;
30 union {
31 /* CRC calculated from the input data */
32 unsigned long crc_result;
33 /* First failed position to verify input data */
34 unsigned long pos_verify;
35 };
36 /* CRC mirror flags */
37 unsigned int bitmirr:1;
38 unsigned int bytmirr:1;
39 unsigned int w16swp:1;
40 unsigned int fdsel:1;
41 unsigned int rsltmirr:1;
42 unsigned int polymirr:1;
43 unsigned int cmpmirr:1;
44};
45
46/* Userspace interface */
47#define CRC_IOC_MAGIC 'C'
48#define CRC_IOC_CALC_CRC _IOWR('C', 0x01, unsigned int)
49#define CRC_IOC_MEMCPY_CRC _IOWR('C', 0x02, unsigned int)
50#define CRC_IOC_VERIFY_VAL _IOWR('C', 0x03, unsigned int)
51#define CRC_IOC_FILL_VAL _IOWR('C', 0x04, unsigned int)
52
53
54#ifdef __KERNEL__
55
56#include <linux/types.h>
57#include <linux/spinlock.h>
58#include <linux/miscdevice.h>
59
60struct crc_register {
61 u32 control;
62 u32 datacnt;
63 u32 datacntrld;
64 u32 __pad_1[2];
65 u32 compare;
66 u32 fillval;
67 u32 datafifo;
68 u32 intren;
69 u32 intrenset;
70 u32 intrenclr;
71 u32 poly;
72 u32 __pad_2[4];
73 u32 status;
74 u32 datacntcap;
75 u32 __pad_3;
76 u32 result;
77 u32 curresult;
78 u32 __pad_4[3];
79 u32 revid;
80};
81
82struct bfin_crc {
83 struct miscdevice mdev;
84 struct list_head list;
85 int irq;
86 int dma_ch_src;
87 int dma_ch_dest;
88 volatile struct crc_register *regs;
89 struct crc_info *info;
90 struct mutex mutex;
91 struct completion c;
92 unsigned short opmode;
93 char name[20];
94};
95
96/* CRC_STATUS Masks */
97#define CMPERR 0x00000002 /* Compare error */
98#define DCNTEXP 0x00000010 /* datacnt register expired */
99#define IBR 0x00010000 /* Input buffer ready */
100#define OBR 0x00020000 /* Output buffer ready */
101#define IRR 0x00040000 /* Immediate result readt */
102#define LUTDONE 0x00080000 /* Look-up table generation done */
103#define FSTAT 0x00700000 /* FIFO status */
104#define MAX_FIFO 4 /* Max fifo size */
105
106/* CRC_CONTROL Masks */
107#define BLKEN 0x00000001 /* Block enable */
108#define OPMODE 0x000000F0 /* Operation mode */
109#define OPMODE_OFFSET 4 /* Operation mode mask offset*/
110#define MODE_DMACPY_CRC 1 /* MTM CRC compute and compare */
111#define MODE_DATA_FILL 2 /* MTM data fill */
112#define MODE_CALC_CRC 3 /* MSM CRC compute and compare */
113#define MODE_DATA_VERIFY 4 /* MSM data verify */
114#define AUTOCLRZ 0x00000100 /* Auto clear to zero */
115#define AUTOCLRF 0x00000200 /* Auto clear to one */
116#define OBRSTALL 0x00001000 /* Stall on output buffer ready */
117#define IRRSTALL 0x00002000 /* Stall on immediate result ready */
118#define BITMIRR 0x00010000 /* Mirror bits within each byte of 32-bit input data */
119#define BITMIRR_OFFSET 16 /* Mirror bits offset */
120#define BYTMIRR 0x00020000 /* Mirror bytes of 32-bit input data */
121#define BYTMIRR_OFFSET 17 /* Mirror bytes offset */
122#define W16SWP 0x00040000 /* Mirror uppper and lower 16-bit word of 32-bit input data */
123#define W16SWP_OFFSET 18 /* Mirror 16-bit word offset */
124#define FDSEL 0x00080000 /* FIFO is written after input data is mirrored */
125#define FDSEL_OFFSET 19 /* Mirror FIFO offset */
126#define RSLTMIRR 0x00100000 /* CRC result registers are mirrored. */
127#define RSLTMIRR_OFFSET 20 /* Mirror CRC result offset. */
128#define POLYMIRR 0x00200000 /* CRC poly register is mirrored. */
129#define POLYMIRR_OFFSET 21 /* Mirror CRC poly offset. */
130#define CMPMIRR 0x00400000 /* CRC compare register is mirrored. */
131#define CMPMIRR_OFFSET 22 /* Mirror CRC compare offset. */
132
133/* CRC_INTREN Masks */
134#define CMPERRI 0x02 /* CRC_ERROR_INTR */
135#define DCNTEXPI 0x10 /* CRC_STATUS_INTR */
136
137#endif
138
139#endif
diff --git a/arch/blackfin/include/asm/bfin_dma.h b/arch/blackfin/include/asm/bfin_dma.h
index d51120744148..6319f4e49083 100644
--- a/arch/blackfin/include/asm/bfin_dma.h
+++ b/arch/blackfin/include/asm/bfin_dma.h
@@ -15,12 +15,55 @@
15#define DMAEN 0x0001 /* DMA Channel Enable */ 15#define DMAEN 0x0001 /* DMA Channel Enable */
16#define WNR 0x0002 /* Channel Direction (W/R*) */ 16#define WNR 0x0002 /* Channel Direction (W/R*) */
17#define WDSIZE_8 0x0000 /* Transfer Word Size = 8 */ 17#define WDSIZE_8 0x0000 /* Transfer Word Size = 8 */
18#define PSIZE_8 0x00000000 /* Transfer Word Size = 16 */
19
20#ifdef CONFIG_BF60x
21
22#define PSIZE_16 0x00000010 /* Transfer Word Size = 16 */
23#define PSIZE_32 0x00000020 /* Transfer Word Size = 32 */
24#define PSIZE_64 0x00000030 /* Transfer Word Size = 32 */
25#define WDSIZE_16 0x00000100 /* Transfer Word Size = 16 */
26#define WDSIZE_32 0x00000200 /* Transfer Word Size = 32 */
27#define WDSIZE_64 0x00000300 /* Transfer Word Size = 32 */
28#define WDSIZE_128 0x00000400 /* Transfer Word Size = 32 */
29#define WDSIZE_256 0x00000500 /* Transfer Word Size = 32 */
30#define DMA2D 0x04000000 /* DMA Mode (2D/1D*) */
31#define RESTART 0x00000004 /* DMA Buffer Clear SYNC */
32#define DI_EN_X 0x00100000 /* Data Interrupt Enable in X count */
33#define DI_EN_Y 0x00200000 /* Data Interrupt Enable in Y count */
34#define DI_EN_P 0x00300000 /* Data Interrupt Enable in Peripheral */
35#define DI_EN DI_EN_X /* Data Interrupt Enable */
36#define NDSIZE_0 0x00000000 /* Next Descriptor Size = 1 */
37#define NDSIZE_1 0x00010000 /* Next Descriptor Size = 2 */
38#define NDSIZE_2 0x00020000 /* Next Descriptor Size = 3 */
39#define NDSIZE_3 0x00030000 /* Next Descriptor Size = 4 */
40#define NDSIZE_4 0x00040000 /* Next Descriptor Size = 5 */
41#define NDSIZE_5 0x00050000 /* Next Descriptor Size = 6 */
42#define NDSIZE_6 0x00060000 /* Next Descriptor Size = 7 */
43#define NDSIZE 0x00070000 /* Next Descriptor Size */
44#define NDSIZE_OFFSET 16 /* Next Descriptor Size Offset */
45#define DMAFLOW_LIST 0x00004000 /* Descriptor List Mode */
46#define DMAFLOW_LARGE DMAFLOW_LIST
47#define DMAFLOW_ARRAY 0x00005000 /* Descriptor Array Mode */
48#define DMAFLOW_LIST_DEMAND 0x00006000 /* Descriptor Demand List Mode */
49#define DMAFLOW_ARRAY_DEMAND 0x00007000 /* Descriptor Demand Array Mode */
50#define DMA_RUN_DFETCH 0x00000100 /* DMA Channel Running Indicator (DFETCH) */
51#define DMA_RUN 0x00000200 /* DMA Channel Running Indicator */
52#define DMA_RUN_WAIT_TRIG 0x00000300 /* DMA Channel Running Indicator (WAIT TRIG) */
53#define DMA_RUN_WAIT_ACK 0x00000400 /* DMA Channel Running Indicator (WAIT ACK) */
54
55#else
56
57#define PSIZE_16 0x0000 /* Transfer Word Size = 16 */
58#define PSIZE_32 0x0000 /* Transfer Word Size = 32 */
18#define WDSIZE_16 0x0004 /* Transfer Word Size = 16 */ 59#define WDSIZE_16 0x0004 /* Transfer Word Size = 16 */
19#define WDSIZE_32 0x0008 /* Transfer Word Size = 32 */ 60#define WDSIZE_32 0x0008 /* Transfer Word Size = 32 */
20#define DMA2D 0x0010 /* DMA Mode (2D/1D*) */ 61#define DMA2D 0x0010 /* DMA Mode (2D/1D*) */
21#define RESTART 0x0020 /* DMA Buffer Clear */ 62#define RESTART 0x0020 /* DMA Buffer Clear */
22#define DI_SEL 0x0040 /* Data Interrupt Timing Select */ 63#define DI_SEL 0x0040 /* Data Interrupt Timing Select */
23#define DI_EN 0x0080 /* Data Interrupt Enable */ 64#define DI_EN 0x0080 /* Data Interrupt Enable */
65#define DI_EN_X 0x00C0 /* Data Interrupt Enable in X count*/
66#define DI_EN_Y 0x0080 /* Data Interrupt Enable in Y count*/
24#define NDSIZE_0 0x0000 /* Next Descriptor Size = 0 (Stop/Autobuffer) */ 67#define NDSIZE_0 0x0000 /* Next Descriptor Size = 0 (Stop/Autobuffer) */
25#define NDSIZE_1 0x0100 /* Next Descriptor Size = 1 */ 68#define NDSIZE_1 0x0100 /* Next Descriptor Size = 1 */
26#define NDSIZE_2 0x0200 /* Next Descriptor Size = 2 */ 69#define NDSIZE_2 0x0200 /* Next Descriptor Size = 2 */
@@ -32,18 +75,26 @@
32#define NDSIZE_8 0x0800 /* Next Descriptor Size = 8 */ 75#define NDSIZE_8 0x0800 /* Next Descriptor Size = 8 */
33#define NDSIZE_9 0x0900 /* Next Descriptor Size = 9 */ 76#define NDSIZE_9 0x0900 /* Next Descriptor Size = 9 */
34#define NDSIZE 0x0f00 /* Next Descriptor Size */ 77#define NDSIZE 0x0f00 /* Next Descriptor Size */
35#define DMAFLOW 0x7000 /* Flow Control */ 78#define NDSIZE_OFFSET 8 /* Next Descriptor Size Offset */
36#define DMAFLOW_STOP 0x0000 /* Stop Mode */
37#define DMAFLOW_AUTO 0x1000 /* Autobuffer Mode */
38#define DMAFLOW_ARRAY 0x4000 /* Descriptor Array Mode */ 79#define DMAFLOW_ARRAY 0x4000 /* Descriptor Array Mode */
39#define DMAFLOW_SMALL 0x6000 /* Small Model Descriptor List Mode */ 80#define DMAFLOW_SMALL 0x6000 /* Small Model Descriptor List Mode */
40#define DMAFLOW_LARGE 0x7000 /* Large Model Descriptor List Mode */ 81#define DMAFLOW_LARGE 0x7000 /* Large Model Descriptor List Mode */
82#define DFETCH 0x0004 /* DMA Descriptor Fetch Indicator */
83#define DMA_RUN 0x0008 /* DMA Channel Running Indicator */
84
85#endif
86#define DMAFLOW 0x7000 /* Flow Control */
87#define DMAFLOW_STOP 0x0000 /* Stop Mode */
88#define DMAFLOW_AUTO 0x1000 /* Autobuffer Mode */
41 89
42/* DMA_IRQ_STATUS Masks */ 90/* DMA_IRQ_STATUS Masks */
43#define DMA_DONE 0x0001 /* DMA Completion Interrupt Status */ 91#define DMA_DONE 0x0001 /* DMA Completion Interrupt Status */
44#define DMA_ERR 0x0002 /* DMA Error Interrupt Status */ 92#define DMA_ERR 0x0002 /* DMA Error Interrupt Status */
45#define DFETCH 0x0004 /* DMA Descriptor Fetch Indicator */ 93#ifdef CONFIG_BF60x
46#define DMA_RUN 0x0008 /* DMA Channel Running Indicator */ 94#define DMA_PIRQ 0x0004 /* DMA Peripheral Error Interrupt Status */
95#else
96#define DMA_PIRQ 0
97#endif
47 98
48/* 99/*
49 * All Blackfin system MMRs are padded to 32bits even if the register 100 * All Blackfin system MMRs are padded to 32bits even if the register
@@ -57,6 +108,26 @@
57struct bfin_dma_regs { 108struct bfin_dma_regs {
58 u32 next_desc_ptr; 109 u32 next_desc_ptr;
59 u32 start_addr; 110 u32 start_addr;
111#ifdef CONFIG_BF60x
112 u32 cfg;
113 u32 x_count;
114 u32 x_modify;
115 u32 y_count;
116 u32 y_modify;
117 u32 pad1;
118 u32 pad2;
119 u32 curr_desc_ptr;
120 u32 prev_desc_ptr;
121 u32 curr_addr;
122 u32 irq_status;
123 u32 curr_x_count;
124 u32 curr_y_count;
125 u32 pad3;
126 u32 bw_limit_count;
127 u32 curr_bw_limit_count;
128 u32 bw_monitor_count;
129 u32 curr_bw_monitor_count;
130#else
60 __BFP(config); 131 __BFP(config);
61 u32 __pad0; 132 u32 __pad0;
62 __BFP(x_count); 133 __BFP(x_count);
@@ -71,8 +142,10 @@ struct bfin_dma_regs {
71 u32 __pad1; 142 u32 __pad1;
72 __BFP(curr_y_count); 143 __BFP(curr_y_count);
73 u32 __pad2; 144 u32 __pad2;
145#endif
74}; 146};
75 147
148#ifndef CONFIG_BF60x
76/* 149/*
77 * bfin handshake mdma registers layout 150 * bfin handshake mdma registers layout
78 */ 151 */
@@ -85,6 +158,7 @@ struct bfin_hmdma_regs {
85 __BFP(ecount); 158 __BFP(ecount);
86 __BFP(bcount); 159 __BFP(bcount);
87}; 160};
161#endif
88 162
89#undef __BFP 163#undef __BFP
90 164
diff --git a/arch/blackfin/include/asm/bfin_pfmon.h b/arch/blackfin/include/asm/bfin_pfmon.h
index accd47e2db40..bf52e1f32257 100644
--- a/arch/blackfin/include/asm/bfin_pfmon.h
+++ b/arch/blackfin/include/asm/bfin_pfmon.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright 2005-2011 Analog Devices Inc. 4 * Copyright 2005-2011 Analog Devices Inc.
5 * 5 *
6 * Licensed under the ADI BSD license or GPL-2 (or later). 6 * Licensed under the Clear BSD license or GPL-2 (or later).
7 */ 7 */
8 8
9#ifndef __ASM_BFIN_PFMON_H__ 9#ifndef __ASM_BFIN_PFMON_H__
diff --git a/arch/blackfin/include/asm/bfin_ppi.h b/arch/blackfin/include/asm/bfin_ppi.h
index 3be05faa2c65..a4e872e16e75 100644
--- a/arch/blackfin/include/asm/bfin_ppi.h
+++ b/arch/blackfin/include/asm/bfin_ppi.h
@@ -10,6 +10,7 @@
10#define __ASM_BFIN_PPI_H__ 10#define __ASM_BFIN_PPI_H__
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <asm/blackfin.h>
13 14
14/* 15/*
15 * All Blackfin system MMRs are padded to 32bits even if the register 16 * All Blackfin system MMRs are padded to 32bits even if the register
@@ -48,6 +49,133 @@ struct bfin_eppi_regs {
48 u32 clip; 49 u32 clip;
49}; 50};
50 51
52/*
53 * bfin eppi3 registers layout
54 */
55struct bfin_eppi3_regs {
56 u32 stat;
57 u32 hcnt;
58 u32 hdly;
59 u32 vcnt;
60 u32 vdly;
61 u32 frame;
62 u32 line;
63 u32 clkdiv;
64 u32 ctl;
65 u32 fs1_wlhb;
66 u32 fs1_paspl;
67 u32 fs2_wlvb;
68 u32 fs2_palpf;
69 u32 imsk;
70 u32 oddclip;
71 u32 evenclip;
72 u32 fs1_dly;
73 u32 fs2_dly;
74 u32 ctl2;
75};
76
51#undef __BFP 77#undef __BFP
52 78
79#ifdef EPPI0_CTL2
80#define EPPI_STAT_CFIFOERR 0x00000001 /* Chroma FIFO Error */
81#define EPPI_STAT_YFIFOERR 0x00000002 /* Luma FIFO Error */
82#define EPPI_STAT_LTERROVR 0x00000004 /* Line Track Overflow */
83#define EPPI_STAT_LTERRUNDR 0x00000008 /* Line Track Underflow */
84#define EPPI_STAT_FTERROVR 0x00000010 /* Frame Track Overflow */
85#define EPPI_STAT_FTERRUNDR 0x00000020 /* Frame Track Underflow */
86#define EPPI_STAT_ERRNCOR 0x00000040 /* Preamble Error Not Corrected */
87#define EPPI_STAT_PXPERR 0x00000080 /* PxP Ready Error */
88#define EPPI_STAT_ERRDET 0x00004000 /* Preamble Error Detected */
89#define EPPI_STAT_FLD 0x00008000 /* Current Field Received by EPPI */
90
91#define EPPI_HCNT_VALUE 0x0000FFFF /* Holds the number of samples to read in or write out per line, after PPIx_HDLY number of cycles have expired since the last assertion of PPIx_FS1 */
92
93#define EPPI_HDLY_VALUE 0x0000FFFF /* Number of PPIx_CLK cycles to delay after assertion of PPIx_FS1 before starting to read or write data */
94
95#define EPPI_VCNT_VALUE 0x0000FFFF /* Holds the number of lines to read in or write out, after PPIx_VDLY number of lines from the start of frame */
96
97#define EPPI_VDLY_VALUE 0x0000FFFF /* Number of lines to wait after the start of a new frame before starting to read/transmit data */
98
99#define EPPI_FRAME_VALUE 0x0000FFFF /* Holds the number of lines expected per frame of data */
100
101#define EPPI_LINE_VALUE 0x0000FFFF /* Holds the number of samples expected per line */
102
103#define EPPI_CLKDIV_VALUE 0x0000FFFF /* Internal clock divider */
104
105#define EPPI_CTL_EN 0x00000001 /* PPI Enable */
106#define EPPI_CTL_DIR 0x00000002 /* PPI Direction */
107#define EPPI_CTL_XFRTYPE 0x0000000C /* PPI Operating Mode */
108#define EPPI_CTL_ACTIVE656 0x00000000 /* XFRTYPE: ITU656 Active Video Only Mode */
109#define EPPI_CTL_ENTIRE656 0x00000004 /* XFRTYPE: ITU656 Entire Field Mode */
110#define EPPI_CTL_VERT656 0x00000008 /* XFRTYPE: ITU656 Vertical Blanking Only Mode */
111#define EPPI_CTL_NON656 0x0000000C /* XFRTYPE: Non-ITU656 Mode (GP Mode) */
112#define EPPI_CTL_FSCFG 0x00000030 /* Frame Sync Configuration */
113#define EPPI_CTL_SYNC0 0x00000000 /* FSCFG: Sync Mode 0 */
114#define EPPI_CTL_SYNC1 0x00000010 /* FSCFG: Sync Mode 1 */
115#define EPPI_CTL_SYNC2 0x00000020 /* FSCFG: Sync Mode 2 */
116#define EPPI_CTL_SYNC3 0x00000030 /* FSCFG: Sync Mode 3 */
117#define EPPI_CTL_FLDSEL 0x00000040 /* Field Select/Trigger */
118#define EPPI_CTL_ITUTYPE 0x00000080 /* ITU Interlace or Progressive */
119#define EPPI_CTL_BLANKGEN 0x00000100 /* ITU Output Mode with Internal Blanking Generation */
120#define EPPI_CTL_ICLKGEN 0x00000200 /* Internal Clock Generation */
121#define EPPI_CTL_IFSGEN 0x00000400 /* Internal Frame Sync Generation */
122#define EPPI_CTL_SIGNEXT 0x00000800 /* Sign Extension */
123#define EPPI_CTL_POLC 0x00003000 /* Frame Sync and Data Driving and Sampling Edges */
124#define EPPI_CTL_POLC0 0x00000000 /* POLC: Clock/Sync polarity mode 0 */
125#define EPPI_CTL_POLC1 0x00001000 /* POLC: Clock/Sync polarity mode 1 */
126#define EPPI_CTL_POLC2 0x00002000 /* POLC: Clock/Sync polarity mode 2 */
127#define EPPI_CTL_POLC3 0x00003000 /* POLC: Clock/Sync polarity mode 3 */
128#define EPPI_CTL_POLS 0x0000C000 /* Frame Sync Polarity */
129#define EPPI_CTL_FS1HI_FS2HI 0x00000000 /* POLS: FS1 and FS2 are active high */
130#define EPPI_CTL_FS1LO_FS2HI 0x00004000 /* POLS: FS1 is active low. FS2 is active high */
131#define EPPI_CTL_FS1HI_FS2LO 0x00008000 /* POLS: FS1 is active high. FS2 is active low */
132#define EPPI_CTL_FS1LO_FS2LO 0x0000C000 /* POLS: FS1 and FS2 are active low */
133#define EPPI_CTL_DLEN 0x00070000 /* Data Length */
134#define EPPI_CTL_DLEN08 0x00000000 /* DLEN: 8 bits */
135#define EPPI_CTL_DLEN10 0x00010000 /* DLEN: 10 bits */
136#define EPPI_CTL_DLEN12 0x00020000 /* DLEN: 12 bits */
137#define EPPI_CTL_DLEN14 0x00030000 /* DLEN: 14 bits */
138#define EPPI_CTL_DLEN16 0x00040000 /* DLEN: 16 bits */
139#define EPPI_CTL_DLEN18 0x00050000 /* DLEN: 18 bits */
140#define EPPI_CTL_DLEN20 0x00060000 /* DLEN: 20 bits */
141#define EPPI_CTL_DLEN24 0x00070000 /* DLEN: 24 bits */
142#define EPPI_CTL_DMIRR 0x00080000 /* Data Mirroring */
143#define EPPI_CTL_SKIPEN 0x00100000 /* Skip Enable */
144#define EPPI_CTL_SKIPEO 0x00200000 /* Skip Even or Odd */
145#define EPPI_CTL_PACKEN 0x00400000 /* Pack/Unpack Enable */
146#define EPPI_CTL_SWAPEN 0x00800000 /* Swap Enable */
147#define EPPI_CTL_SPLTEO 0x01000000 /* Split Even and Odd Data Samples */
148#define EPPI_CTL_SUBSPLTODD 0x02000000 /* Sub-Split Odd Samples */
149#define EPPI_CTL_SPLTWRD 0x04000000 /* Split Word */
150#define EPPI_CTL_RGBFMTEN 0x08000000 /* RGB Formatting Enable */
151#define EPPI_CTL_DMACFG 0x10000000 /* One or Two DMA Channels Mode */
152#define EPPI_CTL_DMAFINEN 0x20000000 /* DMA Finish Enable */
153#define EPPI_CTL_MUXSEL 0x40000000 /* MUX Select */
154#define EPPI_CTL_CLKGATEN 0x80000000 /* Clock Gating Enable */
155
156#define EPPI_FS2_WLVB_F2VBAD 0xFF000000 /* In GP transmit mode with BLANKGEN = 1, contains number of lines of vertical blanking after field 2 */
157#define EPPI_FS2_WLVB_F2VBBD 0x00FF0000 /* In GP transmit mode with BLANKGEN = 1, contains number of lines of vertical blanking before field 2 */
158#define EPPI_FS2_WLVB_F1VBAD 0x0000FF00 /* In GP transmit mode with, BLANKGEN = 1, contains number of lines of vertical blanking after field 1 */
159#define EPPI_FS2_WLVB_F1VBBD 0x000000FF /* In GP 2, or 3 FS modes used to generate PPIx_FS2 width (32-bit). In GP Transmit mode, with BLANKGEN=1, contains the number of lines of Vertical blanking before field 1. */
160
161#define EPPI_FS2_PALPF_F2ACT 0xFFFF0000 /* Number of lines of Active Data in Field 2 */
162#define EPPI_FS2_PALPF_F1ACT 0x0000FFFF /* Number of lines of Active Data in Field 1 */
163
164#define EPPI_IMSK_CFIFOERR 0x00000001 /* Mask CFIFO Underflow or Overflow Error Interrupt */
165#define EPPI_IMSK_YFIFOERR 0x00000002 /* Mask YFIFO Underflow or Overflow Error Interrupt */
166#define EPPI_IMSK_LTERROVR 0x00000004 /* Mask Line Track Overflow Error Interrupt */
167#define EPPI_IMSK_LTERRUNDR 0x00000008 /* Mask Line Track Underflow Error Interrupt */
168#define EPPI_IMSK_FTERROVR 0x00000010 /* Mask Frame Track Overflow Error Interrupt */
169#define EPPI_IMSK_FTERRUNDR 0x00000020 /* Mask Frame Track Underflow Error Interrupt */
170#define EPPI_IMSK_ERRNCOR 0x00000040 /* Mask ITU Preamble Error Not Corrected Interrupt */
171#define EPPI_IMSK_PXPERR 0x00000080 /* Mask PxP Ready Error Interrupt */
172
173#define EPPI_ODDCLIP_HIGHODD 0xFFFF0000
174#define EPPI_ODDCLIP_LOWODD 0x0000FFFF
175
176#define EPPI_EVENCLIP_HIGHEVEN 0xFFFF0000
177#define EPPI_EVENCLIP_LOWEVEN 0x0000FFFF
178
179#define EPPI_CTL2_FS1FINEN 0x00000002 /* HSYNC Finish Enable */
180#endif
53#endif 181#endif
diff --git a/arch/blackfin/include/asm/bfin_rotary.h b/arch/blackfin/include/asm/bfin_rotary.h
index 0b6910bdc57f..8895a750c70c 100644
--- a/arch/blackfin/include/asm/bfin_rotary.h
+++ b/arch/blackfin/include/asm/bfin_rotary.h
@@ -39,6 +39,7 @@ struct bfin_rotary_platform_data {
39 unsigned int rotary_rel_code; 39 unsigned int rotary_rel_code;
40 unsigned short debounce; /* 0..17 */ 40 unsigned short debounce; /* 0..17 */
41 unsigned short mode; 41 unsigned short mode;
42 unsigned short pm_wakeup;
42}; 43};
43 44
44/* CNT_CONFIG bitmasks */ 45/* CNT_CONFIG bitmasks */
diff --git a/arch/blackfin/include/asm/bfin_serial.h b/arch/blackfin/include/asm/bfin_serial.h
index 68bcc3d119b6..8597158010b5 100644
--- a/arch/blackfin/include/asm/bfin_serial.h
+++ b/arch/blackfin/include/asm/bfin_serial.h
@@ -18,7 +18,7 @@
18 defined(CONFIG_BFIN_UART1_CTSRTS) || \ 18 defined(CONFIG_BFIN_UART1_CTSRTS) || \
19 defined(CONFIG_BFIN_UART2_CTSRTS) || \ 19 defined(CONFIG_BFIN_UART2_CTSRTS) || \
20 defined(CONFIG_BFIN_UART3_CTSRTS) 20 defined(CONFIG_BFIN_UART3_CTSRTS)
21# ifdef BFIN_UART_BF54X_STYLE 21# if defined(BFIN_UART_BF54X_STYLE) || defined(BFIN_UART_BF60X_STYLE)
22# define CONFIG_SERIAL_BFIN_HARD_CTSRTS 22# define CONFIG_SERIAL_BFIN_HARD_CTSRTS
23# else 23# else
24# define CONFIG_SERIAL_BFIN_CTSRTS 24# define CONFIG_SERIAL_BFIN_CTSRTS
@@ -58,14 +58,69 @@ struct bfin_serial_port {
58#endif 58#endif
59}; 59};
60 60
61#ifdef BFIN_UART_BF60X_STYLE
62
63/* UART_CTL Masks */
64#define UCEN 0x1 /* Enable UARTx Clocks */
65#define LOOP_ENA 0x2 /* Loopback Mode Enable */
66#define UMOD_MDB 0x10 /* Enable MDB Mode */
67#define UMOD_IRDA 0x20 /* Enable IrDA Mode */
68#define UMOD_MASK 0x30 /* Uart Mode Mask */
69#define WLS(x) (((x-5) & 0x03) << 8) /* Word Length Select */
70#define WLS_MASK 0x300 /* Word length Select Mask */
71#define WLS_OFFSET 8 /* Word length Select Offset */
72#define STB 0x1000 /* Stop Bits */
73#define STBH 0x2000 /* Half Stop Bits */
74#define PEN 0x4000 /* Parity Enable */
75#define EPS 0x8000 /* Even Parity Select */
76#define STP 0x10000 /* Stick Parity */
77#define FPE 0x20000 /* Force Parity Error On Transmit */
78#define FFE 0x40000 /* Force Framing Error On Transmit */
79#define SB 0x80000 /* Set Break */
80#define LCR_MASK (SB | STP | EPS | PEN | STB | WLS_MASK)
81#define FCPOL 0x400000 /* Flow Control Pin Polarity */
82#define RPOLC 0x800000 /* IrDA RX Polarity Change */
83#define TPOLC 0x1000000 /* IrDA TX Polarity Change */
84#define MRTS 0x2000000 /* Manual Request To Send */
85#define XOFF 0x4000000 /* Transmitter Off */
86#define ARTS 0x8000000 /* Automatic Request To Send */
87#define ACTS 0x10000000 /* Automatic Clear To Send */
88#define RFIT 0x20000000 /* Receive FIFO IRQ Threshold */
89#define RFRT 0x40000000 /* Receive FIFO RTS Threshold */
90
91/* UART_STAT Masks */
92#define DR 0x01 /* Data Ready */
93#define OE 0x02 /* Overrun Error */
94#define PE 0x04 /* Parity Error */
95#define FE 0x08 /* Framing Error */
96#define BI 0x10 /* Break Interrupt */
97#define THRE 0x20 /* THR Empty */
98#define TEMT 0x80 /* TSR and UART_THR Empty */
99#define TFI 0x100 /* Transmission Finished Indicator */
100
101#define ASTKY 0x200 /* Address Sticky */
102#define ADDR 0x400 /* Address bit status */
103#define RO 0x800 /* Reception Ongoing */
104#define SCTS 0x1000 /* Sticky CTS */
105#define CTS 0x10000 /* Clear To Send */
106#define RFCS 0x20000 /* Receive FIFO Count Status */
107
108/* UART_CLOCK Masks */
109#define EDBO 0x80000000 /* Enable Devide by One */
110
111#else /* BFIN_UART_BF60X_STYLE */
112
61/* UART_LCR Masks */ 113/* UART_LCR Masks */
62#define WLS(x) (((x)-5) & 0x03) /* Word Length Select */ 114#define WLS(x) (((x)-5) & 0x03) /* Word Length Select */
115#define WLS_MASK 0x03 /* Word length Select Mask */
116#define WLS_OFFSET 0 /* Word length Select Offset */
63#define STB 0x04 /* Stop Bits */ 117#define STB 0x04 /* Stop Bits */
64#define PEN 0x08 /* Parity Enable */ 118#define PEN 0x08 /* Parity Enable */
65#define EPS 0x10 /* Even Parity Select */ 119#define EPS 0x10 /* Even Parity Select */
66#define STP 0x20 /* Stick Parity */ 120#define STP 0x20 /* Stick Parity */
67#define SB 0x40 /* Set Break */ 121#define SB 0x40 /* Set Break */
68#define DLAB 0x80 /* Divisor Latch Access */ 122#define DLAB 0x80 /* Divisor Latch Access */
123#define LCR_MASK (SB | STP | EPS | PEN | STB | WLS_MASK)
69 124
70/* UART_LSR Masks */ 125/* UART_LSR Masks */
71#define DR 0x01 /* Data Ready */ 126#define DR 0x01 /* Data Ready */
@@ -77,15 +132,6 @@ struct bfin_serial_port {
77#define TEMT 0x40 /* TSR and UART_THR Empty */ 132#define TEMT 0x40 /* TSR and UART_THR Empty */
78#define TFI 0x80 /* Transmission Finished Indicator */ 133#define TFI 0x80 /* Transmission Finished Indicator */
79 134
80/* UART_IER Masks */
81#define ERBFI 0x01 /* Enable Receive Buffer Full Interrupt */
82#define ETBEI 0x02 /* Enable Transmit Buffer Empty Interrupt */
83#define ELSI 0x04 /* Enable RX Status Interrupt */
84#define EDSSI 0x08 /* Enable Modem Status Interrupt */
85#define EDTPTI 0x10 /* Enable DMA Transmit PIRQ Interrupt */
86#define ETFI 0x20 /* Enable Transmission Finished Interrupt */
87#define ERFCI 0x40 /* Enable Receive FIFO Count Interrupt */
88
89/* UART_MCR Masks */ 135/* UART_MCR Masks */
90#define XOFF 0x01 /* Transmitter Off */ 136#define XOFF 0x01 /* Transmitter Off */
91#define MRTS 0x02 /* Manual Request To Send */ 137#define MRTS 0x02 /* Manual Request To Send */
@@ -103,13 +149,36 @@ struct bfin_serial_port {
103 149
104/* UART_GCTL Masks */ 150/* UART_GCTL Masks */
105#define UCEN 0x01 /* Enable UARTx Clocks */ 151#define UCEN 0x01 /* Enable UARTx Clocks */
106#define IREN 0x02 /* Enable IrDA Mode */ 152#define UMOD_IRDA 0x02 /* Enable IrDA Mode */
153#define UMOD_MASK 0x02 /* Uart Mode Mask */
107#define TPOLC 0x04 /* IrDA TX Polarity Change */ 154#define TPOLC 0x04 /* IrDA TX Polarity Change */
108#define RPOLC 0x08 /* IrDA RX Polarity Change */ 155#define RPOLC 0x08 /* IrDA RX Polarity Change */
109#define FPE 0x10 /* Force Parity Error On Transmit */ 156#define FPE 0x10 /* Force Parity Error On Transmit */
110#define FFE 0x20 /* Force Framing Error On Transmit */ 157#define FFE 0x20 /* Force Framing Error On Transmit */
111 158
112#ifdef BFIN_UART_BF54X_STYLE 159#endif /* BFIN_UART_BF60X_STYLE */
160
161/* UART_IER Masks */
162#define ERBFI 0x01 /* Enable Receive Buffer Full Interrupt */
163#define ETBEI 0x02 /* Enable Transmit Buffer Empty Interrupt */
164#define ELSI 0x04 /* Enable RX Status Interrupt */
165#define EDSSI 0x08 /* Enable Modem Status Interrupt */
166#define EDTPTI 0x10 /* Enable DMA Transmit PIRQ Interrupt */
167#define ETFI 0x20 /* Enable Transmission Finished Interrupt */
168#define ERFCI 0x40 /* Enable Receive FIFO Count Interrupt */
169
170#if defined(BFIN_UART_BF60X_STYLE)
171# define OFFSET_REDIV 0x00 /* Version ID Register */
172# define OFFSET_CTL 0x04 /* Control Register */
173# define OFFSET_STAT 0x08 /* Status Register */
174# define OFFSET_SCR 0x0C /* SCR Scratch Register */
175# define OFFSET_CLK 0x10 /* Clock Rate Register */
176# define OFFSET_IER 0x14 /* Interrupt Enable Register */
177# define OFFSET_IER_SET 0x18 /* Set Interrupt Enable Register */
178# define OFFSET_IER_CLEAR 0x1C /* Clear Interrupt Enable Register */
179# define OFFSET_RBR 0x20 /* Receive Buffer register */
180# define OFFSET_THR 0x24 /* Transmit Holding register */
181#elif defined(BFIN_UART_BF54X_STYLE)
113# define OFFSET_DLL 0x00 /* Divisor Latch (Low-Byte) */ 182# define OFFSET_DLL 0x00 /* Divisor Latch (Low-Byte) */
114# define OFFSET_DLH 0x04 /* Divisor Latch (High-Byte) */ 183# define OFFSET_DLH 0x04 /* Divisor Latch (High-Byte) */
115# define OFFSET_GCTL 0x08 /* Global Control Register */ 184# define OFFSET_GCTL 0x08 /* Global Control Register */
@@ -145,7 +214,23 @@ struct bfin_serial_port {
145 */ 214 */
146#define __BFP(m) u16 m; u16 __pad_##m 215#define __BFP(m) u16 m; u16 __pad_##m
147struct bfin_uart_regs { 216struct bfin_uart_regs {
148#ifdef BFIN_UART_BF54X_STYLE 217#if defined(BFIN_UART_BF60X_STYLE)
218 u32 revid;
219 u32 ctl;
220 u32 stat;
221 u32 scr;
222 u32 clk;
223 u32 ier;
224 u32 ier_set;
225 u32 ier_clear;
226 u32 rbr;
227 u32 thr;
228 u32 taip;
229 u32 tsr;
230 u32 rsr;
231 u32 txdiv;
232 u32 rxdiv;
233#elif defined(BFIN_UART_BF54X_STYLE)
149 __BFP(dll); 234 __BFP(dll);
150 __BFP(dlh); 235 __BFP(dlh);
151 __BFP(gctl); 236 __BFP(gctl);
@@ -182,13 +267,70 @@ struct bfin_uart_regs {
182}; 267};
183#undef __BFP 268#undef __BFP
184 269
270#define port_membase(uart) (((struct bfin_serial_port *)(uart))->port.membase)
271
272/*
185#ifndef port_membase 273#ifndef port_membase
186# define port_membase(p) 0 274# define port_membase(p) 0
187#endif 275#endif
276*/
277#ifdef BFIN_UART_BF60X_STYLE
278
279#define UART_GET_CHAR(p) bfin_read32(port_membase(p) + OFFSET_RBR)
280#define UART_GET_CLK(p) bfin_read32(port_membase(p) + OFFSET_CLK)
281#define UART_GET_CTL(p) bfin_read32(port_membase(p) + OFFSET_CTL)
282#define UART_GET_GCTL(p) UART_GET_CTL(p)
283#define UART_GET_LCR(p) UART_GET_CTL(p)
284#define UART_GET_MCR(p) UART_GET_CTL(p)
285#if ANOMALY_05001001
286#define UART_GET_STAT(p) \
287({ \
288 u32 __ret; \
289 unsigned long flags; \
290 flags = hard_local_irq_save(); \
291 __ret = bfin_read32(port_membase(p) + OFFSET_STAT); \
292 hard_local_irq_restore(flags); \
293 __ret; \
294})
295#else
296#define UART_GET_STAT(p) bfin_read32(port_membase(p) + OFFSET_STAT)
297#endif
298#define UART_GET_MSR(p) UART_GET_STAT(p)
299
300#define UART_PUT_CHAR(p, v) bfin_write32(port_membase(p) + OFFSET_THR, v)
301#define UART_PUT_CLK(p, v) bfin_write32(port_membase(p) + OFFSET_CLK, v)
302#define UART_PUT_CTL(p, v) bfin_write32(port_membase(p) + OFFSET_CTL, v)
303#define UART_PUT_GCTL(p, v) UART_PUT_CTL(p, v)
304#define UART_PUT_LCR(p, v) UART_PUT_CTL(p, v)
305#define UART_PUT_MCR(p, v) UART_PUT_CTL(p, v)
306#define UART_PUT_STAT(p, v) bfin_write32(port_membase(p) + OFFSET_STAT, v)
307
308#define UART_CLEAR_IER(p, v) bfin_write32(port_membase(p) + OFFSET_IER_CLEAR, v)
309#define UART_GET_IER(p) bfin_read32(port_membase(p) + OFFSET_IER)
310#define UART_SET_IER(p, v) bfin_write32(port_membase(p) + OFFSET_IER_SET, v)
311
312#define UART_CLEAR_DLAB(p) /* MMRs not muxed on BF60x */
313#define UART_SET_DLAB(p) /* MMRs not muxed on BF60x */
314
315#define UART_CLEAR_LSR(p) UART_PUT_STAT(p, -1)
316#define UART_GET_LSR(p) UART_GET_STAT(p)
317#define UART_PUT_LSR(p, v) UART_PUT_STAT(p, v)
318
319/* This handles hard CTS/RTS */
320#define BFIN_UART_CTSRTS_HARD
321#define UART_CLEAR_SCTS(p) UART_PUT_STAT(p, SCTS)
322#define UART_GET_CTS(x) (UART_GET_MSR(x) & CTS)
323#define UART_DISABLE_RTS(x) UART_PUT_MCR(x, UART_GET_MCR(x) & ~(ARTS | MRTS))
324#define UART_ENABLE_RTS(x) UART_PUT_MCR(x, UART_GET_MCR(x) | MRTS | ARTS)
325#define UART_ENABLE_INTS(x, v) UART_SET_IER(x, v)
326#define UART_DISABLE_INTS(x) UART_CLEAR_IER(x, 0xF)
327
328#else /* BFIN_UART_BF60X_STYLE */
188 329
189#define UART_GET_CHAR(p) bfin_read16(port_membase(p) + OFFSET_RBR) 330#define UART_GET_CHAR(p) bfin_read16(port_membase(p) + OFFSET_RBR)
190#define UART_GET_DLL(p) bfin_read16(port_membase(p) + OFFSET_DLL) 331#define UART_GET_DLL(p) bfin_read16(port_membase(p) + OFFSET_DLL)
191#define UART_GET_DLH(p) bfin_read16(port_membase(p) + OFFSET_DLH) 332#define UART_GET_DLH(p) bfin_read16(port_membase(p) + OFFSET_DLH)
333#define UART_GET_CLK(p) ((UART_GET_DLH(p) << 8) | UART_GET_DLL(p))
192#define UART_GET_GCTL(p) bfin_read16(port_membase(p) + OFFSET_GCTL) 334#define UART_GET_GCTL(p) bfin_read16(port_membase(p) + OFFSET_GCTL)
193#define UART_GET_LCR(p) bfin_read16(port_membase(p) + OFFSET_LCR) 335#define UART_GET_LCR(p) bfin_read16(port_membase(p) + OFFSET_LCR)
194#define UART_GET_MCR(p) bfin_read16(port_membase(p) + OFFSET_MCR) 336#define UART_GET_MCR(p) bfin_read16(port_membase(p) + OFFSET_MCR)
@@ -197,6 +339,11 @@ struct bfin_uart_regs {
197#define UART_PUT_CHAR(p, v) bfin_write16(port_membase(p) + OFFSET_THR, v) 339#define UART_PUT_CHAR(p, v) bfin_write16(port_membase(p) + OFFSET_THR, v)
198#define UART_PUT_DLL(p, v) bfin_write16(port_membase(p) + OFFSET_DLL, v) 340#define UART_PUT_DLL(p, v) bfin_write16(port_membase(p) + OFFSET_DLL, v)
199#define UART_PUT_DLH(p, v) bfin_write16(port_membase(p) + OFFSET_DLH, v) 341#define UART_PUT_DLH(p, v) bfin_write16(port_membase(p) + OFFSET_DLH, v)
342#define UART_PUT_CLK(p, v) do \
343{\
344UART_PUT_DLL(p, v & 0xFF); \
345UART_PUT_DLH(p, (v >> 8) & 0xFF); } while (0);
346
200#define UART_PUT_GCTL(p, v) bfin_write16(port_membase(p) + OFFSET_GCTL, v) 347#define UART_PUT_GCTL(p, v) bfin_write16(port_membase(p) + OFFSET_GCTL, v)
201#define UART_PUT_LCR(p, v) bfin_write16(port_membase(p) + OFFSET_LCR, v) 348#define UART_PUT_LCR(p, v) bfin_write16(port_membase(p) + OFFSET_LCR, v)
202#define UART_PUT_MCR(p, v) bfin_write16(port_membase(p) + OFFSET_MCR, v) 349#define UART_PUT_MCR(p, v) bfin_write16(port_membase(p) + OFFSET_MCR, v)
@@ -233,12 +380,17 @@ struct bfin_uart_regs {
233#define UART_CLEAR_DLAB(p) do { UART_PUT_LCR(p, UART_GET_LCR(p) & ~DLAB); SSYNC(); } while (0) 380#define UART_CLEAR_DLAB(p) do { UART_PUT_LCR(p, UART_GET_LCR(p) & ~DLAB); SSYNC(); } while (0)
234#define UART_SET_DLAB(p) do { UART_PUT_LCR(p, UART_GET_LCR(p) | DLAB); SSYNC(); } while (0) 381#define UART_SET_DLAB(p) do { UART_PUT_LCR(p, UART_GET_LCR(p) | DLAB); SSYNC(); } while (0)
235 382
383#define get_lsr_cache(uart) (((struct bfin_serial_port *)(uart))->lsr)
384#define put_lsr_cache(uart, v) (((struct bfin_serial_port *)(uart))->lsr = (v))
385
386/*
236#ifndef put_lsr_cache 387#ifndef put_lsr_cache
237# define put_lsr_cache(p, v) 388# define put_lsr_cache(p, v)
238#endif 389#endif
239#ifndef get_lsr_cache 390#ifndef get_lsr_cache
240# define get_lsr_cache(p) 0 391# define get_lsr_cache(p) 0
241#endif 392#endif
393*/
242 394
243/* The hardware clears the LSR bits upon read, so we need to cache 395/* The hardware clears the LSR bits upon read, so we need to cache
244 * some of the more fun bits in software so they don't get lost 396 * some of the more fun bits in software so they don't get lost
@@ -267,7 +419,9 @@ static inline void UART_PUT_LSR(void *p, uint16_t val)
267#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v) 419#define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v)
268#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0) 420#define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0)
269 421
270#endif 422#endif /* BFIN_UART_BF54X_STYLE */
423
424#endif /* BFIN_UART_BF60X_STYLE */
271 425
272#ifndef BFIN_UART_TX_FIFO_SIZE 426#ifndef BFIN_UART_TX_FIFO_SIZE
273# define BFIN_UART_TX_FIFO_SIZE 2 427# define BFIN_UART_TX_FIFO_SIZE 2
diff --git a/arch/blackfin/include/asm/bfin_sport.h b/arch/blackfin/include/asm/bfin_sport.h
index 0afcfbd54a82..f8907ea6b5b6 100644
--- a/arch/blackfin/include/asm/bfin_sport.h
+++ b/arch/blackfin/include/asm/bfin_sport.h
@@ -24,6 +24,7 @@
24struct sport_config { 24struct sport_config {
25 /* TDM (multichannels), I2S or other mode */ 25 /* TDM (multichannels), I2S or other mode */
26 unsigned int mode:3; 26 unsigned int mode:3;
27 unsigned int polled; /* use poll instead of irq when set */
27 28
28 /* if TDM mode is selected, channels must be set */ 29 /* if TDM mode is selected, channels must be set */
29 int channels; /* Must be in 8 units */ 30 int channels; /* Must be in 8 units */
diff --git a/arch/blackfin/include/asm/bfin_sport3.h b/arch/blackfin/include/asm/bfin_sport3.h
new file mode 100644
index 000000000000..03c00220d69b
--- /dev/null
+++ b/arch/blackfin/include/asm/bfin_sport3.h
@@ -0,0 +1,107 @@
1/*
2 * bfin_sport - Analog Devices BF6XX SPORT registers
3 *
4 * Copyright (c) 2012 Analog Devices Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20#ifndef _BFIN_SPORT3_H_
21#define _BFIN_SPORT3_H_
22
23#include <linux/types.h>
24
25#define SPORT_CTL_SPENPRI 0x00000001 /* Enable Primary Channel */
26#define SPORT_CTL_DTYPE 0x00000006 /* Data type select */
27#define SPORT_CTL_RJUSTIFY_ZFILL 0x00000000 /* DTYPE: MCM mode: Right-justify, zero-fill unused MSBs */
28#define SPORT_CTL_RJUSTIFY_SFILL 0x00000002 /* DTYPE: MCM mode: Right-justify, sign-extend unused MSBs */
29#define SPORT_CTL_USE_U_LAW 0x00000004 /* DTYPE: MCM mode: Compand using u-law */
30#define SPORT_CTL_USE_A_LAW 0x00000006 /* DTYPE: MCM mode: Compand using A-law */
31#define SPORT_CTL_LSBF 0x00000008 /* Serial bit endian select */
32#define SPORT_CTL_SLEN 0x000001F0 /* Serial Word length select */
33#define SPORT_CTL_PACK 0x00000200 /* 16-bit to 32-bit packing enable */
34#define SPORT_CTL_ICLK 0x00000400 /* Internal Clock Select */
35#define SPORT_CTL_OPMODE 0x00000800 /* Operation mode */
36#define SPORT_CTL_CKRE 0x00001000 /* Clock rising edge select */
37#define SPORT_CTL_FSR 0x00002000 /* Frame Sync required */
38#define SPORT_CTL_IFS 0x00004000 /* Internal Frame Sync select */
39#define SPORT_CTL_DIFS 0x00008000 /* Data-independent frame sync select */
40#define SPORT_CTL_LFS 0x00010000 /* Active low frame sync select */
41#define SPORT_CTL_LAFS 0x00020000 /* Late Transmit frame select */
42#define SPORT_CTL_RJUST 0x00040000 /* Right Justified mode select */
43#define SPORT_CTL_FSED 0x00080000 /* External frame sync edge select */
44#define SPORT_CTL_TFIEN 0x00100000 /* Transmit finish interrrupt enable select */
45#define SPORT_CTL_GCLKEN 0x00200000 /* Gated clock mode select */
46#define SPORT_CTL_SPENSEC 0x01000000 /* Enable secondary channel */
47#define SPORT_CTL_SPTRAN 0x02000000 /* Data direction control */
48#define SPORT_CTL_DERRSEC 0x04000000 /* Secondary channel error status */
49#define SPORT_CTL_DXSSEC 0x18000000 /* Secondary channel data buffer status */
50#define SPORT_CTL_SEC_EMPTY 0x00000000 /* DXSSEC: Empty */
51#define SPORT_CTL_SEC_PART_FULL 0x10000000 /* DXSSEC: Partially full */
52#define SPORT_CTL_SEC_FULL 0x18000000 /* DXSSEC: Full */
53#define SPORT_CTL_DERRPRI 0x20000000 /* Primary channel error status */
54#define SPORT_CTL_DXSPRI 0xC0000000 /* Primary channel data buffer status */
55#define SPORT_CTL_PRM_EMPTY 0x00000000 /* DXSPRI: Empty */
56#define SPORT_CTL_PRM_PART_FULL 0x80000000 /* DXSPRI: Partially full */
57#define SPORT_CTL_PRM_FULL 0xC0000000 /* DXSPRI: Full */
58
59#define SPORT_DIV_CLKDIV 0x0000FFFF /* Clock divisor */
60#define SPORT_DIV_FSDIV 0xFFFF0000 /* Frame sync divisor */
61
62#define SPORT_MCTL_MCE 0x00000001 /* Multichannel enable */
63#define SPORT_MCTL_MCPDE 0x00000004 /* Multichannel data packing select */
64#define SPORT_MCTL_MFD 0x000000F0 /* Multichannel frame delay */
65#define SPORT_MCTL_WSIZE 0x00007F00 /* Number of multichannel slots */
66#define SPORT_MCTL_WOFFSET 0x03FF0000 /* Window offset size */
67
68#define SPORT_CNT_CLKCNT 0x0000FFFF /* Current state of clk div counter */
69#define SPORT_CNT_FSDIVCNT 0xFFFF0000 /* Current state of frame div counter */
70
71#define SPORT_ERR_DERRPMSK 0x00000001 /* Primary channel data error interrupt enable */
72#define SPORT_ERR_DERRSMSK 0x00000002 /* Secondary channel data error interrupt enable */
73#define SPORT_ERR_FSERRMSK 0x00000004 /* Frame sync error interrupt enable */
74#define SPORT_ERR_DERRPSTAT 0x00000010 /* Primary channel data error status */
75#define SPORT_ERR_DERRSSTAT 0x00000020 /* Secondary channel data error status */
76#define SPORT_ERR_FSERRSTAT 0x00000040 /* Frame sync error status */
77
78#define SPORT_MSTAT_CURCHAN 0x000003FF /* Channel which is being serviced in the multichannel operation */
79
80#define SPORT_CTL2_FSMUXSEL 0x00000001 /* Frame Sync MUX Select */
81#define SPORT_CTL2_CKMUXSEL 0x00000002 /* Clock MUX Select */
82#define SPORT_CTL2_LBSEL 0x00000004 /* Loopback Select */
83
84struct sport_register {
85 u32 spctl;
86 u32 div;
87 u32 spmctl;
88 u32 spcs0;
89 u32 spcs1;
90 u32 spcs2;
91 u32 spcs3;
92 u32 spcnt;
93 u32 sperrctl;
94 u32 spmstat;
95 u32 spctl2;
96 u32 txa;
97 u32 rxa;
98 u32 txb;
99 u32 rxb;
100 u32 revid;
101};
102
103struct bfin_snd_platform_data {
104 const unsigned short *pin_req;
105};
106
107#endif
diff --git a/arch/blackfin/include/asm/bfin_twi.h b/arch/blackfin/include/asm/bfin_twi.h
index e767d649dfc4..2f3339a47626 100644
--- a/arch/blackfin/include/asm/bfin_twi.h
+++ b/arch/blackfin/include/asm/bfin_twi.h
@@ -10,6 +10,7 @@
10#define __ASM_BFIN_TWI_H__ 10#define __ASM_BFIN_TWI_H__
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/i2c.h>
13 14
14/* 15/*
15 * All Blackfin system MMRs are padded to 32bits even if the register 16 * All Blackfin system MMRs are padded to 32bits even if the register
@@ -42,4 +43,145 @@ struct bfin_twi_regs {
42 43
43#undef __BFP 44#undef __BFP
44 45
46struct bfin_twi_iface {
47 int irq;
48 spinlock_t lock;
49 char read_write;
50 u8 command;
51 u8 *transPtr;
52 int readNum;
53 int writeNum;
54 int cur_mode;
55 int manual_stop;
56 int result;
57 struct i2c_adapter adap;
58 struct completion complete;
59 struct i2c_msg *pmsg;
60 int msg_num;
61 int cur_msg;
62 u16 saved_clkdiv;
63 u16 saved_control;
64 struct bfin_twi_regs *regs_base;
65};
66
67#define DEFINE_TWI_REG(reg_name, reg) \
68static inline u16 read_##reg_name(struct bfin_twi_iface *iface) \
69 { return iface->regs_base->reg; } \
70static inline void write_##reg_name(struct bfin_twi_iface *iface, u16 v) \
71 { iface->regs_base->reg = v; }
72
73DEFINE_TWI_REG(CLKDIV, clkdiv)
74DEFINE_TWI_REG(CONTROL, control)
75DEFINE_TWI_REG(SLAVE_CTL, slave_ctl)
76DEFINE_TWI_REG(SLAVE_STAT, slave_stat)
77DEFINE_TWI_REG(SLAVE_ADDR, slave_addr)
78DEFINE_TWI_REG(MASTER_CTL, master_ctl)
79DEFINE_TWI_REG(MASTER_STAT, master_stat)
80DEFINE_TWI_REG(MASTER_ADDR, master_addr)
81DEFINE_TWI_REG(INT_STAT, int_stat)
82DEFINE_TWI_REG(INT_MASK, int_mask)
83DEFINE_TWI_REG(FIFO_CTL, fifo_ctl)
84DEFINE_TWI_REG(FIFO_STAT, fifo_stat)
85DEFINE_TWI_REG(XMT_DATA8, xmt_data8)
86DEFINE_TWI_REG(XMT_DATA16, xmt_data16)
87#if !ANOMALY_05001001
88DEFINE_TWI_REG(RCV_DATA8, rcv_data8)
89DEFINE_TWI_REG(RCV_DATA16, rcv_data16)
90#else
91static inline u16 read_RCV_DATA8(struct bfin_twi_iface *iface)
92{
93 u16 ret;
94 unsigned long flags;
95
96 flags = hard_local_irq_save();
97 ret = iface->regs_base->rcv_data8;
98 hard_local_irq_restore(flags);
99
100 return ret;
101}
102
103static inline u16 read_RCV_DATA16(struct bfin_twi_iface *iface)
104{
105 u16 ret;
106 unsigned long flags;
107
108 flags = hard_local_irq_save();
109 ret = iface->regs_base->rcv_data16;
110 hard_local_irq_restore(flags);
111
112 return ret;
113}
114#endif
115
116
117/* ******************** TWO-WIRE INTERFACE (TWI) MASKS ***********************/
118/* TWI_CLKDIV Macros (Use: *pTWI_CLKDIV = CLKLOW(x)|CLKHI(y); ) */
119#define CLKLOW(x) ((x) & 0xFF) /* Periods Clock Is Held Low */
120#define CLKHI(y) (((y)&0xFF)<<0x8) /* Periods Before New Clock Low */
121
122/* TWI_PRESCALE Masks */
123#define PRESCALE 0x007F /* SCLKs Per Internal Time Reference (10MHz) */
124#define TWI_ENA 0x0080 /* TWI Enable */
125#define SCCB 0x0200 /* SCCB Compatibility Enable */
126
127/* TWI_SLAVE_CTL Masks */
128#define SEN 0x0001 /* Slave Enable */
129#define SADD_LEN 0x0002 /* Slave Address Length */
130#define STDVAL 0x0004 /* Slave Transmit Data Valid */
131#define NAK 0x0008 /* NAK/ACK* Generated At Conclusion Of Transfer */
132#define GEN 0x0010 /* General Call Address Matching Enabled */
133
134/* TWI_SLAVE_STAT Masks */
135#define SDIR 0x0001 /* Slave Transfer Direction (Transmit/Receive*) */
136#define GCALL 0x0002 /* General Call Indicator */
137
138/* TWI_MASTER_CTL Masks */
139#define MEN 0x0001 /* Master Mode Enable */
140#define MADD_LEN 0x0002 /* Master Address Length */
141#define MDIR 0x0004 /* Master Transmit Direction (RX/TX*) */
142#define FAST 0x0008 /* Use Fast Mode Timing Specs */
143#define STOP 0x0010 /* Issue Stop Condition */
144#define RSTART 0x0020 /* Repeat Start or Stop* At End Of Transfer */
145#define DCNT 0x3FC0 /* Data Bytes To Transfer */
146#define SDAOVR 0x4000 /* Serial Data Override */
147#define SCLOVR 0x8000 /* Serial Clock Override */
148
149/* TWI_MASTER_STAT Masks */
150#define MPROG 0x0001 /* Master Transfer In Progress */
151#define LOSTARB 0x0002 /* Lost Arbitration Indicator (Xfer Aborted) */
152#define ANAK 0x0004 /* Address Not Acknowledged */
153#define DNAK 0x0008 /* Data Not Acknowledged */
154#define BUFRDERR 0x0010 /* Buffer Read Error */
155#define BUFWRERR 0x0020 /* Buffer Write Error */
156#define SDASEN 0x0040 /* Serial Data Sense */
157#define SCLSEN 0x0080 /* Serial Clock Sense */
158#define BUSBUSY 0x0100 /* Bus Busy Indicator */
159
160/* TWI_INT_SRC and TWI_INT_ENABLE Masks */
161#define SINIT 0x0001 /* Slave Transfer Initiated */
162#define SCOMP 0x0002 /* Slave Transfer Complete */
163#define SERR 0x0004 /* Slave Transfer Error */
164#define SOVF 0x0008 /* Slave Overflow */
165#define MCOMP 0x0010 /* Master Transfer Complete */
166#define MERR 0x0020 /* Master Transfer Error */
167#define XMTSERV 0x0040 /* Transmit FIFO Service */
168#define RCVSERV 0x0080 /* Receive FIFO Service */
169
170/* TWI_FIFO_CTRL Masks */
171#define XMTFLUSH 0x0001 /* Transmit Buffer Flush */
172#define RCVFLUSH 0x0002 /* Receive Buffer Flush */
173#define XMTINTLEN 0x0004 /* Transmit Buffer Interrupt Length */
174#define RCVINTLEN 0x0008 /* Receive Buffer Interrupt Length */
175
176/* TWI_FIFO_STAT Masks */
177#define XMTSTAT 0x0003 /* Transmit FIFO Status */
178#define XMT_EMPTY 0x0000 /* Transmit FIFO Empty */
179#define XMT_HALF 0x0001 /* Transmit FIFO Has 1 Byte To Write */
180#define XMT_FULL 0x0003 /* Transmit FIFO Full (2 Bytes To Write) */
181
182#define RCVSTAT 0x000C /* Receive FIFO Status */
183#define RCV_EMPTY 0x0000 /* Receive FIFO Empty */
184#define RCV_HALF 0x0004 /* Receive FIFO Has 1 Byte To Read */
185#define RCV_FULL 0x000C /* Receive FIFO Full (2 Bytes To Read) */
186
45#endif 187#endif
diff --git a/arch/blackfin/include/asm/blackfin.h b/arch/blackfin/include/asm/blackfin.h
index 7be5368c0512..f111f366d758 100644
--- a/arch/blackfin/include/asm/blackfin.h
+++ b/arch/blackfin/include/asm/blackfin.h
@@ -63,20 +63,16 @@ static inline void CSYNC(void)
63 63
64#if ANOMALY_05000312 || ANOMALY_05000244 64#if ANOMALY_05000312 || ANOMALY_05000244
65#define SSYNC(scratch) \ 65#define SSYNC(scratch) \
66do { \
67 cli scratch; \ 66 cli scratch; \
68 nop; nop; nop; \ 67 nop; nop; nop; \
69 SSYNC; \ 68 SSYNC; \
70 sti scratch; \ 69 sti scratch;
71} while (0)
72 70
73#define CSYNC(scratch) \ 71#define CSYNC(scratch) \
74do { \
75 cli scratch; \ 72 cli scratch; \
76 nop; nop; nop; \ 73 nop; nop; nop; \
77 CSYNC; \ 74 CSYNC; \
78 sti scratch; \ 75 sti scratch;
79} while (0)
80 76
81#else 77#else
82#define SSYNC(scratch) SSYNC; 78#define SSYNC(scratch) SSYNC;
diff --git a/arch/blackfin/include/asm/clkdev.h b/arch/blackfin/include/asm/clkdev.h
new file mode 100644
index 000000000000..9053beda8c50
--- /dev/null
+++ b/arch/blackfin/include/asm/clkdev.h
@@ -0,0 +1,14 @@
1#ifndef __ASM_CLKDEV__H_
2#define __ASM_CLKDEV__H_
3
4#include <linux/slab.h>
5
6static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
7{
8 return kzalloc(size, GFP_KERNEL);
9}
10
11#define __clk_put(clk)
12#define __clk_get(clk) ({ 1; })
13
14#endif
diff --git a/arch/blackfin/include/asm/clocks.h b/arch/blackfin/include/asm/clocks.h
index 6f0b61852f58..9b3c85b3c288 100644
--- a/arch/blackfin/include/asm/clocks.h
+++ b/arch/blackfin/include/asm/clocks.h
@@ -48,4 +48,27 @@
48# define CONFIG_VCO_MULT 0 48# define CONFIG_VCO_MULT 0
49#endif 49#endif
50 50
51#include <linux/clk.h>
52
53struct clk_ops {
54 unsigned long (*get_rate)(struct clk *clk);
55 unsigned long (*round_rate)(struct clk *clk, unsigned long rate);
56 int (*set_rate)(struct clk *clk, unsigned long rate);
57 int (*enable)(struct clk *clk);
58 int (*disable)(struct clk *clk);
59};
60
61struct clk {
62 struct clk *parent;
63 const char *name;
64 unsigned long rate;
65 spinlock_t lock;
66 u32 flags;
67 const struct clk_ops *ops;
68 void __iomem *reg;
69 u32 mask;
70 u32 shift;
71};
72
73int clk_init(void);
51#endif 74#endif
diff --git a/arch/blackfin/include/asm/cplb.h b/arch/blackfin/include/asm/cplb.h
index fda96261ed62..5c37f620c4b3 100644
--- a/arch/blackfin/include/asm/cplb.h
+++ b/arch/blackfin/include/asm/cplb.h
@@ -62,6 +62,10 @@
62#define SIZE_4K 0x00001000 /* 4K */ 62#define SIZE_4K 0x00001000 /* 4K */
63#define SIZE_1M 0x00100000 /* 1M */ 63#define SIZE_1M 0x00100000 /* 1M */
64#define SIZE_4M 0x00400000 /* 4M */ 64#define SIZE_4M 0x00400000 /* 4M */
65#define SIZE_16K 0x00004000 /* 16K */
66#define SIZE_64K 0x00010000 /* 64K */
67#define SIZE_16M 0x01000000 /* 16M */
68#define SIZE_64M 0x04000000 /* 64M */
65 69
66#define MAX_CPLBS 16 70#define MAX_CPLBS 16
67 71
diff --git a/arch/blackfin/include/asm/def_LPBlackfin.h b/arch/blackfin/include/asm/def_LPBlackfin.h
index 823679011457..fe0ca03a1cb2 100644
--- a/arch/blackfin/include/asm/def_LPBlackfin.h
+++ b/arch/blackfin/include/asm/def_LPBlackfin.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright 2005-2008 Analog Devices Inc. 4 * Copyright 2005-2008 Analog Devices Inc.
5 * 5 *
6 * Licensed under the ADI BSD license or GPL-2 (or later). 6 * Licensed under the Clear BSD license or GPL-2 (or later).
7 */ 7 */
8 8
9#ifndef _DEF_LPBLACKFIN_H 9#ifndef _DEF_LPBLACKFIN_H
@@ -622,6 +622,10 @@ do { \
622#define PAGE_SIZE_4KB 0x00010000 /* 4 KB page size */ 622#define PAGE_SIZE_4KB 0x00010000 /* 4 KB page size */
623#define PAGE_SIZE_1MB 0x00020000 /* 1 MB page size */ 623#define PAGE_SIZE_1MB 0x00020000 /* 1 MB page size */
624#define PAGE_SIZE_4MB 0x00030000 /* 4 MB page size */ 624#define PAGE_SIZE_4MB 0x00030000 /* 4 MB page size */
625#define PAGE_SIZE_16KB 0x00040000 /* 16 KB page size */
626#define PAGE_SIZE_64KB 0x00050000 /* 64 KB page size */
627#define PAGE_SIZE_16MB 0x00060000 /* 16 MB page size */
628#define PAGE_SIZE_64MB 0x00070000 /* 64 MB page size */
625#define CPLB_L1SRAM 0x00000020 /* 0=SRAM mapped in L1, 0=SRAM not 629#define CPLB_L1SRAM 0x00000020 /* 0=SRAM mapped in L1, 0=SRAM not
626 * mapped to L1 630 * mapped to L1
627 */ 631 */
diff --git a/arch/blackfin/include/asm/dma.h b/arch/blackfin/include/asm/dma.h
index dac0c97242bb..40e9c2bbc6e3 100644
--- a/arch/blackfin/include/asm/dma.h
+++ b/arch/blackfin/include/asm/dma.h
@@ -22,12 +22,22 @@
22#define DATA_SIZE_8 0 22#define DATA_SIZE_8 0
23#define DATA_SIZE_16 1 23#define DATA_SIZE_16 1
24#define DATA_SIZE_32 2 24#define DATA_SIZE_32 2
25#ifdef CONFIG_BF60x
26#define DATA_SIZE_64 3
27#endif
25 28
26#define DMA_FLOW_STOP 0 29#define DMA_FLOW_STOP 0
27#define DMA_FLOW_AUTO 1 30#define DMA_FLOW_AUTO 1
31#ifdef CONFIG_BF60x
32#define DMA_FLOW_LIST 4
33#define DMA_FLOW_ARRAY 5
34#define DMA_FLOW_LIST_DEMAND 6
35#define DMA_FLOW_ARRAY_DEMAND 7
36#else
28#define DMA_FLOW_ARRAY 4 37#define DMA_FLOW_ARRAY 4
29#define DMA_FLOW_SMALL 6 38#define DMA_FLOW_SMALL 6
30#define DMA_FLOW_LARGE 7 39#define DMA_FLOW_LARGE 7
40#endif
31 41
32#define DIMENSION_LINEAR 0 42#define DIMENSION_LINEAR 0
33#define DIMENSION_2D 1 43#define DIMENSION_2D 1
@@ -36,26 +46,80 @@
36#define DIR_WRITE 1 46#define DIR_WRITE 1
37 47
38#define INTR_DISABLE 0 48#define INTR_DISABLE 0
49#ifdef CONFIG_BF60x
50#define INTR_ON_PERI 1
51#endif
39#define INTR_ON_BUF 2 52#define INTR_ON_BUF 2
40#define INTR_ON_ROW 3 53#define INTR_ON_ROW 3
41 54
42#define DMA_NOSYNC_KEEP_DMA_BUF 0 55#define DMA_NOSYNC_KEEP_DMA_BUF 0
43#define DMA_SYNC_RESTART 1 56#define DMA_SYNC_RESTART 1
44 57
58#ifdef DMA_MMR_SIZE_32
59#define DMA_MMR_SIZE_TYPE long
60#define DMA_MMR_READ bfin_read32
61#define DMA_MMR_WRITE bfin_write32
62#else
63#define DMA_MMR_SIZE_TYPE short
64#define DMA_MMR_READ bfin_read16
65#define DMA_MMR_WRITE bfin_write16
66#endif
67
68struct dma_desc_array {
69 unsigned long start_addr;
70 unsigned DMA_MMR_SIZE_TYPE cfg;
71 unsigned DMA_MMR_SIZE_TYPE x_count;
72 DMA_MMR_SIZE_TYPE x_modify;
73} __attribute__((packed));
74
45struct dmasg { 75struct dmasg {
46 void *next_desc_addr; 76 void *next_desc_addr;
47 unsigned long start_addr; 77 unsigned long start_addr;
48 unsigned short cfg; 78 unsigned DMA_MMR_SIZE_TYPE cfg;
49 unsigned short x_count; 79 unsigned DMA_MMR_SIZE_TYPE x_count;
50 short x_modify; 80 DMA_MMR_SIZE_TYPE x_modify;
51 unsigned short y_count; 81 unsigned DMA_MMR_SIZE_TYPE y_count;
52 short y_modify; 82 DMA_MMR_SIZE_TYPE y_modify;
53} __attribute__((packed)); 83} __attribute__((packed));
54 84
55struct dma_register { 85struct dma_register {
56 void *next_desc_ptr; /* DMA Next Descriptor Pointer register */ 86 void *next_desc_ptr; /* DMA Next Descriptor Pointer register */
57 unsigned long start_addr; /* DMA Start address register */ 87 unsigned long start_addr; /* DMA Start address register */
88#ifdef CONFIG_BF60x
89 unsigned long cfg; /* DMA Configuration register */
58 90
91 unsigned long x_count; /* DMA x_count register */
92
93 long x_modify; /* DMA x_modify register */
94
95 unsigned long y_count; /* DMA y_count register */
96
97 long y_modify; /* DMA y_modify register */
98
99 unsigned long reserved;
100 unsigned long reserved2;
101
102 void *curr_desc_ptr; /* DMA Current Descriptor Pointer
103 register */
104 void *prev_desc_ptr; /* DMA previous initial Descriptor Pointer
105 register */
106 unsigned long curr_addr_ptr; /* DMA Current Address Pointer
107 register */
108 unsigned long irq_status; /* DMA irq status register */
109
110 unsigned long curr_x_count; /* DMA Current x-count register */
111
112 unsigned long curr_y_count; /* DMA Current y-count register */
113
114 unsigned long reserved3;
115
116 unsigned long bw_limit_count; /* DMA band width limit count register */
117 unsigned long curr_bw_limit_count; /* DMA Current band width limit
118 count register */
119 unsigned long bw_monitor_count; /* DMA band width limit count register */
120 unsigned long curr_bw_monitor_count; /* DMA Current band width limit
121 count register */
122#else
59 unsigned short cfg; /* DMA Configuration register */ 123 unsigned short cfg; /* DMA Configuration register */
60 unsigned short dummy1; /* DMA Configuration register */ 124 unsigned short dummy1; /* DMA Configuration register */
61 125
@@ -92,6 +156,7 @@ struct dma_register {
92 unsigned short dummy9; 156 unsigned short dummy9;
93 157
94 unsigned long reserved3; 158 unsigned long reserved3;
159#endif
95 160
96}; 161};
97 162
@@ -131,23 +196,23 @@ static inline void set_dma_curr_desc_addr(unsigned int channel, void *addr)
131{ 196{
132 dma_ch[channel].regs->curr_desc_ptr = addr; 197 dma_ch[channel].regs->curr_desc_ptr = addr;
133} 198}
134static inline void set_dma_x_count(unsigned int channel, unsigned short x_count) 199static inline void set_dma_x_count(unsigned int channel, unsigned DMA_MMR_SIZE_TYPE x_count)
135{ 200{
136 dma_ch[channel].regs->x_count = x_count; 201 dma_ch[channel].regs->x_count = x_count;
137} 202}
138static inline void set_dma_y_count(unsigned int channel, unsigned short y_count) 203static inline void set_dma_y_count(unsigned int channel, unsigned DMA_MMR_SIZE_TYPE y_count)
139{ 204{
140 dma_ch[channel].regs->y_count = y_count; 205 dma_ch[channel].regs->y_count = y_count;
141} 206}
142static inline void set_dma_x_modify(unsigned int channel, short x_modify) 207static inline void set_dma_x_modify(unsigned int channel, DMA_MMR_SIZE_TYPE x_modify)
143{ 208{
144 dma_ch[channel].regs->x_modify = x_modify; 209 dma_ch[channel].regs->x_modify = x_modify;
145} 210}
146static inline void set_dma_y_modify(unsigned int channel, short y_modify) 211static inline void set_dma_y_modify(unsigned int channel, DMA_MMR_SIZE_TYPE y_modify)
147{ 212{
148 dma_ch[channel].regs->y_modify = y_modify; 213 dma_ch[channel].regs->y_modify = y_modify;
149} 214}
150static inline void set_dma_config(unsigned int channel, unsigned short config) 215static inline void set_dma_config(unsigned int channel, unsigned DMA_MMR_SIZE_TYPE config)
151{ 216{
152 dma_ch[channel].regs->cfg = config; 217 dma_ch[channel].regs->cfg = config;
153} 218}
@@ -156,23 +221,55 @@ static inline void set_dma_curr_addr(unsigned int channel, unsigned long addr)
156 dma_ch[channel].regs->curr_addr_ptr = addr; 221 dma_ch[channel].regs->curr_addr_ptr = addr;
157} 222}
158 223
159static inline unsigned short 224#ifdef CONFIG_BF60x
225static inline unsigned long
226set_bfin_dma_config2(char direction, char flow_mode, char intr_mode,
227 char dma_mode, char mem_width, char syncmode, char peri_width)
228{
229 unsigned long config = 0;
230
231 switch (intr_mode) {
232 case INTR_ON_BUF:
233 if (dma_mode == DIMENSION_2D)
234 config = DI_EN_Y;
235 else
236 config = DI_EN_X;
237 break;
238 case INTR_ON_ROW:
239 config = DI_EN_X;
240 break;
241 case INTR_ON_PERI:
242 config = DI_EN_P;
243 break;
244 };
245
246 return config | (direction << 1) | (mem_width << 8) | (dma_mode << 26) |
247 (flow_mode << 12) | (syncmode << 2) | (peri_width << 4);
248}
249#endif
250
251static inline unsigned DMA_MMR_SIZE_TYPE
160set_bfin_dma_config(char direction, char flow_mode, 252set_bfin_dma_config(char direction, char flow_mode,
161 char intr_mode, char dma_mode, char width, char syncmode) 253 char intr_mode, char dma_mode, char mem_width, char syncmode)
162{ 254{
163 return (direction << 1) | (width << 2) | (dma_mode << 4) | 255#ifdef CONFIG_BF60x
256 return set_bfin_dma_config2(direction, flow_mode, intr_mode, dma_mode,
257 mem_width, syncmode, mem_width);
258#else
259 return (direction << 1) | (mem_width << 2) | (dma_mode << 4) |
164 (intr_mode << 6) | (flow_mode << 12) | (syncmode << 5); 260 (intr_mode << 6) | (flow_mode << 12) | (syncmode << 5);
261#endif
165} 262}
166 263
167static inline unsigned short get_dma_curr_irqstat(unsigned int channel) 264static inline unsigned DMA_MMR_SIZE_TYPE get_dma_curr_irqstat(unsigned int channel)
168{ 265{
169 return dma_ch[channel].regs->irq_status; 266 return dma_ch[channel].regs->irq_status;
170} 267}
171static inline unsigned short get_dma_curr_xcount(unsigned int channel) 268static inline unsigned DMA_MMR_SIZE_TYPE get_dma_curr_xcount(unsigned int channel)
172{ 269{
173 return dma_ch[channel].regs->curr_x_count; 270 return dma_ch[channel].regs->curr_x_count;
174} 271}
175static inline unsigned short get_dma_curr_ycount(unsigned int channel) 272static inline unsigned DMA_MMR_SIZE_TYPE get_dma_curr_ycount(unsigned int channel)
176{ 273{
177 return dma_ch[channel].regs->curr_y_count; 274 return dma_ch[channel].regs->curr_y_count;
178} 275}
@@ -184,7 +281,7 @@ static inline void *get_dma_curr_desc_ptr(unsigned int channel)
184{ 281{
185 return dma_ch[channel].regs->curr_desc_ptr; 282 return dma_ch[channel].regs->curr_desc_ptr;
186} 283}
187static inline unsigned short get_dma_config(unsigned int channel) 284static inline unsigned DMA_MMR_SIZE_TYPE get_dma_config(unsigned int channel)
188{ 285{
189 return dma_ch[channel].regs->cfg; 286 return dma_ch[channel].regs->cfg;
190} 287}
@@ -203,8 +300,8 @@ static inline void set_dma_sg(unsigned int channel, struct dmasg *sg, int ndsize
203 300
204 dma_ch[channel].regs->next_desc_ptr = sg; 301 dma_ch[channel].regs->next_desc_ptr = sg;
205 dma_ch[channel].regs->cfg = 302 dma_ch[channel].regs->cfg =
206 (dma_ch[channel].regs->cfg & ~(0xf << 8)) | 303 (dma_ch[channel].regs->cfg & ~NDSIZE) |
207 ((ndsize & 0xf) << 8); 304 ((ndsize << NDSIZE_OFFSET) & NDSIZE);
208} 305}
209 306
210static inline int dma_channel_active(unsigned int channel) 307static inline int dma_channel_active(unsigned int channel)
@@ -239,7 +336,7 @@ static inline void dma_enable_irq(unsigned int channel)
239} 336}
240static inline void clear_dma_irqstat(unsigned int channel) 337static inline void clear_dma_irqstat(unsigned int channel)
241{ 338{
242 dma_ch[channel].regs->irq_status = DMA_DONE | DMA_ERR; 339 dma_ch[channel].regs->irq_status = DMA_DONE | DMA_ERR | DMA_PIRQ;
243} 340}
244 341
245void *dma_memcpy(void *dest, const void *src, size_t count); 342void *dma_memcpy(void *dest, const void *src, size_t count);
diff --git a/arch/blackfin/include/asm/dpmc.h b/arch/blackfin/include/asm/dpmc.h
index c4ec959dad78..e91eae8330a6 100644
--- a/arch/blackfin/include/asm/dpmc.h
+++ b/arch/blackfin/include/asm/dpmc.h
@@ -9,6 +9,651 @@
9#ifndef _BLACKFIN_DPMC_H_ 9#ifndef _BLACKFIN_DPMC_H_
10#define _BLACKFIN_DPMC_H_ 10#define _BLACKFIN_DPMC_H_
11 11
12#ifdef __ASSEMBLY__
13#define PM_REG0 R7
14#define PM_REG1 R6
15#define PM_REG2 R5
16#define PM_REG3 R4
17#define PM_REG4 R3
18#define PM_REG5 R2
19#define PM_REG6 R1
20#define PM_REG7 R0
21#define PM_REG8 P5
22#define PM_REG9 P4
23#define PM_REG10 P3
24#define PM_REG11 P2
25#define PM_REG12 P1
26#define PM_REG13 P0
27
28#define PM_REGSET0 R7:7
29#define PM_REGSET1 R7:6
30#define PM_REGSET2 R7:5
31#define PM_REGSET3 R7:4
32#define PM_REGSET4 R7:3
33#define PM_REGSET5 R7:2
34#define PM_REGSET6 R7:1
35#define PM_REGSET7 R7:0
36#define PM_REGSET8 R7:0, P5:5
37#define PM_REGSET9 R7:0, P5:4
38#define PM_REGSET10 R7:0, P5:3
39#define PM_REGSET11 R7:0, P5:2
40#define PM_REGSET12 R7:0, P5:1
41#define PM_REGSET13 R7:0, P5:0
42
43#define _PM_PUSH(n, x, w, base) PM_REG##n = w[FP + ((x) - (base))];
44#define _PM_POP(n, x, w, base) w[FP + ((x) - (base))] = PM_REG##n;
45#define PM_PUSH_SYNC(n) [--sp] = (PM_REGSET##n);
46#define PM_POP_SYNC(n) (PM_REGSET##n) = [sp++];
47#define PM_PUSH(n, x) PM_REG##n = [FP++];
48#define PM_POP(n, x) [FP--] = PM_REG##n;
49#define PM_CORE_PUSH(n, x) _PM_PUSH(n, x, , COREMMR_BASE)
50#define PM_CORE_POP(n, x) _PM_POP(n, x, , COREMMR_BASE)
51#define PM_SYS_PUSH(n, x) _PM_PUSH(n, x, , SYSMMR_BASE)
52#define PM_SYS_POP(n, x) _PM_POP(n, x, , SYSMMR_BASE)
53#define PM_SYS_PUSH16(n, x) _PM_PUSH(n, x, w, SYSMMR_BASE)
54#define PM_SYS_POP16(n, x) _PM_POP(n, x, w, SYSMMR_BASE)
55
56 .macro bfin_init_pm_bench_cycles
57#ifdef CONFIG_BFIN_PM_WAKEUP_TIME_BENCH
58 R4 = 0;
59 CYCLES = R4;
60 CYCLES2 = R4;
61 R4 = SYSCFG;
62 BITSET(R4, 1);
63 SYSCFG = R4;
64#endif
65 .endm
66
67 .macro bfin_cpu_reg_save
68 /*
69 * Save the core regs early so we can blow them away when
70 * saving/restoring MMR states
71 */
72 [--sp] = (R7:0, P5:0);
73 [--sp] = fp;
74 [--sp] = usp;
75
76 [--sp] = i0;
77 [--sp] = i1;
78 [--sp] = i2;
79 [--sp] = i3;
80
81 [--sp] = m0;
82 [--sp] = m1;
83 [--sp] = m2;
84 [--sp] = m3;
85
86 [--sp] = l0;
87 [--sp] = l1;
88 [--sp] = l2;
89 [--sp] = l3;
90
91 [--sp] = b0;
92 [--sp] = b1;
93 [--sp] = b2;
94 [--sp] = b3;
95 [--sp] = a0.x;
96 [--sp] = a0.w;
97 [--sp] = a1.x;
98 [--sp] = a1.w;
99
100 [--sp] = LC0;
101 [--sp] = LC1;
102 [--sp] = LT0;
103 [--sp] = LT1;
104 [--sp] = LB0;
105 [--sp] = LB1;
106
107 /* We can't push RETI directly as that'll change IPEND[4] */
108 r7 = RETI;
109 [--sp] = RETS;
110 [--sp] = ASTAT;
111#ifndef CONFIG_BFIN_PM_WAKEUP_TIME_BENCH
112 [--sp] = CYCLES;
113 [--sp] = CYCLES2;
114#endif
115 [--sp] = SYSCFG;
116 [--sp] = RETX;
117 [--sp] = SEQSTAT;
118 [--sp] = r7;
119
120 /* Save first func arg in M3 */
121 M3 = R0;
122 .endm
123
124 .macro bfin_cpu_reg_restore
125 /* Restore Core Registers */
126 RETI = [sp++];
127 SEQSTAT = [sp++];
128 RETX = [sp++];
129 SYSCFG = [sp++];
130#ifndef CONFIG_BFIN_PM_WAKEUP_TIME_BENCH
131 CYCLES2 = [sp++];
132 CYCLES = [sp++];
133#endif
134 ASTAT = [sp++];
135 RETS = [sp++];
136
137 LB1 = [sp++];
138 LB0 = [sp++];
139 LT1 = [sp++];
140 LT0 = [sp++];
141 LC1 = [sp++];
142 LC0 = [sp++];
143
144 a1.w = [sp++];
145 a1.x = [sp++];
146 a0.w = [sp++];
147 a0.x = [sp++];
148 b3 = [sp++];
149 b2 = [sp++];
150 b1 = [sp++];
151 b0 = [sp++];
152
153 l3 = [sp++];
154 l2 = [sp++];
155 l1 = [sp++];
156 l0 = [sp++];
157
158 m3 = [sp++];
159 m2 = [sp++];
160 m1 = [sp++];
161 m0 = [sp++];
162
163 i3 = [sp++];
164 i2 = [sp++];
165 i1 = [sp++];
166 i0 = [sp++];
167
168 usp = [sp++];
169 fp = [sp++];
170 (R7:0, P5:0) = [sp++];
171
172 .endm
173
174 .macro bfin_sys_mmr_save
175 /* Save system MMRs */
176 FP.H = hi(SYSMMR_BASE);
177 FP.L = lo(SYSMMR_BASE);
178#ifdef SIC_IMASK0
179 PM_SYS_PUSH(0, SIC_IMASK0)
180 PM_SYS_PUSH(1, SIC_IMASK1)
181# ifdef SIC_IMASK2
182 PM_SYS_PUSH(2, SIC_IMASK2)
183# endif
184#else
185# ifdef SIC_IMASK
186 PM_SYS_PUSH(0, SIC_IMASK)
187# endif
188#endif
189
190#ifdef SIC_IAR0
191 PM_SYS_PUSH(3, SIC_IAR0)
192 PM_SYS_PUSH(4, SIC_IAR1)
193 PM_SYS_PUSH(5, SIC_IAR2)
194#endif
195#ifdef SIC_IAR3
196 PM_SYS_PUSH(6, SIC_IAR3)
197#endif
198#ifdef SIC_IAR4
199 PM_SYS_PUSH(7, SIC_IAR4)
200 PM_SYS_PUSH(8, SIC_IAR5)
201 PM_SYS_PUSH(9, SIC_IAR6)
202#endif
203#ifdef SIC_IAR7
204 PM_SYS_PUSH(10, SIC_IAR7)
205#endif
206#ifdef SIC_IAR8
207 PM_SYS_PUSH(11, SIC_IAR8)
208 PM_SYS_PUSH(12, SIC_IAR9)
209 PM_SYS_PUSH(13, SIC_IAR10)
210#endif
211 PM_PUSH_SYNC(13)
212#ifdef SIC_IAR11
213 PM_SYS_PUSH(0, SIC_IAR11)
214#endif
215
216#ifdef SIC_IWR
217 PM_SYS_PUSH(1, SIC_IWR)
218#endif
219#ifdef SIC_IWR0
220 PM_SYS_PUSH(1, SIC_IWR0)
221#endif
222#ifdef SIC_IWR1
223 PM_SYS_PUSH(2, SIC_IWR1)
224#endif
225#ifdef SIC_IWR2
226 PM_SYS_PUSH(3, SIC_IWR2)
227#endif
228
229#ifdef PINT0_ASSIGN
230 PM_SYS_PUSH(4, PINT0_MASK_SET)
231 PM_SYS_PUSH(5, PINT1_MASK_SET)
232 PM_SYS_PUSH(6, PINT2_MASK_SET)
233 PM_SYS_PUSH(7, PINT3_MASK_SET)
234 PM_SYS_PUSH(8, PINT0_ASSIGN)
235 PM_SYS_PUSH(9, PINT1_ASSIGN)
236 PM_SYS_PUSH(10, PINT2_ASSIGN)
237 PM_SYS_PUSH(11, PINT3_ASSIGN)
238 PM_SYS_PUSH(12, PINT0_INVERT_SET)
239 PM_SYS_PUSH(13, PINT1_INVERT_SET)
240 PM_PUSH_SYNC(13)
241 PM_SYS_PUSH(0, PINT2_INVERT_SET)
242 PM_SYS_PUSH(1, PINT3_INVERT_SET)
243 PM_SYS_PUSH(2, PINT0_EDGE_SET)
244 PM_SYS_PUSH(3, PINT1_EDGE_SET)
245 PM_SYS_PUSH(4, PINT2_EDGE_SET)
246 PM_SYS_PUSH(5, PINT3_EDGE_SET)
247#endif
248
249#ifdef SYSCR
250 PM_SYS_PUSH16(6, SYSCR)
251#endif
252
253#ifdef EBIU_AMGCTL
254 PM_SYS_PUSH16(7, EBIU_AMGCTL)
255 PM_SYS_PUSH(8, EBIU_AMBCTL0)
256 PM_SYS_PUSH(9, EBIU_AMBCTL1)
257#endif
258#ifdef EBIU_FCTL
259 PM_SYS_PUSH(10, EBIU_MBSCTL)
260 PM_SYS_PUSH(11, EBIU_MODE)
261 PM_SYS_PUSH(12, EBIU_FCTL)
262 PM_PUSH_SYNC(12)
263#else
264 PM_PUSH_SYNC(9)
265#endif
266 .endm
267
268
269 .macro bfin_sys_mmr_restore
270/* Restore System MMRs */
271 FP.H = hi(SYSMMR_BASE);
272 FP.L = lo(SYSMMR_BASE);
273
274#ifdef EBIU_FCTL
275 PM_POP_SYNC(12)
276 PM_SYS_POP(12, EBIU_FCTL)
277 PM_SYS_POP(11, EBIU_MODE)
278 PM_SYS_POP(10, EBIU_MBSCTL)
279#else
280 PM_POP_SYNC(9)
281#endif
282
283#ifdef EBIU_AMBCTL
284 PM_SYS_POP(9, EBIU_AMBCTL1)
285 PM_SYS_POP(8, EBIU_AMBCTL0)
286 PM_SYS_POP16(7, EBIU_AMGCTL)
287#endif
288
289#ifdef SYSCR
290 PM_SYS_POP16(6, SYSCR)
291#endif
292
293#ifdef PINT0_ASSIGN
294 PM_SYS_POP(5, PINT3_EDGE_SET)
295 PM_SYS_POP(4, PINT2_EDGE_SET)
296 PM_SYS_POP(3, PINT1_EDGE_SET)
297 PM_SYS_POP(2, PINT0_EDGE_SET)
298 PM_SYS_POP(1, PINT3_INVERT_SET)
299 PM_SYS_POP(0, PINT2_INVERT_SET)
300 PM_POP_SYNC(13)
301 PM_SYS_POP(13, PINT1_INVERT_SET)
302 PM_SYS_POP(12, PINT0_INVERT_SET)
303 PM_SYS_POP(11, PINT3_ASSIGN)
304 PM_SYS_POP(10, PINT2_ASSIGN)
305 PM_SYS_POP(9, PINT1_ASSIGN)
306 PM_SYS_POP(8, PINT0_ASSIGN)
307 PM_SYS_POP(7, PINT3_MASK_SET)
308 PM_SYS_POP(6, PINT2_MASK_SET)
309 PM_SYS_POP(5, PINT1_MASK_SET)
310 PM_SYS_POP(4, PINT0_MASK_SET)
311#endif
312
313#ifdef SIC_IWR2
314 PM_SYS_POP(3, SIC_IWR2)
315#endif
316#ifdef SIC_IWR1
317 PM_SYS_POP(2, SIC_IWR1)
318#endif
319#ifdef SIC_IWR0
320 PM_SYS_POP(1, SIC_IWR0)
321#endif
322#ifdef SIC_IWR
323 PM_SYS_POP(1, SIC_IWR)
324#endif
325
326#ifdef SIC_IAR11
327 PM_SYS_POP(0, SIC_IAR11)
328#endif
329 PM_POP_SYNC(13)
330#ifdef SIC_IAR8
331 PM_SYS_POP(13, SIC_IAR10)
332 PM_SYS_POP(12, SIC_IAR9)
333 PM_SYS_POP(11, SIC_IAR8)
334#endif
335#ifdef SIC_IAR7
336 PM_SYS_POP(10, SIC_IAR7)
337#endif
338#ifdef SIC_IAR6
339 PM_SYS_POP(9, SIC_IAR6)
340 PM_SYS_POP(8, SIC_IAR5)
341 PM_SYS_POP(7, SIC_IAR4)
342#endif
343#ifdef SIC_IAR3
344 PM_SYS_POP(6, SIC_IAR3)
345#endif
346#ifdef SIC_IAR0
347 PM_SYS_POP(5, SIC_IAR2)
348 PM_SYS_POP(4, SIC_IAR1)
349 PM_SYS_POP(3, SIC_IAR0)
350#endif
351#ifdef SIC_IMASK0
352# ifdef SIC_IMASK2
353 PM_SYS_POP(2, SIC_IMASK2)
354# endif
355 PM_SYS_POP(1, SIC_IMASK1)
356 PM_SYS_POP(0, SIC_IMASK0)
357#else
358# ifdef SIC_IMASK
359 PM_SYS_POP(0, SIC_IMASK)
360# endif
361#endif
362 .endm
363
364 .macro bfin_core_mmr_save
365 /* Save Core MMRs */
366 I0.H = hi(COREMMR_BASE);
367 I0.L = lo(COREMMR_BASE);
368 I1 = I0;
369 I2 = I0;
370 I3 = I0;
371 B0 = I0;
372 B1 = I0;
373 B2 = I0;
374 B3 = I0;
375 I1.L = lo(DCPLB_ADDR0);
376 I2.L = lo(DCPLB_DATA0);
377 I3.L = lo(ICPLB_ADDR0);
378 B0.L = lo(ICPLB_DATA0);
379 B1.L = lo(EVT2);
380 B2.L = lo(IMASK);
381 B3.L = lo(TCNTL);
382
383 /* Event Vectors */
384 FP = B1;
385 PM_PUSH(0, EVT2)
386 PM_PUSH(1, EVT3)
387 FP += 4; /* EVT4 */
388 PM_PUSH(2, EVT5)
389 PM_PUSH(3, EVT6)
390 PM_PUSH(4, EVT7)
391 PM_PUSH(5, EVT8)
392 PM_PUSH_SYNC(5)
393
394 PM_PUSH(0, EVT9)
395 PM_PUSH(1, EVT10)
396 PM_PUSH(2, EVT11)
397 PM_PUSH(3, EVT12)
398 PM_PUSH(4, EVT13)
399 PM_PUSH(5, EVT14)
400 PM_PUSH(6, EVT15)
401
402 /* CEC */
403 FP = B2;
404 PM_PUSH(7, IMASK)
405 FP += 4; /* IPEND */
406 PM_PUSH(8, ILAT)
407 PM_PUSH(9, IPRIO)
408
409 /* Core Timer */
410 FP = B3;
411 PM_PUSH(10, TCNTL)
412 PM_PUSH(11, TPERIOD)
413 PM_PUSH(12, TSCALE)
414 PM_PUSH(13, TCOUNT)
415 PM_PUSH_SYNC(13)
416
417 /* Misc non-contiguous registers */
418 FP = I0;
419 PM_CORE_PUSH(0, DMEM_CONTROL);
420 PM_CORE_PUSH(1, IMEM_CONTROL);
421 PM_CORE_PUSH(2, TBUFCTL);
422 PM_PUSH_SYNC(2)
423
424 /* DCPLB Addr */
425 FP = I1;
426 PM_PUSH(0, DCPLB_ADDR0)
427 PM_PUSH(1, DCPLB_ADDR1)
428 PM_PUSH(2, DCPLB_ADDR2)
429 PM_PUSH(3, DCPLB_ADDR3)
430 PM_PUSH(4, DCPLB_ADDR4)
431 PM_PUSH(5, DCPLB_ADDR5)
432 PM_PUSH(6, DCPLB_ADDR6)
433 PM_PUSH(7, DCPLB_ADDR7)
434 PM_PUSH(8, DCPLB_ADDR8)
435 PM_PUSH(9, DCPLB_ADDR9)
436 PM_PUSH(10, DCPLB_ADDR10)
437 PM_PUSH(11, DCPLB_ADDR11)
438 PM_PUSH(12, DCPLB_ADDR12)
439 PM_PUSH(13, DCPLB_ADDR13)
440 PM_PUSH_SYNC(13)
441 PM_PUSH(0, DCPLB_ADDR14)
442 PM_PUSH(1, DCPLB_ADDR15)
443
444 /* DCPLB Data */
445 FP = I2;
446 PM_PUSH(2, DCPLB_DATA0)
447 PM_PUSH(3, DCPLB_DATA1)
448 PM_PUSH(4, DCPLB_DATA2)
449 PM_PUSH(5, DCPLB_DATA3)
450 PM_PUSH(6, DCPLB_DATA4)
451 PM_PUSH(7, DCPLB_DATA5)
452 PM_PUSH(8, DCPLB_DATA6)
453 PM_PUSH(9, DCPLB_DATA7)
454 PM_PUSH(10, DCPLB_DATA8)
455 PM_PUSH(11, DCPLB_DATA9)
456 PM_PUSH(12, DCPLB_DATA10)
457 PM_PUSH(13, DCPLB_DATA11)
458 PM_PUSH_SYNC(13)
459 PM_PUSH(0, DCPLB_DATA12)
460 PM_PUSH(1, DCPLB_DATA13)
461 PM_PUSH(2, DCPLB_DATA14)
462 PM_PUSH(3, DCPLB_DATA15)
463
464 /* ICPLB Addr */
465 FP = I3;
466 PM_PUSH(4, ICPLB_ADDR0)
467 PM_PUSH(5, ICPLB_ADDR1)
468 PM_PUSH(6, ICPLB_ADDR2)
469 PM_PUSH(7, ICPLB_ADDR3)
470 PM_PUSH(8, ICPLB_ADDR4)
471 PM_PUSH(9, ICPLB_ADDR5)
472 PM_PUSH(10, ICPLB_ADDR6)
473 PM_PUSH(11, ICPLB_ADDR7)
474 PM_PUSH(12, ICPLB_ADDR8)
475 PM_PUSH(13, ICPLB_ADDR9)
476 PM_PUSH_SYNC(13)
477 PM_PUSH(0, ICPLB_ADDR10)
478 PM_PUSH(1, ICPLB_ADDR11)
479 PM_PUSH(2, ICPLB_ADDR12)
480 PM_PUSH(3, ICPLB_ADDR13)
481 PM_PUSH(4, ICPLB_ADDR14)
482 PM_PUSH(5, ICPLB_ADDR15)
483
484 /* ICPLB Data */
485 FP = B0;
486 PM_PUSH(6, ICPLB_DATA0)
487 PM_PUSH(7, ICPLB_DATA1)
488 PM_PUSH(8, ICPLB_DATA2)
489 PM_PUSH(9, ICPLB_DATA3)
490 PM_PUSH(10, ICPLB_DATA4)
491 PM_PUSH(11, ICPLB_DATA5)
492 PM_PUSH(12, ICPLB_DATA6)
493 PM_PUSH(13, ICPLB_DATA7)
494 PM_PUSH_SYNC(13)
495 PM_PUSH(0, ICPLB_DATA8)
496 PM_PUSH(1, ICPLB_DATA9)
497 PM_PUSH(2, ICPLB_DATA10)
498 PM_PUSH(3, ICPLB_DATA11)
499 PM_PUSH(4, ICPLB_DATA12)
500 PM_PUSH(5, ICPLB_DATA13)
501 PM_PUSH(6, ICPLB_DATA14)
502 PM_PUSH(7, ICPLB_DATA15)
503 PM_PUSH_SYNC(7)
504 .endm
505
506 .macro bfin_core_mmr_restore
507 /* Restore Core MMRs */
508 I0.H = hi(COREMMR_BASE);
509 I0.L = lo(COREMMR_BASE);
510 I1 = I0;
511 I2 = I0;
512 I3 = I0;
513 B0 = I0;
514 B1 = I0;
515 B2 = I0;
516 B3 = I0;
517 I1.L = lo(DCPLB_ADDR15);
518 I2.L = lo(DCPLB_DATA15);
519 I3.L = lo(ICPLB_ADDR15);
520 B0.L = lo(ICPLB_DATA15);
521 B1.L = lo(EVT15);
522 B2.L = lo(IPRIO);
523 B3.L = lo(TCOUNT);
524
525 /* ICPLB Data */
526 FP = B0;
527 PM_POP_SYNC(7)
528 PM_POP(7, ICPLB_DATA15)
529 PM_POP(6, ICPLB_DATA14)
530 PM_POP(5, ICPLB_DATA13)
531 PM_POP(4, ICPLB_DATA12)
532 PM_POP(3, ICPLB_DATA11)
533 PM_POP(2, ICPLB_DATA10)
534 PM_POP(1, ICPLB_DATA9)
535 PM_POP(0, ICPLB_DATA8)
536 PM_POP_SYNC(13)
537 PM_POP(13, ICPLB_DATA7)
538 PM_POP(12, ICPLB_DATA6)
539 PM_POP(11, ICPLB_DATA5)
540 PM_POP(10, ICPLB_DATA4)
541 PM_POP(9, ICPLB_DATA3)
542 PM_POP(8, ICPLB_DATA2)
543 PM_POP(7, ICPLB_DATA1)
544 PM_POP(6, ICPLB_DATA0)
545
546 /* ICPLB Addr */
547 FP = I3;
548 PM_POP(5, ICPLB_ADDR15)
549 PM_POP(4, ICPLB_ADDR14)
550 PM_POP(3, ICPLB_ADDR13)
551 PM_POP(2, ICPLB_ADDR12)
552 PM_POP(1, ICPLB_ADDR11)
553 PM_POP(0, ICPLB_ADDR10)
554 PM_POP_SYNC(13)
555 PM_POP(13, ICPLB_ADDR9)
556 PM_POP(12, ICPLB_ADDR8)
557 PM_POP(11, ICPLB_ADDR7)
558 PM_POP(10, ICPLB_ADDR6)
559 PM_POP(9, ICPLB_ADDR5)
560 PM_POP(8, ICPLB_ADDR4)
561 PM_POP(7, ICPLB_ADDR3)
562 PM_POP(6, ICPLB_ADDR2)
563 PM_POP(5, ICPLB_ADDR1)
564 PM_POP(4, ICPLB_ADDR0)
565
566 /* DCPLB Data */
567 FP = I2;
568 PM_POP(3, DCPLB_DATA15)
569 PM_POP(2, DCPLB_DATA14)
570 PM_POP(1, DCPLB_DATA13)
571 PM_POP(0, DCPLB_DATA12)
572 PM_POP_SYNC(13)
573 PM_POP(13, DCPLB_DATA11)
574 PM_POP(12, DCPLB_DATA10)
575 PM_POP(11, DCPLB_DATA9)
576 PM_POP(10, DCPLB_DATA8)
577 PM_POP(9, DCPLB_DATA7)
578 PM_POP(8, DCPLB_DATA6)
579 PM_POP(7, DCPLB_DATA5)
580 PM_POP(6, DCPLB_DATA4)
581 PM_POP(5, DCPLB_DATA3)
582 PM_POP(4, DCPLB_DATA2)
583 PM_POP(3, DCPLB_DATA1)
584 PM_POP(2, DCPLB_DATA0)
585
586 /* DCPLB Addr */
587 FP = I1;
588 PM_POP(1, DCPLB_ADDR15)
589 PM_POP(0, DCPLB_ADDR14)
590 PM_POP_SYNC(13)
591 PM_POP(13, DCPLB_ADDR13)
592 PM_POP(12, DCPLB_ADDR12)
593 PM_POP(11, DCPLB_ADDR11)
594 PM_POP(10, DCPLB_ADDR10)
595 PM_POP(9, DCPLB_ADDR9)
596 PM_POP(8, DCPLB_ADDR8)
597 PM_POP(7, DCPLB_ADDR7)
598 PM_POP(6, DCPLB_ADDR6)
599 PM_POP(5, DCPLB_ADDR5)
600 PM_POP(4, DCPLB_ADDR4)
601 PM_POP(3, DCPLB_ADDR3)
602 PM_POP(2, DCPLB_ADDR2)
603 PM_POP(1, DCPLB_ADDR1)
604 PM_POP(0, DCPLB_ADDR0)
605
606
607 /* Misc non-contiguous registers */
608
609 /* icache & dcache will enable later
610 drop IMEM_CONTROL, DMEM_CONTROL pop
611 */
612 FP = I0;
613 PM_POP_SYNC(2)
614 PM_CORE_POP(2, TBUFCTL)
615 PM_CORE_POP(1, IMEM_CONTROL)
616 PM_CORE_POP(0, DMEM_CONTROL)
617
618 /* Core Timer */
619 FP = B3;
620 R0 = 0x1;
621 [FP - 0xC] = R0;
622
623 PM_POP_SYNC(13)
624 FP = B3;
625 PM_POP(13, TCOUNT)
626 PM_POP(12, TSCALE)
627 PM_POP(11, TPERIOD)
628 PM_POP(10, TCNTL)
629
630 /* CEC */
631 FP = B2;
632 PM_POP(9, IPRIO)
633 PM_POP(8, ILAT)
634 FP += -4; /* IPEND */
635 PM_POP(7, IMASK)
636
637 /* Event Vectors */
638 FP = B1;
639 PM_POP(6, EVT15)
640 PM_POP(5, EVT14)
641 PM_POP(4, EVT13)
642 PM_POP(3, EVT12)
643 PM_POP(2, EVT11)
644 PM_POP(1, EVT10)
645 PM_POP(0, EVT9)
646 PM_POP_SYNC(5)
647 PM_POP(5, EVT8)
648 PM_POP(4, EVT7)
649 PM_POP(3, EVT6)
650 PM_POP(2, EVT5)
651 FP += -4; /* EVT4 */
652 PM_POP(1, EVT3)
653 PM_POP(0, EVT2)
654 .endm
655#endif
656
12#include <mach/pll.h> 657#include <mach/pll.h>
13 658
14/* PLL_CTL Masks */ 659/* PLL_CTL Masks */
@@ -98,6 +743,16 @@
98#define VLEV_130 0x00F0 /* VLEV = 1.30 V (-5% - +10% Accuracy) */ 743#define VLEV_130 0x00F0 /* VLEV = 1.30 V (-5% - +10% Accuracy) */
99#endif 744#endif
100 745
746#ifdef CONFIG_BF60x
747#define PA15WE 0x00000001 /* Allow Wake-Up from PA15 */
748#define PB15WE 0x00000002 /* Allow Wake-Up from PB15 */
749#define PC15WE 0x00000004 /* Allow Wake-Up from PC15 */
750#define PD06WE 0x00000008 /* Allow Wake-Up from PD06(ETH0_PHYINT) */
751#define PE12WE 0x00000010 /* Allow Wake-Up from PE12(ETH1_PHYINT, PUSH BUTTON) */
752#define PG04WE 0x00000020 /* Allow Wake-Up from PG04(CAN0_RX) */
753#define PG13WE 0x00000040 /* Allow Wake-Up from PG13 */
754#define USBWE 0x00000080 /* Allow Wake-Up from (USB) */
755#else
101#define WAKE 0x0100 /* Enable RTC/Reset Wakeup From Hibernate */ 756#define WAKE 0x0100 /* Enable RTC/Reset Wakeup From Hibernate */
102#define CANWE 0x0200 /* Enable CAN Wakeup From Hibernate */ 757#define CANWE 0x0200 /* Enable CAN Wakeup From Hibernate */
103#define PHYWE 0x0400 /* Enable PHY Wakeup From Hibernate */ 758#define PHYWE 0x0400 /* Enable PHY Wakeup From Hibernate */
@@ -113,6 +768,7 @@
113#else 768#else
114#define USBWE 0x0800 /* Enable USB Wakeup From Hibernate */ 769#define USBWE 0x0800 /* Enable USB Wakeup From Hibernate */
115#endif 770#endif
771#endif
116 772
117#ifndef __ASSEMBLY__ 773#ifndef __ASSEMBLY__
118 774
diff --git a/arch/blackfin/include/asm/fixed_code.h b/arch/blackfin/include/asm/fixed_code.h
index 73fe53e7fd24..5395088b2d0e 100644
--- a/arch/blackfin/include/asm/fixed_code.h
+++ b/arch/blackfin/include/asm/fixed_code.h
@@ -29,24 +29,28 @@ extern void sigreturn_stub(void);
29#endif 29#endif
30#endif 30#endif
31 31
32#define FIXED_CODE_START 0x400 32#ifndef CONFIG_PHY_RAM_BASE_ADDRESS
33#define CONFIG_PHY_RAM_BASE_ADDRESS 0x0
34#endif
35
36#define FIXED_CODE_START (CONFIG_PHY_RAM_BASE_ADDRESS + 0x400)
33 37
34#define SIGRETURN_STUB 0x400 38#define SIGRETURN_STUB (CONFIG_PHY_RAM_BASE_ADDRESS + 0x400)
35 39
36#define ATOMIC_SEQS_START 0x410 40#define ATOMIC_SEQS_START (CONFIG_PHY_RAM_BASE_ADDRESS + 0x410)
37 41
38#define ATOMIC_XCHG32 0x410 42#define ATOMIC_XCHG32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x410)
39#define ATOMIC_CAS32 0x420 43#define ATOMIC_CAS32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x420)
40#define ATOMIC_ADD32 0x430 44#define ATOMIC_ADD32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x430)
41#define ATOMIC_SUB32 0x440 45#define ATOMIC_SUB32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x440)
42#define ATOMIC_IOR32 0x450 46#define ATOMIC_IOR32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x450)
43#define ATOMIC_AND32 0x460 47#define ATOMIC_AND32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x460)
44#define ATOMIC_XOR32 0x470 48#define ATOMIC_XOR32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x470)
45 49
46#define ATOMIC_SEQS_END 0x480 50#define ATOMIC_SEQS_END (CONFIG_PHY_RAM_BASE_ADDRESS + 0x480)
47 51
48#define SAFE_USER_INSTRUCTION 0x480 52#define SAFE_USER_INSTRUCTION (CONFIG_PHY_RAM_BASE_ADDRESS + 0x480)
49 53
50#define FIXED_CODE_END 0x490 54#define FIXED_CODE_END (CONFIG_PHY_RAM_BASE_ADDRESS + 0x490)
51 55
52#endif 56#endif
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h
index 12d3571b5232..3d84d96f7c2c 100644
--- a/arch/blackfin/include/asm/gpio.h
+++ b/arch/blackfin/include/asm/gpio.h
@@ -26,6 +26,7 @@
26#ifndef __ASSEMBLY__ 26#ifndef __ASSEMBLY__
27 27
28#include <linux/compiler.h> 28#include <linux/compiler.h>
29#include <linux/gpio.h>
29 30
30/*********************************************************** 31/***********************************************************
31* 32*
@@ -244,6 +245,49 @@ static inline int gpio_set_debounce(unsigned gpio, unsigned debounce)
244 return -EINVAL; 245 return -EINVAL;
245} 246}
246 247
248static inline int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)
249{
250 int err;
251
252 err = bfin_gpio_request(gpio, label);
253 if (err)
254 return err;
255
256 if (flags & GPIOF_DIR_IN)
257 err = bfin_gpio_direction_input(gpio);
258 else
259 err = bfin_gpio_direction_output(gpio,
260 (flags & GPIOF_INIT_HIGH) ? 1 : 0);
261
262 if (err)
263 bfin_gpio_free(gpio);
264
265 return err;
266}
267
268static inline int gpio_request_array(const struct gpio *array, size_t num)
269{
270 int i, err;
271
272 for (i = 0; i < num; i++, array++) {
273 err = gpio_request_one(array->gpio, array->flags, array->label);
274 if (err)
275 goto err_free;
276 }
277 return 0;
278
279err_free:
280 while (i--)
281 bfin_gpio_free((--array)->gpio);
282 return err;
283}
284
285static inline void gpio_free_array(const struct gpio *array, size_t num)
286{
287 while (num--)
288 bfin_gpio_free((array++)->gpio);
289}
290
247static inline int __gpio_get_value(unsigned gpio) 291static inline int __gpio_get_value(unsigned gpio)
248{ 292{
249 return bfin_gpio_get_value(gpio); 293 return bfin_gpio_get_value(gpio);
diff --git a/arch/blackfin/include/asm/gptimers.h b/arch/blackfin/include/asm/gptimers.h
index 38bddcb190c8..381e3d621a4c 100644
--- a/arch/blackfin/include/asm/gptimers.h
+++ b/arch/blackfin/include/asm/gptimers.h
@@ -44,6 +44,13 @@
44# define TIMER_GROUP2 1 44# define TIMER_GROUP2 1
45#endif 45#endif
46/* 46/*
47 * BF609: 8 timers:
48 */
49#if defined(CONFIG_BF60x)
50# define MAX_BLACKFIN_GPTIMERS 8
51# define TIMER0_GROUP_REG TIMER_RUN
52#endif
53/*
47 * All others: 3 timers: 54 * All others: 3 timers:
48 */ 55 */
49#define TIMER_GROUP1 0 56#define TIMER_GROUP1 0
@@ -104,6 +111,72 @@
104# define FS2_TIMER_BIT TIMER1bit 111# define FS2_TIMER_BIT TIMER1bit
105#endif 112#endif
106 113
114#ifdef CONFIG_BF60x
115/*
116 * Timer Configuration Register Bits
117 */
118#define TIMER_EMU_RUN 0x8000
119#define TIMER_BPER_EN 0x4000
120#define TIMER_BWID_EN 0x2000
121#define TIMER_BDLY_EN 0x1000
122#define TIMER_OUT_DIS 0x0800
123#define TIMER_TIN_SEL 0x0400
124#define TIMER_CLK_SEL 0x0300
125#define TIMER_CLK_SCLK 0x0000
126#define TIMER_CLK_ALT_CLK0 0x0100
127#define TIMER_CLK_ALT_CLK1 0x0300
128#define TIMER_PULSE_HI 0x0080
129#define TIMER_SLAVE_TRIG 0x0040
130#define TIMER_IRQ_MODE 0x0030
131#define TIMER_IRQ_ACT_EDGE 0x0000
132#define TIMER_IRQ_DLY 0x0010
133#define TIMER_IRQ_WID_DLY 0x0020
134#define TIMER_IRQ_PER 0x0030
135#define TIMER_MODE 0x000f
136#define TIMER_MODE_WDOG_P 0x0008
137#define TIMER_MODE_WDOG_W 0x0009
138#define TIMER_MODE_PWM_CONT 0x000c
139#define TIMER_MODE_PWM 0x000d
140#define TIMER_MODE_WDTH 0x000a
141#define TIMER_MODE_WDTH_D 0x000b
142#define TIMER_MODE_EXT_CLK 0x000e
143#define TIMER_MODE_PININT 0x000f
144
145/*
146 * Timer Status Register Bits
147 */
148#define TIMER_STATUS_TIMIL0 0x0001
149#define TIMER_STATUS_TIMIL1 0x0002
150#define TIMER_STATUS_TIMIL2 0x0004
151#define TIMER_STATUS_TIMIL3 0x0008
152#define TIMER_STATUS_TIMIL4 0x0010
153#define TIMER_STATUS_TIMIL5 0x0020
154#define TIMER_STATUS_TIMIL6 0x0040
155#define TIMER_STATUS_TIMIL7 0x0080
156
157#define TIMER_STATUS_TOVF0 0x0001 /* timer 0 overflow error */
158#define TIMER_STATUS_TOVF1 0x0002
159#define TIMER_STATUS_TOVF2 0x0004
160#define TIMER_STATUS_TOVF3 0x0008
161#define TIMER_STATUS_TOVF4 0x0010
162#define TIMER_STATUS_TOVF5 0x0020
163#define TIMER_STATUS_TOVF6 0x0040
164#define TIMER_STATUS_TOVF7 0x0080
165
166/*
167 * Timer Slave Enable Status : write 1 to clear
168 */
169#define TIMER_STATUS_TRUN0 0x0001
170#define TIMER_STATUS_TRUN1 0x0002
171#define TIMER_STATUS_TRUN2 0x0004
172#define TIMER_STATUS_TRUN3 0x0008
173#define TIMER_STATUS_TRUN4 0x0010
174#define TIMER_STATUS_TRUN5 0x0020
175#define TIMER_STATUS_TRUN6 0x0040
176#define TIMER_STATUS_TRUN7 0x0080
177
178#else
179
107/* 180/*
108 * Timer Configuration Register Bits 181 * Timer Configuration Register Bits
109 */ 182 */
@@ -170,12 +243,18 @@
170#define TIMER_STATUS_TRUN10 0x4000 243#define TIMER_STATUS_TRUN10 0x4000
171#define TIMER_STATUS_TRUN11 0x8000 244#define TIMER_STATUS_TRUN11 0x8000
172 245
246#endif
247
173/* The actual gptimer API */ 248/* The actual gptimer API */
174 249
175void set_gptimer_pwidth(unsigned int timer_id, uint32_t width); 250void set_gptimer_pwidth(unsigned int timer_id, uint32_t width);
176uint32_t get_gptimer_pwidth(unsigned int timer_id); 251uint32_t get_gptimer_pwidth(unsigned int timer_id);
177void set_gptimer_period(unsigned int timer_id, uint32_t period); 252void set_gptimer_period(unsigned int timer_id, uint32_t period);
178uint32_t get_gptimer_period(unsigned int timer_id); 253uint32_t get_gptimer_period(unsigned int timer_id);
254#ifdef CONFIG_BF60x
255void set_gptimer_delay(unsigned int timer_id, uint32_t delay);
256uint32_t get_gptimer_delay(unsigned int timer_id);
257#endif
179uint32_t get_gptimer_count(unsigned int timer_id); 258uint32_t get_gptimer_count(unsigned int timer_id);
180int get_gptimer_intr(unsigned int timer_id); 259int get_gptimer_intr(unsigned int timer_id);
181void clear_gptimer_intr(unsigned int timer_id); 260void clear_gptimer_intr(unsigned int timer_id);
@@ -217,16 +296,41 @@ struct bfin_gptimer_regs {
217 u32 counter; 296 u32 counter;
218 u32 period; 297 u32 period;
219 u32 width; 298 u32 width;
299#ifdef CONFIG_BF60x
300 u32 delay;
301#endif
220}; 302};
221 303
222/* 304/*
223 * bfin group timer registers layout 305 * bfin group timer registers layout
224 */ 306 */
307#ifndef CONFIG_BF60x
225struct bfin_gptimer_group_regs { 308struct bfin_gptimer_group_regs {
226 __BFP(enable); 309 __BFP(enable);
227 __BFP(disable); 310 __BFP(disable);
228 u32 status; 311 u32 status;
229}; 312};
313#else
314struct bfin_gptimer_group_regs {
315 __BFP(run);
316 __BFP(enable);
317 __BFP(disable);
318 __BFP(stop_cfg);
319 __BFP(stop_cfg_set);
320 __BFP(stop_cfg_clr);
321 __BFP(data_imsk);
322 __BFP(stat_imsk);
323 __BFP(tr_msk);
324 __BFP(tr_ie);
325 __BFP(data_ilat);
326 __BFP(stat_ilat);
327 __BFP(err_status);
328 __BFP(bcast_per);
329 __BFP(bcast_wid);
330 __BFP(bcast_dly);
331
332};
333#endif
230 334
231#undef __BFP 335#undef __BFP
232 336
diff --git a/arch/blackfin/include/asm/irqflags.h b/arch/blackfin/include/asm/irqflags.h
index 43eb4749de3d..07aff230a812 100644
--- a/arch/blackfin/include/asm/irqflags.h
+++ b/arch/blackfin/include/asm/irqflags.h
@@ -67,7 +67,11 @@ static inline notrace unsigned long __hard_local_irq_save(void)
67 67
68static inline notrace int hard_irqs_disabled_flags(unsigned long flags) 68static inline notrace int hard_irqs_disabled_flags(unsigned long flags)
69{ 69{
70#ifdef CONFIG_BF60x
71 return (flags & IMASK_IVG11) == 0;
72#else
70 return (flags & ~0x3f) == 0; 73 return (flags & ~0x3f) == 0;
74#endif
71} 75}
72 76
73static inline notrace int hard_irqs_disabled(void) 77static inline notrace int hard_irqs_disabled(void)
@@ -224,7 +228,7 @@ static inline notrace void hard_local_irq_restore(unsigned long flags)
224 * Direct interface to linux/irqflags.h. 228 * Direct interface to linux/irqflags.h.
225 */ 229 */
226#define arch_local_save_flags() hard_local_save_flags() 230#define arch_local_save_flags() hard_local_save_flags()
227#define arch_local_irq_save(flags) __hard_local_irq_save() 231#define arch_local_irq_save() __hard_local_irq_save()
228#define arch_local_irq_restore(flags) __hard_local_irq_restore(flags) 232#define arch_local_irq_restore(flags) __hard_local_irq_restore(flags)
229#define arch_local_irq_enable() __hard_local_irq_enable() 233#define arch_local_irq_enable() __hard_local_irq_enable()
230#define arch_local_irq_disable() __hard_local_irq_disable() 234#define arch_local_irq_disable() __hard_local_irq_disable()
diff --git a/arch/blackfin/include/asm/page.h b/arch/blackfin/include/asm/page.h
index 7202404966f6..b93474d5be75 100644
--- a/arch/blackfin/include/asm/page.h
+++ b/arch/blackfin/include/asm/page.h
@@ -7,14 +7,15 @@
7#ifndef _BLACKFIN_PAGE_H 7#ifndef _BLACKFIN_PAGE_H
8#define _BLACKFIN_PAGE_H 8#define _BLACKFIN_PAGE_H
9 9
10#include <asm-generic/page.h> 10#define ARCH_PFN_OFFSET (CONFIG_PHY_RAM_BASE_ADDRESS >> PAGE_SHIFT)
11#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) 11#define MAP_NR(addr) ((unsigned long)(addr) >> PAGE_SHIFT)
12 12
13#define VM_DATA_DEFAULT_FLAGS \ 13#define VM_DATA_DEFAULT_FLAGS \
14 (VM_READ | VM_WRITE | \ 14 (VM_READ | VM_WRITE | \
15 ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ 15 ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
16 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 16 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
17 17
18#include <asm-generic/page.h>
18#include <asm-generic/memory_model.h> 19#include <asm-generic/memory_model.h>
19#include <asm-generic/getorder.h> 20#include <asm-generic/getorder.h>
20 21
diff --git a/arch/blackfin/include/asm/pda.h b/arch/blackfin/include/asm/pda.h
index 28c2498c9c98..68d6f6618f2a 100644
--- a/arch/blackfin/include/asm/pda.h
+++ b/arch/blackfin/include/asm/pda.h
@@ -13,7 +13,9 @@
13#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
14 14
15struct blackfin_pda { /* Per-processor Data Area */ 15struct blackfin_pda { /* Per-processor Data Area */
16#ifdef CONFIG_SMP
16 struct blackfin_pda *next; 17 struct blackfin_pda *next;
18#endif
17 19
18 unsigned long syscfg; 20 unsigned long syscfg;
19#ifdef CONFIG_SMP 21#ifdef CONFIG_SMP
diff --git a/arch/blackfin/include/asm/pm.h b/arch/blackfin/include/asm/pm.h
new file mode 100644
index 000000000000..f72239bf3638
--- /dev/null
+++ b/arch/blackfin/include/asm/pm.h
@@ -0,0 +1,31 @@
1/*
2 * Blackfin bf609 power management
3 *
4 * Copyright 2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2
7 */
8
9#ifndef __PM_H__
10#define __PM_H__
11
12#include <linux/suspend.h>
13
14struct bfin_cpu_pm_fns {
15 void (*save)(unsigned long *);
16 void (*restore)(unsigned long *);
17 int (*valid)(suspend_state_t state);
18 void (*enter)(suspend_state_t state);
19 int (*prepare)(void);
20 void (*finish)(void);
21};
22
23extern struct bfin_cpu_pm_fns *bfin_cpu_pm;
24
25# ifdef CONFIG_BFIN_COREB
26void bfin_coreb_start(void);
27void bfin_coreb_stop(void);
28void bfin_coreb_reset(void);
29# endif
30
31#endif
diff --git a/arch/blackfin/include/asm/unistd.h b/arch/blackfin/include/asm/unistd.h
index 75ec9df5318b..3287222cba34 100644
--- a/arch/blackfin/include/asm/unistd.h
+++ b/arch/blackfin/include/asm/unistd.h
@@ -11,7 +11,7 @@
11 */ 11 */
12#define __NR_restart_syscall 0 12#define __NR_restart_syscall 0
13#define __NR_exit 1 13#define __NR_exit 1
14#define __NR_fork 2 14 /* 2 __NR_fork not supported on nommu */
15#define __NR_read 3 15#define __NR_read 3
16#define __NR_write 4 16#define __NR_write 4
17#define __NR_open 5 17#define __NR_open 5
diff --git a/arch/blackfin/kernel/Makefile b/arch/blackfin/kernel/Makefile
index 9a0d6d706443..08e6625106be 100644
--- a/arch/blackfin/kernel/Makefile
+++ b/arch/blackfin/kernel/Makefile
@@ -2,7 +2,7 @@
2# arch/blackfin/kernel/Makefile 2# arch/blackfin/kernel/Makefile
3# 3#
4 4
5extra-y := init_task.o vmlinux.lds 5extra-y := vmlinux.lds
6 6
7obj-y := \ 7obj-y := \
8 entry.o process.o bfin_ksyms.o ptrace.o setup.o signal.o \ 8 entry.o process.o bfin_ksyms.o ptrace.o setup.o signal.o \
diff --git a/arch/blackfin/kernel/bfin_dma.c b/arch/blackfin/kernel/bfin_dma.c
index 40c2ed61258e..c166939ffb2b 100644
--- a/arch/blackfin/kernel/bfin_dma.c
+++ b/arch/blackfin/kernel/bfin_dma.c
@@ -45,9 +45,15 @@ static int __init blackfin_dma_init(void)
45 atomic_set(&dma_ch[i].chan_status, 0); 45 atomic_set(&dma_ch[i].chan_status, 0);
46 dma_ch[i].regs = dma_io_base_addr[i]; 46 dma_ch[i].regs = dma_io_base_addr[i];
47 } 47 }
48#ifdef CH_MEM_STREAM3_SRC
49 /* Mark MEMDMA Channel 3 as requested since we're using it internally */
50 request_dma(CH_MEM_STREAM3_DEST, "Blackfin dma_memcpy");
51 request_dma(CH_MEM_STREAM3_SRC, "Blackfin dma_memcpy");
52#else
48 /* Mark MEMDMA Channel 0 as requested since we're using it internally */ 53 /* Mark MEMDMA Channel 0 as requested since we're using it internally */
49 request_dma(CH_MEM_STREAM0_DEST, "Blackfin dma_memcpy"); 54 request_dma(CH_MEM_STREAM0_DEST, "Blackfin dma_memcpy");
50 request_dma(CH_MEM_STREAM0_SRC, "Blackfin dma_memcpy"); 55 request_dma(CH_MEM_STREAM0_SRC, "Blackfin dma_memcpy");
56#endif
51 57
52#if defined(CONFIG_DEB_DMA_URGENT) 58#if defined(CONFIG_DEB_DMA_URGENT)
53 bfin_write_EBIU_DDRQUE(bfin_read_EBIU_DDRQUE() 59 bfin_write_EBIU_DDRQUE(bfin_read_EBIU_DDRQUE()
@@ -84,7 +90,8 @@ static const struct file_operations proc_dma_operations = {
84 90
85static int __init proc_dma_init(void) 91static int __init proc_dma_init(void)
86{ 92{
87 return proc_create("dma", 0, NULL, &proc_dma_operations) != NULL; 93 proc_create("dma", 0, NULL, &proc_dma_operations);
94 return 0;
88} 95}
89late_initcall(proc_dma_init); 96late_initcall(proc_dma_init);
90#endif 97#endif
@@ -204,6 +211,7 @@ EXPORT_SYMBOL(free_dma);
204# ifndef MAX_DMA_SUSPEND_CHANNELS 211# ifndef MAX_DMA_SUSPEND_CHANNELS
205# define MAX_DMA_SUSPEND_CHANNELS MAX_DMA_CHANNELS 212# define MAX_DMA_SUSPEND_CHANNELS MAX_DMA_CHANNELS
206# endif 213# endif
214# ifndef CONFIG_BF60x
207int blackfin_dma_suspend(void) 215int blackfin_dma_suspend(void)
208{ 216{
209 int i; 217 int i;
@@ -213,7 +221,6 @@ int blackfin_dma_suspend(void)
213 printk(KERN_ERR "DMA Channel %d failed to suspend\n", i); 221 printk(KERN_ERR "DMA Channel %d failed to suspend\n", i);
214 return -EBUSY; 222 return -EBUSY;
215 } 223 }
216
217 if (i < MAX_DMA_SUSPEND_CHANNELS) 224 if (i < MAX_DMA_SUSPEND_CHANNELS)
218 dma_ch[i].saved_peripheral_map = dma_ch[i].regs->peripheral_map; 225 dma_ch[i].saved_peripheral_map = dma_ch[i].regs->peripheral_map;
219 } 226 }
@@ -230,7 +237,6 @@ void blackfin_dma_resume(void)
230 237
231 for (i = 0; i < MAX_DMA_CHANNELS; ++i) { 238 for (i = 0; i < MAX_DMA_CHANNELS; ++i) {
232 dma_ch[i].regs->cfg = 0; 239 dma_ch[i].regs->cfg = 0;
233
234 if (i < MAX_DMA_SUSPEND_CHANNELS) 240 if (i < MAX_DMA_SUSPEND_CHANNELS)
235 dma_ch[i].regs->peripheral_map = dma_ch[i].saved_peripheral_map; 241 dma_ch[i].regs->peripheral_map = dma_ch[i].saved_peripheral_map;
236 } 242 }
@@ -238,6 +244,16 @@ void blackfin_dma_resume(void)
238 bfin_write_DMAC_TC_PER(0x0111); 244 bfin_write_DMAC_TC_PER(0x0111);
239#endif 245#endif
240} 246}
247# else
248int blackfin_dma_suspend(void)
249{
250 return 0;
251}
252
253void blackfin_dma_resume(void)
254{
255}
256#endif
241#endif 257#endif
242 258
243/** 259/**
@@ -279,10 +295,10 @@ void __init early_dma_memcpy(void *pdst, const void *psrc, size_t size)
279 src_ch = (struct dma_register *)MDMA_S0_NEXT_DESC_PTR; 295 src_ch = (struct dma_register *)MDMA_S0_NEXT_DESC_PTR;
280 } 296 }
281 297
282 if (!bfin_read16(&src_ch->cfg)) 298 if (!DMA_MMR_READ(&src_ch->cfg))
283 break; 299 break;
284 else if (bfin_read16(&dst_ch->irq_status) & DMA_DONE) { 300 else if (DMA_MMR_READ(&dst_ch->irq_status) & DMA_DONE) {
285 bfin_write16(&src_ch->cfg, 0); 301 DMA_MMR_WRITE(&src_ch->cfg, 0);
286 break; 302 break;
287 } 303 }
288 } 304 }
@@ -295,22 +311,31 @@ void __init early_dma_memcpy(void *pdst, const void *psrc, size_t size)
295 311
296 /* Destination */ 312 /* Destination */
297 bfin_write32(&dst_ch->start_addr, dst); 313 bfin_write32(&dst_ch->start_addr, dst);
298 bfin_write16(&dst_ch->x_count, size >> 2); 314 DMA_MMR_WRITE(&dst_ch->x_count, size >> 2);
299 bfin_write16(&dst_ch->x_modify, 1 << 2); 315 DMA_MMR_WRITE(&dst_ch->x_modify, 1 << 2);
300 bfin_write16(&dst_ch->irq_status, DMA_DONE | DMA_ERR); 316 DMA_MMR_WRITE(&dst_ch->irq_status, DMA_DONE | DMA_ERR);
301 317
302 /* Source */ 318 /* Source */
303 bfin_write32(&src_ch->start_addr, src); 319 bfin_write32(&src_ch->start_addr, src);
304 bfin_write16(&src_ch->x_count, size >> 2); 320 DMA_MMR_WRITE(&src_ch->x_count, size >> 2);
305 bfin_write16(&src_ch->x_modify, 1 << 2); 321 DMA_MMR_WRITE(&src_ch->x_modify, 1 << 2);
306 bfin_write16(&src_ch->irq_status, DMA_DONE | DMA_ERR); 322 DMA_MMR_WRITE(&src_ch->irq_status, DMA_DONE | DMA_ERR);
307 323
308 /* Enable */ 324 /* Enable */
309 bfin_write16(&src_ch->cfg, DMAEN | WDSIZE_32); 325 DMA_MMR_WRITE(&src_ch->cfg, DMAEN | WDSIZE_32);
310 bfin_write16(&dst_ch->cfg, WNR | DI_EN | DMAEN | WDSIZE_32); 326 DMA_MMR_WRITE(&dst_ch->cfg, WNR | DI_EN_X | DMAEN | WDSIZE_32);
311 327
312 /* Since we are atomic now, don't use the workaround ssync */ 328 /* Since we are atomic now, don't use the workaround ssync */
313 __builtin_bfin_ssync(); 329 __builtin_bfin_ssync();
330
331#ifdef CONFIG_BF60x
332 /* Work around a possible MDMA anomaly. Running 2 MDMA channels to
333 * transfer DDR data to L1 SRAM may corrupt data.
334 * Should be reverted after this issue is root caused.
335 */
336 while (!(DMA_MMR_READ(&dst_ch->irq_status) & DMA_DONE))
337 continue;
338#endif
314} 339}
315 340
316void __init early_dma_memcpy_done(void) 341void __init early_dma_memcpy_done(void)
@@ -336,6 +361,42 @@ void __init early_dma_memcpy_done(void)
336 __builtin_bfin_ssync(); 361 __builtin_bfin_ssync();
337} 362}
338 363
364#ifdef CH_MEM_STREAM3_SRC
365#define bfin_read_MDMA_S_CONFIG bfin_read_MDMA_S3_CONFIG
366#define bfin_write_MDMA_S_CONFIG bfin_write_MDMA_S3_CONFIG
367#define bfin_write_MDMA_S_START_ADDR bfin_write_MDMA_S3_START_ADDR
368#define bfin_write_MDMA_S_IRQ_STATUS bfin_write_MDMA_S3_IRQ_STATUS
369#define bfin_write_MDMA_S_X_COUNT bfin_write_MDMA_S3_X_COUNT
370#define bfin_write_MDMA_S_X_MODIFY bfin_write_MDMA_S3_X_MODIFY
371#define bfin_write_MDMA_S_Y_COUNT bfin_write_MDMA_S3_Y_COUNT
372#define bfin_write_MDMA_S_Y_MODIFY bfin_write_MDMA_S3_Y_MODIFY
373#define bfin_write_MDMA_D_CONFIG bfin_write_MDMA_D3_CONFIG
374#define bfin_write_MDMA_D_START_ADDR bfin_write_MDMA_D3_START_ADDR
375#define bfin_read_MDMA_D_IRQ_STATUS bfin_read_MDMA_D3_IRQ_STATUS
376#define bfin_write_MDMA_D_IRQ_STATUS bfin_write_MDMA_D3_IRQ_STATUS
377#define bfin_write_MDMA_D_X_COUNT bfin_write_MDMA_D3_X_COUNT
378#define bfin_write_MDMA_D_X_MODIFY bfin_write_MDMA_D3_X_MODIFY
379#define bfin_write_MDMA_D_Y_COUNT bfin_write_MDMA_D3_Y_COUNT
380#define bfin_write_MDMA_D_Y_MODIFY bfin_write_MDMA_D3_Y_MODIFY
381#else
382#define bfin_read_MDMA_S_CONFIG bfin_read_MDMA_S0_CONFIG
383#define bfin_write_MDMA_S_CONFIG bfin_write_MDMA_S0_CONFIG
384#define bfin_write_MDMA_S_START_ADDR bfin_write_MDMA_S0_START_ADDR
385#define bfin_write_MDMA_S_IRQ_STATUS bfin_write_MDMA_S0_IRQ_STATUS
386#define bfin_write_MDMA_S_X_COUNT bfin_write_MDMA_S0_X_COUNT
387#define bfin_write_MDMA_S_X_MODIFY bfin_write_MDMA_S0_X_MODIFY
388#define bfin_write_MDMA_S_Y_COUNT bfin_write_MDMA_S0_Y_COUNT
389#define bfin_write_MDMA_S_Y_MODIFY bfin_write_MDMA_S0_Y_MODIFY
390#define bfin_write_MDMA_D_CONFIG bfin_write_MDMA_D0_CONFIG
391#define bfin_write_MDMA_D_START_ADDR bfin_write_MDMA_D0_START_ADDR
392#define bfin_read_MDMA_D_IRQ_STATUS bfin_read_MDMA_D0_IRQ_STATUS
393#define bfin_write_MDMA_D_IRQ_STATUS bfin_write_MDMA_D0_IRQ_STATUS
394#define bfin_write_MDMA_D_X_COUNT bfin_write_MDMA_D0_X_COUNT
395#define bfin_write_MDMA_D_X_MODIFY bfin_write_MDMA_D0_X_MODIFY
396#define bfin_write_MDMA_D_Y_COUNT bfin_write_MDMA_D0_Y_COUNT
397#define bfin_write_MDMA_D_Y_MODIFY bfin_write_MDMA_D0_Y_MODIFY
398#endif
399
339/** 400/**
340 * __dma_memcpy - program the MDMA registers 401 * __dma_memcpy - program the MDMA registers
341 * 402 *
@@ -358,8 +419,8 @@ static void __dma_memcpy(u32 daddr, s16 dmod, u32 saddr, s16 smod, size_t cnt, u
358 */ 419 */
359 __builtin_bfin_ssync(); 420 __builtin_bfin_ssync();
360 421
361 if (bfin_read_MDMA_S0_CONFIG()) 422 if (bfin_read_MDMA_S_CONFIG())
362 while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE)) 423 while (!(bfin_read_MDMA_D_IRQ_STATUS() & DMA_DONE))
363 continue; 424 continue;
364 425
365 if (conf & DMA2D) { 426 if (conf & DMA2D) {
@@ -374,39 +435,42 @@ static void __dma_memcpy(u32 daddr, s16 dmod, u32 saddr, s16 smod, size_t cnt, u
374 u32 shift = abs(dmod) >> 1; 435 u32 shift = abs(dmod) >> 1;
375 size_t ycnt = cnt >> (16 - shift); 436 size_t ycnt = cnt >> (16 - shift);
376 cnt = 1 << (16 - shift); 437 cnt = 1 << (16 - shift);
377 bfin_write_MDMA_D0_Y_COUNT(ycnt); 438 bfin_write_MDMA_D_Y_COUNT(ycnt);
378 bfin_write_MDMA_S0_Y_COUNT(ycnt); 439 bfin_write_MDMA_S_Y_COUNT(ycnt);
379 bfin_write_MDMA_D0_Y_MODIFY(dmod); 440 bfin_write_MDMA_D_Y_MODIFY(dmod);
380 bfin_write_MDMA_S0_Y_MODIFY(smod); 441 bfin_write_MDMA_S_Y_MODIFY(smod);
381 } 442 }
382 443
383 bfin_write_MDMA_D0_START_ADDR(daddr); 444 bfin_write_MDMA_D_START_ADDR(daddr);
384 bfin_write_MDMA_D0_X_COUNT(cnt); 445 bfin_write_MDMA_D_X_COUNT(cnt);
385 bfin_write_MDMA_D0_X_MODIFY(dmod); 446 bfin_write_MDMA_D_X_MODIFY(dmod);
386 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); 447 bfin_write_MDMA_D_IRQ_STATUS(DMA_DONE | DMA_ERR);
387 448
388 bfin_write_MDMA_S0_START_ADDR(saddr); 449 bfin_write_MDMA_S_START_ADDR(saddr);
389 bfin_write_MDMA_S0_X_COUNT(cnt); 450 bfin_write_MDMA_S_X_COUNT(cnt);
390 bfin_write_MDMA_S0_X_MODIFY(smod); 451 bfin_write_MDMA_S_X_MODIFY(smod);
391 bfin_write_MDMA_S0_IRQ_STATUS(DMA_DONE | DMA_ERR); 452 bfin_write_MDMA_S_IRQ_STATUS(DMA_DONE | DMA_ERR);
392 453
393 bfin_write_MDMA_S0_CONFIG(DMAEN | conf); 454 bfin_write_MDMA_S_CONFIG(DMAEN | conf);
394 bfin_write_MDMA_D0_CONFIG(WNR | DI_EN | DMAEN | conf); 455 if (conf & DMA2D)
456 bfin_write_MDMA_D_CONFIG(WNR | DI_EN_Y | DMAEN | conf);
457 else
458 bfin_write_MDMA_D_CONFIG(WNR | DI_EN_X | DMAEN | conf);
395 459
396 spin_unlock_irqrestore(&mdma_lock, flags); 460 spin_unlock_irqrestore(&mdma_lock, flags);
397 461
398 SSYNC(); 462 SSYNC();
399 463
400 while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE)) 464 while (!(bfin_read_MDMA_D_IRQ_STATUS() & DMA_DONE))
401 if (bfin_read_MDMA_S0_CONFIG()) 465 if (bfin_read_MDMA_S_CONFIG())
402 continue; 466 continue;
403 else 467 else
404 return; 468 return;
405 469
406 bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); 470 bfin_write_MDMA_D_IRQ_STATUS(DMA_DONE | DMA_ERR);
407 471
408 bfin_write_MDMA_S0_CONFIG(0); 472 bfin_write_MDMA_S_CONFIG(0);
409 bfin_write_MDMA_D0_CONFIG(0); 473 bfin_write_MDMA_D_CONFIG(0);
410} 474}
411 475
412/** 476/**
@@ -448,8 +512,10 @@ static void *_dma_memcpy(void *pdst, const void *psrc, size_t size)
448 } 512 }
449 size >>= shift; 513 size >>= shift;
450 514
515#ifndef DMA_MMR_SIZE_32
451 if (size > 0x10000) 516 if (size > 0x10000)
452 conf |= DMA2D; 517 conf |= DMA2D;
518#endif
453 519
454 __dma_memcpy(dst, mod, src, mod, size, conf); 520 __dma_memcpy(dst, mod, src, mod, size, conf);
455 521
@@ -488,6 +554,9 @@ EXPORT_SYMBOL(dma_memcpy);
488 */ 554 */
489void *dma_memcpy_nocache(void *pdst, const void *psrc, size_t size) 555void *dma_memcpy_nocache(void *pdst, const void *psrc, size_t size)
490{ 556{
557#ifdef DMA_MMR_SIZE_32
558 _dma_memcpy(pdst, psrc, size);
559#else
491 size_t bulk, rest; 560 size_t bulk, rest;
492 561
493 bulk = size & ~0xffff; 562 bulk = size & ~0xffff;
@@ -495,6 +564,7 @@ void *dma_memcpy_nocache(void *pdst, const void *psrc, size_t size)
495 if (bulk) 564 if (bulk)
496 _dma_memcpy(pdst, psrc, bulk); 565 _dma_memcpy(pdst, psrc, bulk);
497 _dma_memcpy(pdst + bulk, psrc + bulk, rest); 566 _dma_memcpy(pdst + bulk, psrc + bulk, rest);
567#endif
498 return pdst; 568 return pdst;
499} 569}
500EXPORT_SYMBOL(dma_memcpy_nocache); 570EXPORT_SYMBOL(dma_memcpy_nocache);
@@ -514,14 +584,14 @@ void *safe_dma_memcpy(void *dst, const void *src, size_t size)
514} 584}
515EXPORT_SYMBOL(safe_dma_memcpy); 585EXPORT_SYMBOL(safe_dma_memcpy);
516 586
517static void _dma_out(unsigned long addr, unsigned long buf, unsigned short len, 587static void _dma_out(unsigned long addr, unsigned long buf, unsigned DMA_MMR_SIZE_TYPE len,
518 u16 size, u16 dma_size) 588 u16 size, u16 dma_size)
519{ 589{
520 blackfin_dcache_flush_range(buf, buf + len * size); 590 blackfin_dcache_flush_range(buf, buf + len * size);
521 __dma_memcpy(addr, 0, buf, size, len, dma_size); 591 __dma_memcpy(addr, 0, buf, size, len, dma_size);
522} 592}
523 593
524static void _dma_in(unsigned long addr, unsigned long buf, unsigned short len, 594static void _dma_in(unsigned long addr, unsigned long buf, unsigned DMA_MMR_SIZE_TYPE len,
525 u16 size, u16 dma_size) 595 u16 size, u16 dma_size)
526{ 596{
527 blackfin_dcache_invalidate_range(buf, buf + len * size); 597 blackfin_dcache_invalidate_range(buf, buf + len * size);
@@ -529,7 +599,7 @@ static void _dma_in(unsigned long addr, unsigned long buf, unsigned short len,
529} 599}
530 600
531#define MAKE_DMA_IO(io, bwl, isize, dmasize, cnst) \ 601#define MAKE_DMA_IO(io, bwl, isize, dmasize, cnst) \
532void dma_##io##s##bwl(unsigned long addr, cnst void *buf, unsigned short len) \ 602void dma_##io##s##bwl(unsigned long addr, cnst void *buf, unsigned DMA_MMR_SIZE_TYPE len) \
533{ \ 603{ \
534 _dma_##io(addr, (unsigned long)buf, len, isize, WDSIZE_##dmasize); \ 604 _dma_##io(addr, (unsigned long)buf, len, isize, WDSIZE_##dmasize); \
535} \ 605} \
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c
index 02796b88443d..83139aaf3072 100644
--- a/arch/blackfin/kernel/bfin_gpio.c
+++ b/arch/blackfin/kernel/bfin_gpio.c
@@ -58,7 +58,7 @@ static struct gpio_port_t * const gpio_array[] = {
58 (struct gpio_port_t *) FIO0_FLAG_D, 58 (struct gpio_port_t *) FIO0_FLAG_D,
59 (struct gpio_port_t *) FIO1_FLAG_D, 59 (struct gpio_port_t *) FIO1_FLAG_D,
60 (struct gpio_port_t *) FIO2_FLAG_D, 60 (struct gpio_port_t *) FIO2_FLAG_D,
61#elif defined(CONFIG_BF54x) 61#elif defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
62 (struct gpio_port_t *)PORTA_FER, 62 (struct gpio_port_t *)PORTA_FER,
63 (struct gpio_port_t *)PORTB_FER, 63 (struct gpio_port_t *)PORTB_FER,
64 (struct gpio_port_t *)PORTC_FER, 64 (struct gpio_port_t *)PORTC_FER,
@@ -66,9 +66,11 @@ static struct gpio_port_t * const gpio_array[] = {
66 (struct gpio_port_t *)PORTE_FER, 66 (struct gpio_port_t *)PORTE_FER,
67 (struct gpio_port_t *)PORTF_FER, 67 (struct gpio_port_t *)PORTF_FER,
68 (struct gpio_port_t *)PORTG_FER, 68 (struct gpio_port_t *)PORTG_FER,
69# if defined(CONFIG_BF54x)
69 (struct gpio_port_t *)PORTH_FER, 70 (struct gpio_port_t *)PORTH_FER,
70 (struct gpio_port_t *)PORTI_FER, 71 (struct gpio_port_t *)PORTI_FER,
71 (struct gpio_port_t *)PORTJ_FER, 72 (struct gpio_port_t *)PORTJ_FER,
73# endif
72#else 74#else
73# error no gpio arrays defined 75# error no gpio arrays defined
74#endif 76#endif
@@ -210,7 +212,7 @@ static void port_setup(unsigned gpio, unsigned short usage)
210 else 212 else
211 *port_fer[gpio_bank(gpio)] |= gpio_bit(gpio); 213 *port_fer[gpio_bank(gpio)] |= gpio_bit(gpio);
212 SSYNC(); 214 SSYNC();
213#elif defined(CONFIG_BF54x) 215#elif defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
214 if (usage == GPIO_USAGE) 216 if (usage == GPIO_USAGE)
215 gpio_array[gpio_bank(gpio)]->port_fer &= ~gpio_bit(gpio); 217 gpio_array[gpio_bank(gpio)]->port_fer &= ~gpio_bit(gpio);
216 else 218 else
@@ -299,7 +301,7 @@ static void portmux_setup(unsigned short per)
299 pmux |= (function << offset); 301 pmux |= (function << offset);
300 bfin_write_PORT_MUX(pmux); 302 bfin_write_PORT_MUX(pmux);
301} 303}
302#elif defined(CONFIG_BF54x) 304#elif defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
303inline void portmux_setup(unsigned short per) 305inline void portmux_setup(unsigned short per)
304{ 306{
305 u16 ident = P_IDENT(per); 307 u16 ident = P_IDENT(per);
@@ -377,7 +379,7 @@ static int portmux_group_check(unsigned short per)
377} 379}
378#endif 380#endif
379 381
380#ifndef CONFIG_BF54x 382#if !(defined(CONFIG_BF54x) || defined(CONFIG_BF60x))
381/*********************************************************** 383/***********************************************************
382* 384*
383* FUNCTIONS: Blackfin General Purpose Ports Access Functions 385* FUNCTIONS: Blackfin General Purpose Ports Access Functions
@@ -680,7 +682,7 @@ void bfin_gpio_pm_hibernate_restore(void)
680 682
681 683
682#endif 684#endif
683#else /* CONFIG_BF54x */ 685#else /* CONFIG_BF54x || CONFIG_BF60x */
684#ifdef CONFIG_PM 686#ifdef CONFIG_PM
685 687
686int bfin_pm_standby_ctrl(unsigned ctrl) 688int bfin_pm_standby_ctrl(unsigned ctrl)
@@ -726,7 +728,7 @@ unsigned short get_gpio_dir(unsigned gpio)
726} 728}
727EXPORT_SYMBOL(get_gpio_dir); 729EXPORT_SYMBOL(get_gpio_dir);
728 730
729#endif /* CONFIG_BF54x */ 731#endif /* CONFIG_BF54x || CONFIG_BF60x */
730 732
731/*********************************************************** 733/***********************************************************
732* 734*
@@ -783,7 +785,7 @@ int peripheral_request(unsigned short per, const char *label)
783 * be requested and used by several drivers 785 * be requested and used by several drivers
784 */ 786 */
785 787
786#ifdef CONFIG_BF54x 788#if defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
787 if (!((per & P_MAYSHARE) && get_portmux(per) == P_FUNCT2MUX(per))) { 789 if (!((per & P_MAYSHARE) && get_portmux(per) == P_FUNCT2MUX(per))) {
788#else 790#else
789 if (!(per & P_MAYSHARE)) { 791 if (!(per & P_MAYSHARE)) {
@@ -937,7 +939,7 @@ int bfin_gpio_request(unsigned gpio, const char *label)
937 printk(KERN_NOTICE "bfin-gpio: GPIO %d is already reserved as gpio-irq!" 939 printk(KERN_NOTICE "bfin-gpio: GPIO %d is already reserved as gpio-irq!"
938 " (Documentation/blackfin/bfin-gpio-notes.txt)\n", gpio); 940 " (Documentation/blackfin/bfin-gpio-notes.txt)\n", gpio);
939 } 941 }
940#ifndef CONFIG_BF54x 942#if !(defined(CONFIG_BF54x) || defined(CONFIG_BF60x))
941 else { /* Reset POLAR setting when acquiring a gpio for the first time */ 943 else { /* Reset POLAR setting when acquiring a gpio for the first time */
942 set_gpio_polar(gpio, 0); 944 set_gpio_polar(gpio, 0);
943 } 945 }
@@ -1110,7 +1112,7 @@ void bfin_gpio_irq_free(unsigned gpio)
1110 1112
1111static inline void __bfin_gpio_direction_input(unsigned gpio) 1113static inline void __bfin_gpio_direction_input(unsigned gpio)
1112{ 1114{
1113#ifdef CONFIG_BF54x 1115#if defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
1114 gpio_array[gpio_bank(gpio)]->dir_clear = gpio_bit(gpio); 1116 gpio_array[gpio_bank(gpio)]->dir_clear = gpio_bit(gpio);
1115#else 1117#else
1116 gpio_array[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio); 1118 gpio_array[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio);
@@ -1138,13 +1140,13 @@ EXPORT_SYMBOL(bfin_gpio_direction_input);
1138 1140
1139void bfin_gpio_irq_prepare(unsigned gpio) 1141void bfin_gpio_irq_prepare(unsigned gpio)
1140{ 1142{
1141#ifdef CONFIG_BF54x 1143#if defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
1142 unsigned long flags; 1144 unsigned long flags;
1143#endif 1145#endif
1144 1146
1145 port_setup(gpio, GPIO_USAGE); 1147 port_setup(gpio, GPIO_USAGE);
1146 1148
1147#ifdef CONFIG_BF54x 1149#if defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
1148 flags = hard_local_irq_save(); 1150 flags = hard_local_irq_save();
1149 __bfin_gpio_direction_input(gpio); 1151 __bfin_gpio_direction_input(gpio);
1150 hard_local_irq_restore(flags); 1152 hard_local_irq_restore(flags);
@@ -1173,7 +1175,7 @@ int bfin_gpio_direction_output(unsigned gpio, int value)
1173 1175
1174 gpio_array[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio); 1176 gpio_array[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio);
1175 gpio_set_value(gpio, value); 1177 gpio_set_value(gpio, value);
1176#ifdef CONFIG_BF54x 1178#if defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
1177 gpio_array[gpio_bank(gpio)]->dir_set = gpio_bit(gpio); 1179 gpio_array[gpio_bank(gpio)]->dir_set = gpio_bit(gpio);
1178#else 1180#else
1179 gpio_array[gpio_bank(gpio)]->dir |= gpio_bit(gpio); 1181 gpio_array[gpio_bank(gpio)]->dir |= gpio_bit(gpio);
@@ -1188,7 +1190,7 @@ EXPORT_SYMBOL(bfin_gpio_direction_output);
1188 1190
1189int bfin_gpio_get_value(unsigned gpio) 1191int bfin_gpio_get_value(unsigned gpio)
1190{ 1192{
1191#ifdef CONFIG_BF54x 1193#if defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
1192 return (1 & (gpio_array[gpio_bank(gpio)]->data >> gpio_sub_n(gpio))); 1194 return (1 & (gpio_array[gpio_bank(gpio)]->data >> gpio_sub_n(gpio)));
1193#else 1195#else
1194 unsigned long flags; 1196 unsigned long flags;
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbinit.c b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
index 886e00014d75..3e366dc2d6e1 100644
--- a/arch/blackfin/kernel/cplb-nompu/cplbinit.c
+++ b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
@@ -139,7 +139,7 @@ void __init generate_cplb_tables_all(void)
139 dcplb_bounds[i_d].eaddr = BOOT_ROM_START; 139 dcplb_bounds[i_d].eaddr = BOOT_ROM_START;
140 dcplb_bounds[i_d++].data = 0; 140 dcplb_bounds[i_d++].data = 0;
141 /* BootROM -- largest one should be less than 1 meg. */ 141 /* BootROM -- largest one should be less than 1 meg. */
142 dcplb_bounds[i_d].eaddr = BOOT_ROM_START + (1 * 1024 * 1024); 142 dcplb_bounds[i_d].eaddr = BOOT_ROM_START + BOOT_ROM_LENGTH;
143 dcplb_bounds[i_d++].data = SDRAM_DGENERIC; 143 dcplb_bounds[i_d++].data = SDRAM_DGENERIC;
144 if (L2_LENGTH) { 144 if (L2_LENGTH) {
145 /* Addressing hole up to L2 SRAM. */ 145 /* Addressing hole up to L2 SRAM. */
@@ -178,7 +178,7 @@ void __init generate_cplb_tables_all(void)
178 icplb_bounds[i_i].eaddr = BOOT_ROM_START; 178 icplb_bounds[i_i].eaddr = BOOT_ROM_START;
179 icplb_bounds[i_i++].data = 0; 179 icplb_bounds[i_i++].data = 0;
180 /* BootROM -- largest one should be less than 1 meg. */ 180 /* BootROM -- largest one should be less than 1 meg. */
181 icplb_bounds[i_i].eaddr = BOOT_ROM_START + (1 * 1024 * 1024); 181 icplb_bounds[i_i].eaddr = BOOT_ROM_START + BOOT_ROM_LENGTH;
182 icplb_bounds[i_i++].data = SDRAM_IGENERIC; 182 icplb_bounds[i_i++].data = SDRAM_IGENERIC;
183 183
184 if (L2_LENGTH) { 184 if (L2_LENGTH) {
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbmgr.c b/arch/blackfin/kernel/cplb-nompu/cplbmgr.c
index 5b88861d6183..e854f9066cbd 100644
--- a/arch/blackfin/kernel/cplb-nompu/cplbmgr.c
+++ b/arch/blackfin/kernel/cplb-nompu/cplbmgr.c
@@ -179,6 +179,12 @@ MGR_ATTR static int dcplb_miss(int cpu)
179 addr = addr1; 179 addr = addr1;
180 } 180 }
181 181
182#ifdef CONFIG_BF60x
183 if ((addr >= ASYNC_BANK0_BASE)
184 && (addr < ASYNC_BANK3_BASE + ASYNC_BANK3_SIZE))
185 d_data |= PAGE_SIZE_64MB;
186#endif
187
182 /* Pick entry to evict */ 188 /* Pick entry to evict */
183 idx = evict_one_dcplb(cpu); 189 idx = evict_one_dcplb(cpu);
184 190
diff --git a/arch/blackfin/kernel/debug-mmrs.c b/arch/blackfin/kernel/debug-mmrs.c
index 92f664826281..01232a13470d 100644
--- a/arch/blackfin/kernel/debug-mmrs.c
+++ b/arch/blackfin/kernel/debug-mmrs.c
@@ -105,6 +105,7 @@ DEFINE_SYSREG(seqstat, , );
105DEFINE_SYSREG(syscfg, , CSYNC()); 105DEFINE_SYSREG(syscfg, , CSYNC());
106#define D_SYSREG(sr) debugfs_create_file(#sr, S_IRUSR|S_IWUSR, parent, NULL, &fops_sysreg_##sr) 106#define D_SYSREG(sr) debugfs_create_file(#sr, S_IRUSR|S_IWUSR, parent, NULL, &fops_sysreg_##sr)
107 107
108#ifndef CONFIG_BF60x
108/* 109/*
109 * CAN 110 * CAN
110 */ 111 */
@@ -223,8 +224,10 @@ bfin_debug_mmrs_dma(struct dentry *parent, unsigned long base, int num, char mdm
223 __DMA(CURR_DESC_PTR, curr_desc_ptr); 224 __DMA(CURR_DESC_PTR, curr_desc_ptr);
224 __DMA(CURR_ADDR, curr_addr); 225 __DMA(CURR_ADDR, curr_addr);
225 __DMA(IRQ_STATUS, irq_status); 226 __DMA(IRQ_STATUS, irq_status);
227#ifndef CONFIG_BF60x
226 if (strcmp(pfx, "IMDMA") != 0) 228 if (strcmp(pfx, "IMDMA") != 0)
227 __DMA(PERIPHERAL_MAP, peripheral_map); 229 __DMA(PERIPHERAL_MAP, peripheral_map);
230#endif
228 __DMA(CURR_X_COUNT, curr_x_count); 231 __DMA(CURR_X_COUNT, curr_x_count);
229 __DMA(CURR_Y_COUNT, curr_y_count); 232 __DMA(CURR_Y_COUNT, curr_y_count);
230} 233}
@@ -568,7 +571,7 @@ bfin_debug_mmrs_uart(struct dentry *parent, unsigned long base, int num)
568#endif 571#endif
569} 572}
570#define UART(num) bfin_debug_mmrs_uart(parent, UART##num##_DLL, num) 573#define UART(num) bfin_debug_mmrs_uart(parent, UART##num##_DLL, num)
571 574#endif /* CONFIG_BF60x */
572/* 575/*
573 * The actual debugfs generation 576 * The actual debugfs generation
574 */ 577 */
@@ -740,7 +743,7 @@ static int __init bfin_debug_mmrs_init(void)
740 D32(WPDACNT0); 743 D32(WPDACNT0);
741 D32(WPDACNT1); 744 D32(WPDACNT1);
742 D32(WPSTAT); 745 D32(WPSTAT);
743 746#ifndef CONFIG_BF60x
744 /* System MMRs */ 747 /* System MMRs */
745#ifdef ATAPI_CONTROL 748#ifdef ATAPI_CONTROL
746 parent = debugfs_create_dir("atapi", top); 749 parent = debugfs_create_dir("atapi", top);
@@ -1873,7 +1876,7 @@ static int __init bfin_debug_mmrs_init(void)
1873 1876
1874 } 1877 }
1875#endif /* BF54x */ 1878#endif /* BF54x */
1876 1879#endif /* CONFIG_BF60x */
1877 debug_mmrs_dentry = top; 1880 debug_mmrs_dentry = top;
1878 1881
1879 return 0; 1882 return 0;
diff --git a/arch/blackfin/kernel/entry.S b/arch/blackfin/kernel/entry.S
index 686478f5f66b..f33792cc1a0d 100644
--- a/arch/blackfin/kernel/entry.S
+++ b/arch/blackfin/kernel/entry.S
@@ -64,16 +64,6 @@ ENTRY(_ret_from_fork)
64 jump (p0); 64 jump (p0);
65ENDPROC(_ret_from_fork) 65ENDPROC(_ret_from_fork)
66 66
67ENTRY(_sys_fork)
68 r0 = -EINVAL;
69#if (ANOMALY_05000371)
70 nop;
71 nop;
72 nop;
73#endif
74 rts;
75ENDPROC(_sys_fork)
76
77ENTRY(_sys_vfork) 67ENTRY(_sys_vfork)
78 r0 = sp; 68 r0 = sp;
79 r0 += 24; 69 r0 += 24;
diff --git a/arch/blackfin/kernel/gptimers.c b/arch/blackfin/kernel/gptimers.c
index 06459f4bf43a..d776773d3869 100644
--- a/arch/blackfin/kernel/gptimers.c
+++ b/arch/blackfin/kernel/gptimers.c
@@ -23,7 +23,11 @@
23 printk(KERN_DEBUG "%s:%s:%i: Assertion failed: " #expr "\n", __FILE__, __func__, __LINE__); 23 printk(KERN_DEBUG "%s:%s:%i: Assertion failed: " #expr "\n", __FILE__, __func__, __LINE__);
24#endif 24#endif
25 25
26#define BFIN_TIMER_NUM_GROUP (BFIN_TIMER_OCTET(MAX_BLACKFIN_GPTIMERS - 1) + 1) 26#ifndef CONFIG_BF60x
27# define BFIN_TIMER_NUM_GROUP (BFIN_TIMER_OCTET(MAX_BLACKFIN_GPTIMERS - 1) + 1)
28#else
29# define BFIN_TIMER_NUM_GROUP 1
30#endif
27 31
28static struct bfin_gptimer_regs * const timer_regs[MAX_BLACKFIN_GPTIMERS] = 32static struct bfin_gptimer_regs * const timer_regs[MAX_BLACKFIN_GPTIMERS] =
29{ 33{
@@ -158,6 +162,74 @@ uint32_t get_gptimer_count(unsigned int timer_id)
158} 162}
159EXPORT_SYMBOL(get_gptimer_count); 163EXPORT_SYMBOL(get_gptimer_count);
160 164
165#ifdef CONFIG_BF60x
166void set_gptimer_delay(unsigned int timer_id, uint32_t delay)
167{
168 tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
169 bfin_write(&timer_regs[timer_id]->delay, delay);
170 SSYNC();
171}
172EXPORT_SYMBOL(set_gptimer_delay);
173
174uint32_t get_gptimer_delay(unsigned int timer_id)
175{
176 tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
177 return bfin_read(&timer_regs[timer_id]->delay);
178}
179EXPORT_SYMBOL(get_gptimer_delay);
180#endif
181
182#ifdef CONFIG_BF60x
183int get_gptimer_intr(unsigned int timer_id)
184{
185 tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
186 return !!(bfin_read(&group_regs[BFIN_TIMER_OCTET(timer_id)]->data_ilat) & timil_mask[timer_id]);
187}
188EXPORT_SYMBOL(get_gptimer_intr);
189
190void clear_gptimer_intr(unsigned int timer_id)
191{
192 tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
193 bfin_write(&group_regs[BFIN_TIMER_OCTET(timer_id)]->data_ilat, timil_mask[timer_id]);
194}
195EXPORT_SYMBOL(clear_gptimer_intr);
196
197int get_gptimer_over(unsigned int timer_id)
198{
199 tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
200 return !!(bfin_read(&group_regs[BFIN_TIMER_OCTET(timer_id)]->stat_ilat) & tovf_mask[timer_id]);
201}
202EXPORT_SYMBOL(get_gptimer_over);
203
204void clear_gptimer_over(unsigned int timer_id)
205{
206 tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
207 bfin_write(&group_regs[BFIN_TIMER_OCTET(timer_id)]->stat_ilat, tovf_mask[timer_id]);
208}
209EXPORT_SYMBOL(clear_gptimer_over);
210
211int get_gptimer_run(unsigned int timer_id)
212{
213 tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
214 return !!(bfin_read(&group_regs[BFIN_TIMER_OCTET(timer_id)]->run) & trun_mask[timer_id]);
215}
216EXPORT_SYMBOL(get_gptimer_run);
217
218uint32_t get_gptimer_status(unsigned int group)
219{
220 tassert(group < BFIN_TIMER_NUM_GROUP);
221 return bfin_read(&group_regs[group]->data_ilat);
222}
223EXPORT_SYMBOL(get_gptimer_status);
224
225void set_gptimer_status(unsigned int group, uint32_t value)
226{
227 tassert(group < BFIN_TIMER_NUM_GROUP);
228 bfin_write(&group_regs[group]->data_ilat, value);
229 SSYNC();
230}
231EXPORT_SYMBOL(set_gptimer_status);
232#else
161uint32_t get_gptimer_status(unsigned int group) 233uint32_t get_gptimer_status(unsigned int group)
162{ 234{
163 tassert(group < BFIN_TIMER_NUM_GROUP); 235 tassert(group < BFIN_TIMER_NUM_GROUP);
@@ -212,6 +284,7 @@ int get_gptimer_run(unsigned int timer_id)
212 return !!(read_gptimer_status(timer_id) & trun_mask[timer_id]); 284 return !!(read_gptimer_status(timer_id) & trun_mask[timer_id]);
213} 285}
214EXPORT_SYMBOL(get_gptimer_run); 286EXPORT_SYMBOL(get_gptimer_run);
287#endif
215 288
216void set_gptimer_config(unsigned int timer_id, uint16_t config) 289void set_gptimer_config(unsigned int timer_id, uint16_t config)
217{ 290{
@@ -231,6 +304,12 @@ EXPORT_SYMBOL(get_gptimer_config);
231void enable_gptimers(uint16_t mask) 304void enable_gptimers(uint16_t mask)
232{ 305{
233 int i; 306 int i;
307#ifdef CONFIG_BF60x
308 uint16_t imask;
309 imask = bfin_read16(TIMER_DATA_IMSK);
310 imask &= ~mask;
311 bfin_write16(TIMER_DATA_IMSK, imask);
312#endif
234 tassert((mask & ~BLACKFIN_GPTIMER_IDMASK) == 0); 313 tassert((mask & ~BLACKFIN_GPTIMER_IDMASK) == 0);
235 for (i = 0; i < BFIN_TIMER_NUM_GROUP; ++i) { 314 for (i = 0; i < BFIN_TIMER_NUM_GROUP; ++i) {
236 bfin_write(&group_regs[i]->enable, mask & 0xFF); 315 bfin_write(&group_regs[i]->enable, mask & 0xFF);
@@ -253,12 +332,16 @@ static void _disable_gptimers(uint16_t mask)
253 332
254void disable_gptimers(uint16_t mask) 333void disable_gptimers(uint16_t mask)
255{ 334{
335#ifndef CONFIG_BF60x
256 int i; 336 int i;
257 _disable_gptimers(mask); 337 _disable_gptimers(mask);
258 for (i = 0; i < MAX_BLACKFIN_GPTIMERS; ++i) 338 for (i = 0; i < MAX_BLACKFIN_GPTIMERS; ++i)
259 if (mask & (1 << i)) 339 if (mask & (1 << i))
260 bfin_write(&group_regs[BFIN_TIMER_OCTET(i)]->status, trun_mask[i]); 340 bfin_write(&group_regs[BFIN_TIMER_OCTET(i)]->status, trun_mask[i]);
261 SSYNC(); 341 SSYNC();
342#else
343 _disable_gptimers(mask);
344#endif
262} 345}
263EXPORT_SYMBOL(disable_gptimers); 346EXPORT_SYMBOL(disable_gptimers);
264 347
diff --git a/arch/blackfin/kernel/init_task.c b/arch/blackfin/kernel/init_task.c
deleted file mode 100644
index d3970e8acd1a..000000000000
--- a/arch/blackfin/kernel/init_task.c
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * Copyright 2004-2009 Analog Devices Inc.
3 *
4 * Licensed under the GPL-2 or later
5 */
6
7#include <linux/mm.h>
8#include <linux/module.h>
9#include <linux/init_task.h>
10#include <linux/mqueue.h>
11#include <linux/fs.h>
12
13static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
15/*
16 * Initial task structure.
17 *
18 * All other task structs will be allocated on slabs in fork.c
19 */
20struct task_struct init_task = INIT_TASK(init_task);
21EXPORT_SYMBOL(init_task);
22
23/*
24 * Initial thread structure.
25 *
26 * We need to make sure that this is 8192-byte aligned due to the
27 * way process stacks are handled. This is done by having a special
28 * "init_task" linker map entry.
29 */
30union thread_union init_thread_union
31 __init_task_data = {
32INIT_THREAD_INFO(init_task)};
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index c0f4fe287eb6..2e3994b20169 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -95,7 +95,9 @@ void cpu_idle(void)
95 idle(); 95 idle();
96 rcu_idle_exit(); 96 rcu_idle_exit();
97 tick_nohz_idle_exit(); 97 tick_nohz_idle_exit();
98 schedule_preempt_disabled(); 98 preempt_enable_no_resched();
99 schedule();
100 preempt_disable();
99 } 101 }
100} 102}
101 103
@@ -329,12 +331,16 @@ int in_mem_const(unsigned long addr, unsigned long size,
329{ 331{
330 return in_mem_const_off(addr, size, 0, const_addr, const_size); 332 return in_mem_const_off(addr, size, 0, const_addr, const_size);
331} 333}
334#ifdef CONFIG_BF60x
335#define ASYNC_ENABLED(bnum, bctlnum) 1
336#else
332#define ASYNC_ENABLED(bnum, bctlnum) \ 337#define ASYNC_ENABLED(bnum, bctlnum) \
333({ \ 338({ \
334 (bfin_read_EBIU_AMGCTL() & 0xe) < ((bnum + 1) << 1) ? 0 : \ 339 (bfin_read_EBIU_AMGCTL() & 0xe) < ((bnum + 1) << 1) ? 0 : \
335 bfin_read_EBIU_AMBCTL##bctlnum() & B##bnum##RDYEN ? 0 : \ 340 bfin_read_EBIU_AMBCTL##bctlnum() & B##bnum##RDYEN ? 0 : \
336 1; \ 341 1; \
337}) 342})
343#endif
338/* 344/*
339 * We can't read EBIU banks that aren't enabled or we end up hanging 345 * We can't read EBIU banks that aren't enabled or we end up hanging
340 * on the access to the async space. Make sure we validate accesses 346 * on the access to the async space. Make sure we validate accesses
diff --git a/arch/blackfin/kernel/reboot.c b/arch/blackfin/kernel/reboot.c
index b0434f89e8de..5272e6eefd92 100644
--- a/arch/blackfin/kernel/reboot.c
+++ b/arch/blackfin/kernel/reboot.c
@@ -22,6 +22,7 @@
22__attribute__ ((__l1_text__, __noreturn__)) 22__attribute__ ((__l1_text__, __noreturn__))
23static void bfin_reset(void) 23static void bfin_reset(void)
24{ 24{
25#ifndef CONFIG_BF60x
25 if (!ANOMALY_05000353 && !ANOMALY_05000386) 26 if (!ANOMALY_05000353 && !ANOMALY_05000386)
26 bfrom_SoftReset((void *)(L1_SCRATCH_START + L1_SCRATCH_LENGTH - 20)); 27 bfrom_SoftReset((void *)(L1_SCRATCH_START + L1_SCRATCH_LENGTH - 20));
27 28
@@ -57,7 +58,6 @@ static void bfin_reset(void)
57 if (__SILICON_REVISION__ < 1 && bfin_revid() < 1) 58 if (__SILICON_REVISION__ < 1 && bfin_revid() < 1)
58 bfin_read_SWRST(); 59 bfin_read_SWRST();
59#endif 60#endif
60
61 /* Wait for the SWRST write to complete. Cannot rely on SSYNC 61 /* Wait for the SWRST write to complete. Cannot rely on SSYNC
62 * though as the System state is all reset now. 62 * though as the System state is all reset now.
63 */ 63 */
@@ -72,6 +72,10 @@ static void bfin_reset(void)
72 while (1) 72 while (1)
73 /* Issue core reset */ 73 /* Issue core reset */
74 asm("raise 1"); 74 asm("raise 1");
75#else
76 while (1)
77 bfin_write_RCU0_CTL(0x1);
78#endif
75} 79}
76 80
77__attribute__((weak)) 81__attribute__((weak))
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 2ad747e909fb..ada8f0fc71e4 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -25,12 +25,16 @@
25#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
26#include <asm/blackfin.h> 26#include <asm/blackfin.h>
27#include <asm/cplbinit.h> 27#include <asm/cplbinit.h>
28#include <asm/clocks.h>
28#include <asm/div64.h> 29#include <asm/div64.h>
29#include <asm/cpu.h> 30#include <asm/cpu.h>
30#include <asm/fixed_code.h> 31#include <asm/fixed_code.h>
31#include <asm/early_printk.h> 32#include <asm/early_printk.h>
32#include <asm/irq_handler.h> 33#include <asm/irq_handler.h>
33#include <asm/pda.h> 34#include <asm/pda.h>
35#ifdef CONFIG_BF60x
36#include <mach/pm.h>
37#endif
34 38
35u16 _bfin_swrst; 39u16 _bfin_swrst;
36EXPORT_SYMBOL(_bfin_swrst); 40EXPORT_SYMBOL(_bfin_swrst);
@@ -550,7 +554,6 @@ static __init void memory_setup(void)
550{ 554{
551#ifdef CONFIG_MTD_UCLINUX 555#ifdef CONFIG_MTD_UCLINUX
552 unsigned long mtd_phys = 0; 556 unsigned long mtd_phys = 0;
553 unsigned long n;
554#endif 557#endif
555 unsigned long max_mem; 558 unsigned long max_mem;
556 559
@@ -594,9 +597,9 @@ static __init void memory_setup(void)
594 mtd_size = PAGE_ALIGN(*((unsigned long *)(mtd_phys + 8))); 597 mtd_size = PAGE_ALIGN(*((unsigned long *)(mtd_phys + 8)));
595 598
596# if defined(CONFIG_EXT2_FS) || defined(CONFIG_EXT3_FS) 599# if defined(CONFIG_EXT2_FS) || defined(CONFIG_EXT3_FS)
597 n = ext2_image_size((void *)(mtd_phys + 0x400)); 600 if (*((unsigned short *)(mtd_phys + 0x438)) == EXT2_SUPER_MAGIC)
598 if (n) 601 mtd_size =
599 mtd_size = PAGE_ALIGN(n * 1024); 602 PAGE_ALIGN(*((unsigned long *)(mtd_phys + 0x404)) << 10);
600# endif 603# endif
601 604
602# if defined(CONFIG_CRAMFS) 605# if defined(CONFIG_CRAMFS)
@@ -612,7 +615,8 @@ static __init void memory_setup(void)
612 615
613 /* ROM_FS is XIP, so if we found it, we need to limit memory */ 616 /* ROM_FS is XIP, so if we found it, we need to limit memory */
614 if (memory_end > max_mem) { 617 if (memory_end > max_mem) {
615 pr_info("Limiting kernel memory to %liMB due to anomaly 05000263\n", max_mem >> 20); 618 pr_info("Limiting kernel memory to %liMB due to anomaly 05000263\n",
619 (max_mem - CONFIG_PHY_RAM_BASE_ADDRESS) >> 20);
616 memory_end = max_mem; 620 memory_end = max_mem;
617 } 621 }
618 } 622 }
@@ -642,7 +646,8 @@ static __init void memory_setup(void)
642 * doesn't exist, or we don't need to - then dont. 646 * doesn't exist, or we don't need to - then dont.
643 */ 647 */
644 if (memory_end > max_mem) { 648 if (memory_end > max_mem) {
645 pr_info("Limiting kernel memory to %liMB due to anomaly 05000263\n", max_mem >> 20); 649 pr_info("Limiting kernel memory to %liMB due to anomaly 05000263\n",
650 (max_mem - CONFIG_PHY_RAM_BASE_ADDRESS) >> 20);
646 memory_end = max_mem; 651 memory_end = max_mem;
647 } 652 }
648 653
@@ -661,8 +666,8 @@ static __init void memory_setup(void)
661 init_mm.end_data = (unsigned long)_edata; 666 init_mm.end_data = (unsigned long)_edata;
662 init_mm.brk = (unsigned long)0; 667 init_mm.brk = (unsigned long)0;
663 668
664 printk(KERN_INFO "Board Memory: %ldMB\n", physical_mem_end >> 20); 669 printk(KERN_INFO "Board Memory: %ldMB\n", (physical_mem_end - CONFIG_PHY_RAM_BASE_ADDRESS) >> 20);
665 printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20); 670 printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", (_ramend - CONFIG_PHY_RAM_BASE_ADDRESS) >> 20);
666 671
667 printk(KERN_INFO "Memory map:\n" 672 printk(KERN_INFO "Memory map:\n"
668 " fixedcode = 0x%p-0x%p\n" 673 " fixedcode = 0x%p-0x%p\n"
@@ -705,7 +710,7 @@ void __init find_min_max_pfn(void)
705 int i; 710 int i;
706 711
707 max_pfn = 0; 712 max_pfn = 0;
708 min_low_pfn = memory_end; 713 min_low_pfn = PFN_DOWN(memory_end);
709 714
710 for (i = 0; i < bfin_memmap.nr_map; i++) { 715 for (i = 0; i < bfin_memmap.nr_map; i++) {
711 unsigned long start, end; 716 unsigned long start, end;
@@ -748,8 +753,7 @@ static __init void setup_bootmem_allocator(void)
748 /* pfn of the first usable page frame after kernel image*/ 753 /* pfn of the first usable page frame after kernel image*/
749 if (min_low_pfn < memory_start >> PAGE_SHIFT) 754 if (min_low_pfn < memory_start >> PAGE_SHIFT)
750 min_low_pfn = memory_start >> PAGE_SHIFT; 755 min_low_pfn = memory_start >> PAGE_SHIFT;
751 756 start_pfn = CONFIG_PHY_RAM_BASE_ADDRESS >> PAGE_SHIFT;
752 start_pfn = PAGE_OFFSET >> PAGE_SHIFT;
753 end_pfn = memory_end >> PAGE_SHIFT; 757 end_pfn = memory_end >> PAGE_SHIFT;
754 758
755 /* 759 /*
@@ -794,8 +798,8 @@ static __init void setup_bootmem_allocator(void)
794 } 798 }
795 799
796 /* reserve memory before memory_start, including bootmap */ 800 /* reserve memory before memory_start, including bootmap */
797 reserve_bootmem(PAGE_OFFSET, 801 reserve_bootmem(CONFIG_PHY_RAM_BASE_ADDRESS,
798 memory_start + bootmap_size + PAGE_SIZE - 1 - PAGE_OFFSET, 802 memory_start + bootmap_size + PAGE_SIZE - 1 - CONFIG_PHY_RAM_BASE_ADDRESS,
799 BOOTMEM_DEFAULT); 803 BOOTMEM_DEFAULT);
800} 804}
801 805
@@ -844,13 +848,40 @@ static inline int __init get_mem_size(void)
844 break; 848 break;
845 } 849 }
846 switch (ddrctl & 0x30000) { 850 switch (ddrctl & 0x30000) {
847 case DEVWD_4: ret *= 2; 851 case DEVWD_4:
848 case DEVWD_8: ret *= 2; 852 ret *= 2;
849 case DEVWD_16: break; 853 case DEVWD_8:
854 ret *= 2;
855 case DEVWD_16:
856 break;
850 } 857 }
851 if ((ddrctl & 0xc000) == 0x4000) 858 if ((ddrctl & 0xc000) == 0x4000)
852 ret *= 2; 859 ret *= 2;
853 return ret; 860 return ret;
861#elif defined(CONFIG_BF60x)
862 u32 ddrctl = bfin_read_DMC0_CFG();
863 int ret;
864 switch (ddrctl & 0xf00) {
865 case DEVSZ_64:
866 ret = 64 / 8;
867 break;
868 case DEVSZ_128:
869 ret = 128 / 8;
870 break;
871 case DEVSZ_256:
872 ret = 256 / 8;
873 break;
874 case DEVSZ_512:
875 ret = 512 / 8;
876 break;
877 case DEVSZ_1G:
878 ret = 1024 / 8;
879 break;
880 case DEVSZ_2G:
881 ret = 2048 / 8;
882 break;
883 }
884 return ret;
854#endif 885#endif
855 BUG(); 886 BUG();
856} 887}
@@ -860,6 +891,22 @@ void __init native_machine_early_platform_add_devices(void)
860{ 891{
861} 892}
862 893
894#ifdef CONFIG_BF60x
895static inline u_long bfin_get_clk(char *name)
896{
897 struct clk *clk;
898 u_long clk_rate;
899
900 clk = clk_get(NULL, name);
901 if (IS_ERR(clk))
902 return 0;
903
904 clk_rate = clk_get_rate(clk);
905 clk_put(clk);
906 return clk_rate;
907}
908#endif
909
863void __init setup_arch(char **cmdline_p) 910void __init setup_arch(char **cmdline_p)
864{ 911{
865 u32 mmr; 912 u32 mmr;
@@ -870,6 +917,7 @@ void __init setup_arch(char **cmdline_p)
870 enable_shadow_console(); 917 enable_shadow_console();
871 918
872 /* Check to make sure we are running on the right processor */ 919 /* Check to make sure we are running on the right processor */
920 mmr = bfin_cpuid();
873 if (unlikely(CPUID != bfin_cpuid())) 921 if (unlikely(CPUID != bfin_cpuid()))
874 printk(KERN_ERR "ERROR: Not running on ADSP-%s: unknown CPUID 0x%04x Rev 0.%d\n", 922 printk(KERN_ERR "ERROR: Not running on ADSP-%s: unknown CPUID 0x%04x Rev 0.%d\n",
875 CPU, bfin_cpuid(), bfin_revid()); 923 CPU, bfin_cpuid(), bfin_revid());
@@ -890,6 +938,10 @@ void __init setup_arch(char **cmdline_p)
890 938
891 memset(&bfin_memmap, 0, sizeof(bfin_memmap)); 939 memset(&bfin_memmap, 0, sizeof(bfin_memmap));
892 940
941#ifdef CONFIG_BF60x
942 /* Should init clock device before parse command early */
943 clk_init();
944#endif
893 /* If the user does not specify things on the command line, use 945 /* If the user does not specify things on the command line, use
894 * what the bootloader set things up as 946 * what the bootloader set things up as
895 */ 947 */
@@ -904,6 +956,7 @@ void __init setup_arch(char **cmdline_p)
904 956
905 memory_setup(); 957 memory_setup();
906 958
959#ifndef CONFIG_BF60x
907 /* Initialize Async memory banks */ 960 /* Initialize Async memory banks */
908 bfin_write_EBIU_AMBCTL0(AMBCTL0VAL); 961 bfin_write_EBIU_AMBCTL0(AMBCTL0VAL);
909 bfin_write_EBIU_AMBCTL1(AMBCTL1VAL); 962 bfin_write_EBIU_AMBCTL1(AMBCTL1VAL);
@@ -913,6 +966,7 @@ void __init setup_arch(char **cmdline_p)
913 bfin_write_EBIU_MODE(CONFIG_EBIU_MODEVAL); 966 bfin_write_EBIU_MODE(CONFIG_EBIU_MODEVAL);
914 bfin_write_EBIU_FCTL(CONFIG_EBIU_FCTLVAL); 967 bfin_write_EBIU_FCTL(CONFIG_EBIU_FCTLVAL);
915#endif 968#endif
969#endif
916#ifdef CONFIG_BFIN_HYSTERESIS_CONTROL 970#ifdef CONFIG_BFIN_HYSTERESIS_CONTROL
917 bfin_write_PORTF_HYSTERESIS(HYST_PORTF_0_15); 971 bfin_write_PORTF_HYSTERESIS(HYST_PORTF_0_15);
918 bfin_write_PORTG_HYSTERESIS(HYST_PORTG_0_15); 972 bfin_write_PORTG_HYSTERESIS(HYST_PORTG_0_15);
@@ -938,7 +992,7 @@ void __init setup_arch(char **cmdline_p)
938 printk(KERN_INFO "Hardware Trace %s and %sabled\n", 992 printk(KERN_INFO "Hardware Trace %s and %sabled\n",
939 (mmr & 0x1) ? "active" : "off", 993 (mmr & 0x1) ? "active" : "off",
940 (mmr & 0x2) ? "en" : "dis"); 994 (mmr & 0x2) ? "en" : "dis");
941 995#ifndef CONFIG_BF60x
942 mmr = bfin_read_SYSCR(); 996 mmr = bfin_read_SYSCR();
943 printk(KERN_INFO "Boot Mode: %i\n", mmr & 0xF); 997 printk(KERN_INFO "Boot Mode: %i\n", mmr & 0xF);
944 998
@@ -980,7 +1034,7 @@ void __init setup_arch(char **cmdline_p)
980 printk(KERN_INFO "Recovering from Watchdog event\n"); 1034 printk(KERN_INFO "Recovering from Watchdog event\n");
981 else if (_bfin_swrst & RESET_SOFTWARE) 1035 else if (_bfin_swrst & RESET_SOFTWARE)
982 printk(KERN_NOTICE "Reset caused by Software reset\n"); 1036 printk(KERN_NOTICE "Reset caused by Software reset\n");
983 1037#endif
984 printk(KERN_INFO "Blackfin support (C) 2004-2010 Analog Devices, Inc.\n"); 1038 printk(KERN_INFO "Blackfin support (C) 2004-2010 Analog Devices, Inc.\n");
985 if (bfin_compiled_revid() == 0xffff) 1039 if (bfin_compiled_revid() == 0xffff)
986 printk(KERN_INFO "Compiled for ADSP-%s Rev any, running on 0.%d\n", CPU, bfin_revid()); 1040 printk(KERN_INFO "Compiled for ADSP-%s Rev any, running on 0.%d\n", CPU, bfin_revid());
@@ -1008,8 +1062,13 @@ void __init setup_arch(char **cmdline_p)
1008 1062
1009 printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n"); 1063 printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n");
1010 1064
1065#ifdef CONFIG_BF60x
1066 printk(KERN_INFO "Processor Speed: %lu MHz core clock, %lu MHz SCLk, %lu MHz SCLK0, %lu MHz SCLK1 and %lu MHz DCLK\n",
1067 cclk / 1000000, bfin_get_clk("SYSCLK") / 1000000, get_sclk0() / 1000000, get_sclk1() / 1000000, get_dclk() / 1000000);
1068#else
1011 printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu MHz System Clock\n", 1069 printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu MHz System Clock\n",
1012 cclk / 1000000, sclk / 1000000); 1070 cclk / 1000000, sclk / 1000000);
1071#endif
1013 1072
1014 setup_bootmem_allocator(); 1073 setup_bootmem_allocator();
1015 1074
@@ -1060,10 +1119,12 @@ subsys_initcall(topology_init);
1060 1119
1061/* Get the input clock frequency */ 1120/* Get the input clock frequency */
1062static u_long cached_clkin_hz = CONFIG_CLKIN_HZ; 1121static u_long cached_clkin_hz = CONFIG_CLKIN_HZ;
1122#ifndef CONFIG_BF60x
1063static u_long get_clkin_hz(void) 1123static u_long get_clkin_hz(void)
1064{ 1124{
1065 return cached_clkin_hz; 1125 return cached_clkin_hz;
1066} 1126}
1127#endif
1067static int __init early_init_clkin_hz(char *buf) 1128static int __init early_init_clkin_hz(char *buf)
1068{ 1129{
1069 cached_clkin_hz = simple_strtoul(buf, NULL, 0); 1130 cached_clkin_hz = simple_strtoul(buf, NULL, 0);
@@ -1075,6 +1136,7 @@ static int __init early_init_clkin_hz(char *buf)
1075} 1136}
1076early_param("clkin_hz=", early_init_clkin_hz); 1137early_param("clkin_hz=", early_init_clkin_hz);
1077 1138
1139#ifndef CONFIG_BF60x
1078/* Get the voltage input multiplier */ 1140/* Get the voltage input multiplier */
1079static u_long get_vco(void) 1141static u_long get_vco(void)
1080{ 1142{
@@ -1097,10 +1159,14 @@ static u_long get_vco(void)
1097 cached_vco *= msel; 1159 cached_vco *= msel;
1098 return cached_vco; 1160 return cached_vco;
1099} 1161}
1162#endif
1100 1163
1101/* Get the Core clock */ 1164/* Get the Core clock */
1102u_long get_cclk(void) 1165u_long get_cclk(void)
1103{ 1166{
1167#ifdef CONFIG_BF60x
1168 return bfin_get_clk("CCLK");
1169#else
1104 static u_long cached_cclk_pll_div, cached_cclk; 1170 static u_long cached_cclk_pll_div, cached_cclk;
1105 u_long csel, ssel; 1171 u_long csel, ssel;
1106 1172
@@ -1120,12 +1186,39 @@ u_long get_cclk(void)
1120 else 1186 else
1121 cached_cclk = get_vco() >> csel; 1187 cached_cclk = get_vco() >> csel;
1122 return cached_cclk; 1188 return cached_cclk;
1189#endif
1123} 1190}
1124EXPORT_SYMBOL(get_cclk); 1191EXPORT_SYMBOL(get_cclk);
1125 1192
1126/* Get the System clock */ 1193#ifdef CONFIG_BF60x
1194/* Get the bf60x clock of SCLK0 domain */
1195u_long get_sclk0(void)
1196{
1197 return bfin_get_clk("SCLK0");
1198}
1199EXPORT_SYMBOL(get_sclk0);
1200
1201/* Get the bf60x clock of SCLK1 domain */
1202u_long get_sclk1(void)
1203{
1204 return bfin_get_clk("SCLK1");
1205}
1206EXPORT_SYMBOL(get_sclk1);
1207
1208/* Get the bf60x DRAM clock */
1209u_long get_dclk(void)
1210{
1211 return bfin_get_clk("DCLK");
1212}
1213EXPORT_SYMBOL(get_dclk);
1214#endif
1215
1216/* Get the default system clock */
1127u_long get_sclk(void) 1217u_long get_sclk(void)
1128{ 1218{
1219#ifdef CONFIG_BF60x
1220 return get_sclk0();
1221#else
1129 static u_long cached_sclk; 1222 static u_long cached_sclk;
1130 u_long ssel; 1223 u_long ssel;
1131 1224
@@ -1146,6 +1239,7 @@ u_long get_sclk(void)
1146 1239
1147 cached_sclk = get_vco() / ssel; 1240 cached_sclk = get_vco() / ssel;
1148 return cached_sclk; 1241 return cached_sclk;
1242#endif
1149} 1243}
1150EXPORT_SYMBOL(get_sclk); 1244EXPORT_SYMBOL(get_sclk);
1151 1245
diff --git a/arch/blackfin/kernel/shadow_console.c b/arch/blackfin/kernel/shadow_console.c
index 557e9fef406a..aeb8343eeb03 100644
--- a/arch/blackfin/kernel/shadow_console.c
+++ b/arch/blackfin/kernel/shadow_console.c
@@ -15,9 +15,9 @@
15#include <asm/irq_handler.h> 15#include <asm/irq_handler.h>
16#include <asm/early_printk.h> 16#include <asm/early_printk.h>
17 17
18#define SHADOW_CONSOLE_START (0x500) 18#define SHADOW_CONSOLE_START (CONFIG_PHY_RAM_BASE_ADDRESS + 0x500)
19#define SHADOW_CONSOLE_END (0x1000) 19#define SHADOW_CONSOLE_END (CONFIG_PHY_RAM_BASE_ADDRESS + 0x1000)
20#define SHADOW_CONSOLE_MAGIC_LOC (0x4F0) 20#define SHADOW_CONSOLE_MAGIC_LOC (CONFIG_PHY_RAM_BASE_ADDRESS + 0x4F0)
21#define SHADOW_CONSOLE_MAGIC (0xDEADBEEF) 21#define SHADOW_CONSOLE_MAGIC (0xDEADBEEF)
22 22
23static __initdata char *shadow_console_buffer = (char *)SHADOW_CONSOLE_START; 23static __initdata char *shadow_console_buffer = (char *)SHADOW_CONSOLE_START;
diff --git a/arch/blackfin/kernel/time-ts.c b/arch/blackfin/kernel/time-ts.c
index d98f2d69b0c4..f608f02f29a3 100644
--- a/arch/blackfin/kernel/time-ts.c
+++ b/arch/blackfin/kernel/time-ts.c
@@ -66,8 +66,14 @@ void __init setup_gptimer0(void)
66{ 66{
67 disable_gptimers(TIMER0bit); 67 disable_gptimers(TIMER0bit);
68 68
69#ifdef CONFIG_BF60x
70 bfin_write16(TIMER_DATA_IMSK, 0);
71 set_gptimer_config(TIMER0_id, TIMER_OUT_DIS
72 | TIMER_MODE_PWM_CONT | TIMER_PULSE_HI | TIMER_IRQ_PER);
73#else
69 set_gptimer_config(TIMER0_id, \ 74 set_gptimer_config(TIMER0_id, \
70 TIMER_OUT_DIS | TIMER_PERIOD_CNT | TIMER_MODE_PWM); 75 TIMER_OUT_DIS | TIMER_PERIOD_CNT | TIMER_MODE_PWM);
76#endif
71 set_gptimer_period(TIMER0_id, -1); 77 set_gptimer_period(TIMER0_id, -1);
72 set_gptimer_pwidth(TIMER0_id, -2); 78 set_gptimer_pwidth(TIMER0_id, -2);
73 SSYNC(); 79 SSYNC();
@@ -135,9 +141,15 @@ static void bfin_gptmr0_set_mode(enum clock_event_mode mode,
135{ 141{
136 switch (mode) { 142 switch (mode) {
137 case CLOCK_EVT_MODE_PERIODIC: { 143 case CLOCK_EVT_MODE_PERIODIC: {
144#ifndef CONFIG_BF60x
138 set_gptimer_config(TIMER0_id, \ 145 set_gptimer_config(TIMER0_id, \
139 TIMER_OUT_DIS | TIMER_IRQ_ENA | \ 146 TIMER_OUT_DIS | TIMER_IRQ_ENA | \
140 TIMER_PERIOD_CNT | TIMER_MODE_PWM); 147 TIMER_PERIOD_CNT | TIMER_MODE_PWM);
148#else
149 set_gptimer_config(TIMER0_id, TIMER_OUT_DIS
150 | TIMER_MODE_PWM_CONT | TIMER_PULSE_HI | TIMER_IRQ_PER);
151#endif
152
141 set_gptimer_period(TIMER0_id, get_sclk() / HZ); 153 set_gptimer_period(TIMER0_id, get_sclk() / HZ);
142 set_gptimer_pwidth(TIMER0_id, get_sclk() / HZ - 1); 154 set_gptimer_pwidth(TIMER0_id, get_sclk() / HZ - 1);
143 enable_gptimers(TIMER0bit); 155 enable_gptimers(TIMER0bit);
@@ -145,8 +157,14 @@ static void bfin_gptmr0_set_mode(enum clock_event_mode mode,
145 } 157 }
146 case CLOCK_EVT_MODE_ONESHOT: 158 case CLOCK_EVT_MODE_ONESHOT:
147 disable_gptimers(TIMER0bit); 159 disable_gptimers(TIMER0bit);
160#ifndef CONFIG_BF60x
148 set_gptimer_config(TIMER0_id, \ 161 set_gptimer_config(TIMER0_id, \
149 TIMER_OUT_DIS | TIMER_IRQ_ENA | TIMER_MODE_PWM); 162 TIMER_OUT_DIS | TIMER_IRQ_ENA | TIMER_MODE_PWM);
163#else
164 set_gptimer_config(TIMER0_id, TIMER_OUT_DIS | TIMER_MODE_PWM
165 | TIMER_PULSE_HI | TIMER_IRQ_WID_DLY);
166#endif
167
150 set_gptimer_period(TIMER0_id, 0); 168 set_gptimer_period(TIMER0_id, 0);
151 break; 169 break;
152 case CLOCK_EVT_MODE_UNUSED: 170 case CLOCK_EVT_MODE_UNUSED:
@@ -160,7 +178,7 @@ static void bfin_gptmr0_set_mode(enum clock_event_mode mode,
160 178
161static void bfin_gptmr0_ack(void) 179static void bfin_gptmr0_ack(void)
162{ 180{
163 set_gptimer_status(TIMER_GROUP1, TIMER_STATUS_TIMIL0); 181 clear_gptimer_intr(TIMER0_id);
164} 182}
165 183
166static void __init bfin_gptmr0_init(void) 184static void __init bfin_gptmr0_init(void)
@@ -197,7 +215,7 @@ static struct clock_event_device clockevent_gptmr0 = {
197 .rating = 300, 215 .rating = 300,
198 .irq = IRQ_TIMER0, 216 .irq = IRQ_TIMER0,
199 .shift = 32, 217 .shift = 32,
200 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 218 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
201 .set_next_event = bfin_gptmr0_set_next_event, 219 .set_next_event = bfin_gptmr0_set_next_event,
202 .set_mode = bfin_gptmr0_set_mode, 220 .set_mode = bfin_gptmr0_set_mode,
203}; 221};
@@ -312,6 +330,11 @@ void bfin_coretmr_clockevent_init(void)
312#endif 330#endif
313 331
314 332
333#ifdef CONFIG_SMP
334 evt->broadcast = smp_timer_broadcast;
335#endif
336
337
315 evt->name = "bfin_core_timer"; 338 evt->name = "bfin_core_timer";
316 evt->rating = 350; 339 evt->rating = 350;
317 evt->irq = -1; 340 evt->irq = -1;
diff --git a/arch/blackfin/lib/divsi3.S b/arch/blackfin/lib/divsi3.S
index f89c5a49c47b..ef2cd99efb89 100644
--- a/arch/blackfin/lib/divsi3.S
+++ b/arch/blackfin/lib/divsi3.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2004-2009 Analog Devices Inc. 2 * Copyright 2004-2009 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 * 5 *
6 * 16 / 32 bit signed division. 6 * 16 / 32 bit signed division.
7 * Special cases : 7 * Special cases :
diff --git a/arch/blackfin/lib/memchr.S b/arch/blackfin/lib/memchr.S
index 542e40f8775f..bcfc8a14c3f2 100644
--- a/arch/blackfin/lib/memchr.S
+++ b/arch/blackfin/lib/memchr.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2005-2009 Analog Devices Inc. 2 * Copyright 2005-2009 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#include <linux/linkage.h> 7#include <linux/linkage.h>
diff --git a/arch/blackfin/lib/memcmp.S b/arch/blackfin/lib/memcmp.S
index ce5b9f1a8267..2e1c9477f2f7 100644
--- a/arch/blackfin/lib/memcmp.S
+++ b/arch/blackfin/lib/memcmp.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2004-2009 Analog Devices Inc. 2 * Copyright 2004-2009 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#include <linux/linkage.h> 7#include <linux/linkage.h>
diff --git a/arch/blackfin/lib/memcpy.S b/arch/blackfin/lib/memcpy.S
index c31bf22aab19..53cb3698ab33 100644
--- a/arch/blackfin/lib/memcpy.S
+++ b/arch/blackfin/lib/memcpy.S
@@ -7,7 +7,7 @@
7 * 7 *
8 * Copyright 2004-2009 Analog Devices Inc. 8 * Copyright 2004-2009 Analog Devices Inc.
9 * 9 *
10 * Licensed under the ADI BSD license or the GPL-2 (or later) 10 * Licensed under the Clear BSD license or the GPL-2 (or later)
11 */ 11 */
12 12
13#include <linux/linkage.h> 13#include <linux/linkage.h>
diff --git a/arch/blackfin/lib/memmove.S b/arch/blackfin/lib/memmove.S
index 4eca566237a4..e0b78208f1d6 100644
--- a/arch/blackfin/lib/memmove.S
+++ b/arch/blackfin/lib/memmove.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2005-2009 Analog Devices Inc. 2 * Copyright 2005-2009 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#include <linux/linkage.h> 7#include <linux/linkage.h>
diff --git a/arch/blackfin/lib/memset.S b/arch/blackfin/lib/memset.S
index eab1bef3f5bf..cdcf9148ea20 100644
--- a/arch/blackfin/lib/memset.S
+++ b/arch/blackfin/lib/memset.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2004-2009 Analog Devices Inc. 2 * Copyright 2004-2009 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#include <linux/linkage.h> 7#include <linux/linkage.h>
diff --git a/arch/blackfin/lib/modsi3.S b/arch/blackfin/lib/modsi3.S
index 8b0c7d4052af..f7026ce1fa0e 100644
--- a/arch/blackfin/lib/modsi3.S
+++ b/arch/blackfin/lib/modsi3.S
@@ -6,7 +6,7 @@
6 * 6 *
7 * Copyright 2004-2009 Analog Devices Inc. 7 * Copyright 2004-2009 Analog Devices Inc.
8 * 8 *
9 * Licensed under the ADI BSD license or the GPL-2 (or later) 9 * Licensed under the Clear BSD license or the GPL-2 (or later)
10 */ 10 */
11 11
12.global ___modsi3; 12.global ___modsi3;
diff --git a/arch/blackfin/lib/muldi3.S b/arch/blackfin/lib/muldi3.S
index 953a38a1d1d1..abf9b2a515b2 100644
--- a/arch/blackfin/lib/muldi3.S
+++ b/arch/blackfin/lib/muldi3.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2008 Analog Devices Inc. 2 * Copyright 2008 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7.align 2 7.align 2
diff --git a/arch/blackfin/lib/smulsi3_highpart.S b/arch/blackfin/lib/smulsi3_highpart.S
index 99ee8c5de38b..e50d6c4ac2a5 100644
--- a/arch/blackfin/lib/smulsi3_highpart.S
+++ b/arch/blackfin/lib/smulsi3_highpart.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2007 Analog Devices Inc. 2 * Copyright 2007 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7.align 2 7.align 2
diff --git a/arch/blackfin/lib/strcmp.S b/arch/blackfin/lib/strcmp.S
index d7c1d158973b..9c8b9863713e 100644
--- a/arch/blackfin/lib/strcmp.S
+++ b/arch/blackfin/lib/strcmp.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2005-2010 Analog Devices Inc. 2 * Copyright 2005-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#include <linux/linkage.h> 7#include <linux/linkage.h>
diff --git a/arch/blackfin/lib/strcpy.S b/arch/blackfin/lib/strcpy.S
index a6a0c6363806..9495aa77cc40 100644
--- a/arch/blackfin/lib/strcpy.S
+++ b/arch/blackfin/lib/strcpy.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2005-2010 Analog Devices Inc. 2 * Copyright 2005-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#include <linux/linkage.h> 7#include <linux/linkage.h>
diff --git a/arch/blackfin/lib/strncmp.S b/arch/blackfin/lib/strncmp.S
index 6da37c34a847..3bfaedce893e 100644
--- a/arch/blackfin/lib/strncmp.S
+++ b/arch/blackfin/lib/strncmp.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2005-2010 Analog Devices Inc. 2 * Copyright 2005-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#include <linux/linkage.h> 7#include <linux/linkage.h>
diff --git a/arch/blackfin/lib/strncpy.S b/arch/blackfin/lib/strncpy.S
index 2c07dddac995..92fd1823bbee 100644
--- a/arch/blackfin/lib/strncpy.S
+++ b/arch/blackfin/lib/strncpy.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2005-2010 Analog Devices Inc. 2 * Copyright 2005-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#include <linux/linkage.h> 7#include <linux/linkage.h>
diff --git a/arch/blackfin/lib/udivsi3.S b/arch/blackfin/lib/udivsi3.S
index 97e904315ec6..748a6a2e8c17 100644
--- a/arch/blackfin/lib/udivsi3.S
+++ b/arch/blackfin/lib/udivsi3.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2004-2009 Analog Devices Inc. 2 * Copyright 2004-2009 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#include <linux/linkage.h> 7#include <linux/linkage.h>
diff --git a/arch/blackfin/lib/umodsi3.S b/arch/blackfin/lib/umodsi3.S
index 168eba7c64c8..3794c00d859d 100644
--- a/arch/blackfin/lib/umodsi3.S
+++ b/arch/blackfin/lib/umodsi3.S
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright 2004-2009 Analog Devices Inc. 4 * Copyright 2004-2009 Analog Devices Inc.
5 * 5 *
6 * Licensed under the ADI BSD license or the GPL-2 (or later) 6 * Licensed under the Clear BSD license or the GPL-2 (or later)
7 */ 7 */
8 8
9#ifdef CONFIG_ARITHMETIC_OPS_L1 9#ifdef CONFIG_ARITHMETIC_OPS_L1
diff --git a/arch/blackfin/lib/umulsi3_highpart.S b/arch/blackfin/lib/umulsi3_highpart.S
index 051824a6ed00..0dcace96e4e7 100644
--- a/arch/blackfin/lib/umulsi3_highpart.S
+++ b/arch/blackfin/lib/umulsi3_highpart.S
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2007 Analog Devices Inc. 2 * Copyright 2007 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7.align 2 7.align 2
diff --git a/arch/blackfin/mach-bf518/boards/ezbrd.c b/arch/blackfin/mach-bf518/boards/ezbrd.c
index a17395727efa..f8047ca3b339 100644
--- a/arch/blackfin/mach-bf518/boards/ezbrd.c
+++ b/arch/blackfin/mach-bf518/boards/ezbrd.c
@@ -529,6 +529,8 @@ static struct platform_device bfin_i2s = {
529#endif 529#endif
530 530
531#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 531#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
532static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
533
532static struct resource bfin_twi0_resource[] = { 534static struct resource bfin_twi0_resource[] = {
533 [0] = { 535 [0] = {
534 .start = TWI0_REGBASE, 536 .start = TWI0_REGBASE,
@@ -547,6 +549,9 @@ static struct platform_device i2c_bfin_twi_device = {
547 .id = 0, 549 .id = 0,
548 .num_resources = ARRAY_SIZE(bfin_twi0_resource), 550 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
549 .resource = bfin_twi0_resource, 551 .resource = bfin_twi0_resource,
552 .dev = {
553 .platform_data = &bfin_twi0_pins,
554 },
550}; 555};
551#endif 556#endif
552 557
diff --git a/arch/blackfin/mach-bf518/boards/tcm-bf518.c b/arch/blackfin/mach-bf518/boards/tcm-bf518.c
index 6eebee4e4217..0bedc737566b 100644
--- a/arch/blackfin/mach-bf518/boards/tcm-bf518.c
+++ b/arch/blackfin/mach-bf518/boards/tcm-bf518.c
@@ -455,6 +455,8 @@ static struct platform_device bfin_sir1_device = {
455#endif 455#endif
456 456
457#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 457#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
458static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
459
458static struct resource bfin_twi0_resource[] = { 460static struct resource bfin_twi0_resource[] = {
459 [0] = { 461 [0] = {
460 .start = TWI0_REGBASE, 462 .start = TWI0_REGBASE,
@@ -473,6 +475,9 @@ static struct platform_device i2c_bfin_twi_device = {
473 .id = 0, 475 .id = 0,
474 .num_resources = ARRAY_SIZE(bfin_twi0_resource), 476 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
475 .resource = bfin_twi0_resource, 477 .resource = bfin_twi0_resource,
478 .dev = {
479 .platform_data = &bfin_twi0_pins,
480 },
476}; 481};
477#endif 482#endif
478 483
diff --git a/arch/blackfin/mach-bf518/include/mach/anomaly.h b/arch/blackfin/mach-bf518/include/mach/anomaly.h
index 56383f7cbc07..845e6bc8d633 100644
--- a/arch/blackfin/mach-bf518/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf518/include/mach/anomaly.h
@@ -6,8 +6,7 @@
6 * DO NOT EDIT THIS FILE 6 * DO NOT EDIT THIS FILE
7 * 7 *
8 * Copyright 2004-2011 Analog Devices Inc. 8 * Copyright 2004-2011 Analog Devices Inc.
9 * Licensed under the ADI BSD license. 9 * Licensed under the Clear BSD license.
10 * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
11 */ 10 */
12 11
13/* This file should be up to date with: 12/* This file should be up to date with:
diff --git a/arch/blackfin/mach-bf518/include/mach/cdefBF512.h b/arch/blackfin/mach-bf518/include/mach/cdefBF512.h
index bb79627f0929..1c03ad4bcb72 100644
--- a/arch/blackfin/mach-bf518/include/mach/cdefBF512.h
+++ b/arch/blackfin/mach-bf518/include/mach/cdefBF512.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2008-2010 Analog Devices Inc. 2 * Copyright 2008-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _CDEF_BF512_H 7#ifndef _CDEF_BF512_H
diff --git a/arch/blackfin/mach-bf518/include/mach/cdefBF514.h b/arch/blackfin/mach-bf518/include/mach/cdefBF514.h
index dc988668203e..861221d1dcc9 100644
--- a/arch/blackfin/mach-bf518/include/mach/cdefBF514.h
+++ b/arch/blackfin/mach-bf518/include/mach/cdefBF514.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2008-2010 Analog Devices Inc. 2 * Copyright 2008-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _CDEF_BF514_H 7#ifndef _CDEF_BF514_H
diff --git a/arch/blackfin/mach-bf518/include/mach/cdefBF516.h b/arch/blackfin/mach-bf518/include/mach/cdefBF516.h
index 142e45cbc253..cc9bf0d378c3 100644
--- a/arch/blackfin/mach-bf518/include/mach/cdefBF516.h
+++ b/arch/blackfin/mach-bf518/include/mach/cdefBF516.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2008-2010 Analog Devices Inc. 2 * Copyright 2008-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _CDEF_BF516_H 7#ifndef _CDEF_BF516_H
diff --git a/arch/blackfin/mach-bf518/include/mach/cdefBF518.h b/arch/blackfin/mach-bf518/include/mach/cdefBF518.h
index e638197bf8b1..96a82fd62ef1 100644
--- a/arch/blackfin/mach-bf518/include/mach/cdefBF518.h
+++ b/arch/blackfin/mach-bf518/include/mach/cdefBF518.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2008-2010 Analog Devices Inc. 2 * Copyright 2008-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _CDEF_BF518_H 7#ifndef _CDEF_BF518_H
diff --git a/arch/blackfin/mach-bf518/include/mach/defBF512.h b/arch/blackfin/mach-bf518/include/mach/defBF512.h
index 729704078cd7..e6a017faad01 100644
--- a/arch/blackfin/mach-bf518/include/mach/defBF512.h
+++ b/arch/blackfin/mach-bf518/include/mach/defBF512.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2008-2010 Analog Devices Inc. 2 * Copyright 2008-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF512_H 7#ifndef _DEF_BF512_H
@@ -1083,77 +1083,6 @@
1083#define ERR_NCOR 0x8000 /* Error Not Corrected Indicator */ 1083#define ERR_NCOR 0x8000 /* Error Not Corrected Indicator */
1084 1084
1085 1085
1086/* ******************** TWO-WIRE INTERFACE (TWI) MASKS ***********************/
1087/* TWI_CLKDIV Macros (Use: *pTWI_CLKDIV = CLKLOW(x)|CLKHI(y); ) */
1088#define CLKLOW(x) ((x) & 0xFF) /* Periods Clock Is Held Low */
1089#define CLKHI(y) (((y)&0xFF)<<0x8) /* Periods Before New Clock Low */
1090
1091/* TWI_PRESCALE Masks */
1092#define PRESCALE 0x007F /* SCLKs Per Internal Time Reference (10MHz) */
1093#define TWI_ENA 0x0080 /* TWI Enable */
1094#define SCCB 0x0200 /* SCCB Compatibility Enable */
1095
1096/* TWI_SLAVE_CTL Masks */
1097#define SEN 0x0001 /* Slave Enable */
1098#define SADD_LEN 0x0002 /* Slave Address Length */
1099#define STDVAL 0x0004 /* Slave Transmit Data Valid */
1100#define NAK 0x0008 /* NAK/ACK* Generated At Conclusion Of Transfer */
1101#define GEN 0x0010 /* General Call Adrress Matching Enabled */
1102
1103/* TWI_SLAVE_STAT Masks */
1104#define SDIR 0x0001 /* Slave Transfer Direction (Transmit/Receive*) */
1105#define GCALL 0x0002 /* General Call Indicator */
1106
1107/* TWI_MASTER_CTL Masks */
1108#define MEN 0x0001 /* Master Mode Enable */
1109#define MADD_LEN 0x0002 /* Master Address Length */
1110#define MDIR 0x0004 /* Master Transmit Direction (RX/TX*) */
1111#define FAST 0x0008 /* Use Fast Mode Timing Specs */
1112#define STOP 0x0010 /* Issue Stop Condition */
1113#define RSTART 0x0020 /* Repeat Start or Stop* At End Of Transfer */
1114#define DCNT 0x3FC0 /* Data Bytes To Transfer */
1115#define SDAOVR 0x4000 /* Serial Data Override */
1116#define SCLOVR 0x8000 /* Serial Clock Override */
1117
1118/* TWI_MASTER_STAT Masks */
1119#define MPROG 0x0001 /* Master Transfer In Progress */
1120#define LOSTARB 0x0002 /* Lost Arbitration Indicator (Xfer Aborted) */
1121#define ANAK 0x0004 /* Address Not Acknowledged */
1122#define DNAK 0x0008 /* Data Not Acknowledged */
1123#define BUFRDERR 0x0010 /* Buffer Read Error */
1124#define BUFWRERR 0x0020 /* Buffer Write Error */
1125#define SDASEN 0x0040 /* Serial Data Sense */
1126#define SCLSEN 0x0080 /* Serial Clock Sense */
1127#define BUSBUSY 0x0100 /* Bus Busy Indicator */
1128
1129/* TWI_INT_SRC and TWI_INT_ENABLE Masks */
1130#define SINIT 0x0001 /* Slave Transfer Initiated */
1131#define SCOMP 0x0002 /* Slave Transfer Complete */
1132#define SERR 0x0004 /* Slave Transfer Error */
1133#define SOVF 0x0008 /* Slave Overflow */
1134#define MCOMP 0x0010 /* Master Transfer Complete */
1135#define MERR 0x0020 /* Master Transfer Error */
1136#define XMTSERV 0x0040 /* Transmit FIFO Service */
1137#define RCVSERV 0x0080 /* Receive FIFO Service */
1138
1139/* TWI_FIFO_CTRL Masks */
1140#define XMTFLUSH 0x0001 /* Transmit Buffer Flush */
1141#define RCVFLUSH 0x0002 /* Receive Buffer Flush */
1142#define XMTINTLEN 0x0004 /* Transmit Buffer Interrupt Length */
1143#define RCVINTLEN 0x0008 /* Receive Buffer Interrupt Length */
1144
1145/* TWI_FIFO_STAT Masks */
1146#define XMTSTAT 0x0003 /* Transmit FIFO Status */
1147#define XMT_EMPTY 0x0000 /* Transmit FIFO Empty */
1148#define XMT_HALF 0x0001 /* Transmit FIFO Has 1 Byte To Write */
1149#define XMT_FULL 0x0003 /* Transmit FIFO Full (2 Bytes To Write) */
1150
1151#define RCVSTAT 0x000C /* Receive FIFO Status */
1152#define RCV_EMPTY 0x0000 /* Receive FIFO Empty */
1153#define RCV_HALF 0x0004 /* Receive FIFO Has 1 Byte To Read */
1154#define RCV_FULL 0x000C /* Receive FIFO Full (2 Bytes To Read) */
1155
1156
1157/* ******************* PIN CONTROL REGISTER MASKS ************************/ 1086/* ******************* PIN CONTROL REGISTER MASKS ************************/
1158/* PORT_MUX Masks */ 1087/* PORT_MUX Masks */
1159#define PJSE 0x0001 /* Port J SPI/SPORT Enable */ 1088#define PJSE 0x0001 /* Port J SPI/SPORT Enable */
diff --git a/arch/blackfin/mach-bf518/include/mach/defBF514.h b/arch/blackfin/mach-bf518/include/mach/defBF514.h
index cfab428e577c..97feaa629ed7 100644
--- a/arch/blackfin/mach-bf518/include/mach/defBF514.h
+++ b/arch/blackfin/mach-bf518/include/mach/defBF514.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2008-2009 Analog Devices Inc. 2 * Copyright 2008-2009 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF514_H 7#ifndef _DEF_BF514_H
diff --git a/arch/blackfin/mach-bf518/include/mach/defBF516.h b/arch/blackfin/mach-bf518/include/mach/defBF516.h
index 22a3aa0d2629..7c79cb6a03b1 100644
--- a/arch/blackfin/mach-bf518/include/mach/defBF516.h
+++ b/arch/blackfin/mach-bf518/include/mach/defBF516.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2008-2009 Analog Devices Inc. 2 * Copyright 2008-2009 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF516_H 7#ifndef _DEF_BF516_H
diff --git a/arch/blackfin/mach-bf518/include/mach/defBF518.h b/arch/blackfin/mach-bf518/include/mach/defBF518.h
index cb18270e55c2..12042ff13601 100644
--- a/arch/blackfin/mach-bf518/include/mach/defBF518.h
+++ b/arch/blackfin/mach-bf518/include/mach/defBF518.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2008-2009 Analog Devices Inc. 2 * Copyright 2008-2009 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF518_H 7#ifndef _DEF_BF518_H
diff --git a/arch/blackfin/mach-bf527/boards/ad7160eval.c b/arch/blackfin/mach-bf527/boards/ad7160eval.c
index fad7fea1b0bf..d58f50e5aa4b 100644
--- a/arch/blackfin/mach-bf527/boards/ad7160eval.c
+++ b/arch/blackfin/mach-bf527/boards/ad7160eval.c
@@ -569,6 +569,8 @@ static const struct ad7160_platform_data bfin_ad7160_ts_info = {
569#endif 569#endif
570 570
571#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 571#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
572static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
573
572static struct resource bfin_twi0_resource[] = { 574static struct resource bfin_twi0_resource[] = {
573 [0] = { 575 [0] = {
574 .start = TWI0_REGBASE, 576 .start = TWI0_REGBASE,
@@ -587,6 +589,9 @@ static struct platform_device i2c_bfin_twi_device = {
587 .id = 0, 589 .id = 0,
588 .num_resources = ARRAY_SIZE(bfin_twi0_resource), 590 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
589 .resource = bfin_twi0_resource, 591 .resource = bfin_twi0_resource,
592 .dev = {
593 .platform_data = &bfin_twi0_pins,
594 },
590}; 595};
591#endif 596#endif
592 597
@@ -681,6 +686,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = {
681 .rotary_button_key = KEY_ENTER, 686 .rotary_button_key = KEY_ENTER,
682 .debounce = 10, /* 0..17 */ 687 .debounce = 10, /* 0..17 */
683 .mode = ROT_QUAD_ENC | ROT_DEBE, 688 .mode = ROT_QUAD_ENC | ROT_DEBE,
689 .pm_wakeup = 1,
684}; 690};
685 691
686static struct resource bfin_rotary_resources[] = { 692static struct resource bfin_rotary_resources[] = {
diff --git a/arch/blackfin/mach-bf527/boards/cm_bf527.c b/arch/blackfin/mach-bf527/boards/cm_bf527.c
index 65b7fbd30e16..413d0132b66f 100644
--- a/arch/blackfin/mach-bf527/boards/cm_bf527.c
+++ b/arch/blackfin/mach-bf527/boards/cm_bf527.c
@@ -698,6 +698,8 @@ static struct platform_device bfin_sir1_device = {
698#endif 698#endif
699 699
700#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 700#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
701static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
702
701static struct resource bfin_twi0_resource[] = { 703static struct resource bfin_twi0_resource[] = {
702 [0] = { 704 [0] = {
703 .start = TWI0_REGBASE, 705 .start = TWI0_REGBASE,
@@ -716,6 +718,9 @@ static struct platform_device i2c_bfin_twi_device = {
716 .id = 0, 718 .id = 0,
717 .num_resources = ARRAY_SIZE(bfin_twi0_resource), 719 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
718 .resource = bfin_twi0_resource, 720 .resource = bfin_twi0_resource,
721 .dev = {
722 .platform_data = &bfin_twi0_pins,
723 },
719}; 724};
720#endif 725#endif
721 726
diff --git a/arch/blackfin/mach-bf527/boards/ezbrd.c b/arch/blackfin/mach-bf527/boards/ezbrd.c
index 17c6a24cc076..50bda79194e5 100644
--- a/arch/blackfin/mach-bf527/boards/ezbrd.c
+++ b/arch/blackfin/mach-bf527/boards/ezbrd.c
@@ -576,6 +576,8 @@ static struct platform_device bfin_sir1_device = {
576#endif 576#endif
577 577
578#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 578#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
579static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
580
579static struct resource bfin_twi0_resource[] = { 581static struct resource bfin_twi0_resource[] = {
580 [0] = { 582 [0] = {
581 .start = TWI0_REGBASE, 583 .start = TWI0_REGBASE,
@@ -594,6 +596,9 @@ static struct platform_device i2c_bfin_twi_device = {
594 .id = 0, 596 .id = 0,
595 .num_resources = ARRAY_SIZE(bfin_twi0_resource), 597 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
596 .resource = bfin_twi0_resource, 598 .resource = bfin_twi0_resource,
599 .dev = {
600 .platform_data = &bfin_twi0_pins,
601 },
597}; 602};
598#endif 603#endif
599 604
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c
index 2f9a2bd83ce4..af732eb3a687 100644
--- a/arch/blackfin/mach-bf527/boards/ezkit.c
+++ b/arch/blackfin/mach-bf527/boards/ezkit.c
@@ -869,6 +869,8 @@ static struct platform_device bfin_sir1_device = {
869#endif 869#endif
870 870
871#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 871#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
872static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
873
872static struct resource bfin_twi0_resource[] = { 874static struct resource bfin_twi0_resource[] = {
873 [0] = { 875 [0] = {
874 .start = TWI0_REGBASE, 876 .start = TWI0_REGBASE,
@@ -887,6 +889,9 @@ static struct platform_device i2c_bfin_twi_device = {
887 .id = 0, 889 .id = 0,
888 .num_resources = ARRAY_SIZE(bfin_twi0_resource), 890 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
889 .resource = bfin_twi0_resource, 891 .resource = bfin_twi0_resource,
892 .dev = {
893 .platform_data = &bfin_twi0_pins,
894 },
890}; 895};
891#endif 896#endif
892 897
@@ -1105,6 +1110,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = {
1105 .rotary_button_key = KEY_ENTER, 1110 .rotary_button_key = KEY_ENTER,
1106 .debounce = 10, /* 0..17 */ 1111 .debounce = 10, /* 0..17 */
1107 .mode = ROT_QUAD_ENC | ROT_DEBE, 1112 .mode = ROT_QUAD_ENC | ROT_DEBE,
1113 .pm_wakeup = 1,
1108}; 1114};
1109 1115
1110static struct resource bfin_rotary_resources[] = { 1116static struct resource bfin_rotary_resources[] = {
diff --git a/arch/blackfin/mach-bf527/boards/tll6527m.c b/arch/blackfin/mach-bf527/boards/tll6527m.c
index d192c0ac941c..1509c5a8a3ff 100644
--- a/arch/blackfin/mach-bf527/boards/tll6527m.c
+++ b/arch/blackfin/mach-bf527/boards/tll6527m.c
@@ -656,6 +656,8 @@ static struct platform_device bfin_sir1_device = {
656#endif 656#endif
657 657
658#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 658#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
659static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
660
659static struct resource bfin_twi0_resource[] = { 661static struct resource bfin_twi0_resource[] = {
660 [0] = { 662 [0] = {
661 .start = TWI0_REGBASE, 663 .start = TWI0_REGBASE,
@@ -674,6 +676,9 @@ static struct platform_device i2c_bfin_twi_device = {
674 .id = 0, 676 .id = 0,
675 .num_resources = ARRAY_SIZE(bfin_twi0_resource), 677 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
676 .resource = bfin_twi0_resource, 678 .resource = bfin_twi0_resource,
679 .dev = {
680 .platform_data = &bfin_twi0_pins,
681 },
677}; 682};
678#endif 683#endif
679 684
diff --git a/arch/blackfin/mach-bf527/include/mach/anomaly.h b/arch/blackfin/mach-bf527/include/mach/anomaly.h
index 688470611e15..aa14110be4c4 100644
--- a/arch/blackfin/mach-bf527/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf527/include/mach/anomaly.h
@@ -6,8 +6,7 @@
6 * DO NOT EDIT THIS FILE 6 * DO NOT EDIT THIS FILE
7 * 7 *
8 * Copyright 2004-2011 Analog Devices Inc. 8 * Copyright 2004-2011 Analog Devices Inc.
9 * Licensed under the ADI BSD license. 9 * Licensed under the Clear BSD license.
10 * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
11 */ 10 */
12 11
13/* This file should be up to date with: 12/* This file should be up to date with:
diff --git a/arch/blackfin/mach-bf527/include/mach/defBF522.h b/arch/blackfin/mach-bf527/include/mach/defBF522.h
index 37d353a19722..e007017cf958 100644
--- a/arch/blackfin/mach-bf527/include/mach/defBF522.h
+++ b/arch/blackfin/mach-bf527/include/mach/defBF522.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2007-2010 Analog Devices Inc. 2 * Copyright 2007-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF522_H 7#ifndef _DEF_BF522_H
@@ -1084,77 +1084,6 @@
1084#define ERR_NCOR 0x8000 /* Error Not Corrected Indicator */ 1084#define ERR_NCOR 0x8000 /* Error Not Corrected Indicator */
1085 1085
1086 1086
1087/* ******************** TWO-WIRE INTERFACE (TWI) MASKS ***********************/
1088/* TWI_CLKDIV Macros (Use: *pTWI_CLKDIV = CLKLOW(x)|CLKHI(y); ) */
1089#define CLKLOW(x) ((x) & 0xFF) /* Periods Clock Is Held Low */
1090#define CLKHI(y) (((y)&0xFF)<<0x8) /* Periods Before New Clock Low */
1091
1092/* TWI_PRESCALE Masks */
1093#define PRESCALE 0x007F /* SCLKs Per Internal Time Reference (10MHz) */
1094#define TWI_ENA 0x0080 /* TWI Enable */
1095#define SCCB 0x0200 /* SCCB Compatibility Enable */
1096
1097/* TWI_SLAVE_CTL Masks */
1098#define SEN 0x0001 /* Slave Enable */
1099#define SADD_LEN 0x0002 /* Slave Address Length */
1100#define STDVAL 0x0004 /* Slave Transmit Data Valid */
1101#define NAK 0x0008 /* NAK/ACK* Generated At Conclusion Of Transfer */
1102#define GEN 0x0010 /* General Call Adrress Matching Enabled */
1103
1104/* TWI_SLAVE_STAT Masks */
1105#define SDIR 0x0001 /* Slave Transfer Direction (Transmit/Receive*) */
1106#define GCALL 0x0002 /* General Call Indicator */
1107
1108/* TWI_MASTER_CTL Masks */
1109#define MEN 0x0001 /* Master Mode Enable */
1110#define MADD_LEN 0x0002 /* Master Address Length */
1111#define MDIR 0x0004 /* Master Transmit Direction (RX/TX*) */
1112#define FAST 0x0008 /* Use Fast Mode Timing Specs */
1113#define STOP 0x0010 /* Issue Stop Condition */
1114#define RSTART 0x0020 /* Repeat Start or Stop* At End Of Transfer */
1115#define DCNT 0x3FC0 /* Data Bytes To Transfer */
1116#define SDAOVR 0x4000 /* Serial Data Override */
1117#define SCLOVR 0x8000 /* Serial Clock Override */
1118
1119/* TWI_MASTER_STAT Masks */
1120#define MPROG 0x0001 /* Master Transfer In Progress */
1121#define LOSTARB 0x0002 /* Lost Arbitration Indicator (Xfer Aborted) */
1122#define ANAK 0x0004 /* Address Not Acknowledged */
1123#define DNAK 0x0008 /* Data Not Acknowledged */
1124#define BUFRDERR 0x0010 /* Buffer Read Error */
1125#define BUFWRERR 0x0020 /* Buffer Write Error */
1126#define SDASEN 0x0040 /* Serial Data Sense */
1127#define SCLSEN 0x0080 /* Serial Clock Sense */
1128#define BUSBUSY 0x0100 /* Bus Busy Indicator */
1129
1130/* TWI_INT_SRC and TWI_INT_ENABLE Masks */
1131#define SINIT 0x0001 /* Slave Transfer Initiated */
1132#define SCOMP 0x0002 /* Slave Transfer Complete */
1133#define SERR 0x0004 /* Slave Transfer Error */
1134#define SOVF 0x0008 /* Slave Overflow */
1135#define MCOMP 0x0010 /* Master Transfer Complete */
1136#define MERR 0x0020 /* Master Transfer Error */
1137#define XMTSERV 0x0040 /* Transmit FIFO Service */
1138#define RCVSERV 0x0080 /* Receive FIFO Service */
1139
1140/* TWI_FIFO_CTRL Masks */
1141#define XMTFLUSH 0x0001 /* Transmit Buffer Flush */
1142#define RCVFLUSH 0x0002 /* Receive Buffer Flush */
1143#define XMTINTLEN 0x0004 /* Transmit Buffer Interrupt Length */
1144#define RCVINTLEN 0x0008 /* Receive Buffer Interrupt Length */
1145
1146/* TWI_FIFO_STAT Masks */
1147#define XMTSTAT 0x0003 /* Transmit FIFO Status */
1148#define XMT_EMPTY 0x0000 /* Transmit FIFO Empty */
1149#define XMT_HALF 0x0001 /* Transmit FIFO Has 1 Byte To Write */
1150#define XMT_FULL 0x0003 /* Transmit FIFO Full (2 Bytes To Write) */
1151
1152#define RCVSTAT 0x000C /* Receive FIFO Status */
1153#define RCV_EMPTY 0x0000 /* Receive FIFO Empty */
1154#define RCV_HALF 0x0004 /* Receive FIFO Has 1 Byte To Read */
1155#define RCV_FULL 0x000C /* Receive FIFO Full (2 Bytes To Read) */
1156
1157
1158/* Omit CAN masks from defBF534.h */ 1087/* Omit CAN masks from defBF534.h */
1159 1088
1160/* ******************* PIN CONTROL REGISTER MASKS ************************/ 1089/* ******************* PIN CONTROL REGISTER MASKS ************************/
diff --git a/arch/blackfin/mach-bf527/include/mach/defBF525.h b/arch/blackfin/mach-bf527/include/mach/defBF525.h
index aab80bb1a683..71578d964d00 100644
--- a/arch/blackfin/mach-bf527/include/mach/defBF525.h
+++ b/arch/blackfin/mach-bf527/include/mach/defBF525.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2007-2010 Analog Devices Inc. 2 * Copyright 2007-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF525_H 7#ifndef _DEF_BF525_H
diff --git a/arch/blackfin/mach-bf527/include/mach/defBF527.h b/arch/blackfin/mach-bf527/include/mach/defBF527.h
index 05369a92fbc8..aeb84795b35e 100644
--- a/arch/blackfin/mach-bf527/include/mach/defBF527.h
+++ b/arch/blackfin/mach-bf527/include/mach/defBF527.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2007-2010 Analog Devices Inc. 2 * Copyright 2007-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF527_H 7#ifndef _DEF_BF527_H
diff --git a/arch/blackfin/mach-bf533/include/mach/anomaly.h b/arch/blackfin/mach-bf533/include/mach/anomaly.h
index 03f2b40912a3..3a8f73a669f0 100644
--- a/arch/blackfin/mach-bf533/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf533/include/mach/anomaly.h
@@ -6,8 +6,7 @@
6 * DO NOT EDIT THIS FILE 6 * DO NOT EDIT THIS FILE
7 * 7 *
8 * Copyright 2004-2011 Analog Devices Inc. 8 * Copyright 2004-2011 Analog Devices Inc.
9 * Licensed under the ADI BSD license. 9 * Licensed under the Clear BSD license.
10 * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
11 */ 10 */
12 11
13/* This file should be up to date with: 12/* This file should be up to date with:
diff --git a/arch/blackfin/mach-bf533/include/mach/defBF532.h b/arch/blackfin/mach-bf533/include/mach/defBF532.h
index 2376d5393511..d438150b1025 100644
--- a/arch/blackfin/mach-bf533/include/mach/defBF532.h
+++ b/arch/blackfin/mach-bf533/include/mach/defBF532.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright 2005-2010 Analog Devices Inc. 4 * Copyright 2005-2010 Analog Devices Inc.
5 * 5 *
6 * Licensed under the ADI BSD license or the GPL-2 (or later) 6 * Licensed under the Clear BSD license or the GPL-2 (or later)
7 */ 7 */
8 8
9#ifndef _DEF_BF532_H 9#ifndef _DEF_BF532_H
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537e.c b/arch/blackfin/mach-bf537/boards/cm_bf537e.c
index 27fd2c32ae9a..9408ab56d87f 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537e.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537e.c
@@ -486,6 +486,8 @@ static struct platform_device bfin_sir1_device = {
486#endif 486#endif
487 487
488#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 488#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
489static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
490
489static struct resource bfin_twi0_resource[] = { 491static struct resource bfin_twi0_resource[] = {
490 [0] = { 492 [0] = {
491 .start = TWI0_REGBASE, 493 .start = TWI0_REGBASE,
@@ -504,6 +506,9 @@ static struct platform_device i2c_bfin_twi_device = {
504 .id = 0, 506 .id = 0,
505 .num_resources = ARRAY_SIZE(bfin_twi0_resource), 507 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
506 .resource = bfin_twi0_resource, 508 .resource = bfin_twi0_resource,
509 .dev = {
510 .platform_data = &bfin_twi0_pins,
511 },
507}; 512};
508#endif 513#endif
509 514
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537u.c b/arch/blackfin/mach-bf537/boards/cm_bf537u.c
index 3f3abad86ec3..0143d8bef909 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537u.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537u.c
@@ -451,6 +451,8 @@ static struct platform_device bfin_sir1_device = {
451#endif 451#endif
452 452
453#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 453#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
454static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
455
454static struct resource bfin_twi0_resource[] = { 456static struct resource bfin_twi0_resource[] = {
455 [0] = { 457 [0] = {
456 .start = TWI0_REGBASE, 458 .start = TWI0_REGBASE,
@@ -469,6 +471,9 @@ static struct platform_device i2c_bfin_twi_device = {
469 .id = 0, 471 .id = 0,
470 .num_resources = ARRAY_SIZE(bfin_twi0_resource), 472 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
471 .resource = bfin_twi0_resource, 473 .resource = bfin_twi0_resource,
474 .dev = {
475 .platform_data = &bfin_twi0_pins,
476 },
472}; 477};
473#endif 478#endif
474 479
diff --git a/arch/blackfin/mach-bf537/boards/dnp5370.c b/arch/blackfin/mach-bf537/boards/dnp5370.c
index 6f77bf708ec0..8bbf0a23fd49 100644
--- a/arch/blackfin/mach-bf537/boards/dnp5370.c
+++ b/arch/blackfin/mach-bf537/boards/dnp5370.c
@@ -329,6 +329,8 @@ static struct platform_device bfin_uart1_device = {
329#endif 329#endif
330 330
331#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 331#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
332static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
333
332static struct resource bfin_twi0_resource[] = { 334static struct resource bfin_twi0_resource[] = {
333 [0] = { 335 [0] = {
334 .start = TWI0_REGBASE, 336 .start = TWI0_REGBASE,
@@ -347,6 +349,9 @@ static struct platform_device i2c_bfin_twi_device = {
347 .id = 0, 349 .id = 0,
348 .num_resources = ARRAY_SIZE(bfin_twi0_resource), 350 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
349 .resource = bfin_twi0_resource, 351 .resource = bfin_twi0_resource,
352 .dev = {
353 .platform_data = &bfin_twi0_pins,
354 },
350}; 355};
351#endif 356#endif
352 357
diff --git a/arch/blackfin/mach-bf537/boards/minotaur.c b/arch/blackfin/mach-bf537/boards/minotaur.c
index d2d71282618f..a10f90e444bc 100644
--- a/arch/blackfin/mach-bf537/boards/minotaur.c
+++ b/arch/blackfin/mach-bf537/boards/minotaur.c
@@ -386,6 +386,8 @@ static struct platform_device bfin_sir1_device = {
386#endif 386#endif
387 387
388#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 388#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
389static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
390
389static struct resource bfin_twi0_resource[] = { 391static struct resource bfin_twi0_resource[] = {
390 [0] = { 392 [0] = {
391 .start = TWI0_REGBASE, 393 .start = TWI0_REGBASE,
@@ -404,6 +406,9 @@ static struct platform_device i2c_bfin_twi_device = {
404 .id = 0, 406 .id = 0,
405 .num_resources = ARRAY_SIZE(bfin_twi0_resource), 407 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
406 .resource = bfin_twi0_resource, 408 .resource = bfin_twi0_resource,
409 .dev = {
410 .platform_data = &bfin_twi0_pins,
411 },
407}; 412};
408#endif 413#endif
409 414
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index f3562b0922af..c9d9473a5ab2 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -1790,6 +1790,8 @@ static struct platform_device bfin_sir1_device = {
1790#endif 1790#endif
1791 1791
1792#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 1792#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1793static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
1794
1793static struct resource bfin_twi0_resource[] = { 1795static struct resource bfin_twi0_resource[] = {
1794 [0] = { 1796 [0] = {
1795 .start = TWI0_REGBASE, 1797 .start = TWI0_REGBASE,
@@ -1808,6 +1810,9 @@ static struct platform_device i2c_bfin_twi_device = {
1808 .id = 0, 1810 .id = 0,
1809 .num_resources = ARRAY_SIZE(bfin_twi0_resource), 1811 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1810 .resource = bfin_twi0_resource, 1812 .resource = bfin_twi0_resource,
1813 .dev = {
1814 .platform_data = &bfin_twi0_pins,
1815 },
1811}; 1816};
1812#endif 1817#endif
1813 1818
@@ -2361,7 +2366,13 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
2361 }, 2366 },
2362#endif 2367#endif
2363}; 2368};
2364 2369#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) \
2370|| defined(CONFIG_BFIN_SPORT) || defined(CONFIG_BFIN_SPORT_MODULE)
2371unsigned short bfin_sport0_peripherals[] = {
2372 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
2373 P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
2374};
2375#endif
2365#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) 2376#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
2366#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART 2377#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
2367static struct resource bfin_sport0_uart_resources[] = { 2378static struct resource bfin_sport0_uart_resources[] = {
@@ -2382,11 +2393,6 @@ static struct resource bfin_sport0_uart_resources[] = {
2382 }, 2393 },
2383}; 2394};
2384 2395
2385static unsigned short bfin_sport0_peripherals[] = {
2386 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
2387 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
2388};
2389
2390static struct platform_device bfin_sport0_uart_device = { 2396static struct platform_device bfin_sport0_uart_device = {
2391 .name = "bfin-sport-uart", 2397 .name = "bfin-sport-uart",
2392 .id = 0, 2398 .id = 0,
@@ -2432,7 +2438,49 @@ static struct platform_device bfin_sport1_uart_device = {
2432}; 2438};
2433#endif 2439#endif
2434#endif 2440#endif
2435 2441#if defined(CONFIG_BFIN_SPORT) || defined(CONFIG_BFIN_SPORT_MODULE)
2442static struct resource bfin_sport0_resources[] = {
2443 {
2444 .start = SPORT0_TCR1,
2445 .end = SPORT0_MRCS3+4,
2446 .flags = IORESOURCE_MEM,
2447 },
2448 {
2449 .start = IRQ_SPORT0_RX,
2450 .end = IRQ_SPORT0_RX+1,
2451 .flags = IORESOURCE_IRQ,
2452 },
2453 {
2454 .start = IRQ_SPORT0_TX,
2455 .end = IRQ_SPORT0_TX+1,
2456 .flags = IORESOURCE_IRQ,
2457 },
2458 {
2459 .start = IRQ_SPORT0_ERROR,
2460 .end = IRQ_SPORT0_ERROR,
2461 .flags = IORESOURCE_IRQ,
2462 },
2463 {
2464 .start = CH_SPORT0_TX,
2465 .end = CH_SPORT0_TX,
2466 .flags = IORESOURCE_DMA,
2467 },
2468 {
2469 .start = CH_SPORT0_RX,
2470 .end = CH_SPORT0_RX,
2471 .flags = IORESOURCE_DMA,
2472 },
2473};
2474static struct platform_device bfin_sport0_device = {
2475 .name = "bfin_sport_raw",
2476 .id = 0,
2477 .num_resources = ARRAY_SIZE(bfin_sport0_resources),
2478 .resource = bfin_sport0_resources,
2479 .dev = {
2480 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
2481 },
2482};
2483#endif
2436#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) 2484#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
2437#define CF_IDE_NAND_CARD_USE_HDD_INTERFACE 2485#define CF_IDE_NAND_CARD_USE_HDD_INTERFACE
2438/* #define CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE */ 2486/* #define CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE */
@@ -2754,7 +2802,9 @@ static struct platform_device bf5xx_adau1701_device = {
2754static struct platform_device *stamp_devices[] __initdata = { 2802static struct platform_device *stamp_devices[] __initdata = {
2755 2803
2756 &bfin_dpmc, 2804 &bfin_dpmc,
2757 2805#if defined(CONFIG_BFIN_SPORT) || defined(CONFIG_BFIN_SPORT_MODULE)
2806 &bfin_sport0_device,
2807#endif
2758#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) 2808#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
2759 &bfin_pcmcia_cf_device, 2809 &bfin_pcmcia_cf_device,
2760#endif 2810#endif
diff --git a/arch/blackfin/mach-bf537/boards/tcm_bf537.c b/arch/blackfin/mach-bf537/boards/tcm_bf537.c
index 3fb421823857..e285c3675286 100644
--- a/arch/blackfin/mach-bf537/boards/tcm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/tcm_bf537.c
@@ -453,6 +453,8 @@ static struct platform_device bfin_sir1_device = {
453#endif 453#endif
454 454
455#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 455#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
456static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
457
456static struct resource bfin_twi0_resource[] = { 458static struct resource bfin_twi0_resource[] = {
457 [0] = { 459 [0] = {
458 .start = TWI0_REGBASE, 460 .start = TWI0_REGBASE,
@@ -471,6 +473,9 @@ static struct platform_device i2c_bfin_twi_device = {
471 .id = 0, 473 .id = 0,
472 .num_resources = ARRAY_SIZE(bfin_twi0_resource), 474 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
473 .resource = bfin_twi0_resource, 475 .resource = bfin_twi0_resource,
476 .dev = {
477 .platform_data = &bfin_twi0_pins,
478 },
474}; 479};
475#endif 480#endif
476 481
diff --git a/arch/blackfin/mach-bf537/include/mach/anomaly.h b/arch/blackfin/mach-bf537/include/mach/anomaly.h
index 543cd3fb305e..df9212696397 100644
--- a/arch/blackfin/mach-bf537/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf537/include/mach/anomaly.h
@@ -6,8 +6,7 @@
6 * DO NOT EDIT THIS FILE 6 * DO NOT EDIT THIS FILE
7 * 7 *
8 * Copyright 2004-2011 Analog Devices Inc. 8 * Copyright 2004-2011 Analog Devices Inc.
9 * Licensed under the ADI BSD license. 9 * Licensed under the Clear BSD license.
10 * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
11 */ 10 */
12 11
13/* This file should be up to date with: 12/* This file should be up to date with:
diff --git a/arch/blackfin/mach-bf537/include/mach/defBF534.h b/arch/blackfin/mach-bf537/include/mach/defBF534.h
index 4a031dde173f..ef6a98cdfd44 100644
--- a/arch/blackfin/mach-bf537/include/mach/defBF534.h
+++ b/arch/blackfin/mach-bf537/include/mach/defBF534.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2005-2010 Analog Devices Inc. 2 * Copyright 2005-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF534_H 7#ifndef _DEF_BF534_H
@@ -1403,75 +1403,6 @@
1403#define ERR_DET 0x4000 /* Error Detected Indicator */ 1403#define ERR_DET 0x4000 /* Error Detected Indicator */
1404#define ERR_NCOR 0x8000 /* Error Not Corrected Indicator */ 1404#define ERR_NCOR 0x8000 /* Error Not Corrected Indicator */
1405 1405
1406/* ******************** TWO-WIRE INTERFACE (TWI) MASKS ***********************/
1407/* TWI_CLKDIV Macros (Use: *pTWI_CLKDIV = CLKLOW(x)|CLKHI(y); ) */
1408#define CLKLOW(x) ((x) & 0xFF) /* Periods Clock Is Held Low */
1409#define CLKHI(y) (((y)&0xFF)<<0x8) /* Periods Before New Clock Low */
1410
1411/* TWI_PRESCALE Masks */
1412#define PRESCALE 0x007F /* SCLKs Per Internal Time Reference (10MHz) */
1413#define TWI_ENA 0x0080 /* TWI Enable */
1414#define SCCB 0x0200 /* SCCB Compatibility Enable */
1415
1416/* TWI_SLAVE_CTL Masks */
1417#define SEN 0x0001 /* Slave Enable */
1418#define SADD_LEN 0x0002 /* Slave Address Length */
1419#define STDVAL 0x0004 /* Slave Transmit Data Valid */
1420#define NAK 0x0008 /* NAK/ACK* Generated At Conclusion Of Transfer */
1421#define GEN 0x0010 /* General Call Address Matching Enabled */
1422
1423/* TWI_SLAVE_STAT Masks */
1424#define SDIR 0x0001 /* Slave Transfer Direction (Transmit/Receive*) */
1425#define GCALL 0x0002 /* General Call Indicator */
1426
1427/* TWI_MASTER_CTL Masks */
1428#define MEN 0x0001 /* Master Mode Enable */
1429#define MADD_LEN 0x0002 /* Master Address Length */
1430#define MDIR 0x0004 /* Master Transmit Direction (RX/TX*) */
1431#define FAST 0x0008 /* Use Fast Mode Timing Specs */
1432#define STOP 0x0010 /* Issue Stop Condition */
1433#define RSTART 0x0020 /* Repeat Start or Stop* At End Of Transfer */
1434#define DCNT 0x3FC0 /* Data Bytes To Transfer */
1435#define SDAOVR 0x4000 /* Serial Data Override */
1436#define SCLOVR 0x8000 /* Serial Clock Override */
1437
1438/* TWI_MASTER_STAT Masks */
1439#define MPROG 0x0001 /* Master Transfer In Progress */
1440#define LOSTARB 0x0002 /* Lost Arbitration Indicator (Xfer Aborted) */
1441#define ANAK 0x0004 /* Address Not Acknowledged */
1442#define DNAK 0x0008 /* Data Not Acknowledged */
1443#define BUFRDERR 0x0010 /* Buffer Read Error */
1444#define BUFWRERR 0x0020 /* Buffer Write Error */
1445#define SDASEN 0x0040 /* Serial Data Sense */
1446#define SCLSEN 0x0080 /* Serial Clock Sense */
1447#define BUSBUSY 0x0100 /* Bus Busy Indicator */
1448
1449/* TWI_INT_SRC and TWI_INT_ENABLE Masks */
1450#define SINIT 0x0001 /* Slave Transfer Initiated */
1451#define SCOMP 0x0002 /* Slave Transfer Complete */
1452#define SERR 0x0004 /* Slave Transfer Error */
1453#define SOVF 0x0008 /* Slave Overflow */
1454#define MCOMP 0x0010 /* Master Transfer Complete */
1455#define MERR 0x0020 /* Master Transfer Error */
1456#define XMTSERV 0x0040 /* Transmit FIFO Service */
1457#define RCVSERV 0x0080 /* Receive FIFO Service */
1458
1459/* TWI_FIFO_CTRL Masks */
1460#define XMTFLUSH 0x0001 /* Transmit Buffer Flush */
1461#define RCVFLUSH 0x0002 /* Receive Buffer Flush */
1462#define XMTINTLEN 0x0004 /* Transmit Buffer Interrupt Length */
1463#define RCVINTLEN 0x0008 /* Receive Buffer Interrupt Length */
1464
1465/* TWI_FIFO_STAT Masks */
1466#define XMTSTAT 0x0003 /* Transmit FIFO Status */
1467#define XMT_EMPTY 0x0000 /* Transmit FIFO Empty */
1468#define XMT_HALF 0x0001 /* Transmit FIFO Has 1 Byte To Write */
1469#define XMT_FULL 0x0003 /* Transmit FIFO Full (2 Bytes To Write) */
1470
1471#define RCVSTAT 0x000C /* Receive FIFO Status */
1472#define RCV_EMPTY 0x0000 /* Receive FIFO Empty */
1473#define RCV_HALF 0x0004 /* Receive FIFO Has 1 Byte To Read */
1474#define RCV_FULL 0x000C /* Receive FIFO Full (2 Bytes To Read) */
1475 1406
1476/* ******************* PIN CONTROL REGISTER MASKS ************************/ 1407/* ******************* PIN CONTROL REGISTER MASKS ************************/
1477/* PORT_MUX Masks */ 1408/* PORT_MUX Masks */
diff --git a/arch/blackfin/mach-bf537/include/mach/defBF537.h b/arch/blackfin/mach-bf537/include/mach/defBF537.h
index 3d471d752684..e10332c9f660 100644
--- a/arch/blackfin/mach-bf537/include/mach/defBF537.h
+++ b/arch/blackfin/mach-bf537/include/mach/defBF537.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2005-2010 Analog Devices Inc. 2 * Copyright 2005-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF537_H 7#ifndef _DEF_BF537_H
diff --git a/arch/blackfin/mach-bf538/boards/ezkit.c b/arch/blackfin/mach-bf538/boards/ezkit.c
index 1633a6f306c0..a4fce0370c1d 100644
--- a/arch/blackfin/mach-bf538/boards/ezkit.c
+++ b/arch/blackfin/mach-bf538/boards/ezkit.c
@@ -38,7 +38,7 @@ static struct platform_device rtc_device = {
38 .name = "rtc-bfin", 38 .name = "rtc-bfin",
39 .id = -1, 39 .id = -1,
40}; 40};
41#endif 41#endif /* CONFIG_RTC_DRV_BFIN */
42 42
43#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) 43#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
44#ifdef CONFIG_SERIAL_BFIN_UART0 44#ifdef CONFIG_SERIAL_BFIN_UART0
@@ -100,7 +100,7 @@ static struct platform_device bfin_uart0_device = {
100 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */ 100 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
101 }, 101 },
102}; 102};
103#endif 103#endif /* CONFIG_SERIAL_BFIN_UART0 */
104#ifdef CONFIG_SERIAL_BFIN_UART1 104#ifdef CONFIG_SERIAL_BFIN_UART1
105static struct resource bfin_uart1_resources[] = { 105static struct resource bfin_uart1_resources[] = {
106 { 106 {
@@ -148,7 +148,7 @@ static struct platform_device bfin_uart1_device = {
148 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */ 148 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
149 }, 149 },
150}; 150};
151#endif 151#endif /* CONFIG_SERIAL_BFIN_UART1 */
152#ifdef CONFIG_SERIAL_BFIN_UART2 152#ifdef CONFIG_SERIAL_BFIN_UART2
153static struct resource bfin_uart2_resources[] = { 153static struct resource bfin_uart2_resources[] = {
154 { 154 {
@@ -196,8 +196,8 @@ static struct platform_device bfin_uart2_device = {
196 .platform_data = &bfin_uart2_peripherals, /* Passed to driver */ 196 .platform_data = &bfin_uart2_peripherals, /* Passed to driver */
197 }, 197 },
198}; 198};
199#endif 199#endif /* CONFIG_SERIAL_BFIN_UART2 */
200#endif 200#endif /* CONFIG_SERIAL_BFIN */
201 201
202#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) 202#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
203#ifdef CONFIG_BFIN_SIR0 203#ifdef CONFIG_BFIN_SIR0
@@ -224,7 +224,7 @@ static struct platform_device bfin_sir0_device = {
224 .num_resources = ARRAY_SIZE(bfin_sir0_resources), 224 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
225 .resource = bfin_sir0_resources, 225 .resource = bfin_sir0_resources,
226}; 226};
227#endif 227#endif /* CONFIG_BFIN_SIR0 */
228#ifdef CONFIG_BFIN_SIR1 228#ifdef CONFIG_BFIN_SIR1
229static struct resource bfin_sir1_resources[] = { 229static struct resource bfin_sir1_resources[] = {
230 { 230 {
@@ -249,7 +249,7 @@ static struct platform_device bfin_sir1_device = {
249 .num_resources = ARRAY_SIZE(bfin_sir1_resources), 249 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
250 .resource = bfin_sir1_resources, 250 .resource = bfin_sir1_resources,
251}; 251};
252#endif 252#endif /* CONFIG_BFIN_SIR1 */
253#ifdef CONFIG_BFIN_SIR2 253#ifdef CONFIG_BFIN_SIR2
254static struct resource bfin_sir2_resources[] = { 254static struct resource bfin_sir2_resources[] = {
255 { 255 {
@@ -274,8 +274,8 @@ static struct platform_device bfin_sir2_device = {
274 .num_resources = ARRAY_SIZE(bfin_sir2_resources), 274 .num_resources = ARRAY_SIZE(bfin_sir2_resources),
275 .resource = bfin_sir2_resources, 275 .resource = bfin_sir2_resources,
276}; 276};
277#endif 277#endif /* CONFIG_BFIN_SIR2 */
278#endif 278#endif /* CONFIG_BFIN_SIR */
279 279
280#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) 280#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
281#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART 281#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
@@ -311,7 +311,7 @@ static struct platform_device bfin_sport0_uart_device = {
311 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */ 311 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
312 }, 312 },
313}; 313};
314#endif 314#endif /* CONFIG_SERIAL_BFIN_SPORT0_UART */
315#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART 315#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
316static struct resource bfin_sport1_uart_resources[] = { 316static struct resource bfin_sport1_uart_resources[] = {
317 { 317 {
@@ -345,7 +345,7 @@ static struct platform_device bfin_sport1_uart_device = {
345 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */ 345 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
346 }, 346 },
347}; 347};
348#endif 348#endif /* CONFIG_SERIAL_BFIN_SPORT1_UART */
349#ifdef CONFIG_SERIAL_BFIN_SPORT2_UART 349#ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
350static struct resource bfin_sport2_uart_resources[] = { 350static struct resource bfin_sport2_uart_resources[] = {
351 { 351 {
@@ -379,7 +379,7 @@ static struct platform_device bfin_sport2_uart_device = {
379 .platform_data = &bfin_sport2_peripherals, /* Passed to driver */ 379 .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
380 }, 380 },
381}; 381};
382#endif 382#endif /* CONFIG_SERIAL_BFIN_SPORT2_UART */
383#ifdef CONFIG_SERIAL_BFIN_SPORT3_UART 383#ifdef CONFIG_SERIAL_BFIN_SPORT3_UART
384static struct resource bfin_sport3_uart_resources[] = { 384static struct resource bfin_sport3_uart_resources[] = {
385 { 385 {
@@ -413,8 +413,8 @@ static struct platform_device bfin_sport3_uart_device = {
413 .platform_data = &bfin_sport3_peripherals, /* Passed to driver */ 413 .platform_data = &bfin_sport3_peripherals, /* Passed to driver */
414 }, 414 },
415}; 415};
416#endif 416#endif /* CONFIG_SERIAL_BFIN_SPORT3_UART */
417#endif 417#endif /* CONFIG_SERIAL_BFIN_SPORT */
418 418
419#if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE) 419#if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
420static unsigned short bfin_can_peripherals[] = { 420static unsigned short bfin_can_peripherals[] = {
@@ -452,7 +452,7 @@ static struct platform_device bfin_can_device = {
452 .platform_data = &bfin_can_peripherals, /* Passed to driver */ 452 .platform_data = &bfin_can_peripherals, /* Passed to driver */
453 }, 453 },
454}; 454};
455#endif 455#endif /* CONFIG_CAN_BFIN */
456 456
457/* 457/*
458 * USB-LAN EzExtender board 458 * USB-LAN EzExtender board
@@ -488,7 +488,7 @@ static struct platform_device smc91x_device = {
488 .platform_data = &smc91x_info, 488 .platform_data = &smc91x_info,
489 }, 489 },
490}; 490};
491#endif 491#endif /* CONFIG_SMC91X */
492 492
493#if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE) 493#if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
494/* all SPI peripherals info goes here */ 494/* all SPI peripherals info goes here */
@@ -518,7 +518,8 @@ static struct flash_platform_data bfin_spi_flash_data = {
518static struct bfin5xx_spi_chip spi_flash_chip_info = { 518static struct bfin5xx_spi_chip spi_flash_chip_info = {
519 .enable_dma = 0, /* use dma transfer with this chip*/ 519 .enable_dma = 0, /* use dma transfer with this chip*/
520}; 520};
521#endif 521#endif /* CONFIG_MTD_M25P80 */
522#endif /* CONFIG_SPI_BFIN5XX */
522 523
523#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE) 524#if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
524#include <linux/spi/ad7879.h> 525#include <linux/spi/ad7879.h>
@@ -535,7 +536,7 @@ static const struct ad7879_platform_data bfin_ad7879_ts_info = {
535 .gpio_export = 1, /* Export GPIO to gpiolib */ 536 .gpio_export = 1, /* Export GPIO to gpiolib */
536 .gpio_base = -1, /* Dynamic allocation */ 537 .gpio_base = -1, /* Dynamic allocation */
537}; 538};
538#endif 539#endif /* CONFIG_TOUCHSCREEN_AD7879 */
539 540
540#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE) 541#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
541#include <asm/bfin-lq035q1.h> 542#include <asm/bfin-lq035q1.h>
@@ -564,7 +565,7 @@ static struct platform_device bfin_lq035q1_device = {
564 .platform_data = &bfin_lq035q1_data, 565 .platform_data = &bfin_lq035q1_data,
565 }, 566 },
566}; 567};
567#endif 568#endif /* CONFIG_FB_BFIN_LQ035Q1 */
568 569
569static struct spi_board_info bf538_spi_board_info[] __initdata = { 570static struct spi_board_info bf538_spi_board_info[] __initdata = {
570#if defined(CONFIG_MTD_M25P80) \ 571#if defined(CONFIG_MTD_M25P80) \
@@ -579,7 +580,7 @@ static struct spi_board_info bf538_spi_board_info[] __initdata = {
579 .controller_data = &spi_flash_chip_info, 580 .controller_data = &spi_flash_chip_info,
580 .mode = SPI_MODE_3, 581 .mode = SPI_MODE_3,
581 }, 582 },
582#endif 583#endif /* CONFIG_MTD_M25P80 */
583#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE) 584#if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
584 { 585 {
585 .modalias = "ad7879", 586 .modalias = "ad7879",
@@ -590,7 +591,7 @@ static struct spi_board_info bf538_spi_board_info[] __initdata = {
590 .chip_select = 1, 591 .chip_select = 1,
591 .mode = SPI_CPHA | SPI_CPOL, 592 .mode = SPI_CPHA | SPI_CPOL,
592 }, 593 },
593#endif 594#endif /* CONFIG_TOUCHSCREEN_AD7879_SPI */
594#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE) 595#if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
595 { 596 {
596 .modalias = "bfin-lq035q1-spi", 597 .modalias = "bfin-lq035q1-spi",
@@ -599,7 +600,7 @@ static struct spi_board_info bf538_spi_board_info[] __initdata = {
599 .chip_select = 2, 600 .chip_select = 2,
600 .mode = SPI_CPHA | SPI_CPOL, 601 .mode = SPI_CPHA | SPI_CPOL,
601 }, 602 },
602#endif 603#endif /* CONFIG_FB_BFIN_LQ035Q1 */
603#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) 604#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
604 { 605 {
605 .modalias = "spidev", 606 .modalias = "spidev",
@@ -607,7 +608,7 @@ static struct spi_board_info bf538_spi_board_info[] __initdata = {
607 .bus_num = 0, 608 .bus_num = 0,
608 .chip_select = 1, 609 .chip_select = 1,
609 }, 610 },
610#endif 611#endif /* CONFIG_SPI_SPIDEV */
611}; 612};
612 613
613/* SPI (0) */ 614/* SPI (0) */
@@ -716,9 +717,9 @@ static struct platform_device bf538_spi_master2 = {
716 }, 717 },
717}; 718};
718 719
719#endif /* spi master and devices */
720
721#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 720#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
721static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
722
722static struct resource bfin_twi0_resource[] = { 723static struct resource bfin_twi0_resource[] = {
723 [0] = { 724 [0] = {
724 .start = TWI0_REGBASE, 725 .start = TWI0_REGBASE,
@@ -737,9 +738,13 @@ static struct platform_device i2c_bfin_twi0_device = {
737 .id = 0, 738 .id = 0,
738 .num_resources = ARRAY_SIZE(bfin_twi0_resource), 739 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
739 .resource = bfin_twi0_resource, 740 .resource = bfin_twi0_resource,
741 .dev = {
742 .platform_data = &bfin_twi0_pins,
743 },
740}; 744};
741 745
742#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */ 746static const u16 bfin_twi1_pins[] = {P_TWI1_SCL, P_TWI1_SDA, 0};
747
743static struct resource bfin_twi1_resource[] = { 748static struct resource bfin_twi1_resource[] = {
744 [0] = { 749 [0] = {
745 .start = TWI1_REGBASE, 750 .start = TWI1_REGBASE,
@@ -759,8 +764,8 @@ static struct platform_device i2c_bfin_twi1_device = {
759 .num_resources = ARRAY_SIZE(bfin_twi1_resource), 764 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
760 .resource = bfin_twi1_resource, 765 .resource = bfin_twi1_resource,
761}; 766};
762#endif 767#endif /* CONFIG_BF542 */
763#endif 768#endif /* CONFIG_I2C_BLACKFIN_TWI */
764 769
765#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) 770#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
766#include <linux/gpio_keys.h> 771#include <linux/gpio_keys.h>
diff --git a/arch/blackfin/mach-bf538/include/mach/anomaly.h b/arch/blackfin/mach-bf538/include/mach/anomaly.h
index b6ca99788710..318d922d11d4 100644
--- a/arch/blackfin/mach-bf538/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf538/include/mach/anomaly.h
@@ -6,8 +6,7 @@
6 * DO NOT EDIT THIS FILE 6 * DO NOT EDIT THIS FILE
7 * 7 *
8 * Copyright 2004-2011 Analog Devices Inc. 8 * Copyright 2004-2011 Analog Devices Inc.
9 * Licensed under the ADI BSD license. 9 * Licensed under the Clear BSD license.
10 * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
11 */ 10 */
12 11
13/* This file should be up to date with: 12/* This file should be up to date with:
diff --git a/arch/blackfin/mach-bf538/include/mach/defBF538.h b/arch/blackfin/mach-bf538/include/mach/defBF538.h
index d27f81d6c4b1..876a77028001 100644
--- a/arch/blackfin/mach-bf538/include/mach/defBF538.h
+++ b/arch/blackfin/mach-bf538/include/mach/defBF538.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2008-2010 Analog Devices Inc. 2 * Copyright 2008-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF538_H 7#ifndef _DEF_BF538_H
@@ -1746,80 +1746,4 @@
1746#define SDEASE 0x00000010 /* SDRAM EAB sticky error status - W1C */ 1746#define SDEASE 0x00000010 /* SDRAM EAB sticky error status - W1C */
1747#define BGSTAT 0x00000020 /* Bus granted */ 1747#define BGSTAT 0x00000020 /* Bus granted */
1748 1748
1749
1750/* ******************** TWO-WIRE INTERFACE (TWIx) MASKS ***********************/
1751/* TWIx_CLKDIV Macros (Use: *pTWIx_CLKDIV = CLKLOW(x)|CLKHI(y); ) */
1752#ifdef _MISRA_RULES
1753#define CLKLOW(x) ((x) & 0xFFu) /* Periods Clock Is Held Low */
1754#define CLKHI(y) (((y)&0xFFu)<<0x8) /* Periods Before New Clock Low */
1755#else
1756#define CLKLOW(x) ((x) & 0xFF) /* Periods Clock Is Held Low */
1757#define CLKHI(y) (((y)&0xFF)<<0x8) /* Periods Before New Clock Low */
1758#endif /* _MISRA_RULES */
1759
1760/* TWIx_PRESCALE Masks */
1761#define PRESCALE 0x007F /* SCLKs Per Internal Time Reference (10MHz) */
1762#define TWI_ENA 0x0080 /* TWI Enable */
1763#define SCCB 0x0200 /* SCCB Compatibility Enable */
1764
1765/* TWIx_SLAVE_CTRL Masks */
1766#define SEN 0x0001 /* Slave Enable */
1767#define SADD_LEN 0x0002 /* Slave Address Length */
1768#define STDVAL 0x0004 /* Slave Transmit Data Valid */
1769#define NAK 0x0008 /* NAK/ACK* Generated At Conclusion Of Transfer */
1770#define GEN 0x0010 /* General Call Adrress Matching Enabled */
1771
1772/* TWIx_SLAVE_STAT Masks */
1773#define SDIR 0x0001 /* Slave Transfer Direction (Transmit/Receive*) */
1774#define GCALL 0x0002 /* General Call Indicator */
1775
1776/* TWIx_MASTER_CTRL Masks */
1777#define MEN 0x0001 /* Master Mode Enable */
1778#define MADD_LEN 0x0002 /* Master Address Length */
1779#define MDIR 0x0004 /* Master Transmit Direction (RX/TX*) */
1780#define FAST 0x0008 /* Use Fast Mode Timing Specs */
1781#define STOP 0x0010 /* Issue Stop Condition */
1782#define RSTART 0x0020 /* Repeat Start or Stop* At End Of Transfer */
1783#define DCNT 0x3FC0 /* Data Bytes To Transfer */
1784#define SDAOVR 0x4000 /* Serial Data Override */
1785#define SCLOVR 0x8000 /* Serial Clock Override */
1786
1787/* TWIx_MASTER_STAT Masks */
1788#define MPROG 0x0001 /* Master Transfer In Progress */
1789#define LOSTARB 0x0002 /* Lost Arbitration Indicator (Xfer Aborted) */
1790#define ANAK 0x0004 /* Address Not Acknowledged */
1791#define DNAK 0x0008 /* Data Not Acknowledged */
1792#define BUFRDERR 0x0010 /* Buffer Read Error */
1793#define BUFWRERR 0x0020 /* Buffer Write Error */
1794#define SDASEN 0x0040 /* Serial Data Sense */
1795#define SCLSEN 0x0080 /* Serial Clock Sense */
1796#define BUSBUSY 0x0100 /* Bus Busy Indicator */
1797
1798/* TWIx_INT_SRC and TWIx_INT_ENABLE Masks */
1799#define SINIT 0x0001 /* Slave Transfer Initiated */
1800#define SCOMP 0x0002 /* Slave Transfer Complete */
1801#define SERR 0x0004 /* Slave Transfer Error */
1802#define SOVF 0x0008 /* Slave Overflow */
1803#define MCOMP 0x0010 /* Master Transfer Complete */
1804#define MERR 0x0020 /* Master Transfer Error */
1805#define XMTSERV 0x0040 /* Transmit FIFO Service */
1806#define RCVSERV 0x0080 /* Receive FIFO Service */
1807
1808/* TWIx_FIFO_CTL Masks */
1809#define XMTFLUSH 0x0001 /* Transmit Buffer Flush */
1810#define RCVFLUSH 0x0002 /* Receive Buffer Flush */
1811#define XMTINTLEN 0x0004 /* Transmit Buffer Interrupt Length */
1812#define RCVINTLEN 0x0008 /* Receive Buffer Interrupt Length */
1813
1814/* TWIx_FIFO_STAT Masks */
1815#define XMTSTAT 0x0003 /* Transmit FIFO Status */
1816#define XMT_EMPTY 0x0000 /* Transmit FIFO Empty */
1817#define XMT_HALF 0x0001 /* Transmit FIFO Has 1 Byte To Write */
1818#define XMT_FULL 0x0003 /* Transmit FIFO Full (2 Bytes To Write) */
1819
1820#define RCVSTAT 0x000C /* Receive FIFO Status */
1821#define RCV_EMPTY 0x0000 /* Receive FIFO Empty */
1822#define RCV_HALF 0x0004 /* Receive FIFO Has 1 Byte To Read */
1823#define RCV_FULL 0x000C /* Receive FIFO Full (2 Bytes To Read) */
1824
1825#endif 1749#endif
diff --git a/arch/blackfin/mach-bf538/include/mach/defBF539.h b/arch/blackfin/mach-bf538/include/mach/defBF539.h
index 8100bcd01a0d..199e871634b4 100644
--- a/arch/blackfin/mach-bf538/include/mach/defBF539.h
+++ b/arch/blackfin/mach-bf538/include/mach/defBF539.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2008-2010 Analog Devices Inc. 2 * Copyright 2008-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF539_H 7#ifndef _DEF_BF539_H
diff --git a/arch/blackfin/mach-bf548/boards/cm_bf548.c b/arch/blackfin/mach-bf548/boards/cm_bf548.c
index 68af594db48e..e92543362f35 100644
--- a/arch/blackfin/mach-bf548/boards/cm_bf548.c
+++ b/arch/blackfin/mach-bf548/boards/cm_bf548.c
@@ -1007,6 +1007,8 @@ static struct platform_device bf54x_spi_master1 = {
1007#endif /* spi master and devices */ 1007#endif /* spi master and devices */
1008 1008
1009#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 1009#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1010static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
1011
1010static struct resource bfin_twi0_resource[] = { 1012static struct resource bfin_twi0_resource[] = {
1011 [0] = { 1013 [0] = {
1012 .start = TWI0_REGBASE, 1014 .start = TWI0_REGBASE,
@@ -1025,9 +1027,14 @@ static struct platform_device i2c_bfin_twi0_device = {
1025 .id = 0, 1027 .id = 0,
1026 .num_resources = ARRAY_SIZE(bfin_twi0_resource), 1028 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1027 .resource = bfin_twi0_resource, 1029 .resource = bfin_twi0_resource,
1030 .dev = {
1031 .platform_data = &bfin_twi0_pins,
1032 },
1028}; 1033};
1029 1034
1030#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */ 1035#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1036static const u16 bfin_twi1_pins[] = {P_TWI1_SCL, P_TWI1_SDA, 0};
1037
1031static struct resource bfin_twi1_resource[] = { 1038static struct resource bfin_twi1_resource[] = {
1032 [0] = { 1039 [0] = {
1033 .start = TWI1_REGBASE, 1040 .start = TWI1_REGBASE,
@@ -1046,6 +1053,9 @@ static struct platform_device i2c_bfin_twi1_device = {
1046 .id = 1, 1053 .id = 1,
1047 .num_resources = ARRAY_SIZE(bfin_twi1_resource), 1054 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
1048 .resource = bfin_twi1_resource, 1055 .resource = bfin_twi1_resource,
1056 .dev = {
1057 .platform_data = &bfin_twi1_pins,
1058 },
1049}; 1059};
1050#endif 1060#endif
1051#endif 1061#endif
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c
index 4cadaf8d0b56..3bd75bae750d 100644
--- a/arch/blackfin/mach-bf548/boards/ezkit.c
+++ b/arch/blackfin/mach-bf548/boards/ezkit.c
@@ -165,6 +165,7 @@ static struct bfin_rotary_platform_data bfin_rotary_data = {
165 .rotary_button_key = KEY_ENTER, 165 .rotary_button_key = KEY_ENTER,
166 .debounce = 10, /* 0..17 */ 166 .debounce = 10, /* 0..17 */
167 .mode = ROT_QUAD_ENC | ROT_DEBE, 167 .mode = ROT_QUAD_ENC | ROT_DEBE,
168 .pm_wakeup = 1,
168}; 169};
169 170
170static struct resource bfin_rotary_resources[] = { 171static struct resource bfin_rotary_resources[] = {
@@ -1251,6 +1252,8 @@ static struct platform_device bfin_capture_device = {
1251#endif 1252#endif
1252 1253
1253#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) 1254#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1255static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
1256
1254static struct resource bfin_twi0_resource[] = { 1257static struct resource bfin_twi0_resource[] = {
1255 [0] = { 1258 [0] = {
1256 .start = TWI0_REGBASE, 1259 .start = TWI0_REGBASE,
@@ -1269,9 +1272,14 @@ static struct platform_device i2c_bfin_twi0_device = {
1269 .id = 0, 1272 .id = 0,
1270 .num_resources = ARRAY_SIZE(bfin_twi0_resource), 1273 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1271 .resource = bfin_twi0_resource, 1274 .resource = bfin_twi0_resource,
1275 .dev = {
1276 .platform_data = &bfin_twi0_pins,
1277 },
1272}; 1278};
1273 1279
1274#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */ 1280#if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */
1281static const u16 bfin_twi1_pins[] = {P_TWI1_SCL, P_TWI1_SDA, 0};
1282
1275static struct resource bfin_twi1_resource[] = { 1283static struct resource bfin_twi1_resource[] = {
1276 [0] = { 1284 [0] = {
1277 .start = TWI1_REGBASE, 1285 .start = TWI1_REGBASE,
@@ -1290,6 +1298,9 @@ static struct platform_device i2c_bfin_twi1_device = {
1290 .id = 1, 1298 .id = 1,
1291 .num_resources = ARRAY_SIZE(bfin_twi1_resource), 1299 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
1292 .resource = bfin_twi1_resource, 1300 .resource = bfin_twi1_resource,
1301 .dev = {
1302 .platform_data = &bfin_twi1_pins,
1303 },
1293}; 1304};
1294#endif 1305#endif
1295#endif 1306#endif
diff --git a/arch/blackfin/mach-bf548/include/mach/anomaly.h b/arch/blackfin/mach-bf548/include/mach/anomaly.h
index ac96ee83b00e..5b711d85b90b 100644
--- a/arch/blackfin/mach-bf548/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf548/include/mach/anomaly.h
@@ -6,8 +6,7 @@
6 * DO NOT EDIT THIS FILE 6 * DO NOT EDIT THIS FILE
7 * 7 *
8 * Copyright 2004-2011 Analog Devices Inc. 8 * Copyright 2004-2011 Analog Devices Inc.
9 * Licensed under the ADI BSD license. 9 * Licensed under the Clear BSD license.
10 * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
11 */ 10 */
12 11
13/* This file should be up to date with: 12/* This file should be up to date with:
diff --git a/arch/blackfin/mach-bf548/include/mach/defBF542.h b/arch/blackfin/mach-bf548/include/mach/defBF542.h
index 629bf216e2b5..51161575a163 100644
--- a/arch/blackfin/mach-bf548/include/mach/defBF542.h
+++ b/arch/blackfin/mach-bf548/include/mach/defBF542.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2007-2010 Analog Devices Inc. 2 * Copyright 2007-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF542_H 7#ifndef _DEF_BF542_H
diff --git a/arch/blackfin/mach-bf548/include/mach/defBF544.h b/arch/blackfin/mach-bf548/include/mach/defBF544.h
index bcccab36629c..329b2c58228b 100644
--- a/arch/blackfin/mach-bf548/include/mach/defBF544.h
+++ b/arch/blackfin/mach-bf548/include/mach/defBF544.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2007-2010 Analog Devices Inc. 2 * Copyright 2007-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF544_H 7#ifndef _DEF_BF544_H
diff --git a/arch/blackfin/mach-bf548/include/mach/defBF547.h b/arch/blackfin/mach-bf548/include/mach/defBF547.h
index 1fa41ec03f31..e18de212ba1a 100644
--- a/arch/blackfin/mach-bf548/include/mach/defBF547.h
+++ b/arch/blackfin/mach-bf548/include/mach/defBF547.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2008-2010 Analog Devices Inc. 2 * Copyright 2008-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF547_H 7#ifndef _DEF_BF547_H
diff --git a/arch/blackfin/mach-bf548/include/mach/defBF548.h b/arch/blackfin/mach-bf548/include/mach/defBF548.h
index 3c7f1b69349e..27f29481e283 100644
--- a/arch/blackfin/mach-bf548/include/mach/defBF548.h
+++ b/arch/blackfin/mach-bf548/include/mach/defBF548.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2007-2010 Analog Devices Inc. 2 * Copyright 2007-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF548_H 7#ifndef _DEF_BF548_H
diff --git a/arch/blackfin/mach-bf548/include/mach/defBF549.h b/arch/blackfin/mach-bf548/include/mach/defBF549.h
index 9a45cb6b30da..ac569fc12972 100644
--- a/arch/blackfin/mach-bf548/include/mach/defBF549.h
+++ b/arch/blackfin/mach-bf548/include/mach/defBF549.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2007-2010 Analog Devices Inc. 2 * Copyright 2007-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF549_H 7#ifndef _DEF_BF549_H
diff --git a/arch/blackfin/mach-bf548/include/mach/defBF54x_base.h b/arch/blackfin/mach-bf548/include/mach/defBF54x_base.h
index 0867c2bedb43..8f6e1925779d 100644
--- a/arch/blackfin/mach-bf548/include/mach/defBF54x_base.h
+++ b/arch/blackfin/mach-bf548/include/mach/defBF54x_base.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2007-2010 Analog Devices Inc. 2 * Copyright 2007-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF54X_H 7#ifndef _DEF_BF54X_H
@@ -2062,115 +2062,6 @@
2062#define LOW_EVEN 0xff0000 /* Lower Limit for Even Bytes (Luma) */ 2062#define LOW_EVEN 0xff0000 /* Lower Limit for Even Bytes (Luma) */
2063#define HIGH_EVEN 0xff000000 /* Upper Limit for Even Bytes (Luma) */ 2063#define HIGH_EVEN 0xff000000 /* Upper Limit for Even Bytes (Luma) */
2064 2064
2065/* ************************************************ */
2066/* The TWI bit masks fields are from the ADSP-BF538 */
2067/* and they have not been verified as the final */
2068/* ones for the Moab processors ... bz 1/19/2007 */
2069/* ************************************************ */
2070
2071/* Bit masks for TWIx_CONTROL */
2072
2073#define PRESCALE 0x7f /* Prescale Value */
2074#define TWI_ENA 0x80 /* TWI Enable */
2075#define SCCB 0x200 /* Serial Camera Control Bus */
2076
2077/* Bit maskes for TWIx_CLKDIV */
2078
2079#define CLKLOW 0xff /* Clock Low */
2080#define CLKHI 0xff00 /* Clock High */
2081
2082/* Bit maskes for TWIx_SLAVE_CTL */
2083
2084#define SEN 0x1 /* Slave Enable */
2085#define STDVAL 0x4 /* Slave Transmit Data Valid */
2086#define NAK 0x8 /* Not Acknowledge */
2087#define GEN 0x10 /* General Call Enable */
2088
2089/* Bit maskes for TWIx_SLAVE_ADDR */
2090
2091#define SADDR 0x7f /* Slave Mode Address */
2092
2093/* Bit maskes for TWIx_SLAVE_STAT */
2094
2095#define SDIR 0x1 /* Slave Transfer Direction */
2096#define GCALL 0x2 /* General Call */
2097
2098/* Bit maskes for TWIx_MASTER_CTL */
2099
2100#define MEN 0x1 /* Master Mode Enable */
2101#define MDIR 0x4 /* Master Transfer Direction */
2102#define FAST 0x8 /* Fast Mode */
2103#define STOP 0x10 /* Issue Stop Condition */
2104#define RSTART 0x20 /* Repeat Start */
2105#define DCNT 0x3fc0 /* Data Transfer Count */
2106#define SDAOVR 0x4000 /* Serial Data Override */
2107#define SCLOVR 0x8000 /* Serial Clock Override */
2108
2109/* Bit maskes for TWIx_MASTER_ADDR */
2110
2111#define MADDR 0x7f /* Master Mode Address */
2112
2113/* Bit maskes for TWIx_MASTER_STAT */
2114
2115#define MPROG 0x1 /* Master Transfer in Progress */
2116#define LOSTARB 0x2 /* Lost Arbitration */
2117#define ANAK 0x4 /* Address Not Acknowledged */
2118#define DNAK 0x8 /* Data Not Acknowledged */
2119#define BUFRDERR 0x10 /* Buffer Read Error */
2120#define BUFWRERR 0x20 /* Buffer Write Error */
2121#define SDASEN 0x40 /* Serial Data Sense */
2122#define SCLSEN 0x80 /* Serial Clock Sense */
2123#define BUSBUSY 0x100 /* Bus Busy */
2124
2125/* Bit maskes for TWIx_FIFO_CTL */
2126
2127#define XMTFLUSH 0x1 /* Transmit Buffer Flush */
2128#define RCVFLUSH 0x2 /* Receive Buffer Flush */
2129#define XMTINTLEN 0x4 /* Transmit Buffer Interrupt Length */
2130#define RCVINTLEN 0x8 /* Receive Buffer Interrupt Length */
2131
2132/* Bit maskes for TWIx_FIFO_STAT */
2133
2134#define XMTSTAT 0x3 /* Transmit FIFO Status */
2135#define RCVSTAT 0xc /* Receive FIFO Status */
2136
2137/* Bit maskes for TWIx_INT_MASK */
2138
2139#define SINITM 0x1 /* Slave Transfer Initiated Interrupt Mask */
2140#define SCOMPM 0x2 /* Slave Transfer Complete Interrupt Mask */
2141#define SERRM 0x4 /* Slave Transfer Error Interrupt Mask */
2142#define SOVFM 0x8 /* Slave Overflow Interrupt Mask */
2143#define MCOMPM 0x10 /* Master Transfer Complete Interrupt Mask */
2144#define MERRM 0x20 /* Master Transfer Error Interrupt Mask */
2145#define XMTSERVM 0x40 /* Transmit FIFO Service Interrupt Mask */
2146#define RCVSERVM 0x80 /* Receive FIFO Service Interrupt Mask */
2147
2148/* Bit maskes for TWIx_INT_STAT */
2149
2150#define SINIT 0x1 /* Slave Transfer Initiated */
2151#define SCOMP 0x2 /* Slave Transfer Complete */
2152#define SERR 0x4 /* Slave Transfer Error */
2153#define SOVF 0x8 /* Slave Overflow */
2154#define MCOMP 0x10 /* Master Transfer Complete */
2155#define MERR 0x20 /* Master Transfer Error */
2156#define XMTSERV 0x40 /* Transmit FIFO Service */
2157#define RCVSERV 0x80 /* Receive FIFO Service */
2158
2159/* Bit maskes for TWIx_XMT_DATA8 */
2160
2161#define XMTDATA8 0xff /* Transmit FIFO 8-Bit Data */
2162
2163/* Bit maskes for TWIx_XMT_DATA16 */
2164
2165#define XMTDATA16 0xffff /* Transmit FIFO 16-Bit Data */
2166
2167/* Bit maskes for TWIx_RCV_DATA8 */
2168
2169#define RCVDATA8 0xff /* Receive FIFO 8-Bit Data */
2170
2171/* Bit maskes for TWIx_RCV_DATA16 */
2172
2173#define RCVDATA16 0xffff /* Receive FIFO 16-Bit Data */
2174 2065
2175/* ******************************************* */ 2066/* ******************************************* */
2176/* MULTI BIT MACRO ENUMERATIONS */ 2067/* MULTI BIT MACRO ENUMERATIONS */
diff --git a/arch/blackfin/mach-bf561/include/mach/anomaly.h b/arch/blackfin/mach-bf561/include/mach/anomaly.h
index 836baeed303a..72476ff50335 100644
--- a/arch/blackfin/mach-bf561/include/mach/anomaly.h
+++ b/arch/blackfin/mach-bf561/include/mach/anomaly.h
@@ -6,8 +6,7 @@
6 * DO NOT EDIT THIS FILE 6 * DO NOT EDIT THIS FILE
7 * 7 *
8 * Copyright 2004-2011 Analog Devices Inc. 8 * Copyright 2004-2011 Analog Devices Inc.
9 * Licensed under the ADI BSD license. 9 * Licensed under the Clear BSD license.
10 * https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
11 */ 10 */
12 11
13/* This file should be up to date with: 12/* This file should be up to date with:
diff --git a/arch/blackfin/mach-bf561/include/mach/defBF561.h b/arch/blackfin/mach-bf561/include/mach/defBF561.h
index 5f0ac5a77a37..9f21f768c63a 100644
--- a/arch/blackfin/mach-bf561/include/mach/defBF561.h
+++ b/arch/blackfin/mach-bf561/include/mach/defBF561.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright 2005-2010 Analog Devices Inc. 2 * Copyright 2005-2010 Analog Devices Inc.
3 * 3 *
4 * Licensed under the ADI BSD license or the GPL-2 (or later) 4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */ 5 */
6 6
7#ifndef _DEF_BF561_H 7#ifndef _DEF_BF561_H
diff --git a/arch/blackfin/mach-bf609/Kconfig b/arch/blackfin/mach-bf609/Kconfig
new file mode 100644
index 000000000000..2cb727243778
--- /dev/null
+++ b/arch/blackfin/mach-bf609/Kconfig
@@ -0,0 +1,56 @@
1config BF60x
2 def_bool y
3 depends on (BF609)
4 select IRQ_PREFLOW_FASTEOI
5
6if (BF60x)
7
8source "arch/blackfin/mach-bf609/boards/Kconfig"
9
10menu "BF609 Specific Configuration"
11
12comment "Pin Interrupt to Port Assignment"
13menu "Assignment"
14
15config PINTx_REASSIGN
16 bool "Reprogram PINT Assignment"
17 default y
18 help
19 The interrupt assignment registers controls the pin-to-interrupt
20 assignment in a byte-wide manner. Each option allows you to select
21 a set of pins (High/Low Byte) of an specific Port being mapped
22 to one of the four PIN Interrupts IRQ_PINTx.
23
24 You shouldn't change any of these unless you know exactly what you're doing.
25 Please consult the Blackfin BF60x Processor Hardware Reference Manual.
26
27config PINT0_ASSIGN
28 hex "PINT0_ASSIGN"
29 depends on PINTx_REASSIGN
30 default 0x00000101
31config PINT1_ASSIGN
32 hex "PINT1_ASSIGN"
33 depends on PINTx_REASSIGN
34 default 0x00000101
35config PINT2_ASSIGN
36 hex "PINT2_ASSIGN"
37 depends on PINTx_REASSIGN
38 default 0x00000101
39config PINT3_ASSIGN
40 hex "PINT3_ASSIGN"
41 depends on PINTx_REASSIGN
42 default 0x00000101
43config PINT4_ASSIGN
44 hex "PINT3_ASSIGN"
45 depends on PINTx_REASSIGN
46 default 0x00000101
47config PINT5_ASSIGN
48 hex "PINT3_ASSIGN"
49 depends on PINTx_REASSIGN
50 default 0x00000101
51
52endmenu
53
54endmenu
55
56endif
diff --git a/arch/blackfin/mach-bf609/Makefile b/arch/blackfin/mach-bf609/Makefile
new file mode 100644
index 000000000000..2a27f8174543
--- /dev/null
+++ b/arch/blackfin/mach-bf609/Makefile
@@ -0,0 +1,6 @@
1#
2# arch/blackfin/mach-bf609/Makefile
3#
4
5obj-y := dma.o clock.o
6obj-$(CONFIG_PM) += pm.o hibernate.o
diff --git a/arch/blackfin/mach-bf609/boards/Kconfig b/arch/blackfin/mach-bf609/boards/Kconfig
new file mode 100644
index 000000000000..30e8b6b0d2ed
--- /dev/null
+++ b/arch/blackfin/mach-bf609/boards/Kconfig
@@ -0,0 +1,12 @@
1choice
2 prompt "System type"
3 default BFIN609_EZKIT
4 help
5 Select your board!
6
7config BFIN609_EZKIT
8 bool "BF609-EZKIT"
9 help
10 BFIN609-EZKIT board support.
11
12endchoice
diff --git a/arch/blackfin/mach-bf609/boards/Makefile b/arch/blackfin/mach-bf609/boards/Makefile
new file mode 100644
index 000000000000..11f98b0882ea
--- /dev/null
+++ b/arch/blackfin/mach-bf609/boards/Makefile
@@ -0,0 +1,5 @@
1#
2# arch/blackfin/mach-bf609/boards/Makefile
3#
4
5obj-$(CONFIG_BFIN609_EZKIT) += ezkit.o
diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c
new file mode 100644
index 000000000000..ac64f47217c1
--- /dev/null
+++ b/arch/blackfin/mach-bf609/boards/ezkit.c
@@ -0,0 +1,1340 @@
1/*
2 * Copyright 2004-2009 Analog Devices Inc.
3 * 2005 National ICT Australia (NICTA)
4 * Aidan Williams <aidan@nicta.com.au>
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#include <linux/device.h>
10#include <linux/platform_device.h>
11#include <linux/mtd/mtd.h>
12#include <linux/mtd/partitions.h>
13#include <linux/mtd/physmap.h>
14#include <linux/spi/spi.h>
15#include <linux/spi/flash.h>
16#include <linux/irq.h>
17#include <linux/i2c.h>
18#include <linux/interrupt.h>
19#include <linux/usb/musb.h>
20#include <asm/bfin6xx_spi.h>
21#include <asm/dma.h>
22#include <asm/gpio.h>
23#include <asm/nand.h>
24#include <asm/dpmc.h>
25#include <asm/portmux.h>
26#include <asm/bfin_sdh.h>
27#include <linux/input.h>
28#include <linux/spi/ad7877.h>
29
30/*
31 * Name the Board for the /proc/cpuinfo
32 */
33const char bfin_board_name[] = "ADI BF609-EZKIT";
34
35/*
36 * Driver needs to know address, irq and flag pin.
37 */
38
39#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
40#include <linux/usb/isp1760.h>
41static struct resource bfin_isp1760_resources[] = {
42 [0] = {
43 .start = 0x2C0C0000,
44 .end = 0x2C0C0000 + 0xfffff,
45 .flags = IORESOURCE_MEM,
46 },
47 [1] = {
48 .start = IRQ_PG7,
49 .end = IRQ_PG7,
50 .flags = IORESOURCE_IRQ,
51 },
52};
53
54static struct isp1760_platform_data isp1760_priv = {
55 .is_isp1761 = 0,
56 .bus_width_16 = 1,
57 .port1_otg = 0,
58 .analog_oc = 0,
59 .dack_polarity_high = 0,
60 .dreq_polarity_high = 0,
61};
62
63static struct platform_device bfin_isp1760_device = {
64 .name = "isp1760",
65 .id = 0,
66 .dev = {
67 .platform_data = &isp1760_priv,
68 },
69 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
70 .resource = bfin_isp1760_resources,
71};
72#endif
73
74#if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
75#include <asm/bfin_rotary.h>
76
77static struct bfin_rotary_platform_data bfin_rotary_data = {
78 /*.rotary_up_key = KEY_UP,*/
79 /*.rotary_down_key = KEY_DOWN,*/
80 .rotary_rel_code = REL_WHEEL,
81 .rotary_button_key = KEY_ENTER,
82 .debounce = 10, /* 0..17 */
83 .mode = ROT_QUAD_ENC | ROT_DEBE,
84};
85
86static struct resource bfin_rotary_resources[] = {
87 {
88 .start = IRQ_CNT,
89 .end = IRQ_CNT,
90 .flags = IORESOURCE_IRQ,
91 },
92};
93
94static struct platform_device bfin_rotary_device = {
95 .name = "bfin-rotary",
96 .id = -1,
97 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
98 .resource = bfin_rotary_resources,
99 .dev = {
100 .platform_data = &bfin_rotary_data,
101 },
102};
103#endif
104
105#if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
106#include <linux/stmmac.h>
107
108static unsigned short pins[] = P_RMII0;
109
110static struct stmmac_mdio_bus_data phy_private_data = {
111 .bus_id = 0,
112 .phy_mask = 1,
113};
114
115static struct plat_stmmacenet_data eth_private_data = {
116 .bus_id = 0,
117 .enh_desc = 1,
118 .phy_addr = 1,
119 .mdio_bus_data = &phy_private_data,
120};
121
122static struct platform_device bfin_eth_device = {
123 .name = "stmmaceth",
124 .id = 0,
125 .num_resources = 2,
126 .resource = (struct resource[]) {
127 {
128 .start = EMAC0_MACCFG,
129 .end = EMAC0_MACCFG + 0x1274,
130 .flags = IORESOURCE_MEM,
131 },
132 {
133 .name = "macirq",
134 .start = IRQ_EMAC0_STAT,
135 .end = IRQ_EMAC0_STAT,
136 .flags = IORESOURCE_IRQ,
137 },
138 },
139 .dev = {
140 .power.can_wakeup = 1,
141 .platform_data = &eth_private_data,
142 }
143};
144#endif
145
146#if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
147#include <linux/input/adxl34x.h>
148static const struct adxl34x_platform_data adxl34x_info = {
149 .x_axis_offset = 0,
150 .y_axis_offset = 0,
151 .z_axis_offset = 0,
152 .tap_threshold = 0x31,
153 .tap_duration = 0x10,
154 .tap_latency = 0x60,
155 .tap_window = 0xF0,
156 .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
157 .act_axis_control = 0xFF,
158 .activity_threshold = 5,
159 .inactivity_threshold = 3,
160 .inactivity_time = 4,
161 .free_fall_threshold = 0x7,
162 .free_fall_time = 0x20,
163 .data_rate = 0x8,
164 .data_range = ADXL_FULL_RES,
165
166 .ev_type = EV_ABS,
167 .ev_code_x = ABS_X, /* EV_REL */
168 .ev_code_y = ABS_Y, /* EV_REL */
169 .ev_code_z = ABS_Z, /* EV_REL */
170
171 .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
172
173/* .ev_code_ff = KEY_F,*/ /* EV_KEY */
174/* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
175 .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
176 .fifo_mode = ADXL_FIFO_STREAM,
177 .orientation_enable = ADXL_EN_ORIENTATION_3D,
178 .deadzone_angle = ADXL_DEADZONE_ANGLE_10p8,
179 .divisor_length = ADXL_LP_FILTER_DIVISOR_16,
180 /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
181 .ev_codes_orient_3d = {BTN_Z, BTN_Y, BTN_X, BTN_A, BTN_B, BTN_C},
182};
183#endif
184
185#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
186static struct platform_device rtc_device = {
187 .name = "rtc-bfin",
188 .id = -1,
189};
190#endif
191
192#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
193#ifdef CONFIG_SERIAL_BFIN_UART0
194static struct resource bfin_uart0_resources[] = {
195 {
196 .start = UART0_REVID,
197 .end = UART0_RXDIV+4,
198 .flags = IORESOURCE_MEM,
199 },
200 {
201 .start = IRQ_UART0_TX,
202 .end = IRQ_UART0_TX,
203 .flags = IORESOURCE_IRQ,
204 },
205 {
206 .start = IRQ_UART0_RX,
207 .end = IRQ_UART0_RX,
208 .flags = IORESOURCE_IRQ,
209 },
210 {
211 .start = IRQ_UART0_STAT,
212 .end = IRQ_UART0_STAT,
213 .flags = IORESOURCE_IRQ,
214 },
215 {
216 .start = CH_UART0_TX,
217 .end = CH_UART0_TX,
218 .flags = IORESOURCE_DMA,
219 },
220 {
221 .start = CH_UART0_RX,
222 .end = CH_UART0_RX,
223 .flags = IORESOURCE_DMA,
224 },
225#ifdef CONFIG_BFIN_UART0_CTSRTS
226 { /* CTS pin -- 0 means not supported */
227 .start = GPIO_PD10,
228 .end = GPIO_PD10,
229 .flags = IORESOURCE_IO,
230 },
231 { /* RTS pin -- 0 means not supported */
232 .start = GPIO_PD9,
233 .end = GPIO_PD9,
234 .flags = IORESOURCE_IO,
235 },
236#endif
237};
238
239static unsigned short bfin_uart0_peripherals[] = {
240 P_UART0_TX, P_UART0_RX,
241#ifdef CONFIG_BFIN_UART0_CTSRTS
242 P_UART0_RTS, P_UART0_CTS,
243#endif
244 0
245};
246
247static struct platform_device bfin_uart0_device = {
248 .name = "bfin-uart",
249 .id = 0,
250 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
251 .resource = bfin_uart0_resources,
252 .dev = {
253 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
254 },
255};
256#endif
257#ifdef CONFIG_SERIAL_BFIN_UART1
258static struct resource bfin_uart1_resources[] = {
259 {
260 .start = UART1_REVID,
261 .end = UART1_RXDIV+4,
262 .flags = IORESOURCE_MEM,
263 },
264 {
265 .start = IRQ_UART1_TX,
266 .end = IRQ_UART1_TX,
267 .flags = IORESOURCE_IRQ,
268 },
269 {
270 .start = IRQ_UART1_RX,
271 .end = IRQ_UART1_RX,
272 .flags = IORESOURCE_IRQ,
273 },
274 {
275 .start = IRQ_UART1_STAT,
276 .end = IRQ_UART1_STAT,
277 .flags = IORESOURCE_IRQ,
278 },
279 {
280 .start = CH_UART1_TX,
281 .end = CH_UART1_TX,
282 .flags = IORESOURCE_DMA,
283 },
284 {
285 .start = CH_UART1_RX,
286 .end = CH_UART1_RX,
287 .flags = IORESOURCE_DMA,
288 },
289#ifdef CONFIG_BFIN_UART1_CTSRTS
290 { /* CTS pin -- 0 means not supported */
291 .start = GPIO_PG13,
292 .end = GPIO_PG13,
293 .flags = IORESOURCE_IO,
294 },
295 { /* RTS pin -- 0 means not supported */
296 .start = GPIO_PG10,
297 .end = GPIO_PG10,
298 .flags = IORESOURCE_IO,
299 },
300#endif
301};
302
303static unsigned short bfin_uart1_peripherals[] = {
304 P_UART1_TX, P_UART1_RX,
305#ifdef CONFIG_BFIN_UART1_CTSRTS
306 P_UART1_RTS, P_UART1_CTS,
307#endif
308 0
309};
310
311static struct platform_device bfin_uart1_device = {
312 .name = "bfin-uart",
313 .id = 1,
314 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
315 .resource = bfin_uart1_resources,
316 .dev = {
317 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
318 },
319};
320#endif
321#endif
322
323#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
324#ifdef CONFIG_BFIN_SIR0
325static struct resource bfin_sir0_resources[] = {
326 {
327 .start = 0xFFC00400,
328 .end = 0xFFC004FF,
329 .flags = IORESOURCE_MEM,
330 },
331 {
332 .start = IRQ_UART0_TX,
333 .end = IRQ_UART0_TX+1,
334 .flags = IORESOURCE_IRQ,
335 },
336 {
337 .start = CH_UART0_TX,
338 .end = CH_UART0_TX+1,
339 .flags = IORESOURCE_DMA,
340 },
341};
342static struct platform_device bfin_sir0_device = {
343 .name = "bfin_sir",
344 .id = 0,
345 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
346 .resource = bfin_sir0_resources,
347};
348#endif
349#ifdef CONFIG_BFIN_SIR1
350static struct resource bfin_sir1_resources[] = {
351 {
352 .start = 0xFFC02000,
353 .end = 0xFFC020FF,
354 .flags = IORESOURCE_MEM,
355 },
356 {
357 .start = IRQ_UART1_TX,
358 .end = IRQ_UART1_TX+1,
359 .flags = IORESOURCE_IRQ,
360 },
361 {
362 .start = CH_UART1_TX,
363 .end = CH_UART1_TX+1,
364 .flags = IORESOURCE_DMA,
365 },
366};
367static struct platform_device bfin_sir1_device = {
368 .name = "bfin_sir",
369 .id = 1,
370 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
371 .resource = bfin_sir1_resources,
372};
373#endif
374#endif
375
376#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
377static struct resource musb_resources[] = {
378 [0] = {
379 .start = 0xFFCC1000,
380 .end = 0xFFCC1398,
381 .flags = IORESOURCE_MEM,
382 },
383 [1] = { /* general IRQ */
384 .start = IRQ_USB_STAT,
385 .end = IRQ_USB_STAT,
386 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
387 .name = "mc"
388 },
389 [2] = { /* DMA IRQ */
390 .start = IRQ_USB_DMA,
391 .end = IRQ_USB_DMA,
392 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
393 .name = "dma"
394 },
395};
396
397static struct musb_hdrc_config musb_config = {
398 .multipoint = 1,
399 .dyn_fifo = 0,
400 .dma = 1,
401 .num_eps = 16,
402 .dma_channels = 8,
403 .clkin = 48, /* musb CLKIN in MHZ */
404};
405
406static struct musb_hdrc_platform_data musb_plat = {
407#if defined(CONFIG_USB_MUSB_HDRC) && defined(CONFIG_USB_GADGET_MUSB_HDRC)
408 .mode = MUSB_OTG,
409#elif defined(CONFIG_USB_MUSB_HDRC)
410 .mode = MUSB_HOST,
411#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
412 .mode = MUSB_PERIPHERAL,
413#endif
414 .config = &musb_config,
415};
416
417static u64 musb_dmamask = ~(u32)0;
418
419static struct platform_device musb_device = {
420 .name = "musb-blackfin",
421 .id = 0,
422 .dev = {
423 .dma_mask = &musb_dmamask,
424 .coherent_dma_mask = 0xffffffff,
425 .platform_data = &musb_plat,
426 },
427 .num_resources = ARRAY_SIZE(musb_resources),
428 .resource = musb_resources,
429};
430#endif
431
432#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
433#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
434static struct resource bfin_sport0_uart_resources[] = {
435 {
436 .start = SPORT0_TCR1,
437 .end = SPORT0_MRCS3+4,
438 .flags = IORESOURCE_MEM,
439 },
440 {
441 .start = IRQ_SPORT0_RX,
442 .end = IRQ_SPORT0_RX+1,
443 .flags = IORESOURCE_IRQ,
444 },
445 {
446 .start = IRQ_SPORT0_ERROR,
447 .end = IRQ_SPORT0_ERROR,
448 .flags = IORESOURCE_IRQ,
449 },
450};
451
452static unsigned short bfin_sport0_peripherals[] = {
453 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
454 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
455};
456
457static struct platform_device bfin_sport0_uart_device = {
458 .name = "bfin-sport-uart",
459 .id = 0,
460 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
461 .resource = bfin_sport0_uart_resources,
462 .dev = {
463 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
464 },
465};
466#endif
467#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
468static struct resource bfin_sport1_uart_resources[] = {
469 {
470 .start = SPORT1_TCR1,
471 .end = SPORT1_MRCS3+4,
472 .flags = IORESOURCE_MEM,
473 },
474 {
475 .start = IRQ_SPORT1_RX,
476 .end = IRQ_SPORT1_RX+1,
477 .flags = IORESOURCE_IRQ,
478 },
479 {
480 .start = IRQ_SPORT1_ERROR,
481 .end = IRQ_SPORT1_ERROR,
482 .flags = IORESOURCE_IRQ,
483 },
484};
485
486static unsigned short bfin_sport1_peripherals[] = {
487 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
488 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
489};
490
491static struct platform_device bfin_sport1_uart_device = {
492 .name = "bfin-sport-uart",
493 .id = 1,
494 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
495 .resource = bfin_sport1_uart_resources,
496 .dev = {
497 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
498 },
499};
500#endif
501#ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
502static struct resource bfin_sport2_uart_resources[] = {
503 {
504 .start = SPORT2_TCR1,
505 .end = SPORT2_MRCS3+4,
506 .flags = IORESOURCE_MEM,
507 },
508 {
509 .start = IRQ_SPORT2_RX,
510 .end = IRQ_SPORT2_RX+1,
511 .flags = IORESOURCE_IRQ,
512 },
513 {
514 .start = IRQ_SPORT2_ERROR,
515 .end = IRQ_SPORT2_ERROR,
516 .flags = IORESOURCE_IRQ,
517 },
518};
519
520static unsigned short bfin_sport2_peripherals[] = {
521 P_SPORT2_TFS, P_SPORT2_DTPRI, P_SPORT2_TSCLK, P_SPORT2_RFS,
522 P_SPORT2_DRPRI, P_SPORT2_RSCLK, P_SPORT2_DRSEC, P_SPORT2_DTSEC, 0
523};
524
525static struct platform_device bfin_sport2_uart_device = {
526 .name = "bfin-sport-uart",
527 .id = 2,
528 .num_resources = ARRAY_SIZE(bfin_sport2_uart_resources),
529 .resource = bfin_sport2_uart_resources,
530 .dev = {
531 .platform_data = &bfin_sport2_peripherals, /* Passed to driver */
532 },
533};
534#endif
535#endif
536
537#if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
538
539static unsigned short bfin_can0_peripherals[] = {
540 P_CAN0_RX, P_CAN0_TX, 0
541};
542
543static struct resource bfin_can0_resources[] = {
544 {
545 .start = 0xFFC00A00,
546 .end = 0xFFC00FFF,
547 .flags = IORESOURCE_MEM,
548 },
549 {
550 .start = IRQ_CAN0_RX,
551 .end = IRQ_CAN0_RX,
552 .flags = IORESOURCE_IRQ,
553 },
554 {
555 .start = IRQ_CAN0_TX,
556 .end = IRQ_CAN0_TX,
557 .flags = IORESOURCE_IRQ,
558 },
559 {
560 .start = IRQ_CAN0_STAT,
561 .end = IRQ_CAN0_STAT,
562 .flags = IORESOURCE_IRQ,
563 },
564};
565
566static struct platform_device bfin_can0_device = {
567 .name = "bfin_can",
568 .id = 0,
569 .num_resources = ARRAY_SIZE(bfin_can0_resources),
570 .resource = bfin_can0_resources,
571 .dev = {
572 .platform_data = &bfin_can0_peripherals, /* Passed to driver */
573 },
574};
575
576#endif
577
578#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
579static struct mtd_partition partition_info[] = {
580 {
581 .name = "bootloader(nand)",
582 .offset = 0,
583 .size = 0x80000,
584 }, {
585 .name = "linux kernel(nand)",
586 .offset = MTDPART_OFS_APPEND,
587 .size = 4 * 1024 * 1024,
588 },
589 {
590 .name = "file system(nand)",
591 .offset = MTDPART_OFS_APPEND,
592 .size = MTDPART_SIZ_FULL,
593 },
594};
595
596static struct bf5xx_nand_platform bfin_nand_platform = {
597 .data_width = NFC_NWIDTH_8,
598 .partitions = partition_info,
599 .nr_partitions = ARRAY_SIZE(partition_info),
600 .rd_dly = 3,
601 .wr_dly = 3,
602};
603
604static struct resource bfin_nand_resources[] = {
605 {
606 .start = 0xFFC03B00,
607 .end = 0xFFC03B4F,
608 .flags = IORESOURCE_MEM,
609 },
610 {
611 .start = CH_NFC,
612 .end = CH_NFC,
613 .flags = IORESOURCE_IRQ,
614 },
615};
616
617static struct platform_device bfin_nand_device = {
618 .name = "bfin-nand",
619 .id = 0,
620 .num_resources = ARRAY_SIZE(bfin_nand_resources),
621 .resource = bfin_nand_resources,
622 .dev = {
623 .platform_data = &bfin_nand_platform,
624 },
625};
626#endif
627
628#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
629
630static struct bfin_sd_host bfin_sdh_data = {
631 .dma_chan = CH_RSI,
632 .irq_int0 = IRQ_RSI_INT0,
633 .pin_req = {P_RSI_DATA0, P_RSI_DATA1, P_RSI_DATA2, P_RSI_DATA3, P_RSI_CMD, P_RSI_CLK, 0},
634};
635
636static struct platform_device bfin_sdh_device = {
637 .name = "bfin-sdh",
638 .id = 0,
639 .dev = {
640 .platform_data = &bfin_sdh_data,
641 },
642};
643#endif
644
645#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
646static struct mtd_partition ezkit_partitions[] = {
647 {
648 .name = "bootloader(nor)",
649 .size = 0x80000,
650 .offset = 0,
651 }, {
652 .name = "linux kernel(nor)",
653 .size = 0x400000,
654 .offset = MTDPART_OFS_APPEND,
655 }, {
656 .name = "file system(nor)",
657 .size = 0x1000000 - 0x80000 - 0x400000,
658 .offset = MTDPART_OFS_APPEND,
659 },
660};
661
662int bf609_nor_flash_init(struct platform_device *dev)
663{
664#define CONFIG_SMC_GCTL_VAL 0x00000010
665 const unsigned short pins[] = {
666 P_A3, P_A4, P_A5, P_A6, P_A7, P_A8, P_A9, P_A10, P_A11, P_A12,
667 P_A13, P_A14, P_A15, P_A16, P_A17, P_A18, P_A19, P_A20, P_A21,
668 P_A22, P_A23, P_A24, P_A25, P_NORCK, 0,
669 };
670
671 peripheral_request_list(pins, "smc0");
672
673 bfin_write32(SMC_GCTL, CONFIG_SMC_GCTL_VAL);
674 bfin_write32(SMC_B0CTL, 0x01002011);
675 bfin_write32(SMC_B0TIM, 0x08170977);
676 bfin_write32(SMC_B0ETIM, 0x00092231);
677 return 0;
678}
679
680static struct physmap_flash_data ezkit_flash_data = {
681 .width = 2,
682 .parts = ezkit_partitions,
683 .init = bf609_nor_flash_init,
684 .nr_parts = ARRAY_SIZE(ezkit_partitions),
685};
686
687static struct resource ezkit_flash_resource = {
688 .start = 0xb0000000,
689 .end = 0xb0ffffff,
690 .flags = IORESOURCE_MEM,
691};
692
693static struct platform_device ezkit_flash_device = {
694 .name = "physmap-flash",
695 .id = 0,
696 .dev = {
697 .platform_data = &ezkit_flash_data,
698 },
699 .num_resources = 1,
700 .resource = &ezkit_flash_resource,
701};
702#endif
703
704#if defined(CONFIG_MTD_M25P80) \
705 || defined(CONFIG_MTD_M25P80_MODULE)
706/* SPI flash chip (w25q32) */
707static struct mtd_partition bfin_spi_flash_partitions[] = {
708 {
709 .name = "bootloader(spi)",
710 .size = 0x00080000,
711 .offset = 0,
712 .mask_flags = MTD_CAP_ROM
713 }, {
714 .name = "linux kernel(spi)",
715 .size = 0x00180000,
716 .offset = MTDPART_OFS_APPEND,
717 }, {
718 .name = "file system(spi)",
719 .size = MTDPART_SIZ_FULL,
720 .offset = MTDPART_OFS_APPEND,
721 }
722};
723
724static struct flash_platform_data bfin_spi_flash_data = {
725 .name = "m25p80",
726 .parts = bfin_spi_flash_partitions,
727 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
728 .type = "w25q32",
729};
730
731static struct bfin6xx_spi_chip spi_flash_chip_info = {
732 .enable_dma = true, /* use dma transfer with this chip*/
733};
734#endif
735
736#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
737static struct bfin6xx_spi_chip spidev_chip_info = {
738 .enable_dma = true,
739};
740#endif
741
742#if defined(CONFIG_SND_BF6XX_I2S) || defined(CONFIG_SND_BF6XX_I2S_MODULE)
743static struct platform_device bfin_i2s_pcm = {
744 .name = "bfin-i2s-pcm-audio",
745 .id = -1,
746};
747#endif
748
749#if defined(CONFIG_SND_BF6XX_SOC_I2S) || \
750 defined(CONFIG_SND_BF6XX_SOC_I2S_MODULE)
751#include <asm/bfin_sport3.h>
752static struct resource bfin_snd_resources[] = {
753 {
754 .start = SPORT0_CTL_A,
755 .end = SPORT0_CTL_A,
756 .flags = IORESOURCE_MEM,
757 },
758 {
759 .start = SPORT0_CTL_B,
760 .end = SPORT0_CTL_B,
761 .flags = IORESOURCE_MEM,
762 },
763 {
764 .start = CH_SPORT0_TX,
765 .end = CH_SPORT0_TX,
766 .flags = IORESOURCE_DMA,
767 },
768 {
769 .start = CH_SPORT0_RX,
770 .end = CH_SPORT0_RX,
771 .flags = IORESOURCE_DMA,
772 },
773 {
774 .start = IRQ_SPORT0_TX_STAT,
775 .end = IRQ_SPORT0_TX_STAT,
776 .flags = IORESOURCE_IRQ,
777 },
778 {
779 .start = IRQ_SPORT0_RX_STAT,
780 .end = IRQ_SPORT0_RX_STAT,
781 .flags = IORESOURCE_IRQ,
782 },
783};
784
785static const unsigned short bfin_snd_pin[] = {
786 P_SPORT0_ACLK, P_SPORT0_AFS, P_SPORT0_AD0, P_SPORT0_BCLK,
787 P_SPORT0_BFS, P_SPORT0_BD0, 0,
788};
789
790static struct bfin_snd_platform_data bfin_snd_data = {
791 .pin_req = bfin_snd_pin,
792};
793
794static struct platform_device bfin_i2s = {
795 .name = "bfin-i2s",
796 .num_resources = ARRAY_SIZE(bfin_snd_resources),
797 .resource = bfin_snd_resources,
798 .dev = {
799 .platform_data = &bfin_snd_data,
800 },
801};
802#endif
803
804#if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) || \
805 defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61_MODULE)
806static struct platform_device adau1761_device = {
807 .name = "bfin-eval-adau1x61",
808};
809#endif
810
811#if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
812#include <sound/adau17x1.h>
813static struct adau1761_platform_data adau1761_info = {
814 .lineout_mode = ADAU1761_OUTPUT_MODE_LINE,
815 .headphone_mode = ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS,
816};
817#endif
818
819#if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
820 || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
821#include <linux/videodev2.h>
822#include <media/blackfin/bfin_capture.h>
823#include <media/blackfin/ppi.h>
824
825static const unsigned short ppi_req[] = {
826 P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3,
827 P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7,
828 P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2,
829 0,
830};
831
832static const struct ppi_info ppi_info = {
833 .type = PPI_TYPE_EPPI3,
834 .dma_ch = CH_EPPI0_CH0,
835 .irq_err = IRQ_EPPI0_STAT,
836 .base = (void __iomem *)EPPI0_STAT,
837 .pin_req = ppi_req,
838};
839
840#if defined(CONFIG_VIDEO_VS6624) \
841 || defined(CONFIG_VIDEO_VS6624_MODULE)
842static struct v4l2_input vs6624_inputs[] = {
843 {
844 .index = 0,
845 .name = "Camera",
846 .type = V4L2_INPUT_TYPE_CAMERA,
847 .std = V4L2_STD_UNKNOWN,
848 },
849};
850
851static struct bcap_route vs6624_routes[] = {
852 {
853 .input = 0,
854 .output = 0,
855 },
856};
857
858static const unsigned vs6624_ce_pin = GPIO_PD1;
859
860static struct bfin_capture_config bfin_capture_data = {
861 .card_name = "BF609",
862 .inputs = vs6624_inputs,
863 .num_inputs = ARRAY_SIZE(vs6624_inputs),
864 .routes = vs6624_routes,
865 .i2c_adapter_id = 0,
866 .board_info = {
867 .type = "vs6624",
868 .addr = 0x10,
869 .platform_data = (void *)&vs6624_ce_pin,
870 },
871 .ppi_info = &ppi_info,
872 .ppi_control = (PACK_EN | DLEN_8 | EPPI_CTL_FS1HI_FS2HI
873 | EPPI_CTL_POLC3 | EPPI_CTL_SYNC2 | EPPI_CTL_NON656),
874 .blank_clocks = 8,
875};
876#endif
877
878static struct platform_device bfin_capture_device = {
879 .name = "bfin_capture",
880 .dev = {
881 .platform_data = &bfin_capture_data,
882 },
883};
884#endif
885
886#if defined(CONFIG_BFIN_CRC)
887#define BFIN_CRC_NAME "bfin-crc"
888
889static struct resource bfin_crc0_resources[] = {
890 {
891 .start = REG_CRC0_CTL,
892 .end = REG_CRC0_REVID+4,
893 .flags = IORESOURCE_MEM,
894 },
895 {
896 .start = IRQ_CRC0_DCNTEXP,
897 .end = IRQ_CRC0_DCNTEXP,
898 .flags = IORESOURCE_IRQ,
899 },
900 {
901 .start = CH_MEM_STREAM0_SRC_CRC0,
902 .end = CH_MEM_STREAM0_SRC_CRC0,
903 .flags = IORESOURCE_DMA,
904 },
905 {
906 .start = CH_MEM_STREAM0_DEST_CRC0,
907 .end = CH_MEM_STREAM0_DEST_CRC0,
908 .flags = IORESOURCE_DMA,
909 },
910};
911
912static struct platform_device bfin_crc0_device = {
913 .name = BFIN_CRC_NAME,
914 .id = 0,
915 .num_resources = ARRAY_SIZE(bfin_crc0_resources),
916 .resource = bfin_crc0_resources,
917};
918
919static struct resource bfin_crc1_resources[] = {
920 {
921 .start = REG_CRC1_CTL,
922 .end = REG_CRC1_REVID+4,
923 .flags = IORESOURCE_MEM,
924 },
925 {
926 .start = IRQ_CRC1_DCNTEXP,
927 .end = IRQ_CRC1_DCNTEXP,
928 .flags = IORESOURCE_IRQ,
929 },
930 {
931 .start = CH_MEM_STREAM1_SRC_CRC1,
932 .end = CH_MEM_STREAM1_SRC_CRC1,
933 .flags = IORESOURCE_DMA,
934 },
935 {
936 .start = CH_MEM_STREAM1_DEST_CRC1,
937 .end = CH_MEM_STREAM1_DEST_CRC1,
938 .flags = IORESOURCE_DMA,
939 },
940};
941
942static struct platform_device bfin_crc1_device = {
943 .name = BFIN_CRC_NAME,
944 .id = 1,
945 .num_resources = ARRAY_SIZE(bfin_crc1_resources),
946 .resource = bfin_crc1_resources,
947};
948#endif
949
950#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
951static const struct ad7877_platform_data bfin_ad7877_ts_info = {
952 .model = 7877,
953 .vref_delay_usecs = 50, /* internal, no capacitor */
954 .x_plate_ohms = 419,
955 .y_plate_ohms = 486,
956 .pressure_max = 1000,
957 .pressure_min = 0,
958 .stopacq_polarity = 1,
959 .first_conversion_delay = 3,
960 .acquisition_time = 1,
961 .averaging = 1,
962 .pen_down_acc_interval = 1,
963};
964#endif
965
966static struct spi_board_info bfin_spi_board_info[] __initdata = {
967#if defined(CONFIG_MTD_M25P80) \
968 || defined(CONFIG_MTD_M25P80_MODULE)
969 {
970 /* the modalias must be the same as spi device driver name */
971 .modalias = "m25p80", /* Name of spi_driver for this device */
972 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
973 .bus_num = 0, /* Framework bus number */
974 .chip_select = 1, /* SPI_SSEL1*/
975 .platform_data = &bfin_spi_flash_data,
976 .controller_data = &spi_flash_chip_info,
977 .mode = SPI_MODE_3,
978 },
979#endif
980#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
981 {
982 .modalias = "ad7877",
983 .platform_data = &bfin_ad7877_ts_info,
984 .irq = IRQ_PB4, /* old boards (<=Rev 1.3) use IRQ_PJ11 */
985 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
986 .bus_num = 0,
987 .chip_select = 2,
988 },
989#endif
990#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
991 {
992 .modalias = "spidev",
993 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
994 .bus_num = 0,
995 .chip_select = 1,
996 .controller_data = &spidev_chip_info,
997 },
998#endif
999#if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
1000 {
1001 .modalias = "adxl34x",
1002 .platform_data = &adxl34x_info,
1003 .irq = IRQ_PC5,
1004 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
1005 .bus_num = 1,
1006 .chip_select = 2,
1007 .mode = SPI_MODE_3,
1008 },
1009#endif
1010};
1011#if defined(CONFIG_SPI_BFIN6XX) || defined(CONFIG_SPI_BFIN6XX_MODULE)
1012/* SPI (0) */
1013static struct resource bfin_spi0_resource[] = {
1014 {
1015 .start = SPI0_REGBASE,
1016 .end = SPI0_REGBASE + 0xFF,
1017 .flags = IORESOURCE_MEM,
1018 },
1019 {
1020 .start = CH_SPI0_TX,
1021 .end = CH_SPI0_TX,
1022 .flags = IORESOURCE_DMA,
1023 },
1024 {
1025 .start = CH_SPI0_RX,
1026 .end = CH_SPI0_RX,
1027 .flags = IORESOURCE_DMA,
1028 },
1029};
1030
1031/* SPI (1) */
1032static struct resource bfin_spi1_resource[] = {
1033 {
1034 .start = SPI1_REGBASE,
1035 .end = SPI1_REGBASE + 0xFF,
1036 .flags = IORESOURCE_MEM,
1037 },
1038 {
1039 .start = CH_SPI1_TX,
1040 .end = CH_SPI1_TX,
1041 .flags = IORESOURCE_DMA,
1042 },
1043 {
1044 .start = CH_SPI1_RX,
1045 .end = CH_SPI1_RX,
1046 .flags = IORESOURCE_DMA,
1047 },
1048
1049};
1050
1051/* SPI controller data */
1052static struct bfin6xx_spi_master bf60x_spi_master_info0 = {
1053 .num_chipselect = 4,
1054 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
1055};
1056
1057static struct platform_device bf60x_spi_master0 = {
1058 .name = "bfin-spi",
1059 .id = 0, /* Bus number */
1060 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
1061 .resource = bfin_spi0_resource,
1062 .dev = {
1063 .platform_data = &bf60x_spi_master_info0, /* Passed to driver */
1064 },
1065};
1066
1067static struct bfin6xx_spi_master bf60x_spi_master_info1 = {
1068 .num_chipselect = 4,
1069 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
1070};
1071
1072static struct platform_device bf60x_spi_master1 = {
1073 .name = "bfin-spi",
1074 .id = 1, /* Bus number */
1075 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
1076 .resource = bfin_spi1_resource,
1077 .dev = {
1078 .platform_data = &bf60x_spi_master_info1, /* Passed to driver */
1079 },
1080};
1081#endif /* spi master and devices */
1082
1083#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1084static const u16 bfin_twi0_pins[] = {P_TWI0_SCL, P_TWI0_SDA, 0};
1085
1086static struct resource bfin_twi0_resource[] = {
1087 [0] = {
1088 .start = TWI0_CLKDIV,
1089 .end = TWI0_CLKDIV + 0xFF,
1090 .flags = IORESOURCE_MEM,
1091 },
1092 [1] = {
1093 .start = IRQ_TWI0,
1094 .end = IRQ_TWI0,
1095 .flags = IORESOURCE_IRQ,
1096 },
1097};
1098
1099static struct platform_device i2c_bfin_twi0_device = {
1100 .name = "i2c-bfin-twi",
1101 .id = 0,
1102 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1103 .resource = bfin_twi0_resource,
1104 .dev = {
1105 .platform_data = &bfin_twi0_pins,
1106 },
1107};
1108
1109static const u16 bfin_twi1_pins[] = {P_TWI1_SCL, P_TWI1_SDA, 0};
1110
1111static struct resource bfin_twi1_resource[] = {
1112 [0] = {
1113 .start = TWI1_CLKDIV,
1114 .end = TWI1_CLKDIV + 0xFF,
1115 .flags = IORESOURCE_MEM,
1116 },
1117 [1] = {
1118 .start = IRQ_TWI1,
1119 .end = IRQ_TWI1,
1120 .flags = IORESOURCE_IRQ,
1121 },
1122};
1123
1124static struct platform_device i2c_bfin_twi1_device = {
1125 .name = "i2c-bfin-twi",
1126 .id = 1,
1127 .num_resources = ARRAY_SIZE(bfin_twi1_resource),
1128 .resource = bfin_twi1_resource,
1129 .dev = {
1130 .platform_data = &bfin_twi1_pins,
1131 },
1132};
1133#endif
1134
1135static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
1136#if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
1137 {
1138 I2C_BOARD_INFO("adxl34x", 0x53),
1139 .irq = IRQ_PC5,
1140 .platform_data = (void *)&adxl34x_info,
1141 },
1142#endif
1143#if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
1144 {
1145 I2C_BOARD_INFO("adau1761", 0x38),
1146 .platform_data = (void *)&adau1761_info
1147 },
1148#endif
1149};
1150
1151static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
1152};
1153
1154static const unsigned int cclk_vlev_datasheet[] =
1155{
1156/*
1157 * Internal VLEV BF54XSBBC1533
1158 ****temporarily using these values until data sheet is updated
1159 */
1160 VRPAIR(VLEV_085, 150000000),
1161 VRPAIR(VLEV_090, 250000000),
1162 VRPAIR(VLEV_110, 276000000),
1163 VRPAIR(VLEV_115, 301000000),
1164 VRPAIR(VLEV_120, 525000000),
1165 VRPAIR(VLEV_125, 550000000),
1166 VRPAIR(VLEV_130, 600000000),
1167};
1168
1169static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1170 .tuple_tab = cclk_vlev_datasheet,
1171 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1172 .vr_settling_time = 25 /* us */,
1173};
1174
1175static struct platform_device bfin_dpmc = {
1176 .name = "bfin dpmc",
1177 .dev = {
1178 .platform_data = &bfin_dmpc_vreg_data,
1179 },
1180};
1181
1182static struct platform_device *ezkit_devices[] __initdata = {
1183
1184 &bfin_dpmc,
1185
1186#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1187 &rtc_device,
1188#endif
1189
1190#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1191#ifdef CONFIG_SERIAL_BFIN_UART0
1192 &bfin_uart0_device,
1193#endif
1194#ifdef CONFIG_SERIAL_BFIN_UART1
1195 &bfin_uart1_device,
1196#endif
1197#endif
1198
1199#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1200#ifdef CONFIG_BFIN_SIR0
1201 &bfin_sir0_device,
1202#endif
1203#ifdef CONFIG_BFIN_SIR1
1204 &bfin_sir1_device,
1205#endif
1206#endif
1207
1208#if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
1209 &bfin_eth_device,
1210#endif
1211
1212#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
1213 &musb_device,
1214#endif
1215
1216#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1217 &bfin_isp1760_device,
1218#endif
1219
1220#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1221#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1222 &bfin_sport0_uart_device,
1223#endif
1224#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1225 &bfin_sport1_uart_device,
1226#endif
1227#ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1228 &bfin_sport2_uart_device,
1229#endif
1230#endif
1231
1232#if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
1233 &bfin_can0_device,
1234#endif
1235
1236#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
1237 &bfin_nand_device,
1238#endif
1239
1240#if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
1241 &bfin_sdh_device,
1242#endif
1243
1244#if defined(CONFIG_SPI_BFIN6XX) || defined(CONFIG_SPI_BFIN6XX_MODULE)
1245 &bf60x_spi_master0,
1246 &bf60x_spi_master1,
1247#endif
1248
1249#if defined(CONFIG_INPUT_BFIN_ROTARY) || defined(CONFIG_INPUT_BFIN_ROTARY_MODULE)
1250 &bfin_rotary_device,
1251#endif
1252
1253#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1254 &i2c_bfin_twi0_device,
1255#if !defined(CONFIG_BF542)
1256 &i2c_bfin_twi1_device,
1257#endif
1258#endif
1259
1260#if defined(CONFIG_BFIN_CRC)
1261 &bfin_crc0_device,
1262 &bfin_crc1_device,
1263#endif
1264
1265#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1266 &bfin_device_gpiokeys,
1267#endif
1268
1269#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1270 &ezkit_flash_device,
1271#endif
1272#if defined(CONFIG_SND_BF6XX_I2S) || defined(CONFIG_SND_BF6XX_I2S_MODULE)
1273 &bfin_i2s_pcm,
1274#endif
1275#if defined(CONFIG_SND_BF6XX_SOC_I2S) || \
1276 defined(CONFIG_SND_BF6XX_SOC_I2S_MODULE)
1277 &bfin_i2s,
1278#endif
1279#if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61) || \
1280 defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61_MODULE)
1281 &adau1761_device,
1282#endif
1283#if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \
1284 || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE)
1285 &bfin_capture_device,
1286#endif
1287};
1288
1289static int __init ezkit_init(void)
1290{
1291 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1292
1293 i2c_register_board_info(0, bfin_i2c_board_info0,
1294 ARRAY_SIZE(bfin_i2c_board_info0));
1295 i2c_register_board_info(1, bfin_i2c_board_info1,
1296 ARRAY_SIZE(bfin_i2c_board_info1));
1297
1298#if defined(CONFIG_STMMAC_ETH) || defined(CONFIG_STMMAC_ETH_MODULE)
1299 if (!peripheral_request_list(pins, "emac0"))
1300 printk(KERN_ERR "%s(): request emac pins failed\n", __func__);
1301#endif
1302
1303 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
1304
1305 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1306
1307 return 0;
1308}
1309
1310arch_initcall(ezkit_init);
1311
1312static struct platform_device *ezkit_early_devices[] __initdata = {
1313#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
1314#ifdef CONFIG_SERIAL_BFIN_UART0
1315 &bfin_uart0_device,
1316#endif
1317#ifdef CONFIG_SERIAL_BFIN_UART1
1318 &bfin_uart1_device,
1319#endif
1320#endif
1321
1322#if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
1323#ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1324 &bfin_sport0_uart_device,
1325#endif
1326#ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1327 &bfin_sport1_uart_device,
1328#endif
1329#ifdef CONFIG_SERIAL_BFIN_SPORT2_UART
1330 &bfin_sport2_uart_device,
1331#endif
1332#endif
1333};
1334
1335void __init native_machine_early_platform_add_devices(void)
1336{
1337 printk(KERN_INFO "register early platform devices\n");
1338 early_platform_add_devices(ezkit_early_devices,
1339 ARRAY_SIZE(ezkit_early_devices));
1340}
diff --git a/arch/blackfin/mach-bf609/clock.c b/arch/blackfin/mach-bf609/clock.c
new file mode 100644
index 000000000000..7f8f529693ae
--- /dev/null
+++ b/arch/blackfin/mach-bf609/clock.c
@@ -0,0 +1,390 @@
1#include <linux/module.h>
2#include <linux/kernel.h>
3#include <linux/list.h>
4#include <linux/errno.h>
5#include <linux/err.h>
6#include <linux/string.h>
7#include <linux/clk.h>
8#include <linux/mutex.h>
9#include <linux/spinlock.h>
10#include <linux/debugfs.h>
11#include <linux/device.h>
12#include <linux/init.h>
13#include <linux/timer.h>
14#include <linux/io.h>
15#include <linux/seq_file.h>
16#include <linux/clkdev.h>
17
18#include <asm/clocks.h>
19
20#define CGU0_CTL_DF (1 << 0)
21
22#define CGU0_CTL_MSEL_SHIFT 8
23#define CGU0_CTL_MSEL_MASK (0x7f << 8)
24
25#define CGU0_STAT_PLLEN (1 << 0)
26#define CGU0_STAT_PLLBP (1 << 1)
27#define CGU0_STAT_PLLLK (1 << 2)
28#define CGU0_STAT_CLKSALGN (1 << 3)
29#define CGU0_STAT_CCBF0 (1 << 4)
30#define CGU0_STAT_CCBF1 (1 << 5)
31#define CGU0_STAT_SCBF0 (1 << 6)
32#define CGU0_STAT_SCBF1 (1 << 7)
33#define CGU0_STAT_DCBF (1 << 8)
34#define CGU0_STAT_OCBF (1 << 9)
35#define CGU0_STAT_ADDRERR (1 << 16)
36#define CGU0_STAT_LWERR (1 << 17)
37#define CGU0_STAT_DIVERR (1 << 18)
38#define CGU0_STAT_WDFMSERR (1 << 19)
39#define CGU0_STAT_WDIVERR (1 << 20)
40#define CGU0_STAT_PLOCKERR (1 << 21)
41
42#define CGU0_DIV_CSEL_SHIFT 0
43#define CGU0_DIV_CSEL_MASK 0x0000001F
44#define CGU0_DIV_S0SEL_SHIFT 5
45#define CGU0_DIV_S0SEL_MASK (0x3 << CGU0_DIV_S0SEL_SHIFT)
46#define CGU0_DIV_SYSSEL_SHIFT 8
47#define CGU0_DIV_SYSSEL_MASK (0x1f << CGU0_DIV_SYSSEL_SHIFT)
48#define CGU0_DIV_S1SEL_SHIFT 13
49#define CGU0_DIV_S1SEL_MASK (0x3 << CGU0_DIV_S1SEL_SHIFT)
50#define CGU0_DIV_DSEL_SHIFT 16
51#define CGU0_DIV_DSEL_MASK (0x1f << CGU0_DIV_DSEL_SHIFT)
52#define CGU0_DIV_OSEL_SHIFT 22
53#define CGU0_DIV_OSEL_MASK (0x7f << CGU0_DIV_OSEL_SHIFT)
54
55#define CLK(_clk, _devname, _conname) \
56 { \
57 .clk = &_clk, \
58 .dev_id = _devname, \
59 .con_id = _conname, \
60 }
61
62#define NEEDS_INITIALIZATION 0x11
63
64static LIST_HEAD(clk_list);
65
66static void clk_reg_write_mask(u32 reg, uint32_t val, uint32_t mask)
67{
68 u32 val2;
69
70 val2 = bfin_read32(reg);
71 val2 &= ~mask;
72 val2 |= val;
73 bfin_write32(reg, val2);
74}
75
76static void clk_reg_set_bits(u32 reg, uint32_t mask)
77{
78 u32 val;
79
80 val = bfin_read32(reg);
81 val |= mask;
82 bfin_write32(reg, val);
83}
84
85static void clk_reg_clear_bits(u32 reg, uint32_t mask)
86{
87 u32 val;
88
89 val = bfin_read32(reg);
90 val &= ~mask;
91 bfin_write32(reg, val);
92}
93
94int wait_for_pll_align(void)
95{
96 int i = 10000;
97 while (i-- && (bfin_read32(CGU0_STAT) & CGU0_STAT_CLKSALGN));
98
99 if (bfin_read32(CGU0_STAT) & CGU0_STAT_CLKSALGN) {
100 printk(KERN_DEBUG "fail to align clk\n");
101 return -1;
102 }
103 return 0;
104}
105
106int clk_enable(struct clk *clk)
107{
108 int ret = -EIO;
109 if (clk->ops && clk->ops->enable)
110 ret = clk->ops->enable(clk);
111 return ret;
112}
113EXPORT_SYMBOL(clk_enable);
114
115void clk_disable(struct clk *clk)
116{
117 if (clk->ops && clk->ops->disable)
118 clk->ops->disable(clk);
119}
120EXPORT_SYMBOL(clk_disable);
121
122unsigned long clk_get_rate(struct clk *clk)
123{
124 unsigned long ret = 0;
125 if (clk->ops && clk->ops->get_rate)
126 ret = clk->ops->get_rate(clk);
127 return ret;
128}
129EXPORT_SYMBOL(clk_get_rate);
130
131long clk_round_rate(struct clk *clk, unsigned long rate)
132{
133 long ret = -EIO;
134 if (clk->ops && clk->ops->round_rate)
135 ret = clk->ops->round_rate(clk, rate);
136 return ret;
137}
138EXPORT_SYMBOL(clk_round_rate);
139
140int clk_set_rate(struct clk *clk, unsigned long rate)
141{
142 int ret = -EIO;
143 if (clk->ops && clk->ops->set_rate)
144 ret = clk->ops->set_rate(clk, rate);
145 return ret;
146}
147EXPORT_SYMBOL(clk_set_rate);
148
149unsigned long vco_get_rate(struct clk *clk)
150{
151 return clk->rate;
152}
153
154unsigned long pll_get_rate(struct clk *clk)
155{
156 u32 df;
157 u32 msel;
158 u32 ctl = bfin_read32(CGU0_CTL);
159 u32 stat = bfin_read32(CGU0_STAT);
160 if (stat & CGU0_STAT_PLLBP)
161 return 0;
162 msel = (ctl & CGU0_CTL_MSEL_MASK) >> CGU0_CTL_MSEL_SHIFT;
163 df = (ctl & CGU0_CTL_DF);
164 clk->parent->rate = clk_get_rate(clk->parent);
165 return clk->parent->rate / (df + 1) * msel * 2;
166}
167
168unsigned long pll_round_rate(struct clk *clk, unsigned long rate)
169{
170 u32 div;
171 div = rate / clk->parent->rate;
172 return clk->parent->rate * div;
173}
174
175int pll_set_rate(struct clk *clk, unsigned long rate)
176{
177 u32 msel;
178 u32 stat = bfin_read32(CGU0_STAT);
179 if (!(stat & CGU0_STAT_PLLEN))
180 return -EBUSY;
181 if (!(stat & CGU0_STAT_PLLLK))
182 return -EBUSY;
183 if (wait_for_pll_align())
184 return -EBUSY;
185 msel = rate / clk->parent->rate / 2;
186 clk_reg_write_mask(CGU0_CTL, msel << CGU0_CTL_MSEL_SHIFT,
187 CGU0_CTL_MSEL_MASK);
188 clk->rate = rate;
189 return 0;
190}
191
192unsigned long cclk_get_rate(struct clk *clk)
193{
194 if (clk->parent)
195 return clk->parent->rate;
196 else
197 return 0;
198}
199
200unsigned long sys_clk_get_rate(struct clk *clk)
201{
202 unsigned long drate;
203 u32 msel;
204 u32 df;
205 u32 ctl = bfin_read32(CGU0_CTL);
206 u32 div = bfin_read32(CGU0_DIV);
207 div = (div & clk->mask) >> clk->shift;
208 msel = (ctl & CGU0_CTL_MSEL_MASK) >> CGU0_CTL_MSEL_SHIFT;
209 df = (ctl & CGU0_CTL_DF);
210
211 if (!strcmp(clk->parent->name, "SYS_CLKIN")) {
212 drate = clk->parent->rate / (df + 1);
213 drate *= msel;
214 drate /= div;
215 return drate;
216 } else {
217 clk->parent->rate = clk_get_rate(clk->parent);
218 return clk->parent->rate / div;
219 }
220}
221
222unsigned long sys_clk_round_rate(struct clk *clk, unsigned long rate)
223{
224 unsigned long max_rate;
225 unsigned long drate;
226 int i;
227 u32 msel;
228 u32 df;
229 u32 ctl = bfin_read32(CGU0_CTL);
230
231 msel = (ctl & CGU0_CTL_MSEL_MASK) >> CGU0_CTL_MSEL_SHIFT;
232 df = (ctl & CGU0_CTL_DF);
233 max_rate = clk->parent->rate / (df + 1) * msel;
234
235 if (rate > max_rate)
236 return 0;
237
238 for (i = 1; i < clk->mask; i++) {
239 drate = max_rate / i;
240 if (rate >= drate)
241 return drate;
242 }
243 return 0;
244}
245
246int sys_clk_set_rate(struct clk *clk, unsigned long rate)
247{
248 u32 div = bfin_read32(CGU0_DIV);
249 div = (div & clk->mask) >> clk->shift;
250
251 rate = clk_round_rate(clk, rate);
252
253 if (!rate)
254 return -EINVAL;
255
256 div = (clk_get_rate(clk) * div) / rate;
257
258 if (wait_for_pll_align())
259 return -EBUSY;
260 clk_reg_write_mask(CGU0_DIV, div << clk->shift,
261 clk->mask);
262 clk->rate = rate;
263 return 0;
264}
265
266static struct clk_ops vco_ops = {
267 .get_rate = vco_get_rate,
268};
269
270static struct clk_ops pll_ops = {
271 .get_rate = pll_get_rate,
272 .set_rate = pll_set_rate,
273};
274
275static struct clk_ops cclk_ops = {
276 .get_rate = cclk_get_rate,
277};
278
279static struct clk_ops sys_clk_ops = {
280 .get_rate = sys_clk_get_rate,
281 .set_rate = sys_clk_set_rate,
282 .round_rate = sys_clk_round_rate,
283};
284
285static struct clk sys_clkin = {
286 .name = "SYS_CLKIN",
287 .rate = CONFIG_CLKIN_HZ,
288 .ops = &vco_ops,
289};
290
291static struct clk pll_clk = {
292 .name = "PLLCLK",
293 .rate = 500000000,
294 .parent = &sys_clkin,
295 .ops = &pll_ops,
296 .flags = NEEDS_INITIALIZATION,
297};
298
299static struct clk cclk = {
300 .name = "CCLK",
301 .rate = 500000000,
302 .mask = CGU0_DIV_CSEL_MASK,
303 .shift = CGU0_DIV_CSEL_SHIFT,
304 .parent = &sys_clkin,
305 .ops = &sys_clk_ops,
306 .flags = NEEDS_INITIALIZATION,
307};
308
309static struct clk cclk0 = {
310 .name = "CCLK0",
311 .parent = &cclk,
312 .ops = &cclk_ops,
313};
314
315static struct clk cclk1 = {
316 .name = "CCLK1",
317 .parent = &cclk,
318 .ops = &cclk_ops,
319};
320
321static struct clk sysclk = {
322 .name = "SYSCLK",
323 .rate = 500000000,
324 .mask = CGU0_DIV_SYSSEL_MASK,
325 .shift = CGU0_DIV_SYSSEL_SHIFT,
326 .parent = &sys_clkin,
327 .ops = &sys_clk_ops,
328 .flags = NEEDS_INITIALIZATION,
329};
330
331static struct clk sclk0 = {
332 .name = "SCLK0",
333 .rate = 500000000,
334 .mask = CGU0_DIV_S0SEL_MASK,
335 .shift = CGU0_DIV_S0SEL_SHIFT,
336 .parent = &sysclk,
337 .ops = &sys_clk_ops,
338};
339
340static struct clk sclk1 = {
341 .name = "SCLK1",
342 .rate = 500000000,
343 .mask = CGU0_DIV_S1SEL_MASK,
344 .shift = CGU0_DIV_S1SEL_SHIFT,
345 .parent = &sysclk,
346 .ops = &sys_clk_ops,
347};
348
349static struct clk dclk = {
350 .name = "DCLK",
351 .rate = 500000000,
352 .mask = CGU0_DIV_DSEL_MASK,
353 .shift = CGU0_DIV_DSEL_SHIFT,
354 .parent = &sys_clkin,
355 .ops = &sys_clk_ops,
356};
357
358static struct clk oclk = {
359 .name = "OCLK",
360 .rate = 500000000,
361 .mask = CGU0_DIV_OSEL_MASK,
362 .shift = CGU0_DIV_OSEL_SHIFT,
363 .parent = &pll_clk,
364};
365
366static struct clk_lookup bf609_clks[] = {
367 CLK(sys_clkin, NULL, "SYS_CLKIN"),
368 CLK(pll_clk, NULL, "PLLCLK"),
369 CLK(cclk, NULL, "CCLK"),
370 CLK(cclk0, NULL, "CCLK0"),
371 CLK(cclk1, NULL, "CCLK1"),
372 CLK(sysclk, NULL, "SYSCLK"),
373 CLK(sclk0, NULL, "SCLK0"),
374 CLK(sclk1, NULL, "SCLK1"),
375 CLK(dclk, NULL, "DCLK"),
376 CLK(oclk, NULL, "OCLK"),
377};
378
379int __init clk_init(void)
380{
381 int i;
382 struct clk *clkp;
383 for (i = 0; i < ARRAY_SIZE(bf609_clks); i++) {
384 clkp = bf609_clks[i].clk;
385 if (clkp->flags & NEEDS_INITIALIZATION)
386 clk_get_rate(clkp);
387 }
388 clkdev_add_table(bf609_clks, ARRAY_SIZE(bf609_clks));
389 return 0;
390}
diff --git a/arch/blackfin/mach-bf609/dma.c b/arch/blackfin/mach-bf609/dma.c
new file mode 100644
index 000000000000..1da4b38ac22c
--- /dev/null
+++ b/arch/blackfin/mach-bf609/dma.c
@@ -0,0 +1,202 @@
1/*
2 * the simple DMA Implementation for Blackfin
3 *
4 * Copyright 2007-2009 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#include <linux/module.h>
10
11#include <asm/blackfin.h>
12#include <asm/dma.h>
13
14struct dma_register * const dma_io_base_addr[MAX_DMA_CHANNELS] = {
15 (struct dma_register *) DMA0_NEXT_DESC_PTR,
16 (struct dma_register *) DMA1_NEXT_DESC_PTR,
17 (struct dma_register *) DMA2_NEXT_DESC_PTR,
18 (struct dma_register *) DMA3_NEXT_DESC_PTR,
19 (struct dma_register *) DMA4_NEXT_DESC_PTR,
20 (struct dma_register *) DMA5_NEXT_DESC_PTR,
21 (struct dma_register *) DMA6_NEXT_DESC_PTR,
22 (struct dma_register *) DMA7_NEXT_DESC_PTR,
23 (struct dma_register *) DMA8_NEXT_DESC_PTR,
24 (struct dma_register *) DMA9_NEXT_DESC_PTR,
25 (struct dma_register *) DMA10_NEXT_DESC_PTR,
26 (struct dma_register *) DMA11_NEXT_DESC_PTR,
27 (struct dma_register *) DMA12_NEXT_DESC_PTR,
28 (struct dma_register *) DMA13_NEXT_DESC_PTR,
29 (struct dma_register *) DMA14_NEXT_DESC_PTR,
30 (struct dma_register *) DMA15_NEXT_DESC_PTR,
31 (struct dma_register *) DMA16_NEXT_DESC_PTR,
32 (struct dma_register *) DMA17_NEXT_DESC_PTR,
33 (struct dma_register *) DMA18_NEXT_DESC_PTR,
34 (struct dma_register *) DMA19_NEXT_DESC_PTR,
35 (struct dma_register *) DMA20_NEXT_DESC_PTR,
36 (struct dma_register *) MDMA0_SRC_CRC0_NEXT_DESC_PTR,
37 (struct dma_register *) MDMA0_DEST_CRC0_NEXT_DESC_PTR,
38 (struct dma_register *) MDMA1_SRC_CRC1_NEXT_DESC_PTR,
39 (struct dma_register *) MDMA1_DEST_CRC1_NEXT_DESC_PTR,
40 (struct dma_register *) MDMA2_SRC_NEXT_DESC_PTR,
41 (struct dma_register *) MDMA2_DEST_NEXT_DESC_PTR,
42 (struct dma_register *) MDMA3_SRC_NEXT_DESC_PTR,
43 (struct dma_register *) MDMA3_DEST_NEXT_DESC_PTR,
44 (struct dma_register *) DMA29_NEXT_DESC_PTR,
45 (struct dma_register *) DMA30_NEXT_DESC_PTR,
46 (struct dma_register *) DMA31_NEXT_DESC_PTR,
47 (struct dma_register *) DMA32_NEXT_DESC_PTR,
48 (struct dma_register *) DMA33_NEXT_DESC_PTR,
49 (struct dma_register *) DMA34_NEXT_DESC_PTR,
50 (struct dma_register *) DMA35_NEXT_DESC_PTR,
51 (struct dma_register *) DMA36_NEXT_DESC_PTR,
52 (struct dma_register *) DMA37_NEXT_DESC_PTR,
53 (struct dma_register *) DMA38_NEXT_DESC_PTR,
54 (struct dma_register *) DMA39_NEXT_DESC_PTR,
55 (struct dma_register *) DMA40_NEXT_DESC_PTR,
56 (struct dma_register *) DMA41_NEXT_DESC_PTR,
57 (struct dma_register *) DMA42_NEXT_DESC_PTR,
58 (struct dma_register *) DMA43_NEXT_DESC_PTR,
59 (struct dma_register *) DMA44_NEXT_DESC_PTR,
60 (struct dma_register *) DMA45_NEXT_DESC_PTR,
61 (struct dma_register *) DMA46_NEXT_DESC_PTR,
62};
63EXPORT_SYMBOL(dma_io_base_addr);
64
65int channel2irq(unsigned int channel)
66{
67 int ret_irq = -1;
68
69 switch (channel) {
70 case CH_SPORT0_RX:
71 ret_irq = IRQ_SPORT0_RX;
72 break;
73 case CH_SPORT0_TX:
74 ret_irq = IRQ_SPORT0_TX;
75 break;
76 case CH_SPORT1_RX:
77 ret_irq = IRQ_SPORT1_RX;
78 break;
79 case CH_SPORT1_TX:
80 ret_irq = IRQ_SPORT1_TX;
81 break;
82 case CH_SPORT2_RX:
83 ret_irq = IRQ_SPORT2_RX;
84 break;
85 case CH_SPORT2_TX:
86 ret_irq = IRQ_SPORT2_TX;
87 break;
88 case CH_SPI0_TX:
89 ret_irq = IRQ_SPI0_TX;
90 break;
91 case CH_SPI0_RX:
92 ret_irq = IRQ_SPI0_RX;
93 break;
94 case CH_SPI1_TX:
95 ret_irq = IRQ_SPI1_TX;
96 break;
97 case CH_SPI1_RX:
98 ret_irq = IRQ_SPI1_RX;
99 break;
100 case CH_RSI:
101 ret_irq = IRQ_RSI;
102 break;
103 case CH_SDU:
104 ret_irq = IRQ_SDU;
105 break;
106 case CH_LP0:
107 ret_irq = IRQ_LP0;
108 break;
109 case CH_LP1:
110 ret_irq = IRQ_LP1;
111 break;
112 case CH_LP2:
113 ret_irq = IRQ_LP2;
114 break;
115 case CH_LP3:
116 ret_irq = IRQ_LP3;
117 break;
118 case CH_UART0_RX:
119 ret_irq = IRQ_UART0_RX;
120 break;
121 case CH_UART0_TX:
122 ret_irq = IRQ_UART0_TX;
123 break;
124 case CH_UART1_RX:
125 ret_irq = IRQ_UART1_RX;
126 break;
127 case CH_UART1_TX:
128 ret_irq = IRQ_UART1_TX;
129 break;
130 case CH_EPPI0_CH0:
131 ret_irq = IRQ_EPPI0_CH0;
132 break;
133 case CH_EPPI0_CH1:
134 ret_irq = IRQ_EPPI0_CH1;
135 break;
136 case CH_EPPI1_CH0:
137 ret_irq = IRQ_EPPI1_CH0;
138 break;
139 case CH_EPPI1_CH1:
140 ret_irq = IRQ_EPPI1_CH1;
141 break;
142 case CH_EPPI2_CH0:
143 ret_irq = IRQ_EPPI2_CH0;
144 break;
145 case CH_EPPI2_CH1:
146 ret_irq = IRQ_EPPI2_CH1;
147 break;
148 case CH_PIXC_CH0:
149 ret_irq = IRQ_PIXC_CH0;
150 break;
151 case CH_PIXC_CH1:
152 ret_irq = IRQ_PIXC_CH1;
153 break;
154 case CH_PIXC_CH2:
155 ret_irq = IRQ_PIXC_CH2;
156 break;
157 case CH_PVP_CPDOB:
158 ret_irq = IRQ_PVP_CPDOB;
159 break;
160 case CH_PVP_CPDOC:
161 ret_irq = IRQ_PVP_CPDOC;
162 break;
163 case CH_PVP_CPSTAT:
164 ret_irq = IRQ_PVP_CPSTAT;
165 break;
166 case CH_PVP_CPCI:
167 ret_irq = IRQ_PVP_CPCI;
168 break;
169 case CH_PVP_MPDO:
170 ret_irq = IRQ_PVP_MPDO;
171 break;
172 case CH_PVP_MPDI:
173 ret_irq = IRQ_PVP_MPDI;
174 break;
175 case CH_PVP_MPSTAT:
176 ret_irq = IRQ_PVP_MPSTAT;
177 break;
178 case CH_PVP_MPCI:
179 ret_irq = IRQ_PVP_MPCI;
180 break;
181 case CH_PVP_CPDOA:
182 ret_irq = IRQ_PVP_CPDOA;
183 break;
184 case CH_MEM_STREAM0_SRC:
185 case CH_MEM_STREAM0_DEST:
186 ret_irq = IRQ_MDMAS0;
187 break;
188 case CH_MEM_STREAM1_SRC:
189 case CH_MEM_STREAM1_DEST:
190 ret_irq = IRQ_MDMAS1;
191 break;
192 case CH_MEM_STREAM2_SRC:
193 case CH_MEM_STREAM2_DEST:
194 ret_irq = IRQ_MDMAS2;
195 break;
196 case CH_MEM_STREAM3_SRC:
197 case CH_MEM_STREAM3_DEST:
198 ret_irq = IRQ_MDMAS3;
199 break;
200 }
201 return ret_irq;
202}
diff --git a/arch/blackfin/mach-bf609/hibernate.S b/arch/blackfin/mach-bf609/hibernate.S
new file mode 100644
index 000000000000..d37a532519c8
--- /dev/null
+++ b/arch/blackfin/mach-bf609/hibernate.S
@@ -0,0 +1,65 @@
1#include <linux/linkage.h>
2#include <asm/blackfin.h>
3#include <asm/dpmc.h>
4
5#define PM_STACK (COREA_L1_SCRATCH_START + L1_SCRATCH_LENGTH - 12)
6
7.section .l1.text
8ENTRY(_enter_hibernate)
9 /* switch stack to L1 scratch, prepare for ddr srfr */
10 P0.H = HI(PM_STACK);
11 P0.L = LO(PM_STACK);
12 SP = P0;
13
14 call _bf609_ddr_sr;
15 call _bfin_hibernate_syscontrol;
16
17 P0.H = HI(DPM0_RESTORE4);
18 P0.L = LO(DPM0_RESTORE4);
19 P1.H = _bf609_pm_data;
20 P1.L = _bf609_pm_data;
21 [P0] = P1;
22
23 P0.H = HI(DPM0_CTL);
24 P0.L = LO(DPM0_CTL);
25 R3.H = HI(0x00000010);
26 R3.L = LO(0x00000010);
27
28 bfin_init_pm_bench_cycles;
29
30 [P0] = R3;
31
32 SSYNC;
33ENDPROC(_enter_hibernate_mode)
34
35.section .text
36ENTRY(_bf609_hibernate)
37 bfin_cpu_reg_save;
38 bfin_core_mmr_save;
39
40 P0.H = _bf609_pm_data;
41 P0.L = _bf609_pm_data;
42 R1.H = 0xDEAD;
43 R1.L = 0xBEEF;
44 R2.H = .Lpm_resume_here;
45 R2.L = .Lpm_resume_here;
46 [P0++] = R1;
47 [P0++] = R2;
48 [P0++] = SP;
49
50 P1.H = _enter_hibernate;
51 P1.L = _enter_hibernate;
52
53 call (P1);
54.Lpm_resume_here:
55
56 bfin_core_mmr_restore;
57 bfin_cpu_reg_restore;
58
59 [--sp] = RETI; /* Clear Global Interrupt Disable */
60 SP += 4;
61
62 RTS;
63
64ENDPROC(_bf609_hibernate)
65
diff --git a/arch/blackfin/mach-bf609/include/mach/anomaly.h b/arch/blackfin/mach-bf609/include/mach/anomaly.h
new file mode 100644
index 000000000000..bdd39aefb565
--- /dev/null
+++ b/arch/blackfin/mach-bf609/include/mach/anomaly.h
@@ -0,0 +1,130 @@
1/*
2 * DO NOT EDIT THIS FILE
3 * This file is under version control at
4 * svn://sources.blackfin.uclinux.org/toolchain/trunk/proc-defs/header-frags/
5 * and can be replaced with that version at any time
6 * DO NOT EDIT THIS FILE
7 *
8 * Copyright 2004-2011 Analog Devices Inc.
9 * Licensed under the Clear BSD license.
10 */
11
12/* This file should be up to date with:
13 */
14
15#if __SILICON_REVISION__ < 0
16# error will not work on BF506 silicon version
17#endif
18
19#ifndef _MACH_ANOMALY_H_
20#define _MACH_ANOMALY_H_
21
22/* Multi-Issue Instruction with dsp32shiftimm in slot1 and P-reg Store in slot2 Not Supported */
23#define ANOMALY_05000074 (1)
24/* DMA_RUN Bit Is Not Valid after a Peripheral Receive Channel DMA Stops */
25#define ANOMALY_05000119 (1)
26/* Rx.H Cannot Be Used to Access 16-bit System MMR Registers */
27#define ANOMALY_05000122 (1)
28/* False Hardware Error from an Access in the Shadow of a Conditional Branch */
29#define ANOMALY_05000245 (1)
30/* Incorrect Timer Pulse Width in Single-Shot PWM_OUT Mode with External Clock */
31#define ANOMALY_05000254 (1)
32/* Sensitivity To Noise with Slow Input Edge Rates on External SPORT TX and RX Clocks */
33#define ANOMALY_05000265 (1)
34/* False Hardware Errors Caused by Fetches at the Boundary of Reserved Memory */
35#define ANOMALY_05000310 (1)
36/* PPI Underflow Error Goes Undetected in ITU-R 656 Mode */
37#define ANOMALY_05000366 (1)
38/* Speculative Fetches Can Cause Undesired External FIFO Operations */
39#define ANOMALY_05000416 (1)
40/* Speculative Fetches of Indirect-Pointer Instructions Can Cause False Hardware Errors */
41#define ANOMALY_05000426 (1)
42/* IFLUSH Instruction at End of Hardware Loop Causes Infinite Stall */
43#define ANOMALY_05000443 (1)
44/* UART IrDA Receiver Fails on Extended Bit Pulses */
45#define ANOMALY_05000447 (1)
46/* False Hardware Error when RETI Points to Invalid Memory */
47#define ANOMALY_05000461 (1)
48/* PLL Latches Incorrect Settings During Reset */
49#define ANOMALY_05000469 (1)
50/* Incorrect Default MSEL Value in PLL_CTL */
51#define ANOMALY_05000472 (1)
52/* Interrupted SPORT Receive Data Register Read Results In Underflow when SLEN > 15 */
53#define ANOMALY_05000473 (1)
54/* TESTSET Instruction Cannot Be Interrupted */
55#define ANOMALY_05000477 (1)
56/* Reads of ITEST_COMMAND and ITEST_DATA Registers Cause Cache Corruption */
57#define ANOMALY_05000481 (1)
58/* IFLUSH sucks at life */
59#define ANOMALY_05000491 (1)
60/* Tempopary anomaly ID for data loss in MMR read operation if interrupted */
61#define ANOMALY_05001001 (__SILICON_REVISION__ < 1)
62
63/* Anomalies that don't exist on this proc */
64#define ANOMALY_05000099 (0)
65#define ANOMALY_05000120 (0)
66#define ANOMALY_05000125 (0)
67#define ANOMALY_05000149 (0)
68#define ANOMALY_05000158 (0)
69#define ANOMALY_05000171 (0)
70#define ANOMALY_05000179 (0)
71#define ANOMALY_05000182 (0)
72#define ANOMALY_05000183 (0)
73#define ANOMALY_05000189 (0)
74#define ANOMALY_05000198 (0)
75#define ANOMALY_05000202 (0)
76#define ANOMALY_05000215 (0)
77#define ANOMALY_05000219 (0)
78#define ANOMALY_05000220 (0)
79#define ANOMALY_05000227 (0)
80#define ANOMALY_05000230 (0)
81#define ANOMALY_05000231 (0)
82#define ANOMALY_05000233 (0)
83#define ANOMALY_05000234 (0)
84#define ANOMALY_05000242 (0)
85#define ANOMALY_05000244 (0)
86#define ANOMALY_05000248 (0)
87#define ANOMALY_05000250 (0)
88#define ANOMALY_05000257 (0)
89#define ANOMALY_05000261 (0)
90#define ANOMALY_05000263 (0)
91#define ANOMALY_05000266 (0)
92#define ANOMALY_05000273 (0)
93#define ANOMALY_05000274 (0)
94#define ANOMALY_05000278 (0)
95#define ANOMALY_05000281 (0)
96#define ANOMALY_05000283 (0)
97#define ANOMALY_05000285 (0)
98#define ANOMALY_05000287 (0)
99#define ANOMALY_05000301 (0)
100#define ANOMALY_05000305 (0)
101#define ANOMALY_05000307 (0)
102#define ANOMALY_05000311 (0)
103#define ANOMALY_05000312 (0)
104#define ANOMALY_05000315 (0)
105#define ANOMALY_05000323 (0)
106#define ANOMALY_05000353 (1)
107#define ANOMALY_05000357 (0)
108#define ANOMALY_05000362 (1)
109#define ANOMALY_05000363 (0)
110#define ANOMALY_05000364 (0)
111#define ANOMALY_05000371 (0)
112#define ANOMALY_05000380 (0)
113#define ANOMALY_05000386 (0)
114#define ANOMALY_05000389 (0)
115#define ANOMALY_05000400 (0)
116#define ANOMALY_05000402 (0)
117#define ANOMALY_05000412 (0)
118#define ANOMALY_05000432 (0)
119#define ANOMALY_05000440 (0)
120#define ANOMALY_05000448 (0)
121#define ANOMALY_05000456 (0)
122#define ANOMALY_05000450 (0)
123#define ANOMALY_05000465 (0)
124#define ANOMALY_05000467 (0)
125#define ANOMALY_05000474 (0)
126#define ANOMALY_05000475 (0)
127#define ANOMALY_05000480 (0)
128#define ANOMALY_05000485 (0)
129
130#endif
diff --git a/arch/blackfin/mach-bf609/include/mach/bf609.h b/arch/blackfin/mach-bf609/include/mach/bf609.h
new file mode 100644
index 000000000000..c897c2a2fbfa
--- /dev/null
+++ b/arch/blackfin/mach-bf609/include/mach/bf609.h
@@ -0,0 +1,93 @@
1/*
2 * Copyright 2011 Analog Devices Inc.
3 *
4 * Licensed under the GPL-2 or later.
5 */
6
7#ifndef __MACH_BF609_H__
8#define __MACH_BF609_H__
9
10#define OFFSET_(x) ((x) & 0x0000FFFF)
11
12/*some misc defines*/
13#define IMASK_IVG15 0x8000
14#define IMASK_IVG14 0x4000
15#define IMASK_IVG13 0x2000
16#define IMASK_IVG12 0x1000
17
18#define IMASK_IVG11 0x0800
19#define IMASK_IVG10 0x0400
20#define IMASK_IVG9 0x0200
21#define IMASK_IVG8 0x0100
22
23#define IMASK_IVG7 0x0080
24#define IMASK_IVGTMR 0x0040
25#define IMASK_IVGHW 0x0020
26
27/***************************/
28
29
30#define BFIN_DSUBBANKS 4
31#define BFIN_DWAYS 2
32#define BFIN_DLINES 64
33#define BFIN_ISUBBANKS 4
34#define BFIN_IWAYS 4
35#define BFIN_ILINES 32
36
37#define WAY0_L 0x1
38#define WAY1_L 0x2
39#define WAY01_L 0x3
40#define WAY2_L 0x4
41#define WAY02_L 0x5
42#define WAY12_L 0x6
43#define WAY012_L 0x7
44
45#define WAY3_L 0x8
46#define WAY03_L 0x9
47#define WAY13_L 0xA
48#define WAY013_L 0xB
49
50#define WAY32_L 0xC
51#define WAY320_L 0xD
52#define WAY321_L 0xE
53#define WAYALL_L 0xF
54
55#define DMC_ENABLE (2<<2) /*yes, 2, not 1 */
56
57/********************************* EBIU Settings ************************************/
58#define AMBCTL0VAL ((CONFIG_BANK_1 << 16) | CONFIG_BANK_0)
59#define AMBCTL1VAL ((CONFIG_BANK_3 << 16) | CONFIG_BANK_2)
60
61#ifdef CONFIG_C_AMBEN_ALL
62#define V_AMBEN AMBEN_ALL
63#endif
64#ifdef CONFIG_C_AMBEN
65#define V_AMBEN 0x0
66#endif
67#ifdef CONFIG_C_AMBEN_B0
68#define V_AMBEN AMBEN_B0
69#endif
70#ifdef CONFIG_C_AMBEN_B0_B1
71#define V_AMBEN AMBEN_B0_B1
72#endif
73#ifdef CONFIG_C_AMBEN_B0_B1_B2
74#define V_AMBEN AMBEN_B0_B1_B2
75#endif
76#ifdef CONFIG_C_AMCKEN
77#define V_AMCKEN AMCKEN
78#else
79#define V_AMCKEN 0x0
80#endif
81
82#define AMGCTLVAL (V_AMBEN | V_AMCKEN)
83
84#if defined(CONFIG_BF609)
85# define CPU "BF609"
86# define CPUID 0x27fe /* temperary fake value */
87#endif
88
89#ifndef CPU
90#error "Unknown CPU type - This kernel doesn't seem to be configured properly"
91#endif
92
93#endif /* __MACH_BF609_H__ */
diff --git a/arch/blackfin/mach-bf609/include/mach/bfin_serial.h b/arch/blackfin/mach-bf609/include/mach/bfin_serial.h
new file mode 100644
index 000000000000..1fd398147fd9
--- /dev/null
+++ b/arch/blackfin/mach-bf609/include/mach/bfin_serial.h
@@ -0,0 +1,17 @@
1/*
2 * mach/bfin_serial.h - Blackfin UART/Serial definitions
3 *
4 * Copyright 2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __BFIN_MACH_SERIAL_H__
10#define __BFIN_MACH_SERIAL_H__
11
12#define BFIN_UART_NR_PORTS 2
13#define BFIN_UART_TX_FIFO_SIZE 8
14
15#define BFIN_UART_BF60X_STYLE
16
17#endif
diff --git a/arch/blackfin/mach-bf609/include/mach/blackfin.h b/arch/blackfin/mach-bf609/include/mach/blackfin.h
new file mode 100644
index 000000000000..b1a48c410711
--- /dev/null
+++ b/arch/blackfin/mach-bf609/include/mach/blackfin.h
@@ -0,0 +1,25 @@
1/*
2 * Copyright 2011 Analog Devices Inc.
3 *
4 * Licensed under the GPL-2 or later.
5 */
6
7#ifndef _MACH_BLACKFIN_H_
8#define _MACH_BLACKFIN_H_
9
10#include "bf609.h"
11#include "anomaly.h"
12
13#include <asm/def_LPBlackfin.h>
14#ifdef CONFIG_BF609
15# include "defBF609.h"
16#endif
17
18#ifndef __ASSEMBLY__
19# include <asm/cdef_LPBlackfin.h>
20# ifdef CONFIG_BF609
21# include "cdefBF609.h"
22# endif
23#endif
24
25#endif
diff --git a/arch/blackfin/mach-bf609/include/mach/cdefBF609.h b/arch/blackfin/mach-bf609/include/mach/cdefBF609.h
new file mode 100644
index 000000000000..c4f3fe19acda
--- /dev/null
+++ b/arch/blackfin/mach-bf609/include/mach/cdefBF609.h
@@ -0,0 +1,15 @@
1/*
2 * Copyright 2011 Analog Devices Inc.
3 *
4 * Licensed under the GPL-2 or later.
5 */
6
7#ifndef _CDEF_BF609_H
8#define _CDEF_BF609_H
9
10/* include cdefBF60x_base.h for the set of #defines that are common to all ADSP-BF60x bfin_read_()rocessors */
11#include "cdefBF60x_base.h"
12
13/* The following are the #defines needed by ADSP-BF609 that are not in the common header */
14
15#endif /* _CDEF_BF609_H */
diff --git a/arch/blackfin/mach-bf609/include/mach/cdefBF60x_base.h b/arch/blackfin/mach-bf609/include/mach/cdefBF60x_base.h
new file mode 100644
index 000000000000..4954cf3f7e16
--- /dev/null
+++ b/arch/blackfin/mach-bf609/include/mach/cdefBF60x_base.h
@@ -0,0 +1,3252 @@
1/*
2 * Copyright 2011 Analog Devices Inc.
3 *
4 * Licensed under the GPL-2 or later.
5 */
6
7#ifndef _CDEF_BF60X_H
8#define _CDEF_BF60X_H
9
10/* ************************************************************** */
11/* SYSTEM & MMR ADDRESS DEFINITIONS COMMON TO ALL ADSP-BF60x */
12/* ************************************************************** */
13
14/* Debug/MP/Emulation Registers (0xFFC00014 - 0xFFC00014) */
15
16#define bfin_read_CHIPID() bfin_read32(CHIPID)
17#define bfin_write_CHIPID(val) bfin_write32(CHIPID, val)
18
19/* System Reset and Interrubfin_read_()t Controller (0xFFC00100 - 0xFFC00104) */
20
21/* SEC0 Registers */
22#define bfin_read_SEC0_CCTL() bfin_read32(SEC0_CCTL)
23#define bfin_write_SEC0_CCTL(val) bfin_write32(SEC0_CCTL, val)
24#define bfin_read_SEC0_CSID() bfin_read32(SEC0_CSID)
25#define bfin_write_SEC0_CSID(val) bfin_write32(SEC0_CSID, val)
26#define bfin_read_SEC_GCTL() bfin_read32(SEC_GCTL)
27#define bfin_write_SEC_GCTL(val) bfin_write32(SEC_GCTL, val)
28
29#define bfin_read_SEC_FCTL() bfin_read32(SEC_FCTL)
30#define bfin_write_SEC_FCTL(val) bfin_write32(SEC_FCTL, val)
31
32#define bfin_read_SEC_SCTL(sid) bfin_read32((SEC_SCTL0 + (sid) * 8))
33#define bfin_write_SEC_SCTL(sid, val) bfin_write32((SEC_SCTL0 + (sid) * 8), val)
34
35#define bfin_read_SEC_SSTAT(sid) bfin_read32((SEC_SSTAT0 + (sid) * 8))
36#define bfin_write_SEC_SSTAT(sid, val) bfin_write32((SEC_SSTAT0 + (sid) * 8), val)
37
38/* RCU0 Registers */
39#define bfin_read_RCU0_CTL() bfin_read32(RCU0_CTL)
40#define bfin_write_RCU0_CTL(val) bfin_write32(RCU0_CTL, val)
41
42/* Watchdog Timer Registers */
43#define bfin_read_WDOG_CTL() bfin_read16(WDOG_CTL)
44#define bfin_write_WDOG_CTL(val) bfin_write16(WDOG_CTL, val)
45#define bfin_read_WDOG_CNT() bfin_read32(WDOG_CNT)
46#define bfin_write_WDOG_CNT(val) bfin_write32(WDOG_CNT, val)
47#define bfin_read_WDOG_STAT() bfin_read32(WDOG_STAT)
48#define bfin_write_WDOG_STAT(val) bfin_write32(WDOG_STAT, val)
49
50/* RTC Registers */
51
52/* UART0 Registers */
53
54#define bfin_read_UART0_REVID() bfin_read32(UART0_REVID)
55#define bfin_write_UART0_REVID(val) bfin_write32(UART0_REVID, val)
56#define bfin_read_UART0_GCTL() bfin_read32(UART0_GCTL)
57#define bfin_write_UART0_GCTL(val) bfin_write32(UART0_GCTL, val)
58#define bfin_read_UART0_STAT() bfin_read32(UART0_STAT)
59#define bfin_write_UART0_STAT(val) bfin_write32(UART0_STAT, val)
60#define bfin_read_UART0_SCR() bfin_read32(UART0_SCR)
61#define bfin_write_UART0_SCR(val) bfin_write32(UART0_SCR, val)
62#define bfin_read_UART0_CLK() bfin_read32(UART0_CLK)
63#define bfin_write_UART0_CLK(val) bfin_write32(UART0_CLK, val)
64#define bfin_read_UART0_IER() bfin_read32(UART0_IER)
65#define bfin_write_UART0_IER(val) bfin_write32(UART0_IER, val)
66#define bfin_read_UART0_IER_SET() bfin_read32(UART0_IER_SET)
67#define bfin_write_UART0_IER_SET(val) bfin_write32(UART0_IER_SET, val)
68#define bfin_read_UART0_IER_CLEAR() bfin_read32(UART0_IER_CLEAR)
69#define bfin_write_UART0_IER_CLEAR(val) bfin_write32(UART0_IER_CLEAR, val)
70#define bfin_read_UART0_RBR() bfin_read32(UART0_RBR)
71#define bfin_write_UART0_RBR(val) bfin_write32(UART0_RBR, val)
72#define bfin_read_UART0_THR() bfin_read32(UART0_THR)
73#define bfin_write_UART0_THR(val) bfin_write32(UART0_THR, val)
74#define bfin_read_UART0_TAIP() bfin_read32(UART0_TAIP)
75#define bfin_write_UART0_TAIP(val) bfin_write32(UART0_TAIP, val)
76#define bfin_read_UART0_TSR() bfin_read32(UART0_TSR)
77#define bfin_write_UART0_TSR(val) bfin_write32(UART0_TSR, val)
78#define bfin_read_UART0_RSR() bfin_read32(UART0_RSR)
79#define bfin_write_UART0_RSR(val) bfin_write32(UART0_RSR, val)
80#define bfin_read_UART0_TXCNT() bfin_read32(UART0_TXCNT)
81#define bfin_write_UART0_TXCNT(val) bfin_write32(UART0_TXCNT, val)
82#define bfin_read_UART0_RXCNT() bfin_read32(UART0_RXCNT)
83#define bfin_write_UART0_RXCNT(val) bfin_write32(UART0_RXCNT, val)
84
85/* UART1 Registers */
86
87#define bfin_read_UART1_REVID() bfin_read32(UART1_REVID)
88#define bfin_write_UART1_REVID(val) bfin_write32(UART1_REVID, val)
89#define bfin_read_UART1_GCTL() bfin_read32(UART1_GCTL)
90#define bfin_write_UART1_GCTL(val) bfin_write32(UART1_GCTL, val)
91#define bfin_read_UART1_STAT() bfin_read32(UART1_STAT)
92#define bfin_write_UART1_STAT(val) bfin_write32(UART1_STAT, val)
93#define bfin_read_UART1_SCR() bfin_read32(UART1_SCR)
94#define bfin_write_UART1_SCR(val) bfin_write32(UART1_SCR, val)
95#define bfin_read_UART1_CLK() bfin_read32(UART1_CLK)
96#define bfin_write_UART1_CLK(val) bfin_write32(UART1_CLK, val)
97#define bfin_read_UART1_IER() bfin_read32(UART1_IER)
98#define bfin_write_UART1_IER(val) bfin_write32(UART1_IER, val)
99#define bfin_read_UART1_IER_SET() bfin_read32(UART1_IER_SET)
100#define bfin_write_UART1_IER_SET(val) bfin_write32(UART1_IER_SET, val)
101#define bfin_read_UART1_IER_CLEAR() bfin_read32(UART1_IER_CLEAR)
102#define bfin_write_UART1_IER_CLEAR(val) bfin_write32(UART1_IER_CLEAR, val)
103#define bfin_read_UART1_RBR() bfin_read32(UART1_RBR)
104#define bfin_write_UART1_RBR(val) bfin_write32(UART1_RBR, val)
105#define bfin_read_UART1_THR() bfin_read32(UART1_THR)
106#define bfin_write_UART1_THR(val) bfin_write32(UART1_THR, val)
107#define bfin_read_UART1_TAIP() bfin_read32(UART1_TAIP)
108#define bfin_write_UART1_TAIP(val) bfin_write32(UART1_TAIP, val)
109#define bfin_read_UART1_TSR() bfin_read32(UART1_TSR)
110#define bfin_write_UART1_TSR(val) bfin_write32(UART1_TSR, val)
111#define bfin_read_UART1_RSR() bfin_read32(UART1_RSR)
112#define bfin_write_UART1_RSR(val) bfin_write32(UART1_RSR, val)
113#define bfin_read_UART1_TXCNT() bfin_read32(UART1_TXCNT)
114#define bfin_write_UART1_TXCNT(val) bfin_write32(UART1_TXCNT, val)
115#define bfin_read_UART1_RXCNT() bfin_read32(UART1_RXCNT)
116#define bfin_write_UART1_RXCNT(val) bfin_write32(UART1_RXCNT, val)
117
118
119/* SPI0 Registers */
120
121#define bfin_read_SPI0_CTL() bfin_read32(SPI0_CTL)
122#define bfin_write_SPI0_CTL(val) bfin_write32(SPI0_CTL, val)
123#define bfin_read_SPI0_RXCTL() bfin_read32(SPI0_RXCTL)
124#define bfin_write_SPI0_RXCTL(val) bfin_write32(SPI0_RXCTL, val)
125#define bfin_read_SPI0_TXCTL() bfin_read32(SPI0_TXCTL)
126#define bfin_write_SPI0_TXCTL(val) bfin_write32(SPI0_TXCTL, val)
127#define bfin_read_SPI0_CLK() bfin_read32(SPI0_CLK)
128#define bfin_write_SPI0_CLK(val) bfin_write32(SPI0_CLK, val)
129#define bfin_read_SPI0_DLY() bfin_read32(SPI0_DLY)
130#define bfin_write_SPI0_DLY(val) bfin_write32(SPI0_DLY, val)
131#define bfin_read_SPI0_SLVSEL() bfin_read32(SPI0_SLVSEL)
132#define bfin_write_SPI0_SLVSEL(val) bfin_write32(SPI0_SLVSEL, val)
133#define bfin_read_SPI0_RWC() bfin_read32(SPI0_RWC)
134#define bfin_write_SPI0_RWC(val) bfin_write32(SPI0_RWC, val)
135#define bfin_read_SPI0_RWCR() bfin_read32(SPI0_RWCR)
136#define bfin_write_SPI0_RWCR(val) bfin_write32(SPI0_RWCR, val)
137#define bfin_read_SPI0_TWC() bfin_read32(SPI0_TWC)
138#define bfin_write_SPI0_TWC(val) bfin_write32(SPI0_TWC, val)
139#define bfin_read_SPI0_TWCR() bfin_read32(SPI0_TWCR)
140#define bfin_write_SPI0_TWCR(val) bfin_write32(SPI0_TWCR, val)
141#define bfin_read_SPI0_IMSK() bfin_read32(SPI0_IMSK)
142#define bfin_write_SPI0_IMSK(val) bfin_write32(SPI0_IMSK, val)
143#define bfin_read_SPI0_IMSK_CLR() bfin_read32(SPI0_IMSK_CLR)
144#define bfin_write_SPI0_IMSK_CLR(val) bfin_write32(SPI0_IMSK_CLR, val)
145#define bfin_read_SPI0_IMSK_SET() bfin_read32(SPI0_IMSK_SET)
146#define bfin_write_SPI0_IMSK_SET(val) bfin_write32(SPI0_IMSK_SET, val)
147#define bfin_read_SPI0_STAT() bfin_read32(SPI0_STAT)
148#define bfin_write_SPI0_STAT(val) bfin_write32(SPI0_STAT, val)
149#define bfin_read_SPI0_ILAT() bfin_read32(SPI0_ILAT)
150#define bfin_write_SPI0_ILAT(val) bfin_write32(SPI0_ILAT, val)
151#define bfin_read_SPI0_ILAT_CLR() bfin_read32(SPI0_ILAT_CLR)
152#define bfin_write_SPI0_ILAT_CLR(val) bfin_write32(SPI0_ILAT_CLR, val)
153#define bfin_read_SPI0_RFIFO() bfin_read32(SPI0_RFIFO)
154#define bfin_write_SPI0_RFIFO(val) bfin_write32(SPI0_RFIFO, val)
155#define bfin_read_SPI0_TFIFO() bfin_read32(SPI0_TFIFO)
156#define bfin_write_SPI0_TFIFO(val) bfin_write32(SPI0_TFIFO, val)
157
158/* SPI1 Registers */
159
160#define bfin_read_SPI1_CTL() bfin_read32(SPI1_CTL)
161#define bfin_write_SPI1_CTL(val) bfin_write32(SPI1_CTL, val)
162#define bfin_read_SPI1_RXCTL() bfin_read32(SPI1_RXCTL)
163#define bfin_write_SPI1_RXCTL(val) bfin_write32(SPI1_RXCTL, val)
164#define bfin_read_SPI1_TXCTL() bfin_read32(SPI1_TXCTL)
165#define bfin_write_SPI1_TXCTL(val) bfin_write32(SPI1_TXCTL, val)
166#define bfin_read_SPI1_CLK() bfin_read32(SPI1_CLK)
167#define bfin_write_SPI1_CLK(val) bfin_write32(SPI1_CLK, val)
168#define bfin_read_SPI1_DLY() bfin_read32(SPI1_DLY)
169#define bfin_write_SPI1_DLY(val) bfin_write32(SPI1_DLY, val)
170#define bfin_read_SPI1_SLVSEL() bfin_read32(SPI1_SLVSEL)
171#define bfin_write_SPI1_SLVSEL(val) bfin_write32(SPI1_SLVSEL, val)
172#define bfin_read_SPI1_RWC() bfin_read32(SPI1_RWC)
173#define bfin_write_SPI1_RWC(val) bfin_write32(SPI1_RWC, val)
174#define bfin_read_SPI1_RWCR() bfin_read32(SPI1_RWCR)
175#define bfin_write_SPI1_RWCR(val) bfin_write32(SPI1_RWCR, val)
176#define bfin_read_SPI1_TWC() bfin_read32(SPI1_TWC)
177#define bfin_write_SPI1_TWC(val) bfin_write32(SPI1_TWC, val)
178#define bfin_read_SPI1_TWCR() bfin_read32(SPI1_TWCR)
179#define bfin_write_SPI1_TWCR(val) bfin_write32(SPI1_TWCR, val)
180#define bfin_read_SPI1_IMSK() bfin_read32(SPI1_IMSK)
181#define bfin_write_SPI1_IMSK(val) bfin_write32(SPI1_IMSK, val)
182#define bfin_read_SPI1_IMSK_CLR() bfin_read32(SPI1_IMSK_CLR)
183#define bfin_write_SPI1_IMSK_CLR(val) bfin_write32(SPI1_IMSK_CLR, val)
184#define bfin_read_SPI1_IMSK_SET() bfin_read32(SPI1_IMSK_SET)
185#define bfin_write_SPI1_IMSK_SET(val) bfin_write32(SPI1_IMSK_SET, val)
186#define bfin_read_SPI1_STAT() bfin_read32(SPI1_STAT)
187#define bfin_write_SPI1_STAT(val) bfin_write32(SPI1_STAT, val)
188#define bfin_read_SPI1_ILAT() bfin_read32(SPI1_ILAT)
189#define bfin_write_SPI1_ILAT(val) bfin_write32(SPI1_ILAT, val)
190#define bfin_read_SPI1_ILAT_CLR() bfin_read32(SPI1_ILAT_CLR)
191#define bfin_write_SPI1_ILAT_CLR(val) bfin_write32(SPI1_ILAT_CLR, val)
192#define bfin_read_SPI1_RFIFO() bfin_read32(SPI1_RFIFO)
193#define bfin_write_SPI1_RFIFO(val) bfin_write32(SPI1_RFIFO, val)
194#define bfin_read_SPI1_TFIFO() bfin_read32(SPI1_TFIFO)
195#define bfin_write_SPI1_TFIFO(val) bfin_write32(SPI1_TFIFO, val)
196
197/* Timer 0-7 registers */
198#define bfin_read_TIMER0_CONFIG() bfin_read16(TIMER0_CONFIG)
199#define bfin_write_TIMER0_CONFIG(val) bfin_write16(TIMER0_CONFIG, val)
200#define bfin_read_TIMER0_COUNTER() bfin_read32(TIMER0_COUNTER)
201#define bfin_write_TIMER0_COUNTER(val) bfin_write32(TIMER0_COUNTER, val)
202#define bfin_read_TIMER0_PERIOD() bfin_read32(TIMER0_PERIOD)
203#define bfin_write_TIMER0_PERIOD(val) bfin_write32(TIMER0_PERIOD, val)
204#define bfin_read_TIMER0_WIDTH() bfin_read32(TIMER0_WIDTH)
205#define bfin_write_TIMER0_WIDTH(val) bfin_write32(TIMER0_WIDTH, val)
206#define bfin_read_TIMER1_CONFIG() bfin_read16(TIMER1_CONFIG)
207#define bfin_write_TIMER1_CONFIG(val) bfin_write16(TIMER1_CONFIG, val)
208#define bfin_read_TIMER1_COUNTER() bfin_read32(TIMER1_COUNTER)
209#define bfin_write_TIMER1_COUNTER(val) bfin_write32(TIMER1_COUNTER, val)
210#define bfin_read_TIMER1_PERIOD() bfin_read32(TIMER1_PERIOD)
211#define bfin_write_TIMER1_PERIOD(val) bfin_write32(TIMER1_PERIOD, val)
212#define bfin_read_TIMER1_WIDTH() bfin_read32(TIMER1_WIDTH)
213#define bfin_write_TIMER1_WIDTH(val) bfin_write32(TIMER1_WIDTH, val)
214#define bfin_read_TIMER2_CONFIG() bfin_read16(TIMER2_CONFIG)
215#define bfin_write_TIMER2_CONFIG(val) bfin_write16(TIMER2_CONFIG, val)
216#define bfin_read_TIMER2_COUNTER() bfin_read32(TIMER2_COUNTER)
217#define bfin_write_TIMER2_COUNTER(val) bfin_write32(TIMER2_COUNTER, val)
218#define bfin_read_TIMER2_PERIOD() bfin_read32(TIMER2_PERIOD)
219#define bfin_write_TIMER2_PERIOD(val) bfin_write32(TIMER2_PERIOD, val)
220#define bfin_read_TIMER2_WIDTH() bfin_read32(TIMER2_WIDTH)
221#define bfin_write_TIMER2_WIDTH(val) bfin_write32(TIMER2_WIDTH, val)
222#define bfin_read_TIMER3_CONFIG() bfin_read16(TIMER3_CONFIG)
223#define bfin_write_TIMER3_CONFIG(val) bfin_write16(TIMER3_CONFIG, val)
224#define bfin_read_TIMER3_COUNTER() bfin_read32(TIMER3_COUNTER)
225#define bfin_write_TIMER3_COUNTER(val) bfin_write32(TIMER3_COUNTER, val)
226#define bfin_read_TIMER3_PERIOD() bfin_read32(TIMER3_PERIOD)
227#define bfin_write_TIMER3_PERIOD(val) bfin_write32(TIMER3_PERIOD, val)
228#define bfin_read_TIMER3_WIDTH() bfin_read32(TIMER3_WIDTH)
229#define bfin_write_TIMER3_WIDTH(val) bfin_write32(TIMER3_WIDTH, val)
230#define bfin_read_TIMER4_CONFIG() bfin_read16(TIMER4_CONFIG)
231#define bfin_write_TIMER4_CONFIG(val) bfin_write16(TIMER4_CONFIG, val)
232#define bfin_read_TIMER4_COUNTER() bfin_read32(TIMER4_COUNTER)
233#define bfin_write_TIMER4_COUNTER(val) bfin_write32(TIMER4_COUNTER, val)
234#define bfin_read_TIMER4_PERIOD() bfin_read32(TIMER4_PERIOD)
235#define bfin_write_TIMER4_PERIOD(val) bfin_write32(TIMER4_PERIOD, val)
236#define bfin_read_TIMER4_WIDTH() bfin_read32(TIMER4_WIDTH)
237#define bfin_write_TIMER4_WIDTH(val) bfin_write32(TIMER4_WIDTH, val)
238#define bfin_read_TIMER5_CONFIG() bfin_read16(TIMER5_CONFIG)
239#define bfin_write_TIMER5_CONFIG(val) bfin_write16(TIMER5_CONFIG, val)
240#define bfin_read_TIMER5_COUNTER() bfin_read32(TIMER5_COUNTER)
241#define bfin_write_TIMER5_COUNTER(val) bfin_write32(TIMER5_COUNTER, val)
242#define bfin_read_TIMER5_PERIOD() bfin_read32(TIMER5_PERIOD)
243#define bfin_write_TIMER5_PERIOD(val) bfin_write32(TIMER5_PERIOD, val)
244#define bfin_read_TIMER5_WIDTH() bfin_read32(TIMER5_WIDTH)
245#define bfin_write_TIMER5_WIDTH(val) bfin_write32(TIMER5_WIDTH, val)
246#define bfin_read_TIMER6_CONFIG() bfin_read16(TIMER6_CONFIG)
247#define bfin_write_TIMER6_CONFIG(val) bfin_write16(TIMER6_CONFIG, val)
248#define bfin_read_TIMER6_COUNTER() bfin_read32(TIMER6_COUNTER)
249#define bfin_write_TIMER6_COUNTER(val) bfin_write32(TIMER6_COUNTER, val)
250#define bfin_read_TIMER6_PERIOD() bfin_read32(TIMER6_PERIOD)
251#define bfin_write_TIMER6_PERIOD(val) bfin_write32(TIMER6_PERIOD, val)
252#define bfin_read_TIMER6_WIDTH() bfin_read32(TIMER6_WIDTH)
253#define bfin_write_TIMER6_WIDTH(val) bfin_write32(TIMER6_WIDTH, val)
254#define bfin_read_TIMER7_CONFIG() bfin_read16(TIMER7_CONFIG)
255#define bfin_write_TIMER7_CONFIG(val) bfin_write16(TIMER7_CONFIG, val)
256#define bfin_read_TIMER7_COUNTER() bfin_read32(TIMER7_COUNTER)
257#define bfin_write_TIMER7_COUNTER(val) bfin_write32(TIMER7_COUNTER, val)
258#define bfin_read_TIMER7_PERIOD() bfin_read32(TIMER7_PERIOD)
259#define bfin_write_TIMER7_PERIOD(val) bfin_write32(TIMER7_PERIOD, val)
260#define bfin_read_TIMER7_WIDTH() bfin_read32(TIMER7_WIDTH)
261#define bfin_write_TIMER7_WIDTH(val) bfin_write32(TIMER7_WIDTH, val)
262
263
264
265
266/* Two Wire Interface Registers (TWI0) */
267
268/* SPORT1 Registers */
269
270
271/* SMC Registers */
272#define bfin_read_SMC_GCTL() bfin_read32(SMC_GCTL)
273#define bfin_write_SMC_GCTL(val) bfin_write32(SMC_GCTL, val)
274#define bfin_read_SMC_GSTAT() bfin_read32(SMC_GSTAT)
275#define bfin_read_SMC_B0CTL() bfin_read32(SMC_B0CTL)
276#define bfin_write_SMC_B0CTL(val) bfin_write32(SMC_B0CTL, val)
277#define bfin_read_SMC_B0TIM() bfin_read32(SMC_B0TIM)
278#define bfin_write_SMC_B0TIM(val) bfin_write32(SMC_B0TIM, val)
279#define bfin_read_SMC_B0ETIM() bfin_read32(SMC_B0ETIM)
280#define bfin_write_SMC_B0ETIM(val) bfin_write32(SMC_B0ETIM, val)
281#define bfin_read_SMC_B1CTL() bfin_read32(SMC_B1CTL)
282#define bfin_write_SMC_B1CTL(val) bfin_write32(SMC_B1CTL, val)
283#define bfin_read_SMC_B1TIM() bfin_read32(SMC_B1TIM)
284#define bfin_write_SMC_B1TIM(val) bfin_write32(SMC_B1TIM, val)
285#define bfin_read_SMC_B1ETIM() bfin_read32(SMC_B1ETIM)
286#define bfin_write_SMC_B1ETIM(val) bfin_write32(SMC_B1ETIM, val)
287#define bfin_read_SMC_B2CTL() bfin_read32(SMC_B2CTL)
288#define bfin_write_SMC_B2CTL(val) bfin_write32(SMC_B2CTL, val)
289#define bfin_read_SMC_B2TIM() bfin_read32(SMC_B2TIM)
290#define bfin_write_SMC_B2TIM(val) bfin_write32(SMC_B2TIM, val)
291#define bfin_read_SMC_B2ETIM() bfin_read32(SMC_B2ETIM)
292#define bfin_write_SMC_B2ETIM(val) bfin_write32(SMC_B2ETIM, val)
293#define bfin_read_SMC_B3CTL() bfin_read32(SMC_B3CTL)
294#define bfin_write_SMC_B3CTL(val) bfin_write32(SMC_B3CTL, val)
295#define bfin_read_SMC_B3TIM() bfin_read32(SMC_B3TIM)
296#define bfin_write_SMC_B3TIM(val) bfin_write32(SMC_B3TIM, val)
297#define bfin_read_SMC_B3ETIM() bfin_read32(SMC_B3ETIM)
298#define bfin_write_SMC_B3ETIM(val) bfin_write32(SMC_B3ETIM, val)
299
300/* DDR2 Memory Control Registers */
301#define bfin_read_DMC0_CFG() bfin_read32(DMC0_CFG)
302#define bfin_write_DMC0_CFG(val) bfin_write32(DMC0_CFG, val)
303#define bfin_read_DMC0_TR0() bfin_read32(DMC0_TR0)
304#define bfin_write_DMC0_TR0(val) bfin_write32(DMC0_TR0, val)
305#define bfin_read_DMC0_TR1() bfin_read32(DMC0_TR1)
306#define bfin_write_DMC0_TR1(val) bfin_write32(DMC0_TR1, val)
307#define bfin_read_DMC0_TR2() bfin_read32(DMC0_TR2)
308#define bfin_write_DMC0_TR2(val) bfin_write32(DMC0_TR2, val)
309#define bfin_read_DMC0_MR() bfin_read32(DMC0_MR)
310#define bfin_write_DMC0_MR(val) bfin_write32(DMC0_MR, val)
311#define bfin_read_DMC0_EMR1() bfin_read32(DMC0_EMR1)
312#define bfin_write_DMC0_EMR1(val) bfin_write32(DMC0_EMR1, val)
313#define bfin_read_DMC0_CTL() bfin_read32(DMC0_CTL)
314#define bfin_write_DMC0_CTL(val) bfin_write32(DMC0_CTL, val)
315#define bfin_read_DMC0_STAT() bfin_read32(DMC0_STAT)
316#define bfin_write_DMC0_STAT(val) bfin_write32(DMC0_STAT, val)
317#define bfin_read_DMC0_DLLCTL() bfin_read32(DMC0_DLLCTL)
318#define bfin_write_DMC0_DLLCTL(val) bfin_write32(DMC0_DLLCTL, val)
319
320/* DDR BankRead and Write Count Registers */
321
322
323/* DMA Channel 0 Registers */
324
325#define bfin_read_DMA0_NEXT_DESC_PTR() bfin_read32(DMA0_NEXT_DESC_PTR)
326#define bfin_write_DMA0_NEXT_DESC_PTR(val) bfin_write32(DMA0_NEXT_DESC_PTR, val)
327#define bfin_read_DMA0_START_ADDR() bfin_read32(DMA0_START_ADDR)
328#define bfin_write_DMA0_START_ADDR(val) bfin_write32(DMA0_START_ADDR, val)
329#define bfin_read_DMA0_CONFIG() bfin_read32(DMA0_CONFIG)
330#define bfin_write_DMA0_CONFIG(val) bfin_write32(DMA0_CONFIG, val)
331#define bfin_read_DMA0_X_COUNT() bfin_read32(DMA0_X_COUNT)
332#define bfin_write_DMA0_X_COUNT(val) bfin_write32(DMA0_X_COUNT, val)
333#define bfin_read_DMA0_X_MODIFY() bfin_read32(DMA0_X_MODIFY)
334#define bfin_write_DMA0_X_MODIFY(val) bfin_write32(DMA0_X_MODIFY, val)
335#define bfin_read_DMA0_Y_COUNT() bfin_read32(DMA0_Y_COUNT)
336#define bfin_write_DMA0_Y_COUNT(val) bfin_write32(DMA0_Y_COUNT, val)
337#define bfin_read_DMA0_Y_MODIFY() bfin_read32(DMA0_Y_MODIFY)
338#define bfin_write_DMA0_Y_MODIFY(val) bfin_write32(DMA0_Y_MODIFY, val)
339#define bfin_read_DMA0_CURR_DESC_PTR() bfin_read32(DMA0_CURR_DESC_PTR)
340#define bfin_write_DMA0_CURR_DESC_PTR(val) bfin_write32(DMA0_CURR_DESC_PTR, val)
341#define bfin_read_DMA0_PREV_DESC_PTR() bfin_read32(DMA0_PREV_DESC_PTR)
342#define bfin_write_DMA0_PREV_DESC_PTR(val) bfin_write32(DMA0_PREV_DESC_PTR, val)
343#define bfin_read_DMA0_CURR_ADDR() bfin_read32(DMA0_CURR_ADDR)
344#define bfin_write_DMA0_CURR_ADDR(val) bfin_write32(DMA0_CURR_ADDR, val)
345#define bfin_read_DMA0_IRQ_STATUS() bfin_read32(DMA0_IRQ_STATUS)
346#define bfin_write_DMA0_IRQ_STATUS(val) bfin_write32(DMA0_IRQ_STATUS, val)
347#define bfin_read_DMA0_CURR_X_COUNT() bfin_read32(DMA0_CURR_X_COUNT)
348#define bfin_write_DMA0_CURR_X_COUNT(val) bfin_write32(DMA0_CURR_X_COUNT, val)
349#define bfin_read_DMA0_CURR_Y_COUNT() bfin_read32(DMA0_CURR_Y_COUNT)
350#define bfin_write_DMA0_CURR_Y_COUNT(val) bfin_write32(DMA0_CURR_Y_COUNT, val)
351#define bfin_read_DMA0_BWL_COUNT() bfin_read32(DMA0_BWL_COUNT)
352#define bfin_write_DMA0_BWL_COUNT(val) bfin_write32(DMA0_BWL_COUNT, val)
353#define bfin_read_DMA0_CURR_BWL_COUNT() bfin_read32(DMA0_CURR_BWL_COUNT)
354#define bfin_write_DMA0_CURR_BWL_COUNT(val) bfin_write32(DMA0_CURR_BWL_COUNT, val)
355#define bfin_read_DMA0_BWM_COUNT() bfin_read32(DMA0_BWM_COUNT)
356#define bfin_write_DMA0_BWM_COUNT(val) bfin_write32(DMA0_BWM_COUNT, val)
357#define bfin_read_DMA0_CURR_BWM_COUNT() bfin_read32(DMA0_CURR_BWM_COUNT)
358#define bfin_write_DMA0_CURR_BWM_COUNT(val) bfin_write32(DMA0_CURR_BWM_COUNT, val)
359
360/* DMA Channel 1 Registers */
361
362#define bfin_read_DMA1_NEXT_DESC_PTR() bfin_read32(DMA1_NEXT_DESC_PTR)
363#define bfin_write_DMA1_NEXT_DESC_PTR(val) bfin_write32(DMA1_NEXT_DESC_PTR, val)
364#define bfin_read_DMA1_START_ADDR() bfin_read32(DMA1_START_ADDR)
365#define bfin_write_DMA1_START_ADDR(val) bfin_write32(DMA1_START_ADDR, val)
366#define bfin_read_DMA1_CONFIG() bfin_read32(DMA1_CONFIG)
367#define bfin_write_DMA1_CONFIG(val) bfin_write32(DMA1_CONFIG, val)
368#define bfin_read_DMA1_X_COUNT() bfin_read32(DMA1_X_COUNT)
369#define bfin_write_DMA1_X_COUNT(val) bfin_write32(DMA1_X_COUNT, val)
370#define bfin_read_DMA1_X_MODIFY() bfin_read32(DMA1_X_MODIFY)
371#define bfin_write_DMA1_X_MODIFY(val) bfin_write32(DMA1_X_MODIFY, val)
372#define bfin_read_DMA1_Y_COUNT() bfin_read32(DMA1_Y_COUNT)
373#define bfin_write_DMA1_Y_COUNT(val) bfin_write32(DMA1_Y_COUNT, val)
374#define bfin_read_DMA1_Y_MODIFY() bfin_read32(DMA1_Y_MODIFY)
375#define bfin_write_DMA1_Y_MODIFY(val) bfin_write32(DMA1_Y_MODIFY, val)
376#define bfin_read_DMA1_CURR_DESC_PTR() bfin_read32(DMA1_CURR_DESC_PTR)
377#define bfin_write_DMA1_CURR_DESC_PTR(val) bfin_write32(DMA1_CURR_DESC_PTR, val)
378#define bfin_read_DMA1_PREV_DESC_PTR() bfin_read32(DMA1_PREV_DESC_PTR)
379#define bfin_write_DMA1_PREV_DESC_PTR(val) bfin_write32(DMA1_PREV_DESC_PTR, val)
380#define bfin_read_DMA1_CURR_ADDR() bfin_read32(DMA1_CURR_ADDR)
381#define bfin_write_DMA1_CURR_ADDR(val) bfin_write32(DMA1_CURR_ADDR, val)
382#define bfin_read_DMA1_IRQ_STATUS() bfin_read32(DMA1_IRQ_STATUS)
383#define bfin_write_DMA1_IRQ_STATUS(val) bfin_write32(DMA1_IRQ_STATUS, val)
384#define bfin_read_DMA1_CURR_X_COUNT() bfin_read32(DMA1_CURR_X_COUNT)
385#define bfin_write_DMA1_CURR_X_COUNT(val) bfin_write32(DMA1_CURR_X_COUNT, val)
386#define bfin_read_DMA1_CURR_Y_COUNT() bfin_read32(DMA1_CURR_Y_COUNT)
387#define bfin_write_DMA1_CURR_Y_COUNT(val) bfin_write32(DMA1_CURR_Y_COUNT, val)
388#define bfin_read_DMA1_BWL_COUNT() bfin_read32(DMA1_BWL_COUNT)
389#define bfin_write_DMA1_BWL_COUNT(val) bfin_write32(DMA1_BWL_COUNT, val)
390#define bfin_read_DMA1_CURR_BWL_COUNT() bfin_read32(DMA1_CURR_BWL_COUNT)
391#define bfin_write_DMA1_CURR_BWL_COUNT(val) bfin_write32(DMA1_CURR_BWL_COUNT, val)
392#define bfin_read_DMA1_BWM_COUNT() bfin_read32(DMA1_BWM_COUNT)
393#define bfin_write_DMA1_BWM_COUNT(val) bfin_write32(DMA1_BWM_COUNT, val)
394#define bfin_read_DMA1_CURR_BWM_COUNT() bfin_read32(DMA1_CURR_BWM_COUNT)
395#define bfin_write_DMA1_CURR_BWM_COUNT(val) bfin_write32(DMA1_CURR_BWM_COUNT, val)
396
397/* DMA Channel 2 Registers */
398
399#define bfin_read_DMA2_NEXT_DESC_PTR() bfin_read32(DMA2_NEXT_DESC_PTR)
400#define bfin_write_DMA2_NEXT_DESC_PTR(val) bfin_write32(DMA2_NEXT_DESC_PTR, val)
401#define bfin_read_DMA2_START_ADDR() bfin_read32(DMA2_START_ADDR)
402#define bfin_write_DMA2_START_ADDR(val) bfin_write32(DMA2_START_ADDR, val)
403#define bfin_read_DMA2_CONFIG() bfin_read32(DMA2_CONFIG)
404#define bfin_write_DMA2_CONFIG(val) bfin_write32(DMA2_CONFIG, val)
405#define bfin_read_DMA2_X_COUNT() bfin_read32(DMA2_X_COUNT)
406#define bfin_write_DMA2_X_COUNT(val) bfin_write32(DMA2_X_COUNT, val)
407#define bfin_read_DMA2_X_MODIFY() bfin_read32(DMA2_X_MODIFY)
408#define bfin_write_DMA2_X_MODIFY(val) bfin_write32(DMA2_X_MODIFY, val)
409#define bfin_read_DMA2_Y_COUNT() bfin_read32(DMA2_Y_COUNT)
410#define bfin_write_DMA2_Y_COUNT(val) bfin_write32(DMA2_Y_COUNT, val)
411#define bfin_read_DMA2_Y_MODIFY() bfin_read32(DMA2_Y_MODIFY)
412#define bfin_write_DMA2_Y_MODIFY(val) bfin_write32(DMA2_Y_MODIFY, val)
413#define bfin_read_DMA2_CURR_DESC_PTR() bfin_read32(DMA2_CURR_DESC_PTR)
414#define bfin_write_DMA2_CURR_DESC_PTR(val) bfin_write32(DMA2_CURR_DESC_PTR, val)
415#define bfin_read_DMA2_PREV_DESC_PTR() bfin_read32(DMA2_PREV_DESC_PTR)
416#define bfin_write_DMA2_PREV_DESC_PTR(val) bfin_write32(DMA2_PREV_DESC_PTR, val)
417#define bfin_read_DMA2_CURR_ADDR() bfin_read32(DMA2_CURR_ADDR)
418#define bfin_write_DMA2_CURR_ADDR(val) bfin_write32(DMA2_CURR_ADDR, val)
419#define bfin_read_DMA2_IRQ_STATUS() bfin_read32(DMA2_IRQ_STATUS)
420#define bfin_write_DMA2_IRQ_STATUS(val) bfin_write32(DMA2_IRQ_STATUS, val)
421#define bfin_read_DMA2_CURR_X_COUNT() bfin_read32(DMA2_CURR_X_COUNT)
422#define bfin_write_DMA2_CURR_X_COUNT(val) bfin_write32(DMA2_CURR_X_COUNT, val)
423#define bfin_read_DMA2_CURR_Y_COUNT() bfin_read32(DMA2_CURR_Y_COUNT)
424#define bfin_write_DMA2_CURR_Y_COUNT(val) bfin_write32(DMA2_CURR_Y_COUNT, val)
425#define bfin_read_DMA2_BWL_COUNT() bfin_read32(DMA2_BWL_COUNT)
426#define bfin_write_DMA2_BWL_COUNT(val) bfin_write32(DMA2_BWL_COUNT, val)
427#define bfin_read_DMA2_CURR_BWL_COUNT() bfin_read32(DMA2_CURR_BWL_COUNT)
428#define bfin_write_DMA2_CURR_BWL_COUNT(val) bfin_write32(DMA2_CURR_BWL_COUNT, val)
429#define bfin_read_DMA2_BWM_COUNT() bfin_read32(DMA2_BWM_COUNT)
430#define bfin_write_DMA2_BWM_COUNT(val) bfin_write32(DMA2_BWM_COUNT, val)
431#define bfin_read_DMA2_CURR_BWM_COUNT() bfin_read32(DMA2_CURR_BWM_COUNT)
432#define bfin_write_DMA2_CURR_BWM_COUNT(val) bfin_write32(DMA2_CURR_BWM_COUNT, val)
433
434/* DMA Channel 3 Registers */
435
436#define bfin_read_DMA3_NEXT_DESC_PTR() bfin_read32(DMA3_NEXT_DESC_PTR)
437#define bfin_write_DMA3_NEXT_DESC_PTR(val) bfin_write32(DMA3_NEXT_DESC_PTR, val)
438#define bfin_read_DMA3_START_ADDR() bfin_read32(DMA3_START_ADDR)
439#define bfin_write_DMA3_START_ADDR(val) bfin_write32(DMA3_START_ADDR, val)
440#define bfin_read_DMA3_CONFIG() bfin_read32(DMA3_CONFIG)
441#define bfin_write_DMA3_CONFIG(val) bfin_write32(DMA3_CONFIG, val)
442#define bfin_read_DMA3_X_COUNT() bfin_read32(DMA3_X_COUNT)
443#define bfin_write_DMA3_X_COUNT(val) bfin_write32(DMA3_X_COUNT, val)
444#define bfin_read_DMA3_X_MODIFY() bfin_read32(DMA3_X_MODIFY)
445#define bfin_write_DMA3_X_MODIFY(val) bfin_write32(DMA3_X_MODIFY, val)
446#define bfin_read_DMA3_Y_COUNT() bfin_read32(DMA3_Y_COUNT)
447#define bfin_write_DMA3_Y_COUNT(val) bfin_write32(DMA3_Y_COUNT, val)
448#define bfin_read_DMA3_Y_MODIFY() bfin_read32(DMA3_Y_MODIFY)
449#define bfin_write_DMA3_Y_MODIFY(val) bfin_write32(DMA3_Y_MODIFY, val)
450#define bfin_read_DMA3_CURR_DESC_PTR() bfin_read32(DMA3_CURR_DESC_PTR)
451#define bfin_write_DMA3_CURR_DESC_PTR(val) bfin_write32(DMA3_CURR_DESC_PTR, val)
452#define bfin_read_DMA3_PREV_DESC_PTR() bfin_read32(DMA3_PREV_DESC_PTR)
453#define bfin_write_DMA3_PREV_DESC_PTR(val) bfin_write32(DMA3_PREV_DESC_PTR, val)
454#define bfin_read_DMA3_CURR_ADDR() bfin_read32(DMA3_CURR_ADDR)
455#define bfin_write_DMA3_CURR_ADDR(val) bfin_write32(DMA3_CURR_ADDR, val)
456#define bfin_read_DMA3_IRQ_STATUS() bfin_read32(DMA3_IRQ_STATUS)
457#define bfin_write_DMA3_IRQ_STATUS(val) bfin_write32(DMA3_IRQ_STATUS, val)
458#define bfin_read_DMA3_CURR_X_COUNT() bfin_read32(DMA3_CURR_X_COUNT)
459#define bfin_write_DMA3_CURR_X_COUNT(val) bfin_write32(DMA3_CURR_X_COUNT, val)
460#define bfin_read_DMA3_CURR_Y_COUNT() bfin_read32(DMA3_CURR_Y_COUNT)
461#define bfin_write_DMA3_CURR_Y_COUNT(val) bfin_write32(DMA3_CURR_Y_COUNT, val)
462#define bfin_read_DMA3_BWL_COUNT() bfin_read32(DMA3_BWL_COUNT)
463#define bfin_write_DMA3_BWL_COUNT(val) bfin_write32(DMA3_BWL_COUNT, val)
464#define bfin_read_DMA3_CURR_BWL_COUNT() bfin_read32(DMA3_CURR_BWL_COUNT)
465#define bfin_write_DMA3_CURR_BWL_COUNT(val) bfin_write32(DMA3_CURR_BWL_COUNT, val)
466#define bfin_read_DMA3_BWM_COUNT() bfin_read32(DMA3_BWM_COUNT)
467#define bfin_write_DMA3_BWM_COUNT(val) bfin_write32(DMA3_BWM_COUNT, val)
468#define bfin_read_DMA3_CURR_BWM_COUNT() bfin_read32(DMA3_CURR_BWM_COUNT)
469#define bfin_write_DMA3_CURR_BWM_COUNT(val) bfin_write32(DMA3_CURR_BWM_COUNT, val)
470
471/* DMA Channel 4 Registers */
472
473#define bfin_read_DMA4_NEXT_DESC_PTR() bfin_read32(DMA4_NEXT_DESC_PTR)
474#define bfin_write_DMA4_NEXT_DESC_PTR(val) bfin_write32(DMA4_NEXT_DESC_PTR, val)
475#define bfin_read_DMA4_START_ADDR() bfin_read32(DMA4_START_ADDR)
476#define bfin_write_DMA4_START_ADDR(val) bfin_write32(DMA4_START_ADDR, val)
477#define bfin_read_DMA4_CONFIG() bfin_read32(DMA4_CONFIG)
478#define bfin_write_DMA4_CONFIG(val) bfin_write32(DMA4_CONFIG, val)
479#define bfin_read_DMA4_X_COUNT() bfin_read32(DMA4_X_COUNT)
480#define bfin_write_DMA4_X_COUNT(val) bfin_write32(DMA4_X_COUNT, val)
481#define bfin_read_DMA4_X_MODIFY() bfin_read32(DMA4_X_MODIFY)
482#define bfin_write_DMA4_X_MODIFY(val) bfin_write32(DMA4_X_MODIFY, val)
483#define bfin_read_DMA4_Y_COUNT() bfin_read32(DMA4_Y_COUNT)
484#define bfin_write_DMA4_Y_COUNT(val) bfin_write32(DMA4_Y_COUNT, val)
485#define bfin_read_DMA4_Y_MODIFY() bfin_read32(DMA4_Y_MODIFY)
486#define bfin_write_DMA4_Y_MODIFY(val) bfin_write32(DMA4_Y_MODIFY, val)
487#define bfin_read_DMA4_CURR_DESC_PTR() bfin_read32(DMA4_CURR_DESC_PTR)
488#define bfin_write_DMA4_CURR_DESC_PTR(val) bfin_write32(DMA4_CURR_DESC_PTR, val)
489#define bfin_read_DMA4_PREV_DESC_PTR() bfin_read32(DMA4_PREV_DESC_PTR)
490#define bfin_write_DMA4_PREV_DESC_PTR(val) bfin_write32(DMA4_PREV_DESC_PTR, val)
491#define bfin_read_DMA4_CURR_ADDR() bfin_read32(DMA4_CURR_ADDR)
492#define bfin_write_DMA4_CURR_ADDR(val) bfin_write32(DMA4_CURR_ADDR, val)
493#define bfin_read_DMA4_IRQ_STATUS() bfin_read32(DMA4_IRQ_STATUS)
494#define bfin_write_DMA4_IRQ_STATUS(val) bfin_write32(DMA4_IRQ_STATUS, val)
495#define bfin_read_DMA4_CURR_X_COUNT() bfin_read32(DMA4_CURR_X_COUNT)
496#define bfin_write_DMA4_CURR_X_COUNT(val) bfin_write32(DMA4_CURR_X_COUNT, val)
497#define bfin_read_DMA4_CURR_Y_COUNT() bfin_read32(DMA4_CURR_Y_COUNT)
498#define bfin_write_DMA4_CURR_Y_COUNT(val) bfin_write32(DMA4_CURR_Y_COUNT, val)
499#define bfin_read_DMA4_BWL_COUNT() bfin_read32(DMA4_BWL_COUNT)
500#define bfin_write_DMA4_BWL_COUNT(val) bfin_write32(DMA4_BWL_COUNT, val)
501#define bfin_read_DMA4_CURR_BWL_COUNT() bfin_read32(DMA4_CURR_BWL_COUNT)
502#define bfin_write_DMA4_CURR_BWL_COUNT(val) bfin_write32(DMA4_CURR_BWL_COUNT, val)
503#define bfin_read_DMA4_BWM_COUNT() bfin_read32(DMA4_BWM_COUNT)
504#define bfin_write_DMA4_BWM_COUNT(val) bfin_write32(DMA4_BWM_COUNT, val)
505#define bfin_read_DMA4_CURR_BWM_COUNT() bfin_read32(DMA4_CURR_BWM_COUNT)
506#define bfin_write_DMA4_CURR_BWM_COUNT(val) bfin_write32(DMA4_CURR_BWM_COUNT, val)
507
508/* DMA Channel 5 Registers */
509
510#define bfin_read_DMA5_NEXT_DESC_PTR() bfin_read32(DMA5_NEXT_DESC_PTR)
511#define bfin_write_DMA5_NEXT_DESC_PTR(val) bfin_write32(DMA5_NEXT_DESC_PTR, val)
512#define bfin_read_DMA5_START_ADDR() bfin_read32(DMA5_START_ADDR)
513#define bfin_write_DMA5_START_ADDR(val) bfin_write32(DMA5_START_ADDR, val)
514#define bfin_read_DMA5_CONFIG() bfin_read32(DMA5_CONFIG)
515#define bfin_write_DMA5_CONFIG(val) bfin_write32(DMA5_CONFIG, val)
516#define bfin_read_DMA5_X_COUNT() bfin_read32(DMA5_X_COUNT)
517#define bfin_write_DMA5_X_COUNT(val) bfin_write32(DMA5_X_COUNT, val)
518#define bfin_read_DMA5_X_MODIFY() bfin_read32(DMA5_X_MODIFY)
519#define bfin_write_DMA5_X_MODIFY(val) bfin_write32(DMA5_X_MODIFY, val)
520#define bfin_read_DMA5_Y_COUNT() bfin_read32(DMA5_Y_COUNT)
521#define bfin_write_DMA5_Y_COUNT(val) bfin_write32(DMA5_Y_COUNT, val)
522#define bfin_read_DMA5_Y_MODIFY() bfin_read32(DMA5_Y_MODIFY)
523#define bfin_write_DMA5_Y_MODIFY(val) bfin_write32(DMA5_Y_MODIFY, val)
524#define bfin_read_DMA5_CURR_DESC_PTR() bfin_read32(DMA5_CURR_DESC_PTR)
525#define bfin_write_DMA5_CURR_DESC_PTR(val) bfin_write32(DMA5_CURR_DESC_PTR, val)
526#define bfin_read_DMA5_PREV_DESC_PTR() bfin_read32(DMA5_PREV_DESC_PTR)
527#define bfin_write_DMA5_PREV_DESC_PTR(val) bfin_write32(DMA5_PREV_DESC_PTR, val)
528#define bfin_read_DMA5_CURR_ADDR() bfin_read32(DMA5_CURR_ADDR)
529#define bfin_write_DMA5_CURR_ADDR(val) bfin_write32(DMA5_CURR_ADDR, val)
530#define bfin_read_DMA5_IRQ_STATUS() bfin_read32(DMA5_IRQ_STATUS)
531#define bfin_write_DMA5_IRQ_STATUS(val) bfin_write32(DMA5_IRQ_STATUS, val)
532#define bfin_read_DMA5_CURR_X_COUNT() bfin_read32(DMA5_CURR_X_COUNT)
533#define bfin_write_DMA5_CURR_X_COUNT(val) bfin_write32(DMA5_CURR_X_COUNT, val)
534#define bfin_read_DMA5_CURR_Y_COUNT() bfin_read32(DMA5_CURR_Y_COUNT)
535#define bfin_write_DMA5_CURR_Y_COUNT(val) bfin_write32(DMA5_CURR_Y_COUNT, val)
536#define bfin_read_DMA5_BWL_COUNT() bfin_read32(DMA5_BWL_COUNT)
537#define bfin_write_DMA5_BWL_COUNT(val) bfin_write32(DMA5_BWL_COUNT, val)
538#define bfin_read_DMA5_CURR_BWL_COUNT() bfin_read32(DMA5_CURR_BWL_COUNT)
539#define bfin_write_DMA5_CURR_BWL_COUNT(val) bfin_write32(DMA5_CURR_BWL_COUNT, val)
540#define bfin_read_DMA5_BWM_COUNT() bfin_read32(DMA5_BWM_COUNT)
541#define bfin_write_DMA5_BWM_COUNT(val) bfin_write32(DMA5_BWM_COUNT, val)
542#define bfin_read_DMA5_CURR_BWM_COUNT() bfin_read32(DMA5_CURR_BWM_COUNT)
543#define bfin_write_DMA5_CURR_BWM_COUNT(val) bfin_write32(DMA5_CURR_BWM_COUNT, val)
544
545/* DMA Channel 6 Registers */
546
547#define bfin_read_DMA6_NEXT_DESC_PTR() bfin_read32(DMA6_NEXT_DESC_PTR)
548#define bfin_write_DMA6_NEXT_DESC_PTR(val) bfin_write32(DMA6_NEXT_DESC_PTR, val)
549#define bfin_read_DMA6_START_ADDR() bfin_read32(DMA6_START_ADDR)
550#define bfin_write_DMA6_START_ADDR(val) bfin_write32(DMA6_START_ADDR, val)
551#define bfin_read_DMA6_CONFIG() bfin_read32(DMA6_CONFIG)
552#define bfin_write_DMA6_CONFIG(val) bfin_write32(DMA6_CONFIG, val)
553#define bfin_read_DMA6_X_COUNT() bfin_read32(DMA6_X_COUNT)
554#define bfin_write_DMA6_X_COUNT(val) bfin_write32(DMA6_X_COUNT, val)
555#define bfin_read_DMA6_X_MODIFY() bfin_read32(DMA6_X_MODIFY)
556#define bfin_write_DMA6_X_MODIFY(val) bfin_write32(DMA6_X_MODIFY, val)
557#define bfin_read_DMA6_Y_COUNT() bfin_read32(DMA6_Y_COUNT)
558#define bfin_write_DMA6_Y_COUNT(val) bfin_write32(DMA6_Y_COUNT, val)
559#define bfin_read_DMA6_Y_MODIFY() bfin_read32(DMA6_Y_MODIFY)
560#define bfin_write_DMA6_Y_MODIFY(val) bfin_write32(DMA6_Y_MODIFY, val)
561#define bfin_read_DMA6_CURR_DESC_PTR() bfin_read32(DMA6_CURR_DESC_PTR)
562#define bfin_write_DMA6_CURR_DESC_PTR(val) bfin_write32(DMA6_CURR_DESC_PTR, val)
563#define bfin_read_DMA6_PREV_DESC_PTR() bfin_read32(DMA6_PREV_DESC_PTR)
564#define bfin_write_DMA6_PREV_DESC_PTR(val) bfin_write32(DMA6_PREV_DESC_PTR, val)
565#define bfin_read_DMA6_CURR_ADDR() bfin_read32(DMA6_CURR_ADDR)
566#define bfin_write_DMA6_CURR_ADDR(val) bfin_write32(DMA6_CURR_ADDR, val)
567#define bfin_read_DMA6_IRQ_STATUS() bfin_read32(DMA6_IRQ_STATUS)
568#define bfin_write_DMA6_IRQ_STATUS(val) bfin_write32(DMA6_IRQ_STATUS, val)
569#define bfin_read_DMA6_CURR_X_COUNT() bfin_read32(DMA6_CURR_X_COUNT)
570#define bfin_write_DMA6_CURR_X_COUNT(val) bfin_write32(DMA6_CURR_X_COUNT, val)
571#define bfin_read_DMA6_CURR_Y_COUNT() bfin_read32(DMA6_CURR_Y_COUNT)
572#define bfin_write_DMA6_CURR_Y_COUNT(val) bfin_write32(DMA6_CURR_Y_COUNT, val)
573#define bfin_read_DMA6_BWL_COUNT() bfin_read32(DMA6_BWL_COUNT)
574#define bfin_write_DMA6_BWL_COUNT(val) bfin_write32(DMA6_BWL_COUNT, val)
575#define bfin_read_DMA6_CURR_BWL_COUNT() bfin_read32(DMA6_CURR_BWL_COUNT)
576#define bfin_write_DMA6_CURR_BWL_COUNT(val) bfin_write32(DMA6_CURR_BWL_COUNT, val)
577#define bfin_read_DMA6_BWM_COUNT() bfin_read32(DMA6_BWM_COUNT)
578#define bfin_write_DMA6_BWM_COUNT(val) bfin_write32(DMA6_BWM_COUNT, val)
579#define bfin_read_DMA6_CURR_BWM_COUNT() bfin_read32(DMA6_CURR_BWM_COUNT)
580#define bfin_write_DMA6_CURR_BWM_COUNT(val) bfin_write32(DMA6_CURR_BWM_COUNT, val)
581
582/* DMA Channel 7 Registers */
583
584#define bfin_read_DMA7_NEXT_DESC_PTR() bfin_read32(DMA7_NEXT_DESC_PTR)
585#define bfin_write_DMA7_NEXT_DESC_PTR(val) bfin_write32(DMA7_NEXT_DESC_PTR, val)
586#define bfin_read_DMA7_START_ADDR() bfin_read32(DMA7_START_ADDR)
587#define bfin_write_DMA7_START_ADDR(val) bfin_write32(DMA7_START_ADDR, val)
588#define bfin_read_DMA7_CONFIG() bfin_read32(DMA7_CONFIG)
589#define bfin_write_DMA7_CONFIG(val) bfin_write32(DMA7_CONFIG, val)
590#define bfin_read_DMA7_X_COUNT() bfin_read32(DMA7_X_COUNT)
591#define bfin_write_DMA7_X_COUNT(val) bfin_write32(DMA7_X_COUNT, val)
592#define bfin_read_DMA7_X_MODIFY() bfin_read32(DMA7_X_MODIFY)
593#define bfin_write_DMA7_X_MODIFY(val) bfin_write32(DMA7_X_MODIFY, val)
594#define bfin_read_DMA7_Y_COUNT() bfin_read32(DMA7_Y_COUNT)
595#define bfin_write_DMA7_Y_COUNT(val) bfin_write32(DMA7_Y_COUNT, val)
596#define bfin_read_DMA7_Y_MODIFY() bfin_read32(DMA7_Y_MODIFY)
597#define bfin_write_DMA7_Y_MODIFY(val) bfin_write32(DMA7_Y_MODIFY, val)
598#define bfin_read_DMA7_CURR_DESC_PTR() bfin_read32(DMA7_CURR_DESC_PTR)
599#define bfin_write_DMA7_CURR_DESC_PTR(val) bfin_write32(DMA7_CURR_DESC_PTR, val)
600#define bfin_read_DMA7_PREV_DESC_PTR() bfin_read32(DMA7_PREV_DESC_PTR)
601#define bfin_write_DMA7_PREV_DESC_PTR(val) bfin_write32(DMA7_PREV_DESC_PTR, val)
602#define bfin_read_DMA7_CURR_ADDR() bfin_read32(DMA7_CURR_ADDR)
603#define bfin_write_DMA7_CURR_ADDR(val) bfin_write32(DMA7_CURR_ADDR, val)
604#define bfin_read_DMA7_IRQ_STATUS() bfin_read32(DMA7_IRQ_STATUS)
605#define bfin_write_DMA7_IRQ_STATUS(val) bfin_write32(DMA7_IRQ_STATUS, val)
606#define bfin_read_DMA7_CURR_X_COUNT() bfin_read32(DMA7_CURR_X_COUNT)
607#define bfin_write_DMA7_CURR_X_COUNT(val) bfin_write32(DMA7_CURR_X_COUNT, val)
608#define bfin_read_DMA7_CURR_Y_COUNT() bfin_read32(DMA7_CURR_Y_COUNT)
609#define bfin_write_DMA7_CURR_Y_COUNT(val) bfin_write32(DMA7_CURR_Y_COUNT, val)
610#define bfin_read_DMA7_BWL_COUNT() bfin_read32(DMA7_BWL_COUNT)
611#define bfin_write_DMA7_BWL_COUNT(val) bfin_write32(DMA7_BWL_COUNT, val)
612#define bfin_read_DMA7_CURR_BWL_COUNT() bfin_read32(DMA7_CURR_BWL_COUNT)
613#define bfin_write_DMA7_CURR_BWL_COUNT(val) bfin_write32(DMA7_CURR_BWL_COUNT, val)
614#define bfin_read_DMA7_BWM_COUNT() bfin_read32(DMA7_BWM_COUNT)
615#define bfin_write_DMA7_BWM_COUNT(val) bfin_write32(DMA7_BWM_COUNT, val)
616#define bfin_read_DMA7_CURR_BWM_COUNT() bfin_read32(DMA7_CURR_BWM_COUNT)
617#define bfin_write_DMA7_CURR_BWM_COUNT(val) bfin_write32(DMA7_CURR_BWM_COUNT, val)
618
619/* DMA Channel 8 Registers */
620
621#define bfin_read_DMA8_NEXT_DESC_PTR() bfin_read32(DMA8_NEXT_DESC_PTR)
622#define bfin_write_DMA8_NEXT_DESC_PTR(val) bfin_write32(DMA8_NEXT_DESC_PTR, val)
623#define bfin_read_DMA8_START_ADDR() bfin_read32(DMA8_START_ADDR)
624#define bfin_write_DMA8_START_ADDR(val) bfin_write32(DMA8_START_ADDR, val)
625#define bfin_read_DMA8_CONFIG() bfin_read32(DMA8_CONFIG)
626#define bfin_write_DMA8_CONFIG(val) bfin_write32(DMA8_CONFIG, val)
627#define bfin_read_DMA8_X_COUNT() bfin_read32(DMA8_X_COUNT)
628#define bfin_write_DMA8_X_COUNT(val) bfin_write32(DMA8_X_COUNT, val)
629#define bfin_read_DMA8_X_MODIFY() bfin_read32(DMA8_X_MODIFY)
630#define bfin_write_DMA8_X_MODIFY(val) bfin_write32(DMA8_X_MODIFY, val)
631#define bfin_read_DMA8_Y_COUNT() bfin_read32(DMA8_Y_COUNT)
632#define bfin_write_DMA8_Y_COUNT(val) bfin_write32(DMA8_Y_COUNT, val)
633#define bfin_read_DMA8_Y_MODIFY() bfin_read32(DMA8_Y_MODIFY)
634#define bfin_write_DMA8_Y_MODIFY(val) bfin_write32(DMA8_Y_MODIFY, val)
635#define bfin_read_DMA8_CURR_DESC_PTR() bfin_read32(DMA8_CURR_DESC_PTR)
636#define bfin_write_DMA8_CURR_DESC_PTR(val) bfin_write32(DMA8_CURR_DESC_PTR, val)
637#define bfin_read_DMA8_PREV_DESC_PTR() bfin_read32(DMA8_PREV_DESC_PTR)
638#define bfin_write_DMA8_PREV_DESC_PTR(val) bfin_write32(DMA8_PREV_DESC_PTR, val)
639#define bfin_read_DMA8_CURR_ADDR() bfin_read32(DMA8_CURR_ADDR)
640#define bfin_write_DMA8_CURR_ADDR(val) bfin_write32(DMA8_CURR_ADDR, val)
641#define bfin_read_DMA8_IRQ_STATUS() bfin_read32(DMA8_IRQ_STATUS)
642#define bfin_write_DMA8_IRQ_STATUS(val) bfin_write32(DMA8_IRQ_STATUS, val)
643#define bfin_read_DMA8_CURR_X_COUNT() bfin_read32(DMA8_CURR_X_COUNT)
644#define bfin_write_DMA8_CURR_X_COUNT(val) bfin_write32(DMA8_CURR_X_COUNT, val)
645#define bfin_read_DMA8_CURR_Y_COUNT() bfin_read32(DMA8_CURR_Y_COUNT)
646#define bfin_write_DMA8_CURR_Y_COUNT(val) bfin_write32(DMA8_CURR_Y_COUNT, val)
647#define bfin_read_DMA8_BWL_COUNT() bfin_read32(DMA8_BWL_COUNT)
648#define bfin_write_DMA8_BWL_COUNT(val) bfin_write32(DMA8_BWL_COUNT, val)
649#define bfin_read_DMA8_CURR_BWL_COUNT() bfin_read32(DMA8_CURR_BWL_COUNT)
650#define bfin_write_DMA8_CURR_BWL_COUNT(val) bfin_write32(DMA8_CURR_BWL_COUNT, val)
651#define bfin_read_DMA8_BWM_COUNT() bfin_read32(DMA8_BWM_COUNT)
652#define bfin_write_DMA8_BWM_COUNT(val) bfin_write32(DMA8_BWM_COUNT, val)
653#define bfin_read_DMA8_CURR_BWM_COUNT() bfin_read32(DMA8_CURR_BWM_COUNT)
654#define bfin_write_DMA8_CURR_BWM_COUNT(val) bfin_write32(DMA8_CURR_BWM_COUNT, val)
655
656/* DMA Channel 9 Registers */
657
658#define bfin_read_DMA9_NEXT_DESC_PTR() bfin_read32(DMA9_NEXT_DESC_PTR)
659#define bfin_write_DMA9_NEXT_DESC_PTR(val) bfin_write32(DMA9_NEXT_DESC_PTR, val)
660#define bfin_read_DMA9_START_ADDR() bfin_read32(DMA9_START_ADDR)
661#define bfin_write_DMA9_START_ADDR(val) bfin_write32(DMA9_START_ADDR, val)
662#define bfin_read_DMA9_CONFIG() bfin_read32(DMA9_CONFIG)
663#define bfin_write_DMA9_CONFIG(val) bfin_write32(DMA9_CONFIG, val)
664#define bfin_read_DMA9_X_COUNT() bfin_read32(DMA9_X_COUNT)
665#define bfin_write_DMA9_X_COUNT(val) bfin_write32(DMA9_X_COUNT, val)
666#define bfin_read_DMA9_X_MODIFY() bfin_read32(DMA9_X_MODIFY)
667#define bfin_write_DMA9_X_MODIFY(val) bfin_write32(DMA9_X_MODIFY, val)
668#define bfin_read_DMA9_Y_COUNT() bfin_read32(DMA9_Y_COUNT)
669#define bfin_write_DMA9_Y_COUNT(val) bfin_write32(DMA9_Y_COUNT, val)
670#define bfin_read_DMA9_Y_MODIFY() bfin_read32(DMA9_Y_MODIFY)
671#define bfin_write_DMA9_Y_MODIFY(val) bfin_write32(DMA9_Y_MODIFY, val)
672#define bfin_read_DMA9_CURR_DESC_PTR() bfin_read32(DMA9_CURR_DESC_PTR)
673#define bfin_write_DMA9_CURR_DESC_PTR(val) bfin_write32(DMA9_CURR_DESC_PTR, val)
674#define bfin_read_DMA9_PREV_DESC_PTR() bfin_read32(DMA9_PREV_DESC_PTR)
675#define bfin_write_DMA9_PREV_DESC_PTR(val) bfin_write32(DMA9_PREV_DESC_PTR, val)
676#define bfin_read_DMA9_CURR_ADDR() bfin_read32(DMA9_CURR_ADDR)
677#define bfin_write_DMA9_CURR_ADDR(val) bfin_write32(DMA9_CURR_ADDR, val)
678#define bfin_read_DMA9_IRQ_STATUS() bfin_read32(DMA9_IRQ_STATUS)
679#define bfin_write_DMA9_IRQ_STATUS(val) bfin_write32(DMA9_IRQ_STATUS, val)
680#define bfin_read_DMA9_CURR_X_COUNT() bfin_read32(DMA9_CURR_X_COUNT)
681#define bfin_write_DMA9_CURR_X_COUNT(val) bfin_write32(DMA9_CURR_X_COUNT, val)
682#define bfin_read_DMA9_CURR_Y_COUNT() bfin_read32(DMA9_CURR_Y_COUNT)
683#define bfin_write_DMA9_CURR_Y_COUNT(val) bfin_write32(DMA9_CURR_Y_COUNT, val)
684#define bfin_read_DMA9_BWL_COUNT() bfin_read32(DMA9_BWL_COUNT)
685#define bfin_write_DMA9_BWL_COUNT(val) bfin_write32(DMA9_BWL_COUNT, val)
686#define bfin_read_DMA9_CURR_BWL_COUNT() bfin_read32(DMA9_CURR_BWL_COUNT)
687#define bfin_write_DMA9_CURR_BWL_COUNT(val) bfin_write32(DMA9_CURR_BWL_COUNT, val)
688#define bfin_read_DMA9_BWM_COUNT() bfin_read32(DMA9_BWM_COUNT)
689#define bfin_write_DMA9_BWM_COUNT(val) bfin_write32(DMA9_BWM_COUNT, val)
690#define bfin_read_DMA9_CURR_BWM_COUNT() bfin_read32(DMA9_CURR_BWM_COUNT)
691#define bfin_write_DMA9_CURR_BWM_COUNT(val) bfin_write32(DMA9_CURR_BWM_COUNT, val)
692
693/* DMA Channel 10 Registers */
694
695#define bfin_read_DMA10_NEXT_DESC_PTR() bfin_read32(DMA10_NEXT_DESC_PTR)
696#define bfin_write_DMA10_NEXT_DESC_PTR(val) bfin_write32(DMA10_NEXT_DESC_PTR, val)
697#define bfin_read_DMA10_START_ADDR() bfin_read32(DMA10_START_ADDR)
698#define bfin_write_DMA10_START_ADDR(val) bfin_write32(DMA10_START_ADDR, val)
699#define bfin_read_DMA10_CONFIG() bfin_read32(DMA10_CONFIG)
700#define bfin_write_DMA10_CONFIG(val) bfin_write32(DMA10_CONFIG, val)
701#define bfin_read_DMA10_X_COUNT() bfin_read32(DMA10_X_COUNT)
702#define bfin_write_DMA10_X_COUNT(val) bfin_write32(DMA10_X_COUNT, val)
703#define bfin_read_DMA10_X_MODIFY() bfin_read32(DMA10_X_MODIFY)
704#define bfin_write_DMA10_X_MODIFY(val) bfin_write32(DMA10_X_MODIFY, val)
705#define bfin_read_DMA10_Y_COUNT() bfin_read32(DMA10_Y_COUNT)
706#define bfin_write_DMA10_Y_COUNT(val) bfin_write32(DMA10_Y_COUNT, val)
707#define bfin_read_DMA10_Y_MODIFY() bfin_read32(DMA10_Y_MODIFY)
708#define bfin_write_DMA10_Y_MODIFY(val) bfin_write32(DMA10_Y_MODIFY, val)
709#define bfin_read_DMA10_CURR_DESC_PTR() bfin_read32(DMA10_CURR_DESC_PTR)
710#define bfin_write_DMA10_CURR_DESC_PTR(val) bfin_write32(DMA10_CURR_DESC_PTR, val)
711#define bfin_read_DMA10_PREV_DESC_PTR() bfin_read32(DMA10_PREV_DESC_PTR)
712#define bfin_write_DMA10_PREV_DESC_PTR(val) bfin_write32(DMA10_PREV_DESC_PTR, val)
713#define bfin_read_DMA10_CURR_ADDR() bfin_read32(DMA10_CURR_ADDR)
714#define bfin_write_DMA10_CURR_ADDR(val) bfin_write32(DMA10_CURR_ADDR, val)
715#define bfin_read_DMA10_IRQ_STATUS() bfin_read32(DMA10_IRQ_STATUS)
716#define bfin_write_DMA10_IRQ_STATUS(val) bfin_write32(DMA10_IRQ_STATUS, val)
717#define bfin_read_DMA10_CURR_X_COUNT() bfin_read32(DMA10_CURR_X_COUNT)
718#define bfin_write_DMA10_CURR_X_COUNT(val) bfin_write32(DMA10_CURR_X_COUNT, val)
719#define bfin_read_DMA10_CURR_Y_COUNT() bfin_read32(DMA10_CURR_Y_COUNT)
720#define bfin_write_DMA10_CURR_Y_COUNT(val) bfin_write32(DMA10_CURR_Y_COUNT, val)
721#define bfin_read_DMA10_BWL_COUNT() bfin_read32(DMA10_BWL_COUNT)
722#define bfin_write_DMA10_BWL_COUNT(val) bfin_write32(DMA10_BWL_COUNT, val)
723#define bfin_read_DMA10_CURR_BWL_COUNT() bfin_read32(DMA10_CURR_BWL_COUNT)
724#define bfin_write_DMA10_CURR_BWL_COUNT(val) bfin_write32(DMA10_CURR_BWL_COUNT, val)
725#define bfin_read_DMA10_BWM_COUNT() bfin_read32(DMA10_BWM_COUNT)
726#define bfin_write_DMA10_BWM_COUNT(val) bfin_write32(DMA10_BWM_COUNT, val)
727#define bfin_read_DMA10_CURR_BWM_COUNT() bfin_read32(DMA10_CURR_BWM_COUNT)
728#define bfin_write_DMA10_CURR_BWM_COUNT(val) bfin_write32(DMA10_CURR_BWM_COUNT, val)
729
730/* DMA Channel 11 Registers */
731
732#define bfin_read_DMA11_NEXT_DESC_PTR() bfin_read32(DMA11_NEXT_DESC_PTR)
733#define bfin_write_DMA11_NEXT_DESC_PTR(val) bfin_write32(DMA11_NEXT_DESC_PTR, val)
734#define bfin_read_DMA11_START_ADDR() bfin_read32(DMA11_START_ADDR)
735#define bfin_write_DMA11_START_ADDR(val) bfin_write32(DMA11_START_ADDR, val)
736#define bfin_read_DMA11_CONFIG() bfin_read32(DMA11_CONFIG)
737#define bfin_write_DMA11_CONFIG(val) bfin_write32(DMA11_CONFIG, val)
738#define bfin_read_DMA11_X_COUNT() bfin_read32(DMA11_X_COUNT)
739#define bfin_write_DMA11_X_COUNT(val) bfin_write32(DMA11_X_COUNT, val)
740#define bfin_read_DMA11_X_MODIFY() bfin_read32(DMA11_X_MODIFY)
741#define bfin_write_DMA11_X_MODIFY(val) bfin_write32(DMA11_X_MODIFY, val)
742#define bfin_read_DMA11_Y_COUNT() bfin_read32(DMA11_Y_COUNT)
743#define bfin_write_DMA11_Y_COUNT(val) bfin_write32(DMA11_Y_COUNT, val)
744#define bfin_read_DMA11_Y_MODIFY() bfin_read32(DMA11_Y_MODIFY)
745#define bfin_write_DMA11_Y_MODIFY(val) bfin_write32(DMA11_Y_MODIFY, val)
746#define bfin_read_DMA11_CURR_DESC_PTR() bfin_read32(DMA11_CURR_DESC_PTR)
747#define bfin_write_DMA11_CURR_DESC_PTR(val) bfin_write32(DMA11_CURR_DESC_PTR, val)
748#define bfin_read_DMA11_PREV_DESC_PTR() bfin_read32(DMA11_PREV_DESC_PTR)
749#define bfin_write_DMA11_PREV_DESC_PTR(val) bfin_write32(DMA11_PREV_DESC_PTR, val)
750#define bfin_read_DMA11_CURR_ADDR() bfin_read32(DMA11_CURR_ADDR)
751#define bfin_write_DMA11_CURR_ADDR(val) bfin_write32(DMA11_CURR_ADDR, val)
752#define bfin_read_DMA11_IRQ_STATUS() bfin_read32(DMA11_IRQ_STATUS)
753#define bfin_write_DMA11_IRQ_STATUS(val) bfin_write32(DMA11_IRQ_STATUS, val)
754#define bfin_read_DMA11_CURR_X_COUNT() bfin_read32(DMA11_CURR_X_COUNT)
755#define bfin_write_DMA11_CURR_X_COUNT(val) bfin_write32(DMA11_CURR_X_COUNT, val)
756#define bfin_read_DMA11_CURR_Y_COUNT() bfin_read32(DMA11_CURR_Y_COUNT)
757#define bfin_write_DMA11_CURR_Y_COUNT(val) bfin_write32(DMA11_CURR_Y_COUNT, val)
758#define bfin_read_DMA11_BWL_COUNT() bfin_read32(DMA11_BWL_COUNT)
759#define bfin_write_DMA11_BWL_COUNT(val) bfin_write32(DMA11_BWL_COUNT, val)
760#define bfin_read_DMA11_CURR_BWL_COUNT() bfin_read32(DMA11_CURR_BWL_COUNT)
761#define bfin_write_DMA11_CURR_BWL_COUNT(val) bfin_write32(DMA11_CURR_BWL_COUNT, val)
762#define bfin_read_DMA11_BWM_COUNT() bfin_read32(DMA11_BWM_COUNT)
763#define bfin_write_DMA11_BWM_COUNT(val) bfin_write32(DMA11_BWM_COUNT, val)
764#define bfin_read_DMA11_CURR_BWM_COUNT() bfin_read32(DMA11_CURR_BWM_COUNT)
765#define bfin_write_DMA11_CURR_BWM_COUNT(val) bfin_write32(DMA11_CURR_BWM_COUNT, val)
766
767/* DMA Channel 12 Registers */
768
769#define bfin_read_DMA12_NEXT_DESC_PTR() bfin_read32(DMA12_NEXT_DESC_PTR)
770#define bfin_write_DMA12_NEXT_DESC_PTR(val) bfin_write32(DMA12_NEXT_DESC_PTR, val)
771#define bfin_read_DMA12_START_ADDR() bfin_read32(DMA12_START_ADDR)
772#define bfin_write_DMA12_START_ADDR(val) bfin_write32(DMA12_START_ADDR, val)
773#define bfin_read_DMA12_CONFIG() bfin_read32(DMA12_CONFIG)
774#define bfin_write_DMA12_CONFIG(val) bfin_write32(DMA12_CONFIG, val)
775#define bfin_read_DMA12_X_COUNT() bfin_read32(DMA12_X_COUNT)
776#define bfin_write_DMA12_X_COUNT(val) bfin_write32(DMA12_X_COUNT, val)
777#define bfin_read_DMA12_X_MODIFY() bfin_read32(DMA12_X_MODIFY)
778#define bfin_write_DMA12_X_MODIFY(val) bfin_write32(DMA12_X_MODIFY, val)
779#define bfin_read_DMA12_Y_COUNT() bfin_read32(DMA12_Y_COUNT)
780#define bfin_write_DMA12_Y_COUNT(val) bfin_write32(DMA12_Y_COUNT, val)
781#define bfin_read_DMA12_Y_MODIFY() bfin_read32(DMA12_Y_MODIFY)
782#define bfin_write_DMA12_Y_MODIFY(val) bfin_write32(DMA12_Y_MODIFY, val)
783#define bfin_read_DMA12_CURR_DESC_PTR() bfin_read32(DMA12_CURR_DESC_PTR)
784#define bfin_write_DMA12_CURR_DESC_PTR(val) bfin_write32(DMA12_CURR_DESC_PTR, val)
785#define bfin_read_DMA12_PREV_DESC_PTR() bfin_read32(DMA12_PREV_DESC_PTR)
786#define bfin_write_DMA12_PREV_DESC_PTR(val) bfin_write32(DMA12_PREV_DESC_PTR, val)
787#define bfin_read_DMA12_CURR_ADDR() bfin_read32(DMA12_CURR_ADDR)
788#define bfin_write_DMA12_CURR_ADDR(val) bfin_write32(DMA12_CURR_ADDR, val)
789#define bfin_read_DMA12_IRQ_STATUS() bfin_read32(DMA12_IRQ_STATUS)
790#define bfin_write_DMA12_IRQ_STATUS(val) bfin_write32(DMA12_IRQ_STATUS, val)
791#define bfin_read_DMA12_CURR_X_COUNT() bfin_read32(DMA12_CURR_X_COUNT)
792#define bfin_write_DMA12_CURR_X_COUNT(val) bfin_write32(DMA12_CURR_X_COUNT, val)
793#define bfin_read_DMA12_CURR_Y_COUNT() bfin_read32(DMA12_CURR_Y_COUNT)
794#define bfin_write_DMA12_CURR_Y_COUNT(val) bfin_write32(DMA12_CURR_Y_COUNT, val)
795#define bfin_read_DMA12_BWL_COUNT() bfin_read32(DMA12_BWL_COUNT)
796#define bfin_write_DMA12_BWL_COUNT(val) bfin_write32(DMA12_BWL_COUNT, val)
797#define bfin_read_DMA12_CURR_BWL_COUNT() bfin_read32(DMA12_CURR_BWL_COUNT)
798#define bfin_write_DMA12_CURR_BWL_COUNT(val) bfin_write32(DMA12_CURR_BWL_COUNT, val)
799#define bfin_read_DMA12_BWM_COUNT() bfin_read32(DMA12_BWM_COUNT)
800#define bfin_write_DMA12_BWM_COUNT(val) bfin_write32(DMA12_BWM_COUNT, val)
801#define bfin_read_DMA12_CURR_BWM_COUNT() bfin_read32(DMA12_CURR_BWM_COUNT)
802#define bfin_write_DMA12_CURR_BWM_COUNT(val) bfin_write32(DMA12_CURR_BWM_COUNT, val)
803
804/* DMA Channel 13 Registers */
805
806#define bfin_read_DMA13_NEXT_DESC_PTR() bfin_read32(DMA13_NEXT_DESC_PTR)
807#define bfin_write_DMA13_NEXT_DESC_PTR(val) bfin_write32(DMA13_NEXT_DESC_PTR, val)
808#define bfin_read_DMA13_START_ADDR() bfin_read32(DMA13_START_ADDR)
809#define bfin_write_DMA13_START_ADDR(val) bfin_write32(DMA13_START_ADDR, val)
810#define bfin_read_DMA13_CONFIG() bfin_read32(DMA13_CONFIG)
811#define bfin_write_DMA13_CONFIG(val) bfin_write32(DMA13_CONFIG, val)
812#define bfin_read_DMA13_X_COUNT() bfin_read32(DMA13_X_COUNT)
813#define bfin_write_DMA13_X_COUNT(val) bfin_write32(DMA13_X_COUNT, val)
814#define bfin_read_DMA13_X_MODIFY() bfin_read32(DMA13_X_MODIFY)
815#define bfin_write_DMA13_X_MODIFY(val) bfin_write32(DMA13_X_MODIFY, val)
816#define bfin_read_DMA13_Y_COUNT() bfin_read32(DMA13_Y_COUNT)
817#define bfin_write_DMA13_Y_COUNT(val) bfin_write32(DMA13_Y_COUNT, val)
818#define bfin_read_DMA13_Y_MODIFY() bfin_read32(DMA13_Y_MODIFY)
819#define bfin_write_DMA13_Y_MODIFY(val) bfin_write32(DMA13_Y_MODIFY, val)
820#define bfin_read_DMA13_CURR_DESC_PTR() bfin_read32(DMA13_CURR_DESC_PTR)
821#define bfin_write_DMA13_CURR_DESC_PTR(val) bfin_write32(DMA13_CURR_DESC_PTR, val)
822#define bfin_read_DMA13_PREV_DESC_PTR() bfin_read32(DMA13_PREV_DESC_PTR)
823#define bfin_write_DMA13_PREV_DESC_PTR(val) bfin_write32(DMA13_PREV_DESC_PTR, val)
824#define bfin_read_DMA13_CURR_ADDR() bfin_read32(DMA13_CURR_ADDR)
825#define bfin_write_DMA13_CURR_ADDR(val) bfin_write32(DMA13_CURR_ADDR, val)
826#define bfin_read_DMA13_IRQ_STATUS() bfin_read32(DMA13_IRQ_STATUS)
827#define bfin_write_DMA13_IRQ_STATUS(val) bfin_write32(DMA13_IRQ_STATUS, val)
828#define bfin_read_DMA13_CURR_X_COUNT() bfin_read32(DMA13_CURR_X_COUNT)
829#define bfin_write_DMA13_CURR_X_COUNT(val) bfin_write32(DMA13_CURR_X_COUNT, val)
830#define bfin_read_DMA13_CURR_Y_COUNT() bfin_read32(DMA13_CURR_Y_COUNT)
831#define bfin_write_DMA13_CURR_Y_COUNT(val) bfin_write32(DMA13_CURR_Y_COUNT, val)
832#define bfin_read_DMA13_BWL_COUNT() bfin_read32(DMA13_BWL_COUNT)
833#define bfin_write_DMA13_BWL_COUNT(val) bfin_write32(DMA13_BWL_COUNT, val)
834#define bfin_read_DMA13_CURR_BWL_COUNT() bfin_read32(DMA13_CURR_BWL_COUNT)
835#define bfin_write_DMA13_CURR_BWL_COUNT(val) bfin_write32(DMA13_CURR_BWL_COUNT, val)
836#define bfin_read_DMA13_BWM_COUNT() bfin_read32(DMA13_BWM_COUNT)
837#define bfin_write_DMA13_BWM_COUNT(val) bfin_write32(DMA13_BWM_COUNT, val)
838#define bfin_read_DMA13_CURR_BWM_COUNT() bfin_read32(DMA13_CURR_BWM_COUNT)
839#define bfin_write_DMA13_CURR_BWM_COUNT(val) bfin_write32(DMA13_CURR_BWM_COUNT, val)
840
841/* DMA Channel 14 Registers */
842
843#define bfin_read_DMA14_NEXT_DESC_PTR() bfin_read32(DMA14_NEXT_DESC_PTR)
844#define bfin_write_DMA14_NEXT_DESC_PTR(val) bfin_write32(DMA14_NEXT_DESC_PTR, val)
845#define bfin_read_DMA14_START_ADDR() bfin_read32(DMA14_START_ADDR)
846#define bfin_write_DMA14_START_ADDR(val) bfin_write32(DMA14_START_ADDR, val)
847#define bfin_read_DMA14_CONFIG() bfin_read32(DMA14_CONFIG)
848#define bfin_write_DMA14_CONFIG(val) bfin_write32(DMA14_CONFIG, val)
849#define bfin_read_DMA14_X_COUNT() bfin_read32(DMA14_X_COUNT)
850#define bfin_write_DMA14_X_COUNT(val) bfin_write32(DMA14_X_COUNT, val)
851#define bfin_read_DMA14_X_MODIFY() bfin_read32(DMA14_X_MODIFY)
852#define bfin_write_DMA14_X_MODIFY(val) bfin_write32(DMA14_X_MODIFY, val)
853#define bfin_read_DMA14_Y_COUNT() bfin_read32(DMA14_Y_COUNT)
854#define bfin_write_DMA14_Y_COUNT(val) bfin_write32(DMA14_Y_COUNT, val)
855#define bfin_read_DMA14_Y_MODIFY() bfin_read32(DMA14_Y_MODIFY)
856#define bfin_write_DMA14_Y_MODIFY(val) bfin_write32(DMA14_Y_MODIFY, val)
857#define bfin_read_DMA14_CURR_DESC_PTR() bfin_read32(DMA14_CURR_DESC_PTR)
858#define bfin_write_DMA14_CURR_DESC_PTR(val) bfin_write32(DMA14_CURR_DESC_PTR, val)
859#define bfin_read_DMA14_PREV_DESC_PTR() bfin_read32(DMA14_PREV_DESC_PTR)
860#define bfin_write_DMA14_PREV_DESC_PTR(val) bfin_write32(DMA14_PREV_DESC_PTR, val)
861#define bfin_read_DMA14_CURR_ADDR() bfin_read32(DMA14_CURR_ADDR)
862#define bfin_write_DMA14_CURR_ADDR(val) bfin_write32(DMA14_CURR_ADDR, val)
863#define bfin_read_DMA14_IRQ_STATUS() bfin_read32(DMA14_IRQ_STATUS)
864#define bfin_write_DMA14_IRQ_STATUS(val) bfin_write32(DMA14_IRQ_STATUS, val)
865#define bfin_read_DMA14_CURR_X_COUNT() bfin_read32(DMA14_CURR_X_COUNT)
866#define bfin_write_DMA14_CURR_X_COUNT(val) bfin_write32(DMA14_CURR_X_COUNT, val)
867#define bfin_read_DMA14_CURR_Y_COUNT() bfin_read32(DMA14_CURR_Y_COUNT)
868#define bfin_write_DMA14_CURR_Y_COUNT(val) bfin_write32(DMA14_CURR_Y_COUNT, val)
869#define bfin_read_DMA14_BWL_COUNT() bfin_read32(DMA14_BWL_COUNT)
870#define bfin_write_DMA14_BWL_COUNT(val) bfin_write32(DMA14_BWL_COUNT, val)
871#define bfin_read_DMA14_CURR_BWL_COUNT() bfin_read32(DMA14_CURR_BWL_COUNT)
872#define bfin_write_DMA14_CURR_BWL_COUNT(val) bfin_write32(DMA14_CURR_BWL_COUNT, val)
873#define bfin_read_DMA14_BWM_COUNT() bfin_read32(DMA14_BWM_COUNT)
874#define bfin_write_DMA14_BWM_COUNT(val) bfin_write32(DMA14_BWM_COUNT, val)
875#define bfin_read_DMA14_CURR_BWM_COUNT() bfin_read32(DMA14_CURR_BWM_COUNT)
876#define bfin_write_DMA14_CURR_BWM_COUNT(val) bfin_write32(DMA14_CURR_BWM_COUNT, val)
877
878/* DMA Channel 15 Registers */
879
880#define bfin_read_DMA15_NEXT_DESC_PTR() bfin_read32(DMA15_NEXT_DESC_PTR)
881#define bfin_write_DMA15_NEXT_DESC_PTR(val) bfin_write32(DMA15_NEXT_DESC_PTR, val)
882#define bfin_read_DMA15_START_ADDR() bfin_read32(DMA15_START_ADDR)
883#define bfin_write_DMA15_START_ADDR(val) bfin_write32(DMA15_START_ADDR, val)
884#define bfin_read_DMA15_CONFIG() bfin_read32(DMA15_CONFIG)
885#define bfin_write_DMA15_CONFIG(val) bfin_write32(DMA15_CONFIG, val)
886#define bfin_read_DMA15_X_COUNT() bfin_read32(DMA15_X_COUNT)
887#define bfin_write_DMA15_X_COUNT(val) bfin_write32(DMA15_X_COUNT, val)
888#define bfin_read_DMA15_X_MODIFY() bfin_read32(DMA15_X_MODIFY)
889#define bfin_write_DMA15_X_MODIFY(val) bfin_write32(DMA15_X_MODIFY, val)
890#define bfin_read_DMA15_Y_COUNT() bfin_read32(DMA15_Y_COUNT)
891#define bfin_write_DMA15_Y_COUNT(val) bfin_write32(DMA15_Y_COUNT, val)
892#define bfin_read_DMA15_Y_MODIFY() bfin_read32(DMA15_Y_MODIFY)
893#define bfin_write_DMA15_Y_MODIFY(val) bfin_write32(DMA15_Y_MODIFY, val)
894#define bfin_read_DMA15_CURR_DESC_PTR() bfin_read32(DMA15_CURR_DESC_PTR)
895#define bfin_write_DMA15_CURR_DESC_PTR(val) bfin_write32(DMA15_CURR_DESC_PTR, val)
896#define bfin_read_DMA15_PREV_DESC_PTR() bfin_read32(DMA15_PREV_DESC_PTR)
897#define bfin_write_DMA15_PREV_DESC_PTR(val) bfin_write32(DMA15_PREV_DESC_PTR, val)
898#define bfin_read_DMA15_CURR_ADDR() bfin_read32(DMA15_CURR_ADDR)
899#define bfin_write_DMA15_CURR_ADDR(val) bfin_write32(DMA15_CURR_ADDR, val)
900#define bfin_read_DMA15_IRQ_STATUS() bfin_read32(DMA15_IRQ_STATUS)
901#define bfin_write_DMA15_IRQ_STATUS(val) bfin_write32(DMA15_IRQ_STATUS, val)
902#define bfin_read_DMA15_CURR_X_COUNT() bfin_read32(DMA15_CURR_X_COUNT)
903#define bfin_write_DMA15_CURR_X_COUNT(val) bfin_write32(DMA15_CURR_X_COUNT, val)
904#define bfin_read_DMA15_CURR_Y_COUNT() bfin_read32(DMA15_CURR_Y_COUNT)
905#define bfin_write_DMA15_CURR_Y_COUNT(val) bfin_write32(DMA15_CURR_Y_COUNT, val)
906#define bfin_read_DMA15_BWL_COUNT() bfin_read32(DMA15_BWL_COUNT)
907#define bfin_write_DMA15_BWL_COUNT(val) bfin_write32(DMA15_BWL_COUNT, val)
908#define bfin_read_DMA15_CURR_BWL_COUNT() bfin_read32(DMA15_CURR_BWL_COUNT)
909#define bfin_write_DMA15_CURR_BWL_COUNT(val) bfin_write32(DMA15_CURR_BWL_COUNT, val)
910#define bfin_read_DMA15_BWM_COUNT() bfin_read32(DMA15_BWM_COUNT)
911#define bfin_write_DMA15_BWM_COUNT(val) bfin_write32(DMA15_BWM_COUNT, val)
912#define bfin_read_DMA15_CURR_BWM_COUNT() bfin_read32(DMA15_CURR_BWM_COUNT)
913#define bfin_write_DMA15_CURR_BWM_COUNT(val) bfin_write32(DMA15_CURR_BWM_COUNT, val)
914
915/* DMA Channel 16 Registers */
916
917#define bfin_read_DMA16_NEXT_DESC_PTR() bfin_read32(DMA16_NEXT_DESC_PTR)
918#define bfin_write_DMA16_NEXT_DESC_PTR(val) bfin_write32(DMA16_NEXT_DESC_PTR, val)
919#define bfin_read_DMA16_START_ADDR() bfin_read32(DMA16_START_ADDR)
920#define bfin_write_DMA16_START_ADDR(val) bfin_write32(DMA16_START_ADDR, val)
921#define bfin_read_DMA16_CONFIG() bfin_read32(DMA16_CONFIG)
922#define bfin_write_DMA16_CONFIG(val) bfin_write32(DMA16_CONFIG, val)
923#define bfin_read_DMA16_X_COUNT() bfin_read32(DMA16_X_COUNT)
924#define bfin_write_DMA16_X_COUNT(val) bfin_write32(DMA16_X_COUNT, val)
925#define bfin_read_DMA16_X_MODIFY() bfin_read32(DMA16_X_MODIFY)
926#define bfin_write_DMA16_X_MODIFY(val) bfin_write32(DMA16_X_MODIFY, val)
927#define bfin_read_DMA16_Y_COUNT() bfin_read32(DMA16_Y_COUNT)
928#define bfin_write_DMA16_Y_COUNT(val) bfin_write32(DMA16_Y_COUNT, val)
929#define bfin_read_DMA16_Y_MODIFY() bfin_read32(DMA16_Y_MODIFY)
930#define bfin_write_DMA16_Y_MODIFY(val) bfin_write32(DMA16_Y_MODIFY, val)
931#define bfin_read_DMA16_CURR_DESC_PTR() bfin_read32(DMA16_CURR_DESC_PTR)
932#define bfin_write_DMA16_CURR_DESC_PTR(val) bfin_write32(DMA16_CURR_DESC_PTR, val)
933#define bfin_read_DMA16_PREV_DESC_PTR() bfin_read32(DMA16_PREV_DESC_PTR)
934#define bfin_write_DMA16_PREV_DESC_PTR(val) bfin_write32(DMA16_PREV_DESC_PTR, val)
935#define bfin_read_DMA16_CURR_ADDR() bfin_read32(DMA16_CURR_ADDR)
936#define bfin_write_DMA16_CURR_ADDR(val) bfin_write32(DMA16_CURR_ADDR, val)
937#define bfin_read_DMA16_IRQ_STATUS() bfin_read32(DMA16_IRQ_STATUS)
938#define bfin_write_DMA16_IRQ_STATUS(val) bfin_write32(DMA16_IRQ_STATUS, val)
939#define bfin_read_DMA16_CURR_X_COUNT() bfin_read32(DMA16_CURR_X_COUNT)
940#define bfin_write_DMA16_CURR_X_COUNT(val) bfin_write32(DMA16_CURR_X_COUNT, val)
941#define bfin_read_DMA16_CURR_Y_COUNT() bfin_read32(DMA16_CURR_Y_COUNT)
942#define bfin_write_DMA16_CURR_Y_COUNT(val) bfin_write32(DMA16_CURR_Y_COUNT, val)
943#define bfin_read_DMA16_BWL_COUNT() bfin_read32(DMA16_BWL_COUNT)
944#define bfin_write_DMA16_BWL_COUNT(val) bfin_write32(DMA16_BWL_COUNT, val)
945#define bfin_read_DMA16_CURR_BWL_COUNT() bfin_read32(DMA16_CURR_BWL_COUNT)
946#define bfin_write_DMA16_CURR_BWL_COUNT(val) bfin_write32(DMA16_CURR_BWL_COUNT, val)
947#define bfin_read_DMA16_BWM_COUNT() bfin_read32(DMA16_BWM_COUNT)
948#define bfin_write_DMA16_BWM_COUNT(val) bfin_write32(DMA16_BWM_COUNT, val)
949#define bfin_read_DMA16_CURR_BWM_COUNT() bfin_read32(DMA16_CURR_BWM_COUNT)
950#define bfin_write_DMA16_CURR_BWM_COUNT(val) bfin_write32(DMA16_CURR_BWM_COUNT, val)
951
952/* DMA Channel 17 Registers */
953
954#define bfin_read_DMA17_NEXT_DESC_PTR() bfin_read32(DMA17_NEXT_DESC_PTR)
955#define bfin_write_DMA17_NEXT_DESC_PTR(val) bfin_write32(DMA17_NEXT_DESC_PTR, val)
956#define bfin_read_DMA17_START_ADDR() bfin_read32(DMA17_START_ADDR)
957#define bfin_write_DMA17_START_ADDR(val) bfin_write32(DMA17_START_ADDR, val)
958#define bfin_read_DMA17_CONFIG() bfin_read32(DMA17_CONFIG)
959#define bfin_write_DMA17_CONFIG(val) bfin_write32(DMA17_CONFIG, val)
960#define bfin_read_DMA17_X_COUNT() bfin_read32(DMA17_X_COUNT)
961#define bfin_write_DMA17_X_COUNT(val) bfin_write32(DMA17_X_COUNT, val)
962#define bfin_read_DMA17_X_MODIFY() bfin_read32(DMA17_X_MODIFY)
963#define bfin_write_DMA17_X_MODIFY(val) bfin_write32(DMA17_X_MODIFY, val)
964#define bfin_read_DMA17_Y_COUNT() bfin_read32(DMA17_Y_COUNT)
965#define bfin_write_DMA17_Y_COUNT(val) bfin_write32(DMA17_Y_COUNT, val)
966#define bfin_read_DMA17_Y_MODIFY() bfin_read32(DMA17_Y_MODIFY)
967#define bfin_write_DMA17_Y_MODIFY(val) bfin_write32(DMA17_Y_MODIFY, val)
968#define bfin_read_DMA17_CURR_DESC_PTR() bfin_read32(DMA17_CURR_DESC_PTR)
969#define bfin_write_DMA17_CURR_DESC_PTR(val) bfin_write32(DMA17_CURR_DESC_PTR, val)
970#define bfin_read_DMA17_PREV_DESC_PTR() bfin_read32(DMA17_PREV_DESC_PTR)
971#define bfin_write_DMA17_PREV_DESC_PTR(val) bfin_write32(DMA17_PREV_DESC_PTR, val)
972#define bfin_read_DMA17_CURR_ADDR() bfin_read32(DMA17_CURR_ADDR)
973#define bfin_write_DMA17_CURR_ADDR(val) bfin_write32(DMA17_CURR_ADDR, val)
974#define bfin_read_DMA17_IRQ_STATUS() bfin_read32(DMA17_IRQ_STATUS)
975#define bfin_write_DMA17_IRQ_STATUS(val) bfin_write32(DMA17_IRQ_STATUS, val)
976#define bfin_read_DMA17_CURR_X_COUNT() bfin_read32(DMA17_CURR_X_COUNT)
977#define bfin_write_DMA17_CURR_X_COUNT(val) bfin_write32(DMA17_CURR_X_COUNT, val)
978#define bfin_read_DMA17_CURR_Y_COUNT() bfin_read32(DMA17_CURR_Y_COUNT)
979#define bfin_write_DMA17_CURR_Y_COUNT(val) bfin_write32(DMA17_CURR_Y_COUNT, val)
980#define bfin_read_DMA17_BWL_COUNT() bfin_read32(DMA17_BWL_COUNT)
981#define bfin_write_DMA17_BWL_COUNT(val) bfin_write32(DMA17_BWL_COUNT, val)
982#define bfin_read_DMA17_CURR_BWL_COUNT() bfin_read32(DMA17_CURR_BWL_COUNT)
983#define bfin_write_DMA17_CURR_BWL_COUNT(val) bfin_write32(DMA17_CURR_BWL_COUNT, val)
984#define bfin_read_DMA17_BWM_COUNT() bfin_read32(DMA17_BWM_COUNT)
985#define bfin_write_DMA17_BWM_COUNT(val) bfin_write32(DMA17_BWM_COUNT, val)
986#define bfin_read_DMA17_CURR_BWM_COUNT() bfin_read32(DMA17_CURR_BWM_COUNT)
987#define bfin_write_DMA17_CURR_BWM_COUNT(val) bfin_write32(DMA17_CURR_BWM_COUNT, val)
988
989/* DMA Channel 18 Registers */
990
991#define bfin_read_DMA18_NEXT_DESC_PTR() bfin_read32(DMA18_NEXT_DESC_PTR)
992#define bfin_write_DMA18_NEXT_DESC_PTR(val) bfin_write32(DMA18_NEXT_DESC_PTR, val)
993#define bfin_read_DMA18_START_ADDR() bfin_read32(DMA18_START_ADDR)
994#define bfin_write_DMA18_START_ADDR(val) bfin_write32(DMA18_START_ADDR, val)
995#define bfin_read_DMA18_CONFIG() bfin_read32(DMA18_CONFIG)
996#define bfin_write_DMA18_CONFIG(val) bfin_write32(DMA18_CONFIG, val)
997#define bfin_read_DMA18_X_COUNT() bfin_read32(DMA18_X_COUNT)
998#define bfin_write_DMA18_X_COUNT(val) bfin_write32(DMA18_X_COUNT, val)
999#define bfin_read_DMA18_X_MODIFY() bfin_read32(DMA18_X_MODIFY)
1000#define bfin_write_DMA18_X_MODIFY(val) bfin_write32(DMA18_X_MODIFY, val)
1001#define bfin_read_DMA18_Y_COUNT() bfin_read32(DMA18_Y_COUNT)
1002#define bfin_write_DMA18_Y_COUNT(val) bfin_write32(DMA18_Y_COUNT, val)
1003#define bfin_read_DMA18_Y_MODIFY() bfin_read32(DMA18_Y_MODIFY)
1004#define bfin_write_DMA18_Y_MODIFY(val) bfin_write32(DMA18_Y_MODIFY, val)
1005#define bfin_read_DMA18_CURR_DESC_PTR() bfin_read32(DMA18_CURR_DESC_PTR)
1006#define bfin_write_DMA18_CURR_DESC_PTR(val) bfin_write32(DMA18_CURR_DESC_PTR, val)
1007#define bfin_read_DMA18_PREV_DESC_PTR() bfin_read32(DMA18_PREV_DESC_PTR)
1008#define bfin_write_DMA18_PREV_DESC_PTR(val) bfin_write32(DMA18_PREV_DESC_PTR, val)
1009#define bfin_read_DMA18_CURR_ADDR() bfin_read32(DMA18_CURR_ADDR)
1010#define bfin_write_DMA18_CURR_ADDR(val) bfin_write32(DMA18_CURR_ADDR, val)
1011#define bfin_read_DMA18_IRQ_STATUS() bfin_read32(DMA18_IRQ_STATUS)
1012#define bfin_write_DMA18_IRQ_STATUS(val) bfin_write32(DMA18_IRQ_STATUS, val)
1013#define bfin_read_DMA18_CURR_X_COUNT() bfin_read32(DMA18_CURR_X_COUNT)
1014#define bfin_write_DMA18_CURR_X_COUNT(val) bfin_write32(DMA18_CURR_X_COUNT, val)
1015#define bfin_read_DMA18_CURR_Y_COUNT() bfin_read32(DMA18_CURR_Y_COUNT)
1016#define bfin_write_DMA18_CURR_Y_COUNT(val) bfin_write32(DMA18_CURR_Y_COUNT, val)
1017#define bfin_read_DMA18_BWL_COUNT() bfin_read32(DMA18_BWL_COUNT)
1018#define bfin_write_DMA18_BWL_COUNT(val) bfin_write32(DMA18_BWL_COUNT, val)
1019#define bfin_read_DMA18_CURR_BWL_COUNT() bfin_read32(DMA18_CURR_BWL_COUNT)
1020#define bfin_write_DMA18_CURR_BWL_COUNT(val) bfin_write32(DMA18_CURR_BWL_COUNT, val)
1021#define bfin_read_DMA18_BWM_COUNT() bfin_read32(DMA18_BWM_COUNT)
1022#define bfin_write_DMA18_BWM_COUNT(val) bfin_write32(DMA18_BWM_COUNT, val)
1023#define bfin_read_DMA18_CURR_BWM_COUNT() bfin_read32(DMA18_CURR_BWM_COUNT)
1024#define bfin_write_DMA18_CURR_BWM_COUNT(val) bfin_write32(DMA18_CURR_BWM_COUNT, val)
1025
1026/* DMA Channel 19 Registers */
1027
1028#define bfin_read_DMA19_NEXT_DESC_PTR() bfin_read32(DMA19_NEXT_DESC_PTR)
1029#define bfin_write_DMA19_NEXT_DESC_PTR(val) bfin_write32(DMA19_NEXT_DESC_PTR, val)
1030#define bfin_read_DMA19_START_ADDR() bfin_read32(DMA19_START_ADDR)
1031#define bfin_write_DMA19_START_ADDR(val) bfin_write32(DMA19_START_ADDR, val)
1032#define bfin_read_DMA19_CONFIG() bfin_read32(DMA19_CONFIG)
1033#define bfin_write_DMA19_CONFIG(val) bfin_write32(DMA19_CONFIG, val)
1034#define bfin_read_DMA19_X_COUNT() bfin_read32(DMA19_X_COUNT)
1035#define bfin_write_DMA19_X_COUNT(val) bfin_write32(DMA19_X_COUNT, val)
1036#define bfin_read_DMA19_X_MODIFY() bfin_read32(DMA19_X_MODIFY)
1037#define bfin_write_DMA19_X_MODIFY(val) bfin_write32(DMA19_X_MODIFY, val)
1038#define bfin_read_DMA19_Y_COUNT() bfin_read32(DMA19_Y_COUNT)
1039#define bfin_write_DMA19_Y_COUNT(val) bfin_write32(DMA19_Y_COUNT, val)
1040#define bfin_read_DMA19_Y_MODIFY() bfin_read32(DMA19_Y_MODIFY)
1041#define bfin_write_DMA19_Y_MODIFY(val) bfin_write32(DMA19_Y_MODIFY, val)
1042#define bfin_read_DMA19_CURR_DESC_PTR() bfin_read32(DMA19_CURR_DESC_PTR)
1043#define bfin_write_DMA19_CURR_DESC_PTR(val) bfin_write32(DMA19_CURR_DESC_PTR, val)
1044#define bfin_read_DMA19_PREV_DESC_PTR() bfin_read32(DMA19_PREV_DESC_PTR)
1045#define bfin_write_DMA19_PREV_DESC_PTR(val) bfin_write32(DMA19_PREV_DESC_PTR, val)
1046#define bfin_read_DMA19_CURR_ADDR() bfin_read32(DMA19_CURR_ADDR)
1047#define bfin_write_DMA19_CURR_ADDR(val) bfin_write32(DMA19_CURR_ADDR, val)
1048#define bfin_read_DMA19_IRQ_STATUS() bfin_read32(DMA19_IRQ_STATUS)
1049#define bfin_write_DMA19_IRQ_STATUS(val) bfin_write32(DMA19_IRQ_STATUS, val)
1050#define bfin_read_DMA19_CURR_X_COUNT() bfin_read32(DMA19_CURR_X_COUNT)
1051#define bfin_write_DMA19_CURR_X_COUNT(val) bfin_write32(DMA19_CURR_X_COUNT, val)
1052#define bfin_read_DMA19_CURR_Y_COUNT() bfin_read32(DMA19_CURR_Y_COUNT)
1053#define bfin_write_DMA19_CURR_Y_COUNT(val) bfin_write32(DMA19_CURR_Y_COUNT, val)
1054#define bfin_read_DMA19_BWL_COUNT() bfin_read32(DMA19_BWL_COUNT)
1055#define bfin_write_DMA19_BWL_COUNT(val) bfin_write32(DMA19_BWL_COUNT, val)
1056#define bfin_read_DMA19_CURR_BWL_COUNT() bfin_read32(DMA19_CURR_BWL_COUNT)
1057#define bfin_write_DMA19_CURR_BWL_COUNT(val) bfin_write32(DMA19_CURR_BWL_COUNT, val)
1058#define bfin_read_DMA19_BWM_COUNT() bfin_read32(DMA19_BWM_COUNT)
1059#define bfin_write_DMA19_BWM_COUNT(val) bfin_write32(DMA19_BWM_COUNT, val)
1060#define bfin_read_DMA19_CURR_BWM_COUNT() bfin_read32(DMA19_CURR_BWM_COUNT)
1061#define bfin_write_DMA19_CURR_BWM_COUNT(val) bfin_write32(DMA19_CURR_BWM_COUNT, val)
1062
1063/* DMA Channel 20 Registers */
1064
1065#define bfin_read_DMA20_NEXT_DESC_PTR() bfin_read32(DMA20_NEXT_DESC_PTR)
1066#define bfin_write_DMA20_NEXT_DESC_PTR(val) bfin_write32(DMA20_NEXT_DESC_PTR, val)
1067#define bfin_read_DMA20_START_ADDR() bfin_read32(DMA20_START_ADDR)
1068#define bfin_write_DMA20_START_ADDR(val) bfin_write32(DMA20_START_ADDR, val)
1069#define bfin_read_DMA20_CONFIG() bfin_read32(DMA20_CONFIG)
1070#define bfin_write_DMA20_CONFIG(val) bfin_write32(DMA20_CONFIG, val)
1071#define bfin_read_DMA20_X_COUNT() bfin_read32(DMA20_X_COUNT)
1072#define bfin_write_DMA20_X_COUNT(val) bfin_write32(DMA20_X_COUNT, val)
1073#define bfin_read_DMA20_X_MODIFY() bfin_read32(DMA20_X_MODIFY)
1074#define bfin_write_DMA20_X_MODIFY(val) bfin_write32(DMA20_X_MODIFY, val)
1075#define bfin_read_DMA20_Y_COUNT() bfin_read32(DMA20_Y_COUNT)
1076#define bfin_write_DMA20_Y_COUNT(val) bfin_write32(DMA20_Y_COUNT, val)
1077#define bfin_read_DMA20_Y_MODIFY() bfin_read32(DMA20_Y_MODIFY)
1078#define bfin_write_DMA20_Y_MODIFY(val) bfin_write32(DMA20_Y_MODIFY, val)
1079#define bfin_read_DMA20_CURR_DESC_PTR() bfin_read32(DMA20_CURR_DESC_PTR)
1080#define bfin_write_DMA20_CURR_DESC_PTR(val) bfin_write32(DMA20_CURR_DESC_PTR, val)
1081#define bfin_read_DMA20_PREV_DESC_PTR() bfin_read32(DMA20_PREV_DESC_PTR)
1082#define bfin_write_DMA20_PREV_DESC_PTR(val) bfin_write32(DMA20_PREV_DESC_PTR, val)
1083#define bfin_read_DMA20_CURR_ADDR() bfin_read32(DMA20_CURR_ADDR)
1084#define bfin_write_DMA20_CURR_ADDR(val) bfin_write32(DMA20_CURR_ADDR, val)
1085#define bfin_read_DMA20_IRQ_STATUS() bfin_read32(DMA20_IRQ_STATUS)
1086#define bfin_write_DMA20_IRQ_STATUS(val) bfin_write32(DMA20_IRQ_STATUS, val)
1087#define bfin_read_DMA20_CURR_X_COUNT() bfin_read32(DMA20_CURR_X_COUNT)
1088#define bfin_write_DMA20_CURR_X_COUNT(val) bfin_write32(DMA20_CURR_X_COUNT, val)
1089#define bfin_read_DMA20_CURR_Y_COUNT() bfin_read32(DMA20_CURR_Y_COUNT)
1090#define bfin_write_DMA20_CURR_Y_COUNT(val) bfin_write32(DMA20_CURR_Y_COUNT, val)
1091#define bfin_read_DMA20_BWL_COUNT() bfin_read32(DMA20_BWL_COUNT)
1092#define bfin_write_DMA20_BWL_COUNT(val) bfin_write32(DMA20_BWL_COUNT, val)
1093#define bfin_read_DMA20_CURR_BWL_COUNT() bfin_read32(DMA20_CURR_BWL_COUNT)
1094#define bfin_write_DMA20_CURR_BWL_COUNT(val) bfin_write32(DMA20_CURR_BWL_COUNT, val)
1095#define bfin_read_DMA20_BWM_COUNT() bfin_read32(DMA20_BWM_COUNT)
1096#define bfin_write_DMA20_BWM_COUNT(val) bfin_write32(DMA20_BWM_COUNT, val)
1097#define bfin_read_DMA20_CURR_BWM_COUNT() bfin_read32(DMA20_CURR_BWM_COUNT)
1098#define bfin_write_DMA20_CURR_BWM_COUNT(val) bfin_write32(DMA20_CURR_BWM_COUNT, val)
1099
1100
1101/* MDMA Stream 0 Registers (DMA Channel 21 and 22) */
1102
1103#define bfin_read_MDMA0_DEST_CRC0_NEXT_DESC_PTR() bfin_read32(MDMA0_DEST_CRC0_NEXT_DESC_PTR)
1104#define bfin_write_MDMA0_DEST_CRC0_NEXT_DESC_PTR(val) bfin_write32(MDMA0_DEST_CRC0_NEXT_DESC_PTR, val)
1105#define bfin_read_MDMA0_DEST_CRC0_START_ADDR() bfin_read32(MDMA0_DEST_CRC0_START_ADDR)
1106#define bfin_write_MDMA0_DEST_CRC0_START_ADDR(val) bfin_write32(MDMA0_DEST_CRC0_START_ADDR, val)
1107#define bfin_read_MDMA0_DEST_CRC0_CONFIG() bfin_read32(MDMA0_DEST_CRC0_CONFIG)
1108#define bfin_write_MDMA0_DEST_CRC0_CONFIG(val) bfin_write32(MDMA0_DEST_CRC0_CONFIG, val)
1109#define bfin_read_MDMA0_DEST_CRC0_X_COUNT() bfin_read32(MDMA0_DEST_CRC0_X_COUNT)
1110#define bfin_write_MDMA0_DEST_CRC0_X_COUNT(val) bfin_write32(MDMA0_DEST_CRC0_X_COUNT, val)
1111#define bfin_read_MDMA0_DEST_CRC0_X_MODIFY() bfin_read32(MDMA0_DEST_CRC0_X_MODIFY)
1112#define bfin_write_MDMA0_DEST_CRC0_X_MODIFY(val) bfin_write32(MDMA0_DEST_CRC0_X_MODIFY, val)
1113#define bfin_read_MDMA0_DEST_CRC0_Y_COUNT() bfin_read32(MDMA0_DEST_CRC0_Y_COUNT)
1114#define bfin_write_MDMA0_DEST_CRC0_Y_COUNT(val) bfin_write32(MDMA0_DEST_CRC0_Y_COUNT, val)
1115#define bfin_read_MDMA0_DEST_CRC0_Y_MODIFY() bfin_read32(MDMA0_DEST_CRC0_Y_MODIFY)
1116#define bfin_write_MDMA0_DEST_CRC0_Y_MODIFY(val) bfin_write32(MDMA0_DEST_CRC0_Y_MODIFY, val)
1117#define bfin_read_MDMA0_DEST_CRC0_CURR_DESC_PTR() bfin_read32(MDMA0_DEST_CRC0_CURR_DESC_PTR)
1118#define bfin_write_MDMA0_DEST_CRC0_CURR_DESC_PTR(val) bfin_write32(MDMA0_DEST_CRC0_CURR_DESC_PTR, val)
1119#define bfin_read_MDMA0_DEST_CRC0_PREV_DESC_PTR() bfin_read32(MDMA0_DEST_CRC0_PREV_DESC_PTR)
1120#define bfin_write_MDMA0_DEST_CRC0_PREV_DESC_PTR(val) bfin_write32(MDMA0_DEST_CRC0_PREV_DESC_PTR, val)
1121#define bfin_read_MDMA0_DEST_CRC0_CURR_ADDR() bfin_read32(MDMA0_DEST_CRC0_CURR_ADDR)
1122#define bfin_write_MDMA0_DEST_CRC0_CURR_ADDR(val) bfin_write32(MDMA0_DEST_CRC0_CURR_ADDR, val)
1123#define bfin_read_MDMA0_DEST_CRC0_IRQ_STATUS() bfin_read32(MDMA0_DEST_CRC0_IRQ_STATUS)
1124#define bfin_write_MDMA0_DEST_CRC0_IRQ_STATUS(val) bfin_write32(MDMA0_DEST_CRC0_IRQ_STATUS, val)
1125#define bfin_read_MDMA0_DEST_CRC0_CURR_X_COUNT() bfin_read32(MDMA0_DEST_CRC0_CURR_X_COUNT)
1126#define bfin_write_MDMA0_DEST_CRC0_CURR_X_COUNT(val) bfin_write32(MDMA0_DEST_CRC0_CURR_X_COUNT, val)
1127#define bfin_read_MDMA0_DEST_CRC0_CURR_Y_COUNT() bfin_read32(MDMA0_DEST_CRC0_CURR_Y_COUNT)
1128#define bfin_write_MDMA0_DEST_CRC0_CURR_Y_COUNT(val) bfin_write32(MDMA0_DEST_CRC0_CURR_Y_COUNT, val)
1129#define bfin_read_MDMA0_SRC_CRC0_NEXT_DESC_PTR() bfin_read32(MDMA0_SRC_CRC0_NEXT_DESC_PTR)
1130#define bfin_write_MDMA0_SRC_CRC0_NEXT_DESC_PTR(val) bfin_write32(MDMA0_SRC_CRC0_NEXT_DESC_PTR, val)
1131#define bfin_read_MDMA0_SRC_CRC0_START_ADDR() bfin_read32(MDMA0_SRC_CRC0_START_ADDR)
1132#define bfin_write_MDMA0_SRC_CRC0_START_ADDR(val) bfin_write32(MDMA0_SRC_CRC0_START_ADDR, val)
1133#define bfin_read_MDMA0_SRC_CRC0_CONFIG() bfin_read32(MDMA0_SRC_CRC0_CONFIG)
1134#define bfin_write_MDMA0_SRC_CRC0_CONFIG(val) bfin_write32(MDMA0_SRC_CRC0_CONFIG, val)
1135#define bfin_read_MDMA0_SRC_CRC0_X_COUNT() bfin_read32(MDMA0_SRC_CRC0_X_COUNT)
1136#define bfin_write_MDMA0_SRC_CRC0_X_COUNT(val) bfin_write32(MDMA0_SRC_CRC0_X_COUNT, val)
1137#define bfin_read_MDMA0_SRC_CRC0_X_MODIFY() bfin_read32(MDMA0_SRC_CRC0_X_MODIFY)
1138#define bfin_write_MDMA0_SRC_CRC0_X_MODIFY(val) bfin_write32(MDMA0_SRC_CRC0_X_MODIFY, val)
1139#define bfin_read_MDMA0_SRC_CRC0_Y_COUNT() bfin_read32(MDMA0_SRC_CRC0_Y_COUNT)
1140#define bfin_write_MDMA0_SRC_CRC0_Y_COUNT(val) bfin_write32(MDMA0_SRC_CRC0_Y_COUNT, val)
1141#define bfin_read_MDMA0_SRC_CRC0_Y_MODIFY() bfin_read32(MDMA0_SRC_CRC0_Y_MODIFY)
1142#define bfin_write_MDMA0_SRC_CRC0_Y_MODIFY(val) bfin_write32(MDMA0_SRC_CRC0_Y_MODIFY, val)
1143#define bfin_read_MDMA0_SRC_CRC0_CURR_DESC_PTR() bfin_read32(MDMA0_SRC_CRC0_CURR_DESC_PTR)
1144#define bfin_write_MDMA0_SRC_CRC0_CURR_DESC_PTR(val) bfin_write32(MDMA0_SRC_CRC0_CURR_DESC_PTR, val)
1145#define bfin_read_MDMA0_SRC_CRC0_PREV_DESC_PTR() bfin_read32(MDMA0_SRC_CRC0_PREV_DESC_PTR)
1146#define bfin_write_MDMA0_SRC_CRC0_PREV_DESC_PTR(val) bfin_write32(MDMA0_SRC_CRC0_PREV_DESC_PTR, val)
1147#define bfin_read_MDMA0_SRC_CRC0_CURR_ADDR() bfin_read32(MDMA0_SRC_CRC0_CURR_ADDR)
1148#define bfin_write_MDMA0_SRC_CRC0_CURR_ADDR(val) bfin_write32(MDMA0_SRC_CRC0_CURR_ADDR, val)
1149#define bfin_read_MDMA0_SRC_CRC0_IRQ_STATUS() bfin_read32(MDMA0_SRC_CRC0_IRQ_STATUS)
1150#define bfin_write_MDMA0_SRC_CRC0_IRQ_STATUS(val) bfin_write32(MDMA0_SRC_CRC0_IRQ_STATUS, val)
1151#define bfin_read_MDMA0_SRC_CRC0_CURR_X_COUNT() bfin_read32(MDMA0_SRC_CRC0_CURR_X_COUNT)
1152#define bfin_write_MDMA0_SRC_CRC0_CURR_X_COUNT(val) bfin_write32(MDMA0_SRC_CRC0_CURR_X_COUNT, val)
1153#define bfin_read_MDMA0_SRC_CRC0_CURR_Y_COUNT() bfin_read32(MDMA0_SRC_CRC0_CURR_Y_COUNT)
1154#define bfin_write_MDMA0_SRC_CRC0_CURR_Y_COUNT(val) bfin_write32(MDMA0_SRC_CRC0_CURR_Y_COUNT, val)
1155
1156/* MDMA Stream 1 Registers (DMA Channel 23 and 24) */
1157
1158#define bfin_read_MDMA1_DEST_CRC1_NEXT_DESC_PTR() bfin_read32(MDMA1_DEST_CRC1_NEXT_DESC_PTR)
1159#define bfin_write_MDMA1_DEST_CRC1_NEXT_DESC_PTR(val) bfin_write32(MDMA1_DEST_CRC1_NEXT_DESC_PTR, val)
1160#define bfin_read_MDMA1_DEST_CRC1_START_ADDR() bfin_read32(MDMA1_DEST_CRC1_START_ADDR)
1161#define bfin_write_MDMA1_DEST_CRC1_START_ADDR(val) bfin_write32(MDMA1_DEST_CRC1_START_ADDR, val)
1162#define bfin_read_MDMA1_DEST_CRC1_CONFIG() bfin_read32(MDMA1_DEST_CRC1_CONFIG)
1163#define bfin_write_MDMA1_DEST_CRC1_CONFIG(val) bfin_write32(MDMA1_DEST_CRC1_CONFIG, val)
1164#define bfin_read_MDMA1_DEST_CRC1_X_COUNT() bfin_read32(MDMA1_DEST_CRC1_X_COUNT)
1165#define bfin_write_MDMA1_DEST_CRC1_X_COUNT(val) bfin_write32(MDMA1_DEST_CRC1_X_COUNT, val)
1166#define bfin_read_MDMA1_DEST_CRC1_X_MODIFY() bfin_read32(MDMA1_DEST_CRC1_X_MODIFY)
1167#define bfin_write_MDMA1_DEST_CRC1_X_MODIFY(val) bfin_write32(MDMA1_DEST_CRC1_X_MODIFY, val)
1168#define bfin_read_MDMA1_DEST_CRC1_Y_COUNT() bfin_read32(MDMA1_DEST_CRC1_Y_COUNT)
1169#define bfin_write_MDMA1_DEST_CRC1_Y_COUNT(val) bfin_write32(MDMA1_DEST_CRC1_Y_COUNT, val)
1170#define bfin_read_MDMA1_DEST_CRC1_Y_MODIFY() bfin_read32(MDMA1_DEST_CRC1_Y_MODIFY)
1171#define bfin_write_MDMA1_DEST_CRC1_Y_MODIFY(val) bfin_write32(MDMA1_DEST_CRC1_Y_MODIFY, val)
1172#define bfin_read_MDMA1_DEST_CRC1_CURR_DESC_PTR() bfin_read32(MDMA1_DEST_CRC1_CURR_DESC_PTR)
1173#define bfin_write_MDMA1_DEST_CRC1_CURR_DESC_PTR(val) bfin_write32(MDMA1_DEST_CRC1_CURR_DESC_PTR, val)
1174#define bfin_read_MDMA1_DEST_CRC1_PREV_DESC_PTR() bfin_read32(MDMA1_DEST_CRC1_PREV_DESC_PTR)
1175#define bfin_write_MDMA1_DEST_CRC1_PREV_DESC_PTR(val) bfin_write32(MDMA1_DEST_CRC1_PREV_DESC_PTR, val)
1176#define bfin_read_MDMA1_DEST_CRC1_CURR_ADDR() bfin_read32(MDMA1_DEST_CRC1_CURR_ADDR)
1177#define bfin_write_MDMA1_DEST_CRC1_CURR_ADDR(val) bfin_write32(MDMA1_DEST_CRC1_CURR_ADDR, val)
1178#define bfin_read_MDMA1_DEST_CRC1_IRQ_STATUS() bfin_read32(MDMA1_DEST_CRC1_IRQ_STATUS)
1179#define bfin_write_MDMA1_DEST_CRC1_IRQ_STATUS(val) bfin_write32(MDMA1_DEST_CRC1_IRQ_STATUS, val)
1180#define bfin_read_MDMA1_DEST_CRC1_CURR_X_COUNT() bfin_read32(MDMA1_DEST_CRC1_CURR_X_COUNT)
1181#define bfin_write_MDMA1_DEST_CRC1_CURR_X_COUNT(val) bfin_write32(MDMA1_DEST_CRC1_CURR_X_COUNT, val)
1182#define bfin_read_MDMA1_DEST_CRC1_CURR_Y_COUNT() bfin_read32(MDMA1_DEST_CRC1_CURR_Y_COUNT)
1183#define bfin_write_MDMA1_DEST_CRC1_CURR_Y_COUNT(val) bfin_write32(MDMA1_DEST_CRC1_CURR_Y_COUNT, val)
1184#define bfin_read_MDMA1_SRC_CRC1_NEXT_DESC_PTR() bfin_read32(MDMA1_SRC_CRC1_NEXT_DESC_PTR)
1185#define bfin_write_MDMA1_SRC_CRC1_NEXT_DESC_PTR(val) bfin_write32(MDMA1_SRC_CRC1_NEXT_DESC_PTR, val)
1186#define bfin_read_MDMA1_SRC_CRC1_START_ADDR() bfin_read32(MDMA1_SRC_CRC1_START_ADDR)
1187#define bfin_write_MDMA1_SRC_CRC1_START_ADDR(val) bfin_write32(MDMA1_SRC_CRC1_START_ADDR, val)
1188#define bfin_read_MDMA1_SRC_CRC1_CONFIG() bfin_read32(MDMA1_SRC_CRC1_CONFIG)
1189#define bfin_write_MDMA1_SRC_CRC1_CONFIG(val) bfin_write32(MDMA1_SRC_CRC1_CONFIG, val)
1190#define bfin_read_MDMA1_SRC_CRC1_X_COUNT() bfin_read32(MDMA1_SRC_CRC1_X_COUNT)
1191#define bfin_write_MDMA1_SRC_CRC1_X_COUNT(val) bfin_write32(MDMA1_SRC_CRC1_X_COUNT, val)
1192#define bfin_read_MDMA1_SRC_CRC1_X_MODIFY() bfin_read32(MDMA1_SRC_CRC1_X_MODIFY)
1193#define bfin_write_MDMA1_SRC_CRC1_X_MODIFY(val) bfin_write32(MDMA1_SRC_CRC1_X_MODIFY, val)
1194#define bfin_read_MDMA1_SRC_CRC1_Y_COUNT() bfin_read32(MDMA1_SRC_CRC1_Y_COUNT)
1195#define bfin_write_MDMA1_SRC_CRC1_Y_COUNT(val) bfin_write32(MDMA1_SRC_CRC1_Y_COUNT, val)
1196#define bfin_read_MDMA1_SRC_CRC1_Y_MODIFY() bfin_read32(MDMA1_SRC_CRC1_Y_MODIFY)
1197#define bfin_write_MDMA1_SRC_CRC1_Y_MODIFY(val) bfin_write32(MDMA1_SRC_CRC1_Y_MODIFY, val)
1198#define bfin_read_MDMA1_SRC_CRC1_CURR_DESC_PTR() bfin_read32(MDMA1_SRC_CRC1_CURR_DESC_PTR)
1199#define bfin_write_MDMA1_SRC_CRC1_CURR_DESC_PTR(val) bfin_write32(MDMA1_SRC_CRC1_CURR_DESC_PTR, val)
1200#define bfin_read_MDMA1_SRC_CRC1_PREV_DESC_PTR() bfin_read32(MDMA1_SRC_CRC1_PREV_DESC_PTR)
1201#define bfin_write_MDMA1_SRC_CRC1_PREV_DESC_PTR(val) bfin_write32(MDMA1_SRC_CRC1_PREV_DESC_PTR, val)
1202#define bfin_read_MDMA1_SRC_CRC1_CURR_ADDR() bfin_read32(MDMA1_SRC_CRC1_CURR_ADDR)
1203#define bfin_write_MDMA1_SRC_CRC1_CURR_ADDR(val) bfin_write32(MDMA1_SRC_CRC1_CURR_ADDR, val)
1204#define bfin_read_MDMA1_SRC_CRC1_IRQ_STATUS() bfin_read32(MDMA1_SRC_CRC1_IRQ_STATUS)
1205#define bfin_write_MDMA1_SRC_CRC1_IRQ_STATUS(val) bfin_write32(MDMA1_SRC_CRC1_IRQ_STATUS, val)
1206#define bfin_read_MDMA1_SRC_CRC1_CURR_X_COUNT() bfin_read32(MDMA1_SRC_CRC1_CURR_X_COUNT)
1207#define bfin_write_MDMA1_SRC_CRC1_CURR_X_COUNT(val) bfin_write32(MDMA1_SRC_CRC1_CURR_X_COUNT, val)
1208#define bfin_read_MDMA1_SRC_CRC1_CURR_Y_COUNT() bfin_read32(MDMA1_SRC_CRC1_CURR_Y_COUNT)
1209#define bfin_write_MDMA1_SRC_CRC1_CURR_Y_COUNT(val) bfin_write32(MDMA1_SRC_CRC1_CURR_Y_COUNT, val)
1210
1211
1212/* MDMA Stream 2 Registers (DMA Channel 25 and 26) */
1213
1214#define bfin_read_MDMA2_DEST_NEXT_DESC_PTR() bfin_read32(MDMA2_DEST_NEXT_DESC_PTR)
1215#define bfin_write_MDMA2_DEST_NEXT_DESC_PTR(val) bfin_write32(MDMA2_DEST_NEXT_DESC_PTR, val)
1216#define bfin_read_MDMA2_DEST_START_ADDR() bfin_read32(MDMA2_DEST_START_ADDR)
1217#define bfin_write_MDMA2_DEST_START_ADDR(val) bfin_write32(MDMA2_DEST_START_ADDR, val)
1218#define bfin_read_MDMA2_DEST_CONFIG() bfin_read32(MDMA2_DEST_CONFIG)
1219#define bfin_write_MDMA2_DEST_CONFIG(val) bfin_write32(MDMA2_DEST_CONFIG, val)
1220#define bfin_read_MDMA2_DEST_X_COUNT() bfin_read32(MDMA2_DEST_X_COUNT)
1221#define bfin_write_MDMA2_DEST_X_COUNT(val) bfin_write32(MDMA2_DEST_X_COUNT, val)
1222#define bfin_read_MDMA2_DEST_X_MODIFY() bfin_read32(MDMA2_DEST_X_MODIFY)
1223#define bfin_write_MDMA2_DEST_X_MODIFY(val) bfin_write32(MDMA2_DEST_X_MODIFY, val)
1224#define bfin_read_MDMA2_DEST_Y_COUNT() bfin_read32(MDMA2_DEST_Y_COUNT)
1225#define bfin_write_MDMA2_DEST_Y_COUNT(val) bfin_write32(MDMA2_DEST_Y_COUNT, val)
1226#define bfin_read_MDMA2_DEST_Y_MODIFY() bfin_read32(MDMA2_DEST_Y_MODIFY)
1227#define bfin_write_MDMA2_DEST_Y_MODIFY(val) bfin_write32(MDMA2_DEST_Y_MODIFY, val)
1228#define bfin_read_MDMA2_DEST_CURR_DESC_PTR() bfin_read32(MDMA2_DEST_CURR_DESC_PTR)
1229#define bfin_write_MDMA2_DEST_CURR_DESC_PTR(val) bfin_write32(MDMA2_DEST_CURR_DESC_PTR, val)
1230#define bfin_read_MDMA2_DEST_PREV_DESC_PTR() bfin_read32(MDMA2_DEST_PREV_DESC_PTR)
1231#define bfin_write_MDMA2_DEST_PREV_DESC_PTR(val) bfin_write32(MDMA2_DEST_PREV_DESC_PTR, val)
1232#define bfin_read_MDMA2_DEST_CURR_ADDR() bfin_read32(MDMA2_DEST_CURR_ADDR)
1233#define bfin_write_MDMA2_DEST_CURR_ADDR(val) bfin_write32(MDMA2_DEST_CURR_ADDR, val)
1234#define bfin_read_MDMA2_DEST_IRQ_STATUS() bfin_read32(MDMA2_DEST_IRQ_STATUS)
1235#define bfin_write_MDMA2_DEST_IRQ_STATUS(val) bfin_write32(MDMA2_DEST_IRQ_STATUS, val)
1236#define bfin_read_MDMA2_DEST_CURR_X_COUNT() bfin_read32(MDMA2_DEST_CURR_X_COUNT)
1237#define bfin_write_MDMA2_DEST_CURR_X_COUNT(val) bfin_write32(MDMA2_DEST_CURR_X_COUNT, val)
1238#define bfin_read_MDMA2_DEST_CURR_Y_COUNT() bfin_read32(MDMA2_DEST_CURR_Y_COUNT)
1239#define bfin_write_MDMA2_DEST_CURR_Y_COUNT(val) bfin_write32(MDMA2_DEST_CURR_Y_COUNT, val)
1240#define bfin_read_MDMA2_SRC_NEXT_DESC_PTR() bfin_read32(MDMA2_SRC_NEXT_DESC_PTR)
1241#define bfin_write_MDMA2_SRC_NEXT_DESC_PTR(val) bfin_write32(MDMA2_SRC_NEXT_DESC_PTR, val)
1242#define bfin_read_MDMA2_SRC_START_ADDR() bfin_read32(MDMA2_SRC_START_ADDR)
1243#define bfin_write_MDMA2_SRC_START_ADDR(val) bfin_write32(MDMA2_SRC_START_ADDR, val)
1244#define bfin_read_MDMA2_SRC_CONFIG() bfin_read32(MDMA2_SRC_CONFIG)
1245#define bfin_write_MDMA2_SRC_CONFIG(val) bfin_write32(MDMA2_SRC_CONFIG, val)
1246#define bfin_read_MDMA2_SRC_X_COUNT() bfin_read32(MDMA2_SRC_X_COUNT)
1247#define bfin_write_MDMA2_SRC_X_COUNT(val) bfin_write32(MDMA2_SRC_X_COUNT, val)
1248#define bfin_read_MDMA2_SRC_X_MODIFY() bfin_read32(MDMA2_SRC_X_MODIFY)
1249#define bfin_write_MDMA2_SRC_X_MODIFY(val) bfin_write32(MDMA2_SRC_X_MODIFY, val)
1250#define bfin_read_MDMA2_SRC_Y_COUNT() bfin_read32(MDMA2_SRC_Y_COUNT)
1251#define bfin_write_MDMA2_SRC_Y_COUNT(val) bfin_write32(MDMA2_SRC_Y_COUNT, val)
1252#define bfin_read_MDMA2_SRC_Y_MODIFY() bfin_read32(MDMA2_SRC_Y_MODIFY)
1253#define bfin_write_MDMA2_SRC_Y_MODIFY(val) bfin_write32(MDMA2_SRC_Y_MODIFY, val)
1254#define bfin_read_MDMA2_SRC_CURR_DESC_PTR() bfin_read32(MDMA2_SRC_CURR_DESC_PTR)
1255#define bfin_write_MDMA2_SRC_CURR_DESC_PTR(val) bfin_write32(MDMA2_SRC_CURR_DESC_PTR, val)
1256#define bfin_read_MDMA2_SRC_PREV_DESC_PTR() bfin_read32(MDMA2_SRC_PREV_DESC_PTR)
1257#define bfin_write_MDMA2_SRC_PREV_DESC_PTR(val) bfin_write32(MDMA2_SRC_PREV_DESC_PTR, val)
1258#define bfin_read_MDMA2_SRC_CURR_ADDR() bfin_read32(MDMA2_SRC_CURR_ADDR)
1259#define bfin_write_MDMA2_SRC_CURR_ADDR(val) bfin_write32(MDMA2_SRC_CURR_ADDR, val)
1260#define bfin_read_MDMA2_SRC_IRQ_STATUS() bfin_read32(MDMA2_SRC_IRQ_STATUS)
1261#define bfin_write_MDMA2_SRC_IRQ_STATUS(val) bfin_write32(MDMA2_SRC_IRQ_STATUS, val)
1262#define bfin_read_MDMA2_SRC_CURR_X_COUNT() bfin_read32(MDMA2_SRC_CURR_X_COUNT)
1263#define bfin_write_MDMA2_SRC_CURR_X_COUNT(val) bfin_write32(MDMA2_SRC_CURR_X_COUNT, val)
1264#define bfin_read_MDMA2_SRC_CURR_Y_COUNT() bfin_read32(MDMA2_SRC_CURR_Y_COUNT)
1265#define bfin_write_MDMA2_SRC_CURR_Y_COUNT(val) bfin_write32(MDMA2_SRC_CURR_Y_COUNT, val)
1266
1267/* MDMA Stream 3 Registers (DMA Channel 27 and 28) */
1268
1269#define bfin_read_MDMA3_DEST_NEXT_DESC_PTR() bfin_read32(MDMA3_DEST_NEXT_DESC_PTR)
1270#define bfin_write_MDMA3_DEST_NEXT_DESC_PTR(val) bfin_write32(MDMA3_DEST_NEXT_DESC_PTR, val)
1271#define bfin_read_MDMA3_DEST_START_ADDR() bfin_read32(MDMA3_DEST_START_ADDR)
1272#define bfin_write_MDMA3_DEST_START_ADDR(val) bfin_write32(MDMA3_DEST_START_ADDR, val)
1273#define bfin_read_MDMA3_DEST_CONFIG() bfin_read32(MDMA3_DEST_CONFIG)
1274#define bfin_write_MDMA3_DEST_CONFIG(val) bfin_write32(MDMA3_DEST_CONFIG, val)
1275#define bfin_read_MDMA3_DEST_X_COUNT() bfin_read32(MDMA3_DEST_X_COUNT)
1276#define bfin_write_MDMA3_DEST_X_COUNT(val) bfin_write32(MDMA3_DEST_X_COUNT, val)
1277#define bfin_read_MDMA3_DEST_X_MODIFY() bfin_read32(MDMA3_DEST_X_MODIFY)
1278#define bfin_write_MDMA3_DEST_X_MODIFY(val) bfin_write32(MDMA3_DEST_X_MODIFY, val)
1279#define bfin_read_MDMA3_DEST_Y_COUNT() bfin_read32(MDMA3_DEST_Y_COUNT)
1280#define bfin_write_MDMA3_DEST_Y_COUNT(val) bfin_write32(MDMA3_DEST_Y_COUNT, val)
1281#define bfin_read_MDMA3_DEST_Y_MODIFY() bfin_read32(MDMA3_DEST_Y_MODIFY)
1282#define bfin_write_MDMA3_DEST_Y_MODIFY(val) bfin_write32(MDMA3_DEST_Y_MODIFY, val)
1283#define bfin_read_MDMA3_DEST_CURR_DESC_PTR() bfin_read32(MDMA3_DEST_CURR_DESC_PTR)
1284#define bfin_write_MDMA3_DEST_CURR_DESC_PTR(val) bfin_write32(MDMA3_DEST_CURR_DESC_PTR, val)
1285#define bfin_read_MDMA3_DEST_PREV_DESC_PTR() bfin_read32(MDMA3_DEST_PREV_DESC_PTR)
1286#define bfin_write_MDMA3_DEST_PREV_DESC_PTR(val) bfin_write32(MDMA3_DEST_PREV_DESC_PTR, val)
1287#define bfin_read_MDMA3_DEST_CURR_ADDR() bfin_read32(MDMA3_DEST_CURR_ADDR)
1288#define bfin_write_MDMA3_DEST_CURR_ADDR(val) bfin_write32(MDMA3_DEST_CURR_ADDR, val)
1289#define bfin_read_MDMA3_DEST_IRQ_STATUS() bfin_read32(MDMA3_DEST_IRQ_STATUS)
1290#define bfin_write_MDMA3_DEST_IRQ_STATUS(val) bfin_write32(MDMA3_DEST_IRQ_STATUS, val)
1291#define bfin_read_MDMA3_DEST_CURR_X_COUNT() bfin_read32(MDMA3_DEST_CURR_X_COUNT)
1292#define bfin_write_MDMA3_DEST_CURR_X_COUNT(val) bfin_write32(MDMA3_DEST_CURR_X_COUNT, val)
1293#define bfin_read_MDMA3_DEST_CURR_Y_COUNT() bfin_read32(MDMA3_DEST_CURR_Y_COUNT)
1294#define bfin_write_MDMA3_DEST_CURR_Y_COUNT(val) bfin_write32(MDMA3_DEST_CURR_Y_COUNT, val)
1295#define bfin_read_MDMA3_SRC_NEXT_DESC_PTR() bfin_read32(MDMA3_SRC_NEXT_DESC_PTR)
1296#define bfin_write_MDMA3_SRC_NEXT_DESC_PTR(val) bfin_write32(MDMA3_SRC_NEXT_DESC_PTR, val)
1297#define bfin_read_MDMA3_SRC_START_ADDR() bfin_read32(MDMA3_SRC_START_ADDR)
1298#define bfin_write_MDMA3_SRC_START_ADDR(val) bfin_write32(MDMA3_SRC_START_ADDR, val)
1299#define bfin_read_MDMA3_SRC_CONFIG() bfin_read32(MDMA3_SRC_CONFIG)
1300#define bfin_write_MDMA3_SRC_CONFIG(val) bfin_write32(MDMA3_SRC_CONFIG, val)
1301#define bfin_read_MDMA3_SRC_X_COUNT() bfin_read32(MDMA3_SRC_X_COUNT)
1302#define bfin_write_MDMA3_SRC_X_COUNT(val) bfin_write32(MDMA3_SRC_X_COUNT, val)
1303#define bfin_read_MDMA3_SRC_X_MODIFY() bfin_read32(MDMA3_SRC_X_MODIFY)
1304#define bfin_write_MDMA3_SRC_X_MODIFY(val) bfin_write32(MDMA3_SRC_X_MODIFY, val)
1305#define bfin_read_MDMA3_SRC_Y_COUNT() bfin_read32(MDMA3_SRC_Y_COUNT)
1306#define bfin_write_MDMA3_SRC_Y_COUNT(val) bfin_write32(MDMA3_SRC_Y_COUNT, val)
1307#define bfin_read_MDMA3_SRC_Y_MODIFY() bfin_read32(MDMA3_SRC_Y_MODIFY)
1308#define bfin_write_MDMA3_SRC_Y_MODIFY(val) bfin_write32(MDMA3_SRC_Y_MODIFY, val)
1309#define bfin_read_MDMA3_SRC_CURR_DESC_PTR() bfin_read32(MDMA3_SRC_CURR_DESC_PTR)
1310#define bfin_write_MDMA3_SRC_CURR_DESC_PTR(val) bfin_write32(MDMA3_SRC_CURR_DESC_PTR, val)
1311#define bfin_read_MDMA3_SRC_PREV_DESC_PTR() bfin_read32(MDMA3_SRC_PREV_DESC_PTR)
1312#define bfin_write_MDMA3_SRC_PREV_DESC_PTR(val) bfin_write32(MDMA3_SRC_PREV_DESC_PTR, val)
1313#define bfin_read_MDMA3_SRC_CURR_ADDR() bfin_read32(MDMA3_SRC_CURR_ADDR)
1314#define bfin_write_MDMA3_SRC_CURR_ADDR(val) bfin_write32(MDMA3_SRC_CURR_ADDR, val)
1315#define bfin_read_MDMA3_SRC_IRQ_STATUS() bfin_read32(MDMA3_SRC_IRQ_STATUS)
1316#define bfin_write_MDMA3_SRC_IRQ_STATUS(val) bfin_write32(MDMA3_SRC_IRQ_STATUS, val)
1317#define bfin_read_MDMA3_SRC_CURR_X_COUNT() bfin_read32(MDMA3_SRC_CURR_X_COUNT)
1318#define bfin_write_MDMA3_SRC_CURR_X_COUNT(val) bfin_write32(MDMA3_SRC_CURR_X_COUNT, val)
1319#define bfin_read_MDMA3_SRC_CURR_Y_COUNT() bfin_read32(MDMA3_SRC_CURR_Y_COUNT)
1320#define bfin_write_MDMA3_SRC_CURR_Y_COUNT(val) bfin_write32(MDMA3_SRC_CURR_Y_COUNT, val)
1321
1322
1323/* DMA Channel 29 Registers */
1324
1325#define bfin_read_DMA29_NEXT_DESC_PTR() bfin_read32(DMA29_NEXT_DESC_PTR)
1326#define bfin_write_DMA29_NEXT_DESC_PTR(val) bfin_write32(DMA29_NEXT_DESC_PTR, val)
1327#define bfin_read_DMA29_START_ADDR() bfin_read32(DMA29_START_ADDR)
1328#define bfin_write_DMA29_START_ADDR(val) bfin_write32(DMA29_START_ADDR, val)
1329#define bfin_read_DMA29_CONFIG() bfin_read32(DMA29_CONFIG)
1330#define bfin_write_DMA29_CONFIG(val) bfin_write32(DMA29_CONFIG, val)
1331#define bfin_read_DMA29_X_COUNT() bfin_read32(DMA29_X_COUNT)
1332#define bfin_write_DMA29_X_COUNT(val) bfin_write32(DMA29_X_COUNT, val)
1333#define bfin_read_DMA29_X_MODIFY() bfin_read32(DMA29_X_MODIFY)
1334#define bfin_write_DMA29_X_MODIFY(val) bfin_write32(DMA29_X_MODIFY, val)
1335#define bfin_read_DMA29_Y_COUNT() bfin_read32(DMA29_Y_COUNT)
1336#define bfin_write_DMA29_Y_COUNT(val) bfin_write32(DMA29_Y_COUNT, val)
1337#define bfin_read_DMA29_Y_MODIFY() bfin_read32(DMA29_Y_MODIFY)
1338#define bfin_write_DMA29_Y_MODIFY(val) bfin_write32(DMA29_Y_MODIFY, val)
1339#define bfin_read_DMA29_CURR_DESC_PTR() bfin_read32(DMA29_CURR_DESC_PTR)
1340#define bfin_write_DMA29_CURR_DESC_PTR(val) bfin_write32(DMA29_CURR_DESC_PTR, val)
1341#define bfin_read_DMA29_PREV_DESC_PTR() bfin_read32(DMA29_PREV_DESC_PTR)
1342#define bfin_write_DMA29_PREV_DESC_PTR(val) bfin_write32(DMA29_PREV_DESC_PTR, val)
1343#define bfin_read_DMA29_CURR_ADDR() bfin_read32(DMA29_CURR_ADDR)
1344#define bfin_write_DMA29_CURR_ADDR(val) bfin_write32(DMA29_CURR_ADDR, val)
1345#define bfin_read_DMA29_IRQ_STATUS() bfin_read32(DMA29_IRQ_STATUS)
1346#define bfin_write_DMA29_IRQ_STATUS(val) bfin_write32(DMA29_IRQ_STATUS, val)
1347#define bfin_read_DMA29_CURR_X_COUNT() bfin_read32(DMA29_CURR_X_COUNT)
1348#define bfin_write_DMA29_CURR_X_COUNT(val) bfin_write32(DMA29_CURR_X_COUNT, val)
1349#define bfin_read_DMA29_CURR_Y_COUNT() bfin_read32(DMA29_CURR_Y_COUNT)
1350#define bfin_write_DMA29_CURR_Y_COUNT(val) bfin_write32(DMA29_CURR_Y_COUNT, val)
1351#define bfin_read_DMA29_BWL_COUNT() bfin_read32(DMA29_BWL_COUNT)
1352#define bfin_write_DMA29_BWL_COUNT(val) bfin_write32(DMA29_BWL_COUNT, val)
1353#define bfin_read_DMA29_CURR_BWL_COUNT() bfin_read32(DMA29_CURR_BWL_COUNT)
1354#define bfin_write_DMA29_CURR_BWL_COUNT(val) bfin_write32(DMA29_CURR_BWL_COUNT, val)
1355#define bfin_read_DMA29_BWM_COUNT() bfin_read32(DMA29_BWM_COUNT)
1356#define bfin_write_DMA29_BWM_COUNT(val) bfin_write32(DMA29_BWM_COUNT, val)
1357#define bfin_read_DMA29_CURR_BWM_COUNT() bfin_read32(DMA29_CURR_BWM_COUNT)
1358#define bfin_write_DMA29_CURR_BWM_COUNT(val) bfin_write32(DMA29_CURR_BWM_COUNT, val)
1359
1360/* DMA Channel 30 Registers */
1361
1362#define bfin_read_DMA30_NEXT_DESC_PTR() bfin_read32(DMA30_NEXT_DESC_PTR)
1363#define bfin_write_DMA30_NEXT_DESC_PTR(val) bfin_write32(DMA30_NEXT_DESC_PTR, val)
1364#define bfin_read_DMA30_START_ADDR() bfin_read32(DMA30_START_ADDR)
1365#define bfin_write_DMA30_START_ADDR(val) bfin_write32(DMA30_START_ADDR, val)
1366#define bfin_read_DMA30_CONFIG() bfin_read32(DMA30_CONFIG)
1367#define bfin_write_DMA30_CONFIG(val) bfin_write32(DMA30_CONFIG, val)
1368#define bfin_read_DMA30_X_COUNT() bfin_read32(DMA30_X_COUNT)
1369#define bfin_write_DMA30_X_COUNT(val) bfin_write32(DMA30_X_COUNT, val)
1370#define bfin_read_DMA30_X_MODIFY() bfin_read32(DMA30_X_MODIFY)
1371#define bfin_write_DMA30_X_MODIFY(val) bfin_write32(DMA30_X_MODIFY, val)
1372#define bfin_read_DMA30_Y_COUNT() bfin_read32(DMA30_Y_COUNT)
1373#define bfin_write_DMA30_Y_COUNT(val) bfin_write32(DMA30_Y_COUNT, val)
1374#define bfin_read_DMA30_Y_MODIFY() bfin_read32(DMA30_Y_MODIFY)
1375#define bfin_write_DMA30_Y_MODIFY(val) bfin_write32(DMA30_Y_MODIFY, val)
1376#define bfin_read_DMA30_CURR_DESC_PTR() bfin_read32(DMA30_CURR_DESC_PTR)
1377#define bfin_write_DMA30_CURR_DESC_PTR(val) bfin_write32(DMA30_CURR_DESC_PTR, val)
1378#define bfin_read_DMA30_PREV_DESC_PTR() bfin_read32(DMA30_PREV_DESC_PTR)
1379#define bfin_write_DMA30_PREV_DESC_PTR(val) bfin_write32(DMA30_PREV_DESC_PTR, val)
1380#define bfin_read_DMA30_CURR_ADDR() bfin_read32(DMA30_CURR_ADDR)
1381#define bfin_write_DMA30_CURR_ADDR(val) bfin_write32(DMA30_CURR_ADDR, val)
1382#define bfin_read_DMA30_IRQ_STATUS() bfin_read32(DMA30_IRQ_STATUS)
1383#define bfin_write_DMA30_IRQ_STATUS(val) bfin_write32(DMA30_IRQ_STATUS, val)
1384#define bfin_read_DMA30_CURR_X_COUNT() bfin_read32(DMA30_CURR_X_COUNT)
1385#define bfin_write_DMA30_CURR_X_COUNT(val) bfin_write32(DMA30_CURR_X_COUNT, val)
1386#define bfin_read_DMA30_CURR_Y_COUNT() bfin_read32(DMA30_CURR_Y_COUNT)
1387#define bfin_write_DMA30_CURR_Y_COUNT(val) bfin_write32(DMA30_CURR_Y_COUNT, val)
1388#define bfin_read_DMA30_BWL_COUNT() bfin_read32(DMA30_BWL_COUNT)
1389#define bfin_write_DMA30_BWL_COUNT(val) bfin_write32(DMA30_BWL_COUNT, val)
1390#define bfin_read_DMA30_CURR_BWL_COUNT() bfin_read32(DMA30_CURR_BWL_COUNT)
1391#define bfin_write_DMA30_CURR_BWL_COUNT(val) bfin_write32(DMA30_CURR_BWL_COUNT, val)
1392#define bfin_read_DMA30_BWM_COUNT() bfin_read32(DMA30_BWM_COUNT)
1393#define bfin_write_DMA30_BWM_COUNT(val) bfin_write32(DMA30_BWM_COUNT, val)
1394#define bfin_read_DMA30_CURR_BWM_COUNT() bfin_read32(DMA30_CURR_BWM_COUNT)
1395#define bfin_write_DMA30_CURR_BWM_COUNT(val) bfin_write32(DMA30_CURR_BWM_COUNT, val)
1396
1397/* DMA Channel 31 Registers */
1398
1399#define bfin_read_DMA31_NEXT_DESC_PTR() bfin_read32(DMA31_NEXT_DESC_PTR)
1400#define bfin_write_DMA31_NEXT_DESC_PTR(val) bfin_write32(DMA31_NEXT_DESC_PTR, val)
1401#define bfin_read_DMA31_START_ADDR() bfin_read32(DMA31_START_ADDR)
1402#define bfin_write_DMA31_START_ADDR(val) bfin_write32(DMA31_START_ADDR, val)
1403#define bfin_read_DMA31_CONFIG() bfin_read32(DMA31_CONFIG)
1404#define bfin_write_DMA31_CONFIG(val) bfin_write32(DMA31_CONFIG, val)
1405#define bfin_read_DMA31_X_COUNT() bfin_read32(DMA31_X_COUNT)
1406#define bfin_write_DMA31_X_COUNT(val) bfin_write32(DMA31_X_COUNT, val)
1407#define bfin_read_DMA31_X_MODIFY() bfin_read32(DMA31_X_MODIFY)
1408#define bfin_write_DMA31_X_MODIFY(val) bfin_write32(DMA31_X_MODIFY, val)
1409#define bfin_read_DMA31_Y_COUNT() bfin_read32(DMA31_Y_COUNT)
1410#define bfin_write_DMA31_Y_COUNT(val) bfin_write32(DMA31_Y_COUNT, val)
1411#define bfin_read_DMA31_Y_MODIFY() bfin_read32(DMA31_Y_MODIFY)
1412#define bfin_write_DMA31_Y_MODIFY(val) bfin_write32(DMA31_Y_MODIFY, val)
1413#define bfin_read_DMA31_CURR_DESC_PTR() bfin_read32(DMA31_CURR_DESC_PTR)
1414#define bfin_write_DMA31_CURR_DESC_PTR(val) bfin_write32(DMA31_CURR_DESC_PTR, val)
1415#define bfin_read_DMA31_PREV_DESC_PTR() bfin_read32(DMA31_PREV_DESC_PTR)
1416#define bfin_write_DMA31_PREV_DESC_PTR(val) bfin_write32(DMA31_PREV_DESC_PTR, val)
1417#define bfin_read_DMA31_CURR_ADDR() bfin_read32(DMA31_CURR_ADDR)
1418#define bfin_write_DMA31_CURR_ADDR(val) bfin_write32(DMA31_CURR_ADDR, val)
1419#define bfin_read_DMA31_IRQ_STATUS() bfin_read32(DMA31_IRQ_STATUS)
1420#define bfin_write_DMA31_IRQ_STATUS(val) bfin_write32(DMA31_IRQ_STATUS, val)
1421#define bfin_read_DMA31_CURR_X_COUNT() bfin_read32(DMA31_CURR_X_COUNT)
1422#define bfin_write_DMA31_CURR_X_COUNT(val) bfin_write32(DMA31_CURR_X_COUNT, val)
1423#define bfin_read_DMA31_CURR_Y_COUNT() bfin_read32(DMA31_CURR_Y_COUNT)
1424#define bfin_write_DMA31_CURR_Y_COUNT(val) bfin_write32(DMA31_CURR_Y_COUNT, val)
1425#define bfin_read_DMA31_BWL_COUNT() bfin_read32(DMA31_BWL_COUNT)
1426#define bfin_write_DMA31_BWL_COUNT(val) bfin_write32(DMA31_BWL_COUNT, val)
1427#define bfin_read_DMA31_CURR_BWL_COUNT() bfin_read32(DMA31_CURR_BWL_COUNT)
1428#define bfin_write_DMA31_CURR_BWL_COUNT(val) bfin_write32(DMA31_CURR_BWL_COUNT, val)
1429#define bfin_read_DMA31_BWM_COUNT() bfin_read32(DMA31_BWM_COUNT)
1430#define bfin_write_DMA31_BWM_COUNT(val) bfin_write32(DMA31_BWM_COUNT, val)
1431#define bfin_read_DMA31_CURR_BWM_COUNT() bfin_read32(DMA31_CURR_BWM_COUNT)
1432#define bfin_write_DMA31_CURR_BWM_COUNT(val) bfin_write32(DMA31_CURR_BWM_COUNT, val)
1433
1434/* DMA Channel 32 Registers */
1435
1436#define bfin_read_DMA32_NEXT_DESC_PTR() bfin_read32(DMA32_NEXT_DESC_PTR)
1437#define bfin_write_DMA32_NEXT_DESC_PTR(val) bfin_write32(DMA32_NEXT_DESC_PTR, val)
1438#define bfin_read_DMA32_START_ADDR() bfin_read32(DMA32_START_ADDR)
1439#define bfin_write_DMA32_START_ADDR(val) bfin_write32(DMA32_START_ADDR, val)
1440#define bfin_read_DMA32_CONFIG() bfin_read32(DMA32_CONFIG)
1441#define bfin_write_DMA32_CONFIG(val) bfin_write32(DMA32_CONFIG, val)
1442#define bfin_read_DMA32_X_COUNT() bfin_read32(DMA32_X_COUNT)
1443#define bfin_write_DMA32_X_COUNT(val) bfin_write32(DMA32_X_COUNT, val)
1444#define bfin_read_DMA32_X_MODIFY() bfin_read32(DMA32_X_MODIFY)
1445#define bfin_write_DMA32_X_MODIFY(val) bfin_write32(DMA32_X_MODIFY, val)
1446#define bfin_read_DMA32_Y_COUNT() bfin_read32(DMA32_Y_COUNT)
1447#define bfin_write_DMA32_Y_COUNT(val) bfin_write32(DMA32_Y_COUNT, val)
1448#define bfin_read_DMA32_Y_MODIFY() bfin_read32(DMA32_Y_MODIFY)
1449#define bfin_write_DMA32_Y_MODIFY(val) bfin_write32(DMA32_Y_MODIFY, val)
1450#define bfin_read_DMA32_CURR_DESC_PTR() bfin_read32(DMA32_CURR_DESC_PTR)
1451#define bfin_write_DMA32_CURR_DESC_PTR(val) bfin_write32(DMA32_CURR_DESC_PTR, val)
1452#define bfin_read_DMA32_PREV_DESC_PTR() bfin_read32(DMA32_PREV_DESC_PTR)
1453#define bfin_write_DMA32_PREV_DESC_PTR(val) bfin_write32(DMA32_PREV_DESC_PTR, val)
1454#define bfin_read_DMA32_CURR_ADDR() bfin_read32(DMA32_CURR_ADDR)
1455#define bfin_write_DMA32_CURR_ADDR(val) bfin_write32(DMA32_CURR_ADDR, val)
1456#define bfin_read_DMA32_IRQ_STATUS() bfin_read32(DMA32_IRQ_STATUS)
1457#define bfin_write_DMA32_IRQ_STATUS(val) bfin_write32(DMA32_IRQ_STATUS, val)
1458#define bfin_read_DMA32_CURR_X_COUNT() bfin_read32(DMA32_CURR_X_COUNT)
1459#define bfin_write_DMA32_CURR_X_COUNT(val) bfin_write32(DMA32_CURR_X_COUNT, val)
1460#define bfin_read_DMA32_CURR_Y_COUNT() bfin_read32(DMA32_CURR_Y_COUNT)
1461#define bfin_write_DMA32_CURR_Y_COUNT(val) bfin_write32(DMA32_CURR_Y_COUNT, val)
1462#define bfin_read_DMA32_BWL_COUNT() bfin_read32(DMA32_BWL_COUNT)
1463#define bfin_write_DMA32_BWL_COUNT(val) bfin_write32(DMA32_BWL_COUNT, val)
1464#define bfin_read_DMA32_CURR_BWL_COUNT() bfin_read32(DMA32_CURR_BWL_COUNT)
1465#define bfin_write_DMA32_CURR_BWL_COUNT(val) bfin_write32(DMA32_CURR_BWL_COUNT, val)
1466#define bfin_read_DMA32_BWM_COUNT() bfin_read32(DMA32_BWM_COUNT)
1467#define bfin_write_DMA32_BWM_COUNT(val) bfin_write32(DMA32_BWM_COUNT, val)
1468#define bfin_read_DMA32_CURR_BWM_COUNT() bfin_read32(DMA32_CURR_BWM_COUNT)
1469#define bfin_write_DMA32_CURR_BWM_COUNT(val) bfin_write32(DMA32_CURR_BWM_COUNT, val)
1470
1471/* DMA Channel 33 Registers */
1472
1473#define bfin_read_DMA33_NEXT_DESC_PTR() bfin_read32(DMA33_NEXT_DESC_PTR)
1474#define bfin_write_DMA33_NEXT_DESC_PTR(val) bfin_write32(DMA33_NEXT_DESC_PTR, val)
1475#define bfin_read_DMA33_START_ADDR() bfin_read32(DMA33_START_ADDR)
1476#define bfin_write_DMA33_START_ADDR(val) bfin_write32(DMA33_START_ADDR, val)
1477#define bfin_read_DMA33_CONFIG() bfin_read32(DMA33_CONFIG)
1478#define bfin_write_DMA33_CONFIG(val) bfin_write32(DMA33_CONFIG, val)
1479#define bfin_read_DMA33_X_COUNT() bfin_read32(DMA33_X_COUNT)
1480#define bfin_write_DMA33_X_COUNT(val) bfin_write32(DMA33_X_COUNT, val)
1481#define bfin_read_DMA33_X_MODIFY() bfin_read32(DMA33_X_MODIFY)
1482#define bfin_write_DMA33_X_MODIFY(val) bfin_write32(DMA33_X_MODIFY, val)
1483#define bfin_read_DMA33_Y_COUNT() bfin_read32(DMA33_Y_COUNT)
1484#define bfin_write_DMA33_Y_COUNT(val) bfin_write32(DMA33_Y_COUNT, val)
1485#define bfin_read_DMA33_Y_MODIFY() bfin_read32(DMA33_Y_MODIFY)
1486#define bfin_write_DMA33_Y_MODIFY(val) bfin_write32(DMA33_Y_MODIFY, val)
1487#define bfin_read_DMA33_CURR_DESC_PTR() bfin_read32(DMA33_CURR_DESC_PTR)
1488#define bfin_write_DMA33_CURR_DESC_PTR(val) bfin_write32(DMA33_CURR_DESC_PTR, val)
1489#define bfin_read_DMA33_PREV_DESC_PTR() bfin_read32(DMA33_PREV_DESC_PTR)
1490#define bfin_write_DMA33_PREV_DESC_PTR(val) bfin_write32(DMA33_PREV_DESC_PTR, val)
1491#define bfin_read_DMA33_CURR_ADDR() bfin_read32(DMA33_CURR_ADDR)
1492#define bfin_write_DMA33_CURR_ADDR(val) bfin_write32(DMA33_CURR_ADDR, val)
1493#define bfin_read_DMA33_IRQ_STATUS() bfin_read32(DMA33_IRQ_STATUS)
1494#define bfin_write_DMA33_IRQ_STATUS(val) bfin_write32(DMA33_IRQ_STATUS, val)
1495#define bfin_read_DMA33_CURR_X_COUNT() bfin_read32(DMA33_CURR_X_COUNT)
1496#define bfin_write_DMA33_CURR_X_COUNT(val) bfin_write32(DMA33_CURR_X_COUNT, val)
1497#define bfin_read_DMA33_CURR_Y_COUNT() bfin_read32(DMA33_CURR_Y_COUNT)
1498#define bfin_write_DMA33_CURR_Y_COUNT(val) bfin_write32(DMA33_CURR_Y_COUNT, val)
1499#define bfin_read_DMA33_BWL_COUNT() bfin_read32(DMA33_BWL_COUNT)
1500#define bfin_write_DMA33_BWL_COUNT(val) bfin_write32(DMA33_BWL_COUNT, val)
1501#define bfin_read_DMA33_CURR_BWL_COUNT() bfin_read32(DMA33_CURR_BWL_COUNT)
1502#define bfin_write_DMA33_CURR_BWL_COUNT(val) bfin_write32(DMA33_CURR_BWL_COUNT, val)
1503#define bfin_read_DMA33_BWM_COUNT() bfin_read32(DMA33_BWM_COUNT)
1504#define bfin_write_DMA33_BWM_COUNT(val) bfin_write32(DMA33_BWM_COUNT, val)
1505#define bfin_read_DMA33_CURR_BWM_COUNT() bfin_read32(DMA33_CURR_BWM_COUNT)
1506#define bfin_write_DMA33_CURR_BWM_COUNT(val) bfin_write32(DMA33_CURR_BWM_COUNT, val)
1507
1508/* DMA Channel 34 Registers */
1509
1510#define bfin_read_DMA34_NEXT_DESC_PTR() bfin_read32(DMA34_NEXT_DESC_PTR)
1511#define bfin_write_DMA34_NEXT_DESC_PTR(val) bfin_write32(DMA34_NEXT_DESC_PTR, val)
1512#define bfin_read_DMA34_START_ADDR() bfin_read32(DMA34_START_ADDR)
1513#define bfin_write_DMA34_START_ADDR(val) bfin_write32(DMA34_START_ADDR, val)
1514#define bfin_read_DMA34_CONFIG() bfin_read32(DMA34_CONFIG)
1515#define bfin_write_DMA34_CONFIG(val) bfin_write32(DMA34_CONFIG, val)
1516#define bfin_read_DMA34_X_COUNT() bfin_read32(DMA34_X_COUNT)
1517#define bfin_write_DMA34_X_COUNT(val) bfin_write32(DMA34_X_COUNT, val)
1518#define bfin_read_DMA34_X_MODIFY() bfin_read32(DMA34_X_MODIFY)
1519#define bfin_write_DMA34_X_MODIFY(val) bfin_write32(DMA34_X_MODIFY, val)
1520#define bfin_read_DMA34_Y_COUNT() bfin_read32(DMA34_Y_COUNT)
1521#define bfin_write_DMA34_Y_COUNT(val) bfin_write32(DMA34_Y_COUNT, val)
1522#define bfin_read_DMA34_Y_MODIFY() bfin_read32(DMA34_Y_MODIFY)
1523#define bfin_write_DMA34_Y_MODIFY(val) bfin_write32(DMA34_Y_MODIFY, val)
1524#define bfin_read_DMA34_CURR_DESC_PTR() bfin_read32(DMA34_CURR_DESC_PTR)
1525#define bfin_write_DMA34_CURR_DESC_PTR(val) bfin_write32(DMA34_CURR_DESC_PTR, val)
1526#define bfin_read_DMA34_PREV_DESC_PTR() bfin_read32(DMA34_PREV_DESC_PTR)
1527#define bfin_write_DMA34_PREV_DESC_PTR(val) bfin_write32(DMA34_PREV_DESC_PTR, val)
1528#define bfin_read_DMA34_CURR_ADDR() bfin_read32(DMA34_CURR_ADDR)
1529#define bfin_write_DMA34_CURR_ADDR(val) bfin_write32(DMA34_CURR_ADDR, val)
1530#define bfin_read_DMA34_IRQ_STATUS() bfin_read32(DMA34_IRQ_STATUS)
1531#define bfin_write_DMA34_IRQ_STATUS(val) bfin_write32(DMA34_IRQ_STATUS, val)
1532#define bfin_read_DMA34_CURR_X_COUNT() bfin_read32(DMA34_CURR_X_COUNT)
1533#define bfin_write_DMA34_CURR_X_COUNT(val) bfin_write32(DMA34_CURR_X_COUNT, val)
1534#define bfin_read_DMA34_CURR_Y_COUNT() bfin_read32(DMA34_CURR_Y_COUNT)
1535#define bfin_write_DMA34_CURR_Y_COUNT(val) bfin_write32(DMA34_CURR_Y_COUNT, val)
1536#define bfin_read_DMA34_BWL_COUNT() bfin_read32(DMA34_BWL_COUNT)
1537#define bfin_write_DMA34_BWL_COUNT(val) bfin_write32(DMA34_BWL_COUNT, val)
1538#define bfin_read_DMA34_CURR_BWL_COUNT() bfin_read32(DMA34_CURR_BWL_COUNT)
1539#define bfin_write_DMA34_CURR_BWL_COUNT(val) bfin_write32(DMA34_CURR_BWL_COUNT, val)
1540#define bfin_read_DMA34_BWM_COUNT() bfin_read32(DMA34_BWM_COUNT)
1541#define bfin_write_DMA34_BWM_COUNT(val) bfin_write32(DMA34_BWM_COUNT, val)
1542#define bfin_read_DMA34_CURR_BWM_COUNT() bfin_read32(DMA34_CURR_BWM_COUNT)
1543#define bfin_write_DMA34_CURR_BWM_COUNT(val) bfin_write32(DMA34_CURR_BWM_COUNT, val)
1544
1545/* DMA Channel 35 Registers */
1546
1547#define bfin_read_DMA35_NEXT_DESC_PTR() bfin_read32(DMA35_NEXT_DESC_PTR)
1548#define bfin_write_DMA35_NEXT_DESC_PTR(val) bfin_write32(DMA35_NEXT_DESC_PTR, val)
1549#define bfin_read_DMA35_START_ADDR() bfin_read32(DMA35_START_ADDR)
1550#define bfin_write_DMA35_START_ADDR(val) bfin_write32(DMA35_START_ADDR, val)
1551#define bfin_read_DMA35_CONFIG() bfin_read32(DMA35_CONFIG)
1552#define bfin_write_DMA35_CONFIG(val) bfin_write32(DMA35_CONFIG, val)
1553#define bfin_read_DMA35_X_COUNT() bfin_read32(DMA35_X_COUNT)
1554#define bfin_write_DMA35_X_COUNT(val) bfin_write32(DMA35_X_COUNT, val)
1555#define bfin_read_DMA35_X_MODIFY() bfin_read32(DMA35_X_MODIFY)
1556#define bfin_write_DMA35_X_MODIFY(val) bfin_write32(DMA35_X_MODIFY, val)
1557#define bfin_read_DMA35_Y_COUNT() bfin_read32(DMA35_Y_COUNT)
1558#define bfin_write_DMA35_Y_COUNT(val) bfin_write32(DMA35_Y_COUNT, val)
1559#define bfin_read_DMA35_Y_MODIFY() bfin_read32(DMA35_Y_MODIFY)
1560#define bfin_write_DMA35_Y_MODIFY(val) bfin_write32(DMA35_Y_MODIFY, val)
1561#define bfin_read_DMA35_CURR_DESC_PTR() bfin_read32(DMA35_CURR_DESC_PTR)
1562#define bfin_write_DMA35_CURR_DESC_PTR(val) bfin_write32(DMA35_CURR_DESC_PTR, val)
1563#define bfin_read_DMA35_PREV_DESC_PTR() bfin_read32(DMA35_PREV_DESC_PTR)
1564#define bfin_write_DMA35_PREV_DESC_PTR(val) bfin_write32(DMA35_PREV_DESC_PTR, val)
1565#define bfin_read_DMA35_CURR_ADDR() bfin_read32(DMA35_CURR_ADDR)
1566#define bfin_write_DMA35_CURR_ADDR(val) bfin_write32(DMA35_CURR_ADDR, val)
1567#define bfin_read_DMA35_IRQ_STATUS() bfin_read32(DMA35_IRQ_STATUS)
1568#define bfin_write_DMA35_IRQ_STATUS(val) bfin_write32(DMA35_IRQ_STATUS, val)
1569#define bfin_read_DMA35_CURR_X_COUNT() bfin_read32(DMA35_CURR_X_COUNT)
1570#define bfin_write_DMA35_CURR_X_COUNT(val) bfin_write32(DMA35_CURR_X_COUNT, val)
1571#define bfin_read_DMA35_CURR_Y_COUNT() bfin_read32(DMA35_CURR_Y_COUNT)
1572#define bfin_write_DMA35_CURR_Y_COUNT(val) bfin_write32(DMA35_CURR_Y_COUNT, val)
1573#define bfin_read_DMA35_BWL_COUNT() bfin_read32(DMA35_BWL_COUNT)
1574#define bfin_write_DMA35_BWL_COUNT(val) bfin_write32(DMA35_BWL_COUNT, val)
1575#define bfin_read_DMA35_CURR_BWL_COUNT() bfin_read32(DMA35_CURR_BWL_COUNT)
1576#define bfin_write_DMA35_CURR_BWL_COUNT(val) bfin_write32(DMA35_CURR_BWL_COUNT, val)
1577#define bfin_read_DMA35_BWM_COUNT() bfin_read32(DMA35_BWM_COUNT)
1578#define bfin_write_DMA35_BWM_COUNT(val) bfin_write32(DMA35_BWM_COUNT, val)
1579#define bfin_read_DMA35_CURR_BWM_COUNT() bfin_read32(DMA35_CURR_BWM_COUNT)
1580#define bfin_write_DMA35_CURR_BWM_COUNT(val) bfin_write32(DMA35_CURR_BWM_COUNT, val)
1581
1582/* DMA Channel 36 Registers */
1583
1584#define bfin_read_DMA36_NEXT_DESC_PTR() bfin_read32(DMA36_NEXT_DESC_PTR)
1585#define bfin_write_DMA36_NEXT_DESC_PTR(val) bfin_write32(DMA36_NEXT_DESC_PTR, val)
1586#define bfin_read_DMA36_START_ADDR() bfin_read32(DMA36_START_ADDR)
1587#define bfin_write_DMA36_START_ADDR(val) bfin_write32(DMA36_START_ADDR, val)
1588#define bfin_read_DMA36_CONFIG() bfin_read32(DMA36_CONFIG)
1589#define bfin_write_DMA36_CONFIG(val) bfin_write32(DMA36_CONFIG, val)
1590#define bfin_read_DMA36_X_COUNT() bfin_read32(DMA36_X_COUNT)
1591#define bfin_write_DMA36_X_COUNT(val) bfin_write32(DMA36_X_COUNT, val)
1592#define bfin_read_DMA36_X_MODIFY() bfin_read32(DMA36_X_MODIFY)
1593#define bfin_write_DMA36_X_MODIFY(val) bfin_write32(DMA36_X_MODIFY, val)
1594#define bfin_read_DMA36_Y_COUNT() bfin_read32(DMA36_Y_COUNT)
1595#define bfin_write_DMA36_Y_COUNT(val) bfin_write32(DMA36_Y_COUNT, val)
1596#define bfin_read_DMA36_Y_MODIFY() bfin_read32(DMA36_Y_MODIFY)
1597#define bfin_write_DMA36_Y_MODIFY(val) bfin_write32(DMA36_Y_MODIFY, val)
1598#define bfin_read_DMA36_CURR_DESC_PTR() bfin_read32(DMA36_CURR_DESC_PTR)
1599#define bfin_write_DMA36_CURR_DESC_PTR(val) bfin_write32(DMA36_CURR_DESC_PTR, val)
1600#define bfin_read_DMA36_PREV_DESC_PTR() bfin_read32(DMA36_PREV_DESC_PTR)
1601#define bfin_write_DMA36_PREV_DESC_PTR(val) bfin_write32(DMA36_PREV_DESC_PTR, val)
1602#define bfin_read_DMA36_CURR_ADDR() bfin_read32(DMA36_CURR_ADDR)
1603#define bfin_write_DMA36_CURR_ADDR(val) bfin_write32(DMA36_CURR_ADDR, val)
1604#define bfin_read_DMA36_IRQ_STATUS() bfin_read32(DMA36_IRQ_STATUS)
1605#define bfin_write_DMA36_IRQ_STATUS(val) bfin_write32(DMA36_IRQ_STATUS, val)
1606#define bfin_read_DMA36_CURR_X_COUNT() bfin_read32(DMA36_CURR_X_COUNT)
1607#define bfin_write_DMA36_CURR_X_COUNT(val) bfin_write32(DMA36_CURR_X_COUNT, val)
1608#define bfin_read_DMA36_CURR_Y_COUNT() bfin_read32(DMA36_CURR_Y_COUNT)
1609#define bfin_write_DMA36_CURR_Y_COUNT(val) bfin_write32(DMA36_CURR_Y_COUNT, val)
1610#define bfin_read_DMA36_BWL_COUNT() bfin_read32(DMA36_BWL_COUNT)
1611#define bfin_write_DMA36_BWL_COUNT(val) bfin_write32(DMA36_BWL_COUNT, val)
1612#define bfin_read_DMA36_CURR_BWL_COUNT() bfin_read32(DMA36_CURR_BWL_COUNT)
1613#define bfin_write_DMA36_CURR_BWL_COUNT(val) bfin_write32(DMA36_CURR_BWL_COUNT, val)
1614#define bfin_read_DMA36_BWM_COUNT() bfin_read32(DMA36_BWM_COUNT)
1615#define bfin_write_DMA36_BWM_COUNT(val) bfin_write32(DMA36_BWM_COUNT, val)
1616#define bfin_read_DMA36_CURR_BWM_COUNT() bfin_read32(DMA36_CURR_BWM_COUNT)
1617#define bfin_write_DMA36_CURR_BWM_COUNT(val) bfin_write32(DMA36_CURR_BWM_COUNT, val)
1618
1619/* DMA Channel 37 Registers */
1620
1621#define bfin_read_DMA37_NEXT_DESC_PTR() bfin_read32(DMA37_NEXT_DESC_PTR)
1622#define bfin_write_DMA37_NEXT_DESC_PTR(val) bfin_write32(DMA37_NEXT_DESC_PTR, val)
1623#define bfin_read_DMA37_START_ADDR() bfin_read32(DMA37_START_ADDR)
1624#define bfin_write_DMA37_START_ADDR(val) bfin_write32(DMA37_START_ADDR, val)
1625#define bfin_read_DMA37_CONFIG() bfin_read32(DMA37_CONFIG)
1626#define bfin_write_DMA37_CONFIG(val) bfin_write32(DMA37_CONFIG, val)
1627#define bfin_read_DMA37_X_COUNT() bfin_read32(DMA37_X_COUNT)
1628#define bfin_write_DMA37_X_COUNT(val) bfin_write32(DMA37_X_COUNT, val)
1629#define bfin_read_DMA37_X_MODIFY() bfin_read32(DMA37_X_MODIFY)
1630#define bfin_write_DMA37_X_MODIFY(val) bfin_write32(DMA37_X_MODIFY, val)
1631#define bfin_read_DMA37_Y_COUNT() bfin_read32(DMA37_Y_COUNT)
1632#define bfin_write_DMA37_Y_COUNT(val) bfin_write32(DMA37_Y_COUNT, val)
1633#define bfin_read_DMA37_Y_MODIFY() bfin_read32(DMA37_Y_MODIFY)
1634#define bfin_write_DMA37_Y_MODIFY(val) bfin_write32(DMA37_Y_MODIFY, val)
1635#define bfin_read_DMA37_CURR_DESC_PTR() bfin_read32(DMA37_CURR_DESC_PTR)
1636#define bfin_write_DMA37_CURR_DESC_PTR(val) bfin_write32(DMA37_CURR_DESC_PTR, val)
1637#define bfin_read_DMA37_PREV_DESC_PTR() bfin_read32(DMA37_PREV_DESC_PTR)
1638#define bfin_write_DMA37_PREV_DESC_PTR(val) bfin_write32(DMA37_PREV_DESC_PTR, val)
1639#define bfin_read_DMA37_CURR_ADDR() bfin_read32(DMA37_CURR_ADDR)
1640#define bfin_write_DMA37_CURR_ADDR(val) bfin_write32(DMA37_CURR_ADDR, val)
1641#define bfin_read_DMA37_IRQ_STATUS() bfin_read32(DMA37_IRQ_STATUS)
1642#define bfin_write_DMA37_IRQ_STATUS(val) bfin_write32(DMA37_IRQ_STATUS, val)
1643#define bfin_read_DMA37_CURR_X_COUNT() bfin_read32(DMA37_CURR_X_COUNT)
1644#define bfin_write_DMA37_CURR_X_COUNT(val) bfin_write32(DMA37_CURR_X_COUNT, val)
1645#define bfin_read_DMA37_CURR_Y_COUNT() bfin_read32(DMA37_CURR_Y_COUNT)
1646#define bfin_write_DMA37_CURR_Y_COUNT(val) bfin_write32(DMA37_CURR_Y_COUNT, val)
1647#define bfin_read_DMA37_BWL_COUNT() bfin_read32(DMA37_BWL_COUNT)
1648#define bfin_write_DMA37_BWL_COUNT(val) bfin_write32(DMA37_BWL_COUNT, val)
1649#define bfin_read_DMA37_CURR_BWL_COUNT() bfin_read32(DMA37_CURR_BWL_COUNT)
1650#define bfin_write_DMA37_CURR_BWL_COUNT(val) bfin_write32(DMA37_CURR_BWL_COUNT, val)
1651#define bfin_read_DMA37_BWM_COUNT() bfin_read32(DMA37_BWM_COUNT)
1652#define bfin_write_DMA37_BWM_COUNT(val) bfin_write32(DMA37_BWM_COUNT, val)
1653#define bfin_read_DMA37_CURR_BWM_COUNT() bfin_read32(DMA37_CURR_BWM_COUNT)
1654#define bfin_write_DMA37_CURR_BWM_COUNT(val) bfin_write32(DMA37_CURR_BWM_COUNT, val)
1655
1656/* DMA Channel 38 Registers */
1657
1658#define bfin_read_DMA38_NEXT_DESC_PTR() bfin_read32(DMA38_NEXT_DESC_PTR)
1659#define bfin_write_DMA38_NEXT_DESC_PTR(val) bfin_write32(DMA38_NEXT_DESC_PTR, val)
1660#define bfin_read_DMA38_START_ADDR() bfin_read32(DMA38_START_ADDR)
1661#define bfin_write_DMA38_START_ADDR(val) bfin_write32(DMA38_START_ADDR, val)
1662#define bfin_read_DMA38_CONFIG() bfin_read32(DMA38_CONFIG)
1663#define bfin_write_DMA38_CONFIG(val) bfin_write32(DMA38_CONFIG, val)
1664#define bfin_read_DMA38_X_COUNT() bfin_read32(DMA38_X_COUNT)
1665#define bfin_write_DMA38_X_COUNT(val) bfin_write32(DMA38_X_COUNT, val)
1666#define bfin_read_DMA38_X_MODIFY() bfin_read32(DMA38_X_MODIFY)
1667#define bfin_write_DMA38_X_MODIFY(val) bfin_write32(DMA38_X_MODIFY, val)
1668#define bfin_read_DMA38_Y_COUNT() bfin_read32(DMA38_Y_COUNT)
1669#define bfin_write_DMA38_Y_COUNT(val) bfin_write32(DMA38_Y_COUNT, val)
1670#define bfin_read_DMA38_Y_MODIFY() bfin_read32(DMA38_Y_MODIFY)
1671#define bfin_write_DMA38_Y_MODIFY(val) bfin_write32(DMA38_Y_MODIFY, val)
1672#define bfin_read_DMA38_CURR_DESC_PTR() bfin_read32(DMA38_CURR_DESC_PTR)
1673#define bfin_write_DMA38_CURR_DESC_PTR(val) bfin_write32(DMA38_CURR_DESC_PTR, val)
1674#define bfin_read_DMA38_PREV_DESC_PTR() bfin_read32(DMA38_PREV_DESC_PTR)
1675#define bfin_write_DMA38_PREV_DESC_PTR(val) bfin_write32(DMA38_PREV_DESC_PTR, val)
1676#define bfin_read_DMA38_CURR_ADDR() bfin_read32(DMA38_CURR_ADDR)
1677#define bfin_write_DMA38_CURR_ADDR(val) bfin_write32(DMA38_CURR_ADDR, val)
1678#define bfin_read_DMA38_IRQ_STATUS() bfin_read32(DMA38_IRQ_STATUS)
1679#define bfin_write_DMA38_IRQ_STATUS(val) bfin_write32(DMA38_IRQ_STATUS, val)
1680#define bfin_read_DMA38_CURR_X_COUNT() bfin_read32(DMA38_CURR_X_COUNT)
1681#define bfin_write_DMA38_CURR_X_COUNT(val) bfin_write32(DMA38_CURR_X_COUNT, val)
1682#define bfin_read_DMA38_CURR_Y_COUNT() bfin_read32(DMA38_CURR_Y_COUNT)
1683#define bfin_write_DMA38_CURR_Y_COUNT(val) bfin_write32(DMA38_CURR_Y_COUNT, val)
1684#define bfin_read_DMA38_BWL_COUNT() bfin_read32(DMA38_BWL_COUNT)
1685#define bfin_write_DMA38_BWL_COUNT(val) bfin_write32(DMA38_BWL_COUNT, val)
1686#define bfin_read_DMA38_CURR_BWL_COUNT() bfin_read32(DMA38_CURR_BWL_COUNT)
1687#define bfin_write_DMA38_CURR_BWL_COUNT(val) bfin_write32(DMA38_CURR_BWL_COUNT, val)
1688#define bfin_read_DMA38_BWM_COUNT() bfin_read32(DMA38_BWM_COUNT)
1689#define bfin_write_DMA38_BWM_COUNT(val) bfin_write32(DMA38_BWM_COUNT, val)
1690#define bfin_read_DMA38_CURR_BWM_COUNT() bfin_read32(DMA38_CURR_BWM_COUNT)
1691#define bfin_write_DMA38_CURR_BWM_COUNT(val) bfin_write32(DMA38_CURR_BWM_COUNT, val)
1692
1693/* DMA Channel 39 Registers */
1694
1695#define bfin_read_DMA39_NEXT_DESC_PTR() bfin_read32(DMA39_NEXT_DESC_PTR)
1696#define bfin_write_DMA39_NEXT_DESC_PTR(val) bfin_write32(DMA39_NEXT_DESC_PTR, val)
1697#define bfin_read_DMA39_START_ADDR() bfin_read32(DMA39_START_ADDR)
1698#define bfin_write_DMA39_START_ADDR(val) bfin_write32(DMA39_START_ADDR, val)
1699#define bfin_read_DMA39_CONFIG() bfin_read32(DMA39_CONFIG)
1700#define bfin_write_DMA39_CONFIG(val) bfin_write32(DMA39_CONFIG, val)
1701#define bfin_read_DMA39_X_COUNT() bfin_read32(DMA39_X_COUNT)
1702#define bfin_write_DMA39_X_COUNT(val) bfin_write32(DMA39_X_COUNT, val)
1703#define bfin_read_DMA39_X_MODIFY() bfin_read32(DMA39_X_MODIFY)
1704#define bfin_write_DMA39_X_MODIFY(val) bfin_write32(DMA39_X_MODIFY, val)
1705#define bfin_read_DMA39_Y_COUNT() bfin_read32(DMA39_Y_COUNT)
1706#define bfin_write_DMA39_Y_COUNT(val) bfin_write32(DMA39_Y_COUNT, val)
1707#define bfin_read_DMA39_Y_MODIFY() bfin_read32(DMA39_Y_MODIFY)
1708#define bfin_write_DMA39_Y_MODIFY(val) bfin_write32(DMA39_Y_MODIFY, val)
1709#define bfin_read_DMA39_CURR_DESC_PTR() bfin_read32(DMA39_CURR_DESC_PTR)
1710#define bfin_write_DMA39_CURR_DESC_PTR(val) bfin_write32(DMA39_CURR_DESC_PTR, val)
1711#define bfin_read_DMA39_PREV_DESC_PTR() bfin_read32(DMA39_PREV_DESC_PTR)
1712#define bfin_write_DMA39_PREV_DESC_PTR(val) bfin_write32(DMA39_PREV_DESC_PTR, val)
1713#define bfin_read_DMA39_CURR_ADDR() bfin_read32(DMA39_CURR_ADDR)
1714#define bfin_write_DMA39_CURR_ADDR(val) bfin_write32(DMA39_CURR_ADDR, val)
1715#define bfin_read_DMA39_IRQ_STATUS() bfin_read32(DMA39_IRQ_STATUS)
1716#define bfin_write_DMA39_IRQ_STATUS(val) bfin_write32(DMA39_IRQ_STATUS, val)
1717#define bfin_read_DMA39_CURR_X_COUNT() bfin_read32(DMA39_CURR_X_COUNT)
1718#define bfin_write_DMA39_CURR_X_COUNT(val) bfin_write32(DMA39_CURR_X_COUNT, val)
1719#define bfin_read_DMA39_CURR_Y_COUNT() bfin_read32(DMA39_CURR_Y_COUNT)
1720#define bfin_write_DMA39_CURR_Y_COUNT(val) bfin_write32(DMA39_CURR_Y_COUNT, val)
1721#define bfin_read_DMA39_BWL_COUNT() bfin_read32(DMA39_BWL_COUNT)
1722#define bfin_write_DMA39_BWL_COUNT(val) bfin_write32(DMA39_BWL_COUNT, val)
1723#define bfin_read_DMA39_CURR_BWL_COUNT() bfin_read32(DMA39_CURR_BWL_COUNT)
1724#define bfin_write_DMA39_CURR_BWL_COUNT(val) bfin_write32(DMA39_CURR_BWL_COUNT, val)
1725#define bfin_read_DMA39_BWM_COUNT() bfin_read32(DMA39_BWM_COUNT)
1726#define bfin_write_DMA39_BWM_COUNT(val) bfin_write32(DMA39_BWM_COUNT, val)
1727#define bfin_read_DMA39_CURR_BWM_COUNT() bfin_read32(DMA39_CURR_BWM_COUNT)
1728#define bfin_write_DMA39_CURR_BWM_COUNT(val) bfin_write32(DMA39_CURR_BWM_COUNT, val)
1729
1730/* DMA Channel 40 Registers */
1731
1732#define bfin_read_DMA40_NEXT_DESC_PTR() bfin_read32(DMA40_NEXT_DESC_PTR)
1733#define bfin_write_DMA40_NEXT_DESC_PTR(val) bfin_write32(DMA40_NEXT_DESC_PTR, val)
1734#define bfin_read_DMA40_START_ADDR() bfin_read32(DMA40_START_ADDR)
1735#define bfin_write_DMA40_START_ADDR(val) bfin_write32(DMA40_START_ADDR, val)
1736#define bfin_read_DMA40_CONFIG() bfin_read32(DMA40_CONFIG)
1737#define bfin_write_DMA40_CONFIG(val) bfin_write32(DMA40_CONFIG, val)
1738#define bfin_read_DMA40_X_COUNT() bfin_read32(DMA40_X_COUNT)
1739#define bfin_write_DMA40_X_COUNT(val) bfin_write32(DMA40_X_COUNT, val)
1740#define bfin_read_DMA40_X_MODIFY() bfin_read32(DMA40_X_MODIFY)
1741#define bfin_write_DMA40_X_MODIFY(val) bfin_write32(DMA40_X_MODIFY, val)
1742#define bfin_read_DMA40_Y_COUNT() bfin_read32(DMA40_Y_COUNT)
1743#define bfin_write_DMA40_Y_COUNT(val) bfin_write32(DMA40_Y_COUNT, val)
1744#define bfin_read_DMA40_Y_MODIFY() bfin_read32(DMA40_Y_MODIFY)
1745#define bfin_write_DMA40_Y_MODIFY(val) bfin_write32(DMA40_Y_MODIFY, val)
1746#define bfin_read_DMA40_CURR_DESC_PTR() bfin_read32(DMA40_CURR_DESC_PTR)
1747#define bfin_write_DMA40_CURR_DESC_PTR(val) bfin_write32(DMA40_CURR_DESC_PTR, val)
1748#define bfin_read_DMA40_PREV_DESC_PTR() bfin_read32(DMA40_PREV_DESC_PTR)
1749#define bfin_write_DMA40_PREV_DESC_PTR(val) bfin_write32(DMA40_PREV_DESC_PTR, val)
1750#define bfin_read_DMA40_CURR_ADDR() bfin_read32(DMA40_CURR_ADDR)
1751#define bfin_write_DMA40_CURR_ADDR(val) bfin_write32(DMA40_CURR_ADDR, val)
1752#define bfin_read_DMA40_IRQ_STATUS() bfin_read32(DMA40_IRQ_STATUS)
1753#define bfin_write_DMA40_IRQ_STATUS(val) bfin_write32(DMA40_IRQ_STATUS, val)
1754#define bfin_read_DMA40_CURR_X_COUNT() bfin_read32(DMA40_CURR_X_COUNT)
1755#define bfin_write_DMA40_CURR_X_COUNT(val) bfin_write32(DMA40_CURR_X_COUNT, val)
1756#define bfin_read_DMA40_CURR_Y_COUNT() bfin_read32(DMA40_CURR_Y_COUNT)
1757#define bfin_write_DMA40_CURR_Y_COUNT(val) bfin_write32(DMA40_CURR_Y_COUNT, val)
1758#define bfin_read_DMA40_BWL_COUNT() bfin_read32(DMA40_BWL_COUNT)
1759#define bfin_write_DMA40_BWL_COUNT(val) bfin_write32(DMA40_BWL_COUNT, val)
1760#define bfin_read_DMA40_CURR_BWL_COUNT() bfin_read32(DMA40_CURR_BWL_COUNT)
1761#define bfin_write_DMA40_CURR_BWL_COUNT(val) bfin_write32(DMA40_CURR_BWL_COUNT, val)
1762#define bfin_read_DMA40_BWM_COUNT() bfin_read32(DMA40_BWM_COUNT)
1763#define bfin_write_DMA40_BWM_COUNT(val) bfin_write32(DMA40_BWM_COUNT, val)
1764#define bfin_read_DMA40_CURR_BWM_COUNT() bfin_read32(DMA40_CURR_BWM_COUNT)
1765#define bfin_write_DMA40_CURR_BWM_COUNT(val) bfin_write32(DMA40_CURR_BWM_COUNT, val)
1766
1767/* DMA Channel 41 Registers */
1768
1769#define bfin_read_DMA41_NEXT_DESC_PTR() bfin_read32(DMA41_NEXT_DESC_PTR)
1770#define bfin_write_DMA41_NEXT_DESC_PTR(val) bfin_write32(DMA41_NEXT_DESC_PTR, val)
1771#define bfin_read_DMA41_START_ADDR() bfin_read32(DMA41_START_ADDR)
1772#define bfin_write_DMA41_START_ADDR(val) bfin_write32(DMA41_START_ADDR, val)
1773#define bfin_read_DMA41_CONFIG() bfin_read32(DMA41_CONFIG)
1774#define bfin_write_DMA41_CONFIG(val) bfin_write32(DMA41_CONFIG, val)
1775#define bfin_read_DMA41_X_COUNT() bfin_read32(DMA41_X_COUNT)
1776#define bfin_write_DMA41_X_COUNT(val) bfin_write32(DMA41_X_COUNT, val)
1777#define bfin_read_DMA41_X_MODIFY() bfin_read32(DMA41_X_MODIFY)
1778#define bfin_write_DMA41_X_MODIFY(val) bfin_write32(DMA41_X_MODIFY, val)
1779#define bfin_read_DMA41_Y_COUNT() bfin_read32(DMA41_Y_COUNT)
1780#define bfin_write_DMA41_Y_COUNT(val) bfin_write32(DMA41_Y_COUNT, val)
1781#define bfin_read_DMA41_Y_MODIFY() bfin_read32(DMA41_Y_MODIFY)
1782#define bfin_write_DMA41_Y_MODIFY(val) bfin_write32(DMA41_Y_MODIFY, val)
1783#define bfin_read_DMA41_CURR_DESC_PTR() bfin_read32(DMA41_CURR_DESC_PTR)
1784#define bfin_write_DMA41_CURR_DESC_PTR(val) bfin_write32(DMA41_CURR_DESC_PTR, val)
1785#define bfin_read_DMA41_PREV_DESC_PTR() bfin_read32(DMA41_PREV_DESC_PTR)
1786#define bfin_write_DMA41_PREV_DESC_PTR(val) bfin_write32(DMA41_PREV_DESC_PTR, val)
1787#define bfin_read_DMA41_CURR_ADDR() bfin_read32(DMA41_CURR_ADDR)
1788#define bfin_write_DMA41_CURR_ADDR(val) bfin_write32(DMA41_CURR_ADDR, val)
1789#define bfin_read_DMA41_IRQ_STATUS() bfin_read32(DMA41_IRQ_STATUS)
1790#define bfin_write_DMA41_IRQ_STATUS(val) bfin_write32(DMA41_IRQ_STATUS, val)
1791#define bfin_read_DMA41_CURR_X_COUNT() bfin_read32(DMA41_CURR_X_COUNT)
1792#define bfin_write_DMA41_CURR_X_COUNT(val) bfin_write32(DMA41_CURR_X_COUNT, val)
1793#define bfin_read_DMA41_CURR_Y_COUNT() bfin_read32(DMA41_CURR_Y_COUNT)
1794#define bfin_write_DMA41_CURR_Y_COUNT(val) bfin_write32(DMA41_CURR_Y_COUNT, val)
1795#define bfin_read_DMA41_BWL_COUNT() bfin_read32(DMA41_BWL_COUNT)
1796#define bfin_write_DMA41_BWL_COUNT(val) bfin_write32(DMA41_BWL_COUNT, val)
1797#define bfin_read_DMA41_CURR_BWL_COUNT() bfin_read32(DMA41_CURR_BWL_COUNT)
1798#define bfin_write_DMA41_CURR_BWL_COUNT(val) bfin_write32(DMA41_CURR_BWL_COUNT, val)
1799#define bfin_read_DMA41_BWM_COUNT() bfin_read32(DMA41_BWM_COUNT)
1800#define bfin_write_DMA41_BWM_COUNT(val) bfin_write32(DMA41_BWM_COUNT, val)
1801#define bfin_read_DMA41_CURR_BWM_COUNT() bfin_read32(DMA41_CURR_BWM_COUNT)
1802#define bfin_write_DMA41_CURR_BWM_COUNT(val) bfin_write32(DMA41_CURR_BWM_COUNT, val)
1803
1804/* DMA Channel 42 Registers */
1805
1806#define bfin_read_DMA42_NEXT_DESC_PTR() bfin_read32(DMA42_NEXT_DESC_PTR)
1807#define bfin_write_DMA42_NEXT_DESC_PTR(val) bfin_write32(DMA42_NEXT_DESC_PTR, val)
1808#define bfin_read_DMA42_START_ADDR() bfin_read32(DMA42_START_ADDR)
1809#define bfin_write_DMA42_START_ADDR(val) bfin_write32(DMA42_START_ADDR, val)
1810#define bfin_read_DMA42_CONFIG() bfin_read32(DMA42_CONFIG)
1811#define bfin_write_DMA42_CONFIG(val) bfin_write32(DMA42_CONFIG, val)
1812#define bfin_read_DMA42_X_COUNT() bfin_read32(DMA42_X_COUNT)
1813#define bfin_write_DMA42_X_COUNT(val) bfin_write32(DMA42_X_COUNT, val)
1814#define bfin_read_DMA42_X_MODIFY() bfin_read32(DMA42_X_MODIFY)
1815#define bfin_write_DMA42_X_MODIFY(val) bfin_write32(DMA42_X_MODIFY, val)
1816#define bfin_read_DMA42_Y_COUNT() bfin_read32(DMA42_Y_COUNT)
1817#define bfin_write_DMA42_Y_COUNT(val) bfin_write32(DMA42_Y_COUNT, val)
1818#define bfin_read_DMA42_Y_MODIFY() bfin_read32(DMA42_Y_MODIFY)
1819#define bfin_write_DMA42_Y_MODIFY(val) bfin_write32(DMA42_Y_MODIFY, val)
1820#define bfin_read_DMA42_CURR_DESC_PTR() bfin_read32(DMA42_CURR_DESC_PTR)
1821#define bfin_write_DMA42_CURR_DESC_PTR(val) bfin_write32(DMA42_CURR_DESC_PTR, val)
1822#define bfin_read_DMA42_PREV_DESC_PTR() bfin_read32(DMA42_PREV_DESC_PTR)
1823#define bfin_write_DMA42_PREV_DESC_PTR(val) bfin_write32(DMA42_PREV_DESC_PTR, val)
1824#define bfin_read_DMA42_CURR_ADDR() bfin_read32(DMA42_CURR_ADDR)
1825#define bfin_write_DMA42_CURR_ADDR(val) bfin_write32(DMA42_CURR_ADDR, val)
1826#define bfin_read_DMA42_IRQ_STATUS() bfin_read32(DMA42_IRQ_STATUS)
1827#define bfin_write_DMA42_IRQ_STATUS(val) bfin_write32(DMA42_IRQ_STATUS, val)
1828#define bfin_read_DMA42_CURR_X_COUNT() bfin_read32(DMA42_CURR_X_COUNT)
1829#define bfin_write_DMA42_CURR_X_COUNT(val) bfin_write32(DMA42_CURR_X_COUNT, val)
1830#define bfin_read_DMA42_CURR_Y_COUNT() bfin_read32(DMA42_CURR_Y_COUNT)
1831#define bfin_write_DMA42_CURR_Y_COUNT(val) bfin_write32(DMA42_CURR_Y_COUNT, val)
1832#define bfin_read_DMA42_BWL_COUNT() bfin_read32(DMA42_BWL_COUNT)
1833#define bfin_write_DMA42_BWL_COUNT(val) bfin_write32(DMA42_BWL_COUNT, val)
1834#define bfin_read_DMA42_CURR_BWL_COUNT() bfin_read32(DMA42_CURR_BWL_COUNT)
1835#define bfin_write_DMA42_CURR_BWL_COUNT(val) bfin_write32(DMA42_CURR_BWL_COUNT, val)
1836#define bfin_read_DMA42_BWM_COUNT() bfin_read32(DMA42_BWM_COUNT)
1837#define bfin_write_DMA42_BWM_COUNT(val) bfin_write32(DMA42_BWM_COUNT, val)
1838#define bfin_read_DMA42_CURR_BWM_COUNT() bfin_read32(DMA42_CURR_BWM_COUNT)
1839#define bfin_write_DMA42_CURR_BWM_COUNT(val) bfin_write32(DMA42_CURR_BWM_COUNT, val)
1840
1841/* DMA Channel 43 Registers */
1842
1843#define bfin_read_DMA43_NEXT_DESC_PTR() bfin_read32(DMA43_NEXT_DESC_PTR)
1844#define bfin_write_DMA43_NEXT_DESC_PTR(val) bfin_write32(DMA43_NEXT_DESC_PTR, val)
1845#define bfin_read_DMA43_START_ADDR() bfin_read32(DMA43_START_ADDR)
1846#define bfin_write_DMA43_START_ADDR(val) bfin_write32(DMA43_START_ADDR, val)
1847#define bfin_read_DMA43_CONFIG() bfin_read32(DMA43_CONFIG)
1848#define bfin_write_DMA43_CONFIG(val) bfin_write32(DMA43_CONFIG, val)
1849#define bfin_read_DMA43_X_COUNT() bfin_read32(DMA43_X_COUNT)
1850#define bfin_write_DMA43_X_COUNT(val) bfin_write32(DMA43_X_COUNT, val)
1851#define bfin_read_DMA43_X_MODIFY() bfin_read32(DMA43_X_MODIFY)
1852#define bfin_write_DMA43_X_MODIFY(val) bfin_write32(DMA43_X_MODIFY, val)
1853#define bfin_read_DMA43_Y_COUNT() bfin_read32(DMA43_Y_COUNT)
1854#define bfin_write_DMA43_Y_COUNT(val) bfin_write32(DMA43_Y_COUNT, val)
1855#define bfin_read_DMA43_Y_MODIFY() bfin_read32(DMA43_Y_MODIFY)
1856#define bfin_write_DMA43_Y_MODIFY(val) bfin_write32(DMA43_Y_MODIFY, val)
1857#define bfin_read_DMA43_CURR_DESC_PTR() bfin_read32(DMA43_CURR_DESC_PTR)
1858#define bfin_write_DMA43_CURR_DESC_PTR(val) bfin_write32(DMA43_CURR_DESC_PTR, val)
1859#define bfin_read_DMA43_PREV_DESC_PTR() bfin_read32(DMA43_PREV_DESC_PTR)
1860#define bfin_write_DMA43_PREV_DESC_PTR(val) bfin_write32(DMA43_PREV_DESC_PTR, val)
1861#define bfin_read_DMA43_CURR_ADDR() bfin_read32(DMA43_CURR_ADDR)
1862#define bfin_write_DMA43_CURR_ADDR(val) bfin_write32(DMA43_CURR_ADDR, val)
1863#define bfin_read_DMA43_IRQ_STATUS() bfin_read32(DMA43_IRQ_STATUS)
1864#define bfin_write_DMA43_IRQ_STATUS(val) bfin_write32(DMA43_IRQ_STATUS, val)
1865#define bfin_read_DMA43_CURR_X_COUNT() bfin_read32(DMA43_CURR_X_COUNT)
1866#define bfin_write_DMA43_CURR_X_COUNT(val) bfin_write32(DMA43_CURR_X_COUNT, val)
1867#define bfin_read_DMA43_CURR_Y_COUNT() bfin_read32(DMA43_CURR_Y_COUNT)
1868#define bfin_write_DMA43_CURR_Y_COUNT(val) bfin_write32(DMA43_CURR_Y_COUNT, val)
1869#define bfin_read_DMA43_BWL_COUNT() bfin_read32(DMA43_BWL_COUNT)
1870#define bfin_write_DMA43_BWL_COUNT(val) bfin_write32(DMA43_BWL_COUNT, val)
1871#define bfin_read_DMA43_CURR_BWL_COUNT() bfin_read32(DMA43_CURR_BWL_COUNT)
1872#define bfin_write_DMA43_CURR_BWL_COUNT(val) bfin_write32(DMA43_CURR_BWL_COUNT, val)
1873#define bfin_read_DMA43_BWM_COUNT() bfin_read32(DMA43_BWM_COUNT)
1874#define bfin_write_DMA43_BWM_COUNT(val) bfin_write32(DMA43_BWM_COUNT, val)
1875#define bfin_read_DMA43_CURR_BWM_COUNT() bfin_read32(DMA43_CURR_BWM_COUNT)
1876#define bfin_write_DMA43_CURR_BWM_COUNT(val) bfin_write32(DMA43_CURR_BWM_COUNT, val)
1877
1878/* DMA Channel 44 Registers */
1879
1880#define bfin_read_DMA44_NEXT_DESC_PTR() bfin_read32(DMA44_NEXT_DESC_PTR)
1881#define bfin_write_DMA44_NEXT_DESC_PTR(val) bfin_write32(DMA44_NEXT_DESC_PTR, val)
1882#define bfin_read_DMA44_START_ADDR() bfin_read32(DMA44_START_ADDR)
1883#define bfin_write_DMA44_START_ADDR(val) bfin_write32(DMA44_START_ADDR, val)
1884#define bfin_read_DMA44_CONFIG() bfin_read32(DMA44_CONFIG)
1885#define bfin_write_DMA44_CONFIG(val) bfin_write32(DMA44_CONFIG, val)
1886#define bfin_read_DMA44_X_COUNT() bfin_read32(DMA44_X_COUNT)
1887#define bfin_write_DMA44_X_COUNT(val) bfin_write32(DMA44_X_COUNT, val)
1888#define bfin_read_DMA44_X_MODIFY() bfin_read32(DMA44_X_MODIFY)
1889#define bfin_write_DMA44_X_MODIFY(val) bfin_write32(DMA44_X_MODIFY, val)
1890#define bfin_read_DMA44_Y_COUNT() bfin_read32(DMA44_Y_COUNT)
1891#define bfin_write_DMA44_Y_COUNT(val) bfin_write32(DMA44_Y_COUNT, val)
1892#define bfin_read_DMA44_Y_MODIFY() bfin_read32(DMA44_Y_MODIFY)
1893#define bfin_write_DMA44_Y_MODIFY(val) bfin_write32(DMA44_Y_MODIFY, val)
1894#define bfin_read_DMA44_CURR_DESC_PTR() bfin_read32(DMA44_CURR_DESC_PTR)
1895#define bfin_write_DMA44_CURR_DESC_PTR(val) bfin_write32(DMA44_CURR_DESC_PTR, val)
1896#define bfin_read_DMA44_PREV_DESC_PTR() bfin_read32(DMA44_PREV_DESC_PTR)
1897#define bfin_write_DMA44_PREV_DESC_PTR(val) bfin_write32(DMA44_PREV_DESC_PTR, val)
1898#define bfin_read_DMA44_CURR_ADDR() bfin_read32(DMA44_CURR_ADDR)
1899#define bfin_write_DMA44_CURR_ADDR(val) bfin_write32(DMA44_CURR_ADDR, val)
1900#define bfin_read_DMA44_IRQ_STATUS() bfin_read32(DMA44_IRQ_STATUS)
1901#define bfin_write_DMA44_IRQ_STATUS(val) bfin_write32(DMA44_IRQ_STATUS, val)
1902#define bfin_read_DMA44_CURR_X_COUNT() bfin_read32(DMA44_CURR_X_COUNT)
1903#define bfin_write_DMA44_CURR_X_COUNT(val) bfin_write32(DMA44_CURR_X_COUNT, val)
1904#define bfin_read_DMA44_CURR_Y_COUNT() bfin_read32(DMA44_CURR_Y_COUNT)
1905#define bfin_write_DMA44_CURR_Y_COUNT(val) bfin_write32(DMA44_CURR_Y_COUNT, val)
1906#define bfin_read_DMA44_BWL_COUNT() bfin_read32(DMA44_BWL_COUNT)
1907#define bfin_write_DMA44_BWL_COUNT(val) bfin_write32(DMA44_BWL_COUNT, val)
1908#define bfin_read_DMA44_CURR_BWL_COUNT() bfin_read32(DMA44_CURR_BWL_COUNT)
1909#define bfin_write_DMA44_CURR_BWL_COUNT(val) bfin_write32(DMA44_CURR_BWL_COUNT, val)
1910#define bfin_read_DMA44_BWM_COUNT() bfin_read32(DMA44_BWM_COUNT)
1911#define bfin_write_DMA44_BWM_COUNT(val) bfin_write32(DMA44_BWM_COUNT, val)
1912#define bfin_read_DMA44_CURR_BWM_COUNT() bfin_read32(DMA44_CURR_BWM_COUNT)
1913#define bfin_write_DMA44_CURR_BWM_COUNT(val) bfin_write32(DMA44_CURR_BWM_COUNT, val)
1914
1915/* DMA Channel 45 Registers */
1916
1917#define bfin_read_DMA45_NEXT_DESC_PTR() bfin_read32(DMA45_NEXT_DESC_PTR)
1918#define bfin_write_DMA45_NEXT_DESC_PTR(val) bfin_write32(DMA45_NEXT_DESC_PTR, val)
1919#define bfin_read_DMA45_START_ADDR() bfin_read32(DMA45_START_ADDR)
1920#define bfin_write_DMA45_START_ADDR(val) bfin_write32(DMA45_START_ADDR, val)
1921#define bfin_read_DMA45_CONFIG() bfin_read32(DMA45_CONFIG)
1922#define bfin_write_DMA45_CONFIG(val) bfin_write32(DMA45_CONFIG, val)
1923#define bfin_read_DMA45_X_COUNT() bfin_read32(DMA45_X_COUNT)
1924#define bfin_write_DMA45_X_COUNT(val) bfin_write32(DMA45_X_COUNT, val)
1925#define bfin_read_DMA45_X_MODIFY() bfin_read32(DMA45_X_MODIFY)
1926#define bfin_write_DMA45_X_MODIFY(val) bfin_write32(DMA45_X_MODIFY, val)
1927#define bfin_read_DMA45_Y_COUNT() bfin_read32(DMA45_Y_COUNT)
1928#define bfin_write_DMA45_Y_COUNT(val) bfin_write32(DMA45_Y_COUNT, val)
1929#define bfin_read_DMA45_Y_MODIFY() bfin_read32(DMA45_Y_MODIFY)
1930#define bfin_write_DMA45_Y_MODIFY(val) bfin_write32(DMA45_Y_MODIFY, val)
1931#define bfin_read_DMA45_CURR_DESC_PTR() bfin_read32(DMA45_CURR_DESC_PTR)
1932#define bfin_write_DMA45_CURR_DESC_PTR(val) bfin_write32(DMA45_CURR_DESC_PTR, val)
1933#define bfin_read_DMA45_PREV_DESC_PTR() bfin_read32(DMA45_PREV_DESC_PTR)
1934#define bfin_write_DMA45_PREV_DESC_PTR(val) bfin_write32(DMA45_PREV_DESC_PTR, val)
1935#define bfin_read_DMA45_CURR_ADDR() bfin_read32(DMA45_CURR_ADDR)
1936#define bfin_write_DMA45_CURR_ADDR(val) bfin_write32(DMA45_CURR_ADDR, val)
1937#define bfin_read_DMA45_IRQ_STATUS() bfin_read32(DMA45_IRQ_STATUS)
1938#define bfin_write_DMA45_IRQ_STATUS(val) bfin_write32(DMA45_IRQ_STATUS, val)
1939#define bfin_read_DMA45_CURR_X_COUNT() bfin_read32(DMA45_CURR_X_COUNT)
1940#define bfin_write_DMA45_CURR_X_COUNT(val) bfin_write32(DMA45_CURR_X_COUNT, val)
1941#define bfin_read_DMA45_CURR_Y_COUNT() bfin_read32(DMA45_CURR_Y_COUNT)
1942#define bfin_write_DMA45_CURR_Y_COUNT(val) bfin_write32(DMA45_CURR_Y_COUNT, val)
1943#define bfin_read_DMA45_BWL_COUNT() bfin_read32(DMA45_BWL_COUNT)
1944#define bfin_write_DMA45_BWL_COUNT(val) bfin_write32(DMA45_BWL_COUNT, val)
1945#define bfin_read_DMA45_CURR_BWL_COUNT() bfin_read32(DMA45_CURR_BWL_COUNT)
1946#define bfin_write_DMA45_CURR_BWL_COUNT(val) bfin_write32(DMA45_CURR_BWL_COUNT, val)
1947#define bfin_read_DMA45_BWM_COUNT() bfin_read32(DMA45_BWM_COUNT)
1948#define bfin_write_DMA45_BWM_COUNT(val) bfin_write32(DMA45_BWM_COUNT, val)
1949#define bfin_read_DMA45_CURR_BWM_COUNT() bfin_read32(DMA45_CURR_BWM_COUNT)
1950#define bfin_write_DMA45_CURR_BWM_COUNT(val) bfin_write32(DMA45_CURR_BWM_COUNT, val)
1951
1952/* DMA Channel 46 Registers */
1953
1954#define bfin_read_DMA46_NEXT_DESC_PTR() bfin_read32(DMA46_NEXT_DESC_PTR)
1955#define bfin_write_DMA46_NEXT_DESC_PTR(val) bfin_write32(DMA46_NEXT_DESC_PTR, val)
1956#define bfin_read_DMA46_START_ADDR() bfin_read32(DMA46_START_ADDR)
1957#define bfin_write_DMA46_START_ADDR(val) bfin_write32(DMA46_START_ADDR, val)
1958#define bfin_read_DMA46_CONFIG() bfin_read32(DMA46_CONFIG)
1959#define bfin_write_DMA46_CONFIG(val) bfin_write32(DMA46_CONFIG, val)
1960#define bfin_read_DMA46_X_COUNT() bfin_read32(DMA46_X_COUNT)
1961#define bfin_write_DMA46_X_COUNT(val) bfin_write32(DMA46_X_COUNT, val)
1962#define bfin_read_DMA46_X_MODIFY() bfin_read32(DMA46_X_MODIFY)
1963#define bfin_write_DMA46_X_MODIFY(val) bfin_write32(DMA46_X_MODIFY, val)
1964#define bfin_read_DMA46_Y_COUNT() bfin_read32(DMA46_Y_COUNT)
1965#define bfin_write_DMA46_Y_COUNT(val) bfin_write32(DMA46_Y_COUNT, val)
1966#define bfin_read_DMA46_Y_MODIFY() bfin_read32(DMA46_Y_MODIFY)
1967#define bfin_write_DMA46_Y_MODIFY(val) bfin_write32(DMA46_Y_MODIFY, val)
1968#define bfin_read_DMA46_CURR_DESC_PTR() bfin_read32(DMA46_CURR_DESC_PTR)
1969#define bfin_write_DMA46_CURR_DESC_PTR(val) bfin_write32(DMA46_CURR_DESC_PTR, val)
1970#define bfin_read_DMA46_PREV_DESC_PTR() bfin_read32(DMA46_PREV_DESC_PTR)
1971#define bfin_write_DMA46_PREV_DESC_PTR(val) bfin_write32(DMA46_PREV_DESC_PTR, val)
1972#define bfin_read_DMA46_CURR_ADDR() bfin_read32(DMA46_CURR_ADDR)
1973#define bfin_write_DMA46_CURR_ADDR(val) bfin_write32(DMA46_CURR_ADDR, val)
1974#define bfin_read_DMA46_IRQ_STATUS() bfin_read32(DMA46_IRQ_STATUS)
1975#define bfin_write_DMA46_IRQ_STATUS(val) bfin_write32(DMA46_IRQ_STATUS, val)
1976#define bfin_read_DMA46_CURR_X_COUNT() bfin_read32(DMA46_CURR_X_COUNT)
1977#define bfin_write_DMA46_CURR_X_COUNT(val) bfin_write32(DMA46_CURR_X_COUNT, val)
1978#define bfin_read_DMA46_CURR_Y_COUNT() bfin_read32(DMA46_CURR_Y_COUNT)
1979#define bfin_write_DMA46_CURR_Y_COUNT(val) bfin_write32(DMA46_CURR_Y_COUNT, val)
1980#define bfin_read_DMA46_BWL_COUNT() bfin_read32(DMA46_BWL_COUNT)
1981#define bfin_write_DMA46_BWL_COUNT(val) bfin_write32(DMA46_BWL_COUNT, val)
1982#define bfin_read_DMA46_CURR_BWL_COUNT() bfin_read32(DMA46_CURR_BWL_COUNT)
1983#define bfin_write_DMA46_CURR_BWL_COUNT(val) bfin_write32(DMA46_CURR_BWL_COUNT, val)
1984#define bfin_read_DMA46_BWM_COUNT() bfin_read32(DMA46_BWM_COUNT)
1985#define bfin_write_DMA46_BWM_COUNT(val) bfin_write32(DMA46_BWM_COUNT, val)
1986#define bfin_read_DMA46_CURR_BWM_COUNT() bfin_read32(DMA46_CURR_BWM_COUNT)
1987#define bfin_write_DMA46_CURR_BWM_COUNT(val) bfin_write32(DMA46_CURR_BWM_COUNT, val)
1988
1989
1990/* EPPI1 Registers */
1991
1992
1993/* Port Interrubfin_read_()t 0 Registers (32-bit) */
1994
1995#define bfin_read_PINT0_MASK_SET() bfin_read32(PINT0_MASK_SET)
1996#define bfin_write_PINT0_MASK_SET(val) bfin_write32(PINT0_MASK_SET, val)
1997#define bfin_read_PINT0_MASK_CLEAR() bfin_read32(PINT0_MASK_CLEAR)
1998#define bfin_write_PINT0_MASK_CLEAR(val) bfin_write32(PINT0_MASK_CLEAR, val)
1999#define bfin_read_PINT0_REQUEST() bfin_read32(PINT0_REQUEST)
2000#define bfin_write_PINT0_REQUEST(val) bfin_write32(PINT0_REQUEST, val)
2001#define bfin_read_PINT0_ASSIGN() bfin_read32(PINT0_ASSIGN)
2002#define bfin_write_PINT0_ASSIGN(val) bfin_write32(PINT0_ASSIGN, val)
2003#define bfin_read_PINT0_EDGE_SET() bfin_read32(PINT0_EDGE_SET)
2004#define bfin_write_PINT0_EDGE_SET(val) bfin_write32(PINT0_EDGE_SET, val)
2005#define bfin_read_PINT0_EDGE_CLEAR() bfin_read32(PINT0_EDGE_CLEAR)
2006#define bfin_write_PINT0_EDGE_CLEAR(val) bfin_write32(PINT0_EDGE_CLEAR, val)
2007#define bfin_read_PINT0_INVERT_SET() bfin_read32(PINT0_INVERT_SET)
2008#define bfin_write_PINT0_INVERT_SET(val) bfin_write32(PINT0_INVERT_SET, val)
2009#define bfin_read_PINT0_INVERT_CLEAR() bfin_read32(PINT0_INVERT_CLEAR)
2010#define bfin_write_PINT0_INVERT_CLEAR(val) bfin_write32(PINT0_INVERT_CLEAR, val)
2011#define bfin_read_PINT0_PINSTATE() bfin_read32(PINT0_PINSTATE)
2012#define bfin_write_PINT0_PINSTATE(val) bfin_write32(PINT0_PINSTATE, val)
2013#define bfin_read_PINT0_LATCH() bfin_read32(PINT0_LATCH)
2014#define bfin_write_PINT0_LATCH(val) bfin_write32(PINT0_LATCH, val)
2015
2016/* Port Interrubfin_read_()t 1 Registers (32-bit) */
2017
2018#define bfin_read_PINT1_MASK_SET() bfin_read32(PINT1_MASK_SET)
2019#define bfin_write_PINT1_MASK_SET(val) bfin_write32(PINT1_MASK_SET, val)
2020#define bfin_read_PINT1_MASK_CLEAR() bfin_read32(PINT1_MASK_CLEAR)
2021#define bfin_write_PINT1_MASK_CLEAR(val) bfin_write32(PINT1_MASK_CLEAR, val)
2022#define bfin_read_PINT1_REQUEST() bfin_read32(PINT1_REQUEST)
2023#define bfin_write_PINT1_REQUEST(val) bfin_write32(PINT1_REQUEST, val)
2024#define bfin_read_PINT1_ASSIGN() bfin_read32(PINT1_ASSIGN)
2025#define bfin_write_PINT1_ASSIGN(val) bfin_write32(PINT1_ASSIGN, val)
2026#define bfin_read_PINT1_EDGE_SET() bfin_read32(PINT1_EDGE_SET)
2027#define bfin_write_PINT1_EDGE_SET(val) bfin_write32(PINT1_EDGE_SET, val)
2028#define bfin_read_PINT1_EDGE_CLEAR() bfin_read32(PINT1_EDGE_CLEAR)
2029#define bfin_write_PINT1_EDGE_CLEAR(val) bfin_write32(PINT1_EDGE_CLEAR, val)
2030#define bfin_read_PINT1_INVERT_SET() bfin_read32(PINT1_INVERT_SET)
2031#define bfin_write_PINT1_INVERT_SET(val) bfin_write32(PINT1_INVERT_SET, val)
2032#define bfin_read_PINT1_INVERT_CLEAR() bfin_read32(PINT1_INVERT_CLEAR)
2033#define bfin_write_PINT1_INVERT_CLEAR(val) bfin_write32(PINT1_INVERT_CLEAR, val)
2034#define bfin_read_PINT1_PINSTATE() bfin_read32(PINT1_PINSTATE)
2035#define bfin_write_PINT1_PINSTATE(val) bfin_write32(PINT1_PINSTATE, val)
2036#define bfin_read_PINT1_LATCH() bfin_read32(PINT1_LATCH)
2037#define bfin_write_PINT1_LATCH(val) bfin_write32(PINT1_LATCH, val)
2038
2039/* Port Interrubfin_read_()t 2 Registers (32-bit) */
2040
2041#define bfin_read_PINT2_MASK_SET() bfin_read32(PINT2_MASK_SET)
2042#define bfin_write_PINT2_MASK_SET(val) bfin_write32(PINT2_MASK_SET, val)
2043#define bfin_read_PINT2_MASK_CLEAR() bfin_read32(PINT2_MASK_CLEAR)
2044#define bfin_write_PINT2_MASK_CLEAR(val) bfin_write32(PINT2_MASK_CLEAR, val)
2045#define bfin_read_PINT2_REQUEST() bfin_read32(PINT2_REQUEST)
2046#define bfin_write_PINT2_REQUEST(val) bfin_write32(PINT2_REQUEST, val)
2047#define bfin_read_PINT2_ASSIGN() bfin_read32(PINT2_ASSIGN)
2048#define bfin_write_PINT2_ASSIGN(val) bfin_write32(PINT2_ASSIGN, val)
2049#define bfin_read_PINT2_EDGE_SET() bfin_read32(PINT2_EDGE_SET)
2050#define bfin_write_PINT2_EDGE_SET(val) bfin_write32(PINT2_EDGE_SET, val)
2051#define bfin_read_PINT2_EDGE_CLEAR() bfin_read32(PINT2_EDGE_CLEAR)
2052#define bfin_write_PINT2_EDGE_CLEAR(val) bfin_write32(PINT2_EDGE_CLEAR, val)
2053#define bfin_read_PINT2_INVERT_SET() bfin_read32(PINT2_INVERT_SET)
2054#define bfin_write_PINT2_INVERT_SET(val) bfin_write32(PINT2_INVERT_SET, val)
2055#define bfin_read_PINT2_INVERT_CLEAR() bfin_read32(PINT2_INVERT_CLEAR)
2056#define bfin_write_PINT2_INVERT_CLEAR(val) bfin_write32(PINT2_INVERT_CLEAR, val)
2057#define bfin_read_PINT2_PINSTATE() bfin_read32(PINT2_PINSTATE)
2058#define bfin_write_PINT2_PINSTATE(val) bfin_write32(PINT2_PINSTATE, val)
2059#define bfin_read_PINT2_LATCH() bfin_read32(PINT2_LATCH)
2060#define bfin_write_PINT2_LATCH(val) bfin_write32(PINT2_LATCH, val)
2061
2062/* Port Interrubfin_read_()t 3 Registers (32-bit) */
2063
2064#define bfin_read_PINT3_MASK_SET() bfin_read32(PINT3_MASK_SET)
2065#define bfin_write_PINT3_MASK_SET(val) bfin_write32(PINT3_MASK_SET, val)
2066#define bfin_read_PINT3_MASK_CLEAR() bfin_read32(PINT3_MASK_CLEAR)
2067#define bfin_write_PINT3_MASK_CLEAR(val) bfin_write32(PINT3_MASK_CLEAR, val)
2068#define bfin_read_PINT3_REQUEST() bfin_read32(PINT3_REQUEST)
2069#define bfin_write_PINT3_REQUEST(val) bfin_write32(PINT3_REQUEST, val)
2070#define bfin_read_PINT3_ASSIGN() bfin_read32(PINT3_ASSIGN)
2071#define bfin_write_PINT3_ASSIGN(val) bfin_write32(PINT3_ASSIGN, val)
2072#define bfin_read_PINT3_EDGE_SET() bfin_read32(PINT3_EDGE_SET)
2073#define bfin_write_PINT3_EDGE_SET(val) bfin_write32(PINT3_EDGE_SET, val)
2074#define bfin_read_PINT3_EDGE_CLEAR() bfin_read32(PINT3_EDGE_CLEAR)
2075#define bfin_write_PINT3_EDGE_CLEAR(val) bfin_write32(PINT3_EDGE_CLEAR, val)
2076#define bfin_read_PINT3_INVERT_SET() bfin_read32(PINT3_INVERT_SET)
2077#define bfin_write_PINT3_INVERT_SET(val) bfin_write32(PINT3_INVERT_SET, val)
2078#define bfin_read_PINT3_INVERT_CLEAR() bfin_read32(PINT3_INVERT_CLEAR)
2079#define bfin_write_PINT3_INVERT_CLEAR(val) bfin_write32(PINT3_INVERT_CLEAR, val)
2080#define bfin_read_PINT3_PINSTATE() bfin_read32(PINT3_PINSTATE)
2081#define bfin_write_PINT3_PINSTATE(val) bfin_write32(PINT3_PINSTATE, val)
2082#define bfin_read_PINT3_LATCH() bfin_read32(PINT3_LATCH)
2083#define bfin_write_PINT3_LATCH(val) bfin_write32(PINT3_LATCH, val)
2084
2085/* Port Interrubfin_read_()t 4 Registers (32-bit) */
2086
2087#define bfin_read_PINT4_MASK_SET() bfin_read32(PINT4_MASK_SET)
2088#define bfin_write_PINT4_MASK_SET(val) bfin_write32(PINT4_MASK_SET, val)
2089#define bfin_read_PINT4_MASK_CLEAR() bfin_read32(PINT4_MASK_CLEAR)
2090#define bfin_write_PINT4_MASK_CLEAR(val) bfin_write32(PINT4_MASK_CLEAR, val)
2091#define bfin_read_PINT4_REQUEST() bfin_read32(PINT4_REQUEST)
2092#define bfin_write_PINT4_REQUEST(val) bfin_write32(PINT4_REQUEST, val)
2093#define bfin_read_PINT4_ASSIGN() bfin_read32(PINT4_ASSIGN)
2094#define bfin_write_PINT4_ASSIGN(val) bfin_write32(PINT4_ASSIGN, val)
2095#define bfin_read_PINT4_EDGE_SET() bfin_read32(PINT4_EDGE_SET)
2096#define bfin_write_PINT4_EDGE_SET(val) bfin_write32(PINT4_EDGE_SET, val)
2097#define bfin_read_PINT4_EDGE_CLEAR() bfin_read32(PINT4_EDGE_CLEAR)
2098#define bfin_write_PINT4_EDGE_CLEAR(val) bfin_write32(PINT4_EDGE_CLEAR, val)
2099#define bfin_read_PINT4_INVERT_SET() bfin_read32(PINT4_INVERT_SET)
2100#define bfin_write_PINT4_INVERT_SET(val) bfin_write32(PINT4_INVERT_SET, val)
2101#define bfin_read_PINT4_INVERT_CLEAR() bfin_read32(PINT4_INVERT_CLEAR)
2102#define bfin_write_PINT4_INVERT_CLEAR(val) bfin_write32(PINT4_INVERT_CLEAR, val)
2103#define bfin_read_PINT4_PINSTATE() bfin_read32(PINT4_PINSTATE)
2104#define bfin_write_PINT4_PINSTATE(val) bfin_write32(PINT4_PINSTATE, val)
2105#define bfin_read_PINT4_LATCH() bfin_read32(PINT4_LATCH)
2106#define bfin_write_PINT4_LATCH(val) bfin_write32(PINT4_LATCH, val)
2107
2108/* Port Interrubfin_read_()t 5 Registers (32-bit) */
2109
2110#define bfin_read_PINT5_MASK_SET() bfin_read32(PINT5_MASK_SET)
2111#define bfin_write_PINT5_MASK_SET(val) bfin_write32(PINT5_MASK_SET, val)
2112#define bfin_read_PINT5_MASK_CLEAR() bfin_read32(PINT5_MASK_CLEAR)
2113#define bfin_write_PINT5_MASK_CLEAR(val) bfin_write32(PINT5_MASK_CLEAR, val)
2114#define bfin_read_PINT5_REQUEST() bfin_read32(PINT5_REQUEST)
2115#define bfin_write_PINT5_REQUEST(val) bfin_write32(PINT5_REQUEST, val)
2116#define bfin_read_PINT5_ASSIGN() bfin_read32(PINT5_ASSIGN)
2117#define bfin_write_PINT5_ASSIGN(val) bfin_write32(PINT5_ASSIGN, val)
2118#define bfin_read_PINT5_EDGE_SET() bfin_read32(PINT5_EDGE_SET)
2119#define bfin_write_PINT5_EDGE_SET(val) bfin_write32(PINT5_EDGE_SET, val)
2120#define bfin_read_PINT5_EDGE_CLEAR() bfin_read32(PINT5_EDGE_CLEAR)
2121#define bfin_write_PINT5_EDGE_CLEAR(val) bfin_write32(PINT5_EDGE_CLEAR, val)
2122#define bfin_read_PINT5_INVERT_SET() bfin_read32(PINT5_INVERT_SET)
2123#define bfin_write_PINT5_INVERT_SET(val) bfin_write32(PINT5_INVERT_SET, val)
2124#define bfin_read_PINT5_INVERT_CLEAR() bfin_read32(PINT5_INVERT_CLEAR)
2125#define bfin_write_PINT5_INVERT_CLEAR(val) bfin_write32(PINT5_INVERT_CLEAR, val)
2126#define bfin_read_PINT5_PINSTATE() bfin_read32(PINT5_PINSTATE)
2127#define bfin_write_PINT5_PINSTATE(val) bfin_write32(PINT5_PINSTATE, val)
2128#define bfin_read_PINT5_LATCH() bfin_read32(PINT5_LATCH)
2129#define bfin_write_PINT5_LATCH(val) bfin_write32(PINT5_LATCH, val)
2130
2131/* Port A Registers */
2132
2133#define bfin_read_PORTA_FER() bfin_read32(PORTA_FER)
2134#define bfin_write_PORTA_FER(val) bfin_write32(PORTA_FER, val)
2135#define bfin_read_PORTA_FER_SET() bfin_read32(PORTA_FER_SET)
2136#define bfin_write_PORTA_FER_SET(val) bfin_write32(PORTA_FER_SET, val)
2137#define bfin_read_PORTA_FER_CLEAR() bfin_read32(PORTA_FER_CLEAR)
2138#define bfin_write_PORTA_FER_CLEAR(val) bfin_write32(PORTA_FER_CLEAR, val)
2139#define bfin_read_PORTA() bfin_read32(PORTA)
2140#define bfin_write_PORTA(val) bfin_write32(PORTA, val)
2141#define bfin_read_PORTA_SET() bfin_read32(PORTA_SET)
2142#define bfin_write_PORTA_SET(val) bfin_write32(PORTA_SET, val)
2143#define bfin_read_PORTA_CLEAR() bfin_read32(PORTA_CLEAR)
2144#define bfin_write_PORTA_CLEAR(val) bfin_write32(PORTA_CLEAR, val)
2145#define bfin_read_PORTA_DIR() bfin_read32(PORTA_DIR)
2146#define bfin_write_PORTA_DIR(val) bfin_write32(PORTA_DIR, val)
2147#define bfin_read_PORTA_DIR_SET() bfin_read32(PORTA_DIR_SET)
2148#define bfin_write_PORTA_DIR_SET(val) bfin_write32(PORTA_DIR_SET, val)
2149#define bfin_read_PORTA_DIR_CLEAR() bfin_read32(PORTA_DIR_CLEAR)
2150#define bfin_write_PORTA_DIR_CLEAR(val) bfin_write32(PORTA_DIR_CLEAR, val)
2151#define bfin_read_PORTA_INEN() bfin_read32(PORTA_INEN)
2152#define bfin_write_PORTA_INEN(val) bfin_write32(PORTA_INEN, val)
2153#define bfin_read_PORTA_INEN_SET() bfin_read32(PORTA_INEN_SET)
2154#define bfin_write_PORTA_INEN_SET(val) bfin_write32(PORTA_INEN_SET, val)
2155#define bfin_read_PORTA_INEN_CLEAR() bfin_read32(PORTA_INEN_CLEAR)
2156#define bfin_write_PORTA_INEN_CLEAR(val) bfin_write32(PORTA_INEN_CLEAR, val)
2157#define bfin_read_PORTA_MUX() bfin_read32(PORTA_MUX)
2158#define bfin_write_PORTA_MUX(val) bfin_write32(PORTA_MUX, val)
2159#define bfin_read_PORTA_DATA_TGL() bfin_read32(PORTA_DATA_TGL)
2160#define bfin_write_PORTA_DATA_TGL(val) bfin_write32(PORTA_DATA_TGL, val)
2161#define bfin_read_PORTA_POL() bfin_read32(PORTA_POL)
2162#define bfin_write_PORTA_POL(val) bfin_write32(PORTA_POL, val)
2163#define bfin_read_PORTA_POL_SET() bfin_read32(PORTA_POL_SET)
2164#define bfin_write_PORTA_POL_SET(val) bfin_write32(PORTA_POL_SET, val)
2165#define bfin_read_PORTA_POL_CLEAR() bfin_read32(PORTA_POL_CLEAR)
2166#define bfin_write_PORTA_POL_CLEAR(val) bfin_write32(PORTA_POL_CLEAR, val)
2167#define bfin_read_PORTA_LOCK() bfin_read32(PORTA_LOCK)
2168#define bfin_write_PORTA_LOCK(val) bfin_write32(PORTA_LOCK, val)
2169#define bfin_read_PORTA_REVID() bfin_read32(PORTA_REVID)
2170#define bfin_write_PORTA_REVID(val) bfin_write32(PORTA_REVID, val)
2171
2172
2173
2174/* Port B Registers */
2175#define bfin_read_PORTB_FER() bfin_read32(PORTB_FER)
2176#define bfin_write_PORTB_FER(val) bfin_write32(PORTB_FER, val)
2177#define bfin_read_PORTB_FER_SET() bfin_read32(PORTB_FER_SET)
2178#define bfin_write_PORTB_FER_SET(val) bfin_write32(PORTB_FER_SET, val)
2179#define bfin_read_PORTB_FER_CLEAR() bfin_read32(PORTB_FER_CLEAR)
2180#define bfin_write_PORTB_FER_CLEAR(val) bfin_write32(PORTB_FER_CLEAR, val)
2181#define bfin_read_PORTB() bfin_read32(PORTB)
2182#define bfin_write_PORTB(val) bfin_write32(PORTB, val)
2183#define bfin_read_PORTB_SET() bfin_read32(PORTB_SET)
2184#define bfin_write_PORTB_SET(val) bfin_write32(PORTB_SET, val)
2185#define bfin_read_PORTB_CLEAR() bfin_read32(PORTB_CLEAR)
2186#define bfin_write_PORTB_CLEAR(val) bfin_write32(PORTB_CLEAR, val)
2187#define bfin_read_PORTB_DIR() bfin_read32(PORTB_DIR)
2188#define bfin_write_PORTB_DIR(val) bfin_write32(PORTB_DIR, val)
2189#define bfin_read_PORTB_DIR_SET() bfin_read32(PORTB_DIR_SET)
2190#define bfin_write_PORTB_DIR_SET(val) bfin_write32(PORTB_DIR_SET, val)
2191#define bfin_read_PORTB_DIR_CLEAR() bfin_read32(PORTB_DIR_CLEAR)
2192#define bfin_write_PORTB_DIR_CLEAR(val) bfin_write32(PORTB_DIR_CLEAR, val)
2193#define bfin_read_PORTB_INEN() bfin_read32(PORTB_INEN)
2194#define bfin_write_PORTB_INEN(val) bfin_write32(PORTB_INEN, val)
2195#define bfin_read_PORTB_INEN_SET() bfin_read32(PORTB_INEN_SET)
2196#define bfin_write_PORTB_INEN_SET(val) bfin_write32(PORTB_INEN_SET, val)
2197#define bfin_read_PORTB_INEN_CLEAR() bfin_read32(PORTB_INEN_CLEAR)
2198#define bfin_write_PORTB_INEN_CLEAR(val) bfin_write32(PORTB_INEN_CLEAR, val)
2199#define bfin_read_PORTB_MUX() bfin_read32(PORTB_MUX)
2200#define bfin_write_PORTB_MUX(val) bfin_write32(PORTB_MUX, val)
2201#define bfin_read_PORTB_DATA_TGL() bfin_read32(PORTB_DATA_TGL)
2202#define bfin_write_PORTB_DATA_TGL(val) bfin_write32(PORTB_DATA_TGL, val)
2203#define bfin_read_PORTB_POL() bfin_read32(PORTB_POL)
2204#define bfin_write_PORTB_POL(val) bfin_write32(PORTB_POL, val)
2205#define bfin_read_PORTB_POL_SET() bfin_read32(PORTB_POL_SET)
2206#define bfin_write_PORTB_POL_SET(val) bfin_write32(PORTB_POL_SET, val)
2207#define bfin_read_PORTB_POL_CLEAR() bfin_read32(PORTB_POL_CLEAR)
2208#define bfin_write_PORTB_POL_CLEAR(val) bfin_write32(PORTB_POL_CLEAR, val)
2209#define bfin_read_PORTB_LOCK() bfin_read32(PORTB_LOCK)
2210#define bfin_write_PORTB_LOCK(val) bfin_write32(PORTB_LOCK, val)
2211#define bfin_read_PORTB_REVID() bfin_read32(PORTB_REVID)
2212#define bfin_write_PORTB_REVID(val) bfin_write32(PORTB_REVID, val)
2213
2214
2215/* Port C Registers */
2216#define bfin_read_PORTC_FER() bfin_read32(PORTC_FER)
2217#define bfin_write_PORTC_FER(val) bfin_write32(PORTC_FER, val)
2218#define bfin_read_PORTC_FER_SET() bfin_read32(PORTC_FER_SET)
2219#define bfin_write_PORTC_FER_SET(val) bfin_write32(PORTC_FER_SET, val)
2220#define bfin_read_PORTC_FER_CLEAR() bfin_read32(PORTC_FER_CLEAR)
2221#define bfin_write_PORTC_FER_CLEAR(val) bfin_write32(PORTC_FER_CLEAR, val)
2222#define bfin_read_PORTC() bfin_read32(PORTC)
2223#define bfin_write_PORTC(val) bfin_write32(PORTC, val)
2224#define bfin_read_PORTC_SET() bfin_read32(PORTC_SET)
2225#define bfin_write_PORTC_SET(val) bfin_write32(PORTC_SET, val)
2226#define bfin_read_PORTC_CLEAR() bfin_read32(PORTC_CLEAR)
2227#define bfin_write_PORTC_CLEAR(val) bfin_write32(PORTC_CLEAR, val)
2228#define bfin_read_PORTC_DIR() bfin_read32(PORTC_DIR)
2229#define bfin_write_PORTC_DIR(val) bfin_write32(PORTC_DIR, val)
2230#define bfin_read_PORTC_DIR_SET() bfin_read32(PORTC_DIR_SET)
2231#define bfin_write_PORTC_DIR_SET(val) bfin_write32(PORTC_DIR_SET, val)
2232#define bfin_read_PORTC_DIR_CLEAR() bfin_read32(PORTC_DIR_CLEAR)
2233#define bfin_write_PORTC_DIR_CLEAR(val) bfin_write32(PORTC_DIR_CLEAR, val)
2234#define bfin_read_PORTC_INEN() bfin_read32(PORTC_INEN)
2235#define bfin_write_PORTC_INEN(val) bfin_write32(PORTC_INEN, val)
2236#define bfin_read_PORTC_INEN_SET() bfin_read32(PORTC_INEN_SET)
2237#define bfin_write_PORTC_INEN_SET(val) bfin_write32(PORTC_INEN_SET, val)
2238#define bfin_read_PORTC_INEN_CLEAR() bfin_read32(PORTC_INEN_CLEAR)
2239#define bfin_write_PORTC_INEN_CLEAR(val) bfin_write32(PORTC_INEN_CLEAR, val)
2240#define bfin_read_PORTC_MUX() bfin_read32(PORTC_MUX)
2241#define bfin_write_PORTC_MUX(val) bfin_write32(PORTC_MUX, val)
2242#define bfin_read_PORTC_DATA_TGL() bfin_read32(PORTC_DATA_TGL)
2243#define bfin_write_PORTC_DATA_TGL(val) bfin_write32(PORTC_DATA_TGL, val)
2244#define bfin_read_PORTC_POL() bfin_read32(PORTC_POL)
2245#define bfin_write_PORTC_POL(val) bfin_write32(PORTC_POL, val)
2246#define bfin_read_PORTC_POL_SET() bfin_read32(PORTC_POL_SET)
2247#define bfin_write_PORTC_POL_SET(val) bfin_write32(PORTC_POL_SET, val)
2248#define bfin_read_PORTC_POL_CLEAR() bfin_read32(PORTC_POL_CLEAR)
2249#define bfin_write_PORTC_POL_CLEAR(val) bfin_write32(PORTC_POL_CLEAR, val)
2250#define bfin_read_PORTC_LOCK() bfin_read32(PORTC_LOCK)
2251#define bfin_write_PORTC_LOCK(val) bfin_write32(PORTC_LOCK, val)
2252#define bfin_read_PORTC_REVID() bfin_read32(PORTC_REVID)
2253#define bfin_write_PORTC_REVID(val) bfin_write32(PORTC_REVID, val)
2254
2255
2256/* Port D Registers */
2257#define bfin_read_PORTD_FER() bfin_read32(PORTD_FER)
2258#define bfin_write_PORTD_FER(val) bfin_write32(PORTD_FER, val)
2259#define bfin_read_PORTD_FER_SET() bfin_read32(PORTD_FER_SET)
2260#define bfin_write_PORTD_FER_SET(val) bfin_write32(PORTD_FER_SET, val)
2261#define bfin_read_PORTD_FER_CLEAR() bfin_read32(PORTD_FER_CLEAR)
2262#define bfin_write_PORTD_FER_CLEAR(val) bfin_write32(PORTD_FER_CLEAR, val)
2263#define bfin_read_PORTD() bfin_read32(PORTD)
2264#define bfin_write_PORTD(val) bfin_write32(PORTD, val)
2265#define bfin_read_PORTD_SET() bfin_read32(PORTD_SET)
2266#define bfin_write_PORTD_SET(val) bfin_write32(PORTD_SET, val)
2267#define bfin_read_PORTD_CLEAR() bfin_read32(PORTD_CLEAR)
2268#define bfin_write_PORTD_CLEAR(val) bfin_write32(PORTD_CLEAR, val)
2269#define bfin_read_PORTD_DIR() bfin_read32(PORTD_DIR)
2270#define bfin_write_PORTD_DIR(val) bfin_write32(PORTD_DIR, val)
2271#define bfin_read_PORTD_DIR_SET() bfin_read32(PORTD_DIR_SET)
2272#define bfin_write_PORTD_DIR_SET(val) bfin_write32(PORTD_DIR_SET, val)
2273#define bfin_read_PORTD_DIR_CLEAR() bfin_read32(PORTD_DIR_CLEAR)
2274#define bfin_write_PORTD_DIR_CLEAR(val) bfin_write32(PORTD_DIR_CLEAR, val)
2275#define bfin_read_PORTD_INEN() bfin_read32(PORTD_INEN)
2276#define bfin_write_PORTD_INEN(val) bfin_write32(PORTD_INEN, val)
2277#define bfin_read_PORTD_INEN_SET() bfin_read32(PORTD_INEN_SET)
2278#define bfin_write_PORTD_INEN_SET(val) bfin_write32(PORTD_INEN_SET, val)
2279#define bfin_read_PORTD_INEN_CLEAR() bfin_read32(PORTD_INEN_CLEAR)
2280#define bfin_write_PORTD_INEN_CLEAR(val) bfin_write32(PORTD_INEN_CLEAR, val)
2281#define bfin_read_PORTD_MUX() bfin_read32(PORTD_MUX)
2282#define bfin_write_PORTD_MUX(val) bfin_write32(PORTD_MUX, val)
2283#define bfin_read_PORTD_DATA_TGL() bfin_read32(PORTD_DATA_TGL)
2284#define bfin_write_PORTD_DATA_TGL(val) bfin_write32(PORTD_DATA_TGL, val)
2285#define bfin_read_PORTD_POL() bfin_read32(PORTD_POL)
2286#define bfin_write_PORTD_POL(val) bfin_write32(PORTD_POL, val)
2287#define bfin_read_PORTD_POL_SET() bfin_read32(PORTD_POL_SET)
2288#define bfin_write_PORTD_POL_SET(val) bfin_write32(PORTD_POL_SET, val)
2289#define bfin_read_PORTD_POL_CLEAR() bfin_read32(PORTD_POL_CLEAR)
2290#define bfin_write_PORTD_POL_CLEAR(val) bfin_write32(PORTD_POL_CLEAR, val)
2291#define bfin_read_PORTD_LOCK() bfin_read32(PORTD_LOCK)
2292#define bfin_write_PORTD_LOCK(val) bfin_write32(PORTD_LOCK, val)
2293#define bfin_read_PORTD_REVID() bfin_read32(PORTD_REVID)
2294#define bfin_write_PORTD_REVID(val) bfin_write32(PORTD_REVID, val)
2295
2296
2297/* Port E Registers */
2298#define bfin_read_PORTE_FER() bfin_read32(PORTE_FER)
2299#define bfin_write_PORTE_FER(val) bfin_write32(PORTE_FER, val)
2300#define bfin_read_PORTE_FER_SET() bfin_read32(PORTE_FER_SET)
2301#define bfin_write_PORTE_FER_SET(val) bfin_write32(PORTE_FER_SET, val)
2302#define bfin_read_PORTE_FER_CLEAR() bfin_read32(PORTE_FER_CLEAR)
2303#define bfin_write_PORTE_FER_CLEAR(val) bfin_write32(PORTE_FER_CLEAR, val)
2304#define bfin_read_PORTE() bfin_read32(PORTE)
2305#define bfin_write_PORTE(val) bfin_write32(PORTE, val)
2306#define bfin_read_PORTE_SET() bfin_read32(PORTE_SET)
2307#define bfin_write_PORTE_SET(val) bfin_write32(PORTE_SET, val)
2308#define bfin_read_PORTE_CLEAR() bfin_read32(PORTE_CLEAR)
2309#define bfin_write_PORTE_CLEAR(val) bfin_write32(PORTE_CLEAR, val)
2310#define bfin_read_PORTE_DIR() bfin_read32(PORTE_DIR)
2311#define bfin_write_PORTE_DIR(val) bfin_write32(PORTE_DIR, val)
2312#define bfin_read_PORTE_DIR_SET() bfin_read32(PORTE_DIR_SET)
2313#define bfin_write_PORTE_DIR_SET(val) bfin_write32(PORTE_DIR_SET, val)
2314#define bfin_read_PORTE_DIR_CLEAR() bfin_read32(PORTE_DIR_CLEAR)
2315#define bfin_write_PORTE_DIR_CLEAR(val) bfin_write32(PORTE_DIR_CLEAR, val)
2316#define bfin_read_PORTE_INEN() bfin_read32(PORTE_INEN)
2317#define bfin_write_PORTE_INEN(val) bfin_write32(PORTE_INEN, val)
2318#define bfin_read_PORTE_INEN_SET() bfin_read32(PORTE_INEN_SET)
2319#define bfin_write_PORTE_INEN_SET(val) bfin_write32(PORTE_INEN_SET, val)
2320#define bfin_read_PORTE_INEN_CLEAR() bfin_read32(PORTE_INEN_CLEAR)
2321#define bfin_write_PORTE_INEN_CLEAR(val) bfin_write32(PORTE_INEN_CLEAR, val)
2322#define bfin_read_PORTE_MUX() bfin_read32(PORTE_MUX)
2323#define bfin_write_PORTE_MUX(val) bfin_write32(PORTE_MUX, val)
2324#define bfin_read_PORTE_DATA_TGL() bfin_read32(PORTE_DATA_TGL)
2325#define bfin_write_PORTE_DATA_TGL(val) bfin_write32(PORTE_DATA_TGL, val)
2326#define bfin_read_PORTE_POL() bfin_read32(PORTE_POL)
2327#define bfin_write_PORTE_POL(val) bfin_write32(PORTE_POL, val)
2328#define bfin_read_PORTE_POL_SET() bfin_read32(PORTE_POL_SET)
2329#define bfin_write_PORTE_POL_SET(val) bfin_write32(PORTE_POL_SET, val)
2330#define bfin_read_PORTE_POL_CLEAR() bfin_read32(PORTE_POL_CLEAR)
2331#define bfin_write_PORTE_POL_CLEAR(val) bfin_write32(PORTE_POL_CLEAR, val)
2332#define bfin_read_PORTE_LOCK() bfin_read32(PORTE_LOCK)
2333#define bfin_write_PORTE_LOCK(val) bfin_write32(PORTE_LOCK, val)
2334#define bfin_read_PORTE_REVID() bfin_read32(PORTE_REVID)
2335#define bfin_write_PORTE_REVID(val) bfin_write32(PORTE_REVID, val)
2336
2337
2338/* Port F Registers */
2339#define bfin_read_PORTF_FER() bfin_read32(PORTF_FER)
2340#define bfin_write_PORTF_FER(val) bfin_write32(PORTF_FER, val)
2341#define bfin_read_PORTF_FER_SET() bfin_read32(PORTF_FER_SET)
2342#define bfin_write_PORTF_FER_SET(val) bfin_write32(PORTF_FER_SET, val)
2343#define bfin_read_PORTF_FER_CLEAR() bfin_read32(PORTF_FER_CLEAR)
2344#define bfin_write_PORTF_FER_CLEAR(val) bfin_write32(PORTF_FER_CLEAR, val)
2345#define bfin_read_PORTF() bfin_read32(PORTF)
2346#define bfin_write_PORTF(val) bfin_write32(PORTF, val)
2347#define bfin_read_PORTF_SET() bfin_read32(PORTF_SET)
2348#define bfin_write_PORTF_SET(val) bfin_write32(PORTF_SET, val)
2349#define bfin_read_PORTF_CLEAR() bfin_read32(PORTF_CLEAR)
2350#define bfin_write_PORTF_CLEAR(val) bfin_write32(PORTF_CLEAR, val)
2351#define bfin_read_PORTF_DIR() bfin_read32(PORTF_DIR)
2352#define bfin_write_PORTF_DIR(val) bfin_write32(PORTF_DIR, val)
2353#define bfin_read_PORTF_DIR_SET() bfin_read32(PORTF_DIR_SET)
2354#define bfin_write_PORTF_DIR_SET(val) bfin_write32(PORTF_DIR_SET, val)
2355#define bfin_read_PORTF_DIR_CLEAR() bfin_read32(PORTF_DIR_CLEAR)
2356#define bfin_write_PORTF_DIR_CLEAR(val) bfin_write32(PORTF_DIR_CLEAR, val)
2357#define bfin_read_PORTF_INEN() bfin_read32(PORTF_INEN)
2358#define bfin_write_PORTF_INEN(val) bfin_write32(PORTF_INEN, val)
2359#define bfin_read_PORTF_INEN_SET() bfin_read32(PORTF_INEN_SET)
2360#define bfin_write_PORTF_INEN_SET(val) bfin_write32(PORTF_INEN_SET, val)
2361#define bfin_read_PORTF_INEN_CLEAR() bfin_read32(PORTF_INEN_CLEAR)
2362#define bfin_write_PORTF_INEN_CLEAR(val) bfin_write32(PORTF_INEN_CLEAR, val)
2363#define bfin_read_PORTF_MUX() bfin_read32(PORTF_MUX)
2364#define bfin_write_PORTF_MUX(val) bfin_write32(PORTF_MUX, val)
2365#define bfin_read_PORTF_DATA_TGL() bfin_read32(PORTF_DATA_TGL)
2366#define bfin_write_PORTF_DATA_TGL(val) bfin_write32(PORTF_DATA_TGL, val)
2367#define bfin_read_PORTF_POL() bfin_read32(PORTF_POL)
2368#define bfin_write_PORTF_POL(val) bfin_write32(PORTF_POL, val)
2369#define bfin_read_PORTF_POL_SET() bfin_read32(PORTF_POL_SET)
2370#define bfin_write_PORTF_POL_SET(val) bfin_write32(PORTF_POL_SET, val)
2371#define bfin_read_PORTF_POL_CLEAR() bfin_read32(PORTF_POL_CLEAR)
2372#define bfin_write_PORTF_POL_CLEAR(val) bfin_write32(PORTF_POL_CLEAR, val)
2373#define bfin_read_PORTF_LOCK() bfin_read32(PORTF_LOCK)
2374#define bfin_write_PORTF_LOCK(val) bfin_write32(PORTF_LOCK, val)
2375#define bfin_read_PORTF_REVID() bfin_read32(PORTF_REVID)
2376#define bfin_write_PORTF_REVID(val) bfin_write32(PORTF_REVID, val)
2377
2378
2379/* Port G Registers */
2380#define bfin_read_PORTG_FER() bfin_read32(PORTG_FER)
2381#define bfin_write_PORTG_FER(val) bfin_write32(PORTG_FER, val)
2382#define bfin_read_PORTG_FER_SET() bfin_read32(PORTG_FER_SET)
2383#define bfin_write_PORTG_FER_SET(val) bfin_write32(PORTG_FER_SET, val)
2384#define bfin_read_PORTG_FER_CLEAR() bfin_read32(PORTG_FER_CLEAR)
2385#define bfin_write_PORTG_FER_CLEAR(val) bfin_write32(PORTG_FER_CLEAR, val)
2386#define bfin_read_PORTG() bfin_read32(PORTG)
2387#define bfin_write_PORTG(val) bfin_write32(PORTG, val)
2388#define bfin_read_PORTG_SET() bfin_read32(PORTG_SET)
2389#define bfin_write_PORTG_SET(val) bfin_write32(PORTG_SET, val)
2390#define bfin_read_PORTG_CLEAR() bfin_read32(PORTG_CLEAR)
2391#define bfin_write_PORTG_CLEAR(val) bfin_write32(PORTG_CLEAR, val)
2392#define bfin_read_PORTG_DIR() bfin_read32(PORTG_DIR)
2393#define bfin_write_PORTG_DIR(val) bfin_write32(PORTG_DIR, val)
2394#define bfin_read_PORTG_DIR_SET() bfin_read32(PORTG_DIR_SET)
2395#define bfin_write_PORTG_DIR_SET(val) bfin_write32(PORTG_DIR_SET, val)
2396#define bfin_read_PORTG_DIR_CLEAR() bfin_read32(PORTG_DIR_CLEAR)
2397#define bfin_write_PORTG_DIR_CLEAR(val) bfin_write32(PORTG_DIR_CLEAR, val)
2398#define bfin_read_PORTG_INEN() bfin_read32(PORTG_INEN)
2399#define bfin_write_PORTG_INEN(val) bfin_write32(PORTG_INEN, val)
2400#define bfin_read_PORTG_INEN_SET() bfin_read32(PORTG_INEN_SET)
2401#define bfin_write_PORTG_INEN_SET(val) bfin_write32(PORTG_INEN_SET, val)
2402#define bfin_read_PORTG_INEN_CLEAR() bfin_read32(PORTG_INEN_CLEAR)
2403#define bfin_write_PORTG_INEN_CLEAR(val) bfin_write32(PORTG_INEN_CLEAR, val)
2404#define bfin_read_PORTG_MUX() bfin_read32(PORTG_MUX)
2405#define bfin_write_PORTG_MUX(val) bfin_write32(PORTG_MUX, val)
2406#define bfin_read_PORTG_DATA_TGL() bfin_read32(PORTG_DATA_TGL)
2407#define bfin_write_PORTG_DATA_TGL(val) bfin_write32(PORTG_DATA_TGL, val)
2408#define bfin_read_PORTG_POL() bfin_read32(PORTG_POL)
2409#define bfin_write_PORTG_POL(val) bfin_write32(PORTG_POL, val)
2410#define bfin_read_PORTG_POL_SET() bfin_read32(PORTG_POL_SET)
2411#define bfin_write_PORTG_POL_SET(val) bfin_write32(PORTG_POL_SET, val)
2412#define bfin_read_PORTG_POL_CLEAR() bfin_read32(PORTG_POL_CLEAR)
2413#define bfin_write_PORTG_POL_CLEAR(val) bfin_write32(PORTG_POL_CLEAR, val)
2414#define bfin_read_PORTG_LOCK() bfin_read32(PORTG_LOCK)
2415#define bfin_write_PORTG_LOCK(val) bfin_write32(PORTG_LOCK, val)
2416#define bfin_read_PORTG_REVID() bfin_read32(PORTG_REVID)
2417#define bfin_write_PORTG_REVID(val) bfin_write32(PORTG_REVID, val)
2418
2419
2420
2421
2422/* CAN Controller 0 Config 1 Registers */
2423
2424#define bfin_read_CAN0_MC1() bfin_read16(CAN0_MC1)
2425#define bfin_write_CAN0_MC1(val) bfin_write16(CAN0_MC1, val)
2426#define bfin_read_CAN0_MD1() bfin_read16(CAN0_MD1)
2427#define bfin_write_CAN0_MD1(val) bfin_write16(CAN0_MD1, val)
2428#define bfin_read_CAN0_TRS1() bfin_read16(CAN0_TRS1)
2429#define bfin_write_CAN0_TRS1(val) bfin_write16(CAN0_TRS1, val)
2430#define bfin_read_CAN0_TRR1() bfin_read16(CAN0_TRR1)
2431#define bfin_write_CAN0_TRR1(val) bfin_write16(CAN0_TRR1, val)
2432#define bfin_read_CAN0_TA1() bfin_read16(CAN0_TA1)
2433#define bfin_write_CAN0_TA1(val) bfin_write16(CAN0_TA1, val)
2434#define bfin_read_CAN0_AA1() bfin_read16(CAN0_AA1)
2435#define bfin_write_CAN0_AA1(val) bfin_write16(CAN0_AA1, val)
2436#define bfin_read_CAN0_RMP1() bfin_read16(CAN0_RMP1)
2437#define bfin_write_CAN0_RMP1(val) bfin_write16(CAN0_RMP1, val)
2438#define bfin_read_CAN0_RML1() bfin_read16(CAN0_RML1)
2439#define bfin_write_CAN0_RML1(val) bfin_write16(CAN0_RML1, val)
2440#define bfin_read_CAN0_MBTIF1() bfin_read16(CAN0_MBTIF1)
2441#define bfin_write_CAN0_MBTIF1(val) bfin_write16(CAN0_MBTIF1, val)
2442#define bfin_read_CAN0_MBRIF1() bfin_read16(CAN0_MBRIF1)
2443#define bfin_write_CAN0_MBRIF1(val) bfin_write16(CAN0_MBRIF1, val)
2444#define bfin_read_CAN0_MBIM1() bfin_read16(CAN0_MBIM1)
2445#define bfin_write_CAN0_MBIM1(val) bfin_write16(CAN0_MBIM1, val)
2446#define bfin_read_CAN0_RFH1() bfin_read16(CAN0_RFH1)
2447#define bfin_write_CAN0_RFH1(val) bfin_write16(CAN0_RFH1, val)
2448#define bfin_read_CAN0_OPSS1() bfin_read16(CAN0_OPSS1)
2449#define bfin_write_CAN0_OPSS1(val) bfin_write16(CAN0_OPSS1, val)
2450
2451/* CAN Controller 0 Config 2 Registers */
2452
2453#define bfin_read_CAN0_MC2() bfin_read16(CAN0_MC2)
2454#define bfin_write_CAN0_MC2(val) bfin_write16(CAN0_MC2, val)
2455#define bfin_read_CAN0_MD2() bfin_read16(CAN0_MD2)
2456#define bfin_write_CAN0_MD2(val) bfin_write16(CAN0_MD2, val)
2457#define bfin_read_CAN0_TRS2() bfin_read16(CAN0_TRS2)
2458#define bfin_write_CAN0_TRS2(val) bfin_write16(CAN0_TRS2, val)
2459#define bfin_read_CAN0_TRR2() bfin_read16(CAN0_TRR2)
2460#define bfin_write_CAN0_TRR2(val) bfin_write16(CAN0_TRR2, val)
2461#define bfin_read_CAN0_TA2() bfin_read16(CAN0_TA2)
2462#define bfin_write_CAN0_TA2(val) bfin_write16(CAN0_TA2, val)
2463#define bfin_read_CAN0_AA2() bfin_read16(CAN0_AA2)
2464#define bfin_write_CAN0_AA2(val) bfin_write16(CAN0_AA2, val)
2465#define bfin_read_CAN0_RMP2() bfin_read16(CAN0_RMP2)
2466#define bfin_write_CAN0_RMP2(val) bfin_write16(CAN0_RMP2, val)
2467#define bfin_read_CAN0_RML2() bfin_read16(CAN0_RML2)
2468#define bfin_write_CAN0_RML2(val) bfin_write16(CAN0_RML2, val)
2469#define bfin_read_CAN0_MBTIF2() bfin_read16(CAN0_MBTIF2)
2470#define bfin_write_CAN0_MBTIF2(val) bfin_write16(CAN0_MBTIF2, val)
2471#define bfin_read_CAN0_MBRIF2() bfin_read16(CAN0_MBRIF2)
2472#define bfin_write_CAN0_MBRIF2(val) bfin_write16(CAN0_MBRIF2, val)
2473#define bfin_read_CAN0_MBIM2() bfin_read16(CAN0_MBIM2)
2474#define bfin_write_CAN0_MBIM2(val) bfin_write16(CAN0_MBIM2, val)
2475#define bfin_read_CAN0_RFH2() bfin_read16(CAN0_RFH2)
2476#define bfin_write_CAN0_RFH2(val) bfin_write16(CAN0_RFH2, val)
2477#define bfin_read_CAN0_OPSS2() bfin_read16(CAN0_OPSS2)
2478#define bfin_write_CAN0_OPSS2(val) bfin_write16(CAN0_OPSS2, val)
2479
2480/* CAN Controller 0 Clock/Interrubfin_read_()t/Counter Registers */
2481
2482#define bfin_read_CAN0_CLOCK() bfin_read16(CAN0_CLOCK)
2483#define bfin_write_CAN0_CLOCK(val) bfin_write16(CAN0_CLOCK, val)
2484#define bfin_read_CAN0_TIMING() bfin_read16(CAN0_TIMING)
2485#define bfin_write_CAN0_TIMING(val) bfin_write16(CAN0_TIMING, val)
2486#define bfin_read_CAN0_DEBUG() bfin_read16(CAN0_DEBUG)
2487#define bfin_write_CAN0_DEBUG(val) bfin_write16(CAN0_DEBUG, val)
2488#define bfin_read_CAN0_STATUS() bfin_read16(CAN0_STATUS)
2489#define bfin_write_CAN0_STATUS(val) bfin_write16(CAN0_STATUS, val)
2490#define bfin_read_CAN0_CEC() bfin_read16(CAN0_CEC)
2491#define bfin_write_CAN0_CEC(val) bfin_write16(CAN0_CEC, val)
2492#define bfin_read_CAN0_GIS() bfin_read16(CAN0_GIS)
2493#define bfin_write_CAN0_GIS(val) bfin_write16(CAN0_GIS, val)
2494#define bfin_read_CAN0_GIM() bfin_read16(CAN0_GIM)
2495#define bfin_write_CAN0_GIM(val) bfin_write16(CAN0_GIM, val)
2496#define bfin_read_CAN0_GIF() bfin_read16(CAN0_GIF)
2497#define bfin_write_CAN0_GIF(val) bfin_write16(CAN0_GIF, val)
2498#define bfin_read_CAN0_CONTROL() bfin_read16(CAN0_CONTROL)
2499#define bfin_write_CAN0_CONTROL(val) bfin_write16(CAN0_CONTROL, val)
2500#define bfin_read_CAN0_INTR() bfin_read16(CAN0_INTR)
2501#define bfin_write_CAN0_INTR(val) bfin_write16(CAN0_INTR, val)
2502#define bfin_read_CAN0_MBTD() bfin_read16(CAN0_MBTD)
2503#define bfin_write_CAN0_MBTD(val) bfin_write16(CAN0_MBTD, val)
2504#define bfin_read_CAN0_EWR() bfin_read16(CAN0_EWR)
2505#define bfin_write_CAN0_EWR(val) bfin_write16(CAN0_EWR, val)
2506#define bfin_read_CAN0_ESR() bfin_read16(CAN0_ESR)
2507#define bfin_write_CAN0_ESR(val) bfin_write16(CAN0_ESR, val)
2508#define bfin_read_CAN0_UCCNT() bfin_read16(CAN0_UCCNT)
2509#define bfin_write_CAN0_UCCNT(val) bfin_write16(CAN0_UCCNT, val)
2510#define bfin_read_CAN0_UCRC() bfin_read16(CAN0_UCRC)
2511#define bfin_write_CAN0_UCRC(val) bfin_write16(CAN0_UCRC, val)
2512#define bfin_read_CAN0_UCCNF() bfin_read16(CAN0_UCCNF)
2513#define bfin_write_CAN0_UCCNF(val) bfin_write16(CAN0_UCCNF, val)
2514
2515/* CAN Controller 0 Accebfin_read_()tance Registers */
2516
2517#define bfin_read_CAN0_AM00L() bfin_read16(CAN0_AM00L)
2518#define bfin_write_CAN0_AM00L(val) bfin_write16(CAN0_AM00L, val)
2519#define bfin_read_CAN0_AM00H() bfin_read16(CAN0_AM00H)
2520#define bfin_write_CAN0_AM00H(val) bfin_write16(CAN0_AM00H, val)
2521#define bfin_read_CAN0_AM01L() bfin_read16(CAN0_AM01L)
2522#define bfin_write_CAN0_AM01L(val) bfin_write16(CAN0_AM01L, val)
2523#define bfin_read_CAN0_AM01H() bfin_read16(CAN0_AM01H)
2524#define bfin_write_CAN0_AM01H(val) bfin_write16(CAN0_AM01H, val)
2525#define bfin_read_CAN0_AM02L() bfin_read16(CAN0_AM02L)
2526#define bfin_write_CAN0_AM02L(val) bfin_write16(CAN0_AM02L, val)
2527#define bfin_read_CAN0_AM02H() bfin_read16(CAN0_AM02H)
2528#define bfin_write_CAN0_AM02H(val) bfin_write16(CAN0_AM02H, val)
2529#define bfin_read_CAN0_AM03L() bfin_read16(CAN0_AM03L)
2530#define bfin_write_CAN0_AM03L(val) bfin_write16(CAN0_AM03L, val)
2531#define bfin_read_CAN0_AM03H() bfin_read16(CAN0_AM03H)
2532#define bfin_write_CAN0_AM03H(val) bfin_write16(CAN0_AM03H, val)
2533#define bfin_read_CAN0_AM04L() bfin_read16(CAN0_AM04L)
2534#define bfin_write_CAN0_AM04L(val) bfin_write16(CAN0_AM04L, val)
2535#define bfin_read_CAN0_AM04H() bfin_read16(CAN0_AM04H)
2536#define bfin_write_CAN0_AM04H(val) bfin_write16(CAN0_AM04H, val)
2537#define bfin_read_CAN0_AM05L() bfin_read16(CAN0_AM05L)
2538#define bfin_write_CAN0_AM05L(val) bfin_write16(CAN0_AM05L, val)
2539#define bfin_read_CAN0_AM05H() bfin_read16(CAN0_AM05H)
2540#define bfin_write_CAN0_AM05H(val) bfin_write16(CAN0_AM05H, val)
2541#define bfin_read_CAN0_AM06L() bfin_read16(CAN0_AM06L)
2542#define bfin_write_CAN0_AM06L(val) bfin_write16(CAN0_AM06L, val)
2543#define bfin_read_CAN0_AM06H() bfin_read16(CAN0_AM06H)
2544#define bfin_write_CAN0_AM06H(val) bfin_write16(CAN0_AM06H, val)
2545#define bfin_read_CAN0_AM07L() bfin_read16(CAN0_AM07L)
2546#define bfin_write_CAN0_AM07L(val) bfin_write16(CAN0_AM07L, val)
2547#define bfin_read_CAN0_AM07H() bfin_read16(CAN0_AM07H)
2548#define bfin_write_CAN0_AM07H(val) bfin_write16(CAN0_AM07H, val)
2549#define bfin_read_CAN0_AM08L() bfin_read16(CAN0_AM08L)
2550#define bfin_write_CAN0_AM08L(val) bfin_write16(CAN0_AM08L, val)
2551#define bfin_read_CAN0_AM08H() bfin_read16(CAN0_AM08H)
2552#define bfin_write_CAN0_AM08H(val) bfin_write16(CAN0_AM08H, val)
2553#define bfin_read_CAN0_AM09L() bfin_read16(CAN0_AM09L)
2554#define bfin_write_CAN0_AM09L(val) bfin_write16(CAN0_AM09L, val)
2555#define bfin_read_CAN0_AM09H() bfin_read16(CAN0_AM09H)
2556#define bfin_write_CAN0_AM09H(val) bfin_write16(CAN0_AM09H, val)
2557#define bfin_read_CAN0_AM10L() bfin_read16(CAN0_AM10L)
2558#define bfin_write_CAN0_AM10L(val) bfin_write16(CAN0_AM10L, val)
2559#define bfin_read_CAN0_AM10H() bfin_read16(CAN0_AM10H)
2560#define bfin_write_CAN0_AM10H(val) bfin_write16(CAN0_AM10H, val)
2561#define bfin_read_CAN0_AM11L() bfin_read16(CAN0_AM11L)
2562#define bfin_write_CAN0_AM11L(val) bfin_write16(CAN0_AM11L, val)
2563#define bfin_read_CAN0_AM11H() bfin_read16(CAN0_AM11H)
2564#define bfin_write_CAN0_AM11H(val) bfin_write16(CAN0_AM11H, val)
2565#define bfin_read_CAN0_AM12L() bfin_read16(CAN0_AM12L)
2566#define bfin_write_CAN0_AM12L(val) bfin_write16(CAN0_AM12L, val)
2567#define bfin_read_CAN0_AM12H() bfin_read16(CAN0_AM12H)
2568#define bfin_write_CAN0_AM12H(val) bfin_write16(CAN0_AM12H, val)
2569#define bfin_read_CAN0_AM13L() bfin_read16(CAN0_AM13L)
2570#define bfin_write_CAN0_AM13L(val) bfin_write16(CAN0_AM13L, val)
2571#define bfin_read_CAN0_AM13H() bfin_read16(CAN0_AM13H)
2572#define bfin_write_CAN0_AM13H(val) bfin_write16(CAN0_AM13H, val)
2573#define bfin_read_CAN0_AM14L() bfin_read16(CAN0_AM14L)
2574#define bfin_write_CAN0_AM14L(val) bfin_write16(CAN0_AM14L, val)
2575#define bfin_read_CAN0_AM14H() bfin_read16(CAN0_AM14H)
2576#define bfin_write_CAN0_AM14H(val) bfin_write16(CAN0_AM14H, val)
2577#define bfin_read_CAN0_AM15L() bfin_read16(CAN0_AM15L)
2578#define bfin_write_CAN0_AM15L(val) bfin_write16(CAN0_AM15L, val)
2579#define bfin_read_CAN0_AM15H() bfin_read16(CAN0_AM15H)
2580#define bfin_write_CAN0_AM15H(val) bfin_write16(CAN0_AM15H, val)
2581
2582/* CAN Controller 0 Accebfin_read_()tance Registers */
2583
2584#define bfin_read_CAN0_AM16L() bfin_read16(CAN0_AM16L)
2585#define bfin_write_CAN0_AM16L(val) bfin_write16(CAN0_AM16L, val)
2586#define bfin_read_CAN0_AM16H() bfin_read16(CAN0_AM16H)
2587#define bfin_write_CAN0_AM16H(val) bfin_write16(CAN0_AM16H, val)
2588#define bfin_read_CAN0_AM17L() bfin_read16(CAN0_AM17L)
2589#define bfin_write_CAN0_AM17L(val) bfin_write16(CAN0_AM17L, val)
2590#define bfin_read_CAN0_AM17H() bfin_read16(CAN0_AM17H)
2591#define bfin_write_CAN0_AM17H(val) bfin_write16(CAN0_AM17H, val)
2592#define bfin_read_CAN0_AM18L() bfin_read16(CAN0_AM18L)
2593#define bfin_write_CAN0_AM18L(val) bfin_write16(CAN0_AM18L, val)
2594#define bfin_read_CAN0_AM18H() bfin_read16(CAN0_AM18H)
2595#define bfin_write_CAN0_AM18H(val) bfin_write16(CAN0_AM18H, val)
2596#define bfin_read_CAN0_AM19L() bfin_read16(CAN0_AM19L)
2597#define bfin_write_CAN0_AM19L(val) bfin_write16(CAN0_AM19L, val)
2598#define bfin_read_CAN0_AM19H() bfin_read16(CAN0_AM19H)
2599#define bfin_write_CAN0_AM19H(val) bfin_write16(CAN0_AM19H, val)
2600#define bfin_read_CAN0_AM20L() bfin_read16(CAN0_AM20L)
2601#define bfin_write_CAN0_AM20L(val) bfin_write16(CAN0_AM20L, val)
2602#define bfin_read_CAN0_AM20H() bfin_read16(CAN0_AM20H)
2603#define bfin_write_CAN0_AM20H(val) bfin_write16(CAN0_AM20H, val)
2604#define bfin_read_CAN0_AM21L() bfin_read16(CAN0_AM21L)
2605#define bfin_write_CAN0_AM21L(val) bfin_write16(CAN0_AM21L, val)
2606#define bfin_read_CAN0_AM21H() bfin_read16(CAN0_AM21H)
2607#define bfin_write_CAN0_AM21H(val) bfin_write16(CAN0_AM21H, val)
2608#define bfin_read_CAN0_AM22L() bfin_read16(CAN0_AM22L)
2609#define bfin_write_CAN0_AM22L(val) bfin_write16(CAN0_AM22L, val)
2610#define bfin_read_CAN0_AM22H() bfin_read16(CAN0_AM22H)
2611#define bfin_write_CAN0_AM22H(val) bfin_write16(CAN0_AM22H, val)
2612#define bfin_read_CAN0_AM23L() bfin_read16(CAN0_AM23L)
2613#define bfin_write_CAN0_AM23L(val) bfin_write16(CAN0_AM23L, val)
2614#define bfin_read_CAN0_AM23H() bfin_read16(CAN0_AM23H)
2615#define bfin_write_CAN0_AM23H(val) bfin_write16(CAN0_AM23H, val)
2616#define bfin_read_CAN0_AM24L() bfin_read16(CAN0_AM24L)
2617#define bfin_write_CAN0_AM24L(val) bfin_write16(CAN0_AM24L, val)
2618#define bfin_read_CAN0_AM24H() bfin_read16(CAN0_AM24H)
2619#define bfin_write_CAN0_AM24H(val) bfin_write16(CAN0_AM24H, val)
2620#define bfin_read_CAN0_AM25L() bfin_read16(CAN0_AM25L)
2621#define bfin_write_CAN0_AM25L(val) bfin_write16(CAN0_AM25L, val)
2622#define bfin_read_CAN0_AM25H() bfin_read16(CAN0_AM25H)
2623#define bfin_write_CAN0_AM25H(val) bfin_write16(CAN0_AM25H, val)
2624#define bfin_read_CAN0_AM26L() bfin_read16(CAN0_AM26L)
2625#define bfin_write_CAN0_AM26L(val) bfin_write16(CAN0_AM26L, val)
2626#define bfin_read_CAN0_AM26H() bfin_read16(CAN0_AM26H)
2627#define bfin_write_CAN0_AM26H(val) bfin_write16(CAN0_AM26H, val)
2628#define bfin_read_CAN0_AM27L() bfin_read16(CAN0_AM27L)
2629#define bfin_write_CAN0_AM27L(val) bfin_write16(CAN0_AM27L, val)
2630#define bfin_read_CAN0_AM27H() bfin_read16(CAN0_AM27H)
2631#define bfin_write_CAN0_AM27H(val) bfin_write16(CAN0_AM27H, val)
2632#define bfin_read_CAN0_AM28L() bfin_read16(CAN0_AM28L)
2633#define bfin_write_CAN0_AM28L(val) bfin_write16(CAN0_AM28L, val)
2634#define bfin_read_CAN0_AM28H() bfin_read16(CAN0_AM28H)
2635#define bfin_write_CAN0_AM28H(val) bfin_write16(CAN0_AM28H, val)
2636#define bfin_read_CAN0_AM29L() bfin_read16(CAN0_AM29L)
2637#define bfin_write_CAN0_AM29L(val) bfin_write16(CAN0_AM29L, val)
2638#define bfin_read_CAN0_AM29H() bfin_read16(CAN0_AM29H)
2639#define bfin_write_CAN0_AM29H(val) bfin_write16(CAN0_AM29H, val)
2640#define bfin_read_CAN0_AM30L() bfin_read16(CAN0_AM30L)
2641#define bfin_write_CAN0_AM30L(val) bfin_write16(CAN0_AM30L, val)
2642#define bfin_read_CAN0_AM30H() bfin_read16(CAN0_AM30H)
2643#define bfin_write_CAN0_AM30H(val) bfin_write16(CAN0_AM30H, val)
2644#define bfin_read_CAN0_AM31L() bfin_read16(CAN0_AM31L)
2645#define bfin_write_CAN0_AM31L(val) bfin_write16(CAN0_AM31L, val)
2646#define bfin_read_CAN0_AM31H() bfin_read16(CAN0_AM31H)
2647#define bfin_write_CAN0_AM31H(val) bfin_write16(CAN0_AM31H, val)
2648
2649/* CAN Controller 0 Mailbox Data Registers */
2650
2651#define bfin_read_CAN0_MB00_DATA0() bfin_read16(CAN0_MB00_DATA0)
2652#define bfin_write_CAN0_MB00_DATA0(val) bfin_write16(CAN0_MB00_DATA0, val)
2653#define bfin_read_CAN0_MB00_DATA1() bfin_read16(CAN0_MB00_DATA1)
2654#define bfin_write_CAN0_MB00_DATA1(val) bfin_write16(CAN0_MB00_DATA1, val)
2655#define bfin_read_CAN0_MB00_DATA2() bfin_read16(CAN0_MB00_DATA2)
2656#define bfin_write_CAN0_MB00_DATA2(val) bfin_write16(CAN0_MB00_DATA2, val)
2657#define bfin_read_CAN0_MB00_DATA3() bfin_read16(CAN0_MB00_DATA3)
2658#define bfin_write_CAN0_MB00_DATA3(val) bfin_write16(CAN0_MB00_DATA3, val)
2659#define bfin_read_CAN0_MB00_LENGTH() bfin_read16(CAN0_MB00_LENGTH)
2660#define bfin_write_CAN0_MB00_LENGTH(val) bfin_write16(CAN0_MB00_LENGTH, val)
2661#define bfin_read_CAN0_MB00_TIMESTAMP() bfin_read16(CAN0_MB00_TIMESTAMP)
2662#define bfin_write_CAN0_MB00_TIMESTAMP(val) bfin_write16(CAN0_MB00_TIMESTAMP, val)
2663#define bfin_read_CAN0_MB00_ID0() bfin_read16(CAN0_MB00_ID0)
2664#define bfin_write_CAN0_MB00_ID0(val) bfin_write16(CAN0_MB00_ID0, val)
2665#define bfin_read_CAN0_MB00_ID1() bfin_read16(CAN0_MB00_ID1)
2666#define bfin_write_CAN0_MB00_ID1(val) bfin_write16(CAN0_MB00_ID1, val)
2667#define bfin_read_CAN0_MB01_DATA0() bfin_read16(CAN0_MB01_DATA0)
2668#define bfin_write_CAN0_MB01_DATA0(val) bfin_write16(CAN0_MB01_DATA0, val)
2669#define bfin_read_CAN0_MB01_DATA1() bfin_read16(CAN0_MB01_DATA1)
2670#define bfin_write_CAN0_MB01_DATA1(val) bfin_write16(CAN0_MB01_DATA1, val)
2671#define bfin_read_CAN0_MB01_DATA2() bfin_read16(CAN0_MB01_DATA2)
2672#define bfin_write_CAN0_MB01_DATA2(val) bfin_write16(CAN0_MB01_DATA2, val)
2673#define bfin_read_CAN0_MB01_DATA3() bfin_read16(CAN0_MB01_DATA3)
2674#define bfin_write_CAN0_MB01_DATA3(val) bfin_write16(CAN0_MB01_DATA3, val)
2675#define bfin_read_CAN0_MB01_LENGTH() bfin_read16(CAN0_MB01_LENGTH)
2676#define bfin_write_CAN0_MB01_LENGTH(val) bfin_write16(CAN0_MB01_LENGTH, val)
2677#define bfin_read_CAN0_MB01_TIMESTAMP() bfin_read16(CAN0_MB01_TIMESTAMP)
2678#define bfin_write_CAN0_MB01_TIMESTAMP(val) bfin_write16(CAN0_MB01_TIMESTAMP, val)
2679#define bfin_read_CAN0_MB01_ID0() bfin_read16(CAN0_MB01_ID0)
2680#define bfin_write_CAN0_MB01_ID0(val) bfin_write16(CAN0_MB01_ID0, val)
2681#define bfin_read_CAN0_MB01_ID1() bfin_read16(CAN0_MB01_ID1)
2682#define bfin_write_CAN0_MB01_ID1(val) bfin_write16(CAN0_MB01_ID1, val)
2683#define bfin_read_CAN0_MB02_DATA0() bfin_read16(CAN0_MB02_DATA0)
2684#define bfin_write_CAN0_MB02_DATA0(val) bfin_write16(CAN0_MB02_DATA0, val)
2685#define bfin_read_CAN0_MB02_DATA1() bfin_read16(CAN0_MB02_DATA1)
2686#define bfin_write_CAN0_MB02_DATA1(val) bfin_write16(CAN0_MB02_DATA1, val)
2687#define bfin_read_CAN0_MB02_DATA2() bfin_read16(CAN0_MB02_DATA2)
2688#define bfin_write_CAN0_MB02_DATA2(val) bfin_write16(CAN0_MB02_DATA2, val)
2689#define bfin_read_CAN0_MB02_DATA3() bfin_read16(CAN0_MB02_DATA3)
2690#define bfin_write_CAN0_MB02_DATA3(val) bfin_write16(CAN0_MB02_DATA3, val)
2691#define bfin_read_CAN0_MB02_LENGTH() bfin_read16(CAN0_MB02_LENGTH)
2692#define bfin_write_CAN0_MB02_LENGTH(val) bfin_write16(CAN0_MB02_LENGTH, val)
2693#define bfin_read_CAN0_MB02_TIMESTAMP() bfin_read16(CAN0_MB02_TIMESTAMP)
2694#define bfin_write_CAN0_MB02_TIMESTAMP(val) bfin_write16(CAN0_MB02_TIMESTAMP, val)
2695#define bfin_read_CAN0_MB02_ID0() bfin_read16(CAN0_MB02_ID0)
2696#define bfin_write_CAN0_MB02_ID0(val) bfin_write16(CAN0_MB02_ID0, val)
2697#define bfin_read_CAN0_MB02_ID1() bfin_read16(CAN0_MB02_ID1)
2698#define bfin_write_CAN0_MB02_ID1(val) bfin_write16(CAN0_MB02_ID1, val)
2699#define bfin_read_CAN0_MB03_DATA0() bfin_read16(CAN0_MB03_DATA0)
2700#define bfin_write_CAN0_MB03_DATA0(val) bfin_write16(CAN0_MB03_DATA0, val)
2701#define bfin_read_CAN0_MB03_DATA1() bfin_read16(CAN0_MB03_DATA1)
2702#define bfin_write_CAN0_MB03_DATA1(val) bfin_write16(CAN0_MB03_DATA1, val)
2703#define bfin_read_CAN0_MB03_DATA2() bfin_read16(CAN0_MB03_DATA2)
2704#define bfin_write_CAN0_MB03_DATA2(val) bfin_write16(CAN0_MB03_DATA2, val)
2705#define bfin_read_CAN0_MB03_DATA3() bfin_read16(CAN0_MB03_DATA3)
2706#define bfin_write_CAN0_MB03_DATA3(val) bfin_write16(CAN0_MB03_DATA3, val)
2707#define bfin_read_CAN0_MB03_LENGTH() bfin_read16(CAN0_MB03_LENGTH)
2708#define bfin_write_CAN0_MB03_LENGTH(val) bfin_write16(CAN0_MB03_LENGTH, val)
2709#define bfin_read_CAN0_MB03_TIMESTAMP() bfin_read16(CAN0_MB03_TIMESTAMP)
2710#define bfin_write_CAN0_MB03_TIMESTAMP(val) bfin_write16(CAN0_MB03_TIMESTAMP, val)
2711#define bfin_read_CAN0_MB03_ID0() bfin_read16(CAN0_MB03_ID0)
2712#define bfin_write_CAN0_MB03_ID0(val) bfin_write16(CAN0_MB03_ID0, val)
2713#define bfin_read_CAN0_MB03_ID1() bfin_read16(CAN0_MB03_ID1)
2714#define bfin_write_CAN0_MB03_ID1(val) bfin_write16(CAN0_MB03_ID1, val)
2715#define bfin_read_CAN0_MB04_DATA0() bfin_read16(CAN0_MB04_DATA0)
2716#define bfin_write_CAN0_MB04_DATA0(val) bfin_write16(CAN0_MB04_DATA0, val)
2717#define bfin_read_CAN0_MB04_DATA1() bfin_read16(CAN0_MB04_DATA1)
2718#define bfin_write_CAN0_MB04_DATA1(val) bfin_write16(CAN0_MB04_DATA1, val)
2719#define bfin_read_CAN0_MB04_DATA2() bfin_read16(CAN0_MB04_DATA2)
2720#define bfin_write_CAN0_MB04_DATA2(val) bfin_write16(CAN0_MB04_DATA2, val)
2721#define bfin_read_CAN0_MB04_DATA3() bfin_read16(CAN0_MB04_DATA3)
2722#define bfin_write_CAN0_MB04_DATA3(val) bfin_write16(CAN0_MB04_DATA3, val)
2723#define bfin_read_CAN0_MB04_LENGTH() bfin_read16(CAN0_MB04_LENGTH)
2724#define bfin_write_CAN0_MB04_LENGTH(val) bfin_write16(CAN0_MB04_LENGTH, val)
2725#define bfin_read_CAN0_MB04_TIMESTAMP() bfin_read16(CAN0_MB04_TIMESTAMP)
2726#define bfin_write_CAN0_MB04_TIMESTAMP(val) bfin_write16(CAN0_MB04_TIMESTAMP, val)
2727#define bfin_read_CAN0_MB04_ID0() bfin_read16(CAN0_MB04_ID0)
2728#define bfin_write_CAN0_MB04_ID0(val) bfin_write16(CAN0_MB04_ID0, val)
2729#define bfin_read_CAN0_MB04_ID1() bfin_read16(CAN0_MB04_ID1)
2730#define bfin_write_CAN0_MB04_ID1(val) bfin_write16(CAN0_MB04_ID1, val)
2731#define bfin_read_CAN0_MB05_DATA0() bfin_read16(CAN0_MB05_DATA0)
2732#define bfin_write_CAN0_MB05_DATA0(val) bfin_write16(CAN0_MB05_DATA0, val)
2733#define bfin_read_CAN0_MB05_DATA1() bfin_read16(CAN0_MB05_DATA1)
2734#define bfin_write_CAN0_MB05_DATA1(val) bfin_write16(CAN0_MB05_DATA1, val)
2735#define bfin_read_CAN0_MB05_DATA2() bfin_read16(CAN0_MB05_DATA2)
2736#define bfin_write_CAN0_MB05_DATA2(val) bfin_write16(CAN0_MB05_DATA2, val)
2737#define bfin_read_CAN0_MB05_DATA3() bfin_read16(CAN0_MB05_DATA3)
2738#define bfin_write_CAN0_MB05_DATA3(val) bfin_write16(CAN0_MB05_DATA3, val)
2739#define bfin_read_CAN0_MB05_LENGTH() bfin_read16(CAN0_MB05_LENGTH)
2740#define bfin_write_CAN0_MB05_LENGTH(val) bfin_write16(CAN0_MB05_LENGTH, val)
2741#define bfin_read_CAN0_MB05_TIMESTAMP() bfin_read16(CAN0_MB05_TIMESTAMP)
2742#define bfin_write_CAN0_MB05_TIMESTAMP(val) bfin_write16(CAN0_MB05_TIMESTAMP, val)
2743#define bfin_read_CAN0_MB05_ID0() bfin_read16(CAN0_MB05_ID0)
2744#define bfin_write_CAN0_MB05_ID0(val) bfin_write16(CAN0_MB05_ID0, val)
2745#define bfin_read_CAN0_MB05_ID1() bfin_read16(CAN0_MB05_ID1)
2746#define bfin_write_CAN0_MB05_ID1(val) bfin_write16(CAN0_MB05_ID1, val)
2747#define bfin_read_CAN0_MB06_DATA0() bfin_read16(CAN0_MB06_DATA0)
2748#define bfin_write_CAN0_MB06_DATA0(val) bfin_write16(CAN0_MB06_DATA0, val)
2749#define bfin_read_CAN0_MB06_DATA1() bfin_read16(CAN0_MB06_DATA1)
2750#define bfin_write_CAN0_MB06_DATA1(val) bfin_write16(CAN0_MB06_DATA1, val)
2751#define bfin_read_CAN0_MB06_DATA2() bfin_read16(CAN0_MB06_DATA2)
2752#define bfin_write_CAN0_MB06_DATA2(val) bfin_write16(CAN0_MB06_DATA2, val)
2753#define bfin_read_CAN0_MB06_DATA3() bfin_read16(CAN0_MB06_DATA3)
2754#define bfin_write_CAN0_MB06_DATA3(val) bfin_write16(CAN0_MB06_DATA3, val)
2755#define bfin_read_CAN0_MB06_LENGTH() bfin_read16(CAN0_MB06_LENGTH)
2756#define bfin_write_CAN0_MB06_LENGTH(val) bfin_write16(CAN0_MB06_LENGTH, val)
2757#define bfin_read_CAN0_MB06_TIMESTAMP() bfin_read16(CAN0_MB06_TIMESTAMP)
2758#define bfin_write_CAN0_MB06_TIMESTAMP(val) bfin_write16(CAN0_MB06_TIMESTAMP, val)
2759#define bfin_read_CAN0_MB06_ID0() bfin_read16(CAN0_MB06_ID0)
2760#define bfin_write_CAN0_MB06_ID0(val) bfin_write16(CAN0_MB06_ID0, val)
2761#define bfin_read_CAN0_MB06_ID1() bfin_read16(CAN0_MB06_ID1)
2762#define bfin_write_CAN0_MB06_ID1(val) bfin_write16(CAN0_MB06_ID1, val)
2763#define bfin_read_CAN0_MB07_DATA0() bfin_read16(CAN0_MB07_DATA0)
2764#define bfin_write_CAN0_MB07_DATA0(val) bfin_write16(CAN0_MB07_DATA0, val)
2765#define bfin_read_CAN0_MB07_DATA1() bfin_read16(CAN0_MB07_DATA1)
2766#define bfin_write_CAN0_MB07_DATA1(val) bfin_write16(CAN0_MB07_DATA1, val)
2767#define bfin_read_CAN0_MB07_DATA2() bfin_read16(CAN0_MB07_DATA2)
2768#define bfin_write_CAN0_MB07_DATA2(val) bfin_write16(CAN0_MB07_DATA2, val)
2769#define bfin_read_CAN0_MB07_DATA3() bfin_read16(CAN0_MB07_DATA3)
2770#define bfin_write_CAN0_MB07_DATA3(val) bfin_write16(CAN0_MB07_DATA3, val)
2771#define bfin_read_CAN0_MB07_LENGTH() bfin_read16(CAN0_MB07_LENGTH)
2772#define bfin_write_CAN0_MB07_LENGTH(val) bfin_write16(CAN0_MB07_LENGTH, val)
2773#define bfin_read_CAN0_MB07_TIMESTAMP() bfin_read16(CAN0_MB07_TIMESTAMP)
2774#define bfin_write_CAN0_MB07_TIMESTAMP(val) bfin_write16(CAN0_MB07_TIMESTAMP, val)
2775#define bfin_read_CAN0_MB07_ID0() bfin_read16(CAN0_MB07_ID0)
2776#define bfin_write_CAN0_MB07_ID0(val) bfin_write16(CAN0_MB07_ID0, val)
2777#define bfin_read_CAN0_MB07_ID1() bfin_read16(CAN0_MB07_ID1)
2778#define bfin_write_CAN0_MB07_ID1(val) bfin_write16(CAN0_MB07_ID1, val)
2779#define bfin_read_CAN0_MB08_DATA0() bfin_read16(CAN0_MB08_DATA0)
2780#define bfin_write_CAN0_MB08_DATA0(val) bfin_write16(CAN0_MB08_DATA0, val)
2781#define bfin_read_CAN0_MB08_DATA1() bfin_read16(CAN0_MB08_DATA1)
2782#define bfin_write_CAN0_MB08_DATA1(val) bfin_write16(CAN0_MB08_DATA1, val)
2783#define bfin_read_CAN0_MB08_DATA2() bfin_read16(CAN0_MB08_DATA2)
2784#define bfin_write_CAN0_MB08_DATA2(val) bfin_write16(CAN0_MB08_DATA2, val)
2785#define bfin_read_CAN0_MB08_DATA3() bfin_read16(CAN0_MB08_DATA3)
2786#define bfin_write_CAN0_MB08_DATA3(val) bfin_write16(CAN0_MB08_DATA3, val)
2787#define bfin_read_CAN0_MB08_LENGTH() bfin_read16(CAN0_MB08_LENGTH)
2788#define bfin_write_CAN0_MB08_LENGTH(val) bfin_write16(CAN0_MB08_LENGTH, val)
2789#define bfin_read_CAN0_MB08_TIMESTAMP() bfin_read16(CAN0_MB08_TIMESTAMP)
2790#define bfin_write_CAN0_MB08_TIMESTAMP(val) bfin_write16(CAN0_MB08_TIMESTAMP, val)
2791#define bfin_read_CAN0_MB08_ID0() bfin_read16(CAN0_MB08_ID0)
2792#define bfin_write_CAN0_MB08_ID0(val) bfin_write16(CAN0_MB08_ID0, val)
2793#define bfin_read_CAN0_MB08_ID1() bfin_read16(CAN0_MB08_ID1)
2794#define bfin_write_CAN0_MB08_ID1(val) bfin_write16(CAN0_MB08_ID1, val)
2795#define bfin_read_CAN0_MB09_DATA0() bfin_read16(CAN0_MB09_DATA0)
2796#define bfin_write_CAN0_MB09_DATA0(val) bfin_write16(CAN0_MB09_DATA0, val)
2797#define bfin_read_CAN0_MB09_DATA1() bfin_read16(CAN0_MB09_DATA1)
2798#define bfin_write_CAN0_MB09_DATA1(val) bfin_write16(CAN0_MB09_DATA1, val)
2799#define bfin_read_CAN0_MB09_DATA2() bfin_read16(CAN0_MB09_DATA2)
2800#define bfin_write_CAN0_MB09_DATA2(val) bfin_write16(CAN0_MB09_DATA2, val)
2801#define bfin_read_CAN0_MB09_DATA3() bfin_read16(CAN0_MB09_DATA3)
2802#define bfin_write_CAN0_MB09_DATA3(val) bfin_write16(CAN0_MB09_DATA3, val)
2803#define bfin_read_CAN0_MB09_LENGTH() bfin_read16(CAN0_MB09_LENGTH)
2804#define bfin_write_CAN0_MB09_LENGTH(val) bfin_write16(CAN0_MB09_LENGTH, val)
2805#define bfin_read_CAN0_MB09_TIMESTAMP() bfin_read16(CAN0_MB09_TIMESTAMP)
2806#define bfin_write_CAN0_MB09_TIMESTAMP(val) bfin_write16(CAN0_MB09_TIMESTAMP, val)
2807#define bfin_read_CAN0_MB09_ID0() bfin_read16(CAN0_MB09_ID0)
2808#define bfin_write_CAN0_MB09_ID0(val) bfin_write16(CAN0_MB09_ID0, val)
2809#define bfin_read_CAN0_MB09_ID1() bfin_read16(CAN0_MB09_ID1)
2810#define bfin_write_CAN0_MB09_ID1(val) bfin_write16(CAN0_MB09_ID1, val)
2811#define bfin_read_CAN0_MB10_DATA0() bfin_read16(CAN0_MB10_DATA0)
2812#define bfin_write_CAN0_MB10_DATA0(val) bfin_write16(CAN0_MB10_DATA0, val)
2813#define bfin_read_CAN0_MB10_DATA1() bfin_read16(CAN0_MB10_DATA1)
2814#define bfin_write_CAN0_MB10_DATA1(val) bfin_write16(CAN0_MB10_DATA1, val)
2815#define bfin_read_CAN0_MB10_DATA2() bfin_read16(CAN0_MB10_DATA2)
2816#define bfin_write_CAN0_MB10_DATA2(val) bfin_write16(CAN0_MB10_DATA2, val)
2817#define bfin_read_CAN0_MB10_DATA3() bfin_read16(CAN0_MB10_DATA3)
2818#define bfin_write_CAN0_MB10_DATA3(val) bfin_write16(CAN0_MB10_DATA3, val)
2819#define bfin_read_CAN0_MB10_LENGTH() bfin_read16(CAN0_MB10_LENGTH)
2820#define bfin_write_CAN0_MB10_LENGTH(val) bfin_write16(CAN0_MB10_LENGTH, val)
2821#define bfin_read_CAN0_MB10_TIMESTAMP() bfin_read16(CAN0_MB10_TIMESTAMP)
2822#define bfin_write_CAN0_MB10_TIMESTAMP(val) bfin_write16(CAN0_MB10_TIMESTAMP, val)
2823#define bfin_read_CAN0_MB10_ID0() bfin_read16(CAN0_MB10_ID0)
2824#define bfin_write_CAN0_MB10_ID0(val) bfin_write16(CAN0_MB10_ID0, val)
2825#define bfin_read_CAN0_MB10_ID1() bfin_read16(CAN0_MB10_ID1)
2826#define bfin_write_CAN0_MB10_ID1(val) bfin_write16(CAN0_MB10_ID1, val)
2827#define bfin_read_CAN0_MB11_DATA0() bfin_read16(CAN0_MB11_DATA0)
2828#define bfin_write_CAN0_MB11_DATA0(val) bfin_write16(CAN0_MB11_DATA0, val)
2829#define bfin_read_CAN0_MB11_DATA1() bfin_read16(CAN0_MB11_DATA1)
2830#define bfin_write_CAN0_MB11_DATA1(val) bfin_write16(CAN0_MB11_DATA1, val)
2831#define bfin_read_CAN0_MB11_DATA2() bfin_read16(CAN0_MB11_DATA2)
2832#define bfin_write_CAN0_MB11_DATA2(val) bfin_write16(CAN0_MB11_DATA2, val)
2833#define bfin_read_CAN0_MB11_DATA3() bfin_read16(CAN0_MB11_DATA3)
2834#define bfin_write_CAN0_MB11_DATA3(val) bfin_write16(CAN0_MB11_DATA3, val)
2835#define bfin_read_CAN0_MB11_LENGTH() bfin_read16(CAN0_MB11_LENGTH)
2836#define bfin_write_CAN0_MB11_LENGTH(val) bfin_write16(CAN0_MB11_LENGTH, val)
2837#define bfin_read_CAN0_MB11_TIMESTAMP() bfin_read16(CAN0_MB11_TIMESTAMP)
2838#define bfin_write_CAN0_MB11_TIMESTAMP(val) bfin_write16(CAN0_MB11_TIMESTAMP, val)
2839#define bfin_read_CAN0_MB11_ID0() bfin_read16(CAN0_MB11_ID0)
2840#define bfin_write_CAN0_MB11_ID0(val) bfin_write16(CAN0_MB11_ID0, val)
2841#define bfin_read_CAN0_MB11_ID1() bfin_read16(CAN0_MB11_ID1)
2842#define bfin_write_CAN0_MB11_ID1(val) bfin_write16(CAN0_MB11_ID1, val)
2843#define bfin_read_CAN0_MB12_DATA0() bfin_read16(CAN0_MB12_DATA0)
2844#define bfin_write_CAN0_MB12_DATA0(val) bfin_write16(CAN0_MB12_DATA0, val)
2845#define bfin_read_CAN0_MB12_DATA1() bfin_read16(CAN0_MB12_DATA1)
2846#define bfin_write_CAN0_MB12_DATA1(val) bfin_write16(CAN0_MB12_DATA1, val)
2847#define bfin_read_CAN0_MB12_DATA2() bfin_read16(CAN0_MB12_DATA2)
2848#define bfin_write_CAN0_MB12_DATA2(val) bfin_write16(CAN0_MB12_DATA2, val)
2849#define bfin_read_CAN0_MB12_DATA3() bfin_read16(CAN0_MB12_DATA3)
2850#define bfin_write_CAN0_MB12_DATA3(val) bfin_write16(CAN0_MB12_DATA3, val)
2851#define bfin_read_CAN0_MB12_LENGTH() bfin_read16(CAN0_MB12_LENGTH)
2852#define bfin_write_CAN0_MB12_LENGTH(val) bfin_write16(CAN0_MB12_LENGTH, val)
2853#define bfin_read_CAN0_MB12_TIMESTAMP() bfin_read16(CAN0_MB12_TIMESTAMP)
2854#define bfin_write_CAN0_MB12_TIMESTAMP(val) bfin_write16(CAN0_MB12_TIMESTAMP, val)
2855#define bfin_read_CAN0_MB12_ID0() bfin_read16(CAN0_MB12_ID0)
2856#define bfin_write_CAN0_MB12_ID0(val) bfin_write16(CAN0_MB12_ID0, val)
2857#define bfin_read_CAN0_MB12_ID1() bfin_read16(CAN0_MB12_ID1)
2858#define bfin_write_CAN0_MB12_ID1(val) bfin_write16(CAN0_MB12_ID1, val)
2859#define bfin_read_CAN0_MB13_DATA0() bfin_read16(CAN0_MB13_DATA0)
2860#define bfin_write_CAN0_MB13_DATA0(val) bfin_write16(CAN0_MB13_DATA0, val)
2861#define bfin_read_CAN0_MB13_DATA1() bfin_read16(CAN0_MB13_DATA1)
2862#define bfin_write_CAN0_MB13_DATA1(val) bfin_write16(CAN0_MB13_DATA1, val)
2863#define bfin_read_CAN0_MB13_DATA2() bfin_read16(CAN0_MB13_DATA2)
2864#define bfin_write_CAN0_MB13_DATA2(val) bfin_write16(CAN0_MB13_DATA2, val)
2865#define bfin_read_CAN0_MB13_DATA3() bfin_read16(CAN0_MB13_DATA3)
2866#define bfin_write_CAN0_MB13_DATA3(val) bfin_write16(CAN0_MB13_DATA3, val)
2867#define bfin_read_CAN0_MB13_LENGTH() bfin_read16(CAN0_MB13_LENGTH)
2868#define bfin_write_CAN0_MB13_LENGTH(val) bfin_write16(CAN0_MB13_LENGTH, val)
2869#define bfin_read_CAN0_MB13_TIMESTAMP() bfin_read16(CAN0_MB13_TIMESTAMP)
2870#define bfin_write_CAN0_MB13_TIMESTAMP(val) bfin_write16(CAN0_MB13_TIMESTAMP, val)
2871#define bfin_read_CAN0_MB13_ID0() bfin_read16(CAN0_MB13_ID0)
2872#define bfin_write_CAN0_MB13_ID0(val) bfin_write16(CAN0_MB13_ID0, val)
2873#define bfin_read_CAN0_MB13_ID1() bfin_read16(CAN0_MB13_ID1)
2874#define bfin_write_CAN0_MB13_ID1(val) bfin_write16(CAN0_MB13_ID1, val)
2875#define bfin_read_CAN0_MB14_DATA0() bfin_read16(CAN0_MB14_DATA0)
2876#define bfin_write_CAN0_MB14_DATA0(val) bfin_write16(CAN0_MB14_DATA0, val)
2877#define bfin_read_CAN0_MB14_DATA1() bfin_read16(CAN0_MB14_DATA1)
2878#define bfin_write_CAN0_MB14_DATA1(val) bfin_write16(CAN0_MB14_DATA1, val)
2879#define bfin_read_CAN0_MB14_DATA2() bfin_read16(CAN0_MB14_DATA2)
2880#define bfin_write_CAN0_MB14_DATA2(val) bfin_write16(CAN0_MB14_DATA2, val)
2881#define bfin_read_CAN0_MB14_DATA3() bfin_read16(CAN0_MB14_DATA3)
2882#define bfin_write_CAN0_MB14_DATA3(val) bfin_write16(CAN0_MB14_DATA3, val)
2883#define bfin_read_CAN0_MB14_LENGTH() bfin_read16(CAN0_MB14_LENGTH)
2884#define bfin_write_CAN0_MB14_LENGTH(val) bfin_write16(CAN0_MB14_LENGTH, val)
2885#define bfin_read_CAN0_MB14_TIMESTAMP() bfin_read16(CAN0_MB14_TIMESTAMP)
2886#define bfin_write_CAN0_MB14_TIMESTAMP(val) bfin_write16(CAN0_MB14_TIMESTAMP, val)
2887#define bfin_read_CAN0_MB14_ID0() bfin_read16(CAN0_MB14_ID0)
2888#define bfin_write_CAN0_MB14_ID0(val) bfin_write16(CAN0_MB14_ID0, val)
2889#define bfin_read_CAN0_MB14_ID1() bfin_read16(CAN0_MB14_ID1)
2890#define bfin_write_CAN0_MB14_ID1(val) bfin_write16(CAN0_MB14_ID1, val)
2891#define bfin_read_CAN0_MB15_DATA0() bfin_read16(CAN0_MB15_DATA0)
2892#define bfin_write_CAN0_MB15_DATA0(val) bfin_write16(CAN0_MB15_DATA0, val)
2893#define bfin_read_CAN0_MB15_DATA1() bfin_read16(CAN0_MB15_DATA1)
2894#define bfin_write_CAN0_MB15_DATA1(val) bfin_write16(CAN0_MB15_DATA1, val)
2895#define bfin_read_CAN0_MB15_DATA2() bfin_read16(CAN0_MB15_DATA2)
2896#define bfin_write_CAN0_MB15_DATA2(val) bfin_write16(CAN0_MB15_DATA2, val)
2897#define bfin_read_CAN0_MB15_DATA3() bfin_read16(CAN0_MB15_DATA3)
2898#define bfin_write_CAN0_MB15_DATA3(val) bfin_write16(CAN0_MB15_DATA3, val)
2899#define bfin_read_CAN0_MB15_LENGTH() bfin_read16(CAN0_MB15_LENGTH)
2900#define bfin_write_CAN0_MB15_LENGTH(val) bfin_write16(CAN0_MB15_LENGTH, val)
2901#define bfin_read_CAN0_MB15_TIMESTAMP() bfin_read16(CAN0_MB15_TIMESTAMP)
2902#define bfin_write_CAN0_MB15_TIMESTAMP(val) bfin_write16(CAN0_MB15_TIMESTAMP, val)
2903#define bfin_read_CAN0_MB15_ID0() bfin_read16(CAN0_MB15_ID0)
2904#define bfin_write_CAN0_MB15_ID0(val) bfin_write16(CAN0_MB15_ID0, val)
2905#define bfin_read_CAN0_MB15_ID1() bfin_read16(CAN0_MB15_ID1)
2906#define bfin_write_CAN0_MB15_ID1(val) bfin_write16(CAN0_MB15_ID1, val)
2907
2908/* CAN Controller 0 Mailbox Data Registers */
2909
2910#define bfin_read_CAN0_MB16_DATA0() bfin_read16(CAN0_MB16_DATA0)
2911#define bfin_write_CAN0_MB16_DATA0(val) bfin_write16(CAN0_MB16_DATA0, val)
2912#define bfin_read_CAN0_MB16_DATA1() bfin_read16(CAN0_MB16_DATA1)
2913#define bfin_write_CAN0_MB16_DATA1(val) bfin_write16(CAN0_MB16_DATA1, val)
2914#define bfin_read_CAN0_MB16_DATA2() bfin_read16(CAN0_MB16_DATA2)
2915#define bfin_write_CAN0_MB16_DATA2(val) bfin_write16(CAN0_MB16_DATA2, val)
2916#define bfin_read_CAN0_MB16_DATA3() bfin_read16(CAN0_MB16_DATA3)
2917#define bfin_write_CAN0_MB16_DATA3(val) bfin_write16(CAN0_MB16_DATA3, val)
2918#define bfin_read_CAN0_MB16_LENGTH() bfin_read16(CAN0_MB16_LENGTH)
2919#define bfin_write_CAN0_MB16_LENGTH(val) bfin_write16(CAN0_MB16_LENGTH, val)
2920#define bfin_read_CAN0_MB16_TIMESTAMP() bfin_read16(CAN0_MB16_TIMESTAMP)
2921#define bfin_write_CAN0_MB16_TIMESTAMP(val) bfin_write16(CAN0_MB16_TIMESTAMP, val)
2922#define bfin_read_CAN0_MB16_ID0() bfin_read16(CAN0_MB16_ID0)
2923#define bfin_write_CAN0_MB16_ID0(val) bfin_write16(CAN0_MB16_ID0, val)
2924#define bfin_read_CAN0_MB16_ID1() bfin_read16(CAN0_MB16_ID1)
2925#define bfin_write_CAN0_MB16_ID1(val) bfin_write16(CAN0_MB16_ID1, val)
2926#define bfin_read_CAN0_MB17_DATA0() bfin_read16(CAN0_MB17_DATA0)
2927#define bfin_write_CAN0_MB17_DATA0(val) bfin_write16(CAN0_MB17_DATA0, val)
2928#define bfin_read_CAN0_MB17_DATA1() bfin_read16(CAN0_MB17_DATA1)
2929#define bfin_write_CAN0_MB17_DATA1(val) bfin_write16(CAN0_MB17_DATA1, val)
2930#define bfin_read_CAN0_MB17_DATA2() bfin_read16(CAN0_MB17_DATA2)
2931#define bfin_write_CAN0_MB17_DATA2(val) bfin_write16(CAN0_MB17_DATA2, val)
2932#define bfin_read_CAN0_MB17_DATA3() bfin_read16(CAN0_MB17_DATA3)
2933#define bfin_write_CAN0_MB17_DATA3(val) bfin_write16(CAN0_MB17_DATA3, val)
2934#define bfin_read_CAN0_MB17_LENGTH() bfin_read16(CAN0_MB17_LENGTH)
2935#define bfin_write_CAN0_MB17_LENGTH(val) bfin_write16(CAN0_MB17_LENGTH, val)
2936#define bfin_read_CAN0_MB17_TIMESTAMP() bfin_read16(CAN0_MB17_TIMESTAMP)
2937#define bfin_write_CAN0_MB17_TIMESTAMP(val) bfin_write16(CAN0_MB17_TIMESTAMP, val)
2938#define bfin_read_CAN0_MB17_ID0() bfin_read16(CAN0_MB17_ID0)
2939#define bfin_write_CAN0_MB17_ID0(val) bfin_write16(CAN0_MB17_ID0, val)
2940#define bfin_read_CAN0_MB17_ID1() bfin_read16(CAN0_MB17_ID1)
2941#define bfin_write_CAN0_MB17_ID1(val) bfin_write16(CAN0_MB17_ID1, val)
2942#define bfin_read_CAN0_MB18_DATA0() bfin_read16(CAN0_MB18_DATA0)
2943#define bfin_write_CAN0_MB18_DATA0(val) bfin_write16(CAN0_MB18_DATA0, val)
2944#define bfin_read_CAN0_MB18_DATA1() bfin_read16(CAN0_MB18_DATA1)
2945#define bfin_write_CAN0_MB18_DATA1(val) bfin_write16(CAN0_MB18_DATA1, val)
2946#define bfin_read_CAN0_MB18_DATA2() bfin_read16(CAN0_MB18_DATA2)
2947#define bfin_write_CAN0_MB18_DATA2(val) bfin_write16(CAN0_MB18_DATA2, val)
2948#define bfin_read_CAN0_MB18_DATA3() bfin_read16(CAN0_MB18_DATA3)
2949#define bfin_write_CAN0_MB18_DATA3(val) bfin_write16(CAN0_MB18_DATA3, val)
2950#define bfin_read_CAN0_MB18_LENGTH() bfin_read16(CAN0_MB18_LENGTH)
2951#define bfin_write_CAN0_MB18_LENGTH(val) bfin_write16(CAN0_MB18_LENGTH, val)
2952#define bfin_read_CAN0_MB18_TIMESTAMP() bfin_read16(CAN0_MB18_TIMESTAMP)
2953#define bfin_write_CAN0_MB18_TIMESTAMP(val) bfin_write16(CAN0_MB18_TIMESTAMP, val)
2954#define bfin_read_CAN0_MB18_ID0() bfin_read16(CAN0_MB18_ID0)
2955#define bfin_write_CAN0_MB18_ID0(val) bfin_write16(CAN0_MB18_ID0, val)
2956#define bfin_read_CAN0_MB18_ID1() bfin_read16(CAN0_MB18_ID1)
2957#define bfin_write_CAN0_MB18_ID1(val) bfin_write16(CAN0_MB18_ID1, val)
2958#define bfin_read_CAN0_MB19_DATA0() bfin_read16(CAN0_MB19_DATA0)
2959#define bfin_write_CAN0_MB19_DATA0(val) bfin_write16(CAN0_MB19_DATA0, val)
2960#define bfin_read_CAN0_MB19_DATA1() bfin_read16(CAN0_MB19_DATA1)
2961#define bfin_write_CAN0_MB19_DATA1(val) bfin_write16(CAN0_MB19_DATA1, val)
2962#define bfin_read_CAN0_MB19_DATA2() bfin_read16(CAN0_MB19_DATA2)
2963#define bfin_write_CAN0_MB19_DATA2(val) bfin_write16(CAN0_MB19_DATA2, val)
2964#define bfin_read_CAN0_MB19_DATA3() bfin_read16(CAN0_MB19_DATA3)
2965#define bfin_write_CAN0_MB19_DATA3(val) bfin_write16(CAN0_MB19_DATA3, val)
2966#define bfin_read_CAN0_MB19_LENGTH() bfin_read16(CAN0_MB19_LENGTH)
2967#define bfin_write_CAN0_MB19_LENGTH(val) bfin_write16(CAN0_MB19_LENGTH, val)
2968#define bfin_read_CAN0_MB19_TIMESTAMP() bfin_read16(CAN0_MB19_TIMESTAMP)
2969#define bfin_write_CAN0_MB19_TIMESTAMP(val) bfin_write16(CAN0_MB19_TIMESTAMP, val)
2970#define bfin_read_CAN0_MB19_ID0() bfin_read16(CAN0_MB19_ID0)
2971#define bfin_write_CAN0_MB19_ID0(val) bfin_write16(CAN0_MB19_ID0, val)
2972#define bfin_read_CAN0_MB19_ID1() bfin_read16(CAN0_MB19_ID1)
2973#define bfin_write_CAN0_MB19_ID1(val) bfin_write16(CAN0_MB19_ID1, val)
2974#define bfin_read_CAN0_MB20_DATA0() bfin_read16(CAN0_MB20_DATA0)
2975#define bfin_write_CAN0_MB20_DATA0(val) bfin_write16(CAN0_MB20_DATA0, val)
2976#define bfin_read_CAN0_MB20_DATA1() bfin_read16(CAN0_MB20_DATA1)
2977#define bfin_write_CAN0_MB20_DATA1(val) bfin_write16(CAN0_MB20_DATA1, val)
2978#define bfin_read_CAN0_MB20_DATA2() bfin_read16(CAN0_MB20_DATA2)
2979#define bfin_write_CAN0_MB20_DATA2(val) bfin_write16(CAN0_MB20_DATA2, val)
2980#define bfin_read_CAN0_MB20_DATA3() bfin_read16(CAN0_MB20_DATA3)
2981#define bfin_write_CAN0_MB20_DATA3(val) bfin_write16(CAN0_MB20_DATA3, val)
2982#define bfin_read_CAN0_MB20_LENGTH() bfin_read16(CAN0_MB20_LENGTH)
2983#define bfin_write_CAN0_MB20_LENGTH(val) bfin_write16(CAN0_MB20_LENGTH, val)
2984#define bfin_read_CAN0_MB20_TIMESTAMP() bfin_read16(CAN0_MB20_TIMESTAMP)
2985#define bfin_write_CAN0_MB20_TIMESTAMP(val) bfin_write16(CAN0_MB20_TIMESTAMP, val)
2986#define bfin_read_CAN0_MB20_ID0() bfin_read16(CAN0_MB20_ID0)
2987#define bfin_write_CAN0_MB20_ID0(val) bfin_write16(CAN0_MB20_ID0, val)
2988#define bfin_read_CAN0_MB20_ID1() bfin_read16(CAN0_MB20_ID1)
2989#define bfin_write_CAN0_MB20_ID1(val) bfin_write16(CAN0_MB20_ID1, val)
2990#define bfin_read_CAN0_MB21_DATA0() bfin_read16(CAN0_MB21_DATA0)
2991#define bfin_write_CAN0_MB21_DATA0(val) bfin_write16(CAN0_MB21_DATA0, val)
2992#define bfin_read_CAN0_MB21_DATA1() bfin_read16(CAN0_MB21_DATA1)
2993#define bfin_write_CAN0_MB21_DATA1(val) bfin_write16(CAN0_MB21_DATA1, val)
2994#define bfin_read_CAN0_MB21_DATA2() bfin_read16(CAN0_MB21_DATA2)
2995#define bfin_write_CAN0_MB21_DATA2(val) bfin_write16(CAN0_MB21_DATA2, val)
2996#define bfin_read_CAN0_MB21_DATA3() bfin_read16(CAN0_MB21_DATA3)
2997#define bfin_write_CAN0_MB21_DATA3(val) bfin_write16(CAN0_MB21_DATA3, val)
2998#define bfin_read_CAN0_MB21_LENGTH() bfin_read16(CAN0_MB21_LENGTH)
2999#define bfin_write_CAN0_MB21_LENGTH(val) bfin_write16(CAN0_MB21_LENGTH, val)
3000#define bfin_read_CAN0_MB21_TIMESTAMP() bfin_read16(CAN0_MB21_TIMESTAMP)
3001#define bfin_write_CAN0_MB21_TIMESTAMP(val) bfin_write16(CAN0_MB21_TIMESTAMP, val)
3002#define bfin_read_CAN0_MB21_ID0() bfin_read16(CAN0_MB21_ID0)
3003#define bfin_write_CAN0_MB21_ID0(val) bfin_write16(CAN0_MB21_ID0, val)
3004#define bfin_read_CAN0_MB21_ID1() bfin_read16(CAN0_MB21_ID1)
3005#define bfin_write_CAN0_MB21_ID1(val) bfin_write16(CAN0_MB21_ID1, val)
3006#define bfin_read_CAN0_MB22_DATA0() bfin_read16(CAN0_MB22_DATA0)
3007#define bfin_write_CAN0_MB22_DATA0(val) bfin_write16(CAN0_MB22_DATA0, val)
3008#define bfin_read_CAN0_MB22_DATA1() bfin_read16(CAN0_MB22_DATA1)
3009#define bfin_write_CAN0_MB22_DATA1(val) bfin_write16(CAN0_MB22_DATA1, val)
3010#define bfin_read_CAN0_MB22_DATA2() bfin_read16(CAN0_MB22_DATA2)
3011#define bfin_write_CAN0_MB22_DATA2(val) bfin_write16(CAN0_MB22_DATA2, val)
3012#define bfin_read_CAN0_MB22_DATA3() bfin_read16(CAN0_MB22_DATA3)
3013#define bfin_write_CAN0_MB22_DATA3(val) bfin_write16(CAN0_MB22_DATA3, val)
3014#define bfin_read_CAN0_MB22_LENGTH() bfin_read16(CAN0_MB22_LENGTH)
3015#define bfin_write_CAN0_MB22_LENGTH(val) bfin_write16(CAN0_MB22_LENGTH, val)
3016#define bfin_read_CAN0_MB22_TIMESTAMP() bfin_read16(CAN0_MB22_TIMESTAMP)
3017#define bfin_write_CAN0_MB22_TIMESTAMP(val) bfin_write16(CAN0_MB22_TIMESTAMP, val)
3018#define bfin_read_CAN0_MB22_ID0() bfin_read16(CAN0_MB22_ID0)
3019#define bfin_write_CAN0_MB22_ID0(val) bfin_write16(CAN0_MB22_ID0, val)
3020#define bfin_read_CAN0_MB22_ID1() bfin_read16(CAN0_MB22_ID1)
3021#define bfin_write_CAN0_MB22_ID1(val) bfin_write16(CAN0_MB22_ID1, val)
3022#define bfin_read_CAN0_MB23_DATA0() bfin_read16(CAN0_MB23_DATA0)
3023#define bfin_write_CAN0_MB23_DATA0(val) bfin_write16(CAN0_MB23_DATA0, val)
3024#define bfin_read_CAN0_MB23_DATA1() bfin_read16(CAN0_MB23_DATA1)
3025#define bfin_write_CAN0_MB23_DATA1(val) bfin_write16(CAN0_MB23_DATA1, val)
3026#define bfin_read_CAN0_MB23_DATA2() bfin_read16(CAN0_MB23_DATA2)
3027#define bfin_write_CAN0_MB23_DATA2(val) bfin_write16(CAN0_MB23_DATA2, val)
3028#define bfin_read_CAN0_MB23_DATA3() bfin_read16(CAN0_MB23_DATA3)
3029#define bfin_write_CAN0_MB23_DATA3(val) bfin_write16(CAN0_MB23_DATA3, val)
3030#define bfin_read_CAN0_MB23_LENGTH() bfin_read16(CAN0_MB23_LENGTH)
3031#define bfin_write_CAN0_MB23_LENGTH(val) bfin_write16(CAN0_MB23_LENGTH, val)
3032#define bfin_read_CAN0_MB23_TIMESTAMP() bfin_read16(CAN0_MB23_TIMESTAMP)
3033#define bfin_write_CAN0_MB23_TIMESTAMP(val) bfin_write16(CAN0_MB23_TIMESTAMP, val)
3034#define bfin_read_CAN0_MB23_ID0() bfin_read16(CAN0_MB23_ID0)
3035#define bfin_write_CAN0_MB23_ID0(val) bfin_write16(CAN0_MB23_ID0, val)
3036#define bfin_read_CAN0_MB23_ID1() bfin_read16(CAN0_MB23_ID1)
3037#define bfin_write_CAN0_MB23_ID1(val) bfin_write16(CAN0_MB23_ID1, val)
3038#define bfin_read_CAN0_MB24_DATA0() bfin_read16(CAN0_MB24_DATA0)
3039#define bfin_write_CAN0_MB24_DATA0(val) bfin_write16(CAN0_MB24_DATA0, val)
3040#define bfin_read_CAN0_MB24_DATA1() bfin_read16(CAN0_MB24_DATA1)
3041#define bfin_write_CAN0_MB24_DATA1(val) bfin_write16(CAN0_MB24_DATA1, val)
3042#define bfin_read_CAN0_MB24_DATA2() bfin_read16(CAN0_MB24_DATA2)
3043#define bfin_write_CAN0_MB24_DATA2(val) bfin_write16(CAN0_MB24_DATA2, val)
3044#define bfin_read_CAN0_MB24_DATA3() bfin_read16(CAN0_MB24_DATA3)
3045#define bfin_write_CAN0_MB24_DATA3(val) bfin_write16(CAN0_MB24_DATA3, val)
3046#define bfin_read_CAN0_MB24_LENGTH() bfin_read16(CAN0_MB24_LENGTH)
3047#define bfin_write_CAN0_MB24_LENGTH(val) bfin_write16(CAN0_MB24_LENGTH, val)
3048#define bfin_read_CAN0_MB24_TIMESTAMP() bfin_read16(CAN0_MB24_TIMESTAMP)
3049#define bfin_write_CAN0_MB24_TIMESTAMP(val) bfin_write16(CAN0_MB24_TIMESTAMP, val)
3050#define bfin_read_CAN0_MB24_ID0() bfin_read16(CAN0_MB24_ID0)
3051#define bfin_write_CAN0_MB24_ID0(val) bfin_write16(CAN0_MB24_ID0, val)
3052#define bfin_read_CAN0_MB24_ID1() bfin_read16(CAN0_MB24_ID1)
3053#define bfin_write_CAN0_MB24_ID1(val) bfin_write16(CAN0_MB24_ID1, val)
3054#define bfin_read_CAN0_MB25_DATA0() bfin_read16(CAN0_MB25_DATA0)
3055#define bfin_write_CAN0_MB25_DATA0(val) bfin_write16(CAN0_MB25_DATA0, val)
3056#define bfin_read_CAN0_MB25_DATA1() bfin_read16(CAN0_MB25_DATA1)
3057#define bfin_write_CAN0_MB25_DATA1(val) bfin_write16(CAN0_MB25_DATA1, val)
3058#define bfin_read_CAN0_MB25_DATA2() bfin_read16(CAN0_MB25_DATA2)
3059#define bfin_write_CAN0_MB25_DATA2(val) bfin_write16(CAN0_MB25_DATA2, val)
3060#define bfin_read_CAN0_MB25_DATA3() bfin_read16(CAN0_MB25_DATA3)
3061#define bfin_write_CAN0_MB25_DATA3(val) bfin_write16(CAN0_MB25_DATA3, val)
3062#define bfin_read_CAN0_MB25_LENGTH() bfin_read16(CAN0_MB25_LENGTH)
3063#define bfin_write_CAN0_MB25_LENGTH(val) bfin_write16(CAN0_MB25_LENGTH, val)
3064#define bfin_read_CAN0_MB25_TIMESTAMP() bfin_read16(CAN0_MB25_TIMESTAMP)
3065#define bfin_write_CAN0_MB25_TIMESTAMP(val) bfin_write16(CAN0_MB25_TIMESTAMP, val)
3066#define bfin_read_CAN0_MB25_ID0() bfin_read16(CAN0_MB25_ID0)
3067#define bfin_write_CAN0_MB25_ID0(val) bfin_write16(CAN0_MB25_ID0, val)
3068#define bfin_read_CAN0_MB25_ID1() bfin_read16(CAN0_MB25_ID1)
3069#define bfin_write_CAN0_MB25_ID1(val) bfin_write16(CAN0_MB25_ID1, val)
3070#define bfin_read_CAN0_MB26_DATA0() bfin_read16(CAN0_MB26_DATA0)
3071#define bfin_write_CAN0_MB26_DATA0(val) bfin_write16(CAN0_MB26_DATA0, val)
3072#define bfin_read_CAN0_MB26_DATA1() bfin_read16(CAN0_MB26_DATA1)
3073#define bfin_write_CAN0_MB26_DATA1(val) bfin_write16(CAN0_MB26_DATA1, val)
3074#define bfin_read_CAN0_MB26_DATA2() bfin_read16(CAN0_MB26_DATA2)
3075#define bfin_write_CAN0_MB26_DATA2(val) bfin_write16(CAN0_MB26_DATA2, val)
3076#define bfin_read_CAN0_MB26_DATA3() bfin_read16(CAN0_MB26_DATA3)
3077#define bfin_write_CAN0_MB26_DATA3(val) bfin_write16(CAN0_MB26_DATA3, val)
3078#define bfin_read_CAN0_MB26_LENGTH() bfin_read16(CAN0_MB26_LENGTH)
3079#define bfin_write_CAN0_MB26_LENGTH(val) bfin_write16(CAN0_MB26_LENGTH, val)
3080#define bfin_read_CAN0_MB26_TIMESTAMP() bfin_read16(CAN0_MB26_TIMESTAMP)
3081#define bfin_write_CAN0_MB26_TIMESTAMP(val) bfin_write16(CAN0_MB26_TIMESTAMP, val)
3082#define bfin_read_CAN0_MB26_ID0() bfin_read16(CAN0_MB26_ID0)
3083#define bfin_write_CAN0_MB26_ID0(val) bfin_write16(CAN0_MB26_ID0, val)
3084#define bfin_read_CAN0_MB26_ID1() bfin_read16(CAN0_MB26_ID1)
3085#define bfin_write_CAN0_MB26_ID1(val) bfin_write16(CAN0_MB26_ID1, val)
3086#define bfin_read_CAN0_MB27_DATA0() bfin_read16(CAN0_MB27_DATA0)
3087#define bfin_write_CAN0_MB27_DATA0(val) bfin_write16(CAN0_MB27_DATA0, val)
3088#define bfin_read_CAN0_MB27_DATA1() bfin_read16(CAN0_MB27_DATA1)
3089#define bfin_write_CAN0_MB27_DATA1(val) bfin_write16(CAN0_MB27_DATA1, val)
3090#define bfin_read_CAN0_MB27_DATA2() bfin_read16(CAN0_MB27_DATA2)
3091#define bfin_write_CAN0_MB27_DATA2(val) bfin_write16(CAN0_MB27_DATA2, val)
3092#define bfin_read_CAN0_MB27_DATA3() bfin_read16(CAN0_MB27_DATA3)
3093#define bfin_write_CAN0_MB27_DATA3(val) bfin_write16(CAN0_MB27_DATA3, val)
3094#define bfin_read_CAN0_MB27_LENGTH() bfin_read16(CAN0_MB27_LENGTH)
3095#define bfin_write_CAN0_MB27_LENGTH(val) bfin_write16(CAN0_MB27_LENGTH, val)
3096#define bfin_read_CAN0_MB27_TIMESTAMP() bfin_read16(CAN0_MB27_TIMESTAMP)
3097#define bfin_write_CAN0_MB27_TIMESTAMP(val) bfin_write16(CAN0_MB27_TIMESTAMP, val)
3098#define bfin_read_CAN0_MB27_ID0() bfin_read16(CAN0_MB27_ID0)
3099#define bfin_write_CAN0_MB27_ID0(val) bfin_write16(CAN0_MB27_ID0, val)
3100#define bfin_read_CAN0_MB27_ID1() bfin_read16(CAN0_MB27_ID1)
3101#define bfin_write_CAN0_MB27_ID1(val) bfin_write16(CAN0_MB27_ID1, val)
3102#define bfin_read_CAN0_MB28_DATA0() bfin_read16(CAN0_MB28_DATA0)
3103#define bfin_write_CAN0_MB28_DATA0(val) bfin_write16(CAN0_MB28_DATA0, val)
3104#define bfin_read_CAN0_MB28_DATA1() bfin_read16(CAN0_MB28_DATA1)
3105#define bfin_write_CAN0_MB28_DATA1(val) bfin_write16(CAN0_MB28_DATA1, val)
3106#define bfin_read_CAN0_MB28_DATA2() bfin_read16(CAN0_MB28_DATA2)
3107#define bfin_write_CAN0_MB28_DATA2(val) bfin_write16(CAN0_MB28_DATA2, val)
3108#define bfin_read_CAN0_MB28_DATA3() bfin_read16(CAN0_MB28_DATA3)
3109#define bfin_write_CAN0_MB28_DATA3(val) bfin_write16(CAN0_MB28_DATA3, val)
3110#define bfin_read_CAN0_MB28_LENGTH() bfin_read16(CAN0_MB28_LENGTH)
3111#define bfin_write_CAN0_MB28_LENGTH(val) bfin_write16(CAN0_MB28_LENGTH, val)
3112#define bfin_read_CAN0_MB28_TIMESTAMP() bfin_read16(CAN0_MB28_TIMESTAMP)
3113#define bfin_write_CAN0_MB28_TIMESTAMP(val) bfin_write16(CAN0_MB28_TIMESTAMP, val)
3114#define bfin_read_CAN0_MB28_ID0() bfin_read16(CAN0_MB28_ID0)
3115#define bfin_write_CAN0_MB28_ID0(val) bfin_write16(CAN0_MB28_ID0, val)
3116#define bfin_read_CAN0_MB28_ID1() bfin_read16(CAN0_MB28_ID1)
3117#define bfin_write_CAN0_MB28_ID1(val) bfin_write16(CAN0_MB28_ID1, val)
3118#define bfin_read_CAN0_MB29_DATA0() bfin_read16(CAN0_MB29_DATA0)
3119#define bfin_write_CAN0_MB29_DATA0(val) bfin_write16(CAN0_MB29_DATA0, val)
3120#define bfin_read_CAN0_MB29_DATA1() bfin_read16(CAN0_MB29_DATA1)
3121#define bfin_write_CAN0_MB29_DATA1(val) bfin_write16(CAN0_MB29_DATA1, val)
3122#define bfin_read_CAN0_MB29_DATA2() bfin_read16(CAN0_MB29_DATA2)
3123#define bfin_write_CAN0_MB29_DATA2(val) bfin_write16(CAN0_MB29_DATA2, val)
3124#define bfin_read_CAN0_MB29_DATA3() bfin_read16(CAN0_MB29_DATA3)
3125#define bfin_write_CAN0_MB29_DATA3(val) bfin_write16(CAN0_MB29_DATA3, val)
3126#define bfin_read_CAN0_MB29_LENGTH() bfin_read16(CAN0_MB29_LENGTH)
3127#define bfin_write_CAN0_MB29_LENGTH(val) bfin_write16(CAN0_MB29_LENGTH, val)
3128#define bfin_read_CAN0_MB29_TIMESTAMP() bfin_read16(CAN0_MB29_TIMESTAMP)
3129#define bfin_write_CAN0_MB29_TIMESTAMP(val) bfin_write16(CAN0_MB29_TIMESTAMP, val)
3130#define bfin_read_CAN0_MB29_ID0() bfin_read16(CAN0_MB29_ID0)
3131#define bfin_write_CAN0_MB29_ID0(val) bfin_write16(CAN0_MB29_ID0, val)
3132#define bfin_read_CAN0_MB29_ID1() bfin_read16(CAN0_MB29_ID1)
3133#define bfin_write_CAN0_MB29_ID1(val) bfin_write16(CAN0_MB29_ID1, val)
3134#define bfin_read_CAN0_MB30_DATA0() bfin_read16(CAN0_MB30_DATA0)
3135#define bfin_write_CAN0_MB30_DATA0(val) bfin_write16(CAN0_MB30_DATA0, val)
3136#define bfin_read_CAN0_MB30_DATA1() bfin_read16(CAN0_MB30_DATA1)
3137#define bfin_write_CAN0_MB30_DATA1(val) bfin_write16(CAN0_MB30_DATA1, val)
3138#define bfin_read_CAN0_MB30_DATA2() bfin_read16(CAN0_MB30_DATA2)
3139#define bfin_write_CAN0_MB30_DATA2(val) bfin_write16(CAN0_MB30_DATA2, val)
3140#define bfin_read_CAN0_MB30_DATA3() bfin_read16(CAN0_MB30_DATA3)
3141#define bfin_write_CAN0_MB30_DATA3(val) bfin_write16(CAN0_MB30_DATA3, val)
3142#define bfin_read_CAN0_MB30_LENGTH() bfin_read16(CAN0_MB30_LENGTH)
3143#define bfin_write_CAN0_MB30_LENGTH(val) bfin_write16(CAN0_MB30_LENGTH, val)
3144#define bfin_read_CAN0_MB30_TIMESTAMP() bfin_read16(CAN0_MB30_TIMESTAMP)
3145#define bfin_write_CAN0_MB30_TIMESTAMP(val) bfin_write16(CAN0_MB30_TIMESTAMP, val)
3146#define bfin_read_CAN0_MB30_ID0() bfin_read16(CAN0_MB30_ID0)
3147#define bfin_write_CAN0_MB30_ID0(val) bfin_write16(CAN0_MB30_ID0, val)
3148#define bfin_read_CAN0_MB30_ID1() bfin_read16(CAN0_MB30_ID1)
3149#define bfin_write_CAN0_MB30_ID1(val) bfin_write16(CAN0_MB30_ID1, val)
3150#define bfin_read_CAN0_MB31_DATA0() bfin_read16(CAN0_MB31_DATA0)
3151#define bfin_write_CAN0_MB31_DATA0(val) bfin_write16(CAN0_MB31_DATA0, val)
3152#define bfin_read_CAN0_MB31_DATA1() bfin_read16(CAN0_MB31_DATA1)
3153#define bfin_write_CAN0_MB31_DATA1(val) bfin_write16(CAN0_MB31_DATA1, val)
3154#define bfin_read_CAN0_MB31_DATA2() bfin_read16(CAN0_MB31_DATA2)
3155#define bfin_write_CAN0_MB31_DATA2(val) bfin_write16(CAN0_MB31_DATA2, val)
3156#define bfin_read_CAN0_MB31_DATA3() bfin_read16(CAN0_MB31_DATA3)
3157#define bfin_write_CAN0_MB31_DATA3(val) bfin_write16(CAN0_MB31_DATA3, val)
3158#define bfin_read_CAN0_MB31_LENGTH() bfin_read16(CAN0_MB31_LENGTH)
3159#define bfin_write_CAN0_MB31_LENGTH(val) bfin_write16(CAN0_MB31_LENGTH, val)
3160#define bfin_read_CAN0_MB31_TIMESTAMP() bfin_read16(CAN0_MB31_TIMESTAMP)
3161#define bfin_write_CAN0_MB31_TIMESTAMP(val) bfin_write16(CAN0_MB31_TIMESTAMP, val)
3162#define bfin_read_CAN0_MB31_ID0() bfin_read16(CAN0_MB31_ID0)
3163#define bfin_write_CAN0_MB31_ID0(val) bfin_write16(CAN0_MB31_ID0, val)
3164#define bfin_read_CAN0_MB31_ID1() bfin_read16(CAN0_MB31_ID1)
3165#define bfin_write_CAN0_MB31_ID1(val) bfin_write16(CAN0_MB31_ID1, val)
3166
3167/* Counter Registers */
3168
3169#define bfin_read_CNT_CONFIG() bfin_read16(CNT_CONFIG)
3170#define bfin_write_CNT_CONFIG(val) bfin_write16(CNT_CONFIG, val)
3171#define bfin_read_CNT_IMASK() bfin_read16(CNT_IMASK)
3172#define bfin_write_CNT_IMASK(val) bfin_write16(CNT_IMASK, val)
3173#define bfin_read_CNT_STATUS() bfin_read16(CNT_STATUS)
3174#define bfin_write_CNT_STATUS(val) bfin_write16(CNT_STATUS, val)
3175#define bfin_read_CNT_COMMAND() bfin_read16(CNT_COMMAND)
3176#define bfin_write_CNT_COMMAND(val) bfin_write16(CNT_COMMAND, val)
3177#define bfin_read_CNT_DEBOUNCE() bfin_read16(CNT_DEBOUNCE)
3178#define bfin_write_CNT_DEBOUNCE(val) bfin_write16(CNT_DEBOUNCE, val)
3179#define bfin_read_CNT_COUNTER() bfin_read32(CNT_COUNTER)
3180#define bfin_write_CNT_COUNTER(val) bfin_write32(CNT_COUNTER, val)
3181#define bfin_read_CNT_MAX() bfin_read32(CNT_MAX)
3182#define bfin_write_CNT_MAX(val) bfin_write32(CNT_MAX, val)
3183#define bfin_read_CNT_MIN() bfin_read32(CNT_MIN)
3184#define bfin_write_CNT_MIN(val) bfin_write32(CNT_MIN, val)
3185
3186/* RSI Register */
3187#define bfin_read_RSI_CLK_CTL() bfin_read16(RSI_CLK_CONTROL)
3188#define bfin_write_RSI_CLK_CTL(val) bfin_write16(RSI_CLK_CONTROL, val)
3189#define bfin_read_RSI_ARGUMENT() bfin_read32(RSI_ARGUMENT)
3190#define bfin_write_RSI_ARGUMENT(val) bfin_write32(RSI_ARGUMENT, val)
3191#define bfin_read_RSI_COMMAND() bfin_read16(RSI_COMMAND)
3192#define bfin_write_RSI_COMMAND(val) bfin_write16(RSI_COMMAND, val)
3193#define bfin_read_RSI_RESP_CMD() bfin_read16(RSI_RESP_CMD)
3194#define bfin_write_RSI_RESP_CMD(val) bfin_write16(RSI_RESP_CMD, val)
3195#define bfin_read_RSI_RESPONSE0() bfin_read32(RSI_RESPONSE0)
3196#define bfin_write_RSI_RESPONSE0(val) bfin_write32(RSI_RESPONSE0, val)
3197#define bfin_read_RSI_RESPONSE1() bfin_read32(RSI_RESPONSE1)
3198#define bfin_write_RSI_RESPONSE1(val) bfin_write32(RSI_RESPONSE1, val)
3199#define bfin_read_RSI_RESPONSE2() bfin_read32(RSI_RESPONSE2)
3200#define bfin_write_RSI_RESPONSE2(val) bfin_write32(RSI_RESPONSE2, val)
3201#define bfin_read_RSI_RESPONSE3() bfin_read32(RSI_RESPONSE3)
3202#define bfin_write_RSI_RESPONSE3(val) bfin_write32(RSI_RESPONSE3, val)
3203#define bfin_read_RSI_DATA_TIMER() bfin_read32(RSI_DATA_TIMER)
3204#define bfin_write_RSI_DATA_TIMER(val) bfin_write32(RSI_DATA_TIMER, val)
3205#define bfin_read_RSI_DATA_LGTH() bfin_read16(RSI_DATA_LGTH)
3206#define bfin_write_RSI_DATA_LGTH(val) bfin_write16(RSI_DATA_LGTH, val)
3207#define bfin_read_RSI_DATA_CTL() bfin_read16(RSI_DATA_CONTROL)
3208#define bfin_write_RSI_DATA_CTL(val) bfin_write16(RSI_DATA_CONTROL, val)
3209#define bfin_read_RSI_DATA_CNT() bfin_read16(RSI_DATA_CNT)
3210#define bfin_write_RSI_DATA_CNT(val) bfin_write16(RSI_DATA_CNT, val)
3211#define bfin_read_RSI_STATUS() bfin_read32(RSI_STATUS)
3212#define bfin_write_RSI_STATUS(val) bfin_write32(RSI_STATUS, val)
3213#define bfin_read_RSI_STATUS_CLR() bfin_read16(RSI_STATUSCL)
3214#define bfin_write_RSI_STATUS_CLR(val) bfin_write16(RSI_STATUSCL, val)
3215#define bfin_read_RSI_MASK0() bfin_read32(RSI_MASK0)
3216#define bfin_write_RSI_MASK0(val) bfin_write32(RSI_MASK0, val)
3217#define bfin_read_RSI_MASK1() bfin_read32(RSI_MASK1)
3218#define bfin_write_RSI_MASK1(val) bfin_write32(RSI_MASK1, val)
3219#define bfin_read_RSI_FIFO_CNT() bfin_read16(RSI_FIFO_CNT)
3220#define bfin_write_RSI_FIFO_CNT(val) bfin_write16(RSI_FIFO_CNT, val)
3221#define bfin_read_RSI_CEATA_CONTROL() bfin_read16(RSI_CEATA_CONTROL)
3222#define bfin_write_RSI_CEATA_CONTROL(val) bfin_write16(RSI_CEATA_CONTROL, val)
3223#define bfin_read_RSI_BLKSZ() bfin_read16(RSI_BLKSZ)
3224#define bfin_write_RSI_BLKSZ(val) bfin_write16(RSI_BLKSZ, val)
3225#define bfin_read_RSI_FIFO() bfin_read32(RSI_FIFO)
3226#define bfin_write_RSI_FIFO(val) bfin_write32(RSI_FIFO, val)
3227#define bfin_read_RSI_E_STATUS() bfin_read32(RSI_ESTAT)
3228#define bfin_write_RSI_E_STATUS(val) bfin_write32(RSI_ESTAT, val)
3229#define bfin_read_RSI_E_MASK() bfin_read32(RSI_EMASK)
3230#define bfin_write_RSI_E_MASK(val) bfin_write32(RSI_EMASK, val)
3231#define bfin_read_RSI_CFG() bfin_read16(RSI_CONFIG)
3232#define bfin_write_RSI_CFG(val) bfin_write16(RSI_CONFIG, val)
3233#define bfin_read_RSI_RD_WAIT_EN() bfin_read16(RSI_RD_WAIT_EN)
3234#define bfin_write_RSI_RD_WAIT_EN(val) bfin_write16(RSI_RD_WAIT_EN, val)
3235#define bfin_read_RSI_PID0() bfin_read16(RSI_PID0)
3236#define bfin_write_RSI_PID0(val) bfin_write16(RSI_PID0, val)
3237#define bfin_read_RSI_PID1() bfin_read16(RSI_PID1)
3238#define bfin_write_RSI_PID1(val) bfin_write16(RSI_PID1, val)
3239#define bfin_read_RSI_PID2() bfin_read16(RSI_PID2)
3240#define bfin_write_RSI_PID2(val) bfin_write16(RSI_PID2, val)
3241#define bfin_read_RSI_PID3() bfin_read16(RSI_PID3)
3242#define bfin_write_RSI_PID3(val) bfin_write16(RSI_PID3, val)
3243
3244/* usb register */
3245#define bfin_read_USB_PLLOSC_CTRL() bfin_read16(USB_PLL_OSC)
3246#define bfin_write_USB_PLLOSC_CTRL(val) bfin_write16(USB_PLL_OSC, val)
3247#define bfin_write_USB_VBUS_CTL(val) bfin_write8(USB_VBUS_CTL, val)
3248#define bfin_write_USB_APHY_CNTRL(val) bfin_write8(USB_PHY_CTL, val)
3249#define bfin_read_USB_APHY_CNTRL() bfin_read8(USB_PHY_CTL)
3250
3251#endif /* _CDEF_BF60X_H */
3252
diff --git a/arch/blackfin/mach-bf609/include/mach/defBF609.h b/arch/blackfin/mach-bf609/include/mach/defBF609.h
new file mode 100644
index 000000000000..19690cc42113
--- /dev/null
+++ b/arch/blackfin/mach-bf609/include/mach/defBF609.h
@@ -0,0 +1,15 @@
1/*
2 * Copyright 2011 Analog Devices Inc.
3 *
4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */
6
7#ifndef _DEF_BF609_H
8#define _DEF_BF609_H
9
10/* Include defBF60x_base.h for the set of #defines that are common to all ADSP-BF60x processors */
11#include "defBF60x_base.h"
12
13/* The following are the #defines needed by ADSP-BF609 that are not in the common header */
14
15#endif /* _DEF_BF609_H */
diff --git a/arch/blackfin/mach-bf609/include/mach/defBF60x_base.h b/arch/blackfin/mach-bf609/include/mach/defBF60x_base.h
new file mode 100644
index 000000000000..6aac38544cc9
--- /dev/null
+++ b/arch/blackfin/mach-bf609/include/mach/defBF60x_base.h
@@ -0,0 +1,3587 @@
1/*
2 * Copyright 2011 Analog Devices Inc.
3 *
4 * Licensed under the Clear BSD license or the GPL-2 (or later)
5 */
6
7#ifndef _DEF_BF60X_H
8#define _DEF_BF60X_H
9
10
11/* ************************************************************** */
12/* SYSTEM & MMR ADDRESS DEFINITIONS COMMON TO ALL ADSP-BF60x */
13/* ************************************************************** */
14
15
16/* =========================
17 CNT Registers
18 ========================= */
19
20/* =========================
21 CNT0
22 ========================= */
23#define CNT_CONFIG 0xFFC00400 /* CNT0 Configuration Register */
24#define CNT_IMASK 0xFFC00404 /* CNT0 Interrupt Mask Register */
25#define CNT_STATUS 0xFFC00408 /* CNT0 Status Register */
26#define CNT_COMMAND 0xFFC0040C /* CNT0 Command Register */
27#define CNT_DEBOUNCE 0xFFC00410 /* CNT0 Debounce Register */
28#define CNT_COUNTER 0xFFC00414 /* CNT0 Counter Register */
29#define CNT_MAX 0xFFC00418 /* CNT0 Maximum Count Register */
30#define CNT_MIN 0xFFC0041C /* CNT0 Minimum Count Register */
31
32
33/* =========================
34 RSI Registers
35 ========================= */
36
37#define RSI_CLK_CONTROL 0xFFC00604 /* RSI0 Clock Control Register */
38#define RSI_ARGUMENT 0xFFC00608 /* RSI0 Argument Register */
39#define RSI_COMMAND 0xFFC0060C /* RSI0 Command Register */
40#define RSI_RESP_CMD 0xFFC00610 /* RSI0 Response Command Register */
41#define RSI_RESPONSE0 0xFFC00614 /* RSI0 Response 0 Register */
42#define RSI_RESPONSE1 0xFFC00618 /* RSI0 Response 1 Register */
43#define RSI_RESPONSE2 0xFFC0061C /* RSI0 Response 2 Register */
44#define RSI_RESPONSE3 0xFFC00620 /* RSI0 Response 3 Register */
45#define RSI_DATA_TIMER 0xFFC00624 /* RSI0 Data Timer Register */
46#define RSI_DATA_LGTH 0xFFC00628 /* RSI0 Data Length Register */
47#define RSI_DATA_CONTROL 0xFFC0062C /* RSI0 Data Control Register */
48#define RSI_DATA_CNT 0xFFC00630 /* RSI0 Data Count Register */
49#define RSI_STATUS 0xFFC00634 /* RSI0 Status Register */
50#define RSI_STATUSCL 0xFFC00638 /* RSI0 Status Clear Register */
51#define RSI_MASK0 0xFFC0063C /* RSI0 Interrupt 0 Mask Register */
52#define RSI_MASK1 0xFFC00640 /* RSI0 Interrupt 1 Mask Register */
53#define RSI_FIFO_CNT 0xFFC00648 /* RSI0 FIFO Counter Register */
54#define RSI_CEATA_CONTROL 0xFFC0064C /* RSI0 This register contains bit to dis CCS gen */
55#define RSI_BOOT_TCNTR 0xFFC00650 /* RSI0 Boot Timing Counter Register */
56#define RSI_BACK_TOUT 0xFFC00654 /* RSI0 Boot Acknowledge Timeout Register */
57#define RSI_SLP_WKUP_TOUT 0xFFC00658 /* RSI0 Sleep Wakeup Timeout Register */
58#define RSI_BLKSZ 0xFFC0065C /* RSI0 Block Size Register */
59#define RSI_FIFO 0xFFC00680 /* RSI0 Data FIFO Register */
60#define RSI_ESTAT 0xFFC006C0 /* RSI0 Exception Status Register */
61#define RSI_EMASK 0xFFC006C4 /* RSI0 Exception Mask Register */
62#define RSI_CONFIG 0xFFC006C8 /* RSI0 Configuration Register */
63#define RSI_RD_WAIT_EN 0xFFC006CC /* RSI0 Read Wait Enable Register */
64#define RSI_PID0 0xFFC006D0 /* RSI0 Peripheral Identification Register */
65#define RSI_PID1 0xFFC006D4 /* RSI0 Peripheral Identification Register */
66#define RSI_PID2 0xFFC006D8 /* RSI0 Peripheral Identification Register */
67#define RSI_PID3 0xFFC006DC /* RSI0 Peripheral Identification Register */
68
69/* =========================
70 CAN Registers
71 ========================= */
72
73/* =========================
74 CAN0
75 ========================= */
76#define CAN0_MC1 0xFFC00A00 /* CAN0 Mailbox Configuration Register 1 */
77#define CAN0_MD1 0xFFC00A04 /* CAN0 Mailbox Direction Register 1 */
78#define CAN0_TRS1 0xFFC00A08 /* CAN0 Transmission Request Set Register 1 */
79#define CAN0_TRR1 0xFFC00A0C /* CAN0 Transmission Request Reset Register 1 */
80#define CAN0_TA1 0xFFC00A10 /* CAN0 Transmission Acknowledge Register 1 */
81#define CAN0_AA1 0xFFC00A14 /* CAN0 Abort Acknowledge Register 1 */
82#define CAN0_RMP1 0xFFC00A18 /* CAN0 Receive Message Pending Register 1 */
83#define CAN0_RML1 0xFFC00A1C /* CAN0 Receive Message Lost Register 1 */
84#define CAN0_MBTIF1 0xFFC00A20 /* CAN0 Mailbox Transmit Interrupt Flag Register 1 */
85#define CAN0_MBRIF1 0xFFC00A24 /* CAN0 Mailbox Receive Interrupt Flag Register 1 */
86#define CAN0_MBIM1 0xFFC00A28 /* CAN0 Mailbox Interrupt Mask Register 1 */
87#define CAN0_RFH1 0xFFC00A2C /* CAN0 Remote Frame Handling Register 1 */
88#define CAN0_OPSS1 0xFFC00A30 /* CAN0 Overwrite Protection/Single Shot Transmission Register 1 */
89#define CAN0_MC2 0xFFC00A40 /* CAN0 Mailbox Configuration Register 2 */
90#define CAN0_MD2 0xFFC00A44 /* CAN0 Mailbox Direction Register 2 */
91#define CAN0_TRS2 0xFFC00A48 /* CAN0 Transmission Request Set Register 2 */
92#define CAN0_TRR2 0xFFC00A4C /* CAN0 Transmission Request Reset Register 2 */
93#define CAN0_TA2 0xFFC00A50 /* CAN0 Transmission Acknowledge Register 2 */
94#define CAN0_AA2 0xFFC00A54 /* CAN0 Abort Acknowledge Register 2 */
95#define CAN0_RMP2 0xFFC00A58 /* CAN0 Receive Message Pending Register 2 */
96#define CAN0_RML2 0xFFC00A5C /* CAN0 Receive Message Lost Register 2 */
97#define CAN0_MBTIF2 0xFFC00A60 /* CAN0 Mailbox Transmit Interrupt Flag Register 2 */
98#define CAN0_MBRIF2 0xFFC00A64 /* CAN0 Mailbox Receive Interrupt Flag Register 2 */
99#define CAN0_MBIM2 0xFFC00A68 /* CAN0 Mailbox Interrupt Mask Register 2 */
100#define CAN0_RFH2 0xFFC00A6C /* CAN0 Remote Frame Handling Register 2 */
101#define CAN0_OPSS2 0xFFC00A70 /* CAN0 Overwrite Protection/Single Shot Transmission Register 2 */
102#define CAN0_CLOCK 0xFFC00A80 /* CAN0 Clock Register */
103#define CAN0_TIMING 0xFFC00A84 /* CAN0 Timing Register */
104#define CAN0_DEBUG 0xFFC00A88 /* CAN0 Debug Register */
105#define CAN0_STATUS 0xFFC00A8C /* CAN0 Status Register */
106#define CAN0_CEC 0xFFC00A90 /* CAN0 Error Counter Register */
107#define CAN0_GIS 0xFFC00A94 /* CAN0 Global CAN Interrupt Status */
108#define CAN0_GIM 0xFFC00A98 /* CAN0 Global CAN Interrupt Mask */
109#define CAN0_GIF 0xFFC00A9C /* CAN0 Global CAN Interrupt Flag */
110#define CAN0_CONTROL 0xFFC00AA0 /* CAN0 CAN Master Control Register */
111#define CAN0_INTR 0xFFC00AA4 /* CAN0 Interrupt Pending Register */
112#define CAN0_MBTD 0xFFC00AAC /* CAN0 Temporary Mailbox Disable Register */
113#define CAN0_EWR 0xFFC00AB0 /* CAN0 Error Counter Warning Level Register */
114#define CAN0_ESR 0xFFC00AB4 /* CAN0 Error Status Register */
115#define CAN0_UCCNT 0xFFC00AC4 /* CAN0 Universal Counter Register */
116#define CAN0_UCRC 0xFFC00AC8 /* CAN0 Universal Counter Reload/Capture Register */
117#define CAN0_UCCNF 0xFFC00ACC /* CAN0 Universal Counter Configuration Mode Register */
118#define CAN0_AM00L 0xFFC00B00 /* CAN0 Acceptance Mask Register (L) */
119#define CAN0_AM01L 0xFFC00B08 /* CAN0 Acceptance Mask Register (L) */
120#define CAN0_AM02L 0xFFC00B10 /* CAN0 Acceptance Mask Register (L) */
121#define CAN0_AM03L 0xFFC00B18 /* CAN0 Acceptance Mask Register (L) */
122#define CAN0_AM04L 0xFFC00B20 /* CAN0 Acceptance Mask Register (L) */
123#define CAN0_AM05L 0xFFC00B28 /* CAN0 Acceptance Mask Register (L) */
124#define CAN0_AM06L 0xFFC00B30 /* CAN0 Acceptance Mask Register (L) */
125#define CAN0_AM07L 0xFFC00B38 /* CAN0 Acceptance Mask Register (L) */
126#define CAN0_AM08L 0xFFC00B40 /* CAN0 Acceptance Mask Register (L) */
127#define CAN0_AM09L 0xFFC00B48 /* CAN0 Acceptance Mask Register (L) */
128#define CAN0_AM10L 0xFFC00B50 /* CAN0 Acceptance Mask Register (L) */
129#define CAN0_AM11L 0xFFC00B58 /* CAN0 Acceptance Mask Register (L) */
130#define CAN0_AM12L 0xFFC00B60 /* CAN0 Acceptance Mask Register (L) */
131#define CAN0_AM13L 0xFFC00B68 /* CAN0 Acceptance Mask Register (L) */
132#define CAN0_AM14L 0xFFC00B70 /* CAN0 Acceptance Mask Register (L) */
133#define CAN0_AM15L 0xFFC00B78 /* CAN0 Acceptance Mask Register (L) */
134#define CAN0_AM16L 0xFFC00B80 /* CAN0 Acceptance Mask Register (L) */
135#define CAN0_AM17L 0xFFC00B88 /* CAN0 Acceptance Mask Register (L) */
136#define CAN0_AM18L 0xFFC00B90 /* CAN0 Acceptance Mask Register (L) */
137#define CAN0_AM19L 0xFFC00B98 /* CAN0 Acceptance Mask Register (L) */
138#define CAN0_AM20L 0xFFC00BA0 /* CAN0 Acceptance Mask Register (L) */
139#define CAN0_AM21L 0xFFC00BA8 /* CAN0 Acceptance Mask Register (L) */
140#define CAN0_AM22L 0xFFC00BB0 /* CAN0 Acceptance Mask Register (L) */
141#define CAN0_AM23L 0xFFC00BB8 /* CAN0 Acceptance Mask Register (L) */
142#define CAN0_AM24L 0xFFC00BC0 /* CAN0 Acceptance Mask Register (L) */
143#define CAN0_AM25L 0xFFC00BC8 /* CAN0 Acceptance Mask Register (L) */
144#define CAN0_AM26L 0xFFC00BD0 /* CAN0 Acceptance Mask Register (L) */
145#define CAN0_AM27L 0xFFC00BD8 /* CAN0 Acceptance Mask Register (L) */
146#define CAN0_AM28L 0xFFC00BE0 /* CAN0 Acceptance Mask Register (L) */
147#define CAN0_AM29L 0xFFC00BE8 /* CAN0 Acceptance Mask Register (L) */
148#define CAN0_AM30L 0xFFC00BF0 /* CAN0 Acceptance Mask Register (L) */
149#define CAN0_AM31L 0xFFC00BF8 /* CAN0 Acceptance Mask Register (L) */
150#define CAN0_AM00H 0xFFC00B04 /* CAN0 Acceptance Mask Register (H) */
151#define CAN0_AM01H 0xFFC00B0C /* CAN0 Acceptance Mask Register (H) */
152#define CAN0_AM02H 0xFFC00B14 /* CAN0 Acceptance Mask Register (H) */
153#define CAN0_AM03H 0xFFC00B1C /* CAN0 Acceptance Mask Register (H) */
154#define CAN0_AM04H 0xFFC00B24 /* CAN0 Acceptance Mask Register (H) */
155#define CAN0_AM05H 0xFFC00B2C /* CAN0 Acceptance Mask Register (H) */
156#define CAN0_AM06H 0xFFC00B34 /* CAN0 Acceptance Mask Register (H) */
157#define CAN0_AM07H 0xFFC00B3C /* CAN0 Acceptance Mask Register (H) */
158#define CAN0_AM08H 0xFFC00B44 /* CAN0 Acceptance Mask Register (H) */
159#define CAN0_AM09H 0xFFC00B4C /* CAN0 Acceptance Mask Register (H) */
160#define CAN0_AM10H 0xFFC00B54 /* CAN0 Acceptance Mask Register (H) */
161#define CAN0_AM11H 0xFFC00B5C /* CAN0 Acceptance Mask Register (H) */
162#define CAN0_AM12H 0xFFC00B64 /* CAN0 Acceptance Mask Register (H) */
163#define CAN0_AM13H 0xFFC00B6C /* CAN0 Acceptance Mask Register (H) */
164#define CAN0_AM14H 0xFFC00B74 /* CAN0 Acceptance Mask Register (H) */
165#define CAN0_AM15H 0xFFC00B7C /* CAN0 Acceptance Mask Register (H) */
166#define CAN0_AM16H 0xFFC00B84 /* CAN0 Acceptance Mask Register (H) */
167#define CAN0_AM17H 0xFFC00B8C /* CAN0 Acceptance Mask Register (H) */
168#define CAN0_AM18H 0xFFC00B94 /* CAN0 Acceptance Mask Register (H) */
169#define CAN0_AM19H 0xFFC00B9C /* CAN0 Acceptance Mask Register (H) */
170#define CAN0_AM20H 0xFFC00BA4 /* CAN0 Acceptance Mask Register (H) */
171#define CAN0_AM21H 0xFFC00BAC /* CAN0 Acceptance Mask Register (H) */
172#define CAN0_AM22H 0xFFC00BB4 /* CAN0 Acceptance Mask Register (H) */
173#define CAN0_AM23H 0xFFC00BBC /* CAN0 Acceptance Mask Register (H) */
174#define CAN0_AM24H 0xFFC00BC4 /* CAN0 Acceptance Mask Register (H) */
175#define CAN0_AM25H 0xFFC00BCC /* CAN0 Acceptance Mask Register (H) */
176#define CAN0_AM26H 0xFFC00BD4 /* CAN0 Acceptance Mask Register (H) */
177#define CAN0_AM27H 0xFFC00BDC /* CAN0 Acceptance Mask Register (H) */
178#define CAN0_AM28H 0xFFC00BE4 /* CAN0 Acceptance Mask Register (H) */
179#define CAN0_AM29H 0xFFC00BEC /* CAN0 Acceptance Mask Register (H) */
180#define CAN0_AM30H 0xFFC00BF4 /* CAN0 Acceptance Mask Register (H) */
181#define CAN0_AM31H 0xFFC00BFC /* CAN0 Acceptance Mask Register (H) */
182#define CAN0_MB00_DATA0 0xFFC00C00 /* CAN0 Mailbox Word 0 Register */
183#define CAN0_MB01_DATA0 0xFFC00C20 /* CAN0 Mailbox Word 0 Register */
184#define CAN0_MB02_DATA0 0xFFC00C40 /* CAN0 Mailbox Word 0 Register */
185#define CAN0_MB03_DATA0 0xFFC00C60 /* CAN0 Mailbox Word 0 Register */
186#define CAN0_MB04_DATA0 0xFFC00C80 /* CAN0 Mailbox Word 0 Register */
187#define CAN0_MB05_DATA0 0xFFC00CA0 /* CAN0 Mailbox Word 0 Register */
188#define CAN0_MB06_DATA0 0xFFC00CC0 /* CAN0 Mailbox Word 0 Register */
189#define CAN0_MB07_DATA0 0xFFC00CE0 /* CAN0 Mailbox Word 0 Register */
190#define CAN0_MB08_DATA0 0xFFC00D00 /* CAN0 Mailbox Word 0 Register */
191#define CAN0_MB09_DATA0 0xFFC00D20 /* CAN0 Mailbox Word 0 Register */
192#define CAN0_MB10_DATA0 0xFFC00D40 /* CAN0 Mailbox Word 0 Register */
193#define CAN0_MB11_DATA0 0xFFC00D60 /* CAN0 Mailbox Word 0 Register */
194#define CAN0_MB12_DATA0 0xFFC00D80 /* CAN0 Mailbox Word 0 Register */
195#define CAN0_MB13_DATA0 0xFFC00DA0 /* CAN0 Mailbox Word 0 Register */
196#define CAN0_MB14_DATA0 0xFFC00DC0 /* CAN0 Mailbox Word 0 Register */
197#define CAN0_MB15_DATA0 0xFFC00DE0 /* CAN0 Mailbox Word 0 Register */
198#define CAN0_MB16_DATA0 0xFFC00E00 /* CAN0 Mailbox Word 0 Register */
199#define CAN0_MB17_DATA0 0xFFC00E20 /* CAN0 Mailbox Word 0 Register */
200#define CAN0_MB18_DATA0 0xFFC00E40 /* CAN0 Mailbox Word 0 Register */
201#define CAN0_MB19_DATA0 0xFFC00E60 /* CAN0 Mailbox Word 0 Register */
202#define CAN0_MB20_DATA0 0xFFC00E80 /* CAN0 Mailbox Word 0 Register */
203#define CAN0_MB21_DATA0 0xFFC00EA0 /* CAN0 Mailbox Word 0 Register */
204#define CAN0_MB22_DATA0 0xFFC00EC0 /* CAN0 Mailbox Word 0 Register */
205#define CAN0_MB23_DATA0 0xFFC00EE0 /* CAN0 Mailbox Word 0 Register */
206#define CAN0_MB24_DATA0 0xFFC00F00 /* CAN0 Mailbox Word 0 Register */
207#define CAN0_MB25_DATA0 0xFFC00F20 /* CAN0 Mailbox Word 0 Register */
208#define CAN0_MB26_DATA0 0xFFC00F40 /* CAN0 Mailbox Word 0 Register */
209#define CAN0_MB27_DATA0 0xFFC00F60 /* CAN0 Mailbox Word 0 Register */
210#define CAN0_MB28_DATA0 0xFFC00F80 /* CAN0 Mailbox Word 0 Register */
211#define CAN0_MB29_DATA0 0xFFC00FA0 /* CAN0 Mailbox Word 0 Register */
212#define CAN0_MB30_DATA0 0xFFC00FC0 /* CAN0 Mailbox Word 0 Register */
213#define CAN0_MB31_DATA0 0xFFC00FE0 /* CAN0 Mailbox Word 0 Register */
214#define CAN0_MB00_DATA1 0xFFC00C04 /* CAN0 Mailbox Word 1 Register */
215#define CAN0_MB01_DATA1 0xFFC00C24 /* CAN0 Mailbox Word 1 Register */
216#define CAN0_MB02_DATA1 0xFFC00C44 /* CAN0 Mailbox Word 1 Register */
217#define CAN0_MB03_DATA1 0xFFC00C64 /* CAN0 Mailbox Word 1 Register */
218#define CAN0_MB04_DATA1 0xFFC00C84 /* CAN0 Mailbox Word 1 Register */
219#define CAN0_MB05_DATA1 0xFFC00CA4 /* CAN0 Mailbox Word 1 Register */
220#define CAN0_MB06_DATA1 0xFFC00CC4 /* CAN0 Mailbox Word 1 Register */
221#define CAN0_MB07_DATA1 0xFFC00CE4 /* CAN0 Mailbox Word 1 Register */
222#define CAN0_MB08_DATA1 0xFFC00D04 /* CAN0 Mailbox Word 1 Register */
223#define CAN0_MB09_DATA1 0xFFC00D24 /* CAN0 Mailbox Word 1 Register */
224#define CAN0_MB10_DATA1 0xFFC00D44 /* CAN0 Mailbox Word 1 Register */
225#define CAN0_MB11_DATA1 0xFFC00D64 /* CAN0 Mailbox Word 1 Register */
226#define CAN0_MB12_DATA1 0xFFC00D84 /* CAN0 Mailbox Word 1 Register */
227#define CAN0_MB13_DATA1 0xFFC00DA4 /* CAN0 Mailbox Word 1 Register */
228#define CAN0_MB14_DATA1 0xFFC00DC4 /* CAN0 Mailbox Word 1 Register */
229#define CAN0_MB15_DATA1 0xFFC00DE4 /* CAN0 Mailbox Word 1 Register */
230#define CAN0_MB16_DATA1 0xFFC00E04 /* CAN0 Mailbox Word 1 Register */
231#define CAN0_MB17_DATA1 0xFFC00E24 /* CAN0 Mailbox Word 1 Register */
232#define CAN0_MB18_DATA1 0xFFC00E44 /* CAN0 Mailbox Word 1 Register */
233#define CAN0_MB19_DATA1 0xFFC00E64 /* CAN0 Mailbox Word 1 Register */
234#define CAN0_MB20_DATA1 0xFFC00E84 /* CAN0 Mailbox Word 1 Register */
235#define CAN0_MB21_DATA1 0xFFC00EA4 /* CAN0 Mailbox Word 1 Register */
236#define CAN0_MB22_DATA1 0xFFC00EC4 /* CAN0 Mailbox Word 1 Register */
237#define CAN0_MB23_DATA1 0xFFC00EE4 /* CAN0 Mailbox Word 1 Register */
238#define CAN0_MB24_DATA1 0xFFC00F04 /* CAN0 Mailbox Word 1 Register */
239#define CAN0_MB25_DATA1 0xFFC00F24 /* CAN0 Mailbox Word 1 Register */
240#define CAN0_MB26_DATA1 0xFFC00F44 /* CAN0 Mailbox Word 1 Register */
241#define CAN0_MB27_DATA1 0xFFC00F64 /* CAN0 Mailbox Word 1 Register */
242#define CAN0_MB28_DATA1 0xFFC00F84 /* CAN0 Mailbox Word 1 Register */
243#define CAN0_MB29_DATA1 0xFFC00FA4 /* CAN0 Mailbox Word 1 Register */
244#define CAN0_MB30_DATA1 0xFFC00FC4 /* CAN0 Mailbox Word 1 Register */
245#define CAN0_MB31_DATA1 0xFFC00FE4 /* CAN0 Mailbox Word 1 Register */
246#define CAN0_MB00_DATA2 0xFFC00C08 /* CAN0 Mailbox Word 2 Register */
247#define CAN0_MB01_DATA2 0xFFC00C28 /* CAN0 Mailbox Word 2 Register */
248#define CAN0_MB02_DATA2 0xFFC00C48 /* CAN0 Mailbox Word 2 Register */
249#define CAN0_MB03_DATA2 0xFFC00C68 /* CAN0 Mailbox Word 2 Register */
250#define CAN0_MB04_DATA2 0xFFC00C88 /* CAN0 Mailbox Word 2 Register */
251#define CAN0_MB05_DATA2 0xFFC00CA8 /* CAN0 Mailbox Word 2 Register */
252#define CAN0_MB06_DATA2 0xFFC00CC8 /* CAN0 Mailbox Word 2 Register */
253#define CAN0_MB07_DATA2 0xFFC00CE8 /* CAN0 Mailbox Word 2 Register */
254#define CAN0_MB08_DATA2 0xFFC00D08 /* CAN0 Mailbox Word 2 Register */
255#define CAN0_MB09_DATA2 0xFFC00D28 /* CAN0 Mailbox Word 2 Register */
256#define CAN0_MB10_DATA2 0xFFC00D48 /* CAN0 Mailbox Word 2 Register */
257#define CAN0_MB11_DATA2 0xFFC00D68 /* CAN0 Mailbox Word 2 Register */
258#define CAN0_MB12_DATA2 0xFFC00D88 /* CAN0 Mailbox Word 2 Register */
259#define CAN0_MB13_DATA2 0xFFC00DA8 /* CAN0 Mailbox Word 2 Register */
260#define CAN0_MB14_DATA2 0xFFC00DC8 /* CAN0 Mailbox Word 2 Register */
261#define CAN0_MB15_DATA2 0xFFC00DE8 /* CAN0 Mailbox Word 2 Register */
262#define CAN0_MB16_DATA2 0xFFC00E08 /* CAN0 Mailbox Word 2 Register */
263#define CAN0_MB17_DATA2 0xFFC00E28 /* CAN0 Mailbox Word 2 Register */
264#define CAN0_MB18_DATA2 0xFFC00E48 /* CAN0 Mailbox Word 2 Register */
265#define CAN0_MB19_DATA2 0xFFC00E68 /* CAN0 Mailbox Word 2 Register */
266#define CAN0_MB20_DATA2 0xFFC00E88 /* CAN0 Mailbox Word 2 Register */
267#define CAN0_MB21_DATA2 0xFFC00EA8 /* CAN0 Mailbox Word 2 Register */
268#define CAN0_MB22_DATA2 0xFFC00EC8 /* CAN0 Mailbox Word 2 Register */
269#define CAN0_MB23_DATA2 0xFFC00EE8 /* CAN0 Mailbox Word 2 Register */
270#define CAN0_MB24_DATA2 0xFFC00F08 /* CAN0 Mailbox Word 2 Register */
271#define CAN0_MB25_DATA2 0xFFC00F28 /* CAN0 Mailbox Word 2 Register */
272#define CAN0_MB26_DATA2 0xFFC00F48 /* CAN0 Mailbox Word 2 Register */
273#define CAN0_MB27_DATA2 0xFFC00F68 /* CAN0 Mailbox Word 2 Register */
274#define CAN0_MB28_DATA2 0xFFC00F88 /* CAN0 Mailbox Word 2 Register */
275#define CAN0_MB29_DATA2 0xFFC00FA8 /* CAN0 Mailbox Word 2 Register */
276#define CAN0_MB30_DATA2 0xFFC00FC8 /* CAN0 Mailbox Word 2 Register */
277#define CAN0_MB31_DATA2 0xFFC00FE8 /* CAN0 Mailbox Word 2 Register */
278#define CAN0_MB00_DATA3 0xFFC00C0C /* CAN0 Mailbox Word 3 Register */
279#define CAN0_MB01_DATA3 0xFFC00C2C /* CAN0 Mailbox Word 3 Register */
280#define CAN0_MB02_DATA3 0xFFC00C4C /* CAN0 Mailbox Word 3 Register */
281#define CAN0_MB03_DATA3 0xFFC00C6C /* CAN0 Mailbox Word 3 Register */
282#define CAN0_MB04_DATA3 0xFFC00C8C /* CAN0 Mailbox Word 3 Register */
283#define CAN0_MB05_DATA3 0xFFC00CAC /* CAN0 Mailbox Word 3 Register */
284#define CAN0_MB06_DATA3 0xFFC00CCC /* CAN0 Mailbox Word 3 Register */
285#define CAN0_MB07_DATA3 0xFFC00CEC /* CAN0 Mailbox Word 3 Register */
286#define CAN0_MB08_DATA3 0xFFC00D0C /* CAN0 Mailbox Word 3 Register */
287#define CAN0_MB09_DATA3 0xFFC00D2C /* CAN0 Mailbox Word 3 Register */
288#define CAN0_MB10_DATA3 0xFFC00D4C /* CAN0 Mailbox Word 3 Register */
289#define CAN0_MB11_DATA3 0xFFC00D6C /* CAN0 Mailbox Word 3 Register */
290#define CAN0_MB12_DATA3 0xFFC00D8C /* CAN0 Mailbox Word 3 Register */
291#define CAN0_MB13_DATA3 0xFFC00DAC /* CAN0 Mailbox Word 3 Register */
292#define CAN0_MB14_DATA3 0xFFC00DCC /* CAN0 Mailbox Word 3 Register */
293#define CAN0_MB15_DATA3 0xFFC00DEC /* CAN0 Mailbox Word 3 Register */
294#define CAN0_MB16_DATA3 0xFFC00E0C /* CAN0 Mailbox Word 3 Register */
295#define CAN0_MB17_DATA3 0xFFC00E2C /* CAN0 Mailbox Word 3 Register */
296#define CAN0_MB18_DATA3 0xFFC00E4C /* CAN0 Mailbox Word 3 Register */
297#define CAN0_MB19_DATA3 0xFFC00E6C /* CAN0 Mailbox Word 3 Register */
298#define CAN0_MB20_DATA3 0xFFC00E8C /* CAN0 Mailbox Word 3 Register */
299#define CAN0_MB21_DATA3 0xFFC00EAC /* CAN0 Mailbox Word 3 Register */
300#define CAN0_MB22_DATA3 0xFFC00ECC /* CAN0 Mailbox Word 3 Register */
301#define CAN0_MB23_DATA3 0xFFC00EEC /* CAN0 Mailbox Word 3 Register */
302#define CAN0_MB24_DATA3 0xFFC00F0C /* CAN0 Mailbox Word 3 Register */
303#define CAN0_MB25_DATA3 0xFFC00F2C /* CAN0 Mailbox Word 3 Register */
304#define CAN0_MB26_DATA3 0xFFC00F4C /* CAN0 Mailbox Word 3 Register */
305#define CAN0_MB27_DATA3 0xFFC00F6C /* CAN0 Mailbox Word 3 Register */
306#define CAN0_MB28_DATA3 0xFFC00F8C /* CAN0 Mailbox Word 3 Register */
307#define CAN0_MB29_DATA3 0xFFC00FAC /* CAN0 Mailbox Word 3 Register */
308#define CAN0_MB30_DATA3 0xFFC00FCC /* CAN0 Mailbox Word 3 Register */
309#define CAN0_MB31_DATA3 0xFFC00FEC /* CAN0 Mailbox Word 3 Register */
310#define CAN0_MB00_LENGTH 0xFFC00C10 /* CAN0 Mailbox Word 4 Register */
311#define CAN0_MB01_LENGTH 0xFFC00C30 /* CAN0 Mailbox Word 4 Register */
312#define CAN0_MB02_LENGTH 0xFFC00C50 /* CAN0 Mailbox Word 4 Register */
313#define CAN0_MB03_LENGTH 0xFFC00C70 /* CAN0 Mailbox Word 4 Register */
314#define CAN0_MB04_LENGTH 0xFFC00C90 /* CAN0 Mailbox Word 4 Register */
315#define CAN0_MB05_LENGTH 0xFFC00CB0 /* CAN0 Mailbox Word 4 Register */
316#define CAN0_MB06_LENGTH 0xFFC00CD0 /* CAN0 Mailbox Word 4 Register */
317#define CAN0_MB07_LENGTH 0xFFC00CF0 /* CAN0 Mailbox Word 4 Register */
318#define CAN0_MB08_LENGTH 0xFFC00D10 /* CAN0 Mailbox Word 4 Register */
319#define CAN0_MB09_LENGTH 0xFFC00D30 /* CAN0 Mailbox Word 4 Register */
320#define CAN0_MB10_LENGTH 0xFFC00D50 /* CAN0 Mailbox Word 4 Register */
321#define CAN0_MB11_LENGTH 0xFFC00D70 /* CAN0 Mailbox Word 4 Register */
322#define CAN0_MB12_LENGTH 0xFFC00D90 /* CAN0 Mailbox Word 4 Register */
323#define CAN0_MB13_LENGTH 0xFFC00DB0 /* CAN0 Mailbox Word 4 Register */
324#define CAN0_MB14_LENGTH 0xFFC00DD0 /* CAN0 Mailbox Word 4 Register */
325#define CAN0_MB15_LENGTH 0xFFC00DF0 /* CAN0 Mailbox Word 4 Register */
326#define CAN0_MB16_LENGTH 0xFFC00E10 /* CAN0 Mailbox Word 4 Register */
327#define CAN0_MB17_LENGTH 0xFFC00E30 /* CAN0 Mailbox Word 4 Register */
328#define CAN0_MB18_LENGTH 0xFFC00E50 /* CAN0 Mailbox Word 4 Register */
329#define CAN0_MB19_LENGTH 0xFFC00E70 /* CAN0 Mailbox Word 4 Register */
330#define CAN0_MB20_LENGTH 0xFFC00E90 /* CAN0 Mailbox Word 4 Register */
331#define CAN0_MB21_LENGTH 0xFFC00EB0 /* CAN0 Mailbox Word 4 Register */
332#define CAN0_MB22_LENGTH 0xFFC00ED0 /* CAN0 Mailbox Word 4 Register */
333#define CAN0_MB23_LENGTH 0xFFC00EF0 /* CAN0 Mailbox Word 4 Register */
334#define CAN0_MB24_LENGTH 0xFFC00F10 /* CAN0 Mailbox Word 4 Register */
335#define CAN0_MB25_LENGTH 0xFFC00F30 /* CAN0 Mailbox Word 4 Register */
336#define CAN0_MB26_LENGTH 0xFFC00F50 /* CAN0 Mailbox Word 4 Register */
337#define CAN0_MB27_LENGTH 0xFFC00F70 /* CAN0 Mailbox Word 4 Register */
338#define CAN0_MB28_LENGTH 0xFFC00F90 /* CAN0 Mailbox Word 4 Register */
339#define CAN0_MB29_LENGTH 0xFFC00FB0 /* CAN0 Mailbox Word 4 Register */
340#define CAN0_MB30_LENGTH 0xFFC00FD0 /* CAN0 Mailbox Word 4 Register */
341#define CAN0_MB31_LENGTH 0xFFC00FF0 /* CAN0 Mailbox Word 4 Register */
342#define CAN0_MB00_TIMESTAMP 0xFFC00C14 /* CAN0 Mailbox Word 5 Register */
343#define CAN0_MB01_TIMESTAMP 0xFFC00C34 /* CAN0 Mailbox Word 5 Register */
344#define CAN0_MB02_TIMESTAMP 0xFFC00C54 /* CAN0 Mailbox Word 5 Register */
345#define CAN0_MB03_TIMESTAMP 0xFFC00C74 /* CAN0 Mailbox Word 5 Register */
346#define CAN0_MB04_TIMESTAMP 0xFFC00C94 /* CAN0 Mailbox Word 5 Register */
347#define CAN0_MB05_TIMESTAMP 0xFFC00CB4 /* CAN0 Mailbox Word 5 Register */
348#define CAN0_MB06_TIMESTAMP 0xFFC00CD4 /* CAN0 Mailbox Word 5 Register */
349#define CAN0_MB07_TIMESTAMP 0xFFC00CF4 /* CAN0 Mailbox Word 5 Register */
350#define CAN0_MB08_TIMESTAMP 0xFFC00D14 /* CAN0 Mailbox Word 5 Register */
351#define CAN0_MB09_TIMESTAMP 0xFFC00D34 /* CAN0 Mailbox Word 5 Register */
352#define CAN0_MB10_TIMESTAMP 0xFFC00D54 /* CAN0 Mailbox Word 5 Register */
353#define CAN0_MB11_TIMESTAMP 0xFFC00D74 /* CAN0 Mailbox Word 5 Register */
354#define CAN0_MB12_TIMESTAMP 0xFFC00D94 /* CAN0 Mailbox Word 5 Register */
355#define CAN0_MB13_TIMESTAMP 0xFFC00DB4 /* CAN0 Mailbox Word 5 Register */
356#define CAN0_MB14_TIMESTAMP 0xFFC00DD4 /* CAN0 Mailbox Word 5 Register */
357#define CAN0_MB15_TIMESTAMP 0xFFC00DF4 /* CAN0 Mailbox Word 5 Register */
358#define CAN0_MB16_TIMESTAMP 0xFFC00E14 /* CAN0 Mailbox Word 5 Register */
359#define CAN0_MB17_TIMESTAMP 0xFFC00E34 /* CAN0 Mailbox Word 5 Register */
360#define CAN0_MB18_TIMESTAMP 0xFFC00E54 /* CAN0 Mailbox Word 5 Register */
361#define CAN0_MB19_TIMESTAMP 0xFFC00E74 /* CAN0 Mailbox Word 5 Register */
362#define CAN0_MB20_TIMESTAMP 0xFFC00E94 /* CAN0 Mailbox Word 5 Register */
363#define CAN0_MB21_TIMESTAMP 0xFFC00EB4 /* CAN0 Mailbox Word 5 Register */
364#define CAN0_MB22_TIMESTAMP 0xFFC00ED4 /* CAN0 Mailbox Word 5 Register */
365#define CAN0_MB23_TIMESTAMP 0xFFC00EF4 /* CAN0 Mailbox Word 5 Register */
366#define CAN0_MB24_TIMESTAMP 0xFFC00F14 /* CAN0 Mailbox Word 5 Register */
367#define CAN0_MB25_TIMESTAMP 0xFFC00F34 /* CAN0 Mailbox Word 5 Register */
368#define CAN0_MB26_TIMESTAMP 0xFFC00F54 /* CAN0 Mailbox Word 5 Register */
369#define CAN0_MB27_TIMESTAMP 0xFFC00F74 /* CAN0 Mailbox Word 5 Register */
370#define CAN0_MB28_TIMESTAMP 0xFFC00F94 /* CAN0 Mailbox Word 5 Register */
371#define CAN0_MB29_TIMESTAMP 0xFFC00FB4 /* CAN0 Mailbox Word 5 Register */
372#define CAN0_MB30_TIMESTAMP 0xFFC00FD4 /* CAN0 Mailbox Word 5 Register */
373#define CAN0_MB31_TIMESTAMP 0xFFC00FF4 /* CAN0 Mailbox Word 5 Register */
374#define CAN0_MB00_ID0 0xFFC00C18 /* CAN0 Mailbox Word 6 Register */
375#define CAN0_MB01_ID0 0xFFC00C38 /* CAN0 Mailbox Word 6 Register */
376#define CAN0_MB02_ID0 0xFFC00C58 /* CAN0 Mailbox Word 6 Register */
377#define CAN0_MB03_ID0 0xFFC00C78 /* CAN0 Mailbox Word 6 Register */
378#define CAN0_MB04_ID0 0xFFC00C98 /* CAN0 Mailbox Word 6 Register */
379#define CAN0_MB05_ID0 0xFFC00CB8 /* CAN0 Mailbox Word 6 Register */
380#define CAN0_MB06_ID0 0xFFC00CD8 /* CAN0 Mailbox Word 6 Register */
381#define CAN0_MB07_ID0 0xFFC00CF8 /* CAN0 Mailbox Word 6 Register */
382#define CAN0_MB08_ID0 0xFFC00D18 /* CAN0 Mailbox Word 6 Register */
383#define CAN0_MB09_ID0 0xFFC00D38 /* CAN0 Mailbox Word 6 Register */
384#define CAN0_MB10_ID0 0xFFC00D58 /* CAN0 Mailbox Word 6 Register */
385#define CAN0_MB11_ID0 0xFFC00D78 /* CAN0 Mailbox Word 6 Register */
386#define CAN0_MB12_ID0 0xFFC00D98 /* CAN0 Mailbox Word 6 Register */
387#define CAN0_MB13_ID0 0xFFC00DB8 /* CAN0 Mailbox Word 6 Register */
388#define CAN0_MB14_ID0 0xFFC00DD8 /* CAN0 Mailbox Word 6 Register */
389#define CAN0_MB15_ID0 0xFFC00DF8 /* CAN0 Mailbox Word 6 Register */
390#define CAN0_MB16_ID0 0xFFC00E18 /* CAN0 Mailbox Word 6 Register */
391#define CAN0_MB17_ID0 0xFFC00E38 /* CAN0 Mailbox Word 6 Register */
392#define CAN0_MB18_ID0 0xFFC00E58 /* CAN0 Mailbox Word 6 Register */
393#define CAN0_MB19_ID0 0xFFC00E78 /* CAN0 Mailbox Word 6 Register */
394#define CAN0_MB20_ID0 0xFFC00E98 /* CAN0 Mailbox Word 6 Register */
395#define CAN0_MB21_ID0 0xFFC00EB8 /* CAN0 Mailbox Word 6 Register */
396#define CAN0_MB22_ID0 0xFFC00ED8 /* CAN0 Mailbox Word 6 Register */
397#define CAN0_MB23_ID0 0xFFC00EF8 /* CAN0 Mailbox Word 6 Register */
398#define CAN0_MB24_ID0 0xFFC00F18 /* CAN0 Mailbox Word 6 Register */
399#define CAN0_MB25_ID0 0xFFC00F38 /* CAN0 Mailbox Word 6 Register */
400#define CAN0_MB26_ID0 0xFFC00F58 /* CAN0 Mailbox Word 6 Register */
401#define CAN0_MB27_ID0 0xFFC00F78 /* CAN0 Mailbox Word 6 Register */
402#define CAN0_MB28_ID0 0xFFC00F98 /* CAN0 Mailbox Word 6 Register */
403#define CAN0_MB29_ID0 0xFFC00FB8 /* CAN0 Mailbox Word 6 Register */
404#define CAN0_MB30_ID0 0xFFC00FD8 /* CAN0 Mailbox Word 6 Register */
405#define CAN0_MB31_ID0 0xFFC00FF8 /* CAN0 Mailbox Word 6 Register */
406#define CAN0_MB00_ID1 0xFFC00C1C /* CAN0 Mailbox Word 7 Register */
407#define CAN0_MB01_ID1 0xFFC00C3C /* CAN0 Mailbox Word 7 Register */
408#define CAN0_MB02_ID1 0xFFC00C5C /* CAN0 Mailbox Word 7 Register */
409#define CAN0_MB03_ID1 0xFFC00C7C /* CAN0 Mailbox Word 7 Register */
410#define CAN0_MB04_ID1 0xFFC00C9C /* CAN0 Mailbox Word 7 Register */
411#define CAN0_MB05_ID1 0xFFC00CBC /* CAN0 Mailbox Word 7 Register */
412#define CAN0_MB06_ID1 0xFFC00CDC /* CAN0 Mailbox Word 7 Register */
413#define CAN0_MB07_ID1 0xFFC00CFC /* CAN0 Mailbox Word 7 Register */
414#define CAN0_MB08_ID1 0xFFC00D1C /* CAN0 Mailbox Word 7 Register */
415#define CAN0_MB09_ID1 0xFFC00D3C /* CAN0 Mailbox Word 7 Register */
416#define CAN0_MB10_ID1 0xFFC00D5C /* CAN0 Mailbox Word 7 Register */
417#define CAN0_MB11_ID1 0xFFC00D7C /* CAN0 Mailbox Word 7 Register */
418#define CAN0_MB12_ID1 0xFFC00D9C /* CAN0 Mailbox Word 7 Register */
419#define CAN0_MB13_ID1 0xFFC00DBC /* CAN0 Mailbox Word 7 Register */
420#define CAN0_MB14_ID1 0xFFC00DDC /* CAN0 Mailbox Word 7 Register */
421#define CAN0_MB15_ID1 0xFFC00DFC /* CAN0 Mailbox Word 7 Register */
422#define CAN0_MB16_ID1 0xFFC00E1C /* CAN0 Mailbox Word 7 Register */
423#define CAN0_MB17_ID1 0xFFC00E3C /* CAN0 Mailbox Word 7 Register */
424#define CAN0_MB18_ID1 0xFFC00E5C /* CAN0 Mailbox Word 7 Register */
425#define CAN0_MB19_ID1 0xFFC00E7C /* CAN0 Mailbox Word 7 Register */
426#define CAN0_MB20_ID1 0xFFC00E9C /* CAN0 Mailbox Word 7 Register */
427#define CAN0_MB21_ID1 0xFFC00EBC /* CAN0 Mailbox Word 7 Register */
428#define CAN0_MB22_ID1 0xFFC00EDC /* CAN0 Mailbox Word 7 Register */
429#define CAN0_MB23_ID1 0xFFC00EFC /* CAN0 Mailbox Word 7 Register */
430#define CAN0_MB24_ID1 0xFFC00F1C /* CAN0 Mailbox Word 7 Register */
431#define CAN0_MB25_ID1 0xFFC00F3C /* CAN0 Mailbox Word 7 Register */
432#define CAN0_MB26_ID1 0xFFC00F5C /* CAN0 Mailbox Word 7 Register */
433#define CAN0_MB27_ID1 0xFFC00F7C /* CAN0 Mailbox Word 7 Register */
434#define CAN0_MB28_ID1 0xFFC00F9C /* CAN0 Mailbox Word 7 Register */
435#define CAN0_MB29_ID1 0xFFC00FBC /* CAN0 Mailbox Word 7 Register */
436#define CAN0_MB30_ID1 0xFFC00FDC /* CAN0 Mailbox Word 7 Register */
437#define CAN0_MB31_ID1 0xFFC00FFC /* CAN0 Mailbox Word 7 Register */
438
439/* =========================
440 LINK PORT Registers
441 ========================= */
442#define LP0_CTL 0xFFC01000 /* LP0 Control Register */
443#define LP0_STAT 0xFFC01004 /* LP0 Status Register */
444#define LP0_DIV 0xFFC01008 /* LP0 Clock Divider Value */
445#define LP0_CNT 0xFFC0100C /* LP0 Current Count Value of Clock Divider */
446#define LP0_TX 0xFFC01010 /* LP0 Transmit Buffer */
447#define LP0_RX 0xFFC01014 /* LP0 Receive Buffer */
448#define LP0_TXIN_SHDW 0xFFC01018 /* LP0 Shadow Input Transmit Buffer */
449#define LP0_TXOUT_SHDW 0xFFC0101C /* LP0 Shadow Output Transmit Buffer */
450#define LP1_CTL 0xFFC01100 /* LP1 Control Register */
451#define LP1_STAT 0xFFC01104 /* LP1 Status Register */
452#define LP1_DIV 0xFFC01108 /* LP1 Clock Divider Value */
453#define LP1_CNT 0xFFC0110C /* LP1 Current Count Value of Clock Divider */
454#define LP1_TX 0xFFC01110 /* LP1 Transmit Buffer */
455#define LP1_RX 0xFFC01114 /* LP1 Receive Buffer */
456#define LP1_TXIN_SHDW 0xFFC01118 /* LP1 Shadow Input Transmit Buffer */
457#define LP1_TXOUT_SHDW 0xFFC0111C /* LP1 Shadow Output Transmit Buffer */
458#define LP2_CTL 0xFFC01200 /* LP2 Control Register */
459#define LP2_STAT 0xFFC01204 /* LP2 Status Register */
460#define LP2_DIV 0xFFC01208 /* LP2 Clock Divider Value */
461#define LP2_CNT 0xFFC0120C /* LP2 Current Count Value of Clock Divider */
462#define LP2_TX 0xFFC01210 /* LP2 Transmit Buffer */
463#define LP2_RX 0xFFC01214 /* LP2 Receive Buffer */
464#define LP2_TXIN_SHDW 0xFFC01218 /* LP2 Shadow Input Transmit Buffer */
465#define LP2_TXOUT_SHDW 0xFFC0121C /* LP2 Shadow Output Transmit Buffer */
466#define LP3_CTL 0xFFC01300 /* LP3 Control Register */
467#define LP3_STAT 0xFFC01304 /* LP3 Status Register */
468#define LP3_DIV 0xFFC01308 /* LP3 Clock Divider Value */
469#define LP3_CNT 0xFFC0130C /* LP3 Current Count Value of Clock Divider */
470#define LP3_TX 0xFFC01310 /* LP3 Transmit Buffer */
471#define LP3_RX 0xFFC01314 /* LP3 Receive Buffer */
472#define LP3_TXIN_SHDW 0xFFC01318 /* LP3 Shadow Input Transmit Buffer */
473#define LP3_TXOUT_SHDW 0xFFC0131C /* LP3 Shadow Output Transmit Buffer */
474
475/* =========================
476 TIMER Registers
477 ========================= */
478#define TIMER_REVID 0xFFC01400 /* GPTIMER Timer IP Version ID */
479#define TIMER_RUN 0xFFC01404 /* GPTIMER Timer Run Register */
480#define TIMER_RUN_SET 0xFFC01408 /* GPTIMER Run Register Alias to Set */
481#define TIMER_RUN_CLR 0xFFC0140C /* GPTIMER Run Register Alias to Clear */
482#define TIMER_STOP_CFG 0xFFC01410 /* GPTIMER Stop Config Register */
483#define TIMER_STOP_CFG_SET 0xFFC01414 /* GPTIMER Stop Config Alias to Set */
484#define TIMER_STOP_CFG_CLR 0xFFC01418 /* GPTIMER Stop Config Alias to Clear */
485#define TIMER_DATA_IMSK 0xFFC0141C /* GPTIMER Data Interrupt Mask register */
486#define TIMER_STAT_IMSK 0xFFC01420 /* GPTIMER Status Interrupt Mask register */
487#define TIMER_TRG_MSK 0xFFC01424 /* GPTIMER Output Trigger Mask register */
488#define TIMER_TRG_IE 0xFFC01428 /* GPTIMER Slave Trigger Enable register */
489#define TIMER_DATA_ILAT 0xFFC0142C /* GPTIMER Data Interrupt Register */
490#define TIMER_STAT_ILAT 0xFFC01430 /* GPTIMER Status (Error) Interrupt Register */
491#define TIMER_ERR_TYPE 0xFFC01434 /* GPTIMER Register Indicating Type of Error */
492#define TIMER_BCAST_PER 0xFFC01438 /* GPTIMER Broadcast Period */
493#define TIMER_BCAST_WID 0xFFC0143C /* GPTIMER Broadcast Width */
494#define TIMER_BCAST_DLY 0xFFC01440 /* GPTIMER Broadcast Delay */
495
496/* =========================
497 TIMER0~7
498 ========================= */
499#define TIMER0_CONFIG 0xFFC01460 /* TIMER0 Per Timer Config Register */
500#define TIMER0_COUNTER 0xFFC01464 /* TIMER0 Per Timer Counter Register */
501#define TIMER0_PERIOD 0xFFC01468 /* TIMER0 Per Timer Period Register */
502#define TIMER0_WIDTH 0xFFC0146C /* TIMER0 Per Timer Width Register */
503#define TIMER0_DELAY 0xFFC01470 /* TIMER0 Per Timer Delay Register */
504
505#define TIMER1_CONFIG 0xFFC01480 /* TIMER1 Per Timer Config Register */
506#define TIMER1_COUNTER 0xFFC01484 /* TIMER1 Per Timer Counter Register */
507#define TIMER1_PERIOD 0xFFC01488 /* TIMER1 Per Timer Period Register */
508#define TIMER1_WIDTH 0xFFC0148C /* TIMER1 Per Timer Width Register */
509#define TIMER1_DELAY 0xFFC01490 /* TIMER1 Per Timer Delay Register */
510
511#define TIMER2_CONFIG 0xFFC014A0 /* TIMER2 Per Timer Config Register */
512#define TIMER2_COUNTER 0xFFC014A4 /* TIMER2 Per Timer Counter Register */
513#define TIMER2_PERIOD 0xFFC014A8 /* TIMER2 Per Timer Period Register */
514#define TIMER2_WIDTH 0xFFC014AC /* TIMER2 Per Timer Width Register */
515#define TIMER2_DELAY 0xFFC014B0 /* TIMER2 Per Timer Delay Register */
516
517#define TIMER3_CONFIG 0xFFC014C0 /* TIMER3 Per Timer Config Register */
518#define TIMER3_COUNTER 0xFFC014C4 /* TIMER3 Per Timer Counter Register */
519#define TIMER3_PERIOD 0xFFC014C8 /* TIMER3 Per Timer Period Register */
520#define TIMER3_WIDTH 0xFFC014CC /* TIMER3 Per Timer Width Register */
521#define TIMER3_DELAY 0xFFC014D0 /* TIMER3 Per Timer Delay Register */
522
523#define TIMER4_CONFIG 0xFFC014E0 /* TIMER4 Per Timer Config Register */
524#define TIMER4_COUNTER 0xFFC014E4 /* TIMER4 Per Timer Counter Register */
525#define TIMER4_PERIOD 0xFFC014E8 /* TIMER4 Per Timer Period Register */
526#define TIMER4_WIDTH 0xFFC014EC /* TIMER4 Per Timer Width Register */
527#define TIMER4_DELAY 0xFFC014F0 /* TIMER4 Per Timer Delay Register */
528
529#define TIMER5_CONFIG 0xFFC01500 /* TIMER5 Per Timer Config Register */
530#define TIMER5_COUNTER 0xFFC01504 /* TIMER5 Per Timer Counter Register */
531#define TIMER5_PERIOD 0xFFC01508 /* TIMER5 Per Timer Period Register */
532#define TIMER5_WIDTH 0xFFC0150C /* TIMER5 Per Timer Width Register */
533#define TIMER5_DELAY 0xFFC01510 /* TIMER5 Per Timer Delay Register */
534
535#define TIMER6_CONFIG 0xFFC01520 /* TIMER6 Per Timer Config Register */
536#define TIMER6_COUNTER 0xFFC01524 /* TIMER6 Per Timer Counter Register */
537#define TIMER6_PERIOD 0xFFC01528 /* TIMER6 Per Timer Period Register */
538#define TIMER6_WIDTH 0xFFC0152C /* TIMER6 Per Timer Width Register */
539#define TIMER6_DELAY 0xFFC01530 /* TIMER6 Per Timer Delay Register */
540
541#define TIMER7_CONFIG 0xFFC01540 /* TIMER7 Per Timer Config Register */
542#define TIMER7_COUNTER 0xFFC01544 /* TIMER7 Per Timer Counter Register */
543#define TIMER7_PERIOD 0xFFC01548 /* TIMER7 Per Timer Period Register */
544#define TIMER7_WIDTH 0xFFC0154C /* TIMER7 Per Timer Width Register */
545#define TIMER7_DELAY 0xFFC01550 /* TIMER7 Per Timer Delay Register */
546
547/* =========================
548 CRC Registers
549 ========================= */
550
551/* =========================
552 CRC0
553 ========================= */
554#define REG_CRC0_CTL 0xFFC01C00 /* CRC0 Control Register */
555#define REG_CRC0_DCNT 0xFFC01C04 /* CRC0 Data Word Count Register */
556#define REG_CRC0_DCNTRLD 0xFFC01C08 /* CRC0 Data Word Count Reload Register */
557#define REG_CRC0_COMP 0xFFC01C14 /* CRC0 DATA Compare Register */
558#define REG_CRC0_FILLVAL 0xFFC01C18 /* CRC0 Fill Value Register */
559#define REG_CRC0_DFIFO 0xFFC01C1C /* CRC0 DATA FIFO Register */
560#define REG_CRC0_INEN 0xFFC01C20 /* CRC0 Interrupt Enable Register */
561#define REG_CRC0_INEN_SET 0xFFC01C24 /* CRC0 Interrupt Enable Set Register */
562#define REG_CRC0_INEN_CLR 0xFFC01C28 /* CRC0 Interrupt Enable Clear Register */
563#define REG_CRC0_POLY 0xFFC01C2C /* CRC0 Polynomial Register */
564#define REG_CRC0_STAT 0xFFC01C40 /* CRC0 Status Register */
565#define REG_CRC0_DCNTCAP 0xFFC01C44 /* CRC0 DATA Count Capture Register */
566#define REG_CRC0_RESULT_FIN 0xFFC01C4C /* CRC0 Final CRC Result Register */
567#define REG_CRC0_RESULT_CUR 0xFFC01C50 /* CRC0 Current CRC Result Register */
568#define REG_CRC0_REVID 0xFFC01C60 /* CRC0 Revision ID Register */
569
570/* =========================
571 CRC1
572 ========================= */
573#define REG_CRC1_CTL 0xFFC01D00 /* CRC1 Control Register */
574#define REG_CRC1_DCNT 0xFFC01D04 /* CRC1 Data Word Count Register */
575#define REG_CRC1_DCNTRLD 0xFFC01D08 /* CRC1 Data Word Count Reload Register */
576#define REG_CRC1_COMP 0xFFC01D14 /* CRC1 DATA Compare Register */
577#define REG_CRC1_FILLVAL 0xFFC01D18 /* CRC1 Fill Value Register */
578#define REG_CRC1_DFIFO 0xFFC01D1C /* CRC1 DATA FIFO Register */
579#define REG_CRC1_INEN 0xFFC01D20 /* CRC1 Interrupt Enable Register */
580#define REG_CRC1_INEN_SET 0xFFC01D24 /* CRC1 Interrupt Enable Set Register */
581#define REG_CRC1_INEN_CLR 0xFFC01D28 /* CRC1 Interrupt Enable Clear Register */
582#define REG_CRC1_POLY 0xFFC01D2C /* CRC1 Polynomial Register */
583#define REG_CRC1_STAT 0xFFC01D40 /* CRC1 Status Register */
584#define REG_CRC1_DCNTCAP 0xFFC01D44 /* CRC1 DATA Count Capture Register */
585#define REG_CRC1_RESULT_FIN 0xFFC01D4C /* CRC1 Final CRC Result Register */
586#define REG_CRC1_RESULT_CUR 0xFFC01D50 /* CRC1 Current CRC Result Register */
587#define REG_CRC1_REVID 0xFFC01D60 /* CRC1 Revision ID Register */
588
589/* =========================
590 TWI Registers
591 ========================= */
592
593/* =========================
594 TWI0
595 ========================= */
596#define TWI0_CLKDIV 0xFFC01E00 /* TWI0 SCL Clock Divider */
597#define TWI0_CONTROL 0xFFC01E04 /* TWI0 Control Register */
598#define TWI0_SLAVE_CTL 0xFFC01E08 /* TWI0 Slave Mode Control Register */
599#define TWI0_SLAVE_STAT 0xFFC01E0C /* TWI0 Slave Mode Status Register */
600#define TWI0_SLAVE_ADDR 0xFFC01E10 /* TWI0 Slave Mode Address Register */
601#define TWI0_MASTER_CTL 0xFFC01E14 /* TWI0 Master Mode Control Registers */
602#define TWI0_MASTER_STAT 0xFFC01E18 /* TWI0 Master Mode Status Register */
603#define TWI0_MASTER_ADDR 0xFFC01E1C /* TWI0 Master Mode Address Register */
604#define TWI0_INT_STAT 0xFFC01E20 /* TWI0 Interrupt Status Register */
605#define TWI0_INT_MASK 0xFFC01E24 /* TWI0 Interrupt Mask Register */
606#define TWI0_FIFO_CTL 0xFFC01E28 /* TWI0 FIFO Control Register */
607#define TWI0_FIFO_STAT 0xFFC01E2C /* TWI0 FIFO Status Register */
608#define TWI0_XMT_DATA8 0xFFC01E80 /* TWI0 FIFO Transmit Data Single-Byte Register */
609#define TWI0_XMT_DATA16 0xFFC01E84 /* TWI0 FIFO Transmit Data Double-Byte Register */
610#define TWI0_RCV_DATA8 0xFFC01E88 /* TWI0 FIFO Transmit Data Single-Byte Register */
611#define TWI0_RCV_DATA16 0xFFC01E8C /* TWI0 FIFO Transmit Data Double-Byte Register */
612
613/* =========================
614 TWI1
615 ========================= */
616#define TWI1_CLKDIV 0xFFC01F00 /* TWI1 SCL Clock Divider */
617#define TWI1_CONTROL 0xFFC01F04 /* TWI1 Control Register */
618#define TWI1_SLAVE_CTL 0xFFC01F08 /* TWI1 Slave Mode Control Register */
619#define TWI1_SLAVE_STAT 0xFFC01F0C /* TWI1 Slave Mode Status Register */
620#define TWI1_SLAVE_ADDR 0xFFC01F10 /* TWI1 Slave Mode Address Register */
621#define TWI1_MASTER_CTL 0xFFC01F14 /* TWI1 Master Mode Control Registers */
622#define TWI1_MASTER_STAT 0xFFC01F18 /* TWI1 Master Mode Status Register */
623#define TWI1_MASTER_ADDR 0xFFC01F1C /* TWI1 Master Mode Address Register */
624#define TWI1_INT_STAT 0xFFC01F20 /* TWI1 Interrupt Status Register */
625#define TWI1_INT_MASK 0xFFC01F24 /* TWI1 Interrupt Mask Register */
626#define TWI1_FIFO_CTL 0xFFC01F28 /* TWI1 FIFO Control Register */
627#define TWI1_FIFO_STAT 0xFFC01F2C /* TWI1 FIFO Status Register */
628#define TWI1_XMT_DATA8 0xFFC01F80 /* TWI1 FIFO Transmit Data Single-Byte Register */
629#define TWI1_XMT_DATA16 0xFFC01F84 /* TWI1 FIFO Transmit Data Double-Byte Register */
630#define TWI1_RCV_DATA8 0xFFC01F88 /* TWI1 FIFO Transmit Data Single-Byte Register */
631#define TWI1_RCV_DATA16 0xFFC01F8C /* TWI1 FIFO Transmit Data Double-Byte Register */
632
633
634/* =========================
635 UART Registers
636 ========================= */
637
638/* =========================
639 UART0
640 ========================= */
641#define UART0_REVID 0xFFC02000 /* UART0 Revision ID Register */
642#define UART0_CTL 0xFFC02004 /* UART0 Control Register */
643#define UART0_STAT 0xFFC02008 /* UART0 Status Register */
644#define UART0_SCR 0xFFC0200C /* UART0 Scratch Register */
645#define UART0_CLK 0xFFC02010 /* UART0 Clock Rate Register */
646#define UART0_IER 0xFFC02014 /* UART0 Interrupt Mask Register */
647#define UART0_IER_SET 0xFFC02018 /* UART0 Interrupt Mask Set Register */
648#define UART0_IER_CLR 0xFFC0201C /* UART0 Interrupt Mask Clear Register */
649#define UART0_RBR 0xFFC02020 /* UART0 Receive Buffer Register */
650#define UART0_THR 0xFFC02024 /* UART0 Transmit Hold Register */
651#define UART0_TAIP 0xFFC02028 /* UART0 Transmit Address/Insert Pulse Register */
652#define UART0_TSR 0xFFC0202C /* UART0 Transmit Shift Register */
653#define UART0_RSR 0xFFC02030 /* UART0 Receive Shift Register */
654#define UART0_TXDIV 0xFFC02034 /* UART0 Transmit Clock Devider Register */
655#define UART0_RXDIV 0xFFC02038 /* UART0 Receive Clock Devider Register */
656
657/* =========================
658 UART1
659 ========================= */
660#define UART1_REVID 0xFFC02400 /* UART1 Revision ID Register */
661#define UART1_CTL 0xFFC02404 /* UART1 Control Register */
662#define UART1_STAT 0xFFC02408 /* UART1 Status Register */
663#define UART1_SCR 0xFFC0240C /* UART1 Scratch Register */
664#define UART1_CLK 0xFFC02410 /* UART1 Clock Rate Register */
665#define UART1_IER 0xFFC02414 /* UART1 Interrupt Mask Register */
666#define UART1_IER_SET 0xFFC02418 /* UART1 Interrupt Mask Set Register */
667#define UART1_IER_CLR 0xFFC0241C /* UART1 Interrupt Mask Clear Register */
668#define UART1_RBR 0xFFC02420 /* UART1 Receive Buffer Register */
669#define UART1_THR 0xFFC02424 /* UART1 Transmit Hold Register */
670#define UART1_TAIP 0xFFC02428 /* UART1 Transmit Address/Insert Pulse Register */
671#define UART1_TSR 0xFFC0242C /* UART1 Transmit Shift Register */
672#define UART1_RSR 0xFFC02430 /* UART1 Receive Shift Register */
673#define UART1_TXDIV 0xFFC02434 /* UART1 Transmit Clock Devider Register */
674#define UART1_RXDIV 0xFFC02438 /* UART1 Receive Clock Devider Register */
675
676
677/* =========================
678 PORT Registers
679 ========================= */
680
681/* =========================
682 PORTA
683 ========================= */
684#define PORTA_FER 0xFFC03000 /* PORTA Port x Function Enable Register */
685#define PORTA_FER_SET 0xFFC03004 /* PORTA Port x Function Enable Set Register */
686#define PORTA_FER_CLEAR 0xFFC03008 /* PORTA Port x Function Enable Clear Register */
687#define PORTA_DATA 0xFFC0300C /* PORTA Port x GPIO Data Register */
688#define PORTA_DATA_SET 0xFFC03010 /* PORTA Port x GPIO Data Set Register */
689#define PORTA_DATA_CLEAR 0xFFC03014 /* PORTA Port x GPIO Data Clear Register */
690#define PORTA_DIR 0xFFC03018 /* PORTA Port x GPIO Direction Register */
691#define PORTA_DIR_SET 0xFFC0301C /* PORTA Port x GPIO Direction Set Register */
692#define PORTA_DIR_CLEAR 0xFFC03020 /* PORTA Port x GPIO Direction Clear Register */
693#define PORTA_INEN 0xFFC03024 /* PORTA Port x GPIO Input Enable Register */
694#define PORTA_INEN_SET 0xFFC03028 /* PORTA Port x GPIO Input Enable Set Register */
695#define PORTA_INEN_CLEAR 0xFFC0302C /* PORTA Port x GPIO Input Enable Clear Register */
696#define PORTA_MUX 0xFFC03030 /* PORTA Port x Multiplexer Control Register */
697#define PORTA_DATA_TGL 0xFFC03034 /* PORTA Port x GPIO Input Enable Toggle Register */
698#define PORTA_POL 0xFFC03038 /* PORTA Port x GPIO Programming Inversion Register */
699#define PORTA_POL_SET 0xFFC0303C /* PORTA Port x GPIO Programming Inversion Set Register */
700#define PORTA_POL_CLEAR 0xFFC03040 /* PORTA Port x GPIO Programming Inversion Clear Register */
701#define PORTA_LOCK 0xFFC03044 /* PORTA Port x GPIO Lock Register */
702#define PORTA_REVID 0xFFC0307C /* PORTA Port x GPIO Revision ID */
703
704/* =========================
705 PORTB
706 ========================= */
707#define PORTB_FER 0xFFC03080 /* PORTB Port x Function Enable Register */
708#define PORTB_FER_SET 0xFFC03084 /* PORTB Port x Function Enable Set Register */
709#define PORTB_FER_CLEAR 0xFFC03088 /* PORTB Port x Function Enable Clear Register */
710#define PORTB_DATA 0xFFC0308C /* PORTB Port x GPIO Data Register */
711#define PORTB_DATA_SET 0xFFC03090 /* PORTB Port x GPIO Data Set Register */
712#define PORTB_DATA_CLEAR 0xFFC03094 /* PORTB Port x GPIO Data Clear Register */
713#define PORTB_DIR 0xFFC03098 /* PORTB Port x GPIO Direction Register */
714#define PORTB_DIR_SET 0xFFC0309C /* PORTB Port x GPIO Direction Set Register */
715#define PORTB_DIR_CLEAR 0xFFC030A0 /* PORTB Port x GPIO Direction Clear Register */
716#define PORTB_INEN 0xFFC030A4 /* PORTB Port x GPIO Input Enable Register */
717#define PORTB_INEN_SET 0xFFC030A8 /* PORTB Port x GPIO Input Enable Set Register */
718#define PORTB_INEN_CLEAR 0xFFC030AC /* PORTB Port x GPIO Input Enable Clear Register */
719#define PORTB_MUX 0xFFC030B0 /* PORTB Port x Multiplexer Control Register */
720#define PORTB_DATA_TGL 0xFFC030B4 /* PORTB Port x GPIO Input Enable Toggle Register */
721#define PORTB_POL 0xFFC030B8 /* PORTB Port x GPIO Programming Inversion Register */
722#define PORTB_POL_SET 0xFFC030BC /* PORTB Port x GPIO Programming Inversion Set Register */
723#define PORTB_POL_CLEAR 0xFFC030C0 /* PORTB Port x GPIO Programming Inversion Clear Register */
724#define PORTB_LOCK 0xFFC030C4 /* PORTB Port x GPIO Lock Register */
725#define PORTB_REVID 0xFFC030FC /* PORTB Port x GPIO Revision ID */
726
727/* =========================
728 PORTC
729 ========================= */
730#define PORTC_FER 0xFFC03100 /* PORTC Port x Function Enable Register */
731#define PORTC_FER_SET 0xFFC03104 /* PORTC Port x Function Enable Set Register */
732#define PORTC_FER_CLEAR 0xFFC03108 /* PORTC Port x Function Enable Clear Register */
733#define PORTC_DATA 0xFFC0310C /* PORTC Port x GPIO Data Register */
734#define PORTC_DATA_SET 0xFFC03110 /* PORTC Port x GPIO Data Set Register */
735#define PORTC_DATA_CLEAR 0xFFC03114 /* PORTC Port x GPIO Data Clear Register */
736#define PORTC_DIR 0xFFC03118 /* PORTC Port x GPIO Direction Register */
737#define PORTC_DIR_SET 0xFFC0311C /* PORTC Port x GPIO Direction Set Register */
738#define PORTC_DIR_CLEAR 0xFFC03120 /* PORTC Port x GPIO Direction Clear Register */
739#define PORTC_INEN 0xFFC03124 /* PORTC Port x GPIO Input Enable Register */
740#define PORTC_INEN_SET 0xFFC03128 /* PORTC Port x GPIO Input Enable Set Register */
741#define PORTC_INEN_CLEAR 0xFFC0312C /* PORTC Port x GPIO Input Enable Clear Register */
742#define PORTC_MUX 0xFFC03130 /* PORTC Port x Multiplexer Control Register */
743#define PORTC_DATA_TGL 0xFFC03134 /* PORTC Port x GPIO Input Enable Toggle Register */
744#define PORTC_POL 0xFFC03138 /* PORTC Port x GPIO Programming Inversion Register */
745#define PORTC_POL_SET 0xFFC0313C /* PORTC Port x GPIO Programming Inversion Set Register */
746#define PORTC_POL_CLEAR 0xFFC03140 /* PORTC Port x GPIO Programming Inversion Clear Register */
747#define PORTC_LOCK 0xFFC03144 /* PORTC Port x GPIO Lock Register */
748#define PORTC_REVID 0xFFC0317C /* PORTC Port x GPIO Revision ID */
749
750/* =========================
751 PORTD
752 ========================= */
753#define PORTD_FER 0xFFC03180 /* PORTD Port x Function Enable Register */
754#define PORTD_FER_SET 0xFFC03184 /* PORTD Port x Function Enable Set Register */
755#define PORTD_FER_CLEAR 0xFFC03188 /* PORTD Port x Function Enable Clear Register */
756#define PORTD_DATA 0xFFC0318C /* PORTD Port x GPIO Data Register */
757#define PORTD_DATA_SET 0xFFC03190 /* PORTD Port x GPIO Data Set Register */
758#define PORTD_DATA_CLEAR 0xFFC03194 /* PORTD Port x GPIO Data Clear Register */
759#define PORTD_DIR 0xFFC03198 /* PORTD Port x GPIO Direction Register */
760#define PORTD_DIR_SET 0xFFC0319C /* PORTD Port x GPIO Direction Set Register */
761#define PORTD_DIR_CLEAR 0xFFC031A0 /* PORTD Port x GPIO Direction Clear Register */
762#define PORTD_INEN 0xFFC031A4 /* PORTD Port x GPIO Input Enable Register */
763#define PORTD_INEN_SET 0xFFC031A8 /* PORTD Port x GPIO Input Enable Set Register */
764#define PORTD_INEN_CLEAR 0xFFC031AC /* PORTD Port x GPIO Input Enable Clear Register */
765#define PORTD_MUX 0xFFC031B0 /* PORTD Port x Multiplexer Control Register */
766#define PORTD_DATA_TGL 0xFFC031B4 /* PORTD Port x GPIO Input Enable Toggle Register */
767#define PORTD_POL 0xFFC031B8 /* PORTD Port x GPIO Programming Inversion Register */
768#define PORTD_POL_SET 0xFFC031BC /* PORTD Port x GPIO Programming Inversion Set Register */
769#define PORTD_POL_CLEAR 0xFFC031C0 /* PORTD Port x GPIO Programming Inversion Clear Register */
770#define PORTD_LOCK 0xFFC031C4 /* PORTD Port x GPIO Lock Register */
771#define PORTD_REVID 0xFFC031FC /* PORTD Port x GPIO Revision ID */
772
773/* =========================
774 PORTE
775 ========================= */
776#define PORTE_FER 0xFFC03200 /* PORTE Port x Function Enable Register */
777#define PORTE_FER_SET 0xFFC03204 /* PORTE Port x Function Enable Set Register */
778#define PORTE_FER_CLEAR 0xFFC03208 /* PORTE Port x Function Enable Clear Register */
779#define PORTE_DATA 0xFFC0320C /* PORTE Port x GPIO Data Register */
780#define PORTE_DATA_SET 0xFFC03210 /* PORTE Port x GPIO Data Set Register */
781#define PORTE_DATA_CLEAR 0xFFC03214 /* PORTE Port x GPIO Data Clear Register */
782#define PORTE_DIR 0xFFC03218 /* PORTE Port x GPIO Direction Register */
783#define PORTE_DIR_SET 0xFFC0321C /* PORTE Port x GPIO Direction Set Register */
784#define PORTE_DIR_CLEAR 0xFFC03220 /* PORTE Port x GPIO Direction Clear Register */
785#define PORTE_INEN 0xFFC03224 /* PORTE Port x GPIO Input Enable Register */
786#define PORTE_INEN_SET 0xFFC03228 /* PORTE Port x GPIO Input Enable Set Register */
787#define PORTE_INEN_CLEAR 0xFFC0322C /* PORTE Port x GPIO Input Enable Clear Register */
788#define PORTE_MUX 0xFFC03230 /* PORTE Port x Multiplexer Control Register */
789#define PORTE_DATA_TGL 0xFFC03234 /* PORTE Port x GPIO Input Enable Toggle Register */
790#define PORTE_POL 0xFFC03238 /* PORTE Port x GPIO Programming Inversion Register */
791#define PORTE_POL_SET 0xFFC0323C /* PORTE Port x GPIO Programming Inversion Set Register */
792#define PORTE_POL_CLEAR 0xFFC03240 /* PORTE Port x GPIO Programming Inversion Clear Register */
793#define PORTE_LOCK 0xFFC03244 /* PORTE Port x GPIO Lock Register */
794#define PORTE_REVID 0xFFC0327C /* PORTE Port x GPIO Revision ID */
795
796/* =========================
797 PORTF
798 ========================= */
799#define PORTF_FER 0xFFC03280 /* PORTF Port x Function Enable Register */
800#define PORTF_FER_SET 0xFFC03284 /* PORTF Port x Function Enable Set Register */
801#define PORTF_FER_CLEAR 0xFFC03288 /* PORTF Port x Function Enable Clear Register */
802#define PORTF_DATA 0xFFC0328C /* PORTF Port x GPIO Data Register */
803#define PORTF_DATA_SET 0xFFC03290 /* PORTF Port x GPIO Data Set Register */
804#define PORTF_DATA_CLEAR 0xFFC03294 /* PORTF Port x GPIO Data Clear Register */
805#define PORTF_DIR 0xFFC03298 /* PORTF Port x GPIO Direction Register */
806#define PORTF_DIR_SET 0xFFC0329C /* PORTF Port x GPIO Direction Set Register */
807#define PORTF_DIR_CLEAR 0xFFC032A0 /* PORTF Port x GPIO Direction Clear Register */
808#define PORTF_INEN 0xFFC032A4 /* PORTF Port x GPIO Input Enable Register */
809#define PORTF_INEN_SET 0xFFC032A8 /* PORTF Port x GPIO Input Enable Set Register */
810#define PORTF_INEN_CLEAR 0xFFC032AC /* PORTF Port x GPIO Input Enable Clear Register */
811#define PORTF_MUX 0xFFC032B0 /* PORTF Port x Multiplexer Control Register */
812#define PORTF_DATA_TGL 0xFFC032B4 /* PORTF Port x GPIO Input Enable Toggle Register */
813#define PORTF_POL 0xFFC032B8 /* PORTF Port x GPIO Programming Inversion Register */
814#define PORTF_POL_SET 0xFFC032BC /* PORTF Port x GPIO Programming Inversion Set Register */
815#define PORTF_POL_CLEAR 0xFFC032C0 /* PORTF Port x GPIO Programming Inversion Clear Register */
816#define PORTF_LOCK 0xFFC032C4 /* PORTF Port x GPIO Lock Register */
817#define PORTF_REVID 0xFFC032FC /* PORTF Port x GPIO Revision ID */
818
819/* =========================
820 PORTG
821 ========================= */
822#define PORTG_FER 0xFFC03300 /* PORTG Port x Function Enable Register */
823#define PORTG_FER_SET 0xFFC03304 /* PORTG Port x Function Enable Set Register */
824#define PORTG_FER_CLEAR 0xFFC03308 /* PORTG Port x Function Enable Clear Register */
825#define PORTG_DATA 0xFFC0330C /* PORTG Port x GPIO Data Register */
826#define PORTG_DATA_SET 0xFFC03310 /* PORTG Port x GPIO Data Set Register */
827#define PORTG_DATA_CLEAR 0xFFC03314 /* PORTG Port x GPIO Data Clear Register */
828#define PORTG_DIR 0xFFC03318 /* PORTG Port x GPIO Direction Register */
829#define PORTG_DIR_SET 0xFFC0331C /* PORTG Port x GPIO Direction Set Register */
830#define PORTG_DIR_CLEAR 0xFFC03320 /* PORTG Port x GPIO Direction Clear Register */
831#define PORTG_INEN 0xFFC03324 /* PORTG Port x GPIO Input Enable Register */
832#define PORTG_INEN_SET 0xFFC03328 /* PORTG Port x GPIO Input Enable Set Register */
833#define PORTG_INEN_CLEAR 0xFFC0332C /* PORTG Port x GPIO Input Enable Clear Register */
834#define PORTG_MUX 0xFFC03330 /* PORTG Port x Multiplexer Control Register */
835#define PORTG_DATA_TGL 0xFFC03334 /* PORTG Port x GPIO Input Enable Toggle Register */
836#define PORTG_POL 0xFFC03338 /* PORTG Port x GPIO Programming Inversion Register */
837#define PORTG_POL_SET 0xFFC0333C /* PORTG Port x GPIO Programming Inversion Set Register */
838#define PORTG_POL_CLEAR 0xFFC03340 /* PORTG Port x GPIO Programming Inversion Clear Register */
839#define PORTG_LOCK 0xFFC03344 /* PORTG Port x GPIO Lock Register */
840#define PORTG_REVID 0xFFC0337C /* PORTG Port x GPIO Revision ID */
841
842
843/* =========================
844 PINT Registers
845 ========================= */
846
847/* =========================
848 PINT0
849 ========================= */
850#define PINT0_MASK_SET 0xFFC04000 /* PINT0 Pint Mask Set Register */
851#define PINT0_MASK_CLEAR 0xFFC04004 /* PINT0 Pint Mask Clear Register */
852#define PINT0_REQUEST 0xFFC04008 /* PINT0 Pint Request Register */
853#define PINT0_ASSIGN 0xFFC0400C /* PINT0 Pint Assign Register */
854#define PINT0_EDGE_SET 0xFFC04010 /* PINT0 Pint Edge Set Register */
855#define PINT0_EDGE_CLEAR 0xFFC04014 /* PINT0 Pint Edge Clear Register */
856#define PINT0_INVERT_SET 0xFFC04018 /* PINT0 Pint Invert Set Register */
857#define PINT0_INVERT_CLEAR 0xFFC0401C /* PINT0 Pint Invert Clear Register */
858#define PINT0_PINSTATE 0xFFC04020 /* PINT0 Pint Pinstate Register */
859#define PINT0_LATCH 0xFFC04024 /* PINT0 Pint Latch Register */
860
861/* =========================
862 PINT1
863 ========================= */
864#define PINT1_MASK_SET 0xFFC04100 /* PINT1 Pint Mask Set Register */
865#define PINT1_MASK_CLEAR 0xFFC04104 /* PINT1 Pint Mask Clear Register */
866#define PINT1_REQUEST 0xFFC04108 /* PINT1 Pint Request Register */
867#define PINT1_ASSIGN 0xFFC0410C /* PINT1 Pint Assign Register */
868#define PINT1_EDGE_SET 0xFFC04110 /* PINT1 Pint Edge Set Register */
869#define PINT1_EDGE_CLEAR 0xFFC04114 /* PINT1 Pint Edge Clear Register */
870#define PINT1_INVERT_SET 0xFFC04118 /* PINT1 Pint Invert Set Register */
871#define PINT1_INVERT_CLEAR 0xFFC0411C /* PINT1 Pint Invert Clear Register */
872#define PINT1_PINSTATE 0xFFC04120 /* PINT1 Pint Pinstate Register */
873#define PINT1_LATCH 0xFFC04124 /* PINT1 Pint Latch Register */
874
875/* =========================
876 PINT2
877 ========================= */
878#define PINT2_MASK_SET 0xFFC04200 /* PINT2 Pint Mask Set Register */
879#define PINT2_MASK_CLEAR 0xFFC04204 /* PINT2 Pint Mask Clear Register */
880#define PINT2_REQUEST 0xFFC04208 /* PINT2 Pint Request Register */
881#define PINT2_ASSIGN 0xFFC0420C /* PINT2 Pint Assign Register */
882#define PINT2_EDGE_SET 0xFFC04210 /* PINT2 Pint Edge Set Register */
883#define PINT2_EDGE_CLEAR 0xFFC04214 /* PINT2 Pint Edge Clear Register */
884#define PINT2_INVERT_SET 0xFFC04218 /* PINT2 Pint Invert Set Register */
885#define PINT2_INVERT_CLEAR 0xFFC0421C /* PINT2 Pint Invert Clear Register */
886#define PINT2_PINSTATE 0xFFC04220 /* PINT2 Pint Pinstate Register */
887#define PINT2_LATCH 0xFFC04224 /* PINT2 Pint Latch Register */
888
889/* =========================
890 PINT3
891 ========================= */
892#define PINT3_MASK_SET 0xFFC04300 /* PINT3 Pint Mask Set Register */
893#define PINT3_MASK_CLEAR 0xFFC04304 /* PINT3 Pint Mask Clear Register */
894#define PINT3_REQUEST 0xFFC04308 /* PINT3 Pint Request Register */
895#define PINT3_ASSIGN 0xFFC0430C /* PINT3 Pint Assign Register */
896#define PINT3_EDGE_SET 0xFFC04310 /* PINT3 Pint Edge Set Register */
897#define PINT3_EDGE_CLEAR 0xFFC04314 /* PINT3 Pint Edge Clear Register */
898#define PINT3_INVERT_SET 0xFFC04318 /* PINT3 Pint Invert Set Register */
899#define PINT3_INVERT_CLEAR 0xFFC0431C /* PINT3 Pint Invert Clear Register */
900#define PINT3_PINSTATE 0xFFC04320 /* PINT3 Pint Pinstate Register */
901#define PINT3_LATCH 0xFFC04324 /* PINT3 Pint Latch Register */
902
903/* =========================
904 PINT4
905 ========================= */
906#define PINT4_MASK_SET 0xFFC04400 /* PINT4 Pint Mask Set Register */
907#define PINT4_MASK_CLEAR 0xFFC04404 /* PINT4 Pint Mask Clear Register */
908#define PINT4_REQUEST 0xFFC04408 /* PINT4 Pint Request Register */
909#define PINT4_ASSIGN 0xFFC0440C /* PINT4 Pint Assign Register */
910#define PINT4_EDGE_SET 0xFFC04410 /* PINT4 Pint Edge Set Register */
911#define PINT4_EDGE_CLEAR 0xFFC04414 /* PINT4 Pint Edge Clear Register */
912#define PINT4_INVERT_SET 0xFFC04418 /* PINT4 Pint Invert Set Register */
913#define PINT4_INVERT_CLEAR 0xFFC0441C /* PINT4 Pint Invert Clear Register */
914#define PINT4_PINSTATE 0xFFC04420 /* PINT4 Pint Pinstate Register */
915#define PINT4_LATCH 0xFFC04424 /* PINT4 Pint Latch Register */
916
917/* =========================
918 PINT5
919 ========================= */
920#define PINT5_MASK_SET 0xFFC04500 /* PINT5 Pint Mask Set Register */
921#define PINT5_MASK_CLEAR 0xFFC04504 /* PINT5 Pint Mask Clear Register */
922#define PINT5_REQUEST 0xFFC04508 /* PINT5 Pint Request Register */
923#define PINT5_ASSIGN 0xFFC0450C /* PINT5 Pint Assign Register */
924#define PINT5_EDGE_SET 0xFFC04510 /* PINT5 Pint Edge Set Register */
925#define PINT5_EDGE_CLEAR 0xFFC04514 /* PINT5 Pint Edge Clear Register */
926#define PINT5_INVERT_SET 0xFFC04518 /* PINT5 Pint Invert Set Register */
927#define PINT5_INVERT_CLEAR 0xFFC0451C /* PINT5 Pint Invert Clear Register */
928#define PINT5_PINSTATE 0xFFC04520 /* PINT5 Pint Pinstate Register */
929#define PINT5_LATCH 0xFFC04524 /* PINT5 Pint Latch Register */
930
931
932/* =========================
933 SMC Registers
934 ========================= */
935
936/* =========================
937 SMC0
938 ========================= */
939#define SMC_GCTL 0xFFC16004 /* SMC0 SMC Control Register */
940#define SMC_GSTAT 0xFFC16008 /* SMC0 SMC Status Register */
941#define SMC_B0CTL 0xFFC1600C /* SMC0 SMC Bank0 Control Register */
942#define SMC_B0TIM 0xFFC16010 /* SMC0 SMC Bank0 Timing Register */
943#define SMC_B0ETIM 0xFFC16014 /* SMC0 SMC Bank0 Extended Timing Register */
944#define SMC_B1CTL 0xFFC1601C /* SMC0 SMC BANK1 Control Register */
945#define SMC_B1TIM 0xFFC16020 /* SMC0 SMC BANK1 Timing Register */
946#define SMC_B1ETIM 0xFFC16024 /* SMC0 SMC BANK1 Extended Timing Register */
947#define SMC_B2CTL 0xFFC1602C /* SMC0 SMC BANK2 Control Register */
948#define SMC_B2TIM 0xFFC16030 /* SMC0 SMC BANK2 Timing Register */
949#define SMC_B2ETIM 0xFFC16034 /* SMC0 SMC BANK2 Extended Timing Register */
950#define SMC_B3CTL 0xFFC1603C /* SMC0 SMC BANK3 Control Register */
951#define SMC_B3TIM 0xFFC16040 /* SMC0 SMC BANK3 Timing Register */
952#define SMC_B3ETIM 0xFFC16044 /* SMC0 SMC BANK3 Extended Timing Register */
953
954
955/* =========================
956 WDOG Registers
957 ========================= */
958
959/* =========================
960 WDOG0
961 ========================= */
962#define WDOG0_CTL 0xFFC17000 /* WDOG0 Control Register */
963#define WDOG0_CNT 0xFFC17004 /* WDOG0 Count Register */
964#define WDOG0_STAT 0xFFC17008 /* WDOG0 Watchdog Timer Status Register */
965#define WDOG_CTL WDOG0_CTL
966#define WDOG_CNT WDOG0_CNT
967#define WDOG_STAT WDOG0_STAT
968
969/* =========================
970 WDOG1
971 ========================= */
972#define WDOG1_CTL 0xFFC17800 /* WDOG1 Control Register */
973#define WDOG1_CNT 0xFFC17804 /* WDOG1 Count Register */
974#define WDOG1_STAT 0xFFC17808 /* WDOG1 Watchdog Timer Status Register */
975
976
977/* =========================
978 SDU Registers
979 ========================= */
980
981/* =========================
982 SDU0
983 ========================= */
984#define SDU0_IDCODE 0xFFC1F020 /* SDU0 ID Code Register */
985#define SDU0_CTL 0xFFC1F050 /* SDU0 Control Register */
986#define SDU0_STAT 0xFFC1F054 /* SDU0 Status Register */
987#define SDU0_MACCTL 0xFFC1F058 /* SDU0 Memory Access Control Register */
988#define SDU0_MACADDR 0xFFC1F05C /* SDU0 Memory Access Address Register */
989#define SDU0_MACDATA 0xFFC1F060 /* SDU0 Memory Access Data Register */
990#define SDU0_DMARD 0xFFC1F064 /* SDU0 DMA Read Data Register */
991#define SDU0_DMAWD 0xFFC1F068 /* SDU0 DMA Write Data Register */
992#define SDU0_MSG 0xFFC1F080 /* SDU0 Message Register */
993#define SDU0_MSG_SET 0xFFC1F084 /* SDU0 Message Set Register */
994#define SDU0_MSG_CLR 0xFFC1F088 /* SDU0 Message Clear Register */
995#define SDU0_GHLT 0xFFC1F08C /* SDU0 Group Halt Register */
996
997
998/* =========================
999 EMAC Registers
1000 ========================= */
1001/* =========================
1002 EMAC0
1003 ========================= */
1004#define EMAC0_MACCFG 0xFFC20000 /* EMAC0 MAC Configuration Register */
1005#define EMAC0_MACFRMFILT 0xFFC20004 /* EMAC0 Filter Register for filtering Received Frames */
1006#define EMAC0_HASHTBL_HI 0xFFC20008 /* EMAC0 Contains the Upper 32 bits of the hash table */
1007#define EMAC0_HASHTBL_LO 0xFFC2000C /* EMAC0 Contains the lower 32 bits of the hash table */
1008#define EMAC0_GMII_ADDR 0xFFC20010 /* EMAC0 Management Address Register */
1009#define EMAC0_GMII_DATA 0xFFC20014 /* EMAC0 Management Data Register */
1010#define EMAC0_FLOWCTL 0xFFC20018 /* EMAC0 MAC FLow Control Register */
1011#define EMAC0_VLANTAG 0xFFC2001C /* EMAC0 VLAN Tag Register */
1012#define EMAC0_VER 0xFFC20020 /* EMAC0 EMAC Version Register */
1013#define EMAC0_DBG 0xFFC20024 /* EMAC0 EMAC Debug Register */
1014#define EMAC0_RMTWKUP 0xFFC20028 /* EMAC0 Remote wake up frame register */
1015#define EMAC0_PMT_CTLSTAT 0xFFC2002C /* EMAC0 PMT Control and Status Register */
1016#define EMAC0_ISTAT 0xFFC20038 /* EMAC0 EMAC Interrupt Status Register */
1017#define EMAC0_IMSK 0xFFC2003C /* EMAC0 EMAC Interrupt Mask Register */
1018#define EMAC0_ADDR0_HI 0xFFC20040 /* EMAC0 EMAC Address0 High Register */
1019#define EMAC0_ADDR0_LO 0xFFC20044 /* EMAC0 EMAC Address0 Low Register */
1020#define EMAC0_MMC_CTL 0xFFC20100 /* EMAC0 MMC Control Register */
1021#define EMAC0_MMC_RXINT 0xFFC20104 /* EMAC0 MMC RX Interrupt Register */
1022#define EMAC0_MMC_TXINT 0xFFC20108 /* EMAC0 MMC TX Interrupt Register */
1023#define EMAC0_MMC_RXIMSK 0xFFC2010C /* EMAC0 MMC RX Interrupt Mask Register */
1024#define EMAC0_MMC_TXIMSK 0xFFC20110 /* EMAC0 MMC TX Interrupt Mask Register */
1025#define EMAC0_TXOCTCNT_GB 0xFFC20114 /* EMAC0 Num bytes transmitted exclusive of preamble */
1026#define EMAC0_TXFRMCNT_GB 0xFFC20118 /* EMAC0 Num frames transmitted exclusive of retired */
1027#define EMAC0_TXBCASTFRM_G 0xFFC2011C /* EMAC0 Number of good broadcast frames transmitted. */
1028#define EMAC0_TXMCASTFRM_G 0xFFC20120 /* EMAC0 Number of good multicast frames transmitted. */
1029#define EMAC0_TX64_GB 0xFFC20124 /* EMAC0 Number of 64 byte length frames */
1030#define EMAC0_TX65TO127_GB 0xFFC20128 /* EMAC0 Number of frames of length b/w 65-127 (inclusive) bytes */
1031#define EMAC0_TX128TO255_GB 0xFFC2012C /* EMAC0 Number of frames of length b/w 128-255 (inclusive) bytes */
1032#define EMAC0_TX256TO511_GB 0xFFC20130 /* EMAC0 Number of frames of length b/w 256-511 (inclusive) bytes */
1033#define EMAC0_TX512TO1023_GB 0xFFC20134 /* EMAC0 Number of frames of length b/w 512-1023 (inclusive) bytes */
1034#define EMAC0_TX1024TOMAX_GB 0xFFC20138 /* EMAC0 Number of frames of length b/w 1024-max (inclusive) bytes */
1035#define EMAC0_TXUCASTFRM_GB 0xFFC2013C /* EMAC0 Number of good and bad unicast frames transmitted */
1036#define EMAC0_TXMCASTFRM_GB 0xFFC20140 /* EMAC0 Number of good and bad multicast frames transmitted */
1037#define EMAC0_TXBCASTFRM_GB 0xFFC20144 /* EMAC0 Number of good and bad broadcast frames transmitted */
1038#define EMAC0_TXUNDR_ERR 0xFFC20148 /* EMAC0 Number of frames aborted due to frame underflow error */
1039#define EMAC0_TXSNGCOL_G 0xFFC2014C /* EMAC0 Number of transmitted frames after single collision */
1040#define EMAC0_TXMULTCOL_G 0xFFC20150 /* EMAC0 Number of transmitted frames with more than one collision */
1041#define EMAC0_TXDEFERRED 0xFFC20154 /* EMAC0 Number of transmitted frames after deferral */
1042#define EMAC0_TXLATECOL 0xFFC20158 /* EMAC0 Number of frames aborted due to late collision error */
1043#define EMAC0_TXEXCESSCOL 0xFFC2015C /* EMAC0 Number of aborted frames due to excessive collisions */
1044#define EMAC0_TXCARR_ERR 0xFFC20160 /* EMAC0 Number of aborted frames due to carrier sense error */
1045#define EMAC0_TXOCTCNT_G 0xFFC20164 /* EMAC0 Number of bytes transmitted in good frames only */
1046#define EMAC0_TXFRMCNT_G 0xFFC20168 /* EMAC0 Number of good frames transmitted. */
1047#define EMAC0_TXEXCESSDEF 0xFFC2016C /* EMAC0 Number of frames aborted due to excessive deferral */
1048#define EMAC0_TXPAUSEFRM 0xFFC20170 /* EMAC0 Number of good PAUSE frames transmitted. */
1049#define EMAC0_TXVLANFRM_G 0xFFC20174 /* EMAC0 Number of VLAN frames transmitted */
1050#define EMAC0_RXFRMCNT_GB 0xFFC20180 /* EMAC0 Number of good and bad frames received. */
1051#define EMAC0_RXOCTCNT_GB 0xFFC20184 /* EMAC0 Number of bytes received in good and bad frames */
1052#define EMAC0_RXOCTCNT_G 0xFFC20188 /* EMAC0 Number of bytes received only in good frames */
1053#define EMAC0_RXBCASTFRM_G 0xFFC2018C /* EMAC0 Number of good broadcast frames received. */
1054#define EMAC0_RXMCASTFRM_G 0xFFC20190 /* EMAC0 Number of good multicast frames received */
1055#define EMAC0_RXCRC_ERR 0xFFC20194 /* EMAC0 Number of frames received with CRC error */
1056#define EMAC0_RXALIGN_ERR 0xFFC20198 /* EMAC0 Number of frames with alignment error */
1057#define EMAC0_RXRUNT_ERR 0xFFC2019C /* EMAC0 Number of frames received with runt error. */
1058#define EMAC0_RXJAB_ERR 0xFFC201A0 /* EMAC0 Number of frames received with length greater than 1518 */
1059#define EMAC0_RXUSIZE_G 0xFFC201A4 /* EMAC0 Number of frames received with length 64 */
1060#define EMAC0_RXOSIZE_G 0xFFC201A8 /* EMAC0 Number of frames received with length greater than maxium */
1061#define EMAC0_RX64_GB 0xFFC201AC /* EMAC0 Number of good and bad frames of lengh 64 bytes */
1062#define EMAC0_RX65TO127_GB 0xFFC201B0 /* EMAC0 Number of good and bad frame between 64-127(inclusive) */
1063#define EMAC0_RX128TO255_GB 0xFFC201B4 /* EMAC0 Number of good and bad frames received with length between 128 and 255 (inclusive) bytes, exclusive of preamble. */
1064#define EMAC0_RX256TO511_GB 0xFFC201B8 /* EMAC0 Number of good and bad frames between 256-511(inclusive) */
1065#define EMAC0_RX512TO1023_GB 0xFFC201BC /* EMAC0 Number of good and bad frames received between 512-1023 */
1066#define EMAC0_RX1024TOMAX_GB 0xFFC201C0 /* EMAC0 Number of frames received between 1024 and maxsize */
1067#define EMAC0_RXUCASTFRM_G 0xFFC201C4 /* EMAC0 Number of good unicast frames received. */
1068#define EMAC0_RXLEN_ERR 0xFFC201C8 /* EMAC0 Number of frames received with length error */
1069#define EMAC0_RXOORTYPE 0xFFC201CC /* EMAC0 Number of frames with length not equal to valid frame size */
1070#define EMAC0_RXPAUSEFRM 0xFFC201D0 /* EMAC0 Number of good and valid PAUSE frames received. */
1071#define EMAC0_RXFIFO_OVF 0xFFC201D4 /* EMAC0 Number of missed received frames due to FIFO overflow. This counter is not present in the GMAC-CORE configuration. */
1072#define EMAC0_RXVLANFRM_GB 0xFFC201D8 /* EMAC0 Number of good and bad VLAN frames received. */
1073#define EMAC0_RXWDOG_ERR 0xFFC201DC /* EMAC0 Frames received with error due to watchdog timeout */
1074#define EMAC0_IPC_RXIMSK 0xFFC20200 /* EMAC0 MMC IPC RX Interrupt Mask Register */
1075#define EMAC0_IPC_RXINT 0xFFC20208 /* EMAC0 MMC IPC RX Interrupt Register */
1076#define EMAC0_RXIPV4_GD_FRM 0xFFC20210 /* EMAC0 Number of good IPv4 datagrams */
1077#define EMAC0_RXIPV4_HDR_ERR_FRM 0xFFC20214 /* EMAC0 Number of IPv4 datagrams with header errors */
1078#define EMAC0_RXIPV4_NOPAY_FRM 0xFFC20218 /* EMAC0 Number of IPv4 datagrams without checksum */
1079#define EMAC0_RXIPV4_FRAG_FRM 0xFFC2021C /* EMAC0 Number of good IPv4 datagrams with fragmentation */
1080#define EMAC0_RXIPV4_UDSBL_FRM 0xFFC20220 /* EMAC0 Number of IPv4 UDP datagrams with disabled checksum */
1081#define EMAC0_RXIPV6_GD_FRM 0xFFC20224 /* EMAC0 Number of IPv4 datagrams with TCP/UDP/ICMP payloads */
1082#define EMAC0_RXIPV6_HDR_ERR_FRM 0xFFC20228 /* EMAC0 Number of IPv6 datagrams with header errors */
1083#define EMAC0_RXIPV6_NOPAY_FRM 0xFFC2022C /* EMAC0 Number of IPv6 datagrams with no TCP/UDP/ICMP payload */
1084#define EMAC0_RXUDP_GD_FRM 0xFFC20230 /* EMAC0 Number of good IP datagrames with good UDP payload */
1085#define EMAC0_RXUDP_ERR_FRM 0xFFC20234 /* EMAC0 Number of good IP datagrams with UDP checksum errors */
1086#define EMAC0_RXTCP_GD_FRM 0xFFC20238 /* EMAC0 Number of good IP datagrams with a good TCP payload */
1087#define EMAC0_RXTCP_ERR_FRM 0xFFC2023C /* EMAC0 Number of good IP datagrams with TCP checksum errors */
1088#define EMAC0_RXICMP_GD_FRM 0xFFC20240 /* EMAC0 Number of good IP datagrams with a good ICMP payload */
1089#define EMAC0_RXICMP_ERR_FRM 0xFFC20244 /* EMAC0 Number of good IP datagrams with ICMP checksum errors */
1090#define EMAC0_RXIPV4_GD_OCT 0xFFC20250 /* EMAC0 Bytes received in IPv4 datagrams including tcp,udp or icmp */
1091#define EMAC0_RXIPV4_HDR_ERR_OCT 0xFFC20254 /* EMAC0 Bytes received in IPv4 datagrams with header errors */
1092#define EMAC0_RXIPV4_NOPAY_OCT 0xFFC20258 /* EMAC0 Bytes received in IPv4 datagrams without tcp,udp,icmp load */
1093#define EMAC0_RXIPV4_FRAG_OCT 0xFFC2025C /* EMAC0 Bytes received in fragmented IPv4 datagrams */
1094#define EMAC0_RXIPV4_UDSBL_OCT 0xFFC20260 /* EMAC0 Bytes received in UDP segment with checksum disabled */
1095#define EMAC0_RXIPV6_GD_OCT 0xFFC20264 /* EMAC0 Bytes received in good IPv6 including tcp,udp or icmp load */
1096#define EMAC0_RXIPV6_HDR_ERR_OCT 0xFFC20268 /* EMAC0 Number of bytes received in IPv6 with header errors */
1097#define EMAC0_RXIPV6_NOPAY_OCT 0xFFC2026C /* EMAC0 Bytes received in IPv6 without tcp,udp or icmp load */
1098#define EMAC0_RXUDP_GD_OCT 0xFFC20270 /* EMAC0 Number of bytes received in good UDP segments */
1099#define EMAC0_RXUDP_ERR_OCT 0xFFC20274 /* EMAC0 Number of bytes received in UDP segment with checksum err */
1100#define EMAC0_RXTCP_GD_OCT 0xFFC20278 /* EMAC0 Number of bytes received in a good TCP segment */
1101#define EMAC0_RXTCP_ERR_OCT 0xFFC2027C /* EMAC0 Number of bytes received in TCP segment with checksum err */
1102#define EMAC0_RXICMP_GD_OCT 0xFFC20280 /* EMAC0 Number of bytes received in a good ICMP segment */
1103#define EMAC0_RXICMP_ERR_OCT 0xFFC20284 /* EMAC0 Bytes received in an ICMP segment with checksum errors */
1104#define EMAC0_TM_CTL 0xFFC20700 /* EMAC0 EMAC Time Stamp Control Register */
1105#define EMAC0_TM_SUBSEC 0xFFC20704 /* EMAC0 EMAC Time Stamp Sub Second Increment */
1106#define EMAC0_TM_SEC 0xFFC20708 /* EMAC0 EMAC Time Stamp Second Register */
1107#define EMAC0_TM_NSEC 0xFFC2070C /* EMAC0 EMAC Time Stamp Nano Second Register */
1108#define EMAC0_TM_SECUPDT 0xFFC20710 /* EMAC0 EMAC Time Stamp Seconds Update */
1109#define EMAC0_TM_NSECUPDT 0xFFC20714 /* EMAC0 EMAC Time Stamp Nano Seconds Update */
1110#define EMAC0_TM_ADDEND 0xFFC20718 /* EMAC0 EMAC Time Stamp Addend Register */
1111#define EMAC0_TM_TGTM 0xFFC2071C /* EMAC0 EMAC Time Stamp Target Time Sec. */
1112#define EMAC0_TM_NTGTM 0xFFC20720 /* EMAC0 EMAC Time Stamp Target Time Nanosec. */
1113#define EMAC0_TM_HISEC 0xFFC20724 /* EMAC0 EMAC Time Stamp High Second Register */
1114#define EMAC0_TM_STMPSTAT 0xFFC20728 /* EMAC0 EMAC Time Stamp Status Register */
1115#define EMAC0_TM_PPSCTL 0xFFC2072C /* EMAC0 EMAC PPS Control Register */
1116#define EMAC0_TM_AUXSTMP_NSEC 0xFFC20730 /* EMAC0 EMAC Auxillary Time Stamp Nano Register */
1117#define EMAC0_TM_AUXSTMP_SEC 0xFFC20734 /* EMAC0 EMAC Auxillary Time Stamp Sec Register */
1118#define EMAC0_DMA_BUSMODE 0xFFC21000 /* EMAC0 Bus Operating Modes for EMAC DMA */
1119#define EMAC0_DMA_TXPOLL 0xFFC21004 /* EMAC0 TX DMA Poll demand register */
1120#define EMAC0_DMA_RXPOLL 0xFFC21008 /* EMAC0 RX DMA Poll demand register */
1121#define EMAC0_DMA_RXDSC_ADDR 0xFFC2100C /* EMAC0 RX Descriptor List Address */
1122#define EMAC0_DMA_TXDSC_ADDR 0xFFC21010 /* EMAC0 TX Descriptor List Address */
1123#define EMAC0_DMA_STAT 0xFFC21014 /* EMAC0 DMA Status Register */
1124#define EMAC0_DMA_OPMODE 0xFFC21018 /* EMAC0 DMA Operation Mode Register */
1125#define EMAC0_DMA_IEN 0xFFC2101C /* EMAC0 DMA Interrupt Enable Register */
1126#define EMAC0_DMA_MISS_FRM 0xFFC21020 /* EMAC0 DMA missed frame and buffer overflow counter */
1127#define EMAC0_DMA_RXIWDOG 0xFFC21024 /* EMAC0 DMA RX Interrupt Watch Dog timer */
1128#define EMAC0_DMA_BMMODE 0xFFC21028 /* EMAC0 AXI Bus Mode Register */
1129#define EMAC0_DMA_BMSTAT 0xFFC2102C /* EMAC0 AXI Status Register */
1130#define EMAC0_DMA_TXDSC_CUR 0xFFC21048 /* EMAC0 TX current descriptor register */
1131#define EMAC0_DMA_RXDSC_CUR 0xFFC2104C /* EMAC0 RX current descriptor register */
1132#define EMAC0_DMA_TXBUF_CUR 0xFFC21050 /* EMAC0 TX current buffer pointer register */
1133#define EMAC0_DMA_RXBUF_CUR 0xFFC21054 /* EMAC0 RX current buffer pointer register */
1134#define EMAC0_HWFEAT 0xFFC21058 /* EMAC0 Hardware Feature Register */
1135
1136/* =========================
1137 EMAC1
1138 ========================= */
1139#define EMAC1_MACCFG 0xFFC22000 /* EMAC1 MAC Configuration Register */
1140#define EMAC1_MACFRMFILT 0xFFC22004 /* EMAC1 Filter Register for filtering Received Frames */
1141#define EMAC1_HASHTBL_HI 0xFFC22008 /* EMAC1 Contains the Upper 32 bits of the hash table */
1142#define EMAC1_HASHTBL_LO 0xFFC2200C /* EMAC1 Contains the lower 32 bits of the hash table */
1143#define EMAC1_GMII_ADDR 0xFFC22010 /* EMAC1 Management Address Register */
1144#define EMAC1_GMII_DATA 0xFFC22014 /* EMAC1 Management Data Register */
1145#define EMAC1_FLOWCTL 0xFFC22018 /* EMAC1 MAC FLow Control Register */
1146#define EMAC1_VLANTAG 0xFFC2201C /* EMAC1 VLAN Tag Register */
1147#define EMAC1_VER 0xFFC22020 /* EMAC1 EMAC Version Register */
1148#define EMAC1_DBG 0xFFC22024 /* EMAC1 EMAC Debug Register */
1149#define EMAC1_RMTWKUP 0xFFC22028 /* EMAC1 Remote wake up frame register */
1150#define EMAC1_PMT_CTLSTAT 0xFFC2202C /* EMAC1 PMT Control and Status Register */
1151#define EMAC1_ISTAT 0xFFC22038 /* EMAC1 EMAC Interrupt Status Register */
1152#define EMAC1_IMSK 0xFFC2203C /* EMAC1 EMAC Interrupt Mask Register */
1153#define EMAC1_ADDR0_HI 0xFFC22040 /* EMAC1 EMAC Address0 High Register */
1154#define EMAC1_ADDR0_LO 0xFFC22044 /* EMAC1 EMAC Address0 Low Register */
1155#define EMAC1_MMC_CTL 0xFFC22100 /* EMAC1 MMC Control Register */
1156#define EMAC1_MMC_RXINT 0xFFC22104 /* EMAC1 MMC RX Interrupt Register */
1157#define EMAC1_MMC_TXINT 0xFFC22108 /* EMAC1 MMC TX Interrupt Register */
1158#define EMAC1_MMC_RXIMSK 0xFFC2210C /* EMAC1 MMC RX Interrupt Mask Register */
1159#define EMAC1_MMC_TXIMSK 0xFFC22110 /* EMAC1 MMC TX Interrupt Mask Register */
1160#define EMAC1_TXOCTCNT_GB 0xFFC22114 /* EMAC1 Num bytes transmitted exclusive of preamble */
1161#define EMAC1_TXFRMCNT_GB 0xFFC22118 /* EMAC1 Num frames transmitted exclusive of retired */
1162#define EMAC1_TXBCASTFRM_G 0xFFC2211C /* EMAC1 Number of good broadcast frames transmitted. */
1163#define EMAC1_TXMCASTFRM_G 0xFFC22120 /* EMAC1 Number of good multicast frames transmitted. */
1164#define EMAC1_TX64_GB 0xFFC22124 /* EMAC1 Number of 64 byte length frames */
1165#define EMAC1_TX65TO127_GB 0xFFC22128 /* EMAC1 Number of frames of length b/w 65-127 (inclusive) bytes */
1166#define EMAC1_TX128TO255_GB 0xFFC2212C /* EMAC1 Number of frames of length b/w 128-255 (inclusive) bytes */
1167#define EMAC1_TX256TO511_GB 0xFFC22130 /* EMAC1 Number of frames of length b/w 256-511 (inclusive) bytes */
1168#define EMAC1_TX512TO1023_GB 0xFFC22134 /* EMAC1 Number of frames of length b/w 512-1023 (inclusive) bytes */
1169#define EMAC1_TX1024TOMAX_GB 0xFFC22138 /* EMAC1 Number of frames of length b/w 1024-max (inclusive) bytes */
1170#define EMAC1_TXUCASTFRM_GB 0xFFC2213C /* EMAC1 Number of good and bad unicast frames transmitted */
1171#define EMAC1_TXMCASTFRM_GB 0xFFC22140 /* EMAC1 Number of good and bad multicast frames transmitted */
1172#define EMAC1_TXBCASTFRM_GB 0xFFC22144 /* EMAC1 Number of good and bad broadcast frames transmitted */
1173#define EMAC1_TXUNDR_ERR 0xFFC22148 /* EMAC1 Number of frames aborted due to frame underflow error */
1174#define EMAC1_TXSNGCOL_G 0xFFC2214C /* EMAC1 Number of transmitted frames after single collision */
1175#define EMAC1_TXMULTCOL_G 0xFFC22150 /* EMAC1 Number of transmitted frames with more than one collision */
1176#define EMAC1_TXDEFERRED 0xFFC22154 /* EMAC1 Number of transmitted frames after deferral */
1177#define EMAC1_TXLATECOL 0xFFC22158 /* EMAC1 Number of frames aborted due to late collision error */
1178#define EMAC1_TXEXCESSCOL 0xFFC2215C /* EMAC1 Number of aborted frames due to excessive collisions */
1179#define EMAC1_TXCARR_ERR 0xFFC22160 /* EMAC1 Number of aborted frames due to carrier sense error */
1180#define EMAC1_TXOCTCNT_G 0xFFC22164 /* EMAC1 Number of bytes transmitted in good frames only */
1181#define EMAC1_TXFRMCNT_G 0xFFC22168 /* EMAC1 Number of good frames transmitted. */
1182#define EMAC1_TXEXCESSDEF 0xFFC2216C /* EMAC1 Number of frames aborted due to excessive deferral */
1183#define EMAC1_TXPAUSEFRM 0xFFC22170 /* EMAC1 Number of good PAUSE frames transmitted. */
1184#define EMAC1_TXVLANFRM_G 0xFFC22174 /* EMAC1 Number of VLAN frames transmitted */
1185#define EMAC1_RXFRMCNT_GB 0xFFC22180 /* EMAC1 Number of good and bad frames received. */
1186#define EMAC1_RXOCTCNT_GB 0xFFC22184 /* EMAC1 Number of bytes received in good and bad frames */
1187#define EMAC1_RXOCTCNT_G 0xFFC22188 /* EMAC1 Number of bytes received only in good frames */
1188#define EMAC1_RXBCASTFRM_G 0xFFC2218C /* EMAC1 Number of good broadcast frames received. */
1189#define EMAC1_RXMCASTFRM_G 0xFFC22190 /* EMAC1 Number of good multicast frames received */
1190#define EMAC1_RXCRC_ERR 0xFFC22194 /* EMAC1 Number of frames received with CRC error */
1191#define EMAC1_RXALIGN_ERR 0xFFC22198 /* EMAC1 Number of frames with alignment error */
1192#define EMAC1_RXRUNT_ERR 0xFFC2219C /* EMAC1 Number of frames received with runt error. */
1193#define EMAC1_RXJAB_ERR 0xFFC221A0 /* EMAC1 Number of frames received with length greater than 1518 */
1194#define EMAC1_RXUSIZE_G 0xFFC221A4 /* EMAC1 Number of frames received with length 64 */
1195#define EMAC1_RXOSIZE_G 0xFFC221A8 /* EMAC1 Number of frames received with length greater than maxium */
1196#define EMAC1_RX64_GB 0xFFC221AC /* EMAC1 Number of good and bad frames of lengh 64 bytes */
1197#define EMAC1_RX65TO127_GB 0xFFC221B0 /* EMAC1 Number of good and bad frame between 64-127(inclusive) */
1198#define EMAC1_RX128TO255_GB 0xFFC221B4 /* EMAC1 Number of good and bad frames received with length between 128 and 255 (inclusive) bytes, exclusive of preamble. */
1199#define EMAC1_RX256TO511_GB 0xFFC221B8 /* EMAC1 Number of good and bad frames between 256-511(inclusive) */
1200#define EMAC1_RX512TO1023_GB 0xFFC221BC /* EMAC1 Number of good and bad frames received between 512-1023 */
1201#define EMAC1_RX1024TOMAX_GB 0xFFC221C0 /* EMAC1 Number of frames received between 1024 and maxsize */
1202#define EMAC1_RXUCASTFRM_G 0xFFC221C4 /* EMAC1 Number of good unicast frames received. */
1203#define EMAC1_RXLEN_ERR 0xFFC221C8 /* EMAC1 Number of frames received with length error */
1204#define EMAC1_RXOORTYPE 0xFFC221CC /* EMAC1 Number of frames with length not equal to valid frame size */
1205#define EMAC1_RXPAUSEFRM 0xFFC221D0 /* EMAC1 Number of good and valid PAUSE frames received. */
1206#define EMAC1_RXFIFO_OVF 0xFFC221D4 /* EMAC1 Number of missed received frames due to FIFO overflow. This counter is not present in the GMAC-CORE configuration. */
1207#define EMAC1_RXVLANFRM_GB 0xFFC221D8 /* EMAC1 Number of good and bad VLAN frames received. */
1208#define EMAC1_RXWDOG_ERR 0xFFC221DC /* EMAC1 Frames received with error due to watchdog timeout */
1209#define EMAC1_IPC_RXIMSK 0xFFC22200 /* EMAC1 MMC IPC RX Interrupt Mask Register */
1210#define EMAC1_IPC_RXINT 0xFFC22208 /* EMAC1 MMC IPC RX Interrupt Register */
1211#define EMAC1_RXIPV4_GD_FRM 0xFFC22210 /* EMAC1 Number of good IPv4 datagrams */
1212#define EMAC1_RXIPV4_HDR_ERR_FRM 0xFFC22214 /* EMAC1 Number of IPv4 datagrams with header errors */
1213#define EMAC1_RXIPV4_NOPAY_FRM 0xFFC22218 /* EMAC1 Number of IPv4 datagrams without checksum */
1214#define EMAC1_RXIPV4_FRAG_FRM 0xFFC2221C /* EMAC1 Number of good IPv4 datagrams with fragmentation */
1215#define EMAC1_RXIPV4_UDSBL_FRM 0xFFC22220 /* EMAC1 Number of IPv4 UDP datagrams with disabled checksum */
1216#define EMAC1_RXIPV6_GD_FRM 0xFFC22224 /* EMAC1 Number of IPv4 datagrams with TCP/UDP/ICMP payloads */
1217#define EMAC1_RXIPV6_HDR_ERR_FRM 0xFFC22228 /* EMAC1 Number of IPv6 datagrams with header errors */
1218#define EMAC1_RXIPV6_NOPAY_FRM 0xFFC2222C /* EMAC1 Number of IPv6 datagrams with no TCP/UDP/ICMP payload */
1219#define EMAC1_RXUDP_GD_FRM 0xFFC22230 /* EMAC1 Number of good IP datagrames with good UDP payload */
1220#define EMAC1_RXUDP_ERR_FRM 0xFFC22234 /* EMAC1 Number of good IP datagrams with UDP checksum errors */
1221#define EMAC1_RXTCP_GD_FRM 0xFFC22238 /* EMAC1 Number of good IP datagrams with a good TCP payload */
1222#define EMAC1_RXTCP_ERR_FRM 0xFFC2223C /* EMAC1 Number of good IP datagrams with TCP checksum errors */
1223#define EMAC1_RXICMP_GD_FRM 0xFFC22240 /* EMAC1 Number of good IP datagrams with a good ICMP payload */
1224#define EMAC1_RXICMP_ERR_FRM 0xFFC22244 /* EMAC1 Number of good IP datagrams with ICMP checksum errors */
1225#define EMAC1_RXIPV4_GD_OCT 0xFFC22250 /* EMAC1 Bytes received in IPv4 datagrams including tcp,udp or icmp */
1226#define EMAC1_RXIPV4_HDR_ERR_OCT 0xFFC22254 /* EMAC1 Bytes received in IPv4 datagrams with header errors */
1227#define EMAC1_RXIPV4_NOPAY_OCT 0xFFC22258 /* EMAC1 Bytes received in IPv4 datagrams without tcp,udp,icmp load */
1228#define EMAC1_RXIPV4_FRAG_OCT 0xFFC2225C /* EMAC1 Bytes received in fragmented IPv4 datagrams */
1229#define EMAC1_RXIPV4_UDSBL_OCT 0xFFC22260 /* EMAC1 Bytes received in UDP segment with checksum disabled */
1230#define EMAC1_RXIPV6_GD_OCT 0xFFC22264 /* EMAC1 Bytes received in good IPv6 including tcp,udp or icmp load */
1231#define EMAC1_RXIPV6_HDR_ERR_OCT 0xFFC22268 /* EMAC1 Number of bytes received in IPv6 with header errors */
1232#define EMAC1_RXIPV6_NOPAY_OCT 0xFFC2226C /* EMAC1 Bytes received in IPv6 without tcp,udp or icmp load */
1233#define EMAC1_RXUDP_GD_OCT 0xFFC22270 /* EMAC1 Number of bytes received in good UDP segments */
1234#define EMAC1_RXUDP_ERR_OCT 0xFFC22274 /* EMAC1 Number of bytes received in UDP segment with checksum err */
1235#define EMAC1_RXTCP_GD_OCT 0xFFC22278 /* EMAC1 Number of bytes received in a good TCP segment */
1236#define EMAC1_RXTCP_ERR_OCT 0xFFC2227C /* EMAC1 Number of bytes received in TCP segment with checksum err */
1237#define EMAC1_RXICMP_GD_OCT 0xFFC22280 /* EMAC1 Number of bytes received in a good ICMP segment */
1238#define EMAC1_RXICMP_ERR_OCT 0xFFC22284 /* EMAC1 Bytes received in an ICMP segment with checksum errors */
1239#define EMAC1_TM_CTL 0xFFC22700 /* EMAC1 EMAC Time Stamp Control Register */
1240#define EMAC1_TM_SUBSEC 0xFFC22704 /* EMAC1 EMAC Time Stamp Sub Second Increment */
1241#define EMAC1_TM_SEC 0xFFC22708 /* EMAC1 EMAC Time Stamp Second Register */
1242#define EMAC1_TM_NSEC 0xFFC2270C /* EMAC1 EMAC Time Stamp Nano Second Register */
1243#define EMAC1_TM_SECUPDT 0xFFC22710 /* EMAC1 EMAC Time Stamp Seconds Update */
1244#define EMAC1_TM_NSECUPDT 0xFFC22714 /* EMAC1 EMAC Time Stamp Nano Seconds Update */
1245#define EMAC1_TM_ADDEND 0xFFC22718 /* EMAC1 EMAC Time Stamp Addend Register */
1246#define EMAC1_TM_TGTM 0xFFC2271C /* EMAC1 EMAC Time Stamp Target Time Sec. */
1247#define EMAC1_TM_NTGTM 0xFFC22720 /* EMAC1 EMAC Time Stamp Target Time Nanosec. */
1248#define EMAC1_TM_HISEC 0xFFC22724 /* EMAC1 EMAC Time Stamp High Second Register */
1249#define EMAC1_TM_STMPSTAT 0xFFC22728 /* EMAC1 EMAC Time Stamp Status Register */
1250#define EMAC1_TM_PPSCTL 0xFFC2272C /* EMAC1 EMAC PPS Control Register */
1251#define EMAC1_TM_AUXSTMP_NSEC 0xFFC22730 /* EMAC1 EMAC Auxillary Time Stamp Nano Register */
1252#define EMAC1_TM_AUXSTMP_SEC 0xFFC22734 /* EMAC1 EMAC Auxillary Time Stamp Sec Register */
1253#define EMAC1_DMA_BUSMODE 0xFFC23000 /* EMAC1 Bus Operating Modes for EMAC DMA */
1254#define EMAC1_DMA_TXPOLL 0xFFC23004 /* EMAC1 TX DMA Poll demand register */
1255#define EMAC1_DMA_RXPOLL 0xFFC23008 /* EMAC1 RX DMA Poll demand register */
1256#define EMAC1_DMA_RXDSC_ADDR 0xFFC2300C /* EMAC1 RX Descriptor List Address */
1257#define EMAC1_DMA_TXDSC_ADDR 0xFFC23010 /* EMAC1 TX Descriptor List Address */
1258#define EMAC1_DMA_STAT 0xFFC23014 /* EMAC1 DMA Status Register */
1259#define EMAC1_DMA_OPMODE 0xFFC23018 /* EMAC1 DMA Operation Mode Register */
1260#define EMAC1_DMA_IEN 0xFFC2301C /* EMAC1 DMA Interrupt Enable Register */
1261#define EMAC1_DMA_MISS_FRM 0xFFC23020 /* EMAC1 DMA missed frame and buffer overflow counter */
1262#define EMAC1_DMA_RXIWDOG 0xFFC23024 /* EMAC1 DMA RX Interrupt Watch Dog timer */
1263#define EMAC1_DMA_BMMODE 0xFFC23028 /* EMAC1 AXI Bus Mode Register */
1264#define EMAC1_DMA_BMSTAT 0xFFC2302C /* EMAC1 AXI Status Register */
1265#define EMAC1_DMA_TXDSC_CUR 0xFFC23048 /* EMAC1 TX current descriptor register */
1266#define EMAC1_DMA_RXDSC_CUR 0xFFC2304C /* EMAC1 RX current descriptor register */
1267#define EMAC1_DMA_TXBUF_CUR 0xFFC23050 /* EMAC1 TX current buffer pointer register */
1268#define EMAC1_DMA_RXBUF_CUR 0xFFC23054 /* EMAC1 RX current buffer pointer register */
1269#define EMAC1_HWFEAT 0xFFC23058 /* EMAC1 Hardware Feature Register */
1270
1271
1272/* =========================
1273 SPI Registers
1274 ========================= */
1275
1276/* =========================
1277 SPI0
1278 ========================= */
1279#define SPI0_REGBASE 0xFFC40400
1280#define SPI0_CTL 0xFFC40404 /* SPI0 Control Register */
1281#define SPI0_RXCTL 0xFFC40408 /* SPI0 RX Control Register */
1282#define SPI0_TXCTL 0xFFC4040C /* SPI0 TX Control Register */
1283#define SPI0_CLK 0xFFC40410 /* SPI0 Clock Rate Register */
1284#define SPI0_DLY 0xFFC40414 /* SPI0 Delay Register */
1285#define SPI0_SLVSEL 0xFFC40418 /* SPI0 Slave Select Register */
1286#define SPI0_RWC 0xFFC4041C /* SPI0 Received Word-Count Register */
1287#define SPI0_RWCR 0xFFC40420 /* SPI0 Received Word-Count Reload Register */
1288#define SPI0_TWC 0xFFC40424 /* SPI0 Transmitted Word-Count Register */
1289#define SPI0_TWCR 0xFFC40428 /* SPI0 Transmitted Word-Count Reload Register */
1290#define SPI0_IMSK 0xFFC40430 /* SPI0 Interrupt Mask Register */
1291#define SPI0_IMSK_CLR 0xFFC40434 /* SPI0 Interrupt Mask Clear Register */
1292#define SPI0_IMSK_SET 0xFFC40438 /* SPI0 Interrupt Mask Set Register */
1293#define SPI0_STAT 0xFFC40440 /* SPI0 Status Register */
1294#define SPI0_ILAT 0xFFC40444 /* SPI0 Masked Interrupt Condition Register */
1295#define SPI0_ILAT_CLR 0xFFC40448 /* SPI0 Masked Interrupt Clear Register */
1296#define SPI0_RFIFO 0xFFC40450 /* SPI0 Receive FIFO Data Register */
1297#define SPI0_TFIFO 0xFFC40458 /* SPI0 Transmit FIFO Data Register */
1298
1299/* =========================
1300 SPI1
1301 ========================= */
1302#define SPI1_REGBASE 0xFFC40500
1303#define SPI1_CTL 0xFFC40504 /* SPI1 Control Register */
1304#define SPI1_RXCTL 0xFFC40508 /* SPI1 RX Control Register */
1305#define SPI1_TXCTL 0xFFC4050C /* SPI1 TX Control Register */
1306#define SPI1_CLK 0xFFC40510 /* SPI1 Clock Rate Register */
1307#define SPI1_DLY 0xFFC40514 /* SPI1 Delay Register */
1308#define SPI1_SLVSEL 0xFFC40518 /* SPI1 Slave Select Register */
1309#define SPI1_RWC 0xFFC4051C /* SPI1 Received Word-Count Register */
1310#define SPI1_RWCR 0xFFC40520 /* SPI1 Received Word-Count Reload Register */
1311#define SPI1_TWC 0xFFC40524 /* SPI1 Transmitted Word-Count Register */
1312#define SPI1_TWCR 0xFFC40528 /* SPI1 Transmitted Word-Count Reload Register */
1313#define SPI1_IMSK 0xFFC40530 /* SPI1 Interrupt Mask Register */
1314#define SPI1_IMSK_CLR 0xFFC40534 /* SPI1 Interrupt Mask Clear Register */
1315#define SPI1_IMSK_SET 0xFFC40538 /* SPI1 Interrupt Mask Set Register */
1316#define SPI1_STAT 0xFFC40540 /* SPI1 Status Register */
1317#define SPI1_ILAT 0xFFC40544 /* SPI1 Masked Interrupt Condition Register */
1318#define SPI1_ILAT_CLR 0xFFC40548 /* SPI1 Masked Interrupt Clear Register */
1319#define SPI1_RFIFO 0xFFC40550 /* SPI1 Receive FIFO Data Register */
1320#define SPI1_TFIFO 0xFFC40558 /* SPI1 Transmit FIFO Data Register */
1321
1322/* =========================
1323 SPORT Registers
1324 ========================= */
1325
1326/* =========================
1327 SPORT0
1328 ========================= */
1329#define SPORT0_CTL_A 0xFFC40000 /* SPORT0 'A' Control Register */
1330#define SPORT0_DIV_A 0xFFC40004 /* SPORT0 'A' Clock and FS Divide Register */
1331#define SPORT0_MCTL_A 0xFFC40008 /* SPORT0 'A' Multichannel Control Register */
1332#define SPORT0_CS0_A 0xFFC4000C /* SPORT0 'A' Multichannel Select Register (Channels 0-31) */
1333#define SPORT0_CS1_A 0xFFC40010 /* SPORT0 'A' Multichannel Select Register (Channels 32-63) */
1334#define SPORT0_CS2_A 0xFFC40014 /* SPORT0 'A' Multichannel Select Register (Channels 64-95) */
1335#define SPORT0_CS3_A 0xFFC40018 /* SPORT0 'A' Multichannel Select Register (Channels 96-127) */
1336#define SPORT0_CNT_A 0xFFC4001C /* SPORT0 'A' Frame Sync And Clock Divisor Current Count */
1337#define SPORT0_ERR_A 0xFFC40020 /* SPORT0 'A' Error Register */
1338#define SPORT0_MSTAT_A 0xFFC40024 /* SPORT0 'A' Multichannel Mode Status Register */
1339#define SPORT0_CTL2_A 0xFFC40028 /* SPORT0 'A' Control Register 2 */
1340#define SPORT0_TXPRI_A 0xFFC40040 /* SPORT0 'A' Primary Channel Transmit Buffer Register */
1341#define SPORT0_RXPRI_A 0xFFC40044 /* SPORT0 'A' Primary Channel Receive Buffer Register */
1342#define SPORT0_TXSEC_A 0xFFC40048 /* SPORT0 'A' Secondary Channel Transmit Buffer Register */
1343#define SPORT0_RXSEC_A 0xFFC4004C /* SPORT0 'A' Secondary Channel Receive Buffer Register */
1344#define SPORT0_CTL_B 0xFFC40080 /* SPORT0 'B' Control Register */
1345#define SPORT0_DIV_B 0xFFC40084 /* SPORT0 'B' Clock and FS Divide Register */
1346#define SPORT0_MCTL_B 0xFFC40088 /* SPORT0 'B' Multichannel Control Register */
1347#define SPORT0_CS0_B 0xFFC4008C /* SPORT0 'B' Multichannel Select Register (Channels 0-31) */
1348#define SPORT0_CS1_B 0xFFC40090 /* SPORT0 'B' Multichannel Select Register (Channels 32-63) */
1349#define SPORT0_CS2_B 0xFFC40094 /* SPORT0 'B' Multichannel Select Register (Channels 64-95) */
1350#define SPORT0_CS3_B 0xFFC40098 /* SPORT0 'B' Multichannel Select Register (Channels 96-127) */
1351#define SPORT0_CNT_B 0xFFC4009C /* SPORT0 'B' Frame Sync And Clock Divisor Current Count */
1352#define SPORT0_ERR_B 0xFFC400A0 /* SPORT0 'B' Error Register */
1353#define SPORT0_MSTAT_B 0xFFC400A4 /* SPORT0 'B' Multichannel Mode Status Register */
1354#define SPORT0_CTL2_B 0xFFC400A8 /* SPORT0 'B' Control Register 2 */
1355#define SPORT0_TXPRI_B 0xFFC400C0 /* SPORT0 'B' Primary Channel Transmit Buffer Register */
1356#define SPORT0_RXPRI_B 0xFFC400C4 /* SPORT0 'B' Primary Channel Receive Buffer Register */
1357#define SPORT0_TXSEC_B 0xFFC400C8 /* SPORT0 'B' Secondary Channel Transmit Buffer Register */
1358#define SPORT0_RXSEC_B 0xFFC400CC /* SPORT0 'B' Secondary Channel Receive Buffer Register */
1359
1360/* =========================
1361 SPORT1
1362 ========================= */
1363#define SPORT1_CTL_A 0xFFC40100 /* SPORT1 'A' Control Register */
1364#define SPORT1_DIV_A 0xFFC40104 /* SPORT1 'A' Clock and FS Divide Register */
1365#define SPORT1_MCTL_A 0xFFC40108 /* SPORT1 'A' Multichannel Control Register */
1366#define SPORT1_CS0_A 0xFFC4010C /* SPORT1 'A' Multichannel Select Register (Channels 0-31) */
1367#define SPORT1_CS1_A 0xFFC40110 /* SPORT1 'A' Multichannel Select Register (Channels 32-63) */
1368#define SPORT1_CS2_A 0xFFC40114 /* SPORT1 'A' Multichannel Select Register (Channels 64-95) */
1369#define SPORT1_CS3_A 0xFFC40118 /* SPORT1 'A' Multichannel Select Register (Channels 96-127) */
1370#define SPORT1_CNT_A 0xFFC4011C /* SPORT1 'A' Frame Sync And Clock Divisor Current Count */
1371#define SPORT1_ERR_A 0xFFC40120 /* SPORT1 'A' Error Register */
1372#define SPORT1_MSTAT_A 0xFFC40124 /* SPORT1 'A' Multichannel Mode Status Register */
1373#define SPORT1_CTL2_A 0xFFC40128 /* SPORT1 'A' Control Register 2 */
1374#define SPORT1_TXPRI_A 0xFFC40140 /* SPORT1 'A' Primary Channel Transmit Buffer Register */
1375#define SPORT1_RXPRI_A 0xFFC40144 /* SPORT1 'A' Primary Channel Receive Buffer Register */
1376#define SPORT1_TXSEC_A 0xFFC40148 /* SPORT1 'A' Secondary Channel Transmit Buffer Register */
1377#define SPORT1_RXSEC_A 0xFFC4014C /* SPORT1 'A' Secondary Channel Receive Buffer Register */
1378#define SPORT1_CTL_B 0xFFC40180 /* SPORT1 'B' Control Register */
1379#define SPORT1_DIV_B 0xFFC40184 /* SPORT1 'B' Clock and FS Divide Register */
1380#define SPORT1_MCTL_B 0xFFC40188 /* SPORT1 'B' Multichannel Control Register */
1381#define SPORT1_CS0_B 0xFFC4018C /* SPORT1 'B' Multichannel Select Register (Channels 0-31) */
1382#define SPORT1_CS1_B 0xFFC40190 /* SPORT1 'B' Multichannel Select Register (Channels 32-63) */
1383#define SPORT1_CS2_B 0xFFC40194 /* SPORT1 'B' Multichannel Select Register (Channels 64-95) */
1384#define SPORT1_CS3_B 0xFFC40198 /* SPORT1 'B' Multichannel Select Register (Channels 96-127) */
1385#define SPORT1_CNT_B 0xFFC4019C /* SPORT1 'B' Frame Sync And Clock Divisor Current Count */
1386#define SPORT1_ERR_B 0xFFC401A0 /* SPORT1 'B' Error Register */
1387#define SPORT1_MSTAT_B 0xFFC401A4 /* SPORT1 'B' Multichannel Mode Status Register */
1388#define SPORT1_CTL2_B 0xFFC401A8 /* SPORT1 'B' Control Register 2 */
1389#define SPORT1_TXPRI_B 0xFFC401C0 /* SPORT1 'B' Primary Channel Transmit Buffer Register */
1390#define SPORT1_RXPRI_B 0xFFC401C4 /* SPORT1 'B' Primary Channel Receive Buffer Register */
1391#define SPORT1_TXSEC_B 0xFFC401C8 /* SPORT1 'B' Secondary Channel Transmit Buffer Register */
1392#define SPORT1_RXSEC_B 0xFFC401CC /* SPORT1 'B' Secondary Channel Receive Buffer Register */
1393
1394/* =========================
1395 SPORT2
1396 ========================= */
1397#define SPORT2_CTL_A 0xFFC40200 /* SPORT2 'A' Control Register */
1398#define SPORT2_DIV_A 0xFFC40204 /* SPORT2 'A' Clock and FS Divide Register */
1399#define SPORT2_MCTL_A 0xFFC40208 /* SPORT2 'A' Multichannel Control Register */
1400#define SPORT2_CS0_A 0xFFC4020C /* SPORT2 'A' Multichannel Select Register (Channels 0-31) */
1401#define SPORT2_CS1_A 0xFFC40210 /* SPORT2 'A' Multichannel Select Register (Channels 32-63) */
1402#define SPORT2_CS2_A 0xFFC40214 /* SPORT2 'A' Multichannel Select Register (Channels 64-95) */
1403#define SPORT2_CS3_A 0xFFC40218 /* SPORT2 'A' Multichannel Select Register (Channels 96-127) */
1404#define SPORT2_CNT_A 0xFFC4021C /* SPORT2 'A' Frame Sync And Clock Divisor Current Count */
1405#define SPORT2_ERR_A 0xFFC40220 /* SPORT2 'A' Error Register */
1406#define SPORT2_MSTAT_A 0xFFC40224 /* SPORT2 'A' Multichannel Mode Status Register */
1407#define SPORT2_CTL2_A 0xFFC40228 /* SPORT2 'A' Control Register 2 */
1408#define SPORT2_TXPRI_A 0xFFC40240 /* SPORT2 'A' Primary Channel Transmit Buffer Register */
1409#define SPORT2_RXPRI_A 0xFFC40244 /* SPORT2 'A' Primary Channel Receive Buffer Register */
1410#define SPORT2_TXSEC_A 0xFFC40248 /* SPORT2 'A' Secondary Channel Transmit Buffer Register */
1411#define SPORT2_RXSEC_A 0xFFC4024C /* SPORT2 'A' Secondary Channel Receive Buffer Register */
1412#define SPORT2_CTL_B 0xFFC40280 /* SPORT2 'B' Control Register */
1413#define SPORT2_DIV_B 0xFFC40284 /* SPORT2 'B' Clock and FS Divide Register */
1414#define SPORT2_MCTL_B 0xFFC40288 /* SPORT2 'B' Multichannel Control Register */
1415#define SPORT2_CS0_B 0xFFC4028C /* SPORT2 'B' Multichannel Select Register (Channels 0-31) */
1416#define SPORT2_CS1_B 0xFFC40290 /* SPORT2 'B' Multichannel Select Register (Channels 32-63) */
1417#define SPORT2_CS2_B 0xFFC40294 /* SPORT2 'B' Multichannel Select Register (Channels 64-95) */
1418#define SPORT2_CS3_B 0xFFC40298 /* SPORT2 'B' Multichannel Select Register (Channels 96-127) */
1419#define SPORT2_CNT_B 0xFFC4029C /* SPORT2 'B' Frame Sync And Clock Divisor Current Count */
1420#define SPORT2_ERR_B 0xFFC402A0 /* SPORT2 'B' Error Register */
1421#define SPORT2_MSTAT_B 0xFFC402A4 /* SPORT2 'B' Multichannel Mode Status Register */
1422#define SPORT2_CTL2_B 0xFFC402A8 /* SPORT2 'B' Control Register 2 */
1423#define SPORT2_TXPRI_B 0xFFC402C0 /* SPORT2 'B' Primary Channel Transmit Buffer Register */
1424#define SPORT2_RXPRI_B 0xFFC402C4 /* SPORT2 'B' Primary Channel Receive Buffer Register */
1425#define SPORT2_TXSEC_B 0xFFC402C8 /* SPORT2 'B' Secondary Channel Transmit Buffer Register */
1426#define SPORT2_RXSEC_B 0xFFC402CC /* SPORT2 'B' Secondary Channel Receive Buffer Register */
1427
1428/* =========================
1429 EPPI Registers
1430 ========================= */
1431
1432/* =========================
1433 EPPI0
1434 ========================= */
1435#define EPPI0_STAT 0xFFC18000 /* EPPI0 Status Register */
1436#define EPPI0_HCNT 0xFFC18004 /* EPPI0 Horizontal Transfer Count Register */
1437#define EPPI0_HDLY 0xFFC18008 /* EPPI0 Horizontal Delay Count Register */
1438#define EPPI0_VCNT 0xFFC1800C /* EPPI0 Vertical Transfer Count Register */
1439#define EPPI0_VDLY 0xFFC18010 /* EPPI0 Vertical Delay Count Register */
1440#define EPPI0_FRAME 0xFFC18014 /* EPPI0 Lines Per Frame Register */
1441#define EPPI0_LINE 0xFFC18018 /* EPPI0 Samples Per Line Register */
1442#define EPPI0_CLKDIV 0xFFC1801C /* EPPI0 Clock Divide Register */
1443#define EPPI0_CTL 0xFFC18020 /* EPPI0 Control Register */
1444#define EPPI0_FS1_WLHB 0xFFC18024 /* EPPI0 FS1 Width Register / EPPI Horizontal Blanking Samples Per Line Register */
1445#define EPPI0_FS1_PASPL 0xFFC18028 /* EPPI0 FS1 Period Register / EPPI Active Samples Per Line Register */
1446#define EPPI0_FS2_WLVB 0xFFC1802C /* EPPI0 FS2 Width Register / EPPI Lines Of Vertical Blanking Register */
1447#define EPPI0_FS2_PALPF 0xFFC18030 /* EPPI0 FS2 Period Register / EPPI Active Lines Per Field Register */
1448#define EPPI0_IMSK 0xFFC18034 /* EPPI0 Interrupt Mask Register */
1449#define EPPI0_ODDCLIP 0xFFC1803C /* EPPI0 Clipping Register for ODD (Chroma) Data */
1450#define EPPI0_EVENCLIP 0xFFC18040 /* EPPI0 Clipping Register for EVEN (Luma) Data */
1451#define EPPI0_FS1_DLY 0xFFC18044 /* EPPI0 Frame Sync 1 Delay Value */
1452#define EPPI0_FS2_DLY 0xFFC18048 /* EPPI0 Frame Sync 2 Delay Value */
1453#define EPPI0_CTL2 0xFFC1804C /* EPPI0 Control Register 2 */
1454
1455/* =========================
1456 EPPI1
1457 ========================= */
1458#define EPPI1_STAT 0xFFC18400 /* EPPI1 Status Register */
1459#define EPPI1_HCNT 0xFFC18404 /* EPPI1 Horizontal Transfer Count Register */
1460#define EPPI1_HDLY 0xFFC18408 /* EPPI1 Horizontal Delay Count Register */
1461#define EPPI1_VCNT 0xFFC1840C /* EPPI1 Vertical Transfer Count Register */
1462#define EPPI1_VDLY 0xFFC18410 /* EPPI1 Vertical Delay Count Register */
1463#define EPPI1_FRAME 0xFFC18414 /* EPPI1 Lines Per Frame Register */
1464#define EPPI1_LINE 0xFFC18418 /* EPPI1 Samples Per Line Register */
1465#define EPPI1_CLKDIV 0xFFC1841C /* EPPI1 Clock Divide Register */
1466#define EPPI1_CTL 0xFFC18420 /* EPPI1 Control Register */
1467#define EPPI1_FS1_WLHB 0xFFC18424 /* EPPI1 FS1 Width Register / EPPI Horizontal Blanking Samples Per Line Register */
1468#define EPPI1_FS1_PASPL 0xFFC18428 /* EPPI1 FS1 Period Register / EPPI Active Samples Per Line Register */
1469#define EPPI1_FS2_WLVB 0xFFC1842C /* EPPI1 FS2 Width Register / EPPI Lines Of Vertical Blanking Register */
1470#define EPPI1_FS2_PALPF 0xFFC18430 /* EPPI1 FS2 Period Register / EPPI Active Lines Per Field Register */
1471#define EPPI1_IMSK 0xFFC18434 /* EPPI1 Interrupt Mask Register */
1472#define EPPI1_ODDCLIP 0xFFC1843C /* EPPI1 Clipping Register for ODD (Chroma) Data */
1473#define EPPI1_EVENCLIP 0xFFC18440 /* EPPI1 Clipping Register for EVEN (Luma) Data */
1474#define EPPI1_FS1_DLY 0xFFC18444 /* EPPI1 Frame Sync 1 Delay Value */
1475#define EPPI1_FS2_DLY 0xFFC18448 /* EPPI1 Frame Sync 2 Delay Value */
1476#define EPPI1_CTL2 0xFFC1844C /* EPPI1 Control Register 2 */
1477
1478/* =========================
1479 EPPI2
1480 ========================= */
1481#define EPPI2_STAT 0xFFC18800 /* EPPI2 Status Register */
1482#define EPPI2_HCNT 0xFFC18804 /* EPPI2 Horizontal Transfer Count Register */
1483#define EPPI2_HDLY 0xFFC18808 /* EPPI2 Horizontal Delay Count Register */
1484#define EPPI2_VCNT 0xFFC1880C /* EPPI2 Vertical Transfer Count Register */
1485#define EPPI2_VDLY 0xFFC18810 /* EPPI2 Vertical Delay Count Register */
1486#define EPPI2_FRAME 0xFFC18814 /* EPPI2 Lines Per Frame Register */
1487#define EPPI2_LINE 0xFFC18818 /* EPPI2 Samples Per Line Register */
1488#define EPPI2_CLKDIV 0xFFC1881C /* EPPI2 Clock Divide Register */
1489#define EPPI2_CTL 0xFFC18820 /* EPPI2 Control Register */
1490#define EPPI2_FS1_WLHB 0xFFC18824 /* EPPI2 FS1 Width Register / EPPI Horizontal Blanking Samples Per Line Register */
1491#define EPPI2_FS1_PASPL 0xFFC18828 /* EPPI2 FS1 Period Register / EPPI Active Samples Per Line Register */
1492#define EPPI2_FS2_WLVB 0xFFC1882C /* EPPI2 FS2 Width Register / EPPI Lines Of Vertical Blanking Register */
1493#define EPPI2_FS2_PALPF 0xFFC18830 /* EPPI2 FS2 Period Register / EPPI Active Lines Per Field Register */
1494#define EPPI2_IMSK 0xFFC18834 /* EPPI2 Interrupt Mask Register */
1495#define EPPI2_ODDCLIP 0xFFC1883C /* EPPI2 Clipping Register for ODD (Chroma) Data */
1496#define EPPI2_EVENCLIP 0xFFC18840 /* EPPI2 Clipping Register for EVEN (Luma) Data */
1497#define EPPI2_FS1_DLY 0xFFC18844 /* EPPI2 Frame Sync 1 Delay Value */
1498#define EPPI2_FS2_DLY 0xFFC18848 /* EPPI2 Frame Sync 2 Delay Value */
1499#define EPPI2_CTL2 0xFFC1884C /* EPPI2 Control Register 2 */
1500
1501
1502
1503/* =========================
1504 DDE Registers
1505 ========================= */
1506
1507/* =========================
1508 DMA0
1509 ========================= */
1510#define DMA0_NEXT_DESC_PTR 0xFFC41000 /* DMA0 Pointer to Next Initial Descriptor */
1511#define DMA0_START_ADDR 0xFFC41004 /* DMA0 Start Address of Current Buffer */
1512#define DMA0_CONFIG 0xFFC41008 /* DMA0 Configuration Register */
1513#define DMA0_X_COUNT 0xFFC4100C /* DMA0 Inner Loop Count Start Value */
1514#define DMA0_X_MODIFY 0xFFC41010 /* DMA0 Inner Loop Address Increment */
1515#define DMA0_Y_COUNT 0xFFC41014 /* DMA0 Outer Loop Count Start Value (2D only) */
1516#define DMA0_Y_MODIFY 0xFFC41018 /* DMA0 Outer Loop Address Increment (2D only) */
1517#define DMA0_CURR_DESC_PTR 0xFFC41024 /* DMA0 Current Descriptor Pointer */
1518#define DMA0_PREV_DESC_PTR 0xFFC41028 /* DMA0 Previous Initial Descriptor Pointer */
1519#define DMA0_CURR_ADDR 0xFFC4102C /* DMA0 Current Address */
1520#define DMA0_IRQ_STATUS 0xFFC41030 /* DMA0 Status Register */
1521#define DMA0_CURR_X_COUNT 0xFFC41034 /* DMA0 Current Count(1D) or intra-row XCNT (2D) */
1522#define DMA0_CURR_Y_COUNT 0xFFC41038 /* DMA0 Current Row Count (2D only) */
1523#define DMA0_BWL_COUNT 0xFFC41040 /* DMA0 Bandwidth Limit Count */
1524#define DMA0_CURR_BWL_COUNT 0xFFC41044 /* DMA0 Bandwidth Limit Count Current */
1525#define DMA0_BWM_COUNT 0xFFC41048 /* DMA0 Bandwidth Monitor Count */
1526#define DMA0_CURR_BWM_COUNT 0xFFC4104C /* DMA0 Bandwidth Monitor Count Current */
1527
1528/* =========================
1529 DMA1
1530 ========================= */
1531#define DMA1_NEXT_DESC_PTR 0xFFC41080 /* DMA1 Pointer to Next Initial Descriptor */
1532#define DMA1_START_ADDR 0xFFC41084 /* DMA1 Start Address of Current Buffer */
1533#define DMA1_CONFIG 0xFFC41088 /* DMA1 Configuration Register */
1534#define DMA1_X_COUNT 0xFFC4108C /* DMA1 Inner Loop Count Start Value */
1535#define DMA1_X_MODIFY 0xFFC41090 /* DMA1 Inner Loop Address Increment */
1536#define DMA1_Y_COUNT 0xFFC41094 /* DMA1 Outer Loop Count Start Value (2D only) */
1537#define DMA1_Y_MODIFY 0xFFC41098 /* DMA1 Outer Loop Address Increment (2D only) */
1538#define DMA1_CURR_DESC_PTR 0xFFC410A4 /* DMA1 Current Descriptor Pointer */
1539#define DMA1_PREV_DESC_PTR 0xFFC410A8 /* DMA1 Previous Initial Descriptor Pointer */
1540#define DMA1_CURR_ADDR 0xFFC410AC /* DMA1 Current Address */
1541#define DMA1_IRQ_STATUS 0xFFC410B0 /* DMA1 Status Register */
1542#define DMA1_CURR_X_COUNT 0xFFC410B4 /* DMA1 Current Count(1D) or intra-row XCNT (2D) */
1543#define DMA1_CURR_Y_COUNT 0xFFC410B8 /* DMA1 Current Row Count (2D only) */
1544#define DMA1_BWL_COUNT 0xFFC410C0 /* DMA1 Bandwidth Limit Count */
1545#define DMA1_CURR_BWL_COUNT 0xFFC410C4 /* DMA1 Bandwidth Limit Count Current */
1546#define DMA1_BWM_COUNT 0xFFC410C8 /* DMA1 Bandwidth Monitor Count */
1547#define DMA1_CURR_BWM_COUNT 0xFFC410CC /* DMA1 Bandwidth Monitor Count Current */
1548
1549/* =========================
1550 DMA2
1551 ========================= */
1552#define DMA2_NEXT_DESC_PTR 0xFFC41100 /* DMA2 Pointer to Next Initial Descriptor */
1553#define DMA2_START_ADDR 0xFFC41104 /* DMA2 Start Address of Current Buffer */
1554#define DMA2_CONFIG 0xFFC41108 /* DMA2 Configuration Register */
1555#define DMA2_X_COUNT 0xFFC4110C /* DMA2 Inner Loop Count Start Value */
1556#define DMA2_X_MODIFY 0xFFC41110 /* DMA2 Inner Loop Address Increment */
1557#define DMA2_Y_COUNT 0xFFC41114 /* DMA2 Outer Loop Count Start Value (2D only) */
1558#define DMA2_Y_MODIFY 0xFFC41118 /* DMA2 Outer Loop Address Increment (2D only) */
1559#define DMA2_CURR_DESC_PTR 0xFFC41124 /* DMA2 Current Descriptor Pointer */
1560#define DMA2_PREV_DESC_PTR 0xFFC41128 /* DMA2 Previous Initial Descriptor Pointer */
1561#define DMA2_CURR_ADDR 0xFFC4112C /* DMA2 Current Address */
1562#define DMA2_IRQ_STATUS 0xFFC41130 /* DMA2 Status Register */
1563#define DMA2_CURR_X_COUNT 0xFFC41134 /* DMA2 Current Count(1D) or intra-row XCNT (2D) */
1564#define DMA2_CURR_Y_COUNT 0xFFC41138 /* DMA2 Current Row Count (2D only) */
1565#define DMA2_BWL_COUNT 0xFFC41140 /* DMA2 Bandwidth Limit Count */
1566#define DMA2_CURR_BWL_COUNT 0xFFC41144 /* DMA2 Bandwidth Limit Count Current */
1567#define DMA2_BWM_COUNT 0xFFC41148 /* DMA2 Bandwidth Monitor Count */
1568#define DMA2_CURR_BWM_COUNT 0xFFC4114C /* DMA2 Bandwidth Monitor Count Current */
1569
1570/* =========================
1571 DMA3
1572 ========================= */
1573#define DMA3_NEXT_DESC_PTR 0xFFC41180 /* DMA3 Pointer to Next Initial Descriptor */
1574#define DMA3_START_ADDR 0xFFC41184 /* DMA3 Start Address of Current Buffer */
1575#define DMA3_CONFIG 0xFFC41188 /* DMA3 Configuration Register */
1576#define DMA3_X_COUNT 0xFFC4118C /* DMA3 Inner Loop Count Start Value */
1577#define DMA3_X_MODIFY 0xFFC41190 /* DMA3 Inner Loop Address Increment */
1578#define DMA3_Y_COUNT 0xFFC41194 /* DMA3 Outer Loop Count Start Value (2D only) */
1579#define DMA3_Y_MODIFY 0xFFC41198 /* DMA3 Outer Loop Address Increment (2D only) */
1580#define DMA3_CURR_DESC_PTR 0xFFC411A4 /* DMA3 Current Descriptor Pointer */
1581#define DMA3_PREV_DESC_PTR 0xFFC411A8 /* DMA3 Previous Initial Descriptor Pointer */
1582#define DMA3_CURR_ADDR 0xFFC411AC /* DMA3 Current Address */
1583#define DMA3_IRQ_STATUS 0xFFC411B0 /* DMA3 Status Register */
1584#define DMA3_CURR_X_COUNT 0xFFC411B4 /* DMA3 Current Count(1D) or intra-row XCNT (2D) */
1585#define DMA3_CURR_Y_COUNT 0xFFC411B8 /* DMA3 Current Row Count (2D only) */
1586#define DMA3_BWL_COUNT 0xFFC411C0 /* DMA3 Bandwidth Limit Count */
1587#define DMA3_CURR_BWL_COUNT 0xFFC411C4 /* DMA3 Bandwidth Limit Count Current */
1588#define DMA3_BWM_COUNT 0xFFC411C8 /* DMA3 Bandwidth Monitor Count */
1589#define DMA3_CURR_BWM_COUNT 0xFFC411CC /* DMA3 Bandwidth Monitor Count Current */
1590
1591/* =========================
1592 DMA4
1593 ========================= */
1594#define DMA4_NEXT_DESC_PTR 0xFFC41200 /* DMA4 Pointer to Next Initial Descriptor */
1595#define DMA4_START_ADDR 0xFFC41204 /* DMA4 Start Address of Current Buffer */
1596#define DMA4_CONFIG 0xFFC41208 /* DMA4 Configuration Register */
1597#define DMA4_X_COUNT 0xFFC4120C /* DMA4 Inner Loop Count Start Value */
1598#define DMA4_X_MODIFY 0xFFC41210 /* DMA4 Inner Loop Address Increment */
1599#define DMA4_Y_COUNT 0xFFC41214 /* DMA4 Outer Loop Count Start Value (2D only) */
1600#define DMA4_Y_MODIFY 0xFFC41218 /* DMA4 Outer Loop Address Increment (2D only) */
1601#define DMA4_CURR_DESC_PTR 0xFFC41224 /* DMA4 Current Descriptor Pointer */
1602#define DMA4_PREV_DESC_PTR 0xFFC41228 /* DMA4 Previous Initial Descriptor Pointer */
1603#define DMA4_CURR_ADDR 0xFFC4122C /* DMA4 Current Address */
1604#define DMA4_IRQ_STATUS 0xFFC41230 /* DMA4 Status Register */
1605#define DMA4_CURR_X_COUNT 0xFFC41234 /* DMA4 Current Count(1D) or intra-row XCNT (2D) */
1606#define DMA4_CURR_Y_COUNT 0xFFC41238 /* DMA4 Current Row Count (2D only) */
1607#define DMA4_BWL_COUNT 0xFFC41240 /* DMA4 Bandwidth Limit Count */
1608#define DMA4_CURR_BWL_COUNT 0xFFC41244 /* DMA4 Bandwidth Limit Count Current */
1609#define DMA4_BWM_COUNT 0xFFC41248 /* DMA4 Bandwidth Monitor Count */
1610#define DMA4_CURR_BWM_COUNT 0xFFC4124C /* DMA4 Bandwidth Monitor Count Current */
1611
1612/* =========================
1613 DMA5
1614 ========================= */
1615#define DMA5_NEXT_DESC_PTR 0xFFC41280 /* DMA5 Pointer to Next Initial Descriptor */
1616#define DMA5_START_ADDR 0xFFC41284 /* DMA5 Start Address of Current Buffer */
1617#define DMA5_CONFIG 0xFFC41288 /* DMA5 Configuration Register */
1618#define DMA5_X_COUNT 0xFFC4128C /* DMA5 Inner Loop Count Start Value */
1619#define DMA5_X_MODIFY 0xFFC41290 /* DMA5 Inner Loop Address Increment */
1620#define DMA5_Y_COUNT 0xFFC41294 /* DMA5 Outer Loop Count Start Value (2D only) */
1621#define DMA5_Y_MODIFY 0xFFC41298 /* DMA5 Outer Loop Address Increment (2D only) */
1622#define DMA5_CURR_DESC_PTR 0xFFC412A4 /* DMA5 Current Descriptor Pointer */
1623#define DMA5_PREV_DESC_PTR 0xFFC412A8 /* DMA5 Previous Initial Descriptor Pointer */
1624#define DMA5_CURR_ADDR 0xFFC412AC /* DMA5 Current Address */
1625#define DMA5_IRQ_STATUS 0xFFC412B0 /* DMA5 Status Register */
1626#define DMA5_CURR_X_COUNT 0xFFC412B4 /* DMA5 Current Count(1D) or intra-row XCNT (2D) */
1627#define DMA5_CURR_Y_COUNT 0xFFC412B8 /* DMA5 Current Row Count (2D only) */
1628#define DMA5_BWL_COUNT 0xFFC412C0 /* DMA5 Bandwidth Limit Count */
1629#define DMA5_CURR_BWL_COUNT 0xFFC412C4 /* DMA5 Bandwidth Limit Count Current */
1630#define DMA5_BWM_COUNT 0xFFC412C8 /* DMA5 Bandwidth Monitor Count */
1631#define DMA5_CURR_BWM_COUNT 0xFFC412CC /* DMA5 Bandwidth Monitor Count Current */
1632
1633/* =========================
1634 DMA6
1635 ========================= */
1636#define DMA6_NEXT_DESC_PTR 0xFFC41300 /* DMA6 Pointer to Next Initial Descriptor */
1637#define DMA6_START_ADDR 0xFFC41304 /* DMA6 Start Address of Current Buffer */
1638#define DMA6_CONFIG 0xFFC41308 /* DMA6 Configuration Register */
1639#define DMA6_X_COUNT 0xFFC4130C /* DMA6 Inner Loop Count Start Value */
1640#define DMA6_X_MODIFY 0xFFC41310 /* DMA6 Inner Loop Address Increment */
1641#define DMA6_Y_COUNT 0xFFC41314 /* DMA6 Outer Loop Count Start Value (2D only) */
1642#define DMA6_Y_MODIFY 0xFFC41318 /* DMA6 Outer Loop Address Increment (2D only) */
1643#define DMA6_CURR_DESC_PTR 0xFFC41324 /* DMA6 Current Descriptor Pointer */
1644#define DMA6_PREV_DESC_PTR 0xFFC41328 /* DMA6 Previous Initial Descriptor Pointer */
1645#define DMA6_CURR_ADDR 0xFFC4132C /* DMA6 Current Address */
1646#define DMA6_IRQ_STATUS 0xFFC41330 /* DMA6 Status Register */
1647#define DMA6_CURR_X_COUNT 0xFFC41334 /* DMA6 Current Count(1D) or intra-row XCNT (2D) */
1648#define DMA6_CURR_Y_COUNT 0xFFC41338 /* DMA6 Current Row Count (2D only) */
1649#define DMA6_BWL_COUNT 0xFFC41340 /* DMA6 Bandwidth Limit Count */
1650#define DMA6_CURR_BWL_COUNT 0xFFC41344 /* DMA6 Bandwidth Limit Count Current */
1651#define DMA6_BWM_COUNT 0xFFC41348 /* DMA6 Bandwidth Monitor Count */
1652#define DMA6_CURR_BWM_COUNT 0xFFC4134C /* DMA6 Bandwidth Monitor Count Current */
1653
1654/* =========================
1655 DMA7
1656 ========================= */
1657#define DMA7_NEXT_DESC_PTR 0xFFC41380 /* DMA7 Pointer to Next Initial Descriptor */
1658#define DMA7_START_ADDR 0xFFC41384 /* DMA7 Start Address of Current Buffer */
1659#define DMA7_CONFIG 0xFFC41388 /* DMA7 Configuration Register */
1660#define DMA7_X_COUNT 0xFFC4138C /* DMA7 Inner Loop Count Start Value */
1661#define DMA7_X_MODIFY 0xFFC41390 /* DMA7 Inner Loop Address Increment */
1662#define DMA7_Y_COUNT 0xFFC41394 /* DMA7 Outer Loop Count Start Value (2D only) */
1663#define DMA7_Y_MODIFY 0xFFC41398 /* DMA7 Outer Loop Address Increment (2D only) */
1664#define DMA7_CURR_DESC_PTR 0xFFC413A4 /* DMA7 Current Descriptor Pointer */
1665#define DMA7_PREV_DESC_PTR 0xFFC413A8 /* DMA7 Previous Initial Descriptor Pointer */
1666#define DMA7_CURR_ADDR 0xFFC413AC /* DMA7 Current Address */
1667#define DMA7_IRQ_STATUS 0xFFC413B0 /* DMA7 Status Register */
1668#define DMA7_CURR_X_COUNT 0xFFC413B4 /* DMA7 Current Count(1D) or intra-row XCNT (2D) */
1669#define DMA7_CURR_Y_COUNT 0xFFC413B8 /* DMA7 Current Row Count (2D only) */
1670#define DMA7_BWL_COUNT 0xFFC413C0 /* DMA7 Bandwidth Limit Count */
1671#define DMA7_CURR_BWL_COUNT 0xFFC413C4 /* DMA7 Bandwidth Limit Count Current */
1672#define DMA7_BWM_COUNT 0xFFC413C8 /* DMA7 Bandwidth Monitor Count */
1673#define DMA7_CURR_BWM_COUNT 0xFFC413CC /* DMA7 Bandwidth Monitor Count Current */
1674
1675/* =========================
1676 DMA8
1677 ========================= */
1678#define DMA8_NEXT_DESC_PTR 0xFFC41400 /* DMA8 Pointer to Next Initial Descriptor */
1679#define DMA8_START_ADDR 0xFFC41404 /* DMA8 Start Address of Current Buffer */
1680#define DMA8_CONFIG 0xFFC41408 /* DMA8 Configuration Register */
1681#define DMA8_X_COUNT 0xFFC4140C /* DMA8 Inner Loop Count Start Value */
1682#define DMA8_X_MODIFY 0xFFC41410 /* DMA8 Inner Loop Address Increment */
1683#define DMA8_Y_COUNT 0xFFC41414 /* DMA8 Outer Loop Count Start Value (2D only) */
1684#define DMA8_Y_MODIFY 0xFFC41418 /* DMA8 Outer Loop Address Increment (2D only) */
1685#define DMA8_CURR_DESC_PTR 0xFFC41424 /* DMA8 Current Descriptor Pointer */
1686#define DMA8_PREV_DESC_PTR 0xFFC41428 /* DMA8 Previous Initial Descriptor Pointer */
1687#define DMA8_CURR_ADDR 0xFFC4142C /* DMA8 Current Address */
1688#define DMA8_IRQ_STATUS 0xFFC41430 /* DMA8 Status Register */
1689#define DMA8_CURR_X_COUNT 0xFFC41434 /* DMA8 Current Count(1D) or intra-row XCNT (2D) */
1690#define DMA8_CURR_Y_COUNT 0xFFC41438 /* DMA8 Current Row Count (2D only) */
1691#define DMA8_BWL_COUNT 0xFFC41440 /* DMA8 Bandwidth Limit Count */
1692#define DMA8_CURR_BWL_COUNT 0xFFC41444 /* DMA8 Bandwidth Limit Count Current */
1693#define DMA8_BWM_COUNT 0xFFC41448 /* DMA8 Bandwidth Monitor Count */
1694#define DMA8_CURR_BWM_COUNT 0xFFC4144C /* DMA8 Bandwidth Monitor Count Current */
1695
1696/* =========================
1697 DMA9
1698 ========================= */
1699#define DMA9_NEXT_DESC_PTR 0xFFC41480 /* DMA9 Pointer to Next Initial Descriptor */
1700#define DMA9_START_ADDR 0xFFC41484 /* DMA9 Start Address of Current Buffer */
1701#define DMA9_CONFIG 0xFFC41488 /* DMA9 Configuration Register */
1702#define DMA9_X_COUNT 0xFFC4148C /* DMA9 Inner Loop Count Start Value */
1703#define DMA9_X_MODIFY 0xFFC41490 /* DMA9 Inner Loop Address Increment */
1704#define DMA9_Y_COUNT 0xFFC41494 /* DMA9 Outer Loop Count Start Value (2D only) */
1705#define DMA9_Y_MODIFY 0xFFC41498 /* DMA9 Outer Loop Address Increment (2D only) */
1706#define DMA9_CURR_DESC_PTR 0xFFC414A4 /* DMA9 Current Descriptor Pointer */
1707#define DMA9_PREV_DESC_PTR 0xFFC414A8 /* DMA9 Previous Initial Descriptor Pointer */
1708#define DMA9_CURR_ADDR 0xFFC414AC /* DMA9 Current Address */
1709#define DMA9_IRQ_STATUS 0xFFC414B0 /* DMA9 Status Register */
1710#define DMA9_CURR_X_COUNT 0xFFC414B4 /* DMA9 Current Count(1D) or intra-row XCNT (2D) */
1711#define DMA9_CURR_Y_COUNT 0xFFC414B8 /* DMA9 Current Row Count (2D only) */
1712#define DMA9_BWL_COUNT 0xFFC414C0 /* DMA9 Bandwidth Limit Count */
1713#define DMA9_CURR_BWL_COUNT 0xFFC414C4 /* DMA9 Bandwidth Limit Count Current */
1714#define DMA9_BWM_COUNT 0xFFC414C8 /* DMA9 Bandwidth Monitor Count */
1715#define DMA9_CURR_BWM_COUNT 0xFFC414CC /* DMA9 Bandwidth Monitor Count Current */
1716
1717/* =========================
1718 DMA10
1719 ========================= */
1720#define DMA10_NEXT_DESC_PTR 0xFFC05000 /* DMA10 Pointer to Next Initial Descriptor */
1721#define DMA10_START_ADDR 0xFFC05004 /* DMA10 Start Address of Current Buffer */
1722#define DMA10_CONFIG 0xFFC05008 /* DMA10 Configuration Register */
1723#define DMA10_X_COUNT 0xFFC0500C /* DMA10 Inner Loop Count Start Value */
1724#define DMA10_X_MODIFY 0xFFC05010 /* DMA10 Inner Loop Address Increment */
1725#define DMA10_Y_COUNT 0xFFC05014 /* DMA10 Outer Loop Count Start Value (2D only) */
1726#define DMA10_Y_MODIFY 0xFFC05018 /* DMA10 Outer Loop Address Increment (2D only) */
1727#define DMA10_CURR_DESC_PTR 0xFFC05024 /* DMA10 Current Descriptor Pointer */
1728#define DMA10_PREV_DESC_PTR 0xFFC05028 /* DMA10 Previous Initial Descriptor Pointer */
1729#define DMA10_CURR_ADDR 0xFFC0502C /* DMA10 Current Address */
1730#define DMA10_IRQ_STATUS 0xFFC05030 /* DMA10 Status Register */
1731#define DMA10_CURR_X_COUNT 0xFFC05034 /* DMA10 Current Count(1D) or intra-row XCNT (2D) */
1732#define DMA10_CURR_Y_COUNT 0xFFC05038 /* DMA10 Current Row Count (2D only) */
1733#define DMA10_BWL_COUNT 0xFFC05040 /* DMA10 Bandwidth Limit Count */
1734#define DMA10_CURR_BWL_COUNT 0xFFC05044 /* DMA10 Bandwidth Limit Count Current */
1735#define DMA10_BWM_COUNT 0xFFC05048 /* DMA10 Bandwidth Monitor Count */
1736#define DMA10_CURR_BWM_COUNT 0xFFC0504C /* DMA10 Bandwidth Monitor Count Current */
1737
1738/* =========================
1739 DMA11
1740 ========================= */
1741#define DMA11_NEXT_DESC_PTR 0xFFC05080 /* DMA11 Pointer to Next Initial Descriptor */
1742#define DMA11_START_ADDR 0xFFC05084 /* DMA11 Start Address of Current Buffer */
1743#define DMA11_CONFIG 0xFFC05088 /* DMA11 Configuration Register */
1744#define DMA11_X_COUNT 0xFFC0508C /* DMA11 Inner Loop Count Start Value */
1745#define DMA11_X_MODIFY 0xFFC05090 /* DMA11 Inner Loop Address Increment */
1746#define DMA11_Y_COUNT 0xFFC05094 /* DMA11 Outer Loop Count Start Value (2D only) */
1747#define DMA11_Y_MODIFY 0xFFC05098 /* DMA11 Outer Loop Address Increment (2D only) */
1748#define DMA11_CURR_DESC_PTR 0xFFC050A4 /* DMA11 Current Descriptor Pointer */
1749#define DMA11_PREV_DESC_PTR 0xFFC050A8 /* DMA11 Previous Initial Descriptor Pointer */
1750#define DMA11_CURR_ADDR 0xFFC050AC /* DMA11 Current Address */
1751#define DMA11_IRQ_STATUS 0xFFC050B0 /* DMA11 Status Register */
1752#define DMA11_CURR_X_COUNT 0xFFC050B4 /* DMA11 Current Count(1D) or intra-row XCNT (2D) */
1753#define DMA11_CURR_Y_COUNT 0xFFC050B8 /* DMA11 Current Row Count (2D only) */
1754#define DMA11_BWL_COUNT 0xFFC050C0 /* DMA11 Bandwidth Limit Count */
1755#define DMA11_CURR_BWL_COUNT 0xFFC050C4 /* DMA11 Bandwidth Limit Count Current */
1756#define DMA11_BWM_COUNT 0xFFC050C8 /* DMA11 Bandwidth Monitor Count */
1757#define DMA11_CURR_BWM_COUNT 0xFFC050CC /* DMA11 Bandwidth Monitor Count Current */
1758
1759/* =========================
1760 DMA12
1761 ========================= */
1762#define DMA12_NEXT_DESC_PTR 0xFFC05100 /* DMA12 Pointer to Next Initial Descriptor */
1763#define DMA12_START_ADDR 0xFFC05104 /* DMA12 Start Address of Current Buffer */
1764#define DMA12_CONFIG 0xFFC05108 /* DMA12 Configuration Register */
1765#define DMA12_X_COUNT 0xFFC0510C /* DMA12 Inner Loop Count Start Value */
1766#define DMA12_X_MODIFY 0xFFC05110 /* DMA12 Inner Loop Address Increment */
1767#define DMA12_Y_COUNT 0xFFC05114 /* DMA12 Outer Loop Count Start Value (2D only) */
1768#define DMA12_Y_MODIFY 0xFFC05118 /* DMA12 Outer Loop Address Increment (2D only) */
1769#define DMA12_CURR_DESC_PTR 0xFFC05124 /* DMA12 Current Descriptor Pointer */
1770#define DMA12_PREV_DESC_PTR 0xFFC05128 /* DMA12 Previous Initial Descriptor Pointer */
1771#define DMA12_CURR_ADDR 0xFFC0512C /* DMA12 Current Address */
1772#define DMA12_IRQ_STATUS 0xFFC05130 /* DMA12 Status Register */
1773#define DMA12_CURR_X_COUNT 0xFFC05134 /* DMA12 Current Count(1D) or intra-row XCNT (2D) */
1774#define DMA12_CURR_Y_COUNT 0xFFC05138 /* DMA12 Current Row Count (2D only) */
1775#define DMA12_BWL_COUNT 0xFFC05140 /* DMA12 Bandwidth Limit Count */
1776#define DMA12_CURR_BWL_COUNT 0xFFC05144 /* DMA12 Bandwidth Limit Count Current */
1777#define DMA12_BWM_COUNT 0xFFC05148 /* DMA12 Bandwidth Monitor Count */
1778#define DMA12_CURR_BWM_COUNT 0xFFC0514C /* DMA12 Bandwidth Monitor Count Current */
1779
1780/* =========================
1781 DMA13
1782 ========================= */
1783#define DMA13_NEXT_DESC_PTR 0xFFC07000 /* DMA13 Pointer to Next Initial Descriptor */
1784#define DMA13_START_ADDR 0xFFC07004 /* DMA13 Start Address of Current Buffer */
1785#define DMA13_CONFIG 0xFFC07008 /* DMA13 Configuration Register */
1786#define DMA13_X_COUNT 0xFFC0700C /* DMA13 Inner Loop Count Start Value */
1787#define DMA13_X_MODIFY 0xFFC07010 /* DMA13 Inner Loop Address Increment */
1788#define DMA13_Y_COUNT 0xFFC07014 /* DMA13 Outer Loop Count Start Value (2D only) */
1789#define DMA13_Y_MODIFY 0xFFC07018 /* DMA13 Outer Loop Address Increment (2D only) */
1790#define DMA13_CURR_DESC_PTR 0xFFC07024 /* DMA13 Current Descriptor Pointer */
1791#define DMA13_PREV_DESC_PTR 0xFFC07028 /* DMA13 Previous Initial Descriptor Pointer */
1792#define DMA13_CURR_ADDR 0xFFC0702C /* DMA13 Current Address */
1793#define DMA13_IRQ_STATUS 0xFFC07030 /* DMA13 Status Register */
1794#define DMA13_CURR_X_COUNT 0xFFC07034 /* DMA13 Current Count(1D) or intra-row XCNT (2D) */
1795#define DMA13_CURR_Y_COUNT 0xFFC07038 /* DMA13 Current Row Count (2D only) */
1796#define DMA13_BWL_COUNT 0xFFC07040 /* DMA13 Bandwidth Limit Count */
1797#define DMA13_CURR_BWL_COUNT 0xFFC07044 /* DMA13 Bandwidth Limit Count Current */
1798#define DMA13_BWM_COUNT 0xFFC07048 /* DMA13 Bandwidth Monitor Count */
1799#define DMA13_CURR_BWM_COUNT 0xFFC0704C /* DMA13 Bandwidth Monitor Count Current */
1800
1801/* =========================
1802 DMA14
1803 ========================= */
1804#define DMA14_NEXT_DESC_PTR 0xFFC07080 /* DMA14 Pointer to Next Initial Descriptor */
1805#define DMA14_START_ADDR 0xFFC07084 /* DMA14 Start Address of Current Buffer */
1806#define DMA14_CONFIG 0xFFC07088 /* DMA14 Configuration Register */
1807#define DMA14_X_COUNT 0xFFC0708C /* DMA14 Inner Loop Count Start Value */
1808#define DMA14_X_MODIFY 0xFFC07090 /* DMA14 Inner Loop Address Increment */
1809#define DMA14_Y_COUNT 0xFFC07094 /* DMA14 Outer Loop Count Start Value (2D only) */
1810#define DMA14_Y_MODIFY 0xFFC07098 /* DMA14 Outer Loop Address Increment (2D only) */
1811#define DMA14_CURR_DESC_PTR 0xFFC070A4 /* DMA14 Current Descriptor Pointer */
1812#define DMA14_PREV_DESC_PTR 0xFFC070A8 /* DMA14 Previous Initial Descriptor Pointer */
1813#define DMA14_CURR_ADDR 0xFFC070AC /* DMA14 Current Address */
1814#define DMA14_IRQ_STATUS 0xFFC070B0 /* DMA14 Status Register */
1815#define DMA14_CURR_X_COUNT 0xFFC070B4 /* DMA14 Current Count(1D) or intra-row XCNT (2D) */
1816#define DMA14_CURR_Y_COUNT 0xFFC070B8 /* DMA14 Current Row Count (2D only) */
1817#define DMA14_BWL_COUNT 0xFFC070C0 /* DMA14 Bandwidth Limit Count */
1818#define DMA14_CURR_BWL_COUNT 0xFFC070C4 /* DMA14 Bandwidth Limit Count Current */
1819#define DMA14_BWM_COUNT 0xFFC070C8 /* DMA14 Bandwidth Monitor Count */
1820#define DMA14_CURR_BWM_COUNT 0xFFC070CC /* DMA14 Bandwidth Monitor Count Current */
1821
1822/* =========================
1823 DMA15
1824 ========================= */
1825#define DMA15_NEXT_DESC_PTR 0xFFC07100 /* DMA15 Pointer to Next Initial Descriptor */
1826#define DMA15_START_ADDR 0xFFC07104 /* DMA15 Start Address of Current Buffer */
1827#define DMA15_CONFIG 0xFFC07108 /* DMA15 Configuration Register */
1828#define DMA15_X_COUNT 0xFFC0710C /* DMA15 Inner Loop Count Start Value */
1829#define DMA15_X_MODIFY 0xFFC07110 /* DMA15 Inner Loop Address Increment */
1830#define DMA15_Y_COUNT 0xFFC07114 /* DMA15 Outer Loop Count Start Value (2D only) */
1831#define DMA15_Y_MODIFY 0xFFC07118 /* DMA15 Outer Loop Address Increment (2D only) */
1832#define DMA15_CURR_DESC_PTR 0xFFC07124 /* DMA15 Current Descriptor Pointer */
1833#define DMA15_PREV_DESC_PTR 0xFFC07128 /* DMA15 Previous Initial Descriptor Pointer */
1834#define DMA15_CURR_ADDR 0xFFC0712C /* DMA15 Current Address */
1835#define DMA15_IRQ_STATUS 0xFFC07130 /* DMA15 Status Register */
1836#define DMA15_CURR_X_COUNT 0xFFC07134 /* DMA15 Current Count(1D) or intra-row XCNT (2D) */
1837#define DMA15_CURR_Y_COUNT 0xFFC07138 /* DMA15 Current Row Count (2D only) */
1838#define DMA15_BWL_COUNT 0xFFC07140 /* DMA15 Bandwidth Limit Count */
1839#define DMA15_CURR_BWL_COUNT 0xFFC07144 /* DMA15 Bandwidth Limit Count Current */
1840#define DMA15_BWM_COUNT 0xFFC07148 /* DMA15 Bandwidth Monitor Count */
1841#define DMA15_CURR_BWM_COUNT 0xFFC0714C /* DMA15 Bandwidth Monitor Count Current */
1842
1843/* =========================
1844 DMA16
1845 ========================= */
1846#define DMA16_NEXT_DESC_PTR 0xFFC07180 /* DMA16 Pointer to Next Initial Descriptor */
1847#define DMA16_START_ADDR 0xFFC07184 /* DMA16 Start Address of Current Buffer */
1848#define DMA16_CONFIG 0xFFC07188 /* DMA16 Configuration Register */
1849#define DMA16_X_COUNT 0xFFC0718C /* DMA16 Inner Loop Count Start Value */
1850#define DMA16_X_MODIFY 0xFFC07190 /* DMA16 Inner Loop Address Increment */
1851#define DMA16_Y_COUNT 0xFFC07194 /* DMA16 Outer Loop Count Start Value (2D only) */
1852#define DMA16_Y_MODIFY 0xFFC07198 /* DMA16 Outer Loop Address Increment (2D only) */
1853#define DMA16_CURR_DESC_PTR 0xFFC071A4 /* DMA16 Current Descriptor Pointer */
1854#define DMA16_PREV_DESC_PTR 0xFFC071A8 /* DMA16 Previous Initial Descriptor Pointer */
1855#define DMA16_CURR_ADDR 0xFFC071AC /* DMA16 Current Address */
1856#define DMA16_IRQ_STATUS 0xFFC071B0 /* DMA16 Status Register */
1857#define DMA16_CURR_X_COUNT 0xFFC071B4 /* DMA16 Current Count(1D) or intra-row XCNT (2D) */
1858#define DMA16_CURR_Y_COUNT 0xFFC071B8 /* DMA16 Current Row Count (2D only) */
1859#define DMA16_BWL_COUNT 0xFFC071C0 /* DMA16 Bandwidth Limit Count */
1860#define DMA16_CURR_BWL_COUNT 0xFFC071C4 /* DMA16 Bandwidth Limit Count Current */
1861#define DMA16_BWM_COUNT 0xFFC071C8 /* DMA16 Bandwidth Monitor Count */
1862#define DMA16_CURR_BWM_COUNT 0xFFC071CC /* DMA16 Bandwidth Monitor Count Current */
1863
1864/* =========================
1865 DMA17
1866 ========================= */
1867#define DMA17_NEXT_DESC_PTR 0xFFC07200 /* DMA17 Pointer to Next Initial Descriptor */
1868#define DMA17_START_ADDR 0xFFC07204 /* DMA17 Start Address of Current Buffer */
1869#define DMA17_CONFIG 0xFFC07208 /* DMA17 Configuration Register */
1870#define DMA17_X_COUNT 0xFFC0720C /* DMA17 Inner Loop Count Start Value */
1871#define DMA17_X_MODIFY 0xFFC07210 /* DMA17 Inner Loop Address Increment */
1872#define DMA17_Y_COUNT 0xFFC07214 /* DMA17 Outer Loop Count Start Value (2D only) */
1873#define DMA17_Y_MODIFY 0xFFC07218 /* DMA17 Outer Loop Address Increment (2D only) */
1874#define DMA17_CURR_DESC_PTR 0xFFC07224 /* DMA17 Current Descriptor Pointer */
1875#define DMA17_PREV_DESC_PTR 0xFFC07228 /* DMA17 Previous Initial Descriptor Pointer */
1876#define DMA17_CURR_ADDR 0xFFC0722C /* DMA17 Current Address */
1877#define DMA17_IRQ_STATUS 0xFFC07230 /* DMA17 Status Register */
1878#define DMA17_CURR_X_COUNT 0xFFC07234 /* DMA17 Current Count(1D) or intra-row XCNT (2D) */
1879#define DMA17_CURR_Y_COUNT 0xFFC07238 /* DMA17 Current Row Count (2D only) */
1880#define DMA17_BWL_COUNT 0xFFC07240 /* DMA17 Bandwidth Limit Count */
1881#define DMA17_CURR_BWL_COUNT 0xFFC07244 /* DMA17 Bandwidth Limit Count Current */
1882#define DMA17_BWM_COUNT 0xFFC07248 /* DMA17 Bandwidth Monitor Count */
1883#define DMA17_CURR_BWM_COUNT 0xFFC0724C /* DMA17 Bandwidth Monitor Count Current */
1884
1885/* =========================
1886 DMA18
1887 ========================= */
1888#define DMA18_NEXT_DESC_PTR 0xFFC07280 /* DMA18 Pointer to Next Initial Descriptor */
1889#define DMA18_START_ADDR 0xFFC07284 /* DMA18 Start Address of Current Buffer */
1890#define DMA18_CONFIG 0xFFC07288 /* DMA18 Configuration Register */
1891#define DMA18_X_COUNT 0xFFC0728C /* DMA18 Inner Loop Count Start Value */
1892#define DMA18_X_MODIFY 0xFFC07290 /* DMA18 Inner Loop Address Increment */
1893#define DMA18_Y_COUNT 0xFFC07294 /* DMA18 Outer Loop Count Start Value (2D only) */
1894#define DMA18_Y_MODIFY 0xFFC07298 /* DMA18 Outer Loop Address Increment (2D only) */
1895#define DMA18_CURR_DESC_PTR 0xFFC072A4 /* DMA18 Current Descriptor Pointer */
1896#define DMA18_PREV_DESC_PTR 0xFFC072A8 /* DMA18 Previous Initial Descriptor Pointer */
1897#define DMA18_CURR_ADDR 0xFFC072AC /* DMA18 Current Address */
1898#define DMA18_IRQ_STATUS 0xFFC072B0 /* DMA18 Status Register */
1899#define DMA18_CURR_X_COUNT 0xFFC072B4 /* DMA18 Current Count(1D) or intra-row XCNT (2D) */
1900#define DMA18_CURR_Y_COUNT 0xFFC072B8 /* DMA18 Current Row Count (2D only) */
1901#define DMA18_BWL_COUNT 0xFFC072C0 /* DMA18 Bandwidth Limit Count */
1902#define DMA18_CURR_BWL_COUNT 0xFFC072C4 /* DMA18 Bandwidth Limit Count Current */
1903#define DMA18_BWM_COUNT 0xFFC072C8 /* DMA18 Bandwidth Monitor Count */
1904#define DMA18_CURR_BWM_COUNT 0xFFC072CC /* DMA18 Bandwidth Monitor Count Current */
1905
1906/* =========================
1907 DMA19
1908 ========================= */
1909#define DMA19_NEXT_DESC_PTR 0xFFC07300 /* DMA19 Pointer to Next Initial Descriptor */
1910#define DMA19_START_ADDR 0xFFC07304 /* DMA19 Start Address of Current Buffer */
1911#define DMA19_CONFIG 0xFFC07308 /* DMA19 Configuration Register */
1912#define DMA19_X_COUNT 0xFFC0730C /* DMA19 Inner Loop Count Start Value */
1913#define DMA19_X_MODIFY 0xFFC07310 /* DMA19 Inner Loop Address Increment */
1914#define DMA19_Y_COUNT 0xFFC07314 /* DMA19 Outer Loop Count Start Value (2D only) */
1915#define DMA19_Y_MODIFY 0xFFC07318 /* DMA19 Outer Loop Address Increment (2D only) */
1916#define DMA19_CURR_DESC_PTR 0xFFC07324 /* DMA19 Current Descriptor Pointer */
1917#define DMA19_PREV_DESC_PTR 0xFFC07328 /* DMA19 Previous Initial Descriptor Pointer */
1918#define DMA19_CURR_ADDR 0xFFC0732C /* DMA19 Current Address */
1919#define DMA19_IRQ_STATUS 0xFFC07330 /* DMA19 Status Register */
1920#define DMA19_CURR_X_COUNT 0xFFC07334 /* DMA19 Current Count(1D) or intra-row XCNT (2D) */
1921#define DMA19_CURR_Y_COUNT 0xFFC07338 /* DMA19 Current Row Count (2D only) */
1922#define DMA19_BWL_COUNT 0xFFC07340 /* DMA19 Bandwidth Limit Count */
1923#define DMA19_CURR_BWL_COUNT 0xFFC07344 /* DMA19 Bandwidth Limit Count Current */
1924#define DMA19_BWM_COUNT 0xFFC07348 /* DMA19 Bandwidth Monitor Count */
1925#define DMA19_CURR_BWM_COUNT 0xFFC0734C /* DMA19 Bandwidth Monitor Count Current */
1926
1927/* =========================
1928 DMA20
1929 ========================= */
1930#define DMA20_NEXT_DESC_PTR 0xFFC07380 /* DMA20 Pointer to Next Initial Descriptor */
1931#define DMA20_START_ADDR 0xFFC07384 /* DMA20 Start Address of Current Buffer */
1932#define DMA20_CONFIG 0xFFC07388 /* DMA20 Configuration Register */
1933#define DMA20_X_COUNT 0xFFC0738C /* DMA20 Inner Loop Count Start Value */
1934#define DMA20_X_MODIFY 0xFFC07390 /* DMA20 Inner Loop Address Increment */
1935#define DMA20_Y_COUNT 0xFFC07394 /* DMA20 Outer Loop Count Start Value (2D only) */
1936#define DMA20_Y_MODIFY 0xFFC07398 /* DMA20 Outer Loop Address Increment (2D only) */
1937#define DMA20_CURR_DESC_PTR 0xFFC073A4 /* DMA20 Current Descriptor Pointer */
1938#define DMA20_PREV_DESC_PTR 0xFFC073A8 /* DMA20 Previous Initial Descriptor Pointer */
1939#define DMA20_CURR_ADDR 0xFFC073AC /* DMA20 Current Address */
1940#define DMA20_IRQ_STATUS 0xFFC073B0 /* DMA20 Status Register */
1941#define DMA20_CURR_X_COUNT 0xFFC073B4 /* DMA20 Current Count(1D) or intra-row XCNT (2D) */
1942#define DMA20_CURR_Y_COUNT 0xFFC073B8 /* DMA20 Current Row Count (2D only) */
1943#define DMA20_BWL_COUNT 0xFFC073C0 /* DMA20 Bandwidth Limit Count */
1944#define DMA20_CURR_BWL_COUNT 0xFFC073C4 /* DMA20 Bandwidth Limit Count Current */
1945#define DMA20_BWM_COUNT 0xFFC073C8 /* DMA20 Bandwidth Monitor Count */
1946#define DMA20_CURR_BWM_COUNT 0xFFC073CC /* DMA20 Bandwidth Monitor Count Current */
1947
1948/* =========================
1949 DMA21
1950 ========================= */
1951#define DMA21_NEXT_DESC_PTR 0xFFC09000 /* DMA21 Pointer to Next Initial Descriptor */
1952#define DMA21_START_ADDR 0xFFC09004 /* DMA21 Start Address of Current Buffer */
1953#define DMA21_CONFIG 0xFFC09008 /* DMA21 Configuration Register */
1954#define DMA21_X_COUNT 0xFFC0900C /* DMA21 Inner Loop Count Start Value */
1955#define DMA21_X_MODIFY 0xFFC09010 /* DMA21 Inner Loop Address Increment */
1956#define DMA21_Y_COUNT 0xFFC09014 /* DMA21 Outer Loop Count Start Value (2D only) */
1957#define DMA21_Y_MODIFY 0xFFC09018 /* DMA21 Outer Loop Address Increment (2D only) */
1958#define DMA21_CURR_DESC_PTR 0xFFC09024 /* DMA21 Current Descriptor Pointer */
1959#define DMA21_PREV_DESC_PTR 0xFFC09028 /* DMA21 Previous Initial Descriptor Pointer */
1960#define DMA21_CURR_ADDR 0xFFC0902C /* DMA21 Current Address */
1961#define DMA21_IRQ_STATUS 0xFFC09030 /* DMA21 Status Register */
1962#define DMA21_CURR_X_COUNT 0xFFC09034 /* DMA21 Current Count(1D) or intra-row XCNT (2D) */
1963#define DMA21_CURR_Y_COUNT 0xFFC09038 /* DMA21 Current Row Count (2D only) */
1964#define DMA21_BWL_COUNT 0xFFC09040 /* DMA21 Bandwidth Limit Count */
1965#define DMA21_CURR_BWL_COUNT 0xFFC09044 /* DMA21 Bandwidth Limit Count Current */
1966#define DMA21_BWM_COUNT 0xFFC09048 /* DMA21 Bandwidth Monitor Count */
1967#define DMA21_CURR_BWM_COUNT 0xFFC0904C /* DMA21 Bandwidth Monitor Count Current */
1968
1969/* =========================
1970 DMA22
1971 ========================= */
1972#define DMA22_NEXT_DESC_PTR 0xFFC09080 /* DMA22 Pointer to Next Initial Descriptor */
1973#define DMA22_START_ADDR 0xFFC09084 /* DMA22 Start Address of Current Buffer */
1974#define DMA22_CONFIG 0xFFC09088 /* DMA22 Configuration Register */
1975#define DMA22_X_COUNT 0xFFC0908C /* DMA22 Inner Loop Count Start Value */
1976#define DMA22_X_MODIFY 0xFFC09090 /* DMA22 Inner Loop Address Increment */
1977#define DMA22_Y_COUNT 0xFFC09094 /* DMA22 Outer Loop Count Start Value (2D only) */
1978#define DMA22_Y_MODIFY 0xFFC09098 /* DMA22 Outer Loop Address Increment (2D only) */
1979#define DMA22_CURR_DESC_PTR 0xFFC090A4 /* DMA22 Current Descriptor Pointer */
1980#define DMA22_PREV_DESC_PTR 0xFFC090A8 /* DMA22 Previous Initial Descriptor Pointer */
1981#define DMA22_CURR_ADDR 0xFFC090AC /* DMA22 Current Address */
1982#define DMA22_IRQ_STATUS 0xFFC090B0 /* DMA22 Status Register */
1983#define DMA22_CURR_X_COUNT 0xFFC090B4 /* DMA22 Current Count(1D) or intra-row XCNT (2D) */
1984#define DMA22_CURR_Y_COUNT 0xFFC090B8 /* DMA22 Current Row Count (2D only) */
1985#define DMA22_BWL_COUNT 0xFFC090C0 /* DMA22 Bandwidth Limit Count */
1986#define DMA22_CURR_BWL_COUNT 0xFFC090C4 /* DMA22 Bandwidth Limit Count Current */
1987#define DMA22_BWM_COUNT 0xFFC090C8 /* DMA22 Bandwidth Monitor Count */
1988#define DMA22_CURR_BWM_COUNT 0xFFC090CC /* DMA22 Bandwidth Monitor Count Current */
1989
1990/* =========================
1991 DMA23
1992 ========================= */
1993#define DMA23_NEXT_DESC_PTR 0xFFC09100 /* DMA23 Pointer to Next Initial Descriptor */
1994#define DMA23_START_ADDR 0xFFC09104 /* DMA23 Start Address of Current Buffer */
1995#define DMA23_CONFIG 0xFFC09108 /* DMA23 Configuration Register */
1996#define DMA23_X_COUNT 0xFFC0910C /* DMA23 Inner Loop Count Start Value */
1997#define DMA23_X_MODIFY 0xFFC09110 /* DMA23 Inner Loop Address Increment */
1998#define DMA23_Y_COUNT 0xFFC09114 /* DMA23 Outer Loop Count Start Value (2D only) */
1999#define DMA23_Y_MODIFY 0xFFC09118 /* DMA23 Outer Loop Address Increment (2D only) */
2000#define DMA23_CURR_DESC_PTR 0xFFC09124 /* DMA23 Current Descriptor Pointer */
2001#define DMA23_PREV_DESC_PTR 0xFFC09128 /* DMA23 Previous Initial Descriptor Pointer */
2002#define DMA23_CURR_ADDR 0xFFC0912C /* DMA23 Current Address */
2003#define DMA23_IRQ_STATUS 0xFFC09130 /* DMA23 Status Register */
2004#define DMA23_CURR_X_COUNT 0xFFC09134 /* DMA23 Current Count(1D) or intra-row XCNT (2D) */
2005#define DMA23_CURR_Y_COUNT 0xFFC09138 /* DMA23 Current Row Count (2D only) */
2006#define DMA23_BWL_COUNT 0xFFC09140 /* DMA23 Bandwidth Limit Count */
2007#define DMA23_CURR_BWL_COUNT 0xFFC09144 /* DMA23 Bandwidth Limit Count Current */
2008#define DMA23_BWM_COUNT 0xFFC09148 /* DMA23 Bandwidth Monitor Count */
2009#define DMA23_CURR_BWM_COUNT 0xFFC0914C /* DMA23 Bandwidth Monitor Count Current */
2010
2011/* =========================
2012 DMA24
2013 ========================= */
2014#define DMA24_NEXT_DESC_PTR 0xFFC09180 /* DMA24 Pointer to Next Initial Descriptor */
2015#define DMA24_START_ADDR 0xFFC09184 /* DMA24 Start Address of Current Buffer */
2016#define DMA24_CONFIG 0xFFC09188 /* DMA24 Configuration Register */
2017#define DMA24_X_COUNT 0xFFC0918C /* DMA24 Inner Loop Count Start Value */
2018#define DMA24_X_MODIFY 0xFFC09190 /* DMA24 Inner Loop Address Increment */
2019#define DMA24_Y_COUNT 0xFFC09194 /* DMA24 Outer Loop Count Start Value (2D only) */
2020#define DMA24_Y_MODIFY 0xFFC09198 /* DMA24 Outer Loop Address Increment (2D only) */
2021#define DMA24_CURR_DESC_PTR 0xFFC091A4 /* DMA24 Current Descriptor Pointer */
2022#define DMA24_PREV_DESC_PTR 0xFFC091A8 /* DMA24 Previous Initial Descriptor Pointer */
2023#define DMA24_CURR_ADDR 0xFFC091AC /* DMA24 Current Address */
2024#define DMA24_IRQ_STATUS 0xFFC091B0 /* DMA24 Status Register */
2025#define DMA24_CURR_X_COUNT 0xFFC091B4 /* DMA24 Current Count(1D) or intra-row XCNT (2D) */
2026#define DMA24_CURR_Y_COUNT 0xFFC091B8 /* DMA24 Current Row Count (2D only) */
2027#define DMA24_BWL_COUNT 0xFFC091C0 /* DMA24 Bandwidth Limit Count */
2028#define DMA24_CURR_BWL_COUNT 0xFFC091C4 /* DMA24 Bandwidth Limit Count Current */
2029#define DMA24_BWM_COUNT 0xFFC091C8 /* DMA24 Bandwidth Monitor Count */
2030#define DMA24_CURR_BWM_COUNT 0xFFC091CC /* DMA24 Bandwidth Monitor Count Current */
2031
2032/* =========================
2033 DMA25
2034 ========================= */
2035#define DMA25_NEXT_DESC_PTR 0xFFC09200 /* DMA25 Pointer to Next Initial Descriptor */
2036#define DMA25_START_ADDR 0xFFC09204 /* DMA25 Start Address of Current Buffer */
2037#define DMA25_CONFIG 0xFFC09208 /* DMA25 Configuration Register */
2038#define DMA25_X_COUNT 0xFFC0920C /* DMA25 Inner Loop Count Start Value */
2039#define DMA25_X_MODIFY 0xFFC09210 /* DMA25 Inner Loop Address Increment */
2040#define DMA25_Y_COUNT 0xFFC09214 /* DMA25 Outer Loop Count Start Value (2D only) */
2041#define DMA25_Y_MODIFY 0xFFC09218 /* DMA25 Outer Loop Address Increment (2D only) */
2042#define DMA25_CURR_DESC_PTR 0xFFC09224 /* DMA25 Current Descriptor Pointer */
2043#define DMA25_PREV_DESC_PTR 0xFFC09228 /* DMA25 Previous Initial Descriptor Pointer */
2044#define DMA25_CURR_ADDR 0xFFC0922C /* DMA25 Current Address */
2045#define DMA25_IRQ_STATUS 0xFFC09230 /* DMA25 Status Register */
2046#define DMA25_CURR_X_COUNT 0xFFC09234 /* DMA25 Current Count(1D) or intra-row XCNT (2D) */
2047#define DMA25_CURR_Y_COUNT 0xFFC09238 /* DMA25 Current Row Count (2D only) */
2048#define DMA25_BWL_COUNT 0xFFC09240 /* DMA25 Bandwidth Limit Count */
2049#define DMA25_CURR_BWL_COUNT 0xFFC09244 /* DMA25 Bandwidth Limit Count Current */
2050#define DMA25_BWM_COUNT 0xFFC09248 /* DMA25 Bandwidth Monitor Count */
2051#define DMA25_CURR_BWM_COUNT 0xFFC0924C /* DMA25 Bandwidth Monitor Count Current */
2052
2053/* =========================
2054 DMA26
2055 ========================= */
2056#define DMA26_NEXT_DESC_PTR 0xFFC09280 /* DMA26 Pointer to Next Initial Descriptor */
2057#define DMA26_START_ADDR 0xFFC09284 /* DMA26 Start Address of Current Buffer */
2058#define DMA26_CONFIG 0xFFC09288 /* DMA26 Configuration Register */
2059#define DMA26_X_COUNT 0xFFC0928C /* DMA26 Inner Loop Count Start Value */
2060#define DMA26_X_MODIFY 0xFFC09290 /* DMA26 Inner Loop Address Increment */
2061#define DMA26_Y_COUNT 0xFFC09294 /* DMA26 Outer Loop Count Start Value (2D only) */
2062#define DMA26_Y_MODIFY 0xFFC09298 /* DMA26 Outer Loop Address Increment (2D only) */
2063#define DMA26_CURR_DESC_PTR 0xFFC092A4 /* DMA26 Current Descriptor Pointer */
2064#define DMA26_PREV_DESC_PTR 0xFFC092A8 /* DMA26 Previous Initial Descriptor Pointer */
2065#define DMA26_CURR_ADDR 0xFFC092AC /* DMA26 Current Address */
2066#define DMA26_IRQ_STATUS 0xFFC092B0 /* DMA26 Status Register */
2067#define DMA26_CURR_X_COUNT 0xFFC092B4 /* DMA26 Current Count(1D) or intra-row XCNT (2D) */
2068#define DMA26_CURR_Y_COUNT 0xFFC092B8 /* DMA26 Current Row Count (2D only) */
2069#define DMA26_BWL_COUNT 0xFFC092C0 /* DMA26 Bandwidth Limit Count */
2070#define DMA26_CURR_BWL_COUNT 0xFFC092C4 /* DMA26 Bandwidth Limit Count Current */
2071#define DMA26_BWM_COUNT 0xFFC092C8 /* DMA26 Bandwidth Monitor Count */
2072#define DMA26_CURR_BWM_COUNT 0xFFC092CC /* DMA26 Bandwidth Monitor Count Current */
2073
2074/* =========================
2075 DMA27
2076 ========================= */
2077#define DMA27_NEXT_DESC_PTR 0xFFC09300 /* DMA27 Pointer to Next Initial Descriptor */
2078#define DMA27_START_ADDR 0xFFC09304 /* DMA27 Start Address of Current Buffer */
2079#define DMA27_CONFIG 0xFFC09308 /* DMA27 Configuration Register */
2080#define DMA27_X_COUNT 0xFFC0930C /* DMA27 Inner Loop Count Start Value */
2081#define DMA27_X_MODIFY 0xFFC09310 /* DMA27 Inner Loop Address Increment */
2082#define DMA27_Y_COUNT 0xFFC09314 /* DMA27 Outer Loop Count Start Value (2D only) */
2083#define DMA27_Y_MODIFY 0xFFC09318 /* DMA27 Outer Loop Address Increment (2D only) */
2084#define DMA27_CURR_DESC_PTR 0xFFC09324 /* DMA27 Current Descriptor Pointer */
2085#define DMA27_PREV_DESC_PTR 0xFFC09328 /* DMA27 Previous Initial Descriptor Pointer */
2086#define DMA27_CURR_ADDR 0xFFC0932C /* DMA27 Current Address */
2087#define DMA27_IRQ_STATUS 0xFFC09330 /* DMA27 Status Register */
2088#define DMA27_CURR_X_COUNT 0xFFC09334 /* DMA27 Current Count(1D) or intra-row XCNT (2D) */
2089#define DMA27_CURR_Y_COUNT 0xFFC09338 /* DMA27 Current Row Count (2D only) */
2090#define DMA27_BWL_COUNT 0xFFC09340 /* DMA27 Bandwidth Limit Count */
2091#define DMA27_CURR_BWL_COUNT 0xFFC09344 /* DMA27 Bandwidth Limit Count Current */
2092#define DMA27_BWM_COUNT 0xFFC09348 /* DMA27 Bandwidth Monitor Count */
2093#define DMA27_CURR_BWM_COUNT 0xFFC0934C /* DMA27 Bandwidth Monitor Count Current */
2094
2095/* =========================
2096 DMA28
2097 ========================= */
2098#define DMA28_NEXT_DESC_PTR 0xFFC09380 /* DMA28 Pointer to Next Initial Descriptor */
2099#define DMA28_START_ADDR 0xFFC09384 /* DMA28 Start Address of Current Buffer */
2100#define DMA28_CONFIG 0xFFC09388 /* DMA28 Configuration Register */
2101#define DMA28_X_COUNT 0xFFC0938C /* DMA28 Inner Loop Count Start Value */
2102#define DMA28_X_MODIFY 0xFFC09390 /* DMA28 Inner Loop Address Increment */
2103#define DMA28_Y_COUNT 0xFFC09394 /* DMA28 Outer Loop Count Start Value (2D only) */
2104#define DMA28_Y_MODIFY 0xFFC09398 /* DMA28 Outer Loop Address Increment (2D only) */
2105#define DMA28_CURR_DESC_PTR 0xFFC093A4 /* DMA28 Current Descriptor Pointer */
2106#define DMA28_PREV_DESC_PTR 0xFFC093A8 /* DMA28 Previous Initial Descriptor Pointer */
2107#define DMA28_CURR_ADDR 0xFFC093AC /* DMA28 Current Address */
2108#define DMA28_IRQ_STATUS 0xFFC093B0 /* DMA28 Status Register */
2109#define DMA28_CURR_X_COUNT 0xFFC093B4 /* DMA28 Current Count(1D) or intra-row XCNT (2D) */
2110#define DMA28_CURR_Y_COUNT 0xFFC093B8 /* DMA28 Current Row Count (2D only) */
2111#define DMA28_BWL_COUNT 0xFFC093C0 /* DMA28 Bandwidth Limit Count */
2112#define DMA28_CURR_BWL_COUNT 0xFFC093C4 /* DMA28 Bandwidth Limit Count Current */
2113#define DMA28_BWM_COUNT 0xFFC093C8 /* DMA28 Bandwidth Monitor Count */
2114#define DMA28_CURR_BWM_COUNT 0xFFC093CC /* DMA28 Bandwidth Monitor Count Current */
2115
2116/* =========================
2117 DMA29
2118 ========================= */
2119#define DMA29_NEXT_DESC_PTR 0xFFC0B000 /* DMA29 Pointer to Next Initial Descriptor */
2120#define DMA29_START_ADDR 0xFFC0B004 /* DMA29 Start Address of Current Buffer */
2121#define DMA29_CONFIG 0xFFC0B008 /* DMA29 Configuration Register */
2122#define DMA29_X_COUNT 0xFFC0B00C /* DMA29 Inner Loop Count Start Value */
2123#define DMA29_X_MODIFY 0xFFC0B010 /* DMA29 Inner Loop Address Increment */
2124#define DMA29_Y_COUNT 0xFFC0B014 /* DMA29 Outer Loop Count Start Value (2D only) */
2125#define DMA29_Y_MODIFY 0xFFC0B018 /* DMA29 Outer Loop Address Increment (2D only) */
2126#define DMA29_CURR_DESC_PTR 0xFFC0B024 /* DMA29 Current Descriptor Pointer */
2127#define DMA29_PREV_DESC_PTR 0xFFC0B028 /* DMA29 Previous Initial Descriptor Pointer */
2128#define DMA29_CURR_ADDR 0xFFC0B02C /* DMA29 Current Address */
2129#define DMA29_IRQ_STATUS 0xFFC0B030 /* DMA29 Status Register */
2130#define DMA29_CURR_X_COUNT 0xFFC0B034 /* DMA29 Current Count(1D) or intra-row XCNT (2D) */
2131#define DMA29_CURR_Y_COUNT 0xFFC0B038 /* DMA29 Current Row Count (2D only) */
2132#define DMA29_BWL_COUNT 0xFFC0B040 /* DMA29 Bandwidth Limit Count */
2133#define DMA29_CURR_BWL_COUNT 0xFFC0B044 /* DMA29 Bandwidth Limit Count Current */
2134#define DMA29_BWM_COUNT 0xFFC0B048 /* DMA29 Bandwidth Monitor Count */
2135#define DMA29_CURR_BWM_COUNT 0xFFC0B04C /* DMA29 Bandwidth Monitor Count Current */
2136
2137/* =========================
2138 DMA30
2139 ========================= */
2140#define DMA30_NEXT_DESC_PTR 0xFFC0B080 /* DMA30 Pointer to Next Initial Descriptor */
2141#define DMA30_START_ADDR 0xFFC0B084 /* DMA30 Start Address of Current Buffer */
2142#define DMA30_CONFIG 0xFFC0B088 /* DMA30 Configuration Register */
2143#define DMA30_X_COUNT 0xFFC0B08C /* DMA30 Inner Loop Count Start Value */
2144#define DMA30_X_MODIFY 0xFFC0B090 /* DMA30 Inner Loop Address Increment */
2145#define DMA30_Y_COUNT 0xFFC0B094 /* DMA30 Outer Loop Count Start Value (2D only) */
2146#define DMA30_Y_MODIFY 0xFFC0B098 /* DMA30 Outer Loop Address Increment (2D only) */
2147#define DMA30_CURR_DESC_PTR 0xFFC0B0A4 /* DMA30 Current Descriptor Pointer */
2148#define DMA30_PREV_DESC_PTR 0xFFC0B0A8 /* DMA30 Previous Initial Descriptor Pointer */
2149#define DMA30_CURR_ADDR 0xFFC0B0AC /* DMA30 Current Address */
2150#define DMA30_IRQ_STATUS 0xFFC0B0B0 /* DMA30 Status Register */
2151#define DMA30_CURR_X_COUNT 0xFFC0B0B4 /* DMA30 Current Count(1D) or intra-row XCNT (2D) */
2152#define DMA30_CURR_Y_COUNT 0xFFC0B0B8 /* DMA30 Current Row Count (2D only) */
2153#define DMA30_BWL_COUNT 0xFFC0B0C0 /* DMA30 Bandwidth Limit Count */
2154#define DMA30_CURR_BWL_COUNT 0xFFC0B0C4 /* DMA30 Bandwidth Limit Count Current */
2155#define DMA30_BWM_COUNT 0xFFC0B0C8 /* DMA30 Bandwidth Monitor Count */
2156#define DMA30_CURR_BWM_COUNT 0xFFC0B0CC /* DMA30 Bandwidth Monitor Count Current */
2157
2158/* =========================
2159 DMA31
2160 ========================= */
2161#define DMA31_NEXT_DESC_PTR 0xFFC0B100 /* DMA31 Pointer to Next Initial Descriptor */
2162#define DMA31_START_ADDR 0xFFC0B104 /* DMA31 Start Address of Current Buffer */
2163#define DMA31_CONFIG 0xFFC0B108 /* DMA31 Configuration Register */
2164#define DMA31_X_COUNT 0xFFC0B10C /* DMA31 Inner Loop Count Start Value */
2165#define DMA31_X_MODIFY 0xFFC0B110 /* DMA31 Inner Loop Address Increment */
2166#define DMA31_Y_COUNT 0xFFC0B114 /* DMA31 Outer Loop Count Start Value (2D only) */
2167#define DMA31_Y_MODIFY 0xFFC0B118 /* DMA31 Outer Loop Address Increment (2D only) */
2168#define DMA31_CURR_DESC_PTR 0xFFC0B124 /* DMA31 Current Descriptor Pointer */
2169#define DMA31_PREV_DESC_PTR 0xFFC0B128 /* DMA31 Previous Initial Descriptor Pointer */
2170#define DMA31_CURR_ADDR 0xFFC0B12C /* DMA31 Current Address */
2171#define DMA31_IRQ_STATUS 0xFFC0B130 /* DMA31 Status Register */
2172#define DMA31_CURR_X_COUNT 0xFFC0B134 /* DMA31 Current Count(1D) or intra-row XCNT (2D) */
2173#define DMA31_CURR_Y_COUNT 0xFFC0B138 /* DMA31 Current Row Count (2D only) */
2174#define DMA31_BWL_COUNT 0xFFC0B140 /* DMA31 Bandwidth Limit Count */
2175#define DMA31_CURR_BWL_COUNT 0xFFC0B144 /* DMA31 Bandwidth Limit Count Current */
2176#define DMA31_BWM_COUNT 0xFFC0B148 /* DMA31 Bandwidth Monitor Count */
2177#define DMA31_CURR_BWM_COUNT 0xFFC0B14C /* DMA31 Bandwidth Monitor Count Current */
2178
2179/* =========================
2180 DMA32
2181 ========================= */
2182#define DMA32_NEXT_DESC_PTR 0xFFC0B180 /* DMA32 Pointer to Next Initial Descriptor */
2183#define DMA32_START_ADDR 0xFFC0B184 /* DMA32 Start Address of Current Buffer */
2184#define DMA32_CONFIG 0xFFC0B188 /* DMA32 Configuration Register */
2185#define DMA32_X_COUNT 0xFFC0B18C /* DMA32 Inner Loop Count Start Value */
2186#define DMA32_X_MODIFY 0xFFC0B190 /* DMA32 Inner Loop Address Increment */
2187#define DMA32_Y_COUNT 0xFFC0B194 /* DMA32 Outer Loop Count Start Value (2D only) */
2188#define DMA32_Y_MODIFY 0xFFC0B198 /* DMA32 Outer Loop Address Increment (2D only) */
2189#define DMA32_CURR_DESC_PTR 0xFFC0B1A4 /* DMA32 Current Descriptor Pointer */
2190#define DMA32_PREV_DESC_PTR 0xFFC0B1A8 /* DMA32 Previous Initial Descriptor Pointer */
2191#define DMA32_CURR_ADDR 0xFFC0B1AC /* DMA32 Current Address */
2192#define DMA32_IRQ_STATUS 0xFFC0B1B0 /* DMA32 Status Register */
2193#define DMA32_CURR_X_COUNT 0xFFC0B1B4 /* DMA32 Current Count(1D) or intra-row XCNT (2D) */
2194#define DMA32_CURR_Y_COUNT 0xFFC0B1B8 /* DMA32 Current Row Count (2D only) */
2195#define DMA32_BWL_COUNT 0xFFC0B1C0 /* DMA32 Bandwidth Limit Count */
2196#define DMA32_CURR_BWL_COUNT 0xFFC0B1C4 /* DMA32 Bandwidth Limit Count Current */
2197#define DMA32_BWM_COUNT 0xFFC0B1C8 /* DMA32 Bandwidth Monitor Count */
2198#define DMA32_CURR_BWM_COUNT 0xFFC0B1CC /* DMA32 Bandwidth Monitor Count Current */
2199
2200/* =========================
2201 DMA33
2202 ========================= */
2203#define DMA33_NEXT_DESC_PTR 0xFFC0D000 /* DMA33 Pointer to Next Initial Descriptor */
2204#define DMA33_START_ADDR 0xFFC0D004 /* DMA33 Start Address of Current Buffer */
2205#define DMA33_CONFIG 0xFFC0D008 /* DMA33 Configuration Register */
2206#define DMA33_X_COUNT 0xFFC0D00C /* DMA33 Inner Loop Count Start Value */
2207#define DMA33_X_MODIFY 0xFFC0D010 /* DMA33 Inner Loop Address Increment */
2208#define DMA33_Y_COUNT 0xFFC0D014 /* DMA33 Outer Loop Count Start Value (2D only) */
2209#define DMA33_Y_MODIFY 0xFFC0D018 /* DMA33 Outer Loop Address Increment (2D only) */
2210#define DMA33_CURR_DESC_PTR 0xFFC0D024 /* DMA33 Current Descriptor Pointer */
2211#define DMA33_PREV_DESC_PTR 0xFFC0D028 /* DMA33 Previous Initial Descriptor Pointer */
2212#define DMA33_CURR_ADDR 0xFFC0D02C /* DMA33 Current Address */
2213#define DMA33_IRQ_STATUS 0xFFC0D030 /* DMA33 Status Register */
2214#define DMA33_CURR_X_COUNT 0xFFC0D034 /* DMA33 Current Count(1D) or intra-row XCNT (2D) */
2215#define DMA33_CURR_Y_COUNT 0xFFC0D038 /* DMA33 Current Row Count (2D only) */
2216#define DMA33_BWL_COUNT 0xFFC0D040 /* DMA33 Bandwidth Limit Count */
2217#define DMA33_CURR_BWL_COUNT 0xFFC0D044 /* DMA33 Bandwidth Limit Count Current */
2218#define DMA33_BWM_COUNT 0xFFC0D048 /* DMA33 Bandwidth Monitor Count */
2219#define DMA33_CURR_BWM_COUNT 0xFFC0D04C /* DMA33 Bandwidth Monitor Count Current */
2220
2221/* =========================
2222 DMA34
2223 ========================= */
2224#define DMA34_NEXT_DESC_PTR 0xFFC0D080 /* DMA34 Pointer to Next Initial Descriptor */
2225#define DMA34_START_ADDR 0xFFC0D084 /* DMA34 Start Address of Current Buffer */
2226#define DMA34_CONFIG 0xFFC0D088 /* DMA34 Configuration Register */
2227#define DMA34_X_COUNT 0xFFC0D08C /* DMA34 Inner Loop Count Start Value */
2228#define DMA34_X_MODIFY 0xFFC0D090 /* DMA34 Inner Loop Address Increment */
2229#define DMA34_Y_COUNT 0xFFC0D094 /* DMA34 Outer Loop Count Start Value (2D only) */
2230#define DMA34_Y_MODIFY 0xFFC0D098 /* DMA34 Outer Loop Address Increment (2D only) */
2231#define DMA34_CURR_DESC_PTR 0xFFC0D0A4 /* DMA34 Current Descriptor Pointer */
2232#define DMA34_PREV_DESC_PTR 0xFFC0D0A8 /* DMA34 Previous Initial Descriptor Pointer */
2233#define DMA34_CURR_ADDR 0xFFC0D0AC /* DMA34 Current Address */
2234#define DMA34_IRQ_STATUS 0xFFC0D0B0 /* DMA34 Status Register */
2235#define DMA34_CURR_X_COUNT 0xFFC0D0B4 /* DMA34 Current Count(1D) or intra-row XCNT (2D) */
2236#define DMA34_CURR_Y_COUNT 0xFFC0D0B8 /* DMA34 Current Row Count (2D only) */
2237#define DMA34_BWL_COUNT 0xFFC0D0C0 /* DMA34 Bandwidth Limit Count */
2238#define DMA34_CURR_BWL_COUNT 0xFFC0D0C4 /* DMA34 Bandwidth Limit Count Current */
2239#define DMA34_BWM_COUNT 0xFFC0D0C8 /* DMA34 Bandwidth Monitor Count */
2240#define DMA34_CURR_BWM_COUNT 0xFFC0D0CC /* DMA34 Bandwidth Monitor Count Current */
2241
2242/* =========================
2243 DMA35
2244 ========================= */
2245#define DMA35_NEXT_DESC_PTR 0xFFC10000 /* DMA35 Pointer to Next Initial Descriptor */
2246#define DMA35_START_ADDR 0xFFC10004 /* DMA35 Start Address of Current Buffer */
2247#define DMA35_CONFIG 0xFFC10008 /* DMA35 Configuration Register */
2248#define DMA35_X_COUNT 0xFFC1000C /* DMA35 Inner Loop Count Start Value */
2249#define DMA35_X_MODIFY 0xFFC10010 /* DMA35 Inner Loop Address Increment */
2250#define DMA35_Y_COUNT 0xFFC10014 /* DMA35 Outer Loop Count Start Value (2D only) */
2251#define DMA35_Y_MODIFY 0xFFC10018 /* DMA35 Outer Loop Address Increment (2D only) */
2252#define DMA35_CURR_DESC_PTR 0xFFC10024 /* DMA35 Current Descriptor Pointer */
2253#define DMA35_PREV_DESC_PTR 0xFFC10028 /* DMA35 Previous Initial Descriptor Pointer */
2254#define DMA35_CURR_ADDR 0xFFC1002C /* DMA35 Current Address */
2255#define DMA35_IRQ_STATUS 0xFFC10030 /* DMA35 Status Register */
2256#define DMA35_CURR_X_COUNT 0xFFC10034 /* DMA35 Current Count(1D) or intra-row XCNT (2D) */
2257#define DMA35_CURR_Y_COUNT 0xFFC10038 /* DMA35 Current Row Count (2D only) */
2258#define DMA35_BWL_COUNT 0xFFC10040 /* DMA35 Bandwidth Limit Count */
2259#define DMA35_CURR_BWL_COUNT 0xFFC10044 /* DMA35 Bandwidth Limit Count Current */
2260#define DMA35_BWM_COUNT 0xFFC10048 /* DMA35 Bandwidth Monitor Count */
2261#define DMA35_CURR_BWM_COUNT 0xFFC1004C /* DMA35 Bandwidth Monitor Count Current */
2262
2263/* =========================
2264 DMA36
2265 ========================= */
2266#define DMA36_NEXT_DESC_PTR 0xFFC10080 /* DMA36 Pointer to Next Initial Descriptor */
2267#define DMA36_START_ADDR 0xFFC10084 /* DMA36 Start Address of Current Buffer */
2268#define DMA36_CONFIG 0xFFC10088 /* DMA36 Configuration Register */
2269#define DMA36_X_COUNT 0xFFC1008C /* DMA36 Inner Loop Count Start Value */
2270#define DMA36_X_MODIFY 0xFFC10090 /* DMA36 Inner Loop Address Increment */
2271#define DMA36_Y_COUNT 0xFFC10094 /* DMA36 Outer Loop Count Start Value (2D only) */
2272#define DMA36_Y_MODIFY 0xFFC10098 /* DMA36 Outer Loop Address Increment (2D only) */
2273#define DMA36_CURR_DESC_PTR 0xFFC100A4 /* DMA36 Current Descriptor Pointer */
2274#define DMA36_PREV_DESC_PTR 0xFFC100A8 /* DMA36 Previous Initial Descriptor Pointer */
2275#define DMA36_CURR_ADDR 0xFFC100AC /* DMA36 Current Address */
2276#define DMA36_IRQ_STATUS 0xFFC100B0 /* DMA36 Status Register */
2277#define DMA36_CURR_X_COUNT 0xFFC100B4 /* DMA36 Current Count(1D) or intra-row XCNT (2D) */
2278#define DMA36_CURR_Y_COUNT 0xFFC100B8 /* DMA36 Current Row Count (2D only) */
2279#define DMA36_BWL_COUNT 0xFFC100C0 /* DMA36 Bandwidth Limit Count */
2280#define DMA36_CURR_BWL_COUNT 0xFFC100C4 /* DMA36 Bandwidth Limit Count Current */
2281#define DMA36_BWM_COUNT 0xFFC100C8 /* DMA36 Bandwidth Monitor Count */
2282#define DMA36_CURR_BWM_COUNT 0xFFC100CC /* DMA36 Bandwidth Monitor Count Current */
2283
2284/* =========================
2285 DMA37
2286 ========================= */
2287#define DMA37_NEXT_DESC_PTR 0xFFC10100 /* DMA37 Pointer to Next Initial Descriptor */
2288#define DMA37_START_ADDR 0xFFC10104 /* DMA37 Start Address of Current Buffer */
2289#define DMA37_CONFIG 0xFFC10108 /* DMA37 Configuration Register */
2290#define DMA37_X_COUNT 0xFFC1010C /* DMA37 Inner Loop Count Start Value */
2291#define DMA37_X_MODIFY 0xFFC10110 /* DMA37 Inner Loop Address Increment */
2292#define DMA37_Y_COUNT 0xFFC10114 /* DMA37 Outer Loop Count Start Value (2D only) */
2293#define DMA37_Y_MODIFY 0xFFC10118 /* DMA37 Outer Loop Address Increment (2D only) */
2294#define DMA37_CURR_DESC_PTR 0xFFC10124 /* DMA37 Current Descriptor Pointer */
2295#define DMA37_PREV_DESC_PTR 0xFFC10128 /* DMA37 Previous Initial Descriptor Pointer */
2296#define DMA37_CURR_ADDR 0xFFC1012C /* DMA37 Current Address */
2297#define DMA37_IRQ_STATUS 0xFFC10130 /* DMA37 Status Register */
2298#define DMA37_CURR_X_COUNT 0xFFC10134 /* DMA37 Current Count(1D) or intra-row XCNT (2D) */
2299#define DMA37_CURR_Y_COUNT 0xFFC10138 /* DMA37 Current Row Count (2D only) */
2300#define DMA37_BWL_COUNT 0xFFC10140 /* DMA37 Bandwidth Limit Count */
2301#define DMA37_CURR_BWL_COUNT 0xFFC10144 /* DMA37 Bandwidth Limit Count Current */
2302#define DMA37_BWM_COUNT 0xFFC10148 /* DMA37 Bandwidth Monitor Count */
2303#define DMA37_CURR_BWM_COUNT 0xFFC1014C /* DMA37 Bandwidth Monitor Count Current */
2304
2305/* =========================
2306 DMA38
2307 ========================= */
2308#define DMA38_NEXT_DESC_PTR 0xFFC12000 /* DMA38 Pointer to Next Initial Descriptor */
2309#define DMA38_START_ADDR 0xFFC12004 /* DMA38 Start Address of Current Buffer */
2310#define DMA38_CONFIG 0xFFC12008 /* DMA38 Configuration Register */
2311#define DMA38_X_COUNT 0xFFC1200C /* DMA38 Inner Loop Count Start Value */
2312#define DMA38_X_MODIFY 0xFFC12010 /* DMA38 Inner Loop Address Increment */
2313#define DMA38_Y_COUNT 0xFFC12014 /* DMA38 Outer Loop Count Start Value (2D only) */
2314#define DMA38_Y_MODIFY 0xFFC12018 /* DMA38 Outer Loop Address Increment (2D only) */
2315#define DMA38_CURR_DESC_PTR 0xFFC12024 /* DMA38 Current Descriptor Pointer */
2316#define DMA38_PREV_DESC_PTR 0xFFC12028 /* DMA38 Previous Initial Descriptor Pointer */
2317#define DMA38_CURR_ADDR 0xFFC1202C /* DMA38 Current Address */
2318#define DMA38_IRQ_STATUS 0xFFC12030 /* DMA38 Status Register */
2319#define DMA38_CURR_X_COUNT 0xFFC12034 /* DMA38 Current Count(1D) or intra-row XCNT (2D) */
2320#define DMA38_CURR_Y_COUNT 0xFFC12038 /* DMA38 Current Row Count (2D only) */
2321#define DMA38_BWL_COUNT 0xFFC12040 /* DMA38 Bandwidth Limit Count */
2322#define DMA38_CURR_BWL_COUNT 0xFFC12044 /* DMA38 Bandwidth Limit Count Current */
2323#define DMA38_BWM_COUNT 0xFFC12048 /* DMA38 Bandwidth Monitor Count */
2324#define DMA38_CURR_BWM_COUNT 0xFFC1204C /* DMA38 Bandwidth Monitor Count Current */
2325
2326/* =========================
2327 DMA39
2328 ========================= */
2329#define DMA39_NEXT_DESC_PTR 0xFFC12080 /* DMA39 Pointer to Next Initial Descriptor */
2330#define DMA39_START_ADDR 0xFFC12084 /* DMA39 Start Address of Current Buffer */
2331#define DMA39_CONFIG 0xFFC12088 /* DMA39 Configuration Register */
2332#define DMA39_X_COUNT 0xFFC1208C /* DMA39 Inner Loop Count Start Value */
2333#define DMA39_X_MODIFY 0xFFC12090 /* DMA39 Inner Loop Address Increment */
2334#define DMA39_Y_COUNT 0xFFC12094 /* DMA39 Outer Loop Count Start Value (2D only) */
2335#define DMA39_Y_MODIFY 0xFFC12098 /* DMA39 Outer Loop Address Increment (2D only) */
2336#define DMA39_CURR_DESC_PTR 0xFFC120A4 /* DMA39 Current Descriptor Pointer */
2337#define DMA39_PREV_DESC_PTR 0xFFC120A8 /* DMA39 Previous Initial Descriptor Pointer */
2338#define DMA39_CURR_ADDR 0xFFC120AC /* DMA39 Current Address */
2339#define DMA39_IRQ_STATUS 0xFFC120B0 /* DMA39 Status Register */
2340#define DMA39_CURR_X_COUNT 0xFFC120B4 /* DMA39 Current Count(1D) or intra-row XCNT (2D) */
2341#define DMA39_CURR_Y_COUNT 0xFFC120B8 /* DMA39 Current Row Count (2D only) */
2342#define DMA39_BWL_COUNT 0xFFC120C0 /* DMA39 Bandwidth Limit Count */
2343#define DMA39_CURR_BWL_COUNT 0xFFC120C4 /* DMA39 Bandwidth Limit Count Current */
2344#define DMA39_BWM_COUNT 0xFFC120C8 /* DMA39 Bandwidth Monitor Count */
2345#define DMA39_CURR_BWM_COUNT 0xFFC120CC /* DMA39 Bandwidth Monitor Count Current */
2346
2347/* =========================
2348 DMA40
2349 ========================= */
2350#define DMA40_NEXT_DESC_PTR 0xFFC12100 /* DMA40 Pointer to Next Initial Descriptor */
2351#define DMA40_START_ADDR 0xFFC12104 /* DMA40 Start Address of Current Buffer */
2352#define DMA40_CONFIG 0xFFC12108 /* DMA40 Configuration Register */
2353#define DMA40_X_COUNT 0xFFC1210C /* DMA40 Inner Loop Count Start Value */
2354#define DMA40_X_MODIFY 0xFFC12110 /* DMA40 Inner Loop Address Increment */
2355#define DMA40_Y_COUNT 0xFFC12114 /* DMA40 Outer Loop Count Start Value (2D only) */
2356#define DMA40_Y_MODIFY 0xFFC12118 /* DMA40 Outer Loop Address Increment (2D only) */
2357#define DMA40_CURR_DESC_PTR 0xFFC12124 /* DMA40 Current Descriptor Pointer */
2358#define DMA40_PREV_DESC_PTR 0xFFC12128 /* DMA40 Previous Initial Descriptor Pointer */
2359#define DMA40_CURR_ADDR 0xFFC1212C /* DMA40 Current Address */
2360#define DMA40_IRQ_STATUS 0xFFC12130 /* DMA40 Status Register */
2361#define DMA40_CURR_X_COUNT 0xFFC12134 /* DMA40 Current Count(1D) or intra-row XCNT (2D) */
2362#define DMA40_CURR_Y_COUNT 0xFFC12138 /* DMA40 Current Row Count (2D only) */
2363#define DMA40_BWL_COUNT 0xFFC12140 /* DMA40 Bandwidth Limit Count */
2364#define DMA40_CURR_BWL_COUNT 0xFFC12144 /* DMA40 Bandwidth Limit Count Current */
2365#define DMA40_BWM_COUNT 0xFFC12148 /* DMA40 Bandwidth Monitor Count */
2366#define DMA40_CURR_BWM_COUNT 0xFFC1214C /* DMA40 Bandwidth Monitor Count Current */
2367
2368/* =========================
2369 DMA41
2370 ========================= */
2371#define DMA41_NEXT_DESC_PTR 0xFFC12180 /* DMA41 Pointer to Next Initial Descriptor */
2372#define DMA41_START_ADDR 0xFFC12184 /* DMA41 Start Address of Current Buffer */
2373#define DMA41_CONFIG 0xFFC12188 /* DMA41 Configuration Register */
2374#define DMA41_X_COUNT 0xFFC1218C /* DMA41 Inner Loop Count Start Value */
2375#define DMA41_X_MODIFY 0xFFC12190 /* DMA41 Inner Loop Address Increment */
2376#define DMA41_Y_COUNT 0xFFC12194 /* DMA41 Outer Loop Count Start Value (2D only) */
2377#define DMA41_Y_MODIFY 0xFFC12198 /* DMA41 Outer Loop Address Increment (2D only) */
2378#define DMA41_CURR_DESC_PTR 0xFFC121A4 /* DMA41 Current Descriptor Pointer */
2379#define DMA41_PREV_DESC_PTR 0xFFC121A8 /* DMA41 Previous Initial Descriptor Pointer */
2380#define DMA41_CURR_ADDR 0xFFC121AC /* DMA41 Current Address */
2381#define DMA41_IRQ_STATUS 0xFFC121B0 /* DMA41 Status Register */
2382#define DMA41_CURR_X_COUNT 0xFFC121B4 /* DMA41 Current Count(1D) or intra-row XCNT (2D) */
2383#define DMA41_CURR_Y_COUNT 0xFFC121B8 /* DMA41 Current Row Count (2D only) */
2384#define DMA41_BWL_COUNT 0xFFC121C0 /* DMA41 Bandwidth Limit Count */
2385#define DMA41_CURR_BWL_COUNT 0xFFC121C4 /* DMA41 Bandwidth Limit Count Current */
2386#define DMA41_BWM_COUNT 0xFFC121C8 /* DMA41 Bandwidth Monitor Count */
2387#define DMA41_CURR_BWM_COUNT 0xFFC121CC /* DMA41 Bandwidth Monitor Count Current */
2388
2389/* =========================
2390 DMA42
2391 ========================= */
2392#define DMA42_NEXT_DESC_PTR 0xFFC14000 /* DMA42 Pointer to Next Initial Descriptor */
2393#define DMA42_START_ADDR 0xFFC14004 /* DMA42 Start Address of Current Buffer */
2394#define DMA42_CONFIG 0xFFC14008 /* DMA42 Configuration Register */
2395#define DMA42_X_COUNT 0xFFC1400C /* DMA42 Inner Loop Count Start Value */
2396#define DMA42_X_MODIFY 0xFFC14010 /* DMA42 Inner Loop Address Increment */
2397#define DMA42_Y_COUNT 0xFFC14014 /* DMA42 Outer Loop Count Start Value (2D only) */
2398#define DMA42_Y_MODIFY 0xFFC14018 /* DMA42 Outer Loop Address Increment (2D only) */
2399#define DMA42_CURR_DESC_PTR 0xFFC14024 /* DMA42 Current Descriptor Pointer */
2400#define DMA42_PREV_DESC_PTR 0xFFC14028 /* DMA42 Previous Initial Descriptor Pointer */
2401#define DMA42_CURR_ADDR 0xFFC1402C /* DMA42 Current Address */
2402#define DMA42_IRQ_STATUS 0xFFC14030 /* DMA42 Status Register */
2403#define DMA42_CURR_X_COUNT 0xFFC14034 /* DMA42 Current Count(1D) or intra-row XCNT (2D) */
2404#define DMA42_CURR_Y_COUNT 0xFFC14038 /* DMA42 Current Row Count (2D only) */
2405#define DMA42_BWL_COUNT 0xFFC14040 /* DMA42 Bandwidth Limit Count */
2406#define DMA42_CURR_BWL_COUNT 0xFFC14044 /* DMA42 Bandwidth Limit Count Current */
2407#define DMA42_BWM_COUNT 0xFFC14048 /* DMA42 Bandwidth Monitor Count */
2408#define DMA42_CURR_BWM_COUNT 0xFFC1404C /* DMA42 Bandwidth Monitor Count Current */
2409
2410/* =========================
2411 DMA43
2412 ========================= */
2413#define DMA43_NEXT_DESC_PTR 0xFFC14080 /* DMA43 Pointer to Next Initial Descriptor */
2414#define DMA43_START_ADDR 0xFFC14084 /* DMA43 Start Address of Current Buffer */
2415#define DMA43_CONFIG 0xFFC14088 /* DMA43 Configuration Register */
2416#define DMA43_X_COUNT 0xFFC1408C /* DMA43 Inner Loop Count Start Value */
2417#define DMA43_X_MODIFY 0xFFC14090 /* DMA43 Inner Loop Address Increment */
2418#define DMA43_Y_COUNT 0xFFC14094 /* DMA43 Outer Loop Count Start Value (2D only) */
2419#define DMA43_Y_MODIFY 0xFFC14098 /* DMA43 Outer Loop Address Increment (2D only) */
2420#define DMA43_CURR_DESC_PTR 0xFFC140A4 /* DMA43 Current Descriptor Pointer */
2421#define DMA43_PREV_DESC_PTR 0xFFC140A8 /* DMA43 Previous Initial Descriptor Pointer */
2422#define DMA43_CURR_ADDR 0xFFC140AC /* DMA43 Current Address */
2423#define DMA43_IRQ_STATUS 0xFFC140B0 /* DMA43 Status Register */
2424#define DMA43_CURR_X_COUNT 0xFFC140B4 /* DMA43 Current Count(1D) or intra-row XCNT (2D) */
2425#define DMA43_CURR_Y_COUNT 0xFFC140B8 /* DMA43 Current Row Count (2D only) */
2426#define DMA43_BWL_COUNT 0xFFC140C0 /* DMA43 Bandwidth Limit Count */
2427#define DMA43_CURR_BWL_COUNT 0xFFC140C4 /* DMA43 Bandwidth Limit Count Current */
2428#define DMA43_BWM_COUNT 0xFFC140C8 /* DMA43 Bandwidth Monitor Count */
2429#define DMA43_CURR_BWM_COUNT 0xFFC140CC /* DMA43 Bandwidth Monitor Count Current */
2430
2431/* =========================
2432 DMA44
2433 ========================= */
2434#define DMA44_NEXT_DESC_PTR 0xFFC14100 /* DMA44 Pointer to Next Initial Descriptor */
2435#define DMA44_START_ADDR 0xFFC14104 /* DMA44 Start Address of Current Buffer */
2436#define DMA44_CONFIG 0xFFC14108 /* DMA44 Configuration Register */
2437#define DMA44_X_COUNT 0xFFC1410C /* DMA44 Inner Loop Count Start Value */
2438#define DMA44_X_MODIFY 0xFFC14110 /* DMA44 Inner Loop Address Increment */
2439#define DMA44_Y_COUNT 0xFFC14114 /* DMA44 Outer Loop Count Start Value (2D only) */
2440#define DMA44_Y_MODIFY 0xFFC14118 /* DMA44 Outer Loop Address Increment (2D only) */
2441#define DMA44_CURR_DESC_PTR 0xFFC14124 /* DMA44 Current Descriptor Pointer */
2442#define DMA44_PREV_DESC_PTR 0xFFC14128 /* DMA44 Previous Initial Descriptor Pointer */
2443#define DMA44_CURR_ADDR 0xFFC1412C /* DMA44 Current Address */
2444#define DMA44_IRQ_STATUS 0xFFC14130 /* DMA44 Status Register */
2445#define DMA44_CURR_X_COUNT 0xFFC14134 /* DMA44 Current Count(1D) or intra-row XCNT (2D) */
2446#define DMA44_CURR_Y_COUNT 0xFFC14138 /* DMA44 Current Row Count (2D only) */
2447#define DMA44_BWL_COUNT 0xFFC14140 /* DMA44 Bandwidth Limit Count */
2448#define DMA44_CURR_BWL_COUNT 0xFFC14144 /* DMA44 Bandwidth Limit Count Current */
2449#define DMA44_BWM_COUNT 0xFFC14148 /* DMA44 Bandwidth Monitor Count */
2450#define DMA44_CURR_BWM_COUNT 0xFFC1414C /* DMA44 Bandwidth Monitor Count Current */
2451
2452/* =========================
2453 DMA45
2454 ========================= */
2455#define DMA45_NEXT_DESC_PTR 0xFFC14180 /* DMA45 Pointer to Next Initial Descriptor */
2456#define DMA45_START_ADDR 0xFFC14184 /* DMA45 Start Address of Current Buffer */
2457#define DMA45_CONFIG 0xFFC14188 /* DMA45 Configuration Register */
2458#define DMA45_X_COUNT 0xFFC1418C /* DMA45 Inner Loop Count Start Value */
2459#define DMA45_X_MODIFY 0xFFC14190 /* DMA45 Inner Loop Address Increment */
2460#define DMA45_Y_COUNT 0xFFC14194 /* DMA45 Outer Loop Count Start Value (2D only) */
2461#define DMA45_Y_MODIFY 0xFFC14198 /* DMA45 Outer Loop Address Increment (2D only) */
2462#define DMA45_CURR_DESC_PTR 0xFFC141A4 /* DMA45 Current Descriptor Pointer */
2463#define DMA45_PREV_DESC_PTR 0xFFC141A8 /* DMA45 Previous Initial Descriptor Pointer */
2464#define DMA45_CURR_ADDR 0xFFC141AC /* DMA45 Current Address */
2465#define DMA45_IRQ_STATUS 0xFFC141B0 /* DMA45 Status Register */
2466#define DMA45_CURR_X_COUNT 0xFFC141B4 /* DMA45 Current Count(1D) or intra-row XCNT (2D) */
2467#define DMA45_CURR_Y_COUNT 0xFFC141B8 /* DMA45 Current Row Count (2D only) */
2468#define DMA45_BWL_COUNT 0xFFC141C0 /* DMA45 Bandwidth Limit Count */
2469#define DMA45_CURR_BWL_COUNT 0xFFC141C4 /* DMA45 Bandwidth Limit Count Current */
2470#define DMA45_BWM_COUNT 0xFFC141C8 /* DMA45 Bandwidth Monitor Count */
2471#define DMA45_CURR_BWM_COUNT 0xFFC141CC /* DMA45 Bandwidth Monitor Count Current */
2472
2473/* =========================
2474 DMA46
2475 ========================= */
2476#define DMA46_NEXT_DESC_PTR 0xFFC14200 /* DMA46 Pointer to Next Initial Descriptor */
2477#define DMA46_START_ADDR 0xFFC14204 /* DMA46 Start Address of Current Buffer */
2478#define DMA46_CONFIG 0xFFC14208 /* DMA46 Configuration Register */
2479#define DMA46_X_COUNT 0xFFC1420C /* DMA46 Inner Loop Count Start Value */
2480#define DMA46_X_MODIFY 0xFFC14210 /* DMA46 Inner Loop Address Increment */
2481#define DMA46_Y_COUNT 0xFFC14214 /* DMA46 Outer Loop Count Start Value (2D only) */
2482#define DMA46_Y_MODIFY 0xFFC14218 /* DMA46 Outer Loop Address Increment (2D only) */
2483#define DMA46_CURR_DESC_PTR 0xFFC14224 /* DMA46 Current Descriptor Pointer */
2484#define DMA46_PREV_DESC_PTR 0xFFC14228 /* DMA46 Previous Initial Descriptor Pointer */
2485#define DMA46_CURR_ADDR 0xFFC1422C /* DMA46 Current Address */
2486#define DMA46_IRQ_STATUS 0xFFC14230 /* DMA46 Status Register */
2487#define DMA46_CURR_X_COUNT 0xFFC14234 /* DMA46 Current Count(1D) or intra-row XCNT (2D) */
2488#define DMA46_CURR_Y_COUNT 0xFFC14238 /* DMA46 Current Row Count (2D only) */
2489#define DMA46_BWL_COUNT 0xFFC14240 /* DMA46 Bandwidth Limit Count */
2490#define DMA46_CURR_BWL_COUNT 0xFFC14244 /* DMA46 Bandwidth Limit Count Current */
2491#define DMA46_BWM_COUNT 0xFFC14248 /* DMA46 Bandwidth Monitor Count */
2492#define DMA46_CURR_BWM_COUNT 0xFFC1424C /* DMA46 Bandwidth Monitor Count Current */
2493
2494
2495/********************************************************************************
2496 DMA Alias Definitions
2497 ********************************************************************************/
2498#define MDMA0_DEST_CRC0_NEXT_DESC_PTR (DMA22_NEXT_DESC_PTR)
2499#define MDMA0_DEST_CRC0_START_ADDR (DMA22_START_ADDR)
2500#define MDMA0_DEST_CRC0_CONFIG (DMA22_CONFIG)
2501#define MDMA0_DEST_CRC0_X_COUNT (DMA22_X_COUNT)
2502#define MDMA0_DEST_CRC0_X_MODIFY (DMA22_X_MODIFY)
2503#define MDMA0_DEST_CRC0_Y_COUNT (DMA22_Y_COUNT)
2504#define MDMA0_DEST_CRC0_Y_MODIFY (DMA22_Y_MODIFY)
2505#define MDMA0_DEST_CRC0_CURR_DESC_PTR (DMA22_CURR_DESC_PTR)
2506#define MDMA0_DEST_CRC0_PREV_DESC_PTR (DMA22_PREV_DESC_PTR)
2507#define MDMA0_DEST_CRC0_CURR_ADDR (DMA22_CURR_ADDR)
2508#define MDMA0_DEST_CRC0_IRQ_STATUS (DMA22_IRQ_STATUS)
2509#define MDMA0_DEST_CRC0_CURR_X_COUNT (DMA22_CURR_X_COUNT)
2510#define MDMA0_DEST_CRC0_CURR_Y_COUNT (DMA22_CURR_Y_COUNT)
2511#define MDMA0_DEST_CRC0_BWL_COUNT (DMA22_BWL_COUNT)
2512#define MDMA0_DEST_CRC0_CURR_BWL_COUNT (DMA22_CURR_BWL_COUNT)
2513#define MDMA0_DEST_CRC0_BWM_COUNT (DMA22_BWM_COUNT)
2514#define MDMA0_DEST_CRC0_CURR_BWM_COUNT (DMA22_CURR_BWM_COUNT)
2515#define MDMA0_SRC_CRC0_NEXT_DESC_PTR (DMA21_NEXT_DESC_PTR)
2516#define MDMA0_SRC_CRC0_START_ADDR (DMA21_START_ADDR)
2517#define MDMA0_SRC_CRC0_CONFIG (DMA21_CONFIG)
2518#define MDMA0_SRC_CRC0_X_COUNT (DMA21_X_COUNT)
2519#define MDMA0_SRC_CRC0_X_MODIFY (DMA21_X_MODIFY)
2520#define MDMA0_SRC_CRC0_Y_COUNT (DMA21_Y_COUNT)
2521#define MDMA0_SRC_CRC0_Y_MODIFY (DMA21_Y_MODIFY)
2522#define MDMA0_SRC_CRC0_CURR_DESC_PTR (DMA21_CURR_DESC_PTR)
2523#define MDMA0_SRC_CRC0_PREV_DESC_PTR (DMA21_PREV_DESC_PTR)
2524#define MDMA0_SRC_CRC0_CURR_ADDR (DMA21_CURR_ADDR)
2525#define MDMA0_SRC_CRC0_IRQ_STATUS (DMA21_IRQ_STATUS)
2526#define MDMA0_SRC_CRC0_CURR_X_COUNT (DMA21_CURR_X_COUNT)
2527#define MDMA0_SRC_CRC0_CURR_Y_COUNT (DMA21_CURR_Y_COUNT)
2528#define MDMA0_SRC_CRC0_BWL_COUNT (DMA21_BWL_COUNT)
2529#define MDMA0_SRC_CRC0_CURR_BWL_COUNT (DMA21_CURR_BWL_COUNT)
2530#define MDMA0_SRC_CRC0_BWM_COUNT (DMA21_BWM_COUNT)
2531#define MDMA0_SRC_CRC0_CURR_BWM_COUNT (DMA21_CURR_BWM_COUNT)
2532#define MDMA1_DEST_CRC1_NEXT_DESC_PTR (DMA24_NEXT_DESC_PTR)
2533#define MDMA1_DEST_CRC1_START_ADDR (DMA24_START_ADDR)
2534#define MDMA1_DEST_CRC1_CONFIG (DMA24_CONFIG)
2535#define MDMA1_DEST_CRC1_X_COUNT (DMA24_X_COUNT)
2536#define MDMA1_DEST_CRC1_X_MODIFY (DMA24_X_MODIFY)
2537#define MDMA1_DEST_CRC1_Y_COUNT (DMA24_Y_COUNT)
2538#define MDMA1_DEST_CRC1_Y_MODIFY (DMA24_Y_MODIFY)
2539#define MDMA1_DEST_CRC1_CURR_DESC_PTR (DMA24_CURR_DESC_PTR)
2540#define MDMA1_DEST_CRC1_PREV_DESC_PTR (DMA24_PREV_DESC_PTR)
2541#define MDMA1_DEST_CRC1_CURR_ADDR (DMA24_CURR_ADDR)
2542#define MDMA1_DEST_CRC1_IRQ_STATUS (DMA24_IRQ_STATUS)
2543#define MDMA1_DEST_CRC1_CURR_X_COUNT (DMA24_CURR_X_COUNT)
2544#define MDMA1_DEST_CRC1_CURR_Y_COUNT (DMA24_CURR_Y_COUNT)
2545#define MDMA1_DEST_CRC1_BWL_COUNT (DMA24_BWL_COUNT)
2546#define MDMA1_DEST_CRC1_CURR_BWL_COUNT (DMA24_CURR_BWL_COUNT)
2547#define MDMA1_DEST_CRC1_BWM_COUNT (DMA24_BWM_COUNT)
2548#define MDMA1_DEST_CRC1_CURR_BWM_COUNT (DMA24_CURR_BWM_COUNT)
2549#define MDMA1_SRC_CRC1_NEXT_DESC_PTR (DMA23_NEXT_DESC_PTR)
2550#define MDMA1_SRC_CRC1_START_ADDR (DMA23_START_ADDR)
2551#define MDMA1_SRC_CRC1_CONFIG (DMA23_CONFIG)
2552#define MDMA1_SRC_CRC1_X_COUNT (DMA23_X_COUNT)
2553#define MDMA1_SRC_CRC1_X_MODIFY (DMA23_X_MODIFY)
2554#define MDMA1_SRC_CRC1_Y_COUNT (DMA23_Y_COUNT)
2555#define MDMA1_SRC_CRC1_Y_MODIFY (DMA23_Y_MODIFY)
2556#define MDMA1_SRC_CRC1_CURR_DESC_PTR (DMA23_CURR_DESC_PTR)
2557#define MDMA1_SRC_CRC1_PREV_DESC_PTR (DMA23_PREV_DESC_PTR)
2558#define MDMA1_SRC_CRC1_CURR_ADDR (DMA23_CURR_ADDR)
2559#define MDMA1_SRC_CRC1_IRQ_STATUS (DMA23_IRQ_STATUS)
2560#define MDMA1_SRC_CRC1_CURR_X_COUNT (DMA23_CURR_X_COUNT)
2561#define MDMA1_SRC_CRC1_CURR_Y_COUNT (DMA23_CURR_Y_COUNT)
2562#define MDMA1_SRC_CRC1_BWL_COUNT (DMA23_BWL_COUNT)
2563#define MDMA1_SRC_CRC1_CURR_BWL_COUNT (DMA23_CURR_BWL_COUNT)
2564#define MDMA1_SRC_CRC1_BWM_COUNT (DMA23_BWM_COUNT)
2565#define MDMA1_SRC_CRC1_CURR_BWM_COUNT (DMA23_CURR_BWM_COUNT)
2566#define MDMA2_DEST_NEXT_DESC_PTR (DMA26_NEXT_DESC_PTR)
2567#define MDMA2_DEST_START_ADDR (DMA26_START_ADDR)
2568#define MDMA2_DEST_CONFIG (DMA26_CONFIG)
2569#define MDMA2_DEST_X_COUNT (DMA26_X_COUNT)
2570#define MDMA2_DEST_X_MODIFY (DMA26_X_MODIFY)
2571#define MDMA2_DEST_Y_COUNT (DMA26_Y_COUNT)
2572#define MDMA2_DEST_Y_MODIFY (DMA26_Y_MODIFY)
2573#define MDMA2_DEST_CURR_DESC_PTR (DMA26_CURR_DESC_PTR)
2574#define MDMA2_DEST_PREV_DESC_PTR (DMA26_PREV_DESC_PTR)
2575#define MDMA2_DEST_CURR_ADDR (DMA26_CURR_ADDR)
2576#define MDMA2_DEST_IRQ_STATUS (DMA26_IRQ_STATUS)
2577#define MDMA2_DEST_CURR_X_COUNT (DMA26_CURR_X_COUNT)
2578#define MDMA2_DEST_CURR_Y_COUNT (DMA26_CURR_Y_COUNT)
2579#define MDMA2_DEST_BWL_COUNT (DMA26_BWL_COUNT)
2580#define MDMA2_DEST_CURR_BWL_COUNT (DMA26_CURR_BWL_COUNT)
2581#define MDMA2_DEST_BWM_COUNT (DMA26_BWM_COUNT)
2582#define MDMA2_DEST_CURR_BWM_COUNT (DMA26_CURR_BWM_COUNT)
2583#define MDMA2_SRC_NEXT_DESC_PTR (DMA25_NEXT_DESC_PTR)
2584#define MDMA2_SRC_START_ADDR (DMA25_START_ADDR)
2585#define MDMA2_SRC_CONFIG (DMA25_CONFIG)
2586#define MDMA2_SRC_X_COUNT (DMA25_X_COUNT)
2587#define MDMA2_SRC_X_MODIFY (DMA25_X_MODIFY)
2588#define MDMA2_SRC_Y_COUNT (DMA25_Y_COUNT)
2589#define MDMA2_SRC_Y_MODIFY (DMA25_Y_MODIFY)
2590#define MDMA2_SRC_CURR_DESC_PTR (DMA25_CURR_DESC_PTR)
2591#define MDMA2_SRC_PREV_DESC_PTR (DMA25_PREV_DESC_PTR)
2592#define MDMA2_SRC_CURR_ADDR (DMA25_CURR_ADDR)
2593#define MDMA2_SRC_IRQ_STATUS (DMA25_IRQ_STATUS)
2594#define MDMA2_SRC_CURR_X_COUNT (DMA25_CURR_X_COUNT)
2595#define MDMA2_SRC_CURR_Y_COUNT (DMA25_CURR_Y_COUNT)
2596#define MDMA2_SRC_BWL_COUNT (DMA25_BWL_COUNT)
2597#define MDMA2_SRC_CURR_BWL_COUNT (DMA25_CURR_BWL_COUNT)
2598#define MDMA2_SRC_BWM_COUNT (DMA25_BWM_COUNT)
2599#define MDMA2_SRC_CURR_BWM_COUNT (DMA25_CURR_BWM_COUNT)
2600#define MDMA3_DEST_NEXT_DESC_PTR (DMA28_NEXT_DESC_PTR)
2601#define MDMA3_DEST_START_ADDR (DMA28_START_ADDR)
2602#define MDMA3_DEST_CONFIG (DMA28_CONFIG)
2603#define MDMA3_DEST_X_COUNT (DMA28_X_COUNT)
2604#define MDMA3_DEST_X_MODIFY (DMA28_X_MODIFY)
2605#define MDMA3_DEST_Y_COUNT (DMA28_Y_COUNT)
2606#define MDMA3_DEST_Y_MODIFY (DMA28_Y_MODIFY)
2607#define MDMA3_DEST_CURR_DESC_PTR (DMA28_CURR_DESC_PTR)
2608#define MDMA3_DEST_PREV_DESC_PTR (DMA28_PREV_DESC_PTR)
2609#define MDMA3_DEST_CURR_ADDR (DMA28_CURR_ADDR)
2610#define MDMA3_DEST_IRQ_STATUS (DMA28_IRQ_STATUS)
2611#define MDMA3_DEST_CURR_X_COUNT (DMA28_CURR_X_COUNT)
2612#define MDMA3_DEST_CURR_Y_COUNT (DMA28_CURR_Y_COUNT)
2613#define MDMA3_DEST_BWL_COUNT (DMA28_BWL_COUNT)
2614#define MDMA3_DEST_CURR_BWL_COUNT (DMA28_CURR_BWL_COUNT)
2615#define MDMA3_DEST_BWM_COUNT (DMA28_BWM_COUNT)
2616#define MDMA3_DEST_CURR_BWM_COUNT (DMA28_CURR_BWM_COUNT)
2617#define MDMA3_SRC_NEXT_DESC_PTR (DMA27_NEXT_DESC_PTR)
2618#define MDMA3_SRC_START_ADDR (DMA27_START_ADDR)
2619#define MDMA3_SRC_CONFIG (DMA27_CONFIG)
2620#define MDMA3_SRC_X_COUNT (DMA27_X_COUNT)
2621#define MDMA3_SRC_X_MODIFY (DMA27_X_MODIFY)
2622#define MDMA3_SRC_Y_COUNT (DMA27_Y_COUNT)
2623#define MDMA3_SRC_Y_MODIFY (DMA27_Y_MODIFY)
2624#define MDMA3_SRC_CURR_DESC_PTR (DMA27_CURR_DESC_PTR)
2625#define MDMA3_SRC_PREV_DESC_PTR (DMA27_PREV_DESC_PTR)
2626#define MDMA3_SRC_CURR_ADDR (DMA27_CURR_ADDR)
2627#define MDMA3_SRC_IRQ_STATUS (DMA27_IRQ_STATUS)
2628#define MDMA3_SRC_CURR_X_COUNT (DMA27_CURR_X_COUNT)
2629#define MDMA3_SRC_CURR_Y_COUNT (DMA27_CURR_Y_COUNT)
2630#define MDMA3_SRC_BWL_COUNT (DMA27_BWL_COUNT)
2631#define MDMA3_SRC_CURR_BWL_COUNT (DMA27_CURR_BWL_COUNT)
2632#define MDMA3_SRC_BWM_COUNT (DMA27_BWM_COUNT)
2633#define MDMA3_SRC_CURR_BWM_COUNT (DMA27_CURR_BWM_COUNT)
2634
2635
2636/* =========================
2637 DMC Registers
2638 ========================= */
2639
2640/* =========================
2641 DMC0
2642 ========================= */
2643#define DMC0_ID 0xFFC80000 /* DMC0 Identification Register */
2644#define DMC0_CTL 0xFFC80004 /* DMC0 Control Register */
2645#define DMC0_STAT 0xFFC80008 /* DMC0 Status Register */
2646#define DMC0_EFFCTL 0xFFC8000C /* DMC0 Efficiency Controller */
2647#define DMC0_PRIO 0xFFC80010 /* DMC0 Priority ID Register */
2648#define DMC0_PRIOMSK 0xFFC80014 /* DMC0 Priority ID Mask */
2649#define DMC0_CFG 0xFFC80040 /* DMC0 SDRAM Configuration */
2650#define DMC0_TR0 0xFFC80044 /* DMC0 Timing Register 0 */
2651#define DMC0_TR1 0xFFC80048 /* DMC0 Timing Register 1 */
2652#define DMC0_TR2 0xFFC8004C /* DMC0 Timing Register 2 */
2653#define DMC0_MSK 0xFFC8005C /* DMC0 Mode Register Mask */
2654#define DMC0_MR 0xFFC80060 /* DMC0 Mode Shadow register */
2655#define DMC0_EMR1 0xFFC80064 /* DMC0 EMR1 Shadow Register */
2656#define DMC0_EMR2 0xFFC80068 /* DMC0 EMR2 Shadow Register */
2657#define DMC0_EMR3 0xFFC8006C /* DMC0 EMR3 Shadow Register */
2658#define DMC0_DLLCTL 0xFFC80080 /* DMC0 DLL Control Register */
2659#define DMC0_PADCTL 0xFFC800C0 /* DMC0 PAD Control Register 0 */
2660
2661#define DEVSZ_64 0x000 /* DMC External Bank Size = 64Mbit */
2662#define DEVSZ_128 0x100 /* DMC External Bank Size = 128Mbit */
2663#define DEVSZ_256 0x200 /* DMC External Bank Size = 256Mbit */
2664#define DEVSZ_512 0x300 /* DMC External Bank Size = 512Mbit */
2665#define DEVSZ_1G 0x400 /* DMC External Bank Size = 1Gbit */
2666#define DEVSZ_2G 0x500 /* DMC External Bank Size = 2Gbit */
2667
2668
2669/* =========================
2670 L2CTL Registers
2671 ========================= */
2672
2673/* =========================
2674 L2CTL0
2675 ========================= */
2676#define L2CTL0_CTL 0xFFCA3000 /* L2CTL0 L2 Control Register */
2677#define L2CTL0_ACTL_C0 0xFFCA3004 /* L2CTL0 L2 Core 0 Access Control Register */
2678#define L2CTL0_ACTL_C1 0xFFCA3008 /* L2CTL0 L2 Core 1 Access Control Register */
2679#define L2CTL0_ACTL_SYS 0xFFCA300C /* L2CTL0 L2 System Access Control Register */
2680#define L2CTL0_STAT 0xFFCA3010 /* L2CTL0 L2 Status Register */
2681#define L2CTL0_RPCR 0xFFCA3014 /* L2CTL0 L2 Read Priority Count Register */
2682#define L2CTL0_WPCR 0xFFCA3018 /* L2CTL0 L2 Write Priority Count Register */
2683#define L2CTL0_RFA 0xFFCA3024 /* L2CTL0 L2 Refresh Address Regsiter */
2684#define L2CTL0_ERRADDR0 0xFFCA3040 /* L2CTL0 L2 Bank 0 ECC Error Address Register */
2685#define L2CTL0_ERRADDR1 0xFFCA3044 /* L2CTL0 L2 Bank 1 ECC Error Address Register */
2686#define L2CTL0_ERRADDR2 0xFFCA3048 /* L2CTL0 L2 Bank 2 ECC Error Address Register */
2687#define L2CTL0_ERRADDR3 0xFFCA304C /* L2CTL0 L2 Bank 3 ECC Error Address Register */
2688#define L2CTL0_ERRADDR4 0xFFCA3050 /* L2CTL0 L2 Bank 4 ECC Error Address Register */
2689#define L2CTL0_ERRADDR5 0xFFCA3054 /* L2CTL0 L2 Bank 5 ECC Error Address Register */
2690#define L2CTL0_ERRADDR6 0xFFCA3058 /* L2CTL0 L2 Bank 6 ECC Error Address Register */
2691#define L2CTL0_ERRADDR7 0xFFCA305C /* L2CTL0 L2 Bank 7 ECC Error Address Register */
2692#define L2CTL0_ET0 0xFFCA3080 /* L2CTL0 L2 AXI Error 0 Type Register */
2693#define L2CTL0_EADDR0 0xFFCA3084 /* L2CTL0 L2 AXI Error 0 Address Register */
2694#define L2CTL0_ET1 0xFFCA3088 /* L2CTL0 L2 AXI Error 1 Type Register */
2695#define L2CTL0_EADDR1 0xFFCA308C /* L2CTL0 L2 AXI Error 1 Address Register */
2696
2697
2698/* =========================
2699 SEC Registers
2700 ========================= */
2701/* ------------------------------------------------------------------------------------------------------------------------
2702 SEC Core Interface (SCI) Register Definitions
2703 ------------------------------------------------------------------------------------------------------------------------ */
2704
2705#define SEC_SCI_BASE 0xFFCA4400
2706#define SEC_SCI_OFF 0x40
2707#define SEC_CCTL 0x0 /* SEC Core Control Register n */
2708#define SEC_CSTAT 0x4 /* SEC Core Status Register n */
2709#define SEC_CPND 0x8 /* SEC Core Pending IRQ Register n */
2710#define SEC_CACT 0xC /* SEC Core Active IRQ Register n */
2711#define SEC_CPMSK 0x10 /* SEC Core IRQ Priority Mask Register n */
2712#define SEC_CGMSK 0x14 /* SEC Core IRQ Group Mask Register n */
2713#define SEC_CPLVL 0x18 /* SEC Core IRQ Priority Level Register n */
2714#define SEC_CSID 0x1C /* SEC Core IRQ Source ID Register n */
2715
2716#define bfin_read_SEC_SCI(n, reg) bfin_read32(SEC_SCI_BASE + (n) * SEC_SCI_OFF + reg)
2717#define bfin_write_SEC_SCI(n, reg, val) \
2718 bfin_write32(SEC_SCI_BASE + (n) * SEC_SCI_OFF + reg, val)
2719
2720/* ------------------------------------------------------------------------------------------------------------------------
2721 SEC Fault Management Interface (SFI) Register Definitions
2722 ------------------------------------------------------------------------------------------------------------------------ */
2723#define SEC_FCTL 0xFFCA4010 /* SEC Fault Control Register */
2724#define SEC_FSTAT 0xFFCA4014 /* SEC Fault Status Register */
2725#define SEC_FSID 0xFFCA4018 /* SEC Fault Source ID Register */
2726#define SEC_FEND 0xFFCA401C /* SEC Fault End Register */
2727#define SEC_FDLY 0xFFCA4020 /* SEC Fault Delay Register */
2728#define SEC_FDLY_CUR 0xFFCA4024 /* SEC Fault Delay Current Register */
2729#define SEC_FSRDLY 0xFFCA4028 /* SEC Fault System Reset Delay Register */
2730#define SEC_FSRDLY_CUR 0xFFCA402C /* SEC Fault System Reset Delay Current Register */
2731#define SEC_FCOPP 0xFFCA4030 /* SEC Fault COP Period Register */
2732#define SEC_FCOPP_CUR 0xFFCA4034 /* SEC Fault COP Period Current Register */
2733
2734/* ------------------------------------------------------------------------------------------------------------------------
2735 SEC Global Register Definitions
2736 ------------------------------------------------------------------------------------------------------------------------ */
2737#define SEC_GCTL 0xFFCA4000 /* SEC Global Control Register */
2738#define SEC_GSTAT 0xFFCA4004 /* SEC Global Status Register */
2739#define SEC_RAISE 0xFFCA4008 /* SEC Global Raise Register */
2740#define SEC_END 0xFFCA400C /* SEC Global End Register */
2741
2742/* ------------------------------------------------------------------------------------------------------------------------
2743 SEC Source Interface (SSI) Register Definitions
2744 ------------------------------------------------------------------------------------------------------------------------ */
2745#define SEC_SCTL0 0xFFCA4800 /* SEC IRQ Source Control Register n */
2746#define SEC_SCTL1 0xFFCA4808 /* SEC IRQ Source Control Register n */
2747#define SEC_SCTL2 0xFFCA4810 /* SEC IRQ Source Control Register n */
2748#define SEC_SCTL3 0xFFCA4818 /* SEC IRQ Source Control Register n */
2749#define SEC_SCTL4 0xFFCA4820 /* SEC IRQ Source Control Register n */
2750#define SEC_SCTL5 0xFFCA4828 /* SEC IRQ Source Control Register n */
2751#define SEC_SCTL6 0xFFCA4830 /* SEC IRQ Source Control Register n */
2752#define SEC_SCTL7 0xFFCA4838 /* SEC IRQ Source Control Register n */
2753#define SEC_SCTL8 0xFFCA4840 /* SEC IRQ Source Control Register n */
2754#define SEC_SCTL9 0xFFCA4848 /* SEC IRQ Source Control Register n */
2755#define SEC_SCTL10 0xFFCA4850 /* SEC IRQ Source Control Register n */
2756#define SEC_SCTL11 0xFFCA4858 /* SEC IRQ Source Control Register n */
2757#define SEC_SCTL12 0xFFCA4860 /* SEC IRQ Source Control Register n */
2758#define SEC_SCTL13 0xFFCA4868 /* SEC IRQ Source Control Register n */
2759#define SEC_SCTL14 0xFFCA4870 /* SEC IRQ Source Control Register n */
2760#define SEC_SCTL15 0xFFCA4878 /* SEC IRQ Source Control Register n */
2761#define SEC_SCTL16 0xFFCA4880 /* SEC IRQ Source Control Register n */
2762#define SEC_SCTL17 0xFFCA4888 /* SEC IRQ Source Control Register n */
2763#define SEC_SCTL18 0xFFCA4890 /* SEC IRQ Source Control Register n */
2764#define SEC_SCTL19 0xFFCA4898 /* SEC IRQ Source Control Register n */
2765#define SEC_SCTL20 0xFFCA48A0 /* SEC IRQ Source Control Register n */
2766#define SEC_SCTL21 0xFFCA48A8 /* SEC IRQ Source Control Register n */
2767#define SEC_SCTL22 0xFFCA48B0 /* SEC IRQ Source Control Register n */
2768#define SEC_SCTL23 0xFFCA48B8 /* SEC IRQ Source Control Register n */
2769#define SEC_SCTL24 0xFFCA48C0 /* SEC IRQ Source Control Register n */
2770#define SEC_SCTL25 0xFFCA48C8 /* SEC IRQ Source Control Register n */
2771#define SEC_SCTL26 0xFFCA48D0 /* SEC IRQ Source Control Register n */
2772#define SEC_SCTL27 0xFFCA48D8 /* SEC IRQ Source Control Register n */
2773#define SEC_SCTL28 0xFFCA48E0 /* SEC IRQ Source Control Register n */
2774#define SEC_SCTL29 0xFFCA48E8 /* SEC IRQ Source Control Register n */
2775#define SEC_SCTL30 0xFFCA48F0 /* SEC IRQ Source Control Register n */
2776#define SEC_SCTL31 0xFFCA48F8 /* SEC IRQ Source Control Register n */
2777#define SEC_SCTL32 0xFFCA4900 /* SEC IRQ Source Control Register n */
2778#define SEC_SCTL33 0xFFCA4908 /* SEC IRQ Source Control Register n */
2779#define SEC_SCTL34 0xFFCA4910 /* SEC IRQ Source Control Register n */
2780#define SEC_SCTL35 0xFFCA4918 /* SEC IRQ Source Control Register n */
2781#define SEC_SCTL36 0xFFCA4920 /* SEC IRQ Source Control Register n */
2782#define SEC_SCTL37 0xFFCA4928 /* SEC IRQ Source Control Register n */
2783#define SEC_SCTL38 0xFFCA4930 /* SEC IRQ Source Control Register n */
2784#define SEC_SCTL39 0xFFCA4938 /* SEC IRQ Source Control Register n */
2785#define SEC_SCTL40 0xFFCA4940 /* SEC IRQ Source Control Register n */
2786#define SEC_SCTL41 0xFFCA4948 /* SEC IRQ Source Control Register n */
2787#define SEC_SCTL42 0xFFCA4950 /* SEC IRQ Source Control Register n */
2788#define SEC_SCTL43 0xFFCA4958 /* SEC IRQ Source Control Register n */
2789#define SEC_SCTL44 0xFFCA4960 /* SEC IRQ Source Control Register n */
2790#define SEC_SCTL45 0xFFCA4968 /* SEC IRQ Source Control Register n */
2791#define SEC_SCTL46 0xFFCA4970 /* SEC IRQ Source Control Register n */
2792#define SEC_SCTL47 0xFFCA4978 /* SEC IRQ Source Control Register n */
2793#define SEC_SCTL48 0xFFCA4980 /* SEC IRQ Source Control Register n */
2794#define SEC_SCTL49 0xFFCA4988 /* SEC IRQ Source Control Register n */
2795#define SEC_SCTL50 0xFFCA4990 /* SEC IRQ Source Control Register n */
2796#define SEC_SCTL51 0xFFCA4998 /* SEC IRQ Source Control Register n */
2797#define SEC_SCTL52 0xFFCA49A0 /* SEC IRQ Source Control Register n */
2798#define SEC_SCTL53 0xFFCA49A8 /* SEC IRQ Source Control Register n */
2799#define SEC_SCTL54 0xFFCA49B0 /* SEC IRQ Source Control Register n */
2800#define SEC_SCTL55 0xFFCA49B8 /* SEC IRQ Source Control Register n */
2801#define SEC_SCTL56 0xFFCA49C0 /* SEC IRQ Source Control Register n */
2802#define SEC_SCTL57 0xFFCA49C8 /* SEC IRQ Source Control Register n */
2803#define SEC_SCTL58 0xFFCA49D0 /* SEC IRQ Source Control Register n */
2804#define SEC_SCTL59 0xFFCA49D8 /* SEC IRQ Source Control Register n */
2805#define SEC_SCTL60 0xFFCA49E0 /* SEC IRQ Source Control Register n */
2806#define SEC_SCTL61 0xFFCA49E8 /* SEC IRQ Source Control Register n */
2807#define SEC_SCTL62 0xFFCA49F0 /* SEC IRQ Source Control Register n */
2808#define SEC_SCTL63 0xFFCA49F8 /* SEC IRQ Source Control Register n */
2809#define SEC_SCTL64 0xFFCA4A00 /* SEC IRQ Source Control Register n */
2810#define SEC_SCTL65 0xFFCA4A08 /* SEC IRQ Source Control Register n */
2811#define SEC_SCTL66 0xFFCA4A10 /* SEC IRQ Source Control Register n */
2812#define SEC_SCTL67 0xFFCA4A18 /* SEC IRQ Source Control Register n */
2813#define SEC_SCTL68 0xFFCA4A20 /* SEC IRQ Source Control Register n */
2814#define SEC_SCTL69 0xFFCA4A28 /* SEC IRQ Source Control Register n */
2815#define SEC_SCTL70 0xFFCA4A30 /* SEC IRQ Source Control Register n */
2816#define SEC_SCTL71 0xFFCA4A38 /* SEC IRQ Source Control Register n */
2817#define SEC_SCTL72 0xFFCA4A40 /* SEC IRQ Source Control Register n */
2818#define SEC_SCTL73 0xFFCA4A48 /* SEC IRQ Source Control Register n */
2819#define SEC_SCTL74 0xFFCA4A50 /* SEC IRQ Source Control Register n */
2820#define SEC_SCTL75 0xFFCA4A58 /* SEC IRQ Source Control Register n */
2821#define SEC_SCTL76 0xFFCA4A60 /* SEC IRQ Source Control Register n */
2822#define SEC_SCTL77 0xFFCA4A68 /* SEC IRQ Source Control Register n */
2823#define SEC_SCTL78 0xFFCA4A70 /* SEC IRQ Source Control Register n */
2824#define SEC_SCTL79 0xFFCA4A78 /* SEC IRQ Source Control Register n */
2825#define SEC_SCTL80 0xFFCA4A80 /* SEC IRQ Source Control Register n */
2826#define SEC_SCTL81 0xFFCA4A88 /* SEC IRQ Source Control Register n */
2827#define SEC_SCTL82 0xFFCA4A90 /* SEC IRQ Source Control Register n */
2828#define SEC_SCTL83 0xFFCA4A98 /* SEC IRQ Source Control Register n */
2829#define SEC_SCTL84 0xFFCA4AA0 /* SEC IRQ Source Control Register n */
2830#define SEC_SCTL85 0xFFCA4AA8 /* SEC IRQ Source Control Register n */
2831#define SEC_SCTL86 0xFFCA4AB0 /* SEC IRQ Source Control Register n */
2832#define SEC_SCTL87 0xFFCA4AB8 /* SEC IRQ Source Control Register n */
2833#define SEC_SCTL88 0xFFCA4AC0 /* SEC IRQ Source Control Register n */
2834#define SEC_SCTL89 0xFFCA4AC8 /* SEC IRQ Source Control Register n */
2835#define SEC_SCTL90 0xFFCA4AD0 /* SEC IRQ Source Control Register n */
2836#define SEC_SCTL91 0xFFCA4AD8 /* SEC IRQ Source Control Register n */
2837#define SEC_SCTL92 0xFFCA4AE0 /* SEC IRQ Source Control Register n */
2838#define SEC_SCTL93 0xFFCA4AE8 /* SEC IRQ Source Control Register n */
2839#define SEC_SCTL94 0xFFCA4AF0 /* SEC IRQ Source Control Register n */
2840#define SEC_SCTL95 0xFFCA4AF8 /* SEC IRQ Source Control Register n */
2841#define SEC_SCTL96 0xFFCA4B00 /* SEC IRQ Source Control Register n */
2842#define SEC_SCTL97 0xFFCA4B08 /* SEC IRQ Source Control Register n */
2843#define SEC_SCTL98 0xFFCA4B10 /* SEC IRQ Source Control Register n */
2844#define SEC_SCTL99 0xFFCA4B18 /* SEC IRQ Source Control Register n */
2845#define SEC_SCTL100 0xFFCA4B20 /* SEC IRQ Source Control Register n */
2846#define SEC_SCTL101 0xFFCA4B28 /* SEC IRQ Source Control Register n */
2847#define SEC_SCTL102 0xFFCA4B30 /* SEC IRQ Source Control Register n */
2848#define SEC_SCTL103 0xFFCA4B38 /* SEC IRQ Source Control Register n */
2849#define SEC_SCTL104 0xFFCA4B40 /* SEC IRQ Source Control Register n */
2850#define SEC_SCTL105 0xFFCA4B48 /* SEC IRQ Source Control Register n */
2851#define SEC_SCTL106 0xFFCA4B50 /* SEC IRQ Source Control Register n */
2852#define SEC_SCTL107 0xFFCA4B58 /* SEC IRQ Source Control Register n */
2853#define SEC_SCTL108 0xFFCA4B60 /* SEC IRQ Source Control Register n */
2854#define SEC_SCTL109 0xFFCA4B68 /* SEC IRQ Source Control Register n */
2855#define SEC_SCTL110 0xFFCA4B70 /* SEC IRQ Source Control Register n */
2856#define SEC_SCTL111 0xFFCA4B78 /* SEC IRQ Source Control Register n */
2857#define SEC_SCTL112 0xFFCA4B80 /* SEC IRQ Source Control Register n */
2858#define SEC_SCTL113 0xFFCA4B88 /* SEC IRQ Source Control Register n */
2859#define SEC_SCTL114 0xFFCA4B90 /* SEC IRQ Source Control Register n */
2860#define SEC_SCTL115 0xFFCA4B98 /* SEC IRQ Source Control Register n */
2861#define SEC_SCTL116 0xFFCA4BA0 /* SEC IRQ Source Control Register n */
2862#define SEC_SCTL117 0xFFCA4BA8 /* SEC IRQ Source Control Register n */
2863#define SEC_SCTL118 0xFFCA4BB0 /* SEC IRQ Source Control Register n */
2864#define SEC_SCTL119 0xFFCA4BB8 /* SEC IRQ Source Control Register n */
2865#define SEC_SCTL120 0xFFCA4BC0 /* SEC IRQ Source Control Register n */
2866#define SEC_SCTL121 0xFFCA4BC8 /* SEC IRQ Source Control Register n */
2867#define SEC_SCTL122 0xFFCA4BD0 /* SEC IRQ Source Control Register n */
2868#define SEC_SCTL123 0xFFCA4BD8 /* SEC IRQ Source Control Register n */
2869#define SEC_SCTL124 0xFFCA4BE0 /* SEC IRQ Source Control Register n */
2870#define SEC_SCTL125 0xFFCA4BE8 /* SEC IRQ Source Control Register n */
2871#define SEC_SCTL126 0xFFCA4BF0 /* SEC IRQ Source Control Register n */
2872#define SEC_SCTL127 0xFFCA4BF8 /* SEC IRQ Source Control Register n */
2873#define SEC_SCTL128 0xFFCA4C00 /* SEC IRQ Source Control Register n */
2874#define SEC_SCTL129 0xFFCA4C08 /* SEC IRQ Source Control Register n */
2875#define SEC_SCTL130 0xFFCA4C10 /* SEC IRQ Source Control Register n */
2876#define SEC_SCTL131 0xFFCA4C18 /* SEC IRQ Source Control Register n */
2877#define SEC_SCTL132 0xFFCA4C20 /* SEC IRQ Source Control Register n */
2878#define SEC_SCTL133 0xFFCA4C28 /* SEC IRQ Source Control Register n */
2879#define SEC_SCTL134 0xFFCA4C30 /* SEC IRQ Source Control Register n */
2880#define SEC_SCTL135 0xFFCA4C38 /* SEC IRQ Source Control Register n */
2881#define SEC_SCTL136 0xFFCA4C40 /* SEC IRQ Source Control Register n */
2882#define SEC_SCTL137 0xFFCA4C48 /* SEC IRQ Source Control Register n */
2883#define SEC_SCTL138 0xFFCA4C50 /* SEC IRQ Source Control Register n */
2884#define SEC_SCTL139 0xFFCA4C58 /* SEC IRQ Source Control Register n */
2885#define SEC_SSTAT0 0xFFCA4804 /* SEC IRQ Source Status Register n */
2886#define SEC_SSTAT1 0xFFCA480C /* SEC IRQ Source Status Register n */
2887#define SEC_SSTAT2 0xFFCA4814 /* SEC IRQ Source Status Register n */
2888#define SEC_SSTAT3 0xFFCA481C /* SEC IRQ Source Status Register n */
2889#define SEC_SSTAT4 0xFFCA4824 /* SEC IRQ Source Status Register n */
2890#define SEC_SSTAT5 0xFFCA482C /* SEC IRQ Source Status Register n */
2891#define SEC_SSTAT6 0xFFCA4834 /* SEC IRQ Source Status Register n */
2892#define SEC_SSTAT7 0xFFCA483C /* SEC IRQ Source Status Register n */
2893#define SEC_SSTAT8 0xFFCA4844 /* SEC IRQ Source Status Register n */
2894#define SEC_SSTAT9 0xFFCA484C /* SEC IRQ Source Status Register n */
2895#define SEC_SSTAT10 0xFFCA4854 /* SEC IRQ Source Status Register n */
2896#define SEC_SSTAT11 0xFFCA485C /* SEC IRQ Source Status Register n */
2897#define SEC_SSTAT12 0xFFCA4864 /* SEC IRQ Source Status Register n */
2898#define SEC_SSTAT13 0xFFCA486C /* SEC IRQ Source Status Register n */
2899#define SEC_SSTAT14 0xFFCA4874 /* SEC IRQ Source Status Register n */
2900#define SEC_SSTAT15 0xFFCA487C /* SEC IRQ Source Status Register n */
2901#define SEC_SSTAT16 0xFFCA4884 /* SEC IRQ Source Status Register n */
2902#define SEC_SSTAT17 0xFFCA488C /* SEC IRQ Source Status Register n */
2903#define SEC_SSTAT18 0xFFCA4894 /* SEC IRQ Source Status Register n */
2904#define SEC_SSTAT19 0xFFCA489C /* SEC IRQ Source Status Register n */
2905#define SEC_SSTAT20 0xFFCA48A4 /* SEC IRQ Source Status Register n */
2906#define SEC_SSTAT21 0xFFCA48AC /* SEC IRQ Source Status Register n */
2907#define SEC_SSTAT22 0xFFCA48B4 /* SEC IRQ Source Status Register n */
2908#define SEC_SSTAT23 0xFFCA48BC /* SEC IRQ Source Status Register n */
2909#define SEC_SSTAT24 0xFFCA48C4 /* SEC IRQ Source Status Register n */
2910#define SEC_SSTAT25 0xFFCA48CC /* SEC IRQ Source Status Register n */
2911#define SEC_SSTAT26 0xFFCA48D4 /* SEC IRQ Source Status Register n */
2912#define SEC_SSTAT27 0xFFCA48DC /* SEC IRQ Source Status Register n */
2913#define SEC_SSTAT28 0xFFCA48E4 /* SEC IRQ Source Status Register n */
2914#define SEC_SSTAT29 0xFFCA48EC /* SEC IRQ Source Status Register n */
2915#define SEC_SSTAT30 0xFFCA48F4 /* SEC IRQ Source Status Register n */
2916#define SEC_SSTAT31 0xFFCA48FC /* SEC IRQ Source Status Register n */
2917#define SEC_SSTAT32 0xFFCA4904 /* SEC IRQ Source Status Register n */
2918#define SEC_SSTAT33 0xFFCA490C /* SEC IRQ Source Status Register n */
2919#define SEC_SSTAT34 0xFFCA4914 /* SEC IRQ Source Status Register n */
2920#define SEC_SSTAT35 0xFFCA491C /* SEC IRQ Source Status Register n */
2921#define SEC_SSTAT36 0xFFCA4924 /* SEC IRQ Source Status Register n */
2922#define SEC_SSTAT37 0xFFCA492C /* SEC IRQ Source Status Register n */
2923#define SEC_SSTAT38 0xFFCA4934 /* SEC IRQ Source Status Register n */
2924#define SEC_SSTAT39 0xFFCA493C /* SEC IRQ Source Status Register n */
2925#define SEC_SSTAT40 0xFFCA4944 /* SEC IRQ Source Status Register n */
2926#define SEC_SSTAT41 0xFFCA494C /* SEC IRQ Source Status Register n */
2927#define SEC_SSTAT42 0xFFCA4954 /* SEC IRQ Source Status Register n */
2928#define SEC_SSTAT43 0xFFCA495C /* SEC IRQ Source Status Register n */
2929#define SEC_SSTAT44 0xFFCA4964 /* SEC IRQ Source Status Register n */
2930#define SEC_SSTAT45 0xFFCA496C /* SEC IRQ Source Status Register n */
2931#define SEC_SSTAT46 0xFFCA4974 /* SEC IRQ Source Status Register n */
2932#define SEC_SSTAT47 0xFFCA497C /* SEC IRQ Source Status Register n */
2933#define SEC_SSTAT48 0xFFCA4984 /* SEC IRQ Source Status Register n */
2934#define SEC_SSTAT49 0xFFCA498C /* SEC IRQ Source Status Register n */
2935#define SEC_SSTAT50 0xFFCA4994 /* SEC IRQ Source Status Register n */
2936#define SEC_SSTAT51 0xFFCA499C /* SEC IRQ Source Status Register n */
2937#define SEC_SSTAT52 0xFFCA49A4 /* SEC IRQ Source Status Register n */
2938#define SEC_SSTAT53 0xFFCA49AC /* SEC IRQ Source Status Register n */
2939#define SEC_SSTAT54 0xFFCA49B4 /* SEC IRQ Source Status Register n */
2940#define SEC_SSTAT55 0xFFCA49BC /* SEC IRQ Source Status Register n */
2941#define SEC_SSTAT56 0xFFCA49C4 /* SEC IRQ Source Status Register n */
2942#define SEC_SSTAT57 0xFFCA49CC /* SEC IRQ Source Status Register n */
2943#define SEC_SSTAT58 0xFFCA49D4 /* SEC IRQ Source Status Register n */
2944#define SEC_SSTAT59 0xFFCA49DC /* SEC IRQ Source Status Register n */
2945#define SEC_SSTAT60 0xFFCA49E4 /* SEC IRQ Source Status Register n */
2946#define SEC_SSTAT61 0xFFCA49EC /* SEC IRQ Source Status Register n */
2947#define SEC_SSTAT62 0xFFCA49F4 /* SEC IRQ Source Status Register n */
2948#define SEC_SSTAT63 0xFFCA49FC /* SEC IRQ Source Status Register n */
2949#define SEC_SSTAT64 0xFFCA4A04 /* SEC IRQ Source Status Register n */
2950#define SEC_SSTAT65 0xFFCA4A0C /* SEC IRQ Source Status Register n */
2951#define SEC_SSTAT66 0xFFCA4A14 /* SEC IRQ Source Status Register n */
2952#define SEC_SSTAT67 0xFFCA4A1C /* SEC IRQ Source Status Register n */
2953#define SEC_SSTAT68 0xFFCA4A24 /* SEC IRQ Source Status Register n */
2954#define SEC_SSTAT69 0xFFCA4A2C /* SEC IRQ Source Status Register n */
2955#define SEC_SSTAT70 0xFFCA4A34 /* SEC IRQ Source Status Register n */
2956#define SEC_SSTAT71 0xFFCA4A3C /* SEC IRQ Source Status Register n */
2957#define SEC_SSTAT72 0xFFCA4A44 /* SEC IRQ Source Status Register n */
2958#define SEC_SSTAT73 0xFFCA4A4C /* SEC IRQ Source Status Register n */
2959#define SEC_SSTAT74 0xFFCA4A54 /* SEC IRQ Source Status Register n */
2960#define SEC_SSTAT75 0xFFCA4A5C /* SEC IRQ Source Status Register n */
2961#define SEC_SSTAT76 0xFFCA4A64 /* SEC IRQ Source Status Register n */
2962#define SEC_SSTAT77 0xFFCA4A6C /* SEC IRQ Source Status Register n */
2963#define SEC_SSTAT78 0xFFCA4A74 /* SEC IRQ Source Status Register n */
2964#define SEC_SSTAT79 0xFFCA4A7C /* SEC IRQ Source Status Register n */
2965#define SEC_SSTAT80 0xFFCA4A84 /* SEC IRQ Source Status Register n */
2966#define SEC_SSTAT81 0xFFCA4A8C /* SEC IRQ Source Status Register n */
2967#define SEC_SSTAT82 0xFFCA4A94 /* SEC IRQ Source Status Register n */
2968#define SEC_SSTAT83 0xFFCA4A9C /* SEC IRQ Source Status Register n */
2969#define SEC_SSTAT84 0xFFCA4AA4 /* SEC IRQ Source Status Register n */
2970#define SEC_SSTAT85 0xFFCA4AAC /* SEC IRQ Source Status Register n */
2971#define SEC_SSTAT86 0xFFCA4AB4 /* SEC IRQ Source Status Register n */
2972#define SEC_SSTAT87 0xFFCA4ABC /* SEC IRQ Source Status Register n */
2973#define SEC_SSTAT88 0xFFCA4AC4 /* SEC IRQ Source Status Register n */
2974#define SEC_SSTAT89 0xFFCA4ACC /* SEC IRQ Source Status Register n */
2975#define SEC_SSTAT90 0xFFCA4AD4 /* SEC IRQ Source Status Register n */
2976#define SEC_SSTAT91 0xFFCA4ADC /* SEC IRQ Source Status Register n */
2977#define SEC_SSTAT92 0xFFCA4AE4 /* SEC IRQ Source Status Register n */
2978#define SEC_SSTAT93 0xFFCA4AEC /* SEC IRQ Source Status Register n */
2979#define SEC_SSTAT94 0xFFCA4AF4 /* SEC IRQ Source Status Register n */
2980#define SEC_SSTAT95 0xFFCA4AFC /* SEC IRQ Source Status Register n */
2981#define SEC_SSTAT96 0xFFCA4B04 /* SEC IRQ Source Status Register n */
2982#define SEC_SSTAT97 0xFFCA4B0C /* SEC IRQ Source Status Register n */
2983#define SEC_SSTAT98 0xFFCA4B14 /* SEC IRQ Source Status Register n */
2984#define SEC_SSTAT99 0xFFCA4B1C /* SEC IRQ Source Status Register n */
2985#define SEC_SSTAT100 0xFFCA4B24 /* SEC IRQ Source Status Register n */
2986#define SEC_SSTAT101 0xFFCA4B2C /* SEC IRQ Source Status Register n */
2987#define SEC_SSTAT102 0xFFCA4B34 /* SEC IRQ Source Status Register n */
2988#define SEC_SSTAT103 0xFFCA4B3C /* SEC IRQ Source Status Register n */
2989#define SEC_SSTAT104 0xFFCA4B44 /* SEC IRQ Source Status Register n */
2990#define SEC_SSTAT105 0xFFCA4B4C /* SEC IRQ Source Status Register n */
2991#define SEC_SSTAT106 0xFFCA4B54 /* SEC IRQ Source Status Register n */
2992#define SEC_SSTAT107 0xFFCA4B5C /* SEC IRQ Source Status Register n */
2993#define SEC_SSTAT108 0xFFCA4B64 /* SEC IRQ Source Status Register n */
2994#define SEC_SSTAT109 0xFFCA4B6C /* SEC IRQ Source Status Register n */
2995#define SEC_SSTAT110 0xFFCA4B74 /* SEC IRQ Source Status Register n */
2996#define SEC_SSTAT111 0xFFCA4B7C /* SEC IRQ Source Status Register n */
2997#define SEC_SSTAT112 0xFFCA4B84 /* SEC IRQ Source Status Register n */
2998#define SEC_SSTAT113 0xFFCA4B8C /* SEC IRQ Source Status Register n */
2999#define SEC_SSTAT114 0xFFCA4B94 /* SEC IRQ Source Status Register n */
3000#define SEC_SSTAT115 0xFFCA4B9C /* SEC IRQ Source Status Register n */
3001#define SEC_SSTAT116 0xFFCA4BA4 /* SEC IRQ Source Status Register n */
3002#define SEC_SSTAT117 0xFFCA4BAC /* SEC IRQ Source Status Register n */
3003#define SEC_SSTAT118 0xFFCA4BB4 /* SEC IRQ Source Status Register n */
3004#define SEC_SSTAT119 0xFFCA4BBC /* SEC IRQ Source Status Register n */
3005#define SEC_SSTAT120 0xFFCA4BC4 /* SEC IRQ Source Status Register n */
3006#define SEC_SSTAT121 0xFFCA4BCC /* SEC IRQ Source Status Register n */
3007#define SEC_SSTAT122 0xFFCA4BD4 /* SEC IRQ Source Status Register n */
3008#define SEC_SSTAT123 0xFFCA4BDC /* SEC IRQ Source Status Register n */
3009#define SEC_SSTAT124 0xFFCA4BE4 /* SEC IRQ Source Status Register n */
3010#define SEC_SSTAT125 0xFFCA4BEC /* SEC IRQ Source Status Register n */
3011#define SEC_SSTAT126 0xFFCA4BF4 /* SEC IRQ Source Status Register n */
3012#define SEC_SSTAT127 0xFFCA4BFC /* SEC IRQ Source Status Register n */
3013#define SEC_SSTAT128 0xFFCA4C04 /* SEC IRQ Source Status Register n */
3014#define SEC_SSTAT129 0xFFCA4C0C /* SEC IRQ Source Status Register n */
3015#define SEC_SSTAT130 0xFFCA4C14 /* SEC IRQ Source Status Register n */
3016#define SEC_SSTAT131 0xFFCA4C1C /* SEC IRQ Source Status Register n */
3017#define SEC_SSTAT132 0xFFCA4C24 /* SEC IRQ Source Status Register n */
3018#define SEC_SSTAT133 0xFFCA4C2C /* SEC IRQ Source Status Register n */
3019#define SEC_SSTAT134 0xFFCA4C34 /* SEC IRQ Source Status Register n */
3020#define SEC_SSTAT135 0xFFCA4C3C /* SEC IRQ Source Status Register n */
3021#define SEC_SSTAT136 0xFFCA4C44 /* SEC IRQ Source Status Register n */
3022#define SEC_SSTAT137 0xFFCA4C4C /* SEC IRQ Source Status Register n */
3023#define SEC_SSTAT138 0xFFCA4C54 /* SEC IRQ Source Status Register n */
3024#define SEC_SSTAT139 0xFFCA4C5C /* SEC IRQ Source Status Register n */
3025
3026/* ------------------------------------------------------------------------------------------------------------------------
3027 SEC_CCTL Pos/Masks Description
3028 ------------------------------------------------------------------------------------------------------------------------ */
3029#define SEC_CCTL_LOCK 0x80000000 /* LOCK: Lock */
3030#define SEC_CCTL_NMI_EN 0x00010000 /* NMIEN: Enable */
3031#define SEC_CCTL_WAITIDLE 0x00001000 /* WFI: Wait for Idle */
3032#define SEC_CCTL_RESET 0x00000002 /* RESET: Reset */
3033#define SEC_CCTL_EN 0x00000001 /* EN: Enable */
3034
3035/* ------------------------------------------------------------------------------------------------------------------------
3036 SEC_CSTAT Pos/Masks Description
3037 ------------------------------------------------------------------------------------------------------------------------ */
3038#define SEC_CSTAT_NMI 0x00010000 /* NMI Status */
3039#define SEC_CSTAT_WAITING 0x00001000 /* WFI: Waiting */
3040#define SEC_CSTAT_VALID_SID 0x00000400 /* SIDV: Valid */
3041#define SEC_CSTAT_VALID_ACT 0x00000200 /* ACTV: Valid */
3042#define SEC_CSTAT_VALID_PND 0x00000100 /* PNDV: Valid */
3043#define SEC_CSTAT_ERRC 0x00000030 /* Error Cause */
3044#define SEC_CSTAT_ACKERR 0x00000010 /* ERRC: Acknowledge Error */
3045#define SEC_CSTAT_ERR 0x00000002 /* ERR: Error Occurred */
3046
3047/* ------------------------------------------------------------------------------------------------------------------------
3048 SEC_CPND Pos/Masks Description
3049 ------------------------------------------------------------------------------------------------------------------------ */
3050#define SEC_CPND_PRIO 0x0000FF00 /* Highest Pending IRQ Priority */
3051#define SEC_CPND_SID 0x000000FF /* Highest Pending IRQ Source ID */
3052
3053/* ------------------------------------------------------------------------------------------------------------------------
3054 SEC_CACT Pos/Masks Description
3055 ------------------------------------------------------------------------------------------------------------------------ */
3056#define SEC_CACT_PRIO 0x0000FF00 /* Highest Active IRQ Priority */
3057#define SEC_CACT_SID 0x000000FF /* Highest Active IRQ Source ID */
3058
3059/* ------------------------------------------------------------------------------------------------------------------------
3060 SEC_CPMSK Pos/Masks Description
3061 ------------------------------------------------------------------------------------------------------------------------ */
3062#define SEC_CPMSK_LOCK 0x80000000 /* LOCK: Lock */
3063#define SEC_CPMSK_PRIO 0x000000FF /* IRQ Priority Mask */
3064
3065/* ------------------------------------------------------------------------------------------------------------------------
3066 SEC_CGMSK Pos/Masks Description
3067 ------------------------------------------------------------------------------------------------------------------------ */
3068#define SEC_CGMSK_LOCK 0x80000000 /* LOCK: Lock */
3069#define SEC_CGMSK_MASK 0x00000100 /* UGRP: Mask Ungrouped Sources */
3070#define SEC_CGMSK_GRP 0x0000000F /* Grouped Mask */
3071
3072/* ------------------------------------------------------------------------------------------------------------------------
3073 SEC_CPLVL Pos/Masks Description
3074 ------------------------------------------------------------------------------------------------------------------------ */
3075#define SEC_CPLVL_LOCK 0x80000000 /* LOCK: Lock */
3076#define SEC_CPLVL_PLVL 0x00000007 /* Priority Levels */
3077
3078/* ------------------------------------------------------------------------------------------------------------------------
3079 SEC_CSID Pos/Masks Description
3080 ------------------------------------------------------------------------------------------------------------------------ */
3081#define SEC_CSID_SID 0x000000FF /* Source ID */
3082
3083
3084/* ------------------------------------------------------------------------------------------------------------------------
3085 SEC_FCTL Pos/Masks Description
3086 ------------------------------------------------------------------------------------------------------------------------ */
3087#define SEC_FCTL_LOCK 0x80000000 /* LOCK: Lock */
3088#define SEC_FCTL_FLTPND_MODE 0x00002000 /* TES: Fault Pending Mode */
3089#define SEC_FCTL_COP_MODE 0x00001000 /* CMS: COP Mode */
3090#define SEC_FCTL_FLTIN_EN 0x00000080 /* FIEN: Enable */
3091#define SEC_FCTL_SYSRST_EN 0x00000040 /* SREN: Enable */
3092#define SEC_FCTL_TRGOUT_EN 0x00000020 /* TOEN: Enable */
3093#define SEC_FCTL_FLTOUT_EN 0x00000010 /* FOEN: Enable */
3094#define SEC_FCTL_RESET 0x00000002 /* RESET: Reset */
3095#define SEC_FCTL_EN 0x00000001 /* EN: Enable */
3096
3097/* ------------------------------------------------------------------------------------------------------------------------
3098 SEC_FSTAT Pos/Masks Description
3099 ------------------------------------------------------------------------------------------------------------------------ */
3100#define SEC_FSTAT_NXTFLT 0x00000400 /* NPND: Pending */
3101#define SEC_FSTAT_FLTACT 0x00000200 /* ACT: Active Fault */
3102#define SEC_FSTAT_FLTPND 0x00000100 /* PND: Pending */
3103#define SEC_FSTAT_ERRC 0x00000030 /* Error Cause */
3104#define SEC_FSTAT_ENDERR 0x00000020 /* ERRC: End Error */
3105#define SEC_FSTAT_ERR 0x00000002 /* ERR: Error Occurred */
3106
3107/* ------------------------------------------------------------------------------------------------------------------------
3108 SEC_FSID Pos/Masks Description
3109 ------------------------------------------------------------------------------------------------------------------------ */
3110#define SEC_FSID_SRC_EXTFLT 0x00010000 /* FEXT: Fault External */
3111#define SEC_FSID_SID 0x000000FF /* Source ID */
3112
3113/* ------------------------------------------------------------------------------------------------------------------------
3114 SEC_FEND Pos/Masks Description
3115 ------------------------------------------------------------------------------------------------------------------------ */
3116#define SEC_FEND_END_EXTFLT 0x00010000 /* FEXT: Fault External */
3117#define SEC_FEND_SID 0x000000FF /* Source ID */
3118
3119
3120/* ------------------------------------------------------------------------------------------------------------------------
3121 SEC_GCTL Pos/Masks Description
3122 ------------------------------------------------------------------------------------------------------------------------ */
3123#define SEC_GCTL_LOCK 0x80000000 /* Lock */
3124#define SEC_GCTL_RESET 0x00000002 /* Reset */
3125#define SEC_GCTL_EN 0x00000001 /* Enable */
3126
3127/* ------------------------------------------------------------------------------------------------------------------------
3128 SEC_GSTAT Pos/Masks Description
3129 ------------------------------------------------------------------------------------------------------------------------ */
3130#define SEC_GSTAT_LWERR 0x80000000 /* LWERR: Error Occurred */
3131#define SEC_GSTAT_ADRERR 0x40000000 /* ADRERR: Error Occurred */
3132#define SEC_GSTAT_SID 0x00FF0000 /* Source ID for SSI Error */
3133#define SEC_GSTAT_SCI 0x00000F00 /* SCI ID for SCI Error */
3134#define SEC_GSTAT_ERRC 0x00000030 /* Error Cause */
3135#define SEC_GSTAT_SCIERR 0x00000010 /* ERRC: SCI Error */
3136#define SEC_GSTAT_SSIERR 0x00000020 /* ERRC: SSI Error */
3137#define SEC_GSTAT_ERR 0x00000002 /* ERR: Error Occurred */
3138
3139/* ------------------------------------------------------------------------------------------------------------------------
3140 SEC_RAISE Pos/Masks Description
3141 ------------------------------------------------------------------------------------------------------------------------ */
3142#define SEC_RAISE_SID 0x000000FF /* Source ID IRQ Set to Pending */
3143
3144/* ------------------------------------------------------------------------------------------------------------------------
3145 SEC_END Pos/Masks Description
3146 ------------------------------------------------------------------------------------------------------------------------ */
3147#define SEC_END_SID 0x000000FF /* Source ID IRQ to End */
3148
3149
3150/* ------------------------------------------------------------------------------------------------------------------------
3151 SEC_SCTL Pos/Masks Description
3152 ------------------------------------------------------------------------------------------------------------------------ */
3153#define SEC_SCTL_LOCK 0x80000000 /* Lock */
3154#define SEC_SCTL_CTG 0x0F000000 /* Core Target Select */
3155#define SEC_SCTL_GRP 0x000F0000 /* Group Select */
3156#define SEC_SCTL_PRIO 0x0000FF00 /* Priority Level Select */
3157#define SEC_SCTL_ERR_EN 0x00000010 /* ERREN: Enable */
3158#define SEC_SCTL_EDGE 0x00000008 /* ES: Edge Sensitive */
3159#define SEC_SCTL_SRC_EN 0x00000004 /* SEN: Enable */
3160#define SEC_SCTL_FAULT_EN 0x00000002 /* FEN: Enable */
3161#define SEC_SCTL_INT_EN 0x00000001 /* IEN: Enable */
3162
3163/* ------------------------------------------------------------------------------------------------------------------------
3164 SEC_SSTAT Pos/Masks Description
3165 ------------------------------------------------------------------------------------------------------------------------ */
3166#define SEC_SSTAT_CHID 0x00FF0000 /* Channel ID */
3167#define SEC_SSTAT_ACTIVE_SRC 0x00000200 /* ACT: Active Source */
3168#define SEC_SSTAT_PENDING 0x00000100 /* PND: Pending */
3169#define SEC_SSTAT_ERRC 0x00000030 /* Error Cause */
3170#define SEC_SSTAT_ENDERR 0x00000020 /* ERRC: End Error */
3171#define SEC_SSTAT_ERR 0x00000002 /* Error */
3172
3173
3174/* =========================
3175 RCU Registers
3176 ========================= */
3177
3178/* =========================
3179 RCU0
3180 ========================= */
3181#define RCU0_CTL 0xFFCA6000 /* RCU0 Control Register */
3182#define RCU0_STAT 0xFFCA6004 /* RCU0 Status Register */
3183#define RCU0_CRCTL 0xFFCA6008 /* RCU0 Core Reset Control Register */
3184#define RCU0_CRSTAT 0xFFCA600C /* RCU0 Core Reset Status Register */
3185#define RCU0_SIDIS 0xFFCA6010 /* RCU0 System Interface Disable Register */
3186#define RCU0_SISTAT 0xFFCA6014 /* RCU0 System Interface Status Register */
3187#define RCU0_SVECT_LCK 0xFFCA6018 /* RCU0 SVECT Lock Register */
3188#define RCU0_BCODE 0xFFCA601C /* RCU0 Boot Code Register */
3189#define RCU0_SVECT0 0xFFCA6020 /* RCU0 Software Vector Register n */
3190#define RCU0_SVECT1 0xFFCA6024 /* RCU0 Software Vector Register n */
3191
3192
3193/* =========================
3194 CGU0
3195 ========================= */
3196#define CGU0_CTL 0xFFCA8000 /* CGU0 Control Register */
3197#define CGU0_STAT 0xFFCA8004 /* CGU0 Status Register */
3198#define CGU0_DIV 0xFFCA8008 /* CGU0 Divisor Register */
3199#define CGU0_CLKOUTSEL 0xFFCA800C /* CGU0 CLKOUT Select Register */
3200
3201
3202/* =========================
3203 DPM Registers
3204 ========================= */
3205
3206/* =========================
3207 DPM0
3208 ========================= */
3209#define DPM0_CTL 0xFFCA9000 /* DPM0 Control Register */
3210#define DPM0_STAT 0xFFCA9004 /* DPM0 Status Register */
3211#define DPM0_CCBF_DIS 0xFFCA9008 /* DPM0 Core Clock Buffer Disable Register */
3212#define DPM0_CCBF_EN 0xFFCA900C /* DPM0 Core Clock Buffer Enable Register */
3213#define DPM0_CCBF_STAT 0xFFCA9010 /* DPM0 Core Clock Buffer Status Register */
3214#define DPM0_CCBF_STAT_STKY 0xFFCA9014 /* DPM0 Core Clock Buffer Status Sticky Register */
3215#define DPM0_SCBF_DIS 0xFFCA9018 /* DPM0 System Clock Buffer Disable Register */
3216#define DPM0_WAKE_EN 0xFFCA901C /* DPM0 Wakeup Enable Register */
3217#define DPM0_WAKE_POL 0xFFCA9020 /* DPM0 Wakeup Polarity Register */
3218#define DPM0_WAKE_STAT 0xFFCA9024 /* DPM0 Wakeup Status Register */
3219#define DPM0_HIB_DIS 0xFFCA9028 /* DPM0 Hibernate Disable Register */
3220#define DPM0_PGCNTR 0xFFCA902C /* DPM0 Power Good Counter Register */
3221#define DPM0_RESTORE0 0xFFCA9030 /* DPM0 Restore Register */
3222#define DPM0_RESTORE1 0xFFCA9034 /* DPM0 Restore Register */
3223#define DPM0_RESTORE2 0xFFCA9038 /* DPM0 Restore Register */
3224#define DPM0_RESTORE3 0xFFCA903C /* DPM0 Restore Register */
3225#define DPM0_RESTORE4 0xFFCA9040 /* DPM0 Restore Register */
3226#define DPM0_RESTORE5 0xFFCA9044 /* DPM0 Restore Register */
3227#define DPM0_RESTORE6 0xFFCA9048 /* DPM0 Restore Register */
3228#define DPM0_RESTORE7 0xFFCA904C /* DPM0 Restore Register */
3229#define DPM0_RESTORE8 0xFFCA9050 /* DPM0 Restore Register */
3230#define DPM0_RESTORE9 0xFFCA9054 /* DPM0 Restore Register */
3231#define DPM0_RESTORE10 0xFFCA9058 /* DPM0 Restore Register */
3232#define DPM0_RESTORE11 0xFFCA905C /* DPM0 Restore Register */
3233#define DPM0_RESTORE12 0xFFCA9060 /* DPM0 Restore Register */
3234#define DPM0_RESTORE13 0xFFCA9064 /* DPM0 Restore Register */
3235#define DPM0_RESTORE14 0xFFCA9068 /* DPM0 Restore Register */
3236#define DPM0_RESTORE15 0xFFCA906C /* DPM0 Restore Register */
3237
3238
3239/* =========================
3240 DBG Registers
3241 ========================= */
3242
3243/* USB register */
3244#define USB_FADDR 0xFFCC1000 /* USB Device Address in Peripheral Mode */
3245#define USB_POWER 0xFFCC1001 /* USB Power and Device Control */
3246#define USB_INTRTX 0xFFCC1002 /* USB Transmit Interrupt */
3247#define USB_INTRRX 0xFFCC1004 /* USB Receive Interrupts */
3248#define USB_INTRTXE 0xFFCC1006 /* USB Transmit Interrupt Enable */
3249#define USB_INTRRXE 0xFFCC1008 /* USB Receive Interrupt Enable */
3250#define USB_INTRUSB 0xFFCC100A /* USB USB Interrupts */
3251#define USB_INTRUSBE 0xFFCC100B /* USB USB Interrupt Enable */
3252#define USB_FRAME 0xFFCC100C /* USB Frame Number */
3253#define USB_INDEX 0xFFCC100E /* USB Index */
3254#define USB_TESTMODE 0xFFCC100F /* USB Testmodes */
3255#define USB_EPI_TXMAXP0 0xFFCC1010 /* USB Transmit Maximum Packet Length */
3256#define USB_EP_NI0_TXMAXP 0xFFCC1010
3257#define USB_EP0I_CSR0_H 0xFFCC1012 /* USB Config and Status EP0 */
3258#define USB_EPI_TXCSR0_H 0xFFCC1012 /* USB Transmit Configuration and Status */
3259#define USB_EP0I_CSR0_P 0xFFCC1012 /* USB Config and Status EP0 */
3260#define USB_EPI_TXCSR0_P 0xFFCC1012 /* USB Transmit Configuration and Status */
3261#define USB_EPI_RXMAXP0 0xFFCC1014 /* USB Receive Maximum Packet Length */
3262#define USB_EPI_RXCSR0_H 0xFFCC1016 /* USB Receive Configuration and Status Register */
3263#define USB_EPI_RXCSR0_P 0xFFCC1016 /* USB Receive Configuration and Status Register */
3264#define USB_EP0I_CNT0 0xFFCC1018 /* USB Number of Received Bytes for Endpoint 0 */
3265#define USB_EPI_RXCNT0 0xFFCC1018 /* USB Number of Byte Received */
3266#define USB_EP0I_TYPE0 0xFFCC101A /* USB Speed for Endpoint 0 */
3267#define USB_EPI_TXTYPE0 0xFFCC101A /* USB Transmit Type */
3268#define USB_EP0I_NAKLIMIT0 0xFFCC101B /* USB NAK Response Timeout for Endpoint 0 */
3269#define USB_EPI_TXINTERVAL0 0xFFCC101B /* USB Transmit Polling Interval */
3270#define USB_EPI_RXTYPE0 0xFFCC101C /* USB Receive Type */
3271#define USB_EPI_RXINTERVAL0 0xFFCC101D /* USB Receive Polling Interval */
3272#define USB_EP0I_CFGDATA0 0xFFCC101F /* USB Configuration Information */
3273#define USB_FIFOB0 0xFFCC1020 /* USB FIFO Data */
3274#define USB_FIFOB1 0xFFCC1024 /* USB FIFO Data */
3275#define USB_FIFOB2 0xFFCC1028 /* USB FIFO Data */
3276#define USB_FIFOB3 0xFFCC102C /* USB FIFO Data */
3277#define USB_FIFOB4 0xFFCC1030 /* USB FIFO Data */
3278#define USB_FIFOB5 0xFFCC1034 /* USB FIFO Data */
3279#define USB_FIFOB6 0xFFCC1038 /* USB FIFO Data */
3280#define USB_FIFOB7 0xFFCC103C /* USB FIFO Data */
3281#define USB_FIFOB8 0xFFCC1040 /* USB FIFO Data */
3282#define USB_FIFOB9 0xFFCC1044 /* USB FIFO Data */
3283#define USB_FIFOB10 0xFFCC1048 /* USB FIFO Data */
3284#define USB_FIFOB11 0xFFCC104C /* USB FIFO Data */
3285#define USB_FIFOH0 0xFFCC1020 /* USB FIFO Data */
3286#define USB_FIFOH1 0xFFCC1024 /* USB FIFO Data */
3287#define USB_FIFOH2 0xFFCC1028 /* USB FIFO Data */
3288#define USB_FIFOH3 0xFFCC102C /* USB FIFO Data */
3289#define USB_FIFOH4 0xFFCC1030 /* USB FIFO Data */
3290#define USB_FIFOH5 0xFFCC1034 /* USB FIFO Data */
3291#define USB_FIFOH6 0xFFCC1038 /* USB FIFO Data */
3292#define USB_FIFOH7 0xFFCC103C /* USB FIFO Data */
3293#define USB_FIFOH8 0xFFCC1040 /* USB FIFO Data */
3294#define USB_FIFOH9 0xFFCC1044 /* USB FIFO Data */
3295#define USB_FIFOH10 0xFFCC1048 /* USB FIFO Data */
3296#define USB_FIFOH11 0xFFCC104C /* USB FIFO Data */
3297#define USB_FIFO0 0xFFCC1020 /* USB FIFO Data */
3298#define USB_EP0_FIFO 0xFFCC1020
3299#define USB_FIFO1 0xFFCC1024 /* USB FIFO Data */
3300#define USB_FIFO2 0xFFCC1028 /* USB FIFO Data */
3301#define USB_FIFO3 0xFFCC102C /* USB FIFO Data */
3302#define USB_FIFO4 0xFFCC1030 /* USB FIFO Data */
3303#define USB_FIFO5 0xFFCC1034 /* USB FIFO Data */
3304#define USB_FIFO6 0xFFCC1038 /* USB FIFO Data */
3305#define USB_FIFO7 0xFFCC103C /* USB FIFO Data */
3306#define USB_FIFO8 0xFFCC1040 /* USB FIFO Data */
3307#define USB_FIFO9 0xFFCC1044 /* USB FIFO Data */
3308#define USB_FIFO10 0xFFCC1048 /* USB FIFO Data */
3309#define USB_FIFO11 0xFFCC104C /* USB FIFO Data */
3310#define USB_OTG_DEV_CTL 0xFFCC1060 /* USB Device Control */
3311#define USB_TXFIFOSZ 0xFFCC1062 /* USB Transmit FIFO Size */
3312#define USB_RXFIFOSZ 0xFFCC1063 /* USB Receive FIFO Size */
3313#define USB_TXFIFOADDR 0xFFCC1064 /* USB Transmit FIFO Address */
3314#define USB_RXFIFOADDR 0xFFCC1066 /* USB Receive FIFO Address */
3315#define USB_VENDSTAT 0xFFCC1068 /* USB Vendor Status */
3316#define USB_HWVERS 0xFFCC106C /* USB Hardware Version */
3317#define USB_EPINFO 0xFFCC1078 /* USB Endpoint Info */
3318#define USB_RAMINFO 0xFFCC1079 /* USB Ram Information */
3319#define USB_LINKINFO 0xFFCC107A /* USB Programmable Delay Values */
3320#define USB_VPLEN 0xFFCC107B /* USB VBus Pulse Duration */
3321#define USB_HS_EOF1 0xFFCC107C /* USB High Speed End of Frame Remaining */
3322#define USB_FS_EOF1 0xFFCC107D /* USB Full Speed End of Frame Remaining */
3323#define USB_LS_EOF1 0xFFCC107E /* USB Low Speed End of Frame Remaining */
3324#define USB_SOFT_RST 0xFFCC107F /* USB Software Reset */
3325#define USB_TXFUNCADDR0 0xFFCC1080 /* USB Transmit Function Address */
3326#define USB_TXFUNCADDR1 0xFFCC1088 /* USB Transmit Function Address */
3327#define USB_TXFUNCADDR2 0xFFCC1090 /* USB Transmit Function Address */
3328#define USB_TXFUNCADDR3 0xFFCC1098 /* USB Transmit Function Address */
3329#define USB_TXFUNCADDR4 0xFFCC10A0 /* USB Transmit Function Address */
3330#define USB_TXFUNCADDR5 0xFFCC10A8 /* USB Transmit Function Address */
3331#define USB_TXFUNCADDR6 0xFFCC10B0 /* USB Transmit Function Address */
3332#define USB_TXFUNCADDR7 0xFFCC10B8 /* USB Transmit Function Address */
3333#define USB_TXFUNCADDR8 0xFFCC10C0 /* USB Transmit Function Address */
3334#define USB_TXFUNCADDR9 0xFFCC10C8 /* USB Transmit Function Address */
3335#define USB_TXFUNCADDR10 0xFFCC10D0 /* USB Transmit Function Address */
3336#define USB_TXFUNCADDR11 0xFFCC10D8 /* USB Transmit Function Address */
3337#define USB_TXHUBADDR0 0xFFCC1082 /* USB Transmit Hub Address */
3338#define USB_TXHUBADDR1 0xFFCC108A /* USB Transmit Hub Address */
3339#define USB_TXHUBADDR2 0xFFCC1092 /* USB Transmit Hub Address */
3340#define USB_TXHUBADDR3 0xFFCC109A /* USB Transmit Hub Address */
3341#define USB_TXHUBADDR4 0xFFCC10A2 /* USB Transmit Hub Address */
3342#define USB_TXHUBADDR5 0xFFCC10AA /* USB Transmit Hub Address */
3343#define USB_TXHUBADDR6 0xFFCC10B2 /* USB Transmit Hub Address */
3344#define USB_TXHUBADDR7 0xFFCC10BA /* USB Transmit Hub Address */
3345#define USB_TXHUBADDR8 0xFFCC10C2 /* USB Transmit Hub Address */
3346#define USB_TXHUBADDR9 0xFFCC10CA /* USB Transmit Hub Address */
3347#define USB_TXHUBADDR10 0xFFCC10D2 /* USB Transmit Hub Address */
3348#define USB_TXHUBADDR11 0xFFCC10DA /* USB Transmit Hub Address */
3349#define USB_TXHUBPORT0 0xFFCC1083 /* USB Transmit Hub Port */
3350#define USB_TXHUBPORT1 0xFFCC108B /* USB Transmit Hub Port */
3351#define USB_TXHUBPORT2 0xFFCC1093 /* USB Transmit Hub Port */
3352#define USB_TXHUBPORT3 0xFFCC109B /* USB Transmit Hub Port */
3353#define USB_TXHUBPORT4 0xFFCC10A3 /* USB Transmit Hub Port */
3354#define USB_TXHUBPORT5 0xFFCC10AB /* USB Transmit Hub Port */
3355#define USB_TXHUBPORT6 0xFFCC10B3 /* USB Transmit Hub Port */
3356#define USB_TXHUBPORT7 0xFFCC10BB /* USB Transmit Hub Port */
3357#define USB_TXHUBPORT8 0xFFCC10C3 /* USB Transmit Hub Port */
3358#define USB_TXHUBPORT9 0xFFCC10CB /* USB Transmit Hub Port */
3359#define USB_TXHUBPORT10 0xFFCC10D3 /* USB Transmit Hub Port */
3360#define USB_TXHUBPORT11 0xFFCC10DB /* USB Transmit Hub Port */
3361#define USB_RXFUNCADDR0 0xFFCC1084 /* USB Receive Function Address */
3362#define USB_RXFUNCADDR1 0xFFCC108C /* USB Receive Function Address */
3363#define USB_RXFUNCADDR2 0xFFCC1094 /* USB Receive Function Address */
3364#define USB_RXFUNCADDR3 0xFFCC109C /* USB Receive Function Address */
3365#define USB_RXFUNCADDR4 0xFFCC10A4 /* USB Receive Function Address */
3366#define USB_RXFUNCADDR5 0xFFCC10AC /* USB Receive Function Address */
3367#define USB_RXFUNCADDR6 0xFFCC10B4 /* USB Receive Function Address */
3368#define USB_RXFUNCADDR7 0xFFCC10BC /* USB Receive Function Address */
3369#define USB_RXFUNCADDR8 0xFFCC10C4 /* USB Receive Function Address */
3370#define USB_RXFUNCADDR9 0xFFCC10CC /* USB Receive Function Address */
3371#define USB_RXFUNCADDR10 0xFFCC10D4 /* USB Receive Function Address */
3372#define USB_RXFUNCADDR11 0xFFCC10DC /* USB Receive Function Address */
3373#define USB_RXHUBADDR0 0xFFCC1086 /* USB Receive Hub Address */
3374#define USB_RXHUBADDR1 0xFFCC108E /* USB Receive Hub Address */
3375#define USB_RXHUBADDR2 0xFFCC1096 /* USB Receive Hub Address */
3376#define USB_RXHUBADDR3 0xFFCC109E /* USB Receive Hub Address */
3377#define USB_RXHUBADDR4 0xFFCC10A6 /* USB Receive Hub Address */
3378#define USB_RXHUBADDR5 0xFFCC10AE /* USB Receive Hub Address */
3379#define USB_RXHUBADDR6 0xFFCC10B6 /* USB Receive Hub Address */
3380#define USB_RXHUBADDR7 0xFFCC10BE /* USB Receive Hub Address */
3381#define USB_RXHUBADDR8 0xFFCC10C6 /* USB Receive Hub Address */
3382#define USB_RXHUBADDR9 0xFFCC10CE /* USB Receive Hub Address */
3383#define USB_RXHUBADDR10 0xFFCC10D6 /* USB Receive Hub Address */
3384#define USB_RXHUBADDR11 0xFFCC10DE /* USB Receive Hub Address */
3385#define USB_RXHUBPORT0 0xFFCC1087 /* USB Receive Hub Port */
3386#define USB_RXHUBPORT1 0xFFCC108F /* USB Receive Hub Port */
3387#define USB_RXHUBPORT2 0xFFCC1097 /* USB Receive Hub Port */
3388#define USB_RXHUBPORT3 0xFFCC109F /* USB Receive Hub Port */
3389#define USB_RXHUBPORT4 0xFFCC10A7 /* USB Receive Hub Port */
3390#define USB_RXHUBPORT5 0xFFCC10AF /* USB Receive Hub Port */
3391#define USB_RXHUBPORT6 0xFFCC10B7 /* USB Receive Hub Port */
3392#define USB_RXHUBPORT7 0xFFCC10BF /* USB Receive Hub Port */
3393#define USB_RXHUBPORT8 0xFFCC10C7 /* USB Receive Hub Port */
3394#define USB_RXHUBPORT9 0xFFCC10CF /* USB Receive Hub Port */
3395#define USB_RXHUBPORT10 0xFFCC10D7 /* USB Receive Hub Port */
3396#define USB_RXHUBPORT11 0xFFCC10DF /* USB Receive Hub Port */
3397#define USB_EP0_CSR0_H 0xFFCC1102 /* USB Config and Status EP0 */
3398#define USB_EP0_CSR0_P 0xFFCC1102 /* USB Config and Status EP0 */
3399#define USB_EP0_CNT0 0xFFCC1108 /* USB Number of Received Bytes for Endpoint 0 */
3400#define USB_EP0_TYPE0 0xFFCC110A /* USB Speed for Endpoint 0 */
3401#define USB_EP0_NAKLIMIT0 0xFFCC110B /* USB NAK Response Timeout for Endpoint 0 */
3402#define USB_EP0_CFGDATA0 0xFFCC110F /* USB Configuration Information */
3403#define USB_EP_TXMAXP0 0xFFCC1110 /* USB Transmit Maximum Packet Length */
3404#define USB_EP_TXMAXP1 0xFFCC1120 /* USB Transmit Maximum Packet Length */
3405#define USB_EP_TXMAXP2 0xFFCC1130 /* USB Transmit Maximum Packet Length */
3406#define USB_EP_TXMAXP3 0xFFCC1140 /* USB Transmit Maximum Packet Length */
3407#define USB_EP_TXMAXP4 0xFFCC1150 /* USB Transmit Maximum Packet Length */
3408#define USB_EP_TXMAXP5 0xFFCC1160 /* USB Transmit Maximum Packet Length */
3409#define USB_EP_TXMAXP6 0xFFCC1170 /* USB Transmit Maximum Packet Length */
3410#define USB_EP_TXMAXP7 0xFFCC1180 /* USB Transmit Maximum Packet Length */
3411#define USB_EP_TXMAXP8 0xFFCC1190 /* USB Transmit Maximum Packet Length */
3412#define USB_EP_TXMAXP9 0xFFCC11A0 /* USB Transmit Maximum Packet Length */
3413#define USB_EP_TXMAXP10 0xFFCC11B0 /* USB Transmit Maximum Packet Length */
3414#define USB_EP_TXCSR0_H 0xFFCC1112 /* USB Transmit Configuration and Status */
3415#define USB_EP_TXCSR1_H 0xFFCC1122 /* USB Transmit Configuration and Status */
3416#define USB_EP_TXCSR2_H 0xFFCC1132 /* USB Transmit Configuration and Status */
3417#define USB_EP_TXCSR3_H 0xFFCC1142 /* USB Transmit Configuration and Status */
3418#define USB_EP_TXCSR4_H 0xFFCC1152 /* USB Transmit Configuration and Status */
3419#define USB_EP_TXCSR5_H 0xFFCC1162 /* USB Transmit Configuration and Status */
3420#define USB_EP_TXCSR6_H 0xFFCC1172 /* USB Transmit Configuration and Status */
3421#define USB_EP_TXCSR7_H 0xFFCC1182 /* USB Transmit Configuration and Status */
3422#define USB_EP_TXCSR8_H 0xFFCC1192 /* USB Transmit Configuration and Status */
3423#define USB_EP_TXCSR9_H 0xFFCC11A2 /* USB Transmit Configuration and Status */
3424#define USB_EP_TXCSR10_H 0xFFCC11B2 /* USB Transmit Configuration and Status */
3425#define USB_EP_TXCSR0_P 0xFFCC1112 /* USB Transmit Configuration and Status */
3426#define USB_EP_TXCSR1_P 0xFFCC1122 /* USB Transmit Configuration and Status */
3427#define USB_EP_TXCSR2_P 0xFFCC1132 /* USB Transmit Configuration and Status */
3428#define USB_EP_TXCSR3_P 0xFFCC1142 /* USB Transmit Configuration and Status */
3429#define USB_EP_TXCSR4_P 0xFFCC1152 /* USB Transmit Configuration and Status */
3430#define USB_EP_TXCSR5_P 0xFFCC1162 /* USB Transmit Configuration and Status */
3431#define USB_EP_TXCSR6_P 0xFFCC1172 /* USB Transmit Configuration and Status */
3432#define USB_EP_TXCSR7_P 0xFFCC1182 /* USB Transmit Configuration and Status */
3433#define USB_EP_TXCSR8_P 0xFFCC1192 /* USB Transmit Configuration and Status */
3434#define USB_EP_TXCSR9_P 0xFFCC11A2 /* USB Transmit Configuration and Status */
3435#define USB_EP_TXCSR10_P 0xFFCC11B2 /* USB Transmit Configuration and Status */
3436#define USB_EP_RXMAXP0 0xFFCC1114 /* USB Receive Maximum Packet Length */
3437#define USB_EP_RXMAXP1 0xFFCC1124 /* USB Receive Maximum Packet Length */
3438#define USB_EP_RXMAXP2 0xFFCC1134 /* USB Receive Maximum Packet Length */
3439#define USB_EP_RXMAXP3 0xFFCC1144 /* USB Receive Maximum Packet Length */
3440#define USB_EP_RXMAXP4 0xFFCC1154 /* USB Receive Maximum Packet Length */
3441#define USB_EP_RXMAXP5 0xFFCC1164 /* USB Receive Maximum Packet Length */
3442#define USB_EP_RXMAXP6 0xFFCC1174 /* USB Receive Maximum Packet Length */
3443#define USB_EP_RXMAXP7 0xFFCC1184 /* USB Receive Maximum Packet Length */
3444#define USB_EP_RXMAXP8 0xFFCC1194 /* USB Receive Maximum Packet Length */
3445#define USB_EP_RXMAXP9 0xFFCC11A4 /* USB Receive Maximum Packet Length */
3446#define USB_EP_RXMAXP10 0xFFCC11B4 /* USB Receive Maximum Packet Length */
3447#define USB_EP_RXCSR0_H 0xFFCC1116 /* USB Receive Configuration and Status Register */
3448#define USB_EP_RXCSR1_H 0xFFCC1126 /* USB Receive Configuration and Status Register */
3449#define USB_EP_RXCSR2_H 0xFFCC1136 /* USB Receive Configuration and Status Register */
3450#define USB_EP_RXCSR3_H 0xFFCC1146 /* USB Receive Configuration and Status Register */
3451#define USB_EP_RXCSR4_H 0xFFCC1156 /* USB Receive Configuration and Status Register */
3452#define USB_EP_RXCSR5_H 0xFFCC1166 /* USB Receive Configuration and Status Register */
3453#define USB_EP_RXCSR6_H 0xFFCC1176 /* USB Receive Configuration and Status Register */
3454#define USB_EP_RXCSR7_H 0xFFCC1186 /* USB Receive Configuration and Status Register */
3455#define USB_EP_RXCSR8_H 0xFFCC1196 /* USB Receive Configuration and Status Register */
3456#define USB_EP_RXCSR9_H 0xFFCC11A6 /* USB Receive Configuration and Status Register */
3457#define USB_EP_RXCSR10_H 0xFFCC11B6 /* USB Receive Configuration and Status Register */
3458#define USB_EP_RXCSR0_P 0xFFCC1116 /* USB Receive Configuration and Status Register */
3459#define USB_EP_RXCSR1_P 0xFFCC1126 /* USB Receive Configuration and Status Register */
3460#define USB_EP_RXCSR2_P 0xFFCC1136 /* USB Receive Configuration and Status Register */
3461#define USB_EP_RXCSR3_P 0xFFCC1146 /* USB Receive Configuration and Status Register */
3462#define USB_EP_RXCSR4_P 0xFFCC1156 /* USB Receive Configuration and Status Register */
3463#define USB_EP_RXCSR5_P 0xFFCC1166 /* USB Receive Configuration and Status Register */
3464#define USB_EP_RXCSR6_P 0xFFCC1176 /* USB Receive Configuration and Status Register */
3465#define USB_EP_RXCSR7_P 0xFFCC1186 /* USB Receive Configuration and Status Register */
3466#define USB_EP_RXCSR8_P 0xFFCC1196 /* USB Receive Configuration and Status Register */
3467#define USB_EP_RXCSR9_P 0xFFCC11A6 /* USB Receive Configuration and Status Register */
3468#define USB_EP_RXCSR10_P 0xFFCC11B6 /* USB Receive Configuration and Status Register */
3469#define USB_EP_RXCNT0 0xFFCC1118 /* USB Number of Byte Received */
3470#define USB_EP_RXCNT1 0xFFCC1128 /* USB Number of Byte Received */
3471#define USB_EP_RXCNT2 0xFFCC1138 /* USB Number of Byte Received */
3472#define USB_EP_RXCNT3 0xFFCC1148 /* USB Number of Byte Received */
3473#define USB_EP_RXCNT4 0xFFCC1158 /* USB Number of Byte Received */
3474#define USB_EP_RXCNT5 0xFFCC1168 /* USB Number of Byte Received */
3475#define USB_EP_RXCNT6 0xFFCC1178 /* USB Number of Byte Received */
3476#define USB_EP_RXCNT7 0xFFCC1188 /* USB Number of Byte Received */
3477#define USB_EP_RXCNT8 0xFFCC1198 /* USB Number of Byte Received */
3478#define USB_EP_RXCNT9 0xFFCC11A8 /* USB Number of Byte Received */
3479#define USB_EP_RXCNT10 0xFFCC11B8 /* USB Number of Byte Received */
3480#define USB_EP_TXTYPE0 0xFFCC111A /* USB Transmit Type */
3481#define USB_EP_TXTYPE1 0xFFCC112A /* USB Transmit Type */
3482#define USB_EP_TXTYPE2 0xFFCC113A /* USB Transmit Type */
3483#define USB_EP_TXTYPE3 0xFFCC114A /* USB Transmit Type */
3484#define USB_EP_TXTYPE4 0xFFCC115A /* USB Transmit Type */
3485#define USB_EP_TXTYPE5 0xFFCC116A /* USB Transmit Type */
3486#define USB_EP_TXTYPE6 0xFFCC117A /* USB Transmit Type */
3487#define USB_EP_TXTYPE7 0xFFCC118A /* USB Transmit Type */
3488#define USB_EP_TXTYPE8 0xFFCC119A /* USB Transmit Type */
3489#define USB_EP_TXTYPE9 0xFFCC11AA /* USB Transmit Type */
3490#define USB_EP_TXTYPE10 0xFFCC11BA /* USB Transmit Type */
3491#define USB_EP_TXINTERVAL0 0xFFCC111B /* USB Transmit Polling Interval */
3492#define USB_EP_TXINTERVAL1 0xFFCC112B /* USB Transmit Polling Interval */
3493#define USB_EP_TXINTERVAL2 0xFFCC113B /* USB Transmit Polling Interval */
3494#define USB_EP_TXINTERVAL3 0xFFCC114B /* USB Transmit Polling Interval */
3495#define USB_EP_TXINTERVAL4 0xFFCC115B /* USB Transmit Polling Interval */
3496#define USB_EP_TXINTERVAL5 0xFFCC116B /* USB Transmit Polling Interval */
3497#define USB_EP_TXINTERVAL6 0xFFCC117B /* USB Transmit Polling Interval */
3498#define USB_EP_TXINTERVAL7 0xFFCC118B /* USB Transmit Polling Interval */
3499#define USB_EP_TXINTERVAL8 0xFFCC119B /* USB Transmit Polling Interval */
3500#define USB_EP_TXINTERVAL9 0xFFCC11AB /* USB Transmit Polling Interval */
3501#define USB_EP_TXINTERVAL10 0xFFCC11BB /* USB Transmit Polling Interval */
3502#define USB_EP_RXTYPE0 0xFFCC111C /* USB Receive Type */
3503#define USB_EP_RXTYPE1 0xFFCC112C /* USB Receive Type */
3504#define USB_EP_RXTYPE2 0xFFCC113C /* USB Receive Type */
3505#define USB_EP_RXTYPE3 0xFFCC114C /* USB Receive Type */
3506#define USB_EP_RXTYPE4 0xFFCC115C /* USB Receive Type */
3507#define USB_EP_RXTYPE5 0xFFCC116C /* USB Receive Type */
3508#define USB_EP_RXTYPE6 0xFFCC117C /* USB Receive Type */
3509#define USB_EP_RXTYPE7 0xFFCC118C /* USB Receive Type */
3510#define USB_EP_RXTYPE8 0xFFCC119C /* USB Receive Type */
3511#define USB_EP_RXTYPE9 0xFFCC11AC /* USB Receive Type */
3512#define USB_EP_RXTYPE10 0xFFCC11BC /* USB Receive Type */
3513#define USB_EP_RXINTERVAL0 0xFFCC111D /* USB Receive Polling Interval */
3514#define USB_EP_RXINTERVAL1 0xFFCC112D /* USB Receive Polling Interval */
3515#define USB_EP_RXINTERVAL2 0xFFCC113D /* USB Receive Polling Interval */
3516#define USB_EP_RXINTERVAL3 0xFFCC114D /* USB Receive Polling Interval */
3517#define USB_EP_RXINTERVAL4 0xFFCC115D /* USB Receive Polling Interval */
3518#define USB_EP_RXINTERVAL5 0xFFCC116D /* USB Receive Polling Interval */
3519#define USB_EP_RXINTERVAL6 0xFFCC117D /* USB Receive Polling Interval */
3520#define USB_EP_RXINTERVAL7 0xFFCC118D /* USB Receive Polling Interval */
3521#define USB_EP_RXINTERVAL8 0xFFCC119D /* USB Receive Polling Interval */
3522#define USB_EP_RXINTERVAL9 0xFFCC11AD /* USB Receive Polling Interval */
3523#define USB_EP_RXINTERVAL10 0xFFCC11BD /* USB Receive Polling Interval */
3524#define USB_DMA_IRQ 0xFFCC1200 /* USB Interrupt Register */
3525#define USB_DMA_CTL0 0xFFCC1204 /* USB DMA Control */
3526#define USB_DMA_CTL1 0xFFCC1214 /* USB DMA Control */
3527#define USB_DMA_CTL2 0xFFCC1224 /* USB DMA Control */
3528#define USB_DMA_CTL3 0xFFCC1234 /* USB DMA Control */
3529#define USB_DMA_CTL4 0xFFCC1244 /* USB DMA Control */
3530#define USB_DMA_CTL5 0xFFCC1254 /* USB DMA Control */
3531#define USB_DMA_CTL6 0xFFCC1264 /* USB DMA Control */
3532#define USB_DMA_CTL7 0xFFCC1274 /* USB DMA Control */
3533#define USB_DMA_ADDR0 0xFFCC1208 /* USB DMA Address */
3534#define USB_DMA_ADDR1 0xFFCC1218 /* USB DMA Address */
3535#define USB_DMA_ADDR2 0xFFCC1228 /* USB DMA Address */
3536#define USB_DMA_ADDR3 0xFFCC1238 /* USB DMA Address */
3537#define USB_DMA_ADDR4 0xFFCC1248 /* USB DMA Address */
3538#define USB_DMA_ADDR5 0xFFCC1258 /* USB DMA Address */
3539#define USB_DMA_ADDR6 0xFFCC1268 /* USB DMA Address */
3540#define USB_DMA_ADDR7 0xFFCC1278 /* USB DMA Address */
3541#define USB_DMA_CNT0 0xFFCC120C /* USB DMA Count */
3542#define USB_DMA_CNT1 0xFFCC121C /* USB DMA Count */
3543#define USB_DMA_CNT2 0xFFCC122C /* USB DMA Count */
3544#define USB_DMA_CNT3 0xFFCC123C /* USB DMA Count */
3545#define USB_DMA_CNT4 0xFFCC124C /* USB DMA Count */
3546#define USB_DMA_CNT5 0xFFCC125C /* USB DMA Count */
3547#define USB_DMA_CNT6 0xFFCC126C /* USB DMA Count */
3548#define USB_DMA_CNT7 0xFFCC127C /* USB DMA Count */
3549#define USB_RQPKTCNT0 0xFFCC1300 /* USB Request Packet Count */
3550#define USB_RQPKTCNT1 0xFFCC1304 /* USB Request Packet Count */
3551#define USB_RQPKTCNT2 0xFFCC1308 /* USB Request Packet Count */
3552#define USB_RQPKTCNT3 0xFFCC130C /* USB Request Packet Count */
3553#define USB_RQPKTCNT4 0xFFCC1310 /* USB Request Packet Count */
3554#define USB_RQPKTCNT5 0xFFCC1314 /* USB Request Packet Count */
3555#define USB_RQPKTCNT6 0xFFCC1318 /* USB Request Packet Count */
3556#define USB_RQPKTCNT7 0xFFCC131C /* USB Request Packet Count */
3557#define USB_RQPKTCNT8 0xFFCC1320 /* USB Request Packet Count */
3558#define USB_RQPKTCNT9 0xFFCC1324 /* USB Request Packet Count */
3559#define USB_RQPKTCNT10 0xFFCC1328 /* USB Request Packet Count */
3560#define USB_CT_UCH 0xFFCC1344 /* USB Chirp Timeout */
3561#define USB_CT_HHSRTN 0xFFCC1346 /* USB High Speed Resume Return to Normal */
3562#define USB_CT_HSBT 0xFFCC1348 /* USB High Speed Timeout */
3563#define USB_LPM_ATTR 0xFFCC1360 /* USB LPM Attribute */
3564#define USB_LPM_CTL 0xFFCC1362 /* USB LPM Control */
3565#define USB_LPM_IEN 0xFFCC1363 /* USB LPM Interrupt Enable */
3566#define USB_LPM_IRQ 0xFFCC1364 /* USB LPM Interrupt */
3567#define USB_LPM_FADDR 0xFFCC1365 /* USB LPM Function Address */
3568#define USB_VBUS_CTL 0xFFCC1380 /* USB VBus Control */
3569#define USB_BAT_CHG 0xFFCC1381 /* USB Battery Charging */
3570#define USB_PHY_CTL 0xFFCC1394 /* USB PHY Control */
3571#define USB_TESTCTL 0xFFCC1397 /* USB Test Control */
3572#define USB_PLL_OSC 0xFFCC1398 /* USB PLL and Oscillator Control */
3573
3574
3575
3576/* =========================
3577 CHIPID
3578 ========================= */
3579
3580#define CHIPID 0xffc00014
3581/* CHIPID Masks */
3582#define CHIPID_VERSION 0xF0000000
3583#define CHIPID_FAMILY 0x0FFFF000
3584#define CHIPID_MANUFACTURE 0x00000FFE
3585
3586
3587#endif /* _DEF_BF60X_H */
diff --git a/arch/blackfin/mach-bf609/include/mach/dma.h b/arch/blackfin/mach-bf609/include/mach/dma.h
new file mode 100644
index 000000000000..872d141ca119
--- /dev/null
+++ b/arch/blackfin/mach-bf609/include/mach/dma.h
@@ -0,0 +1,116 @@
1/* mach/dma.h - arch-specific DMA defines
2 *
3 * Copyright 2011 Analog Devices Inc.
4 *
5 * Licensed under the GPL-2 or later.
6 */
7
8#ifndef _MACH_DMA_H_
9#define _MACH_DMA_H_
10
11#define CH_SPORT0_TX 0
12#define CH_SPORT0_RX 1
13#define CH_SPORT1_TX 2
14#define CH_SPORT1_RX 3
15#define CH_SPORT2_TX 4
16#define CH_SPORT2_RX 5
17#define CH_SPI0_TX 6
18#define CH_SPI0_RX 7
19#define CH_SPI1_TX 8
20#define CH_SPI1_RX 9
21#define CH_RSI 10
22#define CH_SDU 11
23#define CH_LP0 13
24#define CH_LP1 14
25#define CH_LP2 15
26#define CH_LP3 16
27#define CH_UART0_TX 17
28#define CH_UART0_RX 18
29#define CH_UART1_TX 19
30#define CH_UART1_RX 20
31#define CH_MEM_STREAM0_SRC_CRC0 21
32#define CH_MEM_STREAM0_SRC CH_MEM_STREAM0_SRC_CRC0
33#define CH_MEM_STREAM0_DEST_CRC0 22
34#define CH_MEM_STREAM0_DEST CH_MEM_STREAM0_DEST_CRC0
35#define CH_MEM_STREAM1_SRC_CRC1 23
36#define CH_MEM_STREAM1_SRC CH_MEM_STREAM1_SRC_CRC1
37#define CH_MEM_STREAM1_DEST_CRC1 24
38#define CH_MEM_STREAM1_DEST CH_MEM_STREAM1_DEST_CRC1
39#define CH_MEM_STREAM2_SRC 25
40#define CH_MEM_STREAM2_DEST 26
41#define CH_MEM_STREAM3_SRC 27
42#define CH_MEM_STREAM3_DEST 28
43#define CH_EPPI0_CH0 29
44#define CH_EPPI0_CH1 30
45#define CH_EPPI1_CH0 31
46#define CH_EPPI1_CH1 32
47#define CH_EPPI2_CH0 33
48#define CH_EPPI2_CH1 34
49#define CH_PIXC_CH0 35
50#define CH_PIXC_CH1 36
51#define CH_PIXC_CH2 37
52#define CH_PVP_CPDOB 38
53#define CH_PVP_CPDOC 39
54#define CH_PVP_CPSTAT 40
55#define CH_PVP_CPCI 41
56#define CH_PVP_MPDO 42
57#define CH_PVP_MPDI 43
58#define CH_PVP_MPSTAT 44
59#define CH_PVP_MPCI 45
60#define CH_PVP_CPDOA 46
61
62#define MAX_DMA_CHANNELS 47
63#define MAX_DMA_SUSPEND_CHANNELS 0
64#define DMA_MMR_SIZE_32
65
66#define bfin_read_MDMA_S0_CONFIG bfin_read_MDMA0_SRC_CRC0_CONFIG
67#define bfin_write_MDMA_S0_CONFIG bfin_write_MDMA0_SRC_CRC0_CONFIG
68#define bfin_read_MDMA_S0_IRQ_STATUS bfin_read_MDMA0_SRC_CRC0_IRQ_STATUS
69#define bfin_write_MDMA_S0_IRQ_STATUS bfin_write_MDMA0_SRC_CRC0_IRQ_STATUS
70#define bfin_write_MDMA_S0_START_ADDR bfin_write_MDMA0_SRC_CRC0_START_ADDR
71#define bfin_write_MDMA_S0_X_COUNT bfin_write_MDMA0_SRC_CRC0_X_COUNT
72#define bfin_write_MDMA_S0_X_MODIFY bfin_write_MDMA0_SRC_CRC0_X_MODIFY
73#define bfin_write_MDMA_S0_Y_COUNT bfin_write_MDMA0_SRC_CRC0_Y_COUNT
74#define bfin_write_MDMA_S0_Y_MODIFY bfin_write_MDMA0_SRC_CRC0_Y_MODIFY
75#define bfin_read_MDMA_D0_CONFIG bfin_read_MDMA0_DEST_CRC0_CONFIG
76#define bfin_write_MDMA_D0_CONFIG bfin_write_MDMA0_DEST_CRC0_CONFIG
77#define bfin_read_MDMA_D0_IRQ_STATUS bfin_read_MDMA0_DEST_CRC0_IRQ_STATUS
78#define bfin_write_MDMA_D0_IRQ_STATUS bfin_write_MDMA0_DEST_CRC0_IRQ_STATUS
79#define bfin_write_MDMA_D0_START_ADDR bfin_write_MDMA0_DEST_CRC0_START_ADDR
80#define bfin_write_MDMA_D0_X_COUNT bfin_write_MDMA0_DEST_CRC0_X_COUNT
81#define bfin_write_MDMA_D0_X_MODIFY bfin_write_MDMA0_DEST_CRC0_X_MODIFY
82#define bfin_write_MDMA_D0_Y_COUNT bfin_write_MDMA0_DEST_CRC0_Y_COUNT
83#define bfin_write_MDMA_D0_Y_MODIFY bfin_write_MDMA0_DEST_CRC0_Y_MODIFY
84
85#define bfin_read_MDMA_S1_CONFIG bfin_read_MDMA1_SRC_CRC1_CONFIG
86#define bfin_write_MDMA_S1_CONFIG bfin_write_MDMA1_SRC_CRC1_CONFIG
87#define bfin_read_MDMA_D1_CONFIG bfin_read_MDMA1_DEST_CRC1_CONFIG
88#define bfin_write_MDMA_D1_CONFIG bfin_write_MDMA1_DEST_CRC1_CONFIG
89#define bfin_read_MDMA_D1_IRQ_STATUS bfin_read_MDMA1_DEST_CRC1_IRQ_STATUS
90#define bfin_write_MDMA_D1_IRQ_STATUS bfin_write_MDMA1_DEST_CRC1_IRQ_STATUS
91
92#define bfin_read_MDMA_S3_CONFIG bfin_read_MDMA3_SRC_CONFIG
93#define bfin_write_MDMA_S3_CONFIG bfin_write_MDMA3_SRC_CONFIG
94#define bfin_read_MDMA_S3_IRQ_STATUS bfin_read_MDMA3_SRC_IRQ_STATUS
95#define bfin_write_MDMA_S3_IRQ_STATUS bfin_write_MDMA3_SRC_IRQ_STATUS
96#define bfin_write_MDMA_S3_START_ADDR bfin_write_MDMA3_SRC_START_ADDR
97#define bfin_write_MDMA_S3_X_COUNT bfin_write_MDMA3_SRC_X_COUNT
98#define bfin_write_MDMA_S3_X_MODIFY bfin_write_MDMA3_SRC_X_MODIFY
99#define bfin_write_MDMA_S3_Y_COUNT bfin_write_MDMA3_SRC_Y_COUNT
100#define bfin_write_MDMA_S3_Y_MODIFY bfin_write_MDMA3_SRC_Y_MODIFY
101#define bfin_read_MDMA_D3_CONFIG bfin_read_MDMA3_DEST_CONFIG
102#define bfin_write_MDMA_D3_CONFIG bfin_write_MDMA3_DEST_CONFIG
103#define bfin_read_MDMA_D3_IRQ_STATUS bfin_read_MDMA3_DEST_IRQ_STATUS
104#define bfin_write_MDMA_D3_IRQ_STATUS bfin_write_MDMA3_DEST_IRQ_STATUS
105#define bfin_write_MDMA_D3_START_ADDR bfin_write_MDMA3_DEST_START_ADDR
106#define bfin_write_MDMA_D3_X_COUNT bfin_write_MDMA3_DEST_X_COUNT
107#define bfin_write_MDMA_D3_X_MODIFY bfin_write_MDMA3_DEST_X_MODIFY
108#define bfin_write_MDMA_D3_Y_COUNT bfin_write_MDMA3_DEST_Y_COUNT
109#define bfin_write_MDMA_D3_Y_MODIFY bfin_write_MDMA3_DEST_Y_MODIFY
110
111#define MDMA_S0_NEXT_DESC_PTR MDMA0_SRC_CRC0_NEXT_DESC_PTR
112#define MDMA_D0_NEXT_DESC_PTR MDMA0_DEST_CRC0_NEXT_DESC_PTR
113#define MDMA_S1_NEXT_DESC_PTR MDMA1_SRC_CRC1_NEXT_DESC_PTR
114#define MDMA_D1_NEXT_DESC_PTR MDMA1_DEST_CRC1_NEXT_DESC_PTR
115
116#endif
diff --git a/arch/blackfin/mach-bf609/include/mach/gpio.h b/arch/blackfin/mach-bf609/include/mach/gpio.h
new file mode 100644
index 000000000000..127586b1e04a
--- /dev/null
+++ b/arch/blackfin/mach-bf609/include/mach/gpio.h
@@ -0,0 +1,171 @@
1/*
2 * Copyright 2007-2009 Analog Devices Inc.
3 * Licensed under the GPL-2 or later.
4 */
5
6#ifndef _MACH_GPIO_H_
7#define _MACH_GPIO_H_
8
9#define MAX_BLACKFIN_GPIOS 112
10
11#define GPIO_PA0 0
12#define GPIO_PA1 1
13#define GPIO_PA2 2
14#define GPIO_PA3 3
15#define GPIO_PA4 4
16#define GPIO_PA5 5
17#define GPIO_PA6 6
18#define GPIO_PA7 7
19#define GPIO_PA8 8
20#define GPIO_PA9 9
21#define GPIO_PA10 10
22#define GPIO_PA11 11
23#define GPIO_PA12 12
24#define GPIO_PA13 13
25#define GPIO_PA14 14
26#define GPIO_PA15 15
27#define GPIO_PB0 16
28#define GPIO_PB1 17
29#define GPIO_PB2 18
30#define GPIO_PB3 19
31#define GPIO_PB4 20
32#define GPIO_PB5 21
33#define GPIO_PB6 22
34#define GPIO_PB7 23
35#define GPIO_PB8 24
36#define GPIO_PB9 25
37#define GPIO_PB10 26
38#define GPIO_PB11 27
39#define GPIO_PB12 28
40#define GPIO_PB13 29
41#define GPIO_PB14 30
42#define GPIO_PB15 31
43#define GPIO_PC0 32
44#define GPIO_PC1 33
45#define GPIO_PC2 34
46#define GPIO_PC3 35
47#define GPIO_PC4 36
48#define GPIO_PC5 37
49#define GPIO_PC6 38
50#define GPIO_PC7 39
51#define GPIO_PC8 40
52#define GPIO_PC9 41
53#define GPIO_PC10 42
54#define GPIO_PC11 43
55#define GPIO_PC12 44
56#define GPIO_PC13 45
57#define GPIO_PC14 46
58#define GPIO_PC15 47
59#define GPIO_PD0 48
60#define GPIO_PD1 49
61#define GPIO_PD2 50
62#define GPIO_PD3 51
63#define GPIO_PD4 52
64#define GPIO_PD5 53
65#define GPIO_PD6 54
66#define GPIO_PD7 55
67#define GPIO_PD8 56
68#define GPIO_PD9 57
69#define GPIO_PD10 58
70#define GPIO_PD11 59
71#define GPIO_PD12 60
72#define GPIO_PD13 61
73#define GPIO_PD14 62
74#define GPIO_PD15 63
75#define GPIO_PE0 64
76#define GPIO_PE1 65
77#define GPIO_PE2 66
78#define GPIO_PE3 67
79#define GPIO_PE4 68
80#define GPIO_PE5 69
81#define GPIO_PE6 70
82#define GPIO_PE7 71
83#define GPIO_PE8 72
84#define GPIO_PE9 73
85#define GPIO_PE10 74
86#define GPIO_PE11 75
87#define GPIO_PE12 76
88#define GPIO_PE13 77
89#define GPIO_PE14 78
90#define GPIO_PE15 79
91#define GPIO_PF0 80
92#define GPIO_PF1 81
93#define GPIO_PF2 82
94#define GPIO_PF3 83
95#define GPIO_PF4 84
96#define GPIO_PF5 85
97#define GPIO_PF6 86
98#define GPIO_PF7 87
99#define GPIO_PF8 88
100#define GPIO_PF9 89
101#define GPIO_PF10 90
102#define GPIO_PF11 91
103#define GPIO_PF12 92
104#define GPIO_PF13 93
105#define GPIO_PF14 94
106#define GPIO_PF15 95
107#define GPIO_PG0 96
108#define GPIO_PG1 97
109#define GPIO_PG2 98
110#define GPIO_PG3 99
111#define GPIO_PG4 100
112#define GPIO_PG5 101
113#define GPIO_PG6 102
114#define GPIO_PG7 103
115#define GPIO_PG8 104
116#define GPIO_PG9 105
117#define GPIO_PG10 106
118#define GPIO_PG11 107
119#define GPIO_PG12 108
120#define GPIO_PG13 109
121#define GPIO_PG14 110
122#define GPIO_PG15 111
123
124
125#define BFIN_GPIO_PINT 1
126
127
128#ifndef __ASSEMBLY__
129
130struct gpio_port_t {
131 unsigned long port_fer;
132 unsigned long port_fer_set;
133 unsigned long port_fer_clear;
134 unsigned long data;
135 unsigned long data_set;
136 unsigned long data_clear;
137 unsigned long dir;
138 unsigned long dir_set;
139 unsigned long dir_clear;
140 unsigned long inen;
141 unsigned long inen_set;
142 unsigned long inen_clear;
143 unsigned long port_mux;
144 unsigned long toggle;
145 unsigned long polar;
146 unsigned long polar_set;
147 unsigned long polar_clear;
148 unsigned long lock;
149 unsigned long spare;
150 unsigned long revid;
151};
152
153struct gpio_port_s {
154 unsigned short fer;
155 unsigned short data;
156 unsigned short dir;
157 unsigned short inen;
158 unsigned int mux;
159};
160
161#endif
162
163#include <mach-common/ports-a.h>
164#include <mach-common/ports-b.h>
165#include <mach-common/ports-c.h>
166#include <mach-common/ports-d.h>
167#include <mach-common/ports-e.h>
168#include <mach-common/ports-f.h>
169#include <mach-common/ports-g.h>
170
171#endif /* _MACH_GPIO_H_ */
diff --git a/arch/blackfin/mach-bf609/include/mach/irq.h b/arch/blackfin/mach-bf609/include/mach/irq.h
new file mode 100644
index 000000000000..0004552433b2
--- /dev/null
+++ b/arch/blackfin/mach-bf609/include/mach/irq.h
@@ -0,0 +1,318 @@
1/*
2 * Copyright 2011 Analog Devices Inc.
3 *
4 * Licensed under the GPL-2 or later.
5 */
6
7#ifndef _BF60x_IRQ_H_
8#define _BF60x_IRQ_H_
9
10#include <mach-common/irq.h>
11
12#undef BFIN_IRQ
13#define BFIN_IRQ(x) ((x) + IVG15)
14
15#define NR_PERI_INTS (5 * 32)
16
17#define IRQ_SEC_ERR BFIN_IRQ(0) /* SEC Error */
18#define IRQ_CGU_EVT BFIN_IRQ(1) /* CGU Event */
19#define IRQ_WATCH0 BFIN_IRQ(2) /* Watchdog0 Interrupt */
20#define IRQ_WATCH1 BFIN_IRQ(3) /* Watchdog1 Interrupt */
21#define IRQ_L2CTL0_ECC_ERR BFIN_IRQ(4) /* L2 ECC Error */
22#define IRQ_L2CTL0_ECC_WARN BFIN_IRQ(5) /* L2 ECC Waring */
23#define IRQ_C0_DBL_FAULT BFIN_IRQ(6) /* Core 0 Double Fault */
24#define IRQ_C1_DBL_FAULT BFIN_IRQ(7) /* Core 1 Double Fault */
25#define IRQ_C0_HW_ERR BFIN_IRQ(8) /* Core 0 Hardware Error */
26#define IRQ_C1_HW_ERR BFIN_IRQ(9) /* Core 1 Hardware Error */
27#define IRQ_C0_NMI_L1_PARITY_ERR BFIN_IRQ(10) /* Core 0 Unhandled NMI or L1 Memory Parity Error */
28#define IRQ_C1_NMI_L1_PARITY_ERR BFIN_IRQ(11) /* Core 1 Unhandled NMI or L1 Memory Parity Error */
29#define CORE_IRQS (IRQ_C1_NMI_L1_PARITY_ERR + 1)
30
31#define IRQ_TIMER0 BFIN_IRQ(12) /* Timer 0 Interrupt */
32#define IRQ_TIMER1 BFIN_IRQ(13) /* Timer 1 Interrupt */
33#define IRQ_TIMER2 BFIN_IRQ(14) /* Timer 2 Interrupt */
34#define IRQ_TIMER3 BFIN_IRQ(15) /* Timer 3 Interrupt */
35#define IRQ_TIMER4 BFIN_IRQ(16) /* Timer 4 Interrupt */
36#define IRQ_TIMER5 BFIN_IRQ(17) /* Timer 5 Interrupt */
37#define IRQ_TIMER6 BFIN_IRQ(18) /* Timer 6 Interrupt */
38#define IRQ_TIMER7 BFIN_IRQ(19) /* Timer 7 Interrupt */
39#define IRQ_TIMER_STAT BFIN_IRQ(20) /* Timer Block Status */
40#define IRQ_PINT0 BFIN_IRQ(21) /* PINT0 Interrupt */
41#define IRQ_PINT1 BFIN_IRQ(22) /* PINT1 Interrupt */
42#define IRQ_PINT2 BFIN_IRQ(23) /* PINT2 Interrupt */
43#define IRQ_PINT3 BFIN_IRQ(24) /* PINT3 Interrupt */
44#define IRQ_PINT4 BFIN_IRQ(25) /* PINT4 Interrupt */
45#define IRQ_PINT5 BFIN_IRQ(26) /* PINT5 Interrupt */
46#define IRQ_CNT BFIN_IRQ(27) /* CNT Interrupt */
47#define IRQ_PWM0_TRIP BFIN_IRQ(28) /* PWM0 Trip Interrupt */
48#define IRQ_PWM0_SYNC BFIN_IRQ(29) /* PWM0 Sync Interrupt */
49#define IRQ_PWM1_TRIP BFIN_IRQ(30) /* PWM1 Trip Interrupt */
50#define IRQ_PWM1_SYNC BFIN_IRQ(31) /* PWM1 Sync Interrupt */
51#define IRQ_TWI0 BFIN_IRQ(32) /* TWI0 Interrupt */
52#define IRQ_TWI1 BFIN_IRQ(33) /* TWI1 Interrupt */
53#define IRQ_SOFT0 BFIN_IRQ(34) /* Software-Driven Interrupt 0 */
54#define IRQ_SOFT1 BFIN_IRQ(35) /* Software-Driven Interrupt 1 */
55#define IRQ_SOFT2 BFIN_IRQ(36) /* Software-Driven Interrupt 2 */
56#define IRQ_SOFT3 BFIN_IRQ(37) /* Software-Driven Interrupt 3 */
57#define IRQ_ACM_EVT_MISS BFIN_IRQ(38) /* ACM Event Miss */
58#define IRQ_ACM_EVT_COMPLETE BFIN_IRQ(39) /* ACM Event Complete */
59#define IRQ_CAN0_RX BFIN_IRQ(40) /* CAN0 Receive Interrupt */
60#define IRQ_CAN0_TX BFIN_IRQ(41) /* CAN0 Transmit Interrupt */
61#define IRQ_CAN0_STAT BFIN_IRQ(42) /* CAN0 Status */
62#define IRQ_SPORT0_TX BFIN_IRQ(43) /* SPORT0 TX Interrupt (DMA0) */
63#define IRQ_SPORT0_TX_STAT BFIN_IRQ(44) /* SPORT0 TX Status Interrupt */
64#define IRQ_SPORT0_RX BFIN_IRQ(45) /* SPORT0 RX Interrupt (DMA1) */
65#define IRQ_SPORT0_RX_STAT BFIN_IRQ(46) /* SPORT0 RX Status Interrupt */
66#define IRQ_SPORT1_TX BFIN_IRQ(47) /* SPORT1 TX Interrupt (DMA2) */
67#define IRQ_SPORT1_TX_STAT BFIN_IRQ(48) /* SPORT1 TX Status Interrupt */
68#define IRQ_SPORT1_RX BFIN_IRQ(49) /* SPORT1 RX Interrupt (DMA3) */
69#define IRQ_SPORT1_RX_STAT BFIN_IRQ(50) /* SPORT1 RX Status Interrupt */
70#define IRQ_SPORT2_TX BFIN_IRQ(51) /* SPORT2 TX Interrupt (DMA4) */
71#define IRQ_SPORT2_TX_STAT BFIN_IRQ(52) /* SPORT2 TX Status Interrupt */
72#define IRQ_SPORT2_RX BFIN_IRQ(53) /* SPORT2 RX Interrupt (DMA5) */
73#define IRQ_SPORT2_RX_STAT BFIN_IRQ(54) /* SPORT2 RX Status Interrupt */
74#define IRQ_SPI0_TX BFIN_IRQ(55) /* SPI0 TX Interrupt (DMA6) */
75#define IRQ_SPI0_RX BFIN_IRQ(56) /* SPI0 RX Interrupt (DMA7) */
76#define IRQ_SPI0_STAT BFIN_IRQ(57) /* SPI0 Status Interrupt */
77#define IRQ_SPI1_TX BFIN_IRQ(58) /* SPI1 TX Interrupt (DMA8) */
78#define IRQ_SPI1_RX BFIN_IRQ(59) /* SPI1 RX Interrupt (DMA9) */
79#define IRQ_SPI1_STAT BFIN_IRQ(60) /* SPI1 Status Interrupt */
80#define IRQ_RSI BFIN_IRQ(61) /* RSI (DMA10) Interrupt */
81#define IRQ_RSI_INT0 BFIN_IRQ(62) /* RSI Interrupt0 */
82#define IRQ_RSI_INT1 BFIN_IRQ(63) /* RSI Interrupt1 */
83#define IRQ_SDU BFIN_IRQ(64) /* DMA11 Data (SDU) */
84/* -- RESERVED -- 65 DMA12 Data (Reserved) */
85/* -- RESERVED -- 66 Reserved */
86/* -- RESERVED -- 67 Reserved */
87#define IRQ_EMAC0_STAT BFIN_IRQ(68) /* EMAC0 Status */
88/* -- RESERVED -- 69 EMAC0 Power (Reserved) */
89#define IRQ_EMAC1_STAT BFIN_IRQ(70) /* EMAC1 Status */
90/* -- RESERVED -- 71 EMAC1 Power (Reserved) */
91#define IRQ_LP0 BFIN_IRQ(72) /* DMA13 Data (Link Port 0) */
92#define IRQ_LP0_STAT BFIN_IRQ(73) /* Link Port 0 Status */
93#define IRQ_LP1 BFIN_IRQ(74) /* DMA14 Data (Link Port 1) */
94#define IRQ_LP1_STAT BFIN_IRQ(75) /* Link Port 1 Status */
95#define IRQ_LP2 BFIN_IRQ(76) /* DMA15 Data (Link Port 2) */
96#define IRQ_LP2_STAT BFIN_IRQ(77) /* Link Port 2 Status */
97#define IRQ_LP3 BFIN_IRQ(78) /* DMA16 Data(Link Port 3) */
98#define IRQ_LP3_STAT BFIN_IRQ(79) /* Link Port 3 Status */
99#define IRQ_UART0_TX BFIN_IRQ(80) /* UART0 TX Interrupt (DMA17) */
100#define IRQ_UART0_RX BFIN_IRQ(81) /* UART0 RX Interrupt (DMA18) */
101#define IRQ_UART0_STAT BFIN_IRQ(82) /* UART0 Status(Error) Interrupt */
102#define IRQ_UART1_TX BFIN_IRQ(83) /* UART1 TX Interrupt (DMA19) */
103#define IRQ_UART1_RX BFIN_IRQ(84) /* UART1 RX Interrupt (DMA20) */
104#define IRQ_UART1_STAT BFIN_IRQ(85) /* UART1 Status(Error) Interrupt */
105#define IRQ_MDMA0_SRC_CRC0 BFIN_IRQ(86) /* DMA21 Data (MDMA Stream 0 Source/CRC0 Input Channel) */
106#define IRQ_MDMA0_DEST_CRC0 BFIN_IRQ(87) /* DMA22 Data (MDMA Stream 0 Destination/CRC0 Output Channel) */
107#define IRQ_MDMAS0 IRQ_MDMA0_DEST_CRC0
108#define IRQ_CRC0_DCNTEXP BFIN_IRQ(88) /* CRC0 DATACOUNT Expiration */
109#define IRQ_CRC0_ERR BFIN_IRQ(89) /* CRC0 Error */
110#define IRQ_MDMA1_SRC_CRC1 BFIN_IRQ(90) /* DMA23 Data (MDMA Stream 1 Source/CRC1 Input Channel) */
111#define IRQ_MDMA1_DEST_CRC1 BFIN_IRQ(91) /* DMA24 Data (MDMA Stream 1 Destination/CRC1 Output Channel) */
112#define IRQ_MDMAS1 IRQ_MDMA1_DEST_CRC1
113#define IRQ_CRC1_DCNTEXP BFIN_IRQ(92) /* CRC1 DATACOUNT Expiration */
114#define IRQ_CRC1_ERR BFIN_IRQ(93) /* CRC1 Error */
115#define IRQ_MDMA2_SRC BFIN_IRQ(94) /* DMA25 Data (MDMA Stream 2 Source Channel) */
116#define IRQ_MDMA2_DEST BFIN_IRQ(95) /* DMA26 Data (MDMA Stream 2 Destination Channel) */
117#define IRQ_MDMAS2 IRQ_MDMA2_DEST
118#define IRQ_MDMA3_SRC BFIN_IRQ(96) /* DMA27 Data (MDMA Stream 3 Source Channel) */
119#define IRQ_MDMA3_DEST BFIN_IRQ(97) /* DMA28 Data (MDMA Stream 3 Destination Channel) */
120#define IRQ_MDMAS3 IRQ_MDMA3_DEST
121#define IRQ_EPPI0_CH0 BFIN_IRQ(98) /* DMA29 Data (EPPI0 Channel 0) */
122#define IRQ_EPPI0_CH1 BFIN_IRQ(99) /* DMA30 Data (EPPI0 Channel 1) */
123#define IRQ_EPPI0_STAT BFIN_IRQ(100) /* EPPI0 Status */
124#define IRQ_EPPI2_CH0 BFIN_IRQ(101) /* DMA31 Data (EPPI2 Channel 0) */
125#define IRQ_EPPI2_CH1 BFIN_IRQ(102) /* DMA32 Data (EPPI2 Channel 1) */
126#define IRQ_EPPI2_STAT BFIN_IRQ(103) /* EPPI2 Status */
127#define IRQ_EPPI1_CH0 BFIN_IRQ(104) /* DMA33 Data (EPPI1 Channel 0) */
128#define IRQ_EPPI1_CH1 BFIN_IRQ(105) /* DMA34 Data (EPPI1 Channel 1) */
129#define IRQ_EPPI1_STAT BFIN_IRQ(106) /* EPPI1 Status */
130#define IRQ_PIXC_CH0 BFIN_IRQ(107) /* DMA35 Data (PIXC Channel 0) */
131#define IRQ_PIXC_CH1 BFIN_IRQ(108) /* DMA36 Data (PIXC Channel 1) */
132#define IRQ_PIXC_CH2 BFIN_IRQ(109) /* DMA37 Data (PIXC Channel 2) */
133#define IRQ_PIXC_STAT BFIN_IRQ(110) /* PIXC Status */
134#define IRQ_PVP_CPDOB BFIN_IRQ(111) /* DMA38 Data (PVP0 Camera Pipe Data Out B) */
135#define IRQ_PVP_CPDOC BFIN_IRQ(112) /* DMA39 Data (PVP0 Camera Pipe Data Out C) */
136#define IRQ_PVP_CPSTAT BFIN_IRQ(113) /* DMA40 Data (PVP0 Camera Pipe Status Out) */
137#define IRQ_PVP_CPCI BFIN_IRQ(114) /* DMA41 Data (PVP0 Camera Pipe Control In) */
138#define IRQ_PVP_STAT0 BFIN_IRQ(115) /* PVP0 Status 0 */
139#define IRQ_PVP_MPDO BFIN_IRQ(116) /* DMA42 Data (PVP0 Memory Pipe Data Out) */
140#define IRQ_PVP_MPDI BFIN_IRQ(117) /* DMA43 Data (PVP0 Memory Pipe Data In) */
141#define IRQ_PVP_MPSTAT BFIN_IRQ(118) /* DMA44 Data (PVP0 Memory Pipe Status Out) */
142#define IRQ_PVP_MPCI BFIN_IRQ(119) /* DMA45 Data (PVP0 Memory Pipe Control In) */
143#define IRQ_PVP_CPDOA BFIN_IRQ(120) /* DMA46 Data (PVP0 Camera Pipe Data Out A) */
144#define IRQ_PVP_STAT1 BFIN_IRQ(121) /* PVP0 Status 1 */
145#define IRQ_USB_STAT BFIN_IRQ(122) /* USB Status Interrupt */
146#define IRQ_USB_DMA BFIN_IRQ(123) /* USB DMA Interrupt */
147#define IRQ_TRU_INT0 BFIN_IRQ(124) /* TRU0 Interrupt 0 */
148#define IRQ_TRU_INT1 BFIN_IRQ(125) /* TRU0 Interrupt 1 */
149#define IRQ_TRU_INT2 BFIN_IRQ(126) /* TRU0 Interrupt 2 */
150#define IRQ_TRU_INT3 BFIN_IRQ(127) /* TRU0 Interrupt 3 */
151#define IRQ_DMAC0_ERROR BFIN_IRQ(128) /* DMAC0 Status Interrupt */
152#define IRQ_CGU0_ERROR BFIN_IRQ(129) /* CGU0 Error */
153/* -- RESERVED -- 130 Reserved */
154#define IRQ_DPM BFIN_IRQ(131) /* DPM0 Event */
155/* -- RESERVED -- 132 Reserved */
156#define IRQ_SWU0 BFIN_IRQ(133) /* SWU0 */
157#define IRQ_SWU1 BFIN_IRQ(134) /* SWU1 */
158#define IRQ_SWU2 BFIN_IRQ(135) /* SWU2 */
159#define IRQ_SWU3 BFIN_IRQ(136) /* SWU3 */
160#define IRQ_SWU4 BFIN_IRQ(137) /* SWU4 */
161#define IRQ_SWU5 BFIN_IRQ(138) /* SWU5 */
162#define IRQ_SWU6 BFIN_IRQ(139) /* SWU6 */
163
164#define SYS_IRQS IRQ_SWU6
165
166#define BFIN_PA_IRQ(x) ((x) + SYS_IRQS + 1)
167#define IRQ_PA0 BFIN_PA_IRQ(0)
168#define IRQ_PA1 BFIN_PA_IRQ(1)
169#define IRQ_PA2 BFIN_PA_IRQ(2)
170#define IRQ_PA3 BFIN_PA_IRQ(3)
171#define IRQ_PA4 BFIN_PA_IRQ(4)
172#define IRQ_PA5 BFIN_PA_IRQ(5)
173#define IRQ_PA6 BFIN_PA_IRQ(6)
174#define IRQ_PA7 BFIN_PA_IRQ(7)
175#define IRQ_PA8 BFIN_PA_IRQ(8)
176#define IRQ_PA9 BFIN_PA_IRQ(9)
177#define IRQ_PA10 BFIN_PA_IRQ(10)
178#define IRQ_PA11 BFIN_PA_IRQ(11)
179#define IRQ_PA12 BFIN_PA_IRQ(12)
180#define IRQ_PA13 BFIN_PA_IRQ(13)
181#define IRQ_PA14 BFIN_PA_IRQ(14)
182#define IRQ_PA15 BFIN_PA_IRQ(15)
183
184#define BFIN_PB_IRQ(x) ((x) + IRQ_PA15 + 1)
185#define IRQ_PB0 BFIN_PB_IRQ(0)
186#define IRQ_PB1 BFIN_PB_IRQ(1)
187#define IRQ_PB2 BFIN_PB_IRQ(2)
188#define IRQ_PB3 BFIN_PB_IRQ(3)
189#define IRQ_PB4 BFIN_PB_IRQ(4)
190#define IRQ_PB5 BFIN_PB_IRQ(5)
191#define IRQ_PB6 BFIN_PB_IRQ(6)
192#define IRQ_PB7 BFIN_PB_IRQ(7)
193#define IRQ_PB8 BFIN_PB_IRQ(8)
194#define IRQ_PB9 BFIN_PB_IRQ(9)
195#define IRQ_PB10 BFIN_PB_IRQ(10)
196#define IRQ_PB11 BFIN_PB_IRQ(11)
197#define IRQ_PB12 BFIN_PB_IRQ(12)
198#define IRQ_PB13 BFIN_PB_IRQ(13)
199#define IRQ_PB14 BFIN_PB_IRQ(14)
200#define IRQ_PB15 BFIN_PB_IRQ(15) /* N/A */
201
202#define BFIN_PC_IRQ(x) ((x) + IRQ_PB15 + 1)
203#define IRQ_PC0 BFIN_PC_IRQ(0)
204#define IRQ_PC1 BFIN_PC_IRQ(1)
205#define IRQ_PC2 BFIN_PC_IRQ(2)
206#define IRQ_PC3 BFIN_PC_IRQ(3)
207#define IRQ_PC4 BFIN_PC_IRQ(4)
208#define IRQ_PC5 BFIN_PC_IRQ(5)
209#define IRQ_PC6 BFIN_PC_IRQ(6)
210#define IRQ_PC7 BFIN_PC_IRQ(7)
211#define IRQ_PC8 BFIN_PC_IRQ(8)
212#define IRQ_PC9 BFIN_PC_IRQ(9)
213#define IRQ_PC10 BFIN_PC_IRQ(10)
214#define IRQ_PC11 BFIN_PC_IRQ(11)
215#define IRQ_PC12 BFIN_PC_IRQ(12)
216#define IRQ_PC13 BFIN_PC_IRQ(13)
217#define IRQ_PC14 BFIN_PC_IRQ(14) /* N/A */
218#define IRQ_PC15 BFIN_PC_IRQ(15) /* N/A */
219
220#define BFIN_PD_IRQ(x) ((x) + IRQ_PC15 + 1)
221#define IRQ_PD0 BFIN_PD_IRQ(0)
222#define IRQ_PD1 BFIN_PD_IRQ(1)
223#define IRQ_PD2 BFIN_PD_IRQ(2)
224#define IRQ_PD3 BFIN_PD_IRQ(3)
225#define IRQ_PD4 BFIN_PD_IRQ(4)
226#define IRQ_PD5 BFIN_PD_IRQ(5)
227#define IRQ_PD6 BFIN_PD_IRQ(6)
228#define IRQ_PD7 BFIN_PD_IRQ(7)
229#define IRQ_PD8 BFIN_PD_IRQ(8)
230#define IRQ_PD9 BFIN_PD_IRQ(9)
231#define IRQ_PD10 BFIN_PD_IRQ(10)
232#define IRQ_PD11 BFIN_PD_IRQ(11)
233#define IRQ_PD12 BFIN_PD_IRQ(12)
234#define IRQ_PD13 BFIN_PD_IRQ(13)
235#define IRQ_PD14 BFIN_PD_IRQ(14)
236#define IRQ_PD15 BFIN_PD_IRQ(15)
237
238#define BFIN_PE_IRQ(x) ((x) + IRQ_PD15 + 1)
239#define IRQ_PE0 BFIN_PE_IRQ(0)
240#define IRQ_PE1 BFIN_PE_IRQ(1)
241#define IRQ_PE2 BFIN_PE_IRQ(2)
242#define IRQ_PE3 BFIN_PE_IRQ(3)
243#define IRQ_PE4 BFIN_PE_IRQ(4)
244#define IRQ_PE5 BFIN_PE_IRQ(5)
245#define IRQ_PE6 BFIN_PE_IRQ(6)
246#define IRQ_PE7 BFIN_PE_IRQ(7)
247#define IRQ_PE8 BFIN_PE_IRQ(8)
248#define IRQ_PE9 BFIN_PE_IRQ(9)
249#define IRQ_PE10 BFIN_PE_IRQ(10)
250#define IRQ_PE11 BFIN_PE_IRQ(11)
251#define IRQ_PE12 BFIN_PE_IRQ(12)
252#define IRQ_PE13 BFIN_PE_IRQ(13)
253#define IRQ_PE14 BFIN_PE_IRQ(14)
254#define IRQ_PE15 BFIN_PE_IRQ(15)
255
256#define BFIN_PF_IRQ(x) ((x) + IRQ_PE15 + 1)
257#define IRQ_PF0 BFIN_PF_IRQ(0)
258#define IRQ_PF1 BFIN_PF_IRQ(1)
259#define IRQ_PF2 BFIN_PF_IRQ(2)
260#define IRQ_PF3 BFIN_PF_IRQ(3)
261#define IRQ_PF4 BFIN_PF_IRQ(4)
262#define IRQ_PF5 BFIN_PF_IRQ(5)
263#define IRQ_PF6 BFIN_PF_IRQ(6)
264#define IRQ_PF7 BFIN_PF_IRQ(7)
265#define IRQ_PF8 BFIN_PF_IRQ(8)
266#define IRQ_PF9 BFIN_PF_IRQ(9)
267#define IRQ_PF10 BFIN_PF_IRQ(10)
268#define IRQ_PF11 BFIN_PF_IRQ(11)
269#define IRQ_PF12 BFIN_PF_IRQ(12)
270#define IRQ_PF13 BFIN_PF_IRQ(13)
271#define IRQ_PF14 BFIN_PF_IRQ(14)
272#define IRQ_PF15 BFIN_PF_IRQ(15)
273
274#define BFIN_PG_IRQ(x) ((x) + IRQ_PF15 + 1)
275#define IRQ_PG0 BFIN_PG_IRQ(0)
276#define IRQ_PG1 BFIN_PG_IRQ(1)
277#define IRQ_PG2 BFIN_PG_IRQ(2)
278#define IRQ_PG3 BFIN_PG_IRQ(3)
279#define IRQ_PG4 BFIN_PG_IRQ(4)
280#define IRQ_PG5 BFIN_PG_IRQ(5)
281#define IRQ_PG6 BFIN_PG_IRQ(6)
282#define IRQ_PG7 BFIN_PG_IRQ(7)
283#define IRQ_PG8 BFIN_PG_IRQ(8)
284#define IRQ_PG9 BFIN_PG_IRQ(9)
285#define IRQ_PG10 BFIN_PG_IRQ(10)
286#define IRQ_PG11 BFIN_PG_IRQ(11)
287#define IRQ_PG12 BFIN_PG_IRQ(12)
288#define IRQ_PG13 BFIN_PG_IRQ(13)
289#define IRQ_PG14 BFIN_PG_IRQ(14)
290#define IRQ_PG15 BFIN_PG_IRQ(15)
291
292#define GPIO_IRQ_BASE IRQ_PA0
293
294#define NR_MACH_IRQS (IRQ_PG15 + 1)
295
296#ifndef __ASSEMBLY__
297#include <linux/types.h>
298
299/*
300 * bfin pint registers layout
301 */
302struct bfin_pint_regs {
303 u32 mask_set;
304 u32 mask_clear;
305 u32 request;
306 u32 assign;
307 u32 edge_set;
308 u32 edge_clear;
309 u32 invert_set;
310 u32 invert_clear;
311 u32 pinstate;
312 u32 latch;
313 u32 __pad0[2];
314};
315
316#endif
317
318#endif
diff --git a/arch/blackfin/mach-bf609/include/mach/mem_map.h b/arch/blackfin/mach-bf609/include/mach/mem_map.h
new file mode 100644
index 000000000000..20b65bfc5311
--- /dev/null
+++ b/arch/blackfin/mach-bf609/include/mach/mem_map.h
@@ -0,0 +1,86 @@
1/*
2 * BF60x memory map
3 *
4 * Copyright 2011 Analog Devices Inc.
5 * Licensed under the GPL-2 or later.
6 */
7
8#ifndef __BFIN_MACH_MEM_MAP_H__
9#define __BFIN_MACH_MEM_MAP_H__
10
11#ifndef __BFIN_MEM_MAP_H__
12# error "do not include mach/mem_map.h directly -- use asm/mem_map.h"
13#endif
14
15/* Async Memory Banks */
16#define ASYNC_BANK3_BASE 0xBC000000 /* Async Bank 3 */
17#define ASYNC_BANK3_SIZE 0x04000000 /* 64M */
18#define ASYNC_BANK2_BASE 0xB8000000 /* Async Bank 2 */
19#define ASYNC_BANK2_SIZE 0x04000000 /* 64M */
20#define ASYNC_BANK1_BASE 0xB4000000 /* Async Bank 1 */
21#define ASYNC_BANK1_SIZE 0x04000000 /* 64M */
22#define ASYNC_BANK0_BASE 0xB0000000 /* Async Bank 0 */
23#define ASYNC_BANK0_SIZE 0x04000000 /* 64M */
24
25/* Boot ROM Memory */
26
27#define BOOT_ROM_START 0xC8000000
28#define BOOT_ROM_LENGTH 0x8000
29
30/* Level 1 Memory */
31
32/* Memory Map for ADSP-BF60x processors */
33#ifdef CONFIG_BFIN_ICACHE
34#define BFIN_ICACHESIZE (16*1024)
35#define L1_CODE_LENGTH 0x10000
36#else
37#define BFIN_ICACHESIZE (0*1024)
38#define L1_CODE_LENGTH 0x14000
39#endif
40
41#define L1_CODE_START 0xFFA00000
42#define L1_DATA_A_START 0xFF800000
43#define L1_DATA_B_START 0xFF900000
44
45
46#define COREA_L1_SCRATCH_START 0xFFB00000
47#define COREB_L1_SCRATCH_START 0xFF700000
48
49#define COREB_L1_CODE_START 0xFF600000
50#define COREB_L1_DATA_A_START 0xFF400000
51#define COREB_L1_DATA_B_START 0xFF500000
52
53#define COREB_L1_CODE_LENGTH 0x14000
54#define COREB_L1_DATA_A_LENGTH 0x8000
55#define COREB_L1_DATA_B_LENGTH 0x8000
56
57
58#ifdef CONFIG_BFIN_DCACHE
59
60#ifdef CONFIG_BFIN_DCACHE_BANKA
61#define DMEM_CNTR (ACACHE_BSRAM | ENDCPLB | PORT_PREF0)
62#define L1_DATA_A_LENGTH (0x8000 - 0x4000)
63#define L1_DATA_B_LENGTH 0x8000
64#define BFIN_DCACHESIZE (16*1024)
65#define BFIN_DSUPBANKS 1
66#else
67#define DMEM_CNTR (ACACHE_BCACHE | ENDCPLB | PORT_PREF0)
68#define L1_DATA_A_LENGTH (0x8000 - 0x4000)
69#define L1_DATA_B_LENGTH (0x8000 - 0x4000)
70#define BFIN_DCACHESIZE (32*1024)
71#define BFIN_DSUPBANKS 2
72#endif
73
74#else
75#define DMEM_CNTR (ASRAM_BSRAM | ENDCPLB | PORT_PREF0)
76#define L1_DATA_A_LENGTH 0x8000
77#define L1_DATA_B_LENGTH 0x8000
78#define BFIN_DCACHESIZE (0*1024)
79#define BFIN_DSUPBANKS 0
80#endif /*CONFIG_BFIN_DCACHE*/
81
82/* Level 2 Memory */
83#define L2_START 0xC8080000
84#define L2_LENGTH 0x40000
85
86#endif
diff --git a/arch/blackfin/mach-bf609/include/mach/pll.h b/arch/blackfin/mach-bf609/include/mach/pll.h
new file mode 100644
index 000000000000..1857a4a0f262
--- /dev/null
+++ b/arch/blackfin/mach-bf609/include/mach/pll.h
@@ -0,0 +1 @@
/* #include <mach-common/pll.h> */
diff --git a/arch/blackfin/mach-bf609/include/mach/pm.h b/arch/blackfin/mach-bf609/include/mach/pm.h
new file mode 100644
index 000000000000..036d9bdc889e
--- /dev/null
+++ b/arch/blackfin/mach-bf609/include/mach/pm.h
@@ -0,0 +1,21 @@
1/*
2 * Blackfin bf609 power management
3 *
4 * Copyright 2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2
7 */
8
9#ifndef __MACH_BF609_PM_H__
10#define __MACH_BF609_PM_H__
11
12#include <linux/suspend.h>
13
14int bfin609_pm_enter(suspend_state_t state);
15int bf609_pm_prepare(void);
16void bf609_pm_finish(void);
17
18void bf609_hibernate(void);
19void bfin_sec_raise_irq(unsigned int sid);
20void coreb_enable(void);
21#endif
diff --git a/arch/blackfin/mach-bf609/include/mach/portmux.h b/arch/blackfin/mach-bf609/include/mach/portmux.h
new file mode 100644
index 000000000000..2e1a51c25098
--- /dev/null
+++ b/arch/blackfin/mach-bf609/include/mach/portmux.h
@@ -0,0 +1,347 @@
1/*
2 * Copyright 2011 Analog Devices Inc.
3 *
4 * Licensed under the GPL-2 or later
5 */
6
7#ifndef _MACH_PORTMUX_H_
8#define _MACH_PORTMUX_H_
9
10#define MAX_RESOURCES MAX_BLACKFIN_GPIOS
11
12/* EMAC RMII Port Mux */
13#define P_MII0_MDC (P_DEFINED | P_IDENT(GPIO_PC6) | P_FUNCT(0))
14#define P_MII0_MDIO (P_DEFINED | P_IDENT(GPIO_PC7) | P_FUNCT(0))
15#define P_MII0_ETxD0 (P_DEFINED | P_IDENT(GPIO_PC2) | P_FUNCT(0))
16#define P_MII0_ERxD0 (P_DEFINED | P_IDENT(GPIO_PC0) | P_FUNCT(0))
17#define P_MII0_ETxD1 (P_DEFINED | P_IDENT(GPIO_PC3) | P_FUNCT(0))
18#define P_MII0_ERxD1 (P_DEFINED | P_IDENT(GPIO_PC1) | P_FUNCT(0))
19#define P_MII0_ETxEN (P_DEFINED | P_IDENT(GPIO_PB13) | P_FUNCT(0))
20#define P_MII0_PHYINT (P_DEFINED | P_IDENT(GPIO_PD6) | P_FUNCT(0))
21#define P_MII0_CRS (P_DEFINED | P_IDENT(GPIO_PC5) | P_FUNCT(0))
22#define P_MII0_ERxER (P_DEFINED | P_IDENT(GPIO_PC4) | P_FUNCT(0))
23#define P_MII0_TxCLK (P_DEFINED | P_IDENT(GPIO_PB14) | P_FUNCT(0))
24
25#define P_RMII0 {\
26 P_MII0_ETxD0, \
27 P_MII0_ETxD1, \
28 P_MII0_ETxEN, \
29 P_MII0_ERxD0, \
30 P_MII0_ERxD1, \
31 P_MII0_ERxER, \
32 P_MII0_TxCLK, \
33 P_MII0_PHYINT, \
34 P_MII0_CRS, \
35 P_MII0_MDC, \
36 P_MII0_MDIO, 0}
37
38#define P_MII1_MDC (P_DEFINED | P_IDENT(GPIO_PE10) | P_FUNCT(0))
39#define P_MII1_MDIO (P_DEFINED | P_IDENT(GPIO_PE11) | P_FUNCT(0))
40#define P_MII1_ETxD0 (P_DEFINED | P_IDENT(GPIO_PG3) | P_FUNCT(0))
41#define P_MII1_ERxD0 (P_DEFINED | P_IDENT(GPIO_PG0) | P_FUNCT(0))
42#define P_MII1_ETxD1 (P_DEFINED | P_IDENT(GPIO_PG2) | P_FUNCT(0))
43#define P_MII1_ERxD1 (P_DEFINED | P_IDENT(GPIO_PE15) | P_FUNCT(0))
44#define P_MII1_ETxEN (P_DEFINED | P_IDENT(GPIO_PG5) | P_FUNCT(0))
45#define P_MII1_PHYINT (P_DEFINED | P_IDENT(GPIO_PE12) | P_FUNCT(0))
46#define P_MII1_CRS (P_DEFINED | P_IDENT(GPIO_PE13) | P_FUNCT(0))
47#define P_MII1_ERxER (P_DEFINED | P_IDENT(GPIO_PE14) | P_FUNCT(0))
48#define P_MII1_TxCLK (P_DEFINED | P_IDENT(GPIO_PG6) | P_FUNCT(0))
49
50#define P_RMII1 {\
51 P_MII1_ETxD0, \
52 P_MII1_ETxD1, \
53 P_MII1_ETxEN, \
54 P_MII1_ERxD0, \
55 P_MII1_ERxD1, \
56 P_MII1_ERxER, \
57 P_MII1_TxCLK, \
58 P_MII1_PHYINT, \
59 P_MII1_CRS, \
60 P_MII1_MDC, \
61 P_MII1_MDIO, 0}
62
63/* PPI Port Mux */
64#define P_PPI0_D0 (P_DEFINED | P_IDENT(GPIO_PF0) | P_FUNCT(1))
65#define P_PPI0_D1 (P_DEFINED | P_IDENT(GPIO_PF1) | P_FUNCT(1))
66#define P_PPI0_D2 (P_DEFINED | P_IDENT(GPIO_PF2) | P_FUNCT(1))
67#define P_PPI0_D3 (P_DEFINED | P_IDENT(GPIO_PF3) | P_FUNCT(1))
68#define P_PPI0_D4 (P_DEFINED | P_IDENT(GPIO_PF4) | P_FUNCT(1))
69#define P_PPI0_D5 (P_DEFINED | P_IDENT(GPIO_PF5) | P_FUNCT(1))
70#define P_PPI0_D6 (P_DEFINED | P_IDENT(GPIO_PF6) | P_FUNCT(1))
71#define P_PPI0_D7 (P_DEFINED | P_IDENT(GPIO_PF7) | P_FUNCT(1))
72#define P_PPI0_D8 (P_DEFINED | P_IDENT(GPIO_PF8) | P_FUNCT(1))
73#define P_PPI0_D9 (P_DEFINED | P_IDENT(GPIO_PF9) | P_FUNCT(1))
74#define P_PPI0_D10 (P_DEFINED | P_IDENT(GPIO_PF10) | P_FUNCT(1))
75#define P_PPI0_D11 (P_DEFINED | P_IDENT(GPIO_PF11) | P_FUNCT(1))
76#define P_PPI0_D12 (P_DEFINED | P_IDENT(GPIO_PF12) | P_FUNCT(1))
77#define P_PPI0_D13 (P_DEFINED | P_IDENT(GPIO_PF13) | P_FUNCT(1))
78#define P_PPI0_D14 (P_DEFINED | P_IDENT(GPIO_PF14) | P_FUNCT(1))
79#define P_PPI0_D15 (P_DEFINED | P_IDENT(GPIO_PF15) | P_FUNCT(1))
80#define P_PPI0_D16 (P_DEFINED | P_IDENT(GPIO_PE3) | P_FUNCT(1))
81#define P_PPI0_D17 (P_DEFINED | P_IDENT(GPIO_PE4) | P_FUNCT(1))
82#define P_PPI0_D18 (P_DEFINED | P_IDENT(GPIO_PE0) | P_FUNCT(1))
83#define P_PPI0_D19 (P_DEFINED | P_IDENT(GPIO_PE1) | P_FUNCT(1))
84#define P_PPI0_D20 (P_DEFINED | P_IDENT(GPIO_PD12) | P_FUNCT(1))
85#define P_PPI0_D21 (P_DEFINED | P_IDENT(GPIO_PD15) | P_FUNCT(1))
86#define P_PPI0_D22 (P_DEFINED | P_IDENT(GPIO_PE2) | P_FUNCT(1))
87#define P_PPI0_D23 (P_DEFINED | P_IDENT(GPIO_PE5) | P_FUNCT(1))
88#define P_PPI0_CLK (P_DEFINED | P_IDENT(GPIO_PE9) | P_FUNCT(1))
89#define P_PPI0_FS1 (P_DEFINED | P_IDENT(GPIO_PE8) | P_FUNCT(1))
90#define P_PPI0_FS2 (P_DEFINED | P_IDENT(GPIO_PE7) | P_FUNCT(1))
91#define P_PPI0_FS3 (P_DEFINED | P_IDENT(GPIO_PE6) | P_FUNCT(1))
92
93#define P_PPI1_D0 (P_DEFINED | P_IDENT(GPIO_PC0) | P_FUNCT(1))
94#define P_PPI1_D1 (P_DEFINED | P_IDENT(GPIO_PC1) | P_FUNCT(1))
95#define P_PPI1_D2 (P_DEFINED | P_IDENT(GPIO_PC2) | P_FUNCT(1))
96#define P_PPI1_D3 (P_DEFINED | P_IDENT(GPIO_PC3) | P_FUNCT(1))
97#define P_PPI1_D4 (P_DEFINED | P_IDENT(GPIO_PC4) | P_FUNCT(1))
98#define P_PPI1_D5 (P_DEFINED | P_IDENT(GPIO_PC5) | P_FUNCT(1))
99#define P_PPI1_D6 (P_DEFINED | P_IDENT(GPIO_PC6) | P_FUNCT(1))
100#define P_PPI1_D7 (P_DEFINED | P_IDENT(GPIO_PC7) | P_FUNCT(1))
101#define P_PPI1_D8 (P_DEFINED | P_IDENT(GPIO_PC8) | P_FUNCT(1))
102#define P_PPI1_D9 (P_DEFINED | P_IDENT(GPIO_PC9) | P_FUNCT(1))
103#define P_PPI1_D10 (P_DEFINED | P_IDENT(GPIO_PC10) | P_FUNCT(1))
104#define P_PPI1_D11 (P_DEFINED | P_IDENT(GPIO_PC11) | P_FUNCT(1))
105#define P_PPI1_D12 (P_DEFINED | P_IDENT(GPIO_PC12) | P_FUNCT(1))
106#define P_PPI1_D13 (P_DEFINED | P_IDENT(GPIO_PC13) | P_FUNCT(1))
107#define P_PPI1_D14 (P_DEFINED | P_IDENT(GPIO_PC14) | P_FUNCT(1))
108#define P_PPI1_D15 (P_DEFINED | P_IDENT(GPIO_PC15) | P_FUNCT(1))
109#define P_PPI1_D16 (P_DEFINED | P_IDENT(GPIO_PD0) | P_FUNCT(1))
110#define P_PPI1_D17 (P_DEFINED | P_IDENT(GPIO_PD1) | P_FUNCT(1))
111#define P_PPI1_CLK (P_DEFINED | P_IDENT(GPIO_PB14) | P_FUNCT(1))
112#define P_PPI1_FS1 (P_DEFINED | P_IDENT(GPIO_PB13) | P_FUNCT(1))
113#define P_PPI1_FS2 (P_DEFINED | P_IDENT(GPIO_PD6) | P_FUNCT(1))
114#define P_PPI1_FS3 (P_DEFINED | P_IDENT(GPIO_PB15) | P_FUNCT(1))
115
116#define P_PPI2_D0 (P_DEFINED | P_IDENT(GPIO_PA0) | P_FUNCT(1))
117#define P_PPI2_D1 (P_DEFINED | P_IDENT(GPIO_PA1) | P_FUNCT(1))
118#define P_PPI2_D2 (P_DEFINED | P_IDENT(GPIO_PA2) | P_FUNCT(1))
119#define P_PPI2_D3 (P_DEFINED | P_IDENT(GPIO_PA3) | P_FUNCT(1))
120#define P_PPI2_D4 (P_DEFINED | P_IDENT(GPIO_PA4) | P_FUNCT(1))
121#define P_PPI2_D5 (P_DEFINED | P_IDENT(GPIO_PA5) | P_FUNCT(1))
122#define P_PPI2_D6 (P_DEFINED | P_IDENT(GPIO_PA6) | P_FUNCT(1))
123#define P_PPI2_D7 (P_DEFINED | P_IDENT(GPIO_PA7) | P_FUNCT(1))
124#define P_PPI2_D8 (P_DEFINED | P_IDENT(GPIO_PA8) | P_FUNCT(1))
125#define P_PPI2_D9 (P_DEFINED | P_IDENT(GPIO_PA9) | P_FUNCT(1))
126#define P_PPI2_D10 (P_DEFINED | P_IDENT(GPIO_PA10) | P_FUNCT(1))
127#define P_PPI2_D11 (P_DEFINED | P_IDENT(GPIO_PA11) | P_FUNCT(1))
128#define P_PPI2_D12 (P_DEFINED | P_IDENT(GPIO_PA12) | P_FUNCT(1))
129#define P_PPI2_D13 (P_DEFINED | P_IDENT(GPIO_PA13) | P_FUNCT(1))
130#define P_PPI2_D14 (P_DEFINED | P_IDENT(GPIO_PA14) | P_FUNCT(1))
131#define P_PPI2_D15 (P_DEFINED | P_IDENT(GPIO_PA15) | P_FUNCT(1))
132#define P_PPI2_D16 (P_DEFINED | P_IDENT(GPIO_PB7) | P_FUNCT(1))
133#define P_PPI2_D17 (P_DEFINED | P_IDENT(GPIO_PB8) | P_FUNCT(1))
134#define P_PPI2_CLK (P_DEFINED | P_IDENT(GPIO_PB0) | P_FUNCT(1))
135#define P_PPI2_FS1 (P_DEFINED | P_IDENT(GPIO_PB1) | P_FUNCT(1))
136#define P_PPI2_FS2 (P_DEFINED | P_IDENT(GPIO_PB2) | P_FUNCT(1))
137#define P_PPI2_FS3 (P_DEFINED | P_IDENT(GPIO_PB3) | P_FUNCT(1))
138
139/* SPI Port Mux */
140#define P_SPI0_SS (P_DEFINED | P_IDENT(GPIO_PD11) | P_FUNCT(3))
141#define P_SPI0_SCK (P_DEFINED | P_IDENT(GPIO_PD4) | P_FUNCT(0))
142#define P_SPI0_MISO (P_DEFINED | P_IDENT(GPIO_PD2) | P_FUNCT(0))
143#define P_SPI0_MOSI (P_DEFINED | P_IDENT(GPIO_PD3) | P_FUNCT(0))
144#define P_SPI0_RDY (P_DEFINED | P_IDENT(GPIO_PD10) | P_FUNCT(0))
145#define P_SPI0_D2 (P_DEFINED | P_IDENT(GPIO_PD0) | P_FUNCT(0))
146#define P_SPI0_D3 (P_DEFINED | P_IDENT(GPIO_PD1) | P_FUNCT(0))
147
148#define P_SPI0_SSEL1 (P_DEFINED | P_IDENT(GPIO_PD11) | P_FUNCT(0))
149#define P_SPI0_SSEL2 (P_DEFINED | P_IDENT(GPIO_PD1) | P_FUNCT(2))
150#define P_SPI0_SSEL3 (P_DEFINED | P_IDENT(GPIO_PD0) | P_FUNCT(2))
151#define P_SPI0_SSEL4 (P_DEFINED | P_IDENT(GPIO_PC15) | P_FUNCT(0))
152#define P_SPI0_SSEL5 (P_DEFINED | P_IDENT(GPIO_PD9) | P_FUNCT(0))
153#define P_SPI0_SSEL6 (P_DEFINED | P_IDENT(GPIO_PC13) | P_FUNCT(0))
154#define P_SPI0_SSEL7 (P_DEFINED | P_IDENT(GPIO_PC12) | P_FUNCT(0))
155
156#define P_SPI1_SS (P_DEFINED | P_IDENT(GPIO_PD12) | P_FUNCT(3))
157#define P_SPI1_SCK (P_DEFINED | P_IDENT(GPIO_PD5) | P_FUNCT(0))
158#define P_SPI1_MISO (P_DEFINED | P_IDENT(GPIO_PD14) | P_FUNCT(0))
159#define P_SPI1_MOSI (P_DEFINED | P_IDENT(GPIO_PD13) | P_FUNCT(0))
160#define P_SPI1_RDY (P_DEFINED | P_IDENT(GPIO_PE2) | P_FUNCT(0))
161#define P_SPI1_D2 (P_DEFINED | P_IDENT(GPIO_PE1) | P_FUNCT(0))
162#define P_SPI1_D3 (P_DEFINED | P_IDENT(GPIO_PE0) | P_FUNCT(0))
163
164#define P_SPI1_SSEL1 (P_DEFINED | P_IDENT(GPIO_PD12) | P_FUNCT(0))
165#define P_SPI1_SSEL2 (P_DEFINED | P_IDENT(GPIO_PD15) | P_FUNCT(2))
166#define P_SPI1_SSEL3 (P_DEFINED | P_IDENT(GPIO_PD10) | P_FUNCT(2))
167#define P_SPI1_SSEL4 (P_DEFINED | P_IDENT(GPIO_PD9) | P_FUNCT(2))
168#define P_SPI1_SSEL5 (P_DEFINED | P_IDENT(GPIO_PF8) | P_FUNCT(0))
169#define P_SPI1_SSEL6 (P_DEFINED | P_IDENT(GPIO_PF9) | P_FUNCT(0))
170#define P_SPI1_SSEL7 (P_DEFINED | P_IDENT(GPIO_PC14) | P_FUNCT(0))
171
172#define GPIO_DEFAULT_BOOT_SPI_CS
173#define P_DEFAULT_BOOT_SPI_CS
174
175/* CORE IDLE */
176#define P_IDLEA (P_DEFINED | P_IDENT(GPIO_PG14) | P_FUNCT(1))
177#define P_IDLEB (P_DEFINED | P_IDENT(GPIO_PG15) | P_FUNCT(1))
178#define P_SLEEP (P_DEFINED | P_IDENT(GPIO_PG15) | P_FUNCT(2))
179
180/* UART Port Mux */
181#define P_UART0_TX (P_DEFINED | P_IDENT(GPIO_PD7) | P_FUNCT(1))
182#define P_UART0_RX (P_DEFINED | P_IDENT(GPIO_PD8) | P_FUNCT(1))
183#define P_UART0_RTS (P_DEFINED | P_IDENT(GPIO_PD9) | P_FUNCT(1))
184#define P_UART0_CTS (P_DEFINED | P_IDENT(GPIO_PD10) | P_FUNCT(1))
185
186#define P_UART1_TX (P_DEFINED | P_IDENT(GPIO_PG15) | P_FUNCT(0))
187#define P_UART1_RX (P_DEFINED | P_IDENT(GPIO_PG14) | P_FUNCT(0))
188#define P_UART1_RTS (P_DEFINED | P_IDENT(GPIO_PG10) | P_FUNCT(0))
189#define P_UART1_CTS (P_DEFINED | P_IDENT(GPIO_PG13) | P_FUNCT(0))
190
191/* Timer */
192#define P_TMRCLK (P_DEFINED | P_IDENT(GPIO_PG13) | P_FUNCT(3))
193#define P_TMR0 (P_DEFINED | P_IDENT(GPIO_PE14) | P_FUNCT(2))
194#define P_TMR1 (P_DEFINED | P_IDENT(GPIO_PG4) | P_FUNCT(1))
195#define P_TMR2 (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(1))
196#define P_TMR3 (P_DEFINED | P_IDENT(GPIO_PG8) | P_FUNCT(1))
197#define P_TMR4 (P_DEFINED | P_IDENT(GPIO_PG9) | P_FUNCT(1))
198#define P_TMR5 (P_DEFINED | P_IDENT(GPIO_PG7) | P_FUNCT(1))
199#define P_TMR6 (P_DEFINED | P_IDENT(GPIO_PG11) | P_FUNCT(1))
200#define P_TMR7 (P_DEFINED | P_IDENT(GPIO_PG12) | P_FUNCT(1))
201
202/* RSI */
203#define P_RSI_DATA0 (P_DEFINED | P_IDENT(GPIO_PG3) | P_FUNCT(2))
204#define P_RSI_DATA1 (P_DEFINED | P_IDENT(GPIO_PG2) | P_FUNCT(2))
205#define P_RSI_DATA2 (P_DEFINED | P_IDENT(GPIO_PG0) | P_FUNCT(2))
206#define P_RSI_DATA3 (P_DEFINED | P_IDENT(GPIO_PE15) | P_FUNCT(2))
207#define P_RSI_DATA4 (P_DEFINED | P_IDENT(GPIO_PE13) | P_FUNCT(2))
208#define P_RSI_DATA5 (P_DEFINED | P_IDENT(GPIO_PE12) | P_FUNCT(2))
209#define P_RSI_DATA6 (P_DEFINED | P_IDENT(GPIO_PE10) | P_FUNCT(2))
210#define P_RSI_DATA7 (P_DEFINED | P_IDENT(GPIO_PE11) | P_FUNCT(2))
211#define P_RSI_CMD (P_DEFINED | P_IDENT(GPIO_PG5) | P_FUNCT(1))
212#define P_RSI_CLK (P_DEFINED | P_IDENT(GPIO_PG6) | P_FUNCT(1))
213
214/* PTP */
215#define P_PTP0_PPS (P_DEFINED | P_IDENT(GPIO_PB15) | P_FUNCT(0))
216#define P_PTP0_CLKIN (P_DEFINED | P_IDENT(GPIO_PC13) | P_FUNCT(2))
217#define P_PTP0_AUXIN (P_DEFINED | P_IDENT(GPIO_PC11) | P_FUNCT(2))
218
219#define P_PTP1_PPS (P_DEFINED | P_IDENT(GPIO_PC9) | P_FUNCT(0))
220#define P_PTP1_CLKIN (P_DEFINED | P_IDENT(GPIO_PC13) | P_FUNCT(2))
221#define P_PTP1_AUXIN (P_DEFINED | P_IDENT(GPIO_PC11) | P_FUNCT(2))
222
223/* SMC Port Mux */
224#define P_A3 (P_DEFINED | P_IDENT(GPIO_PA0) | P_FUNCT(0))
225#define P_A4 (P_DEFINED | P_IDENT(GPIO_PA1) | P_FUNCT(0))
226#define P_A5 (P_DEFINED | P_IDENT(GPIO_PA2) | P_FUNCT(0))
227#define P_A6 (P_DEFINED | P_IDENT(GPIO_PA3) | P_FUNCT(0))
228#define P_A7 (P_DEFINED | P_IDENT(GPIO_PA4) | P_FUNCT(0))
229#define P_A8 (P_DEFINED | P_IDENT(GPIO_PA5) | P_FUNCT(0))
230#define P_A9 (P_DEFINED | P_IDENT(GPIO_PA6) | P_FUNCT(0))
231#define P_A10 (P_DEFINED | P_IDENT(GPIO_PA7) | P_FUNCT(0))
232#define P_A11 (P_DEFINED | P_IDENT(GPIO_PA8) | P_FUNCT(0))
233#define P_A12 (P_DEFINED | P_IDENT(GPIO_PA9) | P_FUNCT(0))
234#define P_A13 (P_DEFINED | P_IDENT(GPIO_PB2) | P_FUNCT(0))
235#define P_A14 (P_DEFINED | P_IDENT(GPIO_PA10) | P_FUNCT(0))
236#define P_A15 (P_DEFINED | P_IDENT(GPIO_PA11) | P_FUNCT(0))
237#define P_A16 (P_DEFINED | P_IDENT(GPIO_PB3) | P_FUNCT(0))
238#define P_A17 (P_DEFINED | P_IDENT(GPIO_PA12) | P_FUNCT(0))
239#define P_A18 (P_DEFINED | P_IDENT(GPIO_PA13) | P_FUNCT(0))
240#define P_A19 (P_DEFINED | P_IDENT(GPIO_PA14) | P_FUNCT(0))
241#define P_A20 (P_DEFINED | P_IDENT(GPIO_PA15) | P_FUNCT(0))
242#define P_A21 (P_DEFINED | P_IDENT(GPIO_PB6) | P_FUNCT(0))
243#define P_A22 (P_DEFINED | P_IDENT(GPIO_PB7) | P_FUNCT(0))
244#define P_A23 (P_DEFINED | P_IDENT(GPIO_PB8) | P_FUNCT(0))
245#define P_A24 (P_DEFINED | P_IDENT(GPIO_PB10) | P_FUNCT(0))
246#define P_A25 (P_DEFINED | P_IDENT(GPIO_PB11) | P_FUNCT(0))
247#define P_NORCK (P_DEFINED | P_IDENT(GPIO_PB0) | P_FUNCT(0))
248
249#define P_AMS1 (P_DEFINED | P_IDENT(GPIO_PB1) | P_FUNCT(0))
250#define P_AMS2 (P_DEFINED | P_IDENT(GPIO_PB4) | P_FUNCT(0))
251#define P_AMS3 (P_DEFINED | P_IDENT(GPIO_PB5) | P_FUNCT(0))
252
253/* CAN */
254#define P_CAN0_TX (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(2))
255#define P_CAN0_RX (P_DEFINED | P_IDENT(GPIO_PG4) | P_FUNCT(2))
256
257/* SPORT */
258#define P_SPORT0_ACLK (P_DEFINED | P_IDENT(GPIO_PB5) | P_FUNCT(2))
259#define P_SPORT0_AFS (P_DEFINED | P_IDENT(GPIO_PB4) | P_FUNCT(2))
260#define P_SPORT0_AD0 (P_DEFINED | P_IDENT(GPIO_PB9) | P_FUNCT(2))
261#define P_SPORT0_AD1 (P_DEFINED | P_IDENT(GPIO_PB12) | P_FUNCT(2))
262#define P_SPORT0_ATDV (P_DEFINED | P_IDENT(GPIO_PB6) | P_FUNCT(1))
263#define P_SPORT0_BCLK (P_DEFINED | P_IDENT(GPIO_PB8) | P_FUNCT(2))
264#define P_SPORT0_BFS (P_DEFINED | P_IDENT(GPIO_PB7) | P_FUNCT(2))
265#define P_SPORT0_BD0 (P_DEFINED | P_IDENT(GPIO_PB11) | P_FUNCT(2))
266#define P_SPORT0_BD1 (P_DEFINED | P_IDENT(GPIO_PB10) | P_FUNCT(2))
267#define P_SPORT0_BTDV (P_DEFINED | P_IDENT(GPIO_PB12) | P_FUNCT(1))
268
269#define P_SPORT1_ACLK (P_DEFINED | P_IDENT(GPIO_PE2) | P_FUNCT(2))
270#define P_SPORT1_AFS (P_DEFINED | P_IDENT(GPIO_PE5) | P_FUNCT(2))
271#define P_SPORT1_AD0 (P_DEFINED | P_IDENT(GPIO_PD15) | P_FUNCT(2))
272#define P_SPORT1_AD1 (P_DEFINED | P_IDENT(GPIO_PD12) | P_FUNCT(2))
273#define P_SPORT1_ATDV (P_DEFINED | P_IDENT(GPIO_PE6) | P_FUNCT(0))
274#define P_SPORT1_BCLK (P_DEFINED | P_IDENT(GPIO_PE4) | P_FUNCT(2))
275#define P_SPORT1_BFS (P_DEFINED | P_IDENT(GPIO_PE3) | P_FUNCT(2))
276#define P_SPORT1_BD0 (P_DEFINED | P_IDENT(GPIO_PE1) | P_FUNCT(2))
277#define P_SPORT1_BD1 (P_DEFINED | P_IDENT(GPIO_PE0) | P_FUNCT(2))
278#define P_SPORT1_BTDV (P_DEFINED | P_IDENT(GPIO_PE7) | P_FUNCT(0))
279
280#define P_SPORT2_ACLK (P_DEFINED | P_IDENT(GPIO_PG4) | P_FUNCT(0))
281#define P_SPORT2_AFS (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(0))
282#define P_SPORT2_AD0 (P_DEFINED | P_IDENT(GPIO_PG9) | P_FUNCT(0))
283#define P_SPORT2_AD1 (P_DEFINED | P_IDENT(GPIO_PG8) | P_FUNCT(0))
284#define P_SPORT2_ATDV (P_DEFINED | P_IDENT(GPIO_PE14) | P_FUNCT(1))
285#define P_SPORT2_BCLK (P_DEFINED | P_IDENT(GPIO_PG10) | P_FUNCT(1))
286#define P_SPORT2_BFS (P_DEFINED | P_IDENT(GPIO_PG7) | P_FUNCT(0))
287#define P_SPORT2_BD0 (P_DEFINED | P_IDENT(GPIO_PG12) | P_FUNCT(0))
288#define P_SPORT2_BD1 (P_DEFINED | P_IDENT(GPIO_PG11) | P_FUNCT(0))
289#define P_SPORT2_BTDV (P_DEFINED | P_IDENT(GPIO_PG6) | P_FUNCT(2))
290
291/* LINK PORT */
292#define P_LP0_CLK (P_DEFINED | P_IDENT(GPIO_PB0) | P_FUNCT(2))
293#define P_LP0_ACK (P_DEFINED | P_IDENT(GPIO_PB1) | P_FUNCT(2))
294#define P_LP0_D0 (P_DEFINED | P_IDENT(GPIO_PA0) | P_FUNCT(2))
295#define P_LP0_D1 (P_DEFINED | P_IDENT(GPIO_PA1) | P_FUNCT(2))
296#define P_LP0_D2 (P_DEFINED | P_IDENT(GPIO_PA2) | P_FUNCT(2))
297#define P_LP0_D3 (P_DEFINED | P_IDENT(GPIO_PA3) | P_FUNCT(2))
298#define P_LP0_D4 (P_DEFINED | P_IDENT(GPIO_PA4) | P_FUNCT(2))
299#define P_LP0_D5 (P_DEFINED | P_IDENT(GPIO_PA5) | P_FUNCT(2))
300#define P_LP0_D6 (P_DEFINED | P_IDENT(GPIO_PA6) | P_FUNCT(2))
301#define P_LP0_D7 (P_DEFINED | P_IDENT(GPIO_PA7) | P_FUNCT(2))
302
303#define P_LP1_CLK (P_DEFINED | P_IDENT(GPIO_PB3) | P_FUNCT(2))
304#define P_LP1_ACK (P_DEFINED | P_IDENT(GPIO_PB2) | P_FUNCT(2))
305#define P_LP1_D0 (P_DEFINED | P_IDENT(GPIO_PA8) | P_FUNCT(2))
306#define P_LP1_D1 (P_DEFINED | P_IDENT(GPIO_PA9) | P_FUNCT(2))
307#define P_LP1_D2 (P_DEFINED | P_IDENT(GPIO_PA10) | P_FUNCT(2))
308#define P_LP1_D3 (P_DEFINED | P_IDENT(GPIO_PA11) | P_FUNCT(2))
309#define P_LP1_D4 (P_DEFINED | P_IDENT(GPIO_PA12) | P_FUNCT(2))
310#define P_LP1_D5 (P_DEFINED | P_IDENT(GPIO_PA13) | P_FUNCT(2))
311#define P_LP1_D6 (P_DEFINED | P_IDENT(GPIO_PA14) | P_FUNCT(2))
312#define P_LP1_D7 (P_DEFINED | P_IDENT(GPIO_PA15) | P_FUNCT(2))
313
314#define P_LP2_CLK (P_DEFINED | P_IDENT(GPIO_PE6) | P_FUNCT(2))
315#define P_LP2_ACK (P_DEFINED | P_IDENT(GPIO_PE7) | P_FUNCT(2))
316#define P_LP2_D0 (P_DEFINED | P_IDENT(GPIO_PF0) | P_FUNCT(2))
317#define P_LP2_D1 (P_DEFINED | P_IDENT(GPIO_PF1) | P_FUNCT(2))
318#define P_LP2_D2 (P_DEFINED | P_IDENT(GPIO_PF2) | P_FUNCT(2))
319#define P_LP2_D3 (P_DEFINED | P_IDENT(GPIO_PF3) | P_FUNCT(2))
320#define P_LP2_D4 (P_DEFINED | P_IDENT(GPIO_PF4) | P_FUNCT(2))
321#define P_LP2_D5 (P_DEFINED | P_IDENT(GPIO_PF5) | P_FUNCT(2))
322#define P_LP2_D6 (P_DEFINED | P_IDENT(GPIO_PF6) | P_FUNCT(2))
323#define P_LP2_D7 (P_DEFINED | P_IDENT(GPIO_PF7) | P_FUNCT(2))
324
325#define P_LP3_CLK (P_DEFINED | P_IDENT(GPIO_PE9) | P_FUNCT(2))
326#define P_LP3_ACK (P_DEFINED | P_IDENT(GPIO_PE8) | P_FUNCT(2))
327#define P_LP3_D0 (P_DEFINED | P_IDENT(GPIO_PF8) | P_FUNCT(2))
328#define P_LP3_D1 (P_DEFINED | P_IDENT(GPIO_PF9) | P_FUNCT(2))
329#define P_LP3_D2 (P_DEFINED | P_IDENT(GPIO_PF10) | P_FUNCT(2))
330#define P_LP3_D3 (P_DEFINED | P_IDENT(GPIO_PF11) | P_FUNCT(2))
331#define P_LP3_D4 (P_DEFINED | P_IDENT(GPIO_PF12) | P_FUNCT(2))
332#define P_LP3_D5 (P_DEFINED | P_IDENT(GPIO_PF13) | P_FUNCT(2))
333#define P_LP3_D6 (P_DEFINED | P_IDENT(GPIO_PF14) | P_FUNCT(2))
334#define P_LP3_D7 (P_DEFINED | P_IDENT(GPIO_PF15) | P_FUNCT(2))
335
336/* TWI */
337#define P_TWI0_SCL (P_DONTCARE)
338#define P_TWI0_SDA (P_DONTCARE)
339#define P_TWI1_SCL (P_DONTCARE)
340#define P_TWI1_SDA (P_DONTCARE)
341
342/* Rotary Encoder */
343#define P_CNT_CZM (P_DEFINED | P_IDENT(GPIO_PG7) | P_FUNCT(3))
344#define P_CNT_CUD (P_DEFINED | P_IDENT(GPIO_PG11) | P_FUNCT(3))
345#define P_CNT_CDG (P_DEFINED | P_IDENT(GPIO_PG12) | P_FUNCT(3))
346
347#endif /* _MACH_PORTMUX_H_ */
diff --git a/arch/blackfin/mach-bf609/pm.c b/arch/blackfin/mach-bf609/pm.c
new file mode 100644
index 000000000000..b76966eb16ad
--- /dev/null
+++ b/arch/blackfin/mach-bf609/pm.c
@@ -0,0 +1,362 @@
1/*
2 * Blackfin bf609 power management
3 *
4 * Copyright 2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2
7 */
8
9#include <linux/suspend.h>
10#include <linux/io.h>
11#include <linux/interrupt.h>
12#include <linux/gpio.h>
13#include <linux/irq.h>
14
15#include <linux/delay.h>
16
17#include <asm/dpmc.h>
18#include <asm/pm.h>
19#include <mach/pm.h>
20#include <asm/blackfin.h>
21
22/***********************************************************/
23/* */
24/* Wakeup Actions for DPM_RESTORE */
25/* */
26/***********************************************************/
27#define BITP_ROM_WUA_CHKHDR 24
28#define BITP_ROM_WUA_DDRLOCK 7
29#define BITP_ROM_WUA_DDRDLLEN 6
30#define BITP_ROM_WUA_DDR 5
31#define BITP_ROM_WUA_CGU 4
32#define BITP_ROM_WUA_MEMBOOT 2
33#define BITP_ROM_WUA_EN 1
34
35#define BITM_ROM_WUA_CHKHDR (0xFF000000)
36#define ENUM_ROM_WUA_CHKHDR_AD 0xAD000000
37
38#define BITM_ROM_WUA_DDRLOCK (0x00000080)
39#define BITM_ROM_WUA_DDRDLLEN (0x00000040)
40#define BITM_ROM_WUA_DDR (0x00000020)
41#define BITM_ROM_WUA_CGU (0x00000010)
42#define BITM_ROM_WUA_MEMBOOT (0x00000002)
43#define BITM_ROM_WUA_EN (0x00000001)
44
45/***********************************************************/
46/* */
47/* Syscontrol */
48/* */
49/***********************************************************/
50#define BITP_ROM_SYSCTRL_CGU_LOCKINGEN 28 /* unlocks CGU_CTL register */
51#define BITP_ROM_SYSCTRL_WUA_OVERRIDE 24
52#define BITP_ROM_SYSCTRL_WUA_DDRDLLEN 20 /* Saves the DDR DLL and PADS registers to the DPM registers */
53#define BITP_ROM_SYSCTRL_WUA_DDR 19 /* Saves the DDR registers to the DPM registers */
54#define BITP_ROM_SYSCTRL_WUA_CGU 18 /* Saves the CGU registers into DPM registers */
55#define BITP_ROM_SYSCTRL_WUA_DPMWRITE 17 /* Saves the Syscontrol structure structure contents into DPM registers */
56#define BITP_ROM_SYSCTRL_WUA_EN 16 /* reads current PLL and DDR configuration into structure */
57#define BITP_ROM_SYSCTRL_DDR_WRITE 13 /* writes the DDR registers from Syscontrol structure for wakeup initialization of DDR */
58#define BITP_ROM_SYSCTRL_DDR_READ 12 /* Read the DDR registers into the Syscontrol structure for storing prior to hibernate */
59#define BITP_ROM_SYSCTRL_CGU_AUTODIS 11 /* Disables auto handling of UPDT and ALGN fields */
60#define BITP_ROM_SYSCTRL_CGU_CLKOUTSEL 7 /* access CGU_CLKOUTSEL register */
61#define BITP_ROM_SYSCTRL_CGU_DIV 6 /* access CGU_DIV register */
62#define BITP_ROM_SYSCTRL_CGU_STAT 5 /* access CGU_STAT register */
63#define BITP_ROM_SYSCTRL_CGU_CTL 4 /* access CGU_CTL register */
64#define BITP_ROM_SYSCTRL_CGU_RTNSTAT 2 /* Update structure STAT field upon error */
65#define BITP_ROM_SYSCTRL_WRITE 1 /* write registers */
66#define BITP_ROM_SYSCTRL_READ 0 /* read registers */
67
68#define BITM_ROM_SYSCTRL_CGU_READ (0x00000001) /* Read CGU registers */
69#define BITM_ROM_SYSCTRL_CGU_WRITE (0x00000002) /* Write registers */
70#define BITM_ROM_SYSCTRL_CGU_RTNSTAT (0x00000004) /* Update structure STAT field upon error or after a write operation */
71#define BITM_ROM_SYSCTRL_CGU_CTL (0x00000010) /* Access CGU_CTL register */
72#define BITM_ROM_SYSCTRL_CGU_STAT (0x00000020) /* Access CGU_STAT register */
73#define BITM_ROM_SYSCTRL_CGU_DIV (0x00000040) /* Access CGU_DIV register */
74#define BITM_ROM_SYSCTRL_CGU_CLKOUTSEL (0x00000080) /* Access CGU_CLKOUTSEL register */
75#define BITM_ROM_SYSCTRL_CGU_AUTODIS (0x00000800) /* Disables auto handling of UPDT and ALGN fields */
76#define BITM_ROM_SYSCTRL_DDR_READ (0x00001000) /* Reads the contents of the DDR registers and stores them into the structure */
77#define BITM_ROM_SYSCTRL_DDR_WRITE (0x00002000) /* Writes the DDR registers from the structure, only really intented for wakeup functionality and not for full DDR configuration */
78#define BITM_ROM_SYSCTRL_WUA_EN (0x00010000) /* Wakeup entry or exit opertation enable */
79#define BITM_ROM_SYSCTRL_WUA_DPMWRITE (0x00020000) /* When set indicates a restore of the PLL and DDR is to be performed otherwise a save is required */
80#define BITM_ROM_SYSCTRL_WUA_CGU (0x00040000) /* Only applicable for a PLL and DDR save operation to the DPM, saves the current settings if cleared or the contents of the structure if set */
81#define BITM_ROM_SYSCTRL_WUA_DDR (0x00080000) /* Only applicable for a PLL and DDR save operation to the DPM, saves the current settings if cleared or the contents of the structure if set */
82#define BITM_ROM_SYSCTRL_WUA_DDRDLLEN (0x00100000) /* Enables saving/restoring of the DDR DLLCTL register */
83#define BITM_ROM_SYSCTRL_WUA_OVERRIDE (0x01000000)
84#define BITM_ROM_SYSCTRL_CGU_LOCKINGEN (0x10000000) /* Unlocks the CGU_CTL register */
85
86
87/* Structures for the syscontrol() function */
88struct STRUCT_ROM_SYSCTRL {
89 uint32_t ulCGU_CTL;
90 uint32_t ulCGU_STAT;
91 uint32_t ulCGU_DIV;
92 uint32_t ulCGU_CLKOUTSEL;
93 uint32_t ulWUA_Flags;
94 uint32_t ulWUA_BootAddr;
95 uint32_t ulWUA_User;
96 uint32_t ulDDR_CTL;
97 uint32_t ulDDR_CFG;
98 uint32_t ulDDR_TR0;
99 uint32_t ulDDR_TR1;
100 uint32_t ulDDR_TR2;
101 uint32_t ulDDR_MR;
102 uint32_t ulDDR_EMR1;
103 uint32_t ulDDR_EMR2;
104 uint32_t ulDDR_PADCTL;
105 uint32_t ulDDR_DLLCTL;
106 uint32_t ulReserved;
107};
108
109struct bfin_pm_data {
110 uint32_t magic;
111 uint32_t resume_addr;
112 uint32_t sp;
113};
114
115struct bfin_pm_data bf609_pm_data;
116
117struct STRUCT_ROM_SYSCTRL configvalues;
118uint32_t dactionflags;
119
120#define FUNC_ROM_SYSCONTROL 0xC8000080
121__attribute__((l1_data))
122static uint32_t (* const bfrom_SysControl)(uint32_t action_flags, struct STRUCT_ROM_SYSCTRL *settings, void *reserved) = (void *)FUNC_ROM_SYSCONTROL;
123
124__attribute__((l1_text))
125void bfin_cpu_suspend(void)
126{
127 __asm__ __volatile__( \
128 ".align 8;" \
129 "idle;" \
130 : : \
131 );
132}
133
134__attribute__((l1_text))
135void bfin_deepsleep(unsigned long mask)
136{
137 uint32_t dpm0_ctl;
138
139 bfin_write32(DPM0_WAKE_EN, 0x10);
140 bfin_write32(DPM0_WAKE_POL, 0x10);
141 dpm0_ctl = 0x00000008;
142 bfin_write32(DPM0_CTL, dpm0_ctl);
143 SSYNC();
144 __asm__ __volatile__( \
145 ".align 8;" \
146 "idle;" \
147 : : \
148 );
149#ifdef CONFIG_BFIN_PM_WAKEUP_TIME_BENCH
150 __asm__ __volatile__(
151 "R0 = 0;"
152 "CYCLES = R0;"
153 "CYCLES2 = R0;"
154 "R0 = SYSCFG;"
155 "BITSET(R0, 1);"
156 "SYSCFG = R0;"
157 : : : "R0"
158 );
159#endif
160
161}
162
163__attribute__((l1_text))
164void bf609_ddr_sr(void)
165{
166 uint32_t reg;
167
168 reg = bfin_read_DMC0_CTL();
169 reg |= 0x8;
170 bfin_write_DMC0_CTL(reg);
171
172 while (!(bfin_read_DMC0_STAT() & 0x8))
173 continue;
174}
175
176__attribute__((l1_text))
177void bf609_ddr_sr_exit(void)
178{
179 uint32_t reg;
180 while (!(bfin_read_DMC0_STAT() & 0x1))
181 continue;
182
183 reg = bfin_read_DMC0_CTL();
184 reg &= ~0x8;
185 bfin_write_DMC0_CTL(reg);
186
187 while ((bfin_read_DMC0_STAT() & 0x8))
188 continue;
189}
190
191__attribute__((l1_text))
192void bfin_hibernate_syscontrol(void)
193{
194 configvalues.ulWUA_Flags = (0xAD000000 | BITM_ROM_WUA_EN
195 | BITM_ROM_WUA_CGU | BITM_ROM_WUA_DDR | BITM_ROM_WUA_DDRDLLEN);
196
197 dactionflags = (BITM_ROM_SYSCTRL_WUA_EN
198 | BITM_ROM_SYSCTRL_WUA_DPMWRITE | BITM_ROM_SYSCTRL_WUA_CGU
199 | BITM_ROM_SYSCTRL_WUA_DDR | BITM_ROM_SYSCTRL_WUA_DDRDLLEN);
200
201 bfrom_SysControl(dactionflags, &configvalues, NULL);
202
203 bfin_write32(DPM0_RESTORE5, bfin_read32(DPM0_RESTORE5) | 4);
204}
205
206#ifndef CONFIG_BF60x
207# define SIC_SYSIRQ(irq) (irq - (IRQ_CORETMR + 1))
208#else
209# define SIC_SYSIRQ(irq) ((irq) - IVG15)
210#endif
211void bfin_hibernate(unsigned long mask)
212{
213 bfin_write32(DPM0_WAKE_EN, 0x10);
214 bfin_write32(DPM0_WAKE_POL, 0x10);
215 bfin_write32(DPM0_PGCNTR, 0x0000FFFF);
216 bfin_write32(DPM0_HIB_DIS, 0xFFFF);
217
218 printk(KERN_DEBUG "hibernate: restore %x pgcnt %x\n", bfin_read32(DPM0_RESTORE0), bfin_read32(DPM0_PGCNTR));
219
220 bf609_hibernate();
221}
222
223void bf609_cpu_pm_enter(suspend_state_t state)
224{
225 int error;
226 unsigned long wakeup = 0;
227 unsigned long wakeup_pol = 0;
228
229#ifdef CONFIG_PM_BFIN_WAKE_PA15
230 wakeup |= PA15WE;
231# if CONFIG_PM_BFIN_WAKE_PA15_POL
232 wakeup_pol |= PA15WE;
233# endif
234#endif
235
236#ifdef CONFIG_PM_BFIN_WAKE_PB15
237 wakeup |= PB15WE;
238# if CONFIG_PM_BFIN_WAKE_PA15_POL
239 wakeup_pol |= PB15WE;
240# endif
241#endif
242
243#ifdef CONFIG_PM_BFIN_WAKE_PC15
244 wakeup |= PC15WE;
245# if CONFIG_PM_BFIN_WAKE_PC15_POL
246 wakeup_pol |= PC15WE;
247# endif
248#endif
249
250#ifdef CONFIG_PM_BFIN_WAKE_PD06
251 wakeup |= PD06WE;
252# if CONFIG_PM_BFIN_WAKE_PD06_POL
253 wakeup_pol |= PD06WE;
254# endif
255#endif
256
257#ifdef CONFIG_PM_BFIN_WAKE_PE12
258 wakeup |= PE12WE;
259# if CONFIG_PM_BFIN_WAKE_PE12_POL
260 wakeup_pol |= PE12WE;
261# endif
262#endif
263
264#ifdef CONFIG_PM_BFIN_WAKE_PG04
265 wakeup |= PG04WE;
266# if CONFIG_PM_BFIN_WAKE_PG04_POL
267 wakeup_pol |= PG04WE;
268# endif
269#endif
270
271#ifdef CONFIG_PM_BFIN_WAKE_PG13
272 wakeup |= PG13WE;
273# if CONFIG_PM_BFIN_WAKE_PG13_POL
274 wakeup_pol |= PG13WE;
275# endif
276#endif
277
278#ifdef CONFIG_PM_BFIN_WAKE_USB
279 wakeup |= USBWE;
280# if CONFIG_PM_BFIN_WAKE_USB_POL
281 wakeup_pol |= USBWE;
282# endif
283#endif
284
285 error = irq_set_irq_wake(255, 1);
286 if(error < 0)
287 printk(KERN_DEBUG "Unable to get irq wake\n");
288 error = irq_set_irq_wake(231, 1);
289 if (error < 0)
290 printk(KERN_DEBUG "Unable to get irq wake\n");
291
292 if (state == PM_SUSPEND_STANDBY)
293 bfin_deepsleep(wakeup);
294 else {
295 bfin_hibernate(wakeup);
296 }
297}
298
299int bf609_cpu_pm_prepare(void)
300{
301 return 0;
302}
303
304void bf609_cpu_pm_finish(void)
305{
306
307}
308
309static struct bfin_cpu_pm_fns bf609_cpu_pm = {
310 .enter = bf609_cpu_pm_enter,
311 .prepare = bf609_cpu_pm_prepare,
312 .finish = bf609_cpu_pm_finish,
313};
314
315static irqreturn_t test_isr(int irq, void *dev_id)
316{
317 printk(KERN_DEBUG "gpio irq %d\n", irq);
318 return IRQ_HANDLED;
319}
320
321static irqreturn_t dpm0_isr(int irq, void *dev_id)
322{
323 uint32_t wake_stat;
324
325 wake_stat = bfin_read32(DPM0_WAKE_STAT);
326 printk(KERN_DEBUG "enter %s wake stat %08x\n", __func__, wake_stat);
327
328 bfin_write32(DPM0_WAKE_STAT, wake_stat);
329 return IRQ_HANDLED;
330}
331
332static int __init bf609_init_pm(void)
333{
334 int irq;
335 int error;
336
337#if CONFIG_PM_BFIN_WAKE_PE12
338 irq = gpio_to_irq(GPIO_PE12);
339 if (irq < 0) {
340 error = irq;
341 printk(KERN_DEBUG "Unable to get irq number for GPIO %d, error %d\n",
342 GPIO_PE12, error);
343 }
344
345 error = request_irq(irq, test_isr, IRQF_TRIGGER_RISING | IRQF_NO_SUSPEND, "gpiope12", NULL);
346 if(error < 0)
347 printk(KERN_DEBUG "Unable to get irq\n");
348#endif
349
350 error = request_irq(IRQ_CGU_EVT, dpm0_isr, IRQF_NO_SUSPEND, "cgu0 event", NULL);
351 if(error < 0)
352 printk(KERN_DEBUG "Unable to get irq\n");
353
354 error = request_irq(IRQ_DPM, dpm0_isr, IRQF_NO_SUSPEND, "dpm0 event", NULL);
355 if (error < 0)
356 printk(KERN_DEBUG "Unable to get irq\n");
357
358 bfin_cpu_pm = &bf609_cpu_pm;
359 return 0;
360}
361
362late_initcall(bf609_init_pm);
diff --git a/arch/blackfin/mach-common/Makefile b/arch/blackfin/mach-common/Makefile
index ff299f24aba0..75f0ba29ebb9 100644
--- a/arch/blackfin/mach-common/Makefile
+++ b/arch/blackfin/mach-common/Makefile
@@ -6,7 +6,10 @@ obj-y := \
6 cache.o cache-c.o entry.o head.o \ 6 cache.o cache-c.o entry.o head.o \
7 interrupt.o arch_checks.o ints-priority.o 7 interrupt.o arch_checks.o ints-priority.o
8 8
9obj-$(CONFIG_PM) += pm.o dpmc_modes.o 9obj-$(CONFIG_PM) += pm.o
10ifneq ($(CONFIG_BF60x),y)
11obj-$(CONFIG_PM) += dpmc_modes.o
12endif
10obj-$(CONFIG_CPU_FREQ) += cpufreq.o 13obj-$(CONFIG_CPU_FREQ) += cpufreq.o
11obj-$(CONFIG_CPU_VOLTAGE) += dpmc.o 14obj-$(CONFIG_CPU_VOLTAGE) += dpmc.o
12obj-$(CONFIG_SMP) += smp.o 15obj-$(CONFIG_SMP) += smp.o
diff --git a/arch/blackfin/mach-common/clock.h b/arch/blackfin/mach-common/clock.h
new file mode 100644
index 000000000000..645ff460a1f2
--- /dev/null
+++ b/arch/blackfin/mach-common/clock.h
@@ -0,0 +1,27 @@
1#ifndef __MACH_COMMON_CLKDEV_H
2#define __MACH_COMMON_CLKDEV_H
3
4#include <linux/clk.h>
5
6struct clk_ops {
7 unsigned long (*get_rate)(struct clk *clk);
8 unsigned long (*round_rate)(struct clk *clk, unsigned long rate);
9 int (*set_rate)(struct clk *clk, unsigned long rate);
10 int (*enable)(struct clk *clk);
11 int (*disable)(struct clk *clk);
12};
13
14struct clk {
15 const char *name;
16 unsigned long rate;
17 spinlock_t lock;
18 u32 flags;
19 const struct clk_ops *ops;
20 const struct params *params;
21 void __iomem *reg;
22 u32 mask;
23 u32 shift;
24};
25
26#endif
27
diff --git a/arch/blackfin/mach-common/clocks-init.c b/arch/blackfin/mach-common/clocks-init.c
index d5cfe611b778..7ad2407d1571 100644
--- a/arch/blackfin/mach-common/clocks-init.c
+++ b/arch/blackfin/mach-common/clocks-init.c
@@ -15,10 +15,121 @@
15#include <asm/mem_init.h> 15#include <asm/mem_init.h>
16#include <asm/dpmc.h> 16#include <asm/dpmc.h>
17 17
18#ifdef CONFIG_BF60x
19#define CSEL_P 0
20#define S0SEL_P 5
21#define SYSSEL_P 8
22#define S1SEL_P 13
23#define DSEL_P 16
24#define OSEL_P 22
25#define ALGN_P 29
26#define UPDT_P 30
27#define LOCK_P 31
28
29#define CGU_CTL_VAL ((CONFIG_VCO_MULT << 8) | CLKIN_HALF)
30#define CGU_DIV_VAL \
31 ((CONFIG_CCLK_DIV << CSEL_P) | \
32 (CONFIG_SCLK_DIV << SYSSEL_P) | \
33 (CONFIG_SCLK0_DIV << S0SEL_P) | \
34 (CONFIG_SCLK1_DIV << S1SEL_P) | \
35 (CONFIG_DCLK_DIV << DSEL_P))
36
37#define CONFIG_BFIN_DCLK (((CONFIG_CLKIN_HZ * CONFIG_VCO_MULT) / CONFIG_DCLK_DIV) / 1000000)
38#if ((CONFIG_BFIN_DCLK != 125) && \
39 (CONFIG_BFIN_DCLK != 133) && (CONFIG_BFIN_DCLK != 150) && \
40 (CONFIG_BFIN_DCLK != 166) && (CONFIG_BFIN_DCLK != 200) && \
41 (CONFIG_BFIN_DCLK != 225) && (CONFIG_BFIN_DCLK != 250))
42#error "DCLK must be in (125, 133, 150, 166, 200, 225, 250)MHz"
43#endif
44struct ddr_config {
45 u32 ddr_clk;
46 u32 dmc_ddrctl;
47 u32 dmc_ddrcfg;
48 u32 dmc_ddrtr0;
49 u32 dmc_ddrtr1;
50 u32 dmc_ddrtr2;
51 u32 dmc_ddrmr;
52 u32 dmc_ddrmr1;
53};
54
55struct ddr_config ddr_config_table[] __attribute__((section(".data_l1"))) = {
56 [0] = {
57 .ddr_clk = 125,
58 .dmc_ddrctl = 0x00000904,
59 .dmc_ddrcfg = 0x00000422,
60 .dmc_ddrtr0 = 0x20705212,
61 .dmc_ddrtr1 = 0x201003CF,
62 .dmc_ddrtr2 = 0x00320107,
63 .dmc_ddrmr = 0x00000422,
64 .dmc_ddrmr1 = 0x4,
65 },
66 [1] = {
67 .ddr_clk = 133,
68 .dmc_ddrctl = 0x00000904,
69 .dmc_ddrcfg = 0x00000422,
70 .dmc_ddrtr0 = 0x20806313,
71 .dmc_ddrtr1 = 0x2013040D,
72 .dmc_ddrtr2 = 0x00320108,
73 .dmc_ddrmr = 0x00000632,
74 .dmc_ddrmr1 = 0x4,
75 },
76 [2] = {
77 .ddr_clk = 150,
78 .dmc_ddrctl = 0x00000904,
79 .dmc_ddrcfg = 0x00000422,
80 .dmc_ddrtr0 = 0x20A07323,
81 .dmc_ddrtr1 = 0x20160492,
82 .dmc_ddrtr2 = 0x00320209,
83 .dmc_ddrmr = 0x00000632,
84 .dmc_ddrmr1 = 0x4,
85 },
86 [3] = {
87 .ddr_clk = 166,
88 .dmc_ddrctl = 0x00000904,
89 .dmc_ddrcfg = 0x00000422,
90 .dmc_ddrtr0 = 0x20A07323,
91 .dmc_ddrtr1 = 0x2016050E,
92 .dmc_ddrtr2 = 0x00320209,
93 .dmc_ddrmr = 0x00000632,
94 .dmc_ddrmr1 = 0x4,
95 },
96 [4] = {
97 .ddr_clk = 200,
98 .dmc_ddrctl = 0x00000904,
99 .dmc_ddrcfg = 0x00000422,
100 .dmc_ddrtr0 = 0x20a07323,
101 .dmc_ddrtr1 = 0x2016050f,
102 .dmc_ddrtr2 = 0x00320509,
103 .dmc_ddrmr = 0x00000632,
104 .dmc_ddrmr1 = 0x4,
105 },
106 [5] = {
107 .ddr_clk = 225,
108 .dmc_ddrctl = 0x00000904,
109 .dmc_ddrcfg = 0x00000422,
110 .dmc_ddrtr0 = 0x20E0A424,
111 .dmc_ddrtr1 = 0x302006DB,
112 .dmc_ddrtr2 = 0x0032020D,
113 .dmc_ddrmr = 0x00000842,
114 .dmc_ddrmr1 = 0x4,
115 },
116 [6] = {
117 .ddr_clk = 250,
118 .dmc_ddrctl = 0x00000904,
119 .dmc_ddrcfg = 0x00000422,
120 .dmc_ddrtr0 = 0x20E0A424,
121 .dmc_ddrtr1 = 0x3020079E,
122 .dmc_ddrtr2 = 0x0032020D,
123 .dmc_ddrmr = 0x00000842,
124 .dmc_ddrmr1 = 0x4,
125 },
126};
127#else
18#define SDGCTL_WIDTH (1 << 31) /* SDRAM external data path width */ 128#define SDGCTL_WIDTH (1 << 31) /* SDRAM external data path width */
19#define PLL_CTL_VAL \ 129#define PLL_CTL_VAL \
20 (((CONFIG_VCO_MULT & 63) << 9) | CLKIN_HALF | \ 130 (((CONFIG_VCO_MULT & 63) << 9) | CLKIN_HALF | \
21 (PLL_BYPASS << 8) | (ANOMALY_05000305 ? 0 : 0x8000)) 131 (PLL_BYPASS << 8) | (ANOMALY_05000305 ? 0 : 0x8000))
132#endif
22 133
23__attribute__((l1_text)) 134__attribute__((l1_text))
24static void do_sync(void) 135static void do_sync(void)
@@ -33,6 +144,44 @@ void init_clocks(void)
33 * in the middle of reprogramming things, and that'll screw us up. 144 * in the middle of reprogramming things, and that'll screw us up.
34 * For example, any automatic DMAs left by U-Boot for splash screens. 145 * For example, any automatic DMAs left by U-Boot for splash screens.
35 */ 146 */
147
148#ifdef CONFIG_BF60x
149 int i, dlldatacycle, dll_ctl;
150 bfin_write32(CGU0_DIV, CGU_DIV_VAL);
151 bfin_write32(CGU0_CTL, CGU_CTL_VAL);
152 while ((bfin_read32(CGU0_STAT) & 0x8) || !(bfin_read32(CGU0_STAT) & 0x4))
153 continue;
154
155 bfin_write32(CGU0_DIV, CGU_DIV_VAL | (1 << UPDT_P));
156 while (bfin_read32(CGU0_STAT) & (1 << 3))
157 continue;
158
159 for (i = 0; i < 7; i++) {
160 if (ddr_config_table[i].ddr_clk == CONFIG_BFIN_DCLK) {
161 bfin_write_DDR0_CFG(ddr_config_table[i].dmc_ddrcfg);
162 bfin_write_DDR0_TR0(ddr_config_table[i].dmc_ddrtr0);
163 bfin_write_DDR0_TR1(ddr_config_table[i].dmc_ddrtr1);
164 bfin_write_DDR0_TR2(ddr_config_table[i].dmc_ddrtr2);
165 bfin_write_DDR0_MR(ddr_config_table[i].dmc_ddrmr);
166 bfin_write_DDR0_EMR1(ddr_config_table[i].dmc_ddrmr1);
167 bfin_write_DDR0_CTL(ddr_config_table[i].dmc_ddrctl);
168 break;
169 }
170 }
171
172 do_sync();
173 while (!(bfin_read_DDR0_STAT() & 0x4))
174 continue;
175
176 dlldatacycle = (bfin_read_DDR0_STAT() & 0x00f00000) >> 20;
177 dll_ctl = bfin_read_DDR0_DLLCTL();
178 dll_ctl &= 0x0ff;
179 bfin_write_DDR0_DLLCTL(dll_ctl | (dlldatacycle << 8));
180
181 do_sync();
182 while (!(bfin_read_DDR0_STAT() & 0x2000))
183 continue;
184#else
36 size_t i; 185 size_t i;
37 for (i = 0; i < MAX_DMA_CHANNELS; ++i) { 186 for (i = 0; i < MAX_DMA_CHANNELS; ++i) {
38 struct dma_register *dma = dma_io_base_addr[i]; 187 struct dma_register *dma = dma_io_base_addr[i];
@@ -91,6 +240,8 @@ void init_clocks(void)
91 bfin_write_EBIU_DDRQUE(CONFIG_MEM_EBIU_DDRQUE); 240 bfin_write_EBIU_DDRQUE(CONFIG_MEM_EBIU_DDRQUE);
92#endif 241#endif
93#endif 242#endif
243#endif
94 do_sync(); 244 do_sync();
95 bfin_read16(0); 245 bfin_read16(0);
246
96} 247}
diff --git a/arch/blackfin/mach-common/cpufreq.c b/arch/blackfin/mach-common/cpufreq.c
index 2e6eefd812f4..6e87dc13f6bf 100644
--- a/arch/blackfin/mach-common/cpufreq.c
+++ b/arch/blackfin/mach-common/cpufreq.c
@@ -10,6 +10,7 @@
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/clk.h>
13#include <linux/cpufreq.h> 14#include <linux/cpufreq.h>
14#include <linux/fs.h> 15#include <linux/fs.h>
15#include <linux/delay.h> 16#include <linux/delay.h>
@@ -17,6 +18,7 @@
17#include <asm/time.h> 18#include <asm/time.h>
18#include <asm/dpmc.h> 19#include <asm/dpmc.h>
19 20
21
20/* this is the table of CCLK frequencies, in Hz */ 22/* this is the table of CCLK frequencies, in Hz */
21/* .index is the entry in the auxiliary dpm_state_table[] */ 23/* .index is the entry in the auxiliary dpm_state_table[] */
22static struct cpufreq_frequency_table bfin_freq_table[] = { 24static struct cpufreq_frequency_table bfin_freq_table[] = {
@@ -67,12 +69,22 @@ static void __init bfin_init_tables(unsigned long cclk, unsigned long sclk)
67#else 69#else
68 min_cclk = sclk; 70 min_cclk = sclk;
69#endif 71#endif
72
73#ifndef CONFIG_BF60x
70 csel = ((bfin_read_PLL_DIV() & CSEL) >> 4); 74 csel = ((bfin_read_PLL_DIV() & CSEL) >> 4);
75#else
76 csel = bfin_read32(CGU0_DIV) & 0x1F;
77#endif
71 78
72 for (index = 0; (cclk >> index) >= min_cclk && csel <= 3; index++, csel++) { 79 for (index = 0; (cclk >> index) >= min_cclk && csel <= 3; index++, csel++) {
73 bfin_freq_table[index].frequency = cclk >> index; 80 bfin_freq_table[index].frequency = cclk >> index;
81#ifndef CONFIG_BF60x
74 dpm_state_table[index].csel = csel << 4; /* Shift now into PLL_DIV bitpos */ 82 dpm_state_table[index].csel = csel << 4; /* Shift now into PLL_DIV bitpos */
75 dpm_state_table[index].tscale = (TIME_SCALE / (1 << csel)) - 1; 83 dpm_state_table[index].tscale = (TIME_SCALE / (1 << csel)) - 1;
84#else
85 dpm_state_table[index].csel = csel;
86 dpm_state_table[index].tscale = TIME_SCALE >> index;
87#endif
76 88
77 pr_debug("cpufreq: freq:%d csel:0x%x tscale:%d\n", 89 pr_debug("cpufreq: freq:%d csel:0x%x tscale:%d\n",
78 bfin_freq_table[index].frequency, 90 bfin_freq_table[index].frequency,
@@ -99,14 +111,34 @@ static unsigned int bfin_getfreq_khz(unsigned int cpu)
99 return get_cclk() / 1000; 111 return get_cclk() / 1000;
100} 112}
101 113
114#ifdef CONFIG_BF60x
115unsigned long cpu_set_cclk(int cpu, unsigned long new)
116{
117 struct clk *clk;
118 int ret;
119
120 clk = clk_get(NULL, "CCLK");
121 if (IS_ERR(clk))
122 return -ENODEV;
123
124 ret = clk_set_rate(clk, new);
125 clk_put(clk);
126 return ret;
127}
128#endif
129
102static int bfin_target(struct cpufreq_policy *poli, 130static int bfin_target(struct cpufreq_policy *poli,
103 unsigned int target_freq, unsigned int relation) 131 unsigned int target_freq, unsigned int relation)
104{ 132{
105 unsigned int index, plldiv, cpu; 133#ifndef CONFIG_BF60x
134 unsigned int plldiv;
135#endif
136 unsigned int index, cpu;
106 unsigned long flags, cclk_hz; 137 unsigned long flags, cclk_hz;
107 struct cpufreq_freqs freqs; 138 struct cpufreq_freqs freqs;
108 static unsigned long lpj_ref; 139 static unsigned long lpj_ref;
109 static unsigned int lpj_ref_freq; 140 static unsigned int lpj_ref_freq;
141 int ret = 0;
110 142
111#if defined(CONFIG_CYCLES_CLOCKSOURCE) 143#if defined(CONFIG_CYCLES_CLOCKSOURCE)
112 cycles_t cycles; 144 cycles_t cycles;
@@ -134,9 +166,17 @@ static int bfin_target(struct cpufreq_policy *poli,
134 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 166 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
135 if (cpu == CPUFREQ_CPU) { 167 if (cpu == CPUFREQ_CPU) {
136 flags = hard_local_irq_save(); 168 flags = hard_local_irq_save();
169#ifndef CONFIG_BF60x
137 plldiv = (bfin_read_PLL_DIV() & SSEL) | 170 plldiv = (bfin_read_PLL_DIV() & SSEL) |
138 dpm_state_table[index].csel; 171 dpm_state_table[index].csel;
139 bfin_write_PLL_DIV(plldiv); 172 bfin_write_PLL_DIV(plldiv);
173#else
174 ret = cpu_set_cclk(cpu, freqs.new * 1000);
175 if (ret != 0) {
176 pr_debug("cpufreq set freq failed %d\n", ret);
177 break;
178 }
179#endif
140 on_each_cpu(bfin_adjust_core_timer, &index, 1); 180 on_each_cpu(bfin_adjust_core_timer, &index, 1);
141#if defined(CONFIG_CYCLES_CLOCKSOURCE) 181#if defined(CONFIG_CYCLES_CLOCKSOURCE)
142 cycles = get_cycles(); 182 cycles = get_cycles();
@@ -161,7 +201,7 @@ static int bfin_target(struct cpufreq_policy *poli,
161 } 201 }
162 202
163 pr_debug("cpufreq: done\n"); 203 pr_debug("cpufreq: done\n");
164 return 0; 204 return ret;
165} 205}
166 206
167static int bfin_verify_speed(struct cpufreq_policy *policy) 207static int bfin_verify_speed(struct cpufreq_policy *policy)
@@ -169,7 +209,7 @@ static int bfin_verify_speed(struct cpufreq_policy *policy)
169 return cpufreq_frequency_table_verify(policy, bfin_freq_table); 209 return cpufreq_frequency_table_verify(policy, bfin_freq_table);
170} 210}
171 211
172static int __init __bfin_cpu_init(struct cpufreq_policy *policy) 212static int __bfin_cpu_init(struct cpufreq_policy *policy)
173{ 213{
174 214
175 unsigned long cclk, sclk; 215 unsigned long cclk, sclk;
diff --git a/arch/blackfin/mach-common/dpmc_modes.S b/arch/blackfin/mach-common/dpmc_modes.S
index 1c534d298de4..de99f3aac2c5 100644
--- a/arch/blackfin/mach-common/dpmc_modes.S
+++ b/arch/blackfin/mach-common/dpmc_modes.S
@@ -10,7 +10,6 @@
10#include <asm/dpmc.h> 10#include <asm/dpmc.h>
11 11
12.section .l1.text 12.section .l1.text
13
14ENTRY(_sleep_mode) 13ENTRY(_sleep_mode)
15 [--SP] = (R7:4, P5:3); 14 [--SP] = (R7:4, P5:3);
16 [--SP] = RETS; 15 [--SP] = RETS;
@@ -43,6 +42,9 @@ ENTRY(_sleep_mode)
43 BITCLR (R7, 5); 42 BITCLR (R7, 5);
44 w[p0] = R7.L; 43 w[p0] = R7.L;
45 IDLE; 44 IDLE;
45
46 bfin_init_pm_bench_cycles;
47
46 call _test_pll_locked; 48 call _test_pll_locked;
47 49
48 RETS = [SP++]; 50 RETS = [SP++];
@@ -58,12 +60,13 @@ ENDPROC(_sleep_mode)
58 * 60 *
59 * We accept just one argument -- the value to write to VR_CTL. 61 * We accept just one argument -- the value to write to VR_CTL.
60 */ 62 */
63
61ENTRY(_hibernate_mode) 64ENTRY(_hibernate_mode)
62 /* Save/setup the regs we need early for minor pipeline optimization */ 65 /* Save/setup the regs we need early for minor pipeline optimization */
63 R4 = R0; 66 R4 = R0;
67
64 P3.H = hi(VR_CTL); 68 P3.H = hi(VR_CTL);
65 P3.L = lo(VR_CTL); 69 P3.L = lo(VR_CTL);
66
67 /* Disable all wakeup sources */ 70 /* Disable all wakeup sources */
68 R0 = IWR_DISABLE_ALL; 71 R0 = IWR_DISABLE_ALL;
69 R1 = IWR_DISABLE_ALL; 72 R1 = IWR_DISABLE_ALL;
@@ -74,6 +77,9 @@ ENTRY(_hibernate_mode)
74 77
75 /* Finally, we climb into our cave to hibernate */ 78 /* Finally, we climb into our cave to hibernate */
76 W[P3] = R4.L; 79 W[P3] = R4.L;
80
81 bfin_init_pm_bench_cycles;
82
77 CLI R2; 83 CLI R2;
78 IDLE; 84 IDLE;
79.Lforever: 85.Lforever:
@@ -158,6 +164,8 @@ ENTRY(_sleep_deeper)
158 SSYNC; 164 SSYNC;
159 IDLE; 165 IDLE;
160 166
167 bfin_init_pm_bench_cycles;
168
161 call _test_pll_locked; 169 call _test_pll_locked;
162 170
163 P0.H = hi(PLL_DIV); 171 P0.H = hi(PLL_DIV);
@@ -276,327 +284,10 @@ ENTRY(_test_pll_locked)
276ENDPROC(_test_pll_locked) 284ENDPROC(_test_pll_locked)
277 285
278.section .text 286.section .text
279
280#define PM_REG0 R7
281#define PM_REG1 R6
282#define PM_REG2 R5
283#define PM_REG3 R4
284#define PM_REG4 R3
285#define PM_REG5 R2
286#define PM_REG6 R1
287#define PM_REG7 R0
288#define PM_REG8 P5
289#define PM_REG9 P4
290#define PM_REG10 P3
291#define PM_REG11 P2
292#define PM_REG12 P1
293#define PM_REG13 P0
294
295#define PM_REGSET0 R7:7
296#define PM_REGSET1 R7:6
297#define PM_REGSET2 R7:5
298#define PM_REGSET3 R7:4
299#define PM_REGSET4 R7:3
300#define PM_REGSET5 R7:2
301#define PM_REGSET6 R7:1
302#define PM_REGSET7 R7:0
303#define PM_REGSET8 R7:0, P5:5
304#define PM_REGSET9 R7:0, P5:4
305#define PM_REGSET10 R7:0, P5:3
306#define PM_REGSET11 R7:0, P5:2
307#define PM_REGSET12 R7:0, P5:1
308#define PM_REGSET13 R7:0, P5:0
309
310#define _PM_PUSH(n, x, w, base) PM_REG##n = w[FP + ((x) - (base))];
311#define _PM_POP(n, x, w, base) w[FP + ((x) - (base))] = PM_REG##n;
312#define PM_PUSH_SYNC(n) [--sp] = (PM_REGSET##n);
313#define PM_POP_SYNC(n) (PM_REGSET##n) = [sp++];
314#define PM_PUSH(n, x) PM_REG##n = [FP++];
315#define PM_POP(n, x) [FP--] = PM_REG##n;
316#define PM_CORE_PUSH(n, x) _PM_PUSH(n, x, , COREMMR_BASE)
317#define PM_CORE_POP(n, x) _PM_POP(n, x, , COREMMR_BASE)
318#define PM_SYS_PUSH(n, x) _PM_PUSH(n, x, , SYSMMR_BASE)
319#define PM_SYS_POP(n, x) _PM_POP(n, x, , SYSMMR_BASE)
320#define PM_SYS_PUSH16(n, x) _PM_PUSH(n, x, w, SYSMMR_BASE)
321#define PM_SYS_POP16(n, x) _PM_POP(n, x, w, SYSMMR_BASE)
322
323ENTRY(_do_hibernate) 287ENTRY(_do_hibernate)
324 /* 288 bfin_cpu_reg_save;
325 * Save the core regs early so we can blow them away when 289 bfin_sys_mmr_save;
326 * saving/restoring MMR states 290 bfin_core_mmr_save;
327 */
328 [--sp] = (R7:0, P5:0);
329 [--sp] = fp;
330 [--sp] = usp;
331
332 [--sp] = i0;
333 [--sp] = i1;
334 [--sp] = i2;
335 [--sp] = i3;
336
337 [--sp] = m0;
338 [--sp] = m1;
339 [--sp] = m2;
340 [--sp] = m3;
341
342 [--sp] = l0;
343 [--sp] = l1;
344 [--sp] = l2;
345 [--sp] = l3;
346
347 [--sp] = b0;
348 [--sp] = b1;
349 [--sp] = b2;
350 [--sp] = b3;
351 [--sp] = a0.x;
352 [--sp] = a0.w;
353 [--sp] = a1.x;
354 [--sp] = a1.w;
355
356 [--sp] = LC0;
357 [--sp] = LC1;
358 [--sp] = LT0;
359 [--sp] = LT1;
360 [--sp] = LB0;
361 [--sp] = LB1;
362
363 /* We can't push RETI directly as that'll change IPEND[4] */
364 r7 = RETI;
365 [--sp] = RETS;
366 [--sp] = ASTAT;
367 [--sp] = CYCLES;
368 [--sp] = CYCLES2;
369 [--sp] = SYSCFG;
370 [--sp] = RETX;
371 [--sp] = SEQSTAT;
372 [--sp] = r7;
373
374 /* Save first func arg in M3 */
375 M3 = R0;
376
377 /* Save system MMRs */
378 FP.H = hi(SYSMMR_BASE);
379 FP.L = lo(SYSMMR_BASE);
380
381#ifdef SIC_IMASK0
382 PM_SYS_PUSH(0, SIC_IMASK0)
383 PM_SYS_PUSH(1, SIC_IMASK1)
384# ifdef SIC_IMASK2
385 PM_SYS_PUSH(2, SIC_IMASK2)
386# endif
387#else
388 PM_SYS_PUSH(0, SIC_IMASK)
389#endif
390#ifdef SIC_IAR0
391 PM_SYS_PUSH(3, SIC_IAR0)
392 PM_SYS_PUSH(4, SIC_IAR1)
393 PM_SYS_PUSH(5, SIC_IAR2)
394#endif
395#ifdef SIC_IAR3
396 PM_SYS_PUSH(6, SIC_IAR3)
397#endif
398#ifdef SIC_IAR4
399 PM_SYS_PUSH(7, SIC_IAR4)
400 PM_SYS_PUSH(8, SIC_IAR5)
401 PM_SYS_PUSH(9, SIC_IAR6)
402#endif
403#ifdef SIC_IAR7
404 PM_SYS_PUSH(10, SIC_IAR7)
405#endif
406#ifdef SIC_IAR8
407 PM_SYS_PUSH(11, SIC_IAR8)
408 PM_SYS_PUSH(12, SIC_IAR9)
409 PM_SYS_PUSH(13, SIC_IAR10)
410#endif
411 PM_PUSH_SYNC(13)
412#ifdef SIC_IAR11
413 PM_SYS_PUSH(0, SIC_IAR11)
414#endif
415
416#ifdef SIC_IWR
417 PM_SYS_PUSH(1, SIC_IWR)
418#endif
419#ifdef SIC_IWR0
420 PM_SYS_PUSH(1, SIC_IWR0)
421#endif
422#ifdef SIC_IWR1
423 PM_SYS_PUSH(2, SIC_IWR1)
424#endif
425#ifdef SIC_IWR2
426 PM_SYS_PUSH(3, SIC_IWR2)
427#endif
428
429#ifdef PINT0_ASSIGN
430 PM_SYS_PUSH(4, PINT0_MASK_SET)
431 PM_SYS_PUSH(5, PINT1_MASK_SET)
432 PM_SYS_PUSH(6, PINT2_MASK_SET)
433 PM_SYS_PUSH(7, PINT3_MASK_SET)
434 PM_SYS_PUSH(8, PINT0_ASSIGN)
435 PM_SYS_PUSH(9, PINT1_ASSIGN)
436 PM_SYS_PUSH(10, PINT2_ASSIGN)
437 PM_SYS_PUSH(11, PINT3_ASSIGN)
438 PM_SYS_PUSH(12, PINT0_INVERT_SET)
439 PM_SYS_PUSH(13, PINT1_INVERT_SET)
440 PM_PUSH_SYNC(13)
441 PM_SYS_PUSH(0, PINT2_INVERT_SET)
442 PM_SYS_PUSH(1, PINT3_INVERT_SET)
443 PM_SYS_PUSH(2, PINT0_EDGE_SET)
444 PM_SYS_PUSH(3, PINT1_EDGE_SET)
445 PM_SYS_PUSH(4, PINT2_EDGE_SET)
446 PM_SYS_PUSH(5, PINT3_EDGE_SET)
447#endif
448
449 PM_SYS_PUSH16(6, SYSCR)
450
451 PM_SYS_PUSH16(7, EBIU_AMGCTL)
452 PM_SYS_PUSH(8, EBIU_AMBCTL0)
453 PM_SYS_PUSH(9, EBIU_AMBCTL1)
454#ifdef EBIU_FCTL
455 PM_SYS_PUSH(10, EBIU_MBSCTL)
456 PM_SYS_PUSH(11, EBIU_MODE)
457 PM_SYS_PUSH(12, EBIU_FCTL)
458 PM_PUSH_SYNC(12)
459#else
460 PM_PUSH_SYNC(9)
461#endif
462
463 /* Save Core MMRs */
464 I0.H = hi(COREMMR_BASE);
465 I0.L = lo(COREMMR_BASE);
466 I1 = I0;
467 I2 = I0;
468 I3 = I0;
469 B0 = I0;
470 B1 = I0;
471 B2 = I0;
472 B3 = I0;
473 I1.L = lo(DCPLB_ADDR0);
474 I2.L = lo(DCPLB_DATA0);
475 I3.L = lo(ICPLB_ADDR0);
476 B0.L = lo(ICPLB_DATA0);
477 B1.L = lo(EVT2);
478 B2.L = lo(IMASK);
479 B3.L = lo(TCNTL);
480
481 /* DCPLB Addr */
482 FP = I1;
483 PM_PUSH(0, DCPLB_ADDR0)
484 PM_PUSH(1, DCPLB_ADDR1)
485 PM_PUSH(2, DCPLB_ADDR2)
486 PM_PUSH(3, DCPLB_ADDR3)
487 PM_PUSH(4, DCPLB_ADDR4)
488 PM_PUSH(5, DCPLB_ADDR5)
489 PM_PUSH(6, DCPLB_ADDR6)
490 PM_PUSH(7, DCPLB_ADDR7)
491 PM_PUSH(8, DCPLB_ADDR8)
492 PM_PUSH(9, DCPLB_ADDR9)
493 PM_PUSH(10, DCPLB_ADDR10)
494 PM_PUSH(11, DCPLB_ADDR11)
495 PM_PUSH(12, DCPLB_ADDR12)
496 PM_PUSH(13, DCPLB_ADDR13)
497 PM_PUSH_SYNC(13)
498 PM_PUSH(0, DCPLB_ADDR14)
499 PM_PUSH(1, DCPLB_ADDR15)
500
501 /* DCPLB Data */
502 FP = I2;
503 PM_PUSH(2, DCPLB_DATA0)
504 PM_PUSH(3, DCPLB_DATA1)
505 PM_PUSH(4, DCPLB_DATA2)
506 PM_PUSH(5, DCPLB_DATA3)
507 PM_PUSH(6, DCPLB_DATA4)
508 PM_PUSH(7, DCPLB_DATA5)
509 PM_PUSH(8, DCPLB_DATA6)
510 PM_PUSH(9, DCPLB_DATA7)
511 PM_PUSH(10, DCPLB_DATA8)
512 PM_PUSH(11, DCPLB_DATA9)
513 PM_PUSH(12, DCPLB_DATA10)
514 PM_PUSH(13, DCPLB_DATA11)
515 PM_PUSH_SYNC(13)
516 PM_PUSH(0, DCPLB_DATA12)
517 PM_PUSH(1, DCPLB_DATA13)
518 PM_PUSH(2, DCPLB_DATA14)
519 PM_PUSH(3, DCPLB_DATA15)
520
521 /* ICPLB Addr */
522 FP = I3;
523 PM_PUSH(4, ICPLB_ADDR0)
524 PM_PUSH(5, ICPLB_ADDR1)
525 PM_PUSH(6, ICPLB_ADDR2)
526 PM_PUSH(7, ICPLB_ADDR3)
527 PM_PUSH(8, ICPLB_ADDR4)
528 PM_PUSH(9, ICPLB_ADDR5)
529 PM_PUSH(10, ICPLB_ADDR6)
530 PM_PUSH(11, ICPLB_ADDR7)
531 PM_PUSH(12, ICPLB_ADDR8)
532 PM_PUSH(13, ICPLB_ADDR9)
533 PM_PUSH_SYNC(13)
534 PM_PUSH(0, ICPLB_ADDR10)
535 PM_PUSH(1, ICPLB_ADDR11)
536 PM_PUSH(2, ICPLB_ADDR12)
537 PM_PUSH(3, ICPLB_ADDR13)
538 PM_PUSH(4, ICPLB_ADDR14)
539 PM_PUSH(5, ICPLB_ADDR15)
540
541 /* ICPLB Data */
542 FP = B0;
543 PM_PUSH(6, ICPLB_DATA0)
544 PM_PUSH(7, ICPLB_DATA1)
545 PM_PUSH(8, ICPLB_DATA2)
546 PM_PUSH(9, ICPLB_DATA3)
547 PM_PUSH(10, ICPLB_DATA4)
548 PM_PUSH(11, ICPLB_DATA5)
549 PM_PUSH(12, ICPLB_DATA6)
550 PM_PUSH(13, ICPLB_DATA7)
551 PM_PUSH_SYNC(13)
552 PM_PUSH(0, ICPLB_DATA8)
553 PM_PUSH(1, ICPLB_DATA9)
554 PM_PUSH(2, ICPLB_DATA10)
555 PM_PUSH(3, ICPLB_DATA11)
556 PM_PUSH(4, ICPLB_DATA12)
557 PM_PUSH(5, ICPLB_DATA13)
558 PM_PUSH(6, ICPLB_DATA14)
559 PM_PUSH(7, ICPLB_DATA15)
560
561 /* Event Vectors */
562 FP = B1;
563 PM_PUSH(8, EVT2)
564 PM_PUSH(9, EVT3)
565 FP += 4; /* EVT4 */
566 PM_PUSH(10, EVT5)
567 PM_PUSH(11, EVT6)
568 PM_PUSH(12, EVT7)
569 PM_PUSH(13, EVT8)
570 PM_PUSH_SYNC(13)
571 PM_PUSH(0, EVT9)
572 PM_PUSH(1, EVT10)
573 PM_PUSH(2, EVT11)
574 PM_PUSH(3, EVT12)
575 PM_PUSH(4, EVT13)
576 PM_PUSH(5, EVT14)
577 PM_PUSH(6, EVT15)
578
579 /* CEC */
580 FP = B2;
581 PM_PUSH(7, IMASK)
582 FP += 4; /* IPEND */
583 PM_PUSH(8, ILAT)
584 PM_PUSH(9, IPRIO)
585
586 /* Core Timer */
587 FP = B3;
588 PM_PUSH(10, TCNTL)
589 PM_PUSH(11, TPERIOD)
590 PM_PUSH(12, TSCALE)
591 PM_PUSH(13, TCOUNT)
592 PM_PUSH_SYNC(13)
593
594 /* Misc non-contiguous registers */
595 FP = I0;
596 PM_CORE_PUSH(0, DMEM_CONTROL);
597 PM_CORE_PUSH(1, IMEM_CONTROL);
598 PM_CORE_PUSH(2, TBUFCTL);
599 PM_PUSH_SYNC(2)
600 291
601 /* Setup args to hibernate mode early for pipeline optimization */ 292 /* Setup args to hibernate mode early for pipeline optimization */
602 R0 = M3; 293 R0 = M3;
@@ -618,274 +309,9 @@ ENTRY(_do_hibernate)
618 309
619.Lpm_resume_here: 310.Lpm_resume_here:
620 311
621 /* Restore Core MMRs */ 312 bfin_core_mmr_restore;
622 I0.H = hi(COREMMR_BASE); 313 bfin_sys_mmr_restore;
623 I0.L = lo(COREMMR_BASE); 314 bfin_cpu_reg_restore;
624 I1 = I0;
625 I2 = I0;
626 I3 = I0;
627 B0 = I0;
628 B1 = I0;
629 B2 = I0;
630 B3 = I0;
631 I1.L = lo(DCPLB_ADDR15);
632 I2.L = lo(DCPLB_DATA15);
633 I3.L = lo(ICPLB_ADDR15);
634 B0.L = lo(ICPLB_DATA15);
635 B1.L = lo(EVT15);
636 B2.L = lo(IPRIO);
637 B3.L = lo(TCOUNT);
638
639 /* Misc non-contiguous registers */
640 FP = I0;
641 PM_POP_SYNC(2)
642 PM_CORE_POP(2, TBUFCTL)
643 PM_CORE_POP(1, IMEM_CONTROL)
644 PM_CORE_POP(0, DMEM_CONTROL)
645
646 /* Core Timer */
647 PM_POP_SYNC(13)
648 FP = B3;
649 PM_POP(13, TCOUNT)
650 PM_POP(12, TSCALE)
651 PM_POP(11, TPERIOD)
652 PM_POP(10, TCNTL)
653
654 /* CEC */
655 FP = B2;
656 PM_POP(9, IPRIO)
657 PM_POP(8, ILAT)
658 FP += -4; /* IPEND */
659 PM_POP(7, IMASK)
660
661 /* Event Vectors */
662 FP = B1;
663 PM_POP(6, EVT15)
664 PM_POP(5, EVT14)
665 PM_POP(4, EVT13)
666 PM_POP(3, EVT12)
667 PM_POP(2, EVT11)
668 PM_POP(1, EVT10)
669 PM_POP(0, EVT9)
670 PM_POP_SYNC(13)
671 PM_POP(13, EVT8)
672 PM_POP(12, EVT7)
673 PM_POP(11, EVT6)
674 PM_POP(10, EVT5)
675 FP += -4; /* EVT4 */
676 PM_POP(9, EVT3)
677 PM_POP(8, EVT2)
678
679 /* ICPLB Data */
680 FP = B0;
681 PM_POP(7, ICPLB_DATA15)
682 PM_POP(6, ICPLB_DATA14)
683 PM_POP(5, ICPLB_DATA13)
684 PM_POP(4, ICPLB_DATA12)
685 PM_POP(3, ICPLB_DATA11)
686 PM_POP(2, ICPLB_DATA10)
687 PM_POP(1, ICPLB_DATA9)
688 PM_POP(0, ICPLB_DATA8)
689 PM_POP_SYNC(13)
690 PM_POP(13, ICPLB_DATA7)
691 PM_POP(12, ICPLB_DATA6)
692 PM_POP(11, ICPLB_DATA5)
693 PM_POP(10, ICPLB_DATA4)
694 PM_POP(9, ICPLB_DATA3)
695 PM_POP(8, ICPLB_DATA2)
696 PM_POP(7, ICPLB_DATA1)
697 PM_POP(6, ICPLB_DATA0)
698
699 /* ICPLB Addr */
700 FP = I3;
701 PM_POP(5, ICPLB_ADDR15)
702 PM_POP(4, ICPLB_ADDR14)
703 PM_POP(3, ICPLB_ADDR13)
704 PM_POP(2, ICPLB_ADDR12)
705 PM_POP(1, ICPLB_ADDR11)
706 PM_POP(0, ICPLB_ADDR10)
707 PM_POP_SYNC(13)
708 PM_POP(13, ICPLB_ADDR9)
709 PM_POP(12, ICPLB_ADDR8)
710 PM_POP(11, ICPLB_ADDR7)
711 PM_POP(10, ICPLB_ADDR6)
712 PM_POP(9, ICPLB_ADDR5)
713 PM_POP(8, ICPLB_ADDR4)
714 PM_POP(7, ICPLB_ADDR3)
715 PM_POP(6, ICPLB_ADDR2)
716 PM_POP(5, ICPLB_ADDR1)
717 PM_POP(4, ICPLB_ADDR0)
718
719 /* DCPLB Data */
720 FP = I2;
721 PM_POP(3, DCPLB_DATA15)
722 PM_POP(2, DCPLB_DATA14)
723 PM_POP(1, DCPLB_DATA13)
724 PM_POP(0, DCPLB_DATA12)
725 PM_POP_SYNC(13)
726 PM_POP(13, DCPLB_DATA11)
727 PM_POP(12, DCPLB_DATA10)
728 PM_POP(11, DCPLB_DATA9)
729 PM_POP(10, DCPLB_DATA8)
730 PM_POP(9, DCPLB_DATA7)
731 PM_POP(8, DCPLB_DATA6)
732 PM_POP(7, DCPLB_DATA5)
733 PM_POP(6, DCPLB_DATA4)
734 PM_POP(5, DCPLB_DATA3)
735 PM_POP(4, DCPLB_DATA2)
736 PM_POP(3, DCPLB_DATA1)
737 PM_POP(2, DCPLB_DATA0)
738
739 /* DCPLB Addr */
740 FP = I1;
741 PM_POP(1, DCPLB_ADDR15)
742 PM_POP(0, DCPLB_ADDR14)
743 PM_POP_SYNC(13)
744 PM_POP(13, DCPLB_ADDR13)
745 PM_POP(12, DCPLB_ADDR12)
746 PM_POP(11, DCPLB_ADDR11)
747 PM_POP(10, DCPLB_ADDR10)
748 PM_POP(9, DCPLB_ADDR9)
749 PM_POP(8, DCPLB_ADDR8)
750 PM_POP(7, DCPLB_ADDR7)
751 PM_POP(6, DCPLB_ADDR6)
752 PM_POP(5, DCPLB_ADDR5)
753 PM_POP(4, DCPLB_ADDR4)
754 PM_POP(3, DCPLB_ADDR3)
755 PM_POP(2, DCPLB_ADDR2)
756 PM_POP(1, DCPLB_ADDR1)
757 PM_POP(0, DCPLB_ADDR0)
758
759 /* Restore System MMRs */
760 FP.H = hi(SYSMMR_BASE);
761 FP.L = lo(SYSMMR_BASE);
762
763#ifdef EBIU_FCTL
764 PM_POP_SYNC(12)
765 PM_SYS_POP(12, EBIU_FCTL)
766 PM_SYS_POP(11, EBIU_MODE)
767 PM_SYS_POP(10, EBIU_MBSCTL)
768#else
769 PM_POP_SYNC(9)
770#endif
771 PM_SYS_POP(9, EBIU_AMBCTL1)
772 PM_SYS_POP(8, EBIU_AMBCTL0)
773 PM_SYS_POP16(7, EBIU_AMGCTL)
774
775 PM_SYS_POP16(6, SYSCR)
776
777#ifdef PINT0_ASSIGN
778 PM_SYS_POP(5, PINT3_EDGE_SET)
779 PM_SYS_POP(4, PINT2_EDGE_SET)
780 PM_SYS_POP(3, PINT1_EDGE_SET)
781 PM_SYS_POP(2, PINT0_EDGE_SET)
782 PM_SYS_POP(1, PINT3_INVERT_SET)
783 PM_SYS_POP(0, PINT2_INVERT_SET)
784 PM_POP_SYNC(13)
785 PM_SYS_POP(13, PINT1_INVERT_SET)
786 PM_SYS_POP(12, PINT0_INVERT_SET)
787 PM_SYS_POP(11, PINT3_ASSIGN)
788 PM_SYS_POP(10, PINT2_ASSIGN)
789 PM_SYS_POP(9, PINT1_ASSIGN)
790 PM_SYS_POP(8, PINT0_ASSIGN)
791 PM_SYS_POP(7, PINT3_MASK_SET)
792 PM_SYS_POP(6, PINT2_MASK_SET)
793 PM_SYS_POP(5, PINT1_MASK_SET)
794 PM_SYS_POP(4, PINT0_MASK_SET)
795#endif
796
797#ifdef SIC_IWR2
798 PM_SYS_POP(3, SIC_IWR2)
799#endif
800#ifdef SIC_IWR1
801 PM_SYS_POP(2, SIC_IWR1)
802#endif
803#ifdef SIC_IWR0
804 PM_SYS_POP(1, SIC_IWR0)
805#endif
806#ifdef SIC_IWR
807 PM_SYS_POP(1, SIC_IWR)
808#endif
809
810#ifdef SIC_IAR11
811 PM_SYS_POP(0, SIC_IAR11)
812#endif
813 PM_POP_SYNC(13)
814#ifdef SIC_IAR8
815 PM_SYS_POP(13, SIC_IAR10)
816 PM_SYS_POP(12, SIC_IAR9)
817 PM_SYS_POP(11, SIC_IAR8)
818#endif
819#ifdef SIC_IAR7
820 PM_SYS_POP(10, SIC_IAR7)
821#endif
822#ifdef SIC_IAR6
823 PM_SYS_POP(9, SIC_IAR6)
824 PM_SYS_POP(8, SIC_IAR5)
825 PM_SYS_POP(7, SIC_IAR4)
826#endif
827#ifdef SIC_IAR3
828 PM_SYS_POP(6, SIC_IAR3)
829#endif
830#ifdef SIC_IAR0
831 PM_SYS_POP(5, SIC_IAR2)
832 PM_SYS_POP(4, SIC_IAR1)
833 PM_SYS_POP(3, SIC_IAR0)
834#endif
835#ifdef SIC_IMASK0
836# ifdef SIC_IMASK2
837 PM_SYS_POP(2, SIC_IMASK2)
838# endif
839 PM_SYS_POP(1, SIC_IMASK1)
840 PM_SYS_POP(0, SIC_IMASK0)
841#else
842 PM_SYS_POP(0, SIC_IMASK)
843#endif
844
845 /* Restore Core Registers */
846 RETI = [sp++];
847 SEQSTAT = [sp++];
848 RETX = [sp++];
849 SYSCFG = [sp++];
850 CYCLES2 = [sp++];
851 CYCLES = [sp++];
852 ASTAT = [sp++];
853 RETS = [sp++];
854
855 LB1 = [sp++];
856 LB0 = [sp++];
857 LT1 = [sp++];
858 LT0 = [sp++];
859 LC1 = [sp++];
860 LC0 = [sp++];
861
862 a1.w = [sp++];
863 a1.x = [sp++];
864 a0.w = [sp++];
865 a0.x = [sp++];
866 b3 = [sp++];
867 b2 = [sp++];
868 b1 = [sp++];
869 b0 = [sp++];
870
871 l3 = [sp++];
872 l2 = [sp++];
873 l1 = [sp++];
874 l0 = [sp++];
875
876 m3 = [sp++];
877 m2 = [sp++];
878 m1 = [sp++];
879 m0 = [sp++];
880
881 i3 = [sp++];
882 i2 = [sp++];
883 i1 = [sp++];
884 i0 = [sp++];
885
886 usp = [sp++];
887 fp = [sp++];
888 (R7:0, P5:0) = [sp++];
889 315
890 [--sp] = RETI; /* Clear Global Interrupt Disable */ 316 [--sp] = RETI; /* Clear Global Interrupt Disable */
891 SP += 4; 317 SP += 4;
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index 4698a9800522..80aa2535e2c9 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -1141,7 +1141,8 @@ ENTRY(_schedule_and_signal_from_int)
1141 sti r0; 1141 sti r0;
1142 1142
1143 /* finish the userspace "atomic" functions for it */ 1143 /* finish the userspace "atomic" functions for it */
1144 r1 = FIXED_CODE_END; 1144 r1.l = lo(FIXED_CODE_END);
1145 r1.h = hi(FIXED_CODE_END);
1145 r2 = [sp + PT_PC]; 1146 r2 = [sp + PT_PC];
1146 cc = r1 <= r2; 1147 cc = r1 <= r2;
1147 if cc jump .Lresume_userspace (bp); 1148 if cc jump .Lresume_userspace (bp);
@@ -1376,7 +1377,7 @@ END(_ex_table)
1376ENTRY(_sys_call_table) 1377ENTRY(_sys_call_table)
1377 .long _sys_restart_syscall /* 0 */ 1378 .long _sys_restart_syscall /* 0 */
1378 .long _sys_exit 1379 .long _sys_exit
1379 .long _sys_fork 1380 .long _sys_ni_syscall /* fork */
1380 .long _sys_read 1381 .long _sys_read
1381 .long _sys_write 1382 .long _sys_write
1382 .long _sys_open /* 5 */ 1383 .long _sys_open /* 5 */
diff --git a/arch/blackfin/mach-common/head.S b/arch/blackfin/mach-common/head.S
index 8b4d98854403..31515f0146f9 100644
--- a/arch/blackfin/mach-common/head.S
+++ b/arch/blackfin/mach-common/head.S
@@ -210,14 +210,12 @@ ENDPROC(__start)
210ENTRY(_real_start) 210ENTRY(_real_start)
211 /* Enable nested interrupts */ 211 /* Enable nested interrupts */
212 [--sp] = reti; 212 [--sp] = reti;
213
214 /* watchdog off for now */ 213 /* watchdog off for now */
215 p0.l = lo(WDOG_CTL); 214 p0.l = lo(WDOG_CTL);
216 p0.h = hi(WDOG_CTL); 215 p0.h = hi(WDOG_CTL);
217 r0 = 0xAD6(z); 216 r0 = 0xAD6(z);
218 w[p0] = r0; 217 w[p0] = r0;
219 ssync; 218 ssync;
220
221 /* Pass the u-boot arguments to the global value command line */ 219 /* Pass the u-boot arguments to the global value command line */
222 R0 = R7; 220 R0 = R7;
223 call _cmdline_init; 221 call _cmdline_init;
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c
index 332dace6af34..2729cba715b0 100644
--- a/arch/blackfin/mach-common/ints-priority.c
+++ b/arch/blackfin/mach-common/ints-priority.c
@@ -16,6 +16,8 @@
16#include <linux/seq_file.h> 16#include <linux/seq_file.h>
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/sched.h> 18#include <linux/sched.h>
19#include <linux/syscore_ops.h>
20#include <asm/delay.h>
19#ifdef CONFIG_IPIPE 21#ifdef CONFIG_IPIPE
20#include <linux/ipipe.h> 22#include <linux/ipipe.h>
21#endif 23#endif
@@ -25,7 +27,11 @@
25#include <asm/irq_handler.h> 27#include <asm/irq_handler.h>
26#include <asm/dpmc.h> 28#include <asm/dpmc.h>
27 29
28#define SIC_SYSIRQ(irq) (irq - (IRQ_CORETMR + 1)) 30#ifndef CONFIG_BF60x
31# define SIC_SYSIRQ(irq) (irq - (IRQ_CORETMR + 1))
32#else
33# define SIC_SYSIRQ(irq) ((irq) - IVG15)
34#endif
29 35
30/* 36/*
31 * NOTES: 37 * NOTES:
@@ -50,6 +56,7 @@ unsigned long bfin_sic_iwr[3]; /* Up to 3 SIC_IWRx registers */
50unsigned vr_wakeup; 56unsigned vr_wakeup;
51#endif 57#endif
52 58
59#ifndef CONFIG_BF60x
53static struct ivgx { 60static struct ivgx {
54 /* irq number for request_irq, available in mach-bf5xx/irq.h */ 61 /* irq number for request_irq, available in mach-bf5xx/irq.h */
55 unsigned int irqno; 62 unsigned int irqno;
@@ -78,7 +85,8 @@ static void __init search_IAR(void)
78 85
79 for (irqN = 0; irqN < NR_PERI_INTS; irqN += 4) { 86 for (irqN = 0; irqN < NR_PERI_INTS; irqN += 4) {
80 int irqn; 87 int irqn;
81 u32 iar = bfin_read32((unsigned long *)SIC_IAR0 + 88 u32 iar =
89 bfin_read32((unsigned long *)SIC_IAR0 +
82#if defined(CONFIG_BF51x) || defined(CONFIG_BF52x) || \ 90#if defined(CONFIG_BF51x) || defined(CONFIG_BF52x) || \
83 defined(CONFIG_BF538) || defined(CONFIG_BF539) 91 defined(CONFIG_BF538) || defined(CONFIG_BF539)
84 ((irqN % 32) >> 3) + ((irqN / 32) * ((SIC_IAR4 - SIC_IAR0) / 4)) 92 ((irqN % 32) >> 3) + ((irqN / 32) * ((SIC_IAR4 - SIC_IAR0) / 4))
@@ -86,7 +94,6 @@ static void __init search_IAR(void)
86 (irqN >> 3) 94 (irqN >> 3)
87#endif 95#endif
88 ); 96 );
89
90 for (irqn = irqN; irqn < irqN + 4; ++irqn) { 97 for (irqn = irqN; irqn < irqN + 4; ++irqn) {
91 int iar_shift = (irqn & 7) * 4; 98 int iar_shift = (irqn & 7) * 4;
92 if (ivg == (0xf & (iar >> iar_shift))) { 99 if (ivg == (0xf & (iar >> iar_shift))) {
@@ -99,11 +106,11 @@ static void __init search_IAR(void)
99 } 106 }
100 } 107 }
101} 108}
109#endif
102 110
103/* 111/*
104 * This is for core internal IRQs 112 * This is for core internal IRQs
105 */ 113 */
106
107void bfin_ack_noop(struct irq_data *d) 114void bfin_ack_noop(struct irq_data *d)
108{ 115{
109 /* Dummy function. */ 116 /* Dummy function. */
@@ -136,21 +143,21 @@ static void bfin_core_unmask_irq(struct irq_data *d)
136void bfin_internal_mask_irq(unsigned int irq) 143void bfin_internal_mask_irq(unsigned int irq)
137{ 144{
138 unsigned long flags = hard_local_irq_save(); 145 unsigned long flags = hard_local_irq_save();
139 146#ifndef CONFIG_BF60x
140#ifdef SIC_IMASK0 147#ifdef SIC_IMASK0
141 unsigned mask_bank = SIC_SYSIRQ(irq) / 32; 148 unsigned mask_bank = SIC_SYSIRQ(irq) / 32;
142 unsigned mask_bit = SIC_SYSIRQ(irq) % 32; 149 unsigned mask_bit = SIC_SYSIRQ(irq) % 32;
143 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) & 150 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) &
144 ~(1 << mask_bit)); 151 ~(1 << mask_bit));
145# ifdef CONFIG_SMP 152# if defined(CONFIG_SMP) || defined(CONFIG_ICC)
146 bfin_write_SICB_IMASK(mask_bank, bfin_read_SICB_IMASK(mask_bank) & 153 bfin_write_SICB_IMASK(mask_bank, bfin_read_SICB_IMASK(mask_bank) &
147 ~(1 << mask_bit)); 154 ~(1 << mask_bit));
148# endif 155# endif
149#else 156#else
150 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() & 157 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() &
151 ~(1 << SIC_SYSIRQ(irq))); 158 ~(1 << SIC_SYSIRQ(irq)));
159#endif /* end of SIC_IMASK0 */
152#endif 160#endif
153
154 hard_local_irq_restore(flags); 161 hard_local_irq_restore(flags);
155} 162}
156 163
@@ -160,7 +167,7 @@ static void bfin_internal_mask_irq_chip(struct irq_data *d)
160} 167}
161 168
162#ifdef CONFIG_SMP 169#ifdef CONFIG_SMP
163static void bfin_internal_unmask_irq_affinity(unsigned int irq, 170void bfin_internal_unmask_irq_affinity(unsigned int irq,
164 const struct cpumask *affinity) 171 const struct cpumask *affinity)
165#else 172#else
166void bfin_internal_unmask_irq(unsigned int irq) 173void bfin_internal_unmask_irq(unsigned int irq)
@@ -168,6 +175,7 @@ void bfin_internal_unmask_irq(unsigned int irq)
168{ 175{
169 unsigned long flags = hard_local_irq_save(); 176 unsigned long flags = hard_local_irq_save();
170 177
178#ifndef CONFIG_BF60x
171#ifdef SIC_IMASK0 179#ifdef SIC_IMASK0
172 unsigned mask_bank = SIC_SYSIRQ(irq) / 32; 180 unsigned mask_bank = SIC_SYSIRQ(irq) / 32;
173 unsigned mask_bit = SIC_SYSIRQ(irq) % 32; 181 unsigned mask_bit = SIC_SYSIRQ(irq) % 32;
@@ -175,22 +183,239 @@ void bfin_internal_unmask_irq(unsigned int irq)
175 if (cpumask_test_cpu(0, affinity)) 183 if (cpumask_test_cpu(0, affinity))
176# endif 184# endif
177 bfin_write_SIC_IMASK(mask_bank, 185 bfin_write_SIC_IMASK(mask_bank,
178 bfin_read_SIC_IMASK(mask_bank) | 186 bfin_read_SIC_IMASK(mask_bank) |
179 (1 << mask_bit)); 187 (1 << mask_bit));
180# ifdef CONFIG_SMP 188# ifdef CONFIG_SMP
181 if (cpumask_test_cpu(1, affinity)) 189 if (cpumask_test_cpu(1, affinity))
182 bfin_write_SICB_IMASK(mask_bank, 190 bfin_write_SICB_IMASK(mask_bank,
183 bfin_read_SICB_IMASK(mask_bank) | 191 bfin_read_SICB_IMASK(mask_bank) |
184 (1 << mask_bit)); 192 (1 << mask_bit));
185# endif 193# endif
186#else 194#else
187 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() | 195 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() |
188 (1 << SIC_SYSIRQ(irq))); 196 (1 << SIC_SYSIRQ(irq)));
197#endif
189#endif 198#endif
199 hard_local_irq_restore(flags);
200}
201
202#ifdef CONFIG_BF60x
203static void bfin_sec_preflow_handler(struct irq_data *d)
204{
205 unsigned long flags = hard_local_irq_save();
206 unsigned int sid = SIC_SYSIRQ(d->irq);
207
208 bfin_write_SEC_SCI(0, SEC_CSID, sid);
209
210 hard_local_irq_restore(flags);
211}
212
213static void bfin_sec_mask_ack_irq(struct irq_data *d)
214{
215 unsigned long flags = hard_local_irq_save();
216 unsigned int sid = SIC_SYSIRQ(d->irq);
217
218 bfin_write_SEC_SCI(0, SEC_CSID, sid);
190 219
191 hard_local_irq_restore(flags); 220 hard_local_irq_restore(flags);
192} 221}
193 222
223static void bfin_sec_unmask_irq(struct irq_data *d)
224{
225 unsigned long flags = hard_local_irq_save();
226 unsigned int sid = SIC_SYSIRQ(d->irq);
227
228 bfin_write32(SEC_END, sid);
229
230 hard_local_irq_restore(flags);
231}
232
233static void bfin_sec_enable_ssi(unsigned int sid)
234{
235 unsigned long flags = hard_local_irq_save();
236 uint32_t reg_sctl = bfin_read_SEC_SCTL(sid);
237
238 reg_sctl |= SEC_SCTL_SRC_EN;
239 bfin_write_SEC_SCTL(sid, reg_sctl);
240
241 hard_local_irq_restore(flags);
242}
243
244static void bfin_sec_disable_ssi(unsigned int sid)
245{
246 unsigned long flags = hard_local_irq_save();
247 uint32_t reg_sctl = bfin_read_SEC_SCTL(sid);
248
249 reg_sctl &= ((uint32_t)~SEC_SCTL_SRC_EN);
250 bfin_write_SEC_SCTL(sid, reg_sctl);
251
252 hard_local_irq_restore(flags);
253}
254
255static void bfin_sec_set_ssi_coreid(unsigned int sid, unsigned int coreid)
256{
257 unsigned long flags = hard_local_irq_save();
258 uint32_t reg_sctl = bfin_read_SEC_SCTL(sid);
259
260 reg_sctl &= ((uint32_t)~SEC_SCTL_CTG);
261 bfin_write_SEC_SCTL(sid, reg_sctl | ((coreid << 20) & SEC_SCTL_CTG));
262
263 hard_local_irq_restore(flags);
264}
265
266static void bfin_sec_enable_sci(unsigned int sid)
267{
268 unsigned long flags = hard_local_irq_save();
269 uint32_t reg_sctl = bfin_read_SEC_SCTL(sid);
270
271 if (sid == SIC_SYSIRQ(IRQ_WATCH0))
272 reg_sctl |= SEC_SCTL_FAULT_EN;
273 else
274 reg_sctl |= SEC_SCTL_INT_EN;
275 bfin_write_SEC_SCTL(sid, reg_sctl);
276
277 hard_local_irq_restore(flags);
278}
279
280static void bfin_sec_disable_sci(unsigned int sid)
281{
282 unsigned long flags = hard_local_irq_save();
283 uint32_t reg_sctl = bfin_read_SEC_SCTL(sid);
284
285 reg_sctl &= ((uint32_t)~SEC_SCTL_INT_EN);
286 bfin_write_SEC_SCTL(sid, reg_sctl);
287
288 hard_local_irq_restore(flags);
289}
290
291static void bfin_sec_enable(struct irq_data *d)
292{
293 unsigned long flags = hard_local_irq_save();
294 unsigned int sid = SIC_SYSIRQ(d->irq);
295
296 bfin_sec_enable_sci(sid);
297 bfin_sec_enable_ssi(sid);
298
299 hard_local_irq_restore(flags);
300}
301
302static void bfin_sec_disable(struct irq_data *d)
303{
304 unsigned long flags = hard_local_irq_save();
305 unsigned int sid = SIC_SYSIRQ(d->irq);
306
307 bfin_sec_disable_sci(sid);
308 bfin_sec_disable_ssi(sid);
309
310 hard_local_irq_restore(flags);
311}
312
313static void bfin_sec_raise_irq(unsigned int sid)
314{
315 unsigned long flags = hard_local_irq_save();
316
317 bfin_write32(SEC_RAISE, sid);
318
319 hard_local_irq_restore(flags);
320}
321
322static void init_software_driven_irq(void)
323{
324 bfin_sec_set_ssi_coreid(34, 0);
325 bfin_sec_set_ssi_coreid(35, 1);
326 bfin_sec_set_ssi_coreid(36, 0);
327 bfin_sec_set_ssi_coreid(37, 1);
328}
329
330void bfin_sec_resume(void)
331{
332 bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_RESET);
333 udelay(100);
334 bfin_write_SEC_GCTL(SEC_GCTL_EN);
335 bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_EN | SEC_CCTL_NMI_EN);
336}
337
338void handle_sec_sfi_fault(uint32_t gstat)
339{
340
341}
342
343void handle_sec_sci_fault(uint32_t gstat)
344{
345 uint32_t core_id;
346 uint32_t cstat;
347
348 core_id = gstat & SEC_GSTAT_SCI;
349 cstat = bfin_read_SEC_SCI(core_id, SEC_CSTAT);
350 if (cstat & SEC_CSTAT_ERR) {
351 switch (cstat & SEC_CSTAT_ERRC) {
352 case SEC_CSTAT_ACKERR:
353 printk(KERN_DEBUG "sec ack err\n");
354 break;
355 default:
356 printk(KERN_DEBUG "sec sci unknow err\n");
357 }
358 }
359
360}
361
362void handle_sec_ssi_fault(uint32_t gstat)
363{
364 uint32_t sid;
365 uint32_t sstat;
366
367 sid = gstat & SEC_GSTAT_SID;
368 sstat = bfin_read_SEC_SSTAT(sid);
369
370}
371
372void handle_sec_fault(unsigned int irq, struct irq_desc *desc)
373{
374 uint32_t sec_gstat;
375
376 raw_spin_lock(&desc->lock);
377
378 sec_gstat = bfin_read32(SEC_GSTAT);
379 if (sec_gstat & SEC_GSTAT_ERR) {
380
381 switch (sec_gstat & SEC_GSTAT_ERRC) {
382 case 0:
383 handle_sec_sfi_fault(sec_gstat);
384 break;
385 case SEC_GSTAT_SCIERR:
386 handle_sec_sci_fault(sec_gstat);
387 break;
388 case SEC_GSTAT_SSIERR:
389 handle_sec_ssi_fault(sec_gstat);
390 break;
391 }
392
393
394 }
395
396 raw_spin_unlock(&desc->lock);
397}
398
399static int sec_suspend(void)
400{
401 return 0;
402}
403
404static void sec_resume(void)
405{
406 bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_RESET);
407 udelay(100);
408 bfin_write_SEC_GCTL(SEC_GCTL_EN);
409 bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_EN | SEC_CCTL_NMI_EN);
410}
411
412static struct syscore_ops sec_pm_syscore_ops = {
413 .suspend = sec_suspend,
414 .resume = sec_resume,
415};
416
417#endif
418
194#ifdef CONFIG_SMP 419#ifdef CONFIG_SMP
195static void bfin_internal_unmask_irq_chip(struct irq_data *d) 420static void bfin_internal_unmask_irq_chip(struct irq_data *d)
196{ 421{
@@ -212,7 +437,7 @@ static void bfin_internal_unmask_irq_chip(struct irq_data *d)
212} 437}
213#endif 438#endif
214 439
215#ifdef CONFIG_PM 440#if defined(CONFIG_PM) && !defined(CONFIG_BF60x)
216int bfin_internal_set_wake(unsigned int irq, unsigned int state) 441int bfin_internal_set_wake(unsigned int irq, unsigned int state)
217{ 442{
218 u32 bank, bit, wakeup = 0; 443 u32 bank, bit, wakeup = 0;
@@ -271,22 +496,20 @@ static int bfin_internal_set_wake_chip(struct irq_data *d, unsigned int state)
271 return bfin_internal_set_wake(d->irq, state); 496 return bfin_internal_set_wake(d->irq, state);
272} 497}
273#else 498#else
499# define bfin_internal_set_wake(irq, state)
274# define bfin_internal_set_wake_chip NULL 500# define bfin_internal_set_wake_chip NULL
275#endif 501#endif
276 502
277static struct irq_chip bfin_core_irqchip = { 503static struct irq_chip bfin_core_irqchip = {
278 .name = "CORE", 504 .name = "CORE",
279 .irq_ack = bfin_ack_noop,
280 .irq_mask = bfin_core_mask_irq, 505 .irq_mask = bfin_core_mask_irq,
281 .irq_unmask = bfin_core_unmask_irq, 506 .irq_unmask = bfin_core_unmask_irq,
282}; 507};
283 508
284static struct irq_chip bfin_internal_irqchip = { 509static struct irq_chip bfin_internal_irqchip = {
285 .name = "INTN", 510 .name = "INTN",
286 .irq_ack = bfin_ack_noop,
287 .irq_mask = bfin_internal_mask_irq_chip, 511 .irq_mask = bfin_internal_mask_irq_chip,
288 .irq_unmask = bfin_internal_unmask_irq_chip, 512 .irq_unmask = bfin_internal_unmask_irq_chip,
289 .irq_mask_ack = bfin_internal_mask_irq_chip,
290 .irq_disable = bfin_internal_mask_irq_chip, 513 .irq_disable = bfin_internal_mask_irq_chip,
291 .irq_enable = bfin_internal_unmask_irq_chip, 514 .irq_enable = bfin_internal_unmask_irq_chip,
292#ifdef CONFIG_SMP 515#ifdef CONFIG_SMP
@@ -295,6 +518,18 @@ static struct irq_chip bfin_internal_irqchip = {
295 .irq_set_wake = bfin_internal_set_wake_chip, 518 .irq_set_wake = bfin_internal_set_wake_chip,
296}; 519};
297 520
521#ifdef CONFIG_BF60x
522static struct irq_chip bfin_sec_irqchip = {
523 .name = "SEC",
524 .irq_mask_ack = bfin_sec_mask_ack_irq,
525 .irq_mask = bfin_sec_mask_ack_irq,
526 .irq_unmask = bfin_sec_unmask_irq,
527 .irq_eoi = bfin_sec_unmask_irq,
528 .irq_disable = bfin_sec_disable,
529 .irq_enable = bfin_sec_enable,
530};
531#endif
532
298void bfin_handle_irq(unsigned irq) 533void bfin_handle_irq(unsigned irq)
299{ 534{
300#ifdef CONFIG_IPIPE 535#ifdef CONFIG_IPIPE
@@ -396,8 +631,6 @@ int bfin_mac_status_set_wake(struct irq_data *d, unsigned int state)
396 631
397static struct irq_chip bfin_mac_status_irqchip = { 632static struct irq_chip bfin_mac_status_irqchip = {
398 .name = "MACST", 633 .name = "MACST",
399 .irq_ack = bfin_ack_noop,
400 .irq_mask_ack = bfin_mac_status_mask_irq,
401 .irq_mask = bfin_mac_status_mask_irq, 634 .irq_mask = bfin_mac_status_mask_irq,
402 .irq_unmask = bfin_mac_status_unmask_irq, 635 .irq_unmask = bfin_mac_status_unmask_irq,
403 .irq_set_wake = bfin_mac_status_set_wake, 636 .irq_set_wake = bfin_mac_status_set_wake,
@@ -421,15 +654,15 @@ void bfin_demux_mac_status_irq(unsigned int int_err_irq,
421 } else { 654 } else {
422 bfin_mac_status_ack_irq(irq); 655 bfin_mac_status_ack_irq(irq);
423 pr_debug("IRQ %d:" 656 pr_debug("IRQ %d:"
424 " MASKED MAC ERROR INTERRUPT ASSERTED\n", 657 " MASKED MAC ERROR INTERRUPT ASSERTED\n",
425 irq); 658 irq);
426 } 659 }
427 } else 660 } else
428 printk(KERN_ERR 661 printk(KERN_ERR
429 "%s : %s : LINE %d :\nIRQ ?: MAC ERROR" 662 "%s : %s : LINE %d :\nIRQ ?: MAC ERROR"
430 " INTERRUPT ASSERTED BUT NO SOURCE FOUND" 663 " INTERRUPT ASSERTED BUT NO SOURCE FOUND"
431 "(EMAC_SYSTAT=0x%X)\n", 664 "(EMAC_SYSTAT=0x%X)\n",
432 __func__, __FILE__, __LINE__, status); 665 __func__, __FILE__, __LINE__, status);
433} 666}
434#endif 667#endif
435 668
@@ -583,7 +816,7 @@ static void bfin_demux_gpio_block(unsigned int irq)
583} 816}
584 817
585void bfin_demux_gpio_irq(unsigned int inta_irq, 818void bfin_demux_gpio_irq(unsigned int inta_irq,
586 struct irq_desc *desc) 819 struct irq_desc *desc)
587{ 820{
588 unsigned int irq; 821 unsigned int irq;
589 822
@@ -635,9 +868,15 @@ void bfin_demux_gpio_irq(unsigned int inta_irq,
635 868
636#else 869#else
637 870
871# ifndef CONFIG_BF60x
638#define NR_PINT_SYS_IRQS 4 872#define NR_PINT_SYS_IRQS 4
639#define NR_PINT_BITS 32
640#define NR_PINTS 160 873#define NR_PINTS 160
874# else
875#define NR_PINT_SYS_IRQS 6
876#define NR_PINTS 112
877#endif
878
879#define NR_PINT_BITS 32
641#define IRQ_NOT_AVAIL 0xFF 880#define IRQ_NOT_AVAIL 0xFF
642 881
643#define PINT_2_BANK(x) ((x) >> 5) 882#define PINT_2_BANK(x) ((x) >> 5)
@@ -652,8 +891,13 @@ static struct bfin_pint_regs * const pint[NR_PINT_SYS_IRQS] = {
652 (struct bfin_pint_regs *)PINT1_MASK_SET, 891 (struct bfin_pint_regs *)PINT1_MASK_SET,
653 (struct bfin_pint_regs *)PINT2_MASK_SET, 892 (struct bfin_pint_regs *)PINT2_MASK_SET,
654 (struct bfin_pint_regs *)PINT3_MASK_SET, 893 (struct bfin_pint_regs *)PINT3_MASK_SET,
894#ifdef CONFIG_BF60x
895 (struct bfin_pint_regs *)PINT4_MASK_SET,
896 (struct bfin_pint_regs *)PINT5_MASK_SET,
897#endif
655}; 898};
656 899
900#ifndef CONFIG_BF60x
657inline unsigned int get_irq_base(u32 bank, u8 bmap) 901inline unsigned int get_irq_base(u32 bank, u8 bmap)
658{ 902{
659 unsigned int irq_base; 903 unsigned int irq_base;
@@ -666,6 +910,16 @@ inline unsigned int get_irq_base(u32 bank, u8 bmap)
666 910
667 return irq_base; 911 return irq_base;
668} 912}
913#else
914inline unsigned int get_irq_base(u32 bank, u8 bmap)
915{
916 unsigned int irq_base;
917
918 irq_base = IRQ_PA0 + bank * 16 + bmap * 16;
919
920 return irq_base;
921}
922#endif
669 923
670 /* Whenever PINTx_ASSIGN is altered init_pint_lut() must be executed! */ 924 /* Whenever PINTx_ASSIGN is altered init_pint_lut() must be executed! */
671void init_pint_lut(void) 925void init_pint_lut(void)
@@ -854,6 +1108,14 @@ static int bfin_gpio_set_wake(struct irq_data *d, unsigned int state)
854 case 1: 1108 case 1:
855 pint_irq = IRQ_PINT1; 1109 pint_irq = IRQ_PINT1;
856 break; 1110 break;
1111#ifdef CONFIG_BF60x
1112 case 4:
1113 pint_irq = IRQ_PINT4;
1114 break;
1115 case 5:
1116 pint_irq = IRQ_PINT5;
1117 break;
1118#endif
857 default: 1119 default:
858 return -EINVAL; 1120 return -EINVAL;
859 } 1121 }
@@ -867,10 +1129,21 @@ static int bfin_gpio_set_wake(struct irq_data *d, unsigned int state)
867#endif 1129#endif
868 1130
869void bfin_demux_gpio_irq(unsigned int inta_irq, 1131void bfin_demux_gpio_irq(unsigned int inta_irq,
870 struct irq_desc *desc) 1132 struct irq_desc *desc)
871{ 1133{
872 u32 bank, pint_val; 1134 u32 bank, pint_val;
873 u32 request, irq; 1135 u32 request, irq;
1136 u32 level_mask;
1137 int umask = 0;
1138 struct irq_chip *chip = irq_desc_get_chip(desc);
1139
1140 if (chip->irq_mask_ack) {
1141 chip->irq_mask_ack(&desc->irq_data);
1142 } else {
1143 chip->irq_mask(&desc->irq_data);
1144 if (chip->irq_ack)
1145 chip->irq_ack(&desc->irq_data);
1146 }
874 1147
875 switch (inta_irq) { 1148 switch (inta_irq) {
876 case IRQ_PINT0: 1149 case IRQ_PINT0:
@@ -885,6 +1158,14 @@ void bfin_demux_gpio_irq(unsigned int inta_irq,
885 case IRQ_PINT1: 1158 case IRQ_PINT1:
886 bank = 1; 1159 bank = 1;
887 break; 1160 break;
1161#ifdef CONFIG_BF60x
1162 case IRQ_PINT4:
1163 bank = 4;
1164 break;
1165 case IRQ_PINT5:
1166 bank = 5;
1167 break;
1168#endif
888 default: 1169 default:
889 return; 1170 return;
890 } 1171 }
@@ -893,15 +1174,23 @@ void bfin_demux_gpio_irq(unsigned int inta_irq,
893 1174
894 request = pint[bank]->request; 1175 request = pint[bank]->request;
895 1176
1177 level_mask = pint[bank]->edge_set & request;
1178
896 while (request) { 1179 while (request) {
897 if (request & 1) { 1180 if (request & 1) {
898 irq = pint2irq_lut[pint_val] + SYS_IRQS; 1181 irq = pint2irq_lut[pint_val] + SYS_IRQS;
1182 if (level_mask & PINT_BIT(pint_val)) {
1183 umask = 1;
1184 chip->irq_unmask(&desc->irq_data);
1185 }
899 bfin_handle_irq(irq); 1186 bfin_handle_irq(irq);
900 } 1187 }
901 pint_val++; 1188 pint_val++;
902 request >>= 1; 1189 request >>= 1;
903 } 1190 }
904 1191
1192 if (!umask)
1193 chip->irq_unmask(&desc->irq_data);
905} 1194}
906#endif 1195#endif
907 1196
@@ -951,6 +1240,7 @@ int __init init_arch_irq(void)
951 int irq; 1240 int irq;
952 unsigned long ilat = 0; 1241 unsigned long ilat = 0;
953 1242
1243#ifndef CONFIG_BF60x
954 /* Disable all the peripheral intrs - page 4-29 HW Ref manual */ 1244 /* Disable all the peripheral intrs - page 4-29 HW Ref manual */
955#ifdef SIC_IMASK0 1245#ifdef SIC_IMASK0
956 bfin_write_SIC_IMASK0(SIC_UNMASK_ALL); 1246 bfin_write_SIC_IMASK0(SIC_UNMASK_ALL);
@@ -958,13 +1248,16 @@ int __init init_arch_irq(void)
958# ifdef SIC_IMASK2 1248# ifdef SIC_IMASK2
959 bfin_write_SIC_IMASK2(SIC_UNMASK_ALL); 1249 bfin_write_SIC_IMASK2(SIC_UNMASK_ALL);
960# endif 1250# endif
961# ifdef CONFIG_SMP 1251# if defined(CONFIG_SMP) || defined(CONFIG_ICC)
962 bfin_write_SICB_IMASK0(SIC_UNMASK_ALL); 1252 bfin_write_SICB_IMASK0(SIC_UNMASK_ALL);
963 bfin_write_SICB_IMASK1(SIC_UNMASK_ALL); 1253 bfin_write_SICB_IMASK1(SIC_UNMASK_ALL);
964# endif 1254# endif
965#else 1255#else
966 bfin_write_SIC_IMASK(SIC_UNMASK_ALL); 1256 bfin_write_SIC_IMASK(SIC_UNMASK_ALL);
967#endif 1257#endif
1258#else /* CONFIG_BF60x */
1259 bfin_write_SEC_GCTL(SEC_GCTL_RESET);
1260#endif
968 1261
969 local_irq_disable(); 1262 local_irq_disable();
970 1263
@@ -974,6 +1267,10 @@ int __init init_arch_irq(void)
974 pint[1]->assign = CONFIG_PINT1_ASSIGN; 1267 pint[1]->assign = CONFIG_PINT1_ASSIGN;
975 pint[2]->assign = CONFIG_PINT2_ASSIGN; 1268 pint[2]->assign = CONFIG_PINT2_ASSIGN;
976 pint[3]->assign = CONFIG_PINT3_ASSIGN; 1269 pint[3]->assign = CONFIG_PINT3_ASSIGN;
1270# ifdef CONFIG_BF60x
1271 pint[4]->assign = CONFIG_PINT4_ASSIGN;
1272 pint[5]->assign = CONFIG_PINT5_ASSIGN;
1273# endif
977# endif 1274# endif
978 /* Whenever PINTx_ASSIGN is altered init_pint_lut() must be executed! */ 1275 /* Whenever PINTx_ASSIGN is altered init_pint_lut() must be executed! */
979 init_pint_lut(); 1276 init_pint_lut();
@@ -986,6 +1283,7 @@ int __init init_arch_irq(void)
986 irq_set_chip(irq, &bfin_internal_irqchip); 1283 irq_set_chip(irq, &bfin_internal_irqchip);
987 1284
988 switch (irq) { 1285 switch (irq) {
1286#ifndef CONFIG_BF60x
989#if BFIN_GPIO_PINT 1287#if BFIN_GPIO_PINT
990 case IRQ_PINT0: 1288 case IRQ_PINT0:
991 case IRQ_PINT1: 1289 case IRQ_PINT1:
@@ -1015,12 +1313,13 @@ int __init init_arch_irq(void)
1015 bfin_demux_mac_status_irq); 1313 bfin_demux_mac_status_irq);
1016 break; 1314 break;
1017#endif 1315#endif
1018#ifdef CONFIG_SMP 1316#if defined(CONFIG_SMP) || defined(CONFIG_ICC)
1019 case IRQ_SUPPLE_0: 1317 case IRQ_SUPPLE_0:
1020 case IRQ_SUPPLE_1: 1318 case IRQ_SUPPLE_1:
1021 irq_set_handler(irq, handle_percpu_irq); 1319 irq_set_handler(irq, handle_percpu_irq);
1022 break; 1320 break;
1023#endif 1321#endif
1322#endif
1024 1323
1025#ifdef CONFIG_TICKSOURCE_CORETMR 1324#ifdef CONFIG_TICKSOURCE_CORETMR
1026 case IRQ_CORETMR: 1325 case IRQ_CORETMR:
@@ -1050,7 +1349,8 @@ int __init init_arch_irq(void)
1050 1349
1051 init_mach_irq(); 1350 init_mach_irq();
1052 1351
1053#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 1352#ifndef CONFIG_BF60x
1353#if (defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)) && !defined(CONFIG_BF60x)
1054 for (irq = IRQ_MAC_PHYINT; irq <= IRQ_MAC_STMDONE; irq++) 1354 for (irq = IRQ_MAC_PHYINT; irq <= IRQ_MAC_STMDONE; irq++)
1055 irq_set_chip_and_handler(irq, &bfin_mac_status_irqchip, 1355 irq_set_chip_and_handler(irq, &bfin_mac_status_irqchip,
1056 handle_level_irq); 1356 handle_level_irq);
@@ -1060,7 +1360,28 @@ int __init init_arch_irq(void)
1060 irq < (GPIO_IRQ_BASE + MAX_BLACKFIN_GPIOS); irq++) 1360 irq < (GPIO_IRQ_BASE + MAX_BLACKFIN_GPIOS); irq++)
1061 irq_set_chip_and_handler(irq, &bfin_gpio_irqchip, 1361 irq_set_chip_and_handler(irq, &bfin_gpio_irqchip,
1062 handle_level_irq); 1362 handle_level_irq);
1063 1363#else
1364 for (irq = BFIN_IRQ(0); irq <= SYS_IRQS; irq++) {
1365 if (irq < CORE_IRQS) {
1366 irq_set_chip(irq, &bfin_sec_irqchip);
1367 __irq_set_handler(irq, handle_sec_fault, 0, NULL);
1368 } else if (irq >= BFIN_IRQ(21) && irq <= BFIN_IRQ(26)) {
1369 irq_set_chip(irq, &bfin_sec_irqchip);
1370 irq_set_chained_handler(irq, bfin_demux_gpio_irq);
1371 } else if (irq >= BFIN_IRQ(34) && irq <= BFIN_IRQ(37)) {
1372 irq_set_chip(irq, &bfin_sec_irqchip);
1373 irq_set_handler(irq, handle_percpu_irq);
1374 } else {
1375 irq_set_chip_and_handler(irq, &bfin_sec_irqchip,
1376 handle_fasteoi_irq);
1377 __irq_set_preflow_handler(irq, bfin_sec_preflow_handler);
1378 }
1379 }
1380 for (irq = GPIO_IRQ_BASE;
1381 irq < (GPIO_IRQ_BASE + MAX_BLACKFIN_GPIOS); irq++)
1382 irq_set_chip_and_handler(irq, &bfin_gpio_irqchip,
1383 handle_level_irq);
1384#endif
1064 bfin_write_IMASK(0); 1385 bfin_write_IMASK(0);
1065 CSYNC(); 1386 CSYNC();
1066 ilat = bfin_read_ILAT(); 1387 ilat = bfin_read_ILAT();
@@ -1072,14 +1393,17 @@ int __init init_arch_irq(void)
1072 /* IMASK=xxx is equivalent to STI xx or bfin_irq_flags=xx, 1393 /* IMASK=xxx is equivalent to STI xx or bfin_irq_flags=xx,
1073 * local_irq_enable() 1394 * local_irq_enable()
1074 */ 1395 */
1396#ifndef CONFIG_BF60x
1075 program_IAR(); 1397 program_IAR();
1076 /* Therefore it's better to setup IARs before interrupts enabled */ 1398 /* Therefore it's better to setup IARs before interrupts enabled */
1077 search_IAR(); 1399 search_IAR();
1078 1400
1079 /* Enable interrupts IVG7-15 */ 1401 /* Enable interrupts IVG7-15 */
1080 bfin_irq_flags |= IMASK_IVG15 | 1402 bfin_irq_flags |= IMASK_IVG15 |
1081 IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 | 1403 IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 |
1082 IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW; 1404 IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW;
1405
1406 bfin_sti(bfin_irq_flags);
1083 1407
1084 /* This implicitly covers ANOMALY_05000171 1408 /* This implicitly covers ANOMALY_05000171
1085 * Boot-ROM code modifies SICA_IWRx wakeup registers 1409 * Boot-ROM code modifies SICA_IWRx wakeup registers
@@ -1103,7 +1427,23 @@ int __init init_arch_irq(void)
1103#else 1427#else
1104 bfin_write_SIC_IWR(IWR_DISABLE_ALL); 1428 bfin_write_SIC_IWR(IWR_DISABLE_ALL);
1105#endif 1429#endif
1430#else /* CONFIG_BF60x */
1431 /* Enable interrupts IVG7-15 */
1432 bfin_irq_flags |= IMASK_IVG15 |
1433 IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 |
1434 IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW;
1106 1435
1436
1437 bfin_write_SEC_FCTL(SEC_FCTL_EN | SEC_FCTL_SYSRST_EN | SEC_FCTL_FLTIN_EN);
1438 bfin_sec_enable_sci(SIC_SYSIRQ(IRQ_WATCH0));
1439 bfin_sec_enable_ssi(SIC_SYSIRQ(IRQ_WATCH0));
1440 bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_RESET);
1441 udelay(100);
1442 bfin_write_SEC_GCTL(SEC_GCTL_EN);
1443 bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_EN | SEC_CCTL_NMI_EN);
1444 init_software_driven_irq();
1445 register_syscore_ops(&sec_pm_syscore_ops);
1446#endif
1107 return 0; 1447 return 0;
1108} 1448}
1109 1449
@@ -1112,13 +1452,14 @@ __attribute__((l1_text))
1112#endif 1452#endif
1113static int vec_to_irq(int vec) 1453static int vec_to_irq(int vec)
1114{ 1454{
1455#ifndef CONFIG_BF60x
1115 struct ivgx *ivg = ivg7_13[vec - IVG7].ifirst; 1456 struct ivgx *ivg = ivg7_13[vec - IVG7].ifirst;
1116 struct ivgx *ivg_stop = ivg7_13[vec - IVG7].istop; 1457 struct ivgx *ivg_stop = ivg7_13[vec - IVG7].istop;
1117 unsigned long sic_status[3]; 1458 unsigned long sic_status[3];
1118 1459#endif
1119 if (likely(vec == EVT_IVTMR_P)) 1460 if (likely(vec == EVT_IVTMR_P))
1120 return IRQ_CORETMR; 1461 return IRQ_CORETMR;
1121 1462#ifndef CONFIG_BF60x
1122#ifdef SIC_ISR 1463#ifdef SIC_ISR
1123 sic_status[0] = bfin_read_SIC_IMASK() & bfin_read_SIC_ISR(); 1464 sic_status[0] = bfin_read_SIC_IMASK() & bfin_read_SIC_ISR();
1124#else 1465#else
@@ -1147,6 +1488,10 @@ static int vec_to_irq(int vec)
1147#endif 1488#endif
1148 return ivg->irqno; 1489 return ivg->irqno;
1149 } 1490 }
1491#else
1492 /* for bf60x read */
1493 return BFIN_IRQ(bfin_read_SEC_SCI(0, SEC_CSID));
1494#endif /* end of CONFIG_BF60x */
1150} 1495}
1151 1496
1152#ifdef CONFIG_DO_IRQ_L1 1497#ifdef CONFIG_DO_IRQ_L1
diff --git a/arch/blackfin/mach-common/pm.c b/arch/blackfin/mach-common/pm.c
index 3c648a077e75..ca6655e0d653 100644
--- a/arch/blackfin/mach-common/pm.c
+++ b/arch/blackfin/mach-common/pm.c
@@ -19,20 +19,33 @@
19#include <asm/gpio.h> 19#include <asm/gpio.h>
20#include <asm/dma.h> 20#include <asm/dma.h>
21#include <asm/dpmc.h> 21#include <asm/dpmc.h>
22#include <asm/pm.h>
22 23
24#ifdef CONFIG_BF60x
25struct bfin_cpu_pm_fns *bfin_cpu_pm;
26#endif
23 27
24void bfin_pm_suspend_standby_enter(void) 28void bfin_pm_suspend_standby_enter(void)
25{ 29{
30#ifndef CONFIG_BF60x
26 bfin_pm_standby_setup(); 31 bfin_pm_standby_setup();
32#endif
27 33
28#ifdef CONFIG_PM_BFIN_SLEEP_DEEPER 34#ifdef CONFIG_BF60x
29 sleep_deeper(bfin_sic_iwr[0], bfin_sic_iwr[1], bfin_sic_iwr[2]); 35 bfin_cpu_pm->enter(PM_SUSPEND_STANDBY);
30#else 36#else
37# ifdef CONFIG_PM_BFIN_SLEEP_DEEPER
38 sleep_deeper(bfin_sic_iwr[0], bfin_sic_iwr[1], bfin_sic_iwr[2]);
39# else
31 sleep_mode(bfin_sic_iwr[0], bfin_sic_iwr[1], bfin_sic_iwr[2]); 40 sleep_mode(bfin_sic_iwr[0], bfin_sic_iwr[1], bfin_sic_iwr[2]);
41# endif
32#endif 42#endif
33 43
44#ifndef CONFIG_BF60x
34 bfin_pm_standby_restore(); 45 bfin_pm_standby_restore();
46#endif
35 47
48#ifndef CONFIG_BF60x
36#ifdef SIC_IWR0 49#ifdef SIC_IWR0
37 bfin_write_SIC_IWR0(IWR_DISABLE_ALL); 50 bfin_write_SIC_IWR0(IWR_DISABLE_ALL);
38# ifdef SIC_IWR1 51# ifdef SIC_IWR1
@@ -52,6 +65,8 @@ void bfin_pm_suspend_standby_enter(void)
52#else 65#else
53 bfin_write_SIC_IWR(IWR_DISABLE_ALL); 66 bfin_write_SIC_IWR(IWR_DISABLE_ALL);
54#endif 67#endif
68
69#endif
55} 70}
56 71
57int bf53x_suspend_l1_mem(unsigned char *memptr) 72int bf53x_suspend_l1_mem(unsigned char *memptr)
@@ -83,10 +98,13 @@ int bf53x_resume_l1_mem(unsigned char *memptr)
83} 98}
84 99
85#if defined(CONFIG_BFIN_EXTMEM_WRITEBACK) || defined(CONFIG_BFIN_L2_WRITEBACK) 100#if defined(CONFIG_BFIN_EXTMEM_WRITEBACK) || defined(CONFIG_BFIN_L2_WRITEBACK)
101# ifdef CONFIG_BF60x
102__attribute__((l1_text))
103# endif
86static void flushinv_all_dcache(void) 104static void flushinv_all_dcache(void)
87{ 105{
88 u32 way, bank, subbank, set; 106 register u32 way, bank, subbank, set;
89 u32 status, addr; 107 register u32 status, addr;
90 u32 dmem_ctl = bfin_read_DMEM_CONTROL(); 108 u32 dmem_ctl = bfin_read_DMEM_CONTROL();
91 109
92 for (bank = 0; bank < 2; ++bank) { 110 for (bank = 0; bank < 2; ++bank) {
@@ -133,6 +151,7 @@ int bfin_pm_suspend_mem_enter(void)
133 return -ENOMEM; 151 return -ENOMEM;
134 } 152 }
135 153
154#ifndef CONFIG_BF60x
136 wakeup = bfin_read_VR_CTL() & ~FREQ; 155 wakeup = bfin_read_VR_CTL() & ~FREQ;
137 wakeup |= SCKELOW; 156 wakeup |= SCKELOW;
138 157
@@ -142,6 +161,7 @@ int bfin_pm_suspend_mem_enter(void)
142#ifdef CONFIG_PM_BFIN_WAKE_GP 161#ifdef CONFIG_PM_BFIN_WAKE_GP
143 wakeup |= GPWE; 162 wakeup |= GPWE;
144#endif 163#endif
164#endif
145 165
146 ret = blackfin_dma_suspend(); 166 ret = blackfin_dma_suspend();
147 167
@@ -159,7 +179,11 @@ int bfin_pm_suspend_mem_enter(void)
159 _disable_icplb(); 179 _disable_icplb();
160 bf53x_suspend_l1_mem(memptr); 180 bf53x_suspend_l1_mem(memptr);
161 181
182#ifndef CONFIG_BF60x
162 do_hibernate(wakeup | vr_wakeup); /* See you later! */ 183 do_hibernate(wakeup | vr_wakeup); /* See you later! */
184#else
185 bfin_cpu_pm->enter(PM_SUSPEND_MEM);
186#endif
163 187
164 bf53x_resume_l1_mem(memptr); 188 bf53x_resume_l1_mem(memptr);
165 189
@@ -223,9 +247,39 @@ static int bfin_pm_enter(suspend_state_t state)
223 return 0; 247 return 0;
224} 248}
225 249
250#ifdef CONFIG_BFIN_PM_WAKEUP_TIME_BENCH
251void bfin_pm_end(void)
252{
253 u32 cycle, cycle2;
254 u64 usec64;
255 u32 usec;
256
257 __asm__ __volatile__ (
258 "1: %0 = CYCLES2\n"
259 "%1 = CYCLES\n"
260 "%2 = CYCLES2\n"
261 "CC = %2 == %0\n"
262 "if ! CC jump 1b\n"
263 : "=d,a" (cycle2), "=d,a" (cycle), "=d,a" (usec) : : "CC"
264 );
265
266 usec64 = ((u64)cycle2 << 32) + cycle;
267 do_div(usec64, get_cclk() / USEC_PER_SEC);
268 usec = usec64;
269 if (usec == 0)
270 usec = 1;
271
272 pr_info("PM: resume of kernel completes after %ld msec %03ld usec\n",
273 usec / USEC_PER_MSEC, usec % USEC_PER_MSEC);
274}
275#endif
276
226static const struct platform_suspend_ops bfin_pm_ops = { 277static const struct platform_suspend_ops bfin_pm_ops = {
227 .enter = bfin_pm_enter, 278 .enter = bfin_pm_enter,
228 .valid = bfin_pm_valid, 279 .valid = bfin_pm_valid,
280#ifdef CONFIG_BFIN_PM_WAKEUP_TIME_BENCH
281 .end = bfin_pm_end,
282#endif
229}; 283};
230 284
231static int __init bfin_pm_init(void) 285static int __init bfin_pm_init(void)
diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c
index ac8f8a43158c..00bbe672b3b3 100644
--- a/arch/blackfin/mach-common/smp.c
+++ b/arch/blackfin/mach-common/smp.c
@@ -340,27 +340,10 @@ void smp_send_stop(void)
340 return; 340 return;
341} 341}
342 342
343int __cpuinit __cpu_up(unsigned int cpu) 343int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
344{ 344{
345 int ret; 345 int ret;
346 struct blackfin_cpudata *ci = &per_cpu(cpu_data, cpu);
347 struct task_struct *idle = ci->idle;
348 346
349 if (idle) {
350 free_task(idle);
351 idle = NULL;
352 }
353
354 if (!idle) {
355 idle = fork_idle(cpu);
356 if (IS_ERR(idle)) {
357 printk(KERN_ERR "CPU%u: fork() failed\n", cpu);
358 return PTR_ERR(idle);
359 }
360 ci->idle = idle;
361 } else {
362 init_idle(idle, cpu);
363 }
364 secondary_stack = task_stack_page(idle) + THREAD_SIZE; 347 secondary_stack = task_stack_page(idle) + THREAD_SIZE;
365 348
366 ret = platform_boot_secondary(cpu, idle); 349 ret = platform_boot_secondary(cpu, idle);
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index 78daae084915..9cb85537bd2b 100644
--- a/arch/blackfin/mm/init.c
+++ b/arch/blackfin/mm/init.c
@@ -48,7 +48,7 @@ void __init paging_init(void)
48 48
49 unsigned long zones_size[MAX_NR_ZONES] = { 49 unsigned long zones_size[MAX_NR_ZONES] = {
50 [0] = 0, 50 [0] = 0,
51 [ZONE_DMA] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT, 51 [ZONE_DMA] = (end_mem - CONFIG_PHY_RAM_BASE_ADDRESS) >> PAGE_SHIFT,
52 [ZONE_NORMAL] = 0, 52 [ZONE_NORMAL] = 0,
53#ifdef CONFIG_HIGHMEM 53#ifdef CONFIG_HIGHMEM
54 [ZONE_HIGHMEM] = 0, 54 [ZONE_HIGHMEM] = 0,
@@ -60,7 +60,8 @@ void __init paging_init(void)
60 60
61 pr_debug("free_area_init -> start_mem is %#lx virtual_end is %#lx\n", 61 pr_debug("free_area_init -> start_mem is %#lx virtual_end is %#lx\n",
62 PAGE_ALIGN(memory_start), end_mem); 62 PAGE_ALIGN(memory_start), end_mem);
63 free_area_init(zones_size); 63 free_area_init_node(0, zones_size,
64 CONFIG_PHY_RAM_BASE_ADDRESS >> PAGE_SHIFT, NULL);
64} 65}
65 66
66asmlinkage void __init init_pda(void) 67asmlinkage void __init init_pda(void)
@@ -75,9 +76,6 @@ asmlinkage void __init init_pda(void)
75 valid pointers to it. */ 76 valid pointers to it. */
76 memset(&cpu_pda[cpu], 0, sizeof(cpu_pda[cpu])); 77 memset(&cpu_pda[cpu], 0, sizeof(cpu_pda[cpu]));
77 78
78 cpu_pda[0].next = &cpu_pda[1];
79 cpu_pda[1].next = &cpu_pda[0];
80
81#ifdef CONFIG_EXCEPTION_L1_SCRATCH 79#ifdef CONFIG_EXCEPTION_L1_SCRATCH
82 cpu_pda[cpu].ex_stack = (unsigned long *)(L1_SCRATCH_START + \ 80 cpu_pda[cpu].ex_stack = (unsigned long *)(L1_SCRATCH_START + \
83 L1_SCRATCH_LENGTH); 81 L1_SCRATCH_LENGTH);
@@ -109,10 +107,10 @@ void __init mem_init(void)
109 totalram_pages = free_all_bootmem(); 107 totalram_pages = free_all_bootmem();
110 108
111 reservedpages = 0; 109 reservedpages = 0;
112 for (tmp = 0; tmp < max_mapnr; tmp++) 110 for (tmp = ARCH_PFN_OFFSET; tmp < max_mapnr; tmp++)
113 if (PageReserved(pfn_to_page(tmp))) 111 if (PageReserved(pfn_to_page(tmp)))
114 reservedpages++; 112 reservedpages++;
115 freepages = max_mapnr - reservedpages; 113 freepages = max_mapnr - ARCH_PFN_OFFSET - reservedpages;
116 114
117 /* do not count in kernel image between _rambase and _ramstart */ 115 /* do not count in kernel image between _rambase and _ramstart */
118 reservedpages -= (_ramstart - _rambase) >> PAGE_SHIFT; 116 reservedpages -= (_ramstart - _rambase) >> PAGE_SHIFT;
@@ -127,7 +125,7 @@ void __init mem_init(void)
127 printk(KERN_INFO 125 printk(KERN_INFO
128 "Memory available: %luk/%luk RAM, " 126 "Memory available: %luk/%luk RAM, "
129 "(%uk init code, %uk kernel code, %uk data, %uk dma, %uk reserved)\n", 127 "(%uk init code, %uk kernel code, %uk data, %uk dma, %uk reserved)\n",
130 (unsigned long) freepages << (PAGE_SHIFT-10), _ramend >> 10, 128 (unsigned long) freepages << (PAGE_SHIFT-10), (_ramend - CONFIG_PHY_RAM_BASE_ADDRESS) >> 10,
131 initk, codek, datak, DMA_UNCACHED_REGION >> 10, (reservedpages << (PAGE_SHIFT-10))); 129 initk, codek, datak, DMA_UNCACHED_REGION >> 10, (reservedpages << (PAGE_SHIFT-10)));
132} 130}
133 131
diff --git a/arch/blackfin/mm/sram-alloc.c b/arch/blackfin/mm/sram-alloc.c
index 29d98faa1efd..342e378da1ec 100644
--- a/arch/blackfin/mm/sram-alloc.c
+++ b/arch/blackfin/mm/sram-alloc.c
@@ -186,9 +186,45 @@ static void __init l1_inst_sram_init(void)
186#endif 186#endif
187} 187}
188 188
189#ifdef __ADSPBF60x__
190static irqreturn_t l2_ecc_err(int irq, void *dev_id)
191{
192 int status;
193
194 printk(KERN_ERR "L2 ecc error happend\n");
195 status = bfin_read32(L2CTL0_STAT);
196 if (status & 0x1)
197 printk(KERN_ERR "Core channel error type:0x%x, addr:0x%x\n",
198 bfin_read32(L2CTL0_ET0), bfin_read32(L2CTL0_EADDR0));
199 if (status & 0x2)
200 printk(KERN_ERR "System channel error type:0x%x, addr:0x%x\n",
201 bfin_read32(L2CTL0_ET1), bfin_read32(L2CTL0_EADDR1));
202
203 status = status >> 8;
204 if (status)
205 printk(KERN_ERR "L2 Bank%d error, addr:0x%x\n",
206 status, bfin_read32(L2CTL0_ERRADDR0 + status));
207
208 panic("L2 Ecc error");
209 return IRQ_HANDLED;
210}
211#endif
212
189static void __init l2_sram_init(void) 213static void __init l2_sram_init(void)
190{ 214{
191#if L2_LENGTH != 0 215#if L2_LENGTH != 0
216
217#ifdef __ADSPBF60x__
218 int ret;
219
220 ret = request_irq(IRQ_L2CTL0_ECC_ERR, l2_ecc_err, 0, "l2-ecc-err",
221 NULL);
222 if (unlikely(ret < 0)) {
223 printk(KERN_INFO "Fail to request l2 ecc error interrupt");
224 return;
225 }
226#endif
227
192 free_l2_sram_head.next = 228 free_l2_sram_head.next =
193 kmem_cache_alloc(sram_piece_cache, GFP_KERNEL); 229 kmem_cache_alloc(sram_piece_cache, GFP_KERNEL);
194 if (!free_l2_sram_head.next) { 230 if (!free_l2_sram_head.next) {
diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig
index 1c3ccd416d50..1f15b88b537f 100644
--- a/arch/c6x/Kconfig
+++ b/arch/c6x/Kconfig
@@ -3,7 +3,7 @@
3# see Documentation/kbuild/kconfig-language.txt. 3# see Documentation/kbuild/kconfig-language.txt.
4# 4#
5 5
6config TMS320C6X 6config C6X
7 def_bool y 7 def_bool y
8 select CLKDEV_LOOKUP 8 select CLKDEV_LOOKUP
9 select GENERIC_IRQ_SHOW 9 select GENERIC_IRQ_SHOW
@@ -19,24 +19,12 @@ config TMS320C6X
19config MMU 19config MMU
20 def_bool n 20 def_bool n
21 21
22config ZONE_DMA
23 def_bool y
24
25config FPU 22config FPU
26 def_bool n 23 def_bool n
27 24
28config HIGHMEM
29 def_bool n
30
31config NUMA
32 def_bool n
33
34config RWSEM_GENERIC_SPINLOCK 25config RWSEM_GENERIC_SPINLOCK
35 def_bool y 26 def_bool y
36 27
37config RWSEM_XCHGADD_ALGORITHM
38 def_bool n
39
40config GENERIC_CALIBRATE_DELAY 28config GENERIC_CALIBRATE_DELAY
41 def_bool y 29 def_bool y
42 30
diff --git a/arch/c6x/include/asm/elf.h b/arch/c6x/include/asm/elf.h
index d57865ba2c44..f4552db20b4a 100644
--- a/arch/c6x/include/asm/elf.h
+++ b/arch/c6x/include/asm/elf.h
@@ -30,7 +30,19 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
30 */ 30 */
31#define elf_check_arch(x) ((x)->e_machine == EM_TI_C6000) 31#define elf_check_arch(x) ((x)->e_machine == EM_TI_C6000)
32 32
33#define elf_check_const_displacement(x) (1) 33#define elf_check_fdpic(x) (1)
34#define elf_check_const_displacement(x) (0)
35
36#define ELF_FDPIC_PLAT_INIT(_regs, _exec_map, _interp_map, _dynamic_addr) \
37do { \
38 _regs->b4 = (_exec_map); \
39 _regs->a6 = (_interp_map); \
40 _regs->b6 = (_dynamic_addr); \
41} while (0)
42
43#define ELF_FDPIC_CORE_EFLAGS 0
44
45#define ELF_CORE_COPY_FPREGS(...) 0 /* No FPU regs to copy */
34 46
35/* 47/*
36 * These are used to set parameters in the core dumps. 48 * These are used to set parameters in the core dumps.
diff --git a/arch/c6x/include/asm/irq.h b/arch/c6x/include/asm/irq.h
index f13b78d5e1ca..ab4577f93d96 100644
--- a/arch/c6x/include/asm/irq.h
+++ b/arch/c6x/include/asm/irq.h
@@ -42,10 +42,6 @@
42/* This number is used when no interrupt has been assigned */ 42/* This number is used when no interrupt has been assigned */
43#define NO_IRQ 0 43#define NO_IRQ 0
44 44
45struct irq_data;
46extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d);
47extern irq_hw_number_t virq_to_hw(unsigned int virq);
48
49extern void __init init_pic_c64xplus(void); 45extern void __init init_pic_c64xplus(void);
50 46
51extern void init_IRQ(void); 47extern void init_IRQ(void);
diff --git a/arch/c6x/include/asm/mmu.h b/arch/c6x/include/asm/mmu.h
index 41592bf16067..4467e770a1ce 100644
--- a/arch/c6x/include/asm/mmu.h
+++ b/arch/c6x/include/asm/mmu.h
@@ -13,6 +13,10 @@
13 13
14typedef struct { 14typedef struct {
15 unsigned long end_brk; 15 unsigned long end_brk;
16#ifdef CONFIG_BINFMT_ELF_FDPIC
17 unsigned long exec_fdpic_loadmap;
18 unsigned long interp_fdpic_loadmap;
19#endif
16} mm_context_t; 20} mm_context_t;
17 21
18#endif /* _ASM_C6X_MMU_H */ 22#endif /* _ASM_C6X_MMU_H */
diff --git a/arch/c6x/include/asm/ptrace.h b/arch/c6x/include/asm/ptrace.h
index 21e8d7931fe7..b04ff5964258 100644
--- a/arch/c6x/include/asm/ptrace.h
+++ b/arch/c6x/include/asm/ptrace.h
@@ -97,6 +97,11 @@
97#define PT_DP PT_B14 /* Data Segment Pointer (B14) */ 97#define PT_DP PT_B14 /* Data Segment Pointer (B14) */
98#define PT_SP PT_B15 /* Stack Pointer (B15) */ 98#define PT_SP PT_B15 /* Stack Pointer (B15) */
99 99
100#define PTRACE_GETFDPIC 31 /* get the ELF fdpic loadmap address */
101
102#define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */
103#define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */
104
100#ifndef __ASSEMBLY__ 105#ifndef __ASSEMBLY__
101 106
102#ifdef _BIG_ENDIAN 107#ifdef _BIG_ENDIAN
diff --git a/arch/c6x/include/asm/thread_info.h b/arch/c6x/include/asm/thread_info.h
index fd99148cda9d..1710bcbb8d09 100644
--- a/arch/c6x/include/asm/thread_info.h
+++ b/arch/c6x/include/asm/thread_info.h
@@ -20,11 +20,11 @@
20#ifdef CONFIG_4KSTACKS 20#ifdef CONFIG_4KSTACKS
21#define THREAD_SIZE 4096 21#define THREAD_SIZE 4096
22#define THREAD_SHIFT 12 22#define THREAD_SHIFT 12
23#define THREAD_ORDER 0 23#define THREAD_SIZE_ORDER 0
24#else 24#else
25#define THREAD_SIZE 8192 25#define THREAD_SIZE 8192
26#define THREAD_SHIFT 13 26#define THREAD_SHIFT 13
27#define THREAD_ORDER 1 27#define THREAD_SIZE_ORDER 1
28#endif 28#endif
29 29
30#define THREAD_START_SP (THREAD_SIZE - 8) 30#define THREAD_START_SP (THREAD_SIZE - 8)
@@ -80,19 +80,6 @@ struct thread_info *current_thread_info(void)
80 return ti; 80 return ti;
81} 81}
82 82
83#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
84
85/* thread information allocation */
86#ifdef CONFIG_DEBUG_STACK_USAGE
87#define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
88#else
89#define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK)
90#endif
91
92#define alloc_thread_info_node(tsk, node) \
93 ((struct thread_info *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER))
94
95#define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER)
96#define get_thread_info(ti) get_task_struct((ti)->task) 83#define get_thread_info(ti) get_task_struct((ti)->task)
97#define put_thread_info(ti) put_task_struct((ti)->task) 84#define put_thread_info(ti) put_task_struct((ti)->task)
98#endif /* __ASSEMBLY__ */ 85#endif /* __ASSEMBLY__ */
diff --git a/arch/c6x/kernel/irq.c b/arch/c6x/kernel/irq.c
index 65b8ddf54b44..c90fb5e82ad7 100644
--- a/arch/c6x/kernel/irq.c
+++ b/arch/c6x/kernel/irq.c
@@ -130,16 +130,3 @@ int arch_show_interrupts(struct seq_file *p, int prec)
130 seq_printf(p, "%*s: %10lu\n", prec, "Err", irq_err_count); 130 seq_printf(p, "%*s: %10lu\n", prec, "Err", irq_err_count);
131 return 0; 131 return 0;
132} 132}
133
134irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
135{
136 return d->hwirq;
137}
138EXPORT_SYMBOL_GPL(irqd_to_hwirq);
139
140irq_hw_number_t virq_to_hw(unsigned int virq)
141{
142 struct irq_data *irq_data = irq_get_irq_data(virq);
143 return WARN_ON(!irq_data) ? 0 : irq_data->hwirq;
144}
145EXPORT_SYMBOL_GPL(virq_to_hw);
diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c
index 7ca8c41b03cd..45e924a636a0 100644
--- a/arch/c6x/kernel/process.c
+++ b/arch/c6x/kernel/process.c
@@ -26,22 +26,6 @@ void (*c6x_halt)(void);
26 26
27extern asmlinkage void ret_from_fork(void); 27extern asmlinkage void ret_from_fork(void);
28 28
29static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
30static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
31
32/*
33 * Initial thread structure.
34 */
35union thread_union init_thread_union __init_task_data = {
36 INIT_THREAD_INFO(init_task)
37};
38
39/*
40 * Initial task structure.
41 */
42struct task_struct init_task = INIT_TASK(init_task);
43EXPORT_SYMBOL(init_task);
44
45/* 29/*
46 * power off function, if any 30 * power off function, if any
47 */ 31 */
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index b3abfb08aa5c..2995035812ec 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -49,6 +49,7 @@ config CRIS
49 select HAVE_GENERIC_HARDIRQS 49 select HAVE_GENERIC_HARDIRQS
50 select GENERIC_IRQ_SHOW 50 select GENERIC_IRQ_SHOW
51 select GENERIC_IOMAP 51 select GENERIC_IOMAP
52 select GENERIC_SMP_IDLE_THREAD if ETRAX_ARCH_V32
52 53
53config HZ 54config HZ
54 int 55 int
diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c
index 0b99df72d2a4..ebe2cb30bd11 100644
--- a/arch/cris/arch-v32/kernel/smp.c
+++ b/arch/cris/arch-v32/kernel/smp.c
@@ -108,17 +108,12 @@ void __init smp_cpus_done(unsigned int max_cpus)
108 108
109/* Bring one cpu online.*/ 109/* Bring one cpu online.*/
110static int __init 110static int __init
111smp_boot_one_cpu(int cpuid) 111smp_boot_one_cpu(int cpuid, struct task_struct idle)
112{ 112{
113 unsigned timeout; 113 unsigned timeout;
114 struct task_struct *idle;
115 cpumask_t cpu_mask; 114 cpumask_t cpu_mask;
116 115
117 cpumask_clear(&cpu_mask); 116 cpumask_clear(&cpu_mask);
118 idle = fork_idle(cpuid);
119 if (IS_ERR(idle))
120 panic("SMP: fork failed for CPU:%d", cpuid);
121
122 task_thread_info(idle)->cpu = cpuid; 117 task_thread_info(idle)->cpu = cpuid;
123 118
124 /* Information to the CPU that is about to boot */ 119 /* Information to the CPU that is about to boot */
@@ -142,9 +137,6 @@ smp_boot_one_cpu(int cpuid)
142 barrier(); 137 barrier();
143 } 138 }
144 139
145 put_task_struct(idle);
146 idle = NULL;
147
148 printk(KERN_CRIT "SMP: CPU:%d is stuck.\n", cpuid); 140 printk(KERN_CRIT "SMP: CPU:%d is stuck.\n", cpuid);
149 return -1; 141 return -1;
150} 142}
@@ -207,9 +199,9 @@ int setup_profiling_timer(unsigned int multiplier)
207 */ 199 */
208unsigned long cache_decay_ticks = 1; 200unsigned long cache_decay_ticks = 1;
209 201
210int __cpuinit __cpu_up(unsigned int cpu) 202int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
211{ 203{
212 smp_boot_one_cpu(cpu); 204 smp_boot_one_cpu(cpu, tidle);
213 return cpu_online(cpu) ? 0 : -ENOSYS; 205 return cpu_online(cpu) ? 0 : -ENOSYS;
214} 206}
215 207
diff --git a/arch/cris/include/asm/processor.h b/arch/cris/include/asm/processor.h
index 4210d72a6667..8dc56ef08712 100644
--- a/arch/cris/include/asm/processor.h
+++ b/arch/cris/include/asm/processor.h
@@ -25,13 +25,12 @@ struct task_struct;
25 */ 25 */
26#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3)) 26#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3))
27 27
28/* THREAD_SIZE is the size of the task_struct/kernel_stack combo. 28/* THREAD_SIZE is the size of the thread_info/kernel_stack combo.
29 * normally, the stack is found by doing something like p + THREAD_SIZE 29 * normally, the stack is found by doing something like p + THREAD_SIZE
30 * in CRIS, a page is 8192 bytes, which seems like a sane size 30 * in CRIS, a page is 8192 bytes, which seems like a sane size
31 */ 31 */
32
33#define THREAD_SIZE PAGE_SIZE 32#define THREAD_SIZE PAGE_SIZE
34#define KERNEL_STACK_SIZE PAGE_SIZE 33#define THREAD_SIZE_ORDER (0)
35 34
36/* 35/*
37 * At user->kernel entry, the pt_regs struct is stacked on the top of the kernel-stack. 36 * At user->kernel entry, the pt_regs struct is stacked on the top of the kernel-stack.
diff --git a/arch/cris/include/asm/thread_info.h b/arch/cris/include/asm/thread_info.h
index 29b92884d793..5b1c448df5c0 100644
--- a/arch/cris/include/asm/thread_info.h
+++ b/arch/cris/include/asm/thread_info.h
@@ -65,12 +65,6 @@ struct thread_info {
65 65
66#define init_thread_info (init_thread_union.thread_info) 66#define init_thread_info (init_thread_union.thread_info)
67 67
68#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
69/* thread information allocation */
70#define alloc_thread_info_node(tsk, node) \
71 ((struct thread_info *) __get_free_pages(GFP_KERNEL, 1))
72#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
73
74#endif /* !__ASSEMBLY__ */ 68#endif /* !__ASSEMBLY__ */
75 69
76/* 70/*
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index 891dad85e8bd..66fd01728790 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -29,34 +29,6 @@
29//#define DEBUG 29//#define DEBUG
30 30
31/* 31/*
32 * Initial task structure. Make this a per-architecture thing,
33 * because different architectures tend to have different
34 * alignment requirements and potentially different initial
35 * setup.
36 */
37
38static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
39static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
40/*
41 * Initial thread structure.
42 *
43 * We need to make sure that this is 8192-byte aligned due to the
44 * way process stacks are handled. This is done by having a special
45 * "init_task" linker map entry..
46 */
47union thread_union init_thread_union __init_task_data =
48 { INIT_THREAD_INFO(init_task) };
49
50/*
51 * Initial task structure.
52 *
53 * All other task structs will be allocated on slabs in fork.c
54 */
55struct task_struct init_task = INIT_TASK(init_task);
56
57EXPORT_SYMBOL(init_task);
58
59/*
60 * The hlt_counter, disable_hlt and enable_hlt is just here as a hook if 32 * The hlt_counter, disable_hlt and enable_hlt is just here as a hook if
61 * there would ever be a halt sequence (for power save when idle) with 33 * there would ever be a halt sequence (for power save when idle) with
62 * some largish delay when halting or resuming *and* a driver that can't 34 * some largish delay when halting or resuming *and* a driver that can't
diff --git a/arch/frv/Makefile b/arch/frv/Makefile
index 7ff84575b186..4d1b1e9baef1 100644
--- a/arch/frv/Makefile
+++ b/arch/frv/Makefile
@@ -81,7 +81,7 @@ ifdef CONFIG_DEBUG_INFO
81KBUILD_AFLAGS += -Wa,--gdwarf2 81KBUILD_AFLAGS += -Wa,--gdwarf2
82endif 82endif
83 83
84head-y := arch/frv/kernel/head.o arch/frv/kernel/init_task.o 84head-y := arch/frv/kernel/head.o
85 85
86core-y += arch/frv/kernel/ arch/frv/mm/ 86core-y += arch/frv/kernel/ arch/frv/mm/
87libs-y += arch/frv/lib/ 87libs-y += arch/frv/lib/
diff --git a/arch/frv/include/asm/processor.h b/arch/frv/include/asm/processor.h
index 81c2e271d620..9b1a92b73f60 100644
--- a/arch/frv/include/asm/processor.h
+++ b/arch/frv/include/asm/processor.h
@@ -135,10 +135,6 @@ unsigned long get_wchan(struct task_struct *p);
135#define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc) 135#define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc)
136#define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp) 136#define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp)
137 137
138/* Allocation and freeing of basic task resources. */
139extern struct task_struct *alloc_task_struct_node(int node);
140extern void free_task_struct(struct task_struct *p);
141
142#define cpu_relax() barrier() 138#define cpu_relax() barrier()
143 139
144/* data cache prefetch */ 140/* data cache prefetch */
diff --git a/arch/frv/include/asm/thread_info.h b/arch/frv/include/asm/thread_info.h
index 92d83ea99ae5..54ab13a0de41 100644
--- a/arch/frv/include/asm/thread_info.h
+++ b/arch/frv/include/asm/thread_info.h
@@ -21,8 +21,6 @@
21 21
22#define THREAD_SIZE 8192 22#define THREAD_SIZE 8192
23 23
24#define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
25
26/* 24/*
27 * low level task data that entry.S needs immediate access to 25 * low level task data that entry.S needs immediate access to
28 * - this struct should fit entirely inside of one cache line 26 * - this struct should fit entirely inside of one cache line
@@ -82,19 +80,6 @@ register struct thread_info *__current_thread_info asm("gr15");
82 80
83#define current_thread_info() ({ __current_thread_info; }) 81#define current_thread_info() ({ __current_thread_info; })
84 82
85#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
86
87/* thread information allocation */
88#ifdef CONFIG_DEBUG_STACK_USAGE
89#define alloc_thread_info_node(tsk, node) \
90 kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
91#else
92#define alloc_thread_info_node(tsk, node) \
93 kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
94#endif
95
96#define free_thread_info(info) kfree(info)
97
98#endif /* __ASSEMBLY__ */ 83#endif /* __ASSEMBLY__ */
99 84
100/* 85/*
diff --git a/arch/frv/kernel/Makefile b/arch/frv/kernel/Makefile
index c36f70b6699a..ad4087b69968 100644
--- a/arch/frv/kernel/Makefile
+++ b/arch/frv/kernel/Makefile
@@ -5,7 +5,7 @@
5heads-y := head-uc-fr401.o head-uc-fr451.o head-uc-fr555.o 5heads-y := head-uc-fr401.o head-uc-fr451.o head-uc-fr555.o
6heads-$(CONFIG_MMU) := head-mmu-fr451.o 6heads-$(CONFIG_MMU) := head-mmu-fr451.o
7 7
8extra-y:= head.o init_task.o vmlinux.lds 8extra-y:= head.o vmlinux.lds
9 9
10obj-y := $(heads-y) entry.o entry-table.o break.o switch_to.o kernel_thread.o \ 10obj-y := $(heads-y) entry.o entry-table.o break.o switch_to.o kernel_thread.o \
11 kernel_execve.o process.o traps.o ptrace.o signal.o dma.o \ 11 kernel_execve.o process.o traps.o ptrace.o signal.o dma.o \
diff --git a/arch/frv/kernel/init_task.c b/arch/frv/kernel/init_task.c
deleted file mode 100644
index 3c3e0b336a9d..000000000000
--- a/arch/frv/kernel/init_task.c
+++ /dev/null
@@ -1,32 +0,0 @@
1#include <linux/mm.h>
2#include <linux/module.h>
3#include <linux/sched.h>
4#include <linux/init.h>
5#include <linux/init_task.h>
6#include <linux/fs.h>
7#include <linux/mqueue.h>
8
9#include <asm/uaccess.h>
10#include <asm/pgtable.h>
11
12
13static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
15/*
16 * Initial thread structure.
17 *
18 * We need to make sure that this is THREAD_SIZE aligned due to the
19 * way process stacks are handled. This is done by having a special
20 * "init_task" linker map entry..
21 */
22union thread_union init_thread_union __init_task_data =
23 { INIT_THREAD_INFO(init_task) };
24
25/*
26 * Initial task structure.
27 *
28 * All other task structs will be allocated on slabs in fork.c
29 */
30struct task_struct init_task = INIT_TASK(init_task);
31
32EXPORT_SYMBOL(init_task);
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index d4de48bd5efe..ed09e9e2c653 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -43,21 +43,6 @@ asmlinkage void ret_from_fork(void);
43void (*pm_power_off)(void); 43void (*pm_power_off)(void);
44EXPORT_SYMBOL(pm_power_off); 44EXPORT_SYMBOL(pm_power_off);
45 45
46struct task_struct *alloc_task_struct_node(int node)
47{
48 struct task_struct *p = kmalloc_node(THREAD_SIZE, GFP_KERNEL, node);
49
50 if (p)
51 atomic_set((atomic_t *)(p+1), 1);
52 return p;
53}
54
55void free_task_struct(struct task_struct *p)
56{
57 if (atomic_dec_and_test((atomic_t *)(p+1)))
58 kfree(p);
59}
60
61static void core_sleep_idle(void) 46static void core_sleep_idle(void)
62{ 47{
63#ifdef LED_DEBUG_SLEEP 48#ifdef LED_DEBUG_SLEEP
diff --git a/arch/h8300/kernel/Makefile b/arch/h8300/kernel/Makefile
index 8d4d2a54be9e..1cc57f872d34 100644
--- a/arch/h8300/kernel/Makefile
+++ b/arch/h8300/kernel/Makefile
@@ -6,7 +6,7 @@ extra-y := vmlinux.lds
6 6
7obj-y := process.o traps.o ptrace.o irq.o \ 7obj-y := process.o traps.o ptrace.o irq.o \
8 sys_h8300.o time.o signal.o \ 8 sys_h8300.o time.o signal.o \
9 setup.o gpio.o init_task.o syscalls.o \ 9 setup.o gpio.o syscalls.o \
10 entry.o timer/ 10 entry.o timer/
11 11
12obj-$(CONFIG_MODULES) += module.o h8300_ksyms.o 12obj-$(CONFIG_MODULES) += module.o h8300_ksyms.o
diff --git a/arch/h8300/kernel/init_task.c b/arch/h8300/kernel/init_task.c
deleted file mode 100644
index 54c1062ee80e..000000000000
--- a/arch/h8300/kernel/init_task.c
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * linux/arch/h8300/kernel/init_task.c
3 */
4#include <linux/mm.h>
5#include <linux/module.h>
6#include <linux/sched.h>
7#include <linux/init.h>
8#include <linux/init_task.h>
9#include <linux/fs.h>
10#include <linux/mqueue.h>
11
12#include <asm/uaccess.h>
13#include <asm/pgtable.h>
14
15static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
17/*
18 * Initial task structure.
19 *
20 * All other task structs will be allocated on slabs in fork.c
21 */
22__asm__(".align 4");
23struct task_struct init_task = INIT_TASK(init_task);
24
25EXPORT_SYMBOL(init_task);
26
27/*
28 * Initial thread structure.
29 *
30 * We need to make sure that this is 8192-byte aligned due to the
31 * way process stacks are handled. This is done by having a special
32 * "init_task" linker map entry..
33 */
34union thread_union init_thread_union __init_task_data =
35 { INIT_THREAD_INFO(init_task) };
36
diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 9059e3905887..22615dd02219 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -18,8 +18,6 @@ config HEXAGON
18 select GENERIC_ATOMIC64 18 select GENERIC_ATOMIC64
19 select HAVE_PERF_EVENTS 19 select HAVE_PERF_EVENTS
20 select HAVE_GENERIC_HARDIRQS 20 select HAVE_GENERIC_HARDIRQS
21 select GENERIC_HARDIRQS_NO__DO_IRQ
22 select GENERIC_HARDIRQS_NO_DEPRECATED
23 # GENERIC_ALLOCATOR is used by dma_alloc_coherent() 21 # GENERIC_ALLOCATOR is used by dma_alloc_coherent()
24 select GENERIC_ALLOCATOR 22 select GENERIC_ALLOCATOR
25 select GENERIC_IRQ_SHOW 23 select GENERIC_IRQ_SHOW
@@ -27,6 +25,7 @@ config HEXAGON
27 select HAVE_ARCH_TRACEHOOK 25 select HAVE_ARCH_TRACEHOOK
28 select NO_IOPORT 26 select NO_IOPORT
29 select GENERIC_IOMAP 27 select GENERIC_IOMAP
28 select GENERIC_SMP_IDLE_THREAD
30 # mostly generic routines, with some accelerated ones 29 # mostly generic routines, with some accelerated ones
31 ---help--- 30 ---help---
32 Qualcomm Hexagon is a processor architecture designed for high 31 Qualcomm Hexagon is a processor architecture designed for high
diff --git a/arch/hexagon/Makefile b/arch/hexagon/Makefile
index 0c4de8790fd5..e27d030846ae 100644
--- a/arch/hexagon/Makefile
+++ b/arch/hexagon/Makefile
@@ -45,8 +45,7 @@ KBUILD_AFLAGS += -DTHREADINFO_REG=$(TIR_NAME)
45LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) 45LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
46libs-y += $(LIBGCC) 46libs-y += $(LIBGCC)
47 47
48head-y := arch/hexagon/kernel/head.o \ 48head-y := arch/hexagon/kernel/head.o
49 arch/hexagon/kernel/init_task.o
50 49
51core-y += arch/hexagon/kernel/ \ 50core-y += arch/hexagon/kernel/ \
52 arch/hexagon/mm/ \ 51 arch/hexagon/mm/ \
diff --git a/arch/hexagon/include/asm/thread_info.h b/arch/hexagon/include/asm/thread_info.h
index 9c2934ff5756..4f936a7ee847 100644
--- a/arch/hexagon/include/asm/thread_info.h
+++ b/arch/hexagon/include/asm/thread_info.h
@@ -31,15 +31,7 @@
31 31
32#define THREAD_SHIFT 12 32#define THREAD_SHIFT 12
33#define THREAD_SIZE (1<<THREAD_SHIFT) 33#define THREAD_SIZE (1<<THREAD_SHIFT)
34
35#if THREAD_SHIFT >= PAGE_SHIFT
36#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) 34#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT)
37#else /* don't use standard allocator */
38#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
39extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);
40extern void free_thread_info(struct thread_info *ti);
41#endif
42
43 35
44#ifndef __ASSEMBLY__ 36#ifndef __ASSEMBLY__
45 37
diff --git a/arch/hexagon/kernel/Makefile b/arch/hexagon/kernel/Makefile
index 3689f3754d09..536aec093e62 100644
--- a/arch/hexagon/kernel/Makefile
+++ b/arch/hexagon/kernel/Makefile
@@ -1,4 +1,4 @@
1extra-y := head.o vmlinux.lds init_task.o 1extra-y := head.o vmlinux.lds
2 2
3obj-$(CONFIG_SMP) += smp.o topology.o 3obj-$(CONFIG_SMP) += smp.o topology.o
4 4
diff --git a/arch/hexagon/kernel/dma.c b/arch/hexagon/kernel/dma.c
index 37302218ca4a..0f2367cc5493 100644
--- a/arch/hexagon/kernel/dma.c
+++ b/arch/hexagon/kernel/dma.c
@@ -22,6 +22,7 @@
22#include <linux/bootmem.h> 22#include <linux/bootmem.h>
23#include <linux/genalloc.h> 23#include <linux/genalloc.h>
24#include <asm/dma-mapping.h> 24#include <asm/dma-mapping.h>
25#include <linux/module.h>
25 26
26struct dma_map_ops *dma_ops; 27struct dma_map_ops *dma_ops;
27EXPORT_SYMBOL(dma_ops); 28EXPORT_SYMBOL(dma_ops);
diff --git a/arch/hexagon/kernel/init_task.c b/arch/hexagon/kernel/init_task.c
deleted file mode 100644
index 73283d3edf09..000000000000
--- a/arch/hexagon/kernel/init_task.c
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * Init task definition
3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and
8 * only version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA.
19 */
20
21#include <linux/mm.h>
22#include <linux/module.h>
23#include <linux/sched.h>
24#include <linux/init_task.h>
25#include <linux/fs.h>
26#include <linux/mqueue.h>
27#include <asm/thread_info.h>
28#include <asm/uaccess.h>
29#include <asm/pgtable.h>
30
31static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
32static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
33
34/*
35 * Initial thread structure.
36 *
37 * We need to make sure that this is 8192-byte aligned due to the
38 * way process stacks are handled. This is done by making sure
39 * the linker maps this in the .text segment right after head.S,
40 * and making head.S ensure the proper alignment.
41 */
42union thread_union init_thread_union
43 __attribute__((__section__(".data.init_task"),
44 __aligned__(THREAD_SIZE))) = {
45 INIT_THREAD_INFO(init_task)
46 };
47
48/*
49 * Initial task structure.
50 *
51 * All other task structs will be allocated on slabs in fork.c
52 */
53struct task_struct init_task = INIT_TASK(init_task);
54EXPORT_SYMBOL(init_task);
diff --git a/arch/hexagon/kernel/process.c b/arch/hexagon/kernel/process.c
index 18c4f0b0f4ba..af51de63b835 100644
--- a/arch/hexagon/kernel/process.c
+++ b/arch/hexagon/kernel/process.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Process creation support for Hexagon 2 * Process creation support for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -88,7 +88,7 @@ void (*idle_sleep)(void) = default_idle;
88void cpu_idle(void) 88void cpu_idle(void)
89{ 89{
90 while (1) { 90 while (1) {
91 tick_nohz_stop_sched_tick(1); 91 tick_nohz_idle_enter();
92 local_irq_disable(); 92 local_irq_disable();
93 while (!need_resched()) { 93 while (!need_resched()) {
94 idle_sleep(); 94 idle_sleep();
@@ -97,7 +97,7 @@ void cpu_idle(void)
97 local_irq_disable(); 97 local_irq_disable();
98 } 98 }
99 local_irq_enable(); 99 local_irq_enable();
100 tick_nohz_restart_sched_tick(); 100 tick_nohz_idle_exit();
101 schedule(); 101 schedule();
102 } 102 }
103} 103}
@@ -234,43 +234,6 @@ unsigned long get_wchan(struct task_struct *p)
234} 234}
235 235
236/* 236/*
237 * Borrowed from PowerPC -- basically allow smaller kernel stacks if we
238 * go crazy with the page sizes.
239 */
240#if THREAD_SHIFT < PAGE_SHIFT
241
242static struct kmem_cache *thread_info_cache;
243
244struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
245{
246 struct thread_info *ti;
247
248 ti = kmem_cache_alloc_node(thread_info_cache, GFP_KERNEL, node);
249 if (unlikely(ti == NULL))
250 return NULL;
251#ifdef CONFIG_DEBUG_STACK_USAGE
252 memset(ti, 0, THREAD_SIZE);
253#endif
254 return ti;
255}
256
257void free_thread_info(struct thread_info *ti)
258{
259 kmem_cache_free(thread_info_cache, ti);
260}
261
262/* Weak symbol; called by init/main.c */
263
264void thread_info_cache_init(void)
265{
266 thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
267 THREAD_SIZE, 0, NULL);
268 BUG_ON(thread_info_cache == NULL);
269}
270
271#endif /* THREAD_SHIFT < PAGE_SHIFT */
272
273/*
274 * Required placeholder. 237 * Required placeholder.
275 */ 238 */
276int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu) 239int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
diff --git a/arch/hexagon/kernel/ptrace.c b/arch/hexagon/kernel/ptrace.c
index 32342de1a79c..96c3b2c4dbad 100644
--- a/arch/hexagon/kernel/ptrace.c
+++ b/arch/hexagon/kernel/ptrace.c
@@ -28,6 +28,7 @@
28#include <linux/ptrace.h> 28#include <linux/ptrace.h>
29#include <linux/regset.h> 29#include <linux/regset.h>
30#include <linux/user.h> 30#include <linux/user.h>
31#include <linux/elf.h>
31 32
32#include <asm/user.h> 33#include <asm/user.h>
33 34
diff --git a/arch/hexagon/kernel/smp.c b/arch/hexagon/kernel/smp.c
index 9b44a9e2d05a..f7264621e58d 100644
--- a/arch/hexagon/kernel/smp.c
+++ b/arch/hexagon/kernel/smp.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * SMP support for Hexagon 2 * SMP support for Hexagon
3 * 3 *
4 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and 7 * it under the terms of the GNU General Public License version 2 and
@@ -28,6 +28,7 @@
28#include <linux/sched.h> 28#include <linux/sched.h>
29#include <linux/smp.h> 29#include <linux/smp.h>
30#include <linux/spinlock.h> 30#include <linux/spinlock.h>
31#include <linux/cpu.h>
31 32
32#include <asm/time.h> /* timer_interrupt */ 33#include <asm/time.h> /* timer_interrupt */
33#include <asm/hexagon_vm.h> 34#include <asm/hexagon_vm.h>
@@ -177,7 +178,12 @@ void __cpuinit start_secondary(void)
177 178
178 printk(KERN_INFO "%s cpu %d\n", __func__, current_thread_info()->cpu); 179 printk(KERN_INFO "%s cpu %d\n", __func__, current_thread_info()->cpu);
179 180
181 notify_cpu_starting(cpu);
182
183 ipi_call_lock();
180 set_cpu_online(cpu, true); 184 set_cpu_online(cpu, true);
185 ipi_call_unlock();
186
181 local_irq_enable(); 187 local_irq_enable();
182 188
183 cpu_idle(); 189 cpu_idle();
@@ -190,18 +196,11 @@ void __cpuinit start_secondary(void)
190 * maintains control until "cpu_online(cpu)" is set. 196 * maintains control until "cpu_online(cpu)" is set.
191 */ 197 */
192 198
193int __cpuinit __cpu_up(unsigned int cpu) 199int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
194{ 200{
195 struct task_struct *idle; 201 struct thread_info *thread = (struct thread_info *)idle->stack;
196 struct thread_info *thread;
197 void *stack_start; 202 void *stack_start;
198 203
199 /* Create new init task for the CPU */
200 idle = fork_idle(cpu);
201 if (IS_ERR(idle))
202 panic(KERN_ERR "fork_idle failed\n");
203
204 thread = (struct thread_info *)idle->stack;
205 thread->cpu = cpu; 204 thread->cpu = cpu;
206 205
207 /* Boot to the head. */ 206 /* Boot to the head. */
diff --git a/arch/hexagon/kernel/time.c b/arch/hexagon/kernel/time.c
index 6bee15c9c113..5d9b33b67935 100644
--- a/arch/hexagon/kernel/time.c
+++ b/arch/hexagon/kernel/time.c
@@ -28,6 +28,7 @@
28#include <linux/of.h> 28#include <linux/of.h>
29#include <linux/of_address.h> 29#include <linux/of_address.h>
30#include <linux/of_irq.h> 30#include <linux/of_irq.h>
31#include <linux/module.h>
31 32
32#include <asm/timer-regs.h> 33#include <asm/timer-regs.h>
33#include <asm/hexagon_vm.h> 34#include <asm/hexagon_vm.h>
diff --git a/arch/hexagon/kernel/vdso.c b/arch/hexagon/kernel/vdso.c
index f212a453b527..5d39f42f7085 100644
--- a/arch/hexagon/kernel/vdso.c
+++ b/arch/hexagon/kernel/vdso.c
@@ -21,6 +21,7 @@
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/vmalloc.h> 23#include <linux/vmalloc.h>
24#include <linux/binfmts.h>
24 25
25#include <asm/vdso.h> 26#include <asm/vdso.h>
26 27
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index bd7266903bf8..ba667b60f32d 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -33,6 +33,10 @@ config IA64
33 select ARCH_WANT_OPTIONAL_GPIOLIB 33 select ARCH_WANT_OPTIONAL_GPIOLIB
34 select ARCH_HAVE_NMI_SAFE_CMPXCHG 34 select ARCH_HAVE_NMI_SAFE_CMPXCHG
35 select GENERIC_IOMAP 35 select GENERIC_IOMAP
36 select GENERIC_SMP_IDLE_THREAD
37 select ARCH_INIT_TASK
38 select ARCH_TASK_STRUCT_ALLOCATOR
39 select ARCH_THREAD_INFO_ALLOCATOR
36 default y 40 default y
37 help 41 help
38 The Itanium Processor Family is Intel's 64-bit successor to 42 The Itanium Processor Family is Intel's 64-bit successor to
diff --git a/arch/ia64/include/asm/cmpxchg.h b/arch/ia64/include/asm/cmpxchg.h
index 4c96187e2049..4f37dbbb8640 100644
--- a/arch/ia64/include/asm/cmpxchg.h
+++ b/arch/ia64/include/asm/cmpxchg.h
@@ -1 +1,147 @@
1#include <asm/intrinsics.h> 1#ifndef _ASM_IA64_CMPXCHG_H
2#define _ASM_IA64_CMPXCHG_H
3
4/*
5 * Compare/Exchange, forked from asm/intrinsics.h
6 * which was:
7 *
8 * Copyright (C) 2002-2003 Hewlett-Packard Co
9 * David Mosberger-Tang <davidm@hpl.hp.com>
10 */
11
12#ifndef __ASSEMBLY__
13
14#include <linux/types.h>
15/* include compiler specific intrinsics */
16#include <asm/ia64regs.h>
17#ifdef __INTEL_COMPILER
18# include <asm/intel_intrin.h>
19#else
20# include <asm/gcc_intrin.h>
21#endif
22
23/*
24 * This function doesn't exist, so you'll get a linker error if
25 * something tries to do an invalid xchg().
26 */
27extern void ia64_xchg_called_with_bad_pointer(void);
28
29#define __xchg(x, ptr, size) \
30({ \
31 unsigned long __xchg_result; \
32 \
33 switch (size) { \
34 case 1: \
35 __xchg_result = ia64_xchg1((__u8 *)ptr, x); \
36 break; \
37 \
38 case 2: \
39 __xchg_result = ia64_xchg2((__u16 *)ptr, x); \
40 break; \
41 \
42 case 4: \
43 __xchg_result = ia64_xchg4((__u32 *)ptr, x); \
44 break; \
45 \
46 case 8: \
47 __xchg_result = ia64_xchg8((__u64 *)ptr, x); \
48 break; \
49 default: \
50 ia64_xchg_called_with_bad_pointer(); \
51 } \
52 __xchg_result; \
53})
54
55#define xchg(ptr, x) \
56((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr))))
57
58/*
59 * Atomic compare and exchange. Compare OLD with MEM, if identical,
60 * store NEW in MEM. Return the initial value in MEM. Success is
61 * indicated by comparing RETURN with OLD.
62 */
63
64#define __HAVE_ARCH_CMPXCHG 1
65
66/*
67 * This function doesn't exist, so you'll get a linker error
68 * if something tries to do an invalid cmpxchg().
69 */
70extern long ia64_cmpxchg_called_with_bad_pointer(void);
71
72#define ia64_cmpxchg(sem, ptr, old, new, size) \
73({ \
74 __u64 _o_, _r_; \
75 \
76 switch (size) { \
77 case 1: \
78 _o_ = (__u8) (long) (old); \
79 break; \
80 case 2: \
81 _o_ = (__u16) (long) (old); \
82 break; \
83 case 4: \
84 _o_ = (__u32) (long) (old); \
85 break; \
86 case 8: \
87 _o_ = (__u64) (long) (old); \
88 break; \
89 default: \
90 break; \
91 } \
92 switch (size) { \
93 case 1: \
94 _r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \
95 break; \
96 \
97 case 2: \
98 _r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \
99 break; \
100 \
101 case 4: \
102 _r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \
103 break; \
104 \
105 case 8: \
106 _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \
107 break; \
108 \
109 default: \
110 _r_ = ia64_cmpxchg_called_with_bad_pointer(); \
111 break; \
112 } \
113 (__typeof__(old)) _r_; \
114})
115
116#define cmpxchg_acq(ptr, o, n) \
117 ia64_cmpxchg(acq, (ptr), (o), (n), sizeof(*(ptr)))
118#define cmpxchg_rel(ptr, o, n) \
119 ia64_cmpxchg(rel, (ptr), (o), (n), sizeof(*(ptr)))
120
121/* for compatibility with other platforms: */
122#define cmpxchg(ptr, o, n) cmpxchg_acq((ptr), (o), (n))
123#define cmpxchg64(ptr, o, n) cmpxchg_acq((ptr), (o), (n))
124
125#define cmpxchg_local cmpxchg
126#define cmpxchg64_local cmpxchg64
127
128#ifdef CONFIG_IA64_DEBUG_CMPXCHG
129# define CMPXCHG_BUGCHECK_DECL int _cmpxchg_bugcheck_count = 128;
130# define CMPXCHG_BUGCHECK(v) \
131do { \
132 if (_cmpxchg_bugcheck_count-- <= 0) { \
133 void *ip; \
134 extern int printk(const char *fmt, ...); \
135 ip = (void *) ia64_getreg(_IA64_REG_IP); \
136 printk("CMPXCHG_BUGCHECK: stuck at %p on word %p\n", ip, (v));\
137 break; \
138 } \
139} while (0)
140#else /* !CONFIG_IA64_DEBUG_CMPXCHG */
141# define CMPXCHG_BUGCHECK_DECL
142# define CMPXCHG_BUGCHECK(v)
143#endif /* !CONFIG_IA64_DEBUG_CMPXCHG */
144
145#endif /* !__ASSEMBLY__ */
146
147#endif /* _ASM_IA64_CMPXCHG_H */
diff --git a/arch/ia64/include/asm/futex.h b/arch/ia64/include/asm/futex.h
index 0ab82cc2dc8f..d2bf1fd5e44f 100644
--- a/arch/ia64/include/asm/futex.h
+++ b/arch/ia64/include/asm/futex.h
@@ -106,15 +106,16 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
106 return -EFAULT; 106 return -EFAULT;
107 107
108 { 108 {
109 register unsigned long r8 __asm ("r8") = 0; 109 register unsigned long r8 __asm ("r8");
110 unsigned long prev; 110 unsigned long prev;
111 __asm__ __volatile__( 111 __asm__ __volatile__(
112 " mf;; \n" 112 " mf;; \n"
113 " mov ar.ccv=%3;; \n" 113 " mov %0=r0 \n"
114 "[1:] cmpxchg4.acq %0=[%1],%2,ar.ccv \n" 114 " mov ar.ccv=%4;; \n"
115 "[1:] cmpxchg4.acq %1=[%2],%3,ar.ccv \n"
115 " .xdata4 \"__ex_table\", 1b-., 2f-. \n" 116 " .xdata4 \"__ex_table\", 1b-., 2f-. \n"
116 "[2:]" 117 "[2:]"
117 : "=r" (prev) 118 : "=r" (r8), "=r" (prev)
118 : "r" (uaddr), "r" (newval), 119 : "r" (uaddr), "r" (newval),
119 "rO" ((long) (unsigned) oldval) 120 "rO" ((long) (unsigned) oldval)
120 : "memory"); 121 : "memory");
diff --git a/arch/ia64/include/asm/intrinsics.h b/arch/ia64/include/asm/intrinsics.h
index e4076b511829..d129e367e764 100644
--- a/arch/ia64/include/asm/intrinsics.h
+++ b/arch/ia64/include/asm/intrinsics.h
@@ -18,6 +18,7 @@
18#else 18#else
19# include <asm/gcc_intrin.h> 19# include <asm/gcc_intrin.h>
20#endif 20#endif
21#include <asm/cmpxchg.h>
21 22
22#define ia64_native_get_psr_i() (ia64_native_getreg(_IA64_REG_PSR) & IA64_PSR_I) 23#define ia64_native_get_psr_i() (ia64_native_getreg(_IA64_REG_PSR) & IA64_PSR_I)
23 24
@@ -81,119 +82,6 @@ extern unsigned long __bad_increment_for_ia64_fetch_and_add (void);
81 82
82#define ia64_fetch_and_add(i,v) (ia64_fetchadd(i, v, rel) + (i)) /* return new value */ 83#define ia64_fetch_and_add(i,v) (ia64_fetchadd(i, v, rel) + (i)) /* return new value */
83 84
84/*
85 * This function doesn't exist, so you'll get a linker error if
86 * something tries to do an invalid xchg().
87 */
88extern void ia64_xchg_called_with_bad_pointer (void);
89
90#define __xchg(x,ptr,size) \
91({ \
92 unsigned long __xchg_result; \
93 \
94 switch (size) { \
95 case 1: \
96 __xchg_result = ia64_xchg1((__u8 *)ptr, x); \
97 break; \
98 \
99 case 2: \
100 __xchg_result = ia64_xchg2((__u16 *)ptr, x); \
101 break; \
102 \
103 case 4: \
104 __xchg_result = ia64_xchg4((__u32 *)ptr, x); \
105 break; \
106 \
107 case 8: \
108 __xchg_result = ia64_xchg8((__u64 *)ptr, x); \
109 break; \
110 default: \
111 ia64_xchg_called_with_bad_pointer(); \
112 } \
113 __xchg_result; \
114})
115
116#define xchg(ptr,x) \
117 ((__typeof__(*(ptr))) __xchg ((unsigned long) (x), (ptr), sizeof(*(ptr))))
118
119/*
120 * Atomic compare and exchange. Compare OLD with MEM, if identical,
121 * store NEW in MEM. Return the initial value in MEM. Success is
122 * indicated by comparing RETURN with OLD.
123 */
124
125#define __HAVE_ARCH_CMPXCHG 1
126
127/*
128 * This function doesn't exist, so you'll get a linker error
129 * if something tries to do an invalid cmpxchg().
130 */
131extern long ia64_cmpxchg_called_with_bad_pointer (void);
132
133#define ia64_cmpxchg(sem,ptr,old,new,size) \
134({ \
135 __u64 _o_, _r_; \
136 \
137 switch (size) { \
138 case 1: _o_ = (__u8 ) (long) (old); break; \
139 case 2: _o_ = (__u16) (long) (old); break; \
140 case 4: _o_ = (__u32) (long) (old); break; \
141 case 8: _o_ = (__u64) (long) (old); break; \
142 default: break; \
143 } \
144 switch (size) { \
145 case 1: \
146 _r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \
147 break; \
148 \
149 case 2: \
150 _r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \
151 break; \
152 \
153 case 4: \
154 _r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \
155 break; \
156 \
157 case 8: \
158 _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \
159 break; \
160 \
161 default: \
162 _r_ = ia64_cmpxchg_called_with_bad_pointer(); \
163 break; \
164 } \
165 (__typeof__(old)) _r_; \
166})
167
168#define cmpxchg_acq(ptr, o, n) \
169 ia64_cmpxchg(acq, (ptr), (o), (n), sizeof(*(ptr)))
170#define cmpxchg_rel(ptr, o, n) \
171 ia64_cmpxchg(rel, (ptr), (o), (n), sizeof(*(ptr)))
172
173/* for compatibility with other platforms: */
174#define cmpxchg(ptr, o, n) cmpxchg_acq((ptr), (o), (n))
175#define cmpxchg64(ptr, o, n) cmpxchg_acq((ptr), (o), (n))
176
177#define cmpxchg_local cmpxchg
178#define cmpxchg64_local cmpxchg64
179
180#ifdef CONFIG_IA64_DEBUG_CMPXCHG
181# define CMPXCHG_BUGCHECK_DECL int _cmpxchg_bugcheck_count = 128;
182# define CMPXCHG_BUGCHECK(v) \
183 do { \
184 if (_cmpxchg_bugcheck_count-- <= 0) { \
185 void *ip; \
186 extern int printk(const char *fmt, ...); \
187 ip = (void *) ia64_getreg(_IA64_REG_IP); \
188 printk("CMPXCHG_BUGCHECK: stuck at %p on word %p\n", ip, (v)); \
189 break; \
190 } \
191 } while (0)
192#else /* !CONFIG_IA64_DEBUG_CMPXCHG */
193# define CMPXCHG_BUGCHECK_DECL
194# define CMPXCHG_BUGCHECK(v)
195#endif /* !CONFIG_IA64_DEBUG_CMPXCHG */
196
197#endif 85#endif
198 86
199#ifdef __KERNEL__ 87#ifdef __KERNEL__
diff --git a/arch/ia64/include/asm/irq_remapping.h b/arch/ia64/include/asm/irq_remapping.h
new file mode 100644
index 000000000000..a8687b1d8906
--- /dev/null
+++ b/arch/ia64/include/asm/irq_remapping.h
@@ -0,0 +1,4 @@
1#ifndef __IA64_INTR_REMAPPING_H
2#define __IA64_INTR_REMAPPING_H
3#define irq_remapping_enabled 0
4#endif
diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h
index 483f6c6a4238..f92f67aba618 100644
--- a/arch/ia64/include/asm/processor.h
+++ b/arch/ia64/include/asm/processor.h
@@ -723,7 +723,6 @@ extern unsigned long boot_option_idle_override;
723enum idle_boot_override {IDLE_NO_OVERRIDE=0, IDLE_HALT, IDLE_FORCE_MWAIT, 723enum idle_boot_override {IDLE_NO_OVERRIDE=0, IDLE_HALT, IDLE_FORCE_MWAIT,
724 IDLE_NOMWAIT, IDLE_POLL}; 724 IDLE_NOMWAIT, IDLE_POLL};
725 725
726void cpu_idle_wait(void);
727void default_idle(void); 726void default_idle(void);
728 727
729#define ia64_platform_is(x) (strcmp(x, platform_name) == 0) 728#define ia64_platform_is(x) (strcmp(x, platform_name) == 0)
diff --git a/arch/ia64/include/asm/thread_info.h b/arch/ia64/include/asm/thread_info.h
index e054bcc4273c..310d9734f02d 100644
--- a/arch/ia64/include/asm/thread_info.h
+++ b/arch/ia64/include/asm/thread_info.h
@@ -54,8 +54,6 @@ struct thread_info {
54 }, \ 54 }, \
55} 55}
56 56
57#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
58
59#ifndef ASM_OFFSETS_C 57#ifndef ASM_OFFSETS_C
60/* how to get the thread information struct from C */ 58/* how to get the thread information struct from C */
61#define current_thread_info() ((struct thread_info *) ((char *) current + IA64_TASK_SIZE)) 59#define current_thread_info() ((struct thread_info *) ((char *) current + IA64_TASK_SIZE))
@@ -84,7 +82,6 @@ struct thread_info {
84#endif 82#endif
85#define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET) 83#define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET)
86 84
87#define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
88#define alloc_task_struct_node(node) \ 85#define alloc_task_struct_node(node) \
89({ \ 86({ \
90 struct page *page = alloc_pages_node(node, GFP_KERNEL | __GFP_COMP, \ 87 struct page *page = alloc_pages_node(node, GFP_KERNEL | __GFP_COMP, \
diff --git a/arch/ia64/include/asm/topology.h b/arch/ia64/include/asm/topology.h
index 09f646753d1a..a2496e449b75 100644
--- a/arch/ia64/include/asm/topology.h
+++ b/arch/ia64/include/asm/topology.h
@@ -70,31 +70,6 @@ void build_cpu_to_node_map(void);
70 .nr_balance_failed = 0, \ 70 .nr_balance_failed = 0, \
71} 71}
72 72
73/* sched_domains SD_NODE_INIT for IA64 NUMA machines */
74#define SD_NODE_INIT (struct sched_domain) { \
75 .parent = NULL, \
76 .child = NULL, \
77 .groups = NULL, \
78 .min_interval = 8, \
79 .max_interval = 8*(min(num_online_cpus(), 32U)), \
80 .busy_factor = 64, \
81 .imbalance_pct = 125, \
82 .cache_nice_tries = 2, \
83 .busy_idx = 3, \
84 .idle_idx = 2, \
85 .newidle_idx = 0, \
86 .wake_idx = 0, \
87 .forkexec_idx = 0, \
88 .flags = SD_LOAD_BALANCE \
89 | SD_BALANCE_NEWIDLE \
90 | SD_BALANCE_EXEC \
91 | SD_BALANCE_FORK \
92 | SD_SERIALIZE, \
93 .last_balance = jiffies, \
94 .balance_interval = 64, \
95 .nr_balance_failed = 0, \
96}
97
98#endif /* CONFIG_NUMA */ 73#endif /* CONFIG_NUMA */
99 74
100#ifdef CONFIG_SMP 75#ifdef CONFIG_SMP
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 9d0fd7d5bb82..f00ba025375d 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -604,12 +604,6 @@ pfm_unprotect_ctx_ctxsw(pfm_context_t *x, unsigned long f)
604 spin_unlock(&(x)->ctx_lock); 604 spin_unlock(&(x)->ctx_lock);
605} 605}
606 606
607static inline unsigned int
608pfm_do_munmap(struct mm_struct *mm, unsigned long addr, size_t len, int acct)
609{
610 return do_munmap(mm, addr, len);
611}
612
613static inline unsigned long 607static inline unsigned long
614pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec) 608pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec)
615{ 609{
@@ -1458,8 +1452,9 @@ pfm_unreserve_session(pfm_context_t *ctx, int is_syswide, unsigned int cpu)
1458 * a PROTECT_CTX() section. 1452 * a PROTECT_CTX() section.
1459 */ 1453 */
1460static int 1454static int
1461pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long size) 1455pfm_remove_smpl_mapping(void *vaddr, unsigned long size)
1462{ 1456{
1457 struct task_struct *task = current;
1463 int r; 1458 int r;
1464 1459
1465 /* sanity checks */ 1460 /* sanity checks */
@@ -1473,13 +1468,8 @@ pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long siz
1473 /* 1468 /*
1474 * does the actual unmapping 1469 * does the actual unmapping
1475 */ 1470 */
1476 down_write(&task->mm->mmap_sem); 1471 r = vm_munmap((unsigned long)vaddr, size);
1477 1472
1478 DPRINT(("down_write done smpl_vaddr=%p size=%lu\n", vaddr, size));
1479
1480 r = pfm_do_munmap(task->mm, (unsigned long)vaddr, size, 0);
1481
1482 up_write(&task->mm->mmap_sem);
1483 if (r !=0) { 1473 if (r !=0) {
1484 printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size); 1474 printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size);
1485 } 1475 }
@@ -1945,7 +1935,7 @@ pfm_flush(struct file *filp, fl_owner_t id)
1945 * because some VM function reenables interrupts. 1935 * because some VM function reenables interrupts.
1946 * 1936 *
1947 */ 1937 */
1948 if (smpl_buf_vaddr) pfm_remove_smpl_mapping(current, smpl_buf_vaddr, smpl_buf_size); 1938 if (smpl_buf_vaddr) pfm_remove_smpl_mapping(smpl_buf_vaddr, smpl_buf_size);
1949 1939
1950 return 0; 1940 return 0;
1951} 1941}
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index ce74e143aea3..5e0e86ddb12f 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -273,26 +273,6 @@ static inline void play_dead(void)
273} 273}
274#endif /* CONFIG_HOTPLUG_CPU */ 274#endif /* CONFIG_HOTPLUG_CPU */
275 275
276static void do_nothing(void *unused)
277{
278}
279
280/*
281 * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
282 * pm_idle and update to new pm_idle value. Required while changing pm_idle
283 * handler on SMP systems.
284 *
285 * Caller must have changed pm_idle to the new value before the call. Old
286 * pm_idle value will not be used by any CPU after the return of this function.
287 */
288void cpu_idle_wait(void)
289{
290 smp_mb();
291 /* kick all the CPUs so that they exit out of pm_idle */
292 smp_call_function(do_nothing, NULL, 1);
293}
294EXPORT_SYMBOL_GPL(cpu_idle_wait);
295
296void __attribute__((noreturn)) 276void __attribute__((noreturn))
297cpu_idle (void) 277cpu_idle (void)
298{ 278{
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 796f6a5b966a..1113b8aba07f 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -75,13 +75,6 @@
75#endif 75#endif
76 76
77/* 77/*
78 * Store all idle threads, this can be reused instead of creating
79 * a new thread. Also avoids complicated thread destroy functionality
80 * for idle threads.
81 */
82struct task_struct *idle_thread_array[NR_CPUS];
83
84/*
85 * Global array allocated for NR_CPUS at boot time 78 * Global array allocated for NR_CPUS at boot time
86 */ 79 */
87struct sal_to_os_boot sal_boot_rendez_state[NR_CPUS]; 80struct sal_to_os_boot sal_boot_rendez_state[NR_CPUS];
@@ -94,13 +87,7 @@ struct sal_to_os_boot *sal_state_for_booting_cpu = &sal_boot_rendez_state[0];
94 87
95#define set_brendez_area(x) (sal_state_for_booting_cpu = &sal_boot_rendez_state[(x)]); 88#define set_brendez_area(x) (sal_state_for_booting_cpu = &sal_boot_rendez_state[(x)]);
96 89
97#define get_idle_for_cpu(x) (idle_thread_array[(x)])
98#define set_idle_for_cpu(x,p) (idle_thread_array[(x)] = (p))
99
100#else 90#else
101
102#define get_idle_for_cpu(x) (NULL)
103#define set_idle_for_cpu(x,p)
104#define set_brendez_area(x) 91#define set_brendez_area(x)
105#endif 92#endif
106 93
@@ -480,54 +467,12 @@ struct pt_regs * __cpuinit idle_regs(struct pt_regs *regs)
480 return NULL; 467 return NULL;
481} 468}
482 469
483struct create_idle {
484 struct work_struct work;
485 struct task_struct *idle;
486 struct completion done;
487 int cpu;
488};
489
490void __cpuinit
491do_fork_idle(struct work_struct *work)
492{
493 struct create_idle *c_idle =
494 container_of(work, struct create_idle, work);
495
496 c_idle->idle = fork_idle(c_idle->cpu);
497 complete(&c_idle->done);
498}
499
500static int __cpuinit 470static int __cpuinit
501do_boot_cpu (int sapicid, int cpu) 471do_boot_cpu (int sapicid, int cpu, struct task_struct *idle)
502{ 472{
503 int timeout; 473 int timeout;
504 struct create_idle c_idle = {
505 .work = __WORK_INITIALIZER(c_idle.work, do_fork_idle),
506 .cpu = cpu,
507 .done = COMPLETION_INITIALIZER(c_idle.done),
508 };
509
510 /*
511 * We can't use kernel_thread since we must avoid to
512 * reschedule the child.
513 */
514 c_idle.idle = get_idle_for_cpu(cpu);
515 if (c_idle.idle) {
516 init_idle(c_idle.idle, cpu);
517 goto do_rest;
518 }
519
520 schedule_work(&c_idle.work);
521 wait_for_completion(&c_idle.done);
522
523 if (IS_ERR(c_idle.idle))
524 panic("failed fork for CPU %d", cpu);
525
526 set_idle_for_cpu(cpu, c_idle.idle);
527
528do_rest:
529 task_for_booting_cpu = c_idle.idle;
530 474
475 task_for_booting_cpu = idle;
531 Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid); 476 Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid);
532 477
533 set_brendez_area(cpu); 478 set_brendez_area(cpu);
@@ -793,7 +738,7 @@ set_cpu_sibling_map(int cpu)
793} 738}
794 739
795int __cpuinit 740int __cpuinit
796__cpu_up (unsigned int cpu) 741__cpu_up(unsigned int cpu, struct task_struct *tidle)
797{ 742{
798 int ret; 743 int ret;
799 int sapicid; 744 int sapicid;
@@ -811,7 +756,7 @@ __cpu_up (unsigned int cpu)
811 756
812 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; 757 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
813 /* Processor goes to start_secondary(), sets online flag */ 758 /* Processor goes to start_secondary(), sets online flag */
814 ret = do_boot_cpu(sapicid, cpu); 759 ret = do_boot_cpu(sapicid, cpu, tidle);
815 if (ret < 0) 760 if (ret < 0)
816 return ret; 761 return ret;
817 762
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index f5104b7c52cd..463fb3bbe11e 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -1174,7 +1174,7 @@ out:
1174 1174
1175bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu) 1175bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu)
1176{ 1176{
1177 return irqchip_in_kernel(vcpu->kcm) == (vcpu->arch.apic != NULL); 1177 return irqchip_in_kernel(vcpu->kvm) == (vcpu->arch.apic != NULL);
1178} 1178}
1179 1179
1180int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) 1180int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
diff --git a/arch/m32r/Makefile b/arch/m32r/Makefile
index 8ff5ba0ea26c..def8dd0b6bc5 100644
--- a/arch/m32r/Makefile
+++ b/arch/m32r/Makefile
@@ -31,7 +31,7 @@ KBUILD_AFLAGS += $(aflags-y)
31 31
32CHECKFLAGS += -D__m32r__ -D__BIG_ENDIAN__=1 32CHECKFLAGS += -D__m32r__ -D__BIG_ENDIAN__=1
33 33
34head-y := arch/m32r/kernel/head.o arch/m32r/kernel/init_task.o 34head-y := arch/m32r/kernel/head.o
35 35
36LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) 36LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
37 37
diff --git a/arch/m32r/include/asm/thread_info.h b/arch/m32r/include/asm/thread_info.h
index bf8fa3c06f4e..c083f6073ef4 100644
--- a/arch/m32r/include/asm/thread_info.h
+++ b/arch/m32r/include/asm/thread_info.h
@@ -55,8 +55,8 @@ struct thread_info {
55 55
56#define PREEMPT_ACTIVE 0x10000000 56#define PREEMPT_ACTIVE 0x10000000
57 57
58#define THREAD_SIZE (PAGE_SIZE << 1) 58#define THREAD_SIZE (PAGE_SIZE << 1)
59 59#define THREAD_SIZE_ORDER 1
60/* 60/*
61 * macros/functions for gaining access to the thread information structure 61 * macros/functions for gaining access to the thread information structure
62 */ 62 */
@@ -92,19 +92,6 @@ static inline struct thread_info *current_thread_info(void)
92 return ti; 92 return ti;
93} 93}
94 94
95#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
96
97/* thread information allocation */
98#ifdef CONFIG_DEBUG_STACK_USAGE
99#define alloc_thread_info_node(tsk, node) \
100 kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
101#else
102#define alloc_thread_info_node(tsk, node) \
103 kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
104#endif
105
106#define free_thread_info(info) kfree(info)
107
108#define TI_FLAG_FAULT_CODE_SHIFT 28 95#define TI_FLAG_FAULT_CODE_SHIFT 28
109 96
110static inline void set_thread_fault_code(unsigned int val) 97static inline void set_thread_fault_code(unsigned int val)
diff --git a/arch/m32r/kernel/Makefile b/arch/m32r/kernel/Makefile
index b1a4b6036591..0c09dad8b1f8 100644
--- a/arch/m32r/kernel/Makefile
+++ b/arch/m32r/kernel/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the Linux/M32R kernel. 2# Makefile for the Linux/M32R kernel.
3# 3#
4 4
5extra-y := head.o init_task.o vmlinux.lds 5extra-y := head.o vmlinux.lds
6 6
7obj-y := process.o entry.o traps.o align.o irq.o setup.o time.o \ 7obj-y := process.o entry.o traps.o align.o irq.o setup.o time.o \
8 m32r_ksyms.o sys_m32r.o signal.o ptrace.o 8 m32r_ksyms.o sys_m32r.o signal.o ptrace.o
diff --git a/arch/m32r/kernel/init_task.c b/arch/m32r/kernel/init_task.c
deleted file mode 100644
index 6c42d5f8df50..000000000000
--- a/arch/m32r/kernel/init_task.c
+++ /dev/null
@@ -1,34 +0,0 @@
1/* orig : i386 init_task.c */
2
3#include <linux/mm.h>
4#include <linux/module.h>
5#include <linux/sched.h>
6#include <linux/init.h>
7#include <linux/init_task.h>
8#include <linux/fs.h>
9#include <linux/mqueue.h>
10
11#include <asm/uaccess.h>
12#include <asm/pgtable.h>
13
14static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
15static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
16/*
17 * Initial thread structure.
18 *
19 * We need to make sure that this is 8192-byte aligned due to the
20 * way process stacks are handled. This is done by having a special
21 * "init_task" linker map entry..
22 */
23union thread_union init_thread_union __init_task_data =
24 { INIT_THREAD_INFO(init_task) };
25
26/*
27 * Initial task structure.
28 *
29 * All other task structs will be allocated on slabs in fork.c
30 */
31struct task_struct init_task = INIT_TASK(init_task);
32
33EXPORT_SYMBOL(init_task);
34
diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c
index cfdbe5d15002..a2cfc0abb05c 100644
--- a/arch/m32r/kernel/smpboot.c
+++ b/arch/m32r/kernel/smpboot.c
@@ -109,12 +109,8 @@ static unsigned int calibration_result;
109/* Function Prototypes */ 109/* Function Prototypes */
110/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 110/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
111 111
112void smp_prepare_boot_cpu(void);
113void smp_prepare_cpus(unsigned int);
114static void init_ipi_lock(void); 112static void init_ipi_lock(void);
115static void do_boot_cpu(int); 113static void do_boot_cpu(int);
116int __cpu_up(unsigned int);
117void smp_cpus_done(unsigned int);
118 114
119int start_secondary(void *); 115int start_secondary(void *);
120static void smp_callin(void); 116static void smp_callin(void);
@@ -347,7 +343,7 @@ static void __init do_boot_cpu(int phys_id)
347 } 343 }
348} 344}
349 345
350int __cpuinit __cpu_up(unsigned int cpu_id) 346int __cpuinit __cpu_up(unsigned int cpu_id, struct task_struct *tidle)
351{ 347{
352 int timeout; 348 int timeout;
353 349
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index cf318f20c64d..b7f2e2d5cd2e 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -16,6 +16,13 @@
16 16
17KBUILD_DEFCONFIG := multi_defconfig 17KBUILD_DEFCONFIG := multi_defconfig
18 18
19ifneq ($(SUBARCH),$(ARCH))
20 ifeq ($(CROSS_COMPILE),)
21 CROSS_COMPILE := $(call cc-cross-prefix, \
22 m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-)
23 endif
24endif
25
19# 26#
20# Enable processor type. Ordering of these is important - we want to 27# Enable processor type. Ordering of these is important - we want to
21# use the minimum processor type of the range we support. The logic 28# use the minimum processor type of the range we support. The logic
@@ -62,12 +69,6 @@ endif
62 69
63LDFLAGS := -m m68kelf 70LDFLAGS := -m m68kelf
64KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds 71KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds
65ifneq ($(SUBARCH),$(ARCH))
66 ifeq ($(CROSS_COMPILE),)
67 CROSS_COMPILE := $(call cc-cross-prefix, \
68 m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-)
69 endif
70endif
71 72
72ifdef CONFIG_SUN3 73ifdef CONFIG_SUN3
73LDFLAGS_vmlinux = -N 74LDFLAGS_vmlinux = -N
@@ -115,18 +116,6 @@ core-$(CONFIG_M68000) += arch/m68k/platform/68328/
115core-$(CONFIG_M68EZ328) += arch/m68k/platform/68EZ328/ 116core-$(CONFIG_M68EZ328) += arch/m68k/platform/68EZ328/
116core-$(CONFIG_M68VZ328) += arch/m68k/platform/68VZ328/ 117core-$(CONFIG_M68VZ328) += arch/m68k/platform/68VZ328/
117core-$(CONFIG_COLDFIRE) += arch/m68k/platform/coldfire/ 118core-$(CONFIG_COLDFIRE) += arch/m68k/platform/coldfire/
118core-$(CONFIG_M5206) += arch/m68k/platform/5206/
119core-$(CONFIG_M5206e) += arch/m68k/platform/5206/
120core-$(CONFIG_M520x) += arch/m68k/platform/520x/
121core-$(CONFIG_M523x) += arch/m68k/platform/523x/
122core-$(CONFIG_M5249) += arch/m68k/platform/5249/
123core-$(CONFIG_M527x) += arch/m68k/platform/527x/
124core-$(CONFIG_M5272) += arch/m68k/platform/5272/
125core-$(CONFIG_M528x) += arch/m68k/platform/528x/
126core-$(CONFIG_M5307) += arch/m68k/platform/5307/
127core-$(CONFIG_M532x) += arch/m68k/platform/532x/
128core-$(CONFIG_M5407) += arch/m68k/platform/5407/
129core-$(CONFIG_M54xx) += arch/m68k/platform/54xx/
130 119
131 120
132all: zImage 121all: zImage
diff --git a/arch/m68k/amiga/platform.c b/arch/m68k/amiga/platform.c
index 7fd8b41723ea..80076d368b7e 100644
--- a/arch/m68k/amiga/platform.c
+++ b/arch/m68k/amiga/platform.c
@@ -6,6 +6,7 @@
6 * for more details. 6 * for more details.
7 */ 7 */
8 8
9#include <linux/err.h>
9#include <linux/init.h> 10#include <linux/init.h>
10#include <linux/platform_device.h> 11#include <linux/platform_device.h>
11#include <linux/zorro.h> 12#include <linux/zorro.h>
@@ -46,18 +47,25 @@ static const struct resource zorro_resources[] __initconst = {
46 47
47static int __init amiga_init_bus(void) 48static int __init amiga_init_bus(void)
48{ 49{
50 struct platform_device *pdev;
51 unsigned int n;
52
49 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO)) 53 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO))
50 return -ENODEV; 54 return -ENODEV;
51 55
52 platform_device_register_simple("amiga-zorro", -1, zorro_resources, 56 n = AMIGAHW_PRESENT(ZORRO3) ? 4 : 2;
53 AMIGAHW_PRESENT(ZORRO3) ? 4 : 2); 57 pdev = platform_device_register_simple("amiga-zorro", -1,
58 zorro_resources, n);
59 if (IS_ERR(pdev))
60 return PTR_ERR(pdev);
61
54 return 0; 62 return 0;
55} 63}
56 64
57subsys_initcall(amiga_init_bus); 65subsys_initcall(amiga_init_bus);
58 66
59 67
60static int z_dev_present(zorro_id id) 68static int __init z_dev_present(zorro_id id)
61{ 69{
62 unsigned int i; 70 unsigned int i;
63 71
@@ -126,72 +134,122 @@ static const struct resource amiga_rtc_resource __initconst = {
126static int __init amiga_init_devices(void) 134static int __init amiga_init_devices(void)
127{ 135{
128 struct platform_device *pdev; 136 struct platform_device *pdev;
137 int error;
129 138
130 if (!MACH_IS_AMIGA) 139 if (!MACH_IS_AMIGA)
131 return -ENODEV; 140 return -ENODEV;
132 141
133 /* video hardware */ 142 /* video hardware */
134 if (AMIGAHW_PRESENT(AMI_VIDEO)) 143 if (AMIGAHW_PRESENT(AMI_VIDEO)) {
135 platform_device_register_simple("amiga-video", -1, NULL, 0); 144 pdev = platform_device_register_simple("amiga-video", -1, NULL,
145 0);
146 if (IS_ERR(pdev))
147 return PTR_ERR(pdev);
148 }
136 149
137 150
138 /* sound hardware */ 151 /* sound hardware */
139 if (AMIGAHW_PRESENT(AMI_AUDIO)) 152 if (AMIGAHW_PRESENT(AMI_AUDIO)) {
140 platform_device_register_simple("amiga-audio", -1, NULL, 0); 153 pdev = platform_device_register_simple("amiga-audio", -1, NULL,
154 0);
155 if (IS_ERR(pdev))
156 return PTR_ERR(pdev);
157 }
141 158
142 159
143 /* storage interfaces */ 160 /* storage interfaces */
144 if (AMIGAHW_PRESENT(AMI_FLOPPY)) 161 if (AMIGAHW_PRESENT(AMI_FLOPPY)) {
145 platform_device_register_simple("amiga-floppy", -1, NULL, 0); 162 pdev = platform_device_register_simple("amiga-floppy", -1,
163 NULL, 0);
164 if (IS_ERR(pdev))
165 return PTR_ERR(pdev);
166 }
146 167
147 if (AMIGAHW_PRESENT(A3000_SCSI)) 168 if (AMIGAHW_PRESENT(A3000_SCSI)) {
148 platform_device_register_simple("amiga-a3000-scsi", -1, 169 pdev = platform_device_register_simple("amiga-a3000-scsi", -1,
149 &a3000_scsi_resource, 1); 170 &a3000_scsi_resource, 1);
171 if (IS_ERR(pdev))
172 return PTR_ERR(pdev);
173 }
150 174
151 if (AMIGAHW_PRESENT(A4000_SCSI)) 175 if (AMIGAHW_PRESENT(A4000_SCSI)) {
152 platform_device_register_simple("amiga-a4000t-scsi", -1, 176 pdev = platform_device_register_simple("amiga-a4000t-scsi", -1,
153 &a4000t_scsi_resource, 1); 177 &a4000t_scsi_resource,
178 1);
179 if (IS_ERR(pdev))
180 return PTR_ERR(pdev);
181 }
154 182
155 if (AMIGAHW_PRESENT(A1200_IDE) || 183 if (AMIGAHW_PRESENT(A1200_IDE) ||
156 z_dev_present(ZORRO_PROD_MTEC_VIPER_MK_V_E_MATRIX_530_SCSI_IDE)) { 184 z_dev_present(ZORRO_PROD_MTEC_VIPER_MK_V_E_MATRIX_530_SCSI_IDE)) {
157 pdev = platform_device_register_simple("amiga-gayle-ide", -1, 185 pdev = platform_device_register_simple("amiga-gayle-ide", -1,
158 &a1200_ide_resource, 1); 186 &a1200_ide_resource, 1);
159 platform_device_add_data(pdev, &a1200_ide_pdata, 187 if (IS_ERR(pdev))
160 sizeof(a1200_ide_pdata)); 188 return PTR_ERR(pdev);
189 error = platform_device_add_data(pdev, &a1200_ide_pdata,
190 sizeof(a1200_ide_pdata));
191 if (error)
192 return error;
161 } 193 }
162 194
163 if (AMIGAHW_PRESENT(A4000_IDE)) { 195 if (AMIGAHW_PRESENT(A4000_IDE)) {
164 pdev = platform_device_register_simple("amiga-gayle-ide", -1, 196 pdev = platform_device_register_simple("amiga-gayle-ide", -1,
165 &a4000_ide_resource, 1); 197 &a4000_ide_resource, 1);
166 platform_device_add_data(pdev, &a4000_ide_pdata, 198 if (IS_ERR(pdev))
167 sizeof(a4000_ide_pdata)); 199 return PTR_ERR(pdev);
200 error = platform_device_add_data(pdev, &a4000_ide_pdata,
201 sizeof(a4000_ide_pdata));
202 if (error)
203 return error;
168 } 204 }
169 205
170 206
171 /* other I/O hardware */ 207 /* other I/O hardware */
172 if (AMIGAHW_PRESENT(AMI_KEYBOARD)) 208 if (AMIGAHW_PRESENT(AMI_KEYBOARD)) {
173 platform_device_register_simple("amiga-keyboard", -1, NULL, 0); 209 pdev = platform_device_register_simple("amiga-keyboard", -1,
210 NULL, 0);
211 if (IS_ERR(pdev))
212 return PTR_ERR(pdev);
213 }
174 214
175 if (AMIGAHW_PRESENT(AMI_MOUSE)) 215 if (AMIGAHW_PRESENT(AMI_MOUSE)) {
176 platform_device_register_simple("amiga-mouse", -1, NULL, 0); 216 pdev = platform_device_register_simple("amiga-mouse", -1, NULL,
217 0);
218 if (IS_ERR(pdev))
219 return PTR_ERR(pdev);
220 }
177 221
178 if (AMIGAHW_PRESENT(AMI_SERIAL)) 222 if (AMIGAHW_PRESENT(AMI_SERIAL)) {
179 platform_device_register_simple("amiga-serial", -1, NULL, 0); 223 pdev = platform_device_register_simple("amiga-serial", -1,
224 NULL, 0);
225 if (IS_ERR(pdev))
226 return PTR_ERR(pdev);
227 }
180 228
181 if (AMIGAHW_PRESENT(AMI_PARALLEL)) 229 if (AMIGAHW_PRESENT(AMI_PARALLEL)) {
182 platform_device_register_simple("amiga-parallel", -1, NULL, 0); 230 pdev = platform_device_register_simple("amiga-parallel", -1,
231 NULL, 0);
232 if (IS_ERR(pdev))
233 return PTR_ERR(pdev);
234 }
183 235
184 236
185 /* real time clocks */ 237 /* real time clocks */
186 if (AMIGAHW_PRESENT(A2000_CLK)) 238 if (AMIGAHW_PRESENT(A2000_CLK)) {
187 platform_device_register_simple("rtc-msm6242", -1, 239 pdev = platform_device_register_simple("rtc-msm6242", -1,
188 &amiga_rtc_resource, 1); 240 &amiga_rtc_resource, 1);
241 if (IS_ERR(pdev))
242 return PTR_ERR(pdev);
243 }
189 244
190 if (AMIGAHW_PRESENT(A3000_CLK)) 245 if (AMIGAHW_PRESENT(A3000_CLK)) {
191 platform_device_register_simple("rtc-rp5c01", -1, 246 pdev = platform_device_register_simple("rtc-rp5c01", -1,
192 &amiga_rtc_resource, 1); 247 &amiga_rtc_resource, 1);
248 if (IS_ERR(pdev))
249 return PTR_ERR(pdev);
250 }
193 251
194 return 0; 252 return 0;
195} 253}
196 254
197device_initcall(amiga_init_devices); 255arch_initcall(amiga_init_devices);
diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c
index 783d8f02360d..3f41092d1b70 100644
--- a/arch/m68k/atari/ataints.c
+++ b/arch/m68k/atari/ataints.c
@@ -206,7 +206,7 @@ void __init atari_init_IRQ(void)
206 * hardware with a programmable int vector (probably a VME board). 206 * hardware with a programmable int vector (probably a VME board).
207 */ 207 */
208 208
209unsigned long atari_register_vme_int(void) 209unsigned int atari_register_vme_int(void)
210{ 210{
211 int i; 211 int i;
212 212
@@ -223,7 +223,7 @@ unsigned long atari_register_vme_int(void)
223EXPORT_SYMBOL(atari_register_vme_int); 223EXPORT_SYMBOL(atari_register_vme_int);
224 224
225 225
226void atari_unregister_vme_int(unsigned long irq) 226void atari_unregister_vme_int(unsigned int irq)
227{ 227{
228 if (irq >= VME_SOURCE_BASE && irq < VME_SOURCE_BASE + VME_MAX_SOURCES) { 228 if (irq >= VME_SOURCE_BASE && irq < VME_SOURCE_BASE + VME_MAX_SOURCES) {
229 irq -= VME_SOURCE_BASE; 229 irq -= VME_SOURCE_BASE;
diff --git a/arch/m68k/configs/m5275evb_defconfig b/arch/m68k/configs/m5275evb_defconfig
index 33c32aeca12b..a1230e82bb1e 100644
--- a/arch/m68k/configs/m5275evb_defconfig
+++ b/arch/m68k/configs/m5275evb_defconfig
@@ -49,7 +49,6 @@ CONFIG_BLK_DEV_RAM=y
49CONFIG_NETDEVICES=y 49CONFIG_NETDEVICES=y
50CONFIG_NET_ETHERNET=y 50CONFIG_NET_ETHERNET=y
51CONFIG_FEC=y 51CONFIG_FEC=y
52CONFIG_FEC2=y
53# CONFIG_NETDEV_1000 is not set 52# CONFIG_NETDEV_1000 is not set
54# CONFIG_NETDEV_10000 is not set 53# CONFIG_NETDEV_10000 is not set
55CONFIG_PPP=y 54CONFIG_PPP=y
diff --git a/arch/m68k/configs/m5475evb_defconfig b/arch/m68k/configs/m5475evb_defconfig
new file mode 100644
index 000000000000..c5018a68819b
--- /dev/null
+++ b/arch/m68k/configs/m5475evb_defconfig
@@ -0,0 +1,62 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_SWAP is not set
3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_SYSFS_DEPRECATED=y
5CONFIG_SYSFS_DEPRECATED_V2=y
6CONFIG_SYSCTL_SYSCALL=y
7# CONFIG_KALLSYMS is not set
8# CONFIG_HOTPLUG is not set
9# CONFIG_FUTEX is not set
10# CONFIG_EPOLL is not set
11# CONFIG_SIGNALFD is not set
12# CONFIG_TIMERFD is not set
13# CONFIG_EVENTFD is not set
14# CONFIG_SHMEM is not set
15# CONFIG_AIO is not set
16CONFIG_EMBEDDED=y
17CONFIG_MODULES=y
18# CONFIG_LBDAF is not set
19# CONFIG_BLK_DEV_BSG is not set
20# CONFIG_IOSCHED_DEADLINE is not set
21# CONFIG_IOSCHED_CFQ is not set
22CONFIG_COLDFIRE=y
23CONFIG_M547x=y
24CONFIG_CLOCK_SET=y
25CONFIG_CLOCK_FREQ=266000000
26# CONFIG_4KSTACKS is not set
27CONFIG_RAMBASE=0x0
28CONFIG_RAMSIZE=0x2000000
29CONFIG_VECTORBASE=0x0
30CONFIG_MBAR=0xff000000
31CONFIG_KERNELBASE=0x20000
32# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
33# CONFIG_FW_LOADER is not set
34CONFIG_MTD=y
35CONFIG_MTD_CHAR=y
36CONFIG_MTD_BLOCK=y
37CONFIG_MTD_CFI=y
38CONFIG_MTD_JEDECPROBE=y
39CONFIG_MTD_CFI_AMDSTD=y
40CONFIG_MTD_RAM=y
41CONFIG_MTD_PHYSMAP=y
42CONFIG_MTD_UCLINUX=y
43CONFIG_BLK_DEV_RAM=y
44# CONFIG_INPUT is not set
45# CONFIG_VT is not set
46# CONFIG_UNIX98_PTYS is not set
47CONFIG_SERIAL_MCF=y
48CONFIG_SERIAL_MCF_CONSOLE=y
49# CONFIG_HW_RANDOM is not set
50# CONFIG_HWMON is not set
51# CONFIG_USB_SUPPORT is not set
52# CONFIG_IOMMU_SUPPORT is not set
53CONFIG_EXT2_FS=y
54# CONFIG_FILE_LOCKING is not set
55# CONFIG_DNOTIFY is not set
56# CONFIG_INOTIFY_USER is not set
57# CONFIG_PROC_PAGE_MONITOR is not set
58CONFIG_ROMFS_FS=y
59CONFIG_ROMFS_BACKED_BY_MTD=y
60# CONFIG_SCHED_DEBUG is not set
61CONFIG_BOOTPARAM=y
62CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0"
diff --git a/arch/m68k/include/asm/atariints.h b/arch/m68k/include/asm/atariints.h
index 656bbbf5a6ff..5fc13bdf9044 100644
--- a/arch/m68k/include/asm/atariints.h
+++ b/arch/m68k/include/asm/atariints.h
@@ -198,7 +198,7 @@ static inline int atari_irq_pending( unsigned irq )
198 return( get_mfp_bit( irq, MFP_PENDING ) ); 198 return( get_mfp_bit( irq, MFP_PENDING ) );
199} 199}
200 200
201unsigned long atari_register_vme_int( void ); 201unsigned int atari_register_vme_int(void);
202void atari_unregister_vme_int( unsigned long ); 202void atari_unregister_vme_int(unsigned int);
203 203
204#endif /* linux/atariints.h */ 204#endif /* linux/atariints.h */
diff --git a/arch/m68k/include/asm/cacheflush_no.h b/arch/m68k/include/asm/cacheflush_no.h
index cb88aa96c4f1..7cafb537d03c 100644
--- a/arch/m68k/include/asm/cacheflush_no.h
+++ b/arch/m68k/include/asm/cacheflush_no.h
@@ -30,11 +30,8 @@
30 30
31void mcf_cache_push(void); 31void mcf_cache_push(void);
32 32
33static inline void __flush_cache_all(void) 33static inline void __clear_cache_all(void)
34{ 34{
35#ifdef CACHE_PUSH
36 mcf_cache_push();
37#endif
38#ifdef CACHE_INVALIDATE 35#ifdef CACHE_INVALIDATE
39 __asm__ __volatile__ ( 36 __asm__ __volatile__ (
40 "movel %0, %%d0\n\t" 37 "movel %0, %%d0\n\t"
@@ -44,6 +41,14 @@ static inline void __flush_cache_all(void)
44#endif 41#endif
45} 42}
46 43
44static inline void __flush_cache_all(void)
45{
46#ifdef CACHE_PUSH
47 mcf_cache_push();
48#endif
49 __clear_cache_all();
50}
51
47/* 52/*
48 * Some ColdFire parts implement separate instruction and data caches, 53 * Some ColdFire parts implement separate instruction and data caches,
49 * on those we should just flush the appropriate cache. If we don't need 54 * on those we should just flush the appropriate cache. If we don't need
@@ -76,4 +81,23 @@ static inline void __flush_dcache_all(void)
76 __asm__ __volatile__ ( "nop" ); 81 __asm__ __volatile__ ( "nop" );
77#endif 82#endif
78} 83}
84
85/*
86 * Push cache entries at supplied address. We want to write back any dirty
87 * data and the invalidate the cache lines associated with this address.
88 */
89static inline void cache_push(unsigned long paddr, int len)
90{
91 __flush_cache_all();
92}
93
94/*
95 * Clear cache entries at supplied address (that is don't write back any
96 * dirty data).
97 */
98static inline void cache_clear(unsigned long paddr, int len)
99{
100 __clear_cache_all();
101}
102
79#endif /* _M68KNOMMU_CACHEFLUSH_H */ 103#endif /* _M68KNOMMU_CACHEFLUSH_H */
diff --git a/arch/m68k/include/asm/entry.h b/arch/m68k/include/asm/entry.h
index 622138dc7288..d7de0f1a8957 100644
--- a/arch/m68k/include/asm/entry.h
+++ b/arch/m68k/include/asm/entry.h
@@ -33,13 +33,11 @@
33 33
34/* the following macro is used when enabling interrupts */ 34/* the following macro is used when enabling interrupts */
35#if defined(MACH_ATARI_ONLY) 35#if defined(MACH_ATARI_ONLY)
36 /* block out HSYNC on the atari */ 36 /* block out HSYNC = ipl 2 on the atari */
37#define ALLOWINT (~0x400) 37#define ALLOWINT (~0x500)
38#define MAX_NOINT_IPL 3
39#else 38#else
40 /* portable version */ 39 /* portable version */
41#define ALLOWINT (~0x700) 40#define ALLOWINT (~0x700)
42#define MAX_NOINT_IPL 0
43#endif /* machine compilation types */ 41#endif /* machine compilation types */
44 42
45#ifdef __ASSEMBLY__ 43#ifdef __ASSEMBLY__
diff --git a/arch/m68k/include/asm/flat.h b/arch/m68k/include/asm/flat.h
index a0e290793978..f9454b89a51b 100644
--- a/arch/m68k/include/asm/flat.h
+++ b/arch/m68k/include/asm/flat.h
@@ -11,6 +11,11 @@
11#define flat_get_addr_from_rp(rp, relval, flags, p) get_unaligned(rp) 11#define flat_get_addr_from_rp(rp, relval, flags, p) get_unaligned(rp)
12#define flat_put_addr_at_rp(rp, val, relval) put_unaligned(val,rp) 12#define flat_put_addr_at_rp(rp, val, relval) put_unaligned(val,rp)
13#define flat_get_relocate_addr(rel) (rel) 13#define flat_get_relocate_addr(rel) (rel)
14#define flat_set_persistent(relval, p) 0 14
15static inline int flat_set_persistent(unsigned long relval,
16 unsigned long *persistent)
17{
18 return 0;
19}
15 20
16#endif /* __M68KNOMMU_FLAT_H__ */ 21#endif /* __M68KNOMMU_FLAT_H__ */
diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
index 0fb3468000e7..fa4324bcf566 100644
--- a/arch/m68k/include/asm/io_mm.h
+++ b/arch/m68k/include/asm/io_mm.h
@@ -278,6 +278,13 @@ static inline void isa_delay(void)
278#define readl(addr) in_le32(addr) 278#define readl(addr) in_le32(addr)
279#define writel(val,addr) out_le32((addr),(val)) 279#define writel(val,addr) out_le32((addr),(val))
280 280
281#define readsb(port, buf, nr) raw_insb((port), (u8 *)(buf), (nr))
282#define readsw(port, buf, nr) raw_insw((port), (u16 *)(buf), (nr))
283#define readsl(port, buf, nr) raw_insl((port), (u32 *)(buf), (nr))
284#define writesb(port, buf, nr) raw_outsb((port), (u8 *)(buf), (nr))
285#define writesw(port, buf, nr) raw_outsw((port), (u16 *)(buf), (nr))
286#define writesl(port, buf, nr) raw_outsl((port), (u32 *)(buf), (nr))
287
281#define mmiowb() 288#define mmiowb()
282 289
283static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size) 290static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
diff --git a/arch/m68k/include/asm/m528xsim.h b/arch/m68k/include/asm/m528xsim.h
index 569476fba18c..d63b99ff7ff7 100644
--- a/arch/m68k/include/asm/m528xsim.h
+++ b/arch/m68k/include/asm/m528xsim.h
@@ -97,100 +97,81 @@
97/* 97/*
98 * GPIO registers 98 * GPIO registers
99 */ 99 */
100#define MCFGPIO_PORTA (MCF_IPSBAR + 0x00100000) 100#define MCFGPIO_PODR_A (MCF_IPSBAR + 0x00100000)
101#define MCFGPIO_PORTB (MCF_IPSBAR + 0x00100001) 101#define MCFGPIO_PODR_B (MCF_IPSBAR + 0x00100001)
102#define MCFGPIO_PORTC (MCF_IPSBAR + 0x00100002) 102#define MCFGPIO_PODR_C (MCF_IPSBAR + 0x00100002)
103#define MCFGPIO_PORTD (MCF_IPSBAR + 0x00100003) 103#define MCFGPIO_PODR_D (MCF_IPSBAR + 0x00100003)
104#define MCFGPIO_PORTE (MCF_IPSBAR + 0x00100004) 104#define MCFGPIO_PODR_E (MCF_IPSBAR + 0x00100004)
105#define MCFGPIO_PORTF (MCF_IPSBAR + 0x00100005) 105#define MCFGPIO_PODR_F (MCF_IPSBAR + 0x00100005)
106#define MCFGPIO_PORTG (MCF_IPSBAR + 0x00100006) 106#define MCFGPIO_PODR_G (MCF_IPSBAR + 0x00100006)
107#define MCFGPIO_PORTH (MCF_IPSBAR + 0x00100007) 107#define MCFGPIO_PODR_H (MCF_IPSBAR + 0x00100007)
108#define MCFGPIO_PORTJ (MCF_IPSBAR + 0x00100008) 108#define MCFGPIO_PODR_J (MCF_IPSBAR + 0x00100008)
109#define MCFGPIO_PORTDD (MCF_IPSBAR + 0x00100009) 109#define MCFGPIO_PODR_DD (MCF_IPSBAR + 0x00100009)
110#define MCFGPIO_PORTEH (MCF_IPSBAR + 0x0010000A) 110#define MCFGPIO_PODR_EH (MCF_IPSBAR + 0x0010000A)
111#define MCFGPIO_PORTEL (MCF_IPSBAR + 0x0010000B) 111#define MCFGPIO_PODR_EL (MCF_IPSBAR + 0x0010000B)
112#define MCFGPIO_PORTAS (MCF_IPSBAR + 0x0010000C) 112#define MCFGPIO_PODR_AS (MCF_IPSBAR + 0x0010000C)
113#define MCFGPIO_PORTQS (MCF_IPSBAR + 0x0010000D) 113#define MCFGPIO_PODR_QS (MCF_IPSBAR + 0x0010000D)
114#define MCFGPIO_PORTSD (MCF_IPSBAR + 0x0010000E) 114#define MCFGPIO_PODR_SD (MCF_IPSBAR + 0x0010000E)
115#define MCFGPIO_PORTTC (MCF_IPSBAR + 0x0010000F) 115#define MCFGPIO_PODR_TC (MCF_IPSBAR + 0x0010000F)
116#define MCFGPIO_PORTTD (MCF_IPSBAR + 0x00100010) 116#define MCFGPIO_PODR_TD (MCF_IPSBAR + 0x00100010)
117#define MCFGPIO_PORTUA (MCF_IPSBAR + 0x00100011) 117#define MCFGPIO_PODR_UA (MCF_IPSBAR + 0x00100011)
118 118
119#define MCFGPIO_DDRA (MCF_IPSBAR + 0x00100014) 119#define MCFGPIO_PDDR_A (MCF_IPSBAR + 0x00100014)
120#define MCFGPIO_DDRB (MCF_IPSBAR + 0x00100015) 120#define MCFGPIO_PDDR_B (MCF_IPSBAR + 0x00100015)
121#define MCFGPIO_DDRC (MCF_IPSBAR + 0x00100016) 121#define MCFGPIO_PDDR_C (MCF_IPSBAR + 0x00100016)
122#define MCFGPIO_DDRD (MCF_IPSBAR + 0x00100017) 122#define MCFGPIO_PDDR_D (MCF_IPSBAR + 0x00100017)
123#define MCFGPIO_DDRE (MCF_IPSBAR + 0x00100018) 123#define MCFGPIO_PDDR_E (MCF_IPSBAR + 0x00100018)
124#define MCFGPIO_DDRF (MCF_IPSBAR + 0x00100019) 124#define MCFGPIO_PDDR_F (MCF_IPSBAR + 0x00100019)
125#define MCFGPIO_DDRG (MCF_IPSBAR + 0x0010001A) 125#define MCFGPIO_PDDR_G (MCF_IPSBAR + 0x0010001A)
126#define MCFGPIO_DDRH (MCF_IPSBAR + 0x0010001B) 126#define MCFGPIO_PDDR_H (MCF_IPSBAR + 0x0010001B)
127#define MCFGPIO_DDRJ (MCF_IPSBAR + 0x0010001C) 127#define MCFGPIO_PDDR_J (MCF_IPSBAR + 0x0010001C)
128#define MCFGPIO_DDRDD (MCF_IPSBAR + 0x0010001D) 128#define MCFGPIO_PDDR_DD (MCF_IPSBAR + 0x0010001D)
129#define MCFGPIO_DDREH (MCF_IPSBAR + 0x0010001E) 129#define MCFGPIO_PDDR_EH (MCF_IPSBAR + 0x0010001E)
130#define MCFGPIO_DDREL (MCF_IPSBAR + 0x0010001F) 130#define MCFGPIO_PDDR_EL (MCF_IPSBAR + 0x0010001F)
131#define MCFGPIO_DDRAS (MCF_IPSBAR + 0x00100020) 131#define MCFGPIO_PDDR_AS (MCF_IPSBAR + 0x00100020)
132#define MCFGPIO_DDRQS (MCF_IPSBAR + 0x00100021) 132#define MCFGPIO_PDDR_QS (MCF_IPSBAR + 0x00100021)
133#define MCFGPIO_DDRSD (MCF_IPSBAR + 0x00100022) 133#define MCFGPIO_PDDR_SD (MCF_IPSBAR + 0x00100022)
134#define MCFGPIO_DDRTC (MCF_IPSBAR + 0x00100023) 134#define MCFGPIO_PDDR_TC (MCF_IPSBAR + 0x00100023)
135#define MCFGPIO_DDRTD (MCF_IPSBAR + 0x00100024) 135#define MCFGPIO_PDDR_TD (MCF_IPSBAR + 0x00100024)
136#define MCFGPIO_DDRUA (MCF_IPSBAR + 0x00100025) 136#define MCFGPIO_PDDR_UA (MCF_IPSBAR + 0x00100025)
137 137
138#define MCFGPIO_PORTAP (MCF_IPSBAR + 0x00100028) 138#define MCFGPIO_PPDSDR_A (MCF_IPSBAR + 0x00100028)
139#define MCFGPIO_PORTBP (MCF_IPSBAR + 0x00100029) 139#define MCFGPIO_PPDSDR_B (MCF_IPSBAR + 0x00100029)
140#define MCFGPIO_PORTCP (MCF_IPSBAR + 0x0010002A) 140#define MCFGPIO_PPDSDR_C (MCF_IPSBAR + 0x0010002A)
141#define MCFGPIO_PORTDP (MCF_IPSBAR + 0x0010002B) 141#define MCFGPIO_PPDSDR_D (MCF_IPSBAR + 0x0010002B)
142#define MCFGPIO_PORTEP (MCF_IPSBAR + 0x0010002C) 142#define MCFGPIO_PPDSDR_E (MCF_IPSBAR + 0x0010002C)
143#define MCFGPIO_PORTFP (MCF_IPSBAR + 0x0010002D) 143#define MCFGPIO_PPDSDR_F (MCF_IPSBAR + 0x0010002D)
144#define MCFGPIO_PORTGP (MCF_IPSBAR + 0x0010002E) 144#define MCFGPIO_PPDSDR_G (MCF_IPSBAR + 0x0010002E)
145#define MCFGPIO_PORTHP (MCF_IPSBAR + 0x0010002F) 145#define MCFGPIO_PPDSDR_H (MCF_IPSBAR + 0x0010002F)
146#define MCFGPIO_PORTJP (MCF_IPSBAR + 0x00100030) 146#define MCFGPIO_PPDSDR_J (MCF_IPSBAR + 0x00100030)
147#define MCFGPIO_PORTDDP (MCF_IPSBAR + 0x00100031) 147#define MCFGPIO_PPDSDR_DD (MCF_IPSBAR + 0x00100031)
148#define MCFGPIO_PORTEHP (MCF_IPSBAR + 0x00100032) 148#define MCFGPIO_PPDSDR_EH (MCF_IPSBAR + 0x00100032)
149#define MCFGPIO_PORTELP (MCF_IPSBAR + 0x00100033) 149#define MCFGPIO_PPDSDR_EL (MCF_IPSBAR + 0x00100033)
150#define MCFGPIO_PORTASP (MCF_IPSBAR + 0x00100034) 150#define MCFGPIO_PPDSDR_AS (MCF_IPSBAR + 0x00100034)
151#define MCFGPIO_PORTQSP (MCF_IPSBAR + 0x00100035) 151#define MCFGPIO_PPDSDR_QS (MCF_IPSBAR + 0x00100035)
152#define MCFGPIO_PORTSDP (MCF_IPSBAR + 0x00100036) 152#define MCFGPIO_PPDSDR_SD (MCF_IPSBAR + 0x00100036)
153#define MCFGPIO_PORTTCP (MCF_IPSBAR + 0x00100037) 153#define MCFGPIO_PPDSDR_TC (MCF_IPSBAR + 0x00100037)
154#define MCFGPIO_PORTTDP (MCF_IPSBAR + 0x00100038) 154#define MCFGPIO_PPDSDR_TD (MCF_IPSBAR + 0x00100038)
155#define MCFGPIO_PORTUAP (MCF_IPSBAR + 0x00100039) 155#define MCFGPIO_PPDSDR_UA (MCF_IPSBAR + 0x00100039)
156 156
157#define MCFGPIO_SETA (MCF_IPSBAR + 0x00100028) 157#define MCFGPIO_PCLRR_A (MCF_IPSBAR + 0x0010003C)
158#define MCFGPIO_SETB (MCF_IPSBAR + 0x00100029) 158#define MCFGPIO_PCLRR_B (MCF_IPSBAR + 0x0010003D)
159#define MCFGPIO_SETC (MCF_IPSBAR + 0x0010002A) 159#define MCFGPIO_PCLRR_C (MCF_IPSBAR + 0x0010003E)
160#define MCFGPIO_SETD (MCF_IPSBAR + 0x0010002B) 160#define MCFGPIO_PCLRR_D (MCF_IPSBAR + 0x0010003F)
161#define MCFGPIO_SETE (MCF_IPSBAR + 0x0010002C) 161#define MCFGPIO_PCLRR_E (MCF_IPSBAR + 0x00100040)
162#define MCFGPIO_SETF (MCF_IPSBAR + 0x0010002D) 162#define MCFGPIO_PCLRR_F (MCF_IPSBAR + 0x00100041)
163#define MCFGPIO_SETG (MCF_IPSBAR + 0x0010002E) 163#define MCFGPIO_PCLRR_G (MCF_IPSBAR + 0x00100042)
164#define MCFGPIO_SETH (MCF_IPSBAR + 0x0010002F) 164#define MCFGPIO_PCLRR_H (MCF_IPSBAR + 0x00100043)
165#define MCFGPIO_SETJ (MCF_IPSBAR + 0x00100030) 165#define MCFGPIO_PCLRR_J (MCF_IPSBAR + 0x00100044)
166#define MCFGPIO_SETDD (MCF_IPSBAR + 0x00100031) 166#define MCFGPIO_PCLRR_DD (MCF_IPSBAR + 0x00100045)
167#define MCFGPIO_SETEH (MCF_IPSBAR + 0x00100032) 167#define MCFGPIO_PCLRR_EH (MCF_IPSBAR + 0x00100046)
168#define MCFGPIO_SETEL (MCF_IPSBAR + 0x00100033) 168#define MCFGPIO_PCLRR_EL (MCF_IPSBAR + 0x00100047)
169#define MCFGPIO_SETAS (MCF_IPSBAR + 0x00100034) 169#define MCFGPIO_PCLRR_AS (MCF_IPSBAR + 0x00100048)
170#define MCFGPIO_SETQS (MCF_IPSBAR + 0x00100035) 170#define MCFGPIO_PCLRR_QS (MCF_IPSBAR + 0x00100049)
171#define MCFGPIO_SETSD (MCF_IPSBAR + 0x00100036) 171#define MCFGPIO_PCLRR_SD (MCF_IPSBAR + 0x0010004A)
172#define MCFGPIO_SETTC (MCF_IPSBAR + 0x00100037) 172#define MCFGPIO_PCLRR_TC (MCF_IPSBAR + 0x0010004B)
173#define MCFGPIO_SETTD (MCF_IPSBAR + 0x00100038) 173#define MCFGPIO_PCLRR_TD (MCF_IPSBAR + 0x0010004C)
174#define MCFGPIO_SETUA (MCF_IPSBAR + 0x00100039) 174#define MCFGPIO_PCLRR_UA (MCF_IPSBAR + 0x0010004D)
175
176#define MCFGPIO_CLRA (MCF_IPSBAR + 0x0010003C)
177#define MCFGPIO_CLRB (MCF_IPSBAR + 0x0010003D)
178#define MCFGPIO_CLRC (MCF_IPSBAR + 0x0010003E)
179#define MCFGPIO_CLRD (MCF_IPSBAR + 0x0010003F)
180#define MCFGPIO_CLRE (MCF_IPSBAR + 0x00100040)
181#define MCFGPIO_CLRF (MCF_IPSBAR + 0x00100041)
182#define MCFGPIO_CLRG (MCF_IPSBAR + 0x00100042)
183#define MCFGPIO_CLRH (MCF_IPSBAR + 0x00100043)
184#define MCFGPIO_CLRJ (MCF_IPSBAR + 0x00100044)
185#define MCFGPIO_CLRDD (MCF_IPSBAR + 0x00100045)
186#define MCFGPIO_CLREH (MCF_IPSBAR + 0x00100046)
187#define MCFGPIO_CLREL (MCF_IPSBAR + 0x00100047)
188#define MCFGPIO_CLRAS (MCF_IPSBAR + 0x00100048)
189#define MCFGPIO_CLRQS (MCF_IPSBAR + 0x00100049)
190#define MCFGPIO_CLRSD (MCF_IPSBAR + 0x0010004A)
191#define MCFGPIO_CLRTC (MCF_IPSBAR + 0x0010004B)
192#define MCFGPIO_CLRTD (MCF_IPSBAR + 0x0010004C)
193#define MCFGPIO_CLRUA (MCF_IPSBAR + 0x0010004D)
194 175
195#define MCFGPIO_PBCDPAR (MCF_IPSBAR + 0x00100050) 176#define MCFGPIO_PBCDPAR (MCF_IPSBAR + 0x00100050)
196#define MCFGPIO_PFPAR (MCF_IPSBAR + 0x00100051) 177#define MCFGPIO_PFPAR (MCF_IPSBAR + 0x00100051)
@@ -242,11 +223,11 @@
242 * definitions for generic gpio support 223 * definitions for generic gpio support
243 * 224 *
244 */ 225 */
245#define MCFGPIO_PODR MCFGPIO_PORTA /* port output data */ 226#define MCFGPIO_PODR MCFGPIO_PODR_A /* port output data */
246#define MCFGPIO_PDDR MCFGPIO_DDRA /* port data direction */ 227#define MCFGPIO_PDDR MCFGPIO_PDDR_A /* port data direction */
247#define MCFGPIO_PPDR MCFGPIO_PORTAP /* port pin data */ 228#define MCFGPIO_PPDR MCFGPIO_PPDSDR_A/* port pin data */
248#define MCFGPIO_SETR MCFGPIO_SETA /* set output */ 229#define MCFGPIO_SETR MCFGPIO_PPDSDR_A/* set output */
249#define MCFGPIO_CLRR MCFGPIO_CLRA /* clr output */ 230#define MCFGPIO_CLRR MCFGPIO_PCLRR_A /* clr output */
250 231
251#define MCFGPIO_IRQ_MAX 8 232#define MCFGPIO_IRQ_MAX 8
252#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE 233#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE
diff --git a/arch/m68k/include/asm/mcfgpio.h b/arch/m68k/include/asm/mcfgpio.h
index ee5e4ccce89e..fe468eaa51e0 100644
--- a/arch/m68k/include/asm/mcfgpio.h
+++ b/arch/m68k/include/asm/mcfgpio.h
@@ -29,6 +29,9 @@ struct mcf_gpio_chip {
29 const u8 *gpio_to_pinmux; 29 const u8 *gpio_to_pinmux;
30}; 30};
31 31
32extern struct mcf_gpio_chip mcf_gpio_chips[];
33extern unsigned int mcf_gpio_chips_size;
34
32int mcf_gpio_direction_input(struct gpio_chip *, unsigned); 35int mcf_gpio_direction_input(struct gpio_chip *, unsigned);
33int mcf_gpio_get_value(struct gpio_chip *, unsigned); 36int mcf_gpio_get_value(struct gpio_chip *, unsigned);
34int mcf_gpio_direction_output(struct gpio_chip *, unsigned, int); 37int mcf_gpio_direction_output(struct gpio_chip *, unsigned, int);
@@ -37,4 +40,58 @@ void mcf_gpio_set_value_fast(struct gpio_chip *, unsigned, int);
37int mcf_gpio_request(struct gpio_chip *, unsigned); 40int mcf_gpio_request(struct gpio_chip *, unsigned);
38void mcf_gpio_free(struct gpio_chip *, unsigned); 41void mcf_gpio_free(struct gpio_chip *, unsigned);
39 42
43/*
44 * Define macros to ease the pain of setting up the GPIO tables. There
45 * are two cases we need to deal with here, they cover all currently
46 * available ColdFire GPIO hardware. There are of course minor differences
47 * in the layout and number of bits in each ColdFire part, but the macros
48 * take all that in.
49 *
50 * Firstly is the conventional GPIO registers where we toggle individual
51 * bits in a register, preserving the other bits in the register. For
52 * lack of a better term I have called this the slow method.
53 */
54#define MCFGPS(mlabel, mbase, mngpio, mpddr, mpodr, mppdr) \
55 { \
56 .gpio_chip = { \
57 .label = #mlabel, \
58 .request = mcf_gpio_request, \
59 .free = mcf_gpio_free, \
60 .direction_input = mcf_gpio_direction_input, \
61 .direction_output = mcf_gpio_direction_output,\
62 .get = mcf_gpio_get_value, \
63 .set = mcf_gpio_set_value, \
64 .base = mbase, \
65 .ngpio = mngpio, \
66 }, \
67 .pddr = (void __iomem *) mpddr, \
68 .podr = (void __iomem *) mpodr, \
69 .ppdr = (void __iomem *) mppdr, \
70 }
71
72/*
73 * Secondly is the faster case, where we have set and clear registers
74 * that allow us to set or clear a bit with a single write, not having
75 * to worry about preserving other bits.
76 */
77#define MCFGPF(mlabel, mbase, mngpio) \
78 { \
79 .gpio_chip = { \
80 .label = #mlabel, \
81 .request = mcf_gpio_request, \
82 .free = mcf_gpio_free, \
83 .direction_input = mcf_gpio_direction_input, \
84 .direction_output = mcf_gpio_direction_output,\
85 .get = mcf_gpio_get_value, \
86 .set = mcf_gpio_set_value_fast, \
87 .base = mbase, \
88 .ngpio = mngpio, \
89 }, \
90 .pddr = (void __iomem *) MCFGPIO_PDDR_##mlabel, \
91 .podr = (void __iomem *) MCFGPIO_PODR_##mlabel, \
92 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_##mlabel, \
93 .setr = (void __iomem *) MCFGPIO_PPDSDR_##mlabel, \
94 .clrr = (void __iomem *) MCFGPIO_PCLRR_##mlabel, \
95 }
96
40#endif 97#endif
diff --git a/arch/m68k/include/asm/unaligned.h b/arch/m68k/include/asm/unaligned.h
index 019caa740c21..f4043ae63db1 100644
--- a/arch/m68k/include/asm/unaligned.h
+++ b/arch/m68k/include/asm/unaligned.h
@@ -2,7 +2,7 @@
2#define _ASM_M68K_UNALIGNED_H 2#define _ASM_M68K_UNALIGNED_H
3 3
4 4
5#ifdef CONFIG_COLDFIRE 5#if defined(CONFIG_COLDFIRE) || defined(CONFIG_M68000)
6#include <linux/unaligned/be_struct.h> 6#include <linux/unaligned/be_struct.h>
7#include <linux/unaligned/le_byteshift.h> 7#include <linux/unaligned/le_byteshift.h>
8#include <linux/unaligned/generic.h> 8#include <linux/unaligned/generic.h>
diff --git a/arch/m68k/include/asm/vga.h b/arch/m68k/include/asm/vga.h
new file mode 100644
index 000000000000..d3aa1401e7aa
--- /dev/null
+++ b/arch/m68k/include/asm/vga.h
@@ -0,0 +1,27 @@
1#ifndef _ASM_M68K_VGA_H
2#define _ASM_M68K_VGA_H
3
4#include <asm/raw_io.h>
5
6/*
7 * FIXME
8 * Ugh, we don't have PCI space, so map readb() and friends to use raw I/O
9 * accessors, which are identical to the z_*() Zorro bus accessors.
10 * This should make cirrusfb work again on Amiga
11 */
12#undef inb_p
13#undef inw_p
14#undef outb_p
15#undef outw
16#undef readb
17#undef writeb
18#undef writew
19#define inb_p(port) 0
20#define inw_p(port) 0
21#define outb_p(port, val) do { } while (0)
22#define outw(port, val) do { } while (0)
23#define readb raw_inb
24#define writeb raw_outb
25#define writew raw_outw
26
27#endif /* _ASM_M68K_VGA_H */
diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile
index 40d29a788b05..5c7070e21eb7 100644
--- a/arch/m68k/kernel/Makefile
+++ b/arch/m68k/kernel/Makefile
@@ -13,7 +13,7 @@ extra-$(CONFIG_SUN3X) := head.o
13extra-$(CONFIG_SUN3) := sun3-head.o 13extra-$(CONFIG_SUN3) := sun3-head.o
14extra-y += vmlinux.lds 14extra-y += vmlinux.lds
15 15
16obj-y := entry.o init_task.o irq.o m68k_ksyms.o module.o process.o ptrace.o 16obj-y := entry.o irq.o m68k_ksyms.o module.o process.o ptrace.o
17obj-y += setup.o signal.o sys_m68k.o syscalltable.o time.o traps.o 17obj-y += setup.o signal.o sys_m68k.o syscalltable.o time.o traps.o
18 18
19obj-$(CONFIG_MMU_MOTOROLA) += ints.o vectors.o 19obj-$(CONFIG_MMU_MOTOROLA) += ints.o vectors.o
diff --git a/arch/m68k/kernel/dma.c b/arch/m68k/kernel/dma.c
index 90e8cb726c8c..f6daf6e15d2e 100644
--- a/arch/m68k/kernel/dma.c
+++ b/arch/m68k/kernel/dma.c
@@ -1,5 +1,164 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file COPYING in the main directory of this archive
4 * for more details.
5 */
6
7#undef DEBUG
8
9#include <linux/dma-mapping.h>
10#include <linux/device.h>
11#include <linux/kernel.h>
12#include <linux/scatterlist.h>
13#include <linux/slab.h>
14#include <linux/vmalloc.h>
15#include <linux/export.h>
16
17#include <asm/pgalloc.h>
18
1#ifdef CONFIG_MMU 19#ifdef CONFIG_MMU
2#include "dma_mm.c" 20
21void *dma_alloc_coherent(struct device *dev, size_t size,
22 dma_addr_t *handle, gfp_t flag)
23{
24 struct page *page, **map;
25 pgprot_t pgprot;
26 void *addr;
27 int i, order;
28
29 pr_debug("dma_alloc_coherent: %d,%x\n", size, flag);
30
31 size = PAGE_ALIGN(size);
32 order = get_order(size);
33
34 page = alloc_pages(flag, order);
35 if (!page)
36 return NULL;
37
38 *handle = page_to_phys(page);
39 map = kmalloc(sizeof(struct page *) << order, flag & ~__GFP_DMA);
40 if (!map) {
41 __free_pages(page, order);
42 return NULL;
43 }
44 split_page(page, order);
45
46 order = 1 << order;
47 size >>= PAGE_SHIFT;
48 map[0] = page;
49 for (i = 1; i < size; i++)
50 map[i] = page + i;
51 for (; i < order; i++)
52 __free_page(page + i);
53 pgprot = __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY);
54 if (CPU_IS_040_OR_060)
55 pgprot_val(pgprot) |= _PAGE_GLOBAL040 | _PAGE_NOCACHE_S;
56 else
57 pgprot_val(pgprot) |= _PAGE_NOCACHE030;
58 addr = vmap(map, size, VM_MAP, pgprot);
59 kfree(map);
60
61 return addr;
62}
63
64void dma_free_coherent(struct device *dev, size_t size,
65 void *addr, dma_addr_t handle)
66{
67 pr_debug("dma_free_coherent: %p, %x\n", addr, handle);
68 vfree(addr);
69}
70
3#else 71#else
4#include "dma_no.c" 72
5#endif 73#include <asm/cacheflush.h>
74
75void *dma_alloc_coherent(struct device *dev, size_t size,
76 dma_addr_t *dma_handle, gfp_t gfp)
77{
78 void *ret;
79 /* ignore region specifiers */
80 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
81
82 if (dev == NULL || (*dev->dma_mask < 0xffffffff))
83 gfp |= GFP_DMA;
84 ret = (void *)__get_free_pages(gfp, get_order(size));
85
86 if (ret != NULL) {
87 memset(ret, 0, size);
88 *dma_handle = virt_to_phys(ret);
89 }
90 return ret;
91}
92
93void dma_free_coherent(struct device *dev, size_t size,
94 void *vaddr, dma_addr_t dma_handle)
95{
96 free_pages((unsigned long)vaddr, get_order(size));
97}
98
99#endif /* CONFIG_MMU */
100
101EXPORT_SYMBOL(dma_alloc_coherent);
102EXPORT_SYMBOL(dma_free_coherent);
103
104void dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
105 size_t size, enum dma_data_direction dir)
106{
107 switch (dir) {
108 case DMA_TO_DEVICE:
109 cache_push(handle, size);
110 break;
111 case DMA_FROM_DEVICE:
112 cache_clear(handle, size);
113 break;
114 default:
115 if (printk_ratelimit())
116 printk("dma_sync_single_for_device: unsupported dir %u\n", dir);
117 break;
118 }
119}
120EXPORT_SYMBOL(dma_sync_single_for_device);
121
122void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents,
123 enum dma_data_direction dir)
124{
125 int i;
126
127 for (i = 0; i < nents; sg++, i++)
128 dma_sync_single_for_device(dev, sg->dma_address, sg->length, dir);
129}
130EXPORT_SYMBOL(dma_sync_sg_for_device);
131
132dma_addr_t dma_map_single(struct device *dev, void *addr, size_t size,
133 enum dma_data_direction dir)
134{
135 dma_addr_t handle = virt_to_bus(addr);
136
137 dma_sync_single_for_device(dev, handle, size, dir);
138 return handle;
139}
140EXPORT_SYMBOL(dma_map_single);
141
142dma_addr_t dma_map_page(struct device *dev, struct page *page,
143 unsigned long offset, size_t size,
144 enum dma_data_direction dir)
145{
146 dma_addr_t handle = page_to_phys(page) + offset;
147
148 dma_sync_single_for_device(dev, handle, size, dir);
149 return handle;
150}
151EXPORT_SYMBOL(dma_map_page);
152
153int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
154 enum dma_data_direction dir)
155{
156 int i;
157
158 for (i = 0; i < nents; sg++, i++) {
159 sg->dma_address = sg_phys(sg);
160 dma_sync_single_for_device(dev, sg->dma_address, sg->length, dir);
161 }
162 return nents;
163}
164EXPORT_SYMBOL(dma_map_sg);
diff --git a/arch/m68k/kernel/dma_mm.c b/arch/m68k/kernel/dma_mm.c
deleted file mode 100644
index a3c471b523f2..000000000000
--- a/arch/m68k/kernel/dma_mm.c
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file COPYING in the main directory of this archive
4 * for more details.
5 */
6
7#undef DEBUG
8
9#include <linux/dma-mapping.h>
10#include <linux/device.h>
11#include <linux/kernel.h>
12#include <linux/scatterlist.h>
13#include <linux/slab.h>
14#include <linux/vmalloc.h>
15#include <linux/export.h>
16
17#include <asm/pgalloc.h>
18
19void *dma_alloc_coherent(struct device *dev, size_t size,
20 dma_addr_t *handle, gfp_t flag)
21{
22 struct page *page, **map;
23 pgprot_t pgprot;
24 void *addr;
25 int i, order;
26
27 pr_debug("dma_alloc_coherent: %d,%x\n", size, flag);
28
29 size = PAGE_ALIGN(size);
30 order = get_order(size);
31
32 page = alloc_pages(flag, order);
33 if (!page)
34 return NULL;
35
36 *handle = page_to_phys(page);
37 map = kmalloc(sizeof(struct page *) << order, flag & ~__GFP_DMA);
38 if (!map) {
39 __free_pages(page, order);
40 return NULL;
41 }
42 split_page(page, order);
43
44 order = 1 << order;
45 size >>= PAGE_SHIFT;
46 map[0] = page;
47 for (i = 1; i < size; i++)
48 map[i] = page + i;
49 for (; i < order; i++)
50 __free_page(page + i);
51 pgprot = __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY);
52 if (CPU_IS_040_OR_060)
53 pgprot_val(pgprot) |= _PAGE_GLOBAL040 | _PAGE_NOCACHE_S;
54 else
55 pgprot_val(pgprot) |= _PAGE_NOCACHE030;
56 addr = vmap(map, size, VM_MAP, pgprot);
57 kfree(map);
58
59 return addr;
60}
61EXPORT_SYMBOL(dma_alloc_coherent);
62
63void dma_free_coherent(struct device *dev, size_t size,
64 void *addr, dma_addr_t handle)
65{
66 pr_debug("dma_free_coherent: %p, %x\n", addr, handle);
67 vfree(addr);
68}
69EXPORT_SYMBOL(dma_free_coherent);
70
71void dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
72 size_t size, enum dma_data_direction dir)
73{
74 switch (dir) {
75 case DMA_TO_DEVICE:
76 cache_push(handle, size);
77 break;
78 case DMA_FROM_DEVICE:
79 cache_clear(handle, size);
80 break;
81 default:
82 if (printk_ratelimit())
83 printk("dma_sync_single_for_device: unsupported dir %u\n", dir);
84 break;
85 }
86}
87EXPORT_SYMBOL(dma_sync_single_for_device);
88
89void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents,
90 enum dma_data_direction dir)
91{
92 int i;
93
94 for (i = 0; i < nents; sg++, i++)
95 dma_sync_single_for_device(dev, sg->dma_address, sg->length, dir);
96}
97EXPORT_SYMBOL(dma_sync_sg_for_device);
98
99dma_addr_t dma_map_single(struct device *dev, void *addr, size_t size,
100 enum dma_data_direction dir)
101{
102 dma_addr_t handle = virt_to_bus(addr);
103
104 dma_sync_single_for_device(dev, handle, size, dir);
105 return handle;
106}
107EXPORT_SYMBOL(dma_map_single);
108
109dma_addr_t dma_map_page(struct device *dev, struct page *page,
110 unsigned long offset, size_t size,
111 enum dma_data_direction dir)
112{
113 dma_addr_t handle = page_to_phys(page) + offset;
114
115 dma_sync_single_for_device(dev, handle, size, dir);
116 return handle;
117}
118EXPORT_SYMBOL(dma_map_page);
119
120int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
121 enum dma_data_direction dir)
122{
123 int i;
124
125 for (i = 0; i < nents; sg++, i++) {
126 sg->dma_address = sg_phys(sg);
127 dma_sync_single_for_device(dev, sg->dma_address, sg->length, dir);
128 }
129 return nents;
130}
131EXPORT_SYMBOL(dma_map_sg);
diff --git a/arch/m68k/kernel/dma_no.c b/arch/m68k/kernel/dma_no.c
deleted file mode 100644
index f1dc3fc71bc2..000000000000
--- a/arch/m68k/kernel/dma_no.c
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * Dynamic DMA mapping support.
3 *
4 * We never have any address translations to worry about, so this
5 * is just alloc/free.
6 */
7
8#include <linux/types.h>
9#include <linux/gfp.h>
10#include <linux/mm.h>
11#include <linux/device.h>
12#include <linux/dma-mapping.h>
13#include <linux/export.h>
14#include <asm/cacheflush.h>
15
16void *dma_alloc_coherent(struct device *dev, size_t size,
17 dma_addr_t *dma_handle, gfp_t gfp)
18{
19 void *ret;
20 /* ignore region specifiers */
21 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
22
23 if (dev == NULL || (*dev->dma_mask < 0xffffffff))
24 gfp |= GFP_DMA;
25 ret = (void *)__get_free_pages(gfp, get_order(size));
26
27 if (ret != NULL) {
28 memset(ret, 0, size);
29 *dma_handle = virt_to_phys(ret);
30 }
31 return ret;
32}
33
34void dma_free_coherent(struct device *dev, size_t size,
35 void *vaddr, dma_addr_t dma_handle)
36{
37 free_pages((unsigned long)vaddr, get_order(size));
38}
39
40void dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
41 size_t size, enum dma_data_direction dir)
42{
43 switch (dir) {
44 case DMA_TO_DEVICE:
45 flush_dcache_range(handle, size);
46 break;
47 case DMA_FROM_DEVICE:
48 /* Should be clear already */
49 break;
50 default:
51 if (printk_ratelimit())
52 printk("dma_sync_single_for_device: unsupported dir %u\n", dir);
53 break;
54 }
55}
56
57EXPORT_SYMBOL(dma_sync_single_for_device);
58dma_addr_t dma_map_single(struct device *dev, void *addr, size_t size,
59 enum dma_data_direction dir)
60{
61 dma_addr_t handle = virt_to_phys(addr);
62 flush_dcache_range(handle, size);
63 return handle;
64}
65EXPORT_SYMBOL(dma_map_single);
66
67dma_addr_t dma_map_page(struct device *dev, struct page *page,
68 unsigned long offset, size_t size,
69 enum dma_data_direction dir)
70{
71 dma_addr_t handle = page_to_phys(page) + offset;
72 dma_sync_single_for_device(dev, handle, size, dir);
73 return handle;
74}
75EXPORT_SYMBOL(dma_map_page);
diff --git a/arch/m68k/kernel/init_task.c b/arch/m68k/kernel/init_task.c
deleted file mode 100644
index c744cfc6bfa1..000000000000
--- a/arch/m68k/kernel/init_task.c
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * linux/arch/m68knommu/kernel/init_task.c
3 */
4#include <linux/mm.h>
5#include <linux/module.h>
6#include <linux/sched.h>
7#include <linux/init.h>
8#include <linux/init_task.h>
9#include <linux/fs.h>
10#include <linux/mqueue.h>
11
12#include <asm/uaccess.h>
13#include <asm/pgtable.h>
14
15static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
17/*
18 * Initial task structure.
19 *
20 * All other task structs will be allocated on slabs in fork.c
21 */
22struct task_struct init_task = INIT_TASK(init_task);
23
24EXPORT_SYMBOL(init_task);
25
26/*
27 * Initial thread structure.
28 *
29 * We need to make sure that this is THREAD size aligned due to the
30 * way process stacks are handled. This is done by having a special
31 * "init_task" linker map entry..
32 */
33union thread_union init_thread_union __init_task_data =
34 { INIT_THREAD_INFO(init_task) };
35
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index 2e25713e2ead..1747c7030a33 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -1,5 +1,1202 @@
1/*
2 * linux/arch/m68k/kernel/signal.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10
11/*
12 * Linux/m68k support by Hamish Macdonald
13 *
14 * 68060 fixes by Jesper Skov
15 *
16 * 1997-12-01 Modified for POSIX.1b signals by Andreas Schwab
17 *
18 * mathemu support by Roman Zippel
19 * (Note: fpstate in the signal context is completely ignored for the emulator
20 * and the internal floating point format is put on stack)
21 */
22
23/*
24 * ++roman (07/09/96): implemented signal stacks (specially for tosemu on
25 * Atari :-) Current limitation: Only one sigstack can be active at one time.
26 * If a second signal with SA_ONSTACK set arrives while working on a sigstack,
27 * SA_ONSTACK is ignored. This behaviour avoids lots of trouble with nested
28 * signal handlers!
29 */
30
31#include <linux/sched.h>
32#include <linux/mm.h>
33#include <linux/kernel.h>
34#include <linux/signal.h>
35#include <linux/syscalls.h>
36#include <linux/errno.h>
37#include <linux/wait.h>
38#include <linux/ptrace.h>
39#include <linux/unistd.h>
40#include <linux/stddef.h>
41#include <linux/highuid.h>
42#include <linux/personality.h>
43#include <linux/tty.h>
44#include <linux/binfmts.h>
45#include <linux/module.h>
46
47#include <asm/setup.h>
48#include <asm/uaccess.h>
49#include <asm/pgtable.h>
50#include <asm/traps.h>
51#include <asm/ucontext.h>
52
53#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
54
1#ifdef CONFIG_MMU 55#ifdef CONFIG_MMU
2#include "signal_mm.c" 56
57/*
58 * Handle the slight differences in classic 68k and ColdFire trap frames.
59 */
60#ifdef CONFIG_COLDFIRE
61#define FORMAT 4
62#define FMT4SIZE 0
3#else 63#else
4#include "signal_no.c" 64#define FORMAT 0
65#define FMT4SIZE sizeof(((struct frame *)0)->un.fmt4)
5#endif 66#endif
67
68static const int frame_size_change[16] = {
69 [1] = -1, /* sizeof(((struct frame *)0)->un.fmt1), */
70 [2] = sizeof(((struct frame *)0)->un.fmt2),
71 [3] = sizeof(((struct frame *)0)->un.fmt3),
72 [4] = FMT4SIZE,
73 [5] = -1, /* sizeof(((struct frame *)0)->un.fmt5), */
74 [6] = -1, /* sizeof(((struct frame *)0)->un.fmt6), */
75 [7] = sizeof(((struct frame *)0)->un.fmt7),
76 [8] = -1, /* sizeof(((struct frame *)0)->un.fmt8), */
77 [9] = sizeof(((struct frame *)0)->un.fmt9),
78 [10] = sizeof(((struct frame *)0)->un.fmta),
79 [11] = sizeof(((struct frame *)0)->un.fmtb),
80 [12] = -1, /* sizeof(((struct frame *)0)->un.fmtc), */
81 [13] = -1, /* sizeof(((struct frame *)0)->un.fmtd), */
82 [14] = -1, /* sizeof(((struct frame *)0)->un.fmte), */
83 [15] = -1, /* sizeof(((struct frame *)0)->un.fmtf), */
84};
85
86static inline int frame_extra_sizes(int f)
87{
88 return frame_size_change[f];
89}
90
91int handle_kernel_fault(struct pt_regs *regs)
92{
93 const struct exception_table_entry *fixup;
94 struct pt_regs *tregs;
95
96 /* Are we prepared to handle this kernel fault? */
97 fixup = search_exception_tables(regs->pc);
98 if (!fixup)
99 return 0;
100
101 /* Create a new four word stack frame, discarding the old one. */
102 regs->stkadj = frame_extra_sizes(regs->format);
103 tregs = (struct pt_regs *)((long)regs + regs->stkadj);
104 tregs->vector = regs->vector;
105 tregs->format = FORMAT;
106 tregs->pc = fixup->fixup;
107 tregs->sr = regs->sr;
108
109 return 1;
110}
111
112void ptrace_signal_deliver(struct pt_regs *regs, void *cookie)
113{
114 if (regs->orig_d0 < 0)
115 return;
116 switch (regs->d0) {
117 case -ERESTARTNOHAND:
118 case -ERESTARTSYS:
119 case -ERESTARTNOINTR:
120 regs->d0 = regs->orig_d0;
121 regs->orig_d0 = -1;
122 regs->pc -= 2;
123 break;
124 }
125}
126
127static inline void push_cache (unsigned long vaddr)
128{
129 /*
130 * Using the old cache_push_v() was really a big waste.
131 *
132 * What we are trying to do is to flush 8 bytes to ram.
133 * Flushing 2 cache lines of 16 bytes is much cheaper than
134 * flushing 1 or 2 pages, as previously done in
135 * cache_push_v().
136 * Jes
137 */
138 if (CPU_IS_040) {
139 unsigned long temp;
140
141 __asm__ __volatile__ (".chip 68040\n\t"
142 "nop\n\t"
143 "ptestr (%1)\n\t"
144 "movec %%mmusr,%0\n\t"
145 ".chip 68k"
146 : "=r" (temp)
147 : "a" (vaddr));
148
149 temp &= PAGE_MASK;
150 temp |= vaddr & ~PAGE_MASK;
151
152 __asm__ __volatile__ (".chip 68040\n\t"
153 "nop\n\t"
154 "cpushl %%bc,(%0)\n\t"
155 ".chip 68k"
156 : : "a" (temp));
157 }
158 else if (CPU_IS_060) {
159 unsigned long temp;
160 __asm__ __volatile__ (".chip 68060\n\t"
161 "plpar (%0)\n\t"
162 ".chip 68k"
163 : "=a" (temp)
164 : "0" (vaddr));
165 __asm__ __volatile__ (".chip 68060\n\t"
166 "cpushl %%bc,(%0)\n\t"
167 ".chip 68k"
168 : : "a" (temp));
169 } else if (!CPU_IS_COLDFIRE) {
170 /*
171 * 68030/68020 have no writeback cache;
172 * still need to clear icache.
173 * Note that vaddr is guaranteed to be long word aligned.
174 */
175 unsigned long temp;
176 asm volatile ("movec %%cacr,%0" : "=r" (temp));
177 temp += 4;
178 asm volatile ("movec %0,%%caar\n\t"
179 "movec %1,%%cacr"
180 : : "r" (vaddr), "r" (temp));
181 asm volatile ("movec %0,%%caar\n\t"
182 "movec %1,%%cacr"
183 : : "r" (vaddr + 4), "r" (temp));
184 }
185}
186
187static inline void adjustformat(struct pt_regs *regs)
188{
189}
190
191static inline void save_a5_state(struct sigcontext *sc, struct pt_regs *regs)
192{
193}
194
195#else /* CONFIG_MMU */
196
197void ret_from_user_signal(void);
198void ret_from_user_rt_signal(void);
199
200static inline int frame_extra_sizes(int f)
201{
202 /* No frame size adjustments required on non-MMU CPUs */
203 return 0;
204}
205
206static inline void adjustformat(struct pt_regs *regs)
207{
208 ((struct switch_stack *)regs - 1)->a5 = current->mm->start_data;
209 /*
210 * set format byte to make stack appear modulo 4, which it will
211 * be when doing the rte
212 */
213 regs->format = 0x4;
214}
215
216static inline void save_a5_state(struct sigcontext *sc, struct pt_regs *regs)
217{
218 sc->sc_a5 = ((struct switch_stack *)regs - 1)->a5;
219}
220
221static inline void push_cache(unsigned long vaddr)
222{
223}
224
225#endif /* CONFIG_MMU */
226
227/*
228 * Atomically swap in the new signal mask, and wait for a signal.
229 */
230asmlinkage int
231sys_sigsuspend(int unused0, int unused1, old_sigset_t mask)
232{
233 mask &= _BLOCKABLE;
234 spin_lock_irq(&current->sighand->siglock);
235 current->saved_sigmask = current->blocked;
236 siginitset(&current->blocked, mask);
237 recalc_sigpending();
238 spin_unlock_irq(&current->sighand->siglock);
239
240 current->state = TASK_INTERRUPTIBLE;
241 schedule();
242 set_restore_sigmask();
243
244 return -ERESTARTNOHAND;
245}
246
247asmlinkage int
248sys_sigaction(int sig, const struct old_sigaction __user *act,
249 struct old_sigaction __user *oact)
250{
251 struct k_sigaction new_ka, old_ka;
252 int ret;
253
254 if (act) {
255 old_sigset_t mask;
256 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
257 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
258 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
259 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
260 __get_user(mask, &act->sa_mask))
261 return -EFAULT;
262 siginitset(&new_ka.sa.sa_mask, mask);
263 }
264
265 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
266
267 if (!ret && oact) {
268 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
269 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
270 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
271 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
272 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
273 return -EFAULT;
274 }
275
276 return ret;
277}
278
279asmlinkage int
280sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
281{
282 return do_sigaltstack(uss, uoss, rdusp());
283}
284
285
286/*
287 * Do a signal return; undo the signal stack.
288 *
289 * Keep the return code on the stack quadword aligned!
290 * That makes the cache flush below easier.
291 */
292
293struct sigframe
294{
295 char __user *pretcode;
296 int sig;
297 int code;
298 struct sigcontext __user *psc;
299 char retcode[8];
300 unsigned long extramask[_NSIG_WORDS-1];
301 struct sigcontext sc;
302};
303
304struct rt_sigframe
305{
306 char __user *pretcode;
307 int sig;
308 struct siginfo __user *pinfo;
309 void __user *puc;
310 char retcode[8];
311 struct siginfo info;
312 struct ucontext uc;
313};
314
315#define FPCONTEXT_SIZE 216
316#define uc_fpstate uc_filler[0]
317#define uc_formatvec uc_filler[FPCONTEXT_SIZE/4]
318#define uc_extra uc_filler[FPCONTEXT_SIZE/4+1]
319
320#ifdef CONFIG_FPU
321
322static unsigned char fpu_version; /* version number of fpu, set by setup_frame */
323
324static inline int restore_fpu_state(struct sigcontext *sc)
325{
326 int err = 1;
327
328 if (FPU_IS_EMU) {
329 /* restore registers */
330 memcpy(current->thread.fpcntl, sc->sc_fpcntl, 12);
331 memcpy(current->thread.fp, sc->sc_fpregs, 24);
332 return 0;
333 }
334
335 if (CPU_IS_060 ? sc->sc_fpstate[2] : sc->sc_fpstate[0]) {
336 /* Verify the frame format. */
337 if (!(CPU_IS_060 || CPU_IS_COLDFIRE) &&
338 (sc->sc_fpstate[0] != fpu_version))
339 goto out;
340 if (CPU_IS_020_OR_030) {
341 if (m68k_fputype & FPU_68881 &&
342 !(sc->sc_fpstate[1] == 0x18 || sc->sc_fpstate[1] == 0xb4))
343 goto out;
344 if (m68k_fputype & FPU_68882 &&
345 !(sc->sc_fpstate[1] == 0x38 || sc->sc_fpstate[1] == 0xd4))
346 goto out;
347 } else if (CPU_IS_040) {
348 if (!(sc->sc_fpstate[1] == 0x00 ||
349 sc->sc_fpstate[1] == 0x28 ||
350 sc->sc_fpstate[1] == 0x60))
351 goto out;
352 } else if (CPU_IS_060) {
353 if (!(sc->sc_fpstate[3] == 0x00 ||
354 sc->sc_fpstate[3] == 0x60 ||
355 sc->sc_fpstate[3] == 0xe0))
356 goto out;
357 } else if (CPU_IS_COLDFIRE) {
358 if (!(sc->sc_fpstate[0] == 0x00 ||
359 sc->sc_fpstate[0] == 0x05 ||
360 sc->sc_fpstate[0] == 0xe5))
361 goto out;
362 } else
363 goto out;
364
365 if (CPU_IS_COLDFIRE) {
366 __asm__ volatile ("fmovemd %0,%%fp0-%%fp1\n\t"
367 "fmovel %1,%%fpcr\n\t"
368 "fmovel %2,%%fpsr\n\t"
369 "fmovel %3,%%fpiar"
370 : /* no outputs */
371 : "m" (sc->sc_fpregs[0]),
372 "m" (sc->sc_fpcntl[0]),
373 "m" (sc->sc_fpcntl[1]),
374 "m" (sc->sc_fpcntl[2]));
375 } else {
376 __asm__ volatile (".chip 68k/68881\n\t"
377 "fmovemx %0,%%fp0-%%fp1\n\t"
378 "fmoveml %1,%%fpcr/%%fpsr/%%fpiar\n\t"
379 ".chip 68k"
380 : /* no outputs */
381 : "m" (*sc->sc_fpregs),
382 "m" (*sc->sc_fpcntl));
383 }
384 }
385
386 if (CPU_IS_COLDFIRE) {
387 __asm__ volatile ("frestore %0" : : "m" (*sc->sc_fpstate));
388 } else {
389 __asm__ volatile (".chip 68k/68881\n\t"
390 "frestore %0\n\t"
391 ".chip 68k"
392 : : "m" (*sc->sc_fpstate));
393 }
394 err = 0;
395
396out:
397 return err;
398}
399
400static inline int rt_restore_fpu_state(struct ucontext __user *uc)
401{
402 unsigned char fpstate[FPCONTEXT_SIZE];
403 int context_size = CPU_IS_060 ? 8 : (CPU_IS_COLDFIRE ? 12 : 0);
404 fpregset_t fpregs;
405 int err = 1;
406
407 if (FPU_IS_EMU) {
408 /* restore fpu control register */
409 if (__copy_from_user(current->thread.fpcntl,
410 uc->uc_mcontext.fpregs.f_fpcntl, 12))
411 goto out;
412 /* restore all other fpu register */
413 if (__copy_from_user(current->thread.fp,
414 uc->uc_mcontext.fpregs.f_fpregs, 96))
415 goto out;
416 return 0;
417 }
418
419 if (__get_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate))
420 goto out;
421 if (CPU_IS_060 ? fpstate[2] : fpstate[0]) {
422 if (!(CPU_IS_060 || CPU_IS_COLDFIRE))
423 context_size = fpstate[1];
424 /* Verify the frame format. */
425 if (!(CPU_IS_060 || CPU_IS_COLDFIRE) &&
426 (fpstate[0] != fpu_version))
427 goto out;
428 if (CPU_IS_020_OR_030) {
429 if (m68k_fputype & FPU_68881 &&
430 !(context_size == 0x18 || context_size == 0xb4))
431 goto out;
432 if (m68k_fputype & FPU_68882 &&
433 !(context_size == 0x38 || context_size == 0xd4))
434 goto out;
435 } else if (CPU_IS_040) {
436 if (!(context_size == 0x00 ||
437 context_size == 0x28 ||
438 context_size == 0x60))
439 goto out;
440 } else if (CPU_IS_060) {
441 if (!(fpstate[3] == 0x00 ||
442 fpstate[3] == 0x60 ||
443 fpstate[3] == 0xe0))
444 goto out;
445 } else if (CPU_IS_COLDFIRE) {
446 if (!(fpstate[3] == 0x00 ||
447 fpstate[3] == 0x05 ||
448 fpstate[3] == 0xe5))
449 goto out;
450 } else
451 goto out;
452 if (__copy_from_user(&fpregs, &uc->uc_mcontext.fpregs,
453 sizeof(fpregs)))
454 goto out;
455
456 if (CPU_IS_COLDFIRE) {
457 __asm__ volatile ("fmovemd %0,%%fp0-%%fp7\n\t"
458 "fmovel %1,%%fpcr\n\t"
459 "fmovel %2,%%fpsr\n\t"
460 "fmovel %3,%%fpiar"
461 : /* no outputs */
462 : "m" (fpregs.f_fpregs[0]),
463 "m" (fpregs.f_fpcntl[0]),
464 "m" (fpregs.f_fpcntl[1]),
465 "m" (fpregs.f_fpcntl[2]));
466 } else {
467 __asm__ volatile (".chip 68k/68881\n\t"
468 "fmovemx %0,%%fp0-%%fp7\n\t"
469 "fmoveml %1,%%fpcr/%%fpsr/%%fpiar\n\t"
470 ".chip 68k"
471 : /* no outputs */
472 : "m" (*fpregs.f_fpregs),
473 "m" (*fpregs.f_fpcntl));
474 }
475 }
476 if (context_size &&
477 __copy_from_user(fpstate + 4, (long __user *)&uc->uc_fpstate + 1,
478 context_size))
479 goto out;
480
481 if (CPU_IS_COLDFIRE) {
482 __asm__ volatile ("frestore %0" : : "m" (*fpstate));
483 } else {
484 __asm__ volatile (".chip 68k/68881\n\t"
485 "frestore %0\n\t"
486 ".chip 68k"
487 : : "m" (*fpstate));
488 }
489 err = 0;
490
491out:
492 return err;
493}
494
495/*
496 * Set up a signal frame.
497 */
498static inline void save_fpu_state(struct sigcontext *sc, struct pt_regs *regs)
499{
500 if (FPU_IS_EMU) {
501 /* save registers */
502 memcpy(sc->sc_fpcntl, current->thread.fpcntl, 12);
503 memcpy(sc->sc_fpregs, current->thread.fp, 24);
504 return;
505 }
506
507 if (CPU_IS_COLDFIRE) {
508 __asm__ volatile ("fsave %0"
509 : : "m" (*sc->sc_fpstate) : "memory");
510 } else {
511 __asm__ volatile (".chip 68k/68881\n\t"
512 "fsave %0\n\t"
513 ".chip 68k"
514 : : "m" (*sc->sc_fpstate) : "memory");
515 }
516
517 if (CPU_IS_060 ? sc->sc_fpstate[2] : sc->sc_fpstate[0]) {
518 fpu_version = sc->sc_fpstate[0];
519 if (CPU_IS_020_OR_030 &&
520 regs->vector >= (VEC_FPBRUC * 4) &&
521 regs->vector <= (VEC_FPNAN * 4)) {
522 /* Clear pending exception in 68882 idle frame */
523 if (*(unsigned short *) sc->sc_fpstate == 0x1f38)
524 sc->sc_fpstate[0x38] |= 1 << 3;
525 }
526
527 if (CPU_IS_COLDFIRE) {
528 __asm__ volatile ("fmovemd %%fp0-%%fp1,%0\n\t"
529 "fmovel %%fpcr,%1\n\t"
530 "fmovel %%fpsr,%2\n\t"
531 "fmovel %%fpiar,%3"
532 : "=m" (sc->sc_fpregs[0]),
533 "=m" (sc->sc_fpcntl[0]),
534 "=m" (sc->sc_fpcntl[1]),
535 "=m" (sc->sc_fpcntl[2])
536 : /* no inputs */
537 : "memory");
538 } else {
539 __asm__ volatile (".chip 68k/68881\n\t"
540 "fmovemx %%fp0-%%fp1,%0\n\t"
541 "fmoveml %%fpcr/%%fpsr/%%fpiar,%1\n\t"
542 ".chip 68k"
543 : "=m" (*sc->sc_fpregs),
544 "=m" (*sc->sc_fpcntl)
545 : /* no inputs */
546 : "memory");
547 }
548 }
549}
550
551static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs *regs)
552{
553 unsigned char fpstate[FPCONTEXT_SIZE];
554 int context_size = CPU_IS_060 ? 8 : (CPU_IS_COLDFIRE ? 12 : 0);
555 int err = 0;
556
557 if (FPU_IS_EMU) {
558 /* save fpu control register */
559 err |= copy_to_user(uc->uc_mcontext.fpregs.f_fpcntl,
560 current->thread.fpcntl, 12);
561 /* save all other fpu register */
562 err |= copy_to_user(uc->uc_mcontext.fpregs.f_fpregs,
563 current->thread.fp, 96);
564 return err;
565 }
566
567 if (CPU_IS_COLDFIRE) {
568 __asm__ volatile ("fsave %0" : : "m" (*fpstate) : "memory");
569 } else {
570 __asm__ volatile (".chip 68k/68881\n\t"
571 "fsave %0\n\t"
572 ".chip 68k"
573 : : "m" (*fpstate) : "memory");
574 }
575
576 err |= __put_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate);
577 if (CPU_IS_060 ? fpstate[2] : fpstate[0]) {
578 fpregset_t fpregs;
579 if (!(CPU_IS_060 || CPU_IS_COLDFIRE))
580 context_size = fpstate[1];
581 fpu_version = fpstate[0];
582 if (CPU_IS_020_OR_030 &&
583 regs->vector >= (VEC_FPBRUC * 4) &&
584 regs->vector <= (VEC_FPNAN * 4)) {
585 /* Clear pending exception in 68882 idle frame */
586 if (*(unsigned short *) fpstate == 0x1f38)
587 fpstate[0x38] |= 1 << 3;
588 }
589 if (CPU_IS_COLDFIRE) {
590 __asm__ volatile ("fmovemd %%fp0-%%fp7,%0\n\t"
591 "fmovel %%fpcr,%1\n\t"
592 "fmovel %%fpsr,%2\n\t"
593 "fmovel %%fpiar,%3"
594 : "=m" (fpregs.f_fpregs[0]),
595 "=m" (fpregs.f_fpcntl[0]),
596 "=m" (fpregs.f_fpcntl[1]),
597 "=m" (fpregs.f_fpcntl[2])
598 : /* no inputs */
599 : "memory");
600 } else {
601 __asm__ volatile (".chip 68k/68881\n\t"
602 "fmovemx %%fp0-%%fp7,%0\n\t"
603 "fmoveml %%fpcr/%%fpsr/%%fpiar,%1\n\t"
604 ".chip 68k"
605 : "=m" (*fpregs.f_fpregs),
606 "=m" (*fpregs.f_fpcntl)
607 : /* no inputs */
608 : "memory");
609 }
610 err |= copy_to_user(&uc->uc_mcontext.fpregs, &fpregs,
611 sizeof(fpregs));
612 }
613 if (context_size)
614 err |= copy_to_user((long __user *)&uc->uc_fpstate + 1, fpstate + 4,
615 context_size);
616 return err;
617}
618
619#else /* CONFIG_FPU */
620
621/*
622 * For the case with no FPU configured these all do nothing.
623 */
624static inline int restore_fpu_state(struct sigcontext *sc)
625{
626 return 0;
627}
628
629static inline int rt_restore_fpu_state(struct ucontext __user *uc)
630{
631 return 0;
632}
633
634static inline void save_fpu_state(struct sigcontext *sc, struct pt_regs *regs)
635{
636}
637
638static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs *regs)
639{
640 return 0;
641}
642
643#endif /* CONFIG_FPU */
644
645static int mangle_kernel_stack(struct pt_regs *regs, int formatvec,
646 void __user *fp)
647{
648 int fsize = frame_extra_sizes(formatvec >> 12);
649 if (fsize < 0) {
650 /*
651 * user process trying to return with weird frame format
652 */
653#ifdef DEBUG
654 printk("user process returning with weird frame format\n");
655#endif
656 return 1;
657 }
658 if (!fsize) {
659 regs->format = formatvec >> 12;
660 regs->vector = formatvec & 0xfff;
661 } else {
662 struct switch_stack *sw = (struct switch_stack *)regs - 1;
663 unsigned long buf[fsize / 2]; /* yes, twice as much */
664
665 /* that'll make sure that expansion won't crap over data */
666 if (copy_from_user(buf + fsize / 4, fp, fsize))
667 return 1;
668
669 /* point of no return */
670 regs->format = formatvec >> 12;
671 regs->vector = formatvec & 0xfff;
672#define frame_offset (sizeof(struct pt_regs)+sizeof(struct switch_stack))
673 __asm__ __volatile__ (
674#ifdef CONFIG_COLDFIRE
675 " movel %0,%/sp\n\t"
676 " bra ret_from_signal\n"
677#else
678 " movel %0,%/a0\n\t"
679 " subl %1,%/a0\n\t" /* make room on stack */
680 " movel %/a0,%/sp\n\t" /* set stack pointer */
681 /* move switch_stack and pt_regs */
682 "1: movel %0@+,%/a0@+\n\t"
683 " dbra %2,1b\n\t"
684 " lea %/sp@(%c3),%/a0\n\t" /* add offset of fmt */
685 " lsrl #2,%1\n\t"
686 " subql #1,%1\n\t"
687 /* copy to the gap we'd made */
688 "2: movel %4@+,%/a0@+\n\t"
689 " dbra %1,2b\n\t"
690 " bral ret_from_signal\n"
691#endif
692 : /* no outputs, it doesn't ever return */
693 : "a" (sw), "d" (fsize), "d" (frame_offset/4-1),
694 "n" (frame_offset), "a" (buf + fsize/4)
695 : "a0");
696#undef frame_offset
697 }
698 return 0;
699}
700
701static inline int
702restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *usc, void __user *fp)
703{
704 int formatvec;
705 struct sigcontext context;
706 int err = 0;
707
708 /* Always make any pending restarted system calls return -EINTR */
709 current_thread_info()->restart_block.fn = do_no_restart_syscall;
710
711 /* get previous context */
712 if (copy_from_user(&context, usc, sizeof(context)))
713 goto badframe;
714
715 /* restore passed registers */
716 regs->d0 = context.sc_d0;
717 regs->d1 = context.sc_d1;
718 regs->a0 = context.sc_a0;
719 regs->a1 = context.sc_a1;
720 regs->sr = (regs->sr & 0xff00) | (context.sc_sr & 0xff);
721 regs->pc = context.sc_pc;
722 regs->orig_d0 = -1; /* disable syscall checks */
723 wrusp(context.sc_usp);
724 formatvec = context.sc_formatvec;
725
726 err = restore_fpu_state(&context);
727
728 if (err || mangle_kernel_stack(regs, formatvec, fp))
729 goto badframe;
730
731 return 0;
732
733badframe:
734 return 1;
735}
736
737static inline int
738rt_restore_ucontext(struct pt_regs *regs, struct switch_stack *sw,
739 struct ucontext __user *uc)
740{
741 int temp;
742 greg_t __user *gregs = uc->uc_mcontext.gregs;
743 unsigned long usp;
744 int err;
745
746 /* Always make any pending restarted system calls return -EINTR */
747 current_thread_info()->restart_block.fn = do_no_restart_syscall;
748
749 err = __get_user(temp, &uc->uc_mcontext.version);
750 if (temp != MCONTEXT_VERSION)
751 goto badframe;
752 /* restore passed registers */
753 err |= __get_user(regs->d0, &gregs[0]);
754 err |= __get_user(regs->d1, &gregs[1]);
755 err |= __get_user(regs->d2, &gregs[2]);
756 err |= __get_user(regs->d3, &gregs[3]);
757 err |= __get_user(regs->d4, &gregs[4]);
758 err |= __get_user(regs->d5, &gregs[5]);
759 err |= __get_user(sw->d6, &gregs[6]);
760 err |= __get_user(sw->d7, &gregs[7]);
761 err |= __get_user(regs->a0, &gregs[8]);
762 err |= __get_user(regs->a1, &gregs[9]);
763 err |= __get_user(regs->a2, &gregs[10]);
764 err |= __get_user(sw->a3, &gregs[11]);
765 err |= __get_user(sw->a4, &gregs[12]);
766 err |= __get_user(sw->a5, &gregs[13]);
767 err |= __get_user(sw->a6, &gregs[14]);
768 err |= __get_user(usp, &gregs[15]);
769 wrusp(usp);
770 err |= __get_user(regs->pc, &gregs[16]);
771 err |= __get_user(temp, &gregs[17]);
772 regs->sr = (regs->sr & 0xff00) | (temp & 0xff);
773 regs->orig_d0 = -1; /* disable syscall checks */
774 err |= __get_user(temp, &uc->uc_formatvec);
775
776 err |= rt_restore_fpu_state(uc);
777
778 if (err || do_sigaltstack(&uc->uc_stack, NULL, usp) == -EFAULT)
779 goto badframe;
780
781 if (mangle_kernel_stack(regs, temp, &uc->uc_extra))
782 goto badframe;
783
784 return 0;
785
786badframe:
787 return 1;
788}
789
790asmlinkage int do_sigreturn(unsigned long __unused)
791{
792 struct switch_stack *sw = (struct switch_stack *) &__unused;
793 struct pt_regs *regs = (struct pt_regs *) (sw + 1);
794 unsigned long usp = rdusp();
795 struct sigframe __user *frame = (struct sigframe __user *)(usp - 4);
796 sigset_t set;
797
798 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
799 goto badframe;
800 if (__get_user(set.sig[0], &frame->sc.sc_mask) ||
801 (_NSIG_WORDS > 1 &&
802 __copy_from_user(&set.sig[1], &frame->extramask,
803 sizeof(frame->extramask))))
804 goto badframe;
805
806 sigdelsetmask(&set, ~_BLOCKABLE);
807 current->blocked = set;
808 recalc_sigpending();
809
810 if (restore_sigcontext(regs, &frame->sc, frame + 1))
811 goto badframe;
812 return regs->d0;
813
814badframe:
815 force_sig(SIGSEGV, current);
816 return 0;
817}
818
819asmlinkage int do_rt_sigreturn(unsigned long __unused)
820{
821 struct switch_stack *sw = (struct switch_stack *) &__unused;
822 struct pt_regs *regs = (struct pt_regs *) (sw + 1);
823 unsigned long usp = rdusp();
824 struct rt_sigframe __user *frame = (struct rt_sigframe __user *)(usp - 4);
825 sigset_t set;
826
827 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
828 goto badframe;
829 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
830 goto badframe;
831
832 sigdelsetmask(&set, ~_BLOCKABLE);
833 current->blocked = set;
834 recalc_sigpending();
835
836 if (rt_restore_ucontext(regs, sw, &frame->uc))
837 goto badframe;
838 return regs->d0;
839
840badframe:
841 force_sig(SIGSEGV, current);
842 return 0;
843}
844
845static void setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs,
846 unsigned long mask)
847{
848 sc->sc_mask = mask;
849 sc->sc_usp = rdusp();
850 sc->sc_d0 = regs->d0;
851 sc->sc_d1 = regs->d1;
852 sc->sc_a0 = regs->a0;
853 sc->sc_a1 = regs->a1;
854 sc->sc_sr = regs->sr;
855 sc->sc_pc = regs->pc;
856 sc->sc_formatvec = regs->format << 12 | regs->vector;
857 save_a5_state(sc, regs);
858 save_fpu_state(sc, regs);
859}
860
861static inline int rt_setup_ucontext(struct ucontext __user *uc, struct pt_regs *regs)
862{
863 struct switch_stack *sw = (struct switch_stack *)regs - 1;
864 greg_t __user *gregs = uc->uc_mcontext.gregs;
865 int err = 0;
866
867 err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version);
868 err |= __put_user(regs->d0, &gregs[0]);
869 err |= __put_user(regs->d1, &gregs[1]);
870 err |= __put_user(regs->d2, &gregs[2]);
871 err |= __put_user(regs->d3, &gregs[3]);
872 err |= __put_user(regs->d4, &gregs[4]);
873 err |= __put_user(regs->d5, &gregs[5]);
874 err |= __put_user(sw->d6, &gregs[6]);
875 err |= __put_user(sw->d7, &gregs[7]);
876 err |= __put_user(regs->a0, &gregs[8]);
877 err |= __put_user(regs->a1, &gregs[9]);
878 err |= __put_user(regs->a2, &gregs[10]);
879 err |= __put_user(sw->a3, &gregs[11]);
880 err |= __put_user(sw->a4, &gregs[12]);
881 err |= __put_user(sw->a5, &gregs[13]);
882 err |= __put_user(sw->a6, &gregs[14]);
883 err |= __put_user(rdusp(), &gregs[15]);
884 err |= __put_user(regs->pc, &gregs[16]);
885 err |= __put_user(regs->sr, &gregs[17]);
886 err |= __put_user((regs->format << 12) | regs->vector, &uc->uc_formatvec);
887 err |= rt_save_fpu_state(uc, regs);
888 return err;
889}
890
891static inline void __user *
892get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
893{
894 unsigned long usp;
895
896 /* Default to using normal stack. */
897 usp = rdusp();
898
899 /* This is the X/Open sanctioned signal stack switching. */
900 if (ka->sa.sa_flags & SA_ONSTACK) {
901 if (!sas_ss_flags(usp))
902 usp = current->sas_ss_sp + current->sas_ss_size;
903 }
904 return (void __user *)((usp - frame_size) & -8UL);
905}
906
907static int setup_frame (int sig, struct k_sigaction *ka,
908 sigset_t *set, struct pt_regs *regs)
909{
910 struct sigframe __user *frame;
911 int fsize = frame_extra_sizes(regs->format);
912 struct sigcontext context;
913 int err = 0;
914
915 if (fsize < 0) {
916#ifdef DEBUG
917 printk ("setup_frame: Unknown frame format %#x\n",
918 regs->format);
919#endif
920 goto give_sigsegv;
921 }
922
923 frame = get_sigframe(ka, regs, sizeof(*frame) + fsize);
924
925 if (fsize)
926 err |= copy_to_user (frame + 1, regs + 1, fsize);
927
928 err |= __put_user((current_thread_info()->exec_domain
929 && current_thread_info()->exec_domain->signal_invmap
930 && sig < 32
931 ? current_thread_info()->exec_domain->signal_invmap[sig]
932 : sig),
933 &frame->sig);
934
935 err |= __put_user(regs->vector, &frame->code);
936 err |= __put_user(&frame->sc, &frame->psc);
937
938 if (_NSIG_WORDS > 1)
939 err |= copy_to_user(frame->extramask, &set->sig[1],
940 sizeof(frame->extramask));
941
942 setup_sigcontext(&context, regs, set->sig[0]);
943 err |= copy_to_user (&frame->sc, &context, sizeof(context));
944
945 /* Set up to return from userspace. */
946#ifdef CONFIG_MMU
947 err |= __put_user(frame->retcode, &frame->pretcode);
948 /* moveq #,d0; trap #0 */
949 err |= __put_user(0x70004e40 + (__NR_sigreturn << 16),
950 (long __user *)(frame->retcode));
951#else
952 err |= __put_user((void *) ret_from_user_signal, &frame->pretcode);
953#endif
954
955 if (err)
956 goto give_sigsegv;
957
958 push_cache ((unsigned long) &frame->retcode);
959
960 /*
961 * Set up registers for signal handler. All the state we are about
962 * to destroy is successfully copied to sigframe.
963 */
964 wrusp ((unsigned long) frame);
965 regs->pc = (unsigned long) ka->sa.sa_handler;
966 adjustformat(regs);
967
968 /*
969 * This is subtle; if we build more than one sigframe, all but the
970 * first one will see frame format 0 and have fsize == 0, so we won't
971 * screw stkadj.
972 */
973 if (fsize)
974 regs->stkadj = fsize;
975
976 /* Prepare to skip over the extra stuff in the exception frame. */
977 if (regs->stkadj) {
978 struct pt_regs *tregs =
979 (struct pt_regs *)((ulong)regs + regs->stkadj);
980#ifdef DEBUG
981 printk("Performing stackadjust=%04x\n", regs->stkadj);
982#endif
983 /* This must be copied with decreasing addresses to
984 handle overlaps. */
985 tregs->vector = 0;
986 tregs->format = 0;
987 tregs->pc = regs->pc;
988 tregs->sr = regs->sr;
989 }
990 return 0;
991
992give_sigsegv:
993 force_sigsegv(sig, current);
994 return err;
995}
996
997static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
998 sigset_t *set, struct pt_regs *regs)
999{
1000 struct rt_sigframe __user *frame;
1001 int fsize = frame_extra_sizes(regs->format);
1002 int err = 0;
1003
1004 if (fsize < 0) {
1005#ifdef DEBUG
1006 printk ("setup_frame: Unknown frame format %#x\n",
1007 regs->format);
1008#endif
1009 goto give_sigsegv;
1010 }
1011
1012 frame = get_sigframe(ka, regs, sizeof(*frame));
1013
1014 if (fsize)
1015 err |= copy_to_user (&frame->uc.uc_extra, regs + 1, fsize);
1016
1017 err |= __put_user((current_thread_info()->exec_domain
1018 && current_thread_info()->exec_domain->signal_invmap
1019 && sig < 32
1020 ? current_thread_info()->exec_domain->signal_invmap[sig]
1021 : sig),
1022 &frame->sig);
1023 err |= __put_user(&frame->info, &frame->pinfo);
1024 err |= __put_user(&frame->uc, &frame->puc);
1025 err |= copy_siginfo_to_user(&frame->info, info);
1026
1027 /* Create the ucontext. */
1028 err |= __put_user(0, &frame->uc.uc_flags);
1029 err |= __put_user(NULL, &frame->uc.uc_link);
1030 err |= __put_user((void __user *)current->sas_ss_sp,
1031 &frame->uc.uc_stack.ss_sp);
1032 err |= __put_user(sas_ss_flags(rdusp()),
1033 &frame->uc.uc_stack.ss_flags);
1034 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
1035 err |= rt_setup_ucontext(&frame->uc, regs);
1036 err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set));
1037
1038 /* Set up to return from userspace. */
1039#ifdef CONFIG_MMU
1040 err |= __put_user(frame->retcode, &frame->pretcode);
1041#ifdef __mcoldfire__
1042 /* movel #__NR_rt_sigreturn,d0; trap #0 */
1043 err |= __put_user(0x203c0000, (long __user *)(frame->retcode + 0));
1044 err |= __put_user(0x00004e40 + (__NR_rt_sigreturn << 16),
1045 (long __user *)(frame->retcode + 4));
1046#else
1047 /* moveq #,d0; notb d0; trap #0 */
1048 err |= __put_user(0x70004600 + ((__NR_rt_sigreturn ^ 0xff) << 16),
1049 (long __user *)(frame->retcode + 0));
1050 err |= __put_user(0x4e40, (short __user *)(frame->retcode + 4));
1051#endif
1052#else
1053 err |= __put_user((void *) ret_from_user_rt_signal, &frame->pretcode);
1054#endif /* CONFIG_MMU */
1055
1056 if (err)
1057 goto give_sigsegv;
1058
1059 push_cache ((unsigned long) &frame->retcode);
1060
1061 /*
1062 * Set up registers for signal handler. All the state we are about
1063 * to destroy is successfully copied to sigframe.
1064 */
1065 wrusp ((unsigned long) frame);
1066 regs->pc = (unsigned long) ka->sa.sa_handler;
1067 adjustformat(regs);
1068
1069 /*
1070 * This is subtle; if we build more than one sigframe, all but the
1071 * first one will see frame format 0 and have fsize == 0, so we won't
1072 * screw stkadj.
1073 */
1074 if (fsize)
1075 regs->stkadj = fsize;
1076
1077 /* Prepare to skip over the extra stuff in the exception frame. */
1078 if (regs->stkadj) {
1079 struct pt_regs *tregs =
1080 (struct pt_regs *)((ulong)regs + regs->stkadj);
1081#ifdef DEBUG
1082 printk("Performing stackadjust=%04x\n", regs->stkadj);
1083#endif
1084 /* This must be copied with decreasing addresses to
1085 handle overlaps. */
1086 tregs->vector = 0;
1087 tregs->format = 0;
1088 tregs->pc = regs->pc;
1089 tregs->sr = regs->sr;
1090 }
1091 return 0;
1092
1093give_sigsegv:
1094 force_sigsegv(sig, current);
1095 return err;
1096}
1097
1098static inline void
1099handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
1100{
1101 switch (regs->d0) {
1102 case -ERESTARTNOHAND:
1103 if (!has_handler)
1104 goto do_restart;
1105 regs->d0 = -EINTR;
1106 break;
1107
1108 case -ERESTART_RESTARTBLOCK:
1109 if (!has_handler) {
1110 regs->d0 = __NR_restart_syscall;
1111 regs->pc -= 2;
1112 break;
1113 }
1114 regs->d0 = -EINTR;
1115 break;
1116
1117 case -ERESTARTSYS:
1118 if (has_handler && !(ka->sa.sa_flags & SA_RESTART)) {
1119 regs->d0 = -EINTR;
1120 break;
1121 }
1122 /* fallthrough */
1123 case -ERESTARTNOINTR:
1124 do_restart:
1125 regs->d0 = regs->orig_d0;
1126 regs->pc -= 2;
1127 break;
1128 }
1129}
1130
1131/*
1132 * OK, we're invoking a handler
1133 */
1134static void
1135handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
1136 sigset_t *oldset, struct pt_regs *regs)
1137{
1138 int err;
1139 /* are we from a system call? */
1140 if (regs->orig_d0 >= 0)
1141 /* If so, check system call restarting.. */
1142 handle_restart(regs, ka, 1);
1143
1144 /* set up the stack frame */
1145 if (ka->sa.sa_flags & SA_SIGINFO)
1146 err = setup_rt_frame(sig, ka, info, oldset, regs);
1147 else
1148 err = setup_frame(sig, ka, oldset, regs);
1149
1150 if (err)
1151 return;
1152
1153 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
1154 if (!(ka->sa.sa_flags & SA_NODEFER))
1155 sigaddset(&current->blocked,sig);
1156 recalc_sigpending();
1157
1158 if (test_thread_flag(TIF_DELAYED_TRACE)) {
1159 regs->sr &= ~0x8000;
1160 send_sig(SIGTRAP, current, 1);
1161 }
1162
1163 clear_thread_flag(TIF_RESTORE_SIGMASK);
1164}
1165
1166/*
1167 * Note that 'init' is a special process: it doesn't get signals it doesn't
1168 * want to handle. Thus you cannot kill init even with a SIGKILL even by
1169 * mistake.
1170 */
1171asmlinkage void do_signal(struct pt_regs *regs)
1172{
1173 siginfo_t info;
1174 struct k_sigaction ka;
1175 int signr;
1176 sigset_t *oldset;
1177
1178 current->thread.esp0 = (unsigned long) regs;
1179
1180 if (test_thread_flag(TIF_RESTORE_SIGMASK))
1181 oldset = &current->saved_sigmask;
1182 else
1183 oldset = &current->blocked;
1184
1185 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
1186 if (signr > 0) {
1187 /* Whee! Actually deliver the signal. */
1188 handle_signal(signr, &ka, &info, oldset, regs);
1189 return;
1190 }
1191
1192 /* Did we come from a system call? */
1193 if (regs->orig_d0 >= 0)
1194 /* Restart the system call - no handlers present */
1195 handle_restart(regs, NULL, 0);
1196
1197 /* If there's no signal to deliver, we just restore the saved mask. */
1198 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
1199 clear_thread_flag(TIF_RESTORE_SIGMASK);
1200 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
1201 }
1202}
diff --git a/arch/m68k/kernel/signal_mm.c b/arch/m68k/kernel/signal_mm.c
deleted file mode 100644
index cb856f9da655..000000000000
--- a/arch/m68k/kernel/signal_mm.c
+++ /dev/null
@@ -1,1115 +0,0 @@
1/*
2 * linux/arch/m68k/kernel/signal.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10
11/*
12 * Linux/m68k support by Hamish Macdonald
13 *
14 * 68060 fixes by Jesper Skov
15 *
16 * 1997-12-01 Modified for POSIX.1b signals by Andreas Schwab
17 *
18 * mathemu support by Roman Zippel
19 * (Note: fpstate in the signal context is completely ignored for the emulator
20 * and the internal floating point format is put on stack)
21 */
22
23/*
24 * ++roman (07/09/96): implemented signal stacks (specially for tosemu on
25 * Atari :-) Current limitation: Only one sigstack can be active at one time.
26 * If a second signal with SA_ONSTACK set arrives while working on a sigstack,
27 * SA_ONSTACK is ignored. This behaviour avoids lots of trouble with nested
28 * signal handlers!
29 */
30
31#include <linux/sched.h>
32#include <linux/mm.h>
33#include <linux/kernel.h>
34#include <linux/signal.h>
35#include <linux/syscalls.h>
36#include <linux/errno.h>
37#include <linux/wait.h>
38#include <linux/ptrace.h>
39#include <linux/unistd.h>
40#include <linux/stddef.h>
41#include <linux/highuid.h>
42#include <linux/personality.h>
43#include <linux/tty.h>
44#include <linux/binfmts.h>
45#include <linux/module.h>
46
47#include <asm/setup.h>
48#include <asm/uaccess.h>
49#include <asm/pgtable.h>
50#include <asm/traps.h>
51#include <asm/ucontext.h>
52
53#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
54
55static const int frame_extra_sizes[16] = {
56 [1] = -1, /* sizeof(((struct frame *)0)->un.fmt1), */
57 [2] = sizeof(((struct frame *)0)->un.fmt2),
58 [3] = sizeof(((struct frame *)0)->un.fmt3),
59#ifdef CONFIG_COLDFIRE
60 [4] = 0,
61#else
62 [4] = sizeof(((struct frame *)0)->un.fmt4),
63#endif
64 [5] = -1, /* sizeof(((struct frame *)0)->un.fmt5), */
65 [6] = -1, /* sizeof(((struct frame *)0)->un.fmt6), */
66 [7] = sizeof(((struct frame *)0)->un.fmt7),
67 [8] = -1, /* sizeof(((struct frame *)0)->un.fmt8), */
68 [9] = sizeof(((struct frame *)0)->un.fmt9),
69 [10] = sizeof(((struct frame *)0)->un.fmta),
70 [11] = sizeof(((struct frame *)0)->un.fmtb),
71 [12] = -1, /* sizeof(((struct frame *)0)->un.fmtc), */
72 [13] = -1, /* sizeof(((struct frame *)0)->un.fmtd), */
73 [14] = -1, /* sizeof(((struct frame *)0)->un.fmte), */
74 [15] = -1, /* sizeof(((struct frame *)0)->un.fmtf), */
75};
76
77int handle_kernel_fault(struct pt_regs *regs)
78{
79 const struct exception_table_entry *fixup;
80 struct pt_regs *tregs;
81
82 /* Are we prepared to handle this kernel fault? */
83 fixup = search_exception_tables(regs->pc);
84 if (!fixup)
85 return 0;
86
87 /* Create a new four word stack frame, discarding the old one. */
88 regs->stkadj = frame_extra_sizes[regs->format];
89 tregs = (struct pt_regs *)((long)regs + regs->stkadj);
90 tregs->vector = regs->vector;
91#ifdef CONFIG_COLDFIRE
92 tregs->format = 4;
93#else
94 tregs->format = 0;
95#endif
96 tregs->pc = fixup->fixup;
97 tregs->sr = regs->sr;
98
99 return 1;
100}
101
102/*
103 * Atomically swap in the new signal mask, and wait for a signal.
104 */
105asmlinkage int
106sys_sigsuspend(int unused0, int unused1, old_sigset_t mask)
107{
108 mask &= _BLOCKABLE;
109 spin_lock_irq(&current->sighand->siglock);
110 current->saved_sigmask = current->blocked;
111 siginitset(&current->blocked, mask);
112 recalc_sigpending();
113 spin_unlock_irq(&current->sighand->siglock);
114
115 current->state = TASK_INTERRUPTIBLE;
116 schedule();
117 set_restore_sigmask();
118
119 return -ERESTARTNOHAND;
120}
121
122asmlinkage int
123sys_sigaction(int sig, const struct old_sigaction __user *act,
124 struct old_sigaction __user *oact)
125{
126 struct k_sigaction new_ka, old_ka;
127 int ret;
128
129 if (act) {
130 old_sigset_t mask;
131 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
132 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
133 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
134 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
135 __get_user(mask, &act->sa_mask))
136 return -EFAULT;
137 siginitset(&new_ka.sa.sa_mask, mask);
138 }
139
140 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
141
142 if (!ret && oact) {
143 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
144 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
145 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
146 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
147 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
148 return -EFAULT;
149 }
150
151 return ret;
152}
153
154asmlinkage int
155sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
156{
157 return do_sigaltstack(uss, uoss, rdusp());
158}
159
160
161/*
162 * Do a signal return; undo the signal stack.
163 *
164 * Keep the return code on the stack quadword aligned!
165 * That makes the cache flush below easier.
166 */
167
168struct sigframe
169{
170 char __user *pretcode;
171 int sig;
172 int code;
173 struct sigcontext __user *psc;
174 char retcode[8];
175 unsigned long extramask[_NSIG_WORDS-1];
176 struct sigcontext sc;
177};
178
179struct rt_sigframe
180{
181 char __user *pretcode;
182 int sig;
183 struct siginfo __user *pinfo;
184 void __user *puc;
185 char retcode[8];
186 struct siginfo info;
187 struct ucontext uc;
188};
189
190
191static unsigned char fpu_version; /* version number of fpu, set by setup_frame */
192
193static inline int restore_fpu_state(struct sigcontext *sc)
194{
195 int err = 1;
196
197 if (FPU_IS_EMU) {
198 /* restore registers */
199 memcpy(current->thread.fpcntl, sc->sc_fpcntl, 12);
200 memcpy(current->thread.fp, sc->sc_fpregs, 24);
201 return 0;
202 }
203
204 if (CPU_IS_060 ? sc->sc_fpstate[2] : sc->sc_fpstate[0]) {
205 /* Verify the frame format. */
206 if (!(CPU_IS_060 || CPU_IS_COLDFIRE) &&
207 (sc->sc_fpstate[0] != fpu_version))
208 goto out;
209 if (CPU_IS_020_OR_030) {
210 if (m68k_fputype & FPU_68881 &&
211 !(sc->sc_fpstate[1] == 0x18 || sc->sc_fpstate[1] == 0xb4))
212 goto out;
213 if (m68k_fputype & FPU_68882 &&
214 !(sc->sc_fpstate[1] == 0x38 || sc->sc_fpstate[1] == 0xd4))
215 goto out;
216 } else if (CPU_IS_040) {
217 if (!(sc->sc_fpstate[1] == 0x00 ||
218 sc->sc_fpstate[1] == 0x28 ||
219 sc->sc_fpstate[1] == 0x60))
220 goto out;
221 } else if (CPU_IS_060) {
222 if (!(sc->sc_fpstate[3] == 0x00 ||
223 sc->sc_fpstate[3] == 0x60 ||
224 sc->sc_fpstate[3] == 0xe0))
225 goto out;
226 } else if (CPU_IS_COLDFIRE) {
227 if (!(sc->sc_fpstate[0] == 0x00 ||
228 sc->sc_fpstate[0] == 0x05 ||
229 sc->sc_fpstate[0] == 0xe5))
230 goto out;
231 } else
232 goto out;
233
234 if (CPU_IS_COLDFIRE) {
235 __asm__ volatile ("fmovemd %0,%%fp0-%%fp1\n\t"
236 "fmovel %1,%%fpcr\n\t"
237 "fmovel %2,%%fpsr\n\t"
238 "fmovel %3,%%fpiar"
239 : /* no outputs */
240 : "m" (sc->sc_fpregs[0]),
241 "m" (sc->sc_fpcntl[0]),
242 "m" (sc->sc_fpcntl[1]),
243 "m" (sc->sc_fpcntl[2]));
244 } else {
245 __asm__ volatile (".chip 68k/68881\n\t"
246 "fmovemx %0,%%fp0-%%fp1\n\t"
247 "fmoveml %1,%%fpcr/%%fpsr/%%fpiar\n\t"
248 ".chip 68k"
249 : /* no outputs */
250 : "m" (*sc->sc_fpregs),
251 "m" (*sc->sc_fpcntl));
252 }
253 }
254
255 if (CPU_IS_COLDFIRE) {
256 __asm__ volatile ("frestore %0" : : "m" (*sc->sc_fpstate));
257 } else {
258 __asm__ volatile (".chip 68k/68881\n\t"
259 "frestore %0\n\t"
260 ".chip 68k"
261 : : "m" (*sc->sc_fpstate));
262 }
263 err = 0;
264
265out:
266 return err;
267}
268
269#define FPCONTEXT_SIZE 216
270#define uc_fpstate uc_filler[0]
271#define uc_formatvec uc_filler[FPCONTEXT_SIZE/4]
272#define uc_extra uc_filler[FPCONTEXT_SIZE/4+1]
273
274static inline int rt_restore_fpu_state(struct ucontext __user *uc)
275{
276 unsigned char fpstate[FPCONTEXT_SIZE];
277 int context_size = CPU_IS_060 ? 8 : (CPU_IS_COLDFIRE ? 12 : 0);
278 fpregset_t fpregs;
279 int err = 1;
280
281 if (FPU_IS_EMU) {
282 /* restore fpu control register */
283 if (__copy_from_user(current->thread.fpcntl,
284 uc->uc_mcontext.fpregs.f_fpcntl, 12))
285 goto out;
286 /* restore all other fpu register */
287 if (__copy_from_user(current->thread.fp,
288 uc->uc_mcontext.fpregs.f_fpregs, 96))
289 goto out;
290 return 0;
291 }
292
293 if (__get_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate))
294 goto out;
295 if (CPU_IS_060 ? fpstate[2] : fpstate[0]) {
296 if (!(CPU_IS_060 || CPU_IS_COLDFIRE))
297 context_size = fpstate[1];
298 /* Verify the frame format. */
299 if (!(CPU_IS_060 || CPU_IS_COLDFIRE) &&
300 (fpstate[0] != fpu_version))
301 goto out;
302 if (CPU_IS_020_OR_030) {
303 if (m68k_fputype & FPU_68881 &&
304 !(context_size == 0x18 || context_size == 0xb4))
305 goto out;
306 if (m68k_fputype & FPU_68882 &&
307 !(context_size == 0x38 || context_size == 0xd4))
308 goto out;
309 } else if (CPU_IS_040) {
310 if (!(context_size == 0x00 ||
311 context_size == 0x28 ||
312 context_size == 0x60))
313 goto out;
314 } else if (CPU_IS_060) {
315 if (!(fpstate[3] == 0x00 ||
316 fpstate[3] == 0x60 ||
317 fpstate[3] == 0xe0))
318 goto out;
319 } else if (CPU_IS_COLDFIRE) {
320 if (!(fpstate[3] == 0x00 ||
321 fpstate[3] == 0x05 ||
322 fpstate[3] == 0xe5))
323 goto out;
324 } else
325 goto out;
326 if (__copy_from_user(&fpregs, &uc->uc_mcontext.fpregs,
327 sizeof(fpregs)))
328 goto out;
329
330 if (CPU_IS_COLDFIRE) {
331 __asm__ volatile ("fmovemd %0,%%fp0-%%fp7\n\t"
332 "fmovel %1,%%fpcr\n\t"
333 "fmovel %2,%%fpsr\n\t"
334 "fmovel %3,%%fpiar"
335 : /* no outputs */
336 : "m" (fpregs.f_fpregs[0]),
337 "m" (fpregs.f_fpcntl[0]),
338 "m" (fpregs.f_fpcntl[1]),
339 "m" (fpregs.f_fpcntl[2]));
340 } else {
341 __asm__ volatile (".chip 68k/68881\n\t"
342 "fmovemx %0,%%fp0-%%fp7\n\t"
343 "fmoveml %1,%%fpcr/%%fpsr/%%fpiar\n\t"
344 ".chip 68k"
345 : /* no outputs */
346 : "m" (*fpregs.f_fpregs),
347 "m" (*fpregs.f_fpcntl));
348 }
349 }
350 if (context_size &&
351 __copy_from_user(fpstate + 4, (long __user *)&uc->uc_fpstate + 1,
352 context_size))
353 goto out;
354
355 if (CPU_IS_COLDFIRE) {
356 __asm__ volatile ("frestore %0" : : "m" (*fpstate));
357 } else {
358 __asm__ volatile (".chip 68k/68881\n\t"
359 "frestore %0\n\t"
360 ".chip 68k"
361 : : "m" (*fpstate));
362 }
363 err = 0;
364
365out:
366 return err;
367}
368
369static int mangle_kernel_stack(struct pt_regs *regs, int formatvec,
370 void __user *fp)
371{
372 int fsize = frame_extra_sizes[formatvec >> 12];
373 if (fsize < 0) {
374 /*
375 * user process trying to return with weird frame format
376 */
377#ifdef DEBUG
378 printk("user process returning with weird frame format\n");
379#endif
380 return 1;
381 }
382 if (!fsize) {
383 regs->format = formatvec >> 12;
384 regs->vector = formatvec & 0xfff;
385 } else {
386 struct switch_stack *sw = (struct switch_stack *)regs - 1;
387 unsigned long buf[fsize / 2]; /* yes, twice as much */
388
389 /* that'll make sure that expansion won't crap over data */
390 if (copy_from_user(buf + fsize / 4, fp, fsize))
391 return 1;
392
393 /* point of no return */
394 regs->format = formatvec >> 12;
395 regs->vector = formatvec & 0xfff;
396#define frame_offset (sizeof(struct pt_regs)+sizeof(struct switch_stack))
397 __asm__ __volatile__ (
398#ifdef CONFIG_COLDFIRE
399 " movel %0,%/sp\n\t"
400 " bra ret_from_signal\n"
401#else
402 " movel %0,%/a0\n\t"
403 " subl %1,%/a0\n\t" /* make room on stack */
404 " movel %/a0,%/sp\n\t" /* set stack pointer */
405 /* move switch_stack and pt_regs */
406 "1: movel %0@+,%/a0@+\n\t"
407 " dbra %2,1b\n\t"
408 " lea %/sp@(%c3),%/a0\n\t" /* add offset of fmt */
409 " lsrl #2,%1\n\t"
410 " subql #1,%1\n\t"
411 /* copy to the gap we'd made */
412 "2: movel %4@+,%/a0@+\n\t"
413 " dbra %1,2b\n\t"
414 " bral ret_from_signal\n"
415#endif
416 : /* no outputs, it doesn't ever return */
417 : "a" (sw), "d" (fsize), "d" (frame_offset/4-1),
418 "n" (frame_offset), "a" (buf + fsize/4)
419 : "a0");
420#undef frame_offset
421 }
422 return 0;
423}
424
425static inline int
426restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *usc, void __user *fp)
427{
428 int formatvec;
429 struct sigcontext context;
430 int err;
431
432 /* Always make any pending restarted system calls return -EINTR */
433 current_thread_info()->restart_block.fn = do_no_restart_syscall;
434
435 /* get previous context */
436 if (copy_from_user(&context, usc, sizeof(context)))
437 goto badframe;
438
439 /* restore passed registers */
440 regs->d0 = context.sc_d0;
441 regs->d1 = context.sc_d1;
442 regs->a0 = context.sc_a0;
443 regs->a1 = context.sc_a1;
444 regs->sr = (regs->sr & 0xff00) | (context.sc_sr & 0xff);
445 regs->pc = context.sc_pc;
446 regs->orig_d0 = -1; /* disable syscall checks */
447 wrusp(context.sc_usp);
448 formatvec = context.sc_formatvec;
449
450 err = restore_fpu_state(&context);
451
452 if (err || mangle_kernel_stack(regs, formatvec, fp))
453 goto badframe;
454
455 return 0;
456
457badframe:
458 return 1;
459}
460
461static inline int
462rt_restore_ucontext(struct pt_regs *regs, struct switch_stack *sw,
463 struct ucontext __user *uc)
464{
465 int temp;
466 greg_t __user *gregs = uc->uc_mcontext.gregs;
467 unsigned long usp;
468 int err;
469
470 /* Always make any pending restarted system calls return -EINTR */
471 current_thread_info()->restart_block.fn = do_no_restart_syscall;
472
473 err = __get_user(temp, &uc->uc_mcontext.version);
474 if (temp != MCONTEXT_VERSION)
475 goto badframe;
476 /* restore passed registers */
477 err |= __get_user(regs->d0, &gregs[0]);
478 err |= __get_user(regs->d1, &gregs[1]);
479 err |= __get_user(regs->d2, &gregs[2]);
480 err |= __get_user(regs->d3, &gregs[3]);
481 err |= __get_user(regs->d4, &gregs[4]);
482 err |= __get_user(regs->d5, &gregs[5]);
483 err |= __get_user(sw->d6, &gregs[6]);
484 err |= __get_user(sw->d7, &gregs[7]);
485 err |= __get_user(regs->a0, &gregs[8]);
486 err |= __get_user(regs->a1, &gregs[9]);
487 err |= __get_user(regs->a2, &gregs[10]);
488 err |= __get_user(sw->a3, &gregs[11]);
489 err |= __get_user(sw->a4, &gregs[12]);
490 err |= __get_user(sw->a5, &gregs[13]);
491 err |= __get_user(sw->a6, &gregs[14]);
492 err |= __get_user(usp, &gregs[15]);
493 wrusp(usp);
494 err |= __get_user(regs->pc, &gregs[16]);
495 err |= __get_user(temp, &gregs[17]);
496 regs->sr = (regs->sr & 0xff00) | (temp & 0xff);
497 regs->orig_d0 = -1; /* disable syscall checks */
498 err |= __get_user(temp, &uc->uc_formatvec);
499
500 err |= rt_restore_fpu_state(uc);
501
502 if (err || do_sigaltstack(&uc->uc_stack, NULL, usp) == -EFAULT)
503 goto badframe;
504
505 if (mangle_kernel_stack(regs, temp, &uc->uc_extra))
506 goto badframe;
507
508 return 0;
509
510badframe:
511 return 1;
512}
513
514asmlinkage int do_sigreturn(unsigned long __unused)
515{
516 struct switch_stack *sw = (struct switch_stack *) &__unused;
517 struct pt_regs *regs = (struct pt_regs *) (sw + 1);
518 unsigned long usp = rdusp();
519 struct sigframe __user *frame = (struct sigframe __user *)(usp - 4);
520 sigset_t set;
521
522 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
523 goto badframe;
524 if (__get_user(set.sig[0], &frame->sc.sc_mask) ||
525 (_NSIG_WORDS > 1 &&
526 __copy_from_user(&set.sig[1], &frame->extramask,
527 sizeof(frame->extramask))))
528 goto badframe;
529
530 sigdelsetmask(&set, ~_BLOCKABLE);
531 current->blocked = set;
532 recalc_sigpending();
533
534 if (restore_sigcontext(regs, &frame->sc, frame + 1))
535 goto badframe;
536 return regs->d0;
537
538badframe:
539 force_sig(SIGSEGV, current);
540 return 0;
541}
542
543asmlinkage int do_rt_sigreturn(unsigned long __unused)
544{
545 struct switch_stack *sw = (struct switch_stack *) &__unused;
546 struct pt_regs *regs = (struct pt_regs *) (sw + 1);
547 unsigned long usp = rdusp();
548 struct rt_sigframe __user *frame = (struct rt_sigframe __user *)(usp - 4);
549 sigset_t set;
550
551 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
552 goto badframe;
553 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
554 goto badframe;
555
556 sigdelsetmask(&set, ~_BLOCKABLE);
557 current->blocked = set;
558 recalc_sigpending();
559
560 if (rt_restore_ucontext(regs, sw, &frame->uc))
561 goto badframe;
562 return regs->d0;
563
564badframe:
565 force_sig(SIGSEGV, current);
566 return 0;
567}
568
569/*
570 * Set up a signal frame.
571 */
572
573static inline void save_fpu_state(struct sigcontext *sc, struct pt_regs *regs)
574{
575 if (FPU_IS_EMU) {
576 /* save registers */
577 memcpy(sc->sc_fpcntl, current->thread.fpcntl, 12);
578 memcpy(sc->sc_fpregs, current->thread.fp, 24);
579 return;
580 }
581
582 if (CPU_IS_COLDFIRE) {
583 __asm__ volatile ("fsave %0"
584 : : "m" (*sc->sc_fpstate) : "memory");
585 } else {
586 __asm__ volatile (".chip 68k/68881\n\t"
587 "fsave %0\n\t"
588 ".chip 68k"
589 : : "m" (*sc->sc_fpstate) : "memory");
590 }
591
592 if (CPU_IS_060 ? sc->sc_fpstate[2] : sc->sc_fpstate[0]) {
593 fpu_version = sc->sc_fpstate[0];
594 if (CPU_IS_020_OR_030 &&
595 regs->vector >= (VEC_FPBRUC * 4) &&
596 regs->vector <= (VEC_FPNAN * 4)) {
597 /* Clear pending exception in 68882 idle frame */
598 if (*(unsigned short *) sc->sc_fpstate == 0x1f38)
599 sc->sc_fpstate[0x38] |= 1 << 3;
600 }
601
602 if (CPU_IS_COLDFIRE) {
603 __asm__ volatile ("fmovemd %%fp0-%%fp1,%0\n\t"
604 "fmovel %%fpcr,%1\n\t"
605 "fmovel %%fpsr,%2\n\t"
606 "fmovel %%fpiar,%3"
607 : "=m" (sc->sc_fpregs[0]),
608 "=m" (sc->sc_fpcntl[0]),
609 "=m" (sc->sc_fpcntl[1]),
610 "=m" (sc->sc_fpcntl[2])
611 : /* no inputs */
612 : "memory");
613 } else {
614 __asm__ volatile (".chip 68k/68881\n\t"
615 "fmovemx %%fp0-%%fp1,%0\n\t"
616 "fmoveml %%fpcr/%%fpsr/%%fpiar,%1\n\t"
617 ".chip 68k"
618 : "=m" (*sc->sc_fpregs),
619 "=m" (*sc->sc_fpcntl)
620 : /* no inputs */
621 : "memory");
622 }
623 }
624}
625
626static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs *regs)
627{
628 unsigned char fpstate[FPCONTEXT_SIZE];
629 int context_size = CPU_IS_060 ? 8 : (CPU_IS_COLDFIRE ? 12 : 0);
630 int err = 0;
631
632 if (FPU_IS_EMU) {
633 /* save fpu control register */
634 err |= copy_to_user(uc->uc_mcontext.fpregs.f_fpcntl,
635 current->thread.fpcntl, 12);
636 /* save all other fpu register */
637 err |= copy_to_user(uc->uc_mcontext.fpregs.f_fpregs,
638 current->thread.fp, 96);
639 return err;
640 }
641
642 if (CPU_IS_COLDFIRE) {
643 __asm__ volatile ("fsave %0" : : "m" (*fpstate) : "memory");
644 } else {
645 __asm__ volatile (".chip 68k/68881\n\t"
646 "fsave %0\n\t"
647 ".chip 68k"
648 : : "m" (*fpstate) : "memory");
649 }
650
651 err |= __put_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate);
652 if (CPU_IS_060 ? fpstate[2] : fpstate[0]) {
653 fpregset_t fpregs;
654 if (!(CPU_IS_060 || CPU_IS_COLDFIRE))
655 context_size = fpstate[1];
656 fpu_version = fpstate[0];
657 if (CPU_IS_020_OR_030 &&
658 regs->vector >= (VEC_FPBRUC * 4) &&
659 regs->vector <= (VEC_FPNAN * 4)) {
660 /* Clear pending exception in 68882 idle frame */
661 if (*(unsigned short *) fpstate == 0x1f38)
662 fpstate[0x38] |= 1 << 3;
663 }
664 if (CPU_IS_COLDFIRE) {
665 __asm__ volatile ("fmovemd %%fp0-%%fp7,%0\n\t"
666 "fmovel %%fpcr,%1\n\t"
667 "fmovel %%fpsr,%2\n\t"
668 "fmovel %%fpiar,%3"
669 : "=m" (fpregs.f_fpregs[0]),
670 "=m" (fpregs.f_fpcntl[0]),
671 "=m" (fpregs.f_fpcntl[1]),
672 "=m" (fpregs.f_fpcntl[2])
673 : /* no inputs */
674 : "memory");
675 } else {
676 __asm__ volatile (".chip 68k/68881\n\t"
677 "fmovemx %%fp0-%%fp7,%0\n\t"
678 "fmoveml %%fpcr/%%fpsr/%%fpiar,%1\n\t"
679 ".chip 68k"
680 : "=m" (*fpregs.f_fpregs),
681 "=m" (*fpregs.f_fpcntl)
682 : /* no inputs */
683 : "memory");
684 }
685 err |= copy_to_user(&uc->uc_mcontext.fpregs, &fpregs,
686 sizeof(fpregs));
687 }
688 if (context_size)
689 err |= copy_to_user((long __user *)&uc->uc_fpstate + 1, fpstate + 4,
690 context_size);
691 return err;
692}
693
694static void setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs,
695 unsigned long mask)
696{
697 sc->sc_mask = mask;
698 sc->sc_usp = rdusp();
699 sc->sc_d0 = regs->d0;
700 sc->sc_d1 = regs->d1;
701 sc->sc_a0 = regs->a0;
702 sc->sc_a1 = regs->a1;
703 sc->sc_sr = regs->sr;
704 sc->sc_pc = regs->pc;
705 sc->sc_formatvec = regs->format << 12 | regs->vector;
706 save_fpu_state(sc, regs);
707}
708
709static inline int rt_setup_ucontext(struct ucontext __user *uc, struct pt_regs *regs)
710{
711 struct switch_stack *sw = (struct switch_stack *)regs - 1;
712 greg_t __user *gregs = uc->uc_mcontext.gregs;
713 int err = 0;
714
715 err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version);
716 err |= __put_user(regs->d0, &gregs[0]);
717 err |= __put_user(regs->d1, &gregs[1]);
718 err |= __put_user(regs->d2, &gregs[2]);
719 err |= __put_user(regs->d3, &gregs[3]);
720 err |= __put_user(regs->d4, &gregs[4]);
721 err |= __put_user(regs->d5, &gregs[5]);
722 err |= __put_user(sw->d6, &gregs[6]);
723 err |= __put_user(sw->d7, &gregs[7]);
724 err |= __put_user(regs->a0, &gregs[8]);
725 err |= __put_user(regs->a1, &gregs[9]);
726 err |= __put_user(regs->a2, &gregs[10]);
727 err |= __put_user(sw->a3, &gregs[11]);
728 err |= __put_user(sw->a4, &gregs[12]);
729 err |= __put_user(sw->a5, &gregs[13]);
730 err |= __put_user(sw->a6, &gregs[14]);
731 err |= __put_user(rdusp(), &gregs[15]);
732 err |= __put_user(regs->pc, &gregs[16]);
733 err |= __put_user(regs->sr, &gregs[17]);
734 err |= __put_user((regs->format << 12) | regs->vector, &uc->uc_formatvec);
735 err |= rt_save_fpu_state(uc, regs);
736 return err;
737}
738
739static inline void push_cache (unsigned long vaddr)
740{
741 /*
742 * Using the old cache_push_v() was really a big waste.
743 *
744 * What we are trying to do is to flush 8 bytes to ram.
745 * Flushing 2 cache lines of 16 bytes is much cheaper than
746 * flushing 1 or 2 pages, as previously done in
747 * cache_push_v().
748 * Jes
749 */
750 if (CPU_IS_040) {
751 unsigned long temp;
752
753 __asm__ __volatile__ (".chip 68040\n\t"
754 "nop\n\t"
755 "ptestr (%1)\n\t"
756 "movec %%mmusr,%0\n\t"
757 ".chip 68k"
758 : "=r" (temp)
759 : "a" (vaddr));
760
761 temp &= PAGE_MASK;
762 temp |= vaddr & ~PAGE_MASK;
763
764 __asm__ __volatile__ (".chip 68040\n\t"
765 "nop\n\t"
766 "cpushl %%bc,(%0)\n\t"
767 ".chip 68k"
768 : : "a" (temp));
769 }
770 else if (CPU_IS_060) {
771 unsigned long temp;
772 __asm__ __volatile__ (".chip 68060\n\t"
773 "plpar (%0)\n\t"
774 ".chip 68k"
775 : "=a" (temp)
776 : "0" (vaddr));
777 __asm__ __volatile__ (".chip 68060\n\t"
778 "cpushl %%bc,(%0)\n\t"
779 ".chip 68k"
780 : : "a" (temp));
781 } else if (!CPU_IS_COLDFIRE) {
782 /*
783 * 68030/68020 have no writeback cache;
784 * still need to clear icache.
785 * Note that vaddr is guaranteed to be long word aligned.
786 */
787 unsigned long temp;
788 asm volatile ("movec %%cacr,%0" : "=r" (temp));
789 temp += 4;
790 asm volatile ("movec %0,%%caar\n\t"
791 "movec %1,%%cacr"
792 : : "r" (vaddr), "r" (temp));
793 asm volatile ("movec %0,%%caar\n\t"
794 "movec %1,%%cacr"
795 : : "r" (vaddr + 4), "r" (temp));
796 }
797}
798
799static inline void __user *
800get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
801{
802 unsigned long usp;
803
804 /* Default to using normal stack. */
805 usp = rdusp();
806
807 /* This is the X/Open sanctioned signal stack switching. */
808 if (ka->sa.sa_flags & SA_ONSTACK) {
809 if (!sas_ss_flags(usp))
810 usp = current->sas_ss_sp + current->sas_ss_size;
811 }
812 return (void __user *)((usp - frame_size) & -8UL);
813}
814
815static int setup_frame (int sig, struct k_sigaction *ka,
816 sigset_t *set, struct pt_regs *regs)
817{
818 struct sigframe __user *frame;
819 int fsize = frame_extra_sizes[regs->format];
820 struct sigcontext context;
821 int err = 0;
822
823 if (fsize < 0) {
824#ifdef DEBUG
825 printk ("setup_frame: Unknown frame format %#x\n",
826 regs->format);
827#endif
828 goto give_sigsegv;
829 }
830
831 frame = get_sigframe(ka, regs, sizeof(*frame) + fsize);
832
833 if (fsize)
834 err |= copy_to_user (frame + 1, regs + 1, fsize);
835
836 err |= __put_user((current_thread_info()->exec_domain
837 && current_thread_info()->exec_domain->signal_invmap
838 && sig < 32
839 ? current_thread_info()->exec_domain->signal_invmap[sig]
840 : sig),
841 &frame->sig);
842
843 err |= __put_user(regs->vector, &frame->code);
844 err |= __put_user(&frame->sc, &frame->psc);
845
846 if (_NSIG_WORDS > 1)
847 err |= copy_to_user(frame->extramask, &set->sig[1],
848 sizeof(frame->extramask));
849
850 setup_sigcontext(&context, regs, set->sig[0]);
851 err |= copy_to_user (&frame->sc, &context, sizeof(context));
852
853 /* Set up to return from userspace. */
854 err |= __put_user(frame->retcode, &frame->pretcode);
855 /* moveq #,d0; trap #0 */
856 err |= __put_user(0x70004e40 + (__NR_sigreturn << 16),
857 (long __user *)(frame->retcode));
858
859 if (err)
860 goto give_sigsegv;
861
862 push_cache ((unsigned long) &frame->retcode);
863
864 /*
865 * Set up registers for signal handler. All the state we are about
866 * to destroy is successfully copied to sigframe.
867 */
868 wrusp ((unsigned long) frame);
869 regs->pc = (unsigned long) ka->sa.sa_handler;
870
871 /*
872 * This is subtle; if we build more than one sigframe, all but the
873 * first one will see frame format 0 and have fsize == 0, so we won't
874 * screw stkadj.
875 */
876 if (fsize)
877 regs->stkadj = fsize;
878
879 /* Prepare to skip over the extra stuff in the exception frame. */
880 if (regs->stkadj) {
881 struct pt_regs *tregs =
882 (struct pt_regs *)((ulong)regs + regs->stkadj);
883#ifdef DEBUG
884 printk("Performing stackadjust=%04x\n", regs->stkadj);
885#endif
886 /* This must be copied with decreasing addresses to
887 handle overlaps. */
888 tregs->vector = 0;
889 tregs->format = 0;
890 tregs->pc = regs->pc;
891 tregs->sr = regs->sr;
892 }
893 return 0;
894
895give_sigsegv:
896 force_sigsegv(sig, current);
897 return err;
898}
899
900static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
901 sigset_t *set, struct pt_regs *regs)
902{
903 struct rt_sigframe __user *frame;
904 int fsize = frame_extra_sizes[regs->format];
905 int err = 0;
906
907 if (fsize < 0) {
908#ifdef DEBUG
909 printk ("setup_frame: Unknown frame format %#x\n",
910 regs->format);
911#endif
912 goto give_sigsegv;
913 }
914
915 frame = get_sigframe(ka, regs, sizeof(*frame));
916
917 if (fsize)
918 err |= copy_to_user (&frame->uc.uc_extra, regs + 1, fsize);
919
920 err |= __put_user((current_thread_info()->exec_domain
921 && current_thread_info()->exec_domain->signal_invmap
922 && sig < 32
923 ? current_thread_info()->exec_domain->signal_invmap[sig]
924 : sig),
925 &frame->sig);
926 err |= __put_user(&frame->info, &frame->pinfo);
927 err |= __put_user(&frame->uc, &frame->puc);
928 err |= copy_siginfo_to_user(&frame->info, info);
929
930 /* Create the ucontext. */
931 err |= __put_user(0, &frame->uc.uc_flags);
932 err |= __put_user(NULL, &frame->uc.uc_link);
933 err |= __put_user((void __user *)current->sas_ss_sp,
934 &frame->uc.uc_stack.ss_sp);
935 err |= __put_user(sas_ss_flags(rdusp()),
936 &frame->uc.uc_stack.ss_flags);
937 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
938 err |= rt_setup_ucontext(&frame->uc, regs);
939 err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set));
940
941 /* Set up to return from userspace. */
942 err |= __put_user(frame->retcode, &frame->pretcode);
943#ifdef __mcoldfire__
944 /* movel #__NR_rt_sigreturn,d0; trap #0 */
945 err |= __put_user(0x203c0000, (long __user *)(frame->retcode + 0));
946 err |= __put_user(0x00004e40 + (__NR_rt_sigreturn << 16),
947 (long __user *)(frame->retcode + 4));
948#else
949 /* moveq #,d0; notb d0; trap #0 */
950 err |= __put_user(0x70004600 + ((__NR_rt_sigreturn ^ 0xff) << 16),
951 (long __user *)(frame->retcode + 0));
952 err |= __put_user(0x4e40, (short __user *)(frame->retcode + 4));
953#endif
954
955 if (err)
956 goto give_sigsegv;
957
958 push_cache ((unsigned long) &frame->retcode);
959
960 /*
961 * Set up registers for signal handler. All the state we are about
962 * to destroy is successfully copied to sigframe.
963 */
964 wrusp ((unsigned long) frame);
965 regs->pc = (unsigned long) ka->sa.sa_handler;
966
967 /*
968 * This is subtle; if we build more than one sigframe, all but the
969 * first one will see frame format 0 and have fsize == 0, so we won't
970 * screw stkadj.
971 */
972 if (fsize)
973 regs->stkadj = fsize;
974
975 /* Prepare to skip over the extra stuff in the exception frame. */
976 if (regs->stkadj) {
977 struct pt_regs *tregs =
978 (struct pt_regs *)((ulong)regs + regs->stkadj);
979#ifdef DEBUG
980 printk("Performing stackadjust=%04x\n", regs->stkadj);
981#endif
982 /* This must be copied with decreasing addresses to
983 handle overlaps. */
984 tregs->vector = 0;
985 tregs->format = 0;
986 tregs->pc = regs->pc;
987 tregs->sr = regs->sr;
988 }
989 return 0;
990
991give_sigsegv:
992 force_sigsegv(sig, current);
993 return err;
994}
995
996static inline void
997handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
998{
999 switch (regs->d0) {
1000 case -ERESTARTNOHAND:
1001 if (!has_handler)
1002 goto do_restart;
1003 regs->d0 = -EINTR;
1004 break;
1005
1006 case -ERESTART_RESTARTBLOCK:
1007 if (!has_handler) {
1008 regs->d0 = __NR_restart_syscall;
1009 regs->pc -= 2;
1010 break;
1011 }
1012 regs->d0 = -EINTR;
1013 break;
1014
1015 case -ERESTARTSYS:
1016 if (has_handler && !(ka->sa.sa_flags & SA_RESTART)) {
1017 regs->d0 = -EINTR;
1018 break;
1019 }
1020 /* fallthrough */
1021 case -ERESTARTNOINTR:
1022 do_restart:
1023 regs->d0 = regs->orig_d0;
1024 regs->pc -= 2;
1025 break;
1026 }
1027}
1028
1029void ptrace_signal_deliver(struct pt_regs *regs, void *cookie)
1030{
1031 if (regs->orig_d0 < 0)
1032 return;
1033 switch (regs->d0) {
1034 case -ERESTARTNOHAND:
1035 case -ERESTARTSYS:
1036 case -ERESTARTNOINTR:
1037 regs->d0 = regs->orig_d0;
1038 regs->orig_d0 = -1;
1039 regs->pc -= 2;
1040 break;
1041 }
1042}
1043
1044/*
1045 * OK, we're invoking a handler
1046 */
1047static void
1048handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
1049 sigset_t *oldset, struct pt_regs *regs)
1050{
1051 int err;
1052 /* are we from a system call? */
1053 if (regs->orig_d0 >= 0)
1054 /* If so, check system call restarting.. */
1055 handle_restart(regs, ka, 1);
1056
1057 /* set up the stack frame */
1058 if (ka->sa.sa_flags & SA_SIGINFO)
1059 err = setup_rt_frame(sig, ka, info, oldset, regs);
1060 else
1061 err = setup_frame(sig, ka, oldset, regs);
1062
1063 if (err)
1064 return;
1065
1066 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
1067 if (!(ka->sa.sa_flags & SA_NODEFER))
1068 sigaddset(&current->blocked,sig);
1069 recalc_sigpending();
1070
1071 if (test_thread_flag(TIF_DELAYED_TRACE)) {
1072 regs->sr &= ~0x8000;
1073 send_sig(SIGTRAP, current, 1);
1074 }
1075
1076 clear_thread_flag(TIF_RESTORE_SIGMASK);
1077}
1078
1079/*
1080 * Note that 'init' is a special process: it doesn't get signals it doesn't
1081 * want to handle. Thus you cannot kill init even with a SIGKILL even by
1082 * mistake.
1083 */
1084asmlinkage void do_signal(struct pt_regs *regs)
1085{
1086 siginfo_t info;
1087 struct k_sigaction ka;
1088 int signr;
1089 sigset_t *oldset;
1090
1091 current->thread.esp0 = (unsigned long) regs;
1092
1093 if (test_thread_flag(TIF_RESTORE_SIGMASK))
1094 oldset = &current->saved_sigmask;
1095 else
1096 oldset = &current->blocked;
1097
1098 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
1099 if (signr > 0) {
1100 /* Whee! Actually deliver the signal. */
1101 handle_signal(signr, &ka, &info, oldset, regs);
1102 return;
1103 }
1104
1105 /* Did we come from a system call? */
1106 if (regs->orig_d0 >= 0)
1107 /* Restart the system call - no handlers present */
1108 handle_restart(regs, NULL, 0);
1109
1110 /* If there's no signal to deliver, we just restore the saved mask. */
1111 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
1112 clear_thread_flag(TIF_RESTORE_SIGMASK);
1113 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
1114 }
1115}
diff --git a/arch/m68k/kernel/signal_no.c b/arch/m68k/kernel/signal_no.c
deleted file mode 100644
index 36a81bb6835a..000000000000
--- a/arch/m68k/kernel/signal_no.c
+++ /dev/null
@@ -1,765 +0,0 @@
1/*
2 * linux/arch/m68knommu/kernel/signal.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10
11/*
12 * Linux/m68k support by Hamish Macdonald
13 *
14 * 68060 fixes by Jesper Skov
15 *
16 * 1997-12-01 Modified for POSIX.1b signals by Andreas Schwab
17 *
18 * mathemu support by Roman Zippel
19 * (Note: fpstate in the signal context is completely ignored for the emulator
20 * and the internal floating point format is put on stack)
21 */
22
23/*
24 * ++roman (07/09/96): implemented signal stacks (specially for tosemu on
25 * Atari :-) Current limitation: Only one sigstack can be active at one time.
26 * If a second signal with SA_ONSTACK set arrives while working on a sigstack,
27 * SA_ONSTACK is ignored. This behaviour avoids lots of trouble with nested
28 * signal handlers!
29 */
30
31#include <linux/sched.h>
32#include <linux/mm.h>
33#include <linux/kernel.h>
34#include <linux/signal.h>
35#include <linux/syscalls.h>
36#include <linux/errno.h>
37#include <linux/wait.h>
38#include <linux/ptrace.h>
39#include <linux/unistd.h>
40#include <linux/stddef.h>
41#include <linux/highuid.h>
42#include <linux/tty.h>
43#include <linux/personality.h>
44#include <linux/binfmts.h>
45
46#include <asm/setup.h>
47#include <asm/uaccess.h>
48#include <asm/pgtable.h>
49#include <asm/traps.h>
50#include <asm/ucontext.h>
51
52#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
53
54void ret_from_user_signal(void);
55void ret_from_user_rt_signal(void);
56
57/*
58 * Atomically swap in the new signal mask, and wait for a signal.
59 */
60asmlinkage int
61sys_sigsuspend(int unused0, int unused1, old_sigset_t mask)
62{
63 mask &= _BLOCKABLE;
64 spin_lock_irq(&current->sighand->siglock);
65 current->saved_sigmask = current->blocked;
66 siginitset(&current->blocked, mask);
67 recalc_sigpending();
68 spin_unlock_irq(&current->sighand->siglock);
69
70 current->state = TASK_INTERRUPTIBLE;
71 schedule();
72 set_restore_sigmask();
73
74 return -ERESTARTNOHAND;
75}
76
77asmlinkage int
78sys_sigaction(int sig, const struct old_sigaction __user *act,
79 struct old_sigaction __user *oact)
80{
81 struct k_sigaction new_ka, old_ka;
82 int ret;
83
84 if (act) {
85 old_sigset_t mask;
86 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
87 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
88 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) ||
89 __get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
90 __get_user(mask, &act->sa_mask))
91 return -EFAULT;
92 siginitset(&new_ka.sa.sa_mask, mask);
93 }
94
95 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
96
97 if (!ret && oact) {
98 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
99 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
100 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) ||
101 __put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
102 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
103 return -EFAULT;
104 }
105
106 return ret;
107}
108
109asmlinkage int
110sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
111{
112 return do_sigaltstack(uss, uoss, rdusp());
113}
114
115
116/*
117 * Do a signal return; undo the signal stack.
118 *
119 * Keep the return code on the stack quadword aligned!
120 * That makes the cache flush below easier.
121 */
122
123struct sigframe
124{
125 char __user *pretcode;
126 int sig;
127 int code;
128 struct sigcontext __user *psc;
129 char retcode[8];
130 unsigned long extramask[_NSIG_WORDS-1];
131 struct sigcontext sc;
132};
133
134struct rt_sigframe
135{
136 char __user *pretcode;
137 int sig;
138 struct siginfo __user *pinfo;
139 void __user *puc;
140 char retcode[8];
141 struct siginfo info;
142 struct ucontext uc;
143};
144
145#ifdef CONFIG_FPU
146
147static unsigned char fpu_version = 0; /* version number of fpu, set by setup_frame */
148
149static inline int restore_fpu_state(struct sigcontext *sc)
150{
151 int err = 1;
152
153 if (FPU_IS_EMU) {
154 /* restore registers */
155 memcpy(current->thread.fpcntl, sc->sc_fpcntl, 12);
156 memcpy(current->thread.fp, sc->sc_fpregs, 24);
157 return 0;
158 }
159
160 if (sc->sc_fpstate[0]) {
161 /* Verify the frame format. */
162 if (sc->sc_fpstate[0] != fpu_version)
163 goto out;
164
165 __asm__ volatile (".chip 68k/68881\n\t"
166 "fmovemx %0,%%fp0-%%fp1\n\t"
167 "fmoveml %1,%%fpcr/%%fpsr/%%fpiar\n\t"
168 ".chip 68k"
169 : /* no outputs */
170 : "m" (*sc->sc_fpregs), "m" (*sc->sc_fpcntl));
171 }
172 __asm__ volatile (".chip 68k/68881\n\t"
173 "frestore %0\n\t"
174 ".chip 68k" : : "m" (*sc->sc_fpstate));
175 err = 0;
176
177out:
178 return err;
179}
180
181#define FPCONTEXT_SIZE 216
182#define uc_fpstate uc_filler[0]
183#define uc_formatvec uc_filler[FPCONTEXT_SIZE/4]
184#define uc_extra uc_filler[FPCONTEXT_SIZE/4+1]
185
186static inline int rt_restore_fpu_state(struct ucontext __user *uc)
187{
188 unsigned char fpstate[FPCONTEXT_SIZE];
189 int context_size = 0;
190 fpregset_t fpregs;
191 int err = 1;
192
193 if (FPU_IS_EMU) {
194 /* restore fpu control register */
195 if (__copy_from_user(current->thread.fpcntl,
196 uc->uc_mcontext.fpregs.f_fpcntl, 12))
197 goto out;
198 /* restore all other fpu register */
199 if (__copy_from_user(current->thread.fp,
200 uc->uc_mcontext.fpregs.f_fpregs, 96))
201 goto out;
202 return 0;
203 }
204
205 if (__get_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate))
206 goto out;
207 if (fpstate[0]) {
208 context_size = fpstate[1];
209
210 /* Verify the frame format. */
211 if (fpstate[0] != fpu_version)
212 goto out;
213 if (__copy_from_user(&fpregs, &uc->uc_mcontext.fpregs,
214 sizeof(fpregs)))
215 goto out;
216 __asm__ volatile (".chip 68k/68881\n\t"
217 "fmovemx %0,%%fp0-%%fp7\n\t"
218 "fmoveml %1,%%fpcr/%%fpsr/%%fpiar\n\t"
219 ".chip 68k"
220 : /* no outputs */
221 : "m" (*fpregs.f_fpregs),
222 "m" (*fpregs.f_fpcntl));
223 }
224 if (context_size &&
225 __copy_from_user(fpstate + 4, (long __user *)&uc->uc_fpstate + 1,
226 context_size))
227 goto out;
228 __asm__ volatile (".chip 68k/68881\n\t"
229 "frestore %0\n\t"
230 ".chip 68k" : : "m" (*fpstate));
231 err = 0;
232
233out:
234 return err;
235}
236
237#endif
238
239static inline int
240restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *usc, void __user *fp,
241 int *pd0)
242{
243 int formatvec;
244 struct sigcontext context;
245 int err = 0;
246
247 /* Always make any pending restarted system calls return -EINTR */
248 current_thread_info()->restart_block.fn = do_no_restart_syscall;
249
250 /* get previous context */
251 if (copy_from_user(&context, usc, sizeof(context)))
252 goto badframe;
253
254 /* restore passed registers */
255 regs->d1 = context.sc_d1;
256 regs->a0 = context.sc_a0;
257 regs->a1 = context.sc_a1;
258 ((struct switch_stack *)regs - 1)->a5 = context.sc_a5;
259 regs->sr = (regs->sr & 0xff00) | (context.sc_sr & 0xff);
260 regs->pc = context.sc_pc;
261 regs->orig_d0 = -1; /* disable syscall checks */
262 wrusp(context.sc_usp);
263 formatvec = context.sc_formatvec;
264 regs->format = formatvec >> 12;
265 regs->vector = formatvec & 0xfff;
266
267#ifdef CONFIG_FPU
268 err = restore_fpu_state(&context);
269#endif
270
271 *pd0 = context.sc_d0;
272 return err;
273
274badframe:
275 return 1;
276}
277
278static inline int
279rt_restore_ucontext(struct pt_regs *regs, struct switch_stack *sw,
280 struct ucontext __user *uc, int *pd0)
281{
282 int temp;
283 greg_t __user *gregs = uc->uc_mcontext.gregs;
284 unsigned long usp;
285 int err;
286
287 /* Always make any pending restarted system calls return -EINTR */
288 current_thread_info()->restart_block.fn = do_no_restart_syscall;
289
290 err = __get_user(temp, &uc->uc_mcontext.version);
291 if (temp != MCONTEXT_VERSION)
292 goto badframe;
293 /* restore passed registers */
294 err |= __get_user(regs->d0, &gregs[0]);
295 err |= __get_user(regs->d1, &gregs[1]);
296 err |= __get_user(regs->d2, &gregs[2]);
297 err |= __get_user(regs->d3, &gregs[3]);
298 err |= __get_user(regs->d4, &gregs[4]);
299 err |= __get_user(regs->d5, &gregs[5]);
300 err |= __get_user(sw->d6, &gregs[6]);
301 err |= __get_user(sw->d7, &gregs[7]);
302 err |= __get_user(regs->a0, &gregs[8]);
303 err |= __get_user(regs->a1, &gregs[9]);
304 err |= __get_user(regs->a2, &gregs[10]);
305 err |= __get_user(sw->a3, &gregs[11]);
306 err |= __get_user(sw->a4, &gregs[12]);
307 err |= __get_user(sw->a5, &gregs[13]);
308 err |= __get_user(sw->a6, &gregs[14]);
309 err |= __get_user(usp, &gregs[15]);
310 wrusp(usp);
311 err |= __get_user(regs->pc, &gregs[16]);
312 err |= __get_user(temp, &gregs[17]);
313 regs->sr = (regs->sr & 0xff00) | (temp & 0xff);
314 regs->orig_d0 = -1; /* disable syscall checks */
315 regs->format = temp >> 12;
316 regs->vector = temp & 0xfff;
317
318 if (do_sigaltstack(&uc->uc_stack, NULL, usp) == -EFAULT)
319 goto badframe;
320
321 *pd0 = regs->d0;
322 return err;
323
324badframe:
325 return 1;
326}
327
328asmlinkage int do_sigreturn(unsigned long __unused)
329{
330 struct switch_stack *sw = (struct switch_stack *) &__unused;
331 struct pt_regs *regs = (struct pt_regs *) (sw + 1);
332 unsigned long usp = rdusp();
333 struct sigframe __user *frame = (struct sigframe __user *)(usp - 4);
334 sigset_t set;
335 int d0;
336
337 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
338 goto badframe;
339 if (__get_user(set.sig[0], &frame->sc.sc_mask) ||
340 (_NSIG_WORDS > 1 &&
341 __copy_from_user(&set.sig[1], &frame->extramask,
342 sizeof(frame->extramask))))
343 goto badframe;
344
345 sigdelsetmask(&set, ~_BLOCKABLE);
346 spin_lock_irq(&current->sighand->siglock);
347 current->blocked = set;
348 recalc_sigpending();
349 spin_unlock_irq(&current->sighand->siglock);
350
351 if (restore_sigcontext(regs, &frame->sc, frame + 1, &d0))
352 goto badframe;
353 return d0;
354
355badframe:
356 force_sig(SIGSEGV, current);
357 return 0;
358}
359
360asmlinkage int do_rt_sigreturn(unsigned long __unused)
361{
362 struct switch_stack *sw = (struct switch_stack *) &__unused;
363 struct pt_regs *regs = (struct pt_regs *) (sw + 1);
364 unsigned long usp = rdusp();
365 struct rt_sigframe __user *frame = (struct rt_sigframe __user *)(usp - 4);
366 sigset_t set;
367 int d0;
368
369 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
370 goto badframe;
371 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
372 goto badframe;
373
374 sigdelsetmask(&set, ~_BLOCKABLE);
375 spin_lock_irq(&current->sighand->siglock);
376 current->blocked = set;
377 recalc_sigpending();
378 spin_unlock_irq(&current->sighand->siglock);
379
380 if (rt_restore_ucontext(regs, sw, &frame->uc, &d0))
381 goto badframe;
382 return d0;
383
384badframe:
385 force_sig(SIGSEGV, current);
386 return 0;
387}
388
389#ifdef CONFIG_FPU
390/*
391 * Set up a signal frame.
392 */
393
394static inline void save_fpu_state(struct sigcontext *sc, struct pt_regs *regs)
395{
396 if (FPU_IS_EMU) {
397 /* save registers */
398 memcpy(sc->sc_fpcntl, current->thread.fpcntl, 12);
399 memcpy(sc->sc_fpregs, current->thread.fp, 24);
400 return;
401 }
402
403 __asm__ volatile (".chip 68k/68881\n\t"
404 "fsave %0\n\t"
405 ".chip 68k"
406 : : "m" (*sc->sc_fpstate) : "memory");
407
408 if (sc->sc_fpstate[0]) {
409 fpu_version = sc->sc_fpstate[0];
410 __asm__ volatile (".chip 68k/68881\n\t"
411 "fmovemx %%fp0-%%fp1,%0\n\t"
412 "fmoveml %%fpcr/%%fpsr/%%fpiar,%1\n\t"
413 ".chip 68k"
414 : "=m" (*sc->sc_fpregs),
415 "=m" (*sc->sc_fpcntl)
416 : /* no inputs */
417 : "memory");
418 }
419}
420
421static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs *regs)
422{
423 unsigned char fpstate[FPCONTEXT_SIZE];
424 int context_size = 0;
425 int err = 0;
426
427 if (FPU_IS_EMU) {
428 /* save fpu control register */
429 err |= copy_to_user(uc->uc_mcontext.fpregs.f_pcntl,
430 current->thread.fpcntl, 12);
431 /* save all other fpu register */
432 err |= copy_to_user(uc->uc_mcontext.fpregs.f_fpregs,
433 current->thread.fp, 96);
434 return err;
435 }
436
437 __asm__ volatile (".chip 68k/68881\n\t"
438 "fsave %0\n\t"
439 ".chip 68k"
440 : : "m" (*fpstate) : "memory");
441
442 err |= __put_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate);
443 if (fpstate[0]) {
444 fpregset_t fpregs;
445 context_size = fpstate[1];
446 fpu_version = fpstate[0];
447 __asm__ volatile (".chip 68k/68881\n\t"
448 "fmovemx %%fp0-%%fp7,%0\n\t"
449 "fmoveml %%fpcr/%%fpsr/%%fpiar,%1\n\t"
450 ".chip 68k"
451 : "=m" (*fpregs.f_fpregs),
452 "=m" (*fpregs.f_fpcntl)
453 : /* no inputs */
454 : "memory");
455 err |= copy_to_user(&uc->uc_mcontext.fpregs, &fpregs,
456 sizeof(fpregs));
457 }
458 if (context_size)
459 err |= copy_to_user((long __user *)&uc->uc_fpstate + 1, fpstate + 4,
460 context_size);
461 return err;
462}
463
464#endif
465
466static void setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs,
467 unsigned long mask)
468{
469 sc->sc_mask = mask;
470 sc->sc_usp = rdusp();
471 sc->sc_d0 = regs->d0;
472 sc->sc_d1 = regs->d1;
473 sc->sc_a0 = regs->a0;
474 sc->sc_a1 = regs->a1;
475 sc->sc_a5 = ((struct switch_stack *)regs - 1)->a5;
476 sc->sc_sr = regs->sr;
477 sc->sc_pc = regs->pc;
478 sc->sc_formatvec = regs->format << 12 | regs->vector;
479#ifdef CONFIG_FPU
480 save_fpu_state(sc, regs);
481#endif
482}
483
484static inline int rt_setup_ucontext(struct ucontext __user *uc, struct pt_regs *regs)
485{
486 struct switch_stack *sw = (struct switch_stack *)regs - 1;
487 greg_t __user *gregs = uc->uc_mcontext.gregs;
488 int err = 0;
489
490 err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version);
491 err |= __put_user(regs->d0, &gregs[0]);
492 err |= __put_user(regs->d1, &gregs[1]);
493 err |= __put_user(regs->d2, &gregs[2]);
494 err |= __put_user(regs->d3, &gregs[3]);
495 err |= __put_user(regs->d4, &gregs[4]);
496 err |= __put_user(regs->d5, &gregs[5]);
497 err |= __put_user(sw->d6, &gregs[6]);
498 err |= __put_user(sw->d7, &gregs[7]);
499 err |= __put_user(regs->a0, &gregs[8]);
500 err |= __put_user(regs->a1, &gregs[9]);
501 err |= __put_user(regs->a2, &gregs[10]);
502 err |= __put_user(sw->a3, &gregs[11]);
503 err |= __put_user(sw->a4, &gregs[12]);
504 err |= __put_user(sw->a5, &gregs[13]);
505 err |= __put_user(sw->a6, &gregs[14]);
506 err |= __put_user(rdusp(), &gregs[15]);
507 err |= __put_user(regs->pc, &gregs[16]);
508 err |= __put_user(regs->sr, &gregs[17]);
509#ifdef CONFIG_FPU
510 err |= rt_save_fpu_state(uc, regs);
511#endif
512 return err;
513}
514
515static inline void __user *
516get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
517{
518 unsigned long usp;
519
520 /* Default to using normal stack. */
521 usp = rdusp();
522
523 /* This is the X/Open sanctioned signal stack switching. */
524 if (ka->sa.sa_flags & SA_ONSTACK) {
525 if (!sas_ss_flags(usp))
526 usp = current->sas_ss_sp + current->sas_ss_size;
527 }
528 return (void __user *)((usp - frame_size) & -8UL);
529}
530
531static int setup_frame (int sig, struct k_sigaction *ka,
532 sigset_t *set, struct pt_regs *regs)
533{
534 struct sigframe __user *frame;
535 struct sigcontext context;
536 int err = 0;
537
538 frame = get_sigframe(ka, regs, sizeof(*frame));
539
540 err |= __put_user((current_thread_info()->exec_domain
541 && current_thread_info()->exec_domain->signal_invmap
542 && sig < 32
543 ? current_thread_info()->exec_domain->signal_invmap[sig]
544 : sig),
545 &frame->sig);
546
547 err |= __put_user(regs->vector, &frame->code);
548 err |= __put_user(&frame->sc, &frame->psc);
549
550 if (_NSIG_WORDS > 1)
551 err |= copy_to_user(frame->extramask, &set->sig[1],
552 sizeof(frame->extramask));
553
554 setup_sigcontext(&context, regs, set->sig[0]);
555 err |= copy_to_user (&frame->sc, &context, sizeof(context));
556
557 /* Set up to return from userspace. */
558 err |= __put_user((void *) ret_from_user_signal, &frame->pretcode);
559
560 if (err)
561 goto give_sigsegv;
562
563 /* Set up registers for signal handler */
564 wrusp ((unsigned long) frame);
565 regs->pc = (unsigned long) ka->sa.sa_handler;
566 ((struct switch_stack *)regs - 1)->a5 = current->mm->start_data;
567 regs->format = 0x4; /*set format byte to make stack appear modulo 4
568 which it will be when doing the rte */
569
570adjust_stack:
571 /* Prepare to skip over the extra stuff in the exception frame. */
572 if (regs->stkadj) {
573 struct pt_regs *tregs =
574 (struct pt_regs *)((ulong)regs + regs->stkadj);
575#if defined(DEBUG)
576 printk(KERN_DEBUG "Performing stackadjust=%04x\n", regs->stkadj);
577#endif
578 /* This must be copied with decreasing addresses to
579 handle overlaps. */
580 tregs->vector = 0;
581 tregs->format = 0;
582 tregs->pc = regs->pc;
583 tregs->sr = regs->sr;
584 }
585 return err;
586
587give_sigsegv:
588 force_sigsegv(sig, current);
589 goto adjust_stack;
590}
591
592static int setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
593 sigset_t *set, struct pt_regs *regs)
594{
595 struct rt_sigframe __user *frame;
596 int err = 0;
597
598 frame = get_sigframe(ka, regs, sizeof(*frame));
599
600 err |= __put_user((current_thread_info()->exec_domain
601 && current_thread_info()->exec_domain->signal_invmap
602 && sig < 32
603 ? current_thread_info()->exec_domain->signal_invmap[sig]
604 : sig),
605 &frame->sig);
606 err |= __put_user(&frame->info, &frame->pinfo);
607 err |= __put_user(&frame->uc, &frame->puc);
608 err |= copy_siginfo_to_user(&frame->info, info);
609
610 /* Create the ucontext. */
611 err |= __put_user(0, &frame->uc.uc_flags);
612 err |= __put_user(NULL, &frame->uc.uc_link);
613 err |= __put_user((void __user *)current->sas_ss_sp,
614 &frame->uc.uc_stack.ss_sp);
615 err |= __put_user(sas_ss_flags(rdusp()),
616 &frame->uc.uc_stack.ss_flags);
617 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
618 err |= rt_setup_ucontext(&frame->uc, regs);
619 err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set));
620
621 /* Set up to return from userspace. */
622 err |= __put_user((void *) ret_from_user_rt_signal, &frame->pretcode);
623
624 if (err)
625 goto give_sigsegv;
626
627 /* Set up registers for signal handler */
628 wrusp ((unsigned long) frame);
629 regs->pc = (unsigned long) ka->sa.sa_handler;
630 ((struct switch_stack *)regs - 1)->a5 = current->mm->start_data;
631 regs->format = 0x4; /*set format byte to make stack appear modulo 4
632 which it will be when doing the rte */
633
634adjust_stack:
635 /* Prepare to skip over the extra stuff in the exception frame. */
636 if (regs->stkadj) {
637 struct pt_regs *tregs =
638 (struct pt_regs *)((ulong)regs + regs->stkadj);
639#if defined(DEBUG)
640 printk(KERN_DEBUG "Performing stackadjust=%04x\n", regs->stkadj);
641#endif
642 /* This must be copied with decreasing addresses to
643 handle overlaps. */
644 tregs->vector = 0;
645 tregs->format = 0;
646 tregs->pc = regs->pc;
647 tregs->sr = regs->sr;
648 }
649 return err;
650
651give_sigsegv:
652 force_sigsegv(sig, current);
653 goto adjust_stack;
654}
655
656static inline void
657handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
658{
659 switch (regs->d0) {
660 case -ERESTARTNOHAND:
661 if (!has_handler)
662 goto do_restart;
663 regs->d0 = -EINTR;
664 break;
665
666 case -ERESTART_RESTARTBLOCK:
667 if (!has_handler) {
668 regs->d0 = __NR_restart_syscall;
669 regs->pc -= 2;
670 break;
671 }
672 regs->d0 = -EINTR;
673 break;
674
675 case -ERESTARTSYS:
676 if (has_handler && !(ka->sa.sa_flags & SA_RESTART)) {
677 regs->d0 = -EINTR;
678 break;
679 }
680 /* fallthrough */
681 case -ERESTARTNOINTR:
682 do_restart:
683 regs->d0 = regs->orig_d0;
684 regs->pc -= 2;
685 break;
686 }
687}
688
689/*
690 * OK, we're invoking a handler
691 */
692static void
693handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
694 sigset_t *oldset, struct pt_regs *regs)
695{
696 int err;
697 /* are we from a system call? */
698 if (regs->orig_d0 >= 0)
699 /* If so, check system call restarting.. */
700 handle_restart(regs, ka, 1);
701
702 /* set up the stack frame */
703 if (ka->sa.sa_flags & SA_SIGINFO)
704 err = setup_rt_frame(sig, ka, info, oldset, regs);
705 else
706 err = setup_frame(sig, ka, oldset, regs);
707
708 if (err)
709 return;
710
711 spin_lock_irq(&current->sighand->siglock);
712 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
713 if (!(ka->sa.sa_flags & SA_NODEFER))
714 sigaddset(&current->blocked,sig);
715 recalc_sigpending();
716 spin_unlock_irq(&current->sighand->siglock);
717
718 clear_thread_flag(TIF_RESTORE_SIGMASK);
719}
720
721/*
722 * Note that 'init' is a special process: it doesn't get signals it doesn't
723 * want to handle. Thus you cannot kill init even with a SIGKILL even by
724 * mistake.
725 */
726asmlinkage void do_signal(struct pt_regs *regs)
727{
728 struct k_sigaction ka;
729 siginfo_t info;
730 int signr;
731 sigset_t *oldset;
732
733 /*
734 * We want the common case to go fast, which
735 * is why we may in certain cases get here from
736 * kernel mode. Just return without doing anything
737 * if so.
738 */
739 if (!user_mode(regs))
740 return;
741
742 if (test_thread_flag(TIF_RESTORE_SIGMASK))
743 oldset = &current->saved_sigmask;
744 else
745 oldset = &current->blocked;
746
747 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
748 if (signr > 0) {
749 /* Whee! Actually deliver the signal. */
750 handle_signal(signr, &ka, &info, oldset, regs);
751 return;
752 }
753
754 /* Did we come from a system call? */
755 if (regs->orig_d0 >= 0) {
756 /* Restart the system call - no handlers present */
757 handle_restart(regs, NULL, 0);
758 }
759
760 /* If there's no signal to deliver, we just restore the saved mask. */
761 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
762 clear_thread_flag(TIF_RESTORE_SIGMASK);
763 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
764 }
765}
diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c
index 6b020a8461e7..aeebbb7b30f0 100644
--- a/arch/m68k/mm/fault.c
+++ b/arch/m68k/mm/fault.c
@@ -72,7 +72,8 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
72{ 72{
73 struct mm_struct *mm = current->mm; 73 struct mm_struct *mm = current->mm;
74 struct vm_area_struct * vma; 74 struct vm_area_struct * vma;
75 int write, fault; 75 int fault;
76 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
76 77
77#ifdef DEBUG 78#ifdef DEBUG
78 printk ("do page fault:\nregs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld, %p\n", 79 printk ("do page fault:\nregs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld, %p\n",
@@ -87,6 +88,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
87 if (in_atomic() || !mm) 88 if (in_atomic() || !mm)
88 goto no_context; 89 goto no_context;
89 90
91retry:
90 down_read(&mm->mmap_sem); 92 down_read(&mm->mmap_sem);
91 93
92 vma = find_vma(mm, address); 94 vma = find_vma(mm, address);
@@ -117,14 +119,13 @@ good_area:
117#ifdef DEBUG 119#ifdef DEBUG
118 printk("do_page_fault: good_area\n"); 120 printk("do_page_fault: good_area\n");
119#endif 121#endif
120 write = 0;
121 switch (error_code & 3) { 122 switch (error_code & 3) {
122 default: /* 3: write, present */ 123 default: /* 3: write, present */
123 /* fall through */ 124 /* fall through */
124 case 2: /* write, not present */ 125 case 2: /* write, not present */
125 if (!(vma->vm_flags & VM_WRITE)) 126 if (!(vma->vm_flags & VM_WRITE))
126 goto acc_err; 127 goto acc_err;
127 write++; 128 flags |= FAULT_FLAG_WRITE;
128 break; 129 break;
129 case 1: /* read, present */ 130 case 1: /* read, present */
130 goto acc_err; 131 goto acc_err;
@@ -139,10 +140,14 @@ good_area:
139 * the fault. 140 * the fault.
140 */ 141 */
141 142
142 fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); 143 fault = handle_mm_fault(mm, vma, address, flags);
143#ifdef DEBUG 144#ifdef DEBUG
144 printk("handle_mm_fault returns %d\n",fault); 145 printk("handle_mm_fault returns %d\n",fault);
145#endif 146#endif
147
148 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
149 return 0;
150
146 if (unlikely(fault & VM_FAULT_ERROR)) { 151 if (unlikely(fault & VM_FAULT_ERROR)) {
147 if (fault & VM_FAULT_OOM) 152 if (fault & VM_FAULT_OOM)
148 goto out_of_memory; 153 goto out_of_memory;
@@ -150,10 +155,31 @@ good_area:
150 goto bus_err; 155 goto bus_err;
151 BUG(); 156 BUG();
152 } 157 }
153 if (fault & VM_FAULT_MAJOR) 158
154 current->maj_flt++; 159 /*
155 else 160 * Major/minor page fault accounting is only done on the
156 current->min_flt++; 161 * initial attempt. If we go through a retry, it is extremely
162 * likely that the page will be found in page cache at that point.
163 */
164 if (flags & FAULT_FLAG_ALLOW_RETRY) {
165 if (fault & VM_FAULT_MAJOR)
166 current->maj_flt++;
167 else
168 current->min_flt++;
169 if (fault & VM_FAULT_RETRY) {
170 /* Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk
171 * of starvation. */
172 flags &= ~FAULT_FLAG_ALLOW_RETRY;
173
174 /*
175 * No need to up_read(&mm->mmap_sem) as we would
176 * have already released it in __lock_page_or_retry
177 * in mm/filemap.c.
178 */
179
180 goto retry;
181 }
182 }
157 183
158 up_read(&mm->mmap_sem); 184 up_read(&mm->mmap_sem);
159 return 0; 185 return 0;
diff --git a/arch/m68k/platform/5206/Makefile b/arch/m68k/platform/5206/Makefile
deleted file mode 100644
index b5db05625cfa..000000000000
--- a/arch/m68k/platform/5206/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
1#
2# Makefile for the m68knommu linux kernel.
3#
4
5#
6# If you want to play with the HW breakpoints then you will
7# need to add define this, which will give you a stack backtrace
8# on the console port whenever a DBG interrupt occurs. You have to
9# set up you HW breakpoints to trigger a DBG interrupt:
10#
11# ccflags-y := -DTRAP_DBG_INTERRUPT
12# asflags-y := -DTRAP_DBG_INTERRUPT
13#
14
15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16
17obj-y := config.o gpio.o
18
diff --git a/arch/m68k/platform/5206/gpio.c b/arch/m68k/platform/5206/gpio.c
deleted file mode 100644
index b9ab4a120f28..000000000000
--- a/arch/m68k/platform/5206/gpio.c
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * Coldfire generic GPIO support
3 *
4 * (C) Copyright 2009, Steven King <sfking@fdwdc.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14*/
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18
19#include <asm/coldfire.h>
20#include <asm/mcfsim.h>
21#include <asm/mcfgpio.h>
22
23static struct mcf_gpio_chip mcf_gpio_chips[] = {
24 {
25 .gpio_chip = {
26 .label = "PP",
27 .request = mcf_gpio_request,
28 .free = mcf_gpio_free,
29 .direction_input = mcf_gpio_direction_input,
30 .direction_output = mcf_gpio_direction_output,
31 .get = mcf_gpio_get_value,
32 .set = mcf_gpio_set_value,
33 .ngpio = 8,
34 },
35 .pddr = (void __iomem *) MCFSIM_PADDR,
36 .podr = (void __iomem *) MCFSIM_PADAT,
37 .ppdr = (void __iomem *) MCFSIM_PADAT,
38 },
39};
40
41static int __init mcf_gpio_init(void)
42{
43 unsigned i = 0;
44 while (i < ARRAY_SIZE(mcf_gpio_chips))
45 (void)gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]);
46 return 0;
47}
48
49core_initcall(mcf_gpio_init);
diff --git a/arch/m68k/platform/520x/Makefile b/arch/m68k/platform/520x/Makefile
deleted file mode 100644
index ad3f4e5a57ce..000000000000
--- a/arch/m68k/platform/520x/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
1#
2# Makefile for the M5208 specific file.
3#
4
5#
6# If you want to play with the HW breakpoints then you will
7# need to add define this, which will give you a stack backtrace
8# on the console port whenever a DBG interrupt occurs. You have to
9# set up you HW breakpoints to trigger a DBG interrupt:
10#
11# ccflags-y := -DTRAP_DBG_INTERRUPT
12# asflags-y := -DTRAP_DBG_INTERRUPT
13#
14
15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16
17obj-y := config.o gpio.o
diff --git a/arch/m68k/platform/520x/gpio.c b/arch/m68k/platform/520x/gpio.c
deleted file mode 100644
index 9bcc3e4b60c5..000000000000
--- a/arch/m68k/platform/520x/gpio.c
+++ /dev/null
@@ -1,175 +0,0 @@
1/*
2 * Coldfire generic GPIO support
3 *
4 * (C) Copyright 2009, Steven King <sfking@fdwdc.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14*/
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18
19#include <asm/coldfire.h>
20#include <asm/mcfsim.h>
21#include <asm/mcfgpio.h>
22
23static struct mcf_gpio_chip mcf_gpio_chips[] = {
24 {
25 .gpio_chip = {
26 .label = "PIRQ",
27 .request = mcf_gpio_request,
28 .free = mcf_gpio_free,
29 .direction_input = mcf_gpio_direction_input,
30 .direction_output = mcf_gpio_direction_output,
31 .get = mcf_gpio_get_value,
32 .set = mcf_gpio_set_value,
33 .ngpio = 8,
34 },
35 .pddr = (void __iomem *) MCFEPORT_EPDDR,
36 .podr = (void __iomem *) MCFEPORT_EPDR,
37 .ppdr = (void __iomem *) MCFEPORT_EPPDR,
38 },
39 {
40 .gpio_chip = {
41 .label = "CS",
42 .request = mcf_gpio_request,
43 .free = mcf_gpio_free,
44 .direction_input = mcf_gpio_direction_input,
45 .direction_output = mcf_gpio_direction_output,
46 .get = mcf_gpio_get_value,
47 .set = mcf_gpio_set_value_fast,
48 .base = 9,
49 .ngpio = 3,
50 },
51 .pddr = (void __iomem *) MCFGPIO_PDDR_CS,
52 .podr = (void __iomem *) MCFGPIO_PODR_CS,
53 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_CS,
54 .setr = (void __iomem *) MCFGPIO_PPDSDR_CS,
55 .clrr = (void __iomem *) MCFGPIO_PCLRR_CS,
56 },
57 {
58 .gpio_chip = {
59 .label = "FECI2C",
60 .request = mcf_gpio_request,
61 .free = mcf_gpio_free,
62 .direction_input = mcf_gpio_direction_input,
63 .direction_output = mcf_gpio_direction_output,
64 .get = mcf_gpio_get_value,
65 .set = mcf_gpio_set_value_fast,
66 .base = 16,
67 .ngpio = 4,
68 },
69 .pddr = (void __iomem *) MCFGPIO_PDDR_FECI2C,
70 .podr = (void __iomem *) MCFGPIO_PODR_FECI2C,
71 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
72 .setr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
73 .clrr = (void __iomem *) MCFGPIO_PCLRR_FECI2C,
74 },
75 {
76 .gpio_chip = {
77 .label = "QSPI",
78 .request = mcf_gpio_request,
79 .free = mcf_gpio_free,
80 .direction_input = mcf_gpio_direction_input,
81 .direction_output = mcf_gpio_direction_output,
82 .get = mcf_gpio_get_value,
83 .set = mcf_gpio_set_value_fast,
84 .base = 24,
85 .ngpio = 4,
86 },
87 .pddr = (void __iomem *) MCFGPIO_PDDR_QSPI,
88 .podr = (void __iomem *) MCFGPIO_PODR_QSPI,
89 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
90 .setr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
91 .clrr = (void __iomem *) MCFGPIO_PCLRR_QSPI,
92 },
93 {
94 .gpio_chip = {
95 .label = "TIMER",
96 .request = mcf_gpio_request,
97 .free = mcf_gpio_free,
98 .direction_input = mcf_gpio_direction_input,
99 .direction_output = mcf_gpio_direction_output,
100 .get = mcf_gpio_get_value,
101 .set = mcf_gpio_set_value_fast,
102 .base = 32,
103 .ngpio = 4,
104 },
105 .pddr = (void __iomem *) MCFGPIO_PDDR_TIMER,
106 .podr = (void __iomem *) MCFGPIO_PODR_TIMER,
107 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_TIMER,
108 .setr = (void __iomem *) MCFGPIO_PPDSDR_TIMER,
109 .clrr = (void __iomem *) MCFGPIO_PCLRR_TIMER,
110 },
111 {
112 .gpio_chip = {
113 .label = "UART",
114 .request = mcf_gpio_request,
115 .free = mcf_gpio_free,
116 .direction_input = mcf_gpio_direction_input,
117 .direction_output = mcf_gpio_direction_output,
118 .get = mcf_gpio_get_value,
119 .set = mcf_gpio_set_value_fast,
120 .base = 40,
121 .ngpio = 8,
122 },
123 .pddr = (void __iomem *) MCFGPIO_PDDR_UART,
124 .podr = (void __iomem *) MCFGPIO_PODR_UART,
125 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_UART,
126 .setr = (void __iomem *) MCFGPIO_PPDSDR_UART,
127 .clrr = (void __iomem *) MCFGPIO_PCLRR_UART,
128 },
129 {
130 .gpio_chip = {
131 .label = "FECH",
132 .request = mcf_gpio_request,
133 .free = mcf_gpio_free,
134 .direction_input = mcf_gpio_direction_input,
135 .direction_output = mcf_gpio_direction_output,
136 .get = mcf_gpio_get_value,
137 .set = mcf_gpio_set_value_fast,
138 .base = 48,
139 .ngpio = 8,
140 },
141 .pddr = (void __iomem *) MCFGPIO_PDDR_FECH,
142 .podr = (void __iomem *) MCFGPIO_PODR_FECH,
143 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FECH,
144 .setr = (void __iomem *) MCFGPIO_PPDSDR_FECH,
145 .clrr = (void __iomem *) MCFGPIO_PCLRR_FECH,
146 },
147 {
148 .gpio_chip = {
149 .label = "FECL",
150 .request = mcf_gpio_request,
151 .free = mcf_gpio_free,
152 .direction_input = mcf_gpio_direction_input,
153 .direction_output = mcf_gpio_direction_output,
154 .get = mcf_gpio_get_value,
155 .set = mcf_gpio_set_value_fast,
156 .base = 56,
157 .ngpio = 8,
158 },
159 .pddr = (void __iomem *) MCFGPIO_PDDR_FECL,
160 .podr = (void __iomem *) MCFGPIO_PODR_FECL,
161 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FECL,
162 .setr = (void __iomem *) MCFGPIO_PPDSDR_FECL,
163 .clrr = (void __iomem *) MCFGPIO_PCLRR_FECL,
164 },
165};
166
167static int __init mcf_gpio_init(void)
168{
169 unsigned i = 0;
170 while (i < ARRAY_SIZE(mcf_gpio_chips))
171 (void)gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]);
172 return 0;
173}
174
175core_initcall(mcf_gpio_init);
diff --git a/arch/m68k/platform/523x/Makefile b/arch/m68k/platform/523x/Makefile
deleted file mode 100644
index c04b8f71c88c..000000000000
--- a/arch/m68k/platform/523x/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
1#
2# Makefile for the m68knommu linux kernel.
3#
4
5#
6# If you want to play with the HW breakpoints then you will
7# need to add define this, which will give you a stack backtrace
8# on the console port whenever a DBG interrupt occurs. You have to
9# set up you HW breakpoints to trigger a DBG interrupt:
10#
11# ccflags-y := -DTRAP_DBG_INTERRUPT
12# asflags-y := -DTRAP_DBG_INTERRUPT
13#
14
15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16
17obj-y := config.o gpio.o
diff --git a/arch/m68k/platform/523x/gpio.c b/arch/m68k/platform/523x/gpio.c
deleted file mode 100644
index 327ebf142c8e..000000000000
--- a/arch/m68k/platform/523x/gpio.c
+++ /dev/null
@@ -1,284 +0,0 @@
1/*
2 * Coldfire generic GPIO support
3 *
4 * (C) Copyright 2009, Steven King <sfking@fdwdc.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14*/
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18
19#include <asm/coldfire.h>
20#include <asm/mcfsim.h>
21#include <asm/mcfgpio.h>
22
23static struct mcf_gpio_chip mcf_gpio_chips[] = {
24 {
25 .gpio_chip = {
26 .label = "PIRQ",
27 .request = mcf_gpio_request,
28 .free = mcf_gpio_free,
29 .direction_input = mcf_gpio_direction_input,
30 .direction_output = mcf_gpio_direction_output,
31 .get = mcf_gpio_get_value,
32 .set = mcf_gpio_set_value,
33 .base = 1,
34 .ngpio = 7,
35 },
36 .pddr = (void __iomem *) MCFEPORT_EPDDR,
37 .podr = (void __iomem *) MCFEPORT_EPDR,
38 .ppdr = (void __iomem *) MCFEPORT_EPPDR,
39 },
40 {
41 .gpio_chip = {
42 .label = "ADDR",
43 .request = mcf_gpio_request,
44 .free = mcf_gpio_free,
45 .direction_input = mcf_gpio_direction_input,
46 .direction_output = mcf_gpio_direction_output,
47 .get = mcf_gpio_get_value,
48 .set = mcf_gpio_set_value_fast,
49 .base = 13,
50 .ngpio = 3,
51 },
52 .pddr = (void __iomem *) MCFGPIO_PDDR_ADDR,
53 .podr = (void __iomem *) MCFGPIO_PODR_ADDR,
54 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_ADDR,
55 .setr = (void __iomem *) MCFGPIO_PPDSDR_ADDR,
56 .clrr = (void __iomem *) MCFGPIO_PCLRR_ADDR,
57 },
58 {
59 .gpio_chip = {
60 .label = "DATAH",
61 .request = mcf_gpio_request,
62 .free = mcf_gpio_free,
63 .direction_input = mcf_gpio_direction_input,
64 .direction_output = mcf_gpio_direction_output,
65 .get = mcf_gpio_get_value,
66 .set = mcf_gpio_set_value_fast,
67 .base = 16,
68 .ngpio = 8,
69 },
70 .pddr = (void __iomem *) MCFGPIO_PDDR_DATAH,
71 .podr = (void __iomem *) MCFGPIO_PODR_DATAH,
72 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_DATAH,
73 .setr = (void __iomem *) MCFGPIO_PPDSDR_DATAH,
74 .clrr = (void __iomem *) MCFGPIO_PCLRR_DATAH,
75 },
76 {
77 .gpio_chip = {
78 .label = "DATAL",
79 .request = mcf_gpio_request,
80 .free = mcf_gpio_free,
81 .direction_input = mcf_gpio_direction_input,
82 .direction_output = mcf_gpio_direction_output,
83 .get = mcf_gpio_get_value,
84 .set = mcf_gpio_set_value_fast,
85 .base = 24,
86 .ngpio = 8,
87 },
88 .pddr = (void __iomem *) MCFGPIO_PDDR_DATAL,
89 .podr = (void __iomem *) MCFGPIO_PODR_DATAL,
90 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_DATAL,
91 .setr = (void __iomem *) MCFGPIO_PPDSDR_DATAL,
92 .clrr = (void __iomem *) MCFGPIO_PCLRR_DATAL,
93 },
94 {
95 .gpio_chip = {
96 .label = "BUSCTL",
97 .request = mcf_gpio_request,
98 .free = mcf_gpio_free,
99 .direction_input = mcf_gpio_direction_input,
100 .direction_output = mcf_gpio_direction_output,
101 .get = mcf_gpio_get_value,
102 .set = mcf_gpio_set_value_fast,
103 .base = 32,
104 .ngpio = 8,
105 },
106 .pddr = (void __iomem *) MCFGPIO_PDDR_BUSCTL,
107 .podr = (void __iomem *) MCFGPIO_PODR_BUSCTL,
108 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_BUSCTL,
109 .setr = (void __iomem *) MCFGPIO_PPDSDR_BUSCTL,
110 .clrr = (void __iomem *) MCFGPIO_PCLRR_BUSCTL,
111 },
112 {
113 .gpio_chip = {
114 .label = "BS",
115 .request = mcf_gpio_request,
116 .free = mcf_gpio_free,
117 .direction_input = mcf_gpio_direction_input,
118 .direction_output = mcf_gpio_direction_output,
119 .get = mcf_gpio_get_value,
120 .set = mcf_gpio_set_value_fast,
121 .base = 40,
122 .ngpio = 4,
123 },
124 .pddr = (void __iomem *) MCFGPIO_PDDR_BS,
125 .podr = (void __iomem *) MCFGPIO_PODR_BS,
126 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_BS,
127 .setr = (void __iomem *) MCFGPIO_PPDSDR_BS,
128 .clrr = (void __iomem *) MCFGPIO_PCLRR_BS,
129 },
130 {
131 .gpio_chip = {
132 .label = "CS",
133 .request = mcf_gpio_request,
134 .free = mcf_gpio_free,
135 .direction_input = mcf_gpio_direction_input,
136 .direction_output = mcf_gpio_direction_output,
137 .get = mcf_gpio_get_value,
138 .set = mcf_gpio_set_value_fast,
139 .base = 49,
140 .ngpio = 7,
141 },
142 .pddr = (void __iomem *) MCFGPIO_PDDR_CS,
143 .podr = (void __iomem *) MCFGPIO_PODR_CS,
144 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_CS,
145 .setr = (void __iomem *) MCFGPIO_PPDSDR_CS,
146 .clrr = (void __iomem *) MCFGPIO_PCLRR_CS,
147 },
148 {
149 .gpio_chip = {
150 .label = "SDRAM",
151 .request = mcf_gpio_request,
152 .free = mcf_gpio_free,
153 .direction_input = mcf_gpio_direction_input,
154 .direction_output = mcf_gpio_direction_output,
155 .get = mcf_gpio_get_value,
156 .set = mcf_gpio_set_value_fast,
157 .base = 56,
158 .ngpio = 6,
159 },
160 .pddr = (void __iomem *) MCFGPIO_PDDR_SDRAM,
161 .podr = (void __iomem *) MCFGPIO_PODR_SDRAM,
162 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_SDRAM,
163 .setr = (void __iomem *) MCFGPIO_PPDSDR_SDRAM,
164 .clrr = (void __iomem *) MCFGPIO_PCLRR_SDRAM,
165 },
166 {
167 .gpio_chip = {
168 .label = "FECI2C",
169 .request = mcf_gpio_request,
170 .free = mcf_gpio_free,
171 .direction_input = mcf_gpio_direction_input,
172 .direction_output = mcf_gpio_direction_output,
173 .get = mcf_gpio_get_value,
174 .set = mcf_gpio_set_value_fast,
175 .base = 64,
176 .ngpio = 4,
177 },
178 .pddr = (void __iomem *) MCFGPIO_PDDR_FECI2C,
179 .podr = (void __iomem *) MCFGPIO_PODR_FECI2C,
180 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
181 .setr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
182 .clrr = (void __iomem *) MCFGPIO_PCLRR_FECI2C,
183 },
184 {
185 .gpio_chip = {
186 .label = "UARTH",
187 .request = mcf_gpio_request,
188 .free = mcf_gpio_free,
189 .direction_input = mcf_gpio_direction_input,
190 .direction_output = mcf_gpio_direction_output,
191 .get = mcf_gpio_get_value,
192 .set = mcf_gpio_set_value_fast,
193 .base = 72,
194 .ngpio = 2,
195 },
196 .pddr = (void __iomem *) MCFGPIO_PDDR_UARTH,
197 .podr = (void __iomem *) MCFGPIO_PODR_UARTH,
198 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_UARTH,
199 .setr = (void __iomem *) MCFGPIO_PPDSDR_UARTH,
200 .clrr = (void __iomem *) MCFGPIO_PCLRR_UARTH,
201 },
202 {
203 .gpio_chip = {
204 .label = "UARTL",
205 .request = mcf_gpio_request,
206 .free = mcf_gpio_free,
207 .direction_input = mcf_gpio_direction_input,
208 .direction_output = mcf_gpio_direction_output,
209 .get = mcf_gpio_get_value,
210 .set = mcf_gpio_set_value_fast,
211 .base = 80,
212 .ngpio = 8,
213 },
214 .pddr = (void __iomem *) MCFGPIO_PDDR_UARTL,
215 .podr = (void __iomem *) MCFGPIO_PODR_UARTL,
216 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_UARTL,
217 .setr = (void __iomem *) MCFGPIO_PPDSDR_UARTL,
218 .clrr = (void __iomem *) MCFGPIO_PCLRR_UARTL,
219 },
220 {
221 .gpio_chip = {
222 .label = "QSPI",
223 .request = mcf_gpio_request,
224 .free = mcf_gpio_free,
225 .direction_input = mcf_gpio_direction_input,
226 .direction_output = mcf_gpio_direction_output,
227 .get = mcf_gpio_get_value,
228 .set = mcf_gpio_set_value_fast,
229 .base = 88,
230 .ngpio = 5,
231 },
232 .pddr = (void __iomem *) MCFGPIO_PDDR_QSPI,
233 .podr = (void __iomem *) MCFGPIO_PODR_QSPI,
234 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
235 .setr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
236 .clrr = (void __iomem *) MCFGPIO_PCLRR_QSPI,
237 },
238 {
239 .gpio_chip = {
240 .label = "TIMER",
241 .request = mcf_gpio_request,
242 .free = mcf_gpio_free,
243 .direction_input = mcf_gpio_direction_input,
244 .direction_output = mcf_gpio_direction_output,
245 .get = mcf_gpio_get_value,
246 .set = mcf_gpio_set_value_fast,
247 .base = 96,
248 .ngpio = 8,
249 },
250 .pddr = (void __iomem *) MCFGPIO_PDDR_TIMER,
251 .podr = (void __iomem *) MCFGPIO_PODR_TIMER,
252 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_TIMER,
253 .setr = (void __iomem *) MCFGPIO_PPDSDR_TIMER,
254 .clrr = (void __iomem *) MCFGPIO_PCLRR_TIMER,
255 },
256 {
257 .gpio_chip = {
258 .label = "ETPU",
259 .request = mcf_gpio_request,
260 .free = mcf_gpio_free,
261 .direction_input = mcf_gpio_direction_input,
262 .direction_output = mcf_gpio_direction_output,
263 .get = mcf_gpio_get_value,
264 .set = mcf_gpio_set_value_fast,
265 .base = 104,
266 .ngpio = 3,
267 },
268 .pddr = (void __iomem *) MCFGPIO_PDDR_ETPU,
269 .podr = (void __iomem *) MCFGPIO_PODR_ETPU,
270 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_ETPU,
271 .setr = (void __iomem *) MCFGPIO_PPDSDR_ETPU,
272 .clrr = (void __iomem *) MCFGPIO_PCLRR_ETPU,
273 },
274};
275
276static int __init mcf_gpio_init(void)
277{
278 unsigned i = 0;
279 while (i < ARRAY_SIZE(mcf_gpio_chips))
280 (void)gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]);
281 return 0;
282}
283
284core_initcall(mcf_gpio_init);
diff --git a/arch/m68k/platform/5249/Makefile b/arch/m68k/platform/5249/Makefile
deleted file mode 100644
index 4bed30fd0073..000000000000
--- a/arch/m68k/platform/5249/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
1#
2# Makefile for the m68knommu linux kernel.
3#
4
5#
6# If you want to play with the HW breakpoints then you will
7# need to add define this, which will give you a stack backtrace
8# on the console port whenever a DBG interrupt occurs. You have to
9# set up you HW breakpoints to trigger a DBG interrupt:
10#
11# ccflags-y := -DTRAP_DBG_INTERRUPT
12# asflags-y := -DTRAP_DBG_INTERRUPT
13#
14
15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16
17obj-y := config.o gpio.o intc2.o
18
diff --git a/arch/m68k/platform/5249/gpio.c b/arch/m68k/platform/5249/gpio.c
deleted file mode 100644
index 2b56c6ef65bf..000000000000
--- a/arch/m68k/platform/5249/gpio.c
+++ /dev/null
@@ -1,65 +0,0 @@
1/*
2 * Coldfire generic GPIO support
3 *
4 * (C) Copyright 2009, Steven King <sfking@fdwdc.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14*/
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18
19#include <asm/coldfire.h>
20#include <asm/mcfsim.h>
21#include <asm/mcfgpio.h>
22
23static struct mcf_gpio_chip mcf_gpio_chips[] = {
24 {
25 .gpio_chip = {
26 .label = "GPIO0",
27 .request = mcf_gpio_request,
28 .free = mcf_gpio_free,
29 .direction_input = mcf_gpio_direction_input,
30 .direction_output = mcf_gpio_direction_output,
31 .get = mcf_gpio_get_value,
32 .set = mcf_gpio_set_value,
33 .ngpio = 32,
34 },
35 .pddr = (void __iomem *) MCFSIM2_GPIOENABLE,
36 .podr = (void __iomem *) MCFSIM2_GPIOWRITE,
37 .ppdr = (void __iomem *) MCFSIM2_GPIOREAD,
38 },
39 {
40 .gpio_chip = {
41 .label = "GPIO1",
42 .request = mcf_gpio_request,
43 .free = mcf_gpio_free,
44 .direction_input = mcf_gpio_direction_input,
45 .direction_output = mcf_gpio_direction_output,
46 .get = mcf_gpio_get_value,
47 .set = mcf_gpio_set_value,
48 .base = 32,
49 .ngpio = 32,
50 },
51 .pddr = (void __iomem *) MCFSIM2_GPIO1ENABLE,
52 .podr = (void __iomem *) MCFSIM2_GPIO1WRITE,
53 .ppdr = (void __iomem *) MCFSIM2_GPIO1READ,
54 },
55};
56
57static int __init mcf_gpio_init(void)
58{
59 unsigned i = 0;
60 while (i < ARRAY_SIZE(mcf_gpio_chips))
61 (void)gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]);
62 return 0;
63}
64
65core_initcall(mcf_gpio_init);
diff --git a/arch/m68k/platform/5272/Makefile b/arch/m68k/platform/5272/Makefile
deleted file mode 100644
index 34110fc14301..000000000000
--- a/arch/m68k/platform/5272/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5#
6# If you want to play with the HW breakpoints then you will
7# need to add define this, which will give you a stack backtrace
8# on the console port whenever a DBG interrupt occurs. You have to
9# set up you HW breakpoints to trigger a DBG interrupt:
10#
11# ccflags-y := -DTRAP_DBG_INTERRUPT
12# asflags-y := -DTRAP_DBG_INTERRUPT
13#
14
15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16
17obj-y := config.o gpio.o intc.o
18
diff --git a/arch/m68k/platform/5272/gpio.c b/arch/m68k/platform/5272/gpio.c
deleted file mode 100644
index 57ac10a5d7f7..000000000000
--- a/arch/m68k/platform/5272/gpio.c
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * Coldfire generic GPIO support
3 *
4 * (C) Copyright 2009, Steven King <sfking@fdwdc.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14*/
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18
19#include <asm/coldfire.h>
20#include <asm/mcfsim.h>
21#include <asm/mcfgpio.h>
22
23static struct mcf_gpio_chip mcf_gpio_chips[] = {
24 {
25 .gpio_chip = {
26 .label = "PA",
27 .request = mcf_gpio_request,
28 .free = mcf_gpio_free,
29 .direction_input = mcf_gpio_direction_input,
30 .direction_output = mcf_gpio_direction_output,
31 .get = mcf_gpio_get_value,
32 .set = mcf_gpio_set_value,
33 .ngpio = 16,
34 },
35 .pddr = (void __iomem *) MCFSIM_PADDR,
36 .podr = (void __iomem *) MCFSIM_PADAT,
37 .ppdr = (void __iomem *) MCFSIM_PADAT,
38 },
39 {
40 .gpio_chip = {
41 .label = "PB",
42 .request = mcf_gpio_request,
43 .free = mcf_gpio_free,
44 .direction_input = mcf_gpio_direction_input,
45 .direction_output = mcf_gpio_direction_output,
46 .get = mcf_gpio_get_value,
47 .set = mcf_gpio_set_value,
48 .base = 16,
49 .ngpio = 16,
50 },
51 .pddr = (void __iomem *) MCFSIM_PBDDR,
52 .podr = (void __iomem *) MCFSIM_PBDAT,
53 .ppdr = (void __iomem *) MCFSIM_PBDAT,
54 },
55 {
56 .gpio_chip = {
57 .label = "PC",
58 .request = mcf_gpio_request,
59 .free = mcf_gpio_free,
60 .direction_input = mcf_gpio_direction_input,
61 .direction_output = mcf_gpio_direction_output,
62 .get = mcf_gpio_get_value,
63 .set = mcf_gpio_set_value,
64 .base = 32,
65 .ngpio = 16,
66 },
67 .pddr = (void __iomem *) MCFSIM_PCDDR,
68 .podr = (void __iomem *) MCFSIM_PCDAT,
69 .ppdr = (void __iomem *) MCFSIM_PCDAT,
70 },
71};
72
73static int __init mcf_gpio_init(void)
74{
75 unsigned i = 0;
76 while (i < ARRAY_SIZE(mcf_gpio_chips))
77 (void)gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]);
78 return 0;
79}
80
81core_initcall(mcf_gpio_init);
diff --git a/arch/m68k/platform/527x/Makefile b/arch/m68k/platform/527x/Makefile
deleted file mode 100644
index 6ac4b57370ea..000000000000
--- a/arch/m68k/platform/527x/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5#
6# If you want to play with the HW breakpoints then you will
7# need to add define this, which will give you a stack backtrace
8# on the console port whenever a DBG interrupt occurs. You have to
9# set up you HW breakpoints to trigger a DBG interrupt:
10#
11# ccflags-y := -DTRAP_DBG_INTERRUPT
12# asflags-y := -DTRAP_DBG_INTERRUPT
13#
14
15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16
17obj-y := config.o gpio.o
18
diff --git a/arch/m68k/platform/527x/gpio.c b/arch/m68k/platform/527x/gpio.c
deleted file mode 100644
index 205da0aa0f2d..000000000000
--- a/arch/m68k/platform/527x/gpio.c
+++ /dev/null
@@ -1,609 +0,0 @@
1/*
2 * Coldfire generic GPIO support
3 *
4 * (C) Copyright 2009, Steven King <sfking@fdwdc.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14*/
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18
19#include <asm/coldfire.h>
20#include <asm/mcfsim.h>
21#include <asm/mcfgpio.h>
22
23static struct mcf_gpio_chip mcf_gpio_chips[] = {
24#if defined(CONFIG_M5271)
25 {
26 .gpio_chip = {
27 .label = "PIRQ",
28 .request = mcf_gpio_request,
29 .free = mcf_gpio_free,
30 .direction_input = mcf_gpio_direction_input,
31 .direction_output = mcf_gpio_direction_output,
32 .get = mcf_gpio_get_value,
33 .set = mcf_gpio_set_value,
34 .base = 1,
35 .ngpio = 7,
36 },
37 .pddr = (void __iomem *) MCFEPORT_EPDDR,
38 .podr = (void __iomem *) MCFEPORT_EPDR,
39 .ppdr = (void __iomem *) MCFEPORT_EPPDR,
40 },
41 {
42 .gpio_chip = {
43 .label = "ADDR",
44 .request = mcf_gpio_request,
45 .free = mcf_gpio_free,
46 .direction_input = mcf_gpio_direction_input,
47 .direction_output = mcf_gpio_direction_output,
48 .get = mcf_gpio_get_value,
49 .set = mcf_gpio_set_value_fast,
50 .base = 13,
51 .ngpio = 3,
52 },
53 .pddr = (void __iomem *) MCFGPIO_PDDR_ADDR,
54 .podr = (void __iomem *) MCFGPIO_PODR_ADDR,
55 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_ADDR,
56 .setr = (void __iomem *) MCFGPIO_PPDSDR_ADDR,
57 .clrr = (void __iomem *) MCFGPIO_PCLRR_ADDR,
58 },
59 {
60 .gpio_chip = {
61 .label = "DATAH",
62 .request = mcf_gpio_request,
63 .free = mcf_gpio_free,
64 .direction_input = mcf_gpio_direction_input,
65 .direction_output = mcf_gpio_direction_output,
66 .get = mcf_gpio_get_value,
67 .set = mcf_gpio_set_value_fast,
68 .base = 16,
69 .ngpio = 8,
70 },
71 .pddr = (void __iomem *) MCFGPIO_PDDR_DATAH,
72 .podr = (void __iomem *) MCFGPIO_PODR_DATAH,
73 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_DATAH,
74 .setr = (void __iomem *) MCFGPIO_PPDSDR_DATAH,
75 .clrr = (void __iomem *) MCFGPIO_PCLRR_DATAH,
76 },
77 {
78 .gpio_chip = {
79 .label = "DATAL",
80 .request = mcf_gpio_request,
81 .free = mcf_gpio_free,
82 .direction_input = mcf_gpio_direction_input,
83 .direction_output = mcf_gpio_direction_output,
84 .get = mcf_gpio_get_value,
85 .set = mcf_gpio_set_value_fast,
86 .base = 24,
87 .ngpio = 8,
88 },
89 .pddr = (void __iomem *) MCFGPIO_PDDR_DATAL,
90 .podr = (void __iomem *) MCFGPIO_PODR_DATAL,
91 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_DATAL,
92 .setr = (void __iomem *) MCFGPIO_PPDSDR_DATAL,
93 .clrr = (void __iomem *) MCFGPIO_PCLRR_DATAL,
94 },
95 {
96 .gpio_chip = {
97 .label = "BUSCTL",
98 .request = mcf_gpio_request,
99 .free = mcf_gpio_free,
100 .direction_input = mcf_gpio_direction_input,
101 .direction_output = mcf_gpio_direction_output,
102 .get = mcf_gpio_get_value,
103 .set = mcf_gpio_set_value_fast,
104 .base = 32,
105 .ngpio = 8,
106 },
107 .pddr = (void __iomem *) MCFGPIO_PDDR_BUSCTL,
108 .podr = (void __iomem *) MCFGPIO_PODR_BUSCTL,
109 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_BUSCTL,
110 .setr = (void __iomem *) MCFGPIO_PPDSDR_BUSCTL,
111 .clrr = (void __iomem *) MCFGPIO_PCLRR_BUSCTL,
112 },
113 {
114 .gpio_chip = {
115 .label = "BS",
116 .request = mcf_gpio_request,
117 .free = mcf_gpio_free,
118 .direction_input = mcf_gpio_direction_input,
119 .direction_output = mcf_gpio_direction_output,
120 .get = mcf_gpio_get_value,
121 .set = mcf_gpio_set_value_fast,
122 .base = 40,
123 .ngpio = 4,
124 },
125 .pddr = (void __iomem *) MCFGPIO_PDDR_BS,
126 .podr = (void __iomem *) MCFGPIO_PODR_BS,
127 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_BS,
128 .setr = (void __iomem *) MCFGPIO_PPDSDR_BS,
129 .clrr = (void __iomem *) MCFGPIO_PCLRR_BS,
130 },
131 {
132 .gpio_chip = {
133 .label = "CS",
134 .request = mcf_gpio_request,
135 .free = mcf_gpio_free,
136 .direction_input = mcf_gpio_direction_input,
137 .direction_output = mcf_gpio_direction_output,
138 .get = mcf_gpio_get_value,
139 .set = mcf_gpio_set_value_fast,
140 .base = 49,
141 .ngpio = 7,
142 },
143 .pddr = (void __iomem *) MCFGPIO_PDDR_CS,
144 .podr = (void __iomem *) MCFGPIO_PODR_CS,
145 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_CS,
146 .setr = (void __iomem *) MCFGPIO_PPDSDR_CS,
147 .clrr = (void __iomem *) MCFGPIO_PCLRR_CS,
148 },
149 {
150 .gpio_chip = {
151 .label = "SDRAM",
152 .request = mcf_gpio_request,
153 .free = mcf_gpio_free,
154 .direction_input = mcf_gpio_direction_input,
155 .direction_output = mcf_gpio_direction_output,
156 .get = mcf_gpio_get_value,
157 .set = mcf_gpio_set_value_fast,
158 .base = 56,
159 .ngpio = 6,
160 },
161 .pddr = (void __iomem *) MCFGPIO_PDDR_SDRAM,
162 .podr = (void __iomem *) MCFGPIO_PODR_SDRAM,
163 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_SDRAM,
164 .setr = (void __iomem *) MCFGPIO_PPDSDR_SDRAM,
165 .clrr = (void __iomem *) MCFGPIO_PCLRR_SDRAM,
166 },
167 {
168 .gpio_chip = {
169 .label = "FECI2C",
170 .request = mcf_gpio_request,
171 .free = mcf_gpio_free,
172 .direction_input = mcf_gpio_direction_input,
173 .direction_output = mcf_gpio_direction_output,
174 .get = mcf_gpio_get_value,
175 .set = mcf_gpio_set_value_fast,
176 .base = 64,
177 .ngpio = 4,
178 },
179 .pddr = (void __iomem *) MCFGPIO_PDDR_FECI2C,
180 .podr = (void __iomem *) MCFGPIO_PODR_FECI2C,
181 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
182 .setr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
183 .clrr = (void __iomem *) MCFGPIO_PCLRR_FECI2C,
184 },
185 {
186 .gpio_chip = {
187 .label = "UARTH",
188 .request = mcf_gpio_request,
189 .free = mcf_gpio_free,
190 .direction_input = mcf_gpio_direction_input,
191 .direction_output = mcf_gpio_direction_output,
192 .get = mcf_gpio_get_value,
193 .set = mcf_gpio_set_value_fast,
194 .base = 72,
195 .ngpio = 2,
196 },
197 .pddr = (void __iomem *) MCFGPIO_PDDR_UARTH,
198 .podr = (void __iomem *) MCFGPIO_PODR_UARTH,
199 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_UARTH,
200 .setr = (void __iomem *) MCFGPIO_PPDSDR_UARTH,
201 .clrr = (void __iomem *) MCFGPIO_PCLRR_UARTH,
202 },
203 {
204 .gpio_chip = {
205 .label = "UARTL",
206 .request = mcf_gpio_request,
207 .free = mcf_gpio_free,
208 .direction_input = mcf_gpio_direction_input,
209 .direction_output = mcf_gpio_direction_output,
210 .get = mcf_gpio_get_value,
211 .set = mcf_gpio_set_value_fast,
212 .base = 80,
213 .ngpio = 8,
214 },
215 .pddr = (void __iomem *) MCFGPIO_PDDR_UARTL,
216 .podr = (void __iomem *) MCFGPIO_PODR_UARTL,
217 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_UARTL,
218 .setr = (void __iomem *) MCFGPIO_PPDSDR_UARTL,
219 .clrr = (void __iomem *) MCFGPIO_PCLRR_UARTL,
220 },
221 {
222 .gpio_chip = {
223 .label = "QSPI",
224 .request = mcf_gpio_request,
225 .free = mcf_gpio_free,
226 .direction_input = mcf_gpio_direction_input,
227 .direction_output = mcf_gpio_direction_output,
228 .get = mcf_gpio_get_value,
229 .set = mcf_gpio_set_value_fast,
230 .base = 88,
231 .ngpio = 5,
232 },
233 .pddr = (void __iomem *) MCFGPIO_PDDR_QSPI,
234 .podr = (void __iomem *) MCFGPIO_PODR_QSPI,
235 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
236 .setr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
237 .clrr = (void __iomem *) MCFGPIO_PCLRR_QSPI,
238 },
239 {
240 .gpio_chip = {
241 .label = "TIMER",
242 .request = mcf_gpio_request,
243 .free = mcf_gpio_free,
244 .direction_input = mcf_gpio_direction_input,
245 .direction_output = mcf_gpio_direction_output,
246 .get = mcf_gpio_get_value,
247 .set = mcf_gpio_set_value_fast,
248 .base = 96,
249 .ngpio = 8,
250 },
251 .pddr = (void __iomem *) MCFGPIO_PDDR_TIMER,
252 .podr = (void __iomem *) MCFGPIO_PODR_TIMER,
253 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_TIMER,
254 .setr = (void __iomem *) MCFGPIO_PPDSDR_TIMER,
255 .clrr = (void __iomem *) MCFGPIO_PCLRR_TIMER,
256 },
257#elif defined(CONFIG_M5275)
258 {
259 .gpio_chip = {
260 .label = "PIRQ",
261 .request = mcf_gpio_request,
262 .free = mcf_gpio_free,
263 .direction_input = mcf_gpio_direction_input,
264 .direction_output = mcf_gpio_direction_output,
265 .get = mcf_gpio_get_value,
266 .set = mcf_gpio_set_value,
267 .base = 1,
268 .ngpio = 7,
269 },
270 .pddr = (void __iomem *) MCFEPORT_EPDDR,
271 .podr = (void __iomem *) MCFEPORT_EPDR,
272 .ppdr = (void __iomem *) MCFEPORT_EPPDR,
273 },
274 {
275 .gpio_chip = {
276 .label = "BUSCTL",
277 .request = mcf_gpio_request,
278 .free = mcf_gpio_free,
279 .direction_input = mcf_gpio_direction_input,
280 .direction_output = mcf_gpio_direction_output,
281 .get = mcf_gpio_get_value,
282 .set = mcf_gpio_set_value_fast,
283 .base = 8,
284 .ngpio = 8,
285 },
286 .pddr = (void __iomem *) MCFGPIO_PDDR_BUSCTL,
287 .podr = (void __iomem *) MCFGPIO_PODR_BUSCTL,
288 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_BUSCTL,
289 .setr = (void __iomem *) MCFGPIO_PPDSDR_BUSCTL,
290 .clrr = (void __iomem *) MCFGPIO_PCLRR_BUSCTL,
291 },
292 {
293 .gpio_chip = {
294 .label = "ADDR",
295 .request = mcf_gpio_request,
296 .free = mcf_gpio_free,
297 .direction_input = mcf_gpio_direction_input,
298 .direction_output = mcf_gpio_direction_output,
299 .get = mcf_gpio_get_value,
300 .set = mcf_gpio_set_value_fast,
301 .base = 21,
302 .ngpio = 3,
303 },
304 .pddr = (void __iomem *) MCFGPIO_PDDR_ADDR,
305 .podr = (void __iomem *) MCFGPIO_PODR_ADDR,
306 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_ADDR,
307 .setr = (void __iomem *) MCFGPIO_PPDSDR_ADDR,
308 .clrr = (void __iomem *) MCFGPIO_PCLRR_ADDR,
309 },
310 {
311 .gpio_chip = {
312 .label = "CS",
313 .request = mcf_gpio_request,
314 .free = mcf_gpio_free,
315 .direction_input = mcf_gpio_direction_input,
316 .direction_output = mcf_gpio_direction_output,
317 .get = mcf_gpio_get_value,
318 .set = mcf_gpio_set_value_fast,
319 .base = 25,
320 .ngpio = 7,
321 },
322 .pddr = (void __iomem *) MCFGPIO_PDDR_CS,
323 .podr = (void __iomem *) MCFGPIO_PODR_CS,
324 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_CS,
325 .setr = (void __iomem *) MCFGPIO_PPDSDR_CS,
326 .clrr = (void __iomem *) MCFGPIO_PCLRR_CS,
327 },
328 {
329 .gpio_chip = {
330 .label = "FEC0H",
331 .request = mcf_gpio_request,
332 .free = mcf_gpio_free,
333 .direction_input = mcf_gpio_direction_input,
334 .direction_output = mcf_gpio_direction_output,
335 .get = mcf_gpio_get_value,
336 .set = mcf_gpio_set_value_fast,
337 .base = 32,
338 .ngpio = 8,
339 },
340 .pddr = (void __iomem *) MCFGPIO_PDDR_FEC0H,
341 .podr = (void __iomem *) MCFGPIO_PODR_FEC0H,
342 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FEC0H,
343 .setr = (void __iomem *) MCFGPIO_PPDSDR_FEC0H,
344 .clrr = (void __iomem *) MCFGPIO_PCLRR_FEC0H,
345 },
346 {
347 .gpio_chip = {
348 .label = "FEC0L",
349 .request = mcf_gpio_request,
350 .free = mcf_gpio_free,
351 .direction_input = mcf_gpio_direction_input,
352 .direction_output = mcf_gpio_direction_output,
353 .get = mcf_gpio_get_value,
354 .set = mcf_gpio_set_value_fast,
355 .base = 40,
356 .ngpio = 8,
357 },
358 .pddr = (void __iomem *) MCFGPIO_PDDR_FEC0L,
359 .podr = (void __iomem *) MCFGPIO_PODR_FEC0L,
360 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FEC0L,
361 .setr = (void __iomem *) MCFGPIO_PPDSDR_FEC0L,
362 .clrr = (void __iomem *) MCFGPIO_PCLRR_FEC0L,
363 },
364 {
365 .gpio_chip = {
366 .label = "FECI2C",
367 .request = mcf_gpio_request,
368 .free = mcf_gpio_free,
369 .direction_input = mcf_gpio_direction_input,
370 .direction_output = mcf_gpio_direction_output,
371 .get = mcf_gpio_get_value,
372 .set = mcf_gpio_set_value_fast,
373 .base = 48,
374 .ngpio = 6,
375 },
376 .pddr = (void __iomem *) MCFGPIO_PDDR_FECI2C,
377 .podr = (void __iomem *) MCFGPIO_PODR_FECI2C,
378 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
379 .setr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
380 .clrr = (void __iomem *) MCFGPIO_PCLRR_FECI2C,
381 },
382 {
383 .gpio_chip = {
384 .label = "QSPI",
385 .request = mcf_gpio_request,
386 .free = mcf_gpio_free,
387 .direction_input = mcf_gpio_direction_input,
388 .direction_output = mcf_gpio_direction_output,
389 .get = mcf_gpio_get_value,
390 .set = mcf_gpio_set_value_fast,
391 .base = 56,
392 .ngpio = 7,
393 },
394 .pddr = (void __iomem *) MCFGPIO_PDDR_QSPI,
395 .podr = (void __iomem *) MCFGPIO_PODR_QSPI,
396 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
397 .setr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
398 .clrr = (void __iomem *) MCFGPIO_PCLRR_QSPI,
399 },
400 {
401 .gpio_chip = {
402 .label = "SDRAM",
403 .request = mcf_gpio_request,
404 .free = mcf_gpio_free,
405 .direction_input = mcf_gpio_direction_input,
406 .direction_output = mcf_gpio_direction_output,
407 .get = mcf_gpio_get_value,
408 .set = mcf_gpio_set_value_fast,
409 .base = 64,
410 .ngpio = 8,
411 },
412 .pddr = (void __iomem *) MCFGPIO_PDDR_SDRAM,
413 .podr = (void __iomem *) MCFGPIO_PODR_SDRAM,
414 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_SDRAM,
415 .setr = (void __iomem *) MCFGPIO_PPDSDR_SDRAM,
416 .clrr = (void __iomem *) MCFGPIO_PCLRR_SDRAM,
417 },
418 {
419 .gpio_chip = {
420 .label = "TIMERH",
421 .request = mcf_gpio_request,
422 .free = mcf_gpio_free,
423 .direction_input = mcf_gpio_direction_input,
424 .direction_output = mcf_gpio_direction_output,
425 .get = mcf_gpio_get_value,
426 .set = mcf_gpio_set_value_fast,
427 .base = 72,
428 .ngpio = 4,
429 },
430 .pddr = (void __iomem *) MCFGPIO_PDDR_TIMERH,
431 .podr = (void __iomem *) MCFGPIO_PODR_TIMERH,
432 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_TIMERH,
433 .setr = (void __iomem *) MCFGPIO_PPDSDR_TIMERH,
434 .clrr = (void __iomem *) MCFGPIO_PCLRR_TIMERH,
435 },
436 {
437 .gpio_chip = {
438 .label = "TIMERL",
439 .request = mcf_gpio_request,
440 .free = mcf_gpio_free,
441 .direction_input = mcf_gpio_direction_input,
442 .direction_output = mcf_gpio_direction_output,
443 .get = mcf_gpio_get_value,
444 .set = mcf_gpio_set_value_fast,
445 .base = 80,
446 .ngpio = 4,
447 },
448 .pddr = (void __iomem *) MCFGPIO_PDDR_TIMERL,
449 .podr = (void __iomem *) MCFGPIO_PODR_TIMERL,
450 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_TIMERL,
451 .setr = (void __iomem *) MCFGPIO_PPDSDR_TIMERL,
452 .clrr = (void __iomem *) MCFGPIO_PCLRR_TIMERL,
453 },
454 {
455 .gpio_chip = {
456 .label = "UARTL",
457 .request = mcf_gpio_request,
458 .free = mcf_gpio_free,
459 .direction_input = mcf_gpio_direction_input,
460 .direction_output = mcf_gpio_direction_output,
461 .get = mcf_gpio_get_value,
462 .set = mcf_gpio_set_value_fast,
463 .base = 88,
464 .ngpio = 8,
465 },
466 .pddr = (void __iomem *) MCFGPIO_PDDR_UARTL,
467 .podr = (void __iomem *) MCFGPIO_PODR_UARTL,
468 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_UARTL,
469 .setr = (void __iomem *) MCFGPIO_PPDSDR_UARTL,
470 .clrr = (void __iomem *) MCFGPIO_PCLRR_UARTL,
471 },
472 {
473 .gpio_chip = {
474 .label = "FEC1H",
475 .request = mcf_gpio_request,
476 .free = mcf_gpio_free,
477 .direction_input = mcf_gpio_direction_input,
478 .direction_output = mcf_gpio_direction_output,
479 .get = mcf_gpio_get_value,
480 .set = mcf_gpio_set_value_fast,
481 .base = 96,
482 .ngpio = 8,
483 },
484 .pddr = (void __iomem *) MCFGPIO_PDDR_FEC1H,
485 .podr = (void __iomem *) MCFGPIO_PODR_FEC1H,
486 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FEC1H,
487 .setr = (void __iomem *) MCFGPIO_PPDSDR_FEC1H,
488 .clrr = (void __iomem *) MCFGPIO_PCLRR_FEC1H,
489 },
490 {
491 .gpio_chip = {
492 .label = "FEC1L",
493 .request = mcf_gpio_request,
494 .free = mcf_gpio_free,
495 .direction_input = mcf_gpio_direction_input,
496 .direction_output = mcf_gpio_direction_output,
497 .get = mcf_gpio_get_value,
498 .set = mcf_gpio_set_value_fast,
499 .base = 104,
500 .ngpio = 8,
501 },
502 .pddr = (void __iomem *) MCFGPIO_PDDR_FEC1L,
503 .podr = (void __iomem *) MCFGPIO_PODR_FEC1L,
504 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FEC1L,
505 .setr = (void __iomem *) MCFGPIO_PPDSDR_FEC1L,
506 .clrr = (void __iomem *) MCFGPIO_PCLRR_FEC1L,
507 },
508 {
509 .gpio_chip = {
510 .label = "BS",
511 .request = mcf_gpio_request,
512 .free = mcf_gpio_free,
513 .direction_input = mcf_gpio_direction_input,
514 .direction_output = mcf_gpio_direction_output,
515 .get = mcf_gpio_get_value,
516 .set = mcf_gpio_set_value_fast,
517 .base = 114,
518 .ngpio = 2,
519 },
520 .pddr = (void __iomem *) MCFGPIO_PDDR_BS,
521 .podr = (void __iomem *) MCFGPIO_PODR_BS,
522 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_BS,
523 .setr = (void __iomem *) MCFGPIO_PPDSDR_BS,
524 .clrr = (void __iomem *) MCFGPIO_PCLRR_BS,
525 },
526 {
527 .gpio_chip = {
528 .label = "IRQ",
529 .request = mcf_gpio_request,
530 .free = mcf_gpio_free,
531 .direction_input = mcf_gpio_direction_input,
532 .direction_output = mcf_gpio_direction_output,
533 .get = mcf_gpio_get_value,
534 .set = mcf_gpio_set_value_fast,
535 .base = 121,
536 .ngpio = 7,
537 },
538 .pddr = (void __iomem *) MCFGPIO_PDDR_IRQ,
539 .podr = (void __iomem *) MCFGPIO_PODR_IRQ,
540 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_IRQ,
541 .setr = (void __iomem *) MCFGPIO_PPDSDR_IRQ,
542 .clrr = (void __iomem *) MCFGPIO_PCLRR_IRQ,
543 },
544 {
545 .gpio_chip = {
546 .label = "USBH",
547 .request = mcf_gpio_request,
548 .free = mcf_gpio_free,
549 .direction_input = mcf_gpio_direction_input,
550 .direction_output = mcf_gpio_direction_output,
551 .get = mcf_gpio_get_value,
552 .set = mcf_gpio_set_value_fast,
553 .base = 128,
554 .ngpio = 1,
555 },
556 .pddr = (void __iomem *) MCFGPIO_PDDR_USBH,
557 .podr = (void __iomem *) MCFGPIO_PODR_USBH,
558 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_USBH,
559 .setr = (void __iomem *) MCFGPIO_PPDSDR_USBH,
560 .clrr = (void __iomem *) MCFGPIO_PCLRR_USBH,
561 },
562 {
563 .gpio_chip = {
564 .label = "USBL",
565 .request = mcf_gpio_request,
566 .free = mcf_gpio_free,
567 .direction_input = mcf_gpio_direction_input,
568 .direction_output = mcf_gpio_direction_output,
569 .get = mcf_gpio_get_value,
570 .set = mcf_gpio_set_value_fast,
571 .base = 136,
572 .ngpio = 8,
573 },
574 .pddr = (void __iomem *) MCFGPIO_PDDR_USBL,
575 .podr = (void __iomem *) MCFGPIO_PODR_USBL,
576 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_USBL,
577 .setr = (void __iomem *) MCFGPIO_PPDSDR_USBL,
578 .clrr = (void __iomem *) MCFGPIO_PCLRR_USBL,
579 },
580 {
581 .gpio_chip = {
582 .label = "UARTH",
583 .request = mcf_gpio_request,
584 .free = mcf_gpio_free,
585 .direction_input = mcf_gpio_direction_input,
586 .direction_output = mcf_gpio_direction_output,
587 .get = mcf_gpio_get_value,
588 .set = mcf_gpio_set_value_fast,
589 .base = 144,
590 .ngpio = 4,
591 },
592 .pddr = (void __iomem *) MCFGPIO_PDDR_UARTH,
593 .podr = (void __iomem *) MCFGPIO_PODR_UARTH,
594 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_UARTH,
595 .setr = (void __iomem *) MCFGPIO_PPDSDR_UARTH,
596 .clrr = (void __iomem *) MCFGPIO_PCLRR_UARTH,
597 },
598#endif
599};
600
601static int __init mcf_gpio_init(void)
602{
603 unsigned i = 0;
604 while (i < ARRAY_SIZE(mcf_gpio_chips))
605 (void)gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]);
606 return 0;
607}
608
609core_initcall(mcf_gpio_init);
diff --git a/arch/m68k/platform/528x/Makefile b/arch/m68k/platform/528x/Makefile
deleted file mode 100644
index 6ac4b57370ea..000000000000
--- a/arch/m68k/platform/528x/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5#
6# If you want to play with the HW breakpoints then you will
7# need to add define this, which will give you a stack backtrace
8# on the console port whenever a DBG interrupt occurs. You have to
9# set up you HW breakpoints to trigger a DBG interrupt:
10#
11# ccflags-y := -DTRAP_DBG_INTERRUPT
12# asflags-y := -DTRAP_DBG_INTERRUPT
13#
14
15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16
17obj-y := config.o gpio.o
18
diff --git a/arch/m68k/platform/528x/gpio.c b/arch/m68k/platform/528x/gpio.c
deleted file mode 100644
index 526db665d87e..000000000000
--- a/arch/m68k/platform/528x/gpio.c
+++ /dev/null
@@ -1,438 +0,0 @@
1/*
2 * Coldfire generic GPIO support
3 *
4 * (C) Copyright 2009, Steven King <sfking@fdwdc.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14*/
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18
19#include <asm/coldfire.h>
20#include <asm/mcfsim.h>
21#include <asm/mcfgpio.h>
22
23static struct mcf_gpio_chip mcf_gpio_chips[] = {
24 {
25 .gpio_chip = {
26 .label = "NQ",
27 .request = mcf_gpio_request,
28 .free = mcf_gpio_free,
29 .direction_input = mcf_gpio_direction_input,
30 .direction_output = mcf_gpio_direction_output,
31 .get = mcf_gpio_get_value,
32 .set = mcf_gpio_set_value,
33 .base = 1,
34 .ngpio = 7,
35 },
36 .pddr = (void __iomem *)MCFEPORT_EPDDR,
37 .podr = (void __iomem *)MCFEPORT_EPDR,
38 .ppdr = (void __iomem *)MCFEPORT_EPPDR,
39 },
40 {
41 .gpio_chip = {
42 .label = "TA",
43 .request = mcf_gpio_request,
44 .free = mcf_gpio_free,
45 .direction_input = mcf_gpio_direction_input,
46 .direction_output = mcf_gpio_direction_output,
47 .get = mcf_gpio_get_value,
48 .set = mcf_gpio_set_value_fast,
49 .base = 8,
50 .ngpio = 4,
51 },
52 .pddr = (void __iomem *)MCFGPTA_GPTDDR,
53 .podr = (void __iomem *)MCFGPTA_GPTPORT,
54 .ppdr = (void __iomem *)MCFGPTB_GPTPORT,
55 },
56 {
57 .gpio_chip = {
58 .label = "TB",
59 .request = mcf_gpio_request,
60 .free = mcf_gpio_free,
61 .direction_input = mcf_gpio_direction_input,
62 .direction_output = mcf_gpio_direction_output,
63 .get = mcf_gpio_get_value,
64 .set = mcf_gpio_set_value_fast,
65 .base = 16,
66 .ngpio = 4,
67 },
68 .pddr = (void __iomem *)MCFGPTB_GPTDDR,
69 .podr = (void __iomem *)MCFGPTB_GPTPORT,
70 .ppdr = (void __iomem *)MCFGPTB_GPTPORT,
71 },
72 {
73 .gpio_chip = {
74 .label = "QA",
75 .request = mcf_gpio_request,
76 .free = mcf_gpio_free,
77 .direction_input = mcf_gpio_direction_input,
78 .direction_output = mcf_gpio_direction_output,
79 .get = mcf_gpio_get_value,
80 .set = mcf_gpio_set_value_fast,
81 .base = 24,
82 .ngpio = 4,
83 },
84 .pddr = (void __iomem *)MCFQADC_DDRQA,
85 .podr = (void __iomem *)MCFQADC_PORTQA,
86 .ppdr = (void __iomem *)MCFQADC_PORTQA,
87 },
88 {
89 .gpio_chip = {
90 .label = "QB",
91 .request = mcf_gpio_request,
92 .free = mcf_gpio_free,
93 .direction_input = mcf_gpio_direction_input,
94 .direction_output = mcf_gpio_direction_output,
95 .get = mcf_gpio_get_value,
96 .set = mcf_gpio_set_value_fast,
97 .base = 32,
98 .ngpio = 4,
99 },
100 .pddr = (void __iomem *)MCFQADC_DDRQB,
101 .podr = (void __iomem *)MCFQADC_PORTQB,
102 .ppdr = (void __iomem *)MCFQADC_PORTQB,
103 },
104 {
105 .gpio_chip = {
106 .label = "A",
107 .request = mcf_gpio_request,
108 .free = mcf_gpio_free,
109 .direction_input = mcf_gpio_direction_input,
110 .direction_output = mcf_gpio_direction_output,
111 .get = mcf_gpio_get_value,
112 .set = mcf_gpio_set_value_fast,
113 .base = 40,
114 .ngpio = 8,
115 },
116 .pddr = (void __iomem *)MCFGPIO_DDRA,
117 .podr = (void __iomem *)MCFGPIO_PORTA,
118 .ppdr = (void __iomem *)MCFGPIO_PORTAP,
119 .setr = (void __iomem *)MCFGPIO_SETA,
120 .clrr = (void __iomem *)MCFGPIO_CLRA,
121 },
122 {
123 .gpio_chip = {
124 .label = "B",
125 .request = mcf_gpio_request,
126 .free = mcf_gpio_free,
127 .direction_input = mcf_gpio_direction_input,
128 .direction_output = mcf_gpio_direction_output,
129 .get = mcf_gpio_get_value,
130 .set = mcf_gpio_set_value_fast,
131 .base = 48,
132 .ngpio = 8,
133 },
134 .pddr = (void __iomem *)MCFGPIO_DDRB,
135 .podr = (void __iomem *)MCFGPIO_PORTB,
136 .ppdr = (void __iomem *)MCFGPIO_PORTBP,
137 .setr = (void __iomem *)MCFGPIO_SETB,
138 .clrr = (void __iomem *)MCFGPIO_CLRB,
139 },
140 {
141 .gpio_chip = {
142 .label = "C",
143 .request = mcf_gpio_request,
144 .free = mcf_gpio_free,
145 .direction_input = mcf_gpio_direction_input,
146 .direction_output = mcf_gpio_direction_output,
147 .get = mcf_gpio_get_value,
148 .set = mcf_gpio_set_value_fast,
149 .base = 56,
150 .ngpio = 8,
151 },
152 .pddr = (void __iomem *)MCFGPIO_DDRC,
153 .podr = (void __iomem *)MCFGPIO_PORTC,
154 .ppdr = (void __iomem *)MCFGPIO_PORTCP,
155 .setr = (void __iomem *)MCFGPIO_SETC,
156 .clrr = (void __iomem *)MCFGPIO_CLRC,
157 },
158 {
159 .gpio_chip = {
160 .label = "D",
161 .request = mcf_gpio_request,
162 .free = mcf_gpio_free,
163 .direction_input = mcf_gpio_direction_input,
164 .direction_output = mcf_gpio_direction_output,
165 .get = mcf_gpio_get_value,
166 .set = mcf_gpio_set_value_fast,
167 .base = 64,
168 .ngpio = 8,
169 },
170 .pddr = (void __iomem *)MCFGPIO_DDRD,
171 .podr = (void __iomem *)MCFGPIO_PORTD,
172 .ppdr = (void __iomem *)MCFGPIO_PORTDP,
173 .setr = (void __iomem *)MCFGPIO_SETD,
174 .clrr = (void __iomem *)MCFGPIO_CLRD,
175 },
176 {
177 .gpio_chip = {
178 .label = "E",
179 .request = mcf_gpio_request,
180 .free = mcf_gpio_free,
181 .direction_input = mcf_gpio_direction_input,
182 .direction_output = mcf_gpio_direction_output,
183 .get = mcf_gpio_get_value,
184 .set = mcf_gpio_set_value_fast,
185 .base = 72,
186 .ngpio = 8,
187 },
188 .pddr = (void __iomem *)MCFGPIO_DDRE,
189 .podr = (void __iomem *)MCFGPIO_PORTE,
190 .ppdr = (void __iomem *)MCFGPIO_PORTEP,
191 .setr = (void __iomem *)MCFGPIO_SETE,
192 .clrr = (void __iomem *)MCFGPIO_CLRE,
193 },
194 {
195 .gpio_chip = {
196 .label = "F",
197 .request = mcf_gpio_request,
198 .free = mcf_gpio_free,
199 .direction_input = mcf_gpio_direction_input,
200 .direction_output = mcf_gpio_direction_output,
201 .get = mcf_gpio_get_value,
202 .set = mcf_gpio_set_value_fast,
203 .base = 80,
204 .ngpio = 8,
205 },
206 .pddr = (void __iomem *)MCFGPIO_DDRF,
207 .podr = (void __iomem *)MCFGPIO_PORTF,
208 .ppdr = (void __iomem *)MCFGPIO_PORTFP,
209 .setr = (void __iomem *)MCFGPIO_SETF,
210 .clrr = (void __iomem *)MCFGPIO_CLRF,
211 },
212 {
213 .gpio_chip = {
214 .label = "G",
215 .request = mcf_gpio_request,
216 .free = mcf_gpio_free,
217 .direction_input = mcf_gpio_direction_input,
218 .direction_output = mcf_gpio_direction_output,
219 .get = mcf_gpio_get_value,
220 .set = mcf_gpio_set_value_fast,
221 .base = 88,
222 .ngpio = 8,
223 },
224 .pddr = (void __iomem *)MCFGPIO_DDRG,
225 .podr = (void __iomem *)MCFGPIO_PORTG,
226 .ppdr = (void __iomem *)MCFGPIO_PORTGP,
227 .setr = (void __iomem *)MCFGPIO_SETG,
228 .clrr = (void __iomem *)MCFGPIO_CLRG,
229 },
230 {
231 .gpio_chip = {
232 .label = "H",
233 .request = mcf_gpio_request,
234 .free = mcf_gpio_free,
235 .direction_input = mcf_gpio_direction_input,
236 .direction_output = mcf_gpio_direction_output,
237 .get = mcf_gpio_get_value,
238 .set = mcf_gpio_set_value_fast,
239 .base = 96,
240 .ngpio = 8,
241 },
242 .pddr = (void __iomem *)MCFGPIO_DDRH,
243 .podr = (void __iomem *)MCFGPIO_PORTH,
244 .ppdr = (void __iomem *)MCFGPIO_PORTHP,
245 .setr = (void __iomem *)MCFGPIO_SETH,
246 .clrr = (void __iomem *)MCFGPIO_CLRH,
247 },
248 {
249 .gpio_chip = {
250 .label = "J",
251 .request = mcf_gpio_request,
252 .free = mcf_gpio_free,
253 .direction_input = mcf_gpio_direction_input,
254 .direction_output = mcf_gpio_direction_output,
255 .get = mcf_gpio_get_value,
256 .set = mcf_gpio_set_value_fast,
257 .base = 104,
258 .ngpio = 8,
259 },
260 .pddr = (void __iomem *)MCFGPIO_DDRJ,
261 .podr = (void __iomem *)MCFGPIO_PORTJ,
262 .ppdr = (void __iomem *)MCFGPIO_PORTJP,
263 .setr = (void __iomem *)MCFGPIO_SETJ,
264 .clrr = (void __iomem *)MCFGPIO_CLRJ,
265 },
266 {
267 .gpio_chip = {
268 .label = "DD",
269 .request = mcf_gpio_request,
270 .free = mcf_gpio_free,
271 .direction_input = mcf_gpio_direction_input,
272 .direction_output = mcf_gpio_direction_output,
273 .get = mcf_gpio_get_value,
274 .set = mcf_gpio_set_value_fast,
275 .base = 112,
276 .ngpio = 8,
277 },
278 .pddr = (void __iomem *)MCFGPIO_DDRDD,
279 .podr = (void __iomem *)MCFGPIO_PORTDD,
280 .ppdr = (void __iomem *)MCFGPIO_PORTDDP,
281 .setr = (void __iomem *)MCFGPIO_SETDD,
282 .clrr = (void __iomem *)MCFGPIO_CLRDD,
283 },
284 {
285 .gpio_chip = {
286 .label = "EH",
287 .request = mcf_gpio_request,
288 .free = mcf_gpio_free,
289 .direction_input = mcf_gpio_direction_input,
290 .direction_output = mcf_gpio_direction_output,
291 .get = mcf_gpio_get_value,
292 .set = mcf_gpio_set_value_fast,
293 .base = 120,
294 .ngpio = 8,
295 },
296 .pddr = (void __iomem *)MCFGPIO_DDREH,
297 .podr = (void __iomem *)MCFGPIO_PORTEH,
298 .ppdr = (void __iomem *)MCFGPIO_PORTEHP,
299 .setr = (void __iomem *)MCFGPIO_SETEH,
300 .clrr = (void __iomem *)MCFGPIO_CLREH,
301 },
302 {
303 .gpio_chip = {
304 .label = "EL",
305 .request = mcf_gpio_request,
306 .free = mcf_gpio_free,
307 .direction_input = mcf_gpio_direction_input,
308 .direction_output = mcf_gpio_direction_output,
309 .get = mcf_gpio_get_value,
310 .set = mcf_gpio_set_value_fast,
311 .base = 128,
312 .ngpio = 8,
313 },
314 .pddr = (void __iomem *)MCFGPIO_DDREL,
315 .podr = (void __iomem *)MCFGPIO_PORTEL,
316 .ppdr = (void __iomem *)MCFGPIO_PORTELP,
317 .setr = (void __iomem *)MCFGPIO_SETEL,
318 .clrr = (void __iomem *)MCFGPIO_CLREL,
319 },
320 {
321 .gpio_chip = {
322 .label = "AS",
323 .request = mcf_gpio_request,
324 .free = mcf_gpio_free,
325 .direction_input = mcf_gpio_direction_input,
326 .direction_output = mcf_gpio_direction_output,
327 .get = mcf_gpio_get_value,
328 .set = mcf_gpio_set_value_fast,
329 .base = 136,
330 .ngpio = 6,
331 },
332 .pddr = (void __iomem *)MCFGPIO_DDRAS,
333 .podr = (void __iomem *)MCFGPIO_PORTAS,
334 .ppdr = (void __iomem *)MCFGPIO_PORTASP,
335 .setr = (void __iomem *)MCFGPIO_SETAS,
336 .clrr = (void __iomem *)MCFGPIO_CLRAS,
337 },
338 {
339 .gpio_chip = {
340 .label = "QS",
341 .request = mcf_gpio_request,
342 .free = mcf_gpio_free,
343 .direction_input = mcf_gpio_direction_input,
344 .direction_output = mcf_gpio_direction_output,
345 .get = mcf_gpio_get_value,
346 .set = mcf_gpio_set_value_fast,
347 .base = 144,
348 .ngpio = 7,
349 },
350 .pddr = (void __iomem *)MCFGPIO_DDRQS,
351 .podr = (void __iomem *)MCFGPIO_PORTQS,
352 .ppdr = (void __iomem *)MCFGPIO_PORTQSP,
353 .setr = (void __iomem *)MCFGPIO_SETQS,
354 .clrr = (void __iomem *)MCFGPIO_CLRQS,
355 },
356 {
357 .gpio_chip = {
358 .label = "SD",
359 .request = mcf_gpio_request,
360 .free = mcf_gpio_free,
361 .direction_input = mcf_gpio_direction_input,
362 .direction_output = mcf_gpio_direction_output,
363 .get = mcf_gpio_get_value,
364 .set = mcf_gpio_set_value_fast,
365 .base = 152,
366 .ngpio = 6,
367 },
368 .pddr = (void __iomem *)MCFGPIO_DDRSD,
369 .podr = (void __iomem *)MCFGPIO_PORTSD,
370 .ppdr = (void __iomem *)MCFGPIO_PORTSDP,
371 .setr = (void __iomem *)MCFGPIO_SETSD,
372 .clrr = (void __iomem *)MCFGPIO_CLRSD,
373 },
374 {
375 .gpio_chip = {
376 .label = "TC",
377 .request = mcf_gpio_request,
378 .free = mcf_gpio_free,
379 .direction_input = mcf_gpio_direction_input,
380 .direction_output = mcf_gpio_direction_output,
381 .get = mcf_gpio_get_value,
382 .set = mcf_gpio_set_value_fast,
383 .base = 160,
384 .ngpio = 4,
385 },
386 .pddr = (void __iomem *)MCFGPIO_DDRTC,
387 .podr = (void __iomem *)MCFGPIO_PORTTC,
388 .ppdr = (void __iomem *)MCFGPIO_PORTTCP,
389 .setr = (void __iomem *)MCFGPIO_SETTC,
390 .clrr = (void __iomem *)MCFGPIO_CLRTC,
391 },
392 {
393 .gpio_chip = {
394 .label = "TD",
395 .request = mcf_gpio_request,
396 .free = mcf_gpio_free,
397 .direction_input = mcf_gpio_direction_input,
398 .direction_output = mcf_gpio_direction_output,
399 .get = mcf_gpio_get_value,
400 .set = mcf_gpio_set_value_fast,
401 .base = 168,
402 .ngpio = 4,
403 },
404 .pddr = (void __iomem *)MCFGPIO_DDRTD,
405 .podr = (void __iomem *)MCFGPIO_PORTTD,
406 .ppdr = (void __iomem *)MCFGPIO_PORTTDP,
407 .setr = (void __iomem *)MCFGPIO_SETTD,
408 .clrr = (void __iomem *)MCFGPIO_CLRTD,
409 },
410 {
411 .gpio_chip = {
412 .label = "UA",
413 .request = mcf_gpio_request,
414 .free = mcf_gpio_free,
415 .direction_input = mcf_gpio_direction_input,
416 .direction_output = mcf_gpio_direction_output,
417 .get = mcf_gpio_get_value,
418 .set = mcf_gpio_set_value_fast,
419 .base = 176,
420 .ngpio = 4,
421 },
422 .pddr = (void __iomem *)MCFGPIO_DDRUA,
423 .podr = (void __iomem *)MCFGPIO_PORTUA,
424 .ppdr = (void __iomem *)MCFGPIO_PORTUAP,
425 .setr = (void __iomem *)MCFGPIO_SETUA,
426 .clrr = (void __iomem *)MCFGPIO_CLRUA,
427 },
428};
429
430static int __init mcf_gpio_init(void)
431{
432 unsigned i = 0;
433 while (i < ARRAY_SIZE(mcf_gpio_chips))
434 (void)gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]);
435 return 0;
436}
437
438core_initcall(mcf_gpio_init);
diff --git a/arch/m68k/platform/5307/Makefile b/arch/m68k/platform/5307/Makefile
deleted file mode 100644
index d4293b791f2e..000000000000
--- a/arch/m68k/platform/5307/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
1#
2# Makefile for the m68knommu kernel.
3#
4
5#
6# If you want to play with the HW breakpoints then you will
7# need to add define this, which will give you a stack backtrace
8# on the console port whenever a DBG interrupt occurs. You have to
9# set up you HW breakpoints to trigger a DBG interrupt:
10#
11# ccflags-y := -DTRAP_DBG_INTERRUPT
12# asflags-y := -DTRAP_DBG_INTERRUPT
13#
14
15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16
17obj-y += config.o gpio.o
18obj-$(CONFIG_NETtel) += nettel.o
19obj-$(CONFIG_CLEOPATRA) += nettel.o
20
diff --git a/arch/m68k/platform/5307/gpio.c b/arch/m68k/platform/5307/gpio.c
deleted file mode 100644
index 5850612b4a38..000000000000
--- a/arch/m68k/platform/5307/gpio.c
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * Coldfire generic GPIO support
3 *
4 * (C) Copyright 2009, Steven King <sfking@fdwdc.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14*/
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18
19#include <asm/coldfire.h>
20#include <asm/mcfsim.h>
21#include <asm/mcfgpio.h>
22
23static struct mcf_gpio_chip mcf_gpio_chips[] = {
24 {
25 .gpio_chip = {
26 .label = "PP",
27 .request = mcf_gpio_request,
28 .free = mcf_gpio_free,
29 .direction_input = mcf_gpio_direction_input,
30 .direction_output = mcf_gpio_direction_output,
31 .get = mcf_gpio_get_value,
32 .set = mcf_gpio_set_value,
33 .ngpio = 16,
34 },
35 .pddr = (void __iomem *) MCFSIM_PADDR,
36 .podr = (void __iomem *) MCFSIM_PADAT,
37 .ppdr = (void __iomem *) MCFSIM_PADAT,
38 },
39};
40
41static int __init mcf_gpio_init(void)
42{
43 unsigned i = 0;
44 while (i < ARRAY_SIZE(mcf_gpio_chips))
45 (void)gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]);
46 return 0;
47}
48
49core_initcall(mcf_gpio_init);
diff --git a/arch/m68k/platform/532x/Makefile b/arch/m68k/platform/532x/Makefile
deleted file mode 100644
index ce01669399c6..000000000000
--- a/arch/m68k/platform/532x/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
1#
2# Makefile for the m68knommu linux kernel.
3#
4
5#
6# If you want to play with the HW breakpoints then you will
7# need to add define this, which will give you a stack backtrace
8# on the console port whenever a DBG interrupt occurs. You have to
9# set up you HW breakpoints to trigger a DBG interrupt:
10#
11# ccflags-y := -DTRAP_DBG_INTERRUPT
12# asflags-y := -DTRAP_DBG_INTERRUPT
13#
14
15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16
17#obj-y := config.o usb-mcf532x.o spi-mcf532x.o
18obj-y := config.o gpio.o
diff --git a/arch/m68k/platform/532x/gpio.c b/arch/m68k/platform/532x/gpio.c
deleted file mode 100644
index 212a85deac90..000000000000
--- a/arch/m68k/platform/532x/gpio.c
+++ /dev/null
@@ -1,337 +0,0 @@
1/*
2 * Coldfire generic GPIO support
3 *
4 * (C) Copyright 2009, Steven King <sfking@fdwdc.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14*/
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18
19#include <asm/coldfire.h>
20#include <asm/mcfsim.h>
21#include <asm/mcfgpio.h>
22
23static struct mcf_gpio_chip mcf_gpio_chips[] = {
24 {
25 .gpio_chip = {
26 .label = "PIRQ",
27 .request = mcf_gpio_request,
28 .free = mcf_gpio_free,
29 .direction_input = mcf_gpio_direction_input,
30 .direction_output = mcf_gpio_direction_output,
31 .get = mcf_gpio_get_value,
32 .set = mcf_gpio_set_value,
33 .ngpio = 8,
34 },
35 .pddr = (void __iomem *) MCFEPORT_EPDDR,
36 .podr = (void __iomem *) MCFEPORT_EPDR,
37 .ppdr = (void __iomem *) MCFEPORT_EPPDR,
38 },
39 {
40 .gpio_chip = {
41 .label = "FECH",
42 .request = mcf_gpio_request,
43 .free = mcf_gpio_free,
44 .direction_input = mcf_gpio_direction_input,
45 .direction_output = mcf_gpio_direction_output,
46 .get = mcf_gpio_get_value,
47 .set = mcf_gpio_set_value_fast,
48 .base = 8,
49 .ngpio = 8,
50 },
51 .pddr = (void __iomem *) MCFGPIO_PDDR_FECH,
52 .podr = (void __iomem *) MCFGPIO_PODR_FECH,
53 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FECH,
54 .setr = (void __iomem *) MCFGPIO_PPDSDR_FECH,
55 .clrr = (void __iomem *) MCFGPIO_PCLRR_FECH,
56 },
57 {
58 .gpio_chip = {
59 .label = "FECL",
60 .request = mcf_gpio_request,
61 .free = mcf_gpio_free,
62 .direction_input = mcf_gpio_direction_input,
63 .direction_output = mcf_gpio_direction_output,
64 .get = mcf_gpio_get_value,
65 .set = mcf_gpio_set_value_fast,
66 .base = 16,
67 .ngpio = 8,
68 },
69 .pddr = (void __iomem *) MCFGPIO_PDDR_FECL,
70 .podr = (void __iomem *) MCFGPIO_PODR_FECL,
71 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FECL,
72 .setr = (void __iomem *) MCFGPIO_PPDSDR_FECL,
73 .clrr = (void __iomem *) MCFGPIO_PCLRR_FECL,
74 },
75 {
76 .gpio_chip = {
77 .label = "SSI",
78 .request = mcf_gpio_request,
79 .free = mcf_gpio_free,
80 .direction_input = mcf_gpio_direction_input,
81 .direction_output = mcf_gpio_direction_output,
82 .get = mcf_gpio_get_value,
83 .set = mcf_gpio_set_value_fast,
84 .base = 24,
85 .ngpio = 5,
86 },
87 .pddr = (void __iomem *) MCFGPIO_PDDR_SSI,
88 .podr = (void __iomem *) MCFGPIO_PODR_SSI,
89 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_SSI,
90 .setr = (void __iomem *) MCFGPIO_PPDSDR_SSI,
91 .clrr = (void __iomem *) MCFGPIO_PCLRR_SSI,
92 },
93 {
94 .gpio_chip = {
95 .label = "BUSCTL",
96 .request = mcf_gpio_request,
97 .free = mcf_gpio_free,
98 .direction_input = mcf_gpio_direction_input,
99 .direction_output = mcf_gpio_direction_output,
100 .get = mcf_gpio_get_value,
101 .set = mcf_gpio_set_value_fast,
102 .base = 32,
103 .ngpio = 4,
104 },
105 .pddr = (void __iomem *) MCFGPIO_PDDR_BUSCTL,
106 .podr = (void __iomem *) MCFGPIO_PODR_BUSCTL,
107 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_BUSCTL,
108 .setr = (void __iomem *) MCFGPIO_PPDSDR_BUSCTL,
109 .clrr = (void __iomem *) MCFGPIO_PCLRR_BUSCTL,
110 },
111 {
112 .gpio_chip = {
113 .label = "BE",
114 .request = mcf_gpio_request,
115 .free = mcf_gpio_free,
116 .direction_input = mcf_gpio_direction_input,
117 .direction_output = mcf_gpio_direction_output,
118 .get = mcf_gpio_get_value,
119 .set = mcf_gpio_set_value_fast,
120 .base = 40,
121 .ngpio = 4,
122 },
123 .pddr = (void __iomem *) MCFGPIO_PDDR_BE,
124 .podr = (void __iomem *) MCFGPIO_PODR_BE,
125 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_BE,
126 .setr = (void __iomem *) MCFGPIO_PPDSDR_BE,
127 .clrr = (void __iomem *) MCFGPIO_PCLRR_BE,
128 },
129 {
130 .gpio_chip = {
131 .label = "CS",
132 .request = mcf_gpio_request,
133 .free = mcf_gpio_free,
134 .direction_input = mcf_gpio_direction_input,
135 .direction_output = mcf_gpio_direction_output,
136 .get = mcf_gpio_get_value,
137 .set = mcf_gpio_set_value_fast,
138 .base = 49,
139 .ngpio = 5,
140 },
141 .pddr = (void __iomem *) MCFGPIO_PDDR_CS,
142 .podr = (void __iomem *) MCFGPIO_PODR_CS,
143 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_CS,
144 .setr = (void __iomem *) MCFGPIO_PPDSDR_CS,
145 .clrr = (void __iomem *) MCFGPIO_PCLRR_CS,
146 },
147 {
148 .gpio_chip = {
149 .label = "PWM",
150 .request = mcf_gpio_request,
151 .free = mcf_gpio_free,
152 .direction_input = mcf_gpio_direction_input,
153 .direction_output = mcf_gpio_direction_output,
154 .get = mcf_gpio_get_value,
155 .set = mcf_gpio_set_value_fast,
156 .base = 58,
157 .ngpio = 4,
158 },
159 .pddr = (void __iomem *) MCFGPIO_PDDR_PWM,
160 .podr = (void __iomem *) MCFGPIO_PODR_PWM,
161 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_PWM,
162 .setr = (void __iomem *) MCFGPIO_PPDSDR_PWM,
163 .clrr = (void __iomem *) MCFGPIO_PCLRR_PWM,
164 },
165 {
166 .gpio_chip = {
167 .label = "FECI2C",
168 .request = mcf_gpio_request,
169 .free = mcf_gpio_free,
170 .direction_input = mcf_gpio_direction_input,
171 .direction_output = mcf_gpio_direction_output,
172 .get = mcf_gpio_get_value,
173 .set = mcf_gpio_set_value_fast,
174 .base = 64,
175 .ngpio = 4,
176 },
177 .pddr = (void __iomem *) MCFGPIO_PDDR_FECI2C,
178 .podr = (void __iomem *) MCFGPIO_PODR_FECI2C,
179 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
180 .setr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
181 .clrr = (void __iomem *) MCFGPIO_PCLRR_FECI2C,
182 },
183 {
184 .gpio_chip = {
185 .label = "UART",
186 .request = mcf_gpio_request,
187 .free = mcf_gpio_free,
188 .direction_input = mcf_gpio_direction_input,
189 .direction_output = mcf_gpio_direction_output,
190 .get = mcf_gpio_get_value,
191 .set = mcf_gpio_set_value_fast,
192 .base = 72,
193 .ngpio = 8,
194 },
195 .pddr = (void __iomem *) MCFGPIO_PDDR_UART,
196 .podr = (void __iomem *) MCFGPIO_PODR_UART,
197 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_UART,
198 .setr = (void __iomem *) MCFGPIO_PPDSDR_UART,
199 .clrr = (void __iomem *) MCFGPIO_PCLRR_UART,
200 },
201 {
202 .gpio_chip = {
203 .label = "QSPI",
204 .request = mcf_gpio_request,
205 .free = mcf_gpio_free,
206 .direction_input = mcf_gpio_direction_input,
207 .direction_output = mcf_gpio_direction_output,
208 .get = mcf_gpio_get_value,
209 .set = mcf_gpio_set_value_fast,
210 .base = 80,
211 .ngpio = 6,
212 },
213 .pddr = (void __iomem *) MCFGPIO_PDDR_QSPI,
214 .podr = (void __iomem *) MCFGPIO_PODR_QSPI,
215 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
216 .setr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
217 .clrr = (void __iomem *) MCFGPIO_PCLRR_QSPI,
218 },
219 {
220 .gpio_chip = {
221 .label = "TIMER",
222 .request = mcf_gpio_request,
223 .free = mcf_gpio_free,
224 .direction_input = mcf_gpio_direction_input,
225 .direction_output = mcf_gpio_direction_output,
226 .get = mcf_gpio_get_value,
227 .set = mcf_gpio_set_value_fast,
228 .base = 88,
229 .ngpio = 4,
230 },
231 .pddr = (void __iomem *) MCFGPIO_PDDR_TIMER,
232 .podr = (void __iomem *) MCFGPIO_PODR_TIMER,
233 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_TIMER,
234 .setr = (void __iomem *) MCFGPIO_PPDSDR_TIMER,
235 .clrr = (void __iomem *) MCFGPIO_PCLRR_TIMER,
236 },
237 {
238 .gpio_chip = {
239 .label = "LCDDATAH",
240 .request = mcf_gpio_request,
241 .free = mcf_gpio_free,
242 .direction_input = mcf_gpio_direction_input,
243 .direction_output = mcf_gpio_direction_output,
244 .get = mcf_gpio_get_value,
245 .set = mcf_gpio_set_value_fast,
246 .base = 96,
247 .ngpio = 2,
248 },
249 .pddr = (void __iomem *) MCFGPIO_PDDR_LCDDATAH,
250 .podr = (void __iomem *) MCFGPIO_PODR_LCDDATAH,
251 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_LCDDATAH,
252 .setr = (void __iomem *) MCFGPIO_PPDSDR_LCDDATAH,
253 .clrr = (void __iomem *) MCFGPIO_PCLRR_LCDDATAH,
254 },
255 {
256 .gpio_chip = {
257 .label = "LCDDATAM",
258 .request = mcf_gpio_request,
259 .free = mcf_gpio_free,
260 .direction_input = mcf_gpio_direction_input,
261 .direction_output = mcf_gpio_direction_output,
262 .get = mcf_gpio_get_value,
263 .set = mcf_gpio_set_value_fast,
264 .base = 104,
265 .ngpio = 8,
266 },
267 .pddr = (void __iomem *) MCFGPIO_PDDR_LCDDATAM,
268 .podr = (void __iomem *) MCFGPIO_PODR_LCDDATAM,
269 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_LCDDATAM,
270 .setr = (void __iomem *) MCFGPIO_PPDSDR_LCDDATAM,
271 .clrr = (void __iomem *) MCFGPIO_PCLRR_LCDDATAM,
272 },
273 {
274 .gpio_chip = {
275 .label = "LCDDATAL",
276 .request = mcf_gpio_request,
277 .free = mcf_gpio_free,
278 .direction_input = mcf_gpio_direction_input,
279 .direction_output = mcf_gpio_direction_output,
280 .get = mcf_gpio_get_value,
281 .set = mcf_gpio_set_value_fast,
282 .base = 112,
283 .ngpio = 8,
284 },
285 .pddr = (void __iomem *) MCFGPIO_PDDR_LCDDATAL,
286 .podr = (void __iomem *) MCFGPIO_PODR_LCDDATAL,
287 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_LCDDATAL,
288 .setr = (void __iomem *) MCFGPIO_PPDSDR_LCDDATAL,
289 .clrr = (void __iomem *) MCFGPIO_PCLRR_LCDDATAL,
290 },
291 {
292 .gpio_chip = {
293 .label = "LCDCTLH",
294 .request = mcf_gpio_request,
295 .free = mcf_gpio_free,
296 .direction_input = mcf_gpio_direction_input,
297 .direction_output = mcf_gpio_direction_output,
298 .get = mcf_gpio_get_value,
299 .set = mcf_gpio_set_value_fast,
300 .base = 120,
301 .ngpio = 1,
302 },
303 .pddr = (void __iomem *) MCFGPIO_PDDR_LCDCTLH,
304 .podr = (void __iomem *) MCFGPIO_PODR_LCDCTLH,
305 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_LCDCTLH,
306 .setr = (void __iomem *) MCFGPIO_PPDSDR_LCDCTLH,
307 .clrr = (void __iomem *) MCFGPIO_PCLRR_LCDCTLH,
308 },
309 {
310 .gpio_chip = {
311 .label = "LCDCTLL",
312 .request = mcf_gpio_request,
313 .free = mcf_gpio_free,
314 .direction_input = mcf_gpio_direction_input,
315 .direction_output = mcf_gpio_direction_output,
316 .get = mcf_gpio_get_value,
317 .set = mcf_gpio_set_value_fast,
318 .base = 128,
319 .ngpio = 8,
320 },
321 .pddr = (void __iomem *) MCFGPIO_PDDR_LCDCTLL,
322 .podr = (void __iomem *) MCFGPIO_PODR_LCDCTLL,
323 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_LCDCTLL,
324 .setr = (void __iomem *) MCFGPIO_PPDSDR_LCDCTLL,
325 .clrr = (void __iomem *) MCFGPIO_PCLRR_LCDCTLL,
326 },
327};
328
329static int __init mcf_gpio_init(void)
330{
331 unsigned i = 0;
332 while (i < ARRAY_SIZE(mcf_gpio_chips))
333 (void)gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]);
334 return 0;
335}
336
337core_initcall(mcf_gpio_init);
diff --git a/arch/m68k/platform/5407/Makefile b/arch/m68k/platform/5407/Makefile
deleted file mode 100644
index e83fe148eddc..000000000000
--- a/arch/m68k/platform/5407/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
1#
2# Makefile for the m68knommu linux kernel.
3#
4
5#
6# If you want to play with the HW breakpoints then you will
7# need to add define this, which will give you a stack backtrace
8# on the console port whenever a DBG interrupt occurs. You have to
9# set up you HW breakpoints to trigger a DBG interrupt:
10#
11# ccflags-y := -DTRAP_DBG_INTERRUPT
12# asflags-y := -DTRAP_DBG_INTERRUPT
13#
14
15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16
17obj-y := config.o gpio.o
18
diff --git a/arch/m68k/platform/5407/gpio.c b/arch/m68k/platform/5407/gpio.c
deleted file mode 100644
index 5850612b4a38..000000000000
--- a/arch/m68k/platform/5407/gpio.c
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * Coldfire generic GPIO support
3 *
4 * (C) Copyright 2009, Steven King <sfking@fdwdc.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14*/
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18
19#include <asm/coldfire.h>
20#include <asm/mcfsim.h>
21#include <asm/mcfgpio.h>
22
23static struct mcf_gpio_chip mcf_gpio_chips[] = {
24 {
25 .gpio_chip = {
26 .label = "PP",
27 .request = mcf_gpio_request,
28 .free = mcf_gpio_free,
29 .direction_input = mcf_gpio_direction_input,
30 .direction_output = mcf_gpio_direction_output,
31 .get = mcf_gpio_get_value,
32 .set = mcf_gpio_set_value,
33 .ngpio = 16,
34 },
35 .pddr = (void __iomem *) MCFSIM_PADDR,
36 .podr = (void __iomem *) MCFSIM_PADAT,
37 .ppdr = (void __iomem *) MCFSIM_PADAT,
38 },
39};
40
41static int __init mcf_gpio_init(void)
42{
43 unsigned i = 0;
44 while (i < ARRAY_SIZE(mcf_gpio_chips))
45 (void)gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]);
46 return 0;
47}
48
49core_initcall(mcf_gpio_init);
diff --git a/arch/m68k/platform/54xx/Makefile b/arch/m68k/platform/54xx/Makefile
deleted file mode 100644
index 6cfd090ec3cd..000000000000
--- a/arch/m68k/platform/54xx/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
1#
2# Makefile for the m68knommu linux kernel.
3#
4
5#
6# If you want to play with the HW breakpoints then you will
7# need to add define this, which will give you a stack backtrace
8# on the console port whenever a DBG interrupt occurs. You have to
9# set up you HW breakpoints to trigger a DBG interrupt:
10#
11# EXTRA_CFLAGS += -DTRAP_DBG_INTERRUPT
12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT
13#
14
15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16
17obj-y := config.o
18obj-$(CONFIG_FIREBEE) += firebee.o
19
diff --git a/arch/m68k/platform/68EZ328/Makefile b/arch/m68k/platform/68EZ328/Makefile
index ee97735a242c..b44d799b1115 100644
--- a/arch/m68k/platform/68EZ328/Makefile
+++ b/arch/m68k/platform/68EZ328/Makefile
@@ -3,9 +3,3 @@
3# 3#
4 4
5obj-y := config.o 5obj-y := config.o
6
7extra-y := bootlogo.rh
8
9$(obj)/bootlogo.rh: $(src)/bootlogo.h
10 perl $(src)/../68328/bootlogo.pl < $(src)/bootlogo.h \
11 > $(obj)/bootlogo.rh
diff --git a/arch/m68k/platform/68VZ328/Makefile b/arch/m68k/platform/68VZ328/Makefile
index 447ffa0fd7c7..a49d75e65489 100644
--- a/arch/m68k/platform/68VZ328/Makefile
+++ b/arch/m68k/platform/68VZ328/Makefile
@@ -3,14 +3,9 @@
3# 3#
4 4
5obj-y := config.o 5obj-y := config.o
6logo-$(UCDIMM) := bootlogo.rh 6extra-$(DRAGEN2):= screen.h
7logo-$(DRAGEN2) := screen.h
8extra-y := $(logo-y)
9
10$(obj)/bootlogo.rh: $(src)/../68EZ328/bootlogo.h
11 perl $(src)/bootlogo.pl < $(src)/../68328/bootlogo.h > $(obj)/bootlogo.rh
12 7
13$(obj)/screen.h: $(src)/screen.xbm $(src)/xbm2lcd.pl 8$(obj)/screen.h: $(src)/screen.xbm $(src)/xbm2lcd.pl
14 perl $(src)/xbm2lcd.pl < $(src)/screen.xbm > $(obj)/screen.h 9 perl $(src)/xbm2lcd.pl < $(src)/screen.xbm > $(obj)/screen.h
15 10
16clean-files := $(obj)/screen.h $(obj)/bootlogo.rh 11clean-files := $(obj)/screen.h
diff --git a/arch/m68k/platform/68EZ328/bootlogo.h b/arch/m68k/platform/68VZ328/bootlogo.h
index e842bdae5839..b38e2b255142 100644
--- a/arch/m68k/platform/68EZ328/bootlogo.h
+++ b/arch/m68k/platform/68VZ328/bootlogo.h
@@ -1,6 +1,6 @@
1#define splash_width 640 1#define splash_width 640
2#define splash_height 480 2#define splash_height 480
3static unsigned char splash_bits[] = { 3unsigned char __attribute__ ((aligned(16))) bootlogo_bits[] = {
4 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 4 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 5 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 6 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
diff --git a/arch/m68k/platform/coldfire/Makefile b/arch/m68k/platform/coldfire/Makefile
index a0815c61dec1..76d389d9a84e 100644
--- a/arch/m68k/platform/coldfire/Makefile
+++ b/arch/m68k/platform/coldfire/Makefile
@@ -15,18 +15,22 @@
15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1 15asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
16 16
17obj-$(CONFIG_COLDFIRE) += cache.o clk.o device.o dma.o entry.o vectors.o 17obj-$(CONFIG_COLDFIRE) += cache.o clk.o device.o dma.o entry.o vectors.o
18obj-$(CONFIG_M5206) += timers.o intc.o reset.o 18obj-$(CONFIG_M5206) += m5206.o timers.o intc.o reset.o
19obj-$(CONFIG_M5206e) += timers.o intc.o reset.o 19obj-$(CONFIG_M5206e) += m5206.o timers.o intc.o reset.o
20obj-$(CONFIG_M520x) += pit.o intc-simr.o reset.o 20obj-$(CONFIG_M520x) += m520x.o pit.o intc-simr.o reset.o
21obj-$(CONFIG_M523x) += pit.o dma_timer.o intc-2.o reset.o 21obj-$(CONFIG_M523x) += m523x.o pit.o dma_timer.o intc-2.o reset.o
22obj-$(CONFIG_M5249) += timers.o intc.o reset.o 22obj-$(CONFIG_M5249) += m5249.o timers.o intc.o intc-5249.o reset.o
23obj-$(CONFIG_M527x) += pit.o intc-2.o reset.o 23obj-$(CONFIG_M527x) += m527x.o pit.o intc-2.o reset.o
24obj-$(CONFIG_M5272) += timers.o 24obj-$(CONFIG_M5272) += m5272.o intc-5272.o timers.o
25obj-$(CONFIG_M528x) += pit.o intc-2.o reset.o 25obj-$(CONFIG_M528x) += m528x.o pit.o intc-2.o reset.o
26obj-$(CONFIG_M5307) += timers.o intc.o reset.o 26obj-$(CONFIG_M5307) += m5307.o timers.o intc.o reset.o
27obj-$(CONFIG_M532x) += timers.o intc-simr.o reset.o 27obj-$(CONFIG_M532x) += m532x.o timers.o intc-simr.o reset.o
28obj-$(CONFIG_M5407) += timers.o intc.o reset.o 28obj-$(CONFIG_M5407) += m5407.o timers.o intc.o reset.o
29obj-$(CONFIG_M54xx) += sltimers.o intc-2.o 29obj-$(CONFIG_M54xx) += m54xx.o sltimers.o intc-2.o
30
31obj-$(CONFIG_NETtel) += nettel.o
32obj-$(CONFIG_CLEOPATRA) += nettel.o
33obj-$(CONFIG_FIREBEE) += firebee.o
30 34
31obj-y += pinmux.o gpio.o 35obj-y += pinmux.o gpio.o
32extra-y := head.o 36extra-y := head.o
diff --git a/arch/m68k/platform/coldfire/device.c b/arch/m68k/platform/coldfire/device.c
index fa50c48292ff..3aa77ddea89d 100644
--- a/arch/m68k/platform/coldfire/device.c
+++ b/arch/m68k/platform/coldfire/device.c
@@ -114,14 +114,14 @@ static struct resource mcf_fec1_resources[] = {
114 114
115static struct platform_device mcf_fec1 = { 115static struct platform_device mcf_fec1 = {
116 .name = "fec", 116 .name = "fec",
117 .id = 0, 117 .id = 1,
118 .num_resources = ARRAY_SIZE(mcf_fec1_resources), 118 .num_resources = ARRAY_SIZE(mcf_fec1_resources),
119 .resource = mcf_fec1_resources, 119 .resource = mcf_fec1_resources,
120}; 120};
121#endif /* MCFFEC_BASE1 */ 121#endif /* MCFFEC_BASE1 */
122#endif /* CONFIG_FEC */ 122#endif /* CONFIG_FEC */
123 123
124#ifdef CONFIG_SPI_COLDFIRE_QSPI 124#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
125/* 125/*
126 * The ColdFire QSPI module is an SPI protocol hardware block used 126 * The ColdFire QSPI module is an SPI protocol hardware block used
127 * on a number of different ColdFire CPUs. 127 * on a number of different ColdFire CPUs.
@@ -274,7 +274,7 @@ static struct platform_device mcf_qspi = {
274 .resource = mcf_qspi_resources, 274 .resource = mcf_qspi_resources,
275 .dev.platform_data = &mcf_qspi_data, 275 .dev.platform_data = &mcf_qspi_data,
276}; 276};
277#endif /* CONFIG_SPI_COLDFIRE_QSPI */ 277#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
278 278
279static struct platform_device *mcf_devices[] __initdata = { 279static struct platform_device *mcf_devices[] __initdata = {
280 &mcf_uart, 280 &mcf_uart,
@@ -284,7 +284,7 @@ static struct platform_device *mcf_devices[] __initdata = {
284 &mcf_fec1, 284 &mcf_fec1,
285#endif 285#endif
286#endif 286#endif
287#ifdef CONFIG_SPI_COLDFIRE_QSPI 287#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
288 &mcf_qspi, 288 &mcf_qspi,
289#endif 289#endif
290}; 290};
diff --git a/arch/m68k/platform/54xx/firebee.c b/arch/m68k/platform/coldfire/firebee.c
index 46d50534f981..46d50534f981 100644
--- a/arch/m68k/platform/54xx/firebee.c
+++ b/arch/m68k/platform/coldfire/firebee.c
diff --git a/arch/m68k/platform/coldfire/gpio.c b/arch/m68k/platform/coldfire/gpio.c
index 292a1a5a2d7c..4c8c42450a4e 100644
--- a/arch/m68k/platform/coldfire/gpio.c
+++ b/arch/m68k/platform/coldfire/gpio.c
@@ -122,6 +122,10 @@ struct bus_type mcf_gpio_subsys = {
122 122
123static int __init mcf_gpio_sysinit(void) 123static int __init mcf_gpio_sysinit(void)
124{ 124{
125 unsigned int i = 0;
126
127 while (i < mcf_gpio_chips_size)
128 gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]);
125 return subsys_system_register(&mcf_gpio_subsys, NULL); 129 return subsys_system_register(&mcf_gpio_subsys, NULL);
126} 130}
127 131
diff --git a/arch/m68k/platform/5249/intc2.c b/arch/m68k/platform/coldfire/intc-5249.c
index f343bf7bf5b0..f343bf7bf5b0 100644
--- a/arch/m68k/platform/5249/intc2.c
+++ b/arch/m68k/platform/coldfire/intc-5249.c
diff --git a/arch/m68k/platform/5272/intc.c b/arch/m68k/platform/coldfire/intc-5272.c
index 7160e618b0a9..7160e618b0a9 100644
--- a/arch/m68k/platform/5272/intc.c
+++ b/arch/m68k/platform/coldfire/intc-5272.c
diff --git a/arch/m68k/platform/5206/config.c b/arch/m68k/platform/coldfire/m5206.c
index 6bfbeebd231b..a8b81df653f0 100644
--- a/arch/m68k/platform/5206/config.c
+++ b/arch/m68k/platform/coldfire/m5206.c
@@ -16,6 +16,15 @@
16#include <asm/machdep.h> 16#include <asm/machdep.h>
17#include <asm/coldfire.h> 17#include <asm/coldfire.h>
18#include <asm/mcfsim.h> 18#include <asm/mcfsim.h>
19#include <asm/mcfgpio.h>
20
21/***************************************************************************/
22
23struct mcf_gpio_chip mcf_gpio_chips[] = {
24 MCFGPS(PP, 0, 8, MCFSIM_PADDR, MCFSIM_PADAT, MCFSIM_PADAT),
25};
26
27unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
19 28
20/***************************************************************************/ 29/***************************************************************************/
21 30
diff --git a/arch/m68k/platform/520x/config.c b/arch/m68k/platform/coldfire/m520x.c
index 235947844f27..3264b8883d5f 100644
--- a/arch/m68k/platform/520x/config.c
+++ b/arch/m68k/platform/coldfire/m520x.c
@@ -19,10 +19,26 @@
19#include <asm/coldfire.h> 19#include <asm/coldfire.h>
20#include <asm/mcfsim.h> 20#include <asm/mcfsim.h>
21#include <asm/mcfuart.h> 21#include <asm/mcfuart.h>
22#include <asm/mcfgpio.h>
22 23
23/***************************************************************************/ 24/***************************************************************************/
24 25
25#ifdef CONFIG_SPI_COLDFIRE_QSPI 26struct mcf_gpio_chip mcf_gpio_chips[] = {
27 MCFGPS(PIRQ, 0, 8, MCFEPORT_EPDDR, MCFEPORT_EPDR, MCFEPORT_EPPDR),
28 MCFGPF(CS, 9, 3),
29 MCFGPF(FECI2C, 16, 4),
30 MCFGPF(QSPI, 24, 4),
31 MCFGPF(TIMER, 32, 4),
32 MCFGPF(UART, 40, 8),
33 MCFGPF(FECH, 48, 8),
34 MCFGPF(FECL, 56, 8),
35};
36
37unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
38
39/***************************************************************************/
40
41#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
26 42
27static void __init m520x_qspi_init(void) 43static void __init m520x_qspi_init(void)
28{ 44{
@@ -35,7 +51,7 @@ static void __init m520x_qspi_init(void)
35 writew(par, MCF_GPIO_PAR_UART); 51 writew(par, MCF_GPIO_PAR_UART);
36} 52}
37 53
38#endif /* CONFIG_SPI_COLDFIRE_QSPI */ 54#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
39 55
40/***************************************************************************/ 56/***************************************************************************/
41 57
@@ -79,7 +95,7 @@ void __init config_BSP(char *commandp, int size)
79 mach_sched_init = hw_timer_init; 95 mach_sched_init = hw_timer_init;
80 m520x_uarts_init(); 96 m520x_uarts_init();
81 m520x_fec_init(); 97 m520x_fec_init();
82#ifdef CONFIG_SPI_COLDFIRE_QSPI 98#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
83 m520x_qspi_init(); 99 m520x_qspi_init();
84#endif 100#endif
85} 101}
diff --git a/arch/m68k/platform/523x/config.c b/arch/m68k/platform/coldfire/m523x.c
index c8b405d5a961..5d57a4249412 100644
--- a/arch/m68k/platform/523x/config.c
+++ b/arch/m68k/platform/coldfire/m523x.c
@@ -19,10 +19,32 @@
19#include <asm/machdep.h> 19#include <asm/machdep.h>
20#include <asm/coldfire.h> 20#include <asm/coldfire.h>
21#include <asm/mcfsim.h> 21#include <asm/mcfsim.h>
22#include <asm/mcfgpio.h>
22 23
23/***************************************************************************/ 24/***************************************************************************/
24 25
25#ifdef CONFIG_SPI_COLDFIRE_QSPI 26struct mcf_gpio_chip mcf_gpio_chips[] = {
27 MCFGPS(PIRQ, 1, 7, MCFEPORT_EPDDR, MCFEPORT_EPDR, MCFEPORT_EPPDR),
28 MCFGPF(ADDR, 13, 3),
29 MCFGPF(DATAH, 16, 8),
30 MCFGPF(DATAL, 24, 8),
31 MCFGPF(BUSCTL, 32, 8),
32 MCFGPF(BS, 40, 4),
33 MCFGPF(CS, 49, 7),
34 MCFGPF(SDRAM, 56, 6),
35 MCFGPF(FECI2C, 64, 4),
36 MCFGPF(UARTH, 72, 2),
37 MCFGPF(UARTL, 80, 8),
38 MCFGPF(QSPI, 88, 5),
39 MCFGPF(TIMER, 96, 8),
40 MCFGPF(ETPU, 104, 3),
41};
42
43unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
44
45/***************************************************************************/
46
47#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
26 48
27static void __init m523x_qspi_init(void) 49static void __init m523x_qspi_init(void)
28{ 50{
@@ -36,7 +58,7 @@ static void __init m523x_qspi_init(void)
36 writew(par, MCFGPIO_PAR_TIMER); 58 writew(par, MCFGPIO_PAR_TIMER);
37} 59}
38 60
39#endif /* CONFIG_SPI_COLDFIRE_QSPI */ 61#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
40 62
41/***************************************************************************/ 63/***************************************************************************/
42 64
@@ -58,7 +80,7 @@ void __init config_BSP(char *commandp, int size)
58{ 80{
59 mach_sched_init = hw_timer_init; 81 mach_sched_init = hw_timer_init;
60 m523x_fec_init(); 82 m523x_fec_init();
61#ifdef CONFIG_SPI_COLDFIRE_QSPI 83#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
62 m523x_qspi_init(); 84 m523x_qspi_init();
63#endif 85#endif
64} 86}
diff --git a/arch/m68k/platform/5249/config.c b/arch/m68k/platform/coldfire/m5249.c
index bbf05135bb98..fdfa1edfd1ac 100644
--- a/arch/m68k/platform/5249/config.c
+++ b/arch/m68k/platform/coldfire/m5249.c
@@ -16,6 +16,16 @@
16#include <asm/machdep.h> 16#include <asm/machdep.h>
17#include <asm/coldfire.h> 17#include <asm/coldfire.h>
18#include <asm/mcfsim.h> 18#include <asm/mcfsim.h>
19#include <asm/mcfgpio.h>
20
21/***************************************************************************/
22
23struct mcf_gpio_chip mcf_gpio_chips[] = {
24 MCFGPS(GPIO0, 0, 32, MCFSIM2_GPIOENABLE, MCFSIM2_GPIOWRITE, MCFSIM2_GPIOREAD),
25 MCFGPS(GPIO1, 32, 32, MCFSIM2_GPIO1ENABLE, MCFSIM2_GPIO1WRITE, MCFSIM2_GPIO1READ),
26};
27
28unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
19 29
20/***************************************************************************/ 30/***************************************************************************/
21 31
@@ -51,7 +61,7 @@ static struct platform_device *m5249_devices[] __initdata = {
51 61
52/***************************************************************************/ 62/***************************************************************************/
53 63
54#ifdef CONFIG_SPI_COLDFIRE_QSPI 64#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
55 65
56static void __init m5249_qspi_init(void) 66static void __init m5249_qspi_init(void)
57{ 67{
@@ -61,7 +71,7 @@ static void __init m5249_qspi_init(void)
61 mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI); 71 mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI);
62} 72}
63 73
64#endif /* CONFIG_SPI_COLDFIRE_QSPI */ 74#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
65 75
66/***************************************************************************/ 76/***************************************************************************/
67 77
@@ -90,7 +100,7 @@ void __init config_BSP(char *commandp, int size)
90#ifdef CONFIG_M5249C3 100#ifdef CONFIG_M5249C3
91 m5249_smc91x_init(); 101 m5249_smc91x_init();
92#endif 102#endif
93#ifdef CONFIG_SPI_COLDFIRE_QSPI 103#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
94 m5249_qspi_init(); 104 m5249_qspi_init();
95#endif 105#endif
96} 106}
diff --git a/arch/m68k/platform/5272/config.c b/arch/m68k/platform/coldfire/m5272.c
index e68bc7a148eb..43e36060da18 100644
--- a/arch/m68k/platform/5272/config.c
+++ b/arch/m68k/platform/coldfire/m5272.c
@@ -19,6 +19,7 @@
19#include <asm/coldfire.h> 19#include <asm/coldfire.h>
20#include <asm/mcfsim.h> 20#include <asm/mcfsim.h>
21#include <asm/mcfuart.h> 21#include <asm/mcfuart.h>
22#include <asm/mcfgpio.h>
22 23
23/***************************************************************************/ 24/***************************************************************************/
24 25
@@ -30,6 +31,16 @@ unsigned char ledbank = 0xff;
30 31
31/***************************************************************************/ 32/***************************************************************************/
32 33
34struct mcf_gpio_chip mcf_gpio_chips[] = {
35 MCFGPS(PA, 0, 16, MCFSIM_PADDR, MCFSIM_PADAT, MCFSIM_PADAT),
36 MCFGPS(PB, 16, 16, MCFSIM_PBDDR, MCFSIM_PBDAT, MCFSIM_PBDAT),
37 MCFGPS(Pc, 32, 16, MCFSIM_PCDDR, MCFSIM_PCDAT, MCFSIM_PCDAT),
38};
39
40unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
41
42/***************************************************************************/
43
33static void __init m5272_uarts_init(void) 44static void __init m5272_uarts_init(void)
34{ 45{
35 u32 v; 46 u32 v;
diff --git a/arch/m68k/platform/527x/config.c b/arch/m68k/platform/coldfire/m527x.c
index 7ed848c3b848..9b0b66aabd1b 100644
--- a/arch/m68k/platform/527x/config.c
+++ b/arch/m68k/platform/coldfire/m527x.c
@@ -20,10 +20,53 @@
20#include <asm/coldfire.h> 20#include <asm/coldfire.h>
21#include <asm/mcfsim.h> 21#include <asm/mcfsim.h>
22#include <asm/mcfuart.h> 22#include <asm/mcfuart.h>
23#include <asm/mcfgpio.h>
23 24
24/***************************************************************************/ 25/***************************************************************************/
25 26
26#ifdef CONFIG_SPI_COLDFIRE_QSPI 27struct mcf_gpio_chip mcf_gpio_chips[] = {
28#if defined(CONFIG_M5271)
29 MCFGPS(PIRQ, 1, 7, MCFEPORT_EPDDR, MCFEPORT_EPDR, MCFEPORT_EPPDR),
30 MCFGPF(ADDR, 13, 3),
31 MCFGPF(DATAH, 16, 8),
32 MCFGPF(DATAL, 24, 8),
33 MCFGPF(BUSCTL, 32, 8),
34 MCFGPF(BS, 40, 4),
35 MCFGPF(CS, 49, 7),
36 MCFGPF(SDRAM, 56, 6),
37 MCFGPF(FECI2C, 64, 4),
38 MCFGPF(UARTH, 72, 2),
39 MCFGPF(UARTL, 80, 8),
40 MCFGPF(QSPI, 88, 5),
41 MCFGPF(TIMER, 96, 8),
42#elif defined(CONFIG_M5275)
43 MCFGPS(PIRQ, 1, 7, MCFEPORT_EPDDR, MCFEPORT_EPDR, MCFEPORT_EPPDR),
44 MCFGPF(BUSCTL, 8, 8),
45 MCFGPF(ADDR, 21, 3),
46 MCFGPF(CS, 25, 7),
47 MCFGPF(FEC0H, 32, 8),
48 MCFGPF(FEC0L, 40, 8),
49 MCFGPF(FECI2C, 48, 6),
50 MCFGPF(QSPI, 56, 7),
51 MCFGPF(SDRAM, 64, 8),
52 MCFGPF(TIMERH, 72, 4),
53 MCFGPF(TIMERL, 80, 4),
54 MCFGPF(UARTL, 88, 8),
55 MCFGPF(FEC1H, 96, 8),
56 MCFGPF(FEC1L, 104, 8),
57 MCFGPF(BS, 114, 2),
58 MCFGPF(IRQ, 121, 7),
59 MCFGPF(USBH, 128, 1),
60 MCFGPF(USBL, 136, 8),
61 MCFGPF(UARTH, 144, 4),
62#endif
63};
64
65unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
66
67/***************************************************************************/
68
69#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
27 70
28static void __init m527x_qspi_init(void) 71static void __init m527x_qspi_init(void)
29{ 72{
@@ -42,7 +85,7 @@ static void __init m527x_qspi_init(void)
42#endif 85#endif
43} 86}
44 87
45#endif /* CONFIG_SPI_COLDFIRE_QSPI */ 88#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
46 89
47/***************************************************************************/ 90/***************************************************************************/
48 91
@@ -74,9 +117,7 @@ static void __init m527x_fec_init(void)
74 writew(par | 0xf00, MCF_IPSBAR + 0x100082); 117 writew(par | 0xf00, MCF_IPSBAR + 0x100082);
75 v = readb(MCF_IPSBAR + 0x100078); 118 v = readb(MCF_IPSBAR + 0x100078);
76 writeb(v | 0xc0, MCF_IPSBAR + 0x100078); 119 writeb(v | 0xc0, MCF_IPSBAR + 0x100078);
77#endif
78 120
79#ifdef CONFIG_FEC2
80 /* Set multi-function pins to ethernet mode for fec1 */ 121 /* Set multi-function pins to ethernet mode for fec1 */
81 par = readw(MCF_IPSBAR + 0x100082); 122 par = readw(MCF_IPSBAR + 0x100082);
82 writew(par | 0xa0, MCF_IPSBAR + 0x100082); 123 writew(par | 0xa0, MCF_IPSBAR + 0x100082);
@@ -92,7 +133,7 @@ void __init config_BSP(char *commandp, int size)
92 mach_sched_init = hw_timer_init; 133 mach_sched_init = hw_timer_init;
93 m527x_uarts_init(); 134 m527x_uarts_init();
94 m527x_fec_init(); 135 m527x_fec_init();
95#ifdef CONFIG_SPI_COLDFIRE_QSPI 136#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
96 m527x_qspi_init(); 137 m527x_qspi_init();
97#endif 138#endif
98} 139}
diff --git a/arch/m68k/platform/528x/config.c b/arch/m68k/platform/coldfire/m528x.c
index d4492926614c..7ed1276b29dc 100644
--- a/arch/m68k/platform/528x/config.c
+++ b/arch/m68k/platform/coldfire/m528x.c
@@ -21,10 +21,41 @@
21#include <asm/coldfire.h> 21#include <asm/coldfire.h>
22#include <asm/mcfsim.h> 22#include <asm/mcfsim.h>
23#include <asm/mcfuart.h> 23#include <asm/mcfuart.h>
24#include <asm/mcfgpio.h>
24 25
25/***************************************************************************/ 26/***************************************************************************/
26 27
27#ifdef CONFIG_SPI_COLDFIRE_QSPI 28struct mcf_gpio_chip mcf_gpio_chips[] = {
29 MCFGPS(NQ, 1, 7, MCFEPORT_EPDDR, MCFEPORT_EPDR, MCFEPORT_EPPDR),
30 MCFGPS(TA, 8, 4, MCFGPTA_GPTDDR, MCFGPTA_GPTPORT, MCFGPTB_GPTPORT),
31 MCFGPS(TB, 16, 4, MCFGPTB_GPTDDR, MCFGPTB_GPTPORT, MCFGPTB_GPTPORT),
32 MCFGPS(QA, 24, 4, MCFQADC_DDRQA, MCFQADC_PORTQA, MCFQADC_PORTQA),
33 MCFGPS(QB, 32, 4, MCFQADC_DDRQB, MCFQADC_PORTQB, MCFQADC_PORTQB),
34 MCFGPF(A, 40, 8),
35 MCFGPF(B, 48, 8),
36 MCFGPF(C, 56, 8),
37 MCFGPF(D, 64, 8),
38 MCFGPF(E, 72, 8),
39 MCFGPF(F, 80, 8),
40 MCFGPF(G, 88, 8),
41 MCFGPF(H, 96, 8),
42 MCFGPF(J, 104, 8),
43 MCFGPF(DD, 112, 8),
44 MCFGPF(EH, 120, 8),
45 MCFGPF(EL, 128, 8),
46 MCFGPF(AS, 136, 6),
47 MCFGPF(QS, 144, 7),
48 MCFGPF(SD, 152, 6),
49 MCFGPF(TC, 160, 4),
50 MCFGPF(TD, 168, 4),
51 MCFGPF(UA, 176, 4),
52};
53
54unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
55
56/***************************************************************************/
57
58#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
28 59
29static void __init m528x_qspi_init(void) 60static void __init m528x_qspi_init(void)
30{ 61{
@@ -32,7 +63,7 @@ static void __init m528x_qspi_init(void)
32 __raw_writeb(0x07, MCFGPIO_PQSPAR); 63 __raw_writeb(0x07, MCFGPIO_PQSPAR);
33} 64}
34 65
35#endif /* CONFIG_SPI_COLDFIRE_QSPI */ 66#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
36 67
37/***************************************************************************/ 68/***************************************************************************/
38 69
@@ -98,7 +129,7 @@ void __init config_BSP(char *commandp, int size)
98 mach_sched_init = hw_timer_init; 129 mach_sched_init = hw_timer_init;
99 m528x_uarts_init(); 130 m528x_uarts_init();
100 m528x_fec_init(); 131 m528x_fec_init();
101#ifdef CONFIG_SPI_COLDFIRE_QSPI 132#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
102 m528x_qspi_init(); 133 m528x_qspi_init();
103#endif 134#endif
104} 135}
diff --git a/arch/m68k/platform/5307/config.c b/arch/m68k/platform/coldfire/m5307.c
index a568d2870d15..93b484976ab3 100644
--- a/arch/m68k/platform/5307/config.c
+++ b/arch/m68k/platform/coldfire/m5307.c
@@ -16,6 +16,7 @@
16#include <asm/machdep.h> 16#include <asm/machdep.h>
17#include <asm/coldfire.h> 17#include <asm/coldfire.h>
18#include <asm/mcfsim.h> 18#include <asm/mcfsim.h>
19#include <asm/mcfgpio.h>
19#include <asm/mcfwdebug.h> 20#include <asm/mcfwdebug.h>
20 21
21/***************************************************************************/ 22/***************************************************************************/
@@ -28,6 +29,14 @@ unsigned char ledbank = 0xff;
28 29
29/***************************************************************************/ 30/***************************************************************************/
30 31
32struct mcf_gpio_chip mcf_gpio_chips[] = {
33 MCFGPS(PP, 0, 16, MCFSIM_PADDR, MCFSIM_PADAT, MCFSIM_PADAT),
34};
35
36unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
37
38/***************************************************************************/
39
31void __init config_BSP(char *commandp, int size) 40void __init config_BSP(char *commandp, int size)
32{ 41{
33#if defined(CONFIG_NETtel) || \ 42#if defined(CONFIG_NETtel) || \
diff --git a/arch/m68k/platform/532x/config.c b/arch/m68k/platform/coldfire/m532x.c
index db8707f5e037..5394223639f8 100644
--- a/arch/m68k/platform/532x/config.c
+++ b/arch/m68k/platform/coldfire/m532x.c
@@ -26,11 +26,36 @@
26#include <asm/mcfsim.h> 26#include <asm/mcfsim.h>
27#include <asm/mcfuart.h> 27#include <asm/mcfuart.h>
28#include <asm/mcfdma.h> 28#include <asm/mcfdma.h>
29#include <asm/mcfgpio.h>
29#include <asm/mcfwdebug.h> 30#include <asm/mcfwdebug.h>
30 31
31/***************************************************************************/ 32/***************************************************************************/
32 33
33#ifdef CONFIG_SPI_COLDFIRE_QSPI 34struct mcf_gpio_chip mcf_gpio_chips[] = {
35 MCFGPS(PIRQ, 0, 8, MCFEPORT_EPDDR, MCFEPORT_EPDR, MCFEPORT_EPPDR),
36 MCFGPF(FECH, 8, 8),
37 MCFGPF(FECL, 16, 8),
38 MCFGPF(SSI, 24, 5),
39 MCFGPF(BUSCTL, 32, 4),
40 MCFGPF(BE, 40, 4),
41 MCFGPF(CS, 49, 5),
42 MCFGPF(PWM, 58, 4),
43 MCFGPF(FECI2C, 64, 4),
44 MCFGPF(UART, 72, 8),
45 MCFGPF(QSPI, 80, 6),
46 MCFGPF(TIMER, 88, 4),
47 MCFGPF(LCDDATAH, 96, 2),
48 MCFGPF(LCDDATAM, 104, 8),
49 MCFGPF(LCDDATAL, 112, 8),
50 MCFGPF(LCDCTLH, 120, 1),
51 MCFGPF(LCDCTLL, 128, 8),
52};
53
54unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
55
56/***************************************************************************/
57
58#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
34 59
35static void __init m532x_qspi_init(void) 60static void __init m532x_qspi_init(void)
36{ 61{
@@ -38,7 +63,7 @@ static void __init m532x_qspi_init(void)
38 writew(0x01f0, MCF_GPIO_PAR_QSPI); 63 writew(0x01f0, MCF_GPIO_PAR_QSPI);
39} 64}
40 65
41#endif /* CONFIG_SPI_COLDFIRE_QSPI */ 66#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
42 67
43/***************************************************************************/ 68/***************************************************************************/
44 69
@@ -77,7 +102,7 @@ void __init config_BSP(char *commandp, int size)
77 mach_sched_init = hw_timer_init; 102 mach_sched_init = hw_timer_init;
78 m532x_uarts_init(); 103 m532x_uarts_init();
79 m532x_fec_init(); 104 m532x_fec_init();
80#ifdef CONFIG_SPI_COLDFIRE_QSPI 105#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
81 m532x_qspi_init(); 106 m532x_qspi_init();
82#endif 107#endif
83 108
diff --git a/arch/m68k/platform/5407/config.c b/arch/m68k/platform/coldfire/m5407.c
index bb6c746ae819..faa6680b3404 100644
--- a/arch/m68k/platform/5407/config.c
+++ b/arch/m68k/platform/coldfire/m5407.c
@@ -16,6 +16,15 @@
16#include <asm/machdep.h> 16#include <asm/machdep.h>
17#include <asm/coldfire.h> 17#include <asm/coldfire.h>
18#include <asm/mcfsim.h> 18#include <asm/mcfsim.h>
19#include <asm/mcfgpio.h>
20
21/***************************************************************************/
22
23struct mcf_gpio_chip mcf_gpio_chips[] = {
24 MCFGPS(PP, 0, 16, MCFSIM_PADDR, MCFSIM_PADAT, MCFSIM_PADAT),
25};
26
27unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
19 28
20/***************************************************************************/ 29/***************************************************************************/
21 30
diff --git a/arch/m68k/platform/54xx/config.c b/arch/m68k/platform/coldfire/m54xx.c
index 2081c6cbb3de..20672dadb252 100644
--- a/arch/m68k/platform/54xx/config.c
+++ b/arch/m68k/platform/coldfire/m54xx.c
@@ -21,12 +21,19 @@
21#include <asm/m54xxsim.h> 21#include <asm/m54xxsim.h>
22#include <asm/mcfuart.h> 22#include <asm/mcfuart.h>
23#include <asm/m54xxgpt.h> 23#include <asm/m54xxgpt.h>
24#include <asm/mcfgpio.h>
24#ifdef CONFIG_MMU 25#ifdef CONFIG_MMU
25#include <asm/mmu_context.h> 26#include <asm/mmu_context.h>
26#endif 27#endif
27 28
28/***************************************************************************/ 29/***************************************************************************/
29 30
31struct mcf_gpio_chip mcf_gpio_chips[] = { };
32
33unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
34
35/***************************************************************************/
36
30static void __init m54xx_uarts_init(void) 37static void __init m54xx_uarts_init(void)
31{ 38{
32 /* enable io pins */ 39 /* enable io pins */
diff --git a/arch/m68k/platform/5307/nettel.c b/arch/m68k/platform/coldfire/nettel.c
index e925ea4602f8..e925ea4602f8 100644
--- a/arch/m68k/platform/5307/nettel.c
+++ b/arch/m68k/platform/coldfire/nettel.c
diff --git a/arch/microblaze/kernel/Makefile b/arch/microblaze/kernel/Makefile
index 494b63b72dd7..928c950fc14c 100644
--- a/arch/microblaze/kernel/Makefile
+++ b/arch/microblaze/kernel/Makefile
@@ -16,7 +16,7 @@ endif
16extra-y := head.o vmlinux.lds 16extra-y := head.o vmlinux.lds
17 17
18obj-y += dma.o exceptions.o \ 18obj-y += dma.o exceptions.o \
19 hw_exception_handler.o init_task.o intc.o irq.o \ 19 hw_exception_handler.o intc.o irq.o \
20 process.o prom.o prom_parse.o ptrace.o \ 20 process.o prom.o prom_parse.o ptrace.o \
21 reset.o setup.o signal.o sys_microblaze.o timer.o traps.o unwind.o 21 reset.o setup.o signal.o sys_microblaze.o timer.o traps.o unwind.o
22 22
diff --git a/arch/microblaze/kernel/init_task.c b/arch/microblaze/kernel/init_task.c
deleted file mode 100644
index b5d711f94ff8..000000000000
--- a/arch/microblaze/kernel/init_task.c
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Copyright (C) 2009 Michal Simek <monstr@monstr.eu>
3 * Copyright (C) 2009 PetaLogix
4 * Copyright (C) 2006 Atmark Techno, Inc.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/module.h>
12#include <linux/sched.h>
13#include <linux/init_task.h>
14#include <linux/fs.h>
15#include <linux/mqueue.h>
16
17#include <asm/pgtable.h>
18
19static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
20static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
21
22union thread_union init_thread_union __init_task_data =
23 { INIT_THREAD_INFO(init_task) };
24
25struct task_struct init_task = INIT_TASK(init_task);
26EXPORT_SYMBOL(init_task);
diff --git a/arch/microblaze/kernel/ptrace.c b/arch/microblaze/kernel/ptrace.c
index 6eb2aa927d89..ab1b9db661f3 100644
--- a/arch/microblaze/kernel/ptrace.c
+++ b/arch/microblaze/kernel/ptrace.c
@@ -136,7 +136,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
136{ 136{
137 long ret = 0; 137 long ret = 0;
138 138
139 secure_computing(regs->r12); 139 secure_computing_strict(regs->r12);
140 140
141 if (test_thread_flag(TIF_SYSCALL_TRACE) && 141 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
142 tracehook_report_syscall_entry(regs)) 142 tracehook_report_syscall_entry(regs))
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index d10403dadd2b..ed22bfc5db14 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1422,6 +1422,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
1422 1422
1423static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, struct list_head *resources) 1423static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, struct list_head *resources)
1424{ 1424{
1425 unsigned long io_offset;
1425 struct resource *res; 1426 struct resource *res;
1426 int i; 1427 int i;
1427 1428
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 923a6c3b9a0a..f5e121213c22 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -29,6 +29,7 @@ config MIPS
29 select HAVE_MEMBLOCK 29 select HAVE_MEMBLOCK
30 select HAVE_MEMBLOCK_NODE_MAP 30 select HAVE_MEMBLOCK_NODE_MAP
31 select ARCH_DISCARD_MEMBLOCK 31 select ARCH_DISCARD_MEMBLOCK
32 select GENERIC_SMP_IDLE_THREAD
32 33
33menu "Machine selection" 34menu "Machine selection"
34 35
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 4fedf5a51d96..76017c25a9e6 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -235,7 +235,7 @@ endif
235 235
236OBJCOPYFLAGS += --remove-section=.reginfo 236OBJCOPYFLAGS += --remove-section=.reginfo
237 237
238head-y := arch/mips/kernel/head.o arch/mips/kernel/init_task.o 238head-y := arch/mips/kernel/head.o
239 239
240libs-y += arch/mips/lib/ 240libs-y += arch/mips/lib/
241 241
diff --git a/arch/mips/ath79/dev-wmac.c b/arch/mips/ath79/dev-wmac.c
index e21507052066..9c717bf98ffe 100644
--- a/arch/mips/ath79/dev-wmac.c
+++ b/arch/mips/ath79/dev-wmac.c
@@ -58,8 +58,8 @@ static void __init ar913x_wmac_setup(void)
58 58
59static int ar933x_wmac_reset(void) 59static int ar933x_wmac_reset(void)
60{ 60{
61 ath79_device_reset_clear(AR933X_RESET_WMAC);
62 ath79_device_reset_set(AR933X_RESET_WMAC); 61 ath79_device_reset_set(AR933X_RESET_WMAC);
62 ath79_device_reset_clear(AR933X_RESET_WMAC);
63 63
64 return 0; 64 return 0;
65} 65}
diff --git a/arch/mips/configs/mtx1_defconfig b/arch/mips/configs/mtx1_defconfig
index 807c97eed8a8..46c61edcdf7b 100644
--- a/arch/mips/configs/mtx1_defconfig
+++ b/arch/mips/configs/mtx1_defconfig
@@ -346,11 +346,8 @@ CONFIG_CHELSIO_T1=m
346CONFIG_IXGB=m 346CONFIG_IXGB=m
347CONFIG_S2IO=m 347CONFIG_S2IO=m
348CONFIG_MYRI10GE=m 348CONFIG_MYRI10GE=m
349CONFIG_TR=y
350CONFIG_IBMOL=m 349CONFIG_IBMOL=m
351CONFIG_IBMLS=m 350CONFIG_IBMLS=m
352CONFIG_3C359=m
353CONFIG_TMS380TR=m
354CONFIG_TMSPCI=m 351CONFIG_TMSPCI=m
355CONFIG_ABYSS=m 352CONFIG_ABYSS=m
356CONFIG_USB_CATC=m 353CONFIG_USB_CATC=m
@@ -376,7 +373,6 @@ CONFIG_PCMCIA_SMC91C92=m
376CONFIG_PCMCIA_XIRC2PS=m 373CONFIG_PCMCIA_XIRC2PS=m
377CONFIG_PCMCIA_AXNET=m 374CONFIG_PCMCIA_AXNET=m
378CONFIG_ARCNET_COM20020_CS=m 375CONFIG_ARCNET_COM20020_CS=m
379CONFIG_PCMCIA_IBMTR=m
380CONFIG_WAN=y 376CONFIG_WAN=y
381CONFIG_LANMEDIA=m 377CONFIG_LANMEDIA=m
382CONFIG_HDLC=m 378CONFIG_HDLC=m
diff --git a/arch/mips/include/asm/mach-ip27/topology.h b/arch/mips/include/asm/mach-ip27/topology.h
index 1b1a7d1632b9..b2cf641f206f 100644
--- a/arch/mips/include/asm/mach-ip27/topology.h
+++ b/arch/mips/include/asm/mach-ip27/topology.h
@@ -36,23 +36,6 @@ extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES];
36 36
37#define node_distance(from, to) (__node_distances[(from)][(to)]) 37#define node_distance(from, to) (__node_distances[(from)][(to)])
38 38
39/* sched_domains SD_NODE_INIT for SGI IP27 machines */
40#define SD_NODE_INIT (struct sched_domain) { \
41 .parent = NULL, \
42 .child = NULL, \
43 .groups = NULL, \
44 .min_interval = 8, \
45 .max_interval = 32, \
46 .busy_factor = 32, \
47 .imbalance_pct = 125, \
48 .cache_nice_tries = 1, \
49 .flags = SD_LOAD_BALANCE | \
50 SD_BALANCE_EXEC, \
51 .last_balance = jiffies, \
52 .balance_interval = 1, \
53 .nr_balance_failed = 0, \
54}
55
56#include <asm-generic/topology.h> 39#include <asm-generic/topology.h>
57 40
58#endif /* _ASM_MACH_TOPOLOGY_H */ 41#endif /* _ASM_MACH_TOPOLOGY_H */
diff --git a/arch/mips/include/asm/mach-jz4740/irq.h b/arch/mips/include/asm/mach-jz4740/irq.h
index a865c983c70a..5ad1a9c113c6 100644
--- a/arch/mips/include/asm/mach-jz4740/irq.h
+++ b/arch/mips/include/asm/mach-jz4740/irq.h
@@ -45,7 +45,7 @@
45#define JZ4740_IRQ_LCD JZ4740_IRQ(30) 45#define JZ4740_IRQ_LCD JZ4740_IRQ(30)
46 46
47/* 2nd-level interrupts */ 47/* 2nd-level interrupts */
48#define JZ4740_IRQ_DMA(x) (JZ4740_IRQ(32) + (X)) 48#define JZ4740_IRQ_DMA(x) (JZ4740_IRQ(32) + (x))
49 49
50#define JZ4740_IRQ_INTC_GPIO(x) (JZ4740_IRQ_GPIO0 - (x)) 50#define JZ4740_IRQ_INTC_GPIO(x) (JZ4740_IRQ_GPIO0 - (x))
51#define JZ4740_IRQ_GPIO(x) (JZ4740_IRQ(48) + (x)) 51#define JZ4740_IRQ_GPIO(x) (JZ4740_IRQ(48) + (x))
diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h
index 73c0d45798de..9b02cfba7449 100644
--- a/arch/mips/include/asm/mmu_context.h
+++ b/arch/mips/include/asm/mmu_context.h
@@ -37,12 +37,6 @@ extern void tlbmiss_handler_setup_pgd(unsigned long pgd);
37 write_c0_xcontext((unsigned long) smp_processor_id() << 51); \ 37 write_c0_xcontext((unsigned long) smp_processor_id() << 51); \
38 } while (0) 38 } while (0)
39 39
40
41static inline unsigned long get_current_pgd(void)
42{
43 return PHYS_TO_XKSEG_CACHED((read_c0_context() >> 11) & ~0xfffUL);
44}
45
46#else /* CONFIG_MIPS_PGD_C0_CONTEXT: using pgd_current*/ 40#else /* CONFIG_MIPS_PGD_C0_CONTEXT: using pgd_current*/
47 41
48/* 42/*
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
index 0d85d8e440c5..e2eca7d10598 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
@@ -85,18 +85,6 @@ register struct thread_info *__current_thread_info __asm__("$28");
85 85
86#define STACK_WARN (THREAD_SIZE / 8) 86#define STACK_WARN (THREAD_SIZE / 8)
87 87
88#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
89
90#ifdef CONFIG_DEBUG_STACK_USAGE
91#define alloc_thread_info_node(tsk, node) \
92 kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
93#else
94#define alloc_thread_info_node(tsk, node) \
95 kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
96#endif
97
98#define free_thread_info(info) kfree(info)
99
100#endif /* !__ASSEMBLY__ */ 88#endif /* !__ASSEMBLY__ */
101 89
102#define PREEMPT_ACTIVE 0x10000000 90#define PREEMPT_ACTIVE 0x10000000
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 0c6877ea9004..fdaf65e1a99d 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the Linux/MIPS kernel. 2# Makefile for the Linux/MIPS kernel.
3# 3#
4 4
5extra-y := head.o init_task.o vmlinux.lds 5extra-y := head.o vmlinux.lds
6 6
7obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \ 7obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \
8 ptrace.o reset.o setup.o signal.o syscall.o \ 8 ptrace.o reset.o setup.o signal.o syscall.o \
diff --git a/arch/mips/kernel/init_task.c b/arch/mips/kernel/init_task.c
deleted file mode 100644
index 5f9a76263c9a..000000000000
--- a/arch/mips/kernel/init_task.c
+++ /dev/null
@@ -1,35 +0,0 @@
1#include <linux/mm.h>
2#include <linux/export.h>
3#include <linux/sched.h>
4#include <linux/init_task.h>
5#include <linux/fs.h>
6#include <linux/mqueue.h>
7
8#include <asm/thread_info.h>
9#include <asm/uaccess.h>
10#include <asm/pgtable.h>
11
12static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
13static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
14/*
15 * Initial thread structure.
16 *
17 * We need to make sure that this is 8192-byte aligned due to the
18 * way process stacks are handled. This is done by making sure
19 * the linker maps this in the .text segment right after head.S,
20 * and making head.S ensure the proper alignment.
21 *
22 * The things we do for performance..
23 */
24union thread_union init_thread_union __init_task_data
25 __attribute__((__aligned__(THREAD_SIZE))) =
26 { INIT_THREAD_INFO(init_task) };
27
28/*
29 * Initial task structure.
30 *
31 * All other task structs will be allocated on slabs in fork.c
32 */
33struct task_struct init_task = INIT_TASK(init_task);
34
35EXPORT_SYMBOL(init_task);
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c
index 811084f4e422..ab73fa2fb9b5 100644
--- a/arch/mips/kernel/perf_event_mipsxx.c
+++ b/arch/mips/kernel/perf_event_mipsxx.c
@@ -1325,7 +1325,7 @@ static int mipsxx_pmu_handle_shared_irq(void)
1325 1325
1326 regs = get_irq_regs(); 1326 regs = get_irq_regs();
1327 1327
1328 perf_sample_data_init(&data, 0); 1328 perf_sample_data_init(&data, 0, 0);
1329 1329
1330 switch (counters) { 1330 switch (counters) {
1331#define HANDLE_COUNTER(n) \ 1331#define HANDLE_COUNTER(n) \
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 7c24c2973c6d..4812c6d916e4 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -535,7 +535,7 @@ static inline int audit_arch(void)
535asmlinkage void syscall_trace_enter(struct pt_regs *regs) 535asmlinkage void syscall_trace_enter(struct pt_regs *regs)
536{ 536{
537 /* do the secure computing check first */ 537 /* do the secure computing check first */
538 secure_computing(regs->regs[2]); 538 secure_computing_strict(regs->regs[2]);
539 539
540 if (!(current->ptrace & PT_PTRACED)) 540 if (!(current->ptrace & PT_PTRACED))
541 goto out; 541 goto out;
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 185ca00c4c84..d5a338a1739c 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -257,11 +257,8 @@ asmlinkage int sys_sigsuspend(nabi_no_regargs struct pt_regs regs)
257 return -EFAULT; 257 return -EFAULT;
258 sigdelsetmask(&newset, ~_BLOCKABLE); 258 sigdelsetmask(&newset, ~_BLOCKABLE);
259 259
260 spin_lock_irq(&current->sighand->siglock);
261 current->saved_sigmask = current->blocked; 260 current->saved_sigmask = current->blocked;
262 current->blocked = newset; 261 set_current_blocked(&newset);
263 recalc_sigpending();
264 spin_unlock_irq(&current->sighand->siglock);
265 262
266 current->state = TASK_INTERRUPTIBLE; 263 current->state = TASK_INTERRUPTIBLE;
267 schedule(); 264 schedule();
@@ -286,11 +283,8 @@ asmlinkage int sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
286 return -EFAULT; 283 return -EFAULT;
287 sigdelsetmask(&newset, ~_BLOCKABLE); 284 sigdelsetmask(&newset, ~_BLOCKABLE);
288 285
289 spin_lock_irq(&current->sighand->siglock);
290 current->saved_sigmask = current->blocked; 286 current->saved_sigmask = current->blocked;
291 current->blocked = newset; 287 set_current_blocked(&newset);
292 recalc_sigpending();
293 spin_unlock_irq(&current->sighand->siglock);
294 288
295 current->state = TASK_INTERRUPTIBLE; 289 current->state = TASK_INTERRUPTIBLE;
296 schedule(); 290 schedule();
@@ -362,10 +356,7 @@ asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs)
362 goto badframe; 356 goto badframe;
363 357
364 sigdelsetmask(&blocked, ~_BLOCKABLE); 358 sigdelsetmask(&blocked, ~_BLOCKABLE);
365 spin_lock_irq(&current->sighand->siglock); 359 set_current_blocked(&blocked);
366 current->blocked = blocked;
367 recalc_sigpending();
368 spin_unlock_irq(&current->sighand->siglock);
369 360
370 sig = restore_sigcontext(&regs, &frame->sf_sc); 361 sig = restore_sigcontext(&regs, &frame->sf_sc);
371 if (sig < 0) 362 if (sig < 0)
@@ -401,10 +392,7 @@ asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
401 goto badframe; 392 goto badframe;
402 393
403 sigdelsetmask(&set, ~_BLOCKABLE); 394 sigdelsetmask(&set, ~_BLOCKABLE);
404 spin_lock_irq(&current->sighand->siglock); 395 set_current_blocked(&set);
405 current->blocked = set;
406 recalc_sigpending();
407 spin_unlock_irq(&current->sighand->siglock);
408 396
409 sig = restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext); 397 sig = restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext);
410 if (sig < 0) 398 if (sig < 0)
@@ -580,12 +568,7 @@ static int handle_signal(unsigned long sig, siginfo_t *info,
580 if (ret) 568 if (ret)
581 return ret; 569 return ret;
582 570
583 spin_lock_irq(&current->sighand->siglock); 571 block_sigmask(ka, sig);
584 sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask);
585 if (!(ka->sa.sa_flags & SA_NODEFER))
586 sigaddset(&current->blocked, sig);
587 recalc_sigpending();
588 spin_unlock_irq(&current->sighand->siglock);
589 572
590 return ret; 573 return ret;
591} 574}
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 06b5da392e24..ac3b8d89aae5 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -290,11 +290,8 @@ asmlinkage int sys32_sigsuspend(nabi_no_regargs struct pt_regs regs)
290 return -EFAULT; 290 return -EFAULT;
291 sigdelsetmask(&newset, ~_BLOCKABLE); 291 sigdelsetmask(&newset, ~_BLOCKABLE);
292 292
293 spin_lock_irq(&current->sighand->siglock);
294 current->saved_sigmask = current->blocked; 293 current->saved_sigmask = current->blocked;
295 current->blocked = newset; 294 set_current_blocked(&newset);
296 recalc_sigpending();
297 spin_unlock_irq(&current->sighand->siglock);
298 295
299 current->state = TASK_INTERRUPTIBLE; 296 current->state = TASK_INTERRUPTIBLE;
300 schedule(); 297 schedule();
@@ -318,11 +315,8 @@ asmlinkage int sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
318 return -EFAULT; 315 return -EFAULT;
319 sigdelsetmask(&newset, ~_BLOCKABLE); 316 sigdelsetmask(&newset, ~_BLOCKABLE);
320 317
321 spin_lock_irq(&current->sighand->siglock);
322 current->saved_sigmask = current->blocked; 318 current->saved_sigmask = current->blocked;
323 current->blocked = newset; 319 set_current_blocked(&newset);
324 recalc_sigpending();
325 spin_unlock_irq(&current->sighand->siglock);
326 320
327 current->state = TASK_INTERRUPTIBLE; 321 current->state = TASK_INTERRUPTIBLE;
328 schedule(); 322 schedule();
@@ -488,10 +482,7 @@ asmlinkage void sys32_sigreturn(nabi_no_regargs struct pt_regs regs)
488 goto badframe; 482 goto badframe;
489 483
490 sigdelsetmask(&blocked, ~_BLOCKABLE); 484 sigdelsetmask(&blocked, ~_BLOCKABLE);
491 spin_lock_irq(&current->sighand->siglock); 485 set_current_blocked(&blocked);
492 current->blocked = blocked;
493 recalc_sigpending();
494 spin_unlock_irq(&current->sighand->siglock);
495 486
496 sig = restore_sigcontext32(&regs, &frame->sf_sc); 487 sig = restore_sigcontext32(&regs, &frame->sf_sc);
497 if (sig < 0) 488 if (sig < 0)
@@ -529,10 +520,7 @@ asmlinkage void sys32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
529 goto badframe; 520 goto badframe;
530 521
531 sigdelsetmask(&set, ~_BLOCKABLE); 522 sigdelsetmask(&set, ~_BLOCKABLE);
532 spin_lock_irq(&current->sighand->siglock); 523 set_current_blocked(&set);
533 current->blocked = set;
534 recalc_sigpending();
535 spin_unlock_irq(&current->sighand->siglock);
536 524
537 sig = restore_sigcontext32(&regs, &frame->rs_uc.uc_mcontext); 525 sig = restore_sigcontext32(&regs, &frame->rs_uc.uc_mcontext);
538 if (sig < 0) 526 if (sig < 0)
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index ae29e894ab8d..86eb4b04631c 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -93,11 +93,8 @@ asmlinkage int sysn32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
93 sigset_from_compat(&newset, &uset); 93 sigset_from_compat(&newset, &uset);
94 sigdelsetmask(&newset, ~_BLOCKABLE); 94 sigdelsetmask(&newset, ~_BLOCKABLE);
95 95
96 spin_lock_irq(&current->sighand->siglock);
97 current->saved_sigmask = current->blocked; 96 current->saved_sigmask = current->blocked;
98 current->blocked = newset; 97 set_current_blocked(&newset);
99 recalc_sigpending();
100 spin_unlock_irq(&current->sighand->siglock);
101 98
102 current->state = TASK_INTERRUPTIBLE; 99 current->state = TASK_INTERRUPTIBLE;
103 schedule(); 100 schedule();
@@ -121,10 +118,7 @@ asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
121 goto badframe; 118 goto badframe;
122 119
123 sigdelsetmask(&set, ~_BLOCKABLE); 120 sigdelsetmask(&set, ~_BLOCKABLE);
124 spin_lock_irq(&current->sighand->siglock); 121 set_current_blocked(&set);
125 current->blocked = set;
126 recalc_sigpending();
127 spin_unlock_irq(&current->sighand->siglock);
128 122
129 sig = restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext); 123 sig = restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext);
130 if (sig < 0) 124 if (sig < 0)
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index ba9376bf52a1..71a95f55a649 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -186,61 +186,9 @@ void __devinit smp_prepare_boot_cpu(void)
186 cpu_set(0, cpu_callin_map); 186 cpu_set(0, cpu_callin_map);
187} 187}
188 188
189/* 189int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
190 * Called once for each "cpu_possible(cpu)". Needs to spin up the cpu
191 * and keep control until "cpu_online(cpu)" is set. Note: cpu is
192 * physical, not logical.
193 */
194static struct task_struct *cpu_idle_thread[NR_CPUS];
195
196struct create_idle {
197 struct work_struct work;
198 struct task_struct *idle;
199 struct completion done;
200 int cpu;
201};
202
203static void __cpuinit do_fork_idle(struct work_struct *work)
204{
205 struct create_idle *c_idle =
206 container_of(work, struct create_idle, work);
207
208 c_idle->idle = fork_idle(c_idle->cpu);
209 complete(&c_idle->done);
210}
211
212int __cpuinit __cpu_up(unsigned int cpu)
213{ 190{
214 struct task_struct *idle; 191 mp_ops->boot_secondary(cpu, tidle);
215
216 /*
217 * Processor goes to start_secondary(), sets online flag
218 * The following code is purely to make sure
219 * Linux can schedule processes on this slave.
220 */
221 if (!cpu_idle_thread[cpu]) {
222 /*
223 * Schedule work item to avoid forking user task
224 * Ported from arch/x86/kernel/smpboot.c
225 */
226 struct create_idle c_idle = {
227 .cpu = cpu,
228 .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done),
229 };
230
231 INIT_WORK_ONSTACK(&c_idle.work, do_fork_idle);
232 schedule_work(&c_idle.work);
233 wait_for_completion(&c_idle.done);
234 idle = cpu_idle_thread[cpu] = c_idle.idle;
235
236 if (IS_ERR(idle))
237 panic(KERN_ERR "Fork failed for CPU %d", cpu);
238 } else {
239 idle = cpu_idle_thread[cpu];
240 init_idle(idle, cpu);
241 }
242
243 mp_ops->boot_secondary(cpu, idle);
244 192
245 /* 193 /*
246 * Trust is futile. We should really have timeouts ... 194 * Trust is futile. We should really have timeouts ...
diff --git a/arch/mn10300/Makefile b/arch/mn10300/Makefile
index 7120282bf0d8..33188b6e81e4 100644
--- a/arch/mn10300/Makefile
+++ b/arch/mn10300/Makefile
@@ -51,7 +51,7 @@ UNIT := asb2364
51endif 51endif
52 52
53 53
54head-y := arch/mn10300/kernel/head.o arch/mn10300/kernel/init_task.o 54head-y := arch/mn10300/kernel/head.o
55 55
56core-y += arch/mn10300/kernel/ arch/mn10300/mm/ 56core-y += arch/mn10300/kernel/ arch/mn10300/mm/
57 57
diff --git a/arch/mn10300/include/asm/thread_info.h b/arch/mn10300/include/asm/thread_info.h
index 28cf52100baa..08251d6f6b11 100644
--- a/arch/mn10300/include/asm/thread_info.h
+++ b/arch/mn10300/include/asm/thread_info.h
@@ -20,8 +20,10 @@
20 20
21#ifdef CONFIG_4KSTACKS 21#ifdef CONFIG_4KSTACKS
22#define THREAD_SIZE (4096) 22#define THREAD_SIZE (4096)
23#define THREAD_SIZE_ORDER (0)
23#else 24#else
24#define THREAD_SIZE (8192) 25#define THREAD_SIZE (8192)
26#define THREAD_SIZE_ORDER (1)
25#endif 27#endif
26 28
27#define STACK_WARN (THREAD_SIZE / 8) 29#define STACK_WARN (THREAD_SIZE / 8)
@@ -120,21 +122,8 @@ static inline unsigned long current_stack_pointer(void)
120 return sp; 122 return sp;
121} 123}
122 124
123#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
124
125/* thread information allocation */
126#ifdef CONFIG_DEBUG_STACK_USAGE
127#define alloc_thread_info_node(tsk, node) \
128 kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
129#else
130#define alloc_thread_info_node(tsk, node) \
131 kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
132#endif
133
134#ifndef CONFIG_KGDB 125#ifndef CONFIG_KGDB
135#define free_thread_info(ti) kfree((ti)) 126void arch_release_thread_info(struct thread_info *ti)
136#else
137extern void free_thread_info(struct thread_info *);
138#endif 127#endif
139#define get_thread_info(ti) get_task_struct((ti)->task) 128#define get_thread_info(ti) get_task_struct((ti)->task)
140#define put_thread_info(ti) put_task_struct((ti)->task) 129#define put_thread_info(ti) put_task_struct((ti)->task)
diff --git a/arch/mn10300/kernel/Makefile b/arch/mn10300/kernel/Makefile
index 47ed30fe8178..d06749173d63 100644
--- a/arch/mn10300/kernel/Makefile
+++ b/arch/mn10300/kernel/Makefile
@@ -1,7 +1,7 @@
1# 1#
2# Makefile for the MN10300-specific core kernel code 2# Makefile for the MN10300-specific core kernel code
3# 3#
4extra-y := head.o init_task.o vmlinux.lds 4extra-y := head.o vmlinux.lds
5 5
6fpu-obj-y := fpu-nofpu.o fpu-nofpu-low.o 6fpu-obj-y := fpu-nofpu.o fpu-nofpu-low.o
7fpu-obj-$(CONFIG_FPU) := fpu.o fpu-low.o 7fpu-obj-$(CONFIG_FPU) := fpu.o fpu-low.o
diff --git a/arch/mn10300/kernel/init_task.c b/arch/mn10300/kernel/init_task.c
deleted file mode 100644
index a481b043bea7..000000000000
--- a/arch/mn10300/kernel/init_task.c
+++ /dev/null
@@ -1,39 +0,0 @@
1/* MN10300 Initial task definitions
2 *
3 * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#include <linux/mm.h>
12#include <linux/module.h>
13#include <linux/sched.h>
14#include <linux/init.h>
15#include <linux/init_task.h>
16#include <linux/fs.h>
17#include <linux/mqueue.h>
18#include <asm/uaccess.h>
19#include <asm/pgtable.h>
20
21static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
22static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
23/*
24 * Initial thread structure.
25 *
26 * We need to make sure that this is THREAD_SIZE aligned due to the
27 * way process stacks are handled. This is done by having a special
28 * "init_task" linker map entry..
29 */
30union thread_union init_thread_union __init_task_data =
31 { INIT_THREAD_INFO(init_task) };
32
33/*
34 * Initial task structure.
35 *
36 * All other task structs will be allocated on slabs in fork.c
37 */
38struct task_struct init_task = INIT_TASK(init_task);
39EXPORT_SYMBOL(init_task);
diff --git a/arch/mn10300/kernel/kgdb.c b/arch/mn10300/kernel/kgdb.c
index f6c981db2a36..99770823451a 100644
--- a/arch/mn10300/kernel/kgdb.c
+++ b/arch/mn10300/kernel/kgdb.c
@@ -397,7 +397,7 @@ static bool kgdb_arch_undo_singlestep(struct pt_regs *regs)
397 * single-step state is cleared. At this point the breakpoints should have 397 * single-step state is cleared. At this point the breakpoints should have
398 * been removed by __switch_to(). 398 * been removed by __switch_to().
399 */ 399 */
400void free_thread_info(struct thread_info *ti) 400void arch_release_thread_info(struct thread_info *ti)
401{ 401{
402 if (kgdb_sstep_thread == ti) { 402 if (kgdb_sstep_thread == ti) {
403 kgdb_sstep_thread = NULL; 403 kgdb_sstep_thread = NULL;
@@ -407,7 +407,6 @@ void free_thread_info(struct thread_info *ti)
407 * so force immediate reentry */ 407 * so force immediate reentry */
408 kgdb_breakpoint(); 408 kgdb_breakpoint();
409 } 409 }
410 kfree(ti);
411} 410}
412 411
413/* 412/*
diff --git a/arch/mn10300/kernel/smp.c b/arch/mn10300/kernel/smp.c
index 910dddf65e44..090d35d36973 100644
--- a/arch/mn10300/kernel/smp.c
+++ b/arch/mn10300/kernel/smp.c
@@ -24,6 +24,7 @@
24#include <linux/sched.h> 24#include <linux/sched.h>
25#include <linux/profile.h> 25#include <linux/profile.h>
26#include <linux/smp.h> 26#include <linux/smp.h>
27#include <linux/cpu.h>
27#include <asm/tlbflush.h> 28#include <asm/tlbflush.h>
28#include <asm/bitops.h> 29#include <asm/bitops.h>
29#include <asm/processor.h> 30#include <asm/processor.h>
@@ -38,7 +39,6 @@
38#include "internal.h" 39#include "internal.h"
39 40
40#ifdef CONFIG_HOTPLUG_CPU 41#ifdef CONFIG_HOTPLUG_CPU
41#include <linux/cpu.h>
42#include <asm/cacheflush.h> 42#include <asm/cacheflush.h>
43 43
44static unsigned long sleep_mode[NR_CPUS]; 44static unsigned long sleep_mode[NR_CPUS];
@@ -874,10 +874,13 @@ static void __init smp_online(void)
874 874
875 cpu = smp_processor_id(); 875 cpu = smp_processor_id();
876 876
877 local_irq_enable(); 877 notify_cpu_starting(cpu);
878 878
879 ipi_call_lock();
879 set_cpu_online(cpu, true); 880 set_cpu_online(cpu, true);
880 smp_wmb(); 881 ipi_call_unlock();
882
883 local_irq_enable();
881} 884}
882 885
883/** 886/**
@@ -921,7 +924,7 @@ void initialize_secondary(void)
921 * __cpu_up - Set smp_commenced_mask for the nominated CPU 924 * __cpu_up - Set smp_commenced_mask for the nominated CPU
922 * @cpu: The target CPU. 925 * @cpu: The target CPU.
923 */ 926 */
924int __devinit __cpu_up(unsigned int cpu) 927int __devinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
925{ 928{
926 int timeout; 929 int timeout;
927 930
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 66dff2046987..297bd38f7c5d 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -7,6 +7,7 @@ config OPENRISC
7 def_bool y 7 def_bool y
8 select OF 8 select OF
9 select OF_EARLY_FLATTREE 9 select OF_EARLY_FLATTREE
10 select IRQ_DOMAIN
10 select HAVE_MEMBLOCK 11 select HAVE_MEMBLOCK
11 select ARCH_WANT_OPTIONAL_GPIOLIB 12 select ARCH_WANT_OPTIONAL_GPIOLIB
12 select HAVE_ARCH_TRACEHOOK 13 select HAVE_ARCH_TRACEHOOK
diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile
index 158ae4c0dc6c..966886c8daf5 100644
--- a/arch/openrisc/Makefile
+++ b/arch/openrisc/Makefile
@@ -38,7 +38,7 @@ else
38 KBUILD_CFLAGS += $(call cc-option,-msoft-div) 38 KBUILD_CFLAGS += $(call cc-option,-msoft-div)
39endif 39endif
40 40
41head-y := arch/openrisc/kernel/head.o arch/openrisc/kernel/init_task.o 41head-y := arch/openrisc/kernel/head.o
42 42
43core-y += arch/openrisc/lib/ \ 43core-y += arch/openrisc/lib/ \
44 arch/openrisc/kernel/ \ 44 arch/openrisc/kernel/ \
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index dcea5a0308ae..c936483bc8e2 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -1,6 +1,7 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3header-y += spr_defs.h 3header-y += elf.h
4header-y += ucontext.h
4 5
5generic-y += atomic.h 6generic-y += atomic.h
6generic-y += auxvec.h 7generic-y += auxvec.h
diff --git a/arch/openrisc/include/asm/dma-mapping.h b/arch/openrisc/include/asm/dma-mapping.h
index b206ba4608b2..fab8628e1b6e 100644
--- a/arch/openrisc/include/asm/dma-mapping.h
+++ b/arch/openrisc/include/asm/dma-mapping.h
@@ -20,150 +20,71 @@
20/* 20/*
21 * See Documentation/DMA-API-HOWTO.txt and 21 * See Documentation/DMA-API-HOWTO.txt and
22 * Documentation/DMA-API.txt for documentation. 22 * Documentation/DMA-API.txt for documentation.
23 *
24 * This file is written with the intention of eventually moving over
25 * to largely using asm-generic/dma-mapping-common.h in its place.
26 */ 23 */
27 24
28#include <linux/dma-debug.h> 25#include <linux/dma-debug.h>
29#include <asm-generic/dma-coherent.h> 26#include <asm-generic/dma-coherent.h>
30#include <linux/kmemcheck.h> 27#include <linux/kmemcheck.h>
28#include <linux/dma-mapping.h>
31 29
32#define DMA_ERROR_CODE (~(dma_addr_t)0x0) 30#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
33 31
32extern struct dma_map_ops or1k_dma_map_ops;
34 33
35#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 34static inline struct dma_map_ops *get_dma_ops(struct device *dev)
36#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
37
38void *or1k_dma_alloc_coherent(struct device *dev, size_t size,
39 dma_addr_t *dma_handle, gfp_t flag);
40void or1k_dma_free_coherent(struct device *dev, size_t size, void *vaddr,
41 dma_addr_t dma_handle);
42dma_addr_t or1k_map_page(struct device *dev, struct page *page,
43 unsigned long offset, size_t size,
44 enum dma_data_direction dir,
45 struct dma_attrs *attrs);
46void or1k_unmap_page(struct device *dev, dma_addr_t dma_handle,
47 size_t size, enum dma_data_direction dir,
48 struct dma_attrs *attrs);
49int or1k_map_sg(struct device *dev, struct scatterlist *sg,
50 int nents, enum dma_data_direction dir,
51 struct dma_attrs *attrs);
52void or1k_unmap_sg(struct device *dev, struct scatterlist *sg,
53 int nents, enum dma_data_direction dir,
54 struct dma_attrs *attrs);
55void or1k_sync_single_for_cpu(struct device *dev,
56 dma_addr_t dma_handle, size_t size,
57 enum dma_data_direction dir);
58void or1k_sync_single_for_device(struct device *dev,
59 dma_addr_t dma_handle, size_t size,
60 enum dma_data_direction dir);
61
62static inline void *dma_alloc_coherent(struct device *dev, size_t size,
63 dma_addr_t *dma_handle, gfp_t flag)
64{ 35{
65 void *memory; 36 return &or1k_dma_map_ops;
66
67 memory = or1k_dma_alloc_coherent(dev, size, dma_handle, flag);
68
69 debug_dma_alloc_coherent(dev, size, *dma_handle, memory);
70 return memory;
71} 37}
72 38
73static inline void dma_free_coherent(struct device *dev, size_t size, 39#include <asm-generic/dma-mapping-common.h>
74 void *cpu_addr, dma_addr_t dma_handle)
75{
76 debug_dma_free_coherent(dev, size, cpu_addr, dma_handle);
77 or1k_dma_free_coherent(dev, size, cpu_addr, dma_handle);
78}
79 40
80static inline dma_addr_t dma_map_single(struct device *dev, void *ptr, 41#define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL)
81 size_t size,
82 enum dma_data_direction dir)
83{
84 dma_addr_t addr;
85
86 kmemcheck_mark_initialized(ptr, size);
87 BUG_ON(!valid_dma_direction(dir));
88 addr = or1k_map_page(dev, virt_to_page(ptr),
89 (unsigned long)ptr & ~PAGE_MASK, size,
90 dir, NULL);
91 debug_dma_map_page(dev, virt_to_page(ptr),
92 (unsigned long)ptr & ~PAGE_MASK, size,
93 dir, addr, true);
94 return addr;
95}
96 42
97static inline void dma_unmap_single(struct device *dev, dma_addr_t addr, 43static inline void *dma_alloc_attrs(struct device *dev, size_t size,
98 size_t size, 44 dma_addr_t *dma_handle, gfp_t gfp,
99 enum dma_data_direction dir) 45 struct dma_attrs *attrs)
100{ 46{
101 BUG_ON(!valid_dma_direction(dir)); 47 struct dma_map_ops *ops = get_dma_ops(dev);
102 or1k_unmap_page(dev, addr, size, dir, NULL); 48 void *memory;
103 debug_dma_unmap_page(dev, addr, size, dir, true);
104}
105 49
106static inline int dma_map_sg(struct device *dev, struct scatterlist *sg, 50 memory = ops->alloc(dev, size, dma_handle, gfp, attrs);
107 int nents, enum dma_data_direction dir)
108{
109 int i, ents;
110 struct scatterlist *s;
111 51
112 for_each_sg(sg, s, nents, i) 52 debug_dma_alloc_coherent(dev, size, *dma_handle, memory);
113 kmemcheck_mark_initialized(sg_virt(s), s->length);
114 BUG_ON(!valid_dma_direction(dir));
115 ents = or1k_map_sg(dev, sg, nents, dir, NULL);
116 debug_dma_map_sg(dev, sg, nents, ents, dir);
117 53
118 return ents; 54 return memory;
119} 55}
120 56
121static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg, 57#define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL)
122 int nents, enum dma_data_direction dir)
123{
124 BUG_ON(!valid_dma_direction(dir));
125 debug_dma_unmap_sg(dev, sg, nents, dir);
126 or1k_unmap_sg(dev, sg, nents, dir, NULL);
127}
128 58
129static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, 59static inline void dma_free_attrs(struct device *dev, size_t size,
130 size_t offset, size_t size, 60 void *cpu_addr, dma_addr_t dma_handle,
131 enum dma_data_direction dir) 61 struct dma_attrs *attrs)
132{ 62{
133 dma_addr_t addr; 63 struct dma_map_ops *ops = get_dma_ops(dev);
134 64
135 kmemcheck_mark_initialized(page_address(page) + offset, size); 65 debug_dma_free_coherent(dev, size, cpu_addr, dma_handle);
136 BUG_ON(!valid_dma_direction(dir));
137 addr = or1k_map_page(dev, page, offset, size, dir, NULL);
138 debug_dma_map_page(dev, page, offset, size, dir, addr, false);
139 66
140 return addr; 67 ops->free(dev, size, cpu_addr, dma_handle, attrs);
141} 68}
142 69
143static inline void dma_unmap_page(struct device *dev, dma_addr_t addr, 70static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
144 size_t size, enum dma_data_direction dir) 71 dma_addr_t *dma_handle, gfp_t gfp)
145{ 72{
146 BUG_ON(!valid_dma_direction(dir)); 73 struct dma_attrs attrs;
147 or1k_unmap_page(dev, addr, size, dir, NULL);
148 debug_dma_unmap_page(dev, addr, size, dir, true);
149}
150 74
151static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr, 75 dma_set_attr(DMA_ATTR_NON_CONSISTENT, &attrs);
152 size_t size, 76
153 enum dma_data_direction dir) 77 return dma_alloc_attrs(dev, size, dma_handle, gfp, &attrs);
154{
155 BUG_ON(!valid_dma_direction(dir));
156 or1k_sync_single_for_cpu(dev, addr, size, dir);
157 debug_dma_sync_single_for_cpu(dev, addr, size, dir);
158} 78}
159 79
160static inline void dma_sync_single_for_device(struct device *dev, 80static inline void dma_free_noncoherent(struct device *dev, size_t size,
161 dma_addr_t addr, size_t size, 81 void *cpu_addr, dma_addr_t dma_handle)
162 enum dma_data_direction dir)
163{ 82{
164 BUG_ON(!valid_dma_direction(dir)); 83 struct dma_attrs attrs;
165 or1k_sync_single_for_device(dev, addr, size, dir); 84
166 debug_dma_sync_single_for_device(dev, addr, size, dir); 85 dma_set_attr(DMA_ATTR_NON_CONSISTENT, &attrs);
86
87 dma_free_attrs(dev, size, cpu_addr, dma_handle, &attrs);
167} 88}
168 89
169static inline int dma_supported(struct device *dev, u64 dma_mask) 90static inline int dma_supported(struct device *dev, u64 dma_mask)
diff --git a/arch/openrisc/include/asm/elf.h b/arch/openrisc/include/asm/elf.h
index 2ce603bbfdd3..a8fe2c513070 100644
--- a/arch/openrisc/include/asm/elf.h
+++ b/arch/openrisc/include/asm/elf.h
@@ -20,11 +20,17 @@
20#define __ASM_OPENRISC_ELF_H 20#define __ASM_OPENRISC_ELF_H
21 21
22/* 22/*
23 * This files is partially exported to userspace. This allows us to keep
24 * the ELF bits in one place which should assist in keeping the kernel and
25 * userspace in sync.
26 */
27
28/*
23 * ELF register definitions.. 29 * ELF register definitions..
24 */ 30 */
25#include <linux/types.h>
26#include <linux/ptrace.h>
27 31
32/* for struct user_regs_struct definition */
33#include <asm/ptrace.h>
28 34
29/* The OR1K relocation types... not all relevant for module loader */ 35/* The OR1K relocation types... not all relevant for module loader */
30#define R_OR32_NONE 0 36#define R_OR32_NONE 0
@@ -62,6 +68,8 @@ typedef unsigned long elf_fpregset_t;
62 68
63#ifdef __KERNEL__ 69#ifdef __KERNEL__
64 70
71#include <linux/types.h>
72
65/* 73/*
66 * This is used to ensure we don't load something for the wrong architecture. 74 * This is used to ensure we don't load something for the wrong architecture.
67 */ 75 */
diff --git a/arch/openrisc/include/asm/ptrace.h b/arch/openrisc/include/asm/ptrace.h
index 4651a737591d..8555c0c3d4d7 100644
--- a/arch/openrisc/include/asm/ptrace.h
+++ b/arch/openrisc/include/asm/ptrace.h
@@ -19,8 +19,6 @@
19#ifndef __ASM_OPENRISC_PTRACE_H 19#ifndef __ASM_OPENRISC_PTRACE_H
20#define __ASM_OPENRISC_PTRACE_H 20#define __ASM_OPENRISC_PTRACE_H
21 21
22#include <asm/spr_defs.h>
23
24#ifndef __ASSEMBLY__ 22#ifndef __ASSEMBLY__
25/* 23/*
26 * This is the layout of the regset returned by the GETREGSET ptrace call 24 * This is the layout of the regset returned by the GETREGSET ptrace call
@@ -30,13 +28,13 @@ struct user_regs_struct {
30 unsigned long gpr[32]; 28 unsigned long gpr[32];
31 unsigned long pc; 29 unsigned long pc;
32 unsigned long sr; 30 unsigned long sr;
33 unsigned long pad1;
34 unsigned long pad2;
35}; 31};
36#endif 32#endif
37 33
38#ifdef __KERNEL__ 34#ifdef __KERNEL__
39 35
36#include <asm/spr_defs.h>
37
40/* 38/*
41 * Make kernel PTrace/register structures opaque to userspace... userspace can 39 * Make kernel PTrace/register structures opaque to userspace... userspace can
42 * access thread state via the regset mechanism. This allows us a bit of 40 * access thread state via the regset mechanism. This allows us a bit of
diff --git a/arch/openrisc/kernel/Makefile b/arch/openrisc/kernel/Makefile
index 9a4c2706d795..e1ee0fa2bbda 100644
--- a/arch/openrisc/kernel/Makefile
+++ b/arch/openrisc/kernel/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5extra-y := head.o vmlinux.lds init_task.o 5extra-y := head.o vmlinux.lds
6 6
7obj-y := setup.o idle.o or32_ksyms.o process.o dma.o \ 7obj-y := setup.o idle.o or32_ksyms.o process.o dma.o \
8 traps.o time.o irq.o entry.o ptrace.o signal.o sys_or32.o \ 8 traps.o time.o irq.o entry.o ptrace.o signal.o sys_or32.o \
diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index f1c8ee2895d0..0b77ddb1ee07 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -21,13 +21,16 @@
21 21
22#include <linux/dma-mapping.h> 22#include <linux/dma-mapping.h>
23#include <linux/dma-debug.h> 23#include <linux/dma-debug.h>
24#include <linux/export.h>
25#include <linux/dma-attrs.h>
24 26
25#include <asm/cpuinfo.h> 27#include <asm/cpuinfo.h>
26#include <asm/spr_defs.h> 28#include <asm/spr_defs.h>
27#include <asm/tlbflush.h> 29#include <asm/tlbflush.h>
28 30
29static int page_set_nocache(pte_t *pte, unsigned long addr, 31static int
30 unsigned long next, struct mm_walk *walk) 32page_set_nocache(pte_t *pte, unsigned long addr,
33 unsigned long next, struct mm_walk *walk)
31{ 34{
32 unsigned long cl; 35 unsigned long cl;
33 36
@@ -46,8 +49,9 @@ static int page_set_nocache(pte_t *pte, unsigned long addr,
46 return 0; 49 return 0;
47} 50}
48 51
49static int page_clear_nocache(pte_t *pte, unsigned long addr, 52static int
50 unsigned long next, struct mm_walk *walk) 53page_clear_nocache(pte_t *pte, unsigned long addr,
54 unsigned long next, struct mm_walk *walk)
51{ 55{
52 pte_val(*pte) &= ~_PAGE_CI; 56 pte_val(*pte) &= ~_PAGE_CI;
53 57
@@ -67,9 +71,19 @@ static int page_clear_nocache(pte_t *pte, unsigned long addr,
67 * cache-inhibit bit on those pages, and makes sure that the pages are 71 * cache-inhibit bit on those pages, and makes sure that the pages are
68 * flushed out of the cache before they are used. 72 * flushed out of the cache before they are used.
69 * 73 *
74 * If the NON_CONSISTENT attribute is set, then this function just
75 * returns "normal", cachable memory.
76 *
77 * There are additional flags WEAK_ORDERING and WRITE_COMBINE to take
78 * into consideration here, too. All current known implementations of
79 * the OR1K support only strongly ordered memory accesses, so that flag
80 * is being ignored for now; uncached but write-combined memory is a
81 * missing feature of the OR1K.
70 */ 82 */
71void *or1k_dma_alloc_coherent(struct device *dev, size_t size, 83static void *
72 dma_addr_t *dma_handle, gfp_t gfp) 84or1k_dma_alloc(struct device *dev, size_t size,
85 dma_addr_t *dma_handle, gfp_t gfp,
86 struct dma_attrs *attrs)
73{ 87{
74 unsigned long va; 88 unsigned long va;
75 void *page; 89 void *page;
@@ -87,20 +101,23 @@ void *or1k_dma_alloc_coherent(struct device *dev, size_t size,
87 101
88 va = (unsigned long)page; 102 va = (unsigned long)page;
89 103
90 /* 104 if (!dma_get_attr(DMA_ATTR_NON_CONSISTENT, attrs)) {
91 * We need to iterate through the pages, clearing the dcache for 105 /*
92 * them and setting the cache-inhibit bit. 106 * We need to iterate through the pages, clearing the dcache for
93 */ 107 * them and setting the cache-inhibit bit.
94 if (walk_page_range(va, va + size, &walk)) { 108 */
95 free_pages_exact(page, size); 109 if (walk_page_range(va, va + size, &walk)) {
96 return NULL; 110 free_pages_exact(page, size);
111 return NULL;
112 }
97 } 113 }
98 114
99 return (void *)va; 115 return (void *)va;
100} 116}
101 117
102void or1k_dma_free_coherent(struct device *dev, size_t size, void *vaddr, 118static void
103 dma_addr_t dma_handle) 119or1k_dma_free(struct device *dev, size_t size, void *vaddr,
120 dma_addr_t dma_handle, struct dma_attrs *attrs)
104{ 121{
105 unsigned long va = (unsigned long)vaddr; 122 unsigned long va = (unsigned long)vaddr;
106 struct mm_walk walk = { 123 struct mm_walk walk = {
@@ -108,16 +125,19 @@ void or1k_dma_free_coherent(struct device *dev, size_t size, void *vaddr,
108 .mm = &init_mm 125 .mm = &init_mm
109 }; 126 };
110 127
111 /* walk_page_range shouldn't be able to fail here */ 128 if (!dma_get_attr(DMA_ATTR_NON_CONSISTENT, attrs)) {
112 WARN_ON(walk_page_range(va, va + size, &walk)); 129 /* walk_page_range shouldn't be able to fail here */
130 WARN_ON(walk_page_range(va, va + size, &walk));
131 }
113 132
114 free_pages_exact(vaddr, size); 133 free_pages_exact(vaddr, size);
115} 134}
116 135
117dma_addr_t or1k_map_page(struct device *dev, struct page *page, 136static dma_addr_t
118 unsigned long offset, size_t size, 137or1k_map_page(struct device *dev, struct page *page,
119 enum dma_data_direction dir, 138 unsigned long offset, size_t size,
120 struct dma_attrs *attrs) 139 enum dma_data_direction dir,
140 struct dma_attrs *attrs)
121{ 141{
122 unsigned long cl; 142 unsigned long cl;
123 dma_addr_t addr = page_to_phys(page) + offset; 143 dma_addr_t addr = page_to_phys(page) + offset;
@@ -147,16 +167,18 @@ dma_addr_t or1k_map_page(struct device *dev, struct page *page,
147 return addr; 167 return addr;
148} 168}
149 169
150void or1k_unmap_page(struct device *dev, dma_addr_t dma_handle, 170static void
151 size_t size, enum dma_data_direction dir, 171or1k_unmap_page(struct device *dev, dma_addr_t dma_handle,
152 struct dma_attrs *attrs) 172 size_t size, enum dma_data_direction dir,
173 struct dma_attrs *attrs)
153{ 174{
154 /* Nothing special to do here... */ 175 /* Nothing special to do here... */
155} 176}
156 177
157int or1k_map_sg(struct device *dev, struct scatterlist *sg, 178static int
158 int nents, enum dma_data_direction dir, 179or1k_map_sg(struct device *dev, struct scatterlist *sg,
159 struct dma_attrs *attrs) 180 int nents, enum dma_data_direction dir,
181 struct dma_attrs *attrs)
160{ 182{
161 struct scatterlist *s; 183 struct scatterlist *s;
162 int i; 184 int i;
@@ -169,9 +191,10 @@ int or1k_map_sg(struct device *dev, struct scatterlist *sg,
169 return nents; 191 return nents;
170} 192}
171 193
172void or1k_unmap_sg(struct device *dev, struct scatterlist *sg, 194static void
173 int nents, enum dma_data_direction dir, 195or1k_unmap_sg(struct device *dev, struct scatterlist *sg,
174 struct dma_attrs *attrs) 196 int nents, enum dma_data_direction dir,
197 struct dma_attrs *attrs)
175{ 198{
176 struct scatterlist *s; 199 struct scatterlist *s;
177 int i; 200 int i;
@@ -181,9 +204,10 @@ void or1k_unmap_sg(struct device *dev, struct scatterlist *sg,
181 } 204 }
182} 205}
183 206
184void or1k_sync_single_for_cpu(struct device *dev, 207static void
185 dma_addr_t dma_handle, size_t size, 208or1k_sync_single_for_cpu(struct device *dev,
186 enum dma_data_direction dir) 209 dma_addr_t dma_handle, size_t size,
210 enum dma_data_direction dir)
187{ 211{
188 unsigned long cl; 212 unsigned long cl;
189 dma_addr_t addr = dma_handle; 213 dma_addr_t addr = dma_handle;
@@ -193,9 +217,10 @@ void or1k_sync_single_for_cpu(struct device *dev,
193 mtspr(SPR_DCBIR, cl); 217 mtspr(SPR_DCBIR, cl);
194} 218}
195 219
196void or1k_sync_single_for_device(struct device *dev, 220static void
197 dma_addr_t dma_handle, size_t size, 221or1k_sync_single_for_device(struct device *dev,
198 enum dma_data_direction dir) 222 dma_addr_t dma_handle, size_t size,
223 enum dma_data_direction dir)
199{ 224{
200 unsigned long cl; 225 unsigned long cl;
201 dma_addr_t addr = dma_handle; 226 dma_addr_t addr = dma_handle;
@@ -205,6 +230,18 @@ void or1k_sync_single_for_device(struct device *dev,
205 mtspr(SPR_DCBFR, cl); 230 mtspr(SPR_DCBFR, cl);
206} 231}
207 232
233struct dma_map_ops or1k_dma_map_ops = {
234 .alloc = or1k_dma_alloc,
235 .free = or1k_dma_free,
236 .map_page = or1k_map_page,
237 .unmap_page = or1k_unmap_page,
238 .map_sg = or1k_map_sg,
239 .unmap_sg = or1k_unmap_sg,
240 .sync_single_for_cpu = or1k_sync_single_for_cpu,
241 .sync_single_for_device = or1k_sync_single_for_device,
242};
243EXPORT_SYMBOL(or1k_dma_map_ops);
244
208/* Number of entries preallocated for DMA-API debugging */ 245/* Number of entries preallocated for DMA-API debugging */
209#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16) 246#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
210 247
diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S
index 6e61af8682b8..ddfcaa828b0e 100644
--- a/arch/openrisc/kernel/entry.S
+++ b/arch/openrisc/kernel/entry.S
@@ -1117,10 +1117,10 @@ ENTRY(sys_rt_sigreturn)
1117ENTRY(sys_or1k_atomic) 1117ENTRY(sys_or1k_atomic)
1118 /* FIXME: This ignores r3 and always does an XCHG */ 1118 /* FIXME: This ignores r3 and always does an XCHG */
1119 DISABLE_INTERRUPTS(r17,r19) 1119 DISABLE_INTERRUPTS(r17,r19)
1120 l.lwz r30,0(r4) 1120 l.lwz r29,0(r4)
1121 l.lwz r28,0(r5) 1121 l.lwz r27,0(r5)
1122 l.sw 0(r4),r28 1122 l.sw 0(r4),r27
1123 l.sw 0(r5),r30 1123 l.sw 0(r5),r29
1124 ENABLE_INTERRUPTS(r17) 1124 ENABLE_INTERRUPTS(r17)
1125 l.jr r9 1125 l.jr r9
1126 l.or r11,r0,r0 1126 l.or r11,r0,r0
diff --git a/arch/openrisc/kernel/init_task.c b/arch/openrisc/kernel/init_task.c
deleted file mode 100644
index ca534082d5f3..000000000000
--- a/arch/openrisc/kernel/init_task.c
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * OpenRISC init_task.c
3 *
4 * Linux architectural port borrowing liberally from similar works of
5 * others. All original copyrights apply as per the original source
6 * declaration.
7 *
8 * Modifications for the OpenRISC architecture:
9 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17
18#include <linux/init_task.h>
19#include <linux/mqueue.h>
20#include <linux/export.h>
21
22static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
23static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
24
25/*
26 * Initial thread structure.
27 *
28 * We need to make sure that this is THREAD_SIZE aligned due to the
29 * way process stacks are handled. This is done by having a special
30 * "init_task" linker map entry..
31 */
32union thread_union init_thread_union __init_task_data = {
33 INIT_THREAD_INFO(init_task)
34};
35
36/*
37 * Initial task structure.
38 *
39 * All other task structs will be allocated on slabs in fork.c
40 */
41struct task_struct init_task = INIT_TASK(init_task);
42EXPORT_SYMBOL(init_task);
diff --git a/arch/openrisc/kernel/irq.c b/arch/openrisc/kernel/irq.c
index 4bfead220956..e935b9d8eee1 100644
--- a/arch/openrisc/kernel/irq.c
+++ b/arch/openrisc/kernel/irq.c
@@ -14,17 +14,13 @@
14 * 2 of the License, or (at your option) any later version. 14 * 2 of the License, or (at your option) any later version.
15 */ 15 */
16 16
17#include <linux/ptrace.h>
18#include <linux/errno.h>
19#include <linux/interrupt.h> 17#include <linux/interrupt.h>
20#include <linux/init.h> 18#include <linux/init.h>
21#include <linux/of.h> 19#include <linux/of.h>
22#include <linux/ftrace.h> 20#include <linux/ftrace.h>
23#include <linux/irq.h> 21#include <linux/irq.h>
24#include <linux/seq_file.h>
25#include <linux/kernel_stat.h>
26#include <linux/export.h> 22#include <linux/export.h>
27 23#include <linux/irqdomain.h>
28#include <linux/irqflags.h> 24#include <linux/irqflags.h>
29 25
30/* read interrupt enabled status */ 26/* read interrupt enabled status */
@@ -98,6 +94,7 @@ static void or1k_pic_mask_ack(struct irq_data *data)
98#endif 94#endif
99} 95}
100 96
97#if 0
101static int or1k_pic_set_type(struct irq_data *data, unsigned int flow_type) 98static int or1k_pic_set_type(struct irq_data *data, unsigned int flow_type)
102{ 99{
103 /* There's nothing to do in the PIC configuration when changing 100 /* There's nothing to do in the PIC configuration when changing
@@ -107,43 +104,64 @@ static int or1k_pic_set_type(struct irq_data *data, unsigned int flow_type)
107 104
108 return irq_setup_alt_chip(data, flow_type); 105 return irq_setup_alt_chip(data, flow_type);
109} 106}
107#endif
108
109static struct irq_chip or1k_dev = {
110 .name = "or1k-PIC",
111 .irq_unmask = or1k_pic_unmask,
112 .irq_mask = or1k_pic_mask,
113 .irq_ack = or1k_pic_ack,
114 .irq_mask_ack = or1k_pic_mask_ack,
115};
116
117static struct irq_domain *root_domain;
110 118
111static inline int pic_get_irq(int first) 119static inline int pic_get_irq(int first)
112{ 120{
113 int irq; 121 int hwirq;
114 122
115 irq = ffs(mfspr(SPR_PICSR) >> first); 123 hwirq = ffs(mfspr(SPR_PICSR) >> first);
124 if (!hwirq)
125 return NO_IRQ;
126 else
127 hwirq = hwirq + first -1;
116 128
117 return irq ? irq + first - 1 : NO_IRQ; 129 return irq_find_mapping(root_domain, hwirq);
118} 130}
119 131
120static void __init or1k_irq_init(void) 132
133static int or1k_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
121{ 134{
122 struct irq_chip_generic *gc; 135 irq_set_chip_and_handler_name(irq, &or1k_dev,
123 struct irq_chip_type *ct; 136 handle_level_irq, "level");
137 irq_set_status_flags(irq, IRQ_LEVEL | IRQ_NOPROBE);
124 138
125 /* Disable all interrupts until explicitly requested */ 139 return 0;
126 mtspr(SPR_PICMR, (0UL)); 140}
127 141
128 gc = irq_alloc_generic_chip("or1k-PIC", 1, 0, 0, handle_level_irq); 142static const struct irq_domain_ops or1k_irq_domain_ops = {
129 ct = gc->chip_types; 143 .xlate = irq_domain_xlate_onecell,
144 .map = or1k_map,
145};
130 146
131 ct->chip.irq_unmask = or1k_pic_unmask; 147/*
132 ct->chip.irq_mask = or1k_pic_mask; 148 * This sets up the IRQ domain for the PIC built in to the OpenRISC
133 ct->chip.irq_ack = or1k_pic_ack; 149 * 1000 CPU. This is the "root" domain as these are the interrupts
134 ct->chip.irq_mask_ack = or1k_pic_mask_ack; 150 * that directly trigger an exception in the CPU.
135 ct->chip.irq_set_type = or1k_pic_set_type; 151 */
152static void __init or1k_irq_init(void)
153{
154 struct device_node *intc = NULL;
136 155
137 /* The OR1K PIC can handle both level and edge trigged 156 /* The interrupt controller device node is mandatory */
138 * interrupts in roughly the same manner 157 intc = of_find_compatible_node(NULL, NULL, "opencores,or1k-pic");
139 */ 158 BUG_ON(!intc);
140#if 0
141 /* FIXME: chip.type??? */
142 ct->chip.type = IRQ_TYPE_EDGE_BOTH | IRQ_TYPE_LEVEL_MASK;
143#endif
144 159
145 irq_setup_generic_chip(gc, IRQ_MSK(NR_IRQS), 0, 160 /* Disable all interrupts until explicitly requested */
146 IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); 161 mtspr(SPR_PICMR, (0UL));
162
163 root_domain = irq_domain_add_linear(intc, 32,
164 &or1k_irq_domain_ops, NULL);
147} 165}
148 166
149void __init init_IRQ(void) 167void __init init_IRQ(void)
@@ -164,10 +182,3 @@ void __irq_entry do_IRQ(struct pt_regs *regs)
164 irq_exit(); 182 irq_exit();
165 set_irq_regs(old_regs); 183 set_irq_regs(old_regs);
166} 184}
167
168unsigned int irq_create_of_mapping(struct device_node *controller,
169 const u32 *intspec, unsigned int intsize)
170{
171 return intspec[0];
172}
173EXPORT_SYMBOL_GPL(irq_create_of_mapping);
diff --git a/arch/openrisc/mm/fault.c b/arch/openrisc/mm/fault.c
index a5dce82f864b..40f850e9766c 100644
--- a/arch/openrisc/mm/fault.c
+++ b/arch/openrisc/mm/fault.c
@@ -54,6 +54,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address,
54 struct vm_area_struct *vma; 54 struct vm_area_struct *vma;
55 siginfo_t info; 55 siginfo_t info;
56 int fault; 56 int fault;
57 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
57 58
58 tsk = current; 59 tsk = current;
59 60
@@ -105,6 +106,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address,
105 if (in_interrupt() || !mm) 106 if (in_interrupt() || !mm)
106 goto no_context; 107 goto no_context;
107 108
109retry:
108 down_read(&mm->mmap_sem); 110 down_read(&mm->mmap_sem);
109 vma = find_vma(mm, address); 111 vma = find_vma(mm, address);
110 112
@@ -143,6 +145,7 @@ good_area:
143 if (write_acc) { 145 if (write_acc) {
144 if (!(vma->vm_flags & VM_WRITE)) 146 if (!(vma->vm_flags & VM_WRITE))
145 goto bad_area; 147 goto bad_area;
148 flags |= FAULT_FLAG_WRITE;
146 } else { 149 } else {
147 /* not present */ 150 /* not present */
148 if (!(vma->vm_flags & (VM_READ | VM_EXEC))) 151 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
@@ -159,7 +162,11 @@ good_area:
159 * the fault. 162 * the fault.
160 */ 163 */
161 164
162 fault = handle_mm_fault(mm, vma, address, write_acc); 165 fault = handle_mm_fault(mm, vma, address, flags);
166
167 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
168 return;
169
163 if (unlikely(fault & VM_FAULT_ERROR)) { 170 if (unlikely(fault & VM_FAULT_ERROR)) {
164 if (fault & VM_FAULT_OOM) 171 if (fault & VM_FAULT_OOM)
165 goto out_of_memory; 172 goto out_of_memory;
@@ -167,11 +174,24 @@ good_area:
167 goto do_sigbus; 174 goto do_sigbus;
168 BUG(); 175 BUG();
169 } 176 }
170 /*RGD modeled on Cris */ 177
171 if (fault & VM_FAULT_MAJOR) 178 if (flags & FAULT_FLAG_ALLOW_RETRY) {
172 tsk->maj_flt++; 179 /*RGD modeled on Cris */
173 else 180 if (fault & VM_FAULT_MAJOR)
174 tsk->min_flt++; 181 tsk->maj_flt++;
182 else
183 tsk->min_flt++;
184 if (fault & VM_FAULT_RETRY) {
185 flags &= ~FAULT_FLAG_ALLOW_RETRY;
186
187 /* No need to up_read(&mm->mmap_sem) as we would
188 * have already released it in __lock_page_or_retry
189 * in mm/filemap.c.
190 */
191
192 goto retry;
193 }
194 }
175 195
176 up_read(&mm->mmap_sem); 196 up_read(&mm->mmap_sem);
177 return; 197 return;
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 242a1b7ac759..ddb8b24b823d 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -17,6 +17,7 @@ config PARISC
17 select GENERIC_PCI_IOMAP 17 select GENERIC_PCI_IOMAP
18 select IRQ_PER_CPU 18 select IRQ_PER_CPU
19 select ARCH_HAVE_NMI_SAFE_CMPXCHG 19 select ARCH_HAVE_NMI_SAFE_CMPXCHG
20 select GENERIC_SMP_IDLE_THREAD
20 21
21 help 22 help
22 The PA-RISC microprocessor is designed by Hewlett-Packard and used 23 The PA-RISC microprocessor is designed by Hewlett-Packard and used
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 19ab7b2ea1cd..dbc3850b1d0d 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -75,7 +75,7 @@ head-y := arch/parisc/kernel/head.o
75 75
76KBUILD_CFLAGS += $(cflags-y) 76KBUILD_CFLAGS += $(cflags-y)
77 77
78kernel-y := mm/ kernel/ math-emu/ kernel/init_task.o 78kernel-y := mm/ kernel/ math-emu/
79kernel-$(CONFIG_HPUX) += hpux/ 79kernel-$(CONFIG_HPUX) += hpux/
80 80
81core-y += $(addprefix arch/parisc/, $(kernel-y)) 81core-y += $(addprefix arch/parisc/, $(kernel-y))
diff --git a/arch/parisc/include/asm/hardware.h b/arch/parisc/include/asm/hardware.h
index 4e9626836bab..d1d864b81bae 100644
--- a/arch/parisc/include/asm/hardware.h
+++ b/arch/parisc/include/asm/hardware.h
@@ -2,7 +2,6 @@
2#define _PARISC_HARDWARE_H 2#define _PARISC_HARDWARE_H
3 3
4#include <linux/mod_devicetable.h> 4#include <linux/mod_devicetable.h>
5#include <asm/pdc.h>
6 5
7#define HWTYPE_ANY_ID PA_HWTYPE_ANY_ID 6#define HWTYPE_ANY_ID PA_HWTYPE_ANY_ID
8#define HVERSION_ANY_ID PA_HVERSION_ANY_ID 7#define HVERSION_ANY_ID PA_HVERSION_ANY_ID
@@ -95,12 +94,14 @@ struct bc_module {
95#define HPHW_MC 15 94#define HPHW_MC 15
96#define HPHW_FAULTY 31 95#define HPHW_FAULTY 31
97 96
97struct parisc_device_id;
98 98
99/* hardware.c: */ 99/* hardware.c: */
100extern const char *parisc_hardware_description(struct parisc_device_id *id); 100extern const char *parisc_hardware_description(struct parisc_device_id *id);
101extern enum cpu_type parisc_get_cpu_type(unsigned long hversion); 101extern enum cpu_type parisc_get_cpu_type(unsigned long hversion);
102 102
103struct pci_dev; 103struct pci_dev;
104struct hardware_path;
104 105
105/* drivers.c: */ 106/* drivers.c: */
106extern struct parisc_device *alloc_pa_dev(unsigned long hpa, 107extern struct parisc_device *alloc_pa_dev(unsigned long hpa,
diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h
index a84cc1f925f6..4e0e7dbf0f3f 100644
--- a/arch/parisc/include/asm/page.h
+++ b/arch/parisc/include/asm/page.h
@@ -160,5 +160,11 @@ extern int npmem_ranges;
160 160
161#include <asm-generic/memory_model.h> 161#include <asm-generic/memory_model.h>
162#include <asm-generic/getorder.h> 162#include <asm-generic/getorder.h>
163#include <asm/pdc.h>
164
165#define PAGE0 ((struct zeropage *)__PAGE_OFFSET)
166
167/* DEFINITION OF THE ZERO-PAGE (PAG0) */
168/* based on work by Jason Eckhardt (jason@equator.com) */
163 169
164#endif /* _PARISC_PAGE_H */ 170#endif /* _PARISC_PAGE_H */
diff --git a/arch/parisc/include/asm/pdc.h b/arch/parisc/include/asm/pdc.h
index 4ca510b3c6f8..7f0f2d23059d 100644
--- a/arch/parisc/include/asm/pdc.h
+++ b/arch/parisc/include/asm/pdc.h
@@ -343,8 +343,6 @@
343 343
344#ifdef __KERNEL__ 344#ifdef __KERNEL__
345 345
346#include <asm/page.h> /* for __PAGE_OFFSET */
347
348extern int pdc_type; 346extern int pdc_type;
349 347
350/* Values for pdc_type */ 348/* Values for pdc_type */
@@ -677,11 +675,6 @@ static inline char * os_id_to_string(u16 os_id) {
677 675
678#endif /* __KERNEL__ */ 676#endif /* __KERNEL__ */
679 677
680#define PAGE0 ((struct zeropage *)__PAGE_OFFSET)
681
682/* DEFINITION OF THE ZERO-PAGE (PAG0) */
683/* based on work by Jason Eckhardt (jason@equator.com) */
684
685/* flags of the device_path */ 678/* flags of the device_path */
686#define PF_AUTOBOOT 0x80 679#define PF_AUTOBOOT 0x80
687#define PF_AUTOSEARCH 0x40 680#define PF_AUTOSEARCH 0x40
diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h
index 22dadeb58695..ee99f2339356 100644
--- a/arch/parisc/include/asm/pgtable.h
+++ b/arch/parisc/include/asm/pgtable.h
@@ -44,6 +44,8 @@ struct vm_area_struct;
44 44
45#endif /* !__ASSEMBLY__ */ 45#endif /* !__ASSEMBLY__ */
46 46
47#include <asm/page.h>
48
47#define pte_ERROR(e) \ 49#define pte_ERROR(e) \
48 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) 50 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
49#define pmd_ERROR(e) \ 51#define pmd_ERROR(e) \
diff --git a/arch/parisc/include/asm/prefetch.h b/arch/parisc/include/asm/prefetch.h
index c5edc60c059f..1ee7c82672c1 100644
--- a/arch/parisc/include/asm/prefetch.h
+++ b/arch/parisc/include/asm/prefetch.h
@@ -21,7 +21,12 @@
21#define ARCH_HAS_PREFETCH 21#define ARCH_HAS_PREFETCH
22static inline void prefetch(const void *addr) 22static inline void prefetch(const void *addr)
23{ 23{
24 __asm__("ldw 0(%0), %%r0" : : "r" (addr)); 24 __asm__(
25#ifndef CONFIG_PA20
26 /* Need to avoid prefetch of NULL on PA7300LC */
27 " extrw,u,= %0,31,32,%%r0\n"
28#endif
29 " ldw 0(%0), %%r0" : : "r" (addr));
25} 30}
26 31
27/* LDD is a PA2.0 addition. */ 32/* LDD is a PA2.0 addition. */
diff --git a/arch/parisc/include/asm/spinlock.h b/arch/parisc/include/asm/spinlock.h
index 804aa28ab1d6..3516e0b27044 100644
--- a/arch/parisc/include/asm/spinlock.h
+++ b/arch/parisc/include/asm/spinlock.h
@@ -1,6 +1,8 @@
1#ifndef __ASM_SPINLOCK_H 1#ifndef __ASM_SPINLOCK_H
2#define __ASM_SPINLOCK_H 2#define __ASM_SPINLOCK_H
3 3
4#include <asm/barrier.h>
5#include <asm/ldcw.h>
4#include <asm/processor.h> 6#include <asm/processor.h>
5#include <asm/spinlock_types.h> 7#include <asm/spinlock_types.h>
6 8
diff --git a/arch/parisc/kernel/Makefile b/arch/parisc/kernel/Makefile
index 67db0722e6ca..66ee3f12df58 100644
--- a/arch/parisc/kernel/Makefile
+++ b/arch/parisc/kernel/Makefile
@@ -2,7 +2,7 @@
2# Makefile for arch/parisc/kernel 2# Makefile for arch/parisc/kernel
3# 3#
4 4
5extra-y := init_task.o head.o vmlinux.lds 5extra-y := head.o vmlinux.lds
6 6
7obj-y := cache.o pacache.o setup.o traps.o time.o irq.o \ 7obj-y := cache.o pacache.o setup.o traps.o time.o irq.o \
8 pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \ 8 pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index 6f0594439143..535034217021 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -581,7 +581,11 @@
581 */ 581 */
582 cmpiclr,= 0x01,\tmp,%r0 582 cmpiclr,= 0x01,\tmp,%r0
583 ldi (_PAGE_DIRTY|_PAGE_READ|_PAGE_WRITE),\prot 583 ldi (_PAGE_DIRTY|_PAGE_READ|_PAGE_WRITE),\prot
584#ifdef CONFIG_64BIT
584 depd,z \prot,8,7,\prot 585 depd,z \prot,8,7,\prot
586#else
587 depw,z \prot,8,7,\prot
588#endif
585 /* 589 /*
586 * OK, it is in the temp alias region, check whether "from" or "to". 590 * OK, it is in the temp alias region, check whether "from" or "to".
587 * Check "subtle" note in pacache.S re: r23/r26. 591 * Check "subtle" note in pacache.S re: r23/r26.
diff --git a/arch/parisc/kernel/init_task.c b/arch/parisc/kernel/init_task.c
deleted file mode 100644
index 4a91e433416f..000000000000
--- a/arch/parisc/kernel/init_task.c
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * Static declaration of "init" task data structure.
3 *
4 * Copyright (C) 2000 Paul Bame <bame at parisc-linux.org>
5 * Copyright (C) 2000-2001 John Marvin <jsm at parisc-linux.org>
6 * Copyright (C) 2001 Helge Deller <deller @ parisc-linux.org>
7 * Copyright (C) 2002 Matthew Wilcox <willy with parisc-linux.org>
8 *
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25#include <linux/mm.h>
26#include <linux/fs.h>
27#include <linux/module.h>
28#include <linux/sched.h>
29#include <linux/init.h>
30#include <linux/init_task.h>
31#include <linux/mqueue.h>
32
33#include <asm/uaccess.h>
34#include <asm/pgtable.h>
35#include <asm/pgalloc.h>
36
37static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
38static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
39/*
40 * Initial task structure.
41 *
42 * We need to make sure that this is 16384-byte aligned due to the
43 * way process stacks are handled. This is done by having a special
44 * "init_task" linker map entry..
45 */
46union thread_union init_thread_union __init_task_data
47 __attribute__((aligned(128))) =
48 { INIT_THREAD_INFO(init_task) };
49
50#if PT_NLEVELS == 3
51/* NOTE: This layout exactly conforms to the hybrid L2/L3 page table layout
52 * with the first pmd adjacent to the pgd and below it. gcc doesn't actually
53 * guarantee that global objects will be laid out in memory in the same order
54 * as the order of declaration, so put these in different sections and use
55 * the linker script to order them. */
56pmd_t pmd0[PTRS_PER_PMD] __attribute__ ((__section__ (".data..vm0.pmd"), aligned(PAGE_SIZE)));
57#endif
58
59pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__ ((__section__ (".data..vm0.pgd"), aligned(PAGE_SIZE)));
60pte_t pg0[PT_INITIAL * PTRS_PER_PTE] __attribute__ ((__section__ (".data..vm0.pte"), aligned(PAGE_SIZE)));
61
62/*
63 * Initial task structure.
64 *
65 * All other task structs will be allocated on slabs in fork.c
66 */
67EXPORT_SYMBOL(init_task);
68
69__asm__(".data");
70struct task_struct init_task = INIT_TASK(init_task);
diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S
index 93ff3d90edd1..5d7218ad885c 100644
--- a/arch/parisc/kernel/pacache.S
+++ b/arch/parisc/kernel/pacache.S
@@ -692,7 +692,7 @@ ENTRY(flush_icache_page_asm)
692 692
693 /* Purge any old translation */ 693 /* Purge any old translation */
694 694
695 pitlb (%sr0,%r28) 695 pitlb (%sr4,%r28)
696 696
697 ldil L%icache_stride, %r1 697 ldil L%icache_stride, %r1
698 ldw R%icache_stride(%r1), %r1 698 ldw R%icache_stride(%r1), %r1
@@ -706,27 +706,29 @@ ENTRY(flush_icache_page_asm)
706 sub %r25, %r1, %r25 706 sub %r25, %r1, %r25
707 707
708 708
7091: fic,m %r1(%r28) 709 /* fic only has the type 26 form on PA1.1, requiring an
710 fic,m %r1(%r28) 710 * explicit space specification, so use %sr4 */
711 fic,m %r1(%r28) 7111: fic,m %r1(%sr4,%r28)
712 fic,m %r1(%r28) 712 fic,m %r1(%sr4,%r28)
713 fic,m %r1(%r28) 713 fic,m %r1(%sr4,%r28)
714 fic,m %r1(%r28) 714 fic,m %r1(%sr4,%r28)
715 fic,m %r1(%r28) 715 fic,m %r1(%sr4,%r28)
716 fic,m %r1(%r28) 716 fic,m %r1(%sr4,%r28)
717 fic,m %r1(%r28) 717 fic,m %r1(%sr4,%r28)
718 fic,m %r1(%r28) 718 fic,m %r1(%sr4,%r28)
719 fic,m %r1(%r28) 719 fic,m %r1(%sr4,%r28)
720 fic,m %r1(%r28) 720 fic,m %r1(%sr4,%r28)
721 fic,m %r1(%r28) 721 fic,m %r1(%sr4,%r28)
722 fic,m %r1(%r28) 722 fic,m %r1(%sr4,%r28)
723 fic,m %r1(%r28) 723 fic,m %r1(%sr4,%r28)
724 fic,m %r1(%sr4,%r28)
725 fic,m %r1(%sr4,%r28)
724 cmpb,COND(<<) %r28, %r25,1b 726 cmpb,COND(<<) %r28, %r25,1b
725 fic,m %r1(%r28) 727 fic,m %r1(%sr4,%r28)
726 728
727 sync 729 sync
728 bv %r0(%r2) 730 bv %r0(%r2)
729 pitlb (%sr0,%r25) 731 pitlb (%sr4,%r25)
730 .exit 732 .exit
731 733
732 .procend 734 .procend
diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c
index 4f004596a6e7..47341aa208f2 100644
--- a/arch/parisc/kernel/pdc_cons.c
+++ b/arch/parisc/kernel/pdc_cons.c
@@ -50,6 +50,7 @@
50#include <linux/init.h> 50#include <linux/init.h>
51#include <linux/major.h> 51#include <linux/major.h>
52#include <linux/tty.h> 52#include <linux/tty.h>
53#include <asm/page.h> /* for PAGE0 */
53#include <asm/pdc.h> /* for iodc_call() proto and friends */ 54#include <asm/pdc.h> /* for iodc_call() proto and friends */
54 55
55static DEFINE_SPINLOCK(pdc_console_lock); 56static DEFINE_SPINLOCK(pdc_console_lock);
@@ -104,7 +105,7 @@ static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp)
104 105
105static void pdc_console_tty_close(struct tty_struct *tty, struct file *filp) 106static void pdc_console_tty_close(struct tty_struct *tty, struct file *filp)
106{ 107{
107 if (!tty->count) { 108 if (tty->count == 1) {
108 del_timer_sync(&pdc_console_timer); 109 del_timer_sync(&pdc_console_timer);
109 tty_port_tty_set(&tty_port, NULL); 110 tty_port_tty_set(&tty_port, NULL);
110 } 111 }
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
index 0bb1d63907f8..a47828d31fe6 100644
--- a/arch/parisc/kernel/smp.c
+++ b/arch/parisc/kernel/smp.c
@@ -31,6 +31,7 @@
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/bitops.h> 32#include <linux/bitops.h>
33#include <linux/ftrace.h> 33#include <linux/ftrace.h>
34#include <linux/cpu.h>
34 35
35#include <linux/atomic.h> 36#include <linux/atomic.h>
36#include <asm/current.h> 37#include <asm/current.h>
@@ -295,8 +296,13 @@ smp_cpu_init(int cpunum)
295 296
296 printk(KERN_CRIT "CPU#%d already initialized!\n", cpunum); 297 printk(KERN_CRIT "CPU#%d already initialized!\n", cpunum);
297 machine_halt(); 298 machine_halt();
298 } 299 }
300
301 notify_cpu_starting(cpunum);
302
303 ipi_call_lock();
299 set_cpu_online(cpunum, true); 304 set_cpu_online(cpunum, true);
305 ipi_call_unlock();
300 306
301 /* Initialise the idle task for this CPU */ 307 /* Initialise the idle task for this CPU */
302 atomic_inc(&init_mm.mm_count); 308 atomic_inc(&init_mm.mm_count);
@@ -334,26 +340,11 @@ void __init smp_callin(void)
334/* 340/*
335 * Bring one cpu online. 341 * Bring one cpu online.
336 */ 342 */
337int __cpuinit smp_boot_one_cpu(int cpuid) 343int __cpuinit smp_boot_one_cpu(int cpuid, struct task_struct *idle)
338{ 344{
339 const struct cpuinfo_parisc *p = &per_cpu(cpu_data, cpuid); 345 const struct cpuinfo_parisc *p = &per_cpu(cpu_data, cpuid);
340 struct task_struct *idle;
341 long timeout; 346 long timeout;
342 347
343 /*
344 * Create an idle task for this CPU. Note the address wed* give
345 * to kernel_thread is irrelevant -- it's going to start
346 * where OS_BOOT_RENDEVZ vector in SAL says to start. But
347 * this gets all the other task-y sort of data structures set
348 * up like we wish. We need to pull the just created idle task
349 * off the run queue and stuff it into the init_tasks[] array.
350 * Sheesh . . .
351 */
352
353 idle = fork_idle(cpuid);
354 if (IS_ERR(idle))
355 panic("SMP: fork failed for CPU:%d", cpuid);
356
357 task_thread_info(idle)->cpu = cpuid; 348 task_thread_info(idle)->cpu = cpuid;
358 349
359 /* Let _start know what logical CPU we're booting 350 /* Let _start know what logical CPU we're booting
@@ -397,10 +388,6 @@ int __cpuinit smp_boot_one_cpu(int cpuid)
397 udelay(100); 388 udelay(100);
398 barrier(); 389 barrier();
399 } 390 }
400
401 put_task_struct(idle);
402 idle = NULL;
403
404 printk(KERN_CRIT "SMP: CPU:%d is stuck.\n", cpuid); 391 printk(KERN_CRIT "SMP: CPU:%d is stuck.\n", cpuid);
405 return -1; 392 return -1;
406 393
@@ -449,10 +436,10 @@ void smp_cpus_done(unsigned int cpu_max)
449} 436}
450 437
451 438
452int __cpuinit __cpu_up(unsigned int cpu) 439int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
453{ 440{
454 if (cpu != 0 && cpu < parisc_max_cpus) 441 if (cpu != 0 && cpu < parisc_max_cpus)
455 smp_boot_one_cpu(cpu); 442 smp_boot_one_cpu(cpu, tidle);
456 443
457 return cpu_online(cpu) ? 0 : -ENOSYS; 444 return cpu_online(cpu) ? 0 : -ENOSYS;
458} 445}
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 7c0774397b89..70e105d62423 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -29,6 +29,7 @@
29#include <asm/uaccess.h> 29#include <asm/uaccess.h>
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/page.h>
32#include <asm/param.h> 33#include <asm/param.h>
33#include <asm/pdc.h> 34#include <asm/pdc.h>
34#include <asm/led.h> 35#include <asm/led.h>
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 82f364e209fc..3ac462de53a4 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -33,6 +33,18 @@
33 33
34extern int data_start; 34extern int data_start;
35 35
36#if PT_NLEVELS == 3
37/* NOTE: This layout exactly conforms to the hybrid L2/L3 page table layout
38 * with the first pmd adjacent to the pgd and below it. gcc doesn't actually
39 * guarantee that global objects will be laid out in memory in the same order
40 * as the order of declaration, so put these in different sections and use
41 * the linker script to order them. */
42pmd_t pmd0[PTRS_PER_PMD] __attribute__ ((__section__ (".data..vm0.pmd"), aligned(PAGE_SIZE)));
43#endif
44
45pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__ ((__section__ (".data..vm0.pgd"), aligned(PAGE_SIZE)));
46pte_t pg0[PT_INITIAL * PTRS_PER_PTE] __attribute__ ((__section__ (".data..vm0.pte"), aligned(PAGE_SIZE)));
47
36#ifdef CONFIG_DISCONTIGMEM 48#ifdef CONFIG_DISCONTIGMEM
37struct node_map_data node_data[MAX_NUMNODES] __read_mostly; 49struct node_map_data node_data[MAX_NUMNODES] __read_mostly;
38unsigned char pfnnid_map[PFNNID_MAP_MAX] __read_mostly; 50unsigned char pfnnid_map[PFNNID_MAP_MAX] __read_mostly;
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index feab3bad6d0f..8a01098eaaca 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -87,10 +87,6 @@ config ARCH_HAS_ILOG2_U64
87 bool 87 bool
88 default y if 64BIT 88 default y if 64BIT
89 89
90config ARCH_HAS_CPU_IDLE_WAIT
91 bool
92 default y
93
94config GENERIC_HWEIGHT 90config GENERIC_HWEIGHT
95 bool 91 bool
96 default y 92 default y
@@ -141,9 +137,10 @@ config PPC
141 select IRQ_FORCED_THREADING 137 select IRQ_FORCED_THREADING
142 select HAVE_RCU_TABLE_FREE if SMP 138 select HAVE_RCU_TABLE_FREE if SMP
143 select HAVE_SYSCALL_TRACEPOINTS 139 select HAVE_SYSCALL_TRACEPOINTS
144 select HAVE_BPF_JIT if (PPC64 && NET) 140 select HAVE_BPF_JIT if PPC64
145 select HAVE_ARCH_JUMP_LABEL 141 select HAVE_ARCH_JUMP_LABEL
146 select ARCH_HAVE_NMI_SAFE_CMPXCHG 142 select ARCH_HAVE_NMI_SAFE_CMPXCHG
143 select GENERIC_SMP_IDLE_THREAD
147 144
148config EARLY_PRINTK 145config EARLY_PRINTK
149 bool 146 bool
diff --git a/arch/powerpc/boot/dts/fsl/pq3-mpic-message-B.dtsi b/arch/powerpc/boot/dts/fsl/pq3-mpic-message-B.dtsi
new file mode 100644
index 000000000000..1cf0b77b1efe
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/pq3-mpic-message-B.dtsi
@@ -0,0 +1,43 @@
1/*
2 * PQ3 MPIC Message (Group B) device tree stub [ controller @ offset 0x42400 ]
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35message@42400 {
36 compatible = "fsl,mpic-v3.1-msgr";
37 reg = <0x42400 0x200>;
38 interrupts = <
39 0xb4 2 0 0
40 0xb5 2 0 0
41 0xb6 2 0 0
42 0xb7 2 0 0>;
43};
diff --git a/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi b/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi
index fdedf7b1fe0f..71c30eb10056 100644
--- a/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi
+++ b/arch/powerpc/boot/dts/fsl/pq3-mpic.dtsi
@@ -53,6 +53,16 @@ timer@41100 {
53 3 0 3 0>; 53 3 0 3 0>;
54}; 54};
55 55
56message@41400 {
57 compatible = "fsl,mpic-v3.1-msgr";
58 reg = <0x41400 0x200>;
59 interrupts = <
60 0xb0 2 0 0
61 0xb1 2 0 0
62 0xb2 2 0 0
63 0xb3 2 0 0>;
64};
65
56msi@41600 { 66msi@41600 {
57 compatible = "fsl,mpic-msi"; 67 compatible = "fsl,mpic-msi";
58 reg = <0x41600 0x80>; 68 reg = <0x41600 0x80>;
diff --git a/arch/powerpc/configs/chroma_defconfig b/arch/powerpc/configs/chroma_defconfig
index f104ccde6b53..b1f9597fe312 100644
--- a/arch/powerpc/configs/chroma_defconfig
+++ b/arch/powerpc/configs/chroma_defconfig
@@ -32,7 +32,7 @@ CONFIG_RD_LZMA=y
32CONFIG_INITRAMFS_COMPRESSION_GZIP=y 32CONFIG_INITRAMFS_COMPRESSION_GZIP=y
33CONFIG_KALLSYMS_ALL=y 33CONFIG_KALLSYMS_ALL=y
34CONFIG_EMBEDDED=y 34CONFIG_EMBEDDED=y
35CONFIG_PERF_COUNTERS=y 35CONFIG_PERF_EVENTS=y
36CONFIG_PROFILING=y 36CONFIG_PROFILING=y
37CONFIG_OPROFILE=y 37CONFIG_OPROFILE=y
38CONFIG_KPROBES=y 38CONFIG_KPROBES=y
diff --git a/arch/powerpc/configs/gamecube_defconfig b/arch/powerpc/configs/gamecube_defconfig
index e74d3a483705..9ef2cc13e1b4 100644
--- a/arch/powerpc/configs/gamecube_defconfig
+++ b/arch/powerpc/configs/gamecube_defconfig
@@ -8,7 +8,7 @@ CONFIG_BLK_DEV_INITRD=y
8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
9CONFIG_EXPERT=y 9CONFIG_EXPERT=y
10# CONFIG_ELF_CORE is not set 10# CONFIG_ELF_CORE is not set
11CONFIG_PERF_COUNTERS=y 11CONFIG_PERF_EVENTS=y
12# CONFIG_VM_EVENT_COUNTERS is not set 12# CONFIG_VM_EVENT_COUNTERS is not set
13CONFIG_SLAB=y 13CONFIG_SLAB=y
14CONFIG_MODULES=y 14CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/wii_defconfig b/arch/powerpc/configs/wii_defconfig
index 175295fbf4f3..1e2b7d062aa4 100644
--- a/arch/powerpc/configs/wii_defconfig
+++ b/arch/powerpc/configs/wii_defconfig
@@ -9,7 +9,7 @@ CONFIG_BLK_DEV_INITRD=y
9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
10CONFIG_EXPERT=y 10CONFIG_EXPERT=y
11# CONFIG_ELF_CORE is not set 11# CONFIG_ELF_CORE is not set
12CONFIG_PERF_COUNTERS=y 12CONFIG_PERF_EVENTS=y
13# CONFIG_VM_EVENT_COUNTERS is not set 13# CONFIG_VM_EVENT_COUNTERS is not set
14CONFIG_SLAB=y 14CONFIG_SLAB=y
15CONFIG_MODULES=y 15CONFIG_MODULES=y
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 548da3aa0a30..d58fc4e4149c 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -288,13 +288,6 @@ label##_hv: \
288/* Exception addition: Hard disable interrupts */ 288/* Exception addition: Hard disable interrupts */
289#define DISABLE_INTS SOFT_DISABLE_INTS(r10,r11) 289#define DISABLE_INTS SOFT_DISABLE_INTS(r10,r11)
290 290
291/* Exception addition: Keep interrupt state */
292#define ENABLE_INTS \
293 ld r11,PACAKMSR(r13); \
294 ld r12,_MSR(r1); \
295 rlwimi r11,r12,0,MSR_EE; \
296 mtmsrd r11,1
297
298#define ADD_NVGPRS \ 291#define ADD_NVGPRS \
299 bl .save_nvgprs 292 bl .save_nvgprs
300 293
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h
index cf417e510736..0e40843a1c6e 100644
--- a/arch/powerpc/include/asm/irq.h
+++ b/arch/powerpc/include/asm/irq.h
@@ -18,10 +18,6 @@
18#include <linux/atomic.h> 18#include <linux/atomic.h>
19 19
20 20
21/* Define a way to iterate across irqs. */
22#define for_each_irq(i) \
23 for ((i) = 0; (i) < NR_IRQS; ++(i))
24
25extern atomic_t ppc_n_lost_interrupts; 21extern atomic_t ppc_n_lost_interrupts;
26 22
27/* This number is used when no interrupt has been assigned */ 23/* This number is used when no interrupt has been assigned */
@@ -33,8 +29,6 @@ extern atomic_t ppc_n_lost_interrupts;
33/* Same thing, used by the generic IRQ code */ 29/* Same thing, used by the generic IRQ code */
34#define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS 30#define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS
35 31
36struct irq_data;
37extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d);
38extern irq_hw_number_t virq_to_hw(unsigned int virq); 32extern irq_hw_number_t virq_to_hw(unsigned int virq);
39 33
40/** 34/**
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
index aa795ccef294..fd07f43d6622 100644
--- a/arch/powerpc/include/asm/kvm_book3s.h
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -81,12 +81,13 @@ struct kvmppc_vcpu_book3s {
81 u64 sdr1; 81 u64 sdr1;
82 u64 hior; 82 u64 hior;
83 u64 msr_mask; 83 u64 msr_mask;
84 u64 vsid_next;
85#ifdef CONFIG_PPC_BOOK3S_32 84#ifdef CONFIG_PPC_BOOK3S_32
86 u32 vsid_pool[VSID_POOL_SIZE]; 85 u32 vsid_pool[VSID_POOL_SIZE];
86 u32 vsid_next;
87#else 87#else
88 u64 vsid_first; 88 u64 proto_vsid_first;
89 u64 vsid_max; 89 u64 proto_vsid_max;
90 u64 proto_vsid_next;
90#endif 91#endif
91 int context_id[SID_CONTEXTS]; 92 int context_id[SID_CONTEXTS];
92 93
diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h
index c65b9294376e..c9f698a994be 100644
--- a/arch/powerpc/include/asm/mpic.h
+++ b/arch/powerpc/include/asm/mpic.h
@@ -275,9 +275,6 @@ struct mpic
275 unsigned int isu_mask; 275 unsigned int isu_mask;
276 /* Number of sources */ 276 /* Number of sources */
277 unsigned int num_sources; 277 unsigned int num_sources;
278 /* default senses array */
279 unsigned char *senses;
280 unsigned int senses_count;
281 278
282 /* vector numbers used for internal sources (ipi/timers) */ 279 /* vector numbers used for internal sources (ipi/timers) */
283 unsigned int ipi_vecs[4]; 280 unsigned int ipi_vecs[4];
@@ -415,21 +412,6 @@ extern struct mpic *mpic_alloc(struct device_node *node,
415extern void mpic_assign_isu(struct mpic *mpic, unsigned int isu_num, 412extern void mpic_assign_isu(struct mpic *mpic, unsigned int isu_num,
416 phys_addr_t phys_addr); 413 phys_addr_t phys_addr);
417 414
418/* Set default sense codes
419 *
420 * @mpic: controller
421 * @senses: array of sense codes
422 * @count: size of above array
423 *
424 * Optionally provide an array (indexed on hardware interrupt numbers
425 * for this MPIC) of default sense codes for the chip. Those are linux
426 * sense codes IRQ_TYPE_*
427 *
428 * The driver gets ownership of the pointer, don't dispose of it or
429 * anything like that. __init only.
430 */
431extern void mpic_set_default_senses(struct mpic *mpic, u8 *senses, int count);
432
433 415
434/* Initialize the controller. After this has been called, none of the above 416/* Initialize the controller. After this has been called, none of the above
435 * should be called again for this mpic 417 * should be called again for this mpic
diff --git a/arch/powerpc/include/asm/mpic_msgr.h b/arch/powerpc/include/asm/mpic_msgr.h
index 3ec37dc9003e..326d33ca55cd 100644
--- a/arch/powerpc/include/asm/mpic_msgr.h
+++ b/arch/powerpc/include/asm/mpic_msgr.h
@@ -13,6 +13,7 @@
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <asm/smp.h>
16 17
17struct mpic_msgr { 18struct mpic_msgr {
18 u32 __iomem *base; 19 u32 __iomem *base;
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 8e2d0371fe1e..48a26d379222 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -386,7 +386,6 @@ extern unsigned long cpuidle_disable;
386enum idle_boot_override {IDLE_NO_OVERRIDE = 0, IDLE_POWERSAVE_OFF}; 386enum idle_boot_override {IDLE_NO_OVERRIDE = 0, IDLE_POWERSAVE_OFF};
387 387
388extern int powersave_nap; /* set if nap mode can be used in idle loop */ 388extern int powersave_nap; /* set if nap mode can be used in idle loop */
389void cpu_idle_wait(void);
390 389
391#ifdef CONFIG_PSERIES_IDLE 390#ifdef CONFIG_PSERIES_IDLE
392extern void update_smt_snooze_delay(int snooze); 391extern void update_smt_snooze_delay(int snooze);
diff --git a/arch/powerpc/include/asm/reg_booke.h b/arch/powerpc/include/asm/reg_booke.h
index b86faa9107da..8a97aa7289d3 100644
--- a/arch/powerpc/include/asm/reg_booke.h
+++ b/arch/powerpc/include/asm/reg_booke.h
@@ -15,11 +15,6 @@
15#ifndef __ASM_POWERPC_REG_BOOKE_H__ 15#ifndef __ASM_POWERPC_REG_BOOKE_H__
16#define __ASM_POWERPC_REG_BOOKE_H__ 16#define __ASM_POWERPC_REG_BOOKE_H__
17 17
18#ifdef CONFIG_BOOKE_WDT
19extern u32 booke_wdt_enabled;
20extern u32 booke_wdt_period;
21#endif /* CONFIG_BOOKE_WDT */
22
23/* Machine State Register (MSR) Fields */ 18/* Machine State Register (MSR) Fields */
24#define MSR_GS (1<<28) /* Guest state */ 19#define MSR_GS (1<<28) /* Guest state */
25#define MSR_UCLE (1<<26) /* User-mode cache lock enable */ 20#define MSR_UCLE (1<<26) /* User-mode cache lock enable */
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index 4a741c7efd02..1a1bb00f061a 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -62,21 +62,8 @@ struct thread_info {
62#define init_thread_info (init_thread_union.thread_info) 62#define init_thread_info (init_thread_union.thread_info)
63#define init_stack (init_thread_union.stack) 63#define init_stack (init_thread_union.stack)
64 64
65/* thread information allocation */
66
67#if THREAD_SHIFT >= PAGE_SHIFT
68
69#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) 65#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT)
70 66
71#else /* THREAD_SHIFT < PAGE_SHIFT */
72
73#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
74
75extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);
76extern void free_thread_info(struct thread_info *ti);
77
78#endif /* THREAD_SHIFT < PAGE_SHIFT */
79
80/* how to get the thread information struct from C */ 67/* how to get the thread information struct from C */
81static inline struct thread_info *current_thread_info(void) 68static inline struct thread_info *current_thread_info(void)
82{ 69{
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index c97185885c6d..852ed1b384f6 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -18,12 +18,6 @@ struct device_node;
18 */ 18 */
19#define RECLAIM_DISTANCE 10 19#define RECLAIM_DISTANCE 10
20 20
21/*
22 * Avoid creating an extra level of balancing (SD_ALLNODES) on the largest
23 * POWER7 boxes which have a maximum of 32 nodes.
24 */
25#define SD_NODES_PER_DOMAIN 32
26
27#include <asm/mmzone.h> 21#include <asm/mmzone.h>
28 22
29static inline int cpu_to_node(int cpu) 23static inline int cpu_to_node(int cpu)
@@ -51,36 +45,6 @@ static inline int pcibus_to_node(struct pci_bus *bus)
51 cpu_all_mask : \ 45 cpu_all_mask : \
52 cpumask_of_node(pcibus_to_node(bus))) 46 cpumask_of_node(pcibus_to_node(bus)))
53 47
54/* sched_domains SD_NODE_INIT for PPC64 machines */
55#define SD_NODE_INIT (struct sched_domain) { \
56 .min_interval = 8, \
57 .max_interval = 32, \
58 .busy_factor = 32, \
59 .imbalance_pct = 125, \
60 .cache_nice_tries = 1, \
61 .busy_idx = 3, \
62 .idle_idx = 1, \
63 .newidle_idx = 0, \
64 .wake_idx = 0, \
65 .forkexec_idx = 0, \
66 \
67 .flags = 1*SD_LOAD_BALANCE \
68 | 0*SD_BALANCE_NEWIDLE \
69 | 1*SD_BALANCE_EXEC \
70 | 1*SD_BALANCE_FORK \
71 | 0*SD_BALANCE_WAKE \
72 | 1*SD_WAKE_AFFINE \
73 | 0*SD_PREFER_LOCAL \
74 | 0*SD_SHARE_CPUPOWER \
75 | 0*SD_POWERSAVINGS_BALANCE \
76 | 0*SD_SHARE_PKG_RESOURCES \
77 | 1*SD_SERIALIZE \
78 | 0*SD_PREFER_SIBLING \
79 , \
80 .last_balance = jiffies, \
81 .balance_interval = 1, \
82}
83
84extern int __node_distance(int, int); 48extern int __node_distance(int, int);
85#define node_distance(a, b) __node_distance(a, b) 49#define node_distance(a, b) __node_distance(a, b)
86 50
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index f5808a35688c..83afacd3ba7b 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -28,7 +28,7 @@ endif
28 28
29obj-y := cputable.o ptrace.o syscalls.o \ 29obj-y := cputable.o ptrace.o syscalls.o \
30 irq.o align.o signal_32.o pmc.o vdso.o \ 30 irq.o align.o signal_32.o pmc.o vdso.o \
31 init_task.o process.o systbl.o idle.o \ 31 process.o systbl.o idle.o \
32 signal.o sysfs.o cacheinfo.o time.o \ 32 signal.o sysfs.o cacheinfo.o time.o \
33 prom.o traps.o setup-common.o \ 33 prom.o traps.o setup-common.o \
34 udbg.o misc.o io.o dma.o \ 34 udbg.o misc.o io.o dma.o \
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 3e57a00b8cba..ba3aeb4bc06a 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -206,40 +206,43 @@ reenable_mmu: /* re-enable mmu so we can */
206 andi. r10,r10,MSR_EE /* Did EE change? */ 206 andi. r10,r10,MSR_EE /* Did EE change? */
207 beq 1f 207 beq 1f
208 208
209 /* Save handler and return address into the 2 unused words
210 * of the STACK_FRAME_OVERHEAD (sneak sneak sneak). Everything
211 * else can be recovered from the pt_regs except r3 which for
212 * normal interrupts has been set to pt_regs and for syscalls
213 * is an argument, so we temporarily use ORIG_GPR3 to save it
214 */
215 stw r9,8(r1)
216 stw r11,12(r1)
217 stw r3,ORIG_GPR3(r1)
218 /* 209 /*
219 * The trace_hardirqs_off will use CALLER_ADDR0 and CALLER_ADDR1. 210 * The trace_hardirqs_off will use CALLER_ADDR0 and CALLER_ADDR1.
220 * If from user mode there is only one stack frame on the stack, and 211 * If from user mode there is only one stack frame on the stack, and
221 * accessing CALLER_ADDR1 will cause oops. So we need create a dummy 212 * accessing CALLER_ADDR1 will cause oops. So we need create a dummy
222 * stack frame to make trace_hardirqs_off happy. 213 * stack frame to make trace_hardirqs_off happy.
214 *
215 * This is handy because we also need to save a bunch of GPRs,
216 * r3 can be different from GPR3(r1) at this point, r9 and r11
217 * contains the old MSR and handler address respectively,
218 * r4 & r5 can contain page fault arguments that need to be passed
219 * along as well. r12, CCR, CTR, XER etc... are left clobbered as
220 * they aren't useful past this point (aren't syscall arguments),
221 * the rest is restored from the exception frame.
223 */ 222 */
223 stwu r1,-32(r1)
224 stw r9,8(r1)
225 stw r11,12(r1)
226 stw r3,16(r1)
227 stw r4,20(r1)
228 stw r5,24(r1)
224 andi. r12,r12,MSR_PR 229 andi. r12,r12,MSR_PR
225 beq 11f 230 b 11f
226 stwu r1,-16(r1)
227 bl trace_hardirqs_off 231 bl trace_hardirqs_off
228 addi r1,r1,16
229 b 12f 232 b 12f
230
23111: 23311:
232 bl trace_hardirqs_off 234 bl trace_hardirqs_off
23312: 23512:
236 lwz r5,24(r1)
237 lwz r4,20(r1)
238 lwz r3,16(r1)
239 lwz r11,12(r1)
240 lwz r9,8(r1)
241 addi r1,r1,32
234 lwz r0,GPR0(r1) 242 lwz r0,GPR0(r1)
235 lwz r3,ORIG_GPR3(r1)
236 lwz r4,GPR4(r1)
237 lwz r5,GPR5(r1)
238 lwz r6,GPR6(r1) 243 lwz r6,GPR6(r1)
239 lwz r7,GPR7(r1) 244 lwz r7,GPR7(r1)
240 lwz r8,GPR8(r1) 245 lwz r8,GPR8(r1)
241 lwz r9,8(r1)
242 lwz r11,12(r1)
2431: mtctr r11 2461: mtctr r11
244 mtlr r9 247 mtlr r9
245 bctr /* jump to handler */ 248 bctr /* jump to handler */
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index f8a7a1a1a9f4..ef2074c3e906 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -588,23 +588,19 @@ _GLOBAL(ret_from_except_lite)
588fast_exc_return_irq: 588fast_exc_return_irq:
589restore: 589restore:
590 /* 590 /*
591 * This is the main kernel exit path, we first check if we 591 * This is the main kernel exit path. First we check if we
592 * have to change our interrupt state. 592 * are about to re-enable interrupts
593 */ 593 */
594 ld r5,SOFTE(r1) 594 ld r5,SOFTE(r1)
595 lbz r6,PACASOFTIRQEN(r13) 595 lbz r6,PACASOFTIRQEN(r13)
596 cmpwi cr1,r5,0 596 cmpwi cr0,r5,0
597 cmpw cr0,r5,r6 597 beq restore_irq_off
598 beq cr0,4f
599 598
600 /* We do, handle disable first, which is easy */ 599 /* We are enabling, were we already enabled ? Yes, just return */
601 bne cr1,3f; 600 cmpwi cr0,r6,1
602 li r0,0 601 beq cr0,do_restore
603 stb r0,PACASOFTIRQEN(r13);
604 TRACE_DISABLE_INTS
605 b 4f
606 602
6073: /* 603 /*
608 * We are about to soft-enable interrupts (we are hard disabled 604 * We are about to soft-enable interrupts (we are hard disabled
609 * at this point). We check if there's anything that needs to 605 * at this point). We check if there's anything that needs to
610 * be replayed first. 606 * be replayed first.
@@ -626,7 +622,7 @@ restore_no_replay:
626 /* 622 /*
627 * Final return path. BookE is handled in a different file 623 * Final return path. BookE is handled in a different file
628 */ 624 */
6294: 625do_restore:
630#ifdef CONFIG_PPC_BOOK3E 626#ifdef CONFIG_PPC_BOOK3E
631 b .exception_return_book3e 627 b .exception_return_book3e
632#else 628#else
@@ -700,6 +696,25 @@ fast_exception_return:
700#endif /* CONFIG_PPC_BOOK3E */ 696#endif /* CONFIG_PPC_BOOK3E */
701 697
702 /* 698 /*
699 * We are returning to a context with interrupts soft disabled.
700 *
701 * However, we may also about to hard enable, so we need to
702 * make sure that in this case, we also clear PACA_IRQ_HARD_DIS
703 * or that bit can get out of sync and bad things will happen
704 */
705restore_irq_off:
706 ld r3,_MSR(r1)
707 lbz r7,PACAIRQHAPPENED(r13)
708 andi. r0,r3,MSR_EE
709 beq 1f
710 rlwinm r7,r7,0,~PACA_IRQ_HARD_DIS
711 stb r7,PACAIRQHAPPENED(r13)
7121: li r0,0
713 stb r0,PACASOFTIRQEN(r13);
714 TRACE_DISABLE_INTS
715 b do_restore
716
717 /*
703 * Something did happen, check if a re-emit is needed 718 * Something did happen, check if a re-emit is needed
704 * (this also clears paca->irq_happened) 719 * (this also clears paca->irq_happened)
705 */ 720 */
@@ -748,6 +763,9 @@ restore_check_irq_replay:
748#endif /* CONFIG_PPC_BOOK3E */ 763#endif /* CONFIG_PPC_BOOK3E */
7491: b .ret_from_except /* What else to do here ? */ 7641: b .ret_from_except /* What else to do here ? */
750 765
766
767
7683:
751do_work: 769do_work:
752#ifdef CONFIG_PREEMPT 770#ifdef CONFIG_PREEMPT
753 andi. r0,r3,MSR_PR /* Returning to user mode? */ 771 andi. r0,r3,MSR_PR /* Returning to user mode? */
@@ -767,16 +785,6 @@ do_work:
767 SOFT_DISABLE_INTS(r3,r4) 785 SOFT_DISABLE_INTS(r3,r4)
7681: bl .preempt_schedule_irq 7861: bl .preempt_schedule_irq
769 787
770 /* Hard-disable interrupts again (and update PACA) */
771#ifdef CONFIG_PPC_BOOK3E
772 wrteei 0
773#else
774 ld r10,PACAKMSR(r13) /* Get kernel MSR without EE */
775 mtmsrd r10,1
776#endif /* CONFIG_PPC_BOOK3E */
777 li r0,PACA_IRQ_HARD_DIS
778 stb r0,PACAIRQHAPPENED(r13)
779
780 /* Re-test flags and eventually loop */ 788 /* Re-test flags and eventually loop */
781 clrrdi r9,r1,THREAD_SHIFT 789 clrrdi r9,r1,THREAD_SHIFT
782 ld r4,TI_FLAGS(r9) 790 ld r4,TI_FLAGS(r9)
@@ -787,14 +795,6 @@ do_work:
787user_work: 795user_work:
788#endif /* CONFIG_PREEMPT */ 796#endif /* CONFIG_PREEMPT */
789 797
790 /* Enable interrupts */
791#ifdef CONFIG_PPC_BOOK3E
792 wrteei 1
793#else
794 ori r10,r10,MSR_EE
795 mtmsrd r10,1
796#endif /* CONFIG_PPC_BOOK3E */
797
798 andi. r0,r4,_TIF_NEED_RESCHED 798 andi. r0,r4,_TIF_NEED_RESCHED
799 beq 1f 799 beq 1f
800 bl .restore_interrupts 800 bl .restore_interrupts
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index cb705fdbb458..8f880bc77c56 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -768,8 +768,8 @@ alignment_common:
768 std r3,_DAR(r1) 768 std r3,_DAR(r1)
769 std r4,_DSISR(r1) 769 std r4,_DSISR(r1)
770 bl .save_nvgprs 770 bl .save_nvgprs
771 DISABLE_INTS
771 addi r3,r1,STACK_FRAME_OVERHEAD 772 addi r3,r1,STACK_FRAME_OVERHEAD
772 ENABLE_INTS
773 bl .alignment_exception 773 bl .alignment_exception
774 b .ret_from_except 774 b .ret_from_except
775 775
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index 6d2209ac0c44..2099d9a879e8 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -113,29 +113,6 @@ void cpu_idle(void)
113 } 113 }
114} 114}
115 115
116
117/*
118 * cpu_idle_wait - Used to ensure that all the CPUs come out of the old
119 * idle loop and start using the new idle loop.
120 * Required while changing idle handler on SMP systems.
121 * Caller must have changed idle handler to the new value before the call.
122 * This window may be larger on shared systems.
123 */
124void cpu_idle_wait(void)
125{
126 int cpu;
127 smp_mb();
128
129 /* kick all the CPUs so that they exit out of old idle routine */
130 get_online_cpus();
131 for_each_online_cpu(cpu) {
132 if (cpu != smp_processor_id())
133 smp_send_reschedule(cpu);
134 }
135 put_online_cpus();
136}
137EXPORT_SYMBOL_GPL(cpu_idle_wait);
138
139int powersave_nap; 116int powersave_nap;
140 117
141#ifdef CONFIG_SYSCTL 118#ifdef CONFIG_SYSCTL
diff --git a/arch/powerpc/kernel/init_task.c b/arch/powerpc/kernel/init_task.c
deleted file mode 100644
index d076d465dbd1..000000000000
--- a/arch/powerpc/kernel/init_task.c
+++ /dev/null
@@ -1,29 +0,0 @@
1#include <linux/mm.h>
2#include <linux/export.h>
3#include <linux/sched.h>
4#include <linux/init.h>
5#include <linux/init_task.h>
6#include <linux/fs.h>
7#include <linux/mqueue.h>
8#include <asm/uaccess.h>
9
10static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
11static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
12/*
13 * Initial thread structure.
14 *
15 * We need to make sure that this is 16384-byte aligned due to the
16 * way process stacks are handled. This is done by having a special
17 * "init_task" linker map entry..
18 */
19union thread_union init_thread_union __init_task_data =
20 { INIT_THREAD_INFO(init_task) };
21
22/*
23 * Initial task structure.
24 *
25 * All other task structs will be allocated on slabs in fork.c
26 */
27struct task_struct init_task = INIT_TASK(init_task);
28
29EXPORT_SYMBOL(init_task);
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 243dbabfe74d..641da9e868ce 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -229,6 +229,19 @@ notrace void arch_local_irq_restore(unsigned long en)
229 */ 229 */
230 if (unlikely(irq_happened != PACA_IRQ_HARD_DIS)) 230 if (unlikely(irq_happened != PACA_IRQ_HARD_DIS))
231 __hard_irq_disable(); 231 __hard_irq_disable();
232#ifdef CONFIG_TRACE_IRQFLAG
233 else {
234 /*
235 * We should already be hard disabled here. We had bugs
236 * where that wasn't the case so let's dbl check it and
237 * warn if we are wrong. Only do that when IRQ tracing
238 * is enabled as mfmsr() can be costly.
239 */
240 if (WARN_ON(mfmsr() & MSR_EE))
241 __hard_irq_disable();
242 }
243#endif /* CONFIG_TRACE_IRQFLAG */
244
232 set_soft_enabled(0); 245 set_soft_enabled(0);
233 246
234 /* 247 /*
@@ -260,11 +273,17 @@ EXPORT_SYMBOL(arch_local_irq_restore);
260 * if they are currently disabled. This is typically called before 273 * if they are currently disabled. This is typically called before
261 * schedule() or do_signal() when returning to userspace. We do it 274 * schedule() or do_signal() when returning to userspace. We do it
262 * in C to avoid the burden of dealing with lockdep etc... 275 * in C to avoid the burden of dealing with lockdep etc...
276 *
277 * NOTE: This is called with interrupts hard disabled but not marked
278 * as such in paca->irq_happened, so we need to resync this.
263 */ 279 */
264void restore_interrupts(void) 280void restore_interrupts(void)
265{ 281{
266 if (irqs_disabled()) 282 if (irqs_disabled()) {
283 local_paca->irq_happened |= PACA_IRQ_HARD_DIS;
267 local_irq_enable(); 284 local_irq_enable();
285 } else
286 __hard_irq_enable();
268} 287}
269 288
270#endif /* CONFIG_PPC64 */ 289#endif /* CONFIG_PPC64 */
@@ -330,14 +349,10 @@ void migrate_irqs(void)
330 349
331 alloc_cpumask_var(&mask, GFP_KERNEL); 350 alloc_cpumask_var(&mask, GFP_KERNEL);
332 351
333 for_each_irq(irq) { 352 for_each_irq_desc(irq, desc) {
334 struct irq_data *data; 353 struct irq_data *data;
335 struct irq_chip *chip; 354 struct irq_chip *chip;
336 355
337 desc = irq_to_desc(irq);
338 if (!desc)
339 continue;
340
341 data = irq_desc_get_irq_data(desc); 356 data = irq_desc_get_irq_data(desc);
342 if (irqd_is_per_cpu(data)) 357 if (irqd_is_per_cpu(data))
343 continue; 358 continue;
@@ -560,12 +575,6 @@ void do_softirq(void)
560 local_irq_restore(flags); 575 local_irq_restore(flags);
561} 576}
562 577
563irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
564{
565 return d->hwirq;
566}
567EXPORT_SYMBOL_GPL(irqd_to_hwirq);
568
569irq_hw_number_t virq_to_hw(unsigned int virq) 578irq_hw_number_t virq_to_hw(unsigned int virq)
570{ 579{
571 struct irq_data *irq_data = irq_get_irq_data(virq); 580 struct irq_data *irq_data = irq_get_irq_data(virq);
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index c957b1202bdc..5df777794403 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -23,14 +23,11 @@
23 23
24void machine_kexec_mask_interrupts(void) { 24void machine_kexec_mask_interrupts(void) {
25 unsigned int i; 25 unsigned int i;
26 struct irq_desc *desc;
26 27
27 for_each_irq(i) { 28 for_each_irq_desc(i, desc) {
28 struct irq_desc *desc = irq_to_desc(i);
29 struct irq_chip *chip; 29 struct irq_chip *chip;
30 30
31 if (!desc)
32 continue;
33
34 chip = irq_desc_get_chip(desc); 31 chip = irq_desc_get_chip(desc);
35 if (!chip) 32 if (!chip)
36 continue; 33 continue;
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index f88698c0f332..aa05935b6947 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1235,7 +1235,7 @@ void __ppc64_runlatch_on(void)
1235 ctrl |= CTRL_RUNLATCH; 1235 ctrl |= CTRL_RUNLATCH;
1236 mtspr(SPRN_CTRLT, ctrl); 1236 mtspr(SPRN_CTRLT, ctrl);
1237 1237
1238 ti->local_flags |= TLF_RUNLATCH; 1238 ti->local_flags |= _TLF_RUNLATCH;
1239} 1239}
1240 1240
1241/* Called with hard IRQs off */ 1241/* Called with hard IRQs off */
@@ -1244,7 +1244,7 @@ void __ppc64_runlatch_off(void)
1244 struct thread_info *ti = current_thread_info(); 1244 struct thread_info *ti = current_thread_info();
1245 unsigned long ctrl; 1245 unsigned long ctrl;
1246 1246
1247 ti->local_flags &= ~TLF_RUNLATCH; 1247 ti->local_flags &= ~_TLF_RUNLATCH;
1248 1248
1249 ctrl = mfspr(SPRN_CTRLF); 1249 ctrl = mfspr(SPRN_CTRLF);
1250 ctrl &= ~CTRL_RUNLATCH; 1250 ctrl &= ~CTRL_RUNLATCH;
@@ -1252,37 +1252,6 @@ void __ppc64_runlatch_off(void)
1252} 1252}
1253#endif /* CONFIG_PPC64 */ 1253#endif /* CONFIG_PPC64 */
1254 1254
1255#if THREAD_SHIFT < PAGE_SHIFT
1256
1257static struct kmem_cache *thread_info_cache;
1258
1259struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
1260{
1261 struct thread_info *ti;
1262
1263 ti = kmem_cache_alloc_node(thread_info_cache, GFP_KERNEL, node);
1264 if (unlikely(ti == NULL))
1265 return NULL;
1266#ifdef CONFIG_DEBUG_STACK_USAGE
1267 memset(ti, 0, THREAD_SIZE);
1268#endif
1269 return ti;
1270}
1271
1272void free_thread_info(struct thread_info *ti)
1273{
1274 kmem_cache_free(thread_info_cache, ti);
1275}
1276
1277void thread_info_cache_init(void)
1278{
1279 thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
1280 THREAD_SIZE, 0, NULL);
1281 BUG_ON(thread_info_cache == NULL);
1282}
1283
1284#endif /* THREAD_SHIFT < PAGE_SHIFT */
1285
1286unsigned long arch_align_stack(unsigned long sp) 1255unsigned long arch_align_stack(unsigned long sp)
1287{ 1256{
1288 if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) 1257 if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 8d8e028893be..dd5e214cdf21 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1710,7 +1710,7 @@ long do_syscall_trace_enter(struct pt_regs *regs)
1710{ 1710{
1711 long ret = 0; 1711 long ret = 0;
1712 1712
1713 secure_computing(regs->gpr[0]); 1713 secure_computing_strict(regs->gpr[0]);
1714 1714
1715 if (test_thread_flag(TIF_SYSCALL_TRACE) && 1715 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
1716 tracehook_report_syscall_entry(regs)) 1716 tracehook_report_syscall_entry(regs))
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 9825f29d1faf..ec8a53fa9e8f 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -150,6 +150,9 @@ notrace void __init machine_init(u64 dt_ptr)
150} 150}
151 151
152#ifdef CONFIG_BOOKE_WDT 152#ifdef CONFIG_BOOKE_WDT
153extern u32 booke_wdt_enabled;
154extern u32 booke_wdt_period;
155
153/* Checks wdt=x and wdt_period=xx command-line option */ 156/* Checks wdt=x and wdt_period=xx command-line option */
154notrace int __init early_parse_wdt(char *p) 157notrace int __init early_parse_wdt(char *p)
155{ 158{
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index d9f94410fd7f..e4cb34322de4 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -57,27 +57,9 @@
57#define DBG(fmt...) 57#define DBG(fmt...)
58#endif 58#endif
59 59
60
61/* Store all idle threads, this can be reused instead of creating
62* a new thread. Also avoids complicated thread destroy functionality
63* for idle threads.
64*/
65#ifdef CONFIG_HOTPLUG_CPU 60#ifdef CONFIG_HOTPLUG_CPU
66/*
67 * Needed only for CONFIG_HOTPLUG_CPU because __cpuinitdata is
68 * removed after init for !CONFIG_HOTPLUG_CPU.
69 */
70static DEFINE_PER_CPU(struct task_struct *, idle_thread_array);
71#define get_idle_for_cpu(x) (per_cpu(idle_thread_array, x))
72#define set_idle_for_cpu(x, p) (per_cpu(idle_thread_array, x) = (p))
73
74/* State of each CPU during hotplug phases */ 61/* State of each CPU during hotplug phases */
75static DEFINE_PER_CPU(int, cpu_state) = { 0 }; 62static DEFINE_PER_CPU(int, cpu_state) = { 0 };
76
77#else
78static struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ;
79#define get_idle_for_cpu(x) (idle_thread_array[(x)])
80#define set_idle_for_cpu(x, p) (idle_thread_array[(x)] = (p))
81#endif 63#endif
82 64
83struct thread_info *secondary_ti; 65struct thread_info *secondary_ti;
@@ -429,60 +411,19 @@ int generic_check_cpu_restart(unsigned int cpu)
429} 411}
430#endif 412#endif
431 413
432struct create_idle { 414static void cpu_idle_thread_init(unsigned int cpu, struct task_struct *idle)
433 struct work_struct work;
434 struct task_struct *idle;
435 struct completion done;
436 int cpu;
437};
438
439static void __cpuinit do_fork_idle(struct work_struct *work)
440{ 415{
441 struct create_idle *c_idle = 416 struct thread_info *ti = task_thread_info(idle);
442 container_of(work, struct create_idle, work);
443
444 c_idle->idle = fork_idle(c_idle->cpu);
445 complete(&c_idle->done);
446}
447
448static int __cpuinit create_idle(unsigned int cpu)
449{
450 struct thread_info *ti;
451 struct create_idle c_idle = {
452 .cpu = cpu,
453 .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done),
454 };
455 INIT_WORK_ONSTACK(&c_idle.work, do_fork_idle);
456
457 c_idle.idle = get_idle_for_cpu(cpu);
458
459 /* We can't use kernel_thread since we must avoid to
460 * reschedule the child. We use a workqueue because
461 * we want to fork from a kernel thread, not whatever
462 * userspace process happens to be trying to online us.
463 */
464 if (!c_idle.idle) {
465 schedule_work(&c_idle.work);
466 wait_for_completion(&c_idle.done);
467 } else
468 init_idle(c_idle.idle, cpu);
469 if (IS_ERR(c_idle.idle)) {
470 pr_err("Failed fork for CPU %u: %li", cpu, PTR_ERR(c_idle.idle));
471 return PTR_ERR(c_idle.idle);
472 }
473 ti = task_thread_info(c_idle.idle);
474 417
475#ifdef CONFIG_PPC64 418#ifdef CONFIG_PPC64
476 paca[cpu].__current = c_idle.idle; 419 paca[cpu].__current = idle;
477 paca[cpu].kstack = (unsigned long)ti + THREAD_SIZE - STACK_FRAME_OVERHEAD; 420 paca[cpu].kstack = (unsigned long)ti + THREAD_SIZE - STACK_FRAME_OVERHEAD;
478#endif 421#endif
479 ti->cpu = cpu; 422 ti->cpu = cpu;
480 current_set[cpu] = ti; 423 secondary_ti = current_set[cpu] = ti;
481
482 return 0;
483} 424}
484 425
485int __cpuinit __cpu_up(unsigned int cpu) 426int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
486{ 427{
487 int rc, c; 428 int rc, c;
488 429
@@ -490,12 +431,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
490 (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu))) 431 (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu)))
491 return -EINVAL; 432 return -EINVAL;
492 433
493 /* Make sure we have an idle thread */ 434 cpu_idle_thread_init(cpu, tidle);
494 rc = create_idle(cpu);
495 if (rc)
496 return rc;
497
498 secondary_ti = current_set[cpu];
499 435
500 /* Make sure callin-map entry is 0 (can be leftover a CPU 436 /* Make sure callin-map entry is 0 (can be leftover a CPU
501 * hotplug 437 * hotplug
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 6aa0c663e247..158972341a2d 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -248,7 +248,7 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
248 addr, regs->nip, regs->link, code); 248 addr, regs->nip, regs->link, code);
249 } 249 }
250 250
251 if (!arch_irq_disabled_regs(regs)) 251 if (arch_irqs_disabled() && !arch_irq_disabled_regs(regs))
252 local_irq_enable(); 252 local_irq_enable();
253 253
254 memset(&info, 0, sizeof(info)); 254 memset(&info, 0, sizeof(info));
@@ -1019,7 +1019,9 @@ void __kprobes program_check_exception(struct pt_regs *regs)
1019 return; 1019 return;
1020 } 1020 }
1021 1021
1022 local_irq_enable(); 1022 /* We restore the interrupt state now */
1023 if (!arch_irq_disabled_regs(regs))
1024 local_irq_enable();
1023 1025
1024#ifdef CONFIG_MATH_EMULATION 1026#ifdef CONFIG_MATH_EMULATION
1025 /* (reason & REASON_ILLEGAL) would be the obvious thing here, 1027 /* (reason & REASON_ILLEGAL) would be the obvious thing here,
@@ -1069,6 +1071,10 @@ void alignment_exception(struct pt_regs *regs)
1069{ 1071{
1070 int sig, code, fixed = 0; 1072 int sig, code, fixed = 0;
1071 1073
1074 /* We restore the interrupt state now */
1075 if (!arch_irq_disabled_regs(regs))
1076 local_irq_enable();
1077
1072 /* we don't implement logging of alignment exceptions */ 1078 /* we don't implement logging of alignment exceptions */
1073 if (!(current->thread.align_ctl & PR_UNALIGN_SIGBUS)) 1079 if (!(current->thread.align_ctl & PR_UNALIGN_SIGBUS))
1074 fixed = fix_alignment(regs); 1080 fixed = fix_alignment(regs);
diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c
index 6f87f39a1ac2..10fc8ec9d2a8 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_host.c
@@ -194,14 +194,14 @@ static struct kvmppc_sid_map *create_sid_map(struct kvm_vcpu *vcpu, u64 gvsid)
194 backwards_map = !backwards_map; 194 backwards_map = !backwards_map;
195 195
196 /* Uh-oh ... out of mappings. Let's flush! */ 196 /* Uh-oh ... out of mappings. Let's flush! */
197 if (vcpu_book3s->vsid_next == vcpu_book3s->vsid_max) { 197 if (vcpu_book3s->proto_vsid_next == vcpu_book3s->proto_vsid_max) {
198 vcpu_book3s->vsid_next = vcpu_book3s->vsid_first; 198 vcpu_book3s->proto_vsid_next = vcpu_book3s->proto_vsid_first;
199 memset(vcpu_book3s->sid_map, 0, 199 memset(vcpu_book3s->sid_map, 0,
200 sizeof(struct kvmppc_sid_map) * SID_MAP_NUM); 200 sizeof(struct kvmppc_sid_map) * SID_MAP_NUM);
201 kvmppc_mmu_pte_flush(vcpu, 0, 0); 201 kvmppc_mmu_pte_flush(vcpu, 0, 0);
202 kvmppc_mmu_flush_segments(vcpu); 202 kvmppc_mmu_flush_segments(vcpu);
203 } 203 }
204 map->host_vsid = vcpu_book3s->vsid_next++; 204 map->host_vsid = vsid_scramble(vcpu_book3s->proto_vsid_next++, 256M);
205 205
206 map->guest_vsid = gvsid; 206 map->guest_vsid = gvsid;
207 map->valid = true; 207 map->valid = true;
@@ -319,9 +319,10 @@ int kvmppc_mmu_init(struct kvm_vcpu *vcpu)
319 return -1; 319 return -1;
320 vcpu3s->context_id[0] = err; 320 vcpu3s->context_id[0] = err;
321 321
322 vcpu3s->vsid_max = ((vcpu3s->context_id[0] + 1) << USER_ESID_BITS) - 1; 322 vcpu3s->proto_vsid_max = ((vcpu3s->context_id[0] + 1)
323 vcpu3s->vsid_first = vcpu3s->context_id[0] << USER_ESID_BITS; 323 << USER_ESID_BITS) - 1;
324 vcpu3s->vsid_next = vcpu3s->vsid_first; 324 vcpu3s->proto_vsid_first = vcpu3s->context_id[0] << USER_ESID_BITS;
325 vcpu3s->proto_vsid_next = vcpu3s->proto_vsid_first;
325 326
326 kvmppc_mmu_hpte_init(vcpu); 327 kvmppc_mmu_hpte_init(vcpu);
327 328
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index ddc485a529f2..c3beaeef3f60 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -258,6 +258,8 @@ static long kvmppc_get_guest_page(struct kvm *kvm, unsigned long gfn,
258 !(memslot->userspace_addr & (s - 1))) { 258 !(memslot->userspace_addr & (s - 1))) {
259 start &= ~(s - 1); 259 start &= ~(s - 1);
260 pgsize = s; 260 pgsize = s;
261 get_page(hpage);
262 put_page(page);
261 page = hpage; 263 page = hpage;
262 } 264 }
263 } 265 }
@@ -281,11 +283,8 @@ static long kvmppc_get_guest_page(struct kvm *kvm, unsigned long gfn,
281 err = 0; 283 err = 0;
282 284
283 out: 285 out:
284 if (got) { 286 if (got)
285 if (PageHuge(page))
286 page = compound_head(page);
287 put_page(page); 287 put_page(page);
288 }
289 return err; 288 return err;
290 289
291 up_err: 290 up_err:
@@ -678,8 +677,15 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
678 SetPageDirty(page); 677 SetPageDirty(page);
679 678
680 out_put: 679 out_put:
681 if (page) 680 if (page) {
682 put_page(page); 681 /*
682 * We drop pages[0] here, not page because page might
683 * have been set to the head page of a compound, but
684 * we have to drop the reference on the correct tail
685 * page to match the get inside gup()
686 */
687 put_page(pages[0]);
688 }
683 return ret; 689 return ret;
684 690
685 out_unlock: 691 out_unlock:
@@ -979,6 +985,7 @@ void *kvmppc_pin_guest_page(struct kvm *kvm, unsigned long gpa,
979 pa = *physp; 985 pa = *physp;
980 } 986 }
981 page = pfn_to_page(pa >> PAGE_SHIFT); 987 page = pfn_to_page(pa >> PAGE_SHIFT);
988 get_page(page);
982 } else { 989 } else {
983 hva = gfn_to_hva_memslot(memslot, gfn); 990 hva = gfn_to_hva_memslot(memslot, gfn);
984 npages = get_user_pages_fast(hva, 1, 1, pages); 991 npages = get_user_pages_fast(hva, 1, 1, pages);
@@ -991,8 +998,6 @@ void *kvmppc_pin_guest_page(struct kvm *kvm, unsigned long gpa,
991 page = compound_head(page); 998 page = compound_head(page);
992 psize <<= compound_order(page); 999 psize <<= compound_order(page);
993 } 1000 }
994 if (!kvm->arch.using_mmu_notifiers)
995 get_page(page);
996 offset = gpa & (psize - 1); 1001 offset = gpa & (psize - 1);
997 if (nb_ret) 1002 if (nb_ret)
998 *nb_ret = psize - offset; 1003 *nb_ret = psize - offset;
@@ -1003,7 +1008,6 @@ void kvmppc_unpin_guest_page(struct kvm *kvm, void *va)
1003{ 1008{
1004 struct page *page = virt_to_page(va); 1009 struct page *page = virt_to_page(va);
1005 1010
1006 page = compound_head(page);
1007 put_page(page); 1011 put_page(page);
1008} 1012}
1009 1013
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 01294a5099dd..108d1f580177 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -1192,8 +1192,6 @@ static void unpin_slot(struct kvm *kvm, int slot_id)
1192 continue; 1192 continue;
1193 pfn = physp[j] >> PAGE_SHIFT; 1193 pfn = physp[j] >> PAGE_SHIFT;
1194 page = pfn_to_page(pfn); 1194 page = pfn_to_page(pfn);
1195 if (PageHuge(page))
1196 page = compound_head(page);
1197 SetPageDirty(page); 1195 SetPageDirty(page);
1198 put_page(page); 1196 put_page(page);
1199 } 1197 }
diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
index def880aea63a..cec4daddbf31 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
@@ -463,6 +463,7 @@ long kvmppc_h_bulk_remove(struct kvm_vcpu *vcpu)
463 /* insert R and C bits from PTE */ 463 /* insert R and C bits from PTE */
464 rcbits = rev->guest_rpte & (HPTE_R_R|HPTE_R_C); 464 rcbits = rev->guest_rpte & (HPTE_R_R|HPTE_R_C);
465 args[j] |= rcbits << (56 - 5); 465 args[j] |= rcbits << (56 - 5);
466 hp[0] = 0;
466 continue; 467 continue;
467 } 468 }
468 469
diff --git a/arch/powerpc/kvm/book3s_segment.S b/arch/powerpc/kvm/book3s_segment.S
index 0676ae249b9f..6e6e9cef34a8 100644
--- a/arch/powerpc/kvm/book3s_segment.S
+++ b/arch/powerpc/kvm/book3s_segment.S
@@ -197,7 +197,8 @@ kvmppc_interrupt:
197 /* Save guest PC and MSR */ 197 /* Save guest PC and MSR */
198#ifdef CONFIG_PPC64 198#ifdef CONFIG_PPC64
199BEGIN_FTR_SECTION 199BEGIN_FTR_SECTION
200 andi. r0,r12,0x2 200 andi. r0, r12, 0x2
201 cmpwi cr1, r0, 0
201 beq 1f 202 beq 1f
202 mfspr r3,SPRN_HSRR0 203 mfspr r3,SPRN_HSRR0
203 mfspr r4,SPRN_HSRR1 204 mfspr r4,SPRN_HSRR1
@@ -250,6 +251,12 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
250 beq ld_last_prev_inst 251 beq ld_last_prev_inst
251 cmpwi r12, BOOK3S_INTERRUPT_ALIGNMENT 252 cmpwi r12, BOOK3S_INTERRUPT_ALIGNMENT
252 beq- ld_last_inst 253 beq- ld_last_inst
254#ifdef CONFIG_PPC64
255BEGIN_FTR_SECTION
256 cmpwi r12, BOOK3S_INTERRUPT_H_EMUL_ASSIST
257 beq- ld_last_inst
258END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
259#endif
253 260
254 b no_ld_last_inst 261 b no_ld_last_inst
255 262
@@ -316,23 +323,17 @@ no_dcbz32_off:
316 * Having set up SRR0/1 with the address where we want 323 * Having set up SRR0/1 with the address where we want
317 * to continue with relocation on (potentially in module 324 * to continue with relocation on (potentially in module
318 * space), we either just go straight there with rfi[d], 325 * space), we either just go straight there with rfi[d],
319 * or we jump to an interrupt handler with bctr if there 326 * or we jump to an interrupt handler if there is an
320 * is an interrupt to be handled first. In the latter 327 * interrupt to be handled first. In the latter case,
321 * case, the rfi[d] at the end of the interrupt handler 328 * the rfi[d] at the end of the interrupt handler will
322 * will get us back to where we want to continue. 329 * get us back to where we want to continue.
323 */ 330 */
324 331
325 cmpwi r12, BOOK3S_INTERRUPT_EXTERNAL
326 beq 1f
327 cmpwi r12, BOOK3S_INTERRUPT_DECREMENTER
328 beq 1f
329 cmpwi r12, BOOK3S_INTERRUPT_PERFMON
3301: mtctr r12
331
332 /* Register usage at this point: 332 /* Register usage at this point:
333 * 333 *
334 * R1 = host R1 334 * R1 = host R1
335 * R2 = host R2 335 * R2 = host R2
336 * R10 = raw exit handler id
336 * R12 = exit handler id 337 * R12 = exit handler id
337 * R13 = shadow vcpu (32-bit) or PACA (64-bit) 338 * R13 = shadow vcpu (32-bit) or PACA (64-bit)
338 * SVCPU.* = guest * 339 * SVCPU.* = guest *
@@ -342,12 +343,25 @@ no_dcbz32_off:
342 PPC_LL r6, HSTATE_HOST_MSR(r13) 343 PPC_LL r6, HSTATE_HOST_MSR(r13)
343 PPC_LL r8, HSTATE_VMHANDLER(r13) 344 PPC_LL r8, HSTATE_VMHANDLER(r13)
344 345
345 /* Restore host msr -> SRR1 */ 346#ifdef CONFIG_PPC64
347BEGIN_FTR_SECTION
348 beq cr1, 1f
349 mtspr SPRN_HSRR1, r6
350 mtspr SPRN_HSRR0, r8
351END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
352#endif
3531: /* Restore host msr -> SRR1 */
346 mtsrr1 r6 354 mtsrr1 r6
347 /* Load highmem handler address */ 355 /* Load highmem handler address */
348 mtsrr0 r8 356 mtsrr0 r8
349 357
350 /* RFI into the highmem handler, or jump to interrupt handler */ 358 /* RFI into the highmem handler, or jump to interrupt handler */
351 beqctr 359 cmpwi r12, BOOK3S_INTERRUPT_EXTERNAL
360 beqa BOOK3S_INTERRUPT_EXTERNAL
361 cmpwi r12, BOOK3S_INTERRUPT_DECREMENTER
362 beqa BOOK3S_INTERRUPT_DECREMENTER
363 cmpwi r12, BOOK3S_INTERRUPT_PERFMON
364 beqa BOOK3S_INTERRUPT_PERFMON
365
352 RFI 366 RFI
353kvmppc_handler_trampoline_exit_end: 367kvmppc_handler_trampoline_exit_end:
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index fb05b123218f..1a6de0a7d8eb 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -271,7 +271,8 @@ int alloc_bootmem_huge_page(struct hstate *hstate)
271 271
272unsigned long gpage_npages[MMU_PAGE_COUNT]; 272unsigned long gpage_npages[MMU_PAGE_COUNT];
273 273
274static int __init do_gpage_early_setup(char *param, char *val) 274static int __init do_gpage_early_setup(char *param, char *val,
275 const char *unused)
275{ 276{
276 static phys_addr_t size; 277 static phys_addr_t size;
277 unsigned long npages; 278 unsigned long npages;
diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
index af1ab5e9a691..5c3cf2d04e41 100644
--- a/arch/powerpc/net/bpf_jit.h
+++ b/arch/powerpc/net/bpf_jit.h
@@ -48,7 +48,13 @@
48/* 48/*
49 * Assembly helpers from arch/powerpc/net/bpf_jit.S: 49 * Assembly helpers from arch/powerpc/net/bpf_jit.S:
50 */ 50 */
51extern u8 sk_load_word[], sk_load_half[], sk_load_byte[], sk_load_byte_msh[]; 51#define DECLARE_LOAD_FUNC(func) \
52 extern u8 func[], func##_negative_offset[], func##_positive_offset[]
53
54DECLARE_LOAD_FUNC(sk_load_word);
55DECLARE_LOAD_FUNC(sk_load_half);
56DECLARE_LOAD_FUNC(sk_load_byte);
57DECLARE_LOAD_FUNC(sk_load_byte_msh);
52 58
53#define FUNCTION_DESCR_SIZE 24 59#define FUNCTION_DESCR_SIZE 24
54 60
diff --git a/arch/powerpc/net/bpf_jit_64.S b/arch/powerpc/net/bpf_jit_64.S
index ff4506e85cce..55ba3855a97f 100644
--- a/arch/powerpc/net/bpf_jit_64.S
+++ b/arch/powerpc/net/bpf_jit_64.S
@@ -31,14 +31,13 @@
31 * then branch directly to slow_path_XXX if required. (In fact, could 31 * then branch directly to slow_path_XXX if required. (In fact, could
32 * load a spare GPR with the address of slow_path_generic and pass size 32 * load a spare GPR with the address of slow_path_generic and pass size
33 * as an argument, making the call site a mtlr, li and bllr.) 33 * as an argument, making the call site a mtlr, li and bllr.)
34 *
35 * Technically, the "is addr < 0" check is unnecessary & slowing down
36 * the ABS path, as it's statically checked on generation.
37 */ 34 */
38 .globl sk_load_word 35 .globl sk_load_word
39sk_load_word: 36sk_load_word:
40 cmpdi r_addr, 0 37 cmpdi r_addr, 0
41 blt bpf_error 38 blt bpf_slow_path_word_neg
39 .globl sk_load_word_positive_offset
40sk_load_word_positive_offset:
42 /* Are we accessing past headlen? */ 41 /* Are we accessing past headlen? */
43 subi r_scratch1, r_HL, 4 42 subi r_scratch1, r_HL, 4
44 cmpd r_scratch1, r_addr 43 cmpd r_scratch1, r_addr
@@ -51,7 +50,9 @@ sk_load_word:
51 .globl sk_load_half 50 .globl sk_load_half
52sk_load_half: 51sk_load_half:
53 cmpdi r_addr, 0 52 cmpdi r_addr, 0
54 blt bpf_error 53 blt bpf_slow_path_half_neg
54 .globl sk_load_half_positive_offset
55sk_load_half_positive_offset:
55 subi r_scratch1, r_HL, 2 56 subi r_scratch1, r_HL, 2
56 cmpd r_scratch1, r_addr 57 cmpd r_scratch1, r_addr
57 blt bpf_slow_path_half 58 blt bpf_slow_path_half
@@ -61,7 +62,9 @@ sk_load_half:
61 .globl sk_load_byte 62 .globl sk_load_byte
62sk_load_byte: 63sk_load_byte:
63 cmpdi r_addr, 0 64 cmpdi r_addr, 0
64 blt bpf_error 65 blt bpf_slow_path_byte_neg
66 .globl sk_load_byte_positive_offset
67sk_load_byte_positive_offset:
65 cmpd r_HL, r_addr 68 cmpd r_HL, r_addr
66 ble bpf_slow_path_byte 69 ble bpf_slow_path_byte
67 lbzx r_A, r_D, r_addr 70 lbzx r_A, r_D, r_addr
@@ -69,22 +72,20 @@ sk_load_byte:
69 72
70/* 73/*
71 * BPF_S_LDX_B_MSH: ldxb 4*([offset]&0xf) 74 * BPF_S_LDX_B_MSH: ldxb 4*([offset]&0xf)
72 * r_addr is the offset value, already known positive 75 * r_addr is the offset value
73 */ 76 */
74 .globl sk_load_byte_msh 77 .globl sk_load_byte_msh
75sk_load_byte_msh: 78sk_load_byte_msh:
79 cmpdi r_addr, 0
80 blt bpf_slow_path_byte_msh_neg
81 .globl sk_load_byte_msh_positive_offset
82sk_load_byte_msh_positive_offset:
76 cmpd r_HL, r_addr 83 cmpd r_HL, r_addr
77 ble bpf_slow_path_byte_msh 84 ble bpf_slow_path_byte_msh
78 lbzx r_X, r_D, r_addr 85 lbzx r_X, r_D, r_addr
79 rlwinm r_X, r_X, 2, 32-4-2, 31-2 86 rlwinm r_X, r_X, 2, 32-4-2, 31-2
80 blr 87 blr
81 88
82bpf_error:
83 /* Entered with cr0 = lt */
84 li r3, 0
85 /* Generated code will 'blt epilogue', returning 0. */
86 blr
87
88/* Call out to skb_copy_bits: 89/* Call out to skb_copy_bits:
89 * We'll need to back up our volatile regs first; we have 90 * We'll need to back up our volatile regs first; we have
90 * local variable space at r1+(BPF_PPC_STACK_BASIC). 91 * local variable space at r1+(BPF_PPC_STACK_BASIC).
@@ -136,3 +137,84 @@ bpf_slow_path_byte_msh:
136 lbz r_X, BPF_PPC_STACK_BASIC+(2*8)(r1) 137 lbz r_X, BPF_PPC_STACK_BASIC+(2*8)(r1)
137 rlwinm r_X, r_X, 2, 32-4-2, 31-2 138 rlwinm r_X, r_X, 2, 32-4-2, 31-2
138 blr 139 blr
140
141/* Call out to bpf_internal_load_pointer_neg_helper:
142 * We'll need to back up our volatile regs first; we have
143 * local variable space at r1+(BPF_PPC_STACK_BASIC).
144 * Allocate a new stack frame here to remain ABI-compliant in
145 * stashing LR.
146 */
147#define sk_negative_common(SIZE) \
148 mflr r0; \
149 std r0, 16(r1); \
150 /* R3 goes in parameter space of caller's frame */ \
151 std r_skb, (BPF_PPC_STACKFRAME+48)(r1); \
152 std r_A, (BPF_PPC_STACK_BASIC+(0*8))(r1); \
153 std r_X, (BPF_PPC_STACK_BASIC+(1*8))(r1); \
154 stdu r1, -BPF_PPC_SLOWPATH_FRAME(r1); \
155 /* R3 = r_skb, as passed */ \
156 mr r4, r_addr; \
157 li r5, SIZE; \
158 bl bpf_internal_load_pointer_neg_helper; \
159 /* R3 != 0 on success */ \
160 addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \
161 ld r0, 16(r1); \
162 ld r_A, (BPF_PPC_STACK_BASIC+(0*8))(r1); \
163 ld r_X, (BPF_PPC_STACK_BASIC+(1*8))(r1); \
164 mtlr r0; \
165 cmpldi r3, 0; \
166 beq bpf_error_slow; /* cr0 = EQ */ \
167 mr r_addr, r3; \
168 ld r_skb, (BPF_PPC_STACKFRAME+48)(r1); \
169 /* Great success! */
170
171bpf_slow_path_word_neg:
172 lis r_scratch1,-32 /* SKF_LL_OFF */
173 cmpd r_addr, r_scratch1 /* addr < SKF_* */
174 blt bpf_error /* cr0 = LT */
175 .globl sk_load_word_negative_offset
176sk_load_word_negative_offset:
177 sk_negative_common(4)
178 lwz r_A, 0(r_addr)
179 blr
180
181bpf_slow_path_half_neg:
182 lis r_scratch1,-32 /* SKF_LL_OFF */
183 cmpd r_addr, r_scratch1 /* addr < SKF_* */
184 blt bpf_error /* cr0 = LT */
185 .globl sk_load_half_negative_offset
186sk_load_half_negative_offset:
187 sk_negative_common(2)
188 lhz r_A, 0(r_addr)
189 blr
190
191bpf_slow_path_byte_neg:
192 lis r_scratch1,-32 /* SKF_LL_OFF */
193 cmpd r_addr, r_scratch1 /* addr < SKF_* */
194 blt bpf_error /* cr0 = LT */
195 .globl sk_load_byte_negative_offset
196sk_load_byte_negative_offset:
197 sk_negative_common(1)
198 lbz r_A, 0(r_addr)
199 blr
200
201bpf_slow_path_byte_msh_neg:
202 lis r_scratch1,-32 /* SKF_LL_OFF */
203 cmpd r_addr, r_scratch1 /* addr < SKF_* */
204 blt bpf_error /* cr0 = LT */
205 .globl sk_load_byte_msh_negative_offset
206sk_load_byte_msh_negative_offset:
207 sk_negative_common(1)
208 lbz r_X, 0(r_addr)
209 rlwinm r_X, r_X, 2, 32-4-2, 31-2
210 blr
211
212bpf_error_slow:
213 /* fabricate a cr0 = lt */
214 li r_scratch1, -1
215 cmpdi r_scratch1, 0
216bpf_error:
217 /* Entered with cr0 = lt */
218 li r3, 0
219 /* Generated code will 'blt epilogue', returning 0. */
220 blr
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 73619d3aeb6c..2dc8b1484845 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -127,6 +127,9 @@ static void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx)
127 PPC_BLR(); 127 PPC_BLR();
128} 128}
129 129
130#define CHOOSE_LOAD_FUNC(K, func) \
131 ((int)K < 0 ? ((int)K >= SKF_LL_OFF ? func##_negative_offset : func) : func##_positive_offset)
132
130/* Assemble the body code between the prologue & epilogue. */ 133/* Assemble the body code between the prologue & epilogue. */
131static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, 134static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
132 struct codegen_context *ctx, 135 struct codegen_context *ctx,
@@ -391,21 +394,16 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
391 394
392 /*** Absolute loads from packet header/data ***/ 395 /*** Absolute loads from packet header/data ***/
393 case BPF_S_LD_W_ABS: 396 case BPF_S_LD_W_ABS:
394 func = sk_load_word; 397 func = CHOOSE_LOAD_FUNC(K, sk_load_word);
395 goto common_load; 398 goto common_load;
396 case BPF_S_LD_H_ABS: 399 case BPF_S_LD_H_ABS:
397 func = sk_load_half; 400 func = CHOOSE_LOAD_FUNC(K, sk_load_half);
398 goto common_load; 401 goto common_load;
399 case BPF_S_LD_B_ABS: 402 case BPF_S_LD_B_ABS:
400 func = sk_load_byte; 403 func = CHOOSE_LOAD_FUNC(K, sk_load_byte);
401 common_load: 404 common_load:
402 /* 405 /* Load from [K]. */
403 * Load from [K]. Reference with the (negative)
404 * SKF_NET_OFF/SKF_LL_OFF offsets is unsupported.
405 */
406 ctx->seen |= SEEN_DATAREF; 406 ctx->seen |= SEEN_DATAREF;
407 if ((int)K < 0)
408 return -ENOTSUPP;
409 PPC_LI64(r_scratch1, func); 407 PPC_LI64(r_scratch1, func);
410 PPC_MTLR(r_scratch1); 408 PPC_MTLR(r_scratch1);
411 PPC_LI32(r_addr, K); 409 PPC_LI32(r_addr, K);
@@ -429,7 +427,7 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
429 common_load_ind: 427 common_load_ind:
430 /* 428 /*
431 * Load from [X + K]. Negative offsets are tested for 429 * Load from [X + K]. Negative offsets are tested for
432 * in the helper functions, and result in a 'ret 0'. 430 * in the helper functions.
433 */ 431 */
434 ctx->seen |= SEEN_DATAREF | SEEN_XREG; 432 ctx->seen |= SEEN_DATAREF | SEEN_XREG;
435 PPC_LI64(r_scratch1, func); 433 PPC_LI64(r_scratch1, func);
@@ -443,13 +441,7 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
443 break; 441 break;
444 442
445 case BPF_S_LDX_B_MSH: 443 case BPF_S_LDX_B_MSH:
446 /* 444 func = CHOOSE_LOAD_FUNC(K, sk_load_byte_msh);
447 * x86 version drops packet (RET 0) when K<0, whereas
448 * interpreter does allow K<0 (__load_pointer, special
449 * ancillary data). common_load returns ENOTSUPP if K<0,
450 * so we fall back to interpreter & filter works.
451 */
452 func = sk_load_byte_msh;
453 goto common_load; 445 goto common_load;
454 break; 446 break;
455 447
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 02aee03e713c..8f84bcba18da 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -1299,8 +1299,7 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
1299 if (record) { 1299 if (record) {
1300 struct perf_sample_data data; 1300 struct perf_sample_data data;
1301 1301
1302 perf_sample_data_init(&data, ~0ULL); 1302 perf_sample_data_init(&data, ~0ULL, event->hw.last_period);
1303 data.period = event->hw.last_period;
1304 1303
1305 if (event->attr.sample_type & PERF_SAMPLE_ADDR) 1304 if (event->attr.sample_type & PERF_SAMPLE_ADDR)
1306 perf_get_data_addr(regs, &data.addr); 1305 perf_get_data_addr(regs, &data.addr);
diff --git a/arch/powerpc/perf/core-fsl-emb.c b/arch/powerpc/perf/core-fsl-emb.c
index 0a6d2a9d569c..106c53354675 100644
--- a/arch/powerpc/perf/core-fsl-emb.c
+++ b/arch/powerpc/perf/core-fsl-emb.c
@@ -613,8 +613,7 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
613 if (record) { 613 if (record) {
614 struct perf_sample_data data; 614 struct perf_sample_data data;
615 615
616 perf_sample_data_init(&data, 0); 616 perf_sample_data_init(&data, 0, event->hw.last_period);
617 data.period = event->hw.last_period;
618 617
619 if (perf_event_overflow(event, &data, regs)) 618 if (perf_event_overflow(event, &data, regs))
620 fsl_emb_pmu_stop(event, 0); 619 fsl_emb_pmu_stop(event, 0);
diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c
index 9fef5302adc1..67dac22b4363 100644
--- a/arch/powerpc/platforms/85xx/common.c
+++ b/arch/powerpc/platforms/85xx/common.c
@@ -21,6 +21,12 @@ static struct of_device_id __initdata mpc85xx_common_ids[] = {
21 { .compatible = "fsl,qe", }, 21 { .compatible = "fsl,qe", },
22 { .compatible = "fsl,cpm2", }, 22 { .compatible = "fsl,cpm2", },
23 { .compatible = "fsl,srio", }, 23 { .compatible = "fsl,srio", },
24 /* So that the DMA channel nodes can be probed individually: */
25 { .compatible = "fsl,eloplus-dma", },
26 /* For the PMC driver */
27 { .compatible = "fsl,mpc8548-guts", },
28 /* Probably unnecessary? */
29 { .compatible = "gpio-leds", },
24 {}, 30 {},
25}; 31};
26 32
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 9a6f04406e0d..d208ebccb91c 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -399,12 +399,6 @@ static int __init board_fixups(void)
399machine_arch_initcall(mpc8568_mds, board_fixups); 399machine_arch_initcall(mpc8568_mds, board_fixups);
400machine_arch_initcall(mpc8569_mds, board_fixups); 400machine_arch_initcall(mpc8569_mds, board_fixups);
401 401
402static struct of_device_id mpc85xx_ids[] = {
403 { .compatible = "fsl,mpc8548-guts", },
404 { .compatible = "gpio-leds", },
405 {},
406};
407
408static int __init mpc85xx_publish_devices(void) 402static int __init mpc85xx_publish_devices(void)
409{ 403{
410 if (machine_is(mpc8568_mds)) 404 if (machine_is(mpc8568_mds))
@@ -412,10 +406,7 @@ static int __init mpc85xx_publish_devices(void)
412 if (machine_is(mpc8569_mds)) 406 if (machine_is(mpc8569_mds))
413 simple_gpiochip_init("fsl,mpc8569mds-bcsr-gpio"); 407 simple_gpiochip_init("fsl,mpc8569mds-bcsr-gpio");
414 408
415 mpc85xx_common_publish_devices(); 409 return mpc85xx_common_publish_devices();
416 of_platform_bus_probe(NULL, mpc85xx_ids, NULL);
417
418 return 0;
419} 410}
420 411
421machine_device_initcall(mpc8568_mds, mpc85xx_publish_devices); 412machine_device_initcall(mpc8568_mds, mpc85xx_publish_devices);
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
index e74b7cde9aee..f700c81a1321 100644
--- a/arch/powerpc/platforms/85xx/p1022_ds.c
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -460,18 +460,7 @@ static void __init p1022_ds_setup_arch(void)
460 pr_info("Freescale P1022 DS reference board\n"); 460 pr_info("Freescale P1022 DS reference board\n");
461} 461}
462 462
463static struct of_device_id __initdata p1022_ds_ids[] = { 463machine_device_initcall(p1022_ds, mpc85xx_common_publish_devices);
464 /* So that the DMA channel nodes can be probed individually: */
465 { .compatible = "fsl,eloplus-dma", },
466 {},
467};
468
469static int __init p1022_ds_publish_devices(void)
470{
471 mpc85xx_common_publish_devices();
472 return of_platform_bus_probe(NULL, p1022_ds_ids, NULL);
473}
474machine_device_initcall(p1022_ds, p1022_ds_publish_devices);
475 464
476machine_arch_initcall(p1022_ds, swiotlb_setup_bus_notifier); 465machine_arch_initcall(p1022_ds, swiotlb_setup_bus_notifier);
477 466
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c
index db360fc4cf0e..85825b5401e5 100644
--- a/arch/powerpc/platforms/cell/axon_msi.c
+++ b/arch/powerpc/platforms/cell/axon_msi.c
@@ -114,7 +114,7 @@ static void axon_msi_cascade(unsigned int irq, struct irq_desc *desc)
114 pr_devel("axon_msi: woff %x roff %x msi %x\n", 114 pr_devel("axon_msi: woff %x roff %x msi %x\n",
115 write_offset, msic->read_offset, msi); 115 write_offset, msic->read_offset, msi);
116 116
117 if (msi < NR_IRQS && irq_get_chip_data(msi) == msic) { 117 if (msi < nr_irqs && irq_get_chip_data(msi) == msic) {
118 generic_handle_irq(msi); 118 generic_handle_irq(msi);
119 msic->fifo_virt[idx] = cpu_to_le32(0xffffffff); 119 msic->fifo_virt[idx] = cpu_to_le32(0xffffffff);
120 } else { 120 } else {
@@ -276,9 +276,6 @@ static int axon_msi_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
276 if (rc) 276 if (rc)
277 return rc; 277 return rc;
278 278
279 /* We rely on being able to stash a virq in a u16 */
280 BUILD_BUG_ON(NR_IRQS > 65536);
281
282 list_for_each_entry(entry, &dev->msi_list, list) { 279 list_for_each_entry(entry, &dev->msi_list, list) {
283 virq = irq_create_direct_mapping(msic->irq_domain); 280 virq = irq_create_direct_mapping(msic->irq_domain);
284 if (virq == NO_IRQ) { 281 if (virq == NO_IRQ) {
@@ -392,7 +389,8 @@ static int axon_msi_probe(struct platform_device *device)
392 } 389 }
393 memset(msic->fifo_virt, 0xff, MSIC_FIFO_SIZE_BYTES); 390 memset(msic->fifo_virt, 0xff, MSIC_FIFO_SIZE_BYTES);
394 391
395 msic->irq_domain = irq_domain_add_nomap(dn, &msic_host_ops, msic); 392 /* We rely on being able to stash a virq in a u16, so limit irqs to < 65536 */
393 msic->irq_domain = irq_domain_add_nomap(dn, 65536, &msic_host_ops, msic);
396 if (!msic->irq_domain) { 394 if (!msic->irq_domain) {
397 printk(KERN_ERR "axon_msi: couldn't allocate irq_domain for %s\n", 395 printk(KERN_ERR "axon_msi: couldn't allocate irq_domain for %s\n",
398 dn->full_name); 396 dn->full_name);
diff --git a/arch/powerpc/platforms/cell/beat_interrupt.c b/arch/powerpc/platforms/cell/beat_interrupt.c
index e5c3a2c6090d..8c6dc42ecf65 100644
--- a/arch/powerpc/platforms/cell/beat_interrupt.c
+++ b/arch/powerpc/platforms/cell/beat_interrupt.c
@@ -239,7 +239,7 @@ void __init beatic_init_IRQ(void)
239 ppc_md.get_irq = beatic_get_irq; 239 ppc_md.get_irq = beatic_get_irq;
240 240
241 /* Allocate an irq host */ 241 /* Allocate an irq host */
242 beatic_host = irq_domain_add_nomap(NULL, &beatic_pic_host_ops, NULL); 242 beatic_host = irq_domain_add_nomap(NULL, 0, &beatic_pic_host_ops, NULL);
243 BUG_ON(beatic_host == NULL); 243 BUG_ON(beatic_host == NULL);
244 irq_set_default_host(beatic_host); 244 irq_set_default_host(beatic_host);
245} 245}
@@ -248,6 +248,6 @@ void beatic_deinit_IRQ(void)
248{ 248{
249 int i; 249 int i;
250 250
251 for (i = 1; i < NR_IRQS; i++) 251 for (i = 1; i < nr_irqs; i++)
252 beat_destruct_irq_plug(i); 252 beat_destruct_irq_plug(i);
253} 253}
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index 996c5ff7824b..03685a329d7d 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -366,11 +366,20 @@ static void kw_i2c_timeout(unsigned long data)
366 unsigned long flags; 366 unsigned long flags;
367 367
368 spin_lock_irqsave(&host->lock, flags); 368 spin_lock_irqsave(&host->lock, flags);
369
370 /*
371 * If the timer is pending, that means we raced with the
372 * irq, in which case we just return
373 */
374 if (timer_pending(&host->timeout_timer))
375 goto skip;
376
369 kw_i2c_handle_interrupt(host, kw_read_reg(reg_isr)); 377 kw_i2c_handle_interrupt(host, kw_read_reg(reg_isr));
370 if (host->state != state_idle) { 378 if (host->state != state_idle) {
371 host->timeout_timer.expires = jiffies + KW_POLL_TIMEOUT; 379 host->timeout_timer.expires = jiffies + KW_POLL_TIMEOUT;
372 add_timer(&host->timeout_timer); 380 add_timer(&host->timeout_timer);
373 } 381 }
382 skip:
374 spin_unlock_irqrestore(&host->lock, flags); 383 spin_unlock_irqrestore(&host->lock, flags);
375} 384}
376 385
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 66ad93de1d55..c4e630576ff2 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -57,9 +57,9 @@ static int max_real_irqs;
57 57
58static DEFINE_RAW_SPINLOCK(pmac_pic_lock); 58static DEFINE_RAW_SPINLOCK(pmac_pic_lock);
59 59
60#define NR_MASK_WORDS ((NR_IRQS + 31) / 32) 60/* The max irq number this driver deals with is 128; see max_irqs */
61static unsigned long ppc_lost_interrupts[NR_MASK_WORDS]; 61static DECLARE_BITMAP(ppc_lost_interrupts, 128);
62static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS]; 62static DECLARE_BITMAP(ppc_cached_irq_mask, 128);
63static int pmac_irq_cascade = -1; 63static int pmac_irq_cascade = -1;
64static struct irq_domain *pmac_pic_host; 64static struct irq_domain *pmac_pic_host;
65 65
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index a81e5a88fbdf..b4ddaa3fbb29 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -192,7 +192,7 @@ static int psurge_secondary_ipi_init(void)
192{ 192{
193 int rc = -ENOMEM; 193 int rc = -ENOMEM;
194 194
195 psurge_host = irq_domain_add_nomap(NULL, &psurge_host_ops, NULL); 195 psurge_host = irq_domain_add_nomap(NULL, 0, &psurge_host_ops, NULL);
196 196
197 if (psurge_host) 197 if (psurge_host)
198 psurge_secondary_virq = irq_create_direct_mapping(psurge_host); 198 psurge_secondary_virq = irq_create_direct_mapping(psurge_host);
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c
index 2a4ff86cc21f..5f3b23220b8e 100644
--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -753,9 +753,8 @@ void __init ps3_init_IRQ(void)
753 unsigned cpu; 753 unsigned cpu;
754 struct irq_domain *host; 754 struct irq_domain *host;
755 755
756 host = irq_domain_add_nomap(NULL, &ps3_host_ops, NULL); 756 host = irq_domain_add_nomap(NULL, PS3_PLUG_MAX + 1, &ps3_host_ops, NULL);
757 irq_set_default_host(host); 757 irq_set_default_host(host);
758 irq_set_virq_count(PS3_PLUG_MAX + 1);
759 758
760 for_each_possible_cpu(cpu) { 759 for_each_possible_cpu(cpu) {
761 struct ps3_private *pd = &per_cpu(ps3_private, cpu); 760 struct ps3_private *pd = &per_cpu(ps3_private, cpu);
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 10ad207dccc2..837cf49357ed 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -30,9 +30,9 @@ config PPC_SPLPAR
30 two or more partitions. 30 two or more partitions.
31 31
32config EEH 32config EEH
33 bool "PCI Extended Error Handling (EEH)" if EXPERT 33 bool
34 depends on PPC_PSERIES && PCI 34 depends on PPC_PSERIES && PCI
35 default y if !EXPERT 35 default y
36 36
37config PSERIES_MSI 37config PSERIES_MSI
38 bool 38 bool
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 309d38ef7322..a75e37dc41aa 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -1076,7 +1076,7 @@ static void eeh_add_device_late(struct pci_dev *dev)
1076 pr_debug("EEH: Adding device %s\n", pci_name(dev)); 1076 pr_debug("EEH: Adding device %s\n", pci_name(dev));
1077 1077
1078 dn = pci_device_to_OF_node(dev); 1078 dn = pci_device_to_OF_node(dev);
1079 edev = pci_dev_to_eeh_dev(dev); 1079 edev = of_node_to_eeh_dev(dn);
1080 if (edev->pdev == dev) { 1080 if (edev->pdev == dev) {
1081 pr_debug("EEH: Already referenced !\n"); 1081 pr_debug("EEH: Already referenced !\n");
1082 return; 1082 return;
diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c
index d3be961e2ae7..10386b676d87 100644
--- a/arch/powerpc/sysdev/cpm2_pic.c
+++ b/arch/powerpc/sysdev/cpm2_pic.c
@@ -51,8 +51,7 @@
51static intctl_cpm2_t __iomem *cpm2_intctl; 51static intctl_cpm2_t __iomem *cpm2_intctl;
52 52
53static struct irq_domain *cpm2_pic_host; 53static struct irq_domain *cpm2_pic_host;
54#define NR_MASK_WORDS ((NR_IRQS + 31) / 32) 54static unsigned long ppc_cached_irq_mask[2]; /* 2 32-bit registers */
55static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS];
56 55
57static const u_char irq_to_siureg[] = { 56static const u_char irq_to_siureg[] = {
58 1, 1, 1, 1, 1, 1, 1, 1, 57 1, 1, 1, 1, 1, 1, 1, 1,
diff --git a/arch/powerpc/sysdev/mpc8xx_pic.c b/arch/powerpc/sysdev/mpc8xx_pic.c
index d5f5416be310..b724622c3a0b 100644
--- a/arch/powerpc/sysdev/mpc8xx_pic.c
+++ b/arch/powerpc/sysdev/mpc8xx_pic.c
@@ -18,69 +18,45 @@
18extern int cpm_get_irq(struct pt_regs *regs); 18extern int cpm_get_irq(struct pt_regs *regs);
19 19
20static struct irq_domain *mpc8xx_pic_host; 20static struct irq_domain *mpc8xx_pic_host;
21#define NR_MASK_WORDS ((NR_IRQS + 31) / 32) 21static unsigned long mpc8xx_cached_irq_mask;
22static unsigned long ppc_cached_irq_mask[NR_MASK_WORDS];
23static sysconf8xx_t __iomem *siu_reg; 22static sysconf8xx_t __iomem *siu_reg;
24 23
25int cpm_get_irq(struct pt_regs *regs); 24static inline unsigned long mpc8xx_irqd_to_bit(struct irq_data *d)
25{
26 return 0x80000000 >> irqd_to_hwirq(d);
27}
26 28
27static void mpc8xx_unmask_irq(struct irq_data *d) 29static void mpc8xx_unmask_irq(struct irq_data *d)
28{ 30{
29 int bit, word; 31 mpc8xx_cached_irq_mask |= mpc8xx_irqd_to_bit(d);
30 unsigned int irq_nr = (unsigned int)irqd_to_hwirq(d); 32 out_be32(&siu_reg->sc_simask, mpc8xx_cached_irq_mask);
31
32 bit = irq_nr & 0x1f;
33 word = irq_nr >> 5;
34
35 ppc_cached_irq_mask[word] |= (1 << (31-bit));
36 out_be32(&siu_reg->sc_simask, ppc_cached_irq_mask[word]);
37} 33}
38 34
39static void mpc8xx_mask_irq(struct irq_data *d) 35static void mpc8xx_mask_irq(struct irq_data *d)
40{ 36{
41 int bit, word; 37 mpc8xx_cached_irq_mask &= ~mpc8xx_irqd_to_bit(d);
42 unsigned int irq_nr = (unsigned int)irqd_to_hwirq(d); 38 out_be32(&siu_reg->sc_simask, mpc8xx_cached_irq_mask);
43
44 bit = irq_nr & 0x1f;
45 word = irq_nr >> 5;
46
47 ppc_cached_irq_mask[word] &= ~(1 << (31-bit));
48 out_be32(&siu_reg->sc_simask, ppc_cached_irq_mask[word]);
49} 39}
50 40
51static void mpc8xx_ack(struct irq_data *d) 41static void mpc8xx_ack(struct irq_data *d)
52{ 42{
53 int bit; 43 out_be32(&siu_reg->sc_sipend, mpc8xx_irqd_to_bit(d));
54 unsigned int irq_nr = (unsigned int)irqd_to_hwirq(d);
55
56 bit = irq_nr & 0x1f;
57 out_be32(&siu_reg->sc_sipend, 1 << (31-bit));
58} 44}
59 45
60static void mpc8xx_end_irq(struct irq_data *d) 46static void mpc8xx_end_irq(struct irq_data *d)
61{ 47{
62 int bit, word; 48 mpc8xx_cached_irq_mask |= mpc8xx_irqd_to_bit(d);
63 unsigned int irq_nr = (unsigned int)irqd_to_hwirq(d); 49 out_be32(&siu_reg->sc_simask, mpc8xx_cached_irq_mask);
64
65 bit = irq_nr & 0x1f;
66 word = irq_nr >> 5;
67
68 ppc_cached_irq_mask[word] |= (1 << (31-bit));
69 out_be32(&siu_reg->sc_simask, ppc_cached_irq_mask[word]);
70} 50}
71 51
72static int mpc8xx_set_irq_type(struct irq_data *d, unsigned int flow_type) 52static int mpc8xx_set_irq_type(struct irq_data *d, unsigned int flow_type)
73{ 53{
74 if (flow_type & IRQ_TYPE_EDGE_FALLING) { 54 /* only external IRQ senses are programmable */
75 irq_hw_number_t hw = (unsigned int)irqd_to_hwirq(d); 55 if ((flow_type & IRQ_TYPE_EDGE_FALLING) && !(irqd_to_hwirq(d) & 1)) {
76 unsigned int siel = in_be32(&siu_reg->sc_siel); 56 unsigned int siel = in_be32(&siu_reg->sc_siel);
77 57 siel |= mpc8xx_irqd_to_bit(d);
78 /* only external IRQ senses are programmable */ 58 out_be32(&siu_reg->sc_siel, siel);
79 if ((hw & 1) == 0) { 59 __irq_set_handler_locked(d->irq, handle_edge_irq);
80 siel |= (0x80000000 >> hw);
81 out_be32(&siu_reg->sc_siel, siel);
82 __irq_set_handler_locked(d->irq, handle_edge_irq);
83 }
84 } 60 }
85 return 0; 61 return 0;
86} 62}
@@ -132,6 +108,9 @@ static int mpc8xx_pic_host_xlate(struct irq_domain *h, struct device_node *ct,
132 IRQ_TYPE_EDGE_FALLING, 108 IRQ_TYPE_EDGE_FALLING,
133 }; 109 };
134 110
111 if (intspec[0] > 0x1f)
112 return 0;
113
135 *out_hwirq = intspec[0]; 114 *out_hwirq = intspec[0];
136 if (intsize > 1 && intspec[1] < 4) 115 if (intsize > 1 && intspec[1] < 4)
137 *out_flags = map_pic_senses[intspec[1]]; 116 *out_flags = map_pic_senses[intspec[1]];
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 9ac71ebd2c40..395af1347749 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -604,18 +604,14 @@ static struct mpic *mpic_find(unsigned int irq)
604} 604}
605 605
606/* Determine if the linux irq is an IPI */ 606/* Determine if the linux irq is an IPI */
607static unsigned int mpic_is_ipi(struct mpic *mpic, unsigned int irq) 607static unsigned int mpic_is_ipi(struct mpic *mpic, unsigned int src)
608{ 608{
609 unsigned int src = virq_to_hw(irq);
610
611 return (src >= mpic->ipi_vecs[0] && src <= mpic->ipi_vecs[3]); 609 return (src >= mpic->ipi_vecs[0] && src <= mpic->ipi_vecs[3]);
612} 610}
613 611
614/* Determine if the linux irq is a timer */ 612/* Determine if the linux irq is a timer */
615static unsigned int mpic_is_tm(struct mpic *mpic, unsigned int irq) 613static unsigned int mpic_is_tm(struct mpic *mpic, unsigned int src)
616{ 614{
617 unsigned int src = virq_to_hw(irq);
618
619 return (src >= mpic->timer_vecs[0] && src <= mpic->timer_vecs[7]); 615 return (src >= mpic->timer_vecs[0] && src <= mpic->timer_vecs[7]);
620} 616}
621 617
@@ -876,21 +872,45 @@ int mpic_set_irq_type(struct irq_data *d, unsigned int flow_type)
876 if (src >= mpic->num_sources) 872 if (src >= mpic->num_sources)
877 return -EINVAL; 873 return -EINVAL;
878 874
875 vold = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI));
876
877 /* We don't support "none" type */
879 if (flow_type == IRQ_TYPE_NONE) 878 if (flow_type == IRQ_TYPE_NONE)
880 if (mpic->senses && src < mpic->senses_count) 879 flow_type = IRQ_TYPE_DEFAULT;
881 flow_type = mpic->senses[src]; 880
882 if (flow_type == IRQ_TYPE_NONE) 881 /* Default: read HW settings */
883 flow_type = IRQ_TYPE_LEVEL_LOW; 882 if (flow_type == IRQ_TYPE_DEFAULT) {
883 switch(vold & (MPIC_INFO(VECPRI_POLARITY_MASK) |
884 MPIC_INFO(VECPRI_SENSE_MASK))) {
885 case MPIC_INFO(VECPRI_SENSE_EDGE) |
886 MPIC_INFO(VECPRI_POLARITY_POSITIVE):
887 flow_type = IRQ_TYPE_EDGE_RISING;
888 break;
889 case MPIC_INFO(VECPRI_SENSE_EDGE) |
890 MPIC_INFO(VECPRI_POLARITY_NEGATIVE):
891 flow_type = IRQ_TYPE_EDGE_FALLING;
892 break;
893 case MPIC_INFO(VECPRI_SENSE_LEVEL) |
894 MPIC_INFO(VECPRI_POLARITY_POSITIVE):
895 flow_type = IRQ_TYPE_LEVEL_HIGH;
896 break;
897 case MPIC_INFO(VECPRI_SENSE_LEVEL) |
898 MPIC_INFO(VECPRI_POLARITY_NEGATIVE):
899 flow_type = IRQ_TYPE_LEVEL_LOW;
900 break;
901 }
902 }
884 903
904 /* Apply to irq desc */
885 irqd_set_trigger_type(d, flow_type); 905 irqd_set_trigger_type(d, flow_type);
886 906
907 /* Apply to HW */
887 if (mpic_is_ht_interrupt(mpic, src)) 908 if (mpic_is_ht_interrupt(mpic, src))
888 vecpri = MPIC_VECPRI_POLARITY_POSITIVE | 909 vecpri = MPIC_VECPRI_POLARITY_POSITIVE |
889 MPIC_VECPRI_SENSE_EDGE; 910 MPIC_VECPRI_SENSE_EDGE;
890 else 911 else
891 vecpri = mpic_type_to_vecpri(mpic, flow_type); 912 vecpri = mpic_type_to_vecpri(mpic, flow_type);
892 913
893 vold = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI));
894 vnew = vold & ~(MPIC_INFO(VECPRI_POLARITY_MASK) | 914 vnew = vold & ~(MPIC_INFO(VECPRI_POLARITY_MASK) |
895 MPIC_INFO(VECPRI_SENSE_MASK)); 915 MPIC_INFO(VECPRI_SENSE_MASK));
896 vnew |= vecpri; 916 vnew |= vecpri;
@@ -1026,7 +1046,7 @@ static int mpic_host_map(struct irq_domain *h, unsigned int virq,
1026 irq_set_chip_and_handler(virq, chip, handle_fasteoi_irq); 1046 irq_set_chip_and_handler(virq, chip, handle_fasteoi_irq);
1027 1047
1028 /* Set default irq type */ 1048 /* Set default irq type */
1029 irq_set_irq_type(virq, IRQ_TYPE_NONE); 1049 irq_set_irq_type(virq, IRQ_TYPE_DEFAULT);
1030 1050
1031 /* If the MPIC was reset, then all vectors have already been 1051 /* If the MPIC was reset, then all vectors have already been
1032 * initialized. Otherwise, a per source lazy initialization 1052 * initialized. Otherwise, a per source lazy initialization
@@ -1417,12 +1437,6 @@ void __init mpic_assign_isu(struct mpic *mpic, unsigned int isu_num,
1417 mpic->num_sources = isu_first + mpic->isu_size; 1437 mpic->num_sources = isu_first + mpic->isu_size;
1418} 1438}
1419 1439
1420void __init mpic_set_default_senses(struct mpic *mpic, u8 *senses, int count)
1421{
1422 mpic->senses = senses;
1423 mpic->senses_count = count;
1424}
1425
1426void __init mpic_init(struct mpic *mpic) 1440void __init mpic_init(struct mpic *mpic)
1427{ 1441{
1428 int i, cpu; 1442 int i, cpu;
@@ -1555,12 +1569,12 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
1555 return; 1569 return;
1556 1570
1557 raw_spin_lock_irqsave(&mpic_lock, flags); 1571 raw_spin_lock_irqsave(&mpic_lock, flags);
1558 if (mpic_is_ipi(mpic, irq)) { 1572 if (mpic_is_ipi(mpic, src)) {
1559 reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) & 1573 reg = mpic_ipi_read(src - mpic->ipi_vecs[0]) &
1560 ~MPIC_VECPRI_PRIORITY_MASK; 1574 ~MPIC_VECPRI_PRIORITY_MASK;
1561 mpic_ipi_write(src - mpic->ipi_vecs[0], 1575 mpic_ipi_write(src - mpic->ipi_vecs[0],
1562 reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT)); 1576 reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT));
1563 } else if (mpic_is_tm(mpic, irq)) { 1577 } else if (mpic_is_tm(mpic, src)) {
1564 reg = mpic_tm_read(src - mpic->timer_vecs[0]) & 1578 reg = mpic_tm_read(src - mpic->timer_vecs[0]) &
1565 ~MPIC_VECPRI_PRIORITY_MASK; 1579 ~MPIC_VECPRI_PRIORITY_MASK;
1566 mpic_tm_write(src - mpic->timer_vecs[0], 1580 mpic_tm_write(src - mpic->timer_vecs[0],
diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
index 6e7fa386e76a..483d8fa72e8b 100644
--- a/arch/powerpc/sysdev/mpic_msgr.c
+++ b/arch/powerpc/sysdev/mpic_msgr.c
@@ -27,6 +27,7 @@
27 27
28static struct mpic_msgr **mpic_msgrs; 28static struct mpic_msgr **mpic_msgrs;
29static unsigned int mpic_msgr_count; 29static unsigned int mpic_msgr_count;
30static DEFINE_RAW_SPINLOCK(msgrs_lock);
30 31
31static inline void _mpic_msgr_mer_write(struct mpic_msgr *msgr, u32 value) 32static inline void _mpic_msgr_mer_write(struct mpic_msgr *msgr, u32 value)
32{ 33{
@@ -56,12 +57,11 @@ struct mpic_msgr *mpic_msgr_get(unsigned int reg_num)
56 if (reg_num >= mpic_msgr_count) 57 if (reg_num >= mpic_msgr_count)
57 return ERR_PTR(-ENODEV); 58 return ERR_PTR(-ENODEV);
58 59
59 raw_spin_lock_irqsave(&msgr->lock, flags); 60 raw_spin_lock_irqsave(&msgrs_lock, flags);
60 if (mpic_msgrs[reg_num]->in_use == MSGR_FREE) { 61 msgr = mpic_msgrs[reg_num];
61 msgr = mpic_msgrs[reg_num]; 62 if (msgr->in_use == MSGR_FREE)
62 msgr->in_use = MSGR_INUSE; 63 msgr->in_use = MSGR_INUSE;
63 } 64 raw_spin_unlock_irqrestore(&msgrs_lock, flags);
64 raw_spin_unlock_irqrestore(&msgr->lock, flags);
65 65
66 return msgr; 66 return msgr;
67} 67}
@@ -228,7 +228,7 @@ static __devinit int mpic_msgr_probe(struct platform_device *dev)
228 228
229 reg_number = block_number * MPIC_MSGR_REGISTERS_PER_BLOCK + i; 229 reg_number = block_number * MPIC_MSGR_REGISTERS_PER_BLOCK + i;
230 msgr->base = msgr_block_addr + i * MPIC_MSGR_STRIDE; 230 msgr->base = msgr_block_addr + i * MPIC_MSGR_STRIDE;
231 msgr->mer = msgr->base + MPIC_MSGR_MER_OFFSET; 231 msgr->mer = (u32 *)((u8 *)msgr->base + MPIC_MSGR_MER_OFFSET);
232 msgr->in_use = MSGR_FREE; 232 msgr->in_use = MSGR_FREE;
233 msgr->num = i; 233 msgr->num = i;
234 raw_spin_lock_init(&msgr->lock); 234 raw_spin_lock_init(&msgr->lock);
diff --git a/arch/powerpc/sysdev/scom.c b/arch/powerpc/sysdev/scom.c
index 49a3ece1c6b3..702256a1ca11 100644
--- a/arch/powerpc/sysdev/scom.c
+++ b/arch/powerpc/sysdev/scom.c
@@ -22,6 +22,7 @@
22#include <linux/debugfs.h> 22#include <linux/debugfs.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/export.h> 24#include <linux/export.h>
25#include <asm/debug.h>
25#include <asm/prom.h> 26#include <asm/prom.h>
26#include <asm/scom.h> 27#include <asm/scom.h>
27 28
diff --git a/arch/powerpc/sysdev/xics/xics-common.c b/arch/powerpc/sysdev/xics/xics-common.c
index ea5e204e3450..cd1d18db92c6 100644
--- a/arch/powerpc/sysdev/xics/xics-common.c
+++ b/arch/powerpc/sysdev/xics/xics-common.c
@@ -188,6 +188,7 @@ void xics_migrate_irqs_away(void)
188{ 188{
189 int cpu = smp_processor_id(), hw_cpu = hard_smp_processor_id(); 189 int cpu = smp_processor_id(), hw_cpu = hard_smp_processor_id();
190 unsigned int irq, virq; 190 unsigned int irq, virq;
191 struct irq_desc *desc;
191 192
192 /* If we used to be the default server, move to the new "boot_cpuid" */ 193 /* If we used to be the default server, move to the new "boot_cpuid" */
193 if (hw_cpu == xics_default_server) 194 if (hw_cpu == xics_default_server)
@@ -202,8 +203,7 @@ void xics_migrate_irqs_away(void)
202 /* Allow IPIs again... */ 203 /* Allow IPIs again... */
203 icp_ops->set_priority(DEFAULT_PRIORITY); 204 icp_ops->set_priority(DEFAULT_PRIORITY);
204 205
205 for_each_irq(virq) { 206 for_each_irq_desc(virq, desc) {
206 struct irq_desc *desc;
207 struct irq_chip *chip; 207 struct irq_chip *chip;
208 long server; 208 long server;
209 unsigned long flags; 209 unsigned long flags;
@@ -212,9 +212,8 @@ void xics_migrate_irqs_away(void)
212 /* We can't set affinity on ISA interrupts */ 212 /* We can't set affinity on ISA interrupts */
213 if (virq < NUM_ISA_INTERRUPTS) 213 if (virq < NUM_ISA_INTERRUPTS)
214 continue; 214 continue;
215 desc = irq_to_desc(virq);
216 /* We only need to migrate enabled IRQS */ 215 /* We only need to migrate enabled IRQS */
217 if (!desc || !desc->action) 216 if (!desc->action)
218 continue; 217 continue;
219 if (desc->irq_data.domain != xics_host) 218 if (desc->irq_data.domain != xics_host)
220 continue; 219 continue;
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 2b7c0fbe578e..e16390c0bca8 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -90,7 +90,6 @@ config S390
90 select HAVE_KERNEL_XZ 90 select HAVE_KERNEL_XZ
91 select HAVE_ARCH_MUTEX_CPU_RELAX 91 select HAVE_ARCH_MUTEX_CPU_RELAX
92 select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 92 select HAVE_ARCH_JUMP_LABEL if !MARCH_G5
93 select HAVE_RCU_TABLE_FREE if SMP
94 select ARCH_SAVE_PAGE_KEYS if HIBERNATION 93 select ARCH_SAVE_PAGE_KEYS if HIBERNATION
95 select HAVE_MEMBLOCK 94 select HAVE_MEMBLOCK
96 select HAVE_MEMBLOCK_NODE_MAP 95 select HAVE_MEMBLOCK_NODE_MAP
@@ -123,6 +122,7 @@ config S390
123 select ARCH_INLINE_WRITE_UNLOCK_BH 122 select ARCH_INLINE_WRITE_UNLOCK_BH
124 select ARCH_INLINE_WRITE_UNLOCK_IRQ 123 select ARCH_INLINE_WRITE_UNLOCK_IRQ
125 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE 124 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
125 select GENERIC_SMP_IDLE_THREAD
126 126
127config SCHED_OMIT_FRAME_POINTER 127config SCHED_OMIT_FRAME_POINTER
128 def_bool y 128 def_bool y
@@ -218,7 +218,7 @@ config COMPAT
218 def_bool y 218 def_bool y
219 prompt "Kernel support for 31 bit emulation" 219 prompt "Kernel support for 31 bit emulation"
220 depends on 64BIT 220 depends on 64BIT
221 select COMPAT_BINFMT_ELF 221 select COMPAT_BINFMT_ELF if BINFMT_ELF
222 select ARCH_WANT_OLD_COMPAT_IPC 222 select ARCH_WANT_OLD_COMPAT_IPC
223 help 223 help
224 Select this option if you want to enable your system kernel to 224 Select this option if you want to enable your system kernel to
@@ -235,6 +235,25 @@ config KEYS_COMPAT
235config AUDIT_ARCH 235config AUDIT_ARCH
236 def_bool y 236 def_bool y
237 237
238config HAVE_MARCH_Z900_FEATURES
239 def_bool n
240
241config HAVE_MARCH_Z990_FEATURES
242 def_bool n
243 select HAVE_MARCH_Z900_FEATURES
244
245config HAVE_MARCH_Z9_109_FEATURES
246 def_bool n
247 select HAVE_MARCH_Z990_FEATURES
248
249config HAVE_MARCH_Z10_FEATURES
250 def_bool n
251 select HAVE_MARCH_Z9_109_FEATURES
252
253config HAVE_MARCH_Z196_FEATURES
254 def_bool n
255 select HAVE_MARCH_Z10_FEATURES
256
238comment "Code generation options" 257comment "Code generation options"
239 258
240choice 259choice
@@ -250,6 +269,7 @@ config MARCH_G5
250 269
251config MARCH_Z900 270config MARCH_Z900
252 bool "IBM zSeries model z800 and z900" 271 bool "IBM zSeries model z800 and z900"
272 select HAVE_MARCH_Z900_FEATURES if 64BIT
253 help 273 help
254 Select this to enable optimizations for model z800/z900 (2064 and 274 Select this to enable optimizations for model z800/z900 (2064 and
255 2066 series). This will enable some optimizations that are not 275 2066 series). This will enable some optimizations that are not
@@ -257,6 +277,7 @@ config MARCH_Z900
257 277
258config MARCH_Z990 278config MARCH_Z990
259 bool "IBM zSeries model z890 and z990" 279 bool "IBM zSeries model z890 and z990"
280 select HAVE_MARCH_Z990_FEATURES if 64BIT
260 help 281 help
261 Select this to enable optimizations for model z890/z990 (2084 and 282 Select this to enable optimizations for model z890/z990 (2084 and
262 2086 series). The kernel will be slightly faster but will not work 283 2086 series). The kernel will be slightly faster but will not work
@@ -264,6 +285,7 @@ config MARCH_Z990
264 285
265config MARCH_Z9_109 286config MARCH_Z9_109
266 bool "IBM System z9" 287 bool "IBM System z9"
288 select HAVE_MARCH_Z9_109_FEATURES if 64BIT
267 help 289 help
268 Select this to enable optimizations for IBM System z9 (2094 and 290 Select this to enable optimizations for IBM System z9 (2094 and
269 2096 series). The kernel will be slightly faster but will not work 291 2096 series). The kernel will be slightly faster but will not work
@@ -271,6 +293,7 @@ config MARCH_Z9_109
271 293
272config MARCH_Z10 294config MARCH_Z10
273 bool "IBM System z10" 295 bool "IBM System z10"
296 select HAVE_MARCH_Z10_FEATURES if 64BIT
274 help 297 help
275 Select this to enable optimizations for IBM System z10 (2097 and 298 Select this to enable optimizations for IBM System z10 (2097 and
276 2098 series). The kernel will be slightly faster but will not work 299 2098 series). The kernel will be slightly faster but will not work
@@ -278,6 +301,7 @@ config MARCH_Z10
278 301
279config MARCH_Z196 302config MARCH_Z196
280 bool "IBM zEnterprise 114 and 196" 303 bool "IBM zEnterprise 114 and 196"
304 select HAVE_MARCH_Z196_FEATURES if 64BIT
281 help 305 help
282 Select this to enable optimizations for IBM zEnterprise 114 and 196 306 Select this to enable optimizations for IBM zEnterprise 114 and 196
283 (2818 and 2817 series). The kernel will be slightly faster but will 307 (2818 and 2817 series). The kernel will be slightly faster but will
@@ -407,33 +431,6 @@ config CHSC_SCH
407 431
408comment "Misc" 432comment "Misc"
409 433
410config IPL
411 def_bool y
412 prompt "Builtin IPL record support"
413 help
414 If you want to use the produced kernel to IPL directly from a
415 device, you have to merge a bootsector specific to the device
416 into the first bytes of the kernel. You will have to select the
417 IPL device.
418
419choice
420 prompt "IPL method generated into head.S"
421 depends on IPL
422 default IPL_VM
423 help
424 Select "tape" if you want to IPL the image from a Tape.
425
426 Select "vm_reader" if you are running under VM/ESA and want
427 to IPL the image from the emulated card reader.
428
429config IPL_TAPE
430 bool "tape"
431
432config IPL_VM
433 bool "vm_reader"
434
435endchoice
436
437source "fs/Kconfig.binfmt" 434source "fs/Kconfig.binfmt"
438 435
439config FORCE_MAX_ZONEORDER 436config FORCE_MAX_ZONEORDER
@@ -570,7 +567,7 @@ config KEXEC
570 567
571config CRASH_DUMP 568config CRASH_DUMP
572 bool "kernel crash dumps" 569 bool "kernel crash dumps"
573 depends on 64BIT 570 depends on 64BIT && SMP
574 select KEXEC 571 select KEXEC
575 help 572 help
576 Generate crash dump after being started by kexec. 573 Generate crash dump after being started by kexec.
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 0ad2f1e1ce9e..49e76e8b477d 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -91,7 +91,6 @@ OBJCOPYFLAGS := -O binary
91 91
92head-y := arch/s390/kernel/head.o 92head-y := arch/s390/kernel/head.o
93head-y += arch/s390/kernel/$(if $(CONFIG_64BIT),head64.o,head31.o) 93head-y += arch/s390/kernel/$(if $(CONFIG_64BIT),head64.o,head31.o)
94head-y += arch/s390/kernel/init_task.o
95 94
96# See arch/s390/Kbuild for content of core part of the kernel 95# See arch/s390/Kbuild for content of core part of the kernel
97core-y += arch/s390/ 96core-y += arch/s390/
diff --git a/arch/s390/boot/.gitignore b/arch/s390/boot/.gitignore
new file mode 100644
index 000000000000..017d5912ad2d
--- /dev/null
+++ b/arch/s390/boot/.gitignore
@@ -0,0 +1,2 @@
1image
2bzImage
diff --git a/arch/s390/boot/compressed/.gitignore b/arch/s390/boot/compressed/.gitignore
new file mode 100644
index 000000000000..ae06b9b4c02f
--- /dev/null
+++ b/arch/s390/boot/compressed/.gitignore
@@ -0,0 +1,3 @@
1sizes.h
2vmlinux
3vmlinux.lds
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index 6cf8e26b3137..37d2bf267964 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -1,8 +1,12 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_POSIX_MQUEUE=y 3CONFIG_POSIX_MQUEUE=y
4CONFIG_FHANDLE=y
5CONFIG_TASKSTATS=y
6CONFIG_TASK_DELAY_ACCT=y
7CONFIG_TASK_XACCT=y
8CONFIG_TASK_IO_ACCOUNTING=y
4CONFIG_AUDIT=y 9CONFIG_AUDIT=y
5CONFIG_RCU_TRACE=y
6CONFIG_IKCONFIG=y 10CONFIG_IKCONFIG=y
7CONFIG_IKCONFIG_PROC=y 11CONFIG_IKCONFIG_PROC=y
8CONFIG_CGROUPS=y 12CONFIG_CGROUPS=y
@@ -14,16 +18,22 @@ CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y
14CONFIG_CGROUP_SCHED=y 18CONFIG_CGROUP_SCHED=y
15CONFIG_RT_GROUP_SCHED=y 19CONFIG_RT_GROUP_SCHED=y
16CONFIG_BLK_CGROUP=y 20CONFIG_BLK_CGROUP=y
21CONFIG_NAMESPACES=y
17CONFIG_BLK_DEV_INITRD=y 22CONFIG_BLK_DEV_INITRD=y
18# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 23CONFIG_RD_BZIP2=y
24CONFIG_RD_LZMA=y
25CONFIG_RD_XZ=y
26CONFIG_RD_LZO=y
27CONFIG_EXPERT=y
19# CONFIG_COMPAT_BRK is not set 28# CONFIG_COMPAT_BRK is not set
20CONFIG_SLAB=y
21CONFIG_PROFILING=y 29CONFIG_PROFILING=y
22CONFIG_OPROFILE=y 30CONFIG_OPROFILE=y
23CONFIG_KPROBES=y 31CONFIG_KPROBES=y
24CONFIG_MODULES=y 32CONFIG_MODULES=y
25CONFIG_MODULE_UNLOAD=y 33CONFIG_MODULE_UNLOAD=y
26CONFIG_MODVERSIONS=y 34CONFIG_MODVERSIONS=y
35CONFIG_PARTITION_ADVANCED=y
36CONFIG_IBM_PARTITION=y
27CONFIG_DEFAULT_DEADLINE=y 37CONFIG_DEFAULT_DEADLINE=y
28CONFIG_NO_HZ=y 38CONFIG_NO_HZ=y
29CONFIG_HIGH_RES_TIMERS=y 39CONFIG_HIGH_RES_TIMERS=y
@@ -34,18 +44,15 @@ CONFIG_KSM=y
34CONFIG_BINFMT_MISC=m 44CONFIG_BINFMT_MISC=m
35CONFIG_CMM=m 45CONFIG_CMM=m
36CONFIG_HZ_100=y 46CONFIG_HZ_100=y
37CONFIG_KEXEC=y 47CONFIG_CRASH_DUMP=y
38CONFIG_PM=y
39CONFIG_HIBERNATION=y 48CONFIG_HIBERNATION=y
40CONFIG_PACKET=y 49CONFIG_PACKET=y
41CONFIG_UNIX=y 50CONFIG_UNIX=y
42CONFIG_NET_KEY=y 51CONFIG_NET_KEY=y
43CONFIG_AFIUCV=m
44CONFIG_INET=y 52CONFIG_INET=y
45CONFIG_IP_MULTICAST=y 53CONFIG_IP_MULTICAST=y
46# CONFIG_INET_LRO is not set 54# CONFIG_INET_LRO is not set
47CONFIG_IPV6=y 55CONFIG_IPV6=y
48CONFIG_NET_SCTPPROBE=m
49CONFIG_L2TP=m 56CONFIG_L2TP=m
50CONFIG_L2TP_DEBUGFS=m 57CONFIG_L2TP_DEBUGFS=m
51CONFIG_VLAN_8021Q=y 58CONFIG_VLAN_8021Q=y
@@ -84,15 +91,14 @@ CONFIG_SCSI_CONSTANTS=y
84CONFIG_SCSI_LOGGING=y 91CONFIG_SCSI_LOGGING=y
85CONFIG_SCSI_SCAN_ASYNC=y 92CONFIG_SCSI_SCAN_ASYNC=y
86CONFIG_ZFCP=y 93CONFIG_ZFCP=y
87CONFIG_ZFCP_DIF=y
88CONFIG_NETDEVICES=y 94CONFIG_NETDEVICES=y
89CONFIG_DUMMY=m
90CONFIG_BONDING=m 95CONFIG_BONDING=m
96CONFIG_DUMMY=m
91CONFIG_EQUALIZER=m 97CONFIG_EQUALIZER=m
92CONFIG_TUN=m 98CONFIG_TUN=m
93CONFIG_NET_ETHERNET=y
94CONFIG_VIRTIO_NET=y 99CONFIG_VIRTIO_NET=y
95CONFIG_RAW_DRIVER=m 100CONFIG_RAW_DRIVER=m
101CONFIG_VIRTIO_BALLOON=y
96CONFIG_EXT2_FS=y 102CONFIG_EXT2_FS=y
97CONFIG_EXT3_FS=y 103CONFIG_EXT3_FS=y
98# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 104# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
@@ -103,27 +109,21 @@ CONFIG_PROC_KCORE=y
103CONFIG_TMPFS=y 109CONFIG_TMPFS=y
104CONFIG_TMPFS_POSIX_ACL=y 110CONFIG_TMPFS_POSIX_ACL=y
105# CONFIG_NETWORK_FILESYSTEMS is not set 111# CONFIG_NETWORK_FILESYSTEMS is not set
106CONFIG_PARTITION_ADVANCED=y
107CONFIG_IBM_PARTITION=y
108CONFIG_DLM=m
109CONFIG_MAGIC_SYSRQ=y 112CONFIG_MAGIC_SYSRQ=y
110CONFIG_DEBUG_KERNEL=y
111CONFIG_TIMER_STATS=y 113CONFIG_TIMER_STATS=y
112CONFIG_PROVE_LOCKING=y 114CONFIG_PROVE_LOCKING=y
113CONFIG_PROVE_RCU=y 115CONFIG_PROVE_RCU=y
114CONFIG_LOCK_STAT=y 116CONFIG_LOCK_STAT=y
115CONFIG_DEBUG_LOCKDEP=y 117CONFIG_DEBUG_LOCKDEP=y
116CONFIG_DEBUG_SPINLOCK_SLEEP=y
117CONFIG_DEBUG_LIST=y 118CONFIG_DEBUG_LIST=y
118CONFIG_DEBUG_NOTIFIERS=y 119CONFIG_DEBUG_NOTIFIERS=y
119# CONFIG_RCU_CPU_STALL_DETECTOR is not set 120CONFIG_RCU_TRACE=y
120CONFIG_KPROBES_SANITY_TEST=y 121CONFIG_KPROBES_SANITY_TEST=y
121CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y 122CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y
122CONFIG_CPU_NOTIFIER_ERROR_INJECT=m 123CONFIG_CPU_NOTIFIER_ERROR_INJECT=m
123CONFIG_LATENCYTOP=y 124CONFIG_LATENCYTOP=y
124CONFIG_SYSCTL_SYSCALL_CHECK=y
125CONFIG_DEBUG_PAGEALLOC=y 125CONFIG_DEBUG_PAGEALLOC=y
126# CONFIG_FTRACE is not set 126CONFIG_BLK_DEV_IO_TRACE=y
127# CONFIG_STRICT_DEVMEM is not set 127# CONFIG_STRICT_DEVMEM is not set
128CONFIG_CRYPTO_NULL=m 128CONFIG_CRYPTO_NULL=m
129CONFIG_CRYPTO_CRYPTD=m 129CONFIG_CRYPTO_CRYPTD=m
@@ -155,7 +155,6 @@ CONFIG_CRYPTO_BLOWFISH=m
155CONFIG_CRYPTO_CAMELLIA=m 155CONFIG_CRYPTO_CAMELLIA=m
156CONFIG_CRYPTO_CAST5=m 156CONFIG_CRYPTO_CAST5=m
157CONFIG_CRYPTO_CAST6=m 157CONFIG_CRYPTO_CAST6=m
158CONFIG_CRYPTO_DES=m
159CONFIG_CRYPTO_FCRYPT=m 158CONFIG_CRYPTO_FCRYPT=m
160CONFIG_CRYPTO_KHAZAD=m 159CONFIG_CRYPTO_KHAZAD=m
161CONFIG_CRYPTO_SALSA20=m 160CONFIG_CRYPTO_SALSA20=m
@@ -173,4 +172,3 @@ CONFIG_CRYPTO_SHA512_S390=m
173CONFIG_CRYPTO_DES_S390=m 172CONFIG_CRYPTO_DES_S390=m
174CONFIG_CRYPTO_AES_S390=m 173CONFIG_CRYPTO_AES_S390=m
175CONFIG_CRC7=m 174CONFIG_CRC7=m
176CONFIG_VIRTIO_BALLOON=y
diff --git a/arch/s390/include/asm/barrier.h b/arch/s390/include/asm/barrier.h
index 451273ad4d34..10a508802940 100644
--- a/arch/s390/include/asm/barrier.h
+++ b/arch/s390/include/asm/barrier.h
@@ -11,25 +11,28 @@
11 * Force strict CPU ordering. 11 * Force strict CPU ordering.
12 * And yes, this is required on UP too when we're talking 12 * And yes, this is required on UP too when we're talking
13 * to devices. 13 * to devices.
14 *
15 * This is very similar to the ppc eieio/sync instruction in that is
16 * does a checkpoint syncronisation & makes sure that
17 * all memory ops have completed wrt other CPU's ( see 7-15 POP DJB ).
18 */ 14 */
19 15
20#define eieio() asm volatile("bcr 15,0" : : : "memory") 16static inline void mb(void)
21#define SYNC_OTHER_CORES(x) eieio() 17{
22#define mb() eieio() 18#ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
23#define rmb() eieio() 19 /* Fast-BCR without checkpoint synchronization */
24#define wmb() eieio() 20 asm volatile("bcr 14,0" : : : "memory");
25#define read_barrier_depends() do { } while(0) 21#else
26#define smp_mb() mb() 22 asm volatile("bcr 15,0" : : : "memory");
27#define smp_rmb() rmb() 23#endif
28#define smp_wmb() wmb() 24}
29#define smp_read_barrier_depends() read_barrier_depends() 25
30#define smp_mb__before_clear_bit() smp_mb() 26#define rmb() mb()
31#define smp_mb__after_clear_bit() smp_mb() 27#define wmb() mb()
28#define read_barrier_depends() do { } while(0)
29#define smp_mb() mb()
30#define smp_rmb() rmb()
31#define smp_wmb() wmb()
32#define smp_read_barrier_depends() read_barrier_depends()
33#define smp_mb__before_clear_bit() smp_mb()
34#define smp_mb__after_clear_bit() smp_mb()
32 35
33#define set_mb(var, value) do { var = value; mb(); } while (0) 36#define set_mb(var, value) do { var = value; mb(); } while (0)
34 37
35#endif /* __ASM_BARRIER_H */ 38#endif /* __ASM_BARRIER_H */
diff --git a/arch/s390/include/asm/ccwgroup.h b/arch/s390/include/asm/ccwgroup.h
index f2ea2c56a7e1..f2ef34f6d6e5 100644
--- a/arch/s390/include/asm/ccwgroup.h
+++ b/arch/s390/include/asm/ccwgroup.h
@@ -29,9 +29,7 @@ struct ccwgroup_device {
29 29
30/** 30/**
31 * struct ccwgroup_driver - driver for ccw group devices 31 * struct ccwgroup_driver - driver for ccw group devices
32 * @max_slaves: maximum number of slave devices 32 * @setup: function called during device creation to setup the device
33 * @driver_id: unique id
34 * @probe: function called on probe
35 * @remove: function called on remove 33 * @remove: function called on remove
36 * @set_online: function called when device is set online 34 * @set_online: function called when device is set online
37 * @set_offline: function called when device is set offline 35 * @set_offline: function called when device is set offline
@@ -44,10 +42,7 @@ struct ccwgroup_device {
44 * @driver: embedded driver structure 42 * @driver: embedded driver structure
45 */ 43 */
46struct ccwgroup_driver { 44struct ccwgroup_driver {
47 int max_slaves; 45 int (*setup) (struct ccwgroup_device *);
48 unsigned long driver_id;
49
50 int (*probe) (struct ccwgroup_device *);
51 void (*remove) (struct ccwgroup_device *); 46 void (*remove) (struct ccwgroup_device *);
52 int (*set_online) (struct ccwgroup_device *); 47 int (*set_online) (struct ccwgroup_device *);
53 int (*set_offline) (struct ccwgroup_device *); 48 int (*set_offline) (struct ccwgroup_device *);
@@ -63,9 +58,8 @@ struct ccwgroup_driver {
63 58
64extern int ccwgroup_driver_register (struct ccwgroup_driver *cdriver); 59extern int ccwgroup_driver_register (struct ccwgroup_driver *cdriver);
65extern void ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver); 60extern void ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver);
66int ccwgroup_create_from_string(struct device *root, unsigned int creator_id, 61int ccwgroup_create_dev(struct device *root, struct ccwgroup_driver *gdrv,
67 struct ccw_driver *cdrv, int num_devices, 62 int num_devices, const char *buf);
68 const char *buf);
69 63
70extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev); 64extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev);
71extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev); 65extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev);
diff --git a/arch/s390/include/asm/facility.h b/arch/s390/include/asm/facility.h
index 1e5b27edc0c9..2ee66a65f2d4 100644
--- a/arch/s390/include/asm/facility.h
+++ b/arch/s390/include/asm/facility.h
@@ -38,12 +38,11 @@ static inline void stfle(u64 *stfle_fac_list, int size)
38 unsigned long nr; 38 unsigned long nr;
39 39
40 preempt_disable(); 40 preempt_disable();
41 S390_lowcore.stfl_fac_list = 0;
42 asm volatile( 41 asm volatile(
43 " .insn s,0xb2b10000,0(0)\n" /* stfl */ 42 " .insn s,0xb2b10000,0(0)\n" /* stfl */
44 "0:\n" 43 "0:\n"
45 EX_TABLE(0b, 0b) 44 EX_TABLE(0b, 0b)
46 : "=m" (S390_lowcore.stfl_fac_list)); 45 : "+m" (S390_lowcore.stfl_fac_list));
47 nr = 4; /* bytes stored by stfl */ 46 nr = 4; /* bytes stored by stfl */
48 memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4); 47 memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4);
49 if (S390_lowcore.stfl_fac_list & 0x01000000) { 48 if (S390_lowcore.stfl_fac_list & 0x01000000) {
diff --git a/arch/s390/include/asm/io.h b/arch/s390/include/asm/io.h
index b7ff6afc3caa..27216d317991 100644
--- a/arch/s390/include/asm/io.h
+++ b/arch/s390/include/asm/io.h
@@ -38,11 +38,8 @@ static inline void * phys_to_virt(unsigned long address)
38 return (void *) address; 38 return (void *) address;
39} 39}
40 40
41/* 41void *xlate_dev_mem_ptr(unsigned long phys);
42 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 42void unxlate_dev_mem_ptr(unsigned long phys, void *addr);
43 * access
44 */
45#define xlate_dev_mem_ptr(p) __va(p)
46 43
47/* 44/*
48 * Convert a virtual cached pointer to an uncached pointer 45 * Convert a virtual cached pointer to an uncached pointer
diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h
index 8eef9b5b3cf4..78e3041919de 100644
--- a/arch/s390/include/asm/pgalloc.h
+++ b/arch/s390/include/asm/pgalloc.h
@@ -22,10 +22,7 @@ void crst_table_free(struct mm_struct *, unsigned long *);
22 22
23unsigned long *page_table_alloc(struct mm_struct *, unsigned long); 23unsigned long *page_table_alloc(struct mm_struct *, unsigned long);
24void page_table_free(struct mm_struct *, unsigned long *); 24void page_table_free(struct mm_struct *, unsigned long *);
25#ifdef CONFIG_HAVE_RCU_TABLE_FREE
26void page_table_free_rcu(struct mmu_gather *, unsigned long *); 25void page_table_free_rcu(struct mmu_gather *, unsigned long *);
27void __tlb_remove_table(void *_table);
28#endif
29 26
30static inline void clear_table(unsigned long *s, unsigned long val, size_t n) 27static inline void clear_table(unsigned long *s, unsigned long val, size_t n)
31{ 28{
diff --git a/arch/s390/include/asm/qdio.h b/arch/s390/include/asm/qdio.h
index d75c8e78f7e3..f039d86adf67 100644
--- a/arch/s390/include/asm/qdio.h
+++ b/arch/s390/include/asm/qdio.h
@@ -258,11 +258,6 @@ struct slsb {
258 u8 val[QDIO_MAX_BUFFERS_PER_Q]; 258 u8 val[QDIO_MAX_BUFFERS_PER_Q];
259} __attribute__ ((packed, aligned(256))); 259} __attribute__ ((packed, aligned(256)));
260 260
261#define CHSC_AC2_MULTI_BUFFER_AVAILABLE 0x0080
262#define CHSC_AC2_MULTI_BUFFER_ENABLED 0x0040
263#define CHSC_AC2_DATA_DIV_AVAILABLE 0x0010
264#define CHSC_AC2_DATA_DIV_ENABLED 0x0002
265
266/** 261/**
267 * struct qdio_outbuf_state - SBAL related asynchronous operation information 262 * struct qdio_outbuf_state - SBAL related asynchronous operation information
268 * (for communication with upper layer programs) 263 * (for communication with upper layer programs)
@@ -293,6 +288,8 @@ struct qdio_outbuf_state {
293#define AC1_SC_QEBSM_AVAILABLE 0x02 /* available for subchannel */ 288#define AC1_SC_QEBSM_AVAILABLE 0x02 /* available for subchannel */
294#define AC1_SC_QEBSM_ENABLED 0x01 /* enabled for subchannel */ 289#define AC1_SC_QEBSM_ENABLED 0x01 /* enabled for subchannel */
295 290
291#define CHSC_AC2_MULTI_BUFFER_AVAILABLE 0x0080
292#define CHSC_AC2_MULTI_BUFFER_ENABLED 0x0040
296#define CHSC_AC2_DATA_DIV_AVAILABLE 0x0010 293#define CHSC_AC2_DATA_DIV_AVAILABLE 0x0010
297#define CHSC_AC2_DATA_DIV_ENABLED 0x0002 294#define CHSC_AC2_DATA_DIV_ENABLED 0x0002
298 295
@@ -328,11 +325,13 @@ typedef void qdio_handler_t(struct ccw_device *, unsigned int, int,
328 int, int, unsigned long); 325 int, int, unsigned long);
329 326
330/* qdio errors reported to the upper-layer program */ 327/* qdio errors reported to the upper-layer program */
331#define QDIO_ERROR_SIGA_TARGET 0x02 328#define QDIO_ERROR_ACTIVATE 0x0001
332#define QDIO_ERROR_SIGA_ACCESS_EXCEPTION 0x10 329#define QDIO_ERROR_GET_BUF_STATE 0x0002
333#define QDIO_ERROR_SIGA_BUSY 0x20 330#define QDIO_ERROR_SET_BUF_STATE 0x0004
334#define QDIO_ERROR_ACTIVATE_CHECK_CONDITION 0x40 331#define QDIO_ERROR_SLSB_STATE 0x0100
335#define QDIO_ERROR_SLSB_STATE 0x80 332
333#define QDIO_ERROR_FATAL 0x00ff
334#define QDIO_ERROR_TEMPORARY 0xff00
336 335
337/* for qdio_cleanup */ 336/* for qdio_cleanup */
338#define QDIO_FLAG_CLEANUP_USING_CLEAR 0x01 337#define QDIO_FLAG_CLEANUP_USING_CLEAR 0x01
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
index b21e46e5d4b8..7244e1f64126 100644
--- a/arch/s390/include/asm/setup.h
+++ b/arch/s390/include/asm/setup.h
@@ -82,7 +82,6 @@ extern unsigned int user_mode;
82#define MACHINE_FLAG_LPAR (1UL << 12) 82#define MACHINE_FLAG_LPAR (1UL << 12)
83#define MACHINE_FLAG_SPP (1UL << 13) 83#define MACHINE_FLAG_SPP (1UL << 13)
84#define MACHINE_FLAG_TOPOLOGY (1UL << 14) 84#define MACHINE_FLAG_TOPOLOGY (1UL << 14)
85#define MACHINE_FLAG_STCKF (1UL << 15)
86 85
87#define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM) 86#define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM)
88#define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM) 87#define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM)
@@ -101,7 +100,6 @@ extern unsigned int user_mode;
101#define MACHINE_HAS_PFMF (0) 100#define MACHINE_HAS_PFMF (0)
102#define MACHINE_HAS_SPP (0) 101#define MACHINE_HAS_SPP (0)
103#define MACHINE_HAS_TOPOLOGY (0) 102#define MACHINE_HAS_TOPOLOGY (0)
104#define MACHINE_HAS_STCKF (0)
105#else /* __s390x__ */ 103#else /* __s390x__ */
106#define MACHINE_HAS_IEEE (1) 104#define MACHINE_HAS_IEEE (1)
107#define MACHINE_HAS_CSP (1) 105#define MACHINE_HAS_CSP (1)
@@ -113,7 +111,6 @@ extern unsigned int user_mode;
113#define MACHINE_HAS_PFMF (S390_lowcore.machine_flags & MACHINE_FLAG_PFMF) 111#define MACHINE_HAS_PFMF (S390_lowcore.machine_flags & MACHINE_FLAG_PFMF)
114#define MACHINE_HAS_SPP (S390_lowcore.machine_flags & MACHINE_FLAG_SPP) 112#define MACHINE_HAS_SPP (S390_lowcore.machine_flags & MACHINE_FLAG_SPP)
115#define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY) 113#define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY)
116#define MACHINE_HAS_STCKF (S390_lowcore.machine_flags & MACHINE_FLAG_STCKF)
117#endif /* __s390x__ */ 114#endif /* __s390x__ */
118 115
119#define ZFCPDUMP_HSA_SIZE (32UL<<20) 116#define ZFCPDUMP_HSA_SIZE (32UL<<20)
diff --git a/arch/s390/include/asm/smp.h b/arch/s390/include/asm/smp.h
index c77c6de6f6c0..0b6f586c1383 100644
--- a/arch/s390/include/asm/smp.h
+++ b/arch/s390/include/asm/smp.h
@@ -16,7 +16,7 @@
16extern struct mutex smp_cpu_state_mutex; 16extern struct mutex smp_cpu_state_mutex;
17extern struct save_area *zfcpdump_save_areas[NR_CPUS + 1]; 17extern struct save_area *zfcpdump_save_areas[NR_CPUS + 1];
18 18
19extern int __cpu_up(unsigned int cpu); 19extern int __cpu_up(unsigned int cpu, struct task_struct *tidle);
20 20
21extern void arch_send_call_function_single_ipi(int cpu); 21extern void arch_send_call_function_single_ipi(int cpu);
22extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 22extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
diff --git a/arch/s390/include/asm/swab.h b/arch/s390/include/asm/swab.h
index 6bdee21c077e..a3e4ebb32090 100644
--- a/arch/s390/include/asm/swab.h
+++ b/arch/s390/include/asm/swab.h
@@ -77,7 +77,7 @@ static inline __u16 __arch_swab16p(const __u16 *x)
77 77
78 asm volatile( 78 asm volatile(
79#ifndef __s390x__ 79#ifndef __s390x__
80 " icm %0,2,%O+1(%R1)\n" 80 " icm %0,2,%O1+1(%R1)\n"
81 " ic %0,%1\n" 81 " ic %0,%1\n"
82 : "=&d" (result) : "Q" (*x) : "cc"); 82 : "=&d" (result) : "Q" (*x) : "cc");
83#else /* __s390x__ */ 83#else /* __s390x__ */
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h
index a73038155e0d..003b04edcff6 100644
--- a/arch/s390/include/asm/thread_info.h
+++ b/arch/s390/include/asm/thread_info.h
@@ -95,7 +95,6 @@ static inline struct thread_info *current_thread_info(void)
95#define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */ 95#define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */
96#define TIF_SECCOMP 10 /* secure computing */ 96#define TIF_SECCOMP 10 /* secure computing */
97#define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */ 97#define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */
98#define TIF_SIE 12 /* guest execution active */
99#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling 98#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling
100 TIF_NEED_RESCHED */ 99 TIF_NEED_RESCHED */
101#define TIF_31BIT 17 /* 32bit process */ 100#define TIF_31BIT 17 /* 32bit process */
@@ -114,7 +113,6 @@ static inline struct thread_info *current_thread_info(void)
114#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 113#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
115#define _TIF_SECCOMP (1<<TIF_SECCOMP) 114#define _TIF_SECCOMP (1<<TIF_SECCOMP)
116#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) 115#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
117#define _TIF_SIE (1<<TIF_SIE)
118#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 116#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
119#define _TIF_31BIT (1<<TIF_31BIT) 117#define _TIF_31BIT (1<<TIF_31BIT)
120#define _TIF_SINGLE_STEP (1<<TIF_SINGLE_STEP) 118#define _TIF_SINGLE_STEP (1<<TIF_SINGLE_STEP)
diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
index c447a27a7fdb..239ece9e53c1 100644
--- a/arch/s390/include/asm/timex.h
+++ b/arch/s390/include/asm/timex.h
@@ -73,11 +73,15 @@ static inline void local_tick_enable(unsigned long long comp)
73 73
74typedef unsigned long long cycles_t; 74typedef unsigned long long cycles_t;
75 75
76static inline unsigned long long get_clock (void) 76static inline unsigned long long get_clock(void)
77{ 77{
78 unsigned long long clk; 78 unsigned long long clk;
79 79
80#ifdef CONFIG_HAVE_MARCH_Z9_109_FEATURES
81 asm volatile(".insn s,0xb27c0000,%0" : "=Q" (clk) : : "cc");
82#else
80 asm volatile("stck %0" : "=Q" (clk) : : "cc"); 83 asm volatile("stck %0" : "=Q" (clk) : : "cc");
84#endif
81 return clk; 85 return clk;
82} 86}
83 87
@@ -86,17 +90,6 @@ static inline void get_clock_ext(char *clk)
86 asm volatile("stcke %0" : "=Q" (*clk) : : "cc"); 90 asm volatile("stcke %0" : "=Q" (*clk) : : "cc");
87} 91}
88 92
89static inline unsigned long long get_clock_fast(void)
90{
91 unsigned long long clk;
92
93 if (MACHINE_HAS_STCKF)
94 asm volatile(".insn s,0xb27c0000,%0" : "=Q" (clk) : : "cc");
95 else
96 clk = get_clock();
97 return clk;
98}
99
100static inline unsigned long long get_clock_xt(void) 93static inline unsigned long long get_clock_xt(void)
101{ 94{
102 unsigned char clk[16]; 95 unsigned char clk[16];
diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h
index c687a2c83462..775a5eea8f9e 100644
--- a/arch/s390/include/asm/tlb.h
+++ b/arch/s390/include/asm/tlb.h
@@ -30,14 +30,10 @@
30 30
31struct mmu_gather { 31struct mmu_gather {
32 struct mm_struct *mm; 32 struct mm_struct *mm;
33#ifdef CONFIG_HAVE_RCU_TABLE_FREE
34 struct mmu_table_batch *batch; 33 struct mmu_table_batch *batch;
35#endif
36 unsigned int fullmm; 34 unsigned int fullmm;
37 unsigned int need_flush;
38}; 35};
39 36
40#ifdef CONFIG_HAVE_RCU_TABLE_FREE
41struct mmu_table_batch { 37struct mmu_table_batch {
42 struct rcu_head rcu; 38 struct rcu_head rcu;
43 unsigned int nr; 39 unsigned int nr;
@@ -49,7 +45,6 @@ struct mmu_table_batch {
49 45
50extern void tlb_table_flush(struct mmu_gather *tlb); 46extern void tlb_table_flush(struct mmu_gather *tlb);
51extern void tlb_remove_table(struct mmu_gather *tlb, void *table); 47extern void tlb_remove_table(struct mmu_gather *tlb, void *table);
52#endif
53 48
54static inline void tlb_gather_mmu(struct mmu_gather *tlb, 49static inline void tlb_gather_mmu(struct mmu_gather *tlb,
55 struct mm_struct *mm, 50 struct mm_struct *mm,
@@ -57,29 +52,20 @@ static inline void tlb_gather_mmu(struct mmu_gather *tlb,
57{ 52{
58 tlb->mm = mm; 53 tlb->mm = mm;
59 tlb->fullmm = full_mm_flush; 54 tlb->fullmm = full_mm_flush;
60 tlb->need_flush = 0;
61#ifdef CONFIG_HAVE_RCU_TABLE_FREE
62 tlb->batch = NULL; 55 tlb->batch = NULL;
63#endif
64 if (tlb->fullmm) 56 if (tlb->fullmm)
65 __tlb_flush_mm(mm); 57 __tlb_flush_mm(mm);
66} 58}
67 59
68static inline void tlb_flush_mmu(struct mmu_gather *tlb) 60static inline void tlb_flush_mmu(struct mmu_gather *tlb)
69{ 61{
70 if (!tlb->need_flush)
71 return;
72 tlb->need_flush = 0;
73 __tlb_flush_mm(tlb->mm);
74#ifdef CONFIG_HAVE_RCU_TABLE_FREE
75 tlb_table_flush(tlb); 62 tlb_table_flush(tlb);
76#endif
77} 63}
78 64
79static inline void tlb_finish_mmu(struct mmu_gather *tlb, 65static inline void tlb_finish_mmu(struct mmu_gather *tlb,
80 unsigned long start, unsigned long end) 66 unsigned long start, unsigned long end)
81{ 67{
82 tlb_flush_mmu(tlb); 68 tlb_table_flush(tlb);
83} 69}
84 70
85/* 71/*
@@ -105,10 +91,8 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
105static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, 91static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
106 unsigned long address) 92 unsigned long address)
107{ 93{
108#ifdef CONFIG_HAVE_RCU_TABLE_FREE
109 if (!tlb->fullmm) 94 if (!tlb->fullmm)
110 return page_table_free_rcu(tlb, (unsigned long *) pte); 95 return page_table_free_rcu(tlb, (unsigned long *) pte);
111#endif
112 page_table_free(tlb->mm, (unsigned long *) pte); 96 page_table_free(tlb->mm, (unsigned long *) pte);
113} 97}
114 98
@@ -125,10 +109,8 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
125#ifdef __s390x__ 109#ifdef __s390x__
126 if (tlb->mm->context.asce_limit <= (1UL << 31)) 110 if (tlb->mm->context.asce_limit <= (1UL << 31))
127 return; 111 return;
128#ifdef CONFIG_HAVE_RCU_TABLE_FREE
129 if (!tlb->fullmm) 112 if (!tlb->fullmm)
130 return tlb_remove_table(tlb, pmd); 113 return tlb_remove_table(tlb, pmd);
131#endif
132 crst_table_free(tlb->mm, (unsigned long *) pmd); 114 crst_table_free(tlb->mm, (unsigned long *) pmd);
133#endif 115#endif
134} 116}
@@ -146,10 +128,8 @@ static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud,
146#ifdef __s390x__ 128#ifdef __s390x__
147 if (tlb->mm->context.asce_limit <= (1UL << 42)) 129 if (tlb->mm->context.asce_limit <= (1UL << 42))
148 return; 130 return;
149#ifdef CONFIG_HAVE_RCU_TABLE_FREE
150 if (!tlb->fullmm) 131 if (!tlb->fullmm)
151 return tlb_remove_table(tlb, pud); 132 return tlb_remove_table(tlb, pud);
152#endif
153 crst_table_free(tlb->mm, (unsigned long *) pud); 133 crst_table_free(tlb->mm, (unsigned long *) pud);
154#endif 134#endif
155} 135}
diff --git a/arch/s390/kernel/.gitignore b/arch/s390/kernel/.gitignore
new file mode 100644
index 000000000000..c5f676c3c224
--- /dev/null
+++ b/arch/s390/kernel/.gitignore
@@ -0,0 +1 @@
vmlinux.lds
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 884b18afc864..9733b3f0eb6d 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -28,7 +28,7 @@ obj-y := bitmap.o traps.o time.o process.o base.o early.o setup.o vtime.o \
28obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o) 28obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o)
29obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) 29obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o)
30 30
31extra-y += head.o init_task.o vmlinux.lds 31extra-y += head.o vmlinux.lds
32extra-y += $(if $(CONFIG_64BIT),head64.o,head31.o) 32extra-y += $(if $(CONFIG_64BIT),head64.o,head31.o)
33 33
34obj-$(CONFIG_MODULES) += s390_ksyms.o module.o 34obj-$(CONFIG_MODULES) += s390_ksyms.o module.o
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index 28040fd5e8a2..377c096ca4a7 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -437,13 +437,6 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
437 sp = current->sas_ss_sp + current->sas_ss_size; 437 sp = current->sas_ss_sp + current->sas_ss_size;
438 } 438 }
439 439
440 /* This is the legacy signal stack switching. */
441 else if (!user_mode(regs) &&
442 !(ka->sa.sa_flags & SA_RESTORER) &&
443 ka->sa.sa_restorer) {
444 sp = (unsigned long) ka->sa.sa_restorer;
445 }
446
447 return (void __user *)((sp - frame_size) & -8ul); 440 return (void __user *)((sp - frame_size) & -8ul);
448} 441}
449 442
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index 9475e682727f..d84181f1f5e8 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -374,8 +374,6 @@ static __init void detect_machine_facilities(void)
374 S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS; 374 S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS;
375 if (test_facility(40)) 375 if (test_facility(40))
376 S390_lowcore.machine_flags |= MACHINE_FLAG_SPP; 376 S390_lowcore.machine_flags |= MACHINE_FLAG_SPP;
377 if (test_facility(25))
378 S390_lowcore.machine_flags |= MACHINE_FLAG_STCKF;
379#endif 377#endif
380} 378}
381 379
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 74ee563fe62b..1ae93b573d7d 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -145,22 +145,23 @@ STACK_SIZE = 1 << STACK_SHIFT
145 * gpr2 = prev 145 * gpr2 = prev
146 */ 146 */
147ENTRY(__switch_to) 147ENTRY(__switch_to)
148 stm %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task
149 st %r15,__THREAD_ksp(%r2) # store kernel stack of prev
148 l %r4,__THREAD_info(%r2) # get thread_info of prev 150 l %r4,__THREAD_info(%r2) # get thread_info of prev
149 l %r5,__THREAD_info(%r3) # get thread_info of next 151 l %r5,__THREAD_info(%r3) # get thread_info of next
152 lr %r15,%r5
153 ahi %r15,STACK_SIZE # end of kernel stack of next
154 st %r3,__LC_CURRENT # store task struct of next
155 st %r5,__LC_THREAD_INFO # store thread info of next
156 st %r15,__LC_KERNEL_STACK # store end of kernel stack
157 lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4
158 mvc __LC_CURRENT_PID(4,%r0),__TASK_pid(%r3) # store pid of next
159 l %r15,__THREAD_ksp(%r3) # load kernel stack of next
150 tm __TI_flags+3(%r4),_TIF_MCCK_PENDING # machine check pending? 160 tm __TI_flags+3(%r4),_TIF_MCCK_PENDING # machine check pending?
151 jz 0f 161 jz 0f
152 ni __TI_flags+3(%r4),255-_TIF_MCCK_PENDING # clear flag in prev 162 ni __TI_flags+3(%r4),255-_TIF_MCCK_PENDING # clear flag in prev
153 oi __TI_flags+3(%r5),_TIF_MCCK_PENDING # set it in next 163 oi __TI_flags+3(%r5),_TIF_MCCK_PENDING # set it in next
1540: stm %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task 1640: lm %r6,%r15,__SF_GPRS(%r15) # load gprs of next task
155 st %r15,__THREAD_ksp(%r2) # store kernel stack of prev
156 l %r15,__THREAD_ksp(%r3) # load kernel stack of next
157 lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4
158 lm %r6,%r15,__SF_GPRS(%r15) # load gprs of next task
159 st %r3,__LC_CURRENT # store task struct of next
160 mvc __LC_CURRENT_PID(4,%r0),__TASK_pid(%r3) # store pid of next
161 st %r5,__LC_THREAD_INFO # store thread info of next
162 ahi %r5,STACK_SIZE # end of kernel stack of next
163 st %r5,__LC_KERNEL_STACK # store end of kernel stack
164 br %r14 165 br %r14
165 166
166__critical_start: 167__critical_start:
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 4e1c292fa7e3..229fe1d07749 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -81,16 +81,14 @@ _TIF_EXIT_SIE = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING)
81 81
82 .macro HANDLE_SIE_INTERCEPT scratch 82 .macro HANDLE_SIE_INTERCEPT scratch
83#if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE) 83#if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE)
84 tm __TI_flags+6(%r12),_TIF_SIE>>8 84 tmhh %r8,0x0001 # interrupting from user ?
85 jz .+42 85 jnz .+42
86 tm __LC_MACHINE_FLAGS+6,0x20 # MACHINE_FLAG_SPP
87 jz .+8
88 .insn s,0xb2800000,BASED(.Lhost_id) # set host id
89 lgr \scratch,%r9 86 lgr \scratch,%r9
90 slg \scratch,BASED(.Lsie_loop) 87 slg \scratch,BASED(.Lsie_loop)
91 clg \scratch,BASED(.Lsie_length) 88 clg \scratch,BASED(.Lsie_length)
92 jhe .+10 89 jhe .+22
93 lg %r9,BASED(.Lsie_loop) 90 lg %r9,BASED(.Lsie_loop)
91 SPP BASED(.Lhost_id) # set host id
94#endif 92#endif
95 .endm 93 .endm
96 94
@@ -148,6 +146,14 @@ _TIF_EXIT_SIE = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING)
148 ssm __LC_RETURN_PSW 146 ssm __LC_RETURN_PSW
149 .endm 147 .endm
150 148
149 .macro STCK savearea
150#ifdef CONFIG_HAVE_MARCH_Z9_109_FEATURES
151 .insn s,0xb27c0000,\savearea # store clock fast
152#else
153 .insn s,0xb2050000,\savearea # store clock
154#endif
155 .endm
156
151 .section .kprobes.text, "ax" 157 .section .kprobes.text, "ax"
152 158
153/* 159/*
@@ -158,22 +164,23 @@ _TIF_EXIT_SIE = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING)
158 * gpr2 = prev 164 * gpr2 = prev
159 */ 165 */
160ENTRY(__switch_to) 166ENTRY(__switch_to)
167 stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task
168 stg %r15,__THREAD_ksp(%r2) # store kernel stack of prev
161 lg %r4,__THREAD_info(%r2) # get thread_info of prev 169 lg %r4,__THREAD_info(%r2) # get thread_info of prev
162 lg %r5,__THREAD_info(%r3) # get thread_info of next 170 lg %r5,__THREAD_info(%r3) # get thread_info of next
171 lgr %r15,%r5
172 aghi %r15,STACK_SIZE # end of kernel stack of next
173 stg %r3,__LC_CURRENT # store task struct of next
174 stg %r5,__LC_THREAD_INFO # store thread info of next
175 stg %r15,__LC_KERNEL_STACK # store end of kernel stack
176 lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4
177 mvc __LC_CURRENT_PID+4(4,%r0),__TASK_pid(%r3) # store pid of next
178 lg %r15,__THREAD_ksp(%r3) # load kernel stack of next
163 tm __TI_flags+7(%r4),_TIF_MCCK_PENDING # machine check pending? 179 tm __TI_flags+7(%r4),_TIF_MCCK_PENDING # machine check pending?
164 jz 0f 180 jz 0f
165 ni __TI_flags+7(%r4),255-_TIF_MCCK_PENDING # clear flag in prev 181 ni __TI_flags+7(%r4),255-_TIF_MCCK_PENDING # clear flag in prev
166 oi __TI_flags+7(%r5),_TIF_MCCK_PENDING # set it in next 182 oi __TI_flags+7(%r5),_TIF_MCCK_PENDING # set it in next
1670: stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task 1830: lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task
168 stg %r15,__THREAD_ksp(%r2) # store kernel stack of prev
169 lg %r15,__THREAD_ksp(%r3) # load kernel stack of next
170 lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4
171 lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task
172 stg %r3,__LC_CURRENT # store task struct of next
173 mvc __LC_CURRENT_PID+4(4,%r0),__TASK_pid(%r3) # store pid of next
174 stg %r5,__LC_THREAD_INFO # store thread info of next
175 aghi %r5,STACK_SIZE # end of kernel stack of next
176 stg %r5,__LC_KERNEL_STACK # store end of kernel stack
177 br %r14 184 br %r14
178 185
179__critical_start: 186__critical_start:
@@ -458,7 +465,7 @@ pgm_svcper:
458 * IO interrupt handler routine 465 * IO interrupt handler routine
459 */ 466 */
460ENTRY(io_int_handler) 467ENTRY(io_int_handler)
461 stck __LC_INT_CLOCK 468 STCK __LC_INT_CLOCK
462 stpt __LC_ASYNC_ENTER_TIMER 469 stpt __LC_ASYNC_ENTER_TIMER
463 stmg %r8,%r15,__LC_SAVE_AREA_ASYNC 470 stmg %r8,%r15,__LC_SAVE_AREA_ASYNC
464 lg %r10,__LC_LAST_BREAK 471 lg %r10,__LC_LAST_BREAK
@@ -604,7 +611,7 @@ io_notify_resume:
604 * External interrupt handler routine 611 * External interrupt handler routine
605 */ 612 */
606ENTRY(ext_int_handler) 613ENTRY(ext_int_handler)
607 stck __LC_INT_CLOCK 614 STCK __LC_INT_CLOCK
608 stpt __LC_ASYNC_ENTER_TIMER 615 stpt __LC_ASYNC_ENTER_TIMER
609 stmg %r8,%r15,__LC_SAVE_AREA_ASYNC 616 stmg %r8,%r15,__LC_SAVE_AREA_ASYNC
610 lg %r10,__LC_LAST_BREAK 617 lg %r10,__LC_LAST_BREAK
@@ -622,6 +629,7 @@ ext_skip:
622 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC 629 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC
623 stmg %r8,%r9,__PT_PSW(%r11) 630 stmg %r8,%r9,__PT_PSW(%r11)
624 TRACE_IRQS_OFF 631 TRACE_IRQS_OFF
632 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
625 lghi %r1,4096 633 lghi %r1,4096
626 lgr %r2,%r11 # pass pointer to pt_regs 634 lgr %r2,%r11 # pass pointer to pt_regs
627 llgf %r3,__LC_EXT_CPU_ADDR # get cpu address + interruption code 635 llgf %r3,__LC_EXT_CPU_ADDR # get cpu address + interruption code
@@ -638,7 +646,7 @@ ENTRY(psw_idle)
638 larl %r1,psw_idle_lpsw+4 646 larl %r1,psw_idle_lpsw+4
639 stg %r1,__SF_EMPTY+8(%r15) 647 stg %r1,__SF_EMPTY+8(%r15)
640 larl %r1,.Lvtimer_max 648 larl %r1,.Lvtimer_max
641 stck __IDLE_ENTER(%r2) 649 STCK __IDLE_ENTER(%r2)
642 ltr %r5,%r5 650 ltr %r5,%r5
643 stpt __VQ_IDLE_ENTER(%r3) 651 stpt __VQ_IDLE_ENTER(%r3)
644 jz psw_idle_lpsw 652 jz psw_idle_lpsw
@@ -654,7 +662,7 @@ __critical_end:
654 * Machine check handler routines 662 * Machine check handler routines
655 */ 663 */
656ENTRY(mcck_int_handler) 664ENTRY(mcck_int_handler)
657 stck __LC_MCCK_CLOCK 665 STCK __LC_MCCK_CLOCK
658 la %r1,4095 # revalidate r1 666 la %r1,4095 # revalidate r1
659 spt __LC_CPU_TIMER_SAVE_AREA-4095(%r1) # revalidate cpu timer 667 spt __LC_CPU_TIMER_SAVE_AREA-4095(%r1) # revalidate cpu timer
660 lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)# revalidate gprs 668 lmg %r0,%r15,__LC_GPREGS_SAVE_AREA-4095(%r1)# revalidate gprs
@@ -967,7 +975,6 @@ ENTRY(sie64a)
967 xc __SF_EMPTY+16(8,%r15),__SF_EMPTY+16(%r15) # host id == 0 975 xc __SF_EMPTY+16(8,%r15),__SF_EMPTY+16(%r15) # host id == 0
968 lmg %r0,%r13,0(%r3) # load guest gprs 0-13 976 lmg %r0,%r13,0(%r3) # load guest gprs 0-13
969 lg %r14,__LC_THREAD_INFO # pointer thread_info struct 977 lg %r14,__LC_THREAD_INFO # pointer thread_info struct
970 oi __TI_flags+6(%r14),_TIF_SIE>>8
971sie_loop: 978sie_loop:
972 lg %r14,__LC_THREAD_INFO # pointer thread_info struct 979 lg %r14,__LC_THREAD_INFO # pointer thread_info struct
973 tm __TI_flags+7(%r14),_TIF_EXIT_SIE 980 tm __TI_flags+7(%r14),_TIF_EXIT_SIE
@@ -985,7 +992,6 @@ sie_done:
985 lg %r14,__LC_THREAD_INFO # pointer thread_info struct 992 lg %r14,__LC_THREAD_INFO # pointer thread_info struct
986sie_exit: 993sie_exit:
987 lctlg %c1,%c1,__LC_USER_ASCE # load primary asce 994 lctlg %c1,%c1,__LC_USER_ASCE # load primary asce
988 ni __TI_flags+6(%r14),255-(_TIF_SIE>>8)
989 lg %r14,__SF_EMPTY+8(%r15) # load guest register save area 995 lg %r14,__SF_EMPTY+8(%r15) # load guest register save area
990 stmg %r0,%r13,0(%r14) # save guest gprs 0-13 996 stmg %r0,%r13,0(%r14) # save guest gprs 0-13
991 lmg %r6,%r14,__SF_GPRS(%r15) # restore kernel registers 997 lmg %r6,%r14,__SF_GPRS(%r15) # restore kernel registers
@@ -994,7 +1000,6 @@ sie_exit:
994sie_fault: 1000sie_fault:
995 lctlg %c1,%c1,__LC_USER_ASCE # load primary asce 1001 lctlg %c1,%c1,__LC_USER_ASCE # load primary asce
996 lg %r14,__LC_THREAD_INFO # pointer thread_info struct 1002 lg %r14,__LC_THREAD_INFO # pointer thread_info struct
997 ni __TI_flags+6(%r14),255-(_TIF_SIE>>8)
998 lg %r14,__SF_EMPTY+8(%r15) # load guest register save area 1003 lg %r14,__SF_EMPTY+8(%r15) # load guest register save area
999 stmg %r0,%r13,0(%r14) # save guest gprs 0-13 1004 stmg %r0,%r13,0(%r14) # save guest gprs 0-13
1000 lmg %r6,%r14,__SF_GPRS(%r15) # restore kernel registers 1005 lmg %r6,%r14,__SF_GPRS(%r15) # restore kernel registers
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
index c27a0727f930..4939d15375aa 100644
--- a/arch/s390/kernel/head.S
+++ b/arch/s390/kernel/head.S
@@ -34,125 +34,7 @@
34#endif 34#endif
35 35
36__HEAD 36__HEAD
37#ifndef CONFIG_IPL
38 .org 0
39 .long 0x00080000,0x80000000+startup # Just a restart PSW
40#else
41#ifdef CONFIG_IPL_TAPE
42#define IPL_BS 1024
43 .org 0
44 .long 0x00080000,0x80000000+iplstart # The first 24 bytes are loaded
45 .long 0x27000000,0x60000001 # by ipl to addresses 0-23.
46 .long 0x02000000,0x20000000+IPL_BS # (a PSW and two CCWs).
47 .long 0x00000000,0x00000000 # external old psw
48 .long 0x00000000,0x00000000 # svc old psw
49 .long 0x00000000,0x00000000 # program check old psw
50 .long 0x00000000,0x00000000 # machine check old psw
51 .long 0x00000000,0x00000000 # io old psw
52 .long 0x00000000,0x00000000
53 .long 0x00000000,0x00000000
54 .long 0x00000000,0x00000000
55 .long 0x000a0000,0x00000058 # external new psw
56 .long 0x000a0000,0x00000060 # svc new psw
57 .long 0x000a0000,0x00000068 # program check new psw
58 .long 0x000a0000,0x00000070 # machine check new psw
59 .long 0x00080000,0x80000000+.Lioint # io new psw
60 37
61 .org 0x100
62#
63# subroutine for loading from tape
64# Parameters:
65# R1 = device number
66# R2 = load address
67.Lloader:
68 st %r14,.Lldret
69 la %r3,.Lorbread # r3 = address of orb
70 la %r5,.Lirb # r5 = address of irb
71 st %r2,.Lccwread+4 # initialize CCW data addresses
72 lctl %c6,%c6,.Lcr6
73 slr %r2,%r2
74.Lldlp:
75 la %r6,3 # 3 retries
76.Lssch:
77 ssch 0(%r3) # load chunk of IPL_BS bytes
78 bnz .Llderr
79.Lw4end:
80 bas %r14,.Lwait4io
81 tm 8(%r5),0x82 # do we have a problem ?
82 bnz .Lrecov
83 slr %r7,%r7
84 icm %r7,3,10(%r5) # get residual count
85 lcr %r7,%r7
86 la %r7,IPL_BS(%r7) # IPL_BS-residual=#bytes read
87 ar %r2,%r7 # add to total size
88 tm 8(%r5),0x01 # found a tape mark ?
89 bnz .Ldone
90 l %r0,.Lccwread+4 # update CCW data addresses
91 ar %r0,%r7
92 st %r0,.Lccwread+4
93 b .Lldlp
94.Ldone:
95 l %r14,.Lldret
96 br %r14 # r2 contains the total size
97.Lrecov:
98 bas %r14,.Lsense # do the sensing
99 bct %r6,.Lssch # dec. retry count & branch
100 b .Llderr
101#
102# Sense subroutine
103#
104.Lsense:
105 st %r14,.Lsnsret
106 la %r7,.Lorbsense
107 ssch 0(%r7) # start sense command
108 bnz .Llderr
109 bas %r14,.Lwait4io
110 l %r14,.Lsnsret
111 tm 8(%r5),0x82 # do we have a problem ?
112 bnz .Llderr
113 br %r14
114#
115# Wait for interrupt subroutine
116#
117.Lwait4io:
118 lpsw .Lwaitpsw
119.Lioint:
120 c %r1,0xb8 # compare subchannel number
121 bne .Lwait4io
122 tsch 0(%r5)
123 slr %r0,%r0
124 tm 8(%r5),0x82 # do we have a problem ?
125 bnz .Lwtexit
126 tm 8(%r5),0x04 # got device end ?
127 bz .Lwait4io
128.Lwtexit:
129 br %r14
130.Llderr:
131 lpsw .Lcrash
132
133 .align 8
134.Lorbread:
135 .long 0x00000000,0x0080ff00,.Lccwread
136 .align 8
137.Lorbsense:
138 .long 0x00000000,0x0080ff00,.Lccwsense
139 .align 8
140.Lccwread:
141 .long 0x02200000+IPL_BS,0x00000000
142.Lccwsense:
143 .long 0x04200001,0x00000000
144.Lwaitpsw:
145 .long 0x020a0000,0x80000000+.Lioint
146
147.Lirb: .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
148.Lcr6: .long 0xff000000
149 .align 8
150.Lcrash:.long 0x000a0000,0x00000000
151.Lldret:.long 0
152.Lsnsret: .long 0
153#endif /* CONFIG_IPL_TAPE */
154
155#ifdef CONFIG_IPL_VM
156#define IPL_BS 0x730 38#define IPL_BS 0x730
157 .org 0 39 .org 0
158 .long 0x00080000,0x80000000+iplstart # The first 24 bytes are loaded 40 .long 0x00080000,0x80000000+iplstart # The first 24 bytes are loaded
@@ -256,7 +138,6 @@ __HEAD
256 .long 0x02600050,0x00000000 138 .long 0x02600050,0x00000000
257 .endr 139 .endr
258 .long 0x02200050,0x00000000 140 .long 0x02200050,0x00000000
259#endif /* CONFIG_IPL_VM */
260 141
261iplstart: 142iplstart:
262 lh %r1,0xb8 # test if subchannel number 143 lh %r1,0xb8 # test if subchannel number
@@ -325,7 +206,6 @@ iplstart:
325 clc 0(3,%r2),.L_eof 206 clc 0(3,%r2),.L_eof
326 bz .Lagain2 207 bz .Lagain2
327 208
328#ifdef CONFIG_IPL_VM
329# 209#
330# reset files in VM reader 210# reset files in VM reader
331# 211#
@@ -358,7 +238,6 @@ iplstart:
358 .long 0x00080000,0x80000000+.Lrdrint 238 .long 0x00080000,0x80000000+.Lrdrint
359.Lrdrwaitpsw: 239.Lrdrwaitpsw:
360 .long 0x020a0000,0x80000000+.Lrdrint 240 .long 0x020a0000,0x80000000+.Lrdrint
361#endif
362 241
363# 242#
364# everything loaded, go for it 243# everything loaded, go for it
@@ -376,8 +255,6 @@ iplstart:
376.L_eof: .long 0xc5d6c600 /* C'EOF' */ 255.L_eof: .long 0xc5d6c600 /* C'EOF' */
377.L_hdr: .long 0xc8c4d900 /* C'HDR' */ 256.L_hdr: .long 0xc8c4d900 /* C'HDR' */
378 257
379#endif /* CONFIG_IPL */
380
381# 258#
382# SALIPL loader support. Based on a patch by Rob van der Heij. 259# SALIPL loader support. Based on a patch by Rob van der Heij.
383# This entry point is called directly from the SALIPL loader and 260# This entry point is called directly from the SALIPL loader and
@@ -474,9 +351,9 @@ ENTRY(startup_kdump)
474 stck __LC_LAST_UPDATE_CLOCK 351 stck __LC_LAST_UPDATE_CLOCK
475 spt 5f-.LPG0(%r13) 352 spt 5f-.LPG0(%r13)
476 mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13) 353 mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13)
354 xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST
477#ifndef CONFIG_MARCH_G5 355#ifndef CONFIG_MARCH_G5
478 # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10} 356 # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10}
479 xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST
480 .insn s,0xb2b10000,__LC_STFL_FAC_LIST # store facility list 357 .insn s,0xb2b10000,__LC_STFL_FAC_LIST # store facility list
481 tm __LC_STFL_FAC_LIST,0x01 # stfle available ? 358 tm __LC_STFL_FAC_LIST,0x01 # stfle available ?
482 jz 0f 359 jz 0f
diff --git a/arch/s390/kernel/init_task.c b/arch/s390/kernel/init_task.c
deleted file mode 100644
index 4d1c9fb0b540..000000000000
--- a/arch/s390/kernel/init_task.c
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * arch/s390/kernel/init_task.c
3 *
4 * S390 version
5 *
6 * Derived from "arch/i386/kernel/init_task.c"
7 */
8
9#include <linux/mm.h>
10#include <linux/fs.h>
11#include <linux/module.h>
12#include <linux/sched.h>
13#include <linux/init_task.h>
14#include <linux/mqueue.h>
15
16#include <asm/uaccess.h>
17#include <asm/pgtable.h>
18
19static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
20static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
21/*
22 * Initial thread structure.
23 *
24 * We need to make sure that this is THREAD_SIZE aligned due to the
25 * way process stacks are handled. This is done by having a special
26 * "init_task" linker map entry..
27 */
28union thread_union init_thread_union __init_task_data =
29 { INIT_THREAD_INFO(init_task) };
30
31/*
32 * Initial task structure.
33 *
34 * All other task structs will be allocated on slabs in fork.c
35 */
36struct task_struct init_task = INIT_TASK(init_task);
37
38EXPORT_SYMBOL(init_task);
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index 1c2cdd59ccd0..8a22c27219dd 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -118,9 +118,10 @@ asmlinkage void do_softirq(void)
118 "a" (__do_softirq) 118 "a" (__do_softirq)
119 : "0", "1", "2", "3", "4", "5", "14", 119 : "0", "1", "2", "3", "4", "5", "14",
120 "cc", "memory" ); 120 "cc", "memory" );
121 } else 121 } else {
122 /* We are already on the async stack. */ 122 /* We are already on the async stack. */
123 __do_softirq(); 123 __do_softirq();
124 }
124 } 125 }
125 126
126 local_irq_restore(flags); 127 local_irq_restore(flags);
@@ -192,11 +193,12 @@ int unregister_external_interrupt(u16 code, ext_int_handler_t handler)
192 int index = ext_hash(code); 193 int index = ext_hash(code);
193 194
194 spin_lock_irqsave(&ext_int_hash_lock, flags); 195 spin_lock_irqsave(&ext_int_hash_lock, flags);
195 list_for_each_entry_rcu(p, &ext_int_hash[index], entry) 196 list_for_each_entry_rcu(p, &ext_int_hash[index], entry) {
196 if (p->code == code && p->handler == handler) { 197 if (p->code == code && p->handler == handler) {
197 list_del_rcu(&p->entry); 198 list_del_rcu(&p->entry);
198 kfree_rcu(p, rcu); 199 kfree_rcu(p, rcu);
199 } 200 }
201 }
200 spin_unlock_irqrestore(&ext_int_hash_lock, flags); 202 spin_unlock_irqrestore(&ext_int_hash_lock, flags);
201 return 0; 203 return 0;
202} 204}
@@ -211,9 +213,10 @@ void __irq_entry do_extint(struct pt_regs *regs, struct ext_code ext_code,
211 213
212 old_regs = set_irq_regs(regs); 214 old_regs = set_irq_regs(regs);
213 irq_enter(); 215 irq_enter();
214 if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) 216 if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) {
215 /* Serve timer interrupts first. */ 217 /* Serve timer interrupts first. */
216 clock_comparator_work(); 218 clock_comparator_work();
219 }
217 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; 220 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++;
218 if (ext_code.code != 0x1004) 221 if (ext_code.code != 0x1004)
219 __get_cpu_var(s390_idle).nohz_delay = 1; 222 __get_cpu_var(s390_idle).nohz_delay = 1;
diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c
index 46405086479c..cb019f429e88 100644
--- a/arch/s390/kernel/perf_cpum_cf.c
+++ b/arch/s390/kernel/perf_cpum_cf.c
@@ -178,7 +178,7 @@ static void cpumf_pmu_enable(struct pmu *pmu)
178 err = lcctl(cpuhw->state); 178 err = lcctl(cpuhw->state);
179 if (err) { 179 if (err) {
180 pr_err("Enabling the performance measuring unit " 180 pr_err("Enabling the performance measuring unit "
181 "failed with rc=%lx\n", err); 181 "failed with rc=%x\n", err);
182 return; 182 return;
183 } 183 }
184 184
@@ -203,7 +203,7 @@ static void cpumf_pmu_disable(struct pmu *pmu)
203 err = lcctl(inactive); 203 err = lcctl(inactive);
204 if (err) { 204 if (err) {
205 pr_err("Disabling the performance measuring unit " 205 pr_err("Disabling the performance measuring unit "
206 "failed with rc=%lx\n", err); 206 "failed with rc=%x\n", err);
207 return; 207 return;
208 } 208 }
209 209
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 02f300fbf070..4993e689b2c2 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -719,7 +719,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
719 long ret = 0; 719 long ret = 0;
720 720
721 /* Do the secure computing check first. */ 721 /* Do the secure computing check first. */
722 secure_computing(regs->gprs[2]); 722 secure_computing_strict(regs->gprs[2]);
723 723
724 /* 724 /*
725 * The sysc_tracesys code in entry.S stored the system 725 * The sysc_tracesys code in entry.S stored the system
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index f7582b27f600..8a4e2b760d56 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -235,13 +235,6 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
235 sp = current->sas_ss_sp + current->sas_ss_size; 235 sp = current->sas_ss_sp + current->sas_ss_size;
236 } 236 }
237 237
238 /* This is the legacy signal stack switching. */
239 else if (!user_mode(regs) &&
240 !(ka->sa.sa_flags & SA_RESTORER) &&
241 ka->sa.sa_restorer) {
242 sp = (unsigned long) ka->sa.sa_restorer;
243 }
244
245 return (void __user *)((sp - frame_size) & -8ul); 238 return (void __user *)((sp - frame_size) & -8ul);
246} 239}
247 240
@@ -414,15 +407,6 @@ void do_signal(struct pt_regs *regs)
414 struct k_sigaction ka; 407 struct k_sigaction ka;
415 sigset_t *oldset; 408 sigset_t *oldset;
416 409
417 /*
418 * We want the common case to go fast, which
419 * is why we may in certain cases get here from
420 * kernel mode. Just return without doing anything
421 * if so.
422 */
423 if (!user_mode(regs))
424 return;
425
426 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 410 if (test_thread_flag(TIF_RESTORE_SIGMASK))
427 oldset = &current->saved_sigmask; 411 oldset = &current->saved_sigmask;
428 else 412 else
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 1f77227669e8..647ba9425893 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -85,7 +85,6 @@ enum {
85 85
86struct pcpu { 86struct pcpu {
87 struct cpu cpu; 87 struct cpu cpu;
88 struct task_struct *idle; /* idle process for the cpu */
89 struct _lowcore *lowcore; /* lowcore page(s) for the cpu */ 88 struct _lowcore *lowcore; /* lowcore page(s) for the cpu */
90 unsigned long async_stack; /* async stack for the cpu */ 89 unsigned long async_stack; /* async stack for the cpu */
91 unsigned long panic_stack; /* panic stack for the cpu */ 90 unsigned long panic_stack; /* panic stack for the cpu */
@@ -226,6 +225,8 @@ out:
226 return -ENOMEM; 225 return -ENOMEM;
227} 226}
228 227
228#ifdef CONFIG_HOTPLUG_CPU
229
229static void pcpu_free_lowcore(struct pcpu *pcpu) 230static void pcpu_free_lowcore(struct pcpu *pcpu)
230{ 231{
231 pcpu_sigp_retry(pcpu, sigp_set_prefix, 0); 232 pcpu_sigp_retry(pcpu, sigp_set_prefix, 0);
@@ -247,6 +248,8 @@ static void pcpu_free_lowcore(struct pcpu *pcpu)
247 } 248 }
248} 249}
249 250
251#endif /* CONFIG_HOTPLUG_CPU */
252
250static void pcpu_prepare_secondary(struct pcpu *pcpu, int cpu) 253static void pcpu_prepare_secondary(struct pcpu *pcpu, int cpu)
251{ 254{
252 struct _lowcore *lc = pcpu->lowcore; 255 struct _lowcore *lc = pcpu->lowcore;
@@ -721,26 +724,9 @@ static void __cpuinit smp_start_secondary(void *cpuvoid)
721 cpu_idle(); 724 cpu_idle();
722} 725}
723 726
724struct create_idle {
725 struct work_struct work;
726 struct task_struct *idle;
727 struct completion done;
728 int cpu;
729};
730
731static void __cpuinit smp_fork_idle(struct work_struct *work)
732{
733 struct create_idle *c_idle;
734
735 c_idle = container_of(work, struct create_idle, work);
736 c_idle->idle = fork_idle(c_idle->cpu);
737 complete(&c_idle->done);
738}
739
740/* Upping and downing of CPUs */ 727/* Upping and downing of CPUs */
741int __cpuinit __cpu_up(unsigned int cpu) 728int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
742{ 729{
743 struct create_idle c_idle;
744 struct pcpu *pcpu; 730 struct pcpu *pcpu;
745 int rc; 731 int rc;
746 732
@@ -750,22 +736,12 @@ int __cpuinit __cpu_up(unsigned int cpu)
750 if (pcpu_sigp_retry(pcpu, sigp_initial_cpu_reset, 0) != 736 if (pcpu_sigp_retry(pcpu, sigp_initial_cpu_reset, 0) !=
751 sigp_order_code_accepted) 737 sigp_order_code_accepted)
752 return -EIO; 738 return -EIO;
753 if (!pcpu->idle) { 739
754 c_idle.done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done);
755 INIT_WORK_ONSTACK(&c_idle.work, smp_fork_idle);
756 c_idle.cpu = cpu;
757 schedule_work(&c_idle.work);
758 wait_for_completion(&c_idle.done);
759 if (IS_ERR(c_idle.idle))
760 return PTR_ERR(c_idle.idle);
761 pcpu->idle = c_idle.idle;
762 }
763 init_idle(pcpu->idle, cpu);
764 rc = pcpu_alloc_lowcore(pcpu, cpu); 740 rc = pcpu_alloc_lowcore(pcpu, cpu);
765 if (rc) 741 if (rc)
766 return rc; 742 return rc;
767 pcpu_prepare_secondary(pcpu, cpu); 743 pcpu_prepare_secondary(pcpu, cpu);
768 pcpu_attach_task(pcpu, pcpu->idle); 744 pcpu_attach_task(pcpu, tidle);
769 pcpu_start_fn(pcpu, smp_start_secondary, NULL); 745 pcpu_start_fn(pcpu, smp_start_secondary, NULL);
770 while (!cpu_online(cpu)) 746 while (!cpu_online(cpu))
771 cpu_relax(); 747 cpu_relax();
@@ -852,7 +828,6 @@ void __init smp_prepare_boot_cpu(void)
852 struct pcpu *pcpu = pcpu_devices; 828 struct pcpu *pcpu = pcpu_devices;
853 829
854 boot_cpu_address = stap(); 830 boot_cpu_address = stap();
855 pcpu->idle = current;
856 pcpu->state = CPU_STATE_CONFIGURED; 831 pcpu->state = CPU_STATE_CONFIGURED;
857 pcpu->address = boot_cpu_address; 832 pcpu->address = boot_cpu_address;
858 pcpu->lowcore = (struct _lowcore *)(unsigned long) store_prefix(); 833 pcpu->lowcore = (struct _lowcore *)(unsigned long) store_prefix();
diff --git a/arch/s390/kernel/vdso32/.gitignore b/arch/s390/kernel/vdso32/.gitignore
new file mode 100644
index 000000000000..e45fba9d0ced
--- /dev/null
+++ b/arch/s390/kernel/vdso32/.gitignore
@@ -0,0 +1 @@
vdso32.lds
diff --git a/arch/s390/kernel/vdso64/.gitignore b/arch/s390/kernel/vdso64/.gitignore
new file mode 100644
index 000000000000..3fd18cf9fec2
--- /dev/null
+++ b/arch/s390/kernel/vdso64/.gitignore
@@ -0,0 +1 @@
vdso64.lds
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 46ef3fd0663b..72cec9ecd96c 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -294,7 +294,7 @@ static inline int do_exception(struct pt_regs *regs, int access)
294 down_read(&mm->mmap_sem); 294 down_read(&mm->mmap_sem);
295 295
296#ifdef CONFIG_PGSTE 296#ifdef CONFIG_PGSTE
297 if (test_tsk_thread_flag(current, TIF_SIE) && S390_lowcore.gmap) { 297 if ((current->flags & PF_VCPU) && S390_lowcore.gmap) {
298 address = __gmap_fault(address, 298 address = __gmap_fault(address,
299 (struct gmap *) S390_lowcore.gmap); 299 (struct gmap *) S390_lowcore.gmap);
300 if (address == -EFAULT) { 300 if (address == -EFAULT) {
@@ -549,19 +549,15 @@ static void pfault_interrupt(struct ext_code ext_code,
549 if ((subcode & 0xff00) != __SUBCODE_MASK) 549 if ((subcode & 0xff00) != __SUBCODE_MASK)
550 return; 550 return;
551 kstat_cpu(smp_processor_id()).irqs[EXTINT_PFL]++; 551 kstat_cpu(smp_processor_id()).irqs[EXTINT_PFL]++;
552 if (subcode & 0x0080) { 552 /* Get the token (= pid of the affected task). */
553 /* Get the token (= pid of the affected task). */ 553 pid = sizeof(void *) == 4 ? param32 : param64;
554 pid = sizeof(void *) == 4 ? param32 : param64; 554 rcu_read_lock();
555 rcu_read_lock(); 555 tsk = find_task_by_pid_ns(pid, &init_pid_ns);
556 tsk = find_task_by_pid_ns(pid, &init_pid_ns); 556 if (tsk)
557 if (tsk) 557 get_task_struct(tsk);
558 get_task_struct(tsk); 558 rcu_read_unlock();
559 rcu_read_unlock(); 559 if (!tsk)
560 if (!tsk) 560 return;
561 return;
562 } else {
563 tsk = current;
564 }
565 spin_lock(&pfault_lock); 561 spin_lock(&pfault_lock);
566 if (subcode & 0x0080) { 562 if (subcode & 0x0080) {
567 /* signal bit is set -> a page has been swapped in by VM */ 563 /* signal bit is set -> a page has been swapped in by VM */
@@ -574,6 +570,7 @@ static void pfault_interrupt(struct ext_code ext_code,
574 tsk->thread.pfault_wait = 0; 570 tsk->thread.pfault_wait = 0;
575 list_del(&tsk->thread.list); 571 list_del(&tsk->thread.list);
576 wake_up_process(tsk); 572 wake_up_process(tsk);
573 put_task_struct(tsk);
577 } else { 574 } else {
578 /* Completion interrupt was faster than initial 575 /* Completion interrupt was faster than initial
579 * interrupt. Set pfault_wait to -1 so the initial 576 * interrupt. Set pfault_wait to -1 so the initial
@@ -585,24 +582,35 @@ static void pfault_interrupt(struct ext_code ext_code,
585 if (tsk->state == TASK_RUNNING) 582 if (tsk->state == TASK_RUNNING)
586 tsk->thread.pfault_wait = -1; 583 tsk->thread.pfault_wait = -1;
587 } 584 }
588 put_task_struct(tsk);
589 } else { 585 } else {
590 /* signal bit not set -> a real page is missing. */ 586 /* signal bit not set -> a real page is missing. */
591 if (tsk->thread.pfault_wait == -1) { 587 if (WARN_ON_ONCE(tsk != current))
588 goto out;
589 if (tsk->thread.pfault_wait == 1) {
590 /* Already on the list with a reference: put to sleep */
591 __set_task_state(tsk, TASK_UNINTERRUPTIBLE);
592 set_tsk_need_resched(tsk);
593 } else if (tsk->thread.pfault_wait == -1) {
592 /* Completion interrupt was faster than the initial 594 /* Completion interrupt was faster than the initial
593 * interrupt (pfault_wait == -1). Set pfault_wait 595 * interrupt (pfault_wait == -1). Set pfault_wait
594 * back to zero and exit. */ 596 * back to zero and exit. */
595 tsk->thread.pfault_wait = 0; 597 tsk->thread.pfault_wait = 0;
596 } else { 598 } else {
597 /* Initial interrupt arrived before completion 599 /* Initial interrupt arrived before completion
598 * interrupt. Let the task sleep. */ 600 * interrupt. Let the task sleep.
601 * An extra task reference is needed since a different
602 * cpu may set the task state to TASK_RUNNING again
603 * before the scheduler is reached. */
604 get_task_struct(tsk);
599 tsk->thread.pfault_wait = 1; 605 tsk->thread.pfault_wait = 1;
600 list_add(&tsk->thread.list, &pfault_list); 606 list_add(&tsk->thread.list, &pfault_list);
601 set_task_state(tsk, TASK_UNINTERRUPTIBLE); 607 __set_task_state(tsk, TASK_UNINTERRUPTIBLE);
602 set_tsk_need_resched(tsk); 608 set_tsk_need_resched(tsk);
603 } 609 }
604 } 610 }
611out:
605 spin_unlock(&pfault_lock); 612 spin_unlock(&pfault_lock);
613 put_task_struct(tsk);
606} 614}
607 615
608static int __cpuinit pfault_cpu_notify(struct notifier_block *self, 616static int __cpuinit pfault_cpu_notify(struct notifier_block *self,
@@ -620,6 +628,7 @@ static int __cpuinit pfault_cpu_notify(struct notifier_block *self,
620 list_del(&thread->list); 628 list_del(&thread->list);
621 tsk = container_of(thread, struct task_struct, thread); 629 tsk = container_of(thread, struct task_struct, thread);
622 wake_up_process(tsk); 630 wake_up_process(tsk);
631 put_task_struct(tsk);
623 } 632 }
624 spin_unlock_irq(&pfault_lock); 633 spin_unlock_irq(&pfault_lock);
625 break; 634 break;
diff --git a/arch/s390/mm/hugetlbpage.c b/arch/s390/mm/hugetlbpage.c
index 597bb2d27c3c..900de2b3cf28 100644
--- a/arch/s390/mm/hugetlbpage.c
+++ b/arch/s390/mm/hugetlbpage.c
@@ -58,6 +58,8 @@ void arch_release_hugepage(struct page *page)
58 ptep = (pte_t *) page[1].index; 58 ptep = (pte_t *) page[1].index;
59 if (!ptep) 59 if (!ptep)
60 return; 60 return;
61 clear_table((unsigned long *) ptep, _PAGE_TYPE_EMPTY,
62 PTRS_PER_PTE * sizeof(pte_t));
61 page_table_free(&init_mm, (unsigned long *) ptep); 63 page_table_free(&init_mm, (unsigned long *) ptep);
62 page[1].index = 0; 64 page[1].index = 0;
63} 65}
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c
index 7bb15fcca75e..795a0a9bb2eb 100644
--- a/arch/s390/mm/maccess.c
+++ b/arch/s390/mm/maccess.c
@@ -12,6 +12,7 @@
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/gfp.h> 14#include <linux/gfp.h>
15#include <linux/cpu.h>
15#include <asm/ctl_reg.h> 16#include <asm/ctl_reg.h>
16 17
17/* 18/*
@@ -61,21 +62,14 @@ long probe_kernel_write(void *dst, const void *src, size_t size)
61 return copied < 0 ? -EFAULT : 0; 62 return copied < 0 ? -EFAULT : 0;
62} 63}
63 64
64/* 65static int __memcpy_real(void *dest, void *src, size_t count)
65 * Copy memory in real mode (kernel to kernel)
66 */
67int memcpy_real(void *dest, void *src, size_t count)
68{ 66{
69 register unsigned long _dest asm("2") = (unsigned long) dest; 67 register unsigned long _dest asm("2") = (unsigned long) dest;
70 register unsigned long _len1 asm("3") = (unsigned long) count; 68 register unsigned long _len1 asm("3") = (unsigned long) count;
71 register unsigned long _src asm("4") = (unsigned long) src; 69 register unsigned long _src asm("4") = (unsigned long) src;
72 register unsigned long _len2 asm("5") = (unsigned long) count; 70 register unsigned long _len2 asm("5") = (unsigned long) count;
73 unsigned long flags;
74 int rc = -EFAULT; 71 int rc = -EFAULT;
75 72
76 if (!count)
77 return 0;
78 flags = __arch_local_irq_stnsm(0xf8UL);
79 asm volatile ( 73 asm volatile (
80 "0: mvcle %1,%2,0x0\n" 74 "0: mvcle %1,%2,0x0\n"
81 "1: jo 0b\n" 75 "1: jo 0b\n"
@@ -86,7 +80,23 @@ int memcpy_real(void *dest, void *src, size_t count)
86 "+d" (_len2), "=m" (*((long *) dest)) 80 "+d" (_len2), "=m" (*((long *) dest))
87 : "m" (*((long *) src)) 81 : "m" (*((long *) src))
88 : "cc", "memory"); 82 : "cc", "memory");
89 arch_local_irq_restore(flags); 83 return rc;
84}
85
86/*
87 * Copy memory in real mode (kernel to kernel)
88 */
89int memcpy_real(void *dest, void *src, size_t count)
90{
91 unsigned long flags;
92 int rc;
93
94 if (!count)
95 return 0;
96 local_irq_save(flags);
97 __arch_local_irq_stnsm(0xfbUL);
98 rc = __memcpy_real(dest, src, count);
99 local_irq_restore(flags);
90 return rc; 100 return rc;
91} 101}
92 102
@@ -157,3 +167,69 @@ out:
157 free_page((unsigned long) buf); 167 free_page((unsigned long) buf);
158 return rc; 168 return rc;
159} 169}
170
171/*
172 * Check if physical address is within prefix or zero page
173 */
174static int is_swapped(unsigned long addr)
175{
176 unsigned long lc;
177 int cpu;
178
179 if (addr < sizeof(struct _lowcore))
180 return 1;
181 for_each_online_cpu(cpu) {
182 lc = (unsigned long) lowcore_ptr[cpu];
183 if (addr > lc + sizeof(struct _lowcore) - 1 || addr < lc)
184 continue;
185 return 1;
186 }
187 return 0;
188}
189
190/*
191 * Return swapped prefix or zero page address
192 */
193static unsigned long get_swapped(unsigned long addr)
194{
195 unsigned long prefix = store_prefix();
196
197 if (addr < sizeof(struct _lowcore))
198 return addr + prefix;
199 if (addr >= prefix && addr < prefix + sizeof(struct _lowcore))
200 return addr - prefix;
201 return addr;
202}
203
204/*
205 * Convert a physical pointer for /dev/mem access
206 *
207 * For swapped prefix pages a new buffer is returned that contains a copy of
208 * the absolute memory. The buffer size is maximum one page large.
209 */
210void *xlate_dev_mem_ptr(unsigned long addr)
211{
212 void *bounce = (void *) addr;
213 unsigned long size;
214
215 get_online_cpus();
216 preempt_disable();
217 if (is_swapped(addr)) {
218 size = PAGE_SIZE - (addr & ~PAGE_MASK);
219 bounce = (void *) __get_free_page(GFP_ATOMIC);
220 if (bounce)
221 memcpy_real(bounce, (void *) get_swapped(addr), size);
222 }
223 preempt_enable();
224 put_online_cpus();
225 return bounce;
226}
227
228/*
229 * Free converted buffer for /dev/mem access (if necessary)
230 */
231void unxlate_dev_mem_ptr(unsigned long addr, void *buf)
232{
233 if ((void *) addr != buf)
234 free_page((unsigned long) buf);
235}
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 373adf69b01c..a3db5a3ea083 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -678,8 +678,6 @@ void page_table_free(struct mm_struct *mm, unsigned long *table)
678 } 678 }
679} 679}
680 680
681#ifdef CONFIG_HAVE_RCU_TABLE_FREE
682
683static void __page_table_free_rcu(void *table, unsigned bit) 681static void __page_table_free_rcu(void *table, unsigned bit)
684{ 682{
685 struct page *page; 683 struct page *page;
@@ -733,7 +731,66 @@ void __tlb_remove_table(void *_table)
733 free_pages((unsigned long) table, ALLOC_ORDER); 731 free_pages((unsigned long) table, ALLOC_ORDER);
734} 732}
735 733
736#endif 734static void tlb_remove_table_smp_sync(void *arg)
735{
736 /* Simply deliver the interrupt */
737}
738
739static void tlb_remove_table_one(void *table)
740{
741 /*
742 * This isn't an RCU grace period and hence the page-tables cannot be
743 * assumed to be actually RCU-freed.
744 *
745 * It is however sufficient for software page-table walkers that rely
746 * on IRQ disabling. See the comment near struct mmu_table_batch.
747 */
748 smp_call_function(tlb_remove_table_smp_sync, NULL, 1);
749 __tlb_remove_table(table);
750}
751
752static void tlb_remove_table_rcu(struct rcu_head *head)
753{
754 struct mmu_table_batch *batch;
755 int i;
756
757 batch = container_of(head, struct mmu_table_batch, rcu);
758
759 for (i = 0; i < batch->nr; i++)
760 __tlb_remove_table(batch->tables[i]);
761
762 free_page((unsigned long)batch);
763}
764
765void tlb_table_flush(struct mmu_gather *tlb)
766{
767 struct mmu_table_batch **batch = &tlb->batch;
768
769 if (*batch) {
770 __tlb_flush_mm(tlb->mm);
771 call_rcu_sched(&(*batch)->rcu, tlb_remove_table_rcu);
772 *batch = NULL;
773 }
774}
775
776void tlb_remove_table(struct mmu_gather *tlb, void *table)
777{
778 struct mmu_table_batch **batch = &tlb->batch;
779
780 if (*batch == NULL) {
781 *batch = (struct mmu_table_batch *)
782 __get_free_page(GFP_NOWAIT | __GFP_NOWARN);
783 if (*batch == NULL) {
784 __tlb_flush_mm(tlb->mm);
785 tlb_remove_table_one(table);
786 return;
787 }
788 (*batch)->nr = 0;
789 }
790 (*batch)->tables[(*batch)->nr++] = table;
791 if ((*batch)->nr == MAX_TABLE_BATCH)
792 tlb_table_flush(tlb);
793}
737 794
738/* 795/*
739 * switch on pgstes for its userspace process (for kvm) 796 * switch on pgstes for its userspace process (for kvm)
@@ -765,6 +822,8 @@ int s390_enable_sie(void)
765 822
766 /* we copy the mm and let dup_mm create the page tables with_pgstes */ 823 /* we copy the mm and let dup_mm create the page tables with_pgstes */
767 tsk->mm->context.alloc_pgste = 1; 824 tsk->mm->context.alloc_pgste = 1;
825 /* make sure that both mms have a correct rss state */
826 sync_mm_rss(tsk->mm);
768 mm = dup_mm(tsk); 827 mm = dup_mm(tsk);
769 tsk->mm->context.alloc_pgste = 0; 828 tsk->mm->context.alloc_pgste = 0;
770 if (!mm) 829 if (!mm)
diff --git a/arch/score/include/asm/thread_info.h b/arch/score/include/asm/thread_info.h
index 2205c62284db..a18006e97f1c 100644
--- a/arch/score/include/asm/thread_info.h
+++ b/arch/score/include/asm/thread_info.h
@@ -11,10 +11,9 @@
11#include <linux/const.h> 11#include <linux/const.h>
12 12
13/* thread information allocation */ 13/* thread information allocation */
14#define THREAD_SIZE_ORDER (1) 14#define THREAD_SIZE_ORDER (1)
15#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) 15#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
16#define THREAD_MASK (THREAD_SIZE - _AC(1,UL)) 16#define THREAD_MASK (THREAD_SIZE - _AC(1,UL))
17#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
18 17
19#ifndef __ASSEMBLY__ 18#ifndef __ASSEMBLY__
20 19
@@ -71,9 +70,6 @@ struct thread_info {
71register struct thread_info *__current_thread_info __asm__("r28"); 70register struct thread_info *__current_thread_info __asm__("r28");
72#define current_thread_info() __current_thread_info 71#define current_thread_info() __current_thread_info
73 72
74#define alloc_thread_info_node(tsk, node) kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
75#define free_thread_info(info) kfree(info)
76
77#endif /* !__ASSEMBLY__ */ 73#endif /* !__ASSEMBLY__ */
78 74
79#define PREEMPT_ACTIVE 0x10000000 75#define PREEMPT_ACTIVE 0x10000000
diff --git a/arch/score/kernel/Makefile b/arch/score/kernel/Makefile
index f218673b5d3d..fb1802b3f542 100644
--- a/arch/score/kernel/Makefile
+++ b/arch/score/kernel/Makefile
@@ -4,7 +4,7 @@
4 4
5extra-y := head.o vmlinux.lds 5extra-y := head.o vmlinux.lds
6 6
7obj-y += entry.o init_task.o irq.o process.o ptrace.o \ 7obj-y += entry.o irq.o process.o ptrace.o \
8 setup.o signal.o sys_score.o time.o traps.o \ 8 setup.o signal.o sys_score.o time.o traps.o \
9 sys_call_table.o 9 sys_call_table.o
10 10
diff --git a/arch/score/kernel/init_task.c b/arch/score/kernel/init_task.c
deleted file mode 100644
index baa03ee217d1..000000000000
--- a/arch/score/kernel/init_task.c
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * arch/score/kernel/init_task.c
3 *
4 * Score Processor version.
5 *
6 * Copyright (C) 2009 Sunplus Core Technology Co., Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, see the file COPYING, or write
20 * to the Free Software Foundation, Inc.,
21 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#include <linux/init_task.h>
25#include <linux/mqueue.h>
26
27static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
28static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
29
30/*
31 * Initial thread structure.
32 *
33 * We need to make sure that this is THREAD_SIZE aligned due to the
34 * way process stacks are handled. This is done by having a special
35 * "init_task" linker map entry..
36 */
37union thread_union init_thread_union __init_task_data =
38 { INIT_THREAD_INFO(init_task) };
39
40/*
41 * Initial task structure.
42 *
43 * All other task structs will be allocated on slabs in fork.c
44 */
45struct task_struct init_task = INIT_TASK(init_task);
46EXPORT_SYMBOL(init_task);
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index ff9e033ce626..04a8cb4700af 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -28,6 +28,7 @@ config SUPERH
28 select RTC_LIB 28 select RTC_LIB
29 select GENERIC_ATOMIC64 29 select GENERIC_ATOMIC64
30 select GENERIC_IRQ_SHOW 30 select GENERIC_IRQ_SHOW
31 select GENERIC_SMP_IDLE_THREAD
31 help 32 help
32 The SuperH is a RISC processor targeted for use in embedded systems 33 The SuperH is a RISC processor targeted for use in embedded systems
33 and consumer electronics; it was also used in the Sega Dreamcast 34 and consumer electronics; it was also used in the Sega Dreamcast
@@ -152,9 +153,6 @@ config ARCH_NO_VIRT_TO_BUS
152config ARCH_HAS_DEFAULT_IDLE 153config ARCH_HAS_DEFAULT_IDLE
153 def_bool y 154 def_bool y
154 155
155config ARCH_HAS_CPU_IDLE_WAIT
156 def_bool y
157
158config NO_IOPORT 156config NO_IOPORT
159 def_bool !PCI 157 def_bool !PCI
160 depends on !SH_CAYMAN && !SH_SH4202_MICRODEV && !SH_SHMIN 158 depends on !SH_CAYMAN && !SH_SH4202_MICRODEV && !SH_SHMIN
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 3fc0f413777c..e14a676a0c7d 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -124,7 +124,7 @@ endif
124 124
125export ld-bfd BITS 125export ld-bfd BITS
126 126
127head-y := arch/sh/kernel/init_task.o arch/sh/kernel/head_$(BITS).o 127head-y := arch/sh/kernel/head_$(BITS).o
128 128
129core-y += arch/sh/kernel/ arch/sh/mm/ arch/sh/boards/ 129core-y += arch/sh/kernel/ arch/sh/mm/ arch/sh/boards/
130core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/ 130core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/
diff --git a/arch/sh/configs/sh7785lcr_32bit_defconfig b/arch/sh/configs/sh7785lcr_32bit_defconfig
index 7b9c696ac5e0..9bdcf72ec06a 100644
--- a/arch/sh/configs/sh7785lcr_32bit_defconfig
+++ b/arch/sh/configs/sh7785lcr_32bit_defconfig
@@ -5,7 +5,7 @@ CONFIG_BSD_PROCESS_ACCT=y
5CONFIG_IKCONFIG=y 5CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=16 7CONFIG_LOG_BUF_SHIFT=16
8CONFIG_PERF_COUNTERS=y 8CONFIG_PERF_EVENTS=y
9# CONFIG_COMPAT_BRK is not set 9# CONFIG_COMPAT_BRK is not set
10CONFIG_SLAB=y 10CONFIG_SLAB=y
11CONFIG_PROFILING=y 11CONFIG_PROFILING=y
diff --git a/arch/sh/include/asm/atomic.h b/arch/sh/include/asm/atomic.h
index 37f2f4a55231..f4c1c20bcdf6 100644
--- a/arch/sh/include/asm/atomic.h
+++ b/arch/sh/include/asm/atomic.h
@@ -11,7 +11,7 @@
11#include <linux/types.h> 11#include <linux/types.h>
12#include <asm/cmpxchg.h> 12#include <asm/cmpxchg.h>
13 13
14#define ATOMIC_INIT(i) ( (atomic_t) { (i) } ) 14#define ATOMIC_INIT(i) { (i) }
15 15
16#define atomic_read(v) (*(volatile int *)&(v)->counter) 16#define atomic_read(v) (*(volatile int *)&(v)->counter)
17#define atomic_set(v,i) ((v)->counter = (i)) 17#define atomic_set(v,i) ((v)->counter = (i))
diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h
index a229c393826a..6dbc1be28a0f 100644
--- a/arch/sh/include/asm/processor.h
+++ b/arch/sh/include/asm/processor.h
@@ -85,10 +85,6 @@ struct sh_cpuinfo {
85 struct tlb_info itlb; 85 struct tlb_info itlb;
86 struct tlb_info dtlb; 86 struct tlb_info dtlb;
87 87
88#ifdef CONFIG_SMP
89 struct task_struct *idle;
90#endif
91
92 unsigned int phys_bits; 88 unsigned int phys_bits;
93 unsigned long flags; 89 unsigned long flags;
94} __attribute__ ((aligned(L1_CACHE_BYTES))); 90} __attribute__ ((aligned(L1_CACHE_BYTES)));
@@ -102,7 +98,6 @@ extern struct sh_cpuinfo cpu_data[];
102#define cpu_relax() barrier() 98#define cpu_relax() barrier()
103 99
104void default_idle(void); 100void default_idle(void);
105void cpu_idle_wait(void);
106void stop_this_cpu(void *); 101void stop_this_cpu(void *);
107 102
108/* Forward decl */ 103/* Forward decl */
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
index 20ee40af16e9..b6902061d4dc 100644
--- a/arch/sh/include/asm/thread_info.h
+++ b/arch/sh/include/asm/thread_info.h
@@ -88,22 +88,13 @@ static inline struct thread_info *current_thread_info(void)
88 return ti; 88 return ti;
89} 89}
90 90
91/* thread information allocation */
92#if THREAD_SHIFT >= PAGE_SHIFT
93
94#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) 91#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT)
95 92
96#endif
97
98extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);
99extern void free_thread_info(struct thread_info *ti);
100extern void arch_task_cache_init(void); 93extern void arch_task_cache_init(void);
101#define arch_task_cache_init arch_task_cache_init
102extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); 94extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
95extern void arch_release_task_struct(struct task_struct *tsk);
103extern void init_thread_xstate(void); 96extern void init_thread_xstate(void);
104 97
105#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
106
107#endif /* __ASSEMBLY__ */ 98#endif /* __ASSEMBLY__ */
108 99
109/* 100/*
diff --git a/arch/sh/include/asm/topology.h b/arch/sh/include/asm/topology.h
index 88e734069fa6..b0a282d65f6a 100644
--- a/arch/sh/include/asm/topology.h
+++ b/arch/sh/include/asm/topology.h
@@ -3,31 +3,6 @@
3 3
4#ifdef CONFIG_NUMA 4#ifdef CONFIG_NUMA
5 5
6/* sched_domains SD_NODE_INIT for sh machines */
7#define SD_NODE_INIT (struct sched_domain) { \
8 .parent = NULL, \
9 .child = NULL, \
10 .groups = NULL, \
11 .min_interval = 8, \
12 .max_interval = 32, \
13 .busy_factor = 32, \
14 .imbalance_pct = 125, \
15 .cache_nice_tries = 2, \
16 .busy_idx = 3, \
17 .idle_idx = 2, \
18 .newidle_idx = 0, \
19 .wake_idx = 0, \
20 .forkexec_idx = 0, \
21 .flags = SD_LOAD_BALANCE \
22 | SD_BALANCE_FORK \
23 | SD_BALANCE_EXEC \
24 | SD_BALANCE_NEWIDLE \
25 | SD_SERIALIZE, \
26 .last_balance = jiffies, \
27 .balance_interval = 1, \
28 .nr_balance_failed = 0, \
29}
30
31#define cpu_to_node(cpu) ((void)(cpu),0) 6#define cpu_to_node(cpu) ((void)(cpu),0)
32#define parent_node(node) ((void)(node),0) 7#define parent_node(node) ((void)(node),0)
33 8
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index 77f7ae1d4647..88571ff8eeec 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the Linux/SuperH kernel. 2# Makefile for the Linux/SuperH kernel.
3# 3#
4 4
5extra-y := head_$(BITS).o init_task.o vmlinux.lds 5extra-y := head_$(BITS).o vmlinux.lds
6 6
7ifdef CONFIG_FUNCTION_TRACER 7ifdef CONFIG_FUNCTION_TRACER
8# Do not profile debug and lowlevel utilities 8# Do not profile debug and lowlevel utilities
diff --git a/arch/sh/kernel/idle.c b/arch/sh/kernel/idle.c
index ee226e20c20c..0c910163caa3 100644
--- a/arch/sh/kernel/idle.c
+++ b/arch/sh/kernel/idle.c
@@ -132,10 +132,6 @@ void __init select_idle_routine(void)
132 pm_idle = poll_idle; 132 pm_idle = poll_idle;
133} 133}
134 134
135static void do_nothing(void *unused)
136{
137}
138
139void stop_this_cpu(void *unused) 135void stop_this_cpu(void *unused)
140{ 136{
141 local_irq_disable(); 137 local_irq_disable();
@@ -144,19 +140,3 @@ void stop_this_cpu(void *unused)
144 for (;;) 140 for (;;)
145 cpu_sleep(); 141 cpu_sleep();
146} 142}
147
148/*
149 * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
150 * pm_idle and update to new pm_idle value. Required while changing pm_idle
151 * handler on SMP systems.
152 *
153 * Caller must have changed pm_idle to the new value before the call. Old
154 * pm_idle value will not be used by any CPU after the return of this function.
155 */
156void cpu_idle_wait(void)
157{
158 smp_mb();
159 /* kick all the CPUs so that they exit out of pm_idle */
160 smp_call_function(do_nothing, NULL, 1);
161}
162EXPORT_SYMBOL_GPL(cpu_idle_wait);
diff --git a/arch/sh/kernel/init_task.c b/arch/sh/kernel/init_task.c
deleted file mode 100644
index 11f2ea556a6b..000000000000
--- a/arch/sh/kernel/init_task.c
+++ /dev/null
@@ -1,30 +0,0 @@
1#include <linux/mm.h>
2#include <linux/module.h>
3#include <linux/sched.h>
4#include <linux/init_task.h>
5#include <linux/mqueue.h>
6#include <linux/fs.h>
7#include <asm/uaccess.h>
8#include <asm/pgtable.h>
9
10static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
11static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
12struct pt_regs fake_swapper_regs;
13/*
14 * Initial thread structure.
15 *
16 * We need to make sure that this is 8192-byte aligned due to the
17 * way process stacks are handled. This is done by having a special
18 * "init_task" linker map entry..
19 */
20union thread_union init_thread_union __init_task_data =
21 { INIT_THREAD_INFO(init_task) };
22
23/*
24 * Initial task structure.
25 *
26 * All other task structs will be allocated on slabs in fork.c
27 */
28struct task_struct init_task = INIT_TASK(init_task);
29
30EXPORT_SYMBOL(init_task);
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index 325f98b1736d..f2621abdf01d 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -29,52 +29,10 @@ void free_thread_xstate(struct task_struct *tsk)
29 } 29 }
30} 30}
31 31
32#if THREAD_SHIFT < PAGE_SHIFT 32void arch_release_task_struct(struct task_struct *tsk)
33static struct kmem_cache *thread_info_cache;
34
35struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
36{
37 struct thread_info *ti;
38#ifdef CONFIG_DEBUG_STACK_USAGE
39 gfp_t mask = GFP_KERNEL | __GFP_ZERO;
40#else
41 gfp_t mask = GFP_KERNEL;
42#endif
43
44 ti = kmem_cache_alloc_node(thread_info_cache, mask, node);
45 return ti;
46}
47
48void free_thread_info(struct thread_info *ti)
49{
50 free_thread_xstate(ti->task);
51 kmem_cache_free(thread_info_cache, ti);
52}
53
54void thread_info_cache_init(void)
55{
56 thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE,
57 THREAD_SIZE, SLAB_PANIC, NULL);
58}
59#else
60struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
61{
62#ifdef CONFIG_DEBUG_STACK_USAGE
63 gfp_t mask = GFP_KERNEL | __GFP_ZERO;
64#else
65 gfp_t mask = GFP_KERNEL;
66#endif
67 struct page *page = alloc_pages_node(node, mask, THREAD_SIZE_ORDER);
68
69 return page ? page_address(page) : NULL;
70}
71
72void free_thread_info(struct thread_info *ti)
73{ 33{
74 free_thread_xstate(ti->task); 34 free_thread_xstate(tsk);
75 free_pages((unsigned long)ti, THREAD_SIZE_ORDER);
76} 35}
77#endif /* THREAD_SHIFT < PAGE_SHIFT */
78 36
79void arch_task_cache_init(void) 37void arch_task_cache_init(void)
80{ 38{
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index 9698671444e6..81f999a672f6 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -503,7 +503,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
503{ 503{
504 long ret = 0; 504 long ret = 0;
505 505
506 secure_computing(regs->regs[0]); 506 secure_computing_strict(regs->regs[0]);
507 507
508 if (test_thread_flag(TIF_SYSCALL_TRACE) && 508 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
509 tracehook_report_syscall_entry(regs)) 509 tracehook_report_syscall_entry(regs))
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
index bc81e07dc098..af90339dadcd 100644
--- a/arch/sh/kernel/ptrace_64.c
+++ b/arch/sh/kernel/ptrace_64.c
@@ -522,7 +522,7 @@ asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs)
522{ 522{
523 long long ret = 0; 523 long long ret = 0;
524 524
525 secure_computing(regs->regs[9]); 525 secure_computing_strict(regs->regs[9]);
526 526
527 if (test_thread_flag(TIF_SYSCALL_TRACE) && 527 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
528 tracehook_report_syscall_entry(regs)) 528 tracehook_report_syscall_entry(regs))
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c
index eaebdf6a5c77..b86e9ca79455 100644
--- a/arch/sh/kernel/smp.c
+++ b/arch/sh/kernel/smp.c
@@ -220,22 +220,10 @@ extern struct {
220 void *thread_info; 220 void *thread_info;
221} stack_start; 221} stack_start;
222 222
223int __cpuinit __cpu_up(unsigned int cpu) 223int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tsk)
224{ 224{
225 struct task_struct *tsk;
226 unsigned long timeout; 225 unsigned long timeout;
227 226
228 tsk = cpu_data[cpu].idle;
229 if (!tsk) {
230 tsk = fork_idle(cpu);
231 if (IS_ERR(tsk)) {
232 pr_err("Failed forking idle task for cpu %d\n", cpu);
233 return PTR_ERR(tsk);
234 }
235
236 cpu_data[cpu].idle = tsk;
237 }
238
239 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; 227 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
240 228
241 /* Fill in data in head.S for secondary cpus */ 229 /* Fill in data in head.S for secondary cpus */
diff --git a/arch/sh/mm/fault_32.c b/arch/sh/mm/fault_32.c
index 324eef93c900..e99b104d967a 100644
--- a/arch/sh/mm/fault_32.c
+++ b/arch/sh/mm/fault_32.c
@@ -86,7 +86,7 @@ static noinline int vmalloc_fault(unsigned long address)
86 pte_t *pte_k; 86 pte_t *pte_k;
87 87
88 /* Make sure we are in vmalloc/module/P3 area: */ 88 /* Make sure we are in vmalloc/module/P3 area: */
89 if (!(address >= VMALLOC_START && address < P3_ADDR_MAX)) 89 if (!(address >= P3SEG && address < P3_ADDR_MAX))
90 return -1; 90 return -1;
91 91
92 /* 92 /*
diff --git a/arch/sparc/Kbuild b/arch/sparc/Kbuild
new file mode 100644
index 000000000000..5cd01161fd00
--- /dev/null
+++ b/arch/sparc/Kbuild
@@ -0,0 +1,8 @@
1#
2# core part of the sparc kernel
3#
4
5obj-y += kernel/
6obj-y += mm/
7obj-y += math-emu/
8obj-y += net/
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 6c0683d3fcba..1ea3fd954756 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -30,11 +30,14 @@ config SPARC
30 select USE_GENERIC_SMP_HELPERS if SMP 30 select USE_GENERIC_SMP_HELPERS if SMP
31 select GENERIC_PCI_IOMAP 31 select GENERIC_PCI_IOMAP
32 select HAVE_NMI_WATCHDOG if SPARC64 32 select HAVE_NMI_WATCHDOG if SPARC64
33 select HAVE_BPF_JIT
34 select GENERIC_SMP_IDLE_THREAD
33 35
34config SPARC32 36config SPARC32
35 def_bool !64BIT 37 def_bool !64BIT
36 select GENERIC_ATOMIC64 38 select GENERIC_ATOMIC64
37 select CLZ_TAB 39 select CLZ_TAB
40 select ARCH_THREAD_INFO_ALLOCATOR
38 41
39config SPARC64 42config SPARC64
40 def_bool 64BIT 43 def_bool 64BIT
@@ -61,6 +64,7 @@ config SPARC64
61 select IRQ_PREFLOW_FASTEOI 64 select IRQ_PREFLOW_FASTEOI
62 select ARCH_HAVE_NMI_SAFE_CMPXCHG 65 select ARCH_HAVE_NMI_SAFE_CMPXCHG
63 select HAVE_C_RECORDMCOUNT 66 select HAVE_C_RECORDMCOUNT
67 select NO_BOOTMEM
64 68
65config ARCH_DEFCONFIG 69config ARCH_DEFCONFIG
66 string 70 string
@@ -73,17 +77,12 @@ config BITS
73 default 32 if SPARC32 77 default 32 if SPARC32
74 default 64 if SPARC64 78 default 64 if SPARC64
75 79
76config ARCH_USES_GETTIMEOFFSET
77 bool
78 default y if SPARC32
79
80config GENERIC_CMOS_UPDATE 80config GENERIC_CMOS_UPDATE
81 bool 81 bool
82 default y 82 default y
83 83
84config GENERIC_CLOCKEVENTS 84config GENERIC_CLOCKEVENTS
85 bool 85 def_bool y
86 default y if SPARC64
87 86
88config IOMMU_HELPER 87config IOMMU_HELPER
89 bool 88 bool
@@ -154,7 +153,7 @@ source "kernel/Kconfig.freezer"
154menu "Processor type and features" 153menu "Processor type and features"
155 154
156config SMP 155config SMP
157 bool "Symmetric multi-processing support (does not work on sun4/sun4c)" 156 bool "Symmetric multi-processing support"
158 ---help--- 157 ---help---
159 This enables support for systems with more than one CPU. If you have 158 This enables support for systems with more than one CPU. If you have
160 a system with only one CPU, say N. If you have a system with more 159 a system with only one CPU, say N. If you have a system with more
@@ -584,6 +583,9 @@ config SYSVIPC_COMPAT
584 depends on COMPAT && SYSVIPC 583 depends on COMPAT && SYSVIPC
585 default y 584 default y
586 585
586config KEYS_COMPAT
587 def_bool y if COMPAT && KEYS
588
587endmenu 589endmenu
588 590
589source "net/Kconfig" 591source "net/Kconfig"
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index eddcfb36aafb..541b8b075c7d 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -19,39 +19,27 @@ ifeq ($(CONFIG_SPARC32),y)
19# sparc32 19# sparc32
20# 20#
21 21
22#
23# Uncomment the first KBUILD_CFLAGS if you are doing kgdb source level
24# debugging of the kernel to get the proper debugging information.
25
26AS := $(AS) -32
27LDFLAGS := -m elf32_sparc
28CHECKFLAGS += -D__sparc__ 22CHECKFLAGS += -D__sparc__
23LDFLAGS := -m elf32_sparc
29export BITS := 32 24export BITS := 32
30UTS_MACHINE := sparc 25UTS_MACHINE := sparc
31 26
32#KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7 27KBUILD_CFLAGS += -m32 -mcpu=v8 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
33KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 28KBUILD_AFLAGS += -m32 -Wa,-Av8
34KBUILD_AFLAGS += -m32 -Wa,-Av8
35
36#LDFLAGS_vmlinux = -N -Ttext 0xf0004000
37# Since 2.5.40, the first stage is left not btfix-ed.
38# Actual linking is done with "make image".
39LDFLAGS_vmlinux = -r
40 29
41else 30else
42##### 31#####
43# sparc64 32# sparc64
44# 33#
45 34
46CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64 35CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64
36LDFLAGS := -m elf64_sparc
37export BITS := 64
38UTS_MACHINE := sparc64
47 39
48LDFLAGS := -m elf64_sparc 40KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow
49export BITS := 64 41KBUILD_CFLAGS += -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare
50UTS_MACHINE := sparc64 42KBUILD_CFLAGS += -Wa,--undeclared-regs
51
52KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \
53 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \
54 -Wa,--undeclared-regs
55KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3) 43KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3)
56KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs 44KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs
57 45
@@ -62,27 +50,15 @@ endif
62endif 50endif
63 51
64head-y := arch/sparc/kernel/head_$(BITS).o 52head-y := arch/sparc/kernel/head_$(BITS).o
65head-y += arch/sparc/kernel/init_task.o
66 53
67core-y += arch/sparc/kernel/ 54# See arch/sparc/Kbuild for the core part of the kernel
68core-y += arch/sparc/mm/ arch/sparc/math-emu/ 55core-y += arch/sparc/
69 56
70libs-y += arch/sparc/prom/ 57libs-y += arch/sparc/prom/
71libs-y += arch/sparc/lib/ 58libs-y += arch/sparc/lib/
72 59
73drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/ 60drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/
74 61
75# Export what is needed by arch/sparc/boot/Makefile
76export VMLINUX_INIT VMLINUX_MAIN
77VMLINUX_INIT := $(head-y) $(init-y)
78VMLINUX_MAIN := $(core-y) kernel/ mm/ fs/ ipc/ security/ crypto/ block/
79VMLINUX_MAIN += $(patsubst %/, %/lib.a, $(libs-y)) $(libs-y)
80VMLINUX_MAIN += $(drivers-y) $(net-y)
81
82ifdef CONFIG_KALLSYMS
83export kallsyms.o := .tmp_kallsyms2.o
84endif
85
86boot := arch/sparc/boot 62boot := arch/sparc/boot
87 63
88# Default target 64# Default target
diff --git a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile
index d56d199c1aa8..6e63afb128d9 100644
--- a/arch/sparc/boot/Makefile
+++ b/arch/sparc/boot/Makefile
@@ -6,8 +6,8 @@
6ROOT_IMG := /usr/src/root.img 6ROOT_IMG := /usr/src/root.img
7ELFTOAOUT := elftoaout 7ELFTOAOUT := elftoaout
8 8
9hostprogs-y := piggyback btfixupprep 9hostprogs-y := piggyback
10targets := tftpboot.img btfix.o btfix.S image zImage vmlinux.aout 10targets := tftpboot.img image zImage vmlinux.aout
11clean-files := System.map 11clean-files := System.map
12 12
13quiet_cmd_elftoaout = ELFTOAOUT $@ 13quiet_cmd_elftoaout = ELFTOAOUT $@
@@ -17,58 +17,9 @@ quiet_cmd_piggy = PIGGY $@
17quiet_cmd_strip = STRIP $@ 17quiet_cmd_strip = STRIP $@
18 cmd_strip = $(STRIP) -R .comment -R .note -K sun4u_init -K _end -K _start $< -o $@ 18 cmd_strip = $(STRIP) -R .comment -R .note -K sun4u_init -K _end -K _start $< -o $@
19 19
20ifeq ($(CONFIG_SPARC32),y)
21quiet_cmd_btfix = BTFIX $@
22 cmd_btfix = $(OBJDUMP) -x vmlinux | $(obj)/btfixupprep > $@
23quiet_cmd_sysmap = SYSMAP $(obj)/System.map
24 cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
25quiet_cmd_image = LD $@
26 cmd_image = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) -o $@
27
28define rule_image
29 $(if $($(quiet)cmd_image), \
30 echo ' $($(quiet)cmd_image)' &&) \
31 $(cmd_image); \
32 $(if $($(quiet)cmd_sysmap), \
33 echo ' $($(quiet)cmd_sysmap)' &&) \
34 $(cmd_sysmap) $@ $(obj)/System.map; \
35 if [ $$? -ne 0 ]; then \
36 rm -f $@; \
37 /bin/false; \
38 fi; \
39 echo 'cmd_$@ := $(cmd_image)' > $(@D)/.$(@F).cmd
40endef
41
42BTOBJS := $(patsubst %/, %/built-in.o, $(VMLINUX_INIT))
43BTLIBS := $(patsubst %/, %/built-in.o, $(VMLINUX_MAIN))
44LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds $(BTOBJS) \
45 --start-group $(BTLIBS) --end-group \
46 $(kallsyms.o) $(obj)/btfix.o
47
48# Link the final image including btfixup'ed symbols.
49# This is a replacement for the link done in the top-level Makefile.
50# Note: No dependency on the prerequisite files since that would require
51# make to try check if they are updated - and due to changes
52# in gcc options (path for example) this would result in
53# these files being recompiled for each build.
54$(obj)/image: $(obj)/btfix.o FORCE
55 $(call if_changed_rule,image)
56
57$(obj)/zImage: $(obj)/image
58 $(call if_changed,strip)
59 @echo ' kernel: $@ is ready'
60
61$(obj)/btfix.S: $(obj)/btfixupprep vmlinux FORCE
62 $(call if_changed,btfix)
63
64endif
65
66ifeq ($(CONFIG_SPARC64),y) 20ifeq ($(CONFIG_SPARC64),y)
67 21
68# Actual linking 22# Actual linking
69$(obj)/image: vmlinux FORCE
70 $(call if_changed,strip)
71 @echo ' kernel: $@ is ready'
72 23
73$(obj)/zImage: $(obj)/image 24$(obj)/zImage: $(obj)/image
74 $(call if_changed,gzip) 25 $(call if_changed,gzip)
@@ -79,6 +30,10 @@ $(obj)/vmlinux.aout: vmlinux FORCE
79 @echo ' kernel: $@ is ready' 30 @echo ' kernel: $@ is ready'
80else 31else
81 32
33$(obj)/zImage: $(obj)/image
34 $(call if_changed,strip)
35 @echo ' kernel: $@ is ready'
36
82# The following lines make a readable image for U-Boot. 37# The following lines make a readable image for U-Boot.
83# uImage - Binary file read by U-boot 38# uImage - Binary file read by U-boot
84# uImage.o - object file of uImage for loading with a 39# uImage.o - object file of uImage for loading with a
@@ -107,6 +62,10 @@ $(obj)/uImage: $(obj)/image.gz
107 62
108endif 63endif
109 64
65$(obj)/image: vmlinux FORCE
66 $(call if_changed,strip)
67 @echo ' kernel: $@ is ready'
68
110$(obj)/tftpboot.img: $(obj)/image $(obj)/piggyback System.map $(ROOT_IMG) FORCE 69$(obj)/tftpboot.img: $(obj)/image $(obj)/piggyback System.map $(ROOT_IMG) FORCE
111 $(call if_changed,elftoaout) 70 $(call if_changed,elftoaout)
112 $(call if_changed,piggy) 71 $(call if_changed,piggy)
diff --git a/arch/sparc/boot/btfixupprep.c b/arch/sparc/boot/btfixupprep.c
deleted file mode 100644
index da031159e2b7..000000000000
--- a/arch/sparc/boot/btfixupprep.c
+++ /dev/null
@@ -1,386 +0,0 @@
1/*
2 Simple utility to prepare vmlinux image for sparc.
3 Resolves all BTFIXUP uses and settings and creates
4 a special .s object to link to the image.
5
6 Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
21
22#include <stdio.h>
23#include <string.h>
24#include <ctype.h>
25#include <errno.h>
26#include <unistd.h>
27#include <stdlib.h>
28#include <malloc.h>
29
30#define MAXSYMS 1024
31
32static char *symtab = "SYMBOL TABLE:";
33static char *relrec = "RELOCATION RECORDS FOR [";
34static int rellen;
35static int symlen;
36int mode;
37
38struct _btfixup;
39
40typedef struct _btfixuprel {
41 char *sect;
42 unsigned long offset;
43 struct _btfixup *f;
44 int frel;
45 struct _btfixuprel *next;
46} btfixuprel;
47
48typedef struct _btfixup {
49 int type;
50 int setinitval;
51 unsigned int initval;
52 char *initvalstr;
53 char *name;
54 btfixuprel *rel;
55} btfixup;
56
57btfixup array[MAXSYMS];
58int last = 0;
59char buffer[1024];
60unsigned long lastfoffset = -1;
61unsigned long lastfrelno;
62btfixup *lastf;
63
64static void fatal(void) __attribute__((noreturn));
65static void fatal(void)
66{
67 fprintf(stderr, "Malformed output from objdump\n%s\n", buffer);
68 exit(1);
69}
70
71static btfixup *find(int type, char *name)
72{
73 int i;
74 for (i = 0; i < last; i++) {
75 if (array[i].type == type && !strcmp(array[i].name, name))
76 return array + i;
77 }
78 array[last].type = type;
79 array[last].name = strdup(name);
80 array[last].setinitval = 0;
81 if (!array[last].name) fatal();
82 array[last].rel = NULL;
83 last++;
84 if (last >= MAXSYMS) {
85 fprintf(stderr, "Ugh. Something strange. More than %d different BTFIXUP symbols\n", MAXSYMS);
86 exit(1);
87 }
88 return array + last - 1;
89}
90
91static void set_mode (char *buffer)
92{
93 for (mode = 0;; mode++)
94 if (buffer[mode] < '0' || buffer[mode] > '9')
95 break;
96 if (mode != 8 && mode != 16)
97 fatal();
98}
99
100
101int main(int argc,char **argv)
102{
103 char *p, *q;
104 char *sect;
105 int i, j, k;
106 unsigned int initval;
107 int shift;
108 btfixup *f;
109 btfixuprel *r, **rr;
110 unsigned long offset;
111 char *initvalstr;
112
113 symlen = strlen(symtab);
114 while (fgets (buffer, 1024, stdin) != NULL)
115 if (!strncmp (buffer, symtab, symlen))
116 goto main0;
117 fatal();
118main0:
119 rellen = strlen(relrec);
120 while (fgets (buffer, 1024, stdin) != NULL)
121 if (!strncmp (buffer, relrec, rellen))
122 goto main1;
123 fatal();
124main1:
125 sect = malloc(strlen (buffer + rellen) + 1);
126 if (!sect) fatal();
127 strcpy (sect, buffer + rellen);
128 p = strchr (sect, ']');
129 if (!p) fatal();
130 *p = 0;
131 if (fgets (buffer, 1024, stdin) == NULL)
132 fatal();
133 while (fgets (buffer, 1024, stdin) != NULL) {
134 int nbase;
135 if (!strncmp (buffer, relrec, rellen))
136 goto main1;
137 if (mode == 0)
138 set_mode (buffer);
139 p = strchr (buffer, '\n');
140 if (p) *p = 0;
141 if (strlen (buffer) < 22+mode)
142 continue;
143 if (strncmp (buffer + mode, " R_SPARC_", 9))
144 continue;
145 nbase = 27 - 8 + mode;
146 if (buffer[nbase] != '_' || buffer[nbase+1] != '_' || buffer[nbase+2] != '_')
147 continue;
148 switch (buffer[nbase+3]) {
149 case 'f': /* CALL */
150 case 'b': /* BLACKBOX */
151 case 's': /* SIMM13 */
152 case 'a': /* HALF */
153 case 'h': /* SETHI */
154 case 'i': /* INT */
155 break;
156 default:
157 continue;
158 }
159 p = strchr (buffer + nbase+5, '+');
160 if (p) *p = 0;
161 shift = nbase + 5;
162 if (buffer[nbase+4] == 's' && buffer[nbase+5] == '_') {
163 shift = nbase + 6;
164 if (strcmp (sect, ".init.text")) {
165 fprintf(stderr,
166 "Wrong use of '%s' BTFIXUPSET in '%s' section.\n"
167 "BTFIXUPSET_CALL can be used only in"
168 " __init sections\n",
169 buffer + shift, sect);
170 exit(1);
171 }
172 } else if (buffer[nbase+4] != '_')
173 continue;
174 if (!strcmp (sect, ".text.exit"))
175 continue;
176 if (strcmp (sect, ".text") &&
177 strcmp (sect, ".init.text") &&
178 strcmp (sect, ".fixup") &&
179 (strcmp (sect, "__ksymtab") || buffer[nbase+3] != 'f')) {
180 if (buffer[nbase+3] == 'f')
181 fprintf(stderr,
182 "Wrong use of '%s' in '%s' section.\n"
183 " It can be used only in .text, .init.text,"
184 " .fixup and __ksymtab\n",
185 buffer + shift, sect);
186 else
187 fprintf(stderr,
188 "Wrong use of '%s' in '%s' section.\n"
189 " It can be only used in .text, .init.text,"
190 " and .fixup\n", buffer + shift, sect);
191 exit(1);
192 }
193 p = strstr (buffer + shift, "__btset_");
194 if (p && buffer[nbase+4] == 's') {
195 fprintf(stderr, "__btset_ in BTFIXUP name can only be used when defining the variable, not for setting\n%s\n", buffer);
196 exit(1);
197 }
198 initval = 0;
199 initvalstr = NULL;
200 if (p) {
201 if (p[8] != '0' || p[9] != 'x') {
202 fprintf(stderr, "Pre-initialized values can be only initialized with hexadecimal constants starting 0x\n%s\n", buffer);
203 exit(1);
204 }
205 initval = strtoul(p + 10, &q, 16);
206 if (*q || !initval) {
207 fprintf(stderr, "Pre-initialized values can be only in the form name__btset_0xXXXXXXXX where X are hex digits.\nThey cannot be name__btset_0x00000000 though. Use BTFIXUPDEF_XX instead of BTFIXUPDEF_XX_INIT then.\n%s\n", buffer);
208 exit(1);
209 }
210 initvalstr = p + 10;
211 *p = 0;
212 }
213 f = find(buffer[nbase+3], buffer + shift);
214 if (buffer[nbase+4] == 's')
215 continue;
216 switch (buffer[nbase+3]) {
217 case 'f':
218 if (initval) {
219 fprintf(stderr, "Cannot use pre-initialized fixups for calls\n%s\n", buffer);
220 exit(1);
221 }
222 if (!strcmp (sect, "__ksymtab")) {
223 if (strncmp (buffer + mode+9, "32 ", 10)) {
224 fprintf(stderr, "BTFIXUP_CALL in EXPORT_SYMBOL results in relocation other than R_SPARC_32\n\%s\n", buffer);
225 exit(1);
226 }
227 } else if (strncmp (buffer + mode+9, "WDISP30 ", 10) &&
228 strncmp (buffer + mode+9, "HI22 ", 10) &&
229 strncmp (buffer + mode+9, "LO10 ", 10)) {
230 fprintf(stderr, "BTFIXUP_CALL results in relocation other than R_SPARC_WDISP30, R_SPARC_HI22 or R_SPARC_LO10\n%s\n", buffer);
231 exit(1);
232 }
233 break;
234 case 'b':
235 if (initval) {
236 fprintf(stderr, "Cannot use pre-initialized fixups for blackboxes\n%s\n", buffer);
237 exit(1);
238 }
239 if (strncmp (buffer + mode+9, "HI22 ", 10)) {
240 fprintf(stderr, "BTFIXUP_BLACKBOX results in relocation other than R_SPARC_HI22\n%s\n", buffer);
241 exit(1);
242 }
243 break;
244 case 's':
245 if (initval + 0x1000 >= 0x2000) {
246 fprintf(stderr, "Wrong initializer for SIMM13. Has to be from $fffff000 to $00000fff\n%s\n", buffer);
247 exit(1);
248 }
249 if (strncmp (buffer + mode+9, "13 ", 10)) {
250 fprintf(stderr, "BTFIXUP_SIMM13 results in relocation other than R_SPARC_13\n%s\n", buffer);
251 exit(1);
252 }
253 break;
254 case 'a':
255 if (initval + 0x1000 >= 0x2000 && (initval & 0x3ff)) {
256 fprintf(stderr, "Wrong initializer for HALF.\n%s\n", buffer);
257 exit(1);
258 }
259 if (strncmp (buffer + mode+9, "13 ", 10)) {
260 fprintf(stderr, "BTFIXUP_HALF results in relocation other than R_SPARC_13\n%s\n", buffer);
261 exit(1);
262 }
263 break;
264 case 'h':
265 if (initval & 0x3ff) {
266 fprintf(stderr, "Wrong initializer for SETHI. Cannot have set low 10 bits\n%s\n", buffer);
267 exit(1);
268 }
269 if (strncmp (buffer + mode+9, "HI22 ", 10)) {
270 fprintf(stderr, "BTFIXUP_SETHI results in relocation other than R_SPARC_HI22\n%s\n", buffer);
271 exit(1);
272 }
273 break;
274 case 'i':
275 if (initval) {
276 fprintf(stderr, "Cannot use pre-initialized fixups for INT\n%s\n", buffer);
277 exit(1);
278 }
279 if (strncmp (buffer + mode+9, "HI22 ", 10) && strncmp (buffer + mode+9, "LO10 ", 10)) {
280 fprintf(stderr, "BTFIXUP_INT results in relocation other than R_SPARC_HI22 and R_SPARC_LO10\n%s\n", buffer);
281 exit(1);
282 }
283 break;
284 }
285 if (!f->setinitval) {
286 f->initval = initval;
287 if (initvalstr) {
288 f->initvalstr = strdup(initvalstr);
289 if (!f->initvalstr) fatal();
290 }
291 f->setinitval = 1;
292 } else if (f->initval != initval) {
293 fprintf(stderr, "Btfixup %s previously used with initializer %s which doesn't match with current initializer\n%s\n",
294 f->name, f->initvalstr ? : "0x00000000", buffer);
295 exit(1);
296 } else if (initval && strcmp(f->initvalstr, initvalstr)) {
297 fprintf(stderr, "Btfixup %s previously used with initializer %s which doesn't match with current initializer.\n"
298 "Initializers have to match literally as well.\n%s\n",
299 f->name, f->initvalstr, buffer);
300 exit(1);
301 }
302 offset = strtoul(buffer, &q, 16);
303 if (q != buffer + mode || (!offset && (mode == 8 ? strncmp (buffer, "00000000 ", 9) : strncmp (buffer, "0000000000000000 ", 17)))) {
304 fprintf(stderr, "Malformed relocation address in\n%s\n", buffer);
305 exit(1);
306 }
307 for (k = 0, r = f->rel, rr = &f->rel; r; rr = &r->next, r = r->next, k++)
308 if (r->offset == offset && !strcmp(r->sect, sect)) {
309 fprintf(stderr, "Ugh. One address has two relocation records\n");
310 exit(1);
311 }
312 *rr = malloc(sizeof(btfixuprel));
313 if (!*rr) fatal();
314 (*rr)->offset = offset;
315 (*rr)->f = NULL;
316 if (buffer[nbase+3] == 'f') {
317 lastf = f;
318 lastfoffset = offset;
319 lastfrelno = k;
320 } else if (lastfoffset + 4 == offset) {
321 (*rr)->f = lastf;
322 (*rr)->frel = lastfrelno;
323 }
324 (*rr)->sect = sect;
325 (*rr)->next = NULL;
326 }
327 printf("! Generated by btfixupprep. Do not edit.\n\n");
328 printf("\t.section\t\".data..init\",#alloc,#write\n\t.align\t4\n\n");
329 printf("\t.global\t___btfixup_start\n___btfixup_start:\n\n");
330 for (i = 0; i < last; i++) {
331 f = array + i;
332 printf("\t.global\t___%cs_%s\n", f->type, f->name);
333 if (f->type == 'f')
334 printf("___%cs_%s:\n\t.word 0x%08x,0,0,", f->type, f->name, f->type << 24);
335 else
336 printf("___%cs_%s:\n\t.word 0x%08x,0,", f->type, f->name, f->type << 24);
337 for (j = 0, r = f->rel; r != NULL; j++, r = r->next);
338 if (j)
339 printf("%d\n\t.word\t", j * 2);
340 else
341 printf("0\n");
342 for (r = f->rel, j--; r != NULL; j--, r = r->next) {
343 if (!strcmp (r->sect, ".text"))
344 printf ("_stext+0x%08lx", r->offset);
345 else if (!strcmp (r->sect, ".init.text"))
346 printf ("__init_begin+0x%08lx", r->offset);
347 else if (!strcmp (r->sect, "__ksymtab"))
348 printf ("__start___ksymtab+0x%08lx", r->offset);
349 else if (!strcmp (r->sect, ".fixup"))
350 printf ("__start___fixup+0x%08lx", r->offset);
351 else
352 fatal();
353 if (f->type == 'f' || !r->f)
354 printf (",0");
355 else
356 printf (",___fs_%s+0x%08x", r->f->name, (4 + r->frel*2)*4 + 4);
357 if (j) printf (",");
358 else printf ("\n");
359 }
360 printf("\n");
361 }
362 printf("\n\t.global\t___btfixup_end\n___btfixup_end:\n");
363 printf("\n\n! Define undefined references\n\n");
364 for (i = 0; i < last; i++) {
365 f = array + i;
366 if (f->type == 'f') {
367 printf("\t.global\t___f_%s\n", f->name);
368 printf("___f_%s:\n", f->name);
369 }
370 }
371 printf("\tretl\n\t nop\n\n");
372 for (i = 0; i < last; i++) {
373 f = array + i;
374 if (f->type != 'f') {
375 if (!f->initval) {
376 printf("\t.global\t___%c_%s\n", f->type, f->name);
377 printf("___%c_%s = 0\n", f->type, f->name);
378 } else {
379 printf("\t.global\t___%c_%s__btset_0x%s\n", f->type, f->name, f->initvalstr);
380 printf("___%c_%s__btset_0x%s = 0x%08x\n", f->type, f->name, f->initvalstr, f->initval);
381 }
382 }
383 }
384 printf("\n\n");
385 exit(0);
386}
diff --git a/arch/sparc/configs/sparc64_defconfig b/arch/sparc/configs/sparc64_defconfig
index 3c1e85807403..9d8521b8c854 100644
--- a/arch/sparc/configs/sparc64_defconfig
+++ b/arch/sparc/configs/sparc64_defconfig
@@ -5,7 +5,7 @@ CONFIG_SYSVIPC=y
5CONFIG_POSIX_MQUEUE=y 5CONFIG_POSIX_MQUEUE=y
6CONFIG_LOG_BUF_SHIFT=18 6CONFIG_LOG_BUF_SHIFT=18
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8CONFIG_PERF_COUNTERS=y 8CONFIG_PERF_EVENTS=y
9# CONFIG_COMPAT_BRK is not set 9# CONFIG_COMPAT_BRK is not set
10CONFIG_SLAB=y 10CONFIG_SLAB=y
11CONFIG_PROFILING=y 11CONFIG_PROFILING=y
diff --git a/arch/sparc/include/asm/asi.h b/arch/sparc/include/asm/asi.h
index b2e3db63a64b..cbb93e5141de 100644
--- a/arch/sparc/include/asm/asi.h
+++ b/arch/sparc/include/asm/asi.h
@@ -112,6 +112,20 @@
112 112
113#define ASI_M_ACTION 0x4c /* Breakpoint Action Register (GNU/Viking) */ 113#define ASI_M_ACTION 0x4c /* Breakpoint Action Register (GNU/Viking) */
114 114
115/* LEON ASI */
116#define ASI_LEON_NOCACHE 0x01
117
118#define ASI_LEON_DCACHE_MISS 0x01
119
120#define ASI_LEON_CACHEREGS 0x02
121#define ASI_LEON_IFLUSH 0x10
122#define ASI_LEON_DFLUSH 0x11
123
124#define ASI_LEON_MMUFLUSH 0x18
125#define ASI_LEON_MMUREGS 0x19
126#define ASI_LEON_BYPASS 0x1c
127#define ASI_LEON_FLUSH_PAGE 0x10
128
115/* V9 Architecture mandary ASIs. */ 129/* V9 Architecture mandary ASIs. */
116#define ASI_N 0x04 /* Nucleus */ 130#define ASI_N 0x04 /* Nucleus */
117#define ASI_NL 0x0c /* Nucleus, little endian */ 131#define ASI_NL 0x0c /* Nucleus, little endian */
diff --git a/arch/sparc/include/asm/asmmacro.h b/arch/sparc/include/asm/asmmacro.h
index a995bf8aba3f..02a172fb193a 100644
--- a/arch/sparc/include/asm/asmmacro.h
+++ b/arch/sparc/include/asm/asmmacro.h
@@ -6,17 +6,6 @@
6#ifndef _SPARC_ASMMACRO_H 6#ifndef _SPARC_ASMMACRO_H
7#define _SPARC_ASMMACRO_H 7#define _SPARC_ASMMACRO_H
8 8
9#include <asm/btfixup.h>
10#include <asm/asi.h>
11
12#define GET_PROCESSOR4M_ID(reg) \
13 rd %tbr, %reg; \
14 srl %reg, 12, %reg; \
15 and %reg, 3, %reg;
16
17#define GET_PROCESSOR4D_ID(reg) \
18 lda [%g0] ASI_M_VIKING_TMP1, %reg;
19
20/* All trap entry points _must_ begin with this macro or else you 9/* All trap entry points _must_ begin with this macro or else you
21 * lose. It makes sure the kernel has a proper window so that 10 * lose. It makes sure the kernel has a proper window so that
22 * c-code can be called. 11 * c-code can be called.
@@ -31,10 +20,4 @@
31/* All traps low-level code here must end with this macro. */ 20/* All traps low-level code here must end with this macro. */
32#define RESTORE_ALL b ret_trap_entry; clr %l6; 21#define RESTORE_ALL b ret_trap_entry; clr %l6;
33 22
34/* sun4 probably wants half word accesses to ASI_SEGMAP, while sun4c+
35 likes byte accesses. These are to avoid ifdef mania. */
36
37#define lduXa lduba
38#define stXa stba
39
40#endif /* !(_SPARC_ASMMACRO_H) */ 23#endif /* !(_SPARC_ASMMACRO_H) */
diff --git a/arch/sparc/include/asm/btfixup.h b/arch/sparc/include/asm/btfixup.h
deleted file mode 100644
index 797722cf69f2..000000000000
--- a/arch/sparc/include/asm/btfixup.h
+++ /dev/null
@@ -1,208 +0,0 @@
1/*
2 * asm/btfixup.h: Macros for boot time linking.
3 *
4 * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
5 */
6
7#ifndef _SPARC_BTFIXUP_H
8#define _SPARC_BTFIXUP_H
9
10#include <linux/init.h>
11
12#ifndef __ASSEMBLY__
13
14#ifdef MODULE
15extern unsigned int ___illegal_use_of_BTFIXUP_SIMM13_in_module(void);
16extern unsigned int ___illegal_use_of_BTFIXUP_SETHI_in_module(void);
17extern unsigned int ___illegal_use_of_BTFIXUP_HALF_in_module(void);
18extern unsigned int ___illegal_use_of_BTFIXUP_INT_in_module(void);
19
20#define BTFIXUP_SIMM13(__name) ___illegal_use_of_BTFIXUP_SIMM13_in_module()
21#define BTFIXUP_HALF(__name) ___illegal_use_of_BTFIXUP_HALF_in_module()
22#define BTFIXUP_SETHI(__name) ___illegal_use_of_BTFIXUP_SETHI_in_module()
23#define BTFIXUP_INT(__name) ___illegal_use_of_BTFIXUP_INT_in_module()
24#define BTFIXUP_BLACKBOX(__name) ___illegal_use_of_BTFIXUP_BLACKBOX_in_module
25
26#else
27
28#define BTFIXUP_SIMM13(__name) ___sf_##__name()
29#define BTFIXUP_HALF(__name) ___af_##__name()
30#define BTFIXUP_SETHI(__name) ___hf_##__name()
31#define BTFIXUP_INT(__name) ((unsigned int)&___i_##__name)
32/* This must be written in assembly and present in a sethi */
33#define BTFIXUP_BLACKBOX(__name) ___b_##__name
34#endif /* MODULE */
35
36/* Fixup call xx */
37
38#define BTFIXUPDEF_CALL(__type, __name, __args...) \
39 extern __type ___f_##__name(__args); \
40 extern unsigned ___fs_##__name[3];
41#define BTFIXUPDEF_CALL_CONST(__type, __name, __args...) \
42 extern __type ___f_##__name(__args) __attribute_const__; \
43 extern unsigned ___fs_##__name[3];
44#define BTFIXUP_CALL(__name) ___f_##__name
45
46#define BTFIXUPDEF_BLACKBOX(__name) \
47 extern unsigned ___bs_##__name[2];
48
49/* Put bottom 13bits into some register variable */
50
51#define BTFIXUPDEF_SIMM13(__name) \
52 static inline unsigned int ___sf_##__name(void) __attribute_const__; \
53 extern unsigned ___ss_##__name[2]; \
54 static inline unsigned int ___sf_##__name(void) { \
55 unsigned int ret; \
56 __asm__ ("or %%g0, ___s_" #__name ", %0" : "=r"(ret)); \
57 return ret; \
58 }
59#define BTFIXUPDEF_SIMM13_INIT(__name,__val) \
60 static inline unsigned int ___sf_##__name(void) __attribute_const__; \
61 extern unsigned ___ss_##__name[2]; \
62 static inline unsigned int ___sf_##__name(void) { \
63 unsigned int ret; \
64 __asm__ ("or %%g0, ___s_" #__name "__btset_" #__val ", %0" : "=r"(ret));\
65 return ret; \
66 }
67
68/* Put either bottom 13 bits, or upper 22 bits into some register variable
69 * (depending on the value, this will lead into sethi FIX, reg; or
70 * mov FIX, reg; )
71 */
72
73#define BTFIXUPDEF_HALF(__name) \
74 static inline unsigned int ___af_##__name(void) __attribute_const__; \
75 extern unsigned ___as_##__name[2]; \
76 static inline unsigned int ___af_##__name(void) { \
77 unsigned int ret; \
78 __asm__ ("or %%g0, ___a_" #__name ", %0" : "=r"(ret)); \
79 return ret; \
80 }
81#define BTFIXUPDEF_HALF_INIT(__name,__val) \
82 static inline unsigned int ___af_##__name(void) __attribute_const__; \
83 extern unsigned ___as_##__name[2]; \
84 static inline unsigned int ___af_##__name(void) { \
85 unsigned int ret; \
86 __asm__ ("or %%g0, ___a_" #__name "__btset_" #__val ", %0" : "=r"(ret));\
87 return ret; \
88 }
89
90/* Put upper 22 bits into some register variable */
91
92#define BTFIXUPDEF_SETHI(__name) \
93 static inline unsigned int ___hf_##__name(void) __attribute_const__; \
94 extern unsigned ___hs_##__name[2]; \
95 static inline unsigned int ___hf_##__name(void) { \
96 unsigned int ret; \
97 __asm__ ("sethi %%hi(___h_" #__name "), %0" : "=r"(ret)); \
98 return ret; \
99 }
100#define BTFIXUPDEF_SETHI_INIT(__name,__val) \
101 static inline unsigned int ___hf_##__name(void) __attribute_const__; \
102 extern unsigned ___hs_##__name[2]; \
103 static inline unsigned int ___hf_##__name(void) { \
104 unsigned int ret; \
105 __asm__ ("sethi %%hi(___h_" #__name "__btset_" #__val "), %0" : \
106 "=r"(ret)); \
107 return ret; \
108 }
109
110/* Put a full 32bit integer into some register variable */
111
112#define BTFIXUPDEF_INT(__name) \
113 extern unsigned char ___i_##__name; \
114 extern unsigned ___is_##__name[2];
115
116#define BTFIXUPCALL_NORM 0x00000000 /* Always call */
117#define BTFIXUPCALL_NOP 0x01000000 /* Possibly optimize to nop */
118#define BTFIXUPCALL_RETINT(i) (0x90102000|((i) & 0x1fff)) /* Possibly optimize to mov i, %o0 */
119#define BTFIXUPCALL_ORINT(i) (0x90122000|((i) & 0x1fff)) /* Possibly optimize to or %o0, i, %o0 */
120#define BTFIXUPCALL_RETO0 0x01000000 /* Return first parameter, actually a nop */
121#define BTFIXUPCALL_ANDNINT(i) (0x902a2000|((i) & 0x1fff)) /* Possibly optimize to andn %o0, i, %o0 */
122#define BTFIXUPCALL_SWAPO0O1 0xd27a0000 /* Possibly optimize to swap [%o0],%o1 */
123#define BTFIXUPCALL_SWAPO0G0 0xc07a0000 /* Possibly optimize to swap [%o0],%g0 */
124#define BTFIXUPCALL_SWAPG1G2 0xc4784000 /* Possibly optimize to swap [%g1],%g2 */
125#define BTFIXUPCALL_STG0O0 0xc0220000 /* Possibly optimize to st %g0,[%o0] */
126#define BTFIXUPCALL_STO1O0 0xd2220000 /* Possibly optimize to st %o1,[%o0] */
127
128#define BTFIXUPSET_CALL(__name, __addr, __insn) \
129 do { \
130 ___fs_##__name[0] |= 1; \
131 ___fs_##__name[1] = (unsigned long)__addr; \
132 ___fs_##__name[2] = __insn; \
133 } while (0)
134
135#define BTFIXUPSET_BLACKBOX(__name, __func) \
136 do { \
137 ___bs_##__name[0] |= 1; \
138 ___bs_##__name[1] = (unsigned long)__func; \
139 } while (0)
140
141#define BTFIXUPCOPY_CALL(__name, __from) \
142 do { \
143 ___fs_##__name[0] |= 1; \
144 ___fs_##__name[1] = ___fs_##__from[1]; \
145 ___fs_##__name[2] = ___fs_##__from[2]; \
146 } while (0)
147
148#define BTFIXUPSET_SIMM13(__name, __val) \
149 do { \
150 ___ss_##__name[0] |= 1; \
151 ___ss_##__name[1] = (unsigned)__val; \
152 } while (0)
153
154#define BTFIXUPCOPY_SIMM13(__name, __from) \
155 do { \
156 ___ss_##__name[0] |= 1; \
157 ___ss_##__name[1] = ___ss_##__from[1]; \
158 } while (0)
159
160#define BTFIXUPSET_HALF(__name, __val) \
161 do { \
162 ___as_##__name[0] |= 1; \
163 ___as_##__name[1] = (unsigned)__val; \
164 } while (0)
165
166#define BTFIXUPCOPY_HALF(__name, __from) \
167 do { \
168 ___as_##__name[0] |= 1; \
169 ___as_##__name[1] = ___as_##__from[1]; \
170 } while (0)
171
172#define BTFIXUPSET_SETHI(__name, __val) \
173 do { \
174 ___hs_##__name[0] |= 1; \
175 ___hs_##__name[1] = (unsigned)__val; \
176 } while (0)
177
178#define BTFIXUPCOPY_SETHI(__name, __from) \
179 do { \
180 ___hs_##__name[0] |= 1; \
181 ___hs_##__name[1] = ___hs_##__from[1]; \
182 } while (0)
183
184#define BTFIXUPSET_INT(__name, __val) \
185 do { \
186 ___is_##__name[0] |= 1; \
187 ___is_##__name[1] = (unsigned)__val; \
188 } while (0)
189
190#define BTFIXUPCOPY_INT(__name, __from) \
191 do { \
192 ___is_##__name[0] |= 1; \
193 ___is_##__name[1] = ___is_##__from[1]; \
194 } while (0)
195
196#define BTFIXUPVAL_CALL(__name) \
197 ((unsigned long)___fs_##__name[1])
198
199extern void btfixup(void);
200
201#else /* __ASSEMBLY__ */
202
203#define BTFIXUP_SETHI(__name) %hi(___h_ ## __name)
204#define BTFIXUP_SETHI_INIT(__name,__val) %hi(___h_ ## __name ## __btset_ ## __val)
205
206#endif /* __ASSEMBLY__ */
207
208#endif /* !(_SPARC_BTFIXUP_H) */
diff --git a/arch/sparc/include/asm/cache.h b/arch/sparc/include/asm/cache.h
index 69358b590c91..5bb6991b4857 100644
--- a/arch/sparc/include/asm/cache.h
+++ b/arch/sparc/include/asm/cache.h
@@ -22,118 +22,4 @@
22 22
23#define __read_mostly __attribute__((__section__(".data..read_mostly"))) 23#define __read_mostly __attribute__((__section__(".data..read_mostly")))
24 24
25#ifdef CONFIG_SPARC32
26#include <asm/asi.h>
27
28/* Direct access to the instruction cache is provided through and
29 * alternate address space. The IDC bit must be off in the ICCR on
30 * HyperSparcs for these accesses to work. The code below does not do
31 * any checking, the caller must do so. These routines are for
32 * diagnostics only, but could end up being useful. Use with care.
33 * Also, you are asking for trouble if you execute these in one of the
34 * three instructions following a %asr/%psr access or modification.
35 */
36
37/* First, cache-tag access. */
38static inline unsigned int get_icache_tag(int setnum, int tagnum)
39{
40 unsigned int vaddr, retval;
41
42 vaddr = ((setnum&1) << 12) | ((tagnum&0x7f) << 5);
43 __asm__ __volatile__("lda [%1] %2, %0\n\t" :
44 "=r" (retval) :
45 "r" (vaddr), "i" (ASI_M_TXTC_TAG));
46 return retval;
47}
48
49static inline void put_icache_tag(int setnum, int tagnum, unsigned int entry)
50{
51 unsigned int vaddr;
52
53 vaddr = ((setnum&1) << 12) | ((tagnum&0x7f) << 5);
54 __asm__ __volatile__("sta %0, [%1] %2\n\t" : :
55 "r" (entry), "r" (vaddr), "i" (ASI_M_TXTC_TAG) :
56 "memory");
57}
58
59/* Second cache-data access. The data is returned two-32bit quantities
60 * at a time.
61 */
62static inline void get_icache_data(int setnum, int tagnum, int subblock,
63 unsigned int *data)
64{
65 unsigned int value1, value2, vaddr;
66
67 vaddr = ((setnum&0x1) << 12) | ((tagnum&0x7f) << 5) |
68 ((subblock&0x3) << 3);
69 __asm__ __volatile__("ldda [%2] %3, %%g2\n\t"
70 "or %%g0, %%g2, %0\n\t"
71 "or %%g0, %%g3, %1\n\t" :
72 "=r" (value1), "=r" (value2) :
73 "r" (vaddr), "i" (ASI_M_TXTC_DATA) :
74 "g2", "g3");
75 data[0] = value1; data[1] = value2;
76}
77
78static inline void put_icache_data(int setnum, int tagnum, int subblock,
79 unsigned int *data)
80{
81 unsigned int value1, value2, vaddr;
82
83 vaddr = ((setnum&0x1) << 12) | ((tagnum&0x7f) << 5) |
84 ((subblock&0x3) << 3);
85 value1 = data[0]; value2 = data[1];
86 __asm__ __volatile__("or %%g0, %0, %%g2\n\t"
87 "or %%g0, %1, %%g3\n\t"
88 "stda %%g2, [%2] %3\n\t" : :
89 "r" (value1), "r" (value2),
90 "r" (vaddr), "i" (ASI_M_TXTC_DATA) :
91 "g2", "g3", "memory" /* no joke */);
92}
93
94/* Different types of flushes with the ICACHE. Some of the flushes
95 * affect both the ICACHE and the external cache. Others only clear
96 * the ICACHE entries on the cpu itself. V8's (most) allow
97 * granularity of flushes on the packet (element in line), whole line,
98 * and entire cache (ie. all lines) level. The ICACHE only flushes are
99 * ROSS HyperSparc specific and are in ross.h
100 */
101
102/* Flushes which clear out both the on-chip and external caches */
103static inline void flush_ei_page(unsigned int addr)
104{
105 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
106 "r" (addr), "i" (ASI_M_FLUSH_PAGE) :
107 "memory");
108}
109
110static inline void flush_ei_seg(unsigned int addr)
111{
112 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
113 "r" (addr), "i" (ASI_M_FLUSH_SEG) :
114 "memory");
115}
116
117static inline void flush_ei_region(unsigned int addr)
118{
119 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
120 "r" (addr), "i" (ASI_M_FLUSH_REGION) :
121 "memory");
122}
123
124static inline void flush_ei_ctx(unsigned int addr)
125{
126 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
127 "r" (addr), "i" (ASI_M_FLUSH_CTX) :
128 "memory");
129}
130
131static inline void flush_ei_user(unsigned int addr)
132{
133 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
134 "r" (addr), "i" (ASI_M_FLUSH_USER) :
135 "memory");
136}
137#endif /* CONFIG_SPARC32 */
138
139#endif /* !(_SPARC_CACHE_H) */ 25#endif /* !(_SPARC_CACHE_H) */
diff --git a/arch/sparc/include/asm/cacheflush.h b/arch/sparc/include/asm/cacheflush.h
index 049168087b19..f6c4839b8388 100644
--- a/arch/sparc/include/asm/cacheflush.h
+++ b/arch/sparc/include/asm/cacheflush.h
@@ -1,5 +1,9 @@
1#ifndef ___ASM_SPARC_CACHEFLUSH_H 1#ifndef ___ASM_SPARC_CACHEFLUSH_H
2#define ___ASM_SPARC_CACHEFLUSH_H 2#define ___ASM_SPARC_CACHEFLUSH_H
3
4/* flush addr - to allow use of self-modifying code */
5#define flushi(addr) __asm__ __volatile__ ("flush %0" : : "r" (addr) : "memory")
6
3#if defined(__sparc__) && defined(__arch64__) 7#if defined(__sparc__) && defined(__arch64__)
4#include <asm/cacheflush_64.h> 8#include <asm/cacheflush_64.h>
5#else 9#else
diff --git a/arch/sparc/include/asm/cacheflush_32.h b/arch/sparc/include/asm/cacheflush_32.h
index 68431b47a22a..bb014c24f318 100644
--- a/arch/sparc/include/asm/cacheflush_32.h
+++ b/arch/sparc/include/asm/cacheflush_32.h
@@ -1,56 +1,18 @@
1#ifndef _SPARC_CACHEFLUSH_H 1#ifndef _SPARC_CACHEFLUSH_H
2#define _SPARC_CACHEFLUSH_H 2#define _SPARC_CACHEFLUSH_H
3 3
4#include <linux/mm.h> /* Common for other includes */ 4#include <asm/cachetlb_32.h>
5// #include <linux/kernel.h> from pgalloc.h 5
6// #include <linux/sched.h> from pgalloc.h 6#define flush_cache_all() \
7 7 sparc32_cachetlb_ops->cache_all()
8// #include <asm/page.h> 8#define flush_cache_mm(mm) \
9#include <asm/btfixup.h> 9 sparc32_cachetlb_ops->cache_mm(mm)
10 10#define flush_cache_dup_mm(mm) \
11/* 11 sparc32_cachetlb_ops->cache_mm(mm)
12 * Fine grained cache flushing. 12#define flush_cache_range(vma,start,end) \
13 */ 13 sparc32_cachetlb_ops->cache_range(vma, start, end)
14#ifdef CONFIG_SMP 14#define flush_cache_page(vma,addr,pfn) \
15 15 sparc32_cachetlb_ops->cache_page(vma, addr)
16BTFIXUPDEF_CALL(void, local_flush_cache_all, void)
17BTFIXUPDEF_CALL(void, local_flush_cache_mm, struct mm_struct *)
18BTFIXUPDEF_CALL(void, local_flush_cache_range, struct vm_area_struct *, unsigned long, unsigned long)
19BTFIXUPDEF_CALL(void, local_flush_cache_page, struct vm_area_struct *, unsigned long)
20
21#define local_flush_cache_all() BTFIXUP_CALL(local_flush_cache_all)()
22#define local_flush_cache_mm(mm) BTFIXUP_CALL(local_flush_cache_mm)(mm)
23#define local_flush_cache_range(vma,start,end) BTFIXUP_CALL(local_flush_cache_range)(vma,start,end)
24#define local_flush_cache_page(vma,addr) BTFIXUP_CALL(local_flush_cache_page)(vma,addr)
25
26BTFIXUPDEF_CALL(void, local_flush_page_to_ram, unsigned long)
27BTFIXUPDEF_CALL(void, local_flush_sig_insns, struct mm_struct *, unsigned long)
28
29#define local_flush_page_to_ram(addr) BTFIXUP_CALL(local_flush_page_to_ram)(addr)
30#define local_flush_sig_insns(mm,insn_addr) BTFIXUP_CALL(local_flush_sig_insns)(mm,insn_addr)
31
32extern void smp_flush_cache_all(void);
33extern void smp_flush_cache_mm(struct mm_struct *mm);
34extern void smp_flush_cache_range(struct vm_area_struct *vma,
35 unsigned long start,
36 unsigned long end);
37extern void smp_flush_cache_page(struct vm_area_struct *vma, unsigned long page);
38
39extern void smp_flush_page_to_ram(unsigned long page);
40extern void smp_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr);
41
42#endif /* CONFIG_SMP */
43
44BTFIXUPDEF_CALL(void, flush_cache_all, void)
45BTFIXUPDEF_CALL(void, flush_cache_mm, struct mm_struct *)
46BTFIXUPDEF_CALL(void, flush_cache_range, struct vm_area_struct *, unsigned long, unsigned long)
47BTFIXUPDEF_CALL(void, flush_cache_page, struct vm_area_struct *, unsigned long)
48
49#define flush_cache_all() BTFIXUP_CALL(flush_cache_all)()
50#define flush_cache_mm(mm) BTFIXUP_CALL(flush_cache_mm)(mm)
51#define flush_cache_dup_mm(mm) BTFIXUP_CALL(flush_cache_mm)(mm)
52#define flush_cache_range(vma,start,end) BTFIXUP_CALL(flush_cache_range)(vma,start,end)
53#define flush_cache_page(vma,addr,pfn) BTFIXUP_CALL(flush_cache_page)(vma,addr)
54#define flush_icache_range(start, end) do { } while (0) 16#define flush_icache_range(start, end) do { } while (0)
55#define flush_icache_page(vma, pg) do { } while (0) 17#define flush_icache_page(vma, pg) do { } while (0)
56 18
@@ -67,11 +29,12 @@ BTFIXUPDEF_CALL(void, flush_cache_page, struct vm_area_struct *, unsigned long)
67 memcpy(dst, src, len); \ 29 memcpy(dst, src, len); \
68 } while (0) 30 } while (0)
69 31
70BTFIXUPDEF_CALL(void, __flush_page_to_ram, unsigned long) 32#define __flush_page_to_ram(addr) \
71BTFIXUPDEF_CALL(void, flush_sig_insns, struct mm_struct *, unsigned long) 33 sparc32_cachetlb_ops->page_to_ram(addr)
72 34#define flush_sig_insns(mm,insn_addr) \
73#define __flush_page_to_ram(addr) BTFIXUP_CALL(__flush_page_to_ram)(addr) 35 sparc32_cachetlb_ops->sig_insns(mm, insn_addr)
74#define flush_sig_insns(mm,insn_addr) BTFIXUP_CALL(flush_sig_insns)(mm,insn_addr) 36#define flush_page_for_dma(addr) \
37 sparc32_cachetlb_ops->page_for_dma(addr)
75 38
76extern void sparc_flush_page_to_ram(struct page *page); 39extern void sparc_flush_page_to_ram(struct page *page);
77 40
diff --git a/arch/sparc/include/asm/cacheflush_64.h b/arch/sparc/include/asm/cacheflush_64.h
index 2efea2ff88b7..301736d9e7a1 100644
--- a/arch/sparc/include/asm/cacheflush_64.h
+++ b/arch/sparc/include/asm/cacheflush_64.h
@@ -8,9 +8,6 @@
8#include <linux/mm.h> 8#include <linux/mm.h>
9 9
10/* Cache flush operations. */ 10/* Cache flush operations. */
11
12
13#define flushi(addr) __asm__ __volatile__ ("flush %0" : : "r" (addr) : "memory")
14#define flushw_all() __asm__ __volatile__("flushw") 11#define flushw_all() __asm__ __volatile__("flushw")
15 12
16extern void __flushw_user(void); 13extern void __flushw_user(void);
diff --git a/arch/sparc/include/asm/cachetlb_32.h b/arch/sparc/include/asm/cachetlb_32.h
new file mode 100644
index 000000000000..efb19889a083
--- /dev/null
+++ b/arch/sparc/include/asm/cachetlb_32.h
@@ -0,0 +1,29 @@
1#ifndef _SPARC_CACHETLB_H
2#define _SPARC_CACHETLB_H
3
4struct mm_struct;
5struct vm_area_struct;
6
7struct sparc32_cachetlb_ops {
8 void (*cache_all)(void);
9 void (*cache_mm)(struct mm_struct *);
10 void (*cache_range)(struct vm_area_struct *, unsigned long,
11 unsigned long);
12 void (*cache_page)(struct vm_area_struct *, unsigned long);
13
14 void (*tlb_all)(void);
15 void (*tlb_mm)(struct mm_struct *);
16 void (*tlb_range)(struct vm_area_struct *, unsigned long,
17 unsigned long);
18 void (*tlb_page)(struct vm_area_struct *, unsigned long);
19
20 void (*page_to_ram)(unsigned long);
21 void (*sig_insns)(struct mm_struct *, unsigned long);
22 void (*page_for_dma)(unsigned long);
23};
24extern const struct sparc32_cachetlb_ops *sparc32_cachetlb_ops;
25#ifdef CONFIG_SMP
26extern const struct sparc32_cachetlb_ops *local_ops;
27#endif
28
29#endif /* SPARC_CACHETLB_H */
diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include/asm/cmpxchg_32.h
index c786b0a92b51..1fae1a02e3c2 100644
--- a/arch/sparc/include/asm/cmpxchg_32.h
+++ b/arch/sparc/include/asm/cmpxchg_32.h
@@ -11,40 +11,13 @@
11#ifndef __ARCH_SPARC_CMPXCHG__ 11#ifndef __ARCH_SPARC_CMPXCHG__
12#define __ARCH_SPARC_CMPXCHG__ 12#define __ARCH_SPARC_CMPXCHG__
13 13
14#include <asm/btfixup.h>
15
16/* This has special calling conventions */
17#ifndef CONFIG_SMP
18BTFIXUPDEF_CALL(void, ___xchg32, void)
19#endif
20
21static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val) 14static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val)
22{ 15{
23#ifdef CONFIG_SMP
24 __asm__ __volatile__("swap [%2], %0" 16 __asm__ __volatile__("swap [%2], %0"
25 : "=&r" (val) 17 : "=&r" (val)
26 : "0" (val), "r" (m) 18 : "0" (val), "r" (m)
27 : "memory"); 19 : "memory");
28 return val; 20 return val;
29#else
30 register unsigned long *ptr asm("g1");
31 register unsigned long ret asm("g2");
32
33 ptr = (unsigned long *) m;
34 ret = val;
35
36 /* Note: this is magic and the nop there is
37 really needed. */
38 __asm__ __volatile__(
39 "mov %%o7, %%g4\n\t"
40 "call ___f____xchg32\n\t"
41 " nop\n\t"
42 : "=&r" (ret)
43 : "0" (ret), "r" (ptr)
44 : "g3", "g4", "g7", "memory", "cc");
45
46 return ret;
47#endif
48} 21}
49 22
50extern void __xchg_called_with_bad_pointer(void); 23extern void __xchg_called_with_bad_pointer(void);
diff --git a/arch/sparc/include/asm/contregs.h b/arch/sparc/include/asm/contregs.h
index 48fa8a4ef357..b8abdfcf5555 100644
--- a/arch/sparc/include/asm/contregs.h
+++ b/arch/sparc/include/asm/contregs.h
@@ -7,28 +7,6 @@
7 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 7 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
8 */ 8 */
9 9
10/* 3=sun3
11 4=sun4 (as in sun4 sysmaint student book)
12 c=sun4c (according to davem) */
13
14#define AC_IDPROM 0x00000000 /* 34 ID PROM, R/O, byte, 32 bytes */
15#define AC_PAGEMAP 0x10000000 /* 3 Pagemap R/W, long */
16#define AC_SEGMAP 0x20000000 /* 3 Segment map, byte */
17#define AC_CONTEXT 0x30000000 /* 34c current mmu-context */
18#define AC_SENABLE 0x40000000 /* 34c system dvma/cache/reset enable reg*/
19#define AC_UDVMA_ENB 0x50000000 /* 34 Not used on Sun boards, byte */
20#define AC_BUS_ERROR 0x60000000 /* 34 Not cleared on read, byte. */
21#define AC_SYNC_ERR 0x60000000 /* c fault type */
22#define AC_SYNC_VA 0x60000004 /* c fault virtual address */
23#define AC_ASYNC_ERR 0x60000008 /* c asynchronous fault type */
24#define AC_ASYNC_VA 0x6000000c /* c async fault virtual address */
25#define AC_LEDS 0x70000000 /* 34 Zero turns on LEDs, byte */
26#define AC_CACHETAGS 0x80000000 /* 34c direct access to the VAC tags */
27#define AC_CACHEDDATA 0x90000000 /* 3 c direct access to the VAC data */
28#define AC_UDVMA_MAP 0xD0000000 /* 4 Not used on Sun boards, byte */
29#define AC_VME_VECTOR 0xE0000000 /* 4 For non-Autovector VME, byte */
30#define AC_BOOT_SCC 0xF0000000 /* 34 bypass to access Zilog 8530. byte.*/
31
32/* s=Swift, h=Ross_HyperSPARC, v=TI_Viking, t=Tsunami, r=Ross_Cypress */ 10/* s=Swift, h=Ross_HyperSPARC, v=TI_Viking, t=Tsunami, r=Ross_Cypress */
33#define AC_M_PCR 0x0000 /* shv Processor Control Reg */ 11#define AC_M_PCR 0x0000 /* shv Processor Control Reg */
34#define AC_M_CTPR 0x0100 /* shv Context Table Pointer Reg */ 12#define AC_M_CTPR 0x0100 /* shv Context Table Pointer Reg */
diff --git a/arch/sparc/include/asm/cpu_type.h b/arch/sparc/include/asm/cpu_type.h
index 4ca184d95d82..84d7d83b8084 100644
--- a/arch/sparc/include/asm/cpu_type.h
+++ b/arch/sparc/include/asm/cpu_type.h
@@ -5,30 +5,24 @@
5 * Sparc (general) CPU types 5 * Sparc (general) CPU types
6 */ 6 */
7enum sparc_cpu { 7enum sparc_cpu {
8 sun4 = 0x00, 8 sun4m = 0x00,
9 sun4c = 0x01, 9 sun4d = 0x01,
10 sun4m = 0x02, 10 sun4e = 0x02,
11 sun4d = 0x03, 11 sun4u = 0x03, /* V8 ploos ploos */
12 sun4e = 0x04, 12 sun_unknown = 0x04,
13 sun4u = 0x05, /* V8 ploos ploos */ 13 ap1000 = 0x05, /* almost a sun4m */
14 sun_unknown = 0x06, 14 sparc_leon = 0x06, /* Leon SoC */
15 ap1000 = 0x07, /* almost a sun4m */
16 sparc_leon = 0x08, /* Leon SoC */
17}; 15};
18 16
19#ifdef CONFIG_SPARC32 17#ifdef CONFIG_SPARC32
20extern enum sparc_cpu sparc_cpu_model; 18extern enum sparc_cpu sparc_cpu_model;
21 19
22#define ARCH_SUN4C (sparc_cpu_model==sun4c)
23
24#define SUN4M_NCPUS 4 /* Architectural limit of sun4m. */ 20#define SUN4M_NCPUS 4 /* Architectural limit of sun4m. */
25 21
26#else 22#else
27 23
28#define sparc_cpu_model sun4u 24#define sparc_cpu_model sun4u
29 25
30/* This cannot ever be a sun4c :) That's just history. */
31#define ARCH_SUN4C 0
32#endif 26#endif
33 27
34#endif /* __ASM_CPU_TYPE_H */ 28#endif /* __ASM_CPU_TYPE_H */
diff --git a/arch/sparc/include/asm/cpudata_32.h b/arch/sparc/include/asm/cpudata_32.h
index a4c5a938b936..0300d94c25b3 100644
--- a/arch/sparc/include/asm/cpudata_32.h
+++ b/arch/sparc/include/asm/cpudata_32.h
@@ -14,7 +14,6 @@
14typedef struct { 14typedef struct {
15 unsigned long udelay_val; 15 unsigned long udelay_val;
16 unsigned long clock_tick; 16 unsigned long clock_tick;
17 unsigned int multiplier;
18 unsigned int counter; 17 unsigned int counter;
19#ifdef CONFIG_SMP 18#ifdef CONFIG_SMP
20 unsigned int irq_resched_count; 19 unsigned int irq_resched_count;
diff --git a/arch/sparc/include/asm/cypress.h b/arch/sparc/include/asm/cypress.h
deleted file mode 100644
index 95e9772ea394..000000000000
--- a/arch/sparc/include/asm/cypress.h
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * cypress.h: Cypress module specific definitions and defines.
3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 */
6
7#ifndef _SPARC_CYPRESS_H
8#define _SPARC_CYPRESS_H
9
10/* Cypress chips have %psr 'impl' of '0001' and 'vers' of '0001'. */
11
12/* The MMU control register fields on the Sparc Cypress 604/605 MMU's.
13 *
14 * ---------------------------------------------------------------
15 * |implvers| MCA | MCM |MV| MID |BM| C|RSV|MR|CM|CL|CE|RSV|NF|ME|
16 * ---------------------------------------------------------------
17 * 31 24 23-22 21-20 19 18-15 14 13 12 11 10 9 8 7-2 1 0
18 *
19 * MCA: MultiChip Access -- Used for configuration of multiple
20 * CY7C604/605 cache units.
21 * MCM: MultiChip Mask -- Again, for multiple cache unit config.
22 * MV: MultiChip Valid -- Indicates MCM and MCA have valid settings.
23 * MID: ModuleID -- Unique processor ID for MBus transactions. (605 only)
24 * BM: Boot Mode -- 0 = not in boot mode, 1 = in boot mode
25 * C: Cacheable -- Indicates whether accesses are cacheable while
26 * the MMU is off. 0=no 1=yes
27 * MR: MemoryReflection -- Indicates whether the bus attached to the
28 * MBus supports memory reflection. 0=no 1=yes (605 only)
29 * CM: CacheMode -- Indicates whether the cache is operating in write
30 * through or copy-back mode. 0=write-through 1=copy-back
31 * CL: CacheLock -- Indicates if the entire cache is locked or not.
32 * 0=not-locked 1=locked (604 only)
33 * CE: CacheEnable -- Is the virtual cache on? 0=no 1=yes
34 * NF: NoFault -- Do faults generate traps? 0=yes 1=no
35 * ME: MmuEnable -- Is the MMU doing translations? 0=no 1=yes
36 */
37
38#define CYPRESS_MCA 0x00c00000
39#define CYPRESS_MCM 0x00300000
40#define CYPRESS_MVALID 0x00080000
41#define CYPRESS_MIDMASK 0x00078000 /* Only on 605 */
42#define CYPRESS_BMODE 0x00004000
43#define CYPRESS_ACENABLE 0x00002000
44#define CYPRESS_MRFLCT 0x00000800 /* Only on 605 */
45#define CYPRESS_CMODE 0x00000400
46#define CYPRESS_CLOCK 0x00000200 /* Only on 604 */
47#define CYPRESS_CENABLE 0x00000100
48#define CYPRESS_NFAULT 0x00000002
49#define CYPRESS_MENABLE 0x00000001
50
51static inline void cypress_flush_page(unsigned long page)
52{
53 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
54 "r" (page), "i" (ASI_M_FLUSH_PAGE));
55}
56
57static inline void cypress_flush_segment(unsigned long addr)
58{
59 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
60 "r" (addr), "i" (ASI_M_FLUSH_SEG));
61}
62
63static inline void cypress_flush_region(unsigned long addr)
64{
65 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
66 "r" (addr), "i" (ASI_M_FLUSH_REGION));
67}
68
69static inline void cypress_flush_context(void)
70{
71 __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" : :
72 "i" (ASI_M_FLUSH_CTX));
73}
74
75/* XXX Displacement flushes for buggy chips and initial testing
76 * XXX go here.
77 */
78
79#endif /* !(_SPARC_CYPRESS_H) */
diff --git a/arch/sparc/include/asm/dma.h b/arch/sparc/include/asm/dma.h
index b554927bbaf6..3d434ef5eae3 100644
--- a/arch/sparc/include/asm/dma.h
+++ b/arch/sparc/include/asm/dma.h
@@ -92,27 +92,31 @@ extern int isa_dma_bridge_buggy;
92#ifdef CONFIG_SPARC32 92#ifdef CONFIG_SPARC32
93 93
94/* Routines for data transfer buffers. */ 94/* Routines for data transfer buffers. */
95BTFIXUPDEF_CALL(char *, mmu_lockarea, char *, unsigned long)
96BTFIXUPDEF_CALL(void, mmu_unlockarea, char *, unsigned long)
97
98#define mmu_lockarea(vaddr,len) BTFIXUP_CALL(mmu_lockarea)(vaddr,len)
99#define mmu_unlockarea(vaddr,len) BTFIXUP_CALL(mmu_unlockarea)(vaddr,len)
100
101struct page;
102struct device; 95struct device;
103struct scatterlist; 96struct scatterlist;
104 97
105/* These are implementations for sbus_map_sg/sbus_unmap_sg... collapse later */ 98struct sparc32_dma_ops {
106BTFIXUPDEF_CALL(__u32, mmu_get_scsi_one, struct device *, char *, unsigned long) 99 __u32 (*get_scsi_one)(struct device *, char *, unsigned long);
107BTFIXUPDEF_CALL(void, mmu_get_scsi_sgl, struct device *, struct scatterlist *, int) 100 void (*get_scsi_sgl)(struct device *, struct scatterlist *, int);
108BTFIXUPDEF_CALL(void, mmu_release_scsi_one, struct device *, __u32, unsigned long) 101 void (*release_scsi_one)(struct device *, __u32, unsigned long);
109BTFIXUPDEF_CALL(void, mmu_release_scsi_sgl, struct device *, struct scatterlist *, int) 102 void (*release_scsi_sgl)(struct device *, struct scatterlist *,int);
110 103#ifdef CONFIG_SBUS
111#define mmu_get_scsi_one(dev,vaddr,len) BTFIXUP_CALL(mmu_get_scsi_one)(dev,vaddr,len) 104 int (*map_dma_area)(struct device *, dma_addr_t *, unsigned long, unsigned long, int);
112#define mmu_get_scsi_sgl(dev,sg,sz) BTFIXUP_CALL(mmu_get_scsi_sgl)(dev,sg,sz) 105 void (*unmap_dma_area)(struct device *, unsigned long, int);
113#define mmu_release_scsi_one(dev,vaddr,len) BTFIXUP_CALL(mmu_release_scsi_one)(dev,vaddr,len) 106#endif
114#define mmu_release_scsi_sgl(dev,sg,sz) BTFIXUP_CALL(mmu_release_scsi_sgl)(dev,sg,sz) 107};
115 108extern const struct sparc32_dma_ops *sparc32_dma_ops;
109
110#define mmu_get_scsi_one(dev,vaddr,len) \
111 sparc32_dma_ops->get_scsi_one(dev, vaddr, len)
112#define mmu_get_scsi_sgl(dev,sg,sz) \
113 sparc32_dma_ops->get_scsi_sgl(dev, sg, sz)
114#define mmu_release_scsi_one(dev,vaddr,len) \
115 sparc32_dma_ops->release_scsi_one(dev, vaddr,len)
116#define mmu_release_scsi_sgl(dev,sg,sz) \
117 sparc32_dma_ops->release_scsi_sgl(dev, sg, sz)
118
119#ifdef CONFIG_SBUS
116/* 120/*
117 * mmu_map/unmap are provided by iommu/iounit; Invalid to call on IIep. 121 * mmu_map/unmap are provided by iommu/iounit; Invalid to call on IIep.
118 * 122 *
@@ -123,17 +127,17 @@ BTFIXUPDEF_CALL(void, mmu_release_scsi_sgl, struct device *, struct scatterlist
123 * Second mapping is for device visible address, or "bus" address. 127 * Second mapping is for device visible address, or "bus" address.
124 * The bus address is returned at '*pba'. 128 * The bus address is returned at '*pba'.
125 * 129 *
126 * These functions seem distinct, but are hard to split. On sun4c, 130 * These functions seem distinct, but are hard to split.
127 * at least for now, 'a' is equal to bus address, and retured in *pba.
128 * On sun4m, page attributes depend on the CPU type, so we have to 131 * On sun4m, page attributes depend on the CPU type, so we have to
129 * know if we are mapping RAM or I/O, so it has to be an additional argument 132 * know if we are mapping RAM or I/O, so it has to be an additional argument
130 * to a separate mapping function for CPU visible mappings. 133 * to a separate mapping function for CPU visible mappings.
131 */ 134 */
132BTFIXUPDEF_CALL(int, mmu_map_dma_area, struct device *, dma_addr_t *, unsigned long, unsigned long, int len) 135#define sbus_map_dma_area(dev,pba,va,a,len) \
133BTFIXUPDEF_CALL(void, mmu_unmap_dma_area, struct device *, unsigned long busa, int len) 136 sparc32_dma_ops->map_dma_area(dev, pba, va, a, len)
137#define sbus_unmap_dma_area(dev,ba,len) \
138 sparc32_dma_ops->unmap_dma_area(dev, ba, len)
139#endif /* CONFIG_SBUS */
134 140
135#define mmu_map_dma_area(dev,pba,va,a,len) BTFIXUP_CALL(mmu_map_dma_area)(dev,pba,va,a,len)
136#define mmu_unmap_dma_area(dev,ba,len) BTFIXUP_CALL(mmu_unmap_dma_area)(dev,ba,len)
137#endif 141#endif
138 142
139#endif /* !(_ASM_SPARC_DMA_H) */ 143#endif /* !(_ASM_SPARC_DMA_H) */
diff --git a/arch/sparc/include/asm/elf_32.h b/arch/sparc/include/asm/elf_32.h
index 4269ca6ad18a..2d4d755cba9e 100644
--- a/arch/sparc/include/asm/elf_32.h
+++ b/arch/sparc/include/asm/elf_32.h
@@ -118,16 +118,9 @@ typedef struct {
118 instruction set this cpu supports. This can NOT be done in userspace 118 instruction set this cpu supports. This can NOT be done in userspace
119 on Sparc. */ 119 on Sparc. */
120 120
121/* Sun4c has none of the capabilities, most sun4m's have them all. 121/* Most sun4m's have them all. */
122 * XXX This is gross, set some global variable at boot time. -DaveM 122#define ELF_HWCAP (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \
123 */ 123 HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV)
124#define ELF_HWCAP ((ARCH_SUN4C) ? 0 : \
125 (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \
126 HWCAP_SPARC_SWAP | \
127 ((srmmu_modtype != Cypress && \
128 srmmu_modtype != Cypress_vE && \
129 srmmu_modtype != Cypress_vD) ? \
130 HWCAP_SPARC_MULDIV : 0)))
131 124
132/* This yields a string that ld.so will use to load implementation 125/* This yields a string that ld.so will use to load implementation
133 specific libraries for optimization. This is more specific in 126 specific libraries for optimization. This is more specific in
diff --git a/arch/sparc/include/asm/floppy_32.h b/arch/sparc/include/asm/floppy_32.h
index 698d9559fead..fb3f16954c69 100644
--- a/arch/sparc/include/asm/floppy_32.h
+++ b/arch/sparc/include/asm/floppy_32.h
@@ -12,7 +12,6 @@
12#include <asm/page.h> 12#include <asm/page.h>
13#include <asm/pgtable.h> 13#include <asm/pgtable.h>
14#include <asm/idprom.h> 14#include <asm/idprom.h>
15#include <asm/machines.h>
16#include <asm/oplib.h> 15#include <asm/oplib.h>
17#include <asm/auxio.h> 16#include <asm/auxio.h>
18#include <asm/irq.h> 17#include <asm/irq.h>
@@ -103,25 +102,13 @@ static struct sun_floppy_ops sun_fdops;
103/* Routines unique to each controller type on a Sun. */ 102/* Routines unique to each controller type on a Sun. */
104static void sun_set_dor(unsigned char value, int fdc_82077) 103static void sun_set_dor(unsigned char value, int fdc_82077)
105{ 104{
106 if (sparc_cpu_model == sun4c) { 105 if (fdc_82077)
107 unsigned int bits = 0;
108 if (value & 0x10)
109 bits |= AUXIO_FLPY_DSEL;
110 if ((value & 0x80) == 0)
111 bits |= AUXIO_FLPY_EJCT;
112 set_auxio(bits, (~bits) & (AUXIO_FLPY_DSEL|AUXIO_FLPY_EJCT));
113 }
114 if (fdc_82077) {
115 sun_fdc->dor_82077 = value; 106 sun_fdc->dor_82077 = value;
116 }
117} 107}
118 108
119static unsigned char sun_read_dir(void) 109static unsigned char sun_read_dir(void)
120{ 110{
121 if (sparc_cpu_model == sun4c) 111 return sun_fdc->dir_82077;
122 return (get_auxio() & AUXIO_FLPY_DCHG) ? 0x80 : 0;
123 else
124 return sun_fdc->dir_82077;
125} 112}
126 113
127static unsigned char sun_82072_fd_inb(int port) 114static unsigned char sun_82072_fd_inb(int port)
@@ -242,10 +229,7 @@ static inline void virtual_dma_init(void)
242static inline void sun_fd_disable_dma(void) 229static inline void sun_fd_disable_dma(void)
243{ 230{
244 doing_pdma = 0; 231 doing_pdma = 0;
245 if (pdma_base) { 232 pdma_base = NULL;
246 mmu_unlockarea(pdma_base, pdma_areasize);
247 pdma_base = NULL;
248 }
249} 233}
250 234
251static inline void sun_fd_set_dma_mode(int mode) 235static inline void sun_fd_set_dma_mode(int mode)
@@ -275,7 +259,6 @@ static inline void sun_fd_set_dma_count(int length)
275 259
276static inline void sun_fd_enable_dma(void) 260static inline void sun_fd_enable_dma(void)
277{ 261{
278 pdma_vaddr = mmu_lockarea(pdma_vaddr, pdma_size);
279 pdma_base = pdma_vaddr; 262 pdma_base = pdma_vaddr;
280 pdma_areasize = pdma_size; 263 pdma_areasize = pdma_size;
281} 264}
@@ -301,38 +284,36 @@ static int sun_floppy_init(void)
301{ 284{
302 struct platform_device *op; 285 struct platform_device *op;
303 struct device_node *dp; 286 struct device_node *dp;
287 struct resource r;
304 char state[128]; 288 char state[128];
305 phandle tnode, fd_node; 289 phandle fd_node;
290 phandle tnode;
306 int num_regs; 291 int num_regs;
307 struct resource r;
308 292
309 use_virtual_dma = 1; 293 use_virtual_dma = 1;
310 294
311 /* Forget it if we aren't on a machine that could possibly 295 /* Forget it if we aren't on a machine that could possibly
312 * ever have a floppy drive. 296 * ever have a floppy drive.
313 */ 297 */
314 if((sparc_cpu_model != sun4c && sparc_cpu_model != sun4m) || 298 if (sparc_cpu_model != sun4m) {
315 ((idprom->id_machtype == (SM_SUN4C | SM_4C_SLC)) ||
316 (idprom->id_machtype == (SM_SUN4C | SM_4C_ELC)))) {
317 /* We certainly don't have a floppy controller. */ 299 /* We certainly don't have a floppy controller. */
318 goto no_sun_fdc; 300 goto no_sun_fdc;
319 } 301 }
320 /* Well, try to find one. */ 302 /* Well, try to find one. */
321 tnode = prom_getchild(prom_root_node); 303 tnode = prom_getchild(prom_root_node);
322 fd_node = prom_searchsiblings(tnode, "obio"); 304 fd_node = prom_searchsiblings(tnode, "obio");
323 if(fd_node != 0) { 305 if (fd_node != 0) {
324 tnode = prom_getchild(fd_node); 306 tnode = prom_getchild(fd_node);
325 fd_node = prom_searchsiblings(tnode, "SUNW,fdtwo"); 307 fd_node = prom_searchsiblings(tnode, "SUNW,fdtwo");
326 } else { 308 } else {
327 fd_node = prom_searchsiblings(tnode, "fd"); 309 fd_node = prom_searchsiblings(tnode, "fd");
328 } 310 }
329 if(fd_node == 0) { 311 if (fd_node == 0) {
330 goto no_sun_fdc; 312 goto no_sun_fdc;
331 } 313 }
332 314
333 /* The sun4m lets us know if the controller is actually usable. */ 315 /* The sun4m lets us know if the controller is actually usable. */
334 if(sparc_cpu_model == sun4m && 316 if (prom_getproperty(fd_node, "status", state, sizeof(state)) != -1) {
335 prom_getproperty(fd_node, "status", state, sizeof(state)) != -1) {
336 if(!strcmp(state, "disabled")) { 317 if(!strcmp(state, "disabled")) {
337 goto no_sun_fdc; 318 goto no_sun_fdc;
338 } 319 }
@@ -343,12 +324,12 @@ static int sun_floppy_init(void)
343 memset(&r, 0, sizeof(r)); 324 memset(&r, 0, sizeof(r));
344 r.flags = fd_regs[0].which_io; 325 r.flags = fd_regs[0].which_io;
345 r.start = fd_regs[0].phys_addr; 326 r.start = fd_regs[0].phys_addr;
346 sun_fdc = (struct sun_flpy_controller *) 327 sun_fdc = of_ioremap(&r, 0, fd_regs[0].reg_size, "floppy");
347 of_ioremap(&r, 0, fd_regs[0].reg_size, "floppy");
348 328
349 /* Look up irq in platform_device. 329 /* Look up irq in platform_device.
350 * We try "SUNW,fdtwo" and "fd" 330 * We try "SUNW,fdtwo" and "fd"
351 */ 331 */
332 op = NULL;
352 for_each_node_by_name(dp, "SUNW,fdtwo") { 333 for_each_node_by_name(dp, "SUNW,fdtwo") {
353 op = of_find_device_by_node(dp); 334 op = of_find_device_by_node(dp);
354 if (op) 335 if (op)
@@ -367,7 +348,7 @@ static int sun_floppy_init(void)
367 FLOPPY_IRQ = op->archdata.irqs[0]; 348 FLOPPY_IRQ = op->archdata.irqs[0];
368 349
369 /* Last minute sanity check... */ 350 /* Last minute sanity check... */
370 if(sun_fdc->status_82072 == 0xff) { 351 if (sun_fdc->status_82072 == 0xff) {
371 sun_fdc = NULL; 352 sun_fdc = NULL;
372 goto no_sun_fdc; 353 goto no_sun_fdc;
373 } 354 }
diff --git a/arch/sparc/include/asm/floppy_64.h b/arch/sparc/include/asm/floppy_64.h
index bcef1f5a2a6d..e204f902e6c9 100644
--- a/arch/sparc/include/asm/floppy_64.h
+++ b/arch/sparc/include/asm/floppy_64.h
@@ -161,10 +161,7 @@ unsigned long pdma_areasize;
161static void sun_fd_disable_dma(void) 161static void sun_fd_disable_dma(void)
162{ 162{
163 doing_pdma = 0; 163 doing_pdma = 0;
164 if (pdma_base) { 164 pdma_base = NULL;
165 mmu_unlockarea(pdma_base, pdma_areasize);
166 pdma_base = NULL;
167 }
168} 165}
169 166
170static void sun_fd_set_dma_mode(int mode) 167static void sun_fd_set_dma_mode(int mode)
@@ -194,7 +191,6 @@ static void sun_fd_set_dma_count(int length)
194 191
195static void sun_fd_enable_dma(void) 192static void sun_fd_enable_dma(void)
196{ 193{
197 pdma_vaddr = mmu_lockarea(pdma_vaddr, pdma_size);
198 pdma_base = pdma_vaddr; 194 pdma_base = pdma_vaddr;
199 pdma_areasize = pdma_size; 195 pdma_areasize = pdma_size;
200} 196}
diff --git a/arch/sparc/include/asm/head_32.h b/arch/sparc/include/asm/head_32.h
index 7c35491a8b53..a76874838f61 100644
--- a/arch/sparc/include/asm/head_32.h
+++ b/arch/sparc/include/asm/head_32.h
@@ -2,15 +2,8 @@
2#define __SPARC_HEAD_H 2#define __SPARC_HEAD_H
3 3
4#define KERNBASE 0xf0000000 /* First address the kernel will eventually be */ 4#define KERNBASE 0xf0000000 /* First address the kernel will eventually be */
5#define LOAD_ADDR 0x4000 /* prom jumps to us here unless this is elf /boot */
6#define SUN4C_SEGSZ (1 << 18)
7#define SRMMU_L1_KBASE_OFFSET ((KERNBASE>>24)<<2) /* Used in boot remapping. */
8#define INTS_ENAB 0x01 /* entry.S uses this. */
9
10#define SUN4_PROM_VECTOR 0xFFE81000 /* SUN4 PROM needs to be hardwired */
11 5
12#define WRITE_PAUSE nop; nop; nop; /* Have to do this after %wim/%psr chg */ 6#define WRITE_PAUSE nop; nop; nop; /* Have to do this after %wim/%psr chg */
13#define NOP_INSN 0x01000000 /* Used to patch sparc_save_state */
14 7
15/* Here are some trap goodies */ 8/* Here are some trap goodies */
16 9
@@ -18,9 +11,7 @@
18#define TRAP_ENTRY(type, label) \ 11#define TRAP_ENTRY(type, label) \
19 rd %psr, %l0; b label; rd %wim, %l3; nop; 12 rd %psr, %l0; b label; rd %wim, %l3; nop;
20 13
21/* Data/text faults. Defaults to sun4c version at boot time. */ 14/* Data/text faults */
22#define SPARC_TFAULT rd %psr, %l0; rd %wim, %l3; b sun4c_fault; mov 1, %l7;
23#define SPARC_DFAULT rd %psr, %l0; rd %wim, %l3; b sun4c_fault; mov 0, %l7;
24#define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; b srmmu_fault; mov 1, %l7; 15#define SRMMU_TFAULT rd %psr, %l0; rd %wim, %l3; b srmmu_fault; mov 1, %l7;
25#define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; b srmmu_fault; mov 0, %l7; 16#define SRMMU_DFAULT rd %psr, %l0; rd %wim, %l3; b srmmu_fault; mov 0, %l7;
26 17
@@ -80,16 +71,6 @@
80#define TRAP_ENTRY_INTERRUPT(int_level) \ 71#define TRAP_ENTRY_INTERRUPT(int_level) \
81 mov int_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3; 72 mov int_level, %l7; rd %psr, %l0; b real_irq_entry; rd %wim, %l3;
82 73
83/* NMI's (Non Maskable Interrupts) are special, you can't keep them
84 * from coming in, and basically if you get one, the shows over. ;(
85 * On the sun4c they are usually asynchronous memory errors, on the
86 * the sun4m they could be either due to mem errors or a software
87 * initiated interrupt from the prom/kern on an SMP box saying "I
88 * command you to do CPU tricks, read your mailbox for more info."
89 */
90#define NMI_TRAP \
91 rd %wim, %l3; b linux_trap_nmi_sun4c; mov %psr, %l0; nop;
92
93/* Window overflows/underflows are special and we need to try to be as 74/* Window overflows/underflows are special and we need to try to be as
94 * efficient as possible here.... 75 * efficient as possible here....
95 */ 76 */
diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h
index a4e457f003ed..07659124c140 100644
--- a/arch/sparc/include/asm/leon.h
+++ b/arch/sparc/include/asm/leon.h
@@ -10,19 +10,6 @@
10 10
11#ifdef CONFIG_SPARC_LEON 11#ifdef CONFIG_SPARC_LEON
12 12
13#define ASI_LEON_NOCACHE 0x01
14
15#define ASI_LEON_DCACHE_MISS 0x1
16
17#define ASI_LEON_CACHEREGS 0x02
18#define ASI_LEON_IFLUSH 0x10
19#define ASI_LEON_DFLUSH 0x11
20
21#define ASI_LEON_MMUFLUSH 0x18
22#define ASI_LEON_MMUREGS 0x19
23#define ASI_LEON_BYPASS 0x1c
24#define ASI_LEON_FLUSH_PAGE 0x10
25
26/* mmu register access, ASI_LEON_MMUREGS */ 13/* mmu register access, ASI_LEON_MMUREGS */
27#define LEON_CNR_CTRL 0x000 14#define LEON_CNR_CTRL 0x000
28#define LEON_CNR_CTXP 0x100 15#define LEON_CNR_CTXP 0x100
@@ -57,29 +44,6 @@
57#define LEON_IRQMASK_R 0x0000fffe /* bit 15- 1 of lregs.irqmask */ 44#define LEON_IRQMASK_R 0x0000fffe /* bit 15- 1 of lregs.irqmask */
58#define LEON_IRQPRIO_R 0xfffe0000 /* bit 31-17 of lregs.irqmask */ 45#define LEON_IRQPRIO_R 0xfffe0000 /* bit 31-17 of lregs.irqmask */
59 46
60/* leon uart register definitions */
61#define LEON_OFF_UDATA 0x0
62#define LEON_OFF_USTAT 0x4
63#define LEON_OFF_UCTRL 0x8
64#define LEON_OFF_USCAL 0xc
65
66#define LEON_UCTRL_RE 0x01
67#define LEON_UCTRL_TE 0x02
68#define LEON_UCTRL_RI 0x04
69#define LEON_UCTRL_TI 0x08
70#define LEON_UCTRL_PS 0x10
71#define LEON_UCTRL_PE 0x20
72#define LEON_UCTRL_FL 0x40
73#define LEON_UCTRL_LB 0x80
74
75#define LEON_USTAT_DR 0x01
76#define LEON_USTAT_TS 0x02
77#define LEON_USTAT_TH 0x04
78#define LEON_USTAT_BR 0x08
79#define LEON_USTAT_OV 0x10
80#define LEON_USTAT_PE 0x20
81#define LEON_USTAT_FE 0x40
82
83#define LEON_MCFG2_SRAMDIS 0x00002000 47#define LEON_MCFG2_SRAMDIS 0x00002000
84#define LEON_MCFG2_SDRAMEN 0x00004000 48#define LEON_MCFG2_SDRAMEN 0x00004000
85#define LEON_MCFG2_SRAMBANKSZ 0x00001e00 /* [12-9] */ 49#define LEON_MCFG2_SRAMBANKSZ 0x00001e00 /* [12-9] */
@@ -89,8 +53,6 @@
89 53
90#define LEON_TCNT0_MASK 0x7fffff 54#define LEON_TCNT0_MASK 0x7fffff
91 55
92#define LEON_USTAT_ERROR (LEON_USTAT_OV | LEON_USTAT_PE | LEON_USTAT_FE)
93/* no break yet */
94 56
95#define ASI_LEON3_SYSCTRL 0x02 57#define ASI_LEON3_SYSCTRL 0x02
96#define ASI_LEON3_SYSCTRL_ICFG 0x08 58#define ASI_LEON3_SYSCTRL_ICFG 0x08
@@ -278,18 +240,11 @@ static inline int sparc_leon3_cpuid(void)
278#define LEON2_CFG_SSIZE_MASK 0x00007000UL 240#define LEON2_CFG_SSIZE_MASK 0x00007000UL
279 241
280#ifndef __ASSEMBLY__ 242#ifndef __ASSEMBLY__
281extern unsigned long srmmu_swprobe(unsigned long vaddr, unsigned long *paddr);
282extern void leon_flush_icache_all(void);
283extern void leon_flush_dcache_all(void);
284extern void leon_flush_cache_all(void);
285extern void leon_flush_tlb_all(void);
286extern int leon_flush_during_switch;
287extern int leon_flush_needed(void);
288
289struct vm_area_struct; 243struct vm_area_struct;
244
245extern unsigned long srmmu_swprobe(unsigned long vaddr, unsigned long *paddr);
290extern void leon_flush_icache_all(void); 246extern void leon_flush_icache_all(void);
291extern void leon_flush_dcache_all(void); 247extern void leon_flush_dcache_all(void);
292extern void leon_flush_pcache_all(struct vm_area_struct *vma, unsigned long page);
293extern void leon_flush_cache_all(void); 248extern void leon_flush_cache_all(void);
294extern void leon_flush_tlb_all(void); 249extern void leon_flush_tlb_all(void);
295extern int leon_flush_during_switch; 250extern int leon_flush_during_switch;
@@ -315,28 +270,19 @@ struct leon2_cacheregs {
315#include <linux/interrupt.h> 270#include <linux/interrupt.h>
316 271
317struct device_node; 272struct device_node;
273struct task_struct;
318extern unsigned int leon_build_device_irq(unsigned int real_irq, 274extern unsigned int leon_build_device_irq(unsigned int real_irq,
319 irq_flow_handler_t flow_handler, 275 irq_flow_handler_t flow_handler,
320 const char *name, int do_ack); 276 const char *name, int do_ack);
321extern void leon_update_virq_handling(unsigned int virq, 277extern void leon_update_virq_handling(unsigned int virq,
322 irq_flow_handler_t flow_handler, 278 irq_flow_handler_t flow_handler,
323 const char *name, int do_ack); 279 const char *name, int do_ack);
324extern void leon_clear_clock_irq(void); 280extern void leon_init_timers(void);
325extern void leon_load_profile_irq(int cpu, unsigned int limit);
326extern void leon_init_timers(irq_handler_t counter_fn);
327extern void leon_clear_clock_irq(void);
328extern void leon_load_profile_irq(int cpu, unsigned int limit);
329extern void leon_trans_init(struct device_node *dp); 281extern void leon_trans_init(struct device_node *dp);
330extern void leon_node_init(struct device_node *dp, struct device_node ***nextp); 282extern void leon_node_init(struct device_node *dp, struct device_node ***nextp);
331extern void leon_init_IRQ(void);
332extern void leon_init(void);
333extern unsigned long srmmu_swprobe(unsigned long vaddr, unsigned long *paddr);
334extern void init_leon(void); 283extern void init_leon(void);
335extern void poke_leonsparc(void); 284extern void poke_leonsparc(void);
336extern void leon3_getCacheRegs(struct leon3_cacheregs *regs); 285extern void leon3_getCacheRegs(struct leon3_cacheregs *regs);
337extern int leon_flush_needed(void);
338extern void leon_switch_mm(void);
339extern int srmmu_swprobe_trace;
340extern int leon3_ticker_irq; 286extern int leon3_ticker_irq;
341 287
342#ifdef CONFIG_SMP 288#ifdef CONFIG_SMP
@@ -344,7 +290,7 @@ extern int leon_smp_nrcpus(void);
344extern void leon_clear_profile_irq(int cpu); 290extern void leon_clear_profile_irq(int cpu);
345extern void leon_smp_done(void); 291extern void leon_smp_done(void);
346extern void leon_boot_cpus(void); 292extern void leon_boot_cpus(void);
347extern int leon_boot_one_cpu(int i); 293extern int leon_boot_one_cpu(int i, struct task_struct *);
348void leon_init_smp(void); 294void leon_init_smp(void);
349extern void cpu_idle(void); 295extern void cpu_idle(void);
350extern void init_IRQ(void); 296extern void init_IRQ(void);
@@ -380,7 +326,7 @@ extern int leon_ipi_irq;
380#define init_leon() do {} while (0) 326#define init_leon() do {} while (0)
381#define leon_smp_done() do {} while (0) 327#define leon_smp_done() do {} while (0)
382#define leon_boot_cpus() do {} while (0) 328#define leon_boot_cpus() do {} while (0)
383#define leon_boot_one_cpu(i) 1 329#define leon_boot_one_cpu(i, t) 1
384#define leon_init_smp() do {} while (0) 330#define leon_init_smp() do {} while (0)
385 331
386#endif /* !defined(CONFIG_SPARC_LEON) */ 332#endif /* !defined(CONFIG_SPARC_LEON) */
diff --git a/arch/sparc/include/asm/machines.h b/arch/sparc/include/asm/machines.h
index cd9c099567e4..fd6ddb05d1b7 100644
--- a/arch/sparc/include/asm/machines.h
+++ b/arch/sparc/include/asm/machines.h
@@ -12,11 +12,6 @@ struct Sun_Machine_Models {
12 unsigned char id_machtype; 12 unsigned char id_machtype;
13}; 13};
14 14
15/* Current number of machines we know about that has an IDPROM
16 * machtype entry including one entry for the 0x80 OBP machines.
17 */
18#define NUM_SUN_MACHINES 16
19
20/* The machine type in the idprom area looks like this: 15/* The machine type in the idprom area looks like this:
21 * 16 *
22 * --------------- 17 * ---------------
@@ -24,36 +19,20 @@ struct Sun_Machine_Models {
24 * --------------- 19 * ---------------
25 * 7 4 3 0 20 * 7 4 3 0
26 * 21 *
27 * The ARCH field determines the architecture line (sun4, sun4c, etc). 22 * The ARCH field determines the architecture line (sun4m, etc).
28 * The MACH field determines the machine make within that architecture. 23 * The MACH field determines the machine make within that architecture.
29 */ 24 */
30 25
31#define SM_ARCH_MASK 0xf0 26#define SM_ARCH_MASK 0xf0
32#define SM_SUN4 0x20
33#define M_LEON 0x30 27#define M_LEON 0x30
34#define SM_SUN4C 0x50
35#define SM_SUN4M 0x70 28#define SM_SUN4M 0x70
36#define SM_SUN4M_OBP 0x80 29#define SM_SUN4M_OBP 0x80
37 30
38#define SM_TYP_MASK 0x0f 31#define SM_TYP_MASK 0x0f
39/* Sun4 machines */
40#define SM_4_260 0x01 /* Sun 4/200 series */
41#define SM_4_110 0x02 /* Sun 4/100 series */
42#define SM_4_330 0x03 /* Sun 4/300 series */
43#define SM_4_470 0x04 /* Sun 4/400 series */
44 32
45/* Leon machines */ 33/* Leon machines */
46#define M_LEON3_SOC 0x02 /* Leon3 SoC */ 34#define M_LEON3_SOC 0x02 /* Leon3 SoC */
47 35
48/* Sun4c machines Full Name - PROM NAME */
49#define SM_4C_SS1 0x01 /* Sun4c SparcStation 1 - Sun 4/60 */
50#define SM_4C_IPC 0x02 /* Sun4c SparcStation IPC - Sun 4/40 */
51#define SM_4C_SS1PLUS 0x03 /* Sun4c SparcStation 1+ - Sun 4/65 */
52#define SM_4C_SLC 0x04 /* Sun4c SparcStation SLC - Sun 4/20 */
53#define SM_4C_SS2 0x05 /* Sun4c SparcStation 2 - Sun 4/75 */
54#define SM_4C_ELC 0x06 /* Sun4c SparcStation ELC - Sun 4/25 */
55#define SM_4C_IPX 0x07 /* Sun4c SparcStation IPX - Sun 4/50 */
56
57/* Sun4m machines, these predate the OpenBoot. These values only mean 36/* Sun4m machines, these predate the OpenBoot. These values only mean
58 * something if the value in the ARCH field is SM_SUN4M, if it is 37 * something if the value in the ARCH field is SM_SUN4M, if it is
59 * SM_SUN4M_OBP then you have the following situation: 38 * SM_SUN4M_OBP then you have the following situation:
diff --git a/arch/sparc/include/asm/mbus.h b/arch/sparc/include/asm/mbus.h
index 69f07a022ee6..14128bcc5821 100644
--- a/arch/sparc/include/asm/mbus.h
+++ b/arch/sparc/include/asm/mbus.h
@@ -8,14 +8,10 @@
8#define _SPARC_MBUS_H 8#define _SPARC_MBUS_H
9 9
10#include <asm/ross.h> /* HyperSparc stuff */ 10#include <asm/ross.h> /* HyperSparc stuff */
11#include <asm/cypress.h> /* Cypress Chips */
12#include <asm/viking.h> /* Ugh, bug city... */ 11#include <asm/viking.h> /* Ugh, bug city... */
13 12
14enum mbus_module { 13enum mbus_module {
15 HyperSparc = 0, 14 HyperSparc = 0,
16 Cypress = 1,
17 Cypress_vE = 2,
18 Cypress_vD = 3,
19 Swift_ok = 4, 15 Swift_ok = 4,
20 Swift_bad_c = 5, 16 Swift_bad_c = 5,
21 Swift_lots_o_bugs = 6, 17 Swift_lots_o_bugs = 6,
diff --git a/arch/sparc/include/asm/memreg.h b/arch/sparc/include/asm/memreg.h
deleted file mode 100644
index 845ad2b39183..000000000000
--- a/arch/sparc/include/asm/memreg.h
+++ /dev/null
@@ -1,51 +0,0 @@
1#ifndef _SPARC_MEMREG_H
2#define _SPARC_MEMREG_H
3/* memreg.h: Definitions of the values found in the synchronous
4 * and asynchronous memory error registers when a fault
5 * occurs on the sun4c.
6 *
7 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
8 */
9
10/* First the synchronous error codes, these are usually just
11 * normal page faults.
12 */
13
14#define SUN4C_SYNC_WDRESET 0x0001 /* watchdog reset */
15#define SUN4C_SYNC_SIZE 0x0002 /* bad access size? whuz this? */
16#define SUN4C_SYNC_PARITY 0x0008 /* bad ram chips caused a parity error */
17#define SUN4C_SYNC_SBUS 0x0010 /* the SBUS had some problems... */
18#define SUN4C_SYNC_NOMEM 0x0020 /* translation to non-existent ram */
19#define SUN4C_SYNC_PROT 0x0040 /* access violated pte protections */
20#define SUN4C_SYNC_NPRESENT 0x0080 /* pte said that page was not present */
21#define SUN4C_SYNC_BADWRITE 0x8000 /* while writing something went bogus */
22
23#define SUN4C_SYNC_BOLIXED \
24 (SUN4C_SYNC_WDRESET | SUN4C_SYNC_SIZE | SUN4C_SYNC_SBUS | \
25 SUN4C_SYNC_NOMEM | SUN4C_SYNC_PARITY)
26
27/* Now the asynchronous error codes, these are almost always produced
28 * by the cache writing things back to memory and getting a bad translation.
29 * Bad DVMA transactions can cause these faults too.
30 */
31
32#define SUN4C_ASYNC_BADDVMA 0x0010 /* error during DVMA access */
33#define SUN4C_ASYNC_NOMEM 0x0020 /* write back pointed to bad phys addr */
34#define SUN4C_ASYNC_BADWB 0x0080 /* write back points to non-present page */
35
36/* Memory parity error register with associated bit constants. */
37#ifndef __ASSEMBLY__
38extern __volatile__ unsigned long __iomem *sun4c_memerr_reg;
39#endif
40
41#define SUN4C_MPE_ERROR 0x80 /* Parity error detected. (ro) */
42#define SUN4C_MPE_MULTI 0x40 /* Multiple parity errors detected. (ro) */
43#define SUN4C_MPE_TEST 0x20 /* Write inverse parity. (rw) */
44#define SUN4C_MPE_CHECK 0x10 /* Enable parity checking. (rw) */
45#define SUN4C_MPE_ERR00 0x08 /* Parity error in bits 0-7. (ro) */
46#define SUN4C_MPE_ERR08 0x04 /* Parity error in bits 8-15. (ro) */
47#define SUN4C_MPE_ERR16 0x02 /* Parity error in bits 16-23. (ro) */
48#define SUN4C_MPE_ERR24 0x01 /* Parity error in bits 24-31. (ro) */
49#define SUN4C_MPE_ERRS 0x0F /* Bit mask for the error bits. (ro) */
50
51#endif /* !(_SPARC_MEMREG_H) */
diff --git a/arch/sparc/include/asm/mmu_context_32.h b/arch/sparc/include/asm/mmu_context_32.h
index 671a997b9e69..01456c900720 100644
--- a/arch/sparc/include/asm/mmu_context_32.h
+++ b/arch/sparc/include/asm/mmu_context_32.h
@@ -1,8 +1,6 @@
1#ifndef __SPARC_MMU_CONTEXT_H 1#ifndef __SPARC_MMU_CONTEXT_H
2#define __SPARC_MMU_CONTEXT_H 2#define __SPARC_MMU_CONTEXT_H
3 3
4#include <asm/btfixup.h>
5
6#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
7 5
8#include <asm-generic/mm_hooks.h> 6#include <asm-generic/mm_hooks.h>
@@ -23,14 +21,11 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
23 * all the page tables have been flushed. Our job is to destroy 21 * all the page tables have been flushed. Our job is to destroy
24 * any remaining processor-specific state. 22 * any remaining processor-specific state.
25 */ 23 */
26BTFIXUPDEF_CALL(void, destroy_context, struct mm_struct *) 24void destroy_context(struct mm_struct *mm);
27
28#define destroy_context(mm) BTFIXUP_CALL(destroy_context)(mm)
29 25
30/* Switch the current MM context. */ 26/* Switch the current MM context. */
31BTFIXUPDEF_CALL(void, switch_mm, struct mm_struct *, struct mm_struct *, struct task_struct *) 27void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm,
32 28 struct task_struct *tsk);
33#define switch_mm(old_mm, mm, tsk) BTFIXUP_CALL(switch_mm)(old_mm, mm, tsk)
34 29
35#define deactivate_mm(tsk,mm) do { } while (0) 30#define deactivate_mm(tsk,mm) do { } while (0)
36 31
diff --git a/arch/sparc/include/asm/obio.h b/arch/sparc/include/asm/obio.h
index 4ade0c8a2c79..910c1d9af1f8 100644
--- a/arch/sparc/include/asm/obio.h
+++ b/arch/sparc/include/asm/obio.h
@@ -220,19 +220,6 @@ static inline void cc_set_igen(unsigned gen)
220 "i" (ASI_M_MXCC)); 220 "i" (ASI_M_MXCC));
221} 221}
222 222
223/* +-------+-------------+-----------+------------------------------------+
224 * | bcast | devid | sid | levels mask |
225 * +-------+-------------+-----------+------------------------------------+
226 * 31 30 23 22 15 14 0
227 */
228#define IGEN_MESSAGE(bcast, devid, sid, levels) \
229 (((bcast) << 31) | ((devid) << 23) | ((sid) << 15) | (levels))
230
231static inline void sun4d_send_ipi(int cpu, int level)
232{
233 cc_set_igen(IGEN_MESSAGE(0, cpu << 3, 6 + ((level >> 1) & 7), 1 << (level - 1)));
234}
235
236#endif /* !__ASSEMBLY__ */ 223#endif /* !__ASSEMBLY__ */
237 224
238#endif /* !(_SPARC_OBIO_H) */ 225#endif /* !(_SPARC_OBIO_H) */
diff --git a/arch/sparc/include/asm/oplib_32.h b/arch/sparc/include/asm/oplib_32.h
index 71e5e9aeb67e..27517879a6c2 100644
--- a/arch/sparc/include/asm/oplib_32.h
+++ b/arch/sparc/include/asm/oplib_32.h
@@ -105,14 +105,6 @@ extern void prom_write(const char *buf, unsigned int len);
105extern int prom_startcpu(int cpunode, struct linux_prom_registers *context_table, 105extern int prom_startcpu(int cpunode, struct linux_prom_registers *context_table,
106 int context, char *program_counter); 106 int context, char *program_counter);
107 107
108/* Sun4/sun4c specific memory-management startup hook. */
109
110/* Map the passed segment in the given context at the passed
111 * virtual address.
112 */
113extern void prom_putsegment(int context, unsigned long virt_addr,
114 int physical_segment);
115
116/* Initialize the memory lists based upon the prom version. */ 108/* Initialize the memory lists based upon the prom version. */
117void prom_meminit(void); 109void prom_meminit(void);
118 110
diff --git a/arch/sparc/include/asm/page_32.h b/arch/sparc/include/asm/page_32.h
index bb5c2ac4055d..fab78a308ebf 100644
--- a/arch/sparc/include/asm/page_32.h
+++ b/arch/sparc/include/asm/page_32.h
@@ -14,8 +14,6 @@
14#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) 14#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
15#define PAGE_MASK (~(PAGE_SIZE-1)) 15#define PAGE_MASK (~(PAGE_SIZE-1))
16 16
17#include <asm/btfixup.h>
18
19#ifndef __ASSEMBLY__ 17#ifndef __ASSEMBLY__
20 18
21#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) 19#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
@@ -45,12 +43,6 @@ struct sparc_phys_banks {
45 43
46extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS+1]; 44extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS+1];
47 45
48/* Cache alias structure. Entry is valid if context != -1. */
49struct cache_palias {
50 unsigned long vaddr;
51 int context;
52};
53
54/* passing structs on the Sparc slow us down tremendously... */ 46/* passing structs on the Sparc slow us down tremendously... */
55 47
56/* #define STRICT_MM_TYPECHECKS */ 48/* #define STRICT_MM_TYPECHECKS */
@@ -116,10 +108,7 @@ typedef unsigned long iopgprot_t;
116typedef struct page *pgtable_t; 108typedef struct page *pgtable_t;
117 109
118extern unsigned long sparc_unmapped_base; 110extern unsigned long sparc_unmapped_base;
119 111#define TASK_UNMAPPED_BASE sparc_unmapped_base
120BTFIXUPDEF_SETHI(sparc_unmapped_base)
121
122#define TASK_UNMAPPED_BASE BTFIXUP_SETHI(sparc_unmapped_base)
123 112
124#else /* !(__ASSEMBLY__) */ 113#else /* !(__ASSEMBLY__) */
125 114
diff --git a/arch/sparc/include/asm/pgalloc_32.h b/arch/sparc/include/asm/pgalloc_32.h
index ca2b34456c4b..e5b169b46d21 100644
--- a/arch/sparc/include/asm/pgalloc_32.h
+++ b/arch/sparc/include/asm/pgalloc_32.h
@@ -4,8 +4,10 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/sched.h> 5#include <linux/sched.h>
6 6
7#include <asm/pgtsrmmu.h>
8#include <asm/pgtable.h>
9#include <asm/vaddrs.h>
7#include <asm/page.h> 10#include <asm/page.h>
8#include <asm/btfixup.h>
9 11
10struct page; 12struct page;
11 13
@@ -15,54 +17,74 @@ extern struct pgtable_cache_struct {
15 unsigned long pgtable_cache_sz; 17 unsigned long pgtable_cache_sz;
16 unsigned long pgd_cache_sz; 18 unsigned long pgd_cache_sz;
17} pgt_quicklists; 19} pgt_quicklists;
20
21unsigned long srmmu_get_nocache(int size, int align);
22void srmmu_free_nocache(unsigned long vaddr, int size);
23
18#define pgd_quicklist (pgt_quicklists.pgd_cache) 24#define pgd_quicklist (pgt_quicklists.pgd_cache)
19#define pmd_quicklist ((unsigned long *)0) 25#define pmd_quicklist ((unsigned long *)0)
20#define pte_quicklist (pgt_quicklists.pte_cache) 26#define pte_quicklist (pgt_quicklists.pte_cache)
21#define pgtable_cache_size (pgt_quicklists.pgtable_cache_sz) 27#define pgtable_cache_size (pgt_quicklists.pgtable_cache_sz)
22#define pgd_cache_size (pgt_quicklists.pgd_cache_sz) 28#define pgd_cache_size (pgt_quicklists.pgd_cache_sz)
23 29
24extern void check_pgt_cache(void); 30#define check_pgt_cache() do { } while (0)
25BTFIXUPDEF_CALL(void, do_check_pgt_cache, int, int)
26#define do_check_pgt_cache(low,high) BTFIXUP_CALL(do_check_pgt_cache)(low,high)
27
28BTFIXUPDEF_CALL(pgd_t *, get_pgd_fast, void)
29#define get_pgd_fast() BTFIXUP_CALL(get_pgd_fast)()
30 31
31BTFIXUPDEF_CALL(void, free_pgd_fast, pgd_t *) 32pgd_t *get_pgd_fast(void);
32#define free_pgd_fast(pgd) BTFIXUP_CALL(free_pgd_fast)(pgd) 33static inline void free_pgd_fast(pgd_t *pgd)
34{
35 srmmu_free_nocache((unsigned long)pgd, SRMMU_PGD_TABLE_SIZE);
36}
33 37
34#define pgd_free(mm, pgd) free_pgd_fast(pgd) 38#define pgd_free(mm, pgd) free_pgd_fast(pgd)
35#define pgd_alloc(mm) get_pgd_fast() 39#define pgd_alloc(mm) get_pgd_fast()
36 40
37BTFIXUPDEF_CALL(void, pgd_set, pgd_t *, pmd_t *) 41static inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp)
38#define pgd_set(pgdp,pmdp) BTFIXUP_CALL(pgd_set)(pgdp,pmdp) 42{
43 unsigned long pa = __nocache_pa((unsigned long)pmdp);
44
45 set_pte((pte_t *)pgdp, (SRMMU_ET_PTD | (pa >> 4)));
46}
47
39#define pgd_populate(MM, PGD, PMD) pgd_set(PGD, PMD) 48#define pgd_populate(MM, PGD, PMD) pgd_set(PGD, PMD)
40 49
41BTFIXUPDEF_CALL(pmd_t *, pmd_alloc_one, struct mm_struct *, unsigned long) 50static inline pmd_t *pmd_alloc_one(struct mm_struct *mm,
42#define pmd_alloc_one(mm, address) BTFIXUP_CALL(pmd_alloc_one)(mm, address) 51 unsigned long address)
52{
53 return (pmd_t *)srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE,
54 SRMMU_PMD_TABLE_SIZE);
55}
43 56
44BTFIXUPDEF_CALL(void, free_pmd_fast, pmd_t *) 57static inline void free_pmd_fast(pmd_t * pmd)
45#define free_pmd_fast(pmd) BTFIXUP_CALL(free_pmd_fast)(pmd) 58{
59 srmmu_free_nocache((unsigned long)pmd, SRMMU_PMD_TABLE_SIZE);
60}
46 61
47#define pmd_free(mm, pmd) free_pmd_fast(pmd) 62#define pmd_free(mm, pmd) free_pmd_fast(pmd)
48#define __pmd_free_tlb(tlb, pmd, addr) pmd_free((tlb)->mm, pmd) 63#define __pmd_free_tlb(tlb, pmd, addr) pmd_free((tlb)->mm, pmd)
49 64
50BTFIXUPDEF_CALL(void, pmd_populate, pmd_t *, struct page *) 65void pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep);
51#define pmd_populate(MM, PMD, PTE) BTFIXUP_CALL(pmd_populate)(PMD, PTE)
52#define pmd_pgtable(pmd) pmd_page(pmd) 66#define pmd_pgtable(pmd) pmd_page(pmd)
53BTFIXUPDEF_CALL(void, pmd_set, pmd_t *, pte_t *)
54#define pmd_populate_kernel(MM, PMD, PTE) BTFIXUP_CALL(pmd_set)(PMD, PTE)
55 67
56BTFIXUPDEF_CALL(pgtable_t , pte_alloc_one, struct mm_struct *, unsigned long) 68void pmd_set(pmd_t *pmdp, pte_t *ptep);
57#define pte_alloc_one(mm, address) BTFIXUP_CALL(pte_alloc_one)(mm, address) 69#define pmd_populate_kernel(MM, PMD, PTE) pmd_set(PMD, PTE)
58BTFIXUPDEF_CALL(pte_t *, pte_alloc_one_kernel, struct mm_struct *, unsigned long) 70
59#define pte_alloc_one_kernel(mm, addr) BTFIXUP_CALL(pte_alloc_one_kernel)(mm, addr) 71pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address);
72
73static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
74 unsigned long address)
75{
76 return (pte_t *)srmmu_get_nocache(PTE_SIZE, PTE_SIZE);
77}
78
79
80static inline void free_pte_fast(pte_t *pte)
81{
82 srmmu_free_nocache((unsigned long)pte, PTE_SIZE);
83}
60 84
61BTFIXUPDEF_CALL(void, free_pte_fast, pte_t *) 85#define pte_free_kernel(mm, pte) free_pte_fast(pte)
62#define pte_free_kernel(mm, pte) BTFIXUP_CALL(free_pte_fast)(pte)
63 86
64BTFIXUPDEF_CALL(void, pte_free, pgtable_t ) 87void pte_free(struct mm_struct * mm, pgtable_t pte);
65#define pte_free(mm, pte) BTFIXUP_CALL(pte_free)(pte)
66#define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, pte) 88#define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, pte)
67 89
68#endif /* _SPARC_PGALLOC_H */ 90#endif /* _SPARC_PGALLOC_H */
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
index 3d7101860e68..cbbbed5cb3aa 100644
--- a/arch/sparc/include/asm/pgtable_32.h
+++ b/arch/sparc/include/asm/pgtable_32.h
@@ -16,11 +16,9 @@
16#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <linux/swap.h> 17#include <linux/swap.h>
18#include <asm/types.h> 18#include <asm/types.h>
19#include <asm/pgtsun4c.h>
20#include <asm/pgtsrmmu.h> 19#include <asm/pgtsrmmu.h>
21#include <asm/vac-ops.h> 20#include <asm/vaddrs.h>
22#include <asm/oplib.h> 21#include <asm/oplib.h>
23#include <asm/btfixup.h>
24#include <asm/cpu_type.h> 22#include <asm/cpu_type.h>
25 23
26 24
@@ -30,87 +28,55 @@ struct page;
30extern void load_mmu(void); 28extern void load_mmu(void);
31extern unsigned long calc_highpages(void); 29extern unsigned long calc_highpages(void);
32 30
33BTFIXUPDEF_SIMM13(pgdir_shift)
34BTFIXUPDEF_SETHI(pgdir_size)
35BTFIXUPDEF_SETHI(pgdir_mask)
36
37BTFIXUPDEF_SIMM13(ptrs_per_pmd)
38BTFIXUPDEF_SIMM13(ptrs_per_pgd)
39BTFIXUPDEF_SIMM13(user_ptrs_per_pgd)
40
41#define pte_ERROR(e) __builtin_trap() 31#define pte_ERROR(e) __builtin_trap()
42#define pmd_ERROR(e) __builtin_trap() 32#define pmd_ERROR(e) __builtin_trap()
43#define pgd_ERROR(e) __builtin_trap() 33#define pgd_ERROR(e) __builtin_trap()
44 34
45BTFIXUPDEF_INT(page_none) 35#define PMD_SHIFT 22
46BTFIXUPDEF_INT(page_copy)
47BTFIXUPDEF_INT(page_readonly)
48BTFIXUPDEF_INT(page_kernel)
49
50#define PMD_SHIFT SUN4C_PMD_SHIFT
51#define PMD_SIZE (1UL << PMD_SHIFT) 36#define PMD_SIZE (1UL << PMD_SHIFT)
52#define PMD_MASK (~(PMD_SIZE-1)) 37#define PMD_MASK (~(PMD_SIZE-1))
53#define PMD_ALIGN(__addr) (((__addr) + ~PMD_MASK) & PMD_MASK) 38#define PMD_ALIGN(__addr) (((__addr) + ~PMD_MASK) & PMD_MASK)
54#define PGDIR_SHIFT BTFIXUP_SIMM13(pgdir_shift) 39#define PGDIR_SHIFT SRMMU_PGDIR_SHIFT
55#define PGDIR_SIZE BTFIXUP_SETHI(pgdir_size) 40#define PGDIR_SIZE SRMMU_PGDIR_SIZE
56#define PGDIR_MASK BTFIXUP_SETHI(pgdir_mask) 41#define PGDIR_MASK SRMMU_PGDIR_MASK
57#define PTRS_PER_PTE 1024 42#define PTRS_PER_PTE 1024
58#define PTRS_PER_PMD BTFIXUP_SIMM13(ptrs_per_pmd) 43#define PTRS_PER_PMD SRMMU_PTRS_PER_PMD
59#define PTRS_PER_PGD BTFIXUP_SIMM13(ptrs_per_pgd) 44#define PTRS_PER_PGD SRMMU_PTRS_PER_PGD
60#define USER_PTRS_PER_PGD BTFIXUP_SIMM13(user_ptrs_per_pgd) 45#define USER_PTRS_PER_PGD PAGE_OFFSET / SRMMU_PGDIR_SIZE
61#define FIRST_USER_ADDRESS 0 46#define FIRST_USER_ADDRESS 0
62#define PTE_SIZE (PTRS_PER_PTE*4) 47#define PTE_SIZE (PTRS_PER_PTE*4)
63 48
64#define PAGE_NONE __pgprot(BTFIXUP_INT(page_none)) 49#define PAGE_NONE SRMMU_PAGE_NONE
65extern pgprot_t PAGE_SHARED; 50#define PAGE_SHARED SRMMU_PAGE_SHARED
66#define PAGE_COPY __pgprot(BTFIXUP_INT(page_copy)) 51#define PAGE_COPY SRMMU_PAGE_COPY
67#define PAGE_READONLY __pgprot(BTFIXUP_INT(page_readonly)) 52#define PAGE_READONLY SRMMU_PAGE_RDONLY
68 53#define PAGE_KERNEL SRMMU_PAGE_KERNEL
69extern unsigned long page_kernel;
70
71#ifdef MODULE
72#define PAGE_KERNEL page_kernel
73#else
74#define PAGE_KERNEL __pgprot(BTFIXUP_INT(page_kernel))
75#endif
76 54
77/* Top-level page directory */ 55/* Top-level page directory */
78extern pgd_t swapper_pg_dir[1024]; 56extern pgd_t swapper_pg_dir[1024];
79 57
80extern void paging_init(void); 58extern void paging_init(void);
81 59
82/* Page table for 0-4MB for everybody, on the Sparc this
83 * holds the same as on the i386.
84 */
85extern pte_t pg0[1024];
86extern pte_t pg1[1024];
87extern pte_t pg2[1024];
88extern pte_t pg3[1024];
89
90extern unsigned long ptr_in_current_pgd; 60extern unsigned long ptr_in_current_pgd;
91 61
92/* Here is a trick, since mmap.c need the initializer elements for 62/* xwr */
93 * protection_map[] to be constant at compile time, I set the following 63#define __P000 PAGE_NONE
94 * to all zeros. I set it to the real values after I link in the 64#define __P001 PAGE_READONLY
95 * appropriate MMU page table routines at boot time. 65#define __P010 PAGE_COPY
96 */ 66#define __P011 PAGE_COPY
97#define __P000 __pgprot(0) 67#define __P100 PAGE_READONLY
98#define __P001 __pgprot(0) 68#define __P101 PAGE_READONLY
99#define __P010 __pgprot(0) 69#define __P110 PAGE_COPY
100#define __P011 __pgprot(0) 70#define __P111 PAGE_COPY
101#define __P100 __pgprot(0) 71
102#define __P101 __pgprot(0) 72#define __S000 PAGE_NONE
103#define __P110 __pgprot(0) 73#define __S001 PAGE_READONLY
104#define __P111 __pgprot(0) 74#define __S010 PAGE_SHARED
105 75#define __S011 PAGE_SHARED
106#define __S000 __pgprot(0) 76#define __S100 PAGE_READONLY
107#define __S001 __pgprot(0) 77#define __S101 PAGE_READONLY
108#define __S010 __pgprot(0) 78#define __S110 PAGE_SHARED
109#define __S011 __pgprot(0) 79#define __S111 PAGE_SHARED
110#define __S100 __pgprot(0)
111#define __S101 __pgprot(0)
112#define __S110 __pgprot(0)
113#define __S111 __pgprot(0)
114 80
115extern int num_contexts; 81extern int num_contexts;
116 82
@@ -137,82 +103,137 @@ extern unsigned long empty_zero_page;
137#define ZERO_PAGE(vaddr) (virt_to_page(&empty_zero_page)) 103#define ZERO_PAGE(vaddr) (virt_to_page(&empty_zero_page))
138 104
139/* 105/*
106 * In general all page table modifications should use the V8 atomic
107 * swap instruction. This insures the mmu and the cpu are in sync
108 * with respect to ref/mod bits in the page tables.
109 */
110static inline unsigned long srmmu_swap(unsigned long *addr, unsigned long value)
111{
112 __asm__ __volatile__("swap [%2], %0" : "=&r" (value) : "0" (value), "r" (addr));
113 return value;
114}
115
116/* Certain architectures need to do special things when pte's
117 * within a page table are directly modified. Thus, the following
118 * hook is made available.
140 */ 119 */
141BTFIXUPDEF_CALL_CONST(struct page *, pmd_page, pmd_t)
142BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page_vaddr, pgd_t)
143 120
144#define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd) 121static inline void set_pte(pte_t *ptep, pte_t pteval)
145#define pgd_page_vaddr(pgd) BTFIXUP_CALL(pgd_page_vaddr)(pgd) 122{
123 srmmu_swap((unsigned long *)ptep, pte_val(pteval));
124}
125
126#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
127
128static inline int srmmu_device_memory(unsigned long x)
129{
130 return ((x & 0xF0000000) != 0);
131}
132
133static inline struct page *pmd_page(pmd_t pmd)
134{
135 if (srmmu_device_memory(pmd_val(pmd)))
136 BUG();
137 return pfn_to_page((pmd_val(pmd) & SRMMU_PTD_PMASK) >> (PAGE_SHIFT-4));
138}
139
140static inline unsigned long pgd_page_vaddr(pgd_t pgd)
141{
142 if (srmmu_device_memory(pgd_val(pgd))) {
143 return ~0;
144 } else {
145 unsigned long v = pgd_val(pgd) & SRMMU_PTD_PMASK;
146 return (unsigned long)__nocache_va(v << 4);
147 }
148}
146 149
147BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t) 150static inline int pte_present(pte_t pte)
148BTFIXUPDEF_CALL(void, pte_clear, pte_t *) 151{
152 return ((pte_val(pte) & SRMMU_ET_MASK) == SRMMU_ET_PTE);
153}
149 154
150static inline int pte_none(pte_t pte) 155static inline int pte_none(pte_t pte)
151{ 156{
152 return !pte_val(pte); 157 return !pte_val(pte);
153} 158}
154 159
155#define pte_present(pte) BTFIXUP_CALL(pte_present)(pte) 160static inline void __pte_clear(pte_t *ptep)
156#define pte_clear(mm,addr,pte) BTFIXUP_CALL(pte_clear)(pte) 161{
162 set_pte(ptep, __pte(0));
163}
164
165static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
166{
167 __pte_clear(ptep);
168}
169
170static inline int pmd_bad(pmd_t pmd)
171{
172 return (pmd_val(pmd) & SRMMU_ET_MASK) != SRMMU_ET_PTD;
173}
157 174
158BTFIXUPDEF_CALL_CONST(int, pmd_bad, pmd_t) 175static inline int pmd_present(pmd_t pmd)
159BTFIXUPDEF_CALL_CONST(int, pmd_present, pmd_t) 176{
160BTFIXUPDEF_CALL(void, pmd_clear, pmd_t *) 177 return ((pmd_val(pmd) & SRMMU_ET_MASK) == SRMMU_ET_PTD);
178}
161 179
162static inline int pmd_none(pmd_t pmd) 180static inline int pmd_none(pmd_t pmd)
163{ 181{
164 return !pmd_val(pmd); 182 return !pmd_val(pmd);
165} 183}
166 184
167#define pmd_bad(pmd) BTFIXUP_CALL(pmd_bad)(pmd) 185static inline void pmd_clear(pmd_t *pmdp)
168#define pmd_present(pmd) BTFIXUP_CALL(pmd_present)(pmd) 186{
169#define pmd_clear(pmd) BTFIXUP_CALL(pmd_clear)(pmd) 187 int i;
188 for (i = 0; i < PTRS_PER_PTE/SRMMU_REAL_PTRS_PER_PTE; i++)
189 set_pte((pte_t *)&pmdp->pmdv[i], __pte(0));
190}
170 191
171BTFIXUPDEF_CALL_CONST(int, pgd_none, pgd_t) 192static inline int pgd_none(pgd_t pgd)
172BTFIXUPDEF_CALL_CONST(int, pgd_bad, pgd_t) 193{
173BTFIXUPDEF_CALL_CONST(int, pgd_present, pgd_t) 194 return !(pgd_val(pgd) & 0xFFFFFFF);
174BTFIXUPDEF_CALL(void, pgd_clear, pgd_t *) 195}
175 196
176#define pgd_none(pgd) BTFIXUP_CALL(pgd_none)(pgd) 197static inline int pgd_bad(pgd_t pgd)
177#define pgd_bad(pgd) BTFIXUP_CALL(pgd_bad)(pgd) 198{
178#define pgd_present(pgd) BTFIXUP_CALL(pgd_present)(pgd) 199 return (pgd_val(pgd) & SRMMU_ET_MASK) != SRMMU_ET_PTD;
179#define pgd_clear(pgd) BTFIXUP_CALL(pgd_clear)(pgd) 200}
201
202static inline int pgd_present(pgd_t pgd)
203{
204 return ((pgd_val(pgd) & SRMMU_ET_MASK) == SRMMU_ET_PTD);
205}
206
207static inline void pgd_clear(pgd_t *pgdp)
208{
209 set_pte((pte_t *)pgdp, __pte(0));
210}
180 211
181/* 212/*
182 * The following only work if pte_present() is true. 213 * The following only work if pte_present() is true.
183 * Undefined behaviour if not.. 214 * Undefined behaviour if not..
184 */ 215 */
185BTFIXUPDEF_HALF(pte_writei)
186BTFIXUPDEF_HALF(pte_dirtyi)
187BTFIXUPDEF_HALF(pte_youngi)
188
189static int pte_write(pte_t pte) __attribute_const__;
190static inline int pte_write(pte_t pte) 216static inline int pte_write(pte_t pte)
191{ 217{
192 return pte_val(pte) & BTFIXUP_HALF(pte_writei); 218 return pte_val(pte) & SRMMU_WRITE;
193} 219}
194 220
195static int pte_dirty(pte_t pte) __attribute_const__;
196static inline int pte_dirty(pte_t pte) 221static inline int pte_dirty(pte_t pte)
197{ 222{
198 return pte_val(pte) & BTFIXUP_HALF(pte_dirtyi); 223 return pte_val(pte) & SRMMU_DIRTY;
199} 224}
200 225
201static int pte_young(pte_t pte) __attribute_const__;
202static inline int pte_young(pte_t pte) 226static inline int pte_young(pte_t pte)
203{ 227{
204 return pte_val(pte) & BTFIXUP_HALF(pte_youngi); 228 return pte_val(pte) & SRMMU_REF;
205} 229}
206 230
207/* 231/*
208 * The following only work if pte_present() is not true. 232 * The following only work if pte_present() is not true.
209 */ 233 */
210BTFIXUPDEF_HALF(pte_filei)
211
212static int pte_file(pte_t pte) __attribute_const__;
213static inline int pte_file(pte_t pte) 234static inline int pte_file(pte_t pte)
214{ 235{
215 return pte_val(pte) & BTFIXUP_HALF(pte_filei); 236 return pte_val(pte) & SRMMU_FILE;
216} 237}
217 238
218static inline int pte_special(pte_t pte) 239static inline int pte_special(pte_t pte)
@@ -220,68 +241,85 @@ static inline int pte_special(pte_t pte)
220 return 0; 241 return 0;
221} 242}
222 243
223/*
224 */
225BTFIXUPDEF_HALF(pte_wrprotecti)
226BTFIXUPDEF_HALF(pte_mkcleani)
227BTFIXUPDEF_HALF(pte_mkoldi)
228
229static pte_t pte_wrprotect(pte_t pte) __attribute_const__;
230static inline pte_t pte_wrprotect(pte_t pte) 244static inline pte_t pte_wrprotect(pte_t pte)
231{ 245{
232 return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_wrprotecti)); 246 return __pte(pte_val(pte) & ~SRMMU_WRITE);
233} 247}
234 248
235static pte_t pte_mkclean(pte_t pte) __attribute_const__;
236static inline pte_t pte_mkclean(pte_t pte) 249static inline pte_t pte_mkclean(pte_t pte)
237{ 250{
238 return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkcleani)); 251 return __pte(pte_val(pte) & ~SRMMU_DIRTY);
239} 252}
240 253
241static pte_t pte_mkold(pte_t pte) __attribute_const__;
242static inline pte_t pte_mkold(pte_t pte) 254static inline pte_t pte_mkold(pte_t pte)
243{ 255{
244 return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkoldi)); 256 return __pte(pte_val(pte) & ~SRMMU_REF);
245} 257}
246 258
247BTFIXUPDEF_CALL_CONST(pte_t, pte_mkwrite, pte_t) 259static inline pte_t pte_mkwrite(pte_t pte)
248BTFIXUPDEF_CALL_CONST(pte_t, pte_mkdirty, pte_t) 260{
249BTFIXUPDEF_CALL_CONST(pte_t, pte_mkyoung, pte_t) 261 return __pte(pte_val(pte) | SRMMU_WRITE);
262}
263
264static inline pte_t pte_mkdirty(pte_t pte)
265{
266 return __pte(pte_val(pte) | SRMMU_DIRTY);
267}
250 268
251#define pte_mkwrite(pte) BTFIXUP_CALL(pte_mkwrite)(pte) 269static inline pte_t pte_mkyoung(pte_t pte)
252#define pte_mkdirty(pte) BTFIXUP_CALL(pte_mkdirty)(pte) 270{
253#define pte_mkyoung(pte) BTFIXUP_CALL(pte_mkyoung)(pte) 271 return __pte(pte_val(pte) | SRMMU_REF);
272}
254 273
255#define pte_mkspecial(pte) (pte) 274#define pte_mkspecial(pte) (pte)
256 275
257#define pfn_pte(pfn, prot) mk_pte(pfn_to_page(pfn), prot) 276#define pfn_pte(pfn, prot) mk_pte(pfn_to_page(pfn), prot)
258 277
259BTFIXUPDEF_CALL(unsigned long, pte_pfn, pte_t) 278static inline unsigned long pte_pfn(pte_t pte)
260#define pte_pfn(pte) BTFIXUP_CALL(pte_pfn)(pte) 279{
280 if (srmmu_device_memory(pte_val(pte))) {
281 /* Just return something that will cause
282 * pfn_valid() to return false. This makes
283 * copy_one_pte() to just directly copy to
284 * PTE over.
285 */
286 return ~0UL;
287 }
288 return (pte_val(pte) & SRMMU_PTE_PMASK) >> (PAGE_SHIFT-4);
289}
290
261#define pte_page(pte) pfn_to_page(pte_pfn(pte)) 291#define pte_page(pte) pfn_to_page(pte_pfn(pte))
262 292
263/* 293/*
264 * Conversion functions: convert a page and protection to a page entry, 294 * Conversion functions: convert a page and protection to a page entry,
265 * and a page entry and page directory to the page they refer to. 295 * and a page entry and page directory to the page they refer to.
266 */ 296 */
267BTFIXUPDEF_CALL_CONST(pte_t, mk_pte, struct page *, pgprot_t) 297static inline pte_t mk_pte(struct page *page, pgprot_t pgprot)
268 298{
269BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_phys, unsigned long, pgprot_t) 299 return __pte((page_to_pfn(page) << (PAGE_SHIFT-4)) | pgprot_val(pgprot));
270BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_io, unsigned long, pgprot_t, int) 300}
271BTFIXUPDEF_CALL_CONST(pgprot_t, pgprot_noncached, pgprot_t)
272 301
273#define mk_pte(page,pgprot) BTFIXUP_CALL(mk_pte)(page,pgprot) 302static inline pte_t mk_pte_phys(unsigned long page, pgprot_t pgprot)
274#define mk_pte_phys(page,pgprot) BTFIXUP_CALL(mk_pte_phys)(page,pgprot) 303{
275#define mk_pte_io(page,pgprot,space) BTFIXUP_CALL(mk_pte_io)(page,pgprot,space) 304 return __pte(((page) >> 4) | pgprot_val(pgprot));
305}
276 306
277#define pgprot_noncached(pgprot) BTFIXUP_CALL(pgprot_noncached)(pgprot) 307static inline pte_t mk_pte_io(unsigned long page, pgprot_t pgprot, int space)
308{
309 return __pte(((page) >> 4) | (space << 28) | pgprot_val(pgprot));
310}
278 311
279BTFIXUPDEF_INT(pte_modify_mask) 312#define pgprot_noncached pgprot_noncached
313static inline pgprot_t pgprot_noncached(pgprot_t prot)
314{
315 prot &= ~__pgprot(SRMMU_CACHE);
316 return prot;
317}
280 318
281static pte_t pte_modify(pte_t pte, pgprot_t newprot) __attribute_const__; 319static pte_t pte_modify(pte_t pte, pgprot_t newprot) __attribute_const__;
282static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 320static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
283{ 321{
284 return __pte((pte_val(pte) & BTFIXUP_INT(pte_modify_mask)) | 322 return __pte((pte_val(pte) & SRMMU_CHG_MASK) |
285 pgprot_val(newprot)); 323 pgprot_val(newprot));
286} 324}
287 325
@@ -294,74 +332,69 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
294#define pgd_offset_k(address) pgd_offset(&init_mm, address) 332#define pgd_offset_k(address) pgd_offset(&init_mm, address)
295 333
296/* Find an entry in the second-level page table.. */ 334/* Find an entry in the second-level page table.. */
297BTFIXUPDEF_CALL(pmd_t *, pmd_offset, pgd_t *, unsigned long) 335static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long address)
298#define pmd_offset(dir,addr) BTFIXUP_CALL(pmd_offset)(dir,addr) 336{
337 return (pmd_t *) pgd_page_vaddr(*dir) +
338 ((address >> PMD_SHIFT) & (PTRS_PER_PMD - 1));
339}
299 340
300/* Find an entry in the third-level page table.. */ 341/* Find an entry in the third-level page table.. */
301BTFIXUPDEF_CALL(pte_t *, pte_offset_kernel, pmd_t *, unsigned long) 342pte_t *pte_offset_kernel(pmd_t * dir, unsigned long address);
302#define pte_offset_kernel(dir,addr) BTFIXUP_CALL(pte_offset_kernel)(dir,addr)
303 343
304/* 344/*
305 * This shortcut works on sun4m (and sun4d) because the nocache area is static, 345 * This shortcut works on sun4m (and sun4d) because the nocache area is static.
306 * and sun4c is guaranteed to have no highmem anyway.
307 */ 346 */
308#define pte_offset_map(d, a) pte_offset_kernel(d,a) 347#define pte_offset_map(d, a) pte_offset_kernel(d,a)
309#define pte_unmap(pte) do{}while(0) 348#define pte_unmap(pte) do{}while(0)
310 349
311/* Certain architectures need to do special things when pte's
312 * within a page table are directly modified. Thus, the following
313 * hook is made available.
314 */
315
316BTFIXUPDEF_CALL(void, set_pte, pte_t *, pte_t)
317
318#define set_pte(ptep,pteval) BTFIXUP_CALL(set_pte)(ptep,pteval)
319#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
320
321struct seq_file; 350struct seq_file;
322BTFIXUPDEF_CALL(void, mmu_info, struct seq_file *) 351void mmu_info(struct seq_file *m);
323
324#define mmu_info(p) BTFIXUP_CALL(mmu_info)(p)
325 352
326/* Fault handler stuff... */ 353/* Fault handler stuff... */
327#define FAULT_CODE_PROT 0x1 354#define FAULT_CODE_PROT 0x1
328#define FAULT_CODE_WRITE 0x2 355#define FAULT_CODE_WRITE 0x2
329#define FAULT_CODE_USER 0x4 356#define FAULT_CODE_USER 0x4
330 357
331BTFIXUPDEF_CALL(void, update_mmu_cache, struct vm_area_struct *, unsigned long, pte_t *) 358#define update_mmu_cache(vma, address, ptep) do { } while (0)
332
333#define update_mmu_cache(vma,addr,ptep) BTFIXUP_CALL(update_mmu_cache)(vma,addr,ptep)
334
335BTFIXUPDEF_CALL(void, sparc_mapiorange, unsigned int, unsigned long,
336 unsigned long, unsigned int)
337BTFIXUPDEF_CALL(void, sparc_unmapiorange, unsigned long, unsigned int)
338#define sparc_mapiorange(bus,pa,va,len) BTFIXUP_CALL(sparc_mapiorange)(bus,pa,va,len)
339#define sparc_unmapiorange(va,len) BTFIXUP_CALL(sparc_unmapiorange)(va,len)
340 359
341extern int invalid_segment; 360void srmmu_mapiorange(unsigned int bus, unsigned long xpa,
361 unsigned long xva, unsigned int len);
362void srmmu_unmapiorange(unsigned long virt_addr, unsigned int len);
342 363
343/* Encode and de-code a swap entry */ 364/* Encode and de-code a swap entry */
344BTFIXUPDEF_CALL(unsigned long, __swp_type, swp_entry_t) 365static inline unsigned long __swp_type(swp_entry_t entry)
345BTFIXUPDEF_CALL(unsigned long, __swp_offset, swp_entry_t) 366{
346BTFIXUPDEF_CALL(swp_entry_t, __swp_entry, unsigned long, unsigned long) 367 return (entry.val >> SRMMU_SWP_TYPE_SHIFT) & SRMMU_SWP_TYPE_MASK;
368}
369
370static inline unsigned long __swp_offset(swp_entry_t entry)
371{
372 return (entry.val >> SRMMU_SWP_OFF_SHIFT) & SRMMU_SWP_OFF_MASK;
373}
347 374
348#define __swp_type(__x) BTFIXUP_CALL(__swp_type)(__x) 375static inline swp_entry_t __swp_entry(unsigned long type, unsigned long offset)
349#define __swp_offset(__x) BTFIXUP_CALL(__swp_offset)(__x) 376{
350#define __swp_entry(__type,__off) BTFIXUP_CALL(__swp_entry)(__type,__off) 377 return (swp_entry_t) {
378 (type & SRMMU_SWP_TYPE_MASK) << SRMMU_SWP_TYPE_SHIFT
379 | (offset & SRMMU_SWP_OFF_MASK) << SRMMU_SWP_OFF_SHIFT };
380}
351 381
352#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 382#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
353#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 383#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
354 384
355/* file-offset-in-pte helpers */ 385/* file-offset-in-pte helpers */
356BTFIXUPDEF_CALL(unsigned long, pte_to_pgoff, pte_t pte); 386static inline unsigned long pte_to_pgoff(pte_t pte)
357BTFIXUPDEF_CALL(pte_t, pgoff_to_pte, unsigned long pgoff); 387{
388 return pte_val(pte) >> SRMMU_PTE_FILE_SHIFT;
389}
358 390
359#define pte_to_pgoff(pte) BTFIXUP_CALL(pte_to_pgoff)(pte) 391static inline pte_t pgoff_to_pte(unsigned long pgoff)
360#define pgoff_to_pte(off) BTFIXUP_CALL(pgoff_to_pte)(off) 392{
393 return __pte((pgoff << SRMMU_PTE_FILE_SHIFT) | SRMMU_FILE);
394}
361 395
362/* 396/*
363 * This is made a constant because mm/fremap.c required a constant. 397 * This is made a constant because mm/fremap.c required a constant.
364 * Note that layout of these bits is different between sun4c.c and srmmu.c.
365 */ 398 */
366#define PTE_FILE_MAX_BITS 24 399#define PTE_FILE_MAX_BITS 24
367 400
@@ -399,9 +432,6 @@ static inline unsigned long
399__get_phys (unsigned long addr) 432__get_phys (unsigned long addr)
400{ 433{
401 switch (sparc_cpu_model){ 434 switch (sparc_cpu_model){
402 case sun4:
403 case sun4c:
404 return sun4c_get_pte (addr) << PAGE_SHIFT;
405 case sun4m: 435 case sun4m:
406 case sun4d: 436 case sun4d:
407 return ((srmmu_get_pte (addr) & 0xffffff00) << 4); 437 return ((srmmu_get_pte (addr) & 0xffffff00) << 4);
@@ -414,9 +444,6 @@ static inline int
414__get_iospace (unsigned long addr) 444__get_iospace (unsigned long addr)
415{ 445{
416 switch (sparc_cpu_model){ 446 switch (sparc_cpu_model){
417 case sun4:
418 case sun4c:
419 return -1; /* Don't check iospace on sun4c */
420 case sun4m: 447 case sun4m:
421 case sun4d: 448 case sun4d:
422 return (srmmu_get_pte (addr) >> 28); 449 return (srmmu_get_pte (addr) >> 28);
@@ -463,7 +490,7 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
463 set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \ 490 set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \
464 flush_tlb_page(__vma, __address); \ 491 flush_tlb_page(__vma, __address); \
465 } \ 492 } \
466 (sparc_cpu_model == sun4c) || __changed; \ 493 __changed; \
467}) 494})
468 495
469#include <asm-generic/pgtable.h> 496#include <asm-generic/pgtable.h>
@@ -471,10 +498,8 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
471#endif /* !(__ASSEMBLY__) */ 498#endif /* !(__ASSEMBLY__) */
472 499
473#define VMALLOC_START _AC(0xfe600000,UL) 500#define VMALLOC_START _AC(0xfe600000,UL)
474/* XXX Alter this when I get around to fixing sun4c - Anton */
475#define VMALLOC_END _AC(0xffc00000,UL) 501#define VMALLOC_END _AC(0xffc00000,UL)
476 502
477
478/* We provide our own get_unmapped_area to cope with VA holes for userland */ 503/* We provide our own get_unmapped_area to cope with VA holes for userland */
479#define HAVE_ARCH_UNMAPPED_AREA 504#define HAVE_ARCH_UNMAPPED_AREA
480 505
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index 76e4a52aa85e..61210db139fb 100644
--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -717,10 +717,6 @@ extern unsigned long find_ecache_flush_span(unsigned long size);
717struct seq_file; 717struct seq_file;
718extern void mmu_info(struct seq_file *); 718extern void mmu_info(struct seq_file *);
719 719
720/* These do nothing with the way I have things setup. */
721#define mmu_lockarea(vaddr, len) (vaddr)
722#define mmu_unlockarea(vaddr, len) do { } while(0)
723
724struct vm_area_struct; 720struct vm_area_struct;
725extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *); 721extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *);
726 722
diff --git a/arch/sparc/include/asm/pgtsrmmu.h b/arch/sparc/include/asm/pgtsrmmu.h
index f6ae2b2b6870..cb828703a63a 100644
--- a/arch/sparc/include/asm/pgtsrmmu.h
+++ b/arch/sparc/include/asm/pgtsrmmu.h
@@ -173,17 +173,6 @@ static inline void srmmu_set_ctable_ptr(unsigned long paddr)
173 "memory"); 173 "memory");
174} 174}
175 175
176static inline unsigned long srmmu_get_ctable_ptr(void)
177{
178 unsigned int retval;
179
180 __asm__ __volatile__("lda [%1] %2, %0\n\t" :
181 "=r" (retval) :
182 "r" (SRMMU_CTXTBL_PTR),
183 "i" (ASI_M_MMUREGS));
184 return (retval & SRMMU_CTX_PMASK) << 4;
185}
186
187static inline void srmmu_set_context(int context) 176static inline void srmmu_set_context(int context)
188{ 177{
189 __asm__ __volatile__("sta %0, [%1] %2\n\t" : : 178 __asm__ __volatile__("sta %0, [%1] %2\n\t" : :
@@ -231,42 +220,6 @@ static inline void srmmu_flush_whole_tlb(void)
231} 220}
232 221
233/* These flush types are not available on all chips... */ 222/* These flush types are not available on all chips... */
234static inline void srmmu_flush_tlb_ctx(void)
235{
236 __asm__ __volatile__("sta %%g0, [%0] %1\n\t": :
237 "r" (0x300), /* Flush TLB ctx.. */
238 "i" (ASI_M_FLUSH_PROBE) : "memory");
239
240}
241
242static inline void srmmu_flush_tlb_region(unsigned long addr)
243{
244 addr &= SRMMU_PGDIR_MASK;
245 __asm__ __volatile__("sta %%g0, [%0] %1\n\t": :
246 "r" (addr | 0x200), /* Flush TLB region.. */
247 "i" (ASI_M_FLUSH_PROBE) : "memory");
248
249}
250
251
252static inline void srmmu_flush_tlb_segment(unsigned long addr)
253{
254 addr &= SRMMU_REAL_PMD_MASK;
255 __asm__ __volatile__("sta %%g0, [%0] %1\n\t": :
256 "r" (addr | 0x100), /* Flush TLB segment.. */
257 "i" (ASI_M_FLUSH_PROBE) : "memory");
258
259}
260
261static inline void srmmu_flush_tlb_page(unsigned long page)
262{
263 page &= PAGE_MASK;
264 __asm__ __volatile__("sta %%g0, [%0] %1\n\t": :
265 "r" (page), /* Flush TLB page.. */
266 "i" (ASI_M_FLUSH_PROBE) : "memory");
267
268}
269
270#ifndef CONFIG_SPARC_LEON 223#ifndef CONFIG_SPARC_LEON
271static inline unsigned long srmmu_hwprobe(unsigned long vaddr) 224static inline unsigned long srmmu_hwprobe(unsigned long vaddr)
272{ 225{
@@ -294,9 +247,6 @@ srmmu_get_pte (unsigned long addr)
294 return entry; 247 return entry;
295} 248}
296 249
297extern unsigned long (*srmmu_read_physical)(unsigned long paddr);
298extern void (*srmmu_write_physical)(unsigned long paddr, unsigned long word);
299
300#endif /* !(__ASSEMBLY__) */ 250#endif /* !(__ASSEMBLY__) */
301 251
302#endif /* !(_SPARC_PGTSRMMU_H) */ 252#endif /* !(_SPARC_PGTSRMMU_H) */
diff --git a/arch/sparc/include/asm/pgtsun4c.h b/arch/sparc/include/asm/pgtsun4c.h
deleted file mode 100644
index aeb25e912179..000000000000
--- a/arch/sparc/include/asm/pgtsun4c.h
+++ /dev/null
@@ -1,172 +0,0 @@
1/*
2 * pgtsun4c.h: Sun4c specific pgtable.h defines and code.
3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 */
6#ifndef _SPARC_PGTSUN4C_H
7#define _SPARC_PGTSUN4C_H
8
9#include <asm/contregs.h>
10
11/* PMD_SHIFT determines the size of the area a second-level page table can map */
12#define SUN4C_PMD_SHIFT 22
13
14/* PGDIR_SHIFT determines what a third-level page table entry can map */
15#define SUN4C_PGDIR_SHIFT 22
16#define SUN4C_PGDIR_SIZE (1UL << SUN4C_PGDIR_SHIFT)
17#define SUN4C_PGDIR_MASK (~(SUN4C_PGDIR_SIZE-1))
18#define SUN4C_PGDIR_ALIGN(addr) (((addr)+SUN4C_PGDIR_SIZE-1)&SUN4C_PGDIR_MASK)
19
20/* To represent how the sun4c mmu really lays things out. */
21#define SUN4C_REAL_PGDIR_SHIFT 18
22#define SUN4C_REAL_PGDIR_SIZE (1UL << SUN4C_REAL_PGDIR_SHIFT)
23#define SUN4C_REAL_PGDIR_MASK (~(SUN4C_REAL_PGDIR_SIZE-1))
24#define SUN4C_REAL_PGDIR_ALIGN(addr) (((addr)+SUN4C_REAL_PGDIR_SIZE-1)&SUN4C_REAL_PGDIR_MASK)
25
26/* 16 bit PFN on sun4c */
27#define SUN4C_PFN_MASK 0xffff
28
29/* Don't increase these unless the structures in sun4c.c are fixed */
30#define SUN4C_MAX_SEGMAPS 256
31#define SUN4C_MAX_CONTEXTS 16
32
33/*
34 * To be efficient, and not have to worry about allocating such
35 * a huge pgd, we make the kernel sun4c tables each hold 1024
36 * entries and the pgd similarly just like the i386 tables.
37 */
38#define SUN4C_PTRS_PER_PTE 1024
39#define SUN4C_PTRS_PER_PMD 1
40#define SUN4C_PTRS_PER_PGD 1024
41
42/*
43 * Sparc SUN4C pte fields.
44 */
45#define _SUN4C_PAGE_VALID 0x80000000
46#define _SUN4C_PAGE_SILENT_READ 0x80000000 /* synonym */
47#define _SUN4C_PAGE_DIRTY 0x40000000
48#define _SUN4C_PAGE_SILENT_WRITE 0x40000000 /* synonym */
49#define _SUN4C_PAGE_PRIV 0x20000000 /* privileged page */
50#define _SUN4C_PAGE_NOCACHE 0x10000000 /* non-cacheable page */
51#define _SUN4C_PAGE_PRESENT 0x08000000 /* implemented in software */
52#define _SUN4C_PAGE_IO 0x04000000 /* I/O page */
53#define _SUN4C_PAGE_FILE 0x02000000 /* implemented in software */
54#define _SUN4C_PAGE_READ 0x00800000 /* implemented in software */
55#define _SUN4C_PAGE_WRITE 0x00400000 /* implemented in software */
56#define _SUN4C_PAGE_ACCESSED 0x00200000 /* implemented in software */
57#define _SUN4C_PAGE_MODIFIED 0x00100000 /* implemented in software */
58
59#define _SUN4C_READABLE (_SUN4C_PAGE_READ|_SUN4C_PAGE_SILENT_READ|\
60 _SUN4C_PAGE_ACCESSED)
61#define _SUN4C_WRITEABLE (_SUN4C_PAGE_WRITE|_SUN4C_PAGE_SILENT_WRITE|\
62 _SUN4C_PAGE_MODIFIED)
63
64#define _SUN4C_PAGE_CHG_MASK (0xffff|_SUN4C_PAGE_ACCESSED|_SUN4C_PAGE_MODIFIED)
65
66#define SUN4C_PAGE_NONE __pgprot(_SUN4C_PAGE_PRESENT)
67#define SUN4C_PAGE_SHARED __pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE|\
68 _SUN4C_PAGE_WRITE)
69#define SUN4C_PAGE_COPY __pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE)
70#define SUN4C_PAGE_READONLY __pgprot(_SUN4C_PAGE_PRESENT|_SUN4C_READABLE)
71#define SUN4C_PAGE_KERNEL __pgprot(_SUN4C_READABLE|_SUN4C_WRITEABLE|\
72 _SUN4C_PAGE_DIRTY|_SUN4C_PAGE_PRIV)
73
74/* SUN4C swap entry encoding
75 *
76 * We use 5 bits for the type and 19 for the offset. This gives us
77 * 32 swapfiles of 4GB each. Encoding looks like:
78 *
79 * RRRRRRRRooooooooooooooooooottttt
80 * fedcba9876543210fedcba9876543210
81 *
82 * The top 8 bits are reserved for protection and status bits, especially
83 * FILE and PRESENT.
84 */
85#define SUN4C_SWP_TYPE_MASK 0x1f
86#define SUN4C_SWP_OFF_MASK 0x7ffff
87#define SUN4C_SWP_OFF_SHIFT 5
88
89#ifndef __ASSEMBLY__
90
91static inline unsigned long sun4c_get_synchronous_error(void)
92{
93 unsigned long sync_err;
94
95 __asm__ __volatile__("lda [%1] %2, %0\n\t" :
96 "=r" (sync_err) :
97 "r" (AC_SYNC_ERR), "i" (ASI_CONTROL));
98 return sync_err;
99}
100
101static inline unsigned long sun4c_get_synchronous_address(void)
102{
103 unsigned long sync_addr;
104
105 __asm__ __volatile__("lda [%1] %2, %0\n\t" :
106 "=r" (sync_addr) :
107 "r" (AC_SYNC_VA), "i" (ASI_CONTROL));
108 return sync_addr;
109}
110
111/* SUN4C pte, segmap, and context manipulation */
112static inline unsigned long sun4c_get_segmap(unsigned long addr)
113{
114 register unsigned long entry;
115
116 __asm__ __volatile__("\n\tlduba [%1] %2, %0\n\t" :
117 "=r" (entry) :
118 "r" (addr), "i" (ASI_SEGMAP));
119
120 return entry;
121}
122
123static inline void sun4c_put_segmap(unsigned long addr, unsigned long entry)
124{
125
126 __asm__ __volatile__("\n\tstba %1, [%0] %2; nop; nop; nop;\n\t" : :
127 "r" (addr), "r" (entry),
128 "i" (ASI_SEGMAP)
129 : "memory");
130}
131
132static inline unsigned long sun4c_get_pte(unsigned long addr)
133{
134 register unsigned long entry;
135
136 __asm__ __volatile__("\n\tlda [%1] %2, %0\n\t" :
137 "=r" (entry) :
138 "r" (addr), "i" (ASI_PTE));
139 return entry;
140}
141
142static inline void sun4c_put_pte(unsigned long addr, unsigned long entry)
143{
144 __asm__ __volatile__("\n\tsta %1, [%0] %2; nop; nop; nop;\n\t" : :
145 "r" (addr),
146 "r" ((entry & ~(_SUN4C_PAGE_PRESENT))), "i" (ASI_PTE)
147 : "memory");
148}
149
150static inline int sun4c_get_context(void)
151{
152 register int ctx;
153
154 __asm__ __volatile__("\n\tlduba [%1] %2, %0\n\t" :
155 "=r" (ctx) :
156 "r" (AC_CONTEXT), "i" (ASI_CONTROL));
157
158 return ctx;
159}
160
161static inline int sun4c_set_context(int ctx)
162{
163 __asm__ __volatile__("\n\tstba %0, [%1] %2; nop; nop; nop;\n\t" : :
164 "r" (ctx), "r" (AC_CONTEXT), "i" (ASI_CONTROL)
165 : "memory");
166
167 return ctx;
168}
169
170#endif /* !(__ASSEMBLY__) */
171
172#endif /* !(_SPARC_PGTSUN4C_H) */
diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h
index 09521c6a5edb..9cbd854fdfdd 100644
--- a/arch/sparc/include/asm/processor_32.h
+++ b/arch/sparc/include/asm/processor_32.h
@@ -16,7 +16,6 @@
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17#include <asm/head.h> 17#include <asm/head.h>
18#include <asm/signal.h> 18#include <asm/signal.h>
19#include <asm/btfixup.h>
20#include <asm/page.h> 19#include <asm/page.h>
21 20
22/* 21/*
diff --git a/arch/sparc/include/asm/setup.h b/arch/sparc/include/asm/setup.h
index 00497abec996..8a83699a5507 100644
--- a/arch/sparc/include/asm/setup.h
+++ b/arch/sparc/include/asm/setup.h
@@ -20,10 +20,7 @@ extern char reboot_command[];
20 * Only sun4d + leon may have boot_cpu_id != 0 20 * Only sun4d + leon may have boot_cpu_id != 0
21 */ 21 */
22extern unsigned char boot_cpu_id; 22extern unsigned char boot_cpu_id;
23extern unsigned char boot_cpu_id4;
24 23
25extern unsigned long empty_bad_page;
26extern unsigned long empty_bad_page_table;
27extern unsigned long empty_zero_page; 24extern unsigned long empty_zero_page;
28 25
29extern int serial_console; 26extern int serial_console;
diff --git a/arch/sparc/include/asm/shmparam_32.h b/arch/sparc/include/asm/shmparam_32.h
index 59a1243c12f3..142825c8d3ac 100644
--- a/arch/sparc/include/asm/shmparam_32.h
+++ b/arch/sparc/include/asm/shmparam_32.h
@@ -4,8 +4,6 @@
4#define __ARCH_FORCE_SHMLBA 1 4#define __ARCH_FORCE_SHMLBA 1
5 5
6extern int vac_cache_size; 6extern int vac_cache_size;
7#define SHMLBA (vac_cache_size ? vac_cache_size : \ 7#define SHMLBA (vac_cache_size ? vac_cache_size : PAGE_SIZE)
8 (sparc_cpu_model == sun4c ? (64 * 1024) : \
9 (sparc_cpu_model == sun4 ? (128 * 1024) : PAGE_SIZE)))
10 8
11#endif /* _ASMSPARC_SHMPARAM_H */ 9#endif /* _ASMSPARC_SHMPARAM_H */
diff --git a/arch/sparc/include/asm/smp_32.h b/arch/sparc/include/asm/smp_32.h
index 01c51c704341..b73da3c5f10a 100644
--- a/arch/sparc/include/asm/smp_32.h
+++ b/arch/sparc/include/asm/smp_32.h
@@ -8,7 +8,6 @@
8 8
9#include <linux/threads.h> 9#include <linux/threads.h>
10#include <asm/head.h> 10#include <asm/head.h>
11#include <asm/btfixup.h>
12 11
13#ifndef __ASSEMBLY__ 12#ifndef __ASSEMBLY__
14 13
@@ -58,104 +57,53 @@ struct seq_file;
58void smp_bogo(struct seq_file *); 57void smp_bogo(struct seq_file *);
59void smp_info(struct seq_file *); 58void smp_info(struct seq_file *);
60 59
61BTFIXUPDEF_CALL(void, smp_cross_call, smpfunc_t, cpumask_t, unsigned long, unsigned long, unsigned long, unsigned long) 60struct sparc32_ipi_ops {
62BTFIXUPDEF_CALL(int, __hard_smp_processor_id, void) 61 void (*cross_call)(smpfunc_t func, cpumask_t mask, unsigned long arg1,
63BTFIXUPDEF_CALL(void, smp_ipi_resched, int); 62 unsigned long arg2, unsigned long arg3,
64BTFIXUPDEF_CALL(void, smp_ipi_single, int); 63 unsigned long arg4);
65BTFIXUPDEF_CALL(void, smp_ipi_mask_one, int); 64 void (*resched)(int cpu);
66BTFIXUPDEF_BLACKBOX(hard_smp_processor_id) 65 void (*single)(int cpu);
67BTFIXUPDEF_BLACKBOX(load_current) 66 void (*mask_one)(int cpu);
68 67};
69#define smp_cross_call(func,mask,arg1,arg2,arg3,arg4) BTFIXUP_CALL(smp_cross_call)(func,mask,arg1,arg2,arg3,arg4) 68extern const struct sparc32_ipi_ops *sparc32_ipi_ops;
69
70static inline void xc0(smpfunc_t func)
71{
72 sparc32_ipi_ops->cross_call(func, *cpu_online_mask, 0, 0, 0, 0);
73}
70 74
71static inline void xc0(smpfunc_t func) { smp_cross_call(func, *cpu_online_mask, 0, 0, 0, 0); }
72static inline void xc1(smpfunc_t func, unsigned long arg1) 75static inline void xc1(smpfunc_t func, unsigned long arg1)
73{ smp_cross_call(func, *cpu_online_mask, arg1, 0, 0, 0); }
74static inline void xc2(smpfunc_t func, unsigned long arg1, unsigned long arg2)
75{ smp_cross_call(func, *cpu_online_mask, arg1, arg2, 0, 0); }
76static inline void xc3(smpfunc_t func, unsigned long arg1, unsigned long arg2,
77 unsigned long arg3)
78{ smp_cross_call(func, *cpu_online_mask, arg1, arg2, arg3, 0); }
79static inline void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2,
80 unsigned long arg3, unsigned long arg4)
81{ smp_cross_call(func, *cpu_online_mask, arg1, arg2, arg3, arg4); }
82
83extern void arch_send_call_function_single_ipi(int cpu);
84extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
85
86static inline int cpu_logical_map(int cpu)
87{ 76{
88 return cpu; 77 sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, 0, 0, 0);
89} 78}
90 79static inline void xc2(smpfunc_t func, unsigned long arg1, unsigned long arg2)
91static inline int hard_smp4m_processor_id(void)
92{ 80{
93 int cpuid; 81 sparc32_ipi_ops->cross_call(func, *cpu_online_mask, arg1, arg2, 0, 0);
94
95 __asm__ __volatile__("rd %%tbr, %0\n\t"
96 "srl %0, 12, %0\n\t"
97 "and %0, 3, %0\n\t" :
98 "=&r" (cpuid));
99 return cpuid;
100} 82}
101 83
102static inline int hard_smp4d_processor_id(void) 84static inline void xc3(smpfunc_t func, unsigned long arg1, unsigned long arg2,
85 unsigned long arg3)
103{ 86{
104 int cpuid; 87 sparc32_ipi_ops->cross_call(func, *cpu_online_mask,
105 88 arg1, arg2, arg3, 0);
106 __asm__ __volatile__("lda [%%g0] %1, %0\n\t" :
107 "=&r" (cpuid) : "i" (ASI_M_VIKING_TMP1));
108 return cpuid;
109} 89}
110 90
111extern inline int hard_smpleon_processor_id(void) 91static inline void xc4(smpfunc_t func, unsigned long arg1, unsigned long arg2,
92 unsigned long arg3, unsigned long arg4)
112{ 93{
113 int cpuid; 94 sparc32_ipi_ops->cross_call(func, *cpu_online_mask,
114 __asm__ __volatile__("rd %%asr17,%0\n\t" 95 arg1, arg2, arg3, arg4);
115 "srl %0,28,%0" :
116 "=&r" (cpuid) : );
117 return cpuid;
118} 96}
119 97
120#ifndef MODULE 98extern void arch_send_call_function_single_ipi(int cpu);
121static inline int hard_smp_processor_id(void) 99extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
100
101static inline int cpu_logical_map(int cpu)
122{ 102{
123 int cpuid; 103 return cpu;
124
125 /* Black box - sun4m
126 __asm__ __volatile__("rd %%tbr, %0\n\t"
127 "srl %0, 12, %0\n\t"
128 "and %0, 3, %0\n\t" :
129 "=&r" (cpuid));
130 - sun4d
131 __asm__ __volatile__("lda [%g0] ASI_M_VIKING_TMP1, %0\n\t"
132 "nop; nop" :
133 "=&r" (cpuid));
134 - leon
135 __asm__ __volatile__( "rd %asr17, %0\n\t"
136 "srl %0, 0x1c, %0\n\t"
137 "nop\n\t" :
138 "=&r" (cpuid));
139 See btfixup.h and btfixupprep.c to understand how a blackbox works.
140 */
141 __asm__ __volatile__("sethi %%hi(___b_hard_smp_processor_id), %0\n\t"
142 "sethi %%hi(boot_cpu_id), %0\n\t"
143 "ldub [%0 + %%lo(boot_cpu_id)], %0\n\t" :
144 "=&r" (cpuid));
145 return cpuid;
146} 104}
147#else
148static inline int hard_smp_processor_id(void)
149{
150 int cpuid;
151 105
152 __asm__ __volatile__("mov %%o7, %%g1\n\t" 106extern int hard_smp_processor_id(void);
153 "call ___f___hard_smp_processor_id\n\t"
154 " nop\n\t"
155 "mov %%g2, %0\n\t" : "=r"(cpuid) : : "g1", "g2");
156 return cpuid;
157}
158#endif
159 107
160#define raw_smp_processor_id() (current_thread_info()->cpu) 108#define raw_smp_processor_id() (current_thread_info()->cpu)
161 109
diff --git a/arch/sparc/include/asm/smpprim.h b/arch/sparc/include/asm/smpprim.h
deleted file mode 100644
index eb849d862c64..000000000000
--- a/arch/sparc/include/asm/smpprim.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * smpprim.h: SMP locking primitives on the Sparc
3 *
4 * God knows we won't be actually using this code for some time
5 * but I thought I'd write it since I knew how.
6 *
7 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
8 */
9
10#ifndef __SPARC_SMPPRIM_H
11#define __SPARC_SMPPRIM_H
12
13/* Test and set the unsigned byte at ADDR to 1. Returns the previous
14 * value. On the Sparc we use the ldstub instruction since it is
15 * atomic.
16 */
17
18static inline __volatile__ char test_and_set(void *addr)
19{
20 char state = 0;
21
22 __asm__ __volatile__("ldstub [%0], %1 ! test_and_set\n\t"
23 "=r" (addr), "=r" (state) :
24 "0" (addr), "1" (state) : "memory");
25
26 return state;
27}
28
29/* Initialize a spin-lock. */
30static inline __volatile__ smp_initlock(void *spinlock)
31{
32 /* Unset the lock. */
33 *((unsigned char *) spinlock) = 0;
34
35 return;
36}
37
38/* This routine spins until it acquires the lock at ADDR. */
39static inline __volatile__ smp_lock(void *addr)
40{
41 while(test_and_set(addr) == 0xff)
42 ;
43
44 /* We now have the lock */
45 return;
46}
47
48/* This routine releases the lock at ADDR. */
49static inline __volatile__ smp_unlock(void *addr)
50{
51 *((unsigned char *) addr) = 0;
52}
53
54#endif /* !(__SPARC_SMPPRIM_H) */
diff --git a/arch/sparc/include/asm/string_32.h b/arch/sparc/include/asm/string_32.h
index edf196ee4ef8..12f67857152e 100644
--- a/arch/sparc/include/asm/string_32.h
+++ b/arch/sparc/include/asm/string_32.h
@@ -61,68 +61,7 @@ extern int memcmp(const void *,const void *,__kernel_size_t);
61extern __kernel_size_t strlen(const char *); 61extern __kernel_size_t strlen(const char *);
62 62
63#define __HAVE_ARCH_STRNCMP 63#define __HAVE_ARCH_STRNCMP
64 64extern int strncmp(const char *, const char *, __kernel_size_t);
65extern int __strncmp(const char *, const char *, __kernel_size_t);
66
67static inline int __constant_strncmp(const char *src, const char *dest, __kernel_size_t count)
68{
69 register int retval;
70 switch(count) {
71 case 0: return 0;
72 case 1: return (src[0] - dest[0]);
73 case 2: retval = (src[0] - dest[0]);
74 if(!retval && src[0])
75 retval = (src[1] - dest[1]);
76 return retval;
77 case 3: retval = (src[0] - dest[0]);
78 if(!retval && src[0]) {
79 retval = (src[1] - dest[1]);
80 if(!retval && src[1])
81 retval = (src[2] - dest[2]);
82 }
83 return retval;
84 case 4: retval = (src[0] - dest[0]);
85 if(!retval && src[0]) {
86 retval = (src[1] - dest[1]);
87 if(!retval && src[1]) {
88 retval = (src[2] - dest[2]);
89 if (!retval && src[2])
90 retval = (src[3] - dest[3]);
91 }
92 }
93 return retval;
94 case 5: retval = (src[0] - dest[0]);
95 if(!retval && src[0]) {
96 retval = (src[1] - dest[1]);
97 if(!retval && src[1]) {
98 retval = (src[2] - dest[2]);
99 if (!retval && src[2]) {
100 retval = (src[3] - dest[3]);
101 if (!retval && src[3])
102 retval = (src[4] - dest[4]);
103 }
104 }
105 }
106 return retval;
107 default:
108 retval = (src[0] - dest[0]);
109 if(!retval && src[0]) {
110 retval = (src[1] - dest[1]);
111 if(!retval && src[1]) {
112 retval = (src[2] - dest[2]);
113 if(!retval && src[2])
114 retval = __strncmp(src+3,dest+3,count-3);
115 }
116 }
117 return retval;
118 }
119}
120
121#undef strncmp
122#define strncmp(__arg0, __arg1, __arg2) \
123(__builtin_constant_p(__arg2) ? \
124 __constant_strncmp(__arg0, __arg1, __arg2) : \
125 __strncmp(__arg0, __arg1, __arg2))
126 65
127#endif /* !EXPORT_SYMTAB_STROPS */ 66#endif /* !EXPORT_SYMTAB_STROPS */
128 67
diff --git a/arch/sparc/include/asm/sysen.h b/arch/sparc/include/asm/sysen.h
deleted file mode 100644
index 6af34abde6e7..000000000000
--- a/arch/sparc/include/asm/sysen.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * sysen.h: Bit fields within the "System Enable" register accessed via
3 * the ASI_CONTROL address space at address AC_SYSENABLE.
4 *
5 * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
6 */
7
8#ifndef _SPARC_SYSEN_H
9#define _SPARC_SYSEN_H
10
11#define SENABLE_DVMA 0x20 /* enable dvma transfers */
12#define SENABLE_CACHE 0x10 /* enable VAC cache */
13#define SENABLE_RESET 0x04 /* reset whole machine, danger Will Robinson */
14
15#endif /* _SPARC_SYSEN_H */
diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h
index c2a1080cdd3b..21a38946541d 100644
--- a/arch/sparc/include/asm/thread_info_32.h
+++ b/arch/sparc/include/asm/thread_info_32.h
@@ -15,7 +15,6 @@
15 15
16#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
17 17
18#include <asm/btfixup.h>
19#include <asm/ptrace.h> 18#include <asm/ptrace.h>
20#include <asm/page.h> 19#include <asm/page.h>
21 20
@@ -80,13 +79,8 @@ register struct thread_info *current_thread_info_reg asm("g6");
80 */ 79 */
81#define THREAD_INFO_ORDER 1 80#define THREAD_INFO_ORDER 1
82 81
83#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR 82struct thread_info * alloc_thread_info_node(struct task_struct *tsk, int node);
84 83void free_thread_info(struct thread_info *);
85BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info_node, int)
86#define alloc_thread_info_node(tsk, node) BTFIXUP_CALL(alloc_thread_info_node)(node)
87
88BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)
89#define free_thread_info(ti) BTFIXUP_CALL(free_thread_info)(ti)
90 84
91#endif /* __ASSEMBLY__ */ 85#endif /* __ASSEMBLY__ */
92 86
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
index 01d057fe6a3f..7f0981b09451 100644
--- a/arch/sparc/include/asm/thread_info_64.h
+++ b/arch/sparc/include/asm/thread_info_64.h
@@ -138,32 +138,11 @@ register struct thread_info *current_thread_info_reg asm("g6");
138 138
139/* thread information allocation */ 139/* thread information allocation */
140#if PAGE_SHIFT == 13 140#if PAGE_SHIFT == 13
141#define __THREAD_INFO_ORDER 1 141#define THREAD_SIZE_ORDER 1
142#else /* PAGE_SHIFT == 13 */ 142#else /* PAGE_SHIFT == 13 */
143#define __THREAD_INFO_ORDER 0 143#define THREAD_SIZE_ORDER 0
144#endif /* PAGE_SHIFT == 13 */ 144#endif /* PAGE_SHIFT == 13 */
145 145
146#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
147
148#ifdef CONFIG_DEBUG_STACK_USAGE
149#define THREAD_FLAGS (GFP_KERNEL | __GFP_ZERO)
150#else
151#define THREAD_FLAGS (GFP_KERNEL)
152#endif
153
154#define alloc_thread_info_node(tsk, node) \
155({ \
156 struct page *page = alloc_pages_node(node, THREAD_FLAGS, \
157 __THREAD_INFO_ORDER); \
158 struct thread_info *ret; \
159 \
160 ret = page ? page_address(page) : NULL; \
161 ret; \
162})
163
164#define free_thread_info(ti) \
165 free_pages((unsigned long)(ti),__THREAD_INFO_ORDER)
166
167#define __thread_flag_byte_ptr(ti) \ 146#define __thread_flag_byte_ptr(ti) \
168 ((unsigned char *)(&((ti)->flags))) 147 ((unsigned char *)(&((ti)->flags)))
169#define __cur_thread_flag_byte_ptr __thread_flag_byte_ptr(current_thread_info()) 148#define __cur_thread_flag_byte_ptr __thread_flag_byte_ptr(current_thread_info())
diff --git a/arch/sparc/include/asm/timer_32.h b/arch/sparc/include/asm/timer_32.h
index 1a91e11dd104..72f40a546de3 100644
--- a/arch/sparc/include/asm/timer_32.h
+++ b/arch/sparc/include/asm/timer_32.h
@@ -8,14 +8,37 @@
8#ifndef _SPARC_TIMER_H 8#ifndef _SPARC_TIMER_H
9#define _SPARC_TIMER_H 9#define _SPARC_TIMER_H
10 10
11#include <linux/clocksource.h>
12#include <linux/irqreturn.h>
13
14#include <asm-generic/percpu.h>
15
11#include <asm/cpu_type.h> /* For SUN4M_NCPUS */ 16#include <asm/cpu_type.h> /* For SUN4M_NCPUS */
12#include <asm/btfixup.h> 17
18#define SBUS_CLOCK_RATE 2000000 /* 2MHz */
19#define TIMER_VALUE_SHIFT 9
20#define TIMER_VALUE_MASK 0x3fffff
21#define TIMER_LIMIT_BIT (1 << 31) /* Bit 31 in Counter-Timer register */
22
23/* The counter timer register has the value offset by 9 bits.
24 * From sun4m manual:
25 * When a counter reaches the value in the corresponding limit register,
26 * the Limit bit is set and the counter is set to 500 nS (i.e. 0x00000200).
27 *
28 * To compensate for this add one to the value.
29 */
30static inline unsigned int timer_value(unsigned int value)
31{
32 return (value + 1) << TIMER_VALUE_SHIFT;
33}
13 34
14extern __volatile__ unsigned int *master_l10_counter; 35extern __volatile__ unsigned int *master_l10_counter;
15 36
16/* FIXME: Make do_[gs]ettimeofday btfixup calls */ 37extern irqreturn_t notrace timer_interrupt(int dummy, void *dev_id);
17struct timespec; 38
18BTFIXUPDEF_CALL(int, bus_do_settimeofday, struct timespec *tv) 39#ifdef CONFIG_SMP
19#define bus_do_settimeofday(tv) BTFIXUP_CALL(bus_do_settimeofday)(tv) 40DECLARE_PER_CPU(struct clock_event_device, sparc32_clockevent);
41extern void register_percpu_ce(int cpu);
42#endif
20 43
21#endif /* !(_SPARC_TIMER_H) */ 44#endif /* !(_SPARC_TIMER_H) */
diff --git a/arch/sparc/include/asm/timex_32.h b/arch/sparc/include/asm/timex_32.h
index a254750e4c03..b6ccdb0d6f7d 100644
--- a/arch/sparc/include/asm/timex_32.h
+++ b/arch/sparc/include/asm/timex_32.h
@@ -12,5 +12,4 @@
12typedef unsigned long cycles_t; 12typedef unsigned long cycles_t;
13#define get_cycles() (0) 13#define get_cycles() (0)
14 14
15extern u32 (*do_arch_gettimeoffset)(void);
16#endif 15#endif
diff --git a/arch/sparc/include/asm/tlbflush_32.h b/arch/sparc/include/asm/tlbflush_32.h
index fe0a71abc9bb..a5c4142130f5 100644
--- a/arch/sparc/include/asm/tlbflush_32.h
+++ b/arch/sparc/include/asm/tlbflush_32.h
@@ -1,52 +1,16 @@
1#ifndef _SPARC_TLBFLUSH_H 1#ifndef _SPARC_TLBFLUSH_H
2#define _SPARC_TLBFLUSH_H 2#define _SPARC_TLBFLUSH_H
3 3
4#include <linux/mm.h> 4#include <asm/cachetlb_32.h>
5// #include <asm/processor.h> 5
6 6#define flush_tlb_all() \
7/* 7 sparc32_cachetlb_ops->tlb_all()
8 * TLB flushing: 8#define flush_tlb_mm(mm) \
9 * 9 sparc32_cachetlb_ops->tlb_mm(mm)
10 * - flush_tlb() flushes the current mm struct TLBs XXX Exists? 10#define flush_tlb_range(vma, start, end) \
11 * - flush_tlb_all() flushes all processes TLBs 11 sparc32_cachetlb_ops->tlb_range(vma, start, end)
12 * - flush_tlb_mm(mm) flushes the specified mm context TLB's 12#define flush_tlb_page(vma, addr) \
13 * - flush_tlb_page(vma, vmaddr) flushes one page 13 sparc32_cachetlb_ops->tlb_page(vma, addr)
14 * - flush_tlb_range(vma, start, end) flushes a range of pages
15 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
16 */
17
18#ifdef CONFIG_SMP
19
20BTFIXUPDEF_CALL(void, local_flush_tlb_all, void)
21BTFIXUPDEF_CALL(void, local_flush_tlb_mm, struct mm_struct *)
22BTFIXUPDEF_CALL(void, local_flush_tlb_range, struct vm_area_struct *, unsigned long, unsigned long)
23BTFIXUPDEF_CALL(void, local_flush_tlb_page, struct vm_area_struct *, unsigned long)
24
25#define local_flush_tlb_all() BTFIXUP_CALL(local_flush_tlb_all)()
26#define local_flush_tlb_mm(mm) BTFIXUP_CALL(local_flush_tlb_mm)(mm)
27#define local_flush_tlb_range(vma,start,end) BTFIXUP_CALL(local_flush_tlb_range)(vma,start,end)
28#define local_flush_tlb_page(vma,addr) BTFIXUP_CALL(local_flush_tlb_page)(vma,addr)
29
30extern void smp_flush_tlb_all(void);
31extern void smp_flush_tlb_mm(struct mm_struct *mm);
32extern void smp_flush_tlb_range(struct vm_area_struct *vma,
33 unsigned long start,
34 unsigned long end);
35extern void smp_flush_tlb_page(struct vm_area_struct *mm, unsigned long page);
36
37#endif /* CONFIG_SMP */
38
39BTFIXUPDEF_CALL(void, flush_tlb_all, void)
40BTFIXUPDEF_CALL(void, flush_tlb_mm, struct mm_struct *)
41BTFIXUPDEF_CALL(void, flush_tlb_range, struct vm_area_struct *, unsigned long, unsigned long)
42BTFIXUPDEF_CALL(void, flush_tlb_page, struct vm_area_struct *, unsigned long)
43
44#define flush_tlb_all() BTFIXUP_CALL(flush_tlb_all)()
45#define flush_tlb_mm(mm) BTFIXUP_CALL(flush_tlb_mm)(mm)
46#define flush_tlb_range(vma,start,end) BTFIXUP_CALL(flush_tlb_range)(vma,start,end)
47#define flush_tlb_page(vma,addr) BTFIXUP_CALL(flush_tlb_page)(vma,addr)
48
49// #define flush_tlb() flush_tlb_mm(current->active_mm) /* XXX Sure? */
50 14
51/* 15/*
52 * This is a kludge, until I know better. --zaitcev XXX 16 * This is a kludge, until I know better. --zaitcev XXX
diff --git a/arch/sparc/include/asm/topology_64.h b/arch/sparc/include/asm/topology_64.h
index 8b9c556d630b..1754390a426f 100644
--- a/arch/sparc/include/asm/topology_64.h
+++ b/arch/sparc/include/asm/topology_64.h
@@ -31,25 +31,6 @@ static inline int pcibus_to_node(struct pci_bus *pbus)
31 cpu_all_mask : \ 31 cpu_all_mask : \
32 cpumask_of_node(pcibus_to_node(bus))) 32 cpumask_of_node(pcibus_to_node(bus)))
33 33
34#define SD_NODE_INIT (struct sched_domain) { \
35 .min_interval = 8, \
36 .max_interval = 32, \
37 .busy_factor = 32, \
38 .imbalance_pct = 125, \
39 .cache_nice_tries = 2, \
40 .busy_idx = 3, \
41 .idle_idx = 2, \
42 .newidle_idx = 0, \
43 .wake_idx = 0, \
44 .forkexec_idx = 0, \
45 .flags = SD_LOAD_BALANCE \
46 | SD_BALANCE_FORK \
47 | SD_BALANCE_EXEC \
48 | SD_SERIALIZE, \
49 .last_balance = jiffies, \
50 .balance_interval = 1, \
51}
52
53#else /* CONFIG_NUMA */ 34#else /* CONFIG_NUMA */
54 35
55#include <asm-generic/topology.h> 36#include <asm-generic/topology.h>
diff --git a/arch/sparc/include/asm/uaccess_32.h b/arch/sparc/include/asm/uaccess_32.h
index 8303ac481034..d50c310f5d38 100644
--- a/arch/sparc/include/asm/uaccess_32.h
+++ b/arch/sparc/include/asm/uaccess_32.h
@@ -12,7 +12,6 @@
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/string.h> 13#include <linux/string.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <asm/vac-ops.h>
16#endif 15#endif
17 16
18#ifndef __ASSEMBLY__ 17#ifndef __ASSEMBLY__
diff --git a/arch/sparc/include/asm/vac-ops.h b/arch/sparc/include/asm/vac-ops.h
deleted file mode 100644
index a63e88ef0426..000000000000
--- a/arch/sparc/include/asm/vac-ops.h
+++ /dev/null
@@ -1,127 +0,0 @@
1#ifndef _SPARC_VAC_OPS_H
2#define _SPARC_VAC_OPS_H
3
4/* vac-ops.h: Inline assembly routines to do operations on the Sparc
5 * VAC (virtual address cache) for the sun4c.
6 *
7 * Copyright (C) 1994, David S. Miller (davem@caip.rutgers.edu)
8 */
9
10#include <asm/sysen.h>
11#include <asm/contregs.h>
12#include <asm/asi.h>
13
14/* The SUN4C models have a virtually addressed write-through
15 * cache.
16 *
17 * The cache tags are directly accessible through an ASI and
18 * each have the form:
19 *
20 * ------------------------------------------------------------
21 * | MBZ | CONTEXT | WRITE | PRIV | VALID | MBZ | TagID | MBZ |
22 * ------------------------------------------------------------
23 * 31 25 24 22 21 20 19 18 16 15 2 1 0
24 *
25 * MBZ: These bits are either unused and/or reserved and should
26 * be written as zeroes.
27 *
28 * CONTEXT: Records the context to which this cache line belongs.
29 *
30 * WRITE: A copy of the writable bit from the mmu pte access bits.
31 *
32 * PRIV: A copy of the privileged bit from the pte access bits.
33 *
34 * VALID: If set, this line is valid, else invalid.
35 *
36 * TagID: Fourteen bits of tag ID.
37 *
38 * Every virtual address is seen by the cache like this:
39 *
40 * ----------------------------------------
41 * | RESV | TagID | LINE | BYTE-in-LINE |
42 * ----------------------------------------
43 * 31 30 29 16 15 4 3 0
44 *
45 * RESV: Unused/reserved.
46 *
47 * TagID: Used to match the Tag-ID in that vac tags.
48 *
49 * LINE: Which line within the cache
50 *
51 * BYTE-in-LINE: Which byte within the cache line.
52 */
53
54/* Sun4c VAC Tags */
55#define S4CVACTAG_CID 0x01c00000
56#define S4CVACTAG_W 0x00200000
57#define S4CVACTAG_P 0x00100000
58#define S4CVACTAG_V 0x00080000
59#define S4CVACTAG_TID 0x0000fffc
60
61/* Sun4c VAC Virtual Address */
62/* These aren't used, why bother? (Anton) */
63#if 0
64#define S4CVACVA_TID 0x3fff0000
65#define S4CVACVA_LINE 0x0000fff0
66#define S4CVACVA_BIL 0x0000000f
67#endif
68
69/* The indexing of cache lines creates a problem. Because the line
70 * field of a virtual address extends past the page offset within
71 * the virtual address it is possible to have what are called
72 * 'bad aliases' which will create inconsistencies. So we must make
73 * sure that within a context that if a physical page is mapped
74 * more than once, that 'extra' line bits are the same. If this is
75 * not the case, and thus is a 'bad alias' we must turn off the
76 * cacheable bit in the pte's of all such pages.
77 */
78
79#define S4CVAC_BADBITS 0x0000f000
80
81/* The following is true if vaddr1 and vaddr2 would cause
82 * a 'bad alias'.
83 */
84#define S4CVAC_BADALIAS(vaddr1, vaddr2) \
85 ((((unsigned long) (vaddr1)) ^ ((unsigned long) (vaddr2))) & \
86 (S4CVAC_BADBITS))
87
88/* The following structure describes the characteristics of a sun4c
89 * VAC as probed from the prom during boot time.
90 */
91struct sun4c_vac_props {
92 unsigned int num_bytes; /* Size of the cache */
93 unsigned int do_hwflushes; /* Hardware flushing available? */
94 unsigned int linesize; /* Size of each line in bytes */
95 unsigned int log2lsize; /* log2(linesize) */
96 unsigned int on; /* VAC is enabled */
97};
98
99extern struct sun4c_vac_props sun4c_vacinfo;
100
101/* sun4c_enable_vac() enables the sun4c virtual address cache. */
102static inline void sun4c_enable_vac(void)
103{
104 __asm__ __volatile__("lduba [%0] %1, %%g1\n\t"
105 "or %%g1, %2, %%g1\n\t"
106 "stba %%g1, [%0] %1\n\t"
107 : /* no outputs */
108 : "r" ((unsigned int) AC_SENABLE),
109 "i" (ASI_CONTROL), "i" (SENABLE_CACHE)
110 : "g1", "memory");
111 sun4c_vacinfo.on = 1;
112}
113
114/* sun4c_disable_vac() disables the virtual address cache. */
115static inline void sun4c_disable_vac(void)
116{
117 __asm__ __volatile__("lduba [%0] %1, %%g1\n\t"
118 "andn %%g1, %2, %%g1\n\t"
119 "stba %%g1, [%0] %1\n\t"
120 : /* no outputs */
121 : "r" ((unsigned int) AC_SENABLE),
122 "i" (ASI_CONTROL), "i" (SENABLE_CACHE)
123 : "g1", "memory");
124 sun4c_vacinfo.on = 0;
125}
126
127#endif /* !(_SPARC_VAC_OPS_H) */
diff --git a/arch/sparc/include/asm/vaddrs.h b/arch/sparc/include/asm/vaddrs.h
index 541e13755cec..da6535d88a72 100644
--- a/arch/sparc/include/asm/vaddrs.h
+++ b/arch/sparc/include/asm/vaddrs.h
@@ -34,22 +34,6 @@
34#define IOBASE_VADDR 0xfe000000 34#define IOBASE_VADDR 0xfe000000
35#define IOBASE_END 0xfe600000 35#define IOBASE_END 0xfe600000
36 36
37/*
38 * On the sun4/4c we need a place
39 * to reliably map locked down kernel data. This includes the
40 * task_struct and kernel stack pages of each process plus the
41 * scsi buffers during dvma IO transfers, also the floppy buffers
42 * during pseudo dma which runs with traps off (no faults allowed).
43 * Some quick calculations yield:
44 * NR_TASKS <512> * (3 * PAGE_SIZE) == 0x600000
45 * Subtract this from 0xc00000 and you get 0x927C0 of vm left
46 * over to map SCSI dvma + floppy pseudo-dma buffers. So be
47 * careful if you change NR_TASKS or else there won't be enough
48 * room for it all.
49 */
50#define SUN4C_LOCK_VADDR 0xff000000
51#define SUN4C_LOCK_END 0xffc00000
52
53#define KADB_DEBUGGER_BEGVM 0xffc00000 /* Where kern debugger is in virt-mem */ 37#define KADB_DEBUGGER_BEGVM 0xffc00000 /* Where kern debugger is in virt-mem */
54#define KADB_DEBUGGER_ENDVM 0xffd00000 38#define KADB_DEBUGGER_ENDVM 0xffd00000
55#define DEBUG_FIRSTVADDR KADB_DEBUGGER_BEGVM 39#define DEBUG_FIRSTVADDR KADB_DEBUGGER_BEGVM
diff --git a/arch/sparc/include/asm/winmacro.h b/arch/sparc/include/asm/winmacro.h
index a9be04b0d049..9b7b21764cde 100644
--- a/arch/sparc/include/asm/winmacro.h
+++ b/arch/sparc/include/asm/winmacro.h
@@ -103,37 +103,24 @@
103 st %scratch, [%cur_reg + TI_W_SAVED]; 103 st %scratch, [%cur_reg + TI_W_SAVED];
104 104
105#ifdef CONFIG_SMP 105#ifdef CONFIG_SMP
106/* Results of LOAD_CURRENT() after BTFIXUP for SUN4M, SUN4D & LEON (comments) */ 106#define LOAD_CURRENT(dest_reg, idreg) \
107#define LOAD_CURRENT4M(dest_reg, idreg) \ 107661: rd %tbr, %idreg; \
108 rd %tbr, %idreg; \ 108 srl %idreg, 10, %idreg; \
109 sethi %hi(current_set), %dest_reg; \ 109 and %idreg, 0xc, %idreg; \
110 srl %idreg, 10, %idreg; \ 110 .section .cpuid_patch, "ax"; \
111 or %dest_reg, %lo(current_set), %dest_reg; \ 111 /* Instruction location. */ \
112 and %idreg, 0xc, %idreg; \ 112 .word 661b; \
113 ld [%idreg + %dest_reg], %dest_reg; 113 /* SUN4D implementation. */ \
114 114 lda [%g0] ASI_M_VIKING_TMP1, %idreg; \
115#define LOAD_CURRENT4D(dest_reg, idreg) \ 115 sll %idreg, 2, %idreg; \
116 lda [%g0] ASI_M_VIKING_TMP1, %idreg; \ 116 nop; \
117 sethi %hi(C_LABEL(current_set)), %dest_reg; \ 117 /* LEON implementation. */ \
118 sll %idreg, 2, %idreg; \ 118 rd %asr17, %idreg; \
119 or %dest_reg, %lo(C_LABEL(current_set)), %dest_reg; \ 119 srl %idreg, 0x1c, %idreg; \
120 ld [%idreg + %dest_reg], %dest_reg; 120 sll %idreg, 0x02, %idreg; \
121 121 .previous; \
122#define LOAD_CURRENT_LEON(dest_reg, idreg) \ 122 sethi %hi(current_set), %dest_reg; \
123 rd %asr17, %idreg; \ 123 or %dest_reg, %lo(current_set), %dest_reg;\
124 sethi %hi(current_set), %dest_reg; \
125 srl %idreg, 0x1c, %idreg; \
126 or %dest_reg, %lo(current_set), %dest_reg; \
127 sll %idreg, 0x2, %idreg; \
128 ld [%idreg + %dest_reg], %dest_reg;
129
130/* Blackbox - take care with this... - check smp4m and smp4d before changing this. */
131#define LOAD_CURRENT(dest_reg, idreg) \
132 sethi %hi(___b_load_current), %idreg; \
133 sethi %hi(current_set), %dest_reg; \
134 sethi %hi(boot_cpu_id4), %idreg; \
135 or %dest_reg, %lo(current_set), %dest_reg; \
136 ldub [%idreg + %lo(boot_cpu_id4)], %idreg; \
137 ld [%idreg + %dest_reg], %dest_reg; 124 ld [%idreg + %dest_reg], %dest_reg;
138#else 125#else
139#define LOAD_CURRENT(dest_reg, idreg) \ 126#define LOAD_CURRENT(dest_reg, idreg) \
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index cb85458f89d2..72308f9b0096 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -6,7 +6,6 @@ asflags-y := -ansi
6ccflags-y := -Werror 6ccflags-y := -Werror
7 7
8extra-y := head_$(BITS).o 8extra-y := head_$(BITS).o
9extra-y += init_task.o
10 9
11# Undefine sparc when processing vmlinux.lds - it is used 10# Undefine sparc when processing vmlinux.lds - it is used
12# And teach CPP we are doing $(BITS) builds (for this case) 11# And teach CPP we are doing $(BITS) builds (for this case)
@@ -28,7 +27,7 @@ obj-y += traps_$(BITS).o
28 27
29# IRQ 28# IRQ
30obj-y += irq_$(BITS).o 29obj-y += irq_$(BITS).o
31obj-$(CONFIG_SPARC32) += sun4m_irq.o sun4c_irq.o sun4d_irq.o 30obj-$(CONFIG_SPARC32) += sun4m_irq.o sun4d_irq.o
32 31
33obj-y += process_$(BITS).o 32obj-y += process_$(BITS).o
34obj-y += signal_$(BITS).o 33obj-y += signal_$(BITS).o
@@ -46,7 +45,6 @@ obj-$(CONFIG_SPARC32) += tadpole.o
46obj-y += ptrace_$(BITS).o 45obj-y += ptrace_$(BITS).o
47obj-y += unaligned_$(BITS).o 46obj-y += unaligned_$(BITS).o
48obj-y += una_asm_$(BITS).o 47obj-y += una_asm_$(BITS).o
49obj-$(CONFIG_SPARC32) += muldiv.o
50obj-y += prom_common.o 48obj-y += prom_common.o
51obj-y += prom_$(BITS).o 49obj-y += prom_$(BITS).o
52obj-y += of_device_common.o 50obj-y += of_device_common.o
diff --git a/arch/sparc/kernel/auxio_32.c b/arch/sparc/kernel/auxio_32.c
index 56d0f52c3e62..e20cc55fb768 100644
--- a/arch/sparc/kernel/auxio_32.c
+++ b/arch/sparc/kernel/auxio_32.c
@@ -32,7 +32,6 @@ void __init auxio_probe(void)
32 switch (sparc_cpu_model) { 32 switch (sparc_cpu_model) {
33 case sparc_leon: 33 case sparc_leon:
34 case sun4d: 34 case sun4d:
35 case sun4:
36 return; 35 return;
37 default: 36 default:
38 break; 37 break;
@@ -65,9 +64,8 @@ void __init auxio_probe(void)
65 r.start = auxregs[0].phys_addr; 64 r.start = auxregs[0].phys_addr;
66 r.end = auxregs[0].phys_addr + auxregs[0].reg_size - 1; 65 r.end = auxregs[0].phys_addr + auxregs[0].reg_size - 1;
67 auxio_register = of_ioremap(&r, 0, auxregs[0].reg_size, "auxio"); 66 auxio_register = of_ioremap(&r, 0, auxregs[0].reg_size, "auxio");
68 /* Fix the address on sun4m and sun4c. */ 67 /* Fix the address on sun4m. */
69 if((((unsigned long) auxregs[0].phys_addr) & 3) == 3 || 68 if ((((unsigned long) auxregs[0].phys_addr) & 3) == 3)
70 sparc_cpu_model == sun4c)
71 auxio_register += (3 - ((unsigned long)auxio_register & 3)); 69 auxio_register += (3 - ((unsigned long)auxio_register & 3));
72 70
73 set_auxio(AUXIO_LED, 0); 71 set_auxio(AUXIO_LED, 0);
@@ -86,12 +84,7 @@ void set_auxio(unsigned char bits_on, unsigned char bits_off)
86 unsigned char regval; 84 unsigned char regval;
87 unsigned long flags; 85 unsigned long flags;
88 spin_lock_irqsave(&auxio_lock, flags); 86 spin_lock_irqsave(&auxio_lock, flags);
89 switch(sparc_cpu_model) { 87 switch (sparc_cpu_model) {
90 case sun4c:
91 regval = sbus_readb(auxio_register);
92 sbus_writeb(((regval | bits_on) & ~bits_off) | AUXIO_ORMEIN,
93 auxio_register);
94 break;
95 case sun4m: 88 case sun4m:
96 if(!auxio_register) 89 if(!auxio_register)
97 break; /* VME chassis sun4m, no auxio. */ 90 break; /* VME chassis sun4m, no auxio. */
diff --git a/arch/sparc/kernel/central.c b/arch/sparc/kernel/central.c
index 38d48a59879c..9708851a8b9f 100644
--- a/arch/sparc/kernel/central.c
+++ b/arch/sparc/kernel/central.c
@@ -269,4 +269,4 @@ static int __init sunfire_init(void)
269 return 0; 269 return 0;
270} 270}
271 271
272subsys_initcall(sunfire_init); 272fs_initcall(sunfire_init);
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c
index 6b2f56a6f8af..3d465e87f7e2 100644
--- a/arch/sparc/kernel/devices.c
+++ b/arch/sparc/kernel/devices.c
@@ -21,7 +21,6 @@
21#include <asm/cpu_type.h> 21#include <asm/cpu_type.h>
22 22
23extern void clock_stop_probe(void); /* tadpole.c */ 23extern void clock_stop_probe(void); /* tadpole.c */
24extern void sun4c_probe_memerr_reg(void);
25 24
26static char *cpu_mid_prop(void) 25static char *cpu_mid_prop(void)
27{ 26{
@@ -139,7 +138,4 @@ void __init device_scan(void)
139 auxio_power_probe(); 138 auxio_power_probe();
140 } 139 }
141 clock_stop_probe(); 140 clock_stop_probe();
142
143 if (ARCH_SUN4C)
144 sun4c_probe_memerr_reg();
145} 141}
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
index fea13c7b1aee..f09257c86107 100644
--- a/arch/sparc/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
@@ -868,7 +868,7 @@ void ldom_power_off(void)
868 868
869static void ds_conn_reset(struct ds_info *dp) 869static void ds_conn_reset(struct ds_info *dp)
870{ 870{
871 printk(KERN_ERR "ds-%llu: ds_conn_reset() from %p\n", 871 printk(KERN_ERR "ds-%llu: ds_conn_reset() from %pf\n",
872 dp->id, __builtin_return_address(0)); 872 dp->id, __builtin_return_address(0));
873} 873}
874 874
@@ -1264,4 +1264,4 @@ static int __init ds_init(void)
1264 return vio_register_driver(&ds_driver); 1264 return vio_register_driver(&ds_driver);
1265} 1265}
1266 1266
1267subsys_initcall(ds_init); 1267fs_initcall(ds_init);
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index f445e98463e6..2dbe1806e530 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -7,6 +7,7 @@
7 * Copyright (C) 1997 Anton Blanchard (anton@progsoc.uts.edu.au) 7 * Copyright (C) 1997 Anton Blanchard (anton@progsoc.uts.edu.au)
8 */ 8 */
9 9
10#include <linux/linkage.h>
10#include <linux/errno.h> 11#include <linux/errno.h>
11 12
12#include <asm/head.h> 13#include <asm/head.h>
@@ -17,10 +18,8 @@
17#include <asm/asm-offsets.h> 18#include <asm/asm-offsets.h>
18#include <asm/psr.h> 19#include <asm/psr.h>
19#include <asm/vaddrs.h> 20#include <asm/vaddrs.h>
20#include <asm/memreg.h>
21#include <asm/page.h> 21#include <asm/page.h>
22#include <asm/pgtable.h> 22#include <asm/pgtable.h>
23#include <asm/pgtsun4c.h>
24#include <asm/winmacro.h> 23#include <asm/winmacro.h>
25#include <asm/signal.h> 24#include <asm/signal.h>
26#include <asm/obio.h> 25#include <asm/obio.h>
@@ -125,22 +124,11 @@ floppy_tdone:
125 set auxio_register, %l7 124 set auxio_register, %l7
126 ld [%l7], %l7 125 ld [%l7], %l7
127 126
128 set sparc_cpu_model, %l5 127 ldub [%l7], %l5
129 ld [%l5], %l5
130 subcc %l5, 1, %g0 /* enum { sun4c = 1 }; */
131 be 1f
132 ldub [%l7], %l5
133 128
134 or %l5, 0xc2, %l5 129 or %l5, 0xc2, %l5
135 stb %l5, [%l7] 130 stb %l5, [%l7]
136 andn %l5, 0x02, %l5 131 andn %l5, 0x02, %l5
137 b 2f
138 nop
139
1401:
141 or %l5, 0xf4, %l5
142 stb %l5, [%l7]
143 andn %l5, 0x04, %l5
144 132
1452: 1332:
146 /* Kill some time so the bits set */ 134 /* Kill some time so the bits set */
@@ -266,6 +254,11 @@ smp4m_ticker:
266 WRITE_PAUSE 254 WRITE_PAUSE
267 RESTORE_ALL 255 RESTORE_ALL
268 256
257#define GET_PROCESSOR4M_ID(reg) \
258 rd %tbr, %reg; \
259 srl %reg, 12, %reg; \
260 and %reg, 3, %reg;
261
269 /* Here is where we check for possible SMP IPI passed to us 262 /* Here is where we check for possible SMP IPI passed to us
270 * on some level other than 15 which is the NMI and only used 263 * on some level other than 15 which is the NMI and only used
271 * for cross calls. That has a separate entry point below. 264 * for cross calls. That has a separate entry point below.
@@ -328,7 +321,7 @@ linux_trap_ipi15_sun4m:
328 ld [%o5 + %o0], %o5 321 ld [%o5 + %o0], %o5
329 ld [%o5 + 0x00], %o3 ! sun4m_irq_percpu[cpu]->pending 322 ld [%o5 + 0x00], %o3 ! sun4m_irq_percpu[cpu]->pending
330 andcc %o3, %o2, %g0 323 andcc %o3, %o2, %g0
331 be 1f ! Must be an NMI async memory error 324 be sun4m_nmi_error ! Must be an NMI async memory error
332 st %o2, [%o5 + 0x04] ! sun4m_irq_percpu[cpu]->clear=0x80000000 325 st %o2, [%o5 + 0x04] ! sun4m_irq_percpu[cpu]->clear=0x80000000
333 WRITE_PAUSE 326 WRITE_PAUSE
334 ld [%o5 + 0x00], %g0 ! sun4m_irq_percpu[cpu]->pending 327 ld [%o5 + 0x00], %g0 ! sun4m_irq_percpu[cpu]->pending
@@ -342,27 +335,6 @@ linux_trap_ipi15_sun4m:
342 nop 335 nop
343 b ret_trap_lockless_ipi 336 b ret_trap_lockless_ipi
344 clr %l6 337 clr %l6
3451:
346 /* NMI async memory error handling. */
347 sethi %hi(0x80000000), %l4
348 sethi %hi(sun4m_irq_global), %o5
349 ld [%o5 + %lo(sun4m_irq_global)], %l5
350 st %l4, [%l5 + 0x0c] ! sun4m_irq_global->mask_set=0x80000000
351 WRITE_PAUSE
352 ld [%l5 + 0x00], %g0 ! sun4m_irq_global->pending
353 WRITE_PAUSE
354 or %l0, PSR_PIL, %l4
355 wr %l4, 0x0, %psr
356 WRITE_PAUSE
357 wr %l4, PSR_ET, %psr
358 WRITE_PAUSE
359 call sun4m_nmi
360 nop
361 st %l4, [%l5 + 0x08] ! sun4m_irq_global->mask_clear=0x80000000
362 WRITE_PAUSE
363 ld [%l5 + 0x00], %g0 ! sun4m_irq_global->pending
364 WRITE_PAUSE
365 RESTORE_ALL
366 338
367 .globl smp4d_ticker 339 .globl smp4d_ticker
368 /* SMP per-cpu ticker interrupts are handled specially. */ 340 /* SMP per-cpu ticker interrupts are handled specially. */
@@ -760,326 +732,37 @@ setcc_trap_handler:
760 jmp %l2 ! advance over trap instruction 732 jmp %l2 ! advance over trap instruction
761 rett %l2 + 0x4 ! like this... 733 rett %l2 + 0x4 ! like this...
762 734
763 .align 4 735sun4m_nmi_error:
764 .globl linux_trap_nmi_sun4c 736 /* NMI async memory error handling. */
765linux_trap_nmi_sun4c: 737 sethi %hi(0x80000000), %l4
766 SAVE_ALL 738 sethi %hi(sun4m_irq_global), %o5
767 739 ld [%o5 + %lo(sun4m_irq_global)], %l5
768 /* Ugh, we need to clear the IRQ line. This is now 740 st %l4, [%l5 + 0x0c] ! sun4m_irq_global->mask_set=0x80000000
769 * a very sun4c specific trap handler...
770 */
771 sethi %hi(interrupt_enable), %l5
772 ld [%l5 + %lo(interrupt_enable)], %l5
773 ldub [%l5], %l6
774 andn %l6, INTS_ENAB, %l6
775 stb %l6, [%l5]
776
777 /* Now it is safe to re-enable traps without recursion. */
778 or %l0, PSR_PIL, %l0
779 wr %l0, PSR_ET, %psr
780 WRITE_PAUSE 741 WRITE_PAUSE
781 742 ld [%l5 + 0x00], %g0 ! sun4m_irq_global->pending
782 /* Now call the c-code with the pt_regs frame ptr and the
783 * memory error registers as arguments. The ordering chosen
784 * here is due to unlatching semantics.
785 */
786 sethi %hi(AC_SYNC_ERR), %o0
787 add %o0, 0x4, %o0
788 lda [%o0] ASI_CONTROL, %o2 ! sync vaddr
789 sub %o0, 0x4, %o0
790 lda [%o0] ASI_CONTROL, %o1 ! sync error
791 add %o0, 0xc, %o0
792 lda [%o0] ASI_CONTROL, %o4 ! async vaddr
793 sub %o0, 0x4, %o0
794 lda [%o0] ASI_CONTROL, %o3 ! async error
795 call sparc_lvl15_nmi
796 add %sp, STACKFRAME_SZ, %o0
797
798 RESTORE_ALL
799
800 .align 4
801 .globl invalid_segment_patch1_ff
802 .globl invalid_segment_patch2_ff
803invalid_segment_patch1_ff: cmp %l4, 0xff
804invalid_segment_patch2_ff: mov 0xff, %l3
805
806 .align 4
807 .globl invalid_segment_patch1_1ff
808 .globl invalid_segment_patch2_1ff
809invalid_segment_patch1_1ff: cmp %l4, 0x1ff
810invalid_segment_patch2_1ff: mov 0x1ff, %l3
811
812 .align 4
813 .globl num_context_patch1_16, num_context_patch2_16
814num_context_patch1_16: mov 0x10, %l7
815num_context_patch2_16: mov 0x10, %l7
816
817 .align 4
818 .globl vac_linesize_patch_32
819vac_linesize_patch_32: subcc %l7, 32, %l7
820
821 .align 4
822 .globl vac_hwflush_patch1_on, vac_hwflush_patch2_on
823
824/*
825 * Ugly, but we can't use hardware flushing on the sun4 and we'd require
826 * two instructions (Anton)
827 */
828vac_hwflush_patch1_on: addcc %l7, -PAGE_SIZE, %l7
829
830vac_hwflush_patch2_on: sta %g0, [%l3 + %l7] ASI_HWFLUSHSEG
831
832 .globl invalid_segment_patch1, invalid_segment_patch2
833 .globl num_context_patch1
834 .globl vac_linesize_patch, vac_hwflush_patch1
835 .globl vac_hwflush_patch2
836
837 .align 4
838 .globl sun4c_fault
839
840! %l0 = %psr
841! %l1 = %pc
842! %l2 = %npc
843! %l3 = %wim
844! %l7 = 1 for textfault
845! We want error in %l5, vaddr in %l6
846sun4c_fault:
847 sethi %hi(AC_SYNC_ERR), %l4
848 add %l4, 0x4, %l6 ! AC_SYNC_VA in %l6
849 lda [%l6] ASI_CONTROL, %l5 ! Address
850 lda [%l4] ASI_CONTROL, %l6 ! Error, retained for a bit
851
852 andn %l5, 0xfff, %l5 ! Encode all info into l7
853 srl %l6, 14, %l4
854
855 and %l4, 2, %l4
856 or %l5, %l4, %l4
857
858 or %l4, %l7, %l7 ! l7 = [addr,write,txtfault]
859
860 andcc %l0, PSR_PS, %g0
861 be sun4c_fault_fromuser
862 andcc %l7, 1, %g0 ! Text fault?
863
864 be 1f
865 sethi %hi(KERNBASE), %l4
866
867 mov %l1, %l5 ! PC
868
8691:
870 cmp %l5, %l4
871 blu sun4c_fault_fromuser
872 sethi %hi(~((1 << SUN4C_REAL_PGDIR_SHIFT) - 1)), %l4
873
874 /* If the kernel references a bum kernel pointer, or a pte which
875 * points to a non existent page in ram, we will run this code
876 * _forever_ and lock up the machine!!!!! So we must check for
877 * this condition, the AC_SYNC_ERR bits are what we must examine.
878 * Also a parity error would make this happen as well. So we just
879 * check that we are in fact servicing a tlb miss and not some
880 * other type of fault for the kernel.
881 */
882 andcc %l6, 0x80, %g0
883 be sun4c_fault_fromuser
884 and %l5, %l4, %l5
885
886 /* Test for NULL pte_t * in vmalloc area. */
887 sethi %hi(VMALLOC_START), %l4
888 cmp %l5, %l4
889 blu,a invalid_segment_patch1
890 lduXa [%l5] ASI_SEGMAP, %l4
891
892 sethi %hi(swapper_pg_dir), %l4
893 srl %l5, SUN4C_PGDIR_SHIFT, %l6
894 or %l4, %lo(swapper_pg_dir), %l4
895 sll %l6, 2, %l6
896 ld [%l4 + %l6], %l4
897 andcc %l4, PAGE_MASK, %g0
898 be sun4c_fault_fromuser
899 lduXa [%l5] ASI_SEGMAP, %l4
900
901invalid_segment_patch1:
902 cmp %l4, 0x7f
903 bne 1f
904 sethi %hi(sun4c_kfree_ring), %l4
905 or %l4, %lo(sun4c_kfree_ring), %l4
906 ld [%l4 + 0x18], %l3
907 deccc %l3 ! do we have a free entry?
908 bcs,a 2f ! no, unmap one.
909 sethi %hi(sun4c_kernel_ring), %l4
910
911 st %l3, [%l4 + 0x18] ! sun4c_kfree_ring.num_entries--
912
913 ld [%l4 + 0x00], %l6 ! entry = sun4c_kfree_ring.ringhd.next
914 st %l5, [%l6 + 0x08] ! entry->vaddr = address
915
916 ld [%l6 + 0x00], %l3 ! next = entry->next
917 ld [%l6 + 0x04], %l7 ! entry->prev
918
919 st %l7, [%l3 + 0x04] ! next->prev = entry->prev
920 st %l3, [%l7 + 0x00] ! entry->prev->next = next
921
922 sethi %hi(sun4c_kernel_ring), %l4
923 or %l4, %lo(sun4c_kernel_ring), %l4
924 ! head = &sun4c_kernel_ring.ringhd
925
926 ld [%l4 + 0x00], %l7 ! head->next
927
928 st %l4, [%l6 + 0x04] ! entry->prev = head
929 st %l7, [%l6 + 0x00] ! entry->next = head->next
930 st %l6, [%l7 + 0x04] ! head->next->prev = entry
931
932 st %l6, [%l4 + 0x00] ! head->next = entry
933
934 ld [%l4 + 0x18], %l3
935 inc %l3 ! sun4c_kernel_ring.num_entries++
936 st %l3, [%l4 + 0x18]
937 b 4f
938 ld [%l6 + 0x08], %l5
939
9402:
941 or %l4, %lo(sun4c_kernel_ring), %l4
942 ! head = &sun4c_kernel_ring.ringhd
943
944 ld [%l4 + 0x04], %l6 ! entry = head->prev
945
946 ld [%l6 + 0x08], %l3 ! tmp = entry->vaddr
947
948 ! Flush segment from the cache.
949 sethi %hi((64 * 1024)), %l7
9509:
951vac_hwflush_patch1:
952vac_linesize_patch:
953 subcc %l7, 16, %l7
954 bne 9b
955vac_hwflush_patch2:
956 sta %g0, [%l3 + %l7] ASI_FLUSHSEG
957
958 st %l5, [%l6 + 0x08] ! entry->vaddr = address
959
960 ld [%l6 + 0x00], %l5 ! next = entry->next
961 ld [%l6 + 0x04], %l7 ! entry->prev
962
963 st %l7, [%l5 + 0x04] ! next->prev = entry->prev
964 st %l5, [%l7 + 0x00] ! entry->prev->next = next
965 st %l4, [%l6 + 0x04] ! entry->prev = head
966
967 ld [%l4 + 0x00], %l7 ! head->next
968
969 st %l7, [%l6 + 0x00] ! entry->next = head->next
970 st %l6, [%l7 + 0x04] ! head->next->prev = entry
971 st %l6, [%l4 + 0x00] ! head->next = entry
972
973 mov %l3, %l5 ! address = tmp
974
9754:
976num_context_patch1:
977 mov 0x08, %l7
978
979 ld [%l6 + 0x08], %l4
980 ldub [%l6 + 0x0c], %l3
981 or %l4, %l3, %l4 ! encode new vaddr/pseg into l4
982
983 sethi %hi(AC_CONTEXT), %l3
984 lduba [%l3] ASI_CONTROL, %l6
985
986 /* Invalidate old mapping, instantiate new mapping,
987 * for each context. Registers l6/l7 are live across
988 * this loop.
989 */
9903: deccc %l7
991 sethi %hi(AC_CONTEXT), %l3
992 stba %l7, [%l3] ASI_CONTROL
993invalid_segment_patch2:
994 mov 0x7f, %l3
995 stXa %l3, [%l5] ASI_SEGMAP
996 andn %l4, 0x1ff, %l3
997 bne 3b
998 stXa %l4, [%l3] ASI_SEGMAP
999
1000 sethi %hi(AC_CONTEXT), %l3
1001 stba %l6, [%l3] ASI_CONTROL
1002
1003 andn %l4, 0x1ff, %l5
1004
10051:
1006 sethi %hi(VMALLOC_START), %l4
1007 cmp %l5, %l4
1008
1009 bgeu 1f
1010 mov 1 << (SUN4C_REAL_PGDIR_SHIFT - PAGE_SHIFT), %l7
1011
1012 sethi %hi(KERNBASE), %l6
1013
1014 sub %l5, %l6, %l4
1015 srl %l4, PAGE_SHIFT, %l4
1016 sethi %hi((SUN4C_PAGE_KERNEL & 0xf4000000)), %l3
1017 or %l3, %l4, %l3
1018
1019 sethi %hi(PAGE_SIZE), %l4
1020
10212:
1022 sta %l3, [%l5] ASI_PTE
1023 deccc %l7
1024 inc %l3
1025 bne 2b
1026 add %l5, %l4, %l5
1027
1028 b 7f
1029 sethi %hi(sun4c_kernel_faults), %l4
1030
10311:
1032 srl %l5, SUN4C_PGDIR_SHIFT, %l3
1033 sethi %hi(swapper_pg_dir), %l4
1034 or %l4, %lo(swapper_pg_dir), %l4
1035 sll %l3, 2, %l3
1036 ld [%l4 + %l3], %l4
1037 and %l4, PAGE_MASK, %l4
1038
1039 srl %l5, (PAGE_SHIFT - 2), %l6
1040 and %l6, ((SUN4C_PTRS_PER_PTE - 1) << 2), %l6
1041 add %l6, %l4, %l6
1042
1043 sethi %hi(PAGE_SIZE), %l4
1044
10452:
1046 ld [%l6], %l3
1047 deccc %l7
1048 sta %l3, [%l5] ASI_PTE
1049 add %l6, 0x4, %l6
1050 bne 2b
1051 add %l5, %l4, %l5
1052
1053 sethi %hi(sun4c_kernel_faults), %l4
10547:
1055 ld [%l4 + %lo(sun4c_kernel_faults)], %l3
1056 inc %l3
1057 st %l3, [%l4 + %lo(sun4c_kernel_faults)]
1058
1059 /* Restore condition codes */
1060 wr %l0, 0x0, %psr
1061 WRITE_PAUSE 743 WRITE_PAUSE
1062 jmp %l1 744 or %l0, PSR_PIL, %l4
1063 rett %l2 745 wr %l4, 0x0, %psr
1064 746 WRITE_PAUSE
1065sun4c_fault_fromuser: 747 wr %l4, PSR_ET, %psr
1066 SAVE_ALL 748 WRITE_PAUSE
749 call sun4m_nmi
1067 nop 750 nop
1068 751 st %l4, [%l5 + 0x08] ! sun4m_irq_global->mask_clear=0x80000000
1069 mov %l7, %o1 ! Decode the info from %l7
1070 mov %l7, %o2
1071 and %o1, 1, %o1 ! arg2 = text_faultp
1072 mov %l7, %o3
1073 and %o2, 2, %o2 ! arg3 = writep
1074 andn %o3, 0xfff, %o3 ! arg4 = faulting address
1075
1076 wr %l0, PSR_ET, %psr
1077 WRITE_PAUSE 752 WRITE_PAUSE
753 ld [%l5 + 0x00], %g0 ! sun4m_irq_global->pending
754 WRITE_PAUSE
755 RESTORE_ALL
1078 756
1079 call do_sun4c_fault 757#ifndef CONFIG_SMP
1080 add %sp, STACKFRAME_SZ, %o0 ! arg1 = pt_regs ptr 758 .align 4
759 .globl linux_trap_ipi15_sun4m
760linux_trap_ipi15_sun4m:
761 SAVE_ALL
1081 762
1082 RESTORE_ALL 763 ba sun4m_nmi_error
764 nop
765#endif /* CONFIG_SMP */
1083 766
1084 .align 4 767 .align 4
1085 .globl srmmu_fault 768 .globl srmmu_fault
@@ -1483,11 +1166,13 @@ fpload:
1483 .globl __ndelay 1166 .globl __ndelay
1484__ndelay: 1167__ndelay:
1485 save %sp, -STACKFRAME_SZ, %sp 1168 save %sp, -STACKFRAME_SZ, %sp
1486 mov %i0, %o0 1169 mov %i0, %o0 ! round multiplier up so large ns ok
1487 call .umul ! round multiplier up so large ns ok 1170 mov 0x1ae, %o1 ! 2**32 / (1 000 000 000 / HZ)
1488 mov 0x1ae, %o1 ! 2**32 / (1 000 000 000 / HZ) 1171 umul %o0, %o1, %o0
1489 call .umul 1172 rd %y, %o1
1490 mov %i1, %o1 ! udelay_val 1173 mov %i1, %o1 ! udelay_val
1174 umul %o0, %o1, %o0
1175 rd %y, %o1
1491 ba delay_continue 1176 ba delay_continue
1492 mov %o1, %o0 ! >>32 later for better resolution 1177 mov %o1, %o0 ! >>32 later for better resolution
1493 1178
@@ -1496,18 +1181,21 @@ __udelay:
1496 save %sp, -STACKFRAME_SZ, %sp 1181 save %sp, -STACKFRAME_SZ, %sp
1497 mov %i0, %o0 1182 mov %i0, %o0
1498 sethi %hi(0x10c7), %o1 ! round multiplier up so large us ok 1183 sethi %hi(0x10c7), %o1 ! round multiplier up so large us ok
1499 call .umul 1184 or %o1, %lo(0x10c7), %o1 ! 2**32 / 1 000 000
1500 or %o1, %lo(0x10c7), %o1 ! 2**32 / 1 000 000 1185 umul %o0, %o1, %o0
1501 call .umul 1186 rd %y, %o1
1502 mov %i1, %o1 ! udelay_val 1187 mov %i1, %o1 ! udelay_val
1188 umul %o0, %o1, %o0
1189 rd %y, %o1
1503 sethi %hi(0x028f4b62), %l0 ! Add in rounding constant * 2**32, 1190 sethi %hi(0x028f4b62), %l0 ! Add in rounding constant * 2**32,
1504 or %g0, %lo(0x028f4b62), %l0 1191 or %g0, %lo(0x028f4b62), %l0
1505 addcc %o0, %l0, %o0 ! 2**32 * 0.009 999 1192 addcc %o0, %l0, %o0 ! 2**32 * 0.009 999
1506 bcs,a 3f 1193 bcs,a 3f
1507 add %o1, 0x01, %o1 1194 add %o1, 0x01, %o1
15083: 11953:
1509 call .umul 1196 mov HZ, %o0 ! >>32 earlier for wider range
1510 mov HZ, %o0 ! >>32 earlier for wider range 1197 umul %o0, %o1, %o0
1198 rd %y, %o1
1511 1199
1512delay_continue: 1200delay_continue:
1513 cmp %o0, 0x0 1201 cmp %o0, 0x0
@@ -1670,4 +1358,26 @@ flushw_all:
1670 ret 1358 ret
1671 restore 1359 restore
1672 1360
1361#ifdef CONFIG_SMP
1362ENTRY(hard_smp_processor_id)
1363661: rd %tbr, %g1
1364 srl %g1, 12, %o0
1365 and %o0, 3, %o0
1366 .section .cpuid_patch, "ax"
1367 /* Instruction location. */
1368 .word 661b
1369 /* SUN4D implementation. */
1370 lda [%g0] ASI_M_VIKING_TMP1, %o0
1371 nop
1372 nop
1373 /* LEON implementation. */
1374 rd %asr17, %o0
1375 srl %o0, 0x1c, %o0
1376 nop
1377 .previous
1378 retl
1379 nop
1380ENDPROC(hard_smp_processor_id)
1381#endif
1382
1673/* End of entry.S */ 1383/* End of entry.S */
diff --git a/arch/sparc/kernel/etrap_32.S b/arch/sparc/kernel/etrap_32.S
index e806fcdc46db..84b5f0d2afde 100644
--- a/arch/sparc/kernel/etrap_32.S
+++ b/arch/sparc/kernel/etrap_32.S
@@ -216,9 +216,7 @@ tsetup_patch6:
216 /* Call MMU-architecture dependent stack checking 216 /* Call MMU-architecture dependent stack checking
217 * routine. 217 * routine.
218 */ 218 */
219 .globl tsetup_mmu_patchme 219 b tsetup_srmmu_stackchk
220tsetup_mmu_patchme:
221 b tsetup_sun4c_stackchk
222 andcc %sp, 0x7, %g0 220 andcc %sp, 0x7, %g0
223 221
224 /* Architecture specific stack checking routines. When either 222 /* Architecture specific stack checking routines. When either
@@ -228,52 +226,6 @@ tsetup_mmu_patchme:
228 */ 226 */
229#define glob_tmp g1 227#define glob_tmp g1
230 228
231tsetup_sun4c_stackchk:
232 /* Done by caller: andcc %sp, 0x7, %g0 */
233 bne trap_setup_user_stack_is_bolixed
234 sra %sp, 29, %glob_tmp
235
236 add %glob_tmp, 0x1, %glob_tmp
237 andncc %glob_tmp, 0x1, %g0
238 bne trap_setup_user_stack_is_bolixed
239 and %sp, 0xfff, %glob_tmp ! delay slot
240
241 /* See if our dump area will be on more than one
242 * page.
243 */
244 add %glob_tmp, 0x38, %glob_tmp
245 andncc %glob_tmp, 0xff8, %g0
246 be tsetup_sun4c_onepage ! only one page to check
247 lda [%sp] ASI_PTE, %glob_tmp ! have to check first page anyways
248
249tsetup_sun4c_twopages:
250 /* Is first page ok permission wise? */
251 srl %glob_tmp, 29, %glob_tmp
252 cmp %glob_tmp, 0x6
253 bne trap_setup_user_stack_is_bolixed
254 add %sp, 0x38, %glob_tmp /* Is second page in vma hole? */
255
256 sra %glob_tmp, 29, %glob_tmp
257 add %glob_tmp, 0x1, %glob_tmp
258 andncc %glob_tmp, 0x1, %g0
259 bne trap_setup_user_stack_is_bolixed
260 add %sp, 0x38, %glob_tmp
261
262 lda [%glob_tmp] ASI_PTE, %glob_tmp
263
264tsetup_sun4c_onepage:
265 srl %glob_tmp, 29, %glob_tmp
266 cmp %glob_tmp, 0x6 ! can user write to it?
267 bne trap_setup_user_stack_is_bolixed ! failure
268 nop
269
270 STORE_WINDOW(sp)
271
272 restore %g0, %g0, %g0
273
274 jmpl %t_retpc + 0x8, %g0
275 mov %t_kstack, %sp
276
277 .globl tsetup_srmmu_stackchk 229 .globl tsetup_srmmu_stackchk
278tsetup_srmmu_stackchk: 230tsetup_srmmu_stackchk:
279 /* Check results of callers andcc %sp, 0x7, %g0 */ 231 /* Check results of callers andcc %sp, 0x7, %g0 */
diff --git a/arch/sparc/kernel/head_32.S b/arch/sparc/kernel/head_32.S
index 587785759838..a0f5c20e4b9c 100644
--- a/arch/sparc/kernel/head_32.S
+++ b/arch/sparc/kernel/head_32.S
@@ -26,11 +26,9 @@
26#include <asm/pgtsrmmu.h> /* SRMMU_PGDIR_SHIFT */ 26#include <asm/pgtsrmmu.h> /* SRMMU_PGDIR_SHIFT */
27 27
28 .data 28 .data
29/* 29/* The following are used with the prom_vector node-ops to figure out
30 * The following are used with the prom_vector node-ops to figure out 30 * the cpu-type
31 * the cpu-type
32 */ 31 */
33
34 .align 4 32 .align 4
35cputyp: 33cputyp:
36 .word 1 34 .word 1
@@ -38,384 +36,35 @@ cputyp:
38 .align 4 36 .align 4
39 .globl cputypval 37 .globl cputypval
40cputypval: 38cputypval:
41 .asciz "sun4c" 39 .asciz "sun4m"
42 .ascii " " 40 .ascii " "
43 41
44cputypvalend: 42/* Tested on SS-5, SS-10 */
45cputypvallen = cputypvar - cputypval
46
47 .align 4 43 .align 4
48/*
49 * Sun people can't spell worth damn. "compatability" indeed.
50 * At least we *know* we can't spell, and use a spell-checker.
51 */
52
53/* Uh, actually Linus it is I who cannot spell. Too much murky
54 * Sparc assembly will do this to ya.
55 */
56cputypvar: 44cputypvar:
57 .asciz "compatability"
58
59/* Tested on SS-5, SS-10. Probably someone at Sun applied a spell-checker. */
60 .align 4
61cputypvar_sun4m:
62 .asciz "compatible" 45 .asciz "compatible"
63 46
64 .align 4 47 .align 4
65 48
66sun4_notsup: 49sun4c_notsup:
67 .asciz "Sparc-Linux sun4 support does no longer exist.\n\n" 50 .asciz "Sparc-Linux sun4/sun4c support does no longer exist.\n\n"
68 .align 4 51 .align 4
69 52
70sun4e_notsup: 53sun4e_notsup:
71 .asciz "Sparc-Linux sun4e support does not exist\n\n" 54 .asciz "Sparc-Linux sun4e support does not exist\n\n"
72 .align 4 55 .align 4
73 56
74 /* The Sparc trap table, bootloader gives us control at _start. */ 57/* The trap-table - located in the __HEAD section */
75 __HEAD 58#include "ttable_32.S"
76 .globl _stext, _start, __stext
77 .globl trapbase
78_start: /* danger danger */
79__stext:
80_stext:
81trapbase:
82#ifdef CONFIG_SMP
83trapbase_cpu0:
84#endif
85/* We get control passed to us here at t_zero. */
86t_zero: b gokernel; nop; nop; nop;
87t_tflt: SPARC_TFAULT /* Inst. Access Exception */
88t_bins: TRAP_ENTRY(0x2, bad_instruction) /* Illegal Instruction */
89t_pins: TRAP_ENTRY(0x3, priv_instruction) /* Privileged Instruction */
90t_fpd: TRAP_ENTRY(0x4, fpd_trap_handler) /* Floating Point Disabled */
91t_wovf: WINDOW_SPILL /* Window Overflow */
92t_wunf: WINDOW_FILL /* Window Underflow */
93t_mna: TRAP_ENTRY(0x7, mna_handler) /* Memory Address Not Aligned */
94t_fpe: TRAP_ENTRY(0x8, fpe_trap_handler) /* Floating Point Exception */
95t_dflt: SPARC_DFAULT /* Data Miss Exception */
96t_tio: TRAP_ENTRY(0xa, do_tag_overflow) /* Tagged Instruction Ovrflw */
97t_wpt: TRAP_ENTRY(0xb, do_watchpoint) /* Watchpoint Detected */
98t_badc: BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
99t_irq1: TRAP_ENTRY_INTERRUPT(1) /* IRQ Software/SBUS Level 1 */
100t_irq2: TRAP_ENTRY_INTERRUPT(2) /* IRQ SBUS Level 2 */
101t_irq3: TRAP_ENTRY_INTERRUPT(3) /* IRQ SCSI/DMA/SBUS Level 3 */
102t_irq4: TRAP_ENTRY_INTERRUPT(4) /* IRQ Software Level 4 */
103t_irq5: TRAP_ENTRY_INTERRUPT(5) /* IRQ SBUS/Ethernet Level 5 */
104t_irq6: TRAP_ENTRY_INTERRUPT(6) /* IRQ Software Level 6 */
105t_irq7: TRAP_ENTRY_INTERRUPT(7) /* IRQ Video/SBUS Level 5 */
106t_irq8: TRAP_ENTRY_INTERRUPT(8) /* IRQ SBUS Level 6 */
107t_irq9: TRAP_ENTRY_INTERRUPT(9) /* IRQ SBUS Level 7 */
108t_irq10:TRAP_ENTRY_INTERRUPT(10) /* IRQ Timer #1 (one we use) */
109t_irq11:TRAP_ENTRY_INTERRUPT(11) /* IRQ Floppy Intr. */
110t_irq12:TRAP_ENTRY_INTERRUPT(12) /* IRQ Zilog serial chip */
111t_irq13:TRAP_ENTRY_INTERRUPT(13) /* IRQ Audio Intr. */
112t_irq14:TRAP_ENTRY_INTERRUPT(14) /* IRQ Timer #2 */
113 .globl t_nmi
114#ifndef CONFIG_SMP
115t_nmi: NMI_TRAP /* Level 15 (NMI) */
116#else
117t_nmi: TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
118#endif
119t_racc: TRAP_ENTRY(0x20, do_reg_access) /* General Register Access Error */
120t_iacce:BAD_TRAP(0x21) /* Instr Access Error */
121t_bad22:BAD_TRAP(0x22) BAD_TRAP(0x23)
122t_cpdis:TRAP_ENTRY(0x24, do_cp_disabled) /* Co-Processor Disabled */
123t_uflsh:SKIP_TRAP(0x25, unimp_flush) /* Unimplemented FLUSH inst. */
124t_bad26:BAD_TRAP(0x26) BAD_TRAP(0x27)
125t_cpexc:TRAP_ENTRY(0x28, do_cp_exception) /* Co-Processor Exception */
126t_dacce:SPARC_DFAULT /* Data Access Error */
127t_hwdz: TRAP_ENTRY(0x2a, do_hw_divzero) /* Division by zero, you lose... */
128t_dserr:BAD_TRAP(0x2b) /* Data Store Error */
129t_daccm:BAD_TRAP(0x2c) /* Data Access MMU-Miss */
130t_bad2d:BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
131t_bad32:BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
132t_bad37:BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
133t_iaccm:BAD_TRAP(0x3c) /* Instr Access MMU-Miss */
134t_bad3d:BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40) BAD_TRAP(0x41)
135t_bad42:BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45) BAD_TRAP(0x46)
136t_bad47:BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a) BAD_TRAP(0x4b)
137t_bad4c:BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f) BAD_TRAP(0x50)
138t_bad51:BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
139t_bad56:BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
140t_bad5b:BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
141t_bad60:BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
142t_bad65:BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
143t_bad6a:BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
144t_bad6f:BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
145t_bad74:BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
146t_bad79:BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
147t_bad7e:BAD_TRAP(0x7e) BAD_TRAP(0x7f)
148t_bad80:BAD_TRAP(0x80) /* SunOS System Call */
149t_sbkpt:BREAKPOINT_TRAP /* Software Breakpoint/KGDB */
150t_divz: TRAP_ENTRY(0x82, do_hw_divzero) /* Divide by zero trap */
151t_flwin:TRAP_ENTRY(0x83, do_flush_windows) /* Flush Windows Trap */
152t_clwin:BAD_TRAP(0x84) /* Clean Windows Trap */
153t_rchk: BAD_TRAP(0x85) /* Range Check */
154t_funal:BAD_TRAP(0x86) /* Fix Unaligned Access Trap */
155t_iovf: BAD_TRAP(0x87) /* Integer Overflow Trap */
156t_bad88:BAD_TRAP(0x88) /* Slowaris System Call */
157t_bad89:BAD_TRAP(0x89) /* Net-B.S. System Call */
158t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d) BAD_TRAP(0x8e)
159t_bad8f:BAD_TRAP(0x8f)
160t_linux:LINUX_SYSCALL_TRAP /* Linux System Call */
161t_bad91:BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94) BAD_TRAP(0x95)
162t_bad96:BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a)
163t_bad9b:BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f)
164t_getcc:GETCC_TRAP /* Get Condition Codes */
165t_setcc:SETCC_TRAP /* Set Condition Codes */
166t_getpsr:GETPSR_TRAP /* Get PSR Register */
167t_bada3:BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
168t_bada7:BAD_TRAP(0xa7)
169t_bada8:BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
170t_badac:BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
171t_badb1:BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
172t_badb6:BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
173t_badbb:BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
174t_badc0:BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
175t_badc5:BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
176t_badca:BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
177t_badcf:BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
178t_badd4:BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
179t_badd9:BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
180t_badde:BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
181t_bade3:BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
182t_bade8:BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
183t_baded:BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
184t_badf2:BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
185t_badf7:BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
186t_badfc:BAD_TRAP(0xfc)
187t_kgdb: KGDB_TRAP(0xfd)
188dbtrap: BAD_TRAP(0xfe) /* Debugger/PROM breakpoint #1 */
189dbtrap2:BAD_TRAP(0xff) /* Debugger/PROM breakpoint #2 */
190
191 .globl end_traptable
192end_traptable:
193
194#ifdef CONFIG_SMP
195 /* Trap tables for the other cpus. */
196 .globl trapbase_cpu1, trapbase_cpu2, trapbase_cpu3
197trapbase_cpu1:
198 BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction)
199 TRAP_ENTRY(0x3, priv_instruction) TRAP_ENTRY(0x4, fpd_trap_handler)
200 WINDOW_SPILL WINDOW_FILL TRAP_ENTRY(0x7, mna_handler)
201 TRAP_ENTRY(0x8, fpe_trap_handler) SRMMU_DFAULT
202 TRAP_ENTRY(0xa, do_tag_overflow) TRAP_ENTRY(0xb, do_watchpoint)
203 BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
204 TRAP_ENTRY_INTERRUPT(1) TRAP_ENTRY_INTERRUPT(2)
205 TRAP_ENTRY_INTERRUPT(3) TRAP_ENTRY_INTERRUPT(4)
206 TRAP_ENTRY_INTERRUPT(5) TRAP_ENTRY_INTERRUPT(6)
207 TRAP_ENTRY_INTERRUPT(7) TRAP_ENTRY_INTERRUPT(8)
208 TRAP_ENTRY_INTERRUPT(9) TRAP_ENTRY_INTERRUPT(10)
209 TRAP_ENTRY_INTERRUPT(11) TRAP_ENTRY_INTERRUPT(12)
210 TRAP_ENTRY_INTERRUPT(13) TRAP_ENTRY_INTERRUPT(14)
211 TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
212 TRAP_ENTRY(0x20, do_reg_access) BAD_TRAP(0x21) BAD_TRAP(0x22)
213 BAD_TRAP(0x23) TRAP_ENTRY(0x24, do_cp_disabled) SKIP_TRAP(0x25, unimp_flush)
214 BAD_TRAP(0x26) BAD_TRAP(0x27) TRAP_ENTRY(0x28, do_cp_exception)
215 SRMMU_DFAULT TRAP_ENTRY(0x2a, do_hw_divzero) BAD_TRAP(0x2b) BAD_TRAP(0x2c)
216 BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
217 BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
218 BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
219 BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
220 BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
221 BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
222 BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
223 BAD_TRAP(0x50)
224 BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
225 BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
226 BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
227 BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
228 BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
229 BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
230 BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
231 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
232 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
233 BAD_TRAP(0x7e) BAD_TRAP(0x7f)
234 BAD_TRAP(0x80)
235 BREAKPOINT_TRAP
236 TRAP_ENTRY(0x82, do_hw_divzero)
237 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
238 BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88)
239 BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
240 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
241 LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
242 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
243 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
244 BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
245 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
246 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
247 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
248 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
249 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
250 BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
251 BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
252 BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
253 BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
254 BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
255 BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
256 BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
257 BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
258 BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
259 BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
260 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
261 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
262 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
263 BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
264
265trapbase_cpu2:
266 BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction)
267 TRAP_ENTRY(0x3, priv_instruction) TRAP_ENTRY(0x4, fpd_trap_handler)
268 WINDOW_SPILL WINDOW_FILL TRAP_ENTRY(0x7, mna_handler)
269 TRAP_ENTRY(0x8, fpe_trap_handler) SRMMU_DFAULT
270 TRAP_ENTRY(0xa, do_tag_overflow) TRAP_ENTRY(0xb, do_watchpoint)
271 BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
272 TRAP_ENTRY_INTERRUPT(1) TRAP_ENTRY_INTERRUPT(2)
273 TRAP_ENTRY_INTERRUPT(3) TRAP_ENTRY_INTERRUPT(4)
274 TRAP_ENTRY_INTERRUPT(5) TRAP_ENTRY_INTERRUPT(6)
275 TRAP_ENTRY_INTERRUPT(7) TRAP_ENTRY_INTERRUPT(8)
276 TRAP_ENTRY_INTERRUPT(9) TRAP_ENTRY_INTERRUPT(10)
277 TRAP_ENTRY_INTERRUPT(11) TRAP_ENTRY_INTERRUPT(12)
278 TRAP_ENTRY_INTERRUPT(13) TRAP_ENTRY_INTERRUPT(14)
279 TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
280 TRAP_ENTRY(0x20, do_reg_access) BAD_TRAP(0x21) BAD_TRAP(0x22)
281 BAD_TRAP(0x23) TRAP_ENTRY(0x24, do_cp_disabled) SKIP_TRAP(0x25, unimp_flush)
282 BAD_TRAP(0x26) BAD_TRAP(0x27) TRAP_ENTRY(0x28, do_cp_exception)
283 SRMMU_DFAULT TRAP_ENTRY(0x2a, do_hw_divzero) BAD_TRAP(0x2b) BAD_TRAP(0x2c)
284 BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
285 BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
286 BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
287 BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
288 BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
289 BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
290 BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
291 BAD_TRAP(0x50)
292 BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
293 BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
294 BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
295 BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
296 BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
297 BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
298 BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
299 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
300 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
301 BAD_TRAP(0x7e) BAD_TRAP(0x7f)
302 BAD_TRAP(0x80)
303 BREAKPOINT_TRAP
304 TRAP_ENTRY(0x82, do_hw_divzero)
305 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
306 BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88)
307 BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
308 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
309 LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
310 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
311 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
312 BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
313 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
314 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
315 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
316 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
317 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
318 BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
319 BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
320 BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
321 BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
322 BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
323 BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
324 BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
325 BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
326 BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
327 BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
328 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
329 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
330 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
331 BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
332
333trapbase_cpu3:
334 BAD_TRAP(0x0) SRMMU_TFAULT TRAP_ENTRY(0x2, bad_instruction)
335 TRAP_ENTRY(0x3, priv_instruction) TRAP_ENTRY(0x4, fpd_trap_handler)
336 WINDOW_SPILL WINDOW_FILL TRAP_ENTRY(0x7, mna_handler)
337 TRAP_ENTRY(0x8, fpe_trap_handler) SRMMU_DFAULT
338 TRAP_ENTRY(0xa, do_tag_overflow) TRAP_ENTRY(0xb, do_watchpoint)
339 BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
340 TRAP_ENTRY_INTERRUPT(1) TRAP_ENTRY_INTERRUPT(2)
341 TRAP_ENTRY_INTERRUPT(3) TRAP_ENTRY_INTERRUPT(4)
342 TRAP_ENTRY_INTERRUPT(5) TRAP_ENTRY_INTERRUPT(6)
343 TRAP_ENTRY_INTERRUPT(7) TRAP_ENTRY_INTERRUPT(8)
344 TRAP_ENTRY_INTERRUPT(9) TRAP_ENTRY_INTERRUPT(10)
345 TRAP_ENTRY_INTERRUPT(11) TRAP_ENTRY_INTERRUPT(12)
346 TRAP_ENTRY_INTERRUPT(13) TRAP_ENTRY_INTERRUPT(14)
347 TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
348 TRAP_ENTRY(0x20, do_reg_access) BAD_TRAP(0x21) BAD_TRAP(0x22)
349 BAD_TRAP(0x23) TRAP_ENTRY(0x24, do_cp_disabled) SKIP_TRAP(0x25, unimp_flush)
350 BAD_TRAP(0x26) BAD_TRAP(0x27) TRAP_ENTRY(0x28, do_cp_exception)
351 SRMMU_DFAULT TRAP_ENTRY(0x2a, do_hw_divzero) BAD_TRAP(0x2b) BAD_TRAP(0x2c)
352 BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
353 BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
354 BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
355 BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
356 BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
357 BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
358 BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
359 BAD_TRAP(0x50)
360 BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
361 BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
362 BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
363 BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
364 BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
365 BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
366 BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
367 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
368 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
369 BAD_TRAP(0x7e) BAD_TRAP(0x7f)
370 BAD_TRAP(0x80)
371 BREAKPOINT_TRAP
372 TRAP_ENTRY(0x82, do_hw_divzero)
373 TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
374 BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88)
375 BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
376 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
377 LINUX_SYSCALL_TRAP BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
378 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
379 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
380 BAD_TRAP(0x9f) GETCC_TRAP SETCC_TRAP GETPSR_TRAP
381 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
382 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
383 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
384 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
385 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
386 BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
387 BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
388 BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
389 BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
390 BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
391 BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
392 BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
393 BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
394 BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
395 BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
396 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
397 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
398 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
399 BAD_TRAP(0xfc) KGDB_TRAP(0xfd) BAD_TRAP(0xfe) BAD_TRAP(0xff)
400 59
401#endif
402 .align PAGE_SIZE 60 .align PAGE_SIZE
403 61
404/* This was the only reasonable way I could think of to properly align 62/* This was the only reasonable way I could think of to properly align
405 * these page-table data structures. 63 * these page-table data structures.
406 */ 64 */
407 .globl pg0, pg1, pg2, pg3
408 .globl empty_bad_page
409 .globl empty_bad_page_table
410 .globl empty_zero_page
411 .globl swapper_pg_dir 65 .globl swapper_pg_dir
412swapper_pg_dir: .skip PAGE_SIZE 66swapper_pg_dir: .skip PAGE_SIZE
413pg0: .skip PAGE_SIZE 67 .globl empty_zero_page
414pg1: .skip PAGE_SIZE
415pg2: .skip PAGE_SIZE
416pg3: .skip PAGE_SIZE
417empty_bad_page: .skip PAGE_SIZE
418empty_bad_page_table: .skip PAGE_SIZE
419empty_zero_page: .skip PAGE_SIZE 68empty_zero_page: .skip PAGE_SIZE
420 69
421 .global root_flags 70 .global root_flags
@@ -523,10 +172,10 @@ copy_prom_lvl14:
523 ldd [%g2 + 0x8], %g4 172 ldd [%g2 + 0x8], %g4
524 std %g4, [%g3 + 0x8] ! Copy proms handler 173 std %g4, [%g3 + 0x8] ! Copy proms handler
525 174
526/* Must determine whether we are on a sun4c MMU, SRMMU, or SUN4/400 MUTANT 175/* DON'T TOUCH %l0 thru %l5 in these remapping routines,
527 * MMU so we can remap ourselves properly. DON'T TOUCH %l0 thru %l5 in these 176 * we need their values afterwards!
528 * remapping routines, we need their values afterwards!
529 */ 177 */
178
530 /* Now check whether we are already mapped, if we 179 /* Now check whether we are already mapped, if we
531 * are we can skip all this garbage coming up. 180 * are we can skip all this garbage coming up.
532 */ 181 */
@@ -535,26 +184,29 @@ copy_prom_done:
535 be go_to_highmem ! this will be a nop then 184 be go_to_highmem ! this will be a nop then
536 nop 185 nop
537 186
538 set LOAD_ADDR, %g6 187 /* Validate that we are in fact running on an
188 * SRMMU based cpu.
189 */
190 set 0x4000, %g6
539 cmp %g7, %g6 191 cmp %g7, %g6
540 bne remap_not_a_sun4 ! This is not a Sun4 192 bne not_a_sun4
541 nop 193 nop
542 194
543 or %g0, 0x1, %g1 195halt_sun4_or_sun4c:
544 lduba [%g1] ASI_CONTROL, %g1 ! Only safe to try on Sun4. 196 ld [%g7 + 0x68], %o1
545 subcc %g1, 0x24, %g0 ! Is this a mutant Sun4/400??? 197 set sun4c_notsup, %o0
546 be sun4_mutant_remap ! Ugh, it is... 198 sub %o0, %l6, %o0
199 call %o1
547 nop 200 nop
548 201 ba halt_me
549 b sun4_normal_remap ! regular sun4, 2 level mmu
550 nop 202 nop
551 203
552remap_not_a_sun4: 204not_a_sun4:
553 lda [%g0] ASI_M_MMUREGS, %g1 ! same as ASI_PTE on sun4c 205 lda [%g0] ASI_M_MMUREGS, %g1
554 and %g1, 0x1, %g1 ! Test SRMMU Enable bit ;-) 206 andcc %g1, 1, %g0
555 cmp %g1, 0x0 207 be halt_sun4_or_sun4c
556 be sun4c_remap ! A sun4c MMU or normal Sun4
557 nop 208 nop
209
558srmmu_remap: 210srmmu_remap:
559 /* First, check for a viking (TI) module. */ 211 /* First, check for a viking (TI) module. */
560 set 0x40000000, %g2 212 set 0x40000000, %g2
@@ -660,72 +312,6 @@ srmmu_nviking:
660 b go_to_highmem 312 b go_to_highmem
661 nop ! wheee.... 313 nop ! wheee....
662 314
663 /* This remaps the kernel on Sun4/4xx machines
664 * that have the Sun Mutant Three Level MMU.
665 * It's like a platypus, Sun didn't have the
666 * SRMMU in conception so they kludged the three
667 * level logic in the regular Sun4 MMU probably.
668 *
669 * Basically, you take each entry in the top level
670 * directory that maps the low 3MB starting at
671 * address zero and put the mapping in the KERNBASE
672 * slots. These top level pgd's are called regmaps.
673 */
674sun4_mutant_remap:
675 or %g0, %g0, %g3 ! source base
676 sethi %hi(KERNBASE), %g4 ! destination base
677 or %g4, %lo(KERNBASE), %g4
678 sethi %hi(0x300000), %g5
679 or %g5, %lo(0x300000), %g5 ! upper bound 3MB
680 or %g0, 0x1, %l6
681 sll %l6, 24, %l6 ! Regmap mapping size
682 add %g3, 0x2, %g3 ! Base magic
683 add %g4, 0x2, %g4 ! Base magic
684
685 /* Main remapping loop on Sun4-Mutant-MMU.
686 * "I am not an animal..." -Famous Mutant Person
687 */
688sun4_mutant_loop:
689 lduha [%g3] ASI_REGMAP, %g2 ! Get lower entry
690 stha %g2, [%g4] ASI_REGMAP ! Store in high entry
691 add %g4, %l6, %g4 ! Move up high memory ptr
692 subcc %g3, %g5, %g0 ! Reached our limit?
693 blu sun4_mutant_loop ! Nope, loop again
694 add %g3, %l6, %g3 ! delay, Move up low ptr
695 b go_to_highmem ! Jump to high memory.
696 nop
697
698 /* The following is for non-4/4xx sun4 MMU's. */
699sun4_normal_remap:
700 mov 0, %g3 ! source base
701 set KERNBASE, %g4 ! destination base
702 set 0x300000, %g5 ! upper bound 3MB
703 mov 1, %l6
704 sll %l6, 18, %l6 ! sun4 mmu segmap size
705sun4_normal_loop:
706 lduha [%g3] ASI_SEGMAP, %g6 ! load phys_seg
707 stha %g6, [%g4] ASI_SEGMAP ! stort new virt mapping
708 add %g3, %l6, %g3 ! increment source pointer
709 subcc %g3, %g5, %g0 ! reached limit?
710 blu sun4_normal_loop ! nope, loop again
711 add %g4, %l6, %g4 ! delay, increment dest ptr
712 b go_to_highmem
713 nop
714
715 /* The following works for Sun4c MMU's */
716sun4c_remap:
717 mov 0, %g3 ! source base
718 set KERNBASE, %g4 ! destination base
719 set 0x300000, %g5 ! upper bound 3MB
720 mov 1, %l6
721 sll %l6, 18, %l6 ! sun4c mmu segmap size
722sun4c_remap_loop:
723 lda [%g3] ASI_SEGMAP, %g6 ! load phys_seg
724 sta %g6, [%g4] ASI_SEGMAP ! store new virt mapping
725 add %g3, %l6, %g3 ! Increment source ptr
726 subcc %g3, %g5, %g0 ! Reached limit?
727 bl sun4c_remap_loop ! Nope, loop again
728 add %g4, %l6, %g4 ! delay, Increment dest ptr
729 315
730/* Now do a non-relative jump so that PC is in high-memory */ 316/* Now do a non-relative jump so that PC is in high-memory */
731go_to_highmem: 317go_to_highmem:
@@ -750,35 +336,12 @@ execute_in_high_mem:
750 sethi %hi(linux_dbvec), %g1 336 sethi %hi(linux_dbvec), %g1
751 st %o1, [%g1 + %lo(linux_dbvec)] 337 st %o1, [%g1 + %lo(linux_dbvec)]
752 338
753 ld [%o0 + 0x4], %o3
754 and %o3, 0x3, %o5 ! get the version
755
756 cmp %o3, 0x2 ! a v2 prom?
757 be found_version
758 nop
759
760 /* paul@sfe.com.au */
761 cmp %o3, 0x3 ! a v3 prom?
762 be found_version
763 nop
764
765/* Old sun4's pass our load address into %o0 instead of the prom
766 * pointer. On sun4's you have to hard code the romvec pointer into
767 * your code. Sun probably still does that because they don't even
768 * trust their own "OpenBoot" specifications.
769 */
770 set LOAD_ADDR, %g6
771 cmp %o0, %g6 ! an old sun4?
772 be sun4_init
773 nop
774
775found_version:
776/* Get the machine type via the mysterious romvec node operations. */ 339/* Get the machine type via the mysterious romvec node operations. */
777 340
778 add %g7, 0x1c, %l1 341 add %g7, 0x1c, %l1
779 ld [%l1], %l0 342 ld [%l1], %l0
780 ld [%l0], %l0 343 ld [%l0], %l0
781 call %l0 344 call %l0
782 or %g0, %g0, %o0 ! next_node(0) = first_node 345 or %g0, %g0, %o0 ! next_node(0) = first_node
783 or %o0, %g0, %g6 346 or %o0, %g0, %g6
784 347
@@ -786,28 +349,13 @@ found_version:
786 or %o1, %lo(cputypvar), %o1 349 or %o1, %lo(cputypvar), %o1
787 sethi %hi(cputypval), %o2 ! information, the string 350 sethi %hi(cputypval), %o2 ! information, the string
788 or %o2, %lo(cputypval), %o2 351 or %o2, %lo(cputypval), %o2
789 ld [%l1], %l0 ! 'compatibility' tells 352 ld [%l1], %l0 ! 'compatible' tells
790 ld [%l0 + 0xc], %l0 ! that we want 'sun4x' where 353 ld [%l0 + 0xc], %l0 ! that we want 'sun4x' where
791 call %l0 ! x is one of '', 'c', 'm', 354 call %l0 ! x is one of 'm', 'd' or 'e'.
792 nop ! 'd' or 'e'. %o2 holds pointer 355 nop ! %o2 holds pointer
793 ! to a buf where above string 356 ! to a buf where above string
794 ! will get stored by the prom. 357 ! will get stored by the prom.
795 358
796 subcc %o0, %g0, %g0
797 bpos got_prop ! Got the property
798 nop
799
800 or %g6, %g0, %o0
801 sethi %hi(cputypvar_sun4m), %o1
802 or %o1, %lo(cputypvar_sun4m), %o1
803 sethi %hi(cputypval), %o2
804 or %o2, %lo(cputypval), %o2
805 ld [%l1], %l0
806 ld [%l0 + 0xc], %l0
807 call %l0
808 nop
809
810got_prop:
811#ifdef CONFIG_SPARC_LEON 359#ifdef CONFIG_SPARC_LEON
812 /* no cpu-type check is needed, it is a SPARC-LEON */ 360 /* no cpu-type check is needed, it is a SPARC-LEON */
813 361
@@ -826,45 +374,29 @@ got_prop:
826 /* Update boot_cpu_id only on boot cpu */ 374 /* Update boot_cpu_id only on boot cpu */
827 stub %g1, [%g2 + %lo(boot_cpu_id)] 375 stub %g1, [%g2 + %lo(boot_cpu_id)]
828 376
829 ba sun4c_continue_boot 377 ba continue_boot
830 nop 378 nop
831#endif 379#endif
380
381/* Check to cputype. We may be booted on a sun4u (64 bit box),
382 * and sun4d needs special treatment.
383 */
384
832 set cputypval, %o2 385 set cputypval, %o2
833 ldub [%o2 + 0x4], %l1 386 ldub [%o2 + 0x4], %l1
834 387
835 cmp %l1, ' ' 388 cmp %l1, 'm'
836 be 1f 389 be sun4m_init
837 cmp %l1, 'c'
838 be 1f
839 cmp %l1, 'm'
840 be 1f
841 cmp %l1, 's' 390 cmp %l1, 's'
842 be 1f 391 be sun4m_init
843 cmp %l1, 'd' 392 cmp %l1, 'd'
844 be 1f 393 be sun4d_init
845 cmp %l1, 'e' 394 cmp %l1, 'e'
846 be no_sun4e_here ! Could be a sun4e. 395 be no_sun4e_here ! Could be a sun4e.
847 nop 396 nop
848 b no_sun4u_here ! AIEEE, a V9 sun4u... Get our BIG BROTHER kernel :)) 397 b no_sun4u_here ! AIEEE, a V9 sun4u... Get our BIG BROTHER kernel :))
849 nop 398 nop
850 399
8511: set cputypval, %l1
852 ldub [%l1 + 0x4], %l1
853 cmp %l1, 'm' ! Test for sun4d, sun4e ?
854 be sun4m_init
855 cmp %l1, 's' ! Treat sun4s as sun4m
856 be sun4m_init
857 cmp %l1, 'd' ! Let us see how the beast will die
858 be sun4d_init
859 nop
860
861 /* Jump into mmu context zero. */
862 set AC_CONTEXT, %g1
863 stba %g0, [%g1] ASI_CONTROL
864
865 b sun4c_continue_boot
866 nop
867
868/* CPUID in bootbus can be found at PA 0xff0140000 */ 400/* CPUID in bootbus can be found at PA 0xff0140000 */
869#define SUN4D_BOOTBUS_CPUID 0xf0140000 401#define SUN4D_BOOTBUS_CPUID 0xf0140000
870 402
@@ -892,66 +424,6 @@ sun4d_init:
892 /* Fall through to sun4m_init */ 424 /* Fall through to sun4m_init */
893 425
894sun4m_init: 426sun4m_init:
895 /* XXX Fucking Cypress... */
896 lda [%g0] ASI_M_MMUREGS, %g5
897 srl %g5, 28, %g4
898
899 cmp %g4, 1
900 bne 1f
901 srl %g5, 24, %g4
902
903 and %g4, 0xf, %g4
904 cmp %g4, 7 /* This would be a HyperSparc. */
905
906 bne 2f
907 nop
908
9091:
910
911#define PATCH_IT(dst, src) \
912 set (dst), %g5; \
913 set (src), %g4; \
914 ld [%g4], %g3; \
915 st %g3, [%g5]; \
916 ld [%g4+0x4], %g3; \
917 st %g3, [%g5+0x4];
918
919 /* Signed multiply. */
920 PATCH_IT(.mul, .mul_patch)
921 PATCH_IT(.mul+0x08, .mul_patch+0x08)
922
923 /* Signed remainder. */
924 PATCH_IT(.rem, .rem_patch)
925 PATCH_IT(.rem+0x08, .rem_patch+0x08)
926 PATCH_IT(.rem+0x10, .rem_patch+0x10)
927 PATCH_IT(.rem+0x18, .rem_patch+0x18)
928 PATCH_IT(.rem+0x20, .rem_patch+0x20)
929 PATCH_IT(.rem+0x28, .rem_patch+0x28)
930
931 /* Signed division. */
932 PATCH_IT(.div, .div_patch)
933 PATCH_IT(.div+0x08, .div_patch+0x08)
934 PATCH_IT(.div+0x10, .div_patch+0x10)
935 PATCH_IT(.div+0x18, .div_patch+0x18)
936 PATCH_IT(.div+0x20, .div_patch+0x20)
937
938 /* Unsigned multiply. */
939 PATCH_IT(.umul, .umul_patch)
940 PATCH_IT(.umul+0x08, .umul_patch+0x08)
941
942 /* Unsigned remainder. */
943 PATCH_IT(.urem, .urem_patch)
944 PATCH_IT(.urem+0x08, .urem_patch+0x08)
945 PATCH_IT(.urem+0x10, .urem_patch+0x10)
946 PATCH_IT(.urem+0x18, .urem_patch+0x18)
947
948 /* Unsigned division. */
949 PATCH_IT(.udiv, .udiv_patch)
950 PATCH_IT(.udiv+0x08, .udiv_patch+0x08)
951 PATCH_IT(.udiv+0x10, .udiv_patch+0x10)
952
953#undef PATCH_IT
954
955/* Ok, the PROM could have done funny things and apple cider could still 427/* Ok, the PROM could have done funny things and apple cider could still
956 * be sitting in the fault status/address registers. Read them all to 428 * be sitting in the fault status/address registers. Read them all to
957 * clear them so we don't get magic faults later on. 429 * clear them so we don't get magic faults later on.
@@ -962,7 +434,7 @@ sun4m_init:
962 srl %o1, 28, %o1 ! Get a type of the CPU 434 srl %o1, 28, %o1 ! Get a type of the CPU
963 435
964 subcc %o1, 4, %g0 ! TI: Viking or MicroSPARC 436 subcc %o1, 4, %g0 ! TI: Viking or MicroSPARC
965 be sun4c_continue_boot 437 be continue_boot
966 nop 438 nop
967 439
968 set AC_M_SFSR, %o0 440 set AC_M_SFSR, %o0
@@ -972,7 +444,7 @@ sun4m_init:
972 444
973 /* Fujitsu MicroSPARC-II has no asynchronous flavors of FARs */ 445 /* Fujitsu MicroSPARC-II has no asynchronous flavors of FARs */
974 subcc %o1, 0, %g0 446 subcc %o1, 0, %g0
975 be sun4c_continue_boot 447 be continue_boot
976 nop 448 nop
977 449
978 set AC_M_AFSR, %o0 450 set AC_M_AFSR, %o0
@@ -982,8 +454,7 @@ sun4m_init:
982 nop 454 nop
983 455
984 456
985sun4c_continue_boot: 457continue_boot:
986
987 458
988/* Aieee, now set PC and nPC, enable traps, give ourselves a stack and it's 459/* Aieee, now set PC and nPC, enable traps, give ourselves a stack and it's
989 * show-time! 460 * show-time!
@@ -1026,10 +497,7 @@ sun4c_continue_boot:
1026 mov %g0, %g3 497 mov %g0, %g3
1027 stub %g3, [%g2 + %lo(boot_cpu_id)] 498 stub %g3, [%g2 + %lo(boot_cpu_id)]
1028 499
10291: /* boot_cpu_id set. calculate boot_cpu_id4 = boot_cpu_id*4 */ 5001: sll %g3, 2, %g3
1030 sll %g3, 2, %g3
1031 sethi %hi(boot_cpu_id4), %g2
1032 stub %g3, [%g2 + %lo(boot_cpu_id4)]
1033 501
1034 /* Initialize the uwinmask value for init task just in case. 502 /* Initialize the uwinmask value for init task just in case.
1035 * But first make current_set[boot_cpu_id] point to something useful. 503 * But first make current_set[boot_cpu_id] point to something useful.
@@ -1165,19 +633,6 @@ sun4c_continue_boot:
1165 call halt_me 633 call halt_me
1166 nop 634 nop
1167 635
1168sun4_init:
1169 sethi %hi(SUN4_PROM_VECTOR+0x84), %o1
1170 ld [%o1 + %lo(SUN4_PROM_VECTOR+0x84)], %o1
1171 set sun4_notsup, %o0
1172 call %o1 /* printf */
1173 nop
1174 sethi %hi(SUN4_PROM_VECTOR+0xc4), %o1
1175 ld [%o1 + %lo(SUN4_PROM_VECTOR+0xc4)], %o1
1176 call %o1 /* exittomon */
1177 nop
11781: ba 1b ! Cannot exit into KMON
1179 nop
1180
1181no_sun4e_here: 636no_sun4e_here:
1182 ld [%g7 + 0x68], %o1 637 ld [%g7 + 0x68], %o1
1183 set sun4e_notsup, %o0 638 set sun4e_notsup, %o0
diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
index 0d810c2f1d00..b42ddbf9651e 100644
--- a/arch/sparc/kernel/head_64.S
+++ b/arch/sparc/kernel/head_64.S
@@ -906,7 +906,7 @@ swapper_4m_tsb:
906 * error and will instead write junk into the relocation and 906 * error and will instead write junk into the relocation and
907 * you'll have an unbootable kernel. 907 * you'll have an unbootable kernel.
908 */ 908 */
909#include "ttable.S" 909#include "ttable_64.S"
910 910
911! 0x0000000000428000 911! 0x0000000000428000
912 912
diff --git a/arch/sparc/kernel/idprom.c b/arch/sparc/kernel/idprom.c
index 9167db40720e..6bd75012109d 100644
--- a/arch/sparc/kernel/idprom.c
+++ b/arch/sparc/kernel/idprom.c
@@ -25,22 +25,9 @@ static struct idprom idprom_buffer;
25 * of the Sparc CPU and have a meaningful IDPROM machtype value that we 25 * of the Sparc CPU and have a meaningful IDPROM machtype value that we
26 * know about. See asm-sparc/machines.h for empirical constants. 26 * know about. See asm-sparc/machines.h for empirical constants.
27 */ 27 */
28static struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES] = { 28static struct Sun_Machine_Models Sun_Machines[] = {
29/* First, Sun4's */ 29/* First, Leon */
30{ .name = "Sun 4/100 Series", .id_machtype = (SM_SUN4 | SM_4_110) },
31{ .name = "Sun 4/200 Series", .id_machtype = (SM_SUN4 | SM_4_260) },
32{ .name = "Sun 4/300 Series", .id_machtype = (SM_SUN4 | SM_4_330) },
33{ .name = "Sun 4/400 Series", .id_machtype = (SM_SUN4 | SM_4_470) },
34/* Now Leon */
35{ .name = "Leon3 System-on-a-Chip", .id_machtype = (M_LEON | M_LEON3_SOC) }, 30{ .name = "Leon3 System-on-a-Chip", .id_machtype = (M_LEON | M_LEON3_SOC) },
36/* Now, Sun4c's */
37{ .name = "Sun4c SparcStation 1", .id_machtype = (SM_SUN4C | SM_4C_SS1) },
38{ .name = "Sun4c SparcStation IPC", .id_machtype = (SM_SUN4C | SM_4C_IPC) },
39{ .name = "Sun4c SparcStation 1+", .id_machtype = (SM_SUN4C | SM_4C_SS1PLUS) },
40{ .name = "Sun4c SparcStation SLC", .id_machtype = (SM_SUN4C | SM_4C_SLC) },
41{ .name = "Sun4c SparcStation 2", .id_machtype = (SM_SUN4C | SM_4C_SS2) },
42{ .name = "Sun4c SparcStation ELC", .id_machtype = (SM_SUN4C | SM_4C_ELC) },
43{ .name = "Sun4c SparcStation IPX", .id_machtype = (SM_SUN4C | SM_4C_IPX) },
44/* Finally, early Sun4m's */ 31/* Finally, early Sun4m's */
45{ .name = "Sun4m SparcSystem600", .id_machtype = (SM_SUN4M | SM_4M_SS60) }, 32{ .name = "Sun4m SparcSystem600", .id_machtype = (SM_SUN4M | SM_4M_SS60) },
46{ .name = "Sun4m SparcStation10/20", .id_machtype = (SM_SUN4M | SM_4M_SS50) }, 33{ .name = "Sun4m SparcStation10/20", .id_machtype = (SM_SUN4M | SM_4M_SS50) },
@@ -53,7 +40,7 @@ static void __init display_system_type(unsigned char machtype)
53 char sysname[128]; 40 char sysname[128];
54 register int i; 41 register int i;
55 42
56 for (i = 0; i < NUM_SUN_MACHINES; i++) { 43 for (i = 0; i < ARRAY_SIZE(Sun_Machines); i++) {
57 if (Sun_Machines[i].id_machtype == machtype) { 44 if (Sun_Machines[i].id_machtype == machtype) {
58 if (machtype != (SM_SUN4M_OBP | 0x00) || 45 if (machtype != (SM_SUN4M_OBP | 0x00) ||
59 prom_getproperty(prom_root_node, "banner-name", 46 prom_getproperty(prom_root_node, "banner-name",
diff --git a/arch/sparc/kernel/init_task.c b/arch/sparc/kernel/init_task.c
deleted file mode 100644
index 35f141a9f506..000000000000
--- a/arch/sparc/kernel/init_task.c
+++ /dev/null
@@ -1,22 +0,0 @@
1#include <linux/mm.h>
2#include <linux/fs.h>
3#include <linux/module.h>
4#include <linux/sched.h>
5#include <linux/init_task.h>
6#include <linux/mqueue.h>
7
8#include <asm/pgtable.h>
9#include <asm/uaccess.h>
10
11static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
12static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
13struct task_struct init_task = INIT_TASK(init_task);
14EXPORT_SYMBOL(init_task);
15
16/* .text section in head.S is aligned at 8k boundary and this gets linked
17 * right after that so that the init_thread_union is aligned properly as well.
18 * If this is not aligned on a 8k boundary, then you should change code
19 * in etrap.S which assumes it.
20 */
21union thread_union init_thread_union __init_task_data =
22 { INIT_THREAD_INFO(init_task) };
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 21bd73943f7f..a2846f5e32d8 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -50,6 +50,8 @@
50#include <asm/io-unit.h> 50#include <asm/io-unit.h>
51#include <asm/leon.h> 51#include <asm/leon.h>
52 52
53const struct sparc32_dma_ops *sparc32_dma_ops;
54
53/* This function must make sure that caches and memory are coherent after DMA 55/* This function must make sure that caches and memory are coherent after DMA
54 * On LEON systems without cache snooping it flushes the entire D-CACHE. 56 * On LEON systems without cache snooping it flushes the entire D-CACHE.
55 */ 57 */
@@ -229,7 +231,7 @@ _sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz)
229 } 231 }
230 232
231 pa &= PAGE_MASK; 233 pa &= PAGE_MASK;
232 sparc_mapiorange(bus, pa, res->start, resource_size(res)); 234 srmmu_mapiorange(bus, pa, res->start, resource_size(res));
233 235
234 return (void __iomem *)(unsigned long)(res->start + offset); 236 return (void __iomem *)(unsigned long)(res->start + offset);
235} 237}
@@ -243,7 +245,7 @@ static void _sparc_free_io(struct resource *res)
243 245
244 plen = resource_size(res); 246 plen = resource_size(res);
245 BUG_ON((plen & (PAGE_SIZE-1)) != 0); 247 BUG_ON((plen & (PAGE_SIZE-1)) != 0);
246 sparc_unmapiorange(res->start, plen); 248 srmmu_unmapiorange(res->start, plen);
247 release_resource(res); 249 release_resource(res);
248} 250}
249 251
@@ -292,13 +294,13 @@ static void *sbus_alloc_coherent(struct device *dev, size_t len,
292 goto err_nova; 294 goto err_nova;
293 } 295 }
294 296
295 // XXX The mmu_map_dma_area does this for us below, see comments. 297 // XXX The sbus_map_dma_area does this for us below, see comments.
296 // sparc_mapiorange(0, virt_to_phys(va), res->start, len_total); 298 // srmmu_mapiorange(0, virt_to_phys(va), res->start, len_total);
297 /* 299 /*
298 * XXX That's where sdev would be used. Currently we load 300 * XXX That's where sdev would be used. Currently we load
299 * all iommu tables with the same translations. 301 * all iommu tables with the same translations.
300 */ 302 */
301 if (mmu_map_dma_area(dev, dma_addrp, va, res->start, len_total) != 0) 303 if (sbus_map_dma_area(dev, dma_addrp, va, res->start, len_total) != 0)
302 goto err_noiommu; 304 goto err_noiommu;
303 305
304 res->name = op->dev.of_node->name; 306 res->name = op->dev.of_node->name;
@@ -343,7 +345,7 @@ static void sbus_free_coherent(struct device *dev, size_t n, void *p,
343 kfree(res); 345 kfree(res);
344 346
345 pgv = virt_to_page(p); 347 pgv = virt_to_page(p);
346 mmu_unmap_dma_area(dev, ba, n); 348 sbus_unmap_dma_area(dev, ba, n);
347 349
348 __free_pages(pgv, get_order(n)); 350 __free_pages(pgv, get_order(n));
349} 351}
@@ -381,11 +383,6 @@ static int sbus_map_sg(struct device *dev, struct scatterlist *sg, int n,
381 enum dma_data_direction dir, struct dma_attrs *attrs) 383 enum dma_data_direction dir, struct dma_attrs *attrs)
382{ 384{
383 mmu_get_scsi_sgl(dev, sg, n); 385 mmu_get_scsi_sgl(dev, sg, n);
384
385 /*
386 * XXX sparc64 can return a partial length here. sun4c should do this
387 * but it currently panics if it can't fulfill the request - Anton
388 */
389 return n; 386 return n;
390} 387}
391 388
@@ -469,7 +466,7 @@ static void *pci32_alloc_coherent(struct device *dev, size_t len,
469 printk("pci_alloc_consistent: cannot occupy 0x%lx", len_total); 466 printk("pci_alloc_consistent: cannot occupy 0x%lx", len_total);
470 goto err_nova; 467 goto err_nova;
471 } 468 }
472 sparc_mapiorange(0, virt_to_phys(va), res->start, len_total); 469 srmmu_mapiorange(0, virt_to_phys(va), res->start, len_total);
473 470
474 *pba = virt_to_phys(va); /* equals virt_to_bus (R.I.P.) for us. */ 471 *pba = virt_to_phys(va); /* equals virt_to_bus (R.I.P.) for us. */
475 return (void *) res->start; 472 return (void *) res->start;
@@ -514,7 +511,7 @@ static void pci32_free_coherent(struct device *dev, size_t n, void *p,
514 } 511 }
515 512
516 dma_make_coherent(ba, n); 513 dma_make_coherent(ba, n);
517 sparc_unmapiorange((unsigned long)p, n); 514 srmmu_unmapiorange((unsigned long)p, n);
518 515
519 release_resource(res); 516 release_resource(res);
520 kfree(res); 517 kfree(res);
diff --git a/arch/sparc/kernel/irq.h b/arch/sparc/kernel/irq.h
index 5a021dd2f854..b66b6aad1d6d 100644
--- a/arch/sparc/kernel/irq.h
+++ b/arch/sparc/kernel/irq.h
@@ -1,6 +1,5 @@
1#include <linux/platform_device.h> 1#include <linux/platform_device.h>
2 2
3#include <asm/btfixup.h>
4#include <asm/cpu_type.h> 3#include <asm/cpu_type.h>
5 4
6struct irq_bucket { 5struct irq_bucket {
@@ -10,6 +9,9 @@ struct irq_bucket {
10 unsigned int pil; 9 unsigned int pil;
11}; 10};
12 11
12#define SUN4M_HARD_INT(x) (0x000000001 << (x))
13#define SUN4M_SOFT_INT(x) (0x000010000 << (x))
14
13#define SUN4D_MAX_BOARD 10 15#define SUN4D_MAX_BOARD 10
14#define SUN4D_MAX_IRQ ((SUN4D_MAX_BOARD + 2) << 5) 16#define SUN4D_MAX_IRQ ((SUN4D_MAX_BOARD + 2) << 5)
15 17
@@ -41,52 +43,46 @@ struct sun4m_irq_global {
41extern struct sun4m_irq_percpu __iomem *sun4m_irq_percpu[SUN4M_NCPUS]; 43extern struct sun4m_irq_percpu __iomem *sun4m_irq_percpu[SUN4M_NCPUS];
42extern struct sun4m_irq_global __iomem *sun4m_irq_global; 44extern struct sun4m_irq_global __iomem *sun4m_irq_global;
43 45
46/* The following definitions describe the individual platform features: */
47#define FEAT_L10_CLOCKSOURCE (1 << 0) /* L10 timer is used as a clocksource */
48#define FEAT_L10_CLOCKEVENT (1 << 1) /* L10 timer is used as a clockevent */
49#define FEAT_L14_ONESHOT (1 << 2) /* L14 timer clockevent can oneshot */
50
44/* 51/*
45 * Platform specific irq configuration 52 * Platform specific configuration
46 * The individual platforms assign their platform 53 * The individual platforms assign their platform
47 * specifics in their init functions. 54 * specifics in their init functions.
48 */ 55 */
49struct sparc_irq_config { 56struct sparc_config {
50 void (*init_timers)(irq_handler_t); 57 void (*init_timers)(void);
51 unsigned int (*build_device_irq)(struct platform_device *op, 58 unsigned int (*build_device_irq)(struct platform_device *op,
52 unsigned int real_irq); 59 unsigned int real_irq);
60
61 /* generic clockevent features - see FEAT_* above */
62 int features;
63
64 /* clock rate used for clock event timer */
65 int clock_rate;
66
67 /* one period for clock source timer */
68 unsigned int cs_period;
69
70 /* function to obtain offsett for cs period */
71 unsigned int (*get_cycles_offset)(void);
72
73 void (*clear_clock_irq)(void);
74 void (*load_profile_irq)(int cpu, unsigned int limit);
53}; 75};
54extern struct sparc_irq_config sparc_irq_config; 76extern struct sparc_config sparc_config;
55 77
56unsigned int irq_alloc(unsigned int real_irq, unsigned int pil); 78unsigned int irq_alloc(unsigned int real_irq, unsigned int pil);
57void irq_link(unsigned int irq); 79void irq_link(unsigned int irq);
58void irq_unlink(unsigned int irq); 80void irq_unlink(unsigned int irq);
59void handler_irq(unsigned int pil, struct pt_regs *regs); 81void handler_irq(unsigned int pil, struct pt_regs *regs);
60 82
61/* Dave Redman (djhr@tadpole.co.uk) 83unsigned long leon_get_irqmask(unsigned int irq);
62 * changed these to function pointers.. it saves cycles and will allow
63 * the irq dependencies to be split into different files at a later date
64 * sun4c_irq.c, sun4m_irq.c etc so we could reduce the kernel size.
65 * Jakub Jelinek (jj@sunsite.mff.cuni.cz)
66 * Changed these to btfixup entities... It saves cycles :)
67 */
68
69BTFIXUPDEF_CALL(void, clear_clock_irq, void)
70BTFIXUPDEF_CALL(void, load_profile_irq, int, unsigned int)
71
72static inline void clear_clock_irq(void)
73{
74 BTFIXUP_CALL(clear_clock_irq)();
75}
76
77static inline void load_profile_irq(int cpu, int limit)
78{
79 BTFIXUP_CALL(load_profile_irq)(cpu, limit);
80}
81 84
82#ifdef CONFIG_SMP 85#ifdef CONFIG_SMP
83BTFIXUPDEF_CALL(void, set_cpu_int, int, int)
84BTFIXUPDEF_CALL(void, clear_cpu_int, int, int)
85BTFIXUPDEF_CALL(void, set_irq_udt, int)
86
87#define set_cpu_int(cpu,level) BTFIXUP_CALL(set_cpu_int)(cpu,level)
88#define clear_cpu_int(cpu,level) BTFIXUP_CALL(clear_cpu_int)(cpu,level)
89#define set_irq_udt(cpu) BTFIXUP_CALL(set_irq_udt)(cpu)
90 86
91/* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */ 87/* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */
92#define SUN4D_IPI_IRQ 13 88#define SUN4D_IPI_IRQ 13
diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c
index b2668afd1c34..ae04914f7774 100644
--- a/arch/sparc/kernel/irq_32.c
+++ b/arch/sparc/kernel/irq_32.c
@@ -23,16 +23,8 @@
23#include "kernel.h" 23#include "kernel.h"
24#include "irq.h" 24#include "irq.h"
25 25
26#ifdef CONFIG_SMP
27#define SMP_NOP2 "nop; nop;\n\t"
28#define SMP_NOP3 "nop; nop; nop;\n\t"
29#else
30#define SMP_NOP2
31#define SMP_NOP3
32#endif /* SMP */
33
34/* platform specific irq setup */ 26/* platform specific irq setup */
35struct sparc_irq_config sparc_irq_config; 27struct sparc_config sparc_config;
36 28
37unsigned long arch_local_irq_save(void) 29unsigned long arch_local_irq_save(void)
38{ 30{
@@ -41,7 +33,6 @@ unsigned long arch_local_irq_save(void)
41 33
42 __asm__ __volatile__( 34 __asm__ __volatile__(
43 "rd %%psr, %0\n\t" 35 "rd %%psr, %0\n\t"
44 SMP_NOP3 /* Sun4m + Cypress + SMP bug */
45 "or %0, %2, %1\n\t" 36 "or %0, %2, %1\n\t"
46 "wr %1, 0, %%psr\n\t" 37 "wr %1, 0, %%psr\n\t"
47 "nop; nop; nop\n" 38 "nop; nop; nop\n"
@@ -59,7 +50,6 @@ void arch_local_irq_enable(void)
59 50
60 __asm__ __volatile__( 51 __asm__ __volatile__(
61 "rd %%psr, %0\n\t" 52 "rd %%psr, %0\n\t"
62 SMP_NOP3 /* Sun4m + Cypress + SMP bug */
63 "andn %0, %1, %0\n\t" 53 "andn %0, %1, %0\n\t"
64 "wr %0, 0, %%psr\n\t" 54 "wr %0, 0, %%psr\n\t"
65 "nop; nop; nop\n" 55 "nop; nop; nop\n"
@@ -76,7 +66,6 @@ void arch_local_irq_restore(unsigned long old_psr)
76 __asm__ __volatile__( 66 __asm__ __volatile__(
77 "rd %%psr, %0\n\t" 67 "rd %%psr, %0\n\t"
78 "and %2, %1, %2\n\t" 68 "and %2, %1, %2\n\t"
79 SMP_NOP2 /* Sun4m + Cypress + SMP bug */
80 "andn %0, %1, %0\n\t" 69 "andn %0, %1, %0\n\t"
81 "wr %0, %2, %%psr\n\t" 70 "wr %0, %2, %%psr\n\t"
82 "nop; nop; nop\n" 71 "nop; nop; nop\n"
@@ -346,11 +335,6 @@ void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs)
346void __init init_IRQ(void) 335void __init init_IRQ(void)
347{ 336{
348 switch (sparc_cpu_model) { 337 switch (sparc_cpu_model) {
349 case sun4c:
350 case sun4:
351 sun4c_init_IRQ();
352 break;
353
354 case sun4m: 338 case sun4m:
355 pcic_probe(); 339 pcic_probe();
356 if (pcic_present()) 340 if (pcic_present())
@@ -371,6 +355,5 @@ void __init init_IRQ(void)
371 prom_printf("Cannot initialize IRQs on this Sun machine..."); 355 prom_printf("Cannot initialize IRQs on this Sun machine...");
372 break; 356 break;
373 } 357 }
374 btfixup();
375} 358}
376 359
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c
index dff2c3d7d370..9bcbbe2c4e7e 100644
--- a/arch/sparc/kernel/irq_64.c
+++ b/arch/sparc/kernel/irq_64.c
@@ -799,7 +799,7 @@ static void kill_prom_timer(void)
799 prom_limit0 = prom_timers->limit0; 799 prom_limit0 = prom_timers->limit0;
800 prom_limit1 = prom_timers->limit1; 800 prom_limit1 = prom_timers->limit1;
801 801
802 /* Just as in sun4c/sun4m PROM uses timer which ticks at IRQ 14. 802 /* Just as in sun4c PROM uses timer which ticks at IRQ 14.
803 * We turn both off here just to be paranoid. 803 * We turn both off here just to be paranoid.
804 */ 804 */
805 prom_timers->limit0 = 0; 805 prom_timers->limit0 = 0;
diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h
index fd6c36b1df74..a86372d34587 100644
--- a/arch/sparc/kernel/kernel.h
+++ b/arch/sparc/kernel/kernel.h
@@ -32,9 +32,6 @@ extern void cpu_probe(void);
32/* traps_32.c */ 32/* traps_32.c */
33extern void handle_hw_divzero(struct pt_regs *regs, unsigned long pc, 33extern void handle_hw_divzero(struct pt_regs *regs, unsigned long pc,
34 unsigned long npc, unsigned long psr); 34 unsigned long npc, unsigned long psr);
35/* muldiv.c */
36extern int do_user_muldiv (struct pt_regs *, unsigned long);
37
38/* irq_32.c */ 35/* irq_32.c */
39extern struct irqaction static_irqaction[]; 36extern struct irqaction static_irqaction[];
40extern int static_irq_count; 37extern int static_irq_count;
@@ -43,12 +40,7 @@ extern spinlock_t irq_action_lock;
43extern void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs); 40extern void unexpected_irq(int irq, void *dev_id, struct pt_regs * regs);
44extern void init_IRQ(void); 41extern void init_IRQ(void);
45 42
46/* sun4c_irq.c */
47extern void sun4c_init_IRQ(void);
48
49/* sun4m_irq.c */ 43/* sun4m_irq.c */
50extern unsigned int lvl14_resolution;
51
52extern void sun4m_init_IRQ(void); 44extern void sun4m_init_IRQ(void);
53extern void sun4m_unmask_profile_irq(void); 45extern void sun4m_unmask_profile_irq(void);
54extern void sun4m_clear_profile_irq(int cpu); 46extern void sun4m_clear_profile_irq(int cpu);
@@ -85,8 +77,6 @@ extern unsigned int patchme_maybe_smp_msg[];
85extern void floppy_hardint(void); 77extern void floppy_hardint(void);
86 78
87/* trampoline_32.S */ 79/* trampoline_32.S */
88extern int __smp4m_processor_id(void);
89extern int __smp4d_processor_id(void);
90extern unsigned long sun4m_cpu_startup; 80extern unsigned long sun4m_cpu_startup;
91extern unsigned long sun4d_cpu_startup; 81extern unsigned long sun4d_cpu_startup;
92 82
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c
index 35e43673c453..77c1b916e4dd 100644
--- a/arch/sparc/kernel/leon_kernel.c
+++ b/arch/sparc/kernel/leon_kernel.c
@@ -10,6 +10,8 @@
10#include <linux/of_platform.h> 10#include <linux/of_platform.h>
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/of_device.h> 12#include <linux/of_device.h>
13#include <linux/clocksource.h>
14#include <linux/clockchips.h>
13 15
14#include <asm/oplib.h> 16#include <asm/oplib.h>
15#include <asm/timer.h> 17#include <asm/timer.h>
@@ -84,7 +86,7 @@ void leon_eirq_setup(unsigned int eirq)
84 sparc_leon_eirq = eirq; 86 sparc_leon_eirq = eirq;
85} 87}
86 88
87static inline unsigned long get_irqmask(unsigned int irq) 89unsigned long leon_get_irqmask(unsigned int irq)
88{ 90{
89 unsigned long mask; 91 unsigned long mask;
90 92
@@ -210,7 +212,7 @@ unsigned int leon_build_device_irq(unsigned int real_irq,
210 unsigned long mask; 212 unsigned long mask;
211 213
212 irq = 0; 214 irq = 0;
213 mask = get_irqmask(real_irq); 215 mask = leon_get_irqmask(real_irq);
214 if (mask == 0) 216 if (mask == 0)
215 goto out; 217 goto out;
216 218
@@ -250,7 +252,38 @@ void leon_update_virq_handling(unsigned int virq,
250 irq_set_chip_data(virq, (void *)mask); 252 irq_set_chip_data(virq, (void *)mask);
251} 253}
252 254
253void __init leon_init_timers(irq_handler_t counter_fn) 255static u32 leon_cycles_offset(void)
256{
257 u32 rld, val, off;
258 rld = LEON3_BYPASS_LOAD_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx].rld);
259 val = LEON3_BYPASS_LOAD_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx].val);
260 off = rld - val;
261 return rld - val;
262}
263
264#ifdef CONFIG_SMP
265
266/* smp clockevent irq */
267irqreturn_t leon_percpu_timer_ce_interrupt(int irq, void *unused)
268{
269 struct clock_event_device *ce;
270 int cpu = smp_processor_id();
271
272 leon_clear_profile_irq(cpu);
273
274 ce = &per_cpu(sparc32_clockevent, cpu);
275
276 irq_enter();
277 if (ce->event_handler)
278 ce->event_handler(ce);
279 irq_exit();
280
281 return IRQ_HANDLED;
282}
283
284#endif /* CONFIG_SMP */
285
286void __init leon_init_timers(void)
254{ 287{
255 int irq, eirq; 288 int irq, eirq;
256 struct device_node *rootnp, *np, *nnp; 289 struct device_node *rootnp, *np, *nnp;
@@ -260,6 +293,14 @@ void __init leon_init_timers(irq_handler_t counter_fn)
260 int ampopts; 293 int ampopts;
261 int err; 294 int err;
262 295
296 sparc_config.get_cycles_offset = leon_cycles_offset;
297 sparc_config.cs_period = 1000000 / HZ;
298 sparc_config.features |= FEAT_L10_CLOCKSOURCE;
299
300#ifndef CONFIG_SMP
301 sparc_config.features |= FEAT_L10_CLOCKEVENT;
302#endif
303
263 leondebug_irq_disable = 0; 304 leondebug_irq_disable = 0;
264 leon_debug_irqout = 0; 305 leon_debug_irqout = 0;
265 master_l10_counter = (unsigned int *)&dummy_master_l10_counter; 306 master_l10_counter = (unsigned int *)&dummy_master_l10_counter;
@@ -369,7 +410,7 @@ void __init leon_init_timers(irq_handler_t counter_fn)
369 leon_eirq_setup(eirq); 410 leon_eirq_setup(eirq);
370 411
371 irq = _leon_build_device_irq(NULL, leon3_gptimer_irq+leon3_gptimer_idx); 412 irq = _leon_build_device_irq(NULL, leon3_gptimer_irq+leon3_gptimer_idx);
372 err = request_irq(irq, counter_fn, IRQF_TIMER, "timer", NULL); 413 err = request_irq(irq, timer_interrupt, IRQF_TIMER, "timer", NULL);
373 if (err) { 414 if (err) {
374 printk(KERN_ERR "unable to attach timer IRQ%d\n", irq); 415 printk(KERN_ERR "unable to attach timer IRQ%d\n", irq);
375 prom_halt(); 416 prom_halt();
@@ -386,7 +427,7 @@ void __init leon_init_timers(irq_handler_t counter_fn)
386 */ 427 */
387 local_irq_save(flags); 428 local_irq_save(flags);
388 patchme_maybe_smp_msg[0] = 0x01000000; /* NOP out the branch */ 429 patchme_maybe_smp_msg[0] = 0x01000000; /* NOP out the branch */
389 local_flush_cache_all(); 430 local_ops->cache_all();
390 local_irq_restore(flags); 431 local_irq_restore(flags);
391 } 432 }
392#endif 433#endif
@@ -401,7 +442,7 @@ void __init leon_init_timers(irq_handler_t counter_fn)
401 /* Install per-cpu IRQ handler for broadcasted ticker */ 442 /* Install per-cpu IRQ handler for broadcasted ticker */
402 irq = leon_build_device_irq(leon3_ticker_irq, handle_percpu_irq, 443 irq = leon_build_device_irq(leon3_ticker_irq, handle_percpu_irq,
403 "per-cpu", 0); 444 "per-cpu", 0);
404 err = request_irq(irq, leon_percpu_timer_interrupt, 445 err = request_irq(irq, leon_percpu_timer_ce_interrupt,
405 IRQF_PERCPU | IRQF_TIMER, "ticker", 446 IRQF_PERCPU | IRQF_TIMER, "ticker",
406 NULL); 447 NULL);
407 if (err) { 448 if (err) {
@@ -422,13 +463,12 @@ bad:
422 return; 463 return;
423} 464}
424 465
425void leon_clear_clock_irq(void) 466static void leon_clear_clock_irq(void)
426{ 467{
427} 468}
428 469
429void leon_load_profile_irq(int cpu, unsigned int limit) 470static void leon_load_profile_irq(int cpu, unsigned int limit)
430{ 471{
431 BUG();
432} 472}
433 473
434void __init leon_trans_init(struct device_node *dp) 474void __init leon_trans_init(struct device_node *dp)
@@ -457,25 +497,6 @@ void __init leon_node_init(struct device_node *dp, struct device_node ***nextp)
457} 497}
458 498
459#ifdef CONFIG_SMP 499#ifdef CONFIG_SMP
460
461void leon_set_cpu_int(int cpu, int level)
462{
463 unsigned long mask;
464 mask = get_irqmask(level);
465 LEON3_BYPASS_STORE_PA(&leon3_irqctrl_regs->force[cpu], mask);
466}
467
468static void leon_clear_ipi(int cpu, int level)
469{
470 unsigned long mask;
471 mask = get_irqmask(level);
472 LEON3_BYPASS_STORE_PA(&leon3_irqctrl_regs->force[cpu], mask<<16);
473}
474
475static void leon_set_udt(int cpu)
476{
477}
478
479void leon_clear_profile_irq(int cpu) 500void leon_clear_profile_irq(int cpu)
480{ 501{
481} 502}
@@ -483,7 +504,7 @@ void leon_clear_profile_irq(int cpu)
483void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu) 504void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu)
484{ 505{
485 unsigned long mask, flags, *addr; 506 unsigned long mask, flags, *addr;
486 mask = get_irqmask(irq_nr); 507 mask = leon_get_irqmask(irq_nr);
487 spin_lock_irqsave(&leon_irq_lock, flags); 508 spin_lock_irqsave(&leon_irq_lock, flags);
488 addr = (unsigned long *)LEON_IMASK(cpu); 509 addr = (unsigned long *)LEON_IMASK(cpu);
489 LEON3_BYPASS_STORE_PA(addr, (LEON3_BYPASS_LOAD_PA(addr) | mask)); 510 LEON3_BYPASS_STORE_PA(addr, (LEON3_BYPASS_LOAD_PA(addr) | mask));
@@ -494,20 +515,11 @@ void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu)
494 515
495void __init leon_init_IRQ(void) 516void __init leon_init_IRQ(void)
496{ 517{
497 sparc_irq_config.init_timers = leon_init_timers; 518 sparc_config.init_timers = leon_init_timers;
498 sparc_irq_config.build_device_irq = _leon_build_device_irq; 519 sparc_config.build_device_irq = _leon_build_device_irq;
499 520 sparc_config.clock_rate = 1000000;
500 BTFIXUPSET_CALL(clear_clock_irq, leon_clear_clock_irq, 521 sparc_config.clear_clock_irq = leon_clear_clock_irq;
501 BTFIXUPCALL_NORM); 522 sparc_config.load_profile_irq = leon_load_profile_irq;
502 BTFIXUPSET_CALL(load_profile_irq, leon_load_profile_irq,
503 BTFIXUPCALL_NOP);
504
505#ifdef CONFIG_SMP
506 BTFIXUPSET_CALL(set_cpu_int, leon_set_cpu_int, BTFIXUPCALL_NORM);
507 BTFIXUPSET_CALL(clear_cpu_int, leon_clear_ipi, BTFIXUPCALL_NORM);
508 BTFIXUPSET_CALL(set_irq_udt, leon_set_udt, BTFIXUPCALL_NORM);
509#endif
510
511} 523}
512 524
513void __init leon_init(void) 525void __init leon_init(void)
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index aba6b958b2a5..19f56058742b 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -45,7 +45,6 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info)
45 45
46void __devinit pcibios_fixup_bus(struct pci_bus *pbus) 46void __devinit pcibios_fixup_bus(struct pci_bus *pbus)
47{ 47{
48 struct leon_pci_info *info = pbus->sysdata;
49 struct pci_dev *dev; 48 struct pci_dev *dev;
50 int i, has_io, has_mem; 49 int i, has_io, has_mem;
51 u16 cmd; 50 u16 cmd;
@@ -111,18 +110,6 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
111 return pci_enable_resources(dev, mask); 110 return pci_enable_resources(dev, mask);
112} 111}
113 112
114struct device_node *pci_device_to_OF_node(struct pci_dev *pdev)
115{
116 /*
117 * Currently the OpenBoot nodes are not connected with the PCI device,
118 * this is because the LEON PROM does not create PCI nodes. Eventually
119 * this will change and the same approach as pcic.c can be used to
120 * match PROM nodes with pci devices.
121 */
122 return NULL;
123}
124EXPORT_SYMBOL(pci_device_to_OF_node);
125
126void __devinit pcibios_update_irq(struct pci_dev *dev, int irq) 113void __devinit pcibios_update_irq(struct pci_dev *dev, int irq)
127{ 114{
128#ifdef CONFIG_PCI_DEBUG 115#ifdef CONFIG_PCI_DEBUG
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index 1210fde18740..a469090faf9f 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -23,6 +23,8 @@
23#include <linux/pm.h> 23#include <linux/pm.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/gfp.h> 25#include <linux/gfp.h>
26#include <linux/cpu.h>
27#include <linux/clockchips.h>
26 28
27#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
28#include <asm/tlbflush.h> 30#include <asm/tlbflush.h>
@@ -42,6 +44,7 @@
42#include <asm/asi.h> 44#include <asm/asi.h>
43#include <asm/leon.h> 45#include <asm/leon.h>
44#include <asm/leon_amba.h> 46#include <asm/leon_amba.h>
47#include <asm/timer.h>
45 48
46#include "kernel.h" 49#include "kernel.h"
47 50
@@ -68,24 +71,24 @@ static inline unsigned long do_swap(volatile unsigned long *ptr,
68 return val; 71 return val;
69} 72}
70 73
71static void smp_setup_percpu_timer(void);
72
73void __cpuinit leon_callin(void) 74void __cpuinit leon_callin(void)
74{ 75{
75 int cpuid = hard_smpleon_processor_id(); 76 int cpuid = hard_smp_processor_id();
76 77
77 local_flush_cache_all(); 78 local_ops->cache_all();
78 local_flush_tlb_all(); 79 local_ops->tlb_all();
79 leon_configure_cache_smp(); 80 leon_configure_cache_smp();
80 81
82 notify_cpu_starting(cpuid);
83
81 /* Get our local ticker going. */ 84 /* Get our local ticker going. */
82 smp_setup_percpu_timer(); 85 register_percpu_ce(cpuid);
83 86
84 calibrate_delay(); 87 calibrate_delay();
85 smp_store_cpu_info(cpuid); 88 smp_store_cpu_info(cpuid);
86 89
87 local_flush_cache_all(); 90 local_ops->cache_all();
88 local_flush_tlb_all(); 91 local_ops->tlb_all();
89 92
90 /* 93 /*
91 * Unblock the master CPU _only_ when the scheduler state 94 * Unblock the master CPU _only_ when the scheduler state
@@ -96,8 +99,8 @@ void __cpuinit leon_callin(void)
96 */ 99 */
97 do_swap(&cpu_callin_map[cpuid], 1); 100 do_swap(&cpu_callin_map[cpuid], 1);
98 101
99 local_flush_cache_all(); 102 local_ops->cache_all();
100 local_flush_tlb_all(); 103 local_ops->tlb_all();
101 104
102 /* Fix idle thread fields. */ 105 /* Fix idle thread fields. */
103 __asm__ __volatile__("ld [%0], %%g6\n\t" : : "r"(&current_set[cpuid]) 106 __asm__ __volatile__("ld [%0], %%g6\n\t" : : "r"(&current_set[cpuid])
@@ -140,8 +143,8 @@ void __init leon_configure_cache_smp(void)
140 } 143 }
141 } 144 }
142 145
143 local_flush_cache_all(); 146 local_ops->cache_all();
144 local_flush_tlb_all(); 147 local_ops->tlb_all();
145} 148}
146 149
147void leon_smp_setbroadcast(unsigned int mask) 150void leon_smp_setbroadcast(unsigned int mask)
@@ -196,21 +199,15 @@ void __init leon_boot_cpus(void)
196 leon_smp_setbroadcast(1 << LEON3_IRQ_TICKER); 199 leon_smp_setbroadcast(1 << LEON3_IRQ_TICKER);
197 200
198 leon_configure_cache_smp(); 201 leon_configure_cache_smp();
199 smp_setup_percpu_timer(); 202 local_ops->cache_all();
200 local_flush_cache_all();
201 203
202} 204}
203 205
204int __cpuinit leon_boot_one_cpu(int i) 206int __cpuinit leon_boot_one_cpu(int i, struct task_struct *idle)
205{ 207{
206
207 struct task_struct *p;
208 int timeout; 208 int timeout;
209 209
210 /* Cook up an idler for this guy. */ 210 current_set[i] = task_thread_info(idle);
211 p = fork_idle(i);
212
213 current_set[i] = task_thread_info(p);
214 211
215 /* See trampoline.S:leon_smp_cpu_startup for details... 212 /* See trampoline.S:leon_smp_cpu_startup for details...
216 * Initialize the contexts table 213 * Initialize the contexts table
@@ -224,7 +221,7 @@ int __cpuinit leon_boot_one_cpu(int i)
224 /* whirrr, whirrr, whirrrrrrrrr... */ 221 /* whirrr, whirrr, whirrrrrrrrr... */
225 printk(KERN_INFO "Starting CPU %d : (irqmp: 0x%x)\n", (unsigned int)i, 222 printk(KERN_INFO "Starting CPU %d : (irqmp: 0x%x)\n", (unsigned int)i,
226 (unsigned int)&leon3_irqctrl_regs->mpstatus); 223 (unsigned int)&leon3_irqctrl_regs->mpstatus);
227 local_flush_cache_all(); 224 local_ops->cache_all();
228 225
229 /* Make sure all IRQs are of from the start for this new CPU */ 226 /* Make sure all IRQs are of from the start for this new CPU */
230 LEON_BYPASS_STORE_PA(&leon3_irqctrl_regs->mask[i], 0); 227 LEON_BYPASS_STORE_PA(&leon3_irqctrl_regs->mask[i], 0);
@@ -249,7 +246,7 @@ int __cpuinit leon_boot_one_cpu(int i)
249 leon_enable_irq_cpu(leon_ipi_irq, i); 246 leon_enable_irq_cpu(leon_ipi_irq, i);
250 } 247 }
251 248
252 local_flush_cache_all(); 249 local_ops->cache_all();
253 return 0; 250 return 0;
254} 251}
255 252
@@ -269,7 +266,7 @@ void __init leon_smp_done(void)
269 } 266 }
270 } 267 }
271 *prev = first; 268 *prev = first;
272 local_flush_cache_all(); 269 local_ops->cache_all();
273 270
274 /* Free unneeded trap tables */ 271 /* Free unneeded trap tables */
275 if (!cpu_present(1)) { 272 if (!cpu_present(1)) {
@@ -335,7 +332,7 @@ static void __init leon_ipi_init(void)
335 local_irq_save(flags); 332 local_irq_save(flags);
336 trap_table = &sparc_ttable[SP_TRAP_IRQ1 + (leon_ipi_irq - 1)]; 333 trap_table = &sparc_ttable[SP_TRAP_IRQ1 + (leon_ipi_irq - 1)];
337 trap_table->inst_three += smpleon_ipi - real_irq_entry; 334 trap_table->inst_three += smpleon_ipi - real_irq_entry;
338 local_flush_cache_all(); 335 local_ops->cache_all();
339 local_irq_restore(flags); 336 local_irq_restore(flags);
340 337
341 for_each_possible_cpu(cpu) { 338 for_each_possible_cpu(cpu) {
@@ -344,6 +341,13 @@ static void __init leon_ipi_init(void)
344 } 341 }
345} 342}
346 343
344static void leon_send_ipi(int cpu, int level)
345{
346 unsigned long mask;
347 mask = leon_get_irqmask(level);
348 LEON3_BYPASS_STORE_PA(&leon3_irqctrl_regs->force[cpu], mask);
349}
350
347static void leon_ipi_single(int cpu) 351static void leon_ipi_single(int cpu)
348{ 352{
349 struct leon_ipi_work *work = &per_cpu(leon_ipi_work, cpu); 353 struct leon_ipi_work *work = &per_cpu(leon_ipi_work, cpu);
@@ -352,7 +356,7 @@ static void leon_ipi_single(int cpu)
352 work->single = 1; 356 work->single = 1;
353 357
354 /* Generate IRQ on the CPU */ 358 /* Generate IRQ on the CPU */
355 set_cpu_int(cpu, leon_ipi_irq); 359 leon_send_ipi(cpu, leon_ipi_irq);
356} 360}
357 361
358static void leon_ipi_mask_one(int cpu) 362static void leon_ipi_mask_one(int cpu)
@@ -363,7 +367,7 @@ static void leon_ipi_mask_one(int cpu)
363 work->msk = 1; 367 work->msk = 1;
364 368
365 /* Generate IRQ on the CPU */ 369 /* Generate IRQ on the CPU */
366 set_cpu_int(cpu, leon_ipi_irq); 370 leon_send_ipi(cpu, leon_ipi_irq);
367} 371}
368 372
369static void leon_ipi_resched(int cpu) 373static void leon_ipi_resched(int cpu)
@@ -374,7 +378,7 @@ static void leon_ipi_resched(int cpu)
374 work->resched = 1; 378 work->resched = 1;
375 379
376 /* Generate IRQ on the CPU (any IRQ will cause resched) */ 380 /* Generate IRQ on the CPU (any IRQ will cause resched) */
377 set_cpu_int(cpu, leon_ipi_irq); 381 leon_send_ipi(cpu, leon_ipi_irq);
378} 382}
379 383
380void leonsmp_ipi_interrupt(void) 384void leonsmp_ipi_interrupt(void)
@@ -446,7 +450,7 @@ static void leon_cross_call(smpfunc_t func, cpumask_t mask, unsigned long arg1,
446 if (cpumask_test_cpu(i, &mask)) { 450 if (cpumask_test_cpu(i, &mask)) {
447 ccall_info.processors_in[i] = 0; 451 ccall_info.processors_in[i] = 0;
448 ccall_info.processors_out[i] = 0; 452 ccall_info.processors_out[i] = 0;
449 set_cpu_int(i, LEON3_IRQ_CROSS_CALL); 453 leon_send_ipi(i, LEON3_IRQ_CROSS_CALL);
450 454
451 } 455 }
452 } 456 }
@@ -489,68 +493,19 @@ void leon_cross_call_irq(void)
489 ccall_info.processors_out[i] = 1; 493 ccall_info.processors_out[i] = 1;
490} 494}
491 495
492irqreturn_t leon_percpu_timer_interrupt(int irq, void *unused) 496static const struct sparc32_ipi_ops leon_ipi_ops = {
493{ 497 .cross_call = leon_cross_call,
494 int cpu = smp_processor_id(); 498 .resched = leon_ipi_resched,
495 499 .single = leon_ipi_single,
496 leon_clear_profile_irq(cpu); 500 .mask_one = leon_ipi_mask_one,
497 501};
498 profile_tick(CPU_PROFILING);
499
500 if (!--prof_counter(cpu)) {
501 int user = user_mode(get_irq_regs());
502
503 update_process_times(user);
504
505 prof_counter(cpu) = prof_multiplier(cpu);
506 }
507
508 return IRQ_HANDLED;
509}
510
511static void __init smp_setup_percpu_timer(void)
512{
513 int cpu = smp_processor_id();
514
515 prof_counter(cpu) = prof_multiplier(cpu) = 1;
516}
517
518void __init leon_blackbox_id(unsigned *addr)
519{
520 int rd = *addr & 0x3e000000;
521 int rs1 = rd >> 11;
522
523 /* patch places where ___b_hard_smp_processor_id appears */
524 addr[0] = 0x81444000 | rd; /* rd %asr17, reg */
525 addr[1] = 0x8130201c | rd | rs1; /* srl reg, 0x1c, reg */
526 addr[2] = 0x01000000; /* nop */
527}
528
529void __init leon_blackbox_current(unsigned *addr)
530{
531 int rd = *addr & 0x3e000000;
532 int rs1 = rd >> 11;
533
534 /* patch LOAD_CURRENT macro where ___b_load_current appears */
535 addr[0] = 0x81444000 | rd; /* rd %asr17, reg */
536 addr[2] = 0x8130201c | rd | rs1; /* srl reg, 0x1c, reg */
537 addr[4] = 0x81282002 | rd | rs1; /* sll reg, 0x2, reg */
538
539}
540 502
541void __init leon_init_smp(void) 503void __init leon_init_smp(void)
542{ 504{
543 /* Patch ipi15 trap table */ 505 /* Patch ipi15 trap table */
544 t_nmi[1] = t_nmi[1] + (linux_trap_ipi15_leon - linux_trap_ipi15_sun4m); 506 t_nmi[1] = t_nmi[1] + (linux_trap_ipi15_leon - linux_trap_ipi15_sun4m);
545 507
546 BTFIXUPSET_BLACKBOX(hard_smp_processor_id, leon_blackbox_id); 508 sparc32_ipi_ops = &leon_ipi_ops;
547 BTFIXUPSET_BLACKBOX(load_current, leon_blackbox_current);
548 BTFIXUPSET_CALL(smp_cross_call, leon_cross_call, BTFIXUPCALL_NORM);
549 BTFIXUPSET_CALL(__hard_smp_processor_id, __leon_processor_id,
550 BTFIXUPCALL_NORM);
551 BTFIXUPSET_CALL(smp_ipi_resched, leon_ipi_resched, BTFIXUPCALL_NORM);
552 BTFIXUPSET_CALL(smp_ipi_single, leon_ipi_single, BTFIXUPCALL_NORM);
553 BTFIXUPSET_CALL(smp_ipi_mask_one, leon_ipi_mask_one, BTFIXUPCALL_NORM);
554} 509}
555 510
556#endif /* CONFIG_SPARC_LEON */ 511#endif /* CONFIG_SPARC_LEON */
diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
index 276359e1ff56..15e0a1693976 100644
--- a/arch/sparc/kernel/module.c
+++ b/arch/sparc/kernel/module.c
@@ -32,26 +32,11 @@ static void *module_map(unsigned long size)
32 GFP_KERNEL, PAGE_KERNEL, -1, 32 GFP_KERNEL, PAGE_KERNEL, -1,
33 __builtin_return_address(0)); 33 __builtin_return_address(0));
34} 34}
35
36static char *dot2underscore(char *name)
37{
38 return name;
39}
40#else 35#else
41static void *module_map(unsigned long size) 36static void *module_map(unsigned long size)
42{ 37{
43 return vmalloc(size); 38 return vmalloc(size);
44} 39}
45
46/* Replace references to .func with _Func */
47static char *dot2underscore(char *name)
48{
49 if (name[0] == '.') {
50 name[0] = '_';
51 name[1] = toupper(name[1]);
52 }
53 return name;
54}
55#endif /* CONFIG_SPARC64 */ 40#endif /* CONFIG_SPARC64 */
56 41
57void *module_alloc(unsigned long size) 42void *module_alloc(unsigned long size)
@@ -93,12 +78,8 @@ int module_frob_arch_sections(Elf_Ehdr *hdr,
93 78
94 for (i = 1; i < sechdrs[symidx].sh_size / sizeof(Elf_Sym); i++) { 79 for (i = 1; i < sechdrs[symidx].sh_size / sizeof(Elf_Sym); i++) {
95 if (sym[i].st_shndx == SHN_UNDEF) { 80 if (sym[i].st_shndx == SHN_UNDEF) {
96 if (ELF_ST_TYPE(sym[i].st_info) == STT_REGISTER) { 81 if (ELF_ST_TYPE(sym[i].st_info) == STT_REGISTER)
97 sym[i].st_shndx = SHN_ABS; 82 sym[i].st_shndx = SHN_ABS;
98 } else {
99 char *name = strtab + sym[i].st_name;
100 dot2underscore(name);
101 }
102 } 83 }
103 } 84 }
104 return 0; 85 return 0;
diff --git a/arch/sparc/kernel/muldiv.c b/arch/sparc/kernel/muldiv.c
deleted file mode 100644
index f7db516b07d8..000000000000
--- a/arch/sparc/kernel/muldiv.c
+++ /dev/null
@@ -1,238 +0,0 @@
1/*
2 * muldiv.c: Hardware multiply/division illegal instruction trap
3 * for sun4c/sun4 (which do not have those instructions)
4 *
5 * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
7 *
8 * 2004-12-25 Krzysztof Helt (krzysztof.h1@wp.pl)
9 * - fixed registers constrains in inline assembly declarations
10 */
11
12#include <linux/kernel.h>
13#include <linux/sched.h>
14#include <linux/mm.h>
15#include <asm/ptrace.h>
16#include <asm/processor.h>
17#include <asm/uaccess.h>
18
19#include "kernel.h"
20
21/* #define DEBUG_MULDIV */
22
23static inline int has_imm13(int insn)
24{
25 return (insn & 0x2000);
26}
27
28static inline int is_foocc(int insn)
29{
30 return (insn & 0x800000);
31}
32
33static inline int sign_extend_imm13(int imm)
34{
35 return imm << 19 >> 19;
36}
37
38static inline void advance(struct pt_regs *regs)
39{
40 regs->pc = regs->npc;
41 regs->npc += 4;
42}
43
44static inline void maybe_flush_windows(unsigned int rs1, unsigned int rs2,
45 unsigned int rd)
46{
47 if(rs2 >= 16 || rs1 >= 16 || rd >= 16) {
48 /* Wheee... */
49 __asm__ __volatile__("save %sp, -0x40, %sp\n\t"
50 "save %sp, -0x40, %sp\n\t"
51 "save %sp, -0x40, %sp\n\t"
52 "save %sp, -0x40, %sp\n\t"
53 "save %sp, -0x40, %sp\n\t"
54 "save %sp, -0x40, %sp\n\t"
55 "save %sp, -0x40, %sp\n\t"
56 "restore; restore; restore; restore;\n\t"
57 "restore; restore; restore;\n\t");
58 }
59}
60
61#define fetch_reg(reg, regs) ({ \
62 struct reg_window32 __user *win; \
63 register unsigned long ret; \
64 \
65 if (!(reg)) ret = 0; \
66 else if ((reg) < 16) { \
67 ret = regs->u_regs[(reg)]; \
68 } else { \
69 /* Ho hum, the slightly complicated case. */ \
70 win = (struct reg_window32 __user *)regs->u_regs[UREG_FP];\
71 if (get_user (ret, &win->locals[(reg) - 16])) return -1;\
72 } \
73 ret; \
74})
75
76static inline int
77store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs)
78{
79 struct reg_window32 __user *win;
80
81 if (!reg)
82 return 0;
83 if (reg < 16) {
84 regs->u_regs[reg] = result;
85 return 0;
86 } else {
87 /* need to use put_user() in this case: */
88 win = (struct reg_window32 __user *) regs->u_regs[UREG_FP];
89 return (put_user(result, &win->locals[reg - 16]));
90 }
91}
92
93/* Should return 0 if mul/div emulation succeeded and SIGILL should
94 * not be issued.
95 */
96int do_user_muldiv(struct pt_regs *regs, unsigned long pc)
97{
98 unsigned int insn;
99 int inst;
100 unsigned int rs1, rs2, rdv;
101
102 if (!pc)
103 return -1; /* This happens to often, I think */
104 if (get_user (insn, (unsigned int __user *)pc))
105 return -1;
106 if ((insn & 0xc1400000) != 0x80400000)
107 return -1;
108 inst = ((insn >> 19) & 0xf);
109 if ((inst & 0xe) != 10 && (inst & 0xe) != 14)
110 return -1;
111
112 /* Now we know we have to do something with umul, smul, udiv or sdiv */
113 rs1 = (insn >> 14) & 0x1f;
114 rs2 = insn & 0x1f;
115 rdv = (insn >> 25) & 0x1f;
116 if (has_imm13(insn)) {
117 maybe_flush_windows(rs1, 0, rdv);
118 rs2 = sign_extend_imm13(insn);
119 } else {
120 maybe_flush_windows(rs1, rs2, rdv);
121 rs2 = fetch_reg(rs2, regs);
122 }
123 rs1 = fetch_reg(rs1, regs);
124 switch (inst) {
125 case 10: /* umul */
126#ifdef DEBUG_MULDIV
127 printk ("unsigned muldiv: 0x%x * 0x%x = ", rs1, rs2);
128#endif
129 __asm__ __volatile__ ("\n\t"
130 "mov %0, %%o0\n\t"
131 "call .umul\n\t"
132 " mov %1, %%o1\n\t"
133 "mov %%o0, %0\n\t"
134 "mov %%o1, %1\n\t"
135 : "=r" (rs1), "=r" (rs2)
136 : "0" (rs1), "1" (rs2)
137 : "o0", "o1", "o2", "o3", "o4", "o5", "o7", "cc");
138#ifdef DEBUG_MULDIV
139 printk ("0x%x%08x\n", rs2, rs1);
140#endif
141 if (store_reg(rs1, rdv, regs))
142 return -1;
143 regs->y = rs2;
144 break;
145 case 11: /* smul */
146#ifdef DEBUG_MULDIV
147 printk ("signed muldiv: 0x%x * 0x%x = ", rs1, rs2);
148#endif
149 __asm__ __volatile__ ("\n\t"
150 "mov %0, %%o0\n\t"
151 "call .mul\n\t"
152 " mov %1, %%o1\n\t"
153 "mov %%o0, %0\n\t"
154 "mov %%o1, %1\n\t"
155 : "=r" (rs1), "=r" (rs2)
156 : "0" (rs1), "1" (rs2)
157 : "o0", "o1", "o2", "o3", "o4", "o5", "o7", "cc");
158#ifdef DEBUG_MULDIV
159 printk ("0x%x%08x\n", rs2, rs1);
160#endif
161 if (store_reg(rs1, rdv, regs))
162 return -1;
163 regs->y = rs2;
164 break;
165 case 14: /* udiv */
166#ifdef DEBUG_MULDIV
167 printk ("unsigned muldiv: 0x%x%08x / 0x%x = ", regs->y, rs1, rs2);
168#endif
169 if (!rs2) {
170#ifdef DEBUG_MULDIV
171 printk ("DIVISION BY ZERO\n");
172#endif
173 handle_hw_divzero (regs, pc, regs->npc, regs->psr);
174 return 0;
175 }
176 __asm__ __volatile__ ("\n\t"
177 "mov %2, %%o0\n\t"
178 "mov %0, %%o1\n\t"
179 "mov %%g0, %%o2\n\t"
180 "call __udivdi3\n\t"
181 " mov %1, %%o3\n\t"
182 "mov %%o1, %0\n\t"
183 "mov %%o0, %1\n\t"
184 : "=r" (rs1), "=r" (rs2)
185 : "r" (regs->y), "0" (rs1), "1" (rs2)
186 : "o0", "o1", "o2", "o3", "o4", "o5", "o7",
187 "g1", "g2", "g3", "cc");
188#ifdef DEBUG_MULDIV
189 printk ("0x%x\n", rs1);
190#endif
191 if (store_reg(rs1, rdv, regs))
192 return -1;
193 break;
194 case 15: /* sdiv */
195#ifdef DEBUG_MULDIV
196 printk ("signed muldiv: 0x%x%08x / 0x%x = ", regs->y, rs1, rs2);
197#endif
198 if (!rs2) {
199#ifdef DEBUG_MULDIV
200 printk ("DIVISION BY ZERO\n");
201#endif
202 handle_hw_divzero (regs, pc, regs->npc, regs->psr);
203 return 0;
204 }
205 __asm__ __volatile__ ("\n\t"
206 "mov %2, %%o0\n\t"
207 "mov %0, %%o1\n\t"
208 "mov %%g0, %%o2\n\t"
209 "call __divdi3\n\t"
210 " mov %1, %%o3\n\t"
211 "mov %%o1, %0\n\t"
212 "mov %%o0, %1\n\t"
213 : "=r" (rs1), "=r" (rs2)
214 : "r" (regs->y), "0" (rs1), "1" (rs2)
215 : "o0", "o1", "o2", "o3", "o4", "o5", "o7",
216 "g1", "g2", "g3", "cc");
217#ifdef DEBUG_MULDIV
218 printk ("0x%x\n", rs1);
219#endif
220 if (store_reg(rs1, rdv, regs))
221 return -1;
222 break;
223 }
224 if (is_foocc (insn)) {
225 regs->psr &= ~PSR_ICC;
226 if ((inst & 0xe) == 14) {
227 /* ?div */
228 if (rs2) regs->psr |= PSR_V;
229 }
230 if (!rs1) regs->psr |= PSR_Z;
231 if (((int)rs1) < 0) regs->psr |= PSR_N;
232#ifdef DEBUG_MULDIV
233 printk ("psr muldiv: %08x\n", regs->psr);
234#endif
235 }
236 advance(regs);
237 return 0;
238}
diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c
index 4ee8ce0d5d8d..185aa96fa5be 100644
--- a/arch/sparc/kernel/of_device_32.c
+++ b/arch/sparc/kernel/of_device_32.c
@@ -356,7 +356,7 @@ static struct platform_device * __init scan_one_device(struct device_node *dp,
356 op->archdata.num_irqs = len / sizeof(struct linux_prom_irqs); 356 op->archdata.num_irqs = len / sizeof(struct linux_prom_irqs);
357 for (i = 0; i < op->archdata.num_irqs; i++) 357 for (i = 0; i < op->archdata.num_irqs; i++)
358 op->archdata.irqs[i] = 358 op->archdata.irqs[i] =
359 sparc_irq_config.build_device_irq(op, intr[i].pri); 359 sparc_config.build_device_irq(op, intr[i].pri);
360 } else { 360 } else {
361 const unsigned int *irq = 361 const unsigned int *irq =
362 of_get_property(dp, "interrupts", &len); 362 of_get_property(dp, "interrupts", &len);
@@ -365,7 +365,7 @@ static struct platform_device * __init scan_one_device(struct device_node *dp,
365 op->archdata.num_irqs = len / sizeof(unsigned int); 365 op->archdata.num_irqs = len / sizeof(unsigned int);
366 for (i = 0; i < op->archdata.num_irqs; i++) 366 for (i = 0; i < op->archdata.num_irqs; i++)
367 op->archdata.irqs[i] = 367 op->archdata.irqs[i] =
368 sparc_irq_config.build_device_irq(op, irq[i]); 368 sparc_config.build_device_irq(op, irq[i]);
369 } else { 369 } else {
370 op->archdata.num_irqs = 0; 370 op->archdata.num_irqs = 0;
371 } 371 }
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index fcc148effaac..ded3f6090c3f 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -703,31 +703,28 @@ static void pcic_clear_clock_irq(void)
703 pcic_timer_dummy = readl(pcic0.pcic_regs+PCI_SYS_LIMIT); 703 pcic_timer_dummy = readl(pcic0.pcic_regs+PCI_SYS_LIMIT);
704} 704}
705 705
706static irqreturn_t pcic_timer_handler (int irq, void *h) 706/* CPU frequency is 100 MHz, timer increments every 4 CPU clocks */
707#define USECS_PER_JIFFY (1000000 / HZ)
708#define TICK_TIMER_LIMIT ((100 * 1000000 / 4) / HZ)
709
710static unsigned int pcic_cycles_offset(void)
707{ 711{
708 pcic_clear_clock_irq(); 712 u32 value, count;
709 xtime_update(1);
710#ifndef CONFIG_SMP
711 update_process_times(user_mode(get_irq_regs()));
712#endif
713 return IRQ_HANDLED;
714}
715 713
716#define USECS_PER_JIFFY 10000 /* We have 100HZ "standard" timer for sparc */ 714 value = readl(pcic0.pcic_regs + PCI_SYS_COUNTER);
717#define TICK_TIMER_LIMIT ((100*1000000/4)/100) 715 count = value & ~PCI_SYS_COUNTER_OVERFLOW;
718 716
719u32 pci_gettimeoffset(void) 717 if (value & PCI_SYS_COUNTER_OVERFLOW)
720{ 718 count += TICK_TIMER_LIMIT;
721 /* 719 /*
722 * We divide all by 100 720 * We divide all by HZ
723 * to have microsecond resolution and to avoid overflow 721 * to have microsecond resolution and to avoid overflow
724 */ 722 */
725 unsigned long count = 723 count = ((count / HZ) * USECS_PER_JIFFY) / (TICK_TIMER_LIMIT / HZ);
726 readl(pcic0.pcic_regs+PCI_SYS_COUNTER) & ~PCI_SYS_COUNTER_OVERFLOW;
727 count = ((count/100)*USECS_PER_JIFFY) / (TICK_TIMER_LIMIT/100);
728 return count * 1000;
729}
730 724
725 /* Coordinate with the sparc_config.clock_rate setting */
726 return count * 2;
727}
731 728
732void __init pci_time_init(void) 729void __init pci_time_init(void)
733{ 730{
@@ -736,9 +733,16 @@ void __init pci_time_init(void)
736 int timer_irq, irq; 733 int timer_irq, irq;
737 int err; 734 int err;
738 735
739 do_arch_gettimeoffset = pci_gettimeoffset; 736#ifndef CONFIG_SMP
740 737 /*
741 btfixup(); 738 * The clock_rate is in SBUS dimension.
739 * We take into account this in pcic_cycles_offset()
740 */
741 sparc_config.clock_rate = SBUS_CLOCK_RATE / HZ;
742 sparc_config.features |= FEAT_L10_CLOCKEVENT;
743#endif
744 sparc_config.features |= FEAT_L10_CLOCKSOURCE;
745 sparc_config.get_cycles_offset = pcic_cycles_offset;
742 746
743 writel (TICK_TIMER_LIMIT, pcic->pcic_regs+PCI_SYS_LIMIT); 747 writel (TICK_TIMER_LIMIT, pcic->pcic_regs+PCI_SYS_LIMIT);
744 /* PROM should set appropriate irq */ 748 /* PROM should set appropriate irq */
@@ -747,7 +751,7 @@ void __init pci_time_init(void)
747 writel (PCI_COUNTER_IRQ_SET(timer_irq, 0), 751 writel (PCI_COUNTER_IRQ_SET(timer_irq, 0),
748 pcic->pcic_regs+PCI_COUNTER_IRQ); 752 pcic->pcic_regs+PCI_COUNTER_IRQ);
749 irq = pcic_build_device_irq(NULL, timer_irq); 753 irq = pcic_build_device_irq(NULL, timer_irq);
750 err = request_irq(irq, pcic_timer_handler, 754 err = request_irq(irq, timer_interrupt,
751 IRQF_TIMER, "timer", NULL); 755 IRQF_TIMER, "timer", NULL);
752 if (err) { 756 if (err) {
753 prom_printf("time_init: unable to attach IRQ%d\n", timer_irq); 757 prom_printf("time_init: unable to attach IRQ%d\n", timer_irq);
@@ -875,10 +879,9 @@ static void pcic_load_profile_irq(int cpu, unsigned int limit)
875 879
876void __init sun4m_pci_init_IRQ(void) 880void __init sun4m_pci_init_IRQ(void)
877{ 881{
878 sparc_irq_config.build_device_irq = pcic_build_device_irq; 882 sparc_config.build_device_irq = pcic_build_device_irq;
879 883 sparc_config.clear_clock_irq = pcic_clear_clock_irq;
880 BTFIXUPSET_CALL(clear_clock_irq, pcic_clear_clock_irq, BTFIXUPCALL_NORM); 884 sparc_config.load_profile_irq = pcic_load_profile_irq;
881 BTFIXUPSET_CALL(load_profile_irq, pcic_load_profile_irq, BTFIXUPCALL_NORM);
882} 885}
883 886
884int pcibios_assign_resource(struct pci_dev *pdev, int resource) 887int pcibios_assign_resource(struct pci_dev *pdev, int resource)
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index 28559ce5eeb5..5713957dcb8a 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -1296,8 +1296,6 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self,
1296 1296
1297 regs = args->regs; 1297 regs = args->regs;
1298 1298
1299 perf_sample_data_init(&data, 0);
1300
1301 cpuc = &__get_cpu_var(cpu_hw_events); 1299 cpuc = &__get_cpu_var(cpu_hw_events);
1302 1300
1303 /* If the PMU has the TOE IRQ enable bits, we need to do a 1301 /* If the PMU has the TOE IRQ enable bits, we need to do a
@@ -1321,7 +1319,7 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self,
1321 if (val & (1ULL << 31)) 1319 if (val & (1ULL << 31))
1322 continue; 1320 continue;
1323 1321
1324 data.period = event->hw.last_period; 1322 perf_sample_data_init(&data, 0, hwc->last_period);
1325 if (!sparc_perf_event_set_period(event, hwc, idx)) 1323 if (!sparc_perf_event_set_period(event, hwc, idx))
1326 continue; 1324 continue;
1327 1325
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index efa07542e85f..fe6787cc62fc 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -67,8 +67,6 @@ struct thread_info *current_set[NR_CPUS];
67 67
68#ifndef CONFIG_SMP 68#ifndef CONFIG_SMP
69 69
70#define SUN4C_FAULT_HIGH 100
71
72/* 70/*
73 * the idle loop on a Sparc... ;) 71 * the idle loop on a Sparc... ;)
74 */ 72 */
@@ -76,36 +74,6 @@ void cpu_idle(void)
76{ 74{
77 /* endless idle loop with no priority at all */ 75 /* endless idle loop with no priority at all */
78 for (;;) { 76 for (;;) {
79 if (ARCH_SUN4C) {
80 static int count = HZ;
81 static unsigned long last_jiffies;
82 static unsigned long last_faults;
83 static unsigned long fps;
84 unsigned long now;
85 unsigned long faults;
86
87 extern unsigned long sun4c_kernel_faults;
88 extern void sun4c_grow_kernel_ring(void);
89
90 local_irq_disable();
91 now = jiffies;
92 count -= (now - last_jiffies);
93 last_jiffies = now;
94 if (count < 0) {
95 count += HZ;
96 faults = sun4c_kernel_faults;
97 fps = (fps + (faults - last_faults)) >> 1;
98 last_faults = faults;
99#if 0
100 printk("kernel faults / second = %ld\n", fps);
101#endif
102 if (fps >= SUN4C_FAULT_HIGH) {
103 sun4c_grow_kernel_ring();
104 }
105 }
106 local_irq_enable();
107 }
108
109 if (pm_idle) { 77 if (pm_idle) {
110 while (!need_resched()) 78 while (!need_resched())
111 (*pm_idle)(); 79 (*pm_idle)();
@@ -114,7 +82,6 @@ void cpu_idle(void)
114 cpu_relax(); 82 cpu_relax();
115 } 83 }
116 schedule_preempt_disabled(); 84 schedule_preempt_disabled();
117 check_pgt_cache();
118 } 85 }
119} 86}
120 87
@@ -137,7 +104,6 @@ void cpu_idle(void)
137 cpu_relax(); 104 cpu_relax();
138 } 105 }
139 schedule_preempt_disabled(); 106 schedule_preempt_disabled();
140 check_pgt_cache();
141 } 107 }
142} 108}
143 109
@@ -179,88 +145,6 @@ void machine_power_off(void)
179 machine_halt(); 145 machine_halt();
180} 146}
181 147
182#if 0
183
184static DEFINE_SPINLOCK(sparc_backtrace_lock);
185
186void __show_backtrace(unsigned long fp)
187{
188 struct reg_window32 *rw;
189 unsigned long flags;
190 int cpu = smp_processor_id();
191
192 spin_lock_irqsave(&sparc_backtrace_lock, flags);
193
194 rw = (struct reg_window32 *)fp;
195 while(rw && (((unsigned long) rw) >= PAGE_OFFSET) &&
196 !(((unsigned long) rw) & 0x7)) {
197 printk("CPU[%d]: ARGS[%08lx,%08lx,%08lx,%08lx,%08lx,%08lx] "
198 "FP[%08lx] CALLER[%08lx]: ", cpu,
199 rw->ins[0], rw->ins[1], rw->ins[2], rw->ins[3],
200 rw->ins[4], rw->ins[5],
201 rw->ins[6],
202 rw->ins[7]);
203 printk("%pS\n", (void *) rw->ins[7]);
204 rw = (struct reg_window32 *) rw->ins[6];
205 }
206 spin_unlock_irqrestore(&sparc_backtrace_lock, flags);
207}
208
209#define __SAVE __asm__ __volatile__("save %sp, -0x40, %sp\n\t")
210#define __RESTORE __asm__ __volatile__("restore %g0, %g0, %g0\n\t")
211#define __GET_FP(fp) __asm__ __volatile__("mov %%i6, %0" : "=r" (fp))
212
213void show_backtrace(void)
214{
215 unsigned long fp;
216
217 __SAVE; __SAVE; __SAVE; __SAVE;
218 __SAVE; __SAVE; __SAVE; __SAVE;
219 __RESTORE; __RESTORE; __RESTORE; __RESTORE;
220 __RESTORE; __RESTORE; __RESTORE; __RESTORE;
221
222 __GET_FP(fp);
223
224 __show_backtrace(fp);
225}
226
227#ifdef CONFIG_SMP
228void smp_show_backtrace_all_cpus(void)
229{
230 xc0((smpfunc_t) show_backtrace);
231 show_backtrace();
232}
233#endif
234
235void show_stackframe(struct sparc_stackf *sf)
236{
237 unsigned long size;
238 unsigned long *stk;
239 int i;
240
241 printk("l0: %08lx l1: %08lx l2: %08lx l3: %08lx "
242 "l4: %08lx l5: %08lx l6: %08lx l7: %08lx\n",
243 sf->locals[0], sf->locals[1], sf->locals[2], sf->locals[3],
244 sf->locals[4], sf->locals[5], sf->locals[6], sf->locals[7]);
245 printk("i0: %08lx i1: %08lx i2: %08lx i3: %08lx "
246 "i4: %08lx i5: %08lx fp: %08lx i7: %08lx\n",
247 sf->ins[0], sf->ins[1], sf->ins[2], sf->ins[3],
248 sf->ins[4], sf->ins[5], (unsigned long)sf->fp, sf->callers_pc);
249 printk("sp: %08lx x0: %08lx x1: %08lx x2: %08lx "
250 "x3: %08lx x4: %08lx x5: %08lx xx: %08lx\n",
251 (unsigned long)sf->structptr, sf->xargs[0], sf->xargs[1],
252 sf->xargs[2], sf->xargs[3], sf->xargs[4], sf->xargs[5],
253 sf->xxargs[0]);
254 size = ((unsigned long)sf->fp) - ((unsigned long)sf);
255 size -= STACKFRAME_SZ;
256 stk = (unsigned long *)((unsigned long)sf + STACKFRAME_SZ);
257 i = 0;
258 do {
259 printk("s%d: %08lx\n", i++, *stk++);
260 } while ((size -= sizeof(unsigned long)));
261}
262#endif
263
264void show_regs(struct pt_regs *r) 148void show_regs(struct pt_regs *r)
265{ 149{
266 struct reg_window32 *rw = (struct reg_window32 *) r->u_regs[14]; 150 struct reg_window32 *rw = (struct reg_window32 *) r->u_regs[14];
diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c
index 6f97c0767995..484dabac7045 100644
--- a/arch/sparc/kernel/ptrace_64.c
+++ b/arch/sparc/kernel/ptrace_64.c
@@ -1062,7 +1062,7 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
1062 int ret = 0; 1062 int ret = 0;
1063 1063
1064 /* do the secure computing check first */ 1064 /* do the secure computing check first */
1065 secure_computing(regs->u_regs[UREG_G1]); 1065 secure_computing_strict(regs->u_regs[UREG_G1]);
1066 1066
1067 if (test_thread_flag(TIF_SYSCALL_TRACE)) 1067 if (test_thread_flag(TIF_SYSCALL_TRACE))
1068 ret = tracehook_report_syscall_entry(regs); 1068 ret = tracehook_report_syscall_entry(regs);
diff --git a/arch/sparc/kernel/rtrap_32.S b/arch/sparc/kernel/rtrap_32.S
index 5f5f74c2c2ca..7abc24e2bf1a 100644
--- a/arch/sparc/kernel/rtrap_32.S
+++ b/arch/sparc/kernel/rtrap_32.S
@@ -128,13 +128,12 @@ rtrap_patch2: and %glob_tmp, 0xff, %glob_tmp
128 128
129 wr %glob_tmp, 0x0, %wim 129 wr %glob_tmp, 0x0, %wim
130 130
131 /* Here comes the architecture specific 131 /* Here comes the architecture specific
132 * branch to the user stack checking routine 132 * branch to the user stack checking routine
133 * for return from traps. 133 * for return from traps.
134 */ 134 */
135 .globl rtrap_mmu_patchme 135 b srmmu_rett_stackchk
136rtrap_mmu_patchme: b sun4c_rett_stackchk 136 andcc %fp, 0x7, %g0
137 andcc %fp, 0x7, %g0
138 137
139ret_trap_userwins_ok: 138ret_trap_userwins_ok:
140 LOAD_PT_PRIV(sp, t_psr, t_pc, t_npc) 139 LOAD_PT_PRIV(sp, t_psr, t_pc, t_npc)
@@ -225,69 +224,6 @@ ret_trap_user_stack_is_bolixed:
225 b signal_p 224 b signal_p
226 ld [%curptr + TI_FLAGS], %g2 225 ld [%curptr + TI_FLAGS], %g2
227 226
228sun4c_rett_stackchk:
229 be 1f
230 and %fp, 0xfff, %g1 ! delay slot
231
232 b ret_trap_user_stack_is_bolixed + 0x4
233 wr %t_wim, 0x0, %wim
234
235 /* See if we have to check the sanity of one page or two */
2361:
237 add %g1, 0x38, %g1
238 sra %fp, 29, %g2
239 add %g2, 0x1, %g2
240 andncc %g2, 0x1, %g0
241 be 1f
242 andncc %g1, 0xff8, %g0
243
244 /* %sp is in vma hole, yuck */
245 b ret_trap_user_stack_is_bolixed + 0x4
246 wr %t_wim, 0x0, %wim
247
2481:
249 be sun4c_rett_onepage /* Only one page to check */
250 lda [%fp] ASI_PTE, %g2
251
252sun4c_rett_twopages:
253 add %fp, 0x38, %g1
254 sra %g1, 29, %g2
255 add %g2, 0x1, %g2
256 andncc %g2, 0x1, %g0
257 be 1f
258 lda [%g1] ASI_PTE, %g2
259
260 /* Second page is in vma hole */
261 b ret_trap_user_stack_is_bolixed + 0x4
262 wr %t_wim, 0x0, %wim
263
2641:
265 srl %g2, 29, %g2
266 andcc %g2, 0x4, %g0
267 bne sun4c_rett_onepage
268 lda [%fp] ASI_PTE, %g2
269
270 /* Second page has bad perms */
271 b ret_trap_user_stack_is_bolixed + 0x4
272 wr %t_wim, 0x0, %wim
273
274sun4c_rett_onepage:
275 srl %g2, 29, %g2
276 andcc %g2, 0x4, %g0
277 bne,a 1f
278 restore %g0, %g0, %g0
279
280 /* A page had bad page permissions, losing... */
281 b ret_trap_user_stack_is_bolixed + 0x4
282 wr %t_wim, 0x0, %wim
283
284 /* Whee, things are ok, load the window and continue. */
2851:
286 LOAD_WINDOW(sp)
287
288 b ret_trap_userwins_ok
289 save %g0, %g0, %g0
290
291 .globl srmmu_rett_stackchk 227 .globl srmmu_rett_stackchk
292srmmu_rett_stackchk: 228srmmu_rett_stackchk:
293 bne ret_trap_user_stack_is_bolixed 229 bne ret_trap_user_stack_is_bolixed
diff --git a/arch/sparc/kernel/rtrap_64.S b/arch/sparc/kernel/rtrap_64.S
index 77f1b95e0806..afa2a9e3d0a0 100644
--- a/arch/sparc/kernel/rtrap_64.S
+++ b/arch/sparc/kernel/rtrap_64.S
@@ -20,11 +20,6 @@
20 20
21 .text 21 .text
22 .align 32 22 .align 32
23__handle_softirq:
24 call do_softirq
25 nop
26 ba,a,pt %xcc, __handle_softirq_continue
27 nop
28__handle_preemption: 23__handle_preemption:
29 call schedule 24 call schedule
30 wrpr %g0, RTRAP_PSTATE, %pstate 25 wrpr %g0, RTRAP_PSTATE, %pstate
@@ -78,20 +73,8 @@ rtrap_nmi: ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
78 .globl rtrap_irq, rtrap, irqsz_patchme, rtrap_xcall 73 .globl rtrap_irq, rtrap, irqsz_patchme, rtrap_xcall
79rtrap_irq: 74rtrap_irq:
80rtrap: 75rtrap:
81#ifndef CONFIG_SMP
82 sethi %hi(__cpu_data), %l0
83 lduw [%l0 + %lo(__cpu_data)], %l1
84#else
85 sethi %hi(__cpu_data), %l0
86 or %l0, %lo(__cpu_data), %l0
87 lduw [%l0 + %g5], %l1
88#endif
89 cmp %l1, 0
90
91 /* mm/ultra.S:xcall_report_regs KNOWS about this load. */ 76 /* mm/ultra.S:xcall_report_regs KNOWS about this load. */
92 bne,pn %icc, __handle_softirq 77 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
93 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
94__handle_softirq_continue:
95rtrap_xcall: 78rtrap_xcall:
96 sethi %hi(0xf << 20), %l4 79 sethi %hi(0xf << 20), %l4
97 and %l1, %l4, %l4 80 and %l1, %l4, %l4
diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c
index d444468b27f6..c052313f4dc5 100644
--- a/arch/sparc/kernel/setup_32.c
+++ b/arch/sparc/kernel/setup_32.c
@@ -42,7 +42,6 @@
42#include <asm/vaddrs.h> 42#include <asm/vaddrs.h>
43#include <asm/mbus.h> 43#include <asm/mbus.h>
44#include <asm/idprom.h> 44#include <asm/idprom.h>
45#include <asm/machines.h>
46#include <asm/cpudata.h> 45#include <asm/cpudata.h>
47#include <asm/setup.h> 46#include <asm/setup.h>
48#include <asm/cacheflush.h> 47#include <asm/cacheflush.h>
@@ -106,7 +105,6 @@ unsigned long cmdline_memory_size __initdata = 0;
106 105
107/* which CPU booted us (0xff = not set) */ 106/* which CPU booted us (0xff = not set) */
108unsigned char boot_cpu_id = 0xff; /* 0xff will make it into DATA section... */ 107unsigned char boot_cpu_id = 0xff; /* 0xff will make it into DATA section... */
109unsigned char boot_cpu_id4; /* boot_cpu_id << 2 */
110 108
111static void 109static void
112prom_console_write(struct console *con, const char *s, unsigned n) 110prom_console_write(struct console *con, const char *s, unsigned n)
@@ -182,13 +180,6 @@ static void __init boot_flags_init(char *commands)
182 } 180 }
183} 181}
184 182
185/* This routine will in the future do all the nasty prom stuff
186 * to probe for the mmu type and its parameters, etc. This will
187 * also be where SMP things happen.
188 */
189
190extern void sun4c_probe_vac(void);
191
192extern unsigned short root_flags; 183extern unsigned short root_flags;
193extern unsigned short root_dev; 184extern unsigned short root_dev;
194extern unsigned short ram_flags; 185extern unsigned short ram_flags;
@@ -200,6 +191,52 @@ extern int root_mountflags;
200 191
201char reboot_command[COMMAND_LINE_SIZE]; 192char reboot_command[COMMAND_LINE_SIZE];
202 193
194struct cpuid_patch_entry {
195 unsigned int addr;
196 unsigned int sun4d[3];
197 unsigned int leon[3];
198};
199extern struct cpuid_patch_entry __cpuid_patch, __cpuid_patch_end;
200
201static void __init per_cpu_patch(void)
202{
203 struct cpuid_patch_entry *p;
204
205 if (sparc_cpu_model == sun4m) {
206 /* Nothing to do, this is what the unpatched code
207 * targets.
208 */
209 return;
210 }
211
212 p = &__cpuid_patch;
213 while (p < &__cpuid_patch_end) {
214 unsigned long addr = p->addr;
215 unsigned int *insns;
216
217 switch (sparc_cpu_model) {
218 case sun4d:
219 insns = &p->sun4d[0];
220 break;
221
222 case sparc_leon:
223 insns = &p->leon[0];
224 break;
225 default:
226 prom_printf("Unknown cpu type, halting.\n");
227 prom_halt();
228 }
229 *(unsigned int *) (addr + 0) = insns[0];
230 flushi(addr + 0);
231 *(unsigned int *) (addr + 4) = insns[1];
232 flushi(addr + 4);
233 *(unsigned int *) (addr + 8) = insns[2];
234 flushi(addr + 8);
235
236 p++;
237 }
238}
239
203enum sparc_cpu sparc_cpu_model; 240enum sparc_cpu sparc_cpu_model;
204EXPORT_SYMBOL(sparc_cpu_model); 241EXPORT_SYMBOL(sparc_cpu_model);
205 242
@@ -225,10 +262,6 @@ void __init setup_arch(char **cmdline_p)
225 262
226 /* Set sparc_cpu_model */ 263 /* Set sparc_cpu_model */
227 sparc_cpu_model = sun_unknown; 264 sparc_cpu_model = sun_unknown;
228 if (!strcmp(&cputypval[0], "sun4 "))
229 sparc_cpu_model = sun4;
230 if (!strcmp(&cputypval[0], "sun4c"))
231 sparc_cpu_model = sun4c;
232 if (!strcmp(&cputypval[0], "sun4m")) 265 if (!strcmp(&cputypval[0], "sun4m"))
233 sparc_cpu_model = sun4m; 266 sparc_cpu_model = sun4m;
234 if (!strcmp(&cputypval[0], "sun4s")) 267 if (!strcmp(&cputypval[0], "sun4s"))
@@ -244,12 +277,6 @@ void __init setup_arch(char **cmdline_p)
244 277
245 printk("ARCH: "); 278 printk("ARCH: ");
246 switch(sparc_cpu_model) { 279 switch(sparc_cpu_model) {
247 case sun4:
248 printk("SUN4\n");
249 break;
250 case sun4c:
251 printk("SUN4C\n");
252 break;
253 case sun4m: 280 case sun4m:
254 printk("SUN4M\n"); 281 printk("SUN4M\n");
255 break; 282 break;
@@ -275,8 +302,6 @@ void __init setup_arch(char **cmdline_p)
275#endif 302#endif
276 303
277 idprom_init(); 304 idprom_init();
278 if (ARCH_SUN4C)
279 sun4c_probe_vac();
280 load_mmu(); 305 load_mmu();
281 306
282 phys_base = 0xffffffffUL; 307 phys_base = 0xffffffffUL;
@@ -313,6 +338,9 @@ void __init setup_arch(char **cmdline_p)
313 init_mm.context = (unsigned long) NO_CONTEXT; 338 init_mm.context = (unsigned long) NO_CONTEXT;
314 init_task.thread.kregs = &fake_swapper_regs; 339 init_task.thread.kregs = &fake_swapper_regs;
315 340
341 /* Run-time patch instructions to match the cpu model */
342 per_cpu_patch();
343
316 paging_init(); 344 paging_init();
317 345
318 smp_setup_cpu_possible_map(); 346 smp_setup_cpu_possible_map();
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c
index 1e750e415d7a..ac8e66b50f07 100644
--- a/arch/sparc/kernel/signal_32.c
+++ b/arch/sparc/kernel/signal_32.c
@@ -217,12 +217,9 @@ segv:
217/* Checks if the fp is valid */ 217/* Checks if the fp is valid */
218static inline int invalid_frame_pointer(void __user *fp, int fplen) 218static inline int invalid_frame_pointer(void __user *fp, int fplen)
219{ 219{
220 if ((((unsigned long) fp) & 7) || 220 if ((((unsigned long) fp) & 7) || !__access_ok((unsigned long)fp, fplen))
221 !__access_ok((unsigned long)fp, fplen) ||
222 ((sparc_cpu_model == sun4 || sparc_cpu_model == sun4c) &&
223 ((unsigned long) fp < 0xe0000000 && (unsigned long) fp >= 0x20000000)))
224 return 1; 221 return 1;
225 222
226 return 0; 223 return 0;
227} 224}
228 225
diff --git a/arch/sparc/kernel/smp_32.c b/arch/sparc/kernel/smp_32.c
index f671e7fd6ddc..79db45e5134a 100644
--- a/arch/sparc/kernel/smp_32.c
+++ b/arch/sparc/kernel/smp_32.c
@@ -40,6 +40,8 @@ volatile unsigned long cpu_callin_map[NR_CPUS] __cpuinitdata = {0,};
40 40
41cpumask_t smp_commenced_mask = CPU_MASK_NONE; 41cpumask_t smp_commenced_mask = CPU_MASK_NONE;
42 42
43const struct sparc32_ipi_ops *sparc32_ipi_ops;
44
43/* The only guaranteed locking primitive available on all Sparc 45/* The only guaranteed locking primitive available on all Sparc
44 * processors is 'ldstub [%reg + immediate], %dest_reg' which atomically 46 * processors is 'ldstub [%reg + immediate], %dest_reg' which atomically
45 * places the current byte at the effective address into dest_reg and 47 * places the current byte at the effective address into dest_reg and
@@ -85,14 +87,6 @@ void __init smp_cpus_done(unsigned int max_cpus)
85 (bogosum/(5000/HZ))%100); 87 (bogosum/(5000/HZ))%100);
86 88
87 switch(sparc_cpu_model) { 89 switch(sparc_cpu_model) {
88 case sun4:
89 printk("SUN4\n");
90 BUG();
91 break;
92 case sun4c:
93 printk("SUN4C\n");
94 BUG();
95 break;
96 case sun4m: 90 case sun4m:
97 smp4m_smp_done(); 91 smp4m_smp_done();
98 break; 92 break;
@@ -132,7 +126,7 @@ void smp_send_reschedule(int cpu)
132 * a single CPU. The trap handler needs only to do trap entry/return 126 * a single CPU. The trap handler needs only to do trap entry/return
133 * to call schedule. 127 * to call schedule.
134 */ 128 */
135 BTFIXUP_CALL(smp_ipi_resched)(cpu); 129 sparc32_ipi_ops->resched(cpu);
136} 130}
137 131
138void smp_send_stop(void) 132void smp_send_stop(void)
@@ -142,7 +136,7 @@ void smp_send_stop(void)
142void arch_send_call_function_single_ipi(int cpu) 136void arch_send_call_function_single_ipi(int cpu)
143{ 137{
144 /* trigger one IPI single call on one CPU */ 138 /* trigger one IPI single call on one CPU */
145 BTFIXUP_CALL(smp_ipi_single)(cpu); 139 sparc32_ipi_ops->single(cpu);
146} 140}
147 141
148void arch_send_call_function_ipi_mask(const struct cpumask *mask) 142void arch_send_call_function_ipi_mask(const struct cpumask *mask)
@@ -151,7 +145,7 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)
151 145
152 /* trigger IPI mask call on each CPU */ 146 /* trigger IPI mask call on each CPU */
153 for_each_cpu(cpu, mask) 147 for_each_cpu(cpu, mask)
154 BTFIXUP_CALL(smp_ipi_mask_one)(cpu); 148 sparc32_ipi_ops->mask_one(cpu);
155} 149}
156 150
157void smp_resched_interrupt(void) 151void smp_resched_interrupt(void)
@@ -179,150 +173,9 @@ void smp_call_function_interrupt(void)
179 irq_exit(); 173 irq_exit();
180} 174}
181 175
182void smp_flush_cache_all(void)
183{
184 xc0((smpfunc_t) BTFIXUP_CALL(local_flush_cache_all));
185 local_flush_cache_all();
186}
187
188void smp_flush_tlb_all(void)
189{
190 xc0((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_all));
191 local_flush_tlb_all();
192}
193
194void smp_flush_cache_mm(struct mm_struct *mm)
195{
196 if(mm->context != NO_CONTEXT) {
197 cpumask_t cpu_mask;
198 cpumask_copy(&cpu_mask, mm_cpumask(mm));
199 cpumask_clear_cpu(smp_processor_id(), &cpu_mask);
200 if (!cpumask_empty(&cpu_mask))
201 xc1((smpfunc_t) BTFIXUP_CALL(local_flush_cache_mm), (unsigned long) mm);
202 local_flush_cache_mm(mm);
203 }
204}
205
206void smp_flush_tlb_mm(struct mm_struct *mm)
207{
208 if(mm->context != NO_CONTEXT) {
209 cpumask_t cpu_mask;
210 cpumask_copy(&cpu_mask, mm_cpumask(mm));
211 cpumask_clear_cpu(smp_processor_id(), &cpu_mask);
212 if (!cpumask_empty(&cpu_mask)) {
213 xc1((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_mm), (unsigned long) mm);
214 if(atomic_read(&mm->mm_users) == 1 && current->active_mm == mm)
215 cpumask_copy(mm_cpumask(mm),
216 cpumask_of(smp_processor_id()));
217 }
218 local_flush_tlb_mm(mm);
219 }
220}
221
222void smp_flush_cache_range(struct vm_area_struct *vma, unsigned long start,
223 unsigned long end)
224{
225 struct mm_struct *mm = vma->vm_mm;
226
227 if (mm->context != NO_CONTEXT) {
228 cpumask_t cpu_mask;
229 cpumask_copy(&cpu_mask, mm_cpumask(mm));
230 cpumask_clear_cpu(smp_processor_id(), &cpu_mask);
231 if (!cpumask_empty(&cpu_mask))
232 xc3((smpfunc_t) BTFIXUP_CALL(local_flush_cache_range), (unsigned long) vma, start, end);
233 local_flush_cache_range(vma, start, end);
234 }
235}
236
237void smp_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
238 unsigned long end)
239{
240 struct mm_struct *mm = vma->vm_mm;
241
242 if (mm->context != NO_CONTEXT) {
243 cpumask_t cpu_mask;
244 cpumask_copy(&cpu_mask, mm_cpumask(mm));
245 cpumask_clear_cpu(smp_processor_id(), &cpu_mask);
246 if (!cpumask_empty(&cpu_mask))
247 xc3((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_range), (unsigned long) vma, start, end);
248 local_flush_tlb_range(vma, start, end);
249 }
250}
251
252void smp_flush_cache_page(struct vm_area_struct *vma, unsigned long page)
253{
254 struct mm_struct *mm = vma->vm_mm;
255
256 if(mm->context != NO_CONTEXT) {
257 cpumask_t cpu_mask;
258 cpumask_copy(&cpu_mask, mm_cpumask(mm));
259 cpumask_clear_cpu(smp_processor_id(), &cpu_mask);
260 if (!cpumask_empty(&cpu_mask))
261 xc2((smpfunc_t) BTFIXUP_CALL(local_flush_cache_page), (unsigned long) vma, page);
262 local_flush_cache_page(vma, page);
263 }
264}
265
266void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
267{
268 struct mm_struct *mm = vma->vm_mm;
269
270 if(mm->context != NO_CONTEXT) {
271 cpumask_t cpu_mask;
272 cpumask_copy(&cpu_mask, mm_cpumask(mm));
273 cpumask_clear_cpu(smp_processor_id(), &cpu_mask);
274 if (!cpumask_empty(&cpu_mask))
275 xc2((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_page), (unsigned long) vma, page);
276 local_flush_tlb_page(vma, page);
277 }
278}
279
280void smp_flush_page_to_ram(unsigned long page)
281{
282 /* Current theory is that those who call this are the one's
283 * who have just dirtied their cache with the pages contents
284 * in kernel space, therefore we only run this on local cpu.
285 *
286 * XXX This experiment failed, research further... -DaveM
287 */
288#if 1
289 xc1((smpfunc_t) BTFIXUP_CALL(local_flush_page_to_ram), page);
290#endif
291 local_flush_page_to_ram(page);
292}
293
294void smp_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr)
295{
296 cpumask_t cpu_mask;
297 cpumask_copy(&cpu_mask, mm_cpumask(mm));
298 cpumask_clear_cpu(smp_processor_id(), &cpu_mask);
299 if (!cpumask_empty(&cpu_mask))
300 xc2((smpfunc_t) BTFIXUP_CALL(local_flush_sig_insns), (unsigned long) mm, insn_addr);
301 local_flush_sig_insns(mm, insn_addr);
302}
303
304extern unsigned int lvl14_resolution;
305
306/* /proc/profile writes can call this, don't __init it please. */
307static DEFINE_SPINLOCK(prof_setup_lock);
308
309int setup_profiling_timer(unsigned int multiplier) 176int setup_profiling_timer(unsigned int multiplier)
310{ 177{
311 int i; 178 return -EINVAL;
312 unsigned long flags;
313
314 /* Prevent level14 ticker IRQ flooding. */
315 if((!multiplier) || (lvl14_resolution / multiplier) < 500)
316 return -EINVAL;
317
318 spin_lock_irqsave(&prof_setup_lock, flags);
319 for_each_possible_cpu(i) {
320 load_profile_irq(i, lvl14_resolution / multiplier);
321 prof_multiplier(i) = multiplier;
322 }
323 spin_unlock_irqrestore(&prof_setup_lock, flags);
324
325 return 0;
326} 179}
327 180
328void __init smp_prepare_cpus(unsigned int max_cpus) 181void __init smp_prepare_cpus(unsigned int max_cpus)
@@ -345,14 +198,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
345 smp_store_cpu_info(boot_cpu_id); 198 smp_store_cpu_info(boot_cpu_id);
346 199
347 switch(sparc_cpu_model) { 200 switch(sparc_cpu_model) {
348 case sun4:
349 printk("SUN4\n");
350 BUG();
351 break;
352 case sun4c:
353 printk("SUN4C\n");
354 BUG();
355 break;
356 case sun4m: 201 case sun4m:
357 smp4m_boot_cpus(); 202 smp4m_boot_cpus();
358 break; 203 break;
@@ -411,29 +256,21 @@ void __init smp_prepare_boot_cpu(void)
411 set_cpu_possible(cpuid, true); 256 set_cpu_possible(cpuid, true);
412} 257}
413 258
414int __cpuinit __cpu_up(unsigned int cpu) 259int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
415{ 260{
416 extern int __cpuinit smp4m_boot_one_cpu(int); 261 extern int __cpuinit smp4m_boot_one_cpu(int, struct task_struct *);
417 extern int __cpuinit smp4d_boot_one_cpu(int); 262 extern int __cpuinit smp4d_boot_one_cpu(int, struct task_struct *);
418 int ret=0; 263 int ret=0;
419 264
420 switch(sparc_cpu_model) { 265 switch(sparc_cpu_model) {
421 case sun4:
422 printk("SUN4\n");
423 BUG();
424 break;
425 case sun4c:
426 printk("SUN4C\n");
427 BUG();
428 break;
429 case sun4m: 266 case sun4m:
430 ret = smp4m_boot_one_cpu(cpu); 267 ret = smp4m_boot_one_cpu(cpu, tidle);
431 break; 268 break;
432 case sun4d: 269 case sun4d:
433 ret = smp4d_boot_one_cpu(cpu); 270 ret = smp4d_boot_one_cpu(cpu, tidle);
434 break; 271 break;
435 case sparc_leon: 272 case sparc_leon:
436 ret = leon_boot_one_cpu(cpu); 273 ret = leon_boot_one_cpu(cpu, tidle);
437 break; 274 break;
438 case sun4e: 275 case sun4e:
439 printk("SUN4E\n"); 276 printk("SUN4E\n");
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 3b1bd7c50164..f591598d92f6 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -343,21 +343,17 @@ extern unsigned long sparc64_cpu_startup;
343 */ 343 */
344static struct thread_info *cpu_new_thread = NULL; 344static struct thread_info *cpu_new_thread = NULL;
345 345
346static int __cpuinit smp_boot_one_cpu(unsigned int cpu) 346static int __cpuinit smp_boot_one_cpu(unsigned int cpu, struct task_struct *idle)
347{ 347{
348 unsigned long entry = 348 unsigned long entry =
349 (unsigned long)(&sparc64_cpu_startup); 349 (unsigned long)(&sparc64_cpu_startup);
350 unsigned long cookie = 350 unsigned long cookie =
351 (unsigned long)(&cpu_new_thread); 351 (unsigned long)(&cpu_new_thread);
352 struct task_struct *p;
353 void *descr = NULL; 352 void *descr = NULL;
354 int timeout, ret; 353 int timeout, ret;
355 354
356 p = fork_idle(cpu);
357 if (IS_ERR(p))
358 return PTR_ERR(p);
359 callin_flag = 0; 355 callin_flag = 0;
360 cpu_new_thread = task_thread_info(p); 356 cpu_new_thread = task_thread_info(idle);
361 357
362 if (tlb_type == hypervisor) { 358 if (tlb_type == hypervisor) {
363#if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU) 359#if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU)
@@ -1227,9 +1223,9 @@ void __devinit smp_fill_in_sib_core_maps(void)
1227 } 1223 }
1228} 1224}
1229 1225
1230int __cpuinit __cpu_up(unsigned int cpu) 1226int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
1231{ 1227{
1232 int ret = smp_boot_one_cpu(cpu); 1228 int ret = smp_boot_one_cpu(cpu, tidle);
1233 1229
1234 if (!ret) { 1230 if (!ret) {
1235 cpumask_set_cpu(cpu, &smp_commenced_mask); 1231 cpumask_set_cpu(cpu, &smp_commenced_mask);
diff --git a/arch/sparc/kernel/sparc_ksyms_32.c b/arch/sparc/kernel/sparc_ksyms_32.c
index baeab8720237..e521c54560f9 100644
--- a/arch/sparc/kernel/sparc_ksyms_32.c
+++ b/arch/sparc/kernel/sparc_ksyms_32.c
@@ -28,19 +28,5 @@ EXPORT_SYMBOL(__ndelay);
28EXPORT_SYMBOL(__ret_efault); 28EXPORT_SYMBOL(__ret_efault);
29EXPORT_SYMBOL(empty_zero_page); 29EXPORT_SYMBOL(empty_zero_page);
30 30
31/* Defined using magic */
32#ifndef CONFIG_SMP
33EXPORT_SYMBOL(BTFIXUP_CALL(___xchg32));
34#else
35EXPORT_SYMBOL(BTFIXUP_CALL(__hard_smp_processor_id));
36#endif
37EXPORT_SYMBOL(BTFIXUP_CALL(mmu_unlockarea));
38EXPORT_SYMBOL(BTFIXUP_CALL(mmu_lockarea));
39EXPORT_SYMBOL(BTFIXUP_CALL(mmu_get_scsi_sgl));
40EXPORT_SYMBOL(BTFIXUP_CALL(mmu_get_scsi_one));
41EXPORT_SYMBOL(BTFIXUP_CALL(mmu_release_scsi_sgl));
42EXPORT_SYMBOL(BTFIXUP_CALL(mmu_release_scsi_one));
43EXPORT_SYMBOL(BTFIXUP_CALL(pgprot_noncached));
44
45/* Exporting a symbol from /init/main.c */ 31/* Exporting a symbol from /init/main.c */
46EXPORT_SYMBOL(saved_command_line); 32EXPORT_SYMBOL(saved_command_line);
diff --git a/arch/sparc/kernel/sun4c_irq.c b/arch/sparc/kernel/sun4c_irq.c
deleted file mode 100644
index f6bf25a2ff80..000000000000
--- a/arch/sparc/kernel/sun4c_irq.c
+++ /dev/null
@@ -1,264 +0,0 @@
1/*
2 * sun4c irq support
3 *
4 * djhr: Hacked out of irq.c into a CPU dependent version.
5 *
6 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
7 * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx)
8 * Copyright (C) 1995 Pete A. Zaitcev (zaitcev@yahoo.com)
9 * Copyright (C) 1996 Dave Redman (djhr@tadpole.co.uk)
10 */
11
12#include <linux/init.h>
13
14#include <asm/oplib.h>
15#include <asm/timer.h>
16#include <asm/irq.h>
17#include <asm/io.h>
18
19#include "irq.h"
20
21/* Sun4c interrupts are typically laid out as follows:
22 *
23 * 1 - Software interrupt, SBUS level 1
24 * 2 - SBUS level 2
25 * 3 - ESP SCSI, SBUS level 3
26 * 4 - Software interrupt
27 * 5 - Lance ethernet, SBUS level 4
28 * 6 - Software interrupt
29 * 7 - Graphics card, SBUS level 5
30 * 8 - SBUS level 6
31 * 9 - SBUS level 7
32 * 10 - Counter timer
33 * 11 - Floppy
34 * 12 - Zilog uart
35 * 13 - CS4231 audio
36 * 14 - Profiling timer
37 * 15 - NMI
38 *
39 * The interrupt enable bits in the interrupt mask register are
40 * really only used to enable/disable the timer interrupts, and
41 * for signalling software interrupts. There is also a master
42 * interrupt enable bit in this register.
43 *
44 * Interrupts are enabled by setting the SUN4C_INT_* bits, they
45 * are disabled by clearing those bits.
46 */
47
48/*
49 * Bit field defines for the interrupt registers on various
50 * Sparc machines.
51 */
52
53/* The sun4c interrupt register. */
54#define SUN4C_INT_ENABLE 0x01 /* Allow interrupts. */
55#define SUN4C_INT_E14 0x80 /* Enable level 14 IRQ. */
56#define SUN4C_INT_E10 0x20 /* Enable level 10 IRQ. */
57#define SUN4C_INT_E8 0x10 /* Enable level 8 IRQ. */
58#define SUN4C_INT_E6 0x08 /* Enable level 6 IRQ. */
59#define SUN4C_INT_E4 0x04 /* Enable level 4 IRQ. */
60#define SUN4C_INT_E1 0x02 /* Enable level 1 IRQ. */
61
62/*
63 * Pointer to the interrupt enable byte
64 * Used by entry.S
65 */
66unsigned char __iomem *interrupt_enable;
67
68static void sun4c_mask_irq(struct irq_data *data)
69{
70 unsigned long mask = (unsigned long)data->chip_data;
71
72 if (mask) {
73 unsigned long flags;
74
75 local_irq_save(flags);
76 mask = sbus_readb(interrupt_enable) & ~mask;
77 sbus_writeb(mask, interrupt_enable);
78 local_irq_restore(flags);
79 }
80}
81
82static void sun4c_unmask_irq(struct irq_data *data)
83{
84 unsigned long mask = (unsigned long)data->chip_data;
85
86 if (mask) {
87 unsigned long flags;
88
89 local_irq_save(flags);
90 mask = sbus_readb(interrupt_enable) | mask;
91 sbus_writeb(mask, interrupt_enable);
92 local_irq_restore(flags);
93 }
94}
95
96static unsigned int sun4c_startup_irq(struct irq_data *data)
97{
98 irq_link(data->irq);
99 sun4c_unmask_irq(data);
100
101 return 0;
102}
103
104static void sun4c_shutdown_irq(struct irq_data *data)
105{
106 sun4c_mask_irq(data);
107 irq_unlink(data->irq);
108}
109
110static struct irq_chip sun4c_irq = {
111 .name = "sun4c",
112 .irq_startup = sun4c_startup_irq,
113 .irq_shutdown = sun4c_shutdown_irq,
114 .irq_mask = sun4c_mask_irq,
115 .irq_unmask = sun4c_unmask_irq,
116};
117
118static unsigned int sun4c_build_device_irq(struct platform_device *op,
119 unsigned int real_irq)
120{
121 unsigned int irq;
122
123 if (real_irq >= 16) {
124 prom_printf("Bogus sun4c IRQ %u\n", real_irq);
125 prom_halt();
126 }
127
128 irq = irq_alloc(real_irq, real_irq);
129 if (irq) {
130 unsigned long mask = 0UL;
131
132 switch (real_irq) {
133 case 1:
134 mask = SUN4C_INT_E1;
135 break;
136 case 8:
137 mask = SUN4C_INT_E8;
138 break;
139 case 10:
140 mask = SUN4C_INT_E10;
141 break;
142 case 14:
143 mask = SUN4C_INT_E14;
144 break;
145 default:
146 /* All the rest are either always enabled,
147 * or are for signalling software interrupts.
148 */
149 break;
150 }
151 irq_set_chip_and_handler_name(irq, &sun4c_irq,
152 handle_level_irq, "level");
153 irq_set_chip_data(irq, (void *)mask);
154 }
155 return irq;
156}
157
158struct sun4c_timer_info {
159 u32 l10_count;
160 u32 l10_limit;
161 u32 l14_count;
162 u32 l14_limit;
163};
164
165static struct sun4c_timer_info __iomem *sun4c_timers;
166
167static void sun4c_clear_clock_irq(void)
168{
169 sbus_readl(&sun4c_timers->l10_limit);
170}
171
172static void sun4c_load_profile_irq(int cpu, unsigned int limit)
173{
174 /* Errm.. not sure how to do this.. */
175}
176
177static void __init sun4c_init_timers(irq_handler_t counter_fn)
178{
179 const struct linux_prom_irqs *prom_irqs;
180 struct device_node *dp;
181 unsigned int irq;
182 const u32 *addr;
183 int err;
184
185 dp = of_find_node_by_name(NULL, "counter-timer");
186 if (!dp) {
187 prom_printf("sun4c_init_timers: Unable to find counter-timer\n");
188 prom_halt();
189 }
190
191 addr = of_get_property(dp, "address", NULL);
192 if (!addr) {
193 prom_printf("sun4c_init_timers: No address property\n");
194 prom_halt();
195 }
196
197 sun4c_timers = (void __iomem *) (unsigned long) addr[0];
198
199 prom_irqs = of_get_property(dp, "intr", NULL);
200 of_node_put(dp);
201 if (!prom_irqs) {
202 prom_printf("sun4c_init_timers: No intr property\n");
203 prom_halt();
204 }
205
206 /* Have the level 10 timer tick at 100HZ. We don't touch the
207 * level 14 timer limit since we are letting the prom handle
208 * them until we have a real console driver so L1-A works.
209 */
210 sbus_writel((((1000000/HZ) + 1) << 10), &sun4c_timers->l10_limit);
211
212 master_l10_counter = &sun4c_timers->l10_count;
213
214 irq = sun4c_build_device_irq(NULL, prom_irqs[0].pri);
215 err = request_irq(irq, counter_fn, IRQF_TIMER, "timer", NULL);
216 if (err) {
217 prom_printf("sun4c_init_timers: request_irq() fails with %d\n", err);
218 prom_halt();
219 }
220
221 /* disable timer interrupt */
222 sun4c_mask_irq(irq_get_irq_data(irq));
223}
224
225#ifdef CONFIG_SMP
226static void sun4c_nop(void)
227{
228}
229#endif
230
231void __init sun4c_init_IRQ(void)
232{
233 struct device_node *dp;
234 const u32 *addr;
235
236 dp = of_find_node_by_name(NULL, "interrupt-enable");
237 if (!dp) {
238 prom_printf("sun4c_init_IRQ: Unable to find interrupt-enable\n");
239 prom_halt();
240 }
241
242 addr = of_get_property(dp, "address", NULL);
243 of_node_put(dp);
244 if (!addr) {
245 prom_printf("sun4c_init_IRQ: No address property\n");
246 prom_halt();
247 }
248
249 interrupt_enable = (void __iomem *) (unsigned long) addr[0];
250
251 BTFIXUPSET_CALL(clear_clock_irq, sun4c_clear_clock_irq, BTFIXUPCALL_NORM);
252 BTFIXUPSET_CALL(load_profile_irq, sun4c_load_profile_irq, BTFIXUPCALL_NOP);
253
254 sparc_irq_config.init_timers = sun4c_init_timers;
255 sparc_irq_config.build_device_irq = sun4c_build_device_irq;
256
257#ifdef CONFIG_SMP
258 BTFIXUPSET_CALL(set_cpu_int, sun4c_nop, BTFIXUPCALL_NOP);
259 BTFIXUPSET_CALL(clear_cpu_int, sun4c_nop, BTFIXUPCALL_NOP);
260 BTFIXUPSET_CALL(set_irq_udt, sun4c_nop, BTFIXUPCALL_NOP);
261#endif
262 sbus_writeb(SUN4C_INT_ENABLE, interrupt_enable);
263 /* Cannot enable interrupts until OBP ticker is disabled. */
264}
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c
index 1d13c5bda0b1..e490ac9327c7 100644
--- a/arch/sparc/kernel/sun4d_irq.c
+++ b/arch/sparc/kernel/sun4d_irq.c
@@ -15,6 +15,7 @@
15#include <asm/sbi.h> 15#include <asm/sbi.h>
16#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
17#include <asm/setup.h> 17#include <asm/setup.h>
18#include <asm/oplib.h>
18 19
19#include "kernel.h" 20#include "kernel.h"
20#include "irq.h" 21#include "irq.h"
@@ -243,19 +244,6 @@ struct irq_chip sun4d_irq = {
243}; 244};
244 245
245#ifdef CONFIG_SMP 246#ifdef CONFIG_SMP
246static void sun4d_set_cpu_int(int cpu, int level)
247{
248 sun4d_send_ipi(cpu, level);
249}
250
251static void sun4d_clear_ipi(int cpu, int level)
252{
253}
254
255static void sun4d_set_udt(int cpu)
256{
257}
258
259/* Setup IRQ distribution scheme. */ 247/* Setup IRQ distribution scheme. */
260void __init sun4d_distribute_irqs(void) 248void __init sun4d_distribute_irqs(void)
261{ 249{
@@ -282,7 +270,8 @@ static void sun4d_clear_clock_irq(void)
282 270
283static void sun4d_load_profile_irq(int cpu, unsigned int limit) 271static void sun4d_load_profile_irq(int cpu, unsigned int limit)
284{ 272{
285 bw_set_prof_limit(cpu, limit); 273 unsigned int value = limit ? timer_value(limit) : 0;
274 bw_set_prof_limit(cpu, value);
286} 275}
287 276
288static void __init sun4d_load_profile_irqs(void) 277static void __init sun4d_load_profile_irqs(void)
@@ -418,12 +407,12 @@ static void __init sun4d_fixup_trap_table(void)
418 trap_table->inst_two = lvl14_save[1]; 407 trap_table->inst_two = lvl14_save[1];
419 trap_table->inst_three = lvl14_save[2]; 408 trap_table->inst_three = lvl14_save[2];
420 trap_table->inst_four = lvl14_save[3]; 409 trap_table->inst_four = lvl14_save[3];
421 local_flush_cache_all(); 410 local_ops->cache_all();
422 local_irq_restore(flags); 411 local_irq_restore(flags);
423#endif 412#endif
424} 413}
425 414
426static void __init sun4d_init_timers(irq_handler_t counter_fn) 415static void __init sun4d_init_timers(void)
427{ 416{
428 struct device_node *dp; 417 struct device_node *dp;
429 struct resource res; 418 struct resource res;
@@ -466,12 +455,20 @@ static void __init sun4d_init_timers(irq_handler_t counter_fn)
466 prom_halt(); 455 prom_halt();
467 } 456 }
468 457
469 sbus_writel((((1000000/HZ) + 1) << 10), &sun4d_timers->l10_timer_limit); 458#ifdef CONFIG_SMP
459 sparc_config.cs_period = SBUS_CLOCK_RATE * 2; /* 2 seconds */
460#else
461 sparc_config.cs_period = SBUS_CLOCK_RATE / HZ; /* 1/HZ sec */
462 sparc_config.features |= FEAT_L10_CLOCKEVENT;
463#endif
464 sparc_config.features |= FEAT_L10_CLOCKSOURCE;
465 sbus_writel(timer_value(sparc_config.cs_period),
466 &sun4d_timers->l10_timer_limit);
470 467
471 master_l10_counter = &sun4d_timers->l10_cur_count; 468 master_l10_counter = &sun4d_timers->l10_cur_count;
472 469
473 irq = sun4d_build_timer_irq(board, SUN4D_TIMER_IRQ); 470 irq = sun4d_build_timer_irq(board, SUN4D_TIMER_IRQ);
474 err = request_irq(irq, counter_fn, IRQF_TIMER, "timer", NULL); 471 err = request_irq(irq, timer_interrupt, IRQF_TIMER, "timer", NULL);
475 if (err) { 472 if (err) {
476 prom_printf("sun4d_init_timers: request_irq() failed with %d\n", 473 prom_printf("sun4d_init_timers: request_irq() failed with %d\n",
477 err); 474 err);
@@ -509,16 +506,11 @@ void __init sun4d_init_IRQ(void)
509{ 506{
510 local_irq_disable(); 507 local_irq_disable();
511 508
512 BTFIXUPSET_CALL(clear_clock_irq, sun4d_clear_clock_irq, BTFIXUPCALL_NORM); 509 sparc_config.init_timers = sun4d_init_timers;
513 BTFIXUPSET_CALL(load_profile_irq, sun4d_load_profile_irq, BTFIXUPCALL_NORM); 510 sparc_config.build_device_irq = sun4d_build_device_irq;
511 sparc_config.clock_rate = SBUS_CLOCK_RATE;
512 sparc_config.clear_clock_irq = sun4d_clear_clock_irq;
513 sparc_config.load_profile_irq = sun4d_load_profile_irq;
514 514
515 sparc_irq_config.init_timers = sun4d_init_timers;
516 sparc_irq_config.build_device_irq = sun4d_build_device_irq;
517
518#ifdef CONFIG_SMP
519 BTFIXUPSET_CALL(set_cpu_int, sun4d_set_cpu_int, BTFIXUPCALL_NORM);
520 BTFIXUPSET_CALL(clear_cpu_int, sun4d_clear_ipi, BTFIXUPCALL_NOP);
521 BTFIXUPSET_CALL(set_irq_udt, sun4d_set_udt, BTFIXUPCALL_NOP);
522#endif
523 /* Cannot enable interrupts until OBP ticker is disabled. */ 515 /* Cannot enable interrupts until OBP ticker is disabled. */
524} 516}
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c
index 540b2fec09f0..ddaea31de586 100644
--- a/arch/sparc/kernel/sun4d_smp.c
+++ b/arch/sparc/kernel/sun4d_smp.c
@@ -6,16 +6,20 @@
6 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 6 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
7 */ 7 */
8 8
9#include <linux/clockchips.h>
9#include <linux/interrupt.h> 10#include <linux/interrupt.h>
10#include <linux/profile.h> 11#include <linux/profile.h>
11#include <linux/delay.h> 12#include <linux/delay.h>
13#include <linux/sched.h>
12#include <linux/cpu.h> 14#include <linux/cpu.h>
13 15
16#include <asm/cacheflush.h>
17#include <asm/switch_to.h>
18#include <asm/tlbflush.h>
19#include <asm/timer.h>
20#include <asm/oplib.h>
14#include <asm/sbi.h> 21#include <asm/sbi.h>
15#include <asm/mmu.h> 22#include <asm/mmu.h>
16#include <asm/tlbflush.h>
17#include <asm/switch_to.h>
18#include <asm/cacheflush.h>
19 23
20#include "kernel.h" 24#include "kernel.h"
21#include "irq.h" 25#include "irq.h"
@@ -34,7 +38,6 @@ static inline unsigned long sun4d_swap(volatile unsigned long *ptr, unsigned lon
34} 38}
35 39
36static void smp4d_ipi_init(void); 40static void smp4d_ipi_init(void);
37static void smp_setup_percpu_timer(void);
38 41
39static unsigned char cpu_leds[32]; 42static unsigned char cpu_leds[32];
40 43
@@ -49,7 +52,7 @@ static inline void show_leds(int cpuid)
49 52
50void __cpuinit smp4d_callin(void) 53void __cpuinit smp4d_callin(void)
51{ 54{
52 int cpuid = hard_smp4d_processor_id(); 55 int cpuid = hard_smp_processor_id();
53 unsigned long flags; 56 unsigned long flags;
54 57
55 /* Show we are alive */ 58 /* Show we are alive */
@@ -59,8 +62,8 @@ void __cpuinit smp4d_callin(void)
59 /* Enable level15 interrupt, disable level14 interrupt for now */ 62 /* Enable level15 interrupt, disable level14 interrupt for now */
60 cc_set_imsk((cc_get_imsk() & ~0x8000) | 0x4000); 63 cc_set_imsk((cc_get_imsk() & ~0x8000) | 0x4000);
61 64
62 local_flush_cache_all(); 65 local_ops->cache_all();
63 local_flush_tlb_all(); 66 local_ops->tlb_all();
64 67
65 notify_cpu_starting(cpuid); 68 notify_cpu_starting(cpuid);
66 /* 69 /*
@@ -70,17 +73,17 @@ void __cpuinit smp4d_callin(void)
70 * to call the scheduler code. 73 * to call the scheduler code.
71 */ 74 */
72 /* Get our local ticker going. */ 75 /* Get our local ticker going. */
73 smp_setup_percpu_timer(); 76 register_percpu_ce(cpuid);
74 77
75 calibrate_delay(); 78 calibrate_delay();
76 smp_store_cpu_info(cpuid); 79 smp_store_cpu_info(cpuid);
77 local_flush_cache_all(); 80 local_ops->cache_all();
78 local_flush_tlb_all(); 81 local_ops->tlb_all();
79 82
80 /* Allow master to continue. */ 83 /* Allow master to continue. */
81 sun4d_swap((unsigned long *)&cpu_callin_map[cpuid], 1); 84 sun4d_swap((unsigned long *)&cpu_callin_map[cpuid], 1);
82 local_flush_cache_all(); 85 local_ops->cache_all();
83 local_flush_tlb_all(); 86 local_ops->tlb_all();
84 87
85 while ((unsigned long)current_set[cpuid] < PAGE_OFFSET) 88 while ((unsigned long)current_set[cpuid] < PAGE_OFFSET)
86 barrier(); 89 barrier();
@@ -100,8 +103,8 @@ void __cpuinit smp4d_callin(void)
100 atomic_inc(&init_mm.mm_count); 103 atomic_inc(&init_mm.mm_count);
101 current->active_mm = &init_mm; 104 current->active_mm = &init_mm;
102 105
103 local_flush_cache_all(); 106 local_ops->cache_all();
104 local_flush_tlb_all(); 107 local_ops->tlb_all();
105 108
106 local_irq_enable(); /* We don't allow PIL 14 yet */ 109 local_irq_enable(); /* We don't allow PIL 14 yet */
107 110
@@ -123,22 +126,17 @@ void __init smp4d_boot_cpus(void)
123 smp4d_ipi_init(); 126 smp4d_ipi_init();
124 if (boot_cpu_id) 127 if (boot_cpu_id)
125 current_set[0] = NULL; 128 current_set[0] = NULL;
126 smp_setup_percpu_timer(); 129 local_ops->cache_all();
127 local_flush_cache_all();
128} 130}
129 131
130int __cpuinit smp4d_boot_one_cpu(int i) 132int __cpuinit smp4d_boot_one_cpu(int i, struct task_struct *idle)
131{ 133{
132 unsigned long *entry = &sun4d_cpu_startup; 134 unsigned long *entry = &sun4d_cpu_startup;
133 struct task_struct *p;
134 int timeout; 135 int timeout;
135 int cpu_node; 136 int cpu_node;
136 137
137 cpu_find_by_instance(i, &cpu_node, NULL); 138 cpu_find_by_instance(i, &cpu_node, NULL);
138 /* Cook up an idler for this guy. */ 139 current_set[i] = task_thread_info(idle);
139 p = fork_idle(i);
140 current_set[i] = task_thread_info(p);
141
142 /* 140 /*
143 * Initialize the contexts table 141 * Initialize the contexts table
144 * Since the call to prom_startcpu() trashes the structure, 142 * Since the call to prom_startcpu() trashes the structure,
@@ -150,7 +148,7 @@ int __cpuinit smp4d_boot_one_cpu(int i)
150 148
151 /* whirrr, whirrr, whirrrrrrrrr... */ 149 /* whirrr, whirrr, whirrrrrrrrr... */
152 printk(KERN_INFO "Starting CPU %d at %p\n", i, entry); 150 printk(KERN_INFO "Starting CPU %d at %p\n", i, entry);
153 local_flush_cache_all(); 151 local_ops->cache_all();
154 prom_startcpu(cpu_node, 152 prom_startcpu(cpu_node,
155 &smp_penguin_ctable, 0, (char *)entry); 153 &smp_penguin_ctable, 0, (char *)entry);
156 154
@@ -168,7 +166,7 @@ int __cpuinit smp4d_boot_one_cpu(int i)
168 return -ENODEV; 166 return -ENODEV;
169 167
170 } 168 }
171 local_flush_cache_all(); 169 local_ops->cache_all();
172 return 0; 170 return 0;
173} 171}
174 172
@@ -185,7 +183,7 @@ void __init smp4d_smp_done(void)
185 prev = &cpu_data(i).next; 183 prev = &cpu_data(i).next;
186 } 184 }
187 *prev = first; 185 *prev = first;
188 local_flush_cache_all(); 186 local_ops->cache_all();
189 187
190 /* Ok, they are spinning and ready to go. */ 188 /* Ok, they are spinning and ready to go. */
191 smp_processors_ready = 1; 189 smp_processors_ready = 1;
@@ -233,7 +231,20 @@ void sun4d_ipi_interrupt(void)
233 } 231 }
234} 232}
235 233
236static void smp4d_ipi_single(int cpu) 234/* +-------+-------------+-----------+------------------------------------+
235 * | bcast | devid | sid | levels mask |
236 * +-------+-------------+-----------+------------------------------------+
237 * 31 30 23 22 15 14 0
238 */
239#define IGEN_MESSAGE(bcast, devid, sid, levels) \
240 (((bcast) << 31) | ((devid) << 23) | ((sid) << 15) | (levels))
241
242static void sun4d_send_ipi(int cpu, int level)
243{
244 cc_set_igen(IGEN_MESSAGE(0, cpu << 3, 6 + ((level >> 1) & 7), 1 << (level - 1)));
245}
246
247static void sun4d_ipi_single(int cpu)
237{ 248{
238 struct sun4d_ipi_work *work = &per_cpu(sun4d_ipi_work, cpu); 249 struct sun4d_ipi_work *work = &per_cpu(sun4d_ipi_work, cpu);
239 250
@@ -244,7 +255,7 @@ static void smp4d_ipi_single(int cpu)
244 sun4d_send_ipi(cpu, SUN4D_IPI_IRQ); 255 sun4d_send_ipi(cpu, SUN4D_IPI_IRQ);
245} 256}
246 257
247static void smp4d_ipi_mask_one(int cpu) 258static void sun4d_ipi_mask_one(int cpu)
248{ 259{
249 struct sun4d_ipi_work *work = &per_cpu(sun4d_ipi_work, cpu); 260 struct sun4d_ipi_work *work = &per_cpu(sun4d_ipi_work, cpu);
250 261
@@ -255,7 +266,7 @@ static void smp4d_ipi_mask_one(int cpu)
255 sun4d_send_ipi(cpu, SUN4D_IPI_IRQ); 266 sun4d_send_ipi(cpu, SUN4D_IPI_IRQ);
256} 267}
257 268
258static void smp4d_ipi_resched(int cpu) 269static void sun4d_ipi_resched(int cpu)
259{ 270{
260 struct sun4d_ipi_work *work = &per_cpu(sun4d_ipi_work, cpu); 271 struct sun4d_ipi_work *work = &per_cpu(sun4d_ipi_work, cpu);
261 272
@@ -280,7 +291,7 @@ static struct smp_funcall {
280static DEFINE_SPINLOCK(cross_call_lock); 291static DEFINE_SPINLOCK(cross_call_lock);
281 292
282/* Cross calls must be serialized, at least currently. */ 293/* Cross calls must be serialized, at least currently. */
283static void smp4d_cross_call(smpfunc_t func, cpumask_t mask, unsigned long arg1, 294static void sun4d_cross_call(smpfunc_t func, cpumask_t mask, unsigned long arg1,
284 unsigned long arg2, unsigned long arg3, 295 unsigned long arg2, unsigned long arg3,
285 unsigned long arg4) 296 unsigned long arg4)
286{ 297{
@@ -352,7 +363,7 @@ static void smp4d_cross_call(smpfunc_t func, cpumask_t mask, unsigned long arg1,
352/* Running cross calls. */ 363/* Running cross calls. */
353void smp4d_cross_call_irq(void) 364void smp4d_cross_call_irq(void)
354{ 365{
355 int i = hard_smp4d_processor_id(); 366 int i = hard_smp_processor_id();
356 367
357 ccall_info.processors_in[i] = 1; 368 ccall_info.processors_in[i] = 1;
358 ccall_info.func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3, 369 ccall_info.func(ccall_info.arg1, ccall_info.arg2, ccall_info.arg3,
@@ -363,7 +374,8 @@ void smp4d_cross_call_irq(void)
363void smp4d_percpu_timer_interrupt(struct pt_regs *regs) 374void smp4d_percpu_timer_interrupt(struct pt_regs *regs)
364{ 375{
365 struct pt_regs *old_regs; 376 struct pt_regs *old_regs;
366 int cpu = hard_smp4d_processor_id(); 377 int cpu = hard_smp_processor_id();
378 struct clock_event_device *ce;
367 static int cpu_tick[NR_CPUS]; 379 static int cpu_tick[NR_CPUS];
368 static char led_mask[] = { 0xe, 0xd, 0xb, 0x7, 0xb, 0xd }; 380 static char led_mask[] = { 0xe, 0xd, 0xb, 0x7, 0xb, 0xd };
369 381
@@ -379,45 +391,21 @@ void smp4d_percpu_timer_interrupt(struct pt_regs *regs)
379 show_leds(cpu); 391 show_leds(cpu);
380 } 392 }
381 393
382 profile_tick(CPU_PROFILING); 394 ce = &per_cpu(sparc32_clockevent, cpu);
383
384 if (!--prof_counter(cpu)) {
385 int user = user_mode(regs);
386 395
387 irq_enter(); 396 irq_enter();
388 update_process_times(user); 397 ce->event_handler(ce);
389 irq_exit(); 398 irq_exit();
390 399
391 prof_counter(cpu) = prof_multiplier(cpu);
392 }
393 set_irq_regs(old_regs); 400 set_irq_regs(old_regs);
394} 401}
395 402
396static void __cpuinit smp_setup_percpu_timer(void) 403static const struct sparc32_ipi_ops sun4d_ipi_ops = {
397{ 404 .cross_call = sun4d_cross_call,
398 int cpu = hard_smp4d_processor_id(); 405 .resched = sun4d_ipi_resched,
399 406 .single = sun4d_ipi_single,
400 prof_counter(cpu) = prof_multiplier(cpu) = 1; 407 .mask_one = sun4d_ipi_mask_one,
401 load_profile_irq(cpu, lvl14_resolution); 408};
402}
403
404void __init smp4d_blackbox_id(unsigned *addr)
405{
406 int rd = *addr & 0x3e000000;
407
408 addr[0] = 0xc0800800 | rd; /* lda [%g0] ASI_M_VIKING_TMP1, reg */
409 addr[1] = 0x01000000; /* nop */
410 addr[2] = 0x01000000; /* nop */
411}
412
413void __init smp4d_blackbox_current(unsigned *addr)
414{
415 int rd = *addr & 0x3e000000;
416
417 addr[0] = 0xc0800800 | rd; /* lda [%g0] ASI_M_VIKING_TMP1, reg */
418 addr[2] = 0x81282002 | rd | (rd >> 11); /* sll reg, 2, reg */
419 addr[4] = 0x01000000; /* nop */
420}
421 409
422void __init sun4d_init_smp(void) 410void __init sun4d_init_smp(void)
423{ 411{
@@ -426,14 +414,7 @@ void __init sun4d_init_smp(void)
426 /* Patch ipi15 trap table */ 414 /* Patch ipi15 trap table */
427 t_nmi[1] = t_nmi[1] + (linux_trap_ipi15_sun4d - linux_trap_ipi15_sun4m); 415 t_nmi[1] = t_nmi[1] + (linux_trap_ipi15_sun4d - linux_trap_ipi15_sun4m);
428 416
429 /* And set btfixup... */ 417 sparc32_ipi_ops = &sun4d_ipi_ops;
430 BTFIXUPSET_BLACKBOX(hard_smp_processor_id, smp4d_blackbox_id);
431 BTFIXUPSET_BLACKBOX(load_current, smp4d_blackbox_current);
432 BTFIXUPSET_CALL(smp_cross_call, smp4d_cross_call, BTFIXUPCALL_NORM);
433 BTFIXUPSET_CALL(__hard_smp_processor_id, __smp4d_processor_id, BTFIXUPCALL_NORM);
434 BTFIXUPSET_CALL(smp_ipi_resched, smp4d_ipi_resched, BTFIXUPCALL_NORM);
435 BTFIXUPSET_CALL(smp_ipi_single, smp4d_ipi_single, BTFIXUPCALL_NORM);
436 BTFIXUPSET_CALL(smp_ipi_mask_one, smp4d_ipi_mask_one, BTFIXUPCALL_NORM);
437 418
438 for (i = 0; i < NR_CPUS; i++) { 419 for (i = 0; i < NR_CPUS; i++) {
439 ccall_info.processors_in[i] = 1; 420 ccall_info.processors_in[i] = 1;
diff --git a/arch/sparc/kernel/sun4m_irq.c b/arch/sparc/kernel/sun4m_irq.c
index e61165161dd3..c5ade9d27a1d 100644
--- a/arch/sparc/kernel/sun4m_irq.c
+++ b/arch/sparc/kernel/sun4m_irq.c
@@ -112,9 +112,6 @@ struct sun4m_handler_data {
112#define SUN4M_INT_E14 0x00000080 112#define SUN4M_INT_E14 0x00000080
113#define SUN4M_INT_E10 0x00080000 113#define SUN4M_INT_E10 0x00080000
114 114
115#define SUN4M_HARD_INT(x) (0x000000001 << (x))
116#define SUN4M_SOFT_INT(x) (0x000010000 << (x))
117
118#define SUN4M_INT_MASKALL 0x80000000 /* mask all interrupts */ 115#define SUN4M_INT_MASKALL 0x80000000 /* mask all interrupts */
119#define SUN4M_INT_MODULE_ERR 0x40000000 /* module error */ 116#define SUN4M_INT_MODULE_ERR 0x40000000 /* module error */
120#define SUN4M_INT_M2S_WRITE_ERR 0x20000000 /* write buffer error */ 117#define SUN4M_INT_M2S_WRITE_ERR 0x20000000 /* write buffer error */
@@ -282,23 +279,6 @@ out:
282 return irq; 279 return irq;
283} 280}
284 281
285#ifdef CONFIG_SMP
286static void sun4m_send_ipi(int cpu, int level)
287{
288 sbus_writel(SUN4M_SOFT_INT(level), &sun4m_irq_percpu[cpu]->set);
289}
290
291static void sun4m_clear_ipi(int cpu, int level)
292{
293 sbus_writel(SUN4M_SOFT_INT(level), &sun4m_irq_percpu[cpu]->clear);
294}
295
296static void sun4m_set_udt(int cpu)
297{
298 sbus_writel(cpu, &sun4m_irq_global->interrupt_target);
299}
300#endif
301
302struct sun4m_timer_percpu { 282struct sun4m_timer_percpu {
303 u32 l14_limit; 283 u32 l14_limit;
304 u32 l14_count; 284 u32 l14_count;
@@ -318,9 +298,6 @@ struct sun4m_timer_global {
318 298
319static struct sun4m_timer_global __iomem *timers_global; 299static struct sun4m_timer_global __iomem *timers_global;
320 300
321
322unsigned int lvl14_resolution = (((1000000/HZ) + 1) << 10);
323
324static void sun4m_clear_clock_irq(void) 301static void sun4m_clear_clock_irq(void)
325{ 302{
326 sbus_readl(&timers_global->l10_limit); 303 sbus_readl(&timers_global->l10_limit);
@@ -369,10 +346,11 @@ void sun4m_clear_profile_irq(int cpu)
369 346
370static void sun4m_load_profile_irq(int cpu, unsigned int limit) 347static void sun4m_load_profile_irq(int cpu, unsigned int limit)
371{ 348{
372 sbus_writel(limit, &timers_percpu[cpu]->l14_limit); 349 unsigned int value = limit ? timer_value(limit) : 0;
350 sbus_writel(value, &timers_percpu[cpu]->l14_limit);
373} 351}
374 352
375static void __init sun4m_init_timers(irq_handler_t counter_fn) 353static void __init sun4m_init_timers(void)
376{ 354{
377 struct device_node *dp = of_find_node_by_name(NULL, "counter"); 355 struct device_node *dp = of_find_node_by_name(NULL, "counter");
378 int i, err, len, num_cpu_timers; 356 int i, err, len, num_cpu_timers;
@@ -402,13 +380,22 @@ static void __init sun4m_init_timers(irq_handler_t counter_fn)
402 /* Every per-cpu timer works in timer mode */ 380 /* Every per-cpu timer works in timer mode */
403 sbus_writel(0x00000000, &timers_global->timer_config); 381 sbus_writel(0x00000000, &timers_global->timer_config);
404 382
405 sbus_writel((((1000000/HZ) + 1) << 10), &timers_global->l10_limit); 383#ifdef CONFIG_SMP
384 sparc_config.cs_period = SBUS_CLOCK_RATE * 2; /* 2 seconds */
385 sparc_config.features |= FEAT_L14_ONESHOT;
386#else
387 sparc_config.cs_period = SBUS_CLOCK_RATE / HZ; /* 1/HZ sec */
388 sparc_config.features |= FEAT_L10_CLOCKEVENT;
389#endif
390 sparc_config.features |= FEAT_L10_CLOCKSOURCE;
391 sbus_writel(timer_value(sparc_config.cs_period),
392 &timers_global->l10_limit);
406 393
407 master_l10_counter = &timers_global->l10_count; 394 master_l10_counter = &timers_global->l10_count;
408 395
409 irq = sun4m_build_device_irq(NULL, SUN4M_TIMER_IRQ); 396 irq = sun4m_build_device_irq(NULL, SUN4M_TIMER_IRQ);
410 397
411 err = request_irq(irq, counter_fn, IRQF_TIMER, "timer", NULL); 398 err = request_irq(irq, timer_interrupt, IRQF_TIMER, "timer", NULL);
412 if (err) { 399 if (err) {
413 printk(KERN_ERR "sun4m_init_timers: Register IRQ error %d.\n", 400 printk(KERN_ERR "sun4m_init_timers: Register IRQ error %d.\n",
414 err); 401 err);
@@ -434,7 +421,7 @@ static void __init sun4m_init_timers(irq_handler_t counter_fn)
434 trap_table->inst_two = lvl14_save[1]; 421 trap_table->inst_two = lvl14_save[1];
435 trap_table->inst_three = lvl14_save[2]; 422 trap_table->inst_three = lvl14_save[2];
436 trap_table->inst_four = lvl14_save[3]; 423 trap_table->inst_four = lvl14_save[3];
437 local_flush_cache_all(); 424 local_ops->cache_all();
438 local_irq_restore(flags); 425 local_irq_restore(flags);
439 } 426 }
440#endif 427#endif
@@ -475,17 +462,12 @@ void __init sun4m_init_IRQ(void)
475 if (num_cpu_iregs == 4) 462 if (num_cpu_iregs == 4)
476 sbus_writel(0, &sun4m_irq_global->interrupt_target); 463 sbus_writel(0, &sun4m_irq_global->interrupt_target);
477 464
478 BTFIXUPSET_CALL(clear_clock_irq, sun4m_clear_clock_irq, BTFIXUPCALL_NORM); 465 sparc_config.init_timers = sun4m_init_timers;
479 BTFIXUPSET_CALL(load_profile_irq, sun4m_load_profile_irq, BTFIXUPCALL_NORM); 466 sparc_config.build_device_irq = sun4m_build_device_irq;
480 467 sparc_config.clock_rate = SBUS_CLOCK_RATE;
481 sparc_irq_config.init_timers = sun4m_init_timers; 468 sparc_config.clear_clock_irq = sun4m_clear_clock_irq;
482 sparc_irq_config.build_device_irq = sun4m_build_device_irq; 469 sparc_config.load_profile_irq = sun4m_load_profile_irq;
483 470
484#ifdef CONFIG_SMP
485 BTFIXUPSET_CALL(set_cpu_int, sun4m_send_ipi, BTFIXUPCALL_NORM);
486 BTFIXUPSET_CALL(clear_cpu_int, sun4m_clear_ipi, BTFIXUPCALL_NORM);
487 BTFIXUPSET_CALL(set_irq_udt, sun4m_set_udt, BTFIXUPCALL_NORM);
488#endif
489 471
490 /* Cannot enable interrupts until OBP ticker is disabled. */ 472 /* Cannot enable interrupts until OBP ticker is disabled. */
491} 473}
diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c
index 02db9a0412ce..128af7304288 100644
--- a/arch/sparc/kernel/sun4m_smp.c
+++ b/arch/sparc/kernel/sun4m_smp.c
@@ -4,14 +4,18 @@
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
5 */ 5 */
6 6
7#include <linux/clockchips.h>
7#include <linux/interrupt.h> 8#include <linux/interrupt.h>
8#include <linux/profile.h> 9#include <linux/profile.h>
9#include <linux/delay.h> 10#include <linux/delay.h>
11#include <linux/sched.h>
10#include <linux/cpu.h> 12#include <linux/cpu.h>
11 13
12#include <asm/cacheflush.h> 14#include <asm/cacheflush.h>
13#include <asm/switch_to.h> 15#include <asm/switch_to.h>
14#include <asm/tlbflush.h> 16#include <asm/tlbflush.h>
17#include <asm/timer.h>
18#include <asm/oplib.h>
15 19
16#include "irq.h" 20#include "irq.h"
17#include "kernel.h" 21#include "kernel.h"
@@ -30,26 +34,22 @@ swap_ulong(volatile unsigned long *ptr, unsigned long val)
30 return val; 34 return val;
31} 35}
32 36
33static void smp4m_ipi_init(void);
34static void smp_setup_percpu_timer(void);
35
36void __cpuinit smp4m_callin(void) 37void __cpuinit smp4m_callin(void)
37{ 38{
38 int cpuid = hard_smp_processor_id(); 39 int cpuid = hard_smp_processor_id();
39 40
40 local_flush_cache_all(); 41 local_ops->cache_all();
41 local_flush_tlb_all(); 42 local_ops->tlb_all();
42 43
43 notify_cpu_starting(cpuid); 44 notify_cpu_starting(cpuid);
44 45
45 /* Get our local ticker going. */ 46 register_percpu_ce(cpuid);
46 smp_setup_percpu_timer();
47 47
48 calibrate_delay(); 48 calibrate_delay();
49 smp_store_cpu_info(cpuid); 49 smp_store_cpu_info(cpuid);
50 50
51 local_flush_cache_all(); 51 local_ops->cache_all();
52 local_flush_tlb_all(); 52 local_ops->tlb_all();
53 53
54 /* 54 /*
55 * Unblock the master CPU _only_ when the scheduler state 55 * Unblock the master CPU _only_ when the scheduler state
@@ -61,8 +61,8 @@ void __cpuinit smp4m_callin(void)
61 swap_ulong(&cpu_callin_map[cpuid], 1); 61 swap_ulong(&cpu_callin_map[cpuid], 1);
62 62
63 /* XXX: What's up with all the flushes? */ 63 /* XXX: What's up with all the flushes? */
64 local_flush_cache_all(); 64 local_ops->cache_all();
65 local_flush_tlb_all(); 65 local_ops->tlb_all();
66 66
67 /* Fix idle thread fields. */ 67 /* Fix idle thread fields. */
68 __asm__ __volatile__("ld [%0], %%g6\n\t" 68 __asm__ __volatile__("ld [%0], %%g6\n\t"
@@ -86,23 +86,19 @@ void __cpuinit smp4m_callin(void)
86 */ 86 */
87void __init smp4m_boot_cpus(void) 87void __init smp4m_boot_cpus(void)
88{ 88{
89 smp4m_ipi_init(); 89 sun4m_unmask_profile_irq();
90 smp_setup_percpu_timer(); 90 local_ops->cache_all();
91 local_flush_cache_all();
92} 91}
93 92
94int __cpuinit smp4m_boot_one_cpu(int i) 93int __cpuinit smp4m_boot_one_cpu(int i, struct task_struct *idle)
95{ 94{
96 unsigned long *entry = &sun4m_cpu_startup; 95 unsigned long *entry = &sun4m_cpu_startup;
97 struct task_struct *p;
98 int timeout; 96 int timeout;
99 int cpu_node; 97 int cpu_node;
100 98
101 cpu_find_by_mid(i, &cpu_node); 99 cpu_find_by_mid(i, &cpu_node);
100 current_set[i] = task_thread_info(idle);
102 101
103 /* Cook up an idler for this guy. */
104 p = fork_idle(i);
105 current_set[i] = task_thread_info(p);
106 /* See trampoline.S for details... */ 102 /* See trampoline.S for details... */
107 entry += ((i - 1) * 3); 103 entry += ((i - 1) * 3);
108 104
@@ -117,7 +113,7 @@ int __cpuinit smp4m_boot_one_cpu(int i)
117 113
118 /* whirrr, whirrr, whirrrrrrrrr... */ 114 /* whirrr, whirrr, whirrrrrrrrr... */
119 printk(KERN_INFO "Starting CPU %d at %p\n", i, entry); 115 printk(KERN_INFO "Starting CPU %d at %p\n", i, entry);
120 local_flush_cache_all(); 116 local_ops->cache_all();
121 prom_startcpu(cpu_node, &smp_penguin_ctable, 0, (char *)entry); 117 prom_startcpu(cpu_node, &smp_penguin_ctable, 0, (char *)entry);
122 118
123 /* wheee... it's going... */ 119 /* wheee... it's going... */
@@ -132,7 +128,7 @@ int __cpuinit smp4m_boot_one_cpu(int i)
132 return -ENODEV; 128 return -ENODEV;
133 } 129 }
134 130
135 local_flush_cache_all(); 131 local_ops->cache_all();
136 return 0; 132 return 0;
137} 133}
138 134
@@ -149,30 +145,29 @@ void __init smp4m_smp_done(void)
149 prev = &cpu_data(i).next; 145 prev = &cpu_data(i).next;
150 } 146 }
151 *prev = first; 147 *prev = first;
152 local_flush_cache_all(); 148 local_ops->cache_all();
153 149
154 /* Ok, they are spinning and ready to go. */ 150 /* Ok, they are spinning and ready to go. */
155} 151}
156 152
157 153static void sun4m_send_ipi(int cpu, int level)
158/* Initialize IPIs on the SUN4M SMP machine */
159static void __init smp4m_ipi_init(void)
160{ 154{
155 sbus_writel(SUN4M_SOFT_INT(level), &sun4m_irq_percpu[cpu]->set);
161} 156}
162 157
163static void smp4m_ipi_resched(int cpu) 158static void sun4m_ipi_resched(int cpu)
164{ 159{
165 set_cpu_int(cpu, IRQ_IPI_RESCHED); 160 sun4m_send_ipi(cpu, IRQ_IPI_RESCHED);
166} 161}
167 162
168static void smp4m_ipi_single(int cpu) 163static void sun4m_ipi_single(int cpu)
169{ 164{
170 set_cpu_int(cpu, IRQ_IPI_SINGLE); 165 sun4m_send_ipi(cpu, IRQ_IPI_SINGLE);
171} 166}
172 167
173static void smp4m_ipi_mask_one(int cpu) 168static void sun4m_ipi_mask_one(int cpu)
174{ 169{
175 set_cpu_int(cpu, IRQ_IPI_MASK); 170 sun4m_send_ipi(cpu, IRQ_IPI_MASK);
176} 171}
177 172
178static struct smp_funcall { 173static struct smp_funcall {
@@ -189,7 +184,7 @@ static struct smp_funcall {
189static DEFINE_SPINLOCK(cross_call_lock); 184static DEFINE_SPINLOCK(cross_call_lock);
190 185
191/* Cross calls must be serialized, at least currently. */ 186/* Cross calls must be serialized, at least currently. */
192static void smp4m_cross_call(smpfunc_t func, cpumask_t mask, unsigned long arg1, 187static void sun4m_cross_call(smpfunc_t func, cpumask_t mask, unsigned long arg1,
193 unsigned long arg2, unsigned long arg3, 188 unsigned long arg2, unsigned long arg3,
194 unsigned long arg4) 189 unsigned long arg4)
195{ 190{
@@ -216,7 +211,7 @@ static void smp4m_cross_call(smpfunc_t func, cpumask_t mask, unsigned long arg1,
216 if (cpumask_test_cpu(i, &mask)) { 211 if (cpumask_test_cpu(i, &mask)) {
217 ccall_info.processors_in[i] = 0; 212 ccall_info.processors_in[i] = 0;
218 ccall_info.processors_out[i] = 0; 213 ccall_info.processors_out[i] = 0;
219 set_cpu_int(i, IRQ_CROSS_CALL); 214 sun4m_send_ipi(i, IRQ_CROSS_CALL);
220 } else { 215 } else {
221 ccall_info.processors_in[i] = 1; 216 ccall_info.processors_in[i] = 1;
222 ccall_info.processors_out[i] = 1; 217 ccall_info.processors_out[i] = 1;
@@ -260,64 +255,33 @@ void smp4m_cross_call_irq(void)
260void smp4m_percpu_timer_interrupt(struct pt_regs *regs) 255void smp4m_percpu_timer_interrupt(struct pt_regs *regs)
261{ 256{
262 struct pt_regs *old_regs; 257 struct pt_regs *old_regs;
258 struct clock_event_device *ce;
263 int cpu = smp_processor_id(); 259 int cpu = smp_processor_id();
264 260
265 old_regs = set_irq_regs(regs); 261 old_regs = set_irq_regs(regs);
266 262
267 sun4m_clear_profile_irq(cpu); 263 ce = &per_cpu(sparc32_clockevent, cpu);
268
269 profile_tick(CPU_PROFILING);
270 264
271 if (!--prof_counter(cpu)) { 265 if (ce->mode & CLOCK_EVT_MODE_PERIODIC)
272 int user = user_mode(regs); 266 sun4m_clear_profile_irq(cpu);
267 else
268 sparc_config.load_profile_irq(cpu, 0); /* Is this needless? */
273 269
274 irq_enter(); 270 irq_enter();
275 update_process_times(user); 271 ce->event_handler(ce);
276 irq_exit(); 272 irq_exit();
277 273
278 prof_counter(cpu) = prof_multiplier(cpu);
279 }
280 set_irq_regs(old_regs); 274 set_irq_regs(old_regs);
281} 275}
282 276
283static void __cpuinit smp_setup_percpu_timer(void) 277static const struct sparc32_ipi_ops sun4m_ipi_ops = {
284{ 278 .cross_call = sun4m_cross_call,
285 int cpu = smp_processor_id(); 279 .resched = sun4m_ipi_resched,
286 280 .single = sun4m_ipi_single,
287 prof_counter(cpu) = prof_multiplier(cpu) = 1; 281 .mask_one = sun4m_ipi_mask_one,
288 load_profile_irq(cpu, lvl14_resolution); 282};
289
290 if (cpu == boot_cpu_id)
291 sun4m_unmask_profile_irq();
292}
293
294static void __init smp4m_blackbox_id(unsigned *addr)
295{
296 int rd = *addr & 0x3e000000;
297 int rs1 = rd >> 11;
298
299 addr[0] = 0x81580000 | rd; /* rd %tbr, reg */
300 addr[1] = 0x8130200c | rd | rs1; /* srl reg, 0xc, reg */
301 addr[2] = 0x80082003 | rd | rs1; /* and reg, 3, reg */
302}
303
304static void __init smp4m_blackbox_current(unsigned *addr)
305{
306 int rd = *addr & 0x3e000000;
307 int rs1 = rd >> 11;
308
309 addr[0] = 0x81580000 | rd; /* rd %tbr, reg */
310 addr[2] = 0x8130200a | rd | rs1; /* srl reg, 0xa, reg */
311 addr[4] = 0x8008200c | rd | rs1; /* and reg, 0xc, reg */
312}
313 283
314void __init sun4m_init_smp(void) 284void __init sun4m_init_smp(void)
315{ 285{
316 BTFIXUPSET_BLACKBOX(hard_smp_processor_id, smp4m_blackbox_id); 286 sparc32_ipi_ops = &sun4m_ipi_ops;
317 BTFIXUPSET_BLACKBOX(load_current, smp4m_blackbox_current);
318 BTFIXUPSET_CALL(smp_cross_call, smp4m_cross_call, BTFIXUPCALL_NORM);
319 BTFIXUPSET_CALL(__hard_smp_processor_id, __smp4m_processor_id, BTFIXUPCALL_NORM);
320 BTFIXUPSET_CALL(smp_ipi_resched, smp4m_ipi_resched, BTFIXUPCALL_NORM);
321 BTFIXUPSET_CALL(smp_ipi_single, smp4m_ipi_single, BTFIXUPCALL_NORM);
322 BTFIXUPSET_CALL(smp_ipi_mask_one, smp4m_ipi_mask_one, BTFIXUPCALL_NORM);
323} 287}
diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c
index 42b282fa6112..627e89af1d71 100644
--- a/arch/sparc/kernel/sys_sparc_32.c
+++ b/arch/sparc/kernel/sys_sparc_32.c
@@ -53,8 +53,6 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
53 /* See asm-sparc/uaccess.h */ 53 /* See asm-sparc/uaccess.h */
54 if (len > TASK_SIZE - PAGE_SIZE) 54 if (len > TASK_SIZE - PAGE_SIZE)
55 return -ENOMEM; 55 return -ENOMEM;
56 if (ARCH_SUN4C && len > 0x20000000)
57 return -ENOMEM;
58 if (!addr) 56 if (!addr)
59 addr = TASK_UNMAPPED_BASE; 57 addr = TASK_UNMAPPED_BASE;
60 58
@@ -65,10 +63,6 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
65 63
66 for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) { 64 for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) {
67 /* At this point: (!vmm || addr < vmm->vm_end). */ 65 /* At this point: (!vmm || addr < vmm->vm_end). */
68 if (ARCH_SUN4C && addr < 0xe0000000 && 0x20000000 - len < addr) {
69 addr = PAGE_OFFSET;
70 vmm = find_vma(current->mm, PAGE_OFFSET);
71 }
72 if (TASK_SIZE - PAGE_SIZE - len < addr) 66 if (TASK_SIZE - PAGE_SIZE - len < addr)
73 return -ENOMEM; 67 return -ENOMEM;
74 if (!vmm || addr + len <= vmm->vm_start) 68 if (!vmm || addr + len <= vmm->vm_start)
@@ -99,11 +93,6 @@ out:
99 93
100int sparc_mmap_check(unsigned long addr, unsigned long len) 94int sparc_mmap_check(unsigned long addr, unsigned long len)
101{ 95{
102 if (ARCH_SUN4C &&
103 (len > 0x20000000 ||
104 (addr < 0xe0000000 && addr + len > 0x20000000)))
105 return -EINVAL;
106
107 /* See asm-sparc/uaccess.h */ 96 /* See asm-sparc/uaccess.h */
108 if (len > TASK_SIZE - PAGE_SIZE || addr + len > TASK_SIZE - PAGE_SIZE) 97 if (len > TASK_SIZE - PAGE_SIZE || addr + len > TASK_SIZE - PAGE_SIZE)
109 return -EINVAL; 98 return -EINVAL;
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index 232df9949530..3ee51f189a55 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -566,15 +566,10 @@ out:
566 566
567SYSCALL_DEFINE2(64_munmap, unsigned long, addr, size_t, len) 567SYSCALL_DEFINE2(64_munmap, unsigned long, addr, size_t, len)
568{ 568{
569 long ret;
570
571 if (invalid_64bit_range(addr, len)) 569 if (invalid_64bit_range(addr, len))
572 return -EINVAL; 570 return -EINVAL;
573 571
574 down_write(&current->mm->mmap_sem); 572 return vm_munmap(addr, len);
575 ret = do_munmap(current->mm, addr, len);
576 up_write(&current->mm->mmap_sem);
577 return ret;
578} 573}
579 574
580extern unsigned long do_mremap(unsigned long addr, 575extern unsigned long do_mremap(unsigned long addr,
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index db86b1a0e9a9..3a58e0d66f51 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -74,7 +74,7 @@ sys_call_table32:
74 .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy 74 .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
75/*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink 75/*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
76 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid 76 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
77/*280*/ .word sys32_tee, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat 77/*280*/ .word sys32_tee, sys_add_key, sys_request_key, compat_sys_keyctl, compat_sys_openat
78 .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_fstatat64 78 .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_fstatat64
79/*290*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat 79/*290*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
80 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare 80 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index 7d0c088e8aba..953641549e82 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -26,6 +26,8 @@
26#include <linux/rtc.h> 26#include <linux/rtc.h>
27#include <linux/rtc/m48t59.h> 27#include <linux/rtc/m48t59.h>
28#include <linux/timex.h> 28#include <linux/timex.h>
29#include <linux/clocksource.h>
30#include <linux/clockchips.h>
29#include <linux/init.h> 31#include <linux/init.h>
30#include <linux/pci.h> 32#include <linux/pci.h>
31#include <linux/ioport.h> 33#include <linux/ioport.h>
@@ -40,13 +42,24 @@
40#include <asm/irq.h> 42#include <asm/irq.h>
41#include <asm/io.h> 43#include <asm/io.h>
42#include <asm/idprom.h> 44#include <asm/idprom.h>
43#include <asm/machines.h>
44#include <asm/page.h> 45#include <asm/page.h>
45#include <asm/pcic.h> 46#include <asm/pcic.h>
46#include <asm/irq_regs.h> 47#include <asm/irq_regs.h>
48#include <asm/setup.h>
47 49
48#include "irq.h" 50#include "irq.h"
49 51
52static __cacheline_aligned_in_smp DEFINE_SEQLOCK(timer_cs_lock);
53static __volatile__ u64 timer_cs_internal_counter = 0;
54static char timer_cs_enabled = 0;
55
56static struct clock_event_device timer_ce;
57static char timer_ce_enabled = 0;
58
59#ifdef CONFIG_SMP
60DEFINE_PER_CPU(struct clock_event_device, sparc32_clockevent);
61#endif
62
50DEFINE_SPINLOCK(rtc_lock); 63DEFINE_SPINLOCK(rtc_lock);
51EXPORT_SYMBOL(rtc_lock); 64EXPORT_SYMBOL(rtc_lock);
52 65
@@ -55,7 +68,6 @@ static int set_rtc_mmss(unsigned long);
55unsigned long profile_pc(struct pt_regs *regs) 68unsigned long profile_pc(struct pt_regs *regs)
56{ 69{
57 extern char __copy_user_begin[], __copy_user_end[]; 70 extern char __copy_user_begin[], __copy_user_end[];
58 extern char __atomic_begin[], __atomic_end[];
59 extern char __bzero_begin[], __bzero_end[]; 71 extern char __bzero_begin[], __bzero_end[];
60 72
61 unsigned long pc = regs->pc; 73 unsigned long pc = regs->pc;
@@ -63,8 +75,6 @@ unsigned long profile_pc(struct pt_regs *regs)
63 if (in_lock_functions(pc) || 75 if (in_lock_functions(pc) ||
64 (pc >= (unsigned long) __copy_user_begin && 76 (pc >= (unsigned long) __copy_user_begin &&
65 pc < (unsigned long) __copy_user_end) || 77 pc < (unsigned long) __copy_user_end) ||
66 (pc >= (unsigned long) __atomic_begin &&
67 pc < (unsigned long) __atomic_end) ||
68 (pc >= (unsigned long) __bzero_begin && 78 (pc >= (unsigned long) __bzero_begin &&
69 pc < (unsigned long) __bzero_end)) 79 pc < (unsigned long) __bzero_end))
70 pc = regs->u_regs[UREG_RETPC]; 80 pc = regs->u_regs[UREG_RETPC];
@@ -75,36 +85,168 @@ EXPORT_SYMBOL(profile_pc);
75 85
76__volatile__ unsigned int *master_l10_counter; 86__volatile__ unsigned int *master_l10_counter;
77 87
78u32 (*do_arch_gettimeoffset)(void);
79
80int update_persistent_clock(struct timespec now) 88int update_persistent_clock(struct timespec now)
81{ 89{
82 return set_rtc_mmss(now.tv_sec); 90 return set_rtc_mmss(now.tv_sec);
83} 91}
84 92
85/* 93irqreturn_t notrace timer_interrupt(int dummy, void *dev_id)
86 * timer_interrupt() needs to keep up the real-time clock, 94{
87 * as well as call the "xtime_update()" routine every clocktick 95 if (timer_cs_enabled) {
88 */ 96 write_seqlock(&timer_cs_lock);
97 timer_cs_internal_counter++;
98 sparc_config.clear_clock_irq();
99 write_sequnlock(&timer_cs_lock);
100 } else {
101 sparc_config.clear_clock_irq();
102 }
89 103
90#define TICK_SIZE (tick_nsec / 1000) 104 if (timer_ce_enabled)
105 timer_ce.event_handler(&timer_ce);
91 106
92static irqreturn_t timer_interrupt(int dummy, void *dev_id) 107 return IRQ_HANDLED;
108}
109
110static void timer_ce_set_mode(enum clock_event_mode mode,
111 struct clock_event_device *evt)
93{ 112{
94#ifndef CONFIG_SMP 113 switch (mode) {
95 profile_tick(CPU_PROFILING); 114 case CLOCK_EVT_MODE_PERIODIC:
96#endif 115 case CLOCK_EVT_MODE_RESUME:
116 timer_ce_enabled = 1;
117 break;
118 case CLOCK_EVT_MODE_SHUTDOWN:
119 timer_ce_enabled = 0;
120 break;
121 default:
122 break;
123 }
124 smp_mb();
125}
97 126
98 clear_clock_irq(); 127static __init void setup_timer_ce(void)
128{
129 struct clock_event_device *ce = &timer_ce;
130
131 BUG_ON(smp_processor_id() != boot_cpu_id);
132
133 ce->name = "timer_ce";
134 ce->rating = 100;
135 ce->features = CLOCK_EVT_FEAT_PERIODIC;
136 ce->set_mode = timer_ce_set_mode;
137 ce->cpumask = cpu_possible_mask;
138 ce->shift = 32;
139 ce->mult = div_sc(sparc_config.clock_rate, NSEC_PER_SEC,
140 ce->shift);
141 clockevents_register_device(ce);
142}
99 143
100 xtime_update(1); 144static unsigned int sbus_cycles_offset(void)
145{
146 unsigned int val, offset;
101 147
102#ifndef CONFIG_SMP 148 val = *master_l10_counter;
103 update_process_times(user_mode(get_irq_regs())); 149 offset = (val >> TIMER_VALUE_SHIFT) & TIMER_VALUE_MASK;
104#endif 150
105 return IRQ_HANDLED; 151 /* Limit hit? */
152 if (val & TIMER_LIMIT_BIT)
153 offset += sparc_config.cs_period;
154
155 return offset;
156}
157
158static cycle_t timer_cs_read(struct clocksource *cs)
159{
160 unsigned int seq, offset;
161 u64 cycles;
162
163 do {
164 seq = read_seqbegin(&timer_cs_lock);
165
166 cycles = timer_cs_internal_counter;
167 offset = sparc_config.get_cycles_offset();
168 } while (read_seqretry(&timer_cs_lock, seq));
169
170 /* Count absolute cycles */
171 cycles *= sparc_config.cs_period;
172 cycles += offset;
173
174 return cycles;
175}
176
177static struct clocksource timer_cs = {
178 .name = "timer_cs",
179 .rating = 100,
180 .read = timer_cs_read,
181 .mask = CLOCKSOURCE_MASK(64),
182 .shift = 2,
183 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
184};
185
186static __init int setup_timer_cs(void)
187{
188 timer_cs_enabled = 1;
189 timer_cs.mult = clocksource_hz2mult(sparc_config.clock_rate,
190 timer_cs.shift);
191
192 return clocksource_register(&timer_cs);
106} 193}
107 194
195#ifdef CONFIG_SMP
196static void percpu_ce_setup(enum clock_event_mode mode,
197 struct clock_event_device *evt)
198{
199 int cpu = __first_cpu(evt->cpumask);
200
201 switch (mode) {
202 case CLOCK_EVT_MODE_PERIODIC:
203 sparc_config.load_profile_irq(cpu,
204 SBUS_CLOCK_RATE / HZ);
205 break;
206 case CLOCK_EVT_MODE_ONESHOT:
207 case CLOCK_EVT_MODE_SHUTDOWN:
208 case CLOCK_EVT_MODE_UNUSED:
209 sparc_config.load_profile_irq(cpu, 0);
210 break;
211 default:
212 break;
213 }
214}
215
216static int percpu_ce_set_next_event(unsigned long delta,
217 struct clock_event_device *evt)
218{
219 int cpu = __first_cpu(evt->cpumask);
220 unsigned int next = (unsigned int)delta;
221
222 sparc_config.load_profile_irq(cpu, next);
223 return 0;
224}
225
226void register_percpu_ce(int cpu)
227{
228 struct clock_event_device *ce = &per_cpu(sparc32_clockevent, cpu);
229 unsigned int features = CLOCK_EVT_FEAT_PERIODIC;
230
231 if (sparc_config.features & FEAT_L14_ONESHOT)
232 features |= CLOCK_EVT_FEAT_ONESHOT;
233
234 ce->name = "percpu_ce";
235 ce->rating = 200;
236 ce->features = features;
237 ce->set_mode = percpu_ce_setup;
238 ce->set_next_event = percpu_ce_set_next_event;
239 ce->cpumask = cpumask_of(cpu);
240 ce->shift = 32;
241 ce->mult = div_sc(sparc_config.clock_rate, NSEC_PER_SEC,
242 ce->shift);
243 ce->max_delta_ns = clockevent_delta2ns(sparc_config.clock_rate, ce);
244 ce->min_delta_ns = clockevent_delta2ns(100, ce);
245
246 clockevents_register_device(ce);
247}
248#endif
249
108static unsigned char mostek_read_byte(struct device *dev, u32 ofs) 250static unsigned char mostek_read_byte(struct device *dev, u32 ofs)
109{ 251{
110 struct platform_device *pdev = to_platform_device(dev); 252 struct platform_device *pdev = to_platform_device(dev);
@@ -195,38 +337,28 @@ static int __init clock_init(void)
195 */ 337 */
196fs_initcall(clock_init); 338fs_initcall(clock_init);
197 339
198 340static void __init sparc32_late_time_init(void)
199u32 sbus_do_gettimeoffset(void)
200{
201 unsigned long val = *master_l10_counter;
202 unsigned long usec = (val >> 10) & 0x1fffff;
203
204 /* Limit hit? */
205 if (val & 0x80000000)
206 usec += 1000000 / HZ;
207
208 return usec * 1000;
209}
210
211
212u32 arch_gettimeoffset(void)
213{ 341{
214 if (unlikely(!do_arch_gettimeoffset)) 342 if (sparc_config.features & FEAT_L10_CLOCKEVENT)
215 return 0; 343 setup_timer_ce();
216 return do_arch_gettimeoffset(); 344 if (sparc_config.features & FEAT_L10_CLOCKSOURCE)
345 setup_timer_cs();
346#ifdef CONFIG_SMP
347 register_percpu_ce(smp_processor_id());
348#endif
217} 349}
218 350
219static void __init sbus_time_init(void) 351static void __init sbus_time_init(void)
220{ 352{
221 do_arch_gettimeoffset = sbus_do_gettimeoffset; 353 sparc_config.get_cycles_offset = sbus_cycles_offset;
222 354 sparc_config.init_timers();
223 btfixup();
224
225 sparc_irq_config.init_timers(timer_interrupt);
226} 355}
227 356
228void __init time_init(void) 357void __init time_init(void)
229{ 358{
359 sparc_config.features = 0;
360 late_time_init = sparc32_late_time_init;
361
230 if (pcic_present()) 362 if (pcic_present())
231 pci_time_init(); 363 pci_time_init();
232 else 364 else
diff --git a/arch/sparc/kernel/trampoline_32.S b/arch/sparc/kernel/trampoline_32.S
index 691f484e03b3..7364ddc9e5aa 100644
--- a/arch/sparc/kernel/trampoline_32.S
+++ b/arch/sparc/kernel/trampoline_32.S
@@ -15,8 +15,8 @@
15#include <asm/contregs.h> 15#include <asm/contregs.h>
16#include <asm/thread_info.h> 16#include <asm/thread_info.h>
17 17
18 .globl sun4m_cpu_startup, __smp4m_processor_id, __leon_processor_id 18 .globl sun4m_cpu_startup
19 .globl sun4d_cpu_startup, __smp4d_processor_id 19 .globl sun4d_cpu_startup
20 20
21 __CPUINIT 21 __CPUINIT
22 .align 4 22 .align 4
@@ -94,24 +94,6 @@ smp_do_cpu_idle:
94 call cpu_panic 94 call cpu_panic
95 nop 95 nop
96 96
97__smp4m_processor_id:
98 rd %tbr, %g2
99 srl %g2, 12, %g2
100 and %g2, 3, %g2
101 retl
102 mov %g1, %o7
103
104__smp4d_processor_id:
105 lda [%g0] ASI_M_VIKING_TMP1, %g2
106 retl
107 mov %g1, %o7
108
109__leon_processor_id:
110 rd %asr17,%g2
111 srl %g2,28,%g2
112 retl
113 mov %g1, %o7
114
115/* CPUID in bootbus can be found at PA 0xff0140000 */ 97/* CPUID in bootbus can be found at PA 0xff0140000 */
116#define SUN4D_BOOTBUS_CPUID 0xf0140000 98#define SUN4D_BOOTBUS_CPUID 0xf0140000
117 99
diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c
index d2de21333146..a5785ea2a85d 100644
--- a/arch/sparc/kernel/traps_32.c
+++ b/arch/sparc/kernel/traps_32.c
@@ -120,8 +120,6 @@ void do_illegal_instruction(struct pt_regs *regs, unsigned long pc, unsigned lon
120 printk("Ill instr. at pc=%08lx instruction is %08lx\n", 120 printk("Ill instr. at pc=%08lx instruction is %08lx\n",
121 regs->pc, *(unsigned long *)regs->pc); 121 regs->pc, *(unsigned long *)regs->pc);
122#endif 122#endif
123 if (!do_user_muldiv (regs, pc))
124 return;
125 123
126 info.si_signo = SIGILL; 124 info.si_signo = SIGILL;
127 info.si_errno = 0; 125 info.si_errno = 0;
diff --git a/arch/sparc/kernel/ttable_32.S b/arch/sparc/kernel/ttable_32.S
new file mode 100644
index 000000000000..8a7a96ca676f
--- /dev/null
+++ b/arch/sparc/kernel/ttable_32.S
@@ -0,0 +1,417 @@
1/* The Sparc trap table, bootloader gives us control at _start. */
2 __HEAD
3
4 .globl _start
5_start:
6
7 .globl _stext
8_stext:
9
10 .globl trapbase
11trapbase:
12
13#ifdef CONFIG_SMP
14trapbase_cpu0:
15#endif
16/* We get control passed to us here at t_zero. */
17t_zero: b gokernel; nop; nop; nop;
18t_tflt: SRMMU_TFAULT /* Inst. Access Exception */
19t_bins: TRAP_ENTRY(0x2, bad_instruction) /* Illegal Instruction */
20t_pins: TRAP_ENTRY(0x3, priv_instruction) /* Privileged Instruction */
21t_fpd: TRAP_ENTRY(0x4, fpd_trap_handler) /* Floating Point Disabled */
22t_wovf: WINDOW_SPILL /* Window Overflow */
23t_wunf: WINDOW_FILL /* Window Underflow */
24t_mna: TRAP_ENTRY(0x7, mna_handler) /* Memory Address Not Aligned */
25t_fpe: TRAP_ENTRY(0x8, fpe_trap_handler) /* Floating Point Exception */
26t_dflt: SRMMU_DFAULT /* Data Miss Exception */
27t_tio: TRAP_ENTRY(0xa, do_tag_overflow) /* Tagged Instruction Ovrflw */
28t_wpt: TRAP_ENTRY(0xb, do_watchpoint) /* Watchpoint Detected */
29t_badc: BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
30t_irq1: TRAP_ENTRY_INTERRUPT(1) /* IRQ Software/SBUS Level 1 */
31t_irq2: TRAP_ENTRY_INTERRUPT(2) /* IRQ SBUS Level 2 */
32t_irq3: TRAP_ENTRY_INTERRUPT(3) /* IRQ SCSI/DMA/SBUS Level 3 */
33t_irq4: TRAP_ENTRY_INTERRUPT(4) /* IRQ Software Level 4 */
34t_irq5: TRAP_ENTRY_INTERRUPT(5) /* IRQ SBUS/Ethernet Level 5 */
35t_irq6: TRAP_ENTRY_INTERRUPT(6) /* IRQ Software Level 6 */
36t_irq7: TRAP_ENTRY_INTERRUPT(7) /* IRQ Video/SBUS Level 5 */
37t_irq8: TRAP_ENTRY_INTERRUPT(8) /* IRQ SBUS Level 6 */
38t_irq9: TRAP_ENTRY_INTERRUPT(9) /* IRQ SBUS Level 7 */
39t_irq10:TRAP_ENTRY_INTERRUPT(10) /* IRQ Timer #1 (one we use) */
40t_irq11:TRAP_ENTRY_INTERRUPT(11) /* IRQ Floppy Intr. */
41t_irq12:TRAP_ENTRY_INTERRUPT(12) /* IRQ Zilog serial chip */
42t_irq13:TRAP_ENTRY_INTERRUPT(13) /* IRQ Audio Intr. */
43t_irq14:TRAP_ENTRY_INTERRUPT(14) /* IRQ Timer #2 */
44
45 .globl t_nmi
46t_nmi: TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
47
48t_racc: TRAP_ENTRY(0x20, do_reg_access) /* General Register Access Error */
49t_iacce:BAD_TRAP(0x21) /* Instr Access Error */
50t_bad22:BAD_TRAP(0x22)
51 BAD_TRAP(0x23)
52t_cpdis:TRAP_ENTRY(0x24, do_cp_disabled) /* Co-Processor Disabled */
53t_uflsh:SKIP_TRAP(0x25, unimp_flush) /* Unimplemented FLUSH inst. */
54t_bad26:BAD_TRAP(0x26) BAD_TRAP(0x27)
55t_cpexc:TRAP_ENTRY(0x28, do_cp_exception) /* Co-Processor Exception */
56t_dacce:SRMMU_DFAULT /* Data Access Error */
57t_hwdz: TRAP_ENTRY(0x2a, do_hw_divzero) /* Division by zero, you lose... */
58t_dserr:BAD_TRAP(0x2b) /* Data Store Error */
59t_daccm:BAD_TRAP(0x2c) /* Data Access MMU-Miss */
60t_bad2d:BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
61t_bad32:BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
62t_bad37:BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
63t_iaccm:BAD_TRAP(0x3c) /* Instr Access MMU-Miss */
64t_bad3d:BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40) BAD_TRAP(0x41)
65t_bad42:BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45) BAD_TRAP(0x46)
66t_bad47:BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a) BAD_TRAP(0x4b)
67t_bad4c:BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f) BAD_TRAP(0x50)
68t_bad51:BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
69t_bad56:BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
70t_bad5b:BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
71t_bad60:BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
72t_bad65:BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
73t_bad6a:BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
74t_bad6f:BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
75t_bad74:BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
76t_bad79:BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
77t_bad7e:BAD_TRAP(0x7e) BAD_TRAP(0x7f)
78t_bad80:BAD_TRAP(0x80) /* SunOS System Call */
79t_sbkpt:BREAKPOINT_TRAP /* Software Breakpoint/KGDB */
80t_divz: TRAP_ENTRY(0x82, do_hw_divzero) /* Divide by zero trap */
81t_flwin:TRAP_ENTRY(0x83, do_flush_windows) /* Flush Windows Trap */
82t_clwin:BAD_TRAP(0x84) /* Clean Windows Trap */
83t_rchk: BAD_TRAP(0x85) /* Range Check */
84t_funal:BAD_TRAP(0x86) /* Fix Unaligned Access Trap */
85t_iovf: BAD_TRAP(0x87) /* Integer Overflow Trap */
86t_bad88:BAD_TRAP(0x88) /* Slowaris System Call */
87t_bad89:BAD_TRAP(0x89) /* Net-B.S. System Call */
88t_bad8a:BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c) BAD_TRAP(0x8d) BAD_TRAP(0x8e)
89t_bad8f:BAD_TRAP(0x8f)
90t_linux:LINUX_SYSCALL_TRAP /* Linux System Call */
91t_bad91:BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94) BAD_TRAP(0x95)
92t_bad96:BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99) BAD_TRAP(0x9a)
93t_bad9b:BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e) BAD_TRAP(0x9f)
94t_getcc:GETCC_TRAP /* Get Condition Codes */
95t_setcc:SETCC_TRAP /* Set Condition Codes */
96t_getpsr:GETPSR_TRAP /* Get PSR Register */
97t_bada3:BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
98t_bada7:BAD_TRAP(0xa7)
99t_bada8:BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
100t_badac:BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
101t_badb1:BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
102t_badb6:BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
103t_badbb:BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
104t_badc0:BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
105t_badc5:BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
106t_badca:BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
107t_badcf:BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
108t_badd4:BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
109t_badd9:BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
110t_badde:BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
111t_bade3:BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
112t_bade8:BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
113t_baded:BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
114t_badf2:BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
115t_badf7:BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
116t_badfc:BAD_TRAP(0xfc)
117t_kgdb: KGDB_TRAP(0xfd)
118dbtrap: BAD_TRAP(0xfe) /* Debugger/PROM breakpoint #1 */
119dbtrap2:BAD_TRAP(0xff) /* Debugger/PROM breakpoint #2 */
120
121 .globl end_traptable
122end_traptable:
123
124#ifdef CONFIG_SMP
125 /* Trap tables for the other cpus. */
126 .globl trapbase_cpu1, trapbase_cpu2, trapbase_cpu3
127trapbase_cpu1:
128 BAD_TRAP(0x0)
129 SRMMU_TFAULT
130 TRAP_ENTRY(0x2, bad_instruction)
131 TRAP_ENTRY(0x3, priv_instruction)
132 TRAP_ENTRY(0x4, fpd_trap_handler)
133 WINDOW_SPILL
134 WINDOW_FILL
135 TRAP_ENTRY(0x7, mna_handler)
136 TRAP_ENTRY(0x8, fpe_trap_handler)
137 SRMMU_DFAULT
138 TRAP_ENTRY(0xa, do_tag_overflow)
139 TRAP_ENTRY(0xb, do_watchpoint)
140 BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
141 TRAP_ENTRY_INTERRUPT(1) TRAP_ENTRY_INTERRUPT(2)
142 TRAP_ENTRY_INTERRUPT(3) TRAP_ENTRY_INTERRUPT(4)
143 TRAP_ENTRY_INTERRUPT(5) TRAP_ENTRY_INTERRUPT(6)
144 TRAP_ENTRY_INTERRUPT(7) TRAP_ENTRY_INTERRUPT(8)
145 TRAP_ENTRY_INTERRUPT(9) TRAP_ENTRY_INTERRUPT(10)
146 TRAP_ENTRY_INTERRUPT(11) TRAP_ENTRY_INTERRUPT(12)
147 TRAP_ENTRY_INTERRUPT(13) TRAP_ENTRY_INTERRUPT(14)
148 TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
149 TRAP_ENTRY(0x20, do_reg_access)
150 BAD_TRAP(0x21)
151 BAD_TRAP(0x22)
152 BAD_TRAP(0x23)
153 TRAP_ENTRY(0x24, do_cp_disabled)
154 SKIP_TRAP(0x25, unimp_flush)
155 BAD_TRAP(0x26)
156 BAD_TRAP(0x27)
157 TRAP_ENTRY(0x28, do_cp_exception)
158 SRMMU_DFAULT
159 TRAP_ENTRY(0x2a, do_hw_divzero)
160 BAD_TRAP(0x2b)
161 BAD_TRAP(0x2c)
162 BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
163 BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
164 BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
165 BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
166 BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
167 BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
168 BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
169 BAD_TRAP(0x50)
170 BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
171 BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
172 BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
173 BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
174 BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
175 BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
176 BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
177 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
178 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
179 BAD_TRAP(0x7e) BAD_TRAP(0x7f)
180 BAD_TRAP(0x80)
181 BREAKPOINT_TRAP
182 TRAP_ENTRY(0x82, do_hw_divzero)
183 TRAP_ENTRY(0x83, do_flush_windows)
184 BAD_TRAP(0x84) BAD_TRAP(0x85) BAD_TRAP(0x86)
185 BAD_TRAP(0x87) BAD_TRAP(0x88) BAD_TRAP(0x89)
186 BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
187 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
188 LINUX_SYSCALL_TRAP BAD_TRAP(0x91)
189 BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
190 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
191 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
192 BAD_TRAP(0x9f)
193 GETCC_TRAP
194 SETCC_TRAP
195 GETPSR_TRAP
196 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
197 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
198 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
199 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
200 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
201 BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
202 BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
203 BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
204 BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
205 BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
206 BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
207 BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
208 BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
209 BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
210 BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
211 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
212 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
213 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
214 BAD_TRAP(0xfc)
215 KGDB_TRAP(0xfd)
216 BAD_TRAP(0xfe)
217 BAD_TRAP(0xff)
218
219trapbase_cpu2:
220 BAD_TRAP(0x0)
221 SRMMU_TFAULT
222 TRAP_ENTRY(0x2, bad_instruction)
223 TRAP_ENTRY(0x3, priv_instruction)
224 TRAP_ENTRY(0x4, fpd_trap_handler)
225 WINDOW_SPILL
226 WINDOW_FILL
227 TRAP_ENTRY(0x7, mna_handler)
228 TRAP_ENTRY(0x8, fpe_trap_handler)
229 SRMMU_DFAULT
230 TRAP_ENTRY(0xa, do_tag_overflow)
231 TRAP_ENTRY(0xb, do_watchpoint)
232 BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
233 TRAP_ENTRY_INTERRUPT(1)
234 TRAP_ENTRY_INTERRUPT(2)
235 TRAP_ENTRY_INTERRUPT(3)
236 TRAP_ENTRY_INTERRUPT(4)
237 TRAP_ENTRY_INTERRUPT(5)
238 TRAP_ENTRY_INTERRUPT(6)
239 TRAP_ENTRY_INTERRUPT(7)
240 TRAP_ENTRY_INTERRUPT(8)
241 TRAP_ENTRY_INTERRUPT(9)
242 TRAP_ENTRY_INTERRUPT(10)
243 TRAP_ENTRY_INTERRUPT(11)
244 TRAP_ENTRY_INTERRUPT(12)
245 TRAP_ENTRY_INTERRUPT(13)
246 TRAP_ENTRY_INTERRUPT(14)
247 TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
248 TRAP_ENTRY(0x20, do_reg_access)
249 BAD_TRAP(0x21)
250 BAD_TRAP(0x22)
251 BAD_TRAP(0x23)
252 TRAP_ENTRY(0x24, do_cp_disabled)
253 SKIP_TRAP(0x25, unimp_flush)
254 BAD_TRAP(0x26)
255 BAD_TRAP(0x27)
256 TRAP_ENTRY(0x28, do_cp_exception)
257 SRMMU_DFAULT
258 TRAP_ENTRY(0x2a, do_hw_divzero)
259 BAD_TRAP(0x2b)
260 BAD_TRAP(0x2c)
261 BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
262 BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
263 BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
264 BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
265 BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
266 BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
267 BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
268 BAD_TRAP(0x50)
269 BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
270 BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
271 BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
272 BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
273 BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
274 BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
275 BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
276 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
277 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
278 BAD_TRAP(0x7e) BAD_TRAP(0x7f)
279 BAD_TRAP(0x80)
280 BREAKPOINT_TRAP
281 TRAP_ENTRY(0x82, do_hw_divzero)
282 TRAP_ENTRY(0x83, do_flush_windows)
283 BAD_TRAP(0x84)
284 BAD_TRAP(0x85)
285 BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88)
286 BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
287 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
288 LINUX_SYSCALL_TRAP BAD_TRAP(0x91)
289 BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
290 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
291 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
292 BAD_TRAP(0x9f)
293 GETCC_TRAP
294 SETCC_TRAP
295 GETPSR_TRAP
296 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
297 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
298 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
299 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
300 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
301 BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
302 BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
303 BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
304 BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
305 BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
306 BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
307 BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
308 BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
309 BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
310 BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
311 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
312 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
313 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
314 BAD_TRAP(0xfc)
315 KGDB_TRAP(0xfd)
316 BAD_TRAP(0xfe)
317 BAD_TRAP(0xff)
318
319trapbase_cpu3:
320 BAD_TRAP(0x0)
321 SRMMU_TFAULT
322 TRAP_ENTRY(0x2, bad_instruction)
323 TRAP_ENTRY(0x3, priv_instruction)
324 TRAP_ENTRY(0x4, fpd_trap_handler)
325 WINDOW_SPILL
326 WINDOW_FILL
327 TRAP_ENTRY(0x7, mna_handler)
328 TRAP_ENTRY(0x8, fpe_trap_handler)
329 SRMMU_DFAULT
330 TRAP_ENTRY(0xa, do_tag_overflow)
331 TRAP_ENTRY(0xb, do_watchpoint)
332 BAD_TRAP(0xc) BAD_TRAP(0xd) BAD_TRAP(0xe) BAD_TRAP(0xf) BAD_TRAP(0x10)
333 TRAP_ENTRY_INTERRUPT(1)
334 TRAP_ENTRY_INTERRUPT(2)
335 TRAP_ENTRY_INTERRUPT(3)
336 TRAP_ENTRY_INTERRUPT(4)
337 TRAP_ENTRY_INTERRUPT(5)
338 TRAP_ENTRY_INTERRUPT(6)
339 TRAP_ENTRY_INTERRUPT(7)
340 TRAP_ENTRY_INTERRUPT(8)
341 TRAP_ENTRY_INTERRUPT(9)
342 TRAP_ENTRY_INTERRUPT(10)
343 TRAP_ENTRY_INTERRUPT(11)
344 TRAP_ENTRY_INTERRUPT(12)
345 TRAP_ENTRY_INTERRUPT(13)
346 TRAP_ENTRY_INTERRUPT(14)
347 TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
348 TRAP_ENTRY(0x20, do_reg_access)
349 BAD_TRAP(0x21)
350 BAD_TRAP(0x22)
351 BAD_TRAP(0x23)
352 TRAP_ENTRY(0x24, do_cp_disabled)
353 SKIP_TRAP(0x25, unimp_flush)
354 BAD_TRAP(0x26)
355 BAD_TRAP(0x27)
356 TRAP_ENTRY(0x28, do_cp_exception)
357 SRMMU_DFAULT
358 TRAP_ENTRY(0x2a, do_hw_divzero)
359 BAD_TRAP(0x2b) BAD_TRAP(0x2c)
360 BAD_TRAP(0x2d) BAD_TRAP(0x2e) BAD_TRAP(0x2f) BAD_TRAP(0x30) BAD_TRAP(0x31)
361 BAD_TRAP(0x32) BAD_TRAP(0x33) BAD_TRAP(0x34) BAD_TRAP(0x35) BAD_TRAP(0x36)
362 BAD_TRAP(0x37) BAD_TRAP(0x38) BAD_TRAP(0x39) BAD_TRAP(0x3a) BAD_TRAP(0x3b)
363 BAD_TRAP(0x3c) BAD_TRAP(0x3d) BAD_TRAP(0x3e) BAD_TRAP(0x3f) BAD_TRAP(0x40)
364 BAD_TRAP(0x41) BAD_TRAP(0x42) BAD_TRAP(0x43) BAD_TRAP(0x44) BAD_TRAP(0x45)
365 BAD_TRAP(0x46) BAD_TRAP(0x47) BAD_TRAP(0x48) BAD_TRAP(0x49) BAD_TRAP(0x4a)
366 BAD_TRAP(0x4b) BAD_TRAP(0x4c) BAD_TRAP(0x4d) BAD_TRAP(0x4e) BAD_TRAP(0x4f)
367 BAD_TRAP(0x50)
368 BAD_TRAP(0x51) BAD_TRAP(0x52) BAD_TRAP(0x53) BAD_TRAP(0x54) BAD_TRAP(0x55)
369 BAD_TRAP(0x56) BAD_TRAP(0x57) BAD_TRAP(0x58) BAD_TRAP(0x59) BAD_TRAP(0x5a)
370 BAD_TRAP(0x5b) BAD_TRAP(0x5c) BAD_TRAP(0x5d) BAD_TRAP(0x5e) BAD_TRAP(0x5f)
371 BAD_TRAP(0x60) BAD_TRAP(0x61) BAD_TRAP(0x62) BAD_TRAP(0x63) BAD_TRAP(0x64)
372 BAD_TRAP(0x65) BAD_TRAP(0x66) BAD_TRAP(0x67) BAD_TRAP(0x68) BAD_TRAP(0x69)
373 BAD_TRAP(0x6a) BAD_TRAP(0x6b) BAD_TRAP(0x6c) BAD_TRAP(0x6d) BAD_TRAP(0x6e)
374 BAD_TRAP(0x6f) BAD_TRAP(0x70) BAD_TRAP(0x71) BAD_TRAP(0x72) BAD_TRAP(0x73)
375 BAD_TRAP(0x74) BAD_TRAP(0x75) BAD_TRAP(0x76) BAD_TRAP(0x77) BAD_TRAP(0x78)
376 BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7d)
377 BAD_TRAP(0x7e) BAD_TRAP(0x7f)
378 BAD_TRAP(0x80)
379 BREAKPOINT_TRAP
380 TRAP_ENTRY(0x82, do_hw_divzero)
381 TRAP_ENTRY(0x83, do_flush_windows)
382 BAD_TRAP(0x84) BAD_TRAP(0x85)
383 BAD_TRAP(0x86) BAD_TRAP(0x87) BAD_TRAP(0x88)
384 BAD_TRAP(0x89) BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
385 BAD_TRAP(0x8d) BAD_TRAP(0x8e) BAD_TRAP(0x8f)
386 LINUX_SYSCALL_TRAP
387 BAD_TRAP(0x91) BAD_TRAP(0x92) BAD_TRAP(0x93) BAD_TRAP(0x94)
388 BAD_TRAP(0x95) BAD_TRAP(0x96) BAD_TRAP(0x97) BAD_TRAP(0x98) BAD_TRAP(0x99)
389 BAD_TRAP(0x9a) BAD_TRAP(0x9b) BAD_TRAP(0x9c) BAD_TRAP(0x9d) BAD_TRAP(0x9e)
390 BAD_TRAP(0x9f)
391 GETCC_TRAP
392 SETCC_TRAP
393 GETPSR_TRAP
394 BAD_TRAP(0xa3) BAD_TRAP(0xa4) BAD_TRAP(0xa5) BAD_TRAP(0xa6)
395 BAD_TRAP(0xa7) BAD_TRAP(0xa8) BAD_TRAP(0xa9) BAD_TRAP(0xaa) BAD_TRAP(0xab)
396 BAD_TRAP(0xac) BAD_TRAP(0xad) BAD_TRAP(0xae) BAD_TRAP(0xaf) BAD_TRAP(0xb0)
397 BAD_TRAP(0xb1) BAD_TRAP(0xb2) BAD_TRAP(0xb3) BAD_TRAP(0xb4) BAD_TRAP(0xb5)
398 BAD_TRAP(0xb6) BAD_TRAP(0xb7) BAD_TRAP(0xb8) BAD_TRAP(0xb9) BAD_TRAP(0xba)
399 BAD_TRAP(0xbb) BAD_TRAP(0xbc) BAD_TRAP(0xbd) BAD_TRAP(0xbe) BAD_TRAP(0xbf)
400 BAD_TRAP(0xc0) BAD_TRAP(0xc1) BAD_TRAP(0xc2) BAD_TRAP(0xc3) BAD_TRAP(0xc4)
401 BAD_TRAP(0xc5) BAD_TRAP(0xc6) BAD_TRAP(0xc7) BAD_TRAP(0xc8) BAD_TRAP(0xc9)
402 BAD_TRAP(0xca) BAD_TRAP(0xcb) BAD_TRAP(0xcc) BAD_TRAP(0xcd) BAD_TRAP(0xce)
403 BAD_TRAP(0xcf) BAD_TRAP(0xd0) BAD_TRAP(0xd1) BAD_TRAP(0xd2) BAD_TRAP(0xd3)
404 BAD_TRAP(0xd4) BAD_TRAP(0xd5) BAD_TRAP(0xd6) BAD_TRAP(0xd7) BAD_TRAP(0xd8)
405 BAD_TRAP(0xd9) BAD_TRAP(0xda) BAD_TRAP(0xdb) BAD_TRAP(0xdc) BAD_TRAP(0xdd)
406 BAD_TRAP(0xde) BAD_TRAP(0xdf) BAD_TRAP(0xe0) BAD_TRAP(0xe1) BAD_TRAP(0xe2)
407 BAD_TRAP(0xe3) BAD_TRAP(0xe4) BAD_TRAP(0xe5) BAD_TRAP(0xe6) BAD_TRAP(0xe7)
408 BAD_TRAP(0xe8) BAD_TRAP(0xe9) BAD_TRAP(0xea) BAD_TRAP(0xeb) BAD_TRAP(0xec)
409 BAD_TRAP(0xed) BAD_TRAP(0xee) BAD_TRAP(0xef) BAD_TRAP(0xf0) BAD_TRAP(0xf1)
410 BAD_TRAP(0xf2) BAD_TRAP(0xf3) BAD_TRAP(0xf4) BAD_TRAP(0xf5) BAD_TRAP(0xf6)
411 BAD_TRAP(0xf7) BAD_TRAP(0xf8) BAD_TRAP(0xf9) BAD_TRAP(0xfa) BAD_TRAP(0xfb)
412 BAD_TRAP(0xfc)
413 KGDB_TRAP(0xfd)
414 BAD_TRAP(0xfe)
415 BAD_TRAP(0xff)
416
417#endif
diff --git a/arch/sparc/kernel/ttable.S b/arch/sparc/kernel/ttable_64.S
index c6dfdaa29e20..c6dfdaa29e20 100644
--- a/arch/sparc/kernel/ttable.S
+++ b/arch/sparc/kernel/ttable_64.S
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c
index dae85bc2eda5..f81d038f7340 100644
--- a/arch/sparc/kernel/unaligned_64.c
+++ b/arch/sparc/kernel/unaligned_64.c
@@ -21,7 +21,6 @@
21#include <linux/bitops.h> 21#include <linux/bitops.h>
22#include <linux/perf_event.h> 22#include <linux/perf_event.h>
23#include <linux/ratelimit.h> 23#include <linux/ratelimit.h>
24#include <linux/bitops.h>
25#include <asm/fpumacro.h> 24#include <asm/fpumacro.h>
26#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
27 26
diff --git a/arch/sparc/kernel/wof.S b/arch/sparc/kernel/wof.S
index 3bbcd8dc9abf..4c2de3cf309b 100644
--- a/arch/sparc/kernel/wof.S
+++ b/arch/sparc/kernel/wof.S
@@ -163,9 +163,8 @@ spwin_fromuser:
163 * the label 'spwin_user_stack_is_bolixed' which will take 163 * the label 'spwin_user_stack_is_bolixed' which will take
164 * care of things at that point. 164 * care of things at that point.
165 */ 165 */
166 .globl spwin_mmu_patchme 166 b spwin_srmmu_stackchk
167spwin_mmu_patchme: b spwin_sun4c_stackchk 167 andcc %sp, 0x7, %g0
168 andcc %sp, 0x7, %g0
169 168
170spwin_good_ustack: 169spwin_good_ustack:
171 /* LOCATION: Window to be saved */ 170 /* LOCATION: Window to be saved */
@@ -306,73 +305,6 @@ spwin_bad_ustack_from_kernel:
306 * As noted above %curptr cannot be touched by this routine at all. 305 * As noted above %curptr cannot be touched by this routine at all.
307 */ 306 */
308 307
309spwin_sun4c_stackchk:
310 /* LOCATION: Window to be saved on the stack */
311
312 /* See if the stack is in the address space hole but first,
313 * check results of callers andcc %sp, 0x7, %g0
314 */
315 be 1f
316 sra %sp, 29, %glob_tmp
317
318 rd %psr, %glob_tmp
319 b spwin_user_stack_is_bolixed + 0x4
320 nop
321
3221:
323 add %glob_tmp, 0x1, %glob_tmp
324 andncc %glob_tmp, 0x1, %g0
325 be 1f
326 and %sp, 0xfff, %glob_tmp ! delay slot
327
328 rd %psr, %glob_tmp
329 b spwin_user_stack_is_bolixed + 0x4
330 nop
331
332 /* See if our dump area will be on more than one
333 * page.
334 */
3351:
336 add %glob_tmp, 0x38, %glob_tmp
337 andncc %glob_tmp, 0xff8, %g0
338 be spwin_sun4c_onepage ! only one page to check
339 lda [%sp] ASI_PTE, %glob_tmp ! have to check first page anyways
340
341spwin_sun4c_twopages:
342 /* Is first page ok permission wise? */
343 srl %glob_tmp, 29, %glob_tmp
344 cmp %glob_tmp, 0x6
345 be 1f
346 add %sp, 0x38, %glob_tmp /* Is second page in vma hole? */
347
348 rd %psr, %glob_tmp
349 b spwin_user_stack_is_bolixed + 0x4
350 nop
351
3521:
353 sra %glob_tmp, 29, %glob_tmp
354 add %glob_tmp, 0x1, %glob_tmp
355 andncc %glob_tmp, 0x1, %g0
356 be 1f
357 add %sp, 0x38, %glob_tmp
358
359 rd %psr, %glob_tmp
360 b spwin_user_stack_is_bolixed + 0x4
361 nop
362
3631:
364 lda [%glob_tmp] ASI_PTE, %glob_tmp
365
366spwin_sun4c_onepage:
367 srl %glob_tmp, 29, %glob_tmp
368 cmp %glob_tmp, 0x6 ! can user write to it?
369 be spwin_good_ustack ! success
370 nop
371
372 rd %psr, %glob_tmp
373 b spwin_user_stack_is_bolixed + 0x4
374 nop
375
376 /* This is a generic SRMMU routine. As far as I know this 308 /* This is a generic SRMMU routine. As far as I know this
377 * works for all current v8/srmmu implementations, we'll 309 * works for all current v8/srmmu implementations, we'll
378 * see... 310 * see...
diff --git a/arch/sparc/kernel/wuf.S b/arch/sparc/kernel/wuf.S
index 779ff750603d..9fde91a249e0 100644
--- a/arch/sparc/kernel/wuf.S
+++ b/arch/sparc/kernel/wuf.S
@@ -131,12 +131,9 @@ fwin_from_user:
131 131
132 /* LOCATION: Window 'W' */ 132 /* LOCATION: Window 'W' */
133 133
134 /* Branch to the architecture specific stack validation 134 /* Branch to the stack validation routine */
135 * routine. They can be found below... 135 b srmmu_fwin_stackchk
136 */ 136 andcc %sp, 0x7, %g0
137 .globl fwin_mmu_patchme
138fwin_mmu_patchme: b sun4c_fwin_stackchk
139 andcc %sp, 0x7, %g0
140 137
141#define STACK_OFFSET (THREAD_SIZE - TRACEREG_SZ - STACKFRAME_SZ) 138#define STACK_OFFSET (THREAD_SIZE - TRACEREG_SZ - STACKFRAME_SZ)
142 139
@@ -242,57 +239,6 @@ fwin_user_finish_up:
242 * 'someone elses' window possibly. 239 * 'someone elses' window possibly.
243 */ 240 */
244 241
245 .align 4
246sun4c_fwin_stackchk:
247 /* LOCATION: Window 'W' */
248
249 /* Caller did 'andcc %sp, 0x7, %g0' */
250 be 1f
251 and %sp, 0xfff, %l0 ! delay slot
252
253 b,a fwin_user_stack_is_bolixed
254
255 /* See if we have to check the sanity of one page or two */
2561:
257 add %l0, 0x38, %l0
258 sra %sp, 29, %l5
259 add %l5, 0x1, %l5
260 andncc %l5, 0x1, %g0
261 be 1f
262 andncc %l0, 0xff8, %g0
263
264 b,a fwin_user_stack_is_bolixed /* %sp is in vma hole, yuck */
265
2661:
267 be sun4c_fwin_onepage /* Only one page to check */
268 lda [%sp] ASI_PTE, %l1
269sun4c_fwin_twopages:
270 add %sp, 0x38, %l0
271 sra %l0, 29, %l5
272 add %l5, 0x1, %l5
273 andncc %l5, 0x1, %g0
274 be 1f
275 lda [%l0] ASI_PTE, %l1
276
277 b,a fwin_user_stack_is_bolixed /* Second page in vma hole */
278
2791:
280 srl %l1, 29, %l1
281 andcc %l1, 0x4, %g0
282 bne sun4c_fwin_onepage
283 lda [%sp] ASI_PTE, %l1
284
285 b,a fwin_user_stack_is_bolixed /* Second page has bad perms */
286
287sun4c_fwin_onepage:
288 srl %l1, 29, %l1
289 andcc %l1, 0x4, %g0
290 bne fwin_user_stack_is_ok
291 nop
292
293 /* A page had bad page permissions, losing... */
294 b,a fwin_user_stack_is_bolixed
295
296 .globl srmmu_fwin_stackchk 242 .globl srmmu_fwin_stackchk
297srmmu_fwin_stackchk: 243srmmu_fwin_stackchk:
298 /* LOCATION: Window 'W' */ 244 /* LOCATION: Window 'W' */
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile
index a3fc4375a150..389628f50a15 100644
--- a/arch/sparc/lib/Makefile
+++ b/arch/sparc/lib/Makefile
@@ -4,7 +4,7 @@
4asflags-y := -ansi -DST_DIV0=0x02 4asflags-y := -ansi -DST_DIV0=0x02
5ccflags-y := -Werror 5ccflags-y := -Werror
6 6
7lib-$(CONFIG_SPARC32) += mul.o rem.o sdiv.o udiv.o umul.o urem.o ashrdi3.o 7lib-$(CONFIG_SPARC32) += ashrdi3.o
8lib-$(CONFIG_SPARC32) += memcpy.o memset.o 8lib-$(CONFIG_SPARC32) += memcpy.o memset.o
9lib-y += strlen.o 9lib-y += strlen.o
10lib-y += checksum_$(BITS).o 10lib-y += checksum_$(BITS).o
@@ -13,7 +13,7 @@ lib-y += memscan_$(BITS).o memcmp.o strncmp_$(BITS).o
13lib-y += strncpy_from_user_$(BITS).o strlen_user_$(BITS).o 13lib-y += strncpy_from_user_$(BITS).o strlen_user_$(BITS).o
14lib-$(CONFIG_SPARC32) += divdi3.o udivdi3.o 14lib-$(CONFIG_SPARC32) += divdi3.o udivdi3.o
15lib-$(CONFIG_SPARC32) += copy_user.o locks.o 15lib-$(CONFIG_SPARC32) += copy_user.o locks.o
16lib-y += atomic_$(BITS).o 16lib-$(CONFIG_SPARC64) += atomic_64.o
17lib-$(CONFIG_SPARC32) += lshrdi3.o ashldi3.o 17lib-$(CONFIG_SPARC32) += lshrdi3.o ashldi3.o
18lib-$(CONFIG_SPARC32) += muldi3.o bitext.o cmpdi2.o 18lib-$(CONFIG_SPARC32) += muldi3.o bitext.o cmpdi2.o
19 19
@@ -40,7 +40,7 @@ lib-$(CONFIG_SPARC64) += copy_in_user.o user_fixup.o memmove.o
40lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o 40lib-$(CONFIG_SPARC64) += mcount.o ipcsum.o xor.o hweight.o ffs.o
41 41
42obj-y += iomap.o 42obj-y += iomap.o
43obj-$(CONFIG_SPARC32) += atomic32.o 43obj-$(CONFIG_SPARC32) += atomic32.o ucmpdi2.o
44obj-y += ksyms.o 44obj-y += ksyms.o
45obj-$(CONFIG_SPARC64) += PeeCeeI.o 45obj-$(CONFIG_SPARC64) += PeeCeeI.o
46obj-y += usercopy.o 46obj-y += usercopy.o
diff --git a/arch/sparc/lib/ashldi3.S b/arch/sparc/lib/ashldi3.S
index 17912e608716..86f60de07b0a 100644
--- a/arch/sparc/lib/ashldi3.S
+++ b/arch/sparc/lib/ashldi3.S
@@ -5,10 +5,10 @@
5 * Copyright (C) 1999 David S. Miller (davem@redhat.com) 5 * Copyright (C) 1999 David S. Miller (davem@redhat.com)
6 */ 6 */
7 7
8#include <linux/linkage.h>
9
8 .text 10 .text
9 .align 4 11ENTRY(__ashldi3)
10 .globl __ashldi3
11__ashldi3:
12 cmp %o2, 0 12 cmp %o2, 0
13 be 9f 13 be 9f
14 mov 0x20, %g2 14 mov 0x20, %g2
@@ -32,3 +32,4 @@ __ashldi3:
329: 329:
33 retl 33 retl
34 nop 34 nop
35ENDPROC(__ashldi3)
diff --git a/arch/sparc/lib/ashrdi3.S b/arch/sparc/lib/ashrdi3.S
index 85398fd6dcc9..6eb8ba2dd50e 100644
--- a/arch/sparc/lib/ashrdi3.S
+++ b/arch/sparc/lib/ashrdi3.S
@@ -5,10 +5,10 @@
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 */ 6 */
7 7
8#include <linux/linkage.h>
9
8 .text 10 .text
9 .align 4 11ENTRY(__ashrdi3)
10 .globl __ashrdi3
11__ashrdi3:
12 tst %o2 12 tst %o2
13 be 3f 13 be 3f
14 or %g0, 32, %g2 14 or %g0, 32, %g2
@@ -34,3 +34,4 @@ __ashrdi3:
343: 343:
35 jmpl %o7 + 8, %g0 35 jmpl %o7 + 8, %g0
36 nop 36 nop
37ENDPROC(__ashrdi3)
diff --git a/arch/sparc/lib/atomic_32.S b/arch/sparc/lib/atomic_32.S
deleted file mode 100644
index eb6c7359cbd1..000000000000
--- a/arch/sparc/lib/atomic_32.S
+++ /dev/null
@@ -1,44 +0,0 @@
1/* atomic.S: Move this stuff here for better ICACHE hit rates.
2 *
3 * Copyright (C) 1996 David S. Miller (davem@caipfs.rutgers.edu)
4 */
5
6#include <asm/ptrace.h>
7#include <asm/psr.h>
8
9 .text
10 .align 4
11
12 .globl __atomic_begin
13__atomic_begin:
14
15#ifndef CONFIG_SMP
16 .globl ___xchg32_sun4c
17___xchg32_sun4c:
18 rd %psr, %g3
19 andcc %g3, PSR_PIL, %g0
20 bne 1f
21 nop
22 wr %g3, PSR_PIL, %psr
23 nop; nop; nop
241:
25 andcc %g3, PSR_PIL, %g0
26 ld [%g1], %g7
27 bne 1f
28 st %g2, [%g1]
29 wr %g3, 0x0, %psr
30 nop; nop; nop
311:
32 mov %g7, %g2
33 jmpl %o7 + 8, %g0
34 mov %g4, %o7
35
36 .globl ___xchg32_sun4md
37___xchg32_sun4md:
38 swap [%g1], %g2
39 jmpl %o7 + 8, %g0
40 mov %g4, %o7
41#endif
42
43 .globl __atomic_end
44__atomic_end:
diff --git a/arch/sparc/lib/atomic_64.S b/arch/sparc/lib/atomic_64.S
index 59186e0fcf39..4d502da3de78 100644
--- a/arch/sparc/lib/atomic_64.S
+++ b/arch/sparc/lib/atomic_64.S
@@ -3,6 +3,7 @@
3 * Copyright (C) 1999, 2007 David S. Miller (davem@davemloft.net) 3 * Copyright (C) 1999, 2007 David S. Miller (davem@davemloft.net)
4 */ 4 */
5 5
6#include <linux/linkage.h>
6#include <asm/asi.h> 7#include <asm/asi.h>
7#include <asm/backoff.h> 8#include <asm/backoff.h>
8 9
@@ -13,9 +14,7 @@
13 * memory barriers, and a second which returns 14 * memory barriers, and a second which returns
14 * a value and does the barriers. 15 * a value and does the barriers.
15 */ 16 */
16 .globl atomic_add 17ENTRY(atomic_add) /* %o0 = increment, %o1 = atomic_ptr */
17 .type atomic_add,#function
18atomic_add: /* %o0 = increment, %o1 = atomic_ptr */
19 BACKOFF_SETUP(%o2) 18 BACKOFF_SETUP(%o2)
201: lduw [%o1], %g1 191: lduw [%o1], %g1
21 add %g1, %o0, %g7 20 add %g1, %o0, %g7
@@ -26,11 +25,9 @@ atomic_add: /* %o0 = increment, %o1 = atomic_ptr */
26 retl 25 retl
27 nop 26 nop
282: BACKOFF_SPIN(%o2, %o3, 1b) 272: BACKOFF_SPIN(%o2, %o3, 1b)
29 .size atomic_add, .-atomic_add 28ENDPROC(atomic_add)
30 29
31 .globl atomic_sub 30ENTRY(atomic_sub) /* %o0 = decrement, %o1 = atomic_ptr */
32 .type atomic_sub,#function
33atomic_sub: /* %o0 = decrement, %o1 = atomic_ptr */
34 BACKOFF_SETUP(%o2) 31 BACKOFF_SETUP(%o2)
351: lduw [%o1], %g1 321: lduw [%o1], %g1
36 sub %g1, %o0, %g7 33 sub %g1, %o0, %g7
@@ -41,11 +38,9 @@ atomic_sub: /* %o0 = decrement, %o1 = atomic_ptr */
41 retl 38 retl
42 nop 39 nop
432: BACKOFF_SPIN(%o2, %o3, 1b) 402: BACKOFF_SPIN(%o2, %o3, 1b)
44 .size atomic_sub, .-atomic_sub 41ENDPROC(atomic_sub)
45 42
46 .globl atomic_add_ret 43ENTRY(atomic_add_ret) /* %o0 = increment, %o1 = atomic_ptr */
47 .type atomic_add_ret,#function
48atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
49 BACKOFF_SETUP(%o2) 44 BACKOFF_SETUP(%o2)
501: lduw [%o1], %g1 451: lduw [%o1], %g1
51 add %g1, %o0, %g7 46 add %g1, %o0, %g7
@@ -56,11 +51,9 @@ atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
56 retl 51 retl
57 sra %g1, 0, %o0 52 sra %g1, 0, %o0
582: BACKOFF_SPIN(%o2, %o3, 1b) 532: BACKOFF_SPIN(%o2, %o3, 1b)
59 .size atomic_add_ret, .-atomic_add_ret 54ENDPROC(atomic_add_ret)
60 55
61 .globl atomic_sub_ret 56ENTRY(atomic_sub_ret) /* %o0 = decrement, %o1 = atomic_ptr */
62 .type atomic_sub_ret,#function
63atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
64 BACKOFF_SETUP(%o2) 57 BACKOFF_SETUP(%o2)
651: lduw [%o1], %g1 581: lduw [%o1], %g1
66 sub %g1, %o0, %g7 59 sub %g1, %o0, %g7
@@ -71,11 +64,9 @@ atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
71 retl 64 retl
72 sra %g1, 0, %o0 65 sra %g1, 0, %o0
732: BACKOFF_SPIN(%o2, %o3, 1b) 662: BACKOFF_SPIN(%o2, %o3, 1b)
74 .size atomic_sub_ret, .-atomic_sub_ret 67ENDPROC(atomic_sub_ret)
75 68
76 .globl atomic64_add 69ENTRY(atomic64_add) /* %o0 = increment, %o1 = atomic_ptr */
77 .type atomic64_add,#function
78atomic64_add: /* %o0 = increment, %o1 = atomic_ptr */
79 BACKOFF_SETUP(%o2) 70 BACKOFF_SETUP(%o2)
801: ldx [%o1], %g1 711: ldx [%o1], %g1
81 add %g1, %o0, %g7 72 add %g1, %o0, %g7
@@ -86,11 +77,9 @@ atomic64_add: /* %o0 = increment, %o1 = atomic_ptr */
86 retl 77 retl
87 nop 78 nop
882: BACKOFF_SPIN(%o2, %o3, 1b) 792: BACKOFF_SPIN(%o2, %o3, 1b)
89 .size atomic64_add, .-atomic64_add 80ENDPROC(atomic64_add)
90 81
91 .globl atomic64_sub 82ENTRY(atomic64_sub) /* %o0 = decrement, %o1 = atomic_ptr */
92 .type atomic64_sub,#function
93atomic64_sub: /* %o0 = decrement, %o1 = atomic_ptr */
94 BACKOFF_SETUP(%o2) 83 BACKOFF_SETUP(%o2)
951: ldx [%o1], %g1 841: ldx [%o1], %g1
96 sub %g1, %o0, %g7 85 sub %g1, %o0, %g7
@@ -101,11 +90,9 @@ atomic64_sub: /* %o0 = decrement, %o1 = atomic_ptr */
101 retl 90 retl
102 nop 91 nop
1032: BACKOFF_SPIN(%o2, %o3, 1b) 922: BACKOFF_SPIN(%o2, %o3, 1b)
104 .size atomic64_sub, .-atomic64_sub 93ENDPROC(atomic64_sub)
105 94
106 .globl atomic64_add_ret 95ENTRY(atomic64_add_ret) /* %o0 = increment, %o1 = atomic_ptr */
107 .type atomic64_add_ret,#function
108atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
109 BACKOFF_SETUP(%o2) 96 BACKOFF_SETUP(%o2)
1101: ldx [%o1], %g1 971: ldx [%o1], %g1
111 add %g1, %o0, %g7 98 add %g1, %o0, %g7
@@ -116,11 +103,9 @@ atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
116 retl 103 retl
117 add %g1, %o0, %o0 104 add %g1, %o0, %o0
1182: BACKOFF_SPIN(%o2, %o3, 1b) 1052: BACKOFF_SPIN(%o2, %o3, 1b)
119 .size atomic64_add_ret, .-atomic64_add_ret 106ENDPROC(atomic64_add_ret)
120 107
121 .globl atomic64_sub_ret 108ENTRY(atomic64_sub_ret) /* %o0 = decrement, %o1 = atomic_ptr */
122 .type atomic64_sub_ret,#function
123atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
124 BACKOFF_SETUP(%o2) 109 BACKOFF_SETUP(%o2)
1251: ldx [%o1], %g1 1101: ldx [%o1], %g1
126 sub %g1, %o0, %g7 111 sub %g1, %o0, %g7
@@ -131,4 +116,4 @@ atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
131 retl 116 retl
132 sub %g1, %o0, %o0 117 sub %g1, %o0, %o0
1332: BACKOFF_SPIN(%o2, %o3, 1b) 1182: BACKOFF_SPIN(%o2, %o3, 1b)
134 .size atomic64_sub_ret, .-atomic64_sub_ret 119ENDPROC(atomic64_sub_ret)
diff --git a/arch/sparc/lib/bitops.S b/arch/sparc/lib/bitops.S
index 3dc61d5537c0..36f72cc0e67e 100644
--- a/arch/sparc/lib/bitops.S
+++ b/arch/sparc/lib/bitops.S
@@ -3,14 +3,13 @@
3 * Copyright (C) 2000, 2007 David S. Miller (davem@davemloft.net) 3 * Copyright (C) 2000, 2007 David S. Miller (davem@davemloft.net)
4 */ 4 */
5 5
6#include <linux/linkage.h>
6#include <asm/asi.h> 7#include <asm/asi.h>
7#include <asm/backoff.h> 8#include <asm/backoff.h>
8 9
9 .text 10 .text
10 11
11 .globl test_and_set_bit 12ENTRY(test_and_set_bit) /* %o0=nr, %o1=addr */
12 .type test_and_set_bit,#function
13test_and_set_bit: /* %o0=nr, %o1=addr */
14 BACKOFF_SETUP(%o3) 13 BACKOFF_SETUP(%o3)
15 srlx %o0, 6, %g1 14 srlx %o0, 6, %g1
16 mov 1, %o2 15 mov 1, %o2
@@ -29,11 +28,9 @@ test_and_set_bit: /* %o0=nr, %o1=addr */
29 retl 28 retl
30 nop 29 nop
312: BACKOFF_SPIN(%o3, %o4, 1b) 302: BACKOFF_SPIN(%o3, %o4, 1b)
32 .size test_and_set_bit, .-test_and_set_bit 31ENDPROC(test_and_set_bit)
33 32
34 .globl test_and_clear_bit 33ENTRY(test_and_clear_bit) /* %o0=nr, %o1=addr */
35 .type test_and_clear_bit,#function
36test_and_clear_bit: /* %o0=nr, %o1=addr */
37 BACKOFF_SETUP(%o3) 34 BACKOFF_SETUP(%o3)
38 srlx %o0, 6, %g1 35 srlx %o0, 6, %g1
39 mov 1, %o2 36 mov 1, %o2
@@ -52,11 +49,9 @@ test_and_clear_bit: /* %o0=nr, %o1=addr */
52 retl 49 retl
53 nop 50 nop
542: BACKOFF_SPIN(%o3, %o4, 1b) 512: BACKOFF_SPIN(%o3, %o4, 1b)
55 .size test_and_clear_bit, .-test_and_clear_bit 52ENDPROC(test_and_clear_bit)
56 53
57 .globl test_and_change_bit 54ENTRY(test_and_change_bit) /* %o0=nr, %o1=addr */
58 .type test_and_change_bit,#function
59test_and_change_bit: /* %o0=nr, %o1=addr */
60 BACKOFF_SETUP(%o3) 55 BACKOFF_SETUP(%o3)
61 srlx %o0, 6, %g1 56 srlx %o0, 6, %g1
62 mov 1, %o2 57 mov 1, %o2
@@ -75,11 +70,9 @@ test_and_change_bit: /* %o0=nr, %o1=addr */
75 retl 70 retl
76 nop 71 nop
772: BACKOFF_SPIN(%o3, %o4, 1b) 722: BACKOFF_SPIN(%o3, %o4, 1b)
78 .size test_and_change_bit, .-test_and_change_bit 73ENDPROC(test_and_change_bit)
79 74
80 .globl set_bit 75ENTRY(set_bit) /* %o0=nr, %o1=addr */
81 .type set_bit,#function
82set_bit: /* %o0=nr, %o1=addr */
83 BACKOFF_SETUP(%o3) 76 BACKOFF_SETUP(%o3)
84 srlx %o0, 6, %g1 77 srlx %o0, 6, %g1
85 mov 1, %o2 78 mov 1, %o2
@@ -96,11 +89,9 @@ set_bit: /* %o0=nr, %o1=addr */
96 retl 89 retl
97 nop 90 nop
982: BACKOFF_SPIN(%o3, %o4, 1b) 912: BACKOFF_SPIN(%o3, %o4, 1b)
99 .size set_bit, .-set_bit 92ENDPROC(set_bit)
100 93
101 .globl clear_bit 94ENTRY(clear_bit) /* %o0=nr, %o1=addr */
102 .type clear_bit,#function
103clear_bit: /* %o0=nr, %o1=addr */
104 BACKOFF_SETUP(%o3) 95 BACKOFF_SETUP(%o3)
105 srlx %o0, 6, %g1 96 srlx %o0, 6, %g1
106 mov 1, %o2 97 mov 1, %o2
@@ -117,11 +108,9 @@ clear_bit: /* %o0=nr, %o1=addr */
117 retl 108 retl
118 nop 109 nop
1192: BACKOFF_SPIN(%o3, %o4, 1b) 1102: BACKOFF_SPIN(%o3, %o4, 1b)
120 .size clear_bit, .-clear_bit 111ENDPROC(clear_bit)
121 112
122 .globl change_bit 113ENTRY(change_bit) /* %o0=nr, %o1=addr */
123 .type change_bit,#function
124change_bit: /* %o0=nr, %o1=addr */
125 BACKOFF_SETUP(%o3) 114 BACKOFF_SETUP(%o3)
126 srlx %o0, 6, %g1 115 srlx %o0, 6, %g1
127 mov 1, %o2 116 mov 1, %o2
@@ -138,4 +127,4 @@ change_bit: /* %o0=nr, %o1=addr */
138 retl 127 retl
139 nop 128 nop
1402: BACKOFF_SPIN(%o3, %o4, 1b) 1292: BACKOFF_SPIN(%o3, %o4, 1b)
141 .size change_bit, .-change_bit 130ENDPROC(change_bit)
diff --git a/arch/sparc/lib/blockops.S b/arch/sparc/lib/blockops.S
index 804be87f9a42..3c771011ff4b 100644
--- a/arch/sparc/lib/blockops.S
+++ b/arch/sparc/lib/blockops.S
@@ -4,6 +4,7 @@
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
5 */ 5 */
6 6
7#include <linux/linkage.h>
7#include <asm/page.h> 8#include <asm/page.h>
8 9
9 /* Zero out 64 bytes of memory at (buf + offset). 10 /* Zero out 64 bytes of memory at (buf + offset).
@@ -44,10 +45,7 @@
44 */ 45 */
45 46
46 .text 47 .text
47 .align 4 48ENTRY(bzero_1page)
48 .globl bzero_1page, __copy_1page
49
50bzero_1page:
51/* NOTE: If you change the number of insns of this routine, please check 49/* NOTE: If you change the number of insns of this routine, please check
52 * arch/sparc/mm/hypersparc.S */ 50 * arch/sparc/mm/hypersparc.S */
53 /* %o0 = buf */ 51 /* %o0 = buf */
@@ -65,8 +63,9 @@ bzero_1page:
65 63
66 retl 64 retl
67 nop 65 nop
66ENDPROC(bzero_1page)
68 67
69__copy_1page: 68ENTRY(__copy_1page)
70/* NOTE: If you change the number of insns of this routine, please check 69/* NOTE: If you change the number of insns of this routine, please check
71 * arch/sparc/mm/hypersparc.S */ 70 * arch/sparc/mm/hypersparc.S */
72 /* %o0 = dst, %o1 = src */ 71 /* %o0 = dst, %o1 = src */
@@ -87,3 +86,4 @@ __copy_1page:
87 86
88 retl 87 retl
89 nop 88 nop
89ENDPROC(__copy_1page)
diff --git a/arch/sparc/lib/bzero.S b/arch/sparc/lib/bzero.S
index 615f401edf69..8c058114b649 100644
--- a/arch/sparc/lib/bzero.S
+++ b/arch/sparc/lib/bzero.S
@@ -4,11 +4,11 @@
4 * Copyright (C) 2005 David S. Miller <davem@davemloft.net> 4 * Copyright (C) 2005 David S. Miller <davem@davemloft.net>
5 */ 5 */
6 6
7#include <linux/linkage.h>
8
7 .text 9 .text
8 10
9 .globl memset 11ENTRY(memset) /* %o0=buf, %o1=pat, %o2=len */
10 .type memset, #function
11memset: /* %o0=buf, %o1=pat, %o2=len */
12 and %o1, 0xff, %o3 12 and %o1, 0xff, %o3
13 mov %o2, %o1 13 mov %o2, %o1
14 sllx %o3, 8, %g1 14 sllx %o3, 8, %g1
@@ -19,9 +19,7 @@ memset: /* %o0=buf, %o1=pat, %o2=len */
19 ba,pt %xcc, 1f 19 ba,pt %xcc, 1f
20 or %g1, %o2, %o2 20 or %g1, %o2, %o2
21 21
22 .globl __bzero 22ENTRY(__bzero) /* %o0=buf, %o1=len */
23 .type __bzero, #function
24__bzero: /* %o0=buf, %o1=len */
25 clr %o2 23 clr %o2
261: mov %o0, %o3 241: mov %o0, %o3
27 brz,pn %o1, __bzero_done 25 brz,pn %o1, __bzero_done
@@ -78,8 +76,8 @@ __bzero_tiny:
78__bzero_done: 76__bzero_done:
79 retl 77 retl
80 mov %o3, %o0 78 mov %o3, %o0
81 .size __bzero, .-__bzero 79ENDPROC(__bzero)
82 .size memset, .-memset 80ENDPROC(memset)
83 81
84#define EX_ST(x,y) \ 82#define EX_ST(x,y) \
8598: x,y; \ 8398: x,y; \
@@ -89,9 +87,7 @@ __bzero_done:
89 .text; \ 87 .text; \
90 .align 4; 88 .align 4;
91 89
92 .globl __clear_user 90ENTRY(__clear_user) /* %o0=buf, %o1=len */
93 .type __clear_user, #function
94__clear_user: /* %o0=buf, %o1=len */
95 brz,pn %o1, __clear_user_done 91 brz,pn %o1, __clear_user_done
96 cmp %o1, 16 92 cmp %o1, 16
97 bl,pn %icc, __clear_user_tiny 93 bl,pn %icc, __clear_user_tiny
@@ -146,4 +142,4 @@ __clear_user_tiny:
146__clear_user_done: 142__clear_user_done:
147 retl 143 retl
148 clr %o0 144 clr %o0
149 .size __clear_user, .-__clear_user 145ENDPROC(__clear_user)
diff --git a/arch/sparc/lib/divdi3.S b/arch/sparc/lib/divdi3.S
index d74bc0925f2d..9614b48b6ef8 100644
--- a/arch/sparc/lib/divdi3.S
+++ b/arch/sparc/lib/divdi3.S
@@ -19,7 +19,6 @@ Boston, MA 02111-1307, USA. */
19 19
20 .text 20 .text
21 .align 4 21 .align 4
22 .global .udiv
23 .globl __divdi3 22 .globl __divdi3
24__divdi3: 23__divdi3:
25 save %sp,-104,%sp 24 save %sp,-104,%sp
@@ -83,8 +82,9 @@ __divdi3:
83 bne .LL85 82 bne .LL85
84 mov %i0,%o2 83 mov %i0,%o2
85 mov 1,%o0 84 mov 1,%o0
86 call .udiv,0
87 mov 0,%o1 85 mov 0,%o1
86 wr %g0, 0, %y
87 udiv %o0, %o1, %o0
88 mov %o0,%o4 88 mov %o0,%o4
89 mov %i0,%o2 89 mov %i0,%o2
90.LL85: 90.LL85:
diff --git a/arch/sparc/lib/ipcsum.S b/arch/sparc/lib/ipcsum.S
index 58ca5b9a8778..4742d59029ee 100644
--- a/arch/sparc/lib/ipcsum.S
+++ b/arch/sparc/lib/ipcsum.S
@@ -1,8 +1,7 @@
1#include <linux/linkage.h>
2
1 .text 3 .text
2 .align 32 4ENTRY(ip_fast_csum) /* %o0 = iph, %o1 = ihl */
3 .globl ip_fast_csum
4 .type ip_fast_csum,#function
5ip_fast_csum: /* %o0 = iph, %o1 = ihl */
6 sub %o1, 4, %g7 5 sub %o1, 4, %g7
7 lduw [%o0 + 0x00], %o2 6 lduw [%o0 + 0x00], %o2
8 lduw [%o0 + 0x04], %g2 7 lduw [%o0 + 0x04], %g2
@@ -31,4 +30,4 @@ ip_fast_csum: /* %o0 = iph, %o1 = ihl */
31 set 0xffff, %o1 30 set 0xffff, %o1
32 retl 31 retl
33 and %o2, %o1, %o0 32 and %o2, %o1, %o0
34 .size ip_fast_csum, .-ip_fast_csum 33ENDPROC(ip_fast_csum)
diff --git a/arch/sparc/lib/ksyms.c b/arch/sparc/lib/ksyms.c
index f73c2240fe60..2dc30875c8bc 100644
--- a/arch/sparc/lib/ksyms.c
+++ b/arch/sparc/lib/ksyms.c
@@ -56,23 +56,11 @@ extern int __divdi3(int, int);
56extern void (*__copy_1page)(void *, const void *); 56extern void (*__copy_1page)(void *, const void *);
57extern void (*bzero_1page)(void *); 57extern void (*bzero_1page)(void *);
58 58
59extern int __strncmp(const char *, const char *, __kernel_size_t);
60
61extern void ___rw_read_enter(void); 59extern void ___rw_read_enter(void);
62extern void ___rw_read_try(void); 60extern void ___rw_read_try(void);
63extern void ___rw_read_exit(void); 61extern void ___rw_read_exit(void);
64extern void ___rw_write_enter(void); 62extern void ___rw_write_enter(void);
65 63
66/* Alias functions whose names begin with "." and export the aliases.
67 * The module references will be fixed up by module_frob_arch_sections.
68 */
69extern int _Div(int, int);
70extern int _Mul(int, int);
71extern int _Rem(int, int);
72extern unsigned _Udiv(unsigned, unsigned);
73extern unsigned _Umul(unsigned, unsigned);
74extern unsigned _Urem(unsigned, unsigned);
75
76/* Networking helper routines. */ 64/* Networking helper routines. */
77EXPORT_SYMBOL(__csum_partial_copy_sparc_generic); 65EXPORT_SYMBOL(__csum_partial_copy_sparc_generic);
78 66
@@ -81,9 +69,6 @@ EXPORT_SYMBOL(__copy_1page);
81EXPORT_SYMBOL(__memmove); 69EXPORT_SYMBOL(__memmove);
82EXPORT_SYMBOL(bzero_1page); 70EXPORT_SYMBOL(bzero_1page);
83 71
84/* string functions */
85EXPORT_SYMBOL(__strncmp);
86
87/* Moving data to/from/in userspace. */ 72/* Moving data to/from/in userspace. */
88EXPORT_SYMBOL(__copy_user); 73EXPORT_SYMBOL(__copy_user);
89 74
@@ -100,13 +85,6 @@ EXPORT_SYMBOL(__ashldi3);
100EXPORT_SYMBOL(__lshrdi3); 85EXPORT_SYMBOL(__lshrdi3);
101EXPORT_SYMBOL(__muldi3); 86EXPORT_SYMBOL(__muldi3);
102EXPORT_SYMBOL(__divdi3); 87EXPORT_SYMBOL(__divdi3);
103
104EXPORT_SYMBOL(_Rem);
105EXPORT_SYMBOL(_Urem);
106EXPORT_SYMBOL(_Mul);
107EXPORT_SYMBOL(_Umul);
108EXPORT_SYMBOL(_Div);
109EXPORT_SYMBOL(_Udiv);
110#endif 88#endif
111 89
112/* 90/*
diff --git a/arch/sparc/lib/lshrdi3.S b/arch/sparc/lib/lshrdi3.S
index 47a1354c1602..60ebc7cdbee0 100644
--- a/arch/sparc/lib/lshrdi3.S
+++ b/arch/sparc/lib/lshrdi3.S
@@ -1,6 +1,6 @@
1#include <linux/linkage.h>
1 2
2 .globl __lshrdi3 3ENTRY(__lshrdi3)
3__lshrdi3:
4 cmp %o2, 0 4 cmp %o2, 0
5 be 3f 5 be 3f
6 mov 0x20, %g2 6 mov 0x20, %g2
@@ -24,3 +24,4 @@ __lshrdi3:
243: 243:
25 retl 25 retl
26 nop 26 nop
27ENDPROC(__lshrdi3)
diff --git a/arch/sparc/lib/memmove.S b/arch/sparc/lib/memmove.S
index 97395802c23c..b7f6334e159f 100644
--- a/arch/sparc/lib/memmove.S
+++ b/arch/sparc/lib/memmove.S
@@ -4,11 +4,10 @@
4 * Copyright (C) 1996, 1997, 1998, 1999 Jakub Jelinek (jj@ultra.linux.cz) 4 * Copyright (C) 1996, 1997, 1998, 1999 Jakub Jelinek (jj@ultra.linux.cz)
5 */ 5 */
6 6
7#include <linux/linkage.h>
8
7 .text 9 .text
8 .align 32 10ENTRY(memmove) /* o0=dst o1=src o2=len */
9 .globl memmove
10 .type memmove,#function
11memmove: /* o0=dst o1=src o2=len */
12 mov %o0, %g1 11 mov %o0, %g1
13 cmp %o0, %o1 12 cmp %o0, %o1
14 bleu,pt %xcc, memcpy 13 bleu,pt %xcc, memcpy
@@ -28,4 +27,4 @@ memmove: /* o0=dst o1=src o2=len */
28 27
29 retl 28 retl
30 mov %g1, %o0 29 mov %g1, %o0
31 .size memmove, .-memmove 30ENDPROC(memmove)
diff --git a/arch/sparc/lib/mul.S b/arch/sparc/lib/mul.S
deleted file mode 100644
index c45470d0b0ce..000000000000
--- a/arch/sparc/lib/mul.S
+++ /dev/null
@@ -1,137 +0,0 @@
1/*
2 * mul.S: This routine was taken from glibc-1.09 and is covered
3 * by the GNU Library General Public License Version 2.
4 */
5
6/*
7 * Signed multiply, from Appendix E of the Sparc Version 8
8 * Architecture Manual.
9 */
10
11/*
12 * Returns %o0 * %o1 in %o1%o0 (i.e., %o1 holds the upper 32 bits of
13 * the 64-bit product).
14 *
15 * This code optimizes short (less than 13-bit) multiplies.
16 */
17
18 .globl .mul
19 .globl _Mul
20.mul:
21_Mul: /* needed for export */
22 mov %o0, %y ! multiplier -> Y
23 andncc %o0, 0xfff, %g0 ! test bits 12..31
24 be Lmul_shortway ! if zero, can do it the short way
25 andcc %g0, %g0, %o4 ! zero the partial product and clear N and V
26
27 /*
28 * Long multiply. 32 steps, followed by a final shift step.
29 */
30 mulscc %o4, %o1, %o4 ! 1
31 mulscc %o4, %o1, %o4 ! 2
32 mulscc %o4, %o1, %o4 ! 3
33 mulscc %o4, %o1, %o4 ! 4
34 mulscc %o4, %o1, %o4 ! 5
35 mulscc %o4, %o1, %o4 ! 6
36 mulscc %o4, %o1, %o4 ! 7
37 mulscc %o4, %o1, %o4 ! 8
38 mulscc %o4, %o1, %o4 ! 9
39 mulscc %o4, %o1, %o4 ! 10
40 mulscc %o4, %o1, %o4 ! 11
41 mulscc %o4, %o1, %o4 ! 12
42 mulscc %o4, %o1, %o4 ! 13
43 mulscc %o4, %o1, %o4 ! 14
44 mulscc %o4, %o1, %o4 ! 15
45 mulscc %o4, %o1, %o4 ! 16
46 mulscc %o4, %o1, %o4 ! 17
47 mulscc %o4, %o1, %o4 ! 18
48 mulscc %o4, %o1, %o4 ! 19
49 mulscc %o4, %o1, %o4 ! 20
50 mulscc %o4, %o1, %o4 ! 21
51 mulscc %o4, %o1, %o4 ! 22
52 mulscc %o4, %o1, %o4 ! 23
53 mulscc %o4, %o1, %o4 ! 24
54 mulscc %o4, %o1, %o4 ! 25
55 mulscc %o4, %o1, %o4 ! 26
56 mulscc %o4, %o1, %o4 ! 27
57 mulscc %o4, %o1, %o4 ! 28
58 mulscc %o4, %o1, %o4 ! 29
59 mulscc %o4, %o1, %o4 ! 30
60 mulscc %o4, %o1, %o4 ! 31
61 mulscc %o4, %o1, %o4 ! 32
62 mulscc %o4, %g0, %o4 ! final shift
63
64 ! If %o0 was negative, the result is
65 ! (%o0 * %o1) + (%o1 << 32))
66 ! We fix that here.
67
68#if 0
69 tst %o0
70 bge 1f
71 rd %y, %o0
72
73 ! %o0 was indeed negative; fix upper 32 bits of result by subtracting
74 ! %o1 (i.e., return %o4 - %o1 in %o1).
75 retl
76 sub %o4, %o1, %o1
77
781:
79 retl
80 mov %o4, %o1
81#else
82 /* Faster code adapted from tege@sics.se's code for umul.S. */
83 sra %o0, 31, %o2 ! make mask from sign bit
84 and %o1, %o2, %o2 ! %o2 = 0 or %o1, depending on sign of %o0
85 rd %y, %o0 ! get lower half of product
86 retl
87 sub %o4, %o2, %o1 ! subtract compensation
88 ! and put upper half in place
89#endif
90
91Lmul_shortway:
92 /*
93 * Short multiply. 12 steps, followed by a final shift step.
94 * The resulting bits are off by 12 and (32-12) = 20 bit positions,
95 * but there is no problem with %o0 being negative (unlike above).
96 */
97 mulscc %o4, %o1, %o4 ! 1
98 mulscc %o4, %o1, %o4 ! 2
99 mulscc %o4, %o1, %o4 ! 3
100 mulscc %o4, %o1, %o4 ! 4
101 mulscc %o4, %o1, %o4 ! 5
102 mulscc %o4, %o1, %o4 ! 6
103 mulscc %o4, %o1, %o4 ! 7
104 mulscc %o4, %o1, %o4 ! 8
105 mulscc %o4, %o1, %o4 ! 9
106 mulscc %o4, %o1, %o4 ! 10
107 mulscc %o4, %o1, %o4 ! 11
108 mulscc %o4, %o1, %o4 ! 12
109 mulscc %o4, %g0, %o4 ! final shift
110
111 /*
112 * %o4 has 20 of the bits that should be in the low part of the
113 * result; %y has the bottom 12 (as %y's top 12). That is:
114 *
115 * %o4 %y
116 * +----------------+----------------+
117 * | -12- | -20- | -12- | -20- |
118 * +------(---------+------)---------+
119 * --hi-- ----low-part----
120 *
121 * The upper 12 bits of %o4 should be sign-extended to form the
122 * high part of the product (i.e., highpart = %o4 >> 20).
123 */
124
125 rd %y, %o5
126 sll %o4, 12, %o0 ! shift middle bits left 12
127 srl %o5, 20, %o5 ! shift low bits right 20, zero fill at left
128 or %o5, %o0, %o0 ! construct low part of result
129 retl
130 sra %o4, 20, %o1 ! ... and extract high part of result
131
132 .globl .mul_patch
133.mul_patch:
134 smul %o0, %o1, %o0
135 retl
136 rd %y, %o1
137 nop
diff --git a/arch/sparc/lib/muldi3.S b/arch/sparc/lib/muldi3.S
index 7f17872d0603..9794939d1c12 100644
--- a/arch/sparc/lib/muldi3.S
+++ b/arch/sparc/lib/muldi3.S
@@ -63,12 +63,12 @@ __muldi3:
63 rd %y, %o1 63 rd %y, %o1
64 mov %o1, %l3 64 mov %o1, %l3
65 mov %i1, %o0 65 mov %i1, %o0
66 call .umul
67 mov %i2, %o1 66 mov %i2, %o1
67 umul %o0, %o1, %o0
68 mov %o0, %l0 68 mov %o0, %l0
69 mov %i0, %o0 69 mov %i0, %o0
70 call .umul
71 mov %i3, %o1 70 mov %i3, %o1
71 umul %o0, %o1, %o0
72 add %l0, %o0, %l0 72 add %l0, %o0, %l0
73 mov %l2, %i0 73 mov %l2, %i0
74 add %l2, %l0, %i0 74 add %l2, %l0, %i0
diff --git a/arch/sparc/lib/rem.S b/arch/sparc/lib/rem.S
deleted file mode 100644
index 42fb86252815..000000000000
--- a/arch/sparc/lib/rem.S
+++ /dev/null
@@ -1,384 +0,0 @@
1/*
2 * rem.S: This routine was taken from glibc-1.09 and is covered
3 * by the GNU Library General Public License Version 2.
4 */
5
6
7/* This file is generated from divrem.m4; DO NOT EDIT! */
8/*
9 * Division and remainder, from Appendix E of the Sparc Version 8
10 * Architecture Manual, with fixes from Gordon Irlam.
11 */
12
13/*
14 * Input: dividend and divisor in %o0 and %o1 respectively.
15 *
16 * m4 parameters:
17 * .rem name of function to generate
18 * rem rem=div => %o0 / %o1; rem=rem => %o0 % %o1
19 * true true=true => signed; true=false => unsigned
20 *
21 * Algorithm parameters:
22 * N how many bits per iteration we try to get (4)
23 * WORDSIZE total number of bits (32)
24 *
25 * Derived constants:
26 * TOPBITS number of bits in the top decade of a number
27 *
28 * Important variables:
29 * Q the partial quotient under development (initially 0)
30 * R the remainder so far, initially the dividend
31 * ITER number of main division loop iterations required;
32 * equal to ceil(log2(quotient) / N). Note that this
33 * is the log base (2^N) of the quotient.
34 * V the current comparand, initially divisor*2^(ITER*N-1)
35 *
36 * Cost:
37 * Current estimate for non-large dividend is
38 * ceil(log2(quotient) / N) * (10 + 7N/2) + C
39 * A large dividend is one greater than 2^(31-TOPBITS) and takes a
40 * different path, as the upper bits of the quotient must be developed
41 * one bit at a time.
42 */
43
44
45 .globl .rem
46 .globl _Rem
47.rem:
48_Rem: /* needed for export */
49 ! compute sign of result; if neither is negative, no problem
50 orcc %o1, %o0, %g0 ! either negative?
51 bge 2f ! no, go do the divide
52 mov %o0, %g2 ! compute sign in any case
53
54 tst %o1
55 bge 1f
56 tst %o0
57 ! %o1 is definitely negative; %o0 might also be negative
58 bge 2f ! if %o0 not negative...
59 sub %g0, %o1, %o1 ! in any case, make %o1 nonneg
601: ! %o0 is negative, %o1 is nonnegative
61 sub %g0, %o0, %o0 ! make %o0 nonnegative
622:
63
64 ! Ready to divide. Compute size of quotient; scale comparand.
65 orcc %o1, %g0, %o5
66 bne 1f
67 mov %o0, %o3
68
69 ! Divide by zero trap. If it returns, return 0 (about as
70 ! wrong as possible, but that is what SunOS does...).
71 ta ST_DIV0
72 retl
73 clr %o0
74
751:
76 cmp %o3, %o5 ! if %o1 exceeds %o0, done
77 blu Lgot_result ! (and algorithm fails otherwise)
78 clr %o2
79
80 sethi %hi(1 << (32 - 4 - 1)), %g1
81
82 cmp %o3, %g1
83 blu Lnot_really_big
84 clr %o4
85
86 ! Here the dividend is >= 2**(31-N) or so. We must be careful here,
87 ! as our usual N-at-a-shot divide step will cause overflow and havoc.
88 ! The number of bits in the result here is N*ITER+SC, where SC <= N.
89 ! Compute ITER in an unorthodox manner: know we need to shift V into
90 ! the top decade: so do not even bother to compare to R.
91 1:
92 cmp %o5, %g1
93 bgeu 3f
94 mov 1, %g7
95
96 sll %o5, 4, %o5
97
98 b 1b
99 add %o4, 1, %o4
100
101 ! Now compute %g7.
102 2:
103 addcc %o5, %o5, %o5
104
105 bcc Lnot_too_big
106 add %g7, 1, %g7
107
108 ! We get here if the %o1 overflowed while shifting.
109 ! This means that %o3 has the high-order bit set.
110 ! Restore %o5 and subtract from %o3.
111 sll %g1, 4, %g1 ! high order bit
112 srl %o5, 1, %o5 ! rest of %o5
113 add %o5, %g1, %o5
114
115 b Ldo_single_div
116 sub %g7, 1, %g7
117
118 Lnot_too_big:
119 3:
120 cmp %o5, %o3
121 blu 2b
122 nop
123
124 be Ldo_single_div
125 nop
126 /* NB: these are commented out in the V8-Sparc manual as well */
127 /* (I do not understand this) */
128 ! %o5 > %o3: went too far: back up 1 step
129 ! srl %o5, 1, %o5
130 ! dec %g7
131 ! do single-bit divide steps
132 !
133 ! We have to be careful here. We know that %o3 >= %o5, so we can do the
134 ! first divide step without thinking. BUT, the others are conditional,
135 ! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high-
136 ! order bit set in the first step, just falling into the regular
137 ! division loop will mess up the first time around.
138 ! So we unroll slightly...
139 Ldo_single_div:
140 subcc %g7, 1, %g7
141 bl Lend_regular_divide
142 nop
143
144 sub %o3, %o5, %o3
145 mov 1, %o2
146
147 b Lend_single_divloop
148 nop
149 Lsingle_divloop:
150 sll %o2, 1, %o2
151
152 bl 1f
153 srl %o5, 1, %o5
154 ! %o3 >= 0
155 sub %o3, %o5, %o3
156
157 b 2f
158 add %o2, 1, %o2
159 1: ! %o3 < 0
160 add %o3, %o5, %o3
161 sub %o2, 1, %o2
162 2:
163 Lend_single_divloop:
164 subcc %g7, 1, %g7
165 bge Lsingle_divloop
166 tst %o3
167
168 b,a Lend_regular_divide
169
170Lnot_really_big:
1711:
172 sll %o5, 4, %o5
173 cmp %o5, %o3
174 bleu 1b
175 addcc %o4, 1, %o4
176 be Lgot_result
177 sub %o4, 1, %o4
178
179 tst %o3 ! set up for initial iteration
180Ldivloop:
181 sll %o2, 4, %o2
182 ! depth 1, accumulated bits 0
183 bl L.1.16
184 srl %o5,1,%o5
185 ! remainder is positive
186 subcc %o3,%o5,%o3
187 ! depth 2, accumulated bits 1
188 bl L.2.17
189 srl %o5,1,%o5
190 ! remainder is positive
191 subcc %o3,%o5,%o3
192 ! depth 3, accumulated bits 3
193 bl L.3.19
194 srl %o5,1,%o5
195 ! remainder is positive
196 subcc %o3,%o5,%o3
197 ! depth 4, accumulated bits 7
198 bl L.4.23
199 srl %o5,1,%o5
200 ! remainder is positive
201 subcc %o3,%o5,%o3
202
203 b 9f
204 add %o2, (7*2+1), %o2
205
206L.4.23:
207 ! remainder is negative
208 addcc %o3,%o5,%o3
209 b 9f
210 add %o2, (7*2-1), %o2
211
212L.3.19:
213 ! remainder is negative
214 addcc %o3,%o5,%o3
215 ! depth 4, accumulated bits 5
216 bl L.4.21
217 srl %o5,1,%o5
218 ! remainder is positive
219 subcc %o3,%o5,%o3
220 b 9f
221 add %o2, (5*2+1), %o2
222
223L.4.21:
224 ! remainder is negative
225 addcc %o3,%o5,%o3
226 b 9f
227 add %o2, (5*2-1), %o2
228
229L.2.17:
230 ! remainder is negative
231 addcc %o3,%o5,%o3
232 ! depth 3, accumulated bits 1
233 bl L.3.17
234 srl %o5,1,%o5
235 ! remainder is positive
236 subcc %o3,%o5,%o3
237 ! depth 4, accumulated bits 3
238 bl L.4.19
239 srl %o5,1,%o5
240 ! remainder is positive
241 subcc %o3,%o5,%o3
242 b 9f
243 add %o2, (3*2+1), %o2
244
245L.4.19:
246 ! remainder is negative
247 addcc %o3,%o5,%o3
248 b 9f
249 add %o2, (3*2-1), %o2
250
251L.3.17:
252 ! remainder is negative
253 addcc %o3,%o5,%o3
254 ! depth 4, accumulated bits 1
255 bl L.4.17
256 srl %o5,1,%o5
257 ! remainder is positive
258 subcc %o3,%o5,%o3
259 b 9f
260 add %o2, (1*2+1), %o2
261
262L.4.17:
263 ! remainder is negative
264 addcc %o3,%o5,%o3
265 b 9f
266 add %o2, (1*2-1), %o2
267
268L.1.16:
269 ! remainder is negative
270 addcc %o3,%o5,%o3
271 ! depth 2, accumulated bits -1
272 bl L.2.15
273 srl %o5,1,%o5
274 ! remainder is positive
275 subcc %o3,%o5,%o3
276 ! depth 3, accumulated bits -1
277 bl L.3.15
278 srl %o5,1,%o5
279 ! remainder is positive
280 subcc %o3,%o5,%o3
281 ! depth 4, accumulated bits -1
282 bl L.4.15
283 srl %o5,1,%o5
284 ! remainder is positive
285 subcc %o3,%o5,%o3
286 b 9f
287 add %o2, (-1*2+1), %o2
288
289L.4.15:
290 ! remainder is negative
291 addcc %o3,%o5,%o3
292 b 9f
293 add %o2, (-1*2-1), %o2
294
295L.3.15:
296 ! remainder is negative
297 addcc %o3,%o5,%o3
298 ! depth 4, accumulated bits -3
299 bl L.4.13
300 srl %o5,1,%o5
301 ! remainder is positive
302 subcc %o3,%o5,%o3
303 b 9f
304 add %o2, (-3*2+1), %o2
305
306L.4.13:
307 ! remainder is negative
308 addcc %o3,%o5,%o3
309 b 9f
310 add %o2, (-3*2-1), %o2
311
312L.2.15:
313 ! remainder is negative
314 addcc %o3,%o5,%o3
315 ! depth 3, accumulated bits -3
316 bl L.3.13
317 srl %o5,1,%o5
318 ! remainder is positive
319 subcc %o3,%o5,%o3
320 ! depth 4, accumulated bits -5
321 bl L.4.11
322 srl %o5,1,%o5
323 ! remainder is positive
324 subcc %o3,%o5,%o3
325 b 9f
326 add %o2, (-5*2+1), %o2
327
328L.4.11:
329 ! remainder is negative
330 addcc %o3,%o5,%o3
331 b 9f
332 add %o2, (-5*2-1), %o2
333
334
335L.3.13:
336 ! remainder is negative
337 addcc %o3,%o5,%o3
338 ! depth 4, accumulated bits -7
339 bl L.4.9
340 srl %o5,1,%o5
341 ! remainder is positive
342 subcc %o3,%o5,%o3
343 b 9f
344 add %o2, (-7*2+1), %o2
345
346L.4.9:
347 ! remainder is negative
348 addcc %o3,%o5,%o3
349 b 9f
350 add %o2, (-7*2-1), %o2
351
352 9:
353Lend_regular_divide:
354 subcc %o4, 1, %o4
355 bge Ldivloop
356 tst %o3
357
358 bl,a Lgot_result
359 ! non-restoring fixup here (one instruction only!)
360 add %o3, %o1, %o3
361
362Lgot_result:
363 ! check to see if answer should be < 0
364 tst %g2
365 bl,a 1f
366 sub %g0, %o3, %o3
3671:
368 retl
369 mov %o3, %o0
370
371 .globl .rem_patch
372.rem_patch:
373 sra %o0, 0x1f, %o4
374 wr %o4, 0x0, %y
375 nop
376 nop
377 nop
378 sdivcc %o0, %o1, %o2
379 bvs,a 1f
380 xnor %o2, %g0, %o2
3811: smul %o2, %o1, %o2
382 retl
383 sub %o0, %o2, %o0
384 nop
diff --git a/arch/sparc/lib/sdiv.S b/arch/sparc/lib/sdiv.S
deleted file mode 100644
index f0a0d4e4db78..000000000000
--- a/arch/sparc/lib/sdiv.S
+++ /dev/null
@@ -1,381 +0,0 @@
1/*
2 * sdiv.S: This routine was taken from glibc-1.09 and is covered
3 * by the GNU Library General Public License Version 2.
4 */
5
6
7/* This file is generated from divrem.m4; DO NOT EDIT! */
8/*
9 * Division and remainder, from Appendix E of the Sparc Version 8
10 * Architecture Manual, with fixes from Gordon Irlam.
11 */
12
13/*
14 * Input: dividend and divisor in %o0 and %o1 respectively.
15 *
16 * m4 parameters:
17 * .div name of function to generate
18 * div div=div => %o0 / %o1; div=rem => %o0 % %o1
19 * true true=true => signed; true=false => unsigned
20 *
21 * Algorithm parameters:
22 * N how many bits per iteration we try to get (4)
23 * WORDSIZE total number of bits (32)
24 *
25 * Derived constants:
26 * TOPBITS number of bits in the top decade of a number
27 *
28 * Important variables:
29 * Q the partial quotient under development (initially 0)
30 * R the remainder so far, initially the dividend
31 * ITER number of main division loop iterations required;
32 * equal to ceil(log2(quotient) / N). Note that this
33 * is the log base (2^N) of the quotient.
34 * V the current comparand, initially divisor*2^(ITER*N-1)
35 *
36 * Cost:
37 * Current estimate for non-large dividend is
38 * ceil(log2(quotient) / N) * (10 + 7N/2) + C
39 * A large dividend is one greater than 2^(31-TOPBITS) and takes a
40 * different path, as the upper bits of the quotient must be developed
41 * one bit at a time.
42 */
43
44
45 .globl .div
46 .globl _Div
47.div:
48_Div: /* needed for export */
49 ! compute sign of result; if neither is negative, no problem
50 orcc %o1, %o0, %g0 ! either negative?
51 bge 2f ! no, go do the divide
52 xor %o1, %o0, %g2 ! compute sign in any case
53
54 tst %o1
55 bge 1f
56 tst %o0
57 ! %o1 is definitely negative; %o0 might also be negative
58 bge 2f ! if %o0 not negative...
59 sub %g0, %o1, %o1 ! in any case, make %o1 nonneg
601: ! %o0 is negative, %o1 is nonnegative
61 sub %g0, %o0, %o0 ! make %o0 nonnegative
622:
63
64 ! Ready to divide. Compute size of quotient; scale comparand.
65 orcc %o1, %g0, %o5
66 bne 1f
67 mov %o0, %o3
68
69 ! Divide by zero trap. If it returns, return 0 (about as
70 ! wrong as possible, but that is what SunOS does...).
71 ta ST_DIV0
72 retl
73 clr %o0
74
751:
76 cmp %o3, %o5 ! if %o1 exceeds %o0, done
77 blu Lgot_result ! (and algorithm fails otherwise)
78 clr %o2
79
80 sethi %hi(1 << (32 - 4 - 1)), %g1
81
82 cmp %o3, %g1
83 blu Lnot_really_big
84 clr %o4
85
86 ! Here the dividend is >= 2**(31-N) or so. We must be careful here,
87 ! as our usual N-at-a-shot divide step will cause overflow and havoc.
88 ! The number of bits in the result here is N*ITER+SC, where SC <= N.
89 ! Compute ITER in an unorthodox manner: know we need to shift V into
90 ! the top decade: so do not even bother to compare to R.
91 1:
92 cmp %o5, %g1
93 bgeu 3f
94 mov 1, %g7
95
96 sll %o5, 4, %o5
97
98 b 1b
99 add %o4, 1, %o4
100
101 ! Now compute %g7.
102 2:
103 addcc %o5, %o5, %o5
104 bcc Lnot_too_big
105 add %g7, 1, %g7
106
107 ! We get here if the %o1 overflowed while shifting.
108 ! This means that %o3 has the high-order bit set.
109 ! Restore %o5 and subtract from %o3.
110 sll %g1, 4, %g1 ! high order bit
111 srl %o5, 1, %o5 ! rest of %o5
112 add %o5, %g1, %o5
113
114 b Ldo_single_div
115 sub %g7, 1, %g7
116
117 Lnot_too_big:
118 3:
119 cmp %o5, %o3
120 blu 2b
121 nop
122
123 be Ldo_single_div
124 nop
125 /* NB: these are commented out in the V8-Sparc manual as well */
126 /* (I do not understand this) */
127 ! %o5 > %o3: went too far: back up 1 step
128 ! srl %o5, 1, %o5
129 ! dec %g7
130 ! do single-bit divide steps
131 !
132 ! We have to be careful here. We know that %o3 >= %o5, so we can do the
133 ! first divide step without thinking. BUT, the others are conditional,
134 ! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high-
135 ! order bit set in the first step, just falling into the regular
136 ! division loop will mess up the first time around.
137 ! So we unroll slightly...
138 Ldo_single_div:
139 subcc %g7, 1, %g7
140 bl Lend_regular_divide
141 nop
142
143 sub %o3, %o5, %o3
144 mov 1, %o2
145
146 b Lend_single_divloop
147 nop
148 Lsingle_divloop:
149 sll %o2, 1, %o2
150
151 bl 1f
152 srl %o5, 1, %o5
153 ! %o3 >= 0
154 sub %o3, %o5, %o3
155
156 b 2f
157 add %o2, 1, %o2
158 1: ! %o3 < 0
159 add %o3, %o5, %o3
160 sub %o2, 1, %o2
161 2:
162 Lend_single_divloop:
163 subcc %g7, 1, %g7
164 bge Lsingle_divloop
165 tst %o3
166
167 b,a Lend_regular_divide
168
169Lnot_really_big:
1701:
171 sll %o5, 4, %o5
172 cmp %o5, %o3
173 bleu 1b
174 addcc %o4, 1, %o4
175
176 be Lgot_result
177 sub %o4, 1, %o4
178
179 tst %o3 ! set up for initial iteration
180Ldivloop:
181 sll %o2, 4, %o2
182 ! depth 1, accumulated bits 0
183 bl L.1.16
184 srl %o5,1,%o5
185 ! remainder is positive
186 subcc %o3,%o5,%o3
187 ! depth 2, accumulated bits 1
188 bl L.2.17
189 srl %o5,1,%o5
190 ! remainder is positive
191 subcc %o3,%o5,%o3
192 ! depth 3, accumulated bits 3
193 bl L.3.19
194 srl %o5,1,%o5
195 ! remainder is positive
196 subcc %o3,%o5,%o3
197 ! depth 4, accumulated bits 7
198 bl L.4.23
199 srl %o5,1,%o5
200 ! remainder is positive
201 subcc %o3,%o5,%o3
202 b 9f
203 add %o2, (7*2+1), %o2
204
205L.4.23:
206 ! remainder is negative
207 addcc %o3,%o5,%o3
208 b 9f
209 add %o2, (7*2-1), %o2
210
211L.3.19:
212 ! remainder is negative
213 addcc %o3,%o5,%o3
214 ! depth 4, accumulated bits 5
215 bl L.4.21
216 srl %o5,1,%o5
217 ! remainder is positive
218 subcc %o3,%o5,%o3
219 b 9f
220 add %o2, (5*2+1), %o2
221
222L.4.21:
223 ! remainder is negative
224 addcc %o3,%o5,%o3
225 b 9f
226 add %o2, (5*2-1), %o2
227
228L.2.17:
229 ! remainder is negative
230 addcc %o3,%o5,%o3
231 ! depth 3, accumulated bits 1
232 bl L.3.17
233 srl %o5,1,%o5
234 ! remainder is positive
235 subcc %o3,%o5,%o3
236 ! depth 4, accumulated bits 3
237 bl L.4.19
238 srl %o5,1,%o5
239 ! remainder is positive
240 subcc %o3,%o5,%o3
241 b 9f
242 add %o2, (3*2+1), %o2
243
244L.4.19:
245 ! remainder is negative
246 addcc %o3,%o5,%o3
247 b 9f
248 add %o2, (3*2-1), %o2
249
250
251L.3.17:
252 ! remainder is negative
253 addcc %o3,%o5,%o3
254 ! depth 4, accumulated bits 1
255 bl L.4.17
256 srl %o5,1,%o5
257 ! remainder is positive
258 subcc %o3,%o5,%o3
259 b 9f
260 add %o2, (1*2+1), %o2
261
262L.4.17:
263 ! remainder is negative
264 addcc %o3,%o5,%o3
265 b 9f
266 add %o2, (1*2-1), %o2
267
268L.1.16:
269 ! remainder is negative
270 addcc %o3,%o5,%o3
271 ! depth 2, accumulated bits -1
272 bl L.2.15
273 srl %o5,1,%o5
274 ! remainder is positive
275 subcc %o3,%o5,%o3
276 ! depth 3, accumulated bits -1
277 bl L.3.15
278 srl %o5,1,%o5
279 ! remainder is positive
280 subcc %o3,%o5,%o3
281 ! depth 4, accumulated bits -1
282 bl L.4.15
283 srl %o5,1,%o5
284 ! remainder is positive
285 subcc %o3,%o5,%o3
286 b 9f
287 add %o2, (-1*2+1), %o2
288
289L.4.15:
290 ! remainder is negative
291 addcc %o3,%o5,%o3
292 b 9f
293 add %o2, (-1*2-1), %o2
294
295L.3.15:
296 ! remainder is negative
297 addcc %o3,%o5,%o3
298 ! depth 4, accumulated bits -3
299 bl L.4.13
300 srl %o5,1,%o5
301 ! remainder is positive
302 subcc %o3,%o5,%o3
303 b 9f
304 add %o2, (-3*2+1), %o2
305
306L.4.13:
307 ! remainder is negative
308 addcc %o3,%o5,%o3
309 b 9f
310 add %o2, (-3*2-1), %o2
311
312L.2.15:
313 ! remainder is negative
314 addcc %o3,%o5,%o3
315 ! depth 3, accumulated bits -3
316 bl L.3.13
317 srl %o5,1,%o5
318 ! remainder is positive
319 subcc %o3,%o5,%o3
320 ! depth 4, accumulated bits -5
321 bl L.4.11
322 srl %o5,1,%o5
323 ! remainder is positive
324 subcc %o3,%o5,%o3
325 b 9f
326 add %o2, (-5*2+1), %o2
327
328L.4.11:
329 ! remainder is negative
330 addcc %o3,%o5,%o3
331 b 9f
332 add %o2, (-5*2-1), %o2
333
334L.3.13:
335 ! remainder is negative
336 addcc %o3,%o5,%o3
337 ! depth 4, accumulated bits -7
338 bl L.4.9
339 srl %o5,1,%o5
340 ! remainder is positive
341 subcc %o3,%o5,%o3
342 b 9f
343 add %o2, (-7*2+1), %o2
344
345L.4.9:
346 ! remainder is negative
347 addcc %o3,%o5,%o3
348 b 9f
349 add %o2, (-7*2-1), %o2
350
351 9:
352Lend_regular_divide:
353 subcc %o4, 1, %o4
354 bge Ldivloop
355 tst %o3
356
357 bl,a Lgot_result
358 ! non-restoring fixup here (one instruction only!)
359 sub %o2, 1, %o2
360
361Lgot_result:
362 ! check to see if answer should be < 0
363 tst %g2
364 bl,a 1f
365 sub %g0, %o2, %o2
3661:
367 retl
368 mov %o2, %o0
369
370 .globl .div_patch
371.div_patch:
372 sra %o0, 0x1f, %o2
373 wr %o2, 0x0, %y
374 nop
375 nop
376 nop
377 sdivcc %o0, %o1, %o0
378 bvs,a 1f
379 xnor %o0, %g0, %o0
3801: retl
381 nop
diff --git a/arch/sparc/lib/strlen_user_64.S b/arch/sparc/lib/strlen_user_64.S
index 114ed111e251..c3df71fa4928 100644
--- a/arch/sparc/lib/strlen_user_64.S
+++ b/arch/sparc/lib/strlen_user_64.S
@@ -8,16 +8,16 @@
8 * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 8 * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
9 */ 9 */
10 10
11#include <linux/linkage.h>
11#include <asm/asi.h> 12#include <asm/asi.h>
12 13
13#define LO_MAGIC 0x01010101 14#define LO_MAGIC 0x01010101
14#define HI_MAGIC 0x80808080 15#define HI_MAGIC 0x80808080
15 16
16 .align 4 17 .align 4
17 .global __strlen_user, __strnlen_user 18ENTRY(__strlen_user)
18__strlen_user:
19 sethi %hi(32768), %o1 19 sethi %hi(32768), %o1
20__strnlen_user: 20ENTRY(__strnlen_user)
21 mov %o1, %g1 21 mov %o1, %g1
22 mov %o0, %o1 22 mov %o0, %o1
23 andcc %o0, 3, %g0 23 andcc %o0, 3, %g0
@@ -78,6 +78,8 @@ __strnlen_user:
78 mov 2, %o0 78 mov 2, %o0
7923: retl 7923: retl
80 mov 3, %o0 80 mov 3, %o0
81ENDPROC(__strlen_user)
82ENDPROC(__strnlen_user)
81 83
82 .section .fixup,#alloc,#execinstr 84 .section .fixup,#alloc,#execinstr
83 .align 4 85 .align 4
diff --git a/arch/sparc/lib/strncmp_32.S b/arch/sparc/lib/strncmp_32.S
index 494ec664537a..c0d1b568c1c5 100644
--- a/arch/sparc/lib/strncmp_32.S
+++ b/arch/sparc/lib/strncmp_32.S
@@ -3,11 +3,10 @@
3 * generic strncmp routine. 3 * generic strncmp routine.
4 */ 4 */
5 5
6#include <linux/linkage.h>
7
6 .text 8 .text
7 .align 4 9ENTRY(strncmp)
8 .global __strncmp, strncmp
9__strncmp:
10strncmp:
11 mov %o0, %g3 10 mov %o0, %g3
12 mov 0, %o3 11 mov 0, %o3
13 12
@@ -116,3 +115,4 @@ strncmp:
116 and %g2, 0xff, %o0 115 and %g2, 0xff, %o0
117 retl 116 retl
118 sub %o3, %o0, %o0 117 sub %o3, %o0, %o0
118ENDPROC(strncmp)
diff --git a/arch/sparc/lib/strncmp_64.S b/arch/sparc/lib/strncmp_64.S
index 980e83751556..0656627166f3 100644
--- a/arch/sparc/lib/strncmp_64.S
+++ b/arch/sparc/lib/strncmp_64.S
@@ -4,13 +4,11 @@
4 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 4 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
5 */ 5 */
6 6
7#include <linux/linkage.h>
7#include <asm/asi.h> 8#include <asm/asi.h>
8 9
9 .text 10 .text
10 .align 32 11ENTRY(strncmp)
11 .globl strncmp
12 .type strncmp,#function
13strncmp:
14 brlez,pn %o2, 3f 12 brlez,pn %o2, 3f
15 lduba [%o0] (ASI_PNF), %o3 13 lduba [%o0] (ASI_PNF), %o3
161: 141:
@@ -29,4 +27,4 @@ strncmp:
293: 273:
30 retl 28 retl
31 clr %o0 29 clr %o0
32 .size strncmp, .-strncmp 30ENDPROC(strncmp)
diff --git a/arch/sparc/lib/strncpy_from_user_32.S b/arch/sparc/lib/strncpy_from_user_32.S
index d77198976a66..db0ed2964bdb 100644
--- a/arch/sparc/lib/strncpy_from_user_32.S
+++ b/arch/sparc/lib/strncpy_from_user_32.S
@@ -3,11 +3,11 @@
3 * Copyright(C) 1996 David S. Miller 3 * Copyright(C) 1996 David S. Miller
4 */ 4 */
5 5
6#include <linux/linkage.h>
6#include <asm/ptrace.h> 7#include <asm/ptrace.h>
7#include <asm/errno.h> 8#include <asm/errno.h>
8 9
9 .text 10 .text
10 .align 4
11 11
12 /* Must return: 12 /* Must return:
13 * 13 *
@@ -16,8 +16,7 @@
16 * bytes copied if we hit a null byte 16 * bytes copied if we hit a null byte
17 */ 17 */
18 18
19 .globl __strncpy_from_user 19ENTRY(__strncpy_from_user)
20__strncpy_from_user:
21 /* %o0=dest, %o1=src, %o2=count */ 20 /* %o0=dest, %o1=src, %o2=count */
22 mov %o2, %o3 21 mov %o2, %o3
231: 221:
@@ -35,6 +34,7 @@ __strncpy_from_user:
35 add %o2, 1, %o0 34 add %o2, 1, %o0
36 retl 35 retl
37 sub %o3, %o0, %o0 36 sub %o3, %o0, %o0
37ENDPROC(__strncpy_from_user)
38 38
39 .section .fixup,#alloc,#execinstr 39 .section .fixup,#alloc,#execinstr
40 .align 4 40 .align 4
diff --git a/arch/sparc/lib/strncpy_from_user_64.S b/arch/sparc/lib/strncpy_from_user_64.S
index 511c8f136f95..d1246b713077 100644
--- a/arch/sparc/lib/strncpy_from_user_64.S
+++ b/arch/sparc/lib/strncpy_from_user_64.S
@@ -4,6 +4,7 @@
4 * Copyright (C) 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz) 4 * Copyright (C) 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz)
5 */ 5 */
6 6
7#include <linux/linkage.h>
7#include <asm/asi.h> 8#include <asm/asi.h>
8#include <asm/errno.h> 9#include <asm/errno.h>
9 10
@@ -12,7 +13,6 @@
120: .xword 0x0101010101010101 130: .xword 0x0101010101010101
13 14
14 .text 15 .text
15 .align 32
16 16
17 /* Must return: 17 /* Must return:
18 * 18 *
@@ -30,9 +30,7 @@
30 * and average length is 18 or so. 30 * and average length is 18 or so.
31 */ 31 */
32 32
33 .globl __strncpy_from_user 33ENTRY(__strncpy_from_user)
34 .type __strncpy_from_user,#function
35__strncpy_from_user:
36 /* %o0=dest, %o1=src, %o2=count */ 34 /* %o0=dest, %o1=src, %o2=count */
37 andcc %o1, 7, %g0 ! IEU1 Group 35 andcc %o1, 7, %g0 ! IEU1 Group
38 bne,pn %icc, 30f ! CTI 36 bne,pn %icc, 30f ! CTI
@@ -123,7 +121,7 @@ __strncpy_from_user:
123 mov %o2, %o0 121 mov %o2, %o0
1242: retl 1222: retl
125 add %o2, %o3, %o0 123 add %o2, %o3, %o0
126 .size __strncpy_from_user, .-__strncpy_from_user 124ENDPROC(__strncpy_from_user)
127 125
128 .section __ex_table,"a" 126 .section __ex_table,"a"
129 .align 4 127 .align 4
diff --git a/arch/sparc/lib/ucmpdi2.c b/arch/sparc/lib/ucmpdi2.c
new file mode 100644
index 000000000000..1e06ed500682
--- /dev/null
+++ b/arch/sparc/lib/ucmpdi2.c
@@ -0,0 +1,19 @@
1#include <linux/module.h>
2#include "libgcc.h"
3
4word_type __ucmpdi2(unsigned long long a, unsigned long long b)
5{
6 const DWunion au = {.ll = a};
7 const DWunion bu = {.ll = b};
8
9 if ((unsigned int) au.s.high < (unsigned int) bu.s.high)
10 return 0;
11 else if ((unsigned int) au.s.high > (unsigned int) bu.s.high)
12 return 2;
13 if ((unsigned int) au.s.low < (unsigned int) bu.s.low)
14 return 0;
15 else if ((unsigned int) au.s.low > (unsigned int) bu.s.low)
16 return 2;
17 return 1;
18}
19EXPORT_SYMBOL(__ucmpdi2);
diff --git a/arch/sparc/lib/udiv.S b/arch/sparc/lib/udiv.S
deleted file mode 100644
index 2101405bdfcb..000000000000
--- a/arch/sparc/lib/udiv.S
+++ /dev/null
@@ -1,357 +0,0 @@
1/*
2 * udiv.S: This routine was taken from glibc-1.09 and is covered
3 * by the GNU Library General Public License Version 2.
4 */
5
6
7/* This file is generated from divrem.m4; DO NOT EDIT! */
8/*
9 * Division and remainder, from Appendix E of the Sparc Version 8
10 * Architecture Manual, with fixes from Gordon Irlam.
11 */
12
13/*
14 * Input: dividend and divisor in %o0 and %o1 respectively.
15 *
16 * m4 parameters:
17 * .udiv name of function to generate
18 * div div=div => %o0 / %o1; div=rem => %o0 % %o1
19 * false false=true => signed; false=false => unsigned
20 *
21 * Algorithm parameters:
22 * N how many bits per iteration we try to get (4)
23 * WORDSIZE total number of bits (32)
24 *
25 * Derived constants:
26 * TOPBITS number of bits in the top decade of a number
27 *
28 * Important variables:
29 * Q the partial quotient under development (initially 0)
30 * R the remainder so far, initially the dividend
31 * ITER number of main division loop iterations required;
32 * equal to ceil(log2(quotient) / N). Note that this
33 * is the log base (2^N) of the quotient.
34 * V the current comparand, initially divisor*2^(ITER*N-1)
35 *
36 * Cost:
37 * Current estimate for non-large dividend is
38 * ceil(log2(quotient) / N) * (10 + 7N/2) + C
39 * A large dividend is one greater than 2^(31-TOPBITS) and takes a
40 * different path, as the upper bits of the quotient must be developed
41 * one bit at a time.
42 */
43
44
45 .globl .udiv
46 .globl _Udiv
47.udiv:
48_Udiv: /* needed for export */
49
50 ! Ready to divide. Compute size of quotient; scale comparand.
51 orcc %o1, %g0, %o5
52 bne 1f
53 mov %o0, %o3
54
55 ! Divide by zero trap. If it returns, return 0 (about as
56 ! wrong as possible, but that is what SunOS does...).
57 ta ST_DIV0
58 retl
59 clr %o0
60
611:
62 cmp %o3, %o5 ! if %o1 exceeds %o0, done
63 blu Lgot_result ! (and algorithm fails otherwise)
64 clr %o2
65
66 sethi %hi(1 << (32 - 4 - 1)), %g1
67
68 cmp %o3, %g1
69 blu Lnot_really_big
70 clr %o4
71
72 ! Here the dividend is >= 2**(31-N) or so. We must be careful here,
73 ! as our usual N-at-a-shot divide step will cause overflow and havoc.
74 ! The number of bits in the result here is N*ITER+SC, where SC <= N.
75 ! Compute ITER in an unorthodox manner: know we need to shift V into
76 ! the top decade: so do not even bother to compare to R.
77 1:
78 cmp %o5, %g1
79 bgeu 3f
80 mov 1, %g7
81
82 sll %o5, 4, %o5
83
84 b 1b
85 add %o4, 1, %o4
86
87 ! Now compute %g7.
88 2:
89 addcc %o5, %o5, %o5
90 bcc Lnot_too_big
91 add %g7, 1, %g7
92
93 ! We get here if the %o1 overflowed while shifting.
94 ! This means that %o3 has the high-order bit set.
95 ! Restore %o5 and subtract from %o3.
96 sll %g1, 4, %g1 ! high order bit
97 srl %o5, 1, %o5 ! rest of %o5
98 add %o5, %g1, %o5
99
100 b Ldo_single_div
101 sub %g7, 1, %g7
102
103 Lnot_too_big:
104 3:
105 cmp %o5, %o3
106 blu 2b
107 nop
108
109 be Ldo_single_div
110 nop
111 /* NB: these are commented out in the V8-Sparc manual as well */
112 /* (I do not understand this) */
113 ! %o5 > %o3: went too far: back up 1 step
114 ! srl %o5, 1, %o5
115 ! dec %g7
116 ! do single-bit divide steps
117 !
118 ! We have to be careful here. We know that %o3 >= %o5, so we can do the
119 ! first divide step without thinking. BUT, the others are conditional,
120 ! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high-
121 ! order bit set in the first step, just falling into the regular
122 ! division loop will mess up the first time around.
123 ! So we unroll slightly...
124 Ldo_single_div:
125 subcc %g7, 1, %g7
126 bl Lend_regular_divide
127 nop
128
129 sub %o3, %o5, %o3
130 mov 1, %o2
131
132 b Lend_single_divloop
133 nop
134 Lsingle_divloop:
135 sll %o2, 1, %o2
136 bl 1f
137 srl %o5, 1, %o5
138 ! %o3 >= 0
139 sub %o3, %o5, %o3
140 b 2f
141 add %o2, 1, %o2
142 1: ! %o3 < 0
143 add %o3, %o5, %o3
144 sub %o2, 1, %o2
145 2:
146 Lend_single_divloop:
147 subcc %g7, 1, %g7
148 bge Lsingle_divloop
149 tst %o3
150
151 b,a Lend_regular_divide
152
153Lnot_really_big:
1541:
155 sll %o5, 4, %o5
156
157 cmp %o5, %o3
158 bleu 1b
159 addcc %o4, 1, %o4
160
161 be Lgot_result
162 sub %o4, 1, %o4
163
164 tst %o3 ! set up for initial iteration
165Ldivloop:
166 sll %o2, 4, %o2
167 ! depth 1, accumulated bits 0
168 bl L.1.16
169 srl %o5,1,%o5
170 ! remainder is positive
171 subcc %o3,%o5,%o3
172 ! depth 2, accumulated bits 1
173 bl L.2.17
174 srl %o5,1,%o5
175 ! remainder is positive
176 subcc %o3,%o5,%o3
177 ! depth 3, accumulated bits 3
178 bl L.3.19
179 srl %o5,1,%o5
180 ! remainder is positive
181 subcc %o3,%o5,%o3
182 ! depth 4, accumulated bits 7
183 bl L.4.23
184 srl %o5,1,%o5
185 ! remainder is positive
186 subcc %o3,%o5,%o3
187 b 9f
188 add %o2, (7*2+1), %o2
189
190L.4.23:
191 ! remainder is negative
192 addcc %o3,%o5,%o3
193 b 9f
194 add %o2, (7*2-1), %o2
195
196L.3.19:
197 ! remainder is negative
198 addcc %o3,%o5,%o3
199 ! depth 4, accumulated bits 5
200 bl L.4.21
201 srl %o5,1,%o5
202 ! remainder is positive
203 subcc %o3,%o5,%o3
204 b 9f
205 add %o2, (5*2+1), %o2
206
207L.4.21:
208 ! remainder is negative
209 addcc %o3,%o5,%o3
210 b 9f
211 add %o2, (5*2-1), %o2
212
213L.2.17:
214 ! remainder is negative
215 addcc %o3,%o5,%o3
216 ! depth 3, accumulated bits 1
217 bl L.3.17
218 srl %o5,1,%o5
219 ! remainder is positive
220 subcc %o3,%o5,%o3
221 ! depth 4, accumulated bits 3
222 bl L.4.19
223 srl %o5,1,%o5
224 ! remainder is positive
225 subcc %o3,%o5,%o3
226 b 9f
227 add %o2, (3*2+1), %o2
228
229L.4.19:
230 ! remainder is negative
231 addcc %o3,%o5,%o3
232 b 9f
233 add %o2, (3*2-1), %o2
234
235L.3.17:
236 ! remainder is negative
237 addcc %o3,%o5,%o3
238 ! depth 4, accumulated bits 1
239 bl L.4.17
240 srl %o5,1,%o5
241 ! remainder is positive
242 subcc %o3,%o5,%o3
243 b 9f
244 add %o2, (1*2+1), %o2
245
246L.4.17:
247 ! remainder is negative
248 addcc %o3,%o5,%o3
249 b 9f
250 add %o2, (1*2-1), %o2
251
252L.1.16:
253 ! remainder is negative
254 addcc %o3,%o5,%o3
255 ! depth 2, accumulated bits -1
256 bl L.2.15
257 srl %o5,1,%o5
258 ! remainder is positive
259 subcc %o3,%o5,%o3
260 ! depth 3, accumulated bits -1
261 bl L.3.15
262 srl %o5,1,%o5
263 ! remainder is positive
264 subcc %o3,%o5,%o3
265 ! depth 4, accumulated bits -1
266 bl L.4.15
267 srl %o5,1,%o5
268 ! remainder is positive
269 subcc %o3,%o5,%o3
270 b 9f
271 add %o2, (-1*2+1), %o2
272
273L.4.15:
274 ! remainder is negative
275 addcc %o3,%o5,%o3
276 b 9f
277 add %o2, (-1*2-1), %o2
278
279L.3.15:
280 ! remainder is negative
281 addcc %o3,%o5,%o3
282 ! depth 4, accumulated bits -3
283 bl L.4.13
284 srl %o5,1,%o5
285 ! remainder is positive
286 subcc %o3,%o5,%o3
287 b 9f
288 add %o2, (-3*2+1), %o2
289
290L.4.13:
291 ! remainder is negative
292 addcc %o3,%o5,%o3
293 b 9f
294 add %o2, (-3*2-1), %o2
295
296L.2.15:
297 ! remainder is negative
298 addcc %o3,%o5,%o3
299 ! depth 3, accumulated bits -3
300 bl L.3.13
301 srl %o5,1,%o5
302 ! remainder is positive
303 subcc %o3,%o5,%o3
304 ! depth 4, accumulated bits -5
305 bl L.4.11
306 srl %o5,1,%o5
307 ! remainder is positive
308 subcc %o3,%o5,%o3
309 b 9f
310 add %o2, (-5*2+1), %o2
311
312L.4.11:
313 ! remainder is negative
314 addcc %o3,%o5,%o3
315 b 9f
316 add %o2, (-5*2-1), %o2
317
318L.3.13:
319 ! remainder is negative
320 addcc %o3,%o5,%o3
321 ! depth 4, accumulated bits -7
322 bl L.4.9
323 srl %o5,1,%o5
324 ! remainder is positive
325 subcc %o3,%o5,%o3
326 b 9f
327 add %o2, (-7*2+1), %o2
328
329L.4.9:
330 ! remainder is negative
331 addcc %o3,%o5,%o3
332 b 9f
333 add %o2, (-7*2-1), %o2
334
335 9:
336Lend_regular_divide:
337 subcc %o4, 1, %o4
338 bge Ldivloop
339 tst %o3
340
341 bl,a Lgot_result
342 ! non-restoring fixup here (one instruction only!)
343 sub %o2, 1, %o2
344
345Lgot_result:
346
347 retl
348 mov %o2, %o0
349
350 .globl .udiv_patch
351.udiv_patch:
352 wr %g0, 0x0, %y
353 nop
354 nop
355 retl
356 udiv %o0, %o1, %o0
357 nop
diff --git a/arch/sparc/lib/udivdi3.S b/arch/sparc/lib/udivdi3.S
index b430f1f0ef62..24e0a355e2e8 100644
--- a/arch/sparc/lib/udivdi3.S
+++ b/arch/sparc/lib/udivdi3.S
@@ -60,8 +60,9 @@ __udivdi3:
60 bne .LL77 60 bne .LL77
61 mov %i0,%o2 61 mov %i0,%o2
62 mov 1,%o0 62 mov 1,%o0
63 call .udiv,0
64 mov 0,%o1 63 mov 0,%o1
64 wr %g0, 0, %y
65 udiv %o0, %o1, %o0
65 mov %o0,%o3 66 mov %o0,%o3
66 mov %i0,%o2 67 mov %i0,%o2
67.LL77: 68.LL77:
diff --git a/arch/sparc/lib/umul.S b/arch/sparc/lib/umul.S
deleted file mode 100644
index 1f36ae682529..000000000000
--- a/arch/sparc/lib/umul.S
+++ /dev/null
@@ -1,171 +0,0 @@
1/*
2 * umul.S: This routine was taken from glibc-1.09 and is covered
3 * by the GNU Library General Public License Version 2.
4 */
5
6
7/*
8 * Unsigned multiply. Returns %o0 * %o1 in %o1%o0 (i.e., %o1 holds the
9 * upper 32 bits of the 64-bit product).
10 *
11 * This code optimizes short (less than 13-bit) multiplies. Short
12 * multiplies require 25 instruction cycles, and long ones require
13 * 45 instruction cycles.
14 *
15 * On return, overflow has occurred (%o1 is not zero) if and only if
16 * the Z condition code is clear, allowing, e.g., the following:
17 *
18 * call .umul
19 * nop
20 * bnz overflow (or tnz)
21 */
22
23 .globl .umul
24 .globl _Umul
25.umul:
26_Umul: /* needed for export */
27 or %o0, %o1, %o4
28 mov %o0, %y ! multiplier -> Y
29
30 andncc %o4, 0xfff, %g0 ! test bits 12..31 of *both* args
31 be Lmul_shortway ! if zero, can do it the short way
32 andcc %g0, %g0, %o4 ! zero the partial product and clear N and V
33
34 /*
35 * Long multiply. 32 steps, followed by a final shift step.
36 */
37 mulscc %o4, %o1, %o4 ! 1
38 mulscc %o4, %o1, %o4 ! 2
39 mulscc %o4, %o1, %o4 ! 3
40 mulscc %o4, %o1, %o4 ! 4
41 mulscc %o4, %o1, %o4 ! 5
42 mulscc %o4, %o1, %o4 ! 6
43 mulscc %o4, %o1, %o4 ! 7
44 mulscc %o4, %o1, %o4 ! 8
45 mulscc %o4, %o1, %o4 ! 9
46 mulscc %o4, %o1, %o4 ! 10
47 mulscc %o4, %o1, %o4 ! 11
48 mulscc %o4, %o1, %o4 ! 12
49 mulscc %o4, %o1, %o4 ! 13
50 mulscc %o4, %o1, %o4 ! 14
51 mulscc %o4, %o1, %o4 ! 15
52 mulscc %o4, %o1, %o4 ! 16
53 mulscc %o4, %o1, %o4 ! 17
54 mulscc %o4, %o1, %o4 ! 18
55 mulscc %o4, %o1, %o4 ! 19
56 mulscc %o4, %o1, %o4 ! 20
57 mulscc %o4, %o1, %o4 ! 21
58 mulscc %o4, %o1, %o4 ! 22
59 mulscc %o4, %o1, %o4 ! 23
60 mulscc %o4, %o1, %o4 ! 24
61 mulscc %o4, %o1, %o4 ! 25
62 mulscc %o4, %o1, %o4 ! 26
63 mulscc %o4, %o1, %o4 ! 27
64 mulscc %o4, %o1, %o4 ! 28
65 mulscc %o4, %o1, %o4 ! 29
66 mulscc %o4, %o1, %o4 ! 30
67 mulscc %o4, %o1, %o4 ! 31
68 mulscc %o4, %o1, %o4 ! 32
69 mulscc %o4, %g0, %o4 ! final shift
70
71
72 /*
73 * Normally, with the shift-and-add approach, if both numbers are
74 * positive you get the correct result. With 32-bit two's-complement
75 * numbers, -x is represented as
76 *
77 * x 32
78 * ( 2 - ------ ) mod 2 * 2
79 * 32
80 * 2
81 *
82 * (the `mod 2' subtracts 1 from 1.bbbb). To avoid lots of 2^32s,
83 * we can treat this as if the radix point were just to the left
84 * of the sign bit (multiply by 2^32), and get
85 *
86 * -x = (2 - x) mod 2
87 *
88 * Then, ignoring the `mod 2's for convenience:
89 *
90 * x * y = xy
91 * -x * y = 2y - xy
92 * x * -y = 2x - xy
93 * -x * -y = 4 - 2x - 2y + xy
94 *
95 * For signed multiplies, we subtract (x << 32) from the partial
96 * product to fix this problem for negative multipliers (see mul.s).
97 * Because of the way the shift into the partial product is calculated
98 * (N xor V), this term is automatically removed for the multiplicand,
99 * so we don't have to adjust.
100 *
101 * But for unsigned multiplies, the high order bit wasn't a sign bit,
102 * and the correction is wrong. So for unsigned multiplies where the
103 * high order bit is one, we end up with xy - (y << 32). To fix it
104 * we add y << 32.
105 */
106#if 0
107 tst %o1
108 bl,a 1f ! if %o1 < 0 (high order bit = 1),
109 add %o4, %o0, %o4 ! %o4 += %o0 (add y to upper half)
110
1111:
112 rd %y, %o0 ! get lower half of product
113 retl
114 addcc %o4, %g0, %o1 ! put upper half in place and set Z for %o1==0
115#else
116 /* Faster code from tege@sics.se. */
117 sra %o1, 31, %o2 ! make mask from sign bit
118 and %o0, %o2, %o2 ! %o2 = 0 or %o0, depending on sign of %o1
119 rd %y, %o0 ! get lower half of product
120 retl
121 addcc %o4, %o2, %o1 ! add compensation and put upper half in place
122#endif
123
124Lmul_shortway:
125 /*
126 * Short multiply. 12 steps, followed by a final shift step.
127 * The resulting bits are off by 12 and (32-12) = 20 bit positions,
128 * but there is no problem with %o0 being negative (unlike above),
129 * and overflow is impossible (the answer is at most 24 bits long).
130 */
131 mulscc %o4, %o1, %o4 ! 1
132 mulscc %o4, %o1, %o4 ! 2
133 mulscc %o4, %o1, %o4 ! 3
134 mulscc %o4, %o1, %o4 ! 4
135 mulscc %o4, %o1, %o4 ! 5
136 mulscc %o4, %o1, %o4 ! 6
137 mulscc %o4, %o1, %o4 ! 7
138 mulscc %o4, %o1, %o4 ! 8
139 mulscc %o4, %o1, %o4 ! 9
140 mulscc %o4, %o1, %o4 ! 10
141 mulscc %o4, %o1, %o4 ! 11
142 mulscc %o4, %o1, %o4 ! 12
143 mulscc %o4, %g0, %o4 ! final shift
144
145 /*
146 * %o4 has 20 of the bits that should be in the result; %y has
147 * the bottom 12 (as %y's top 12). That is:
148 *
149 * %o4 %y
150 * +----------------+----------------+
151 * | -12- | -20- | -12- | -20- |
152 * +------(---------+------)---------+
153 * -----result-----
154 *
155 * The 12 bits of %o4 left of the `result' area are all zero;
156 * in fact, all top 20 bits of %o4 are zero.
157 */
158
159 rd %y, %o5
160 sll %o4, 12, %o0 ! shift middle bits left 12
161 srl %o5, 20, %o5 ! shift low bits right 20
162 or %o5, %o0, %o0
163 retl
164 addcc %g0, %g0, %o1 ! %o1 = zero, and set Z
165
166 .globl .umul_patch
167.umul_patch:
168 umul %o0, %o1, %o0
169 retl
170 rd %y, %o1
171 nop
diff --git a/arch/sparc/lib/urem.S b/arch/sparc/lib/urem.S
deleted file mode 100644
index 77123eb83c44..000000000000
--- a/arch/sparc/lib/urem.S
+++ /dev/null
@@ -1,357 +0,0 @@
1/*
2 * urem.S: This routine was taken from glibc-1.09 and is covered
3 * by the GNU Library General Public License Version 2.
4 */
5
6/* This file is generated from divrem.m4; DO NOT EDIT! */
7/*
8 * Division and remainder, from Appendix E of the Sparc Version 8
9 * Architecture Manual, with fixes from Gordon Irlam.
10 */
11
12/*
13 * Input: dividend and divisor in %o0 and %o1 respectively.
14 *
15 * m4 parameters:
16 * .urem name of function to generate
17 * rem rem=div => %o0 / %o1; rem=rem => %o0 % %o1
18 * false false=true => signed; false=false => unsigned
19 *
20 * Algorithm parameters:
21 * N how many bits per iteration we try to get (4)
22 * WORDSIZE total number of bits (32)
23 *
24 * Derived constants:
25 * TOPBITS number of bits in the top decade of a number
26 *
27 * Important variables:
28 * Q the partial quotient under development (initially 0)
29 * R the remainder so far, initially the dividend
30 * ITER number of main division loop iterations required;
31 * equal to ceil(log2(quotient) / N). Note that this
32 * is the log base (2^N) of the quotient.
33 * V the current comparand, initially divisor*2^(ITER*N-1)
34 *
35 * Cost:
36 * Current estimate for non-large dividend is
37 * ceil(log2(quotient) / N) * (10 + 7N/2) + C
38 * A large dividend is one greater than 2^(31-TOPBITS) and takes a
39 * different path, as the upper bits of the quotient must be developed
40 * one bit at a time.
41 */
42
43 .globl .urem
44 .globl _Urem
45.urem:
46_Urem: /* needed for export */
47
48 ! Ready to divide. Compute size of quotient; scale comparand.
49 orcc %o1, %g0, %o5
50 bne 1f
51 mov %o0, %o3
52
53 ! Divide by zero trap. If it returns, return 0 (about as
54 ! wrong as possible, but that is what SunOS does...).
55 ta ST_DIV0
56 retl
57 clr %o0
58
591:
60 cmp %o3, %o5 ! if %o1 exceeds %o0, done
61 blu Lgot_result ! (and algorithm fails otherwise)
62 clr %o2
63
64 sethi %hi(1 << (32 - 4 - 1)), %g1
65
66 cmp %o3, %g1
67 blu Lnot_really_big
68 clr %o4
69
70 ! Here the dividend is >= 2**(31-N) or so. We must be careful here,
71 ! as our usual N-at-a-shot divide step will cause overflow and havoc.
72 ! The number of bits in the result here is N*ITER+SC, where SC <= N.
73 ! Compute ITER in an unorthodox manner: know we need to shift V into
74 ! the top decade: so do not even bother to compare to R.
75 1:
76 cmp %o5, %g1
77 bgeu 3f
78 mov 1, %g7
79
80 sll %o5, 4, %o5
81
82 b 1b
83 add %o4, 1, %o4
84
85 ! Now compute %g7.
86 2:
87 addcc %o5, %o5, %o5
88 bcc Lnot_too_big
89 add %g7, 1, %g7
90
91 ! We get here if the %o1 overflowed while shifting.
92 ! This means that %o3 has the high-order bit set.
93 ! Restore %o5 and subtract from %o3.
94 sll %g1, 4, %g1 ! high order bit
95 srl %o5, 1, %o5 ! rest of %o5
96 add %o5, %g1, %o5
97
98 b Ldo_single_div
99 sub %g7, 1, %g7
100
101 Lnot_too_big:
102 3:
103 cmp %o5, %o3
104 blu 2b
105 nop
106
107 be Ldo_single_div
108 nop
109 /* NB: these are commented out in the V8-Sparc manual as well */
110 /* (I do not understand this) */
111 ! %o5 > %o3: went too far: back up 1 step
112 ! srl %o5, 1, %o5
113 ! dec %g7
114 ! do single-bit divide steps
115 !
116 ! We have to be careful here. We know that %o3 >= %o5, so we can do the
117 ! first divide step without thinking. BUT, the others are conditional,
118 ! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high-
119 ! order bit set in the first step, just falling into the regular
120 ! division loop will mess up the first time around.
121 ! So we unroll slightly...
122 Ldo_single_div:
123 subcc %g7, 1, %g7
124 bl Lend_regular_divide
125 nop
126
127 sub %o3, %o5, %o3
128 mov 1, %o2
129
130 b Lend_single_divloop
131 nop
132 Lsingle_divloop:
133 sll %o2, 1, %o2
134 bl 1f
135 srl %o5, 1, %o5
136 ! %o3 >= 0
137 sub %o3, %o5, %o3
138 b 2f
139 add %o2, 1, %o2
140 1: ! %o3 < 0
141 add %o3, %o5, %o3
142 sub %o2, 1, %o2
143 2:
144 Lend_single_divloop:
145 subcc %g7, 1, %g7
146 bge Lsingle_divloop
147 tst %o3
148
149 b,a Lend_regular_divide
150
151Lnot_really_big:
1521:
153 sll %o5, 4, %o5
154
155 cmp %o5, %o3
156 bleu 1b
157 addcc %o4, 1, %o4
158
159 be Lgot_result
160 sub %o4, 1, %o4
161
162 tst %o3 ! set up for initial iteration
163Ldivloop:
164 sll %o2, 4, %o2
165 ! depth 1, accumulated bits 0
166 bl L.1.16
167 srl %o5,1,%o5
168 ! remainder is positive
169 subcc %o3,%o5,%o3
170 ! depth 2, accumulated bits 1
171 bl L.2.17
172 srl %o5,1,%o5
173 ! remainder is positive
174 subcc %o3,%o5,%o3
175 ! depth 3, accumulated bits 3
176 bl L.3.19
177 srl %o5,1,%o5
178 ! remainder is positive
179 subcc %o3,%o5,%o3
180 ! depth 4, accumulated bits 7
181 bl L.4.23
182 srl %o5,1,%o5
183 ! remainder is positive
184 subcc %o3,%o5,%o3
185 b 9f
186 add %o2, (7*2+1), %o2
187
188L.4.23:
189 ! remainder is negative
190 addcc %o3,%o5,%o3
191 b 9f
192 add %o2, (7*2-1), %o2
193
194L.3.19:
195 ! remainder is negative
196 addcc %o3,%o5,%o3
197 ! depth 4, accumulated bits 5
198 bl L.4.21
199 srl %o5,1,%o5
200 ! remainder is positive
201 subcc %o3,%o5,%o3
202 b 9f
203 add %o2, (5*2+1), %o2
204
205L.4.21:
206 ! remainder is negative
207 addcc %o3,%o5,%o3
208 b 9f
209 add %o2, (5*2-1), %o2
210
211L.2.17:
212 ! remainder is negative
213 addcc %o3,%o5,%o3
214 ! depth 3, accumulated bits 1
215 bl L.3.17
216 srl %o5,1,%o5
217 ! remainder is positive
218 subcc %o3,%o5,%o3
219 ! depth 4, accumulated bits 3
220 bl L.4.19
221 srl %o5,1,%o5
222 ! remainder is positive
223 subcc %o3,%o5,%o3
224 b 9f
225 add %o2, (3*2+1), %o2
226
227L.4.19:
228 ! remainder is negative
229 addcc %o3,%o5,%o3
230 b 9f
231 add %o2, (3*2-1), %o2
232
233L.3.17:
234 ! remainder is negative
235 addcc %o3,%o5,%o3
236 ! depth 4, accumulated bits 1
237 bl L.4.17
238 srl %o5,1,%o5
239 ! remainder is positive
240 subcc %o3,%o5,%o3
241 b 9f
242 add %o2, (1*2+1), %o2
243
244L.4.17:
245 ! remainder is negative
246 addcc %o3,%o5,%o3
247 b 9f
248 add %o2, (1*2-1), %o2
249
250L.1.16:
251 ! remainder is negative
252 addcc %o3,%o5,%o3
253 ! depth 2, accumulated bits -1
254 bl L.2.15
255 srl %o5,1,%o5
256 ! remainder is positive
257 subcc %o3,%o5,%o3
258 ! depth 3, accumulated bits -1
259 bl L.3.15
260 srl %o5,1,%o5
261 ! remainder is positive
262 subcc %o3,%o5,%o3
263 ! depth 4, accumulated bits -1
264 bl L.4.15
265 srl %o5,1,%o5
266 ! remainder is positive
267 subcc %o3,%o5,%o3
268 b 9f
269 add %o2, (-1*2+1), %o2
270
271L.4.15:
272 ! remainder is negative
273 addcc %o3,%o5,%o3
274 b 9f
275 add %o2, (-1*2-1), %o2
276
277L.3.15:
278 ! remainder is negative
279 addcc %o3,%o5,%o3
280 ! depth 4, accumulated bits -3
281 bl L.4.13
282 srl %o5,1,%o5
283 ! remainder is positive
284 subcc %o3,%o5,%o3
285 b 9f
286 add %o2, (-3*2+1), %o2
287
288L.4.13:
289 ! remainder is negative
290 addcc %o3,%o5,%o3
291 b 9f
292 add %o2, (-3*2-1), %o2
293
294L.2.15:
295 ! remainder is negative
296 addcc %o3,%o5,%o3
297 ! depth 3, accumulated bits -3
298 bl L.3.13
299 srl %o5,1,%o5
300 ! remainder is positive
301 subcc %o3,%o5,%o3
302 ! depth 4, accumulated bits -5
303 bl L.4.11
304 srl %o5,1,%o5
305 ! remainder is positive
306 subcc %o3,%o5,%o3
307 b 9f
308 add %o2, (-5*2+1), %o2
309
310L.4.11:
311 ! remainder is negative
312 addcc %o3,%o5,%o3
313 b 9f
314 add %o2, (-5*2-1), %o2
315
316L.3.13:
317 ! remainder is negative
318 addcc %o3,%o5,%o3
319 ! depth 4, accumulated bits -7
320 bl L.4.9
321 srl %o5,1,%o5
322 ! remainder is positive
323 subcc %o3,%o5,%o3
324 b 9f
325 add %o2, (-7*2+1), %o2
326
327L.4.9:
328 ! remainder is negative
329 addcc %o3,%o5,%o3
330 b 9f
331 add %o2, (-7*2-1), %o2
332
333 9:
334Lend_regular_divide:
335 subcc %o4, 1, %o4
336 bge Ldivloop
337 tst %o3
338
339 bl,a Lgot_result
340 ! non-restoring fixup here (one instruction only!)
341 add %o3, %o1, %o3
342
343Lgot_result:
344
345 retl
346 mov %o3, %o0
347
348 .globl .urem_patch
349.urem_patch:
350 wr %g0, 0x0, %y
351 nop
352 nop
353 nop
354 udiv %o0, %o1, %o2
355 umul %o2, %o1, %o2
356 retl
357 sub %o0, %o2, %o0
diff --git a/arch/sparc/lib/xor.S b/arch/sparc/lib/xor.S
index f44f58f40234..2c05641c3263 100644
--- a/arch/sparc/lib/xor.S
+++ b/arch/sparc/lib/xor.S
@@ -8,6 +8,7 @@
8 * Copyright (C) 2006 David S. Miller <davem@davemloft.net> 8 * Copyright (C) 2006 David S. Miller <davem@davemloft.net>
9 */ 9 */
10 10
11#include <linux/linkage.h>
11#include <asm/visasm.h> 12#include <asm/visasm.h>
12#include <asm/asi.h> 13#include <asm/asi.h>
13#include <asm/dcu.h> 14#include <asm/dcu.h>
@@ -19,12 +20,9 @@
19 * !(len & 127) && len >= 256 20 * !(len & 127) && len >= 256
20 */ 21 */
21 .text 22 .text
22 .align 32
23 23
24 /* VIS versions. */ 24 /* VIS versions. */
25 .globl xor_vis_2 25ENTRY(xor_vis_2)
26 .type xor_vis_2,#function
27xor_vis_2:
28 rd %fprs, %o5 26 rd %fprs, %o5
29 andcc %o5, FPRS_FEF|FPRS_DU, %g0 27 andcc %o5, FPRS_FEF|FPRS_DU, %g0
30 be,pt %icc, 0f 28 be,pt %icc, 0f
@@ -91,11 +89,9 @@ xor_vis_2:
91 wr %g1, %g0, %asi 89 wr %g1, %g0, %asi
92 retl 90 retl
93 wr %g0, 0, %fprs 91 wr %g0, 0, %fprs
94 .size xor_vis_2, .-xor_vis_2 92ENDPROC(xor_vis_2)
95 93
96 .globl xor_vis_3 94ENTRY(xor_vis_3)
97 .type xor_vis_3,#function
98xor_vis_3:
99 rd %fprs, %o5 95 rd %fprs, %o5
100 andcc %o5, FPRS_FEF|FPRS_DU, %g0 96 andcc %o5, FPRS_FEF|FPRS_DU, %g0
101 be,pt %icc, 0f 97 be,pt %icc, 0f
@@ -159,11 +155,9 @@ xor_vis_3:
159 wr %g1, %g0, %asi 155 wr %g1, %g0, %asi
160 retl 156 retl
161 wr %g0, 0, %fprs 157 wr %g0, 0, %fprs
162 .size xor_vis_3, .-xor_vis_3 158ENDPROC(xor_vis_3)
163 159
164 .globl xor_vis_4 160ENTRY(xor_vis_4)
165 .type xor_vis_4,#function
166xor_vis_4:
167 rd %fprs, %o5 161 rd %fprs, %o5
168 andcc %o5, FPRS_FEF|FPRS_DU, %g0 162 andcc %o5, FPRS_FEF|FPRS_DU, %g0
169 be,pt %icc, 0f 163 be,pt %icc, 0f
@@ -246,11 +240,9 @@ xor_vis_4:
246 wr %g1, %g0, %asi 240 wr %g1, %g0, %asi
247 retl 241 retl
248 wr %g0, 0, %fprs 242 wr %g0, 0, %fprs
249 .size xor_vis_4, .-xor_vis_4 243ENDPROC(xor_vis_4)
250 244
251 .globl xor_vis_5 245ENTRY(xor_vis_5)
252 .type xor_vis_5,#function
253xor_vis_5:
254 save %sp, -192, %sp 246 save %sp, -192, %sp
255 rd %fprs, %o5 247 rd %fprs, %o5
256 andcc %o5, FPRS_FEF|FPRS_DU, %g0 248 andcc %o5, FPRS_FEF|FPRS_DU, %g0
@@ -354,12 +346,10 @@ xor_vis_5:
354 wr %g0, 0, %fprs 346 wr %g0, 0, %fprs
355 ret 347 ret
356 restore 348 restore
357 .size xor_vis_5, .-xor_vis_5 349ENDPROC(xor_vis_5)
358 350
359 /* Niagara versions. */ 351 /* Niagara versions. */
360 .globl xor_niagara_2 352ENTRY(xor_niagara_2) /* %o0=bytes, %o1=dest, %o2=src */
361 .type xor_niagara_2,#function
362xor_niagara_2: /* %o0=bytes, %o1=dest, %o2=src */
363 save %sp, -192, %sp 353 save %sp, -192, %sp
364 prefetch [%i1], #n_writes 354 prefetch [%i1], #n_writes
365 prefetch [%i2], #one_read 355 prefetch [%i2], #one_read
@@ -402,11 +392,9 @@ xor_niagara_2: /* %o0=bytes, %o1=dest, %o2=src */
402 wr %g7, 0x0, %asi 392 wr %g7, 0x0, %asi
403 ret 393 ret
404 restore 394 restore
405 .size xor_niagara_2, .-xor_niagara_2 395ENDPROC(xor_niagara_2)
406 396
407 .globl xor_niagara_3 397ENTRY(xor_niagara_3) /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2 */
408 .type xor_niagara_3,#function
409xor_niagara_3: /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2 */
410 save %sp, -192, %sp 398 save %sp, -192, %sp
411 prefetch [%i1], #n_writes 399 prefetch [%i1], #n_writes
412 prefetch [%i2], #one_read 400 prefetch [%i2], #one_read
@@ -465,11 +453,9 @@ xor_niagara_3: /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2 */
465 wr %g7, 0x0, %asi 453 wr %g7, 0x0, %asi
466 ret 454 ret
467 restore 455 restore
468 .size xor_niagara_3, .-xor_niagara_3 456ENDPROC(xor_niagara_3)
469 457
470 .globl xor_niagara_4 458ENTRY(xor_niagara_4) /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2, %o4=src3 */
471 .type xor_niagara_4,#function
472xor_niagara_4: /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2, %o4=src3 */
473 save %sp, -192, %sp 459 save %sp, -192, %sp
474 prefetch [%i1], #n_writes 460 prefetch [%i1], #n_writes
475 prefetch [%i2], #one_read 461 prefetch [%i2], #one_read
@@ -549,11 +535,9 @@ xor_niagara_4: /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2, %o4=src3 */
549 wr %g7, 0x0, %asi 535 wr %g7, 0x0, %asi
550 ret 536 ret
551 restore 537 restore
552 .size xor_niagara_4, .-xor_niagara_4 538ENDPROC(xor_niagara_4)
553 539
554 .globl xor_niagara_5 540ENTRY(xor_niagara_5) /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2, %o4=src3, %o5=src4 */
555 .type xor_niagara_5,#function
556xor_niagara_5: /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2, %o4=src3, %o5=src4 */
557 save %sp, -192, %sp 541 save %sp, -192, %sp
558 prefetch [%i1], #n_writes 542 prefetch [%i1], #n_writes
559 prefetch [%i2], #one_read 543 prefetch [%i2], #one_read
@@ -649,4 +633,4 @@ xor_niagara_5: /* %o0=bytes, %o1=dest, %o2=src1, %o3=src2, %o4=src3, %o5=src4 *
649 wr %g7, 0x0, %asi 633 wr %g7, 0x0, %asi
650 ret 634 ret
651 restore 635 restore
652 .size xor_niagara_5, .-xor_niagara_5 636ENDPROC(xor_niagara_5)
diff --git a/arch/sparc/mm/Makefile b/arch/sparc/mm/Makefile
index 301421c11291..69ffd3112fed 100644
--- a/arch/sparc/mm/Makefile
+++ b/arch/sparc/mm/Makefile
@@ -7,8 +7,7 @@ ccflags-y := -Werror
7obj-$(CONFIG_SPARC64) += ultra.o tlb.o tsb.o gup.o 7obj-$(CONFIG_SPARC64) += ultra.o tlb.o tsb.o gup.o
8obj-y += fault_$(BITS).o 8obj-y += fault_$(BITS).o
9obj-y += init_$(BITS).o 9obj-y += init_$(BITS).o
10obj-$(CONFIG_SPARC32) += loadmmu.o 10obj-$(CONFIG_SPARC32) += extable.o srmmu.o iommu.o io-unit.o
11obj-$(CONFIG_SPARC32) += extable.o btfixup.o srmmu.o iommu.o io-unit.o
12obj-$(CONFIG_SPARC32) += hypersparc.o viking.o tsunami.o swift.o 11obj-$(CONFIG_SPARC32) += hypersparc.o viking.o tsunami.o swift.o
13obj-$(CONFIG_SPARC_LEON)+= leon_mm.o 12obj-$(CONFIG_SPARC_LEON)+= leon_mm.o
14 13
@@ -17,9 +16,3 @@ obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
17 16
18# Only used by sparc32 17# Only used by sparc32
19obj-$(CONFIG_HIGHMEM) += highmem.o 18obj-$(CONFIG_HIGHMEM) += highmem.o
20
21ifdef CONFIG_SMP
22obj-$(CONFIG_SPARC32) += nosun4c.o
23else
24obj-$(CONFIG_SPARC32) += sun4c.o
25endif
diff --git a/arch/sparc/mm/btfixup.c b/arch/sparc/mm/btfixup.c
deleted file mode 100644
index 09d6af22db2d..000000000000
--- a/arch/sparc/mm/btfixup.c
+++ /dev/null
@@ -1,328 +0,0 @@
1/* btfixup.c: Boot time code fixup and relocator, so that
2 * we can get rid of most indirect calls to achieve single
3 * image sun4c and srmmu kernel.
4 *
5 * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6 */
7
8#include <linux/kernel.h>
9#include <linux/init.h>
10#include <asm/btfixup.h>
11#include <asm/page.h>
12#include <asm/pgalloc.h>
13#include <asm/pgtable.h>
14#include <asm/oplib.h>
15#include <asm/cacheflush.h>
16
17#define BTFIXUP_OPTIMIZE_NOP
18#define BTFIXUP_OPTIMIZE_OTHER
19
20extern char *srmmu_name;
21static char version[] __initdata = "Boot time fixup v1.6. 4/Mar/98 Jakub Jelinek (jj@ultra.linux.cz). Patching kernel for ";
22static char str_sun4c[] __initdata = "sun4c\n";
23static char str_srmmu[] __initdata = "srmmu[%s]/";
24static char str_iommu[] __initdata = "iommu\n";
25static char str_iounit[] __initdata = "io-unit\n";
26
27static int visited __initdata = 0;
28extern unsigned int ___btfixup_start[], ___btfixup_end[], __init_begin[], __init_end[], __init_text_end[];
29extern unsigned int _stext[], _end[], __start___ksymtab[], __stop___ksymtab[];
30static char wrong_f[] __initdata = "Trying to set f fixup %p to invalid function %08x\n";
31static char wrong_b[] __initdata = "Trying to set b fixup %p to invalid function %08x\n";
32static char wrong_s[] __initdata = "Trying to set s fixup %p to invalid value %08x\n";
33static char wrong_h[] __initdata = "Trying to set h fixup %p to invalid value %08x\n";
34static char wrong_a[] __initdata = "Trying to set a fixup %p to invalid value %08x\n";
35static char wrong[] __initdata = "Wrong address for %c fixup %p\n";
36static char insn_f[] __initdata = "Fixup f %p refers to weird instructions at %p[%08x,%08x]\n";
37static char insn_b[] __initdata = "Fixup b %p doesn't refer to a SETHI at %p[%08x]\n";
38static char insn_s[] __initdata = "Fixup s %p doesn't refer to an OR at %p[%08x]\n";
39static char insn_h[] __initdata = "Fixup h %p doesn't refer to a SETHI at %p[%08x]\n";
40static char insn_a[] __initdata = "Fixup a %p doesn't refer to a SETHI nor OR at %p[%08x]\n";
41static char insn_i[] __initdata = "Fixup i %p doesn't refer to a valid instruction at %p[%08x]\n";
42static char fca_und[] __initdata = "flush_cache_all undefined in btfixup()\n";
43static char wrong_setaddr[] __initdata = "Garbled CALL/INT patch at %p[%08x,%08x,%08x]=%08x\n";
44
45#ifdef BTFIXUP_OPTIMIZE_OTHER
46static void __init set_addr(unsigned int *addr, unsigned int q1, int fmangled, unsigned int value)
47{
48 if (!fmangled)
49 *addr = value;
50 else {
51 unsigned int *q = (unsigned int *)q1;
52 if (*addr == 0x01000000) {
53 /* Noped */
54 *q = value;
55 } else if (addr[-1] == *q) {
56 /* Moved */
57 addr[-1] = value;
58 *q = value;
59 } else {
60 prom_printf(wrong_setaddr, addr-1, addr[-1], *addr, *q, value);
61 prom_halt();
62 }
63 }
64}
65#else
66static inline void set_addr(unsigned int *addr, unsigned int q1, int fmangled, unsigned int value)
67{
68 *addr = value;
69}
70#endif
71
72void __init btfixup(void)
73{
74 unsigned int *p, *q;
75 int type, count;
76 unsigned insn;
77 unsigned *addr;
78 int fmangled = 0;
79 void (*flush_cacheall)(void);
80
81 if (!visited) {
82 visited++;
83 printk(version);
84 if (ARCH_SUN4C)
85 printk(str_sun4c);
86 else {
87 printk(str_srmmu, srmmu_name);
88 if (sparc_cpu_model == sun4d)
89 printk(str_iounit);
90 else
91 printk(str_iommu);
92 }
93 }
94 for (p = ___btfixup_start; p < ___btfixup_end; ) {
95 count = p[2];
96 q = p + 3;
97 switch (type = *(unsigned char *)p) {
98 case 'f':
99 count = p[3];
100 q = p + 4;
101 if (((p[0] & 1) || p[1])
102 && ((p[1] & 3) || (unsigned *)(p[1]) < _stext || (unsigned *)(p[1]) >= _end)) {
103 prom_printf(wrong_f, p, p[1]);
104 prom_halt();
105 }
106 break;
107 case 'b':
108 if (p[1] < (unsigned long)__init_begin || p[1] >= (unsigned long)__init_text_end || (p[1] & 3)) {
109 prom_printf(wrong_b, p, p[1]);
110 prom_halt();
111 }
112 break;
113 case 's':
114 if (p[1] + 0x1000 >= 0x2000) {
115 prom_printf(wrong_s, p, p[1]);
116 prom_halt();
117 }
118 break;
119 case 'h':
120 if (p[1] & 0x3ff) {
121 prom_printf(wrong_h, p, p[1]);
122 prom_halt();
123 }
124 break;
125 case 'a':
126 if (p[1] + 0x1000 >= 0x2000 && (p[1] & 0x3ff)) {
127 prom_printf(wrong_a, p, p[1]);
128 prom_halt();
129 }
130 break;
131 }
132 if (p[0] & 1) {
133 p[0] &= ~1;
134 while (count) {
135 fmangled = 0;
136 addr = (unsigned *)*q;
137 if (addr < _stext || addr >= _end) {
138 prom_printf(wrong, type, p);
139 prom_halt();
140 }
141 insn = *addr;
142#ifdef BTFIXUP_OPTIMIZE_OTHER
143 if (type != 'f' && q[1]) {
144 insn = *(unsigned int *)q[1];
145 if (!insn || insn == 1)
146 insn = *addr;
147 else
148 fmangled = 1;
149 }
150#endif
151 switch (type) {
152 case 'f': /* CALL */
153 if (addr >= __start___ksymtab && addr < __stop___ksymtab) {
154 *addr = p[1];
155 break;
156 } else if (!q[1]) {
157 if ((insn & 0xc1c00000) == 0x01000000) { /* SETHI */
158 *addr = (insn & 0xffc00000) | (p[1] >> 10); break;
159 } else if ((insn & 0xc1f82000) == 0x80102000) { /* OR X, %LO(i), Y */
160 *addr = (insn & 0xffffe000) | (p[1] & 0x3ff); break;
161 } else if ((insn & 0xc0000000) != 0x40000000) { /* !CALL */
162 bad_f:
163 prom_printf(insn_f, p, addr, insn, addr[1]);
164 prom_halt();
165 }
166 } else if (q[1] != 1)
167 addr[1] = q[1];
168 if (p[2] == BTFIXUPCALL_NORM) {
169 norm_f:
170 *addr = 0x40000000 | ((p[1] - (unsigned)addr) >> 2);
171 q[1] = 0;
172 break;
173 }
174#ifndef BTFIXUP_OPTIMIZE_NOP
175 goto norm_f;
176#else
177 if (!(addr[1] & 0x80000000)) {
178 if ((addr[1] & 0xc1c00000) != 0x01000000) /* !SETHI */
179 goto bad_f; /* CALL, Bicc, FBfcc, CBccc are weird in delay slot, aren't they? */
180 } else {
181 if ((addr[1] & 0x01800000) == 0x01800000) {
182 if ((addr[1] & 0x01f80000) == 0x01e80000) {
183 /* RESTORE */
184 goto norm_f; /* It is dangerous to patch that */
185 }
186 goto bad_f;
187 }
188 if ((addr[1] & 0xffffe003) == 0x9e03e000) {
189 /* ADD %O7, XX, %o7 */
190 int displac = (addr[1] << 19);
191
192 displac = (displac >> 21) + 2;
193 *addr = (0x10800000) + (displac & 0x3fffff);
194 q[1] = addr[1];
195 addr[1] = p[2];
196 break;
197 }
198 if ((addr[1] & 0x201f) == 0x200f || (addr[1] & 0x7c000) == 0x3c000)
199 goto norm_f; /* Someone is playing bad tricks with us: rs1 or rs2 is o7 */
200 if ((addr[1] & 0x3e000000) == 0x1e000000)
201 goto norm_f; /* rd is %o7. We'd better take care. */
202 }
203 if (p[2] == BTFIXUPCALL_NOP) {
204 *addr = 0x01000000;
205 q[1] = 1;
206 break;
207 }
208#ifndef BTFIXUP_OPTIMIZE_OTHER
209 goto norm_f;
210#else
211 if (addr[1] == 0x01000000) { /* NOP in the delay slot */
212 q[1] = addr[1];
213 *addr = p[2];
214 break;
215 }
216 if ((addr[1] & 0xc0000000) != 0xc0000000) {
217 /* Not a memory operation */
218 if ((addr[1] & 0x30000000) == 0x10000000) {
219 /* Ok, non-memory op with rd %oX */
220 if ((addr[1] & 0x3e000000) == 0x1c000000)
221 goto bad_f; /* Aiee. Someone is playing strange %sp tricks */
222 if ((addr[1] & 0x3e000000) > 0x12000000 ||
223 ((addr[1] & 0x3e000000) == 0x12000000 &&
224 p[2] != BTFIXUPCALL_STO1O0 && p[2] != BTFIXUPCALL_SWAPO0O1) ||
225 ((p[2] & 0xffffe000) == BTFIXUPCALL_RETINT(0))) {
226 /* Nobody uses the result. We can nop it out. */
227 *addr = p[2];
228 q[1] = addr[1];
229 addr[1] = 0x01000000;
230 break;
231 }
232 if ((addr[1] & 0xf1ffffe0) == 0x90100000) {
233 /* MOV %reg, %Ox */
234 if ((addr[1] & 0x3e000000) == 0x10000000 &&
235 (p[2] & 0x7c000) == 0x20000) {
236 /* Ok, it is call xx; mov reg, %o0 and call optimizes
237 to doing something on %o0. Patch the patch. */
238 *addr = (p[2] & ~0x7c000) | ((addr[1] & 0x1f) << 14);
239 q[1] = addr[1];
240 addr[1] = 0x01000000;
241 break;
242 }
243 if ((addr[1] & 0x3e000000) == 0x12000000 &&
244 p[2] == BTFIXUPCALL_STO1O0) {
245 *addr = (p[2] & ~0x3e000000) | ((addr[1] & 0x1f) << 25);
246 q[1] = addr[1];
247 addr[1] = 0x01000000;
248 break;
249 }
250 }
251 }
252 }
253 *addr = addr[1];
254 q[1] = addr[1];
255 addr[1] = p[2];
256 break;
257#endif /* BTFIXUP_OPTIMIZE_OTHER */
258#endif /* BTFIXUP_OPTIMIZE_NOP */
259 case 'b': /* BLACKBOX */
260 /* Has to be sethi i, xx */
261 if ((insn & 0xc1c00000) != 0x01000000) {
262 prom_printf(insn_b, p, addr, insn);
263 prom_halt();
264 } else {
265 void (*do_fixup)(unsigned *);
266
267 do_fixup = (void (*)(unsigned *))p[1];
268 do_fixup(addr);
269 }
270 break;
271 case 's': /* SIMM13 */
272 /* Has to be or %g0, i, xx */
273 if ((insn & 0xc1ffe000) != 0x80102000) {
274 prom_printf(insn_s, p, addr, insn);
275 prom_halt();
276 }
277 set_addr(addr, q[1], fmangled, (insn & 0xffffe000) | (p[1] & 0x1fff));
278 break;
279 case 'h': /* SETHI */
280 /* Has to be sethi i, xx */
281 if ((insn & 0xc1c00000) != 0x01000000) {
282 prom_printf(insn_h, p, addr, insn);
283 prom_halt();
284 }
285 set_addr(addr, q[1], fmangled, (insn & 0xffc00000) | (p[1] >> 10));
286 break;
287 case 'a': /* HALF */
288 /* Has to be sethi i, xx or or %g0, i, xx */
289 if ((insn & 0xc1c00000) != 0x01000000 &&
290 (insn & 0xc1ffe000) != 0x80102000) {
291 prom_printf(insn_a, p, addr, insn);
292 prom_halt();
293 }
294 if (p[1] & 0x3ff)
295 set_addr(addr, q[1], fmangled,
296 (insn & 0x3e000000) | 0x80102000 | (p[1] & 0x1fff));
297 else
298 set_addr(addr, q[1], fmangled,
299 (insn & 0x3e000000) | 0x01000000 | (p[1] >> 10));
300 break;
301 case 'i': /* INT */
302 if ((insn & 0xc1c00000) == 0x01000000) /* %HI */
303 set_addr(addr, q[1], fmangled, (insn & 0xffc00000) | (p[1] >> 10));
304 else if ((insn & 0x80002000) == 0x80002000) /* %LO */
305 set_addr(addr, q[1], fmangled, (insn & 0xffffe000) | (p[1] & 0x3ff));
306 else {
307 prom_printf(insn_i, p, addr, insn);
308 prom_halt();
309 }
310 break;
311 }
312 count -= 2;
313 q += 2;
314 }
315 } else
316 p = q + count;
317 }
318#ifdef CONFIG_SMP
319 flush_cacheall = (void (*)(void))BTFIXUPVAL_CALL(local_flush_cache_all);
320#else
321 flush_cacheall = (void (*)(void))BTFIXUPVAL_CALL(flush_cache_all);
322#endif
323 if (!flush_cacheall) {
324 prom_printf(fca_und);
325 prom_halt();
326 }
327 (*flush_cacheall)();
328}
diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c
index 7705c6731e28..f46cf6be3370 100644
--- a/arch/sparc/mm/fault_32.c
+++ b/arch/sparc/mm/fault_32.c
@@ -24,29 +24,19 @@
24 24
25#include <asm/page.h> 25#include <asm/page.h>
26#include <asm/pgtable.h> 26#include <asm/pgtable.h>
27#include <asm/memreg.h>
28#include <asm/openprom.h> 27#include <asm/openprom.h>
29#include <asm/oplib.h> 28#include <asm/oplib.h>
30#include <asm/smp.h> 29#include <asm/smp.h>
31#include <asm/traps.h> 30#include <asm/traps.h>
32#include <asm/uaccess.h> 31#include <asm/uaccess.h>
33 32
34extern int prom_node_root;
35
36int show_unhandled_signals = 1; 33int show_unhandled_signals = 1;
37 34
38/* At boot time we determine these two values necessary for setting 35/* At boot time we determine these two values necessary for setting
39 * up the segment maps and page table entries (pte's). 36 * up the segment maps and page table entries (pte's).
40 */ 37 */
41 38
42int num_segmaps, num_contexts; 39int num_contexts;
43int invalid_segment;
44
45/* various Virtual Address Cache parameters we find at boot time... */
46
47int vac_size, vac_linesize, vac_do_hw_vac_flushes;
48int vac_entries_per_context, vac_entries_per_segment;
49int vac_entries_per_page;
50 40
51/* Return how much physical memory we have. */ 41/* Return how much physical memory we have. */
52unsigned long probe_memory(void) 42unsigned long probe_memory(void)
@@ -60,55 +50,36 @@ unsigned long probe_memory(void)
60 return total; 50 return total;
61} 51}
62 52
63extern void sun4c_complete_all_stores(void);
64
65/* Whee, a level 15 NMI interrupt memory error. Let's have fun... */
66asmlinkage void sparc_lvl15_nmi(struct pt_regs *regs, unsigned long serr,
67 unsigned long svaddr, unsigned long aerr,
68 unsigned long avaddr)
69{
70 sun4c_complete_all_stores();
71 printk("FAULT: NMI received\n");
72 printk("SREGS: Synchronous Error %08lx\n", serr);
73 printk(" Synchronous Vaddr %08lx\n", svaddr);
74 printk(" Asynchronous Error %08lx\n", aerr);
75 printk(" Asynchronous Vaddr %08lx\n", avaddr);
76 if (sun4c_memerr_reg)
77 printk(" Memory Parity Error %08lx\n", *sun4c_memerr_reg);
78 printk("REGISTER DUMP:\n");
79 show_regs(regs);
80 prom_halt();
81}
82
83static void unhandled_fault(unsigned long, struct task_struct *, 53static void unhandled_fault(unsigned long, struct task_struct *,
84 struct pt_regs *) __attribute__ ((noreturn)); 54 struct pt_regs *) __attribute__ ((noreturn));
85 55
86static void unhandled_fault(unsigned long address, struct task_struct *tsk, 56static void __noreturn unhandled_fault(unsigned long address,
87 struct pt_regs *regs) 57 struct task_struct *tsk,
58 struct pt_regs *regs)
88{ 59{
89 if((unsigned long) address < PAGE_SIZE) { 60 if ((unsigned long) address < PAGE_SIZE) {
90 printk(KERN_ALERT 61 printk(KERN_ALERT
91 "Unable to handle kernel NULL pointer dereference\n"); 62 "Unable to handle kernel NULL pointer dereference\n");
92 } else { 63 } else {
93 printk(KERN_ALERT "Unable to handle kernel paging request " 64 printk(KERN_ALERT "Unable to handle kernel paging request at virtual address %08lx\n",
94 "at virtual address %08lx\n", address); 65 address);
95 } 66 }
96 printk(KERN_ALERT "tsk->{mm,active_mm}->context = %08lx\n", 67 printk(KERN_ALERT "tsk->{mm,active_mm}->context = %08lx\n",
97 (tsk->mm ? tsk->mm->context : tsk->active_mm->context)); 68 (tsk->mm ? tsk->mm->context : tsk->active_mm->context));
98 printk(KERN_ALERT "tsk->{mm,active_mm}->pgd = %08lx\n", 69 printk(KERN_ALERT "tsk->{mm,active_mm}->pgd = %08lx\n",
99 (tsk->mm ? (unsigned long) tsk->mm->pgd : 70 (tsk->mm ? (unsigned long) tsk->mm->pgd :
100 (unsigned long) tsk->active_mm->pgd)); 71 (unsigned long) tsk->active_mm->pgd));
101 die_if_kernel("Oops", regs); 72 die_if_kernel("Oops", regs);
102} 73}
103 74
104asmlinkage int lookup_fault(unsigned long pc, unsigned long ret_pc, 75asmlinkage int lookup_fault(unsigned long pc, unsigned long ret_pc,
105 unsigned long address) 76 unsigned long address)
106{ 77{
107 struct pt_regs regs; 78 struct pt_regs regs;
108 unsigned long g2; 79 unsigned long g2;
109 unsigned int insn; 80 unsigned int insn;
110 int i; 81 int i;
111 82
112 i = search_extables_range(ret_pc, &g2); 83 i = search_extables_range(ret_pc, &g2);
113 switch (i) { 84 switch (i) {
114 case 3: 85 case 3:
@@ -128,14 +99,14 @@ asmlinkage int lookup_fault(unsigned long pc, unsigned long ret_pc,
128 /* for _from_ macros */ 99 /* for _from_ macros */
129 insn = *((unsigned int *) pc); 100 insn = *((unsigned int *) pc);
130 if (!((insn >> 21) & 1) || ((insn>>19)&0x3f) == 15) 101 if (!((insn >> 21) & 1) || ((insn>>19)&0x3f) == 15)
131 return 2; 102 return 2;
132 break; 103 break;
133 104
134 default: 105 default:
135 break; 106 break;
136 } 107 }
137 108
138 memset(&regs, 0, sizeof (regs)); 109 memset(&regs, 0, sizeof(regs));
139 regs.pc = pc; 110 regs.pc = pc;
140 regs.npc = pc + 4; 111 regs.npc = pc + 4;
141 __asm__ __volatile__( 112 __asm__ __volatile__(
@@ -198,11 +169,10 @@ static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault)
198 if (text_fault) 169 if (text_fault)
199 return regs->pc; 170 return regs->pc;
200 171
201 if (regs->psr & PSR_PS) { 172 if (regs->psr & PSR_PS)
202 insn = *(unsigned int *) regs->pc; 173 insn = *(unsigned int *) regs->pc;
203 } else { 174 else
204 __get_user(insn, (unsigned int *) regs->pc); 175 __get_user(insn, (unsigned int *) regs->pc);
205 }
206 176
207 return safe_compute_effective_address(regs, insn); 177 return safe_compute_effective_address(regs, insn);
208} 178}
@@ -225,8 +195,10 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
225 unsigned long g2; 195 unsigned long g2;
226 int from_user = !(regs->psr & PSR_PS); 196 int from_user = !(regs->psr & PSR_PS);
227 int fault, code; 197 int fault, code;
198 unsigned int flags = (FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
199 (write ? FAULT_FLAG_WRITE : 0));
228 200
229 if(text_fault) 201 if (text_fault)
230 address = regs->pc; 202 address = regs->pc;
231 203
232 /* 204 /*
@@ -239,35 +211,32 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
239 * nothing more. 211 * nothing more.
240 */ 212 */
241 code = SEGV_MAPERR; 213 code = SEGV_MAPERR;
242 if (!ARCH_SUN4C && address >= TASK_SIZE) 214 if (address >= TASK_SIZE)
243 goto vmalloc_fault; 215 goto vmalloc_fault;
244 216
245 /* 217 /*
246 * If we're in an interrupt or have no user 218 * If we're in an interrupt or have no user
247 * context, we must not take the fault.. 219 * context, we must not take the fault..
248 */ 220 */
249 if (in_atomic() || !mm) 221 if (in_atomic() || !mm)
250 goto no_context; 222 goto no_context;
251 223
252 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); 224 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
253 225
226retry:
254 down_read(&mm->mmap_sem); 227 down_read(&mm->mmap_sem);
255 228
256 /* 229 if (!from_user && address >= PAGE_OFFSET)
257 * The kernel referencing a bad kernel pointer can lock up
258 * a sun4c machine completely, so we must attempt recovery.
259 */
260 if(!from_user && address >= PAGE_OFFSET)
261 goto bad_area; 230 goto bad_area;
262 231
263 vma = find_vma(mm, address); 232 vma = find_vma(mm, address);
264 if(!vma) 233 if (!vma)
265 goto bad_area; 234 goto bad_area;
266 if(vma->vm_start <= address) 235 if (vma->vm_start <= address)
267 goto good_area; 236 goto good_area;
268 if(!(vma->vm_flags & VM_GROWSDOWN)) 237 if (!(vma->vm_flags & VM_GROWSDOWN))
269 goto bad_area; 238 goto bad_area;
270 if(expand_stack(vma, address)) 239 if (expand_stack(vma, address))
271 goto bad_area; 240 goto bad_area;
272 /* 241 /*
273 * Ok, we have a good vm_area for this memory access, so 242 * Ok, we have a good vm_area for this memory access, so
@@ -275,12 +244,12 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
275 */ 244 */
276good_area: 245good_area:
277 code = SEGV_ACCERR; 246 code = SEGV_ACCERR;
278 if(write) { 247 if (write) {
279 if(!(vma->vm_flags & VM_WRITE)) 248 if (!(vma->vm_flags & VM_WRITE))
280 goto bad_area; 249 goto bad_area;
281 } else { 250 } else {
282 /* Allow reads even for write-only mappings */ 251 /* Allow reads even for write-only mappings */
283 if(!(vma->vm_flags & (VM_READ | VM_EXEC))) 252 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
284 goto bad_area; 253 goto bad_area;
285 } 254 }
286 255
@@ -289,7 +258,11 @@ good_area:
289 * make sure we exit gracefully rather than endlessly redo 258 * make sure we exit gracefully rather than endlessly redo
290 * the fault. 259 * the fault.
291 */ 260 */
292 fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); 261 fault = handle_mm_fault(mm, vma, address, flags);
262
263 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
264 return;
265
293 if (unlikely(fault & VM_FAULT_ERROR)) { 266 if (unlikely(fault & VM_FAULT_ERROR)) {
294 if (fault & VM_FAULT_OOM) 267 if (fault & VM_FAULT_OOM)
295 goto out_of_memory; 268 goto out_of_memory;
@@ -297,13 +270,29 @@ good_area:
297 goto do_sigbus; 270 goto do_sigbus;
298 BUG(); 271 BUG();
299 } 272 }
300 if (fault & VM_FAULT_MAJOR) { 273
301 current->maj_flt++; 274 if (flags & FAULT_FLAG_ALLOW_RETRY) {
302 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, address); 275 if (fault & VM_FAULT_MAJOR) {
303 } else { 276 current->maj_flt++;
304 current->min_flt++; 277 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ,
305 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, address); 278 1, regs, address);
279 } else {
280 current->min_flt++;
281 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN,
282 1, regs, address);
283 }
284 if (fault & VM_FAULT_RETRY) {
285 flags &= ~FAULT_FLAG_ALLOW_RETRY;
286
287 /* No need to up_read(&mm->mmap_sem) as we would
288 * have already released it in __lock_page_or_retry
289 * in mm/filemap.c.
290 */
291
292 goto retry;
293 }
306 } 294 }
295
307 up_read(&mm->mmap_sem); 296 up_read(&mm->mmap_sem);
308 return; 297 return;
309 298
@@ -326,14 +315,16 @@ no_context:
326 g2 = regs->u_regs[UREG_G2]; 315 g2 = regs->u_regs[UREG_G2];
327 if (!from_user) { 316 if (!from_user) {
328 fixup = search_extables_range(regs->pc, &g2); 317 fixup = search_extables_range(regs->pc, &g2);
329 if (fixup > 10) { /* Values below are reserved for other things */ 318 /* Values below 10 are reserved for other things */
319 if (fixup > 10) {
330 extern const unsigned __memset_start[]; 320 extern const unsigned __memset_start[];
331 extern const unsigned __memset_end[]; 321 extern const unsigned __memset_end[];
332 extern const unsigned __csum_partial_copy_start[]; 322 extern const unsigned __csum_partial_copy_start[];
333 extern const unsigned __csum_partial_copy_end[]; 323 extern const unsigned __csum_partial_copy_end[];
334 324
335#ifdef DEBUG_EXCEPTIONS 325#ifdef DEBUG_EXCEPTIONS
336 printk("Exception: PC<%08lx> faddr<%08lx>\n", regs->pc, address); 326 printk("Exception: PC<%08lx> faddr<%08lx>\n",
327 regs->pc, address);
337 printk("EX_TABLE: insn<%08lx> fixup<%08x> g2<%08lx>\n", 328 printk("EX_TABLE: insn<%08lx> fixup<%08x> g2<%08lx>\n",
338 regs->pc, fixup, g2); 329 regs->pc, fixup, g2);
339#endif 330#endif
@@ -341,7 +332,7 @@ no_context:
341 regs->pc < (unsigned long)__memset_end) || 332 regs->pc < (unsigned long)__memset_end) ||
342 (regs->pc >= (unsigned long)__csum_partial_copy_start && 333 (regs->pc >= (unsigned long)__csum_partial_copy_start &&
343 regs->pc < (unsigned long)__csum_partial_copy_end)) { 334 regs->pc < (unsigned long)__csum_partial_copy_end)) {
344 regs->u_regs[UREG_I4] = address; 335 regs->u_regs[UREG_I4] = address;
345 regs->u_regs[UREG_I5] = regs->pc; 336 regs->u_regs[UREG_I5] = regs->pc;
346 } 337 }
347 regs->u_regs[UREG_G2] = g2; 338 regs->u_regs[UREG_G2] = g2;
@@ -350,8 +341,8 @@ no_context:
350 return; 341 return;
351 } 342 }
352 } 343 }
353 344
354 unhandled_fault (address, tsk, regs); 345 unhandled_fault(address, tsk, regs);
355 do_exit(SIGKILL); 346 do_exit(SIGKILL);
356 347
357/* 348/*
@@ -397,97 +388,12 @@ vmalloc_fault:
397 388
398 if (pmd_present(*pmd) || !pmd_present(*pmd_k)) 389 if (pmd_present(*pmd) || !pmd_present(*pmd_k))
399 goto bad_area_nosemaphore; 390 goto bad_area_nosemaphore;
391
400 *pmd = *pmd_k; 392 *pmd = *pmd_k;
401 return; 393 return;
402 } 394 }
403} 395}
404 396
405asmlinkage void do_sun4c_fault(struct pt_regs *regs, int text_fault, int write,
406 unsigned long address)
407{
408 extern void sun4c_update_mmu_cache(struct vm_area_struct *,
409 unsigned long,pte_t *);
410 extern pte_t *sun4c_pte_offset_kernel(pmd_t *,unsigned long);
411 struct task_struct *tsk = current;
412 struct mm_struct *mm = tsk->mm;
413 pgd_t *pgdp;
414 pte_t *ptep;
415
416 if (text_fault) {
417 address = regs->pc;
418 } else if (!write &&
419 !(regs->psr & PSR_PS)) {
420 unsigned int insn, __user *ip;
421
422 ip = (unsigned int __user *)regs->pc;
423 if (!get_user(insn, ip)) {
424 if ((insn & 0xc1680000) == 0xc0680000)
425 write = 1;
426 }
427 }
428
429 if (!mm) {
430 /* We are oopsing. */
431 do_sparc_fault(regs, text_fault, write, address);
432 BUG(); /* P3 Oops already, you bitch */
433 }
434
435 pgdp = pgd_offset(mm, address);
436 ptep = sun4c_pte_offset_kernel((pmd_t *) pgdp, address);
437
438 if (pgd_val(*pgdp)) {
439 if (write) {
440 if ((pte_val(*ptep) & (_SUN4C_PAGE_WRITE|_SUN4C_PAGE_PRESENT))
441 == (_SUN4C_PAGE_WRITE|_SUN4C_PAGE_PRESENT)) {
442 unsigned long flags;
443
444 *ptep = __pte(pte_val(*ptep) | _SUN4C_PAGE_ACCESSED |
445 _SUN4C_PAGE_MODIFIED |
446 _SUN4C_PAGE_VALID |
447 _SUN4C_PAGE_DIRTY);
448
449 local_irq_save(flags);
450 if (sun4c_get_segmap(address) != invalid_segment) {
451 sun4c_put_pte(address, pte_val(*ptep));
452 local_irq_restore(flags);
453 return;
454 }
455 local_irq_restore(flags);
456 }
457 } else {
458 if ((pte_val(*ptep) & (_SUN4C_PAGE_READ|_SUN4C_PAGE_PRESENT))
459 == (_SUN4C_PAGE_READ|_SUN4C_PAGE_PRESENT)) {
460 unsigned long flags;
461
462 *ptep = __pte(pte_val(*ptep) | _SUN4C_PAGE_ACCESSED |
463 _SUN4C_PAGE_VALID);
464
465 local_irq_save(flags);
466 if (sun4c_get_segmap(address) != invalid_segment) {
467 sun4c_put_pte(address, pte_val(*ptep));
468 local_irq_restore(flags);
469 return;
470 }
471 local_irq_restore(flags);
472 }
473 }
474 }
475
476 /* This conditional is 'interesting'. */
477 if (pgd_val(*pgdp) && !(write && !(pte_val(*ptep) & _SUN4C_PAGE_WRITE))
478 && (pte_val(*ptep) & _SUN4C_PAGE_VALID))
479 /* Note: It is safe to not grab the MMAP semaphore here because
480 * we know that update_mmu_cache() will not sleep for
481 * any reason (at least not in the current implementation)
482 * and therefore there is no danger of another thread getting
483 * on the CPU and doing a shrink_mmap() on this vma.
484 */
485 sun4c_update_mmu_cache (find_vma(current->mm, address), address,
486 ptep);
487 else
488 do_sparc_fault(regs, text_fault, write, address);
489}
490
491/* This always deals with user addresses. */ 397/* This always deals with user addresses. */
492static void force_user_fault(unsigned long address, int write) 398static void force_user_fault(unsigned long address, int write)
493{ 399{
@@ -500,21 +406,21 @@ static void force_user_fault(unsigned long address, int write)
500 406
501 down_read(&mm->mmap_sem); 407 down_read(&mm->mmap_sem);
502 vma = find_vma(mm, address); 408 vma = find_vma(mm, address);
503 if(!vma) 409 if (!vma)
504 goto bad_area; 410 goto bad_area;
505 if(vma->vm_start <= address) 411 if (vma->vm_start <= address)
506 goto good_area; 412 goto good_area;
507 if(!(vma->vm_flags & VM_GROWSDOWN)) 413 if (!(vma->vm_flags & VM_GROWSDOWN))
508 goto bad_area; 414 goto bad_area;
509 if(expand_stack(vma, address)) 415 if (expand_stack(vma, address))
510 goto bad_area; 416 goto bad_area;
511good_area: 417good_area:
512 code = SEGV_ACCERR; 418 code = SEGV_ACCERR;
513 if(write) { 419 if (write) {
514 if(!(vma->vm_flags & VM_WRITE)) 420 if (!(vma->vm_flags & VM_WRITE))
515 goto bad_area; 421 goto bad_area;
516 } else { 422 } else {
517 if(!(vma->vm_flags & (VM_READ | VM_EXEC))) 423 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
518 goto bad_area; 424 goto bad_area;
519 } 425 }
520 switch (handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0)) { 426 switch (handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0)) {
@@ -545,7 +451,7 @@ void window_overflow_fault(void)
545 unsigned long sp; 451 unsigned long sp;
546 452
547 sp = current_thread_info()->rwbuf_stkptrs[0]; 453 sp = current_thread_info()->rwbuf_stkptrs[0];
548 if(((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK)) 454 if (((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK))
549 force_user_fault(sp + 0x38, 1); 455 force_user_fault(sp + 0x38, 1);
550 force_user_fault(sp, 1); 456 force_user_fault(sp, 1);
551 457
@@ -554,7 +460,7 @@ void window_overflow_fault(void)
554 460
555void window_underflow_fault(unsigned long sp) 461void window_underflow_fault(unsigned long sp)
556{ 462{
557 if(((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK)) 463 if (((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK))
558 force_user_fault(sp + 0x38, 0); 464 force_user_fault(sp + 0x38, 0);
559 force_user_fault(sp, 0); 465 force_user_fault(sp, 0);
560 466
@@ -566,7 +472,7 @@ void window_ret_fault(struct pt_regs *regs)
566 unsigned long sp; 472 unsigned long sp;
567 473
568 sp = regs->u_regs[UREG_FP]; 474 sp = regs->u_regs[UREG_FP];
569 if(((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK)) 475 if (((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK))
570 force_user_fault(sp + 0x38, 0); 476 force_user_fault(sp + 0x38, 0);
571 force_user_fault(sp, 0); 477 force_user_fault(sp, 0);
572 478
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c
index 504c0622f729..1fe0429b6314 100644
--- a/arch/sparc/mm/fault_64.c
+++ b/arch/sparc/mm/fault_64.c
@@ -279,6 +279,7 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
279 unsigned int insn = 0; 279 unsigned int insn = 0;
280 int si_code, fault_code, fault; 280 int si_code, fault_code, fault;
281 unsigned long address, mm_rss; 281 unsigned long address, mm_rss;
282 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
282 283
283 fault_code = get_thread_fault_code(); 284 fault_code = get_thread_fault_code();
284 285
@@ -333,6 +334,8 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
333 insn = get_fault_insn(regs, insn); 334 insn = get_fault_insn(regs, insn);
334 goto handle_kernel_fault; 335 goto handle_kernel_fault;
335 } 336 }
337
338retry:
336 down_read(&mm->mmap_sem); 339 down_read(&mm->mmap_sem);
337 } 340 }
338 341
@@ -423,7 +426,12 @@ good_area:
423 goto bad_area; 426 goto bad_area;
424 } 427 }
425 428
426 fault = handle_mm_fault(mm, vma, address, (fault_code & FAULT_CODE_WRITE) ? FAULT_FLAG_WRITE : 0); 429 flags |= ((fault_code & FAULT_CODE_WRITE) ? FAULT_FLAG_WRITE : 0);
430 fault = handle_mm_fault(mm, vma, address, flags);
431
432 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
433 return;
434
427 if (unlikely(fault & VM_FAULT_ERROR)) { 435 if (unlikely(fault & VM_FAULT_ERROR)) {
428 if (fault & VM_FAULT_OOM) 436 if (fault & VM_FAULT_OOM)
429 goto out_of_memory; 437 goto out_of_memory;
@@ -431,12 +439,27 @@ good_area:
431 goto do_sigbus; 439 goto do_sigbus;
432 BUG(); 440 BUG();
433 } 441 }
434 if (fault & VM_FAULT_MAJOR) { 442
435 current->maj_flt++; 443 if (flags & FAULT_FLAG_ALLOW_RETRY) {
436 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, address); 444 if (fault & VM_FAULT_MAJOR) {
437 } else { 445 current->maj_flt++;
438 current->min_flt++; 446 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ,
439 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, address); 447 1, regs, address);
448 } else {
449 current->min_flt++;
450 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN,
451 1, regs, address);
452 }
453 if (fault & VM_FAULT_RETRY) {
454 flags &= ~FAULT_FLAG_ALLOW_RETRY;
455
456 /* No need to up_read(&mm->mmap_sem) as we would
457 * have already released it in __lock_page_or_retry
458 * in mm/filemap.c.
459 */
460
461 goto retry;
462 }
440 } 463 }
441 up_read(&mm->mmap_sem); 464 up_read(&mm->mmap_sem);
442 465
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index c5f9021b1a01..ef5c779ec855 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -27,7 +27,6 @@
27#include <linux/gfp.h> 27#include <linux/gfp.h>
28 28
29#include <asm/sections.h> 29#include <asm/sections.h>
30#include <asm/vac-ops.h>
31#include <asm/page.h> 30#include <asm/page.h>
32#include <asm/pgtable.h> 31#include <asm/pgtable.h>
33#include <asm/vaddrs.h> 32#include <asm/vaddrs.h>
@@ -45,9 +44,6 @@ EXPORT_SYMBOL(phys_base);
45unsigned long pfn_base; 44unsigned long pfn_base;
46EXPORT_SYMBOL(pfn_base); 45EXPORT_SYMBOL(pfn_base);
47 46
48unsigned long page_kernel;
49EXPORT_SYMBOL(page_kernel);
50
51struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS+1]; 47struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS+1];
52unsigned long sparc_unmapped_base; 48unsigned long sparc_unmapped_base;
53 49
@@ -287,44 +283,16 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
287} 283}
288 284
289/* 285/*
290 * check_pgt_cache
291 *
292 * This is called at the end of unmapping of VMA (zap_page_range),
293 * to rescan the page cache for architecture specific things,
294 * presumably something like sun4/sun4c PMEGs. Most architectures
295 * define check_pgt_cache empty.
296 *
297 * We simply copy the 2.4 implementation for now.
298 */
299static int pgt_cache_water[2] = { 25, 50 };
300
301void check_pgt_cache(void)
302{
303 do_check_pgt_cache(pgt_cache_water[0], pgt_cache_water[1]);
304}
305
306/*
307 * paging_init() sets up the page tables: We call the MMU specific 286 * paging_init() sets up the page tables: We call the MMU specific
308 * init routine based upon the Sun model type on the Sparc. 287 * init routine based upon the Sun model type on the Sparc.
309 * 288 *
310 */ 289 */
311extern void sun4c_paging_init(void);
312extern void srmmu_paging_init(void); 290extern void srmmu_paging_init(void);
313extern void device_scan(void); 291extern void device_scan(void);
314 292
315pgprot_t PAGE_SHARED __read_mostly;
316EXPORT_SYMBOL(PAGE_SHARED);
317
318void __init paging_init(void) 293void __init paging_init(void)
319{ 294{
320 switch(sparc_cpu_model) { 295 switch(sparc_cpu_model) {
321 case sun4c:
322 case sun4e:
323 case sun4:
324 sun4c_paging_init();
325 sparc_unmapped_base = 0xe0000000;
326 BTFIXUPSET_SETHI(sparc_unmapped_base, 0xe0000000);
327 break;
328 case sparc_leon: 296 case sparc_leon:
329 leon_init(); 297 leon_init();
330 /* fall through */ 298 /* fall through */
@@ -332,7 +300,6 @@ void __init paging_init(void)
332 case sun4d: 300 case sun4d:
333 srmmu_paging_init(); 301 srmmu_paging_init();
334 sparc_unmapped_base = 0x50000000; 302 sparc_unmapped_base = 0x50000000;
335 BTFIXUPSET_SETHI(sparc_unmapped_base, 0x50000000);
336 break; 303 break;
337 default: 304 default:
338 prom_printf("paging_init: Cannot init paging on this Sparc\n"); 305 prom_printf("paging_init: Cannot init paging on this Sparc\n");
@@ -341,24 +308,6 @@ void __init paging_init(void)
341 prom_halt(); 308 prom_halt();
342 } 309 }
343 310
344 /* Initialize the protection map with non-constant, MMU dependent values. */
345 protection_map[0] = PAGE_NONE;
346 protection_map[1] = PAGE_READONLY;
347 protection_map[2] = PAGE_COPY;
348 protection_map[3] = PAGE_COPY;
349 protection_map[4] = PAGE_READONLY;
350 protection_map[5] = PAGE_READONLY;
351 protection_map[6] = PAGE_COPY;
352 protection_map[7] = PAGE_COPY;
353 protection_map[8] = PAGE_NONE;
354 protection_map[9] = PAGE_READONLY;
355 protection_map[10] = PAGE_SHARED;
356 protection_map[11] = PAGE_SHARED;
357 protection_map[12] = PAGE_READONLY;
358 protection_map[13] = PAGE_READONLY;
359 protection_map[14] = PAGE_SHARED;
360 protection_map[15] = PAGE_SHARED;
361 btfixup();
362 prom_build_devicetree(); 311 prom_build_devicetree();
363 of_fill_in_cpu_data(); 312 of_fill_in_cpu_data();
364 device_scan(); 313 device_scan();
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 21faaeea85de..6026fdd1b2ed 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -741,7 +741,6 @@ static void __init find_ramdisk(unsigned long phys_base)
741struct node_mem_mask { 741struct node_mem_mask {
742 unsigned long mask; 742 unsigned long mask;
743 unsigned long val; 743 unsigned long val;
744 unsigned long bootmem_paddr;
745}; 744};
746static struct node_mem_mask node_masks[MAX_NUMNODES]; 745static struct node_mem_mask node_masks[MAX_NUMNODES];
747static int num_node_masks; 746static int num_node_masks;
@@ -806,12 +805,6 @@ static u64 memblock_nid_range(u64 start, u64 end, int *nid)
806 805
807 return start; 806 return start;
808} 807}
809#else
810static u64 memblock_nid_range(u64 start, u64 end, int *nid)
811{
812 *nid = 0;
813 return end;
814}
815#endif 808#endif
816 809
817/* This must be invoked after performing all of the necessary 810/* This must be invoked after performing all of the necessary
@@ -820,10 +813,11 @@ static u64 memblock_nid_range(u64 start, u64 end, int *nid)
820 */ 813 */
821static void __init allocate_node_data(int nid) 814static void __init allocate_node_data(int nid)
822{ 815{
823 unsigned long paddr, num_pages, start_pfn, end_pfn;
824 struct pglist_data *p; 816 struct pglist_data *p;
825 817 unsigned long start_pfn, end_pfn;
826#ifdef CONFIG_NEED_MULTIPLE_NODES 818#ifdef CONFIG_NEED_MULTIPLE_NODES
819 unsigned long paddr;
820
827 paddr = memblock_alloc_try_nid(sizeof(struct pglist_data), SMP_CACHE_BYTES, nid); 821 paddr = memblock_alloc_try_nid(sizeof(struct pglist_data), SMP_CACHE_BYTES, nid);
828 if (!paddr) { 822 if (!paddr) {
829 prom_printf("Cannot allocate pglist_data for nid[%d]\n", nid); 823 prom_printf("Cannot allocate pglist_data for nid[%d]\n", nid);
@@ -832,7 +826,7 @@ static void __init allocate_node_data(int nid)
832 NODE_DATA(nid) = __va(paddr); 826 NODE_DATA(nid) = __va(paddr);
833 memset(NODE_DATA(nid), 0, sizeof(struct pglist_data)); 827 memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
834 828
835 NODE_DATA(nid)->bdata = &bootmem_node_data[nid]; 829 NODE_DATA(nid)->node_id = nid;
836#endif 830#endif
837 831
838 p = NODE_DATA(nid); 832 p = NODE_DATA(nid);
@@ -840,18 +834,6 @@ static void __init allocate_node_data(int nid)
840 get_pfn_range_for_nid(nid, &start_pfn, &end_pfn); 834 get_pfn_range_for_nid(nid, &start_pfn, &end_pfn);
841 p->node_start_pfn = start_pfn; 835 p->node_start_pfn = start_pfn;
842 p->node_spanned_pages = end_pfn - start_pfn; 836 p->node_spanned_pages = end_pfn - start_pfn;
843
844 if (p->node_spanned_pages) {
845 num_pages = bootmem_bootmap_pages(p->node_spanned_pages);
846
847 paddr = memblock_alloc_try_nid(num_pages << PAGE_SHIFT, PAGE_SIZE, nid);
848 if (!paddr) {
849 prom_printf("Cannot allocate bootmap for nid[%d]\n",
850 nid);
851 prom_halt();
852 }
853 node_masks[nid].bootmem_paddr = paddr;
854 }
855} 837}
856 838
857static void init_node_masks_nonnuma(void) 839static void init_node_masks_nonnuma(void)
@@ -1292,75 +1274,9 @@ static void __init bootmem_init_nonnuma(void)
1292 node_set_online(0); 1274 node_set_online(0);
1293} 1275}
1294 1276
1295static void __init reserve_range_in_node(int nid, unsigned long start,
1296 unsigned long end)
1297{
1298 numadbg(" reserve_range_in_node(nid[%d],start[%lx],end[%lx]\n",
1299 nid, start, end);
1300 while (start < end) {
1301 unsigned long this_end;
1302 int n;
1303
1304 this_end = memblock_nid_range(start, end, &n);
1305 if (n == nid) {
1306 numadbg(" MATCH reserving range [%lx:%lx]\n",
1307 start, this_end);
1308 reserve_bootmem_node(NODE_DATA(nid), start,
1309 (this_end - start), BOOTMEM_DEFAULT);
1310 } else
1311 numadbg(" NO MATCH, advancing start to %lx\n",
1312 this_end);
1313
1314 start = this_end;
1315 }
1316}
1317
1318static void __init trim_reserved_in_node(int nid)
1319{
1320 struct memblock_region *reg;
1321
1322 numadbg(" trim_reserved_in_node(%d)\n", nid);
1323
1324 for_each_memblock(reserved, reg)
1325 reserve_range_in_node(nid, reg->base, reg->base + reg->size);
1326}
1327
1328static void __init bootmem_init_one_node(int nid)
1329{
1330 struct pglist_data *p;
1331
1332 numadbg("bootmem_init_one_node(%d)\n", nid);
1333
1334 p = NODE_DATA(nid);
1335
1336 if (p->node_spanned_pages) {
1337 unsigned long paddr = node_masks[nid].bootmem_paddr;
1338 unsigned long end_pfn;
1339
1340 end_pfn = p->node_start_pfn + p->node_spanned_pages;
1341
1342 numadbg(" init_bootmem_node(%d, %lx, %lx, %lx)\n",
1343 nid, paddr >> PAGE_SHIFT, p->node_start_pfn, end_pfn);
1344
1345 init_bootmem_node(p, paddr >> PAGE_SHIFT,
1346 p->node_start_pfn, end_pfn);
1347
1348 numadbg(" free_bootmem_with_active_regions(%d, %lx)\n",
1349 nid, end_pfn);
1350 free_bootmem_with_active_regions(nid, end_pfn);
1351
1352 trim_reserved_in_node(nid);
1353
1354 numadbg(" sparse_memory_present_with_active_regions(%d)\n",
1355 nid);
1356 sparse_memory_present_with_active_regions(nid);
1357 }
1358}
1359
1360static unsigned long __init bootmem_init(unsigned long phys_base) 1277static unsigned long __init bootmem_init(unsigned long phys_base)
1361{ 1278{
1362 unsigned long end_pfn; 1279 unsigned long end_pfn;
1363 int nid;
1364 1280
1365 end_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT; 1281 end_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
1366 max_pfn = max_low_pfn = end_pfn; 1282 max_pfn = max_low_pfn = end_pfn;
@@ -1369,11 +1285,12 @@ static unsigned long __init bootmem_init(unsigned long phys_base)
1369 if (bootmem_init_numa() < 0) 1285 if (bootmem_init_numa() < 0)
1370 bootmem_init_nonnuma(); 1286 bootmem_init_nonnuma();
1371 1287
1372 /* XXX cpu notifier XXX */ 1288 /* Dump memblock with node info. */
1289 memblock_dump_all();
1373 1290
1374 for_each_online_node(nid) 1291 /* XXX cpu notifier XXX */
1375 bootmem_init_one_node(nid);
1376 1292
1293 sparse_memory_present_with_active_regions(MAX_NUMNODES);
1377 sparse_init(); 1294 sparse_init();
1378 1295
1379 return end_pfn; 1296 return end_pfn;
@@ -1701,6 +1618,7 @@ void __init paging_init(void)
1701{ 1618{
1702 unsigned long end_pfn, shift, phys_base; 1619 unsigned long end_pfn, shift, phys_base;
1703 unsigned long real_end, i; 1620 unsigned long real_end, i;
1621 int node;
1704 1622
1705 /* These build time checkes make sure that the dcache_dirty_cpu() 1623 /* These build time checkes make sure that the dcache_dirty_cpu()
1706 * page->flags usage will work. 1624 * page->flags usage will work.
@@ -1826,22 +1744,24 @@ void __init paging_init(void)
1826#endif 1744#endif
1827 } 1745 }
1828 1746
1747 /* Setup bootmem... */
1748 last_valid_pfn = end_pfn = bootmem_init(phys_base);
1749
1829 /* Once the OF device tree and MDESC have been setup, we know 1750 /* Once the OF device tree and MDESC have been setup, we know
1830 * the list of possible cpus. Therefore we can allocate the 1751 * the list of possible cpus. Therefore we can allocate the
1831 * IRQ stacks. 1752 * IRQ stacks.
1832 */ 1753 */
1833 for_each_possible_cpu(i) { 1754 for_each_possible_cpu(i) {
1834 /* XXX Use node local allocations... XXX */ 1755 node = cpu_to_node(i);
1835 softirq_stack[i] = __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
1836 hardirq_stack[i] = __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
1837 }
1838 1756
1839 /* Setup bootmem... */ 1757 softirq_stack[i] = __alloc_bootmem_node(NODE_DATA(node),
1840 last_valid_pfn = end_pfn = bootmem_init(phys_base); 1758 THREAD_SIZE,
1759 THREAD_SIZE, 0);
1760 hardirq_stack[i] = __alloc_bootmem_node(NODE_DATA(node),
1761 THREAD_SIZE,
1762 THREAD_SIZE, 0);
1763 }
1841 1764
1842#ifndef CONFIG_NEED_MULTIPLE_NODES
1843 max_mapnr = last_valid_pfn;
1844#endif
1845 kernel_physical_mapping_init(); 1765 kernel_physical_mapping_init();
1846 1766
1847 { 1767 {
@@ -1973,6 +1893,7 @@ void __init mem_init(void)
1973 free_all_bootmem_node(NODE_DATA(i)); 1893 free_all_bootmem_node(NODE_DATA(i));
1974 } 1894 }
1975 } 1895 }
1896 totalram_pages += free_low_memory_core_early(MAX_NUMNODES);
1976 } 1897 }
1977#else 1898#else
1978 totalram_pages = free_all_bootmem(); 1899 totalram_pages = free_all_bootmem();
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c
index fc58c3e917df..eb99862e9654 100644
--- a/arch/sparc/mm/io-unit.c
+++ b/arch/sparc/mm/io-unit.c
@@ -197,7 +197,7 @@ static void iounit_release_scsi_sgl(struct device *dev, struct scatterlist *sg,
197} 197}
198 198
199#ifdef CONFIG_SBUS 199#ifdef CONFIG_SBUS
200static int iounit_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned long va, __u32 addr, int len) 200static int iounit_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned long va, unsigned long addr, int len)
201{ 201{
202 struct iounit_struct *iounit = dev->archdata.iommu; 202 struct iounit_struct *iounit = dev->archdata.iommu;
203 unsigned long page, end; 203 unsigned long page, end;
@@ -242,29 +242,18 @@ static void iounit_unmap_dma_area(struct device *dev, unsigned long addr, int le
242} 242}
243#endif 243#endif
244 244
245static char *iounit_lockarea(char *vaddr, unsigned long len) 245static const struct sparc32_dma_ops iounit_dma_ops = {
246{ 246 .get_scsi_one = iounit_get_scsi_one,
247/* FIXME: Write this */ 247 .get_scsi_sgl = iounit_get_scsi_sgl,
248 return vaddr; 248 .release_scsi_one = iounit_release_scsi_one,
249} 249 .release_scsi_sgl = iounit_release_scsi_sgl,
250 250#ifdef CONFIG_SBUS
251static void iounit_unlockarea(char *vaddr, unsigned long len) 251 .map_dma_area = iounit_map_dma_area,
252{ 252 .unmap_dma_area = iounit_unmap_dma_area,
253/* FIXME: Write this */ 253#endif
254} 254};
255 255
256void __init ld_mmu_iounit(void) 256void __init ld_mmu_iounit(void)
257{ 257{
258 BTFIXUPSET_CALL(mmu_lockarea, iounit_lockarea, BTFIXUPCALL_RETO0); 258 sparc32_dma_ops = &iounit_dma_ops;
259 BTFIXUPSET_CALL(mmu_unlockarea, iounit_unlockarea, BTFIXUPCALL_NOP);
260
261 BTFIXUPSET_CALL(mmu_get_scsi_one, iounit_get_scsi_one, BTFIXUPCALL_NORM);
262 BTFIXUPSET_CALL(mmu_get_scsi_sgl, iounit_get_scsi_sgl, BTFIXUPCALL_NORM);
263 BTFIXUPSET_CALL(mmu_release_scsi_one, iounit_release_scsi_one, BTFIXUPCALL_NORM);
264 BTFIXUPSET_CALL(mmu_release_scsi_sgl, iounit_release_scsi_sgl, BTFIXUPCALL_NORM);
265
266#ifdef CONFIG_SBUS
267 BTFIXUPSET_CALL(mmu_map_dma_area, iounit_map_dma_area, BTFIXUPCALL_NORM);
268 BTFIXUPSET_CALL(mmu_unmap_dma_area, iounit_unmap_dma_area, BTFIXUPCALL_NORM);
269#endif
270} 259}
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c
index 07fc6a65d9b6..a8a58cad9d2b 100644
--- a/arch/sparc/mm/iommu.c
+++ b/arch/sparc/mm/iommu.c
@@ -39,8 +39,6 @@
39 39
40/* srmmu.c */ 40/* srmmu.c */
41extern int viking_mxcc_present; 41extern int viking_mxcc_present;
42BTFIXUPDEF_CALL(void, flush_page_for_dma, unsigned long)
43#define flush_page_for_dma(page) BTFIXUP_CALL(flush_page_for_dma)(page)
44extern int flush_page_for_dma_global; 42extern int flush_page_for_dma_global;
45static int viking_flush; 43static int viking_flush;
46/* viking.S */ 44/* viking.S */
@@ -143,7 +141,6 @@ static int __init iommu_init(void)
143 141
144subsys_initcall(iommu_init); 142subsys_initcall(iommu_init);
145 143
146/* This begs to be btfixup-ed by srmmu. */
147/* Flush the iotlb entries to ram. */ 144/* Flush the iotlb entries to ram. */
148/* This could be better if we didn't have to flush whole pages. */ 145/* This could be better if we didn't have to flush whole pages. */
149static void iommu_flush_iotlb(iopte_t *iopte, unsigned int niopte) 146static void iommu_flush_iotlb(iopte_t *iopte, unsigned int niopte)
@@ -216,11 +213,6 @@ static u32 iommu_get_scsi_one(struct device *dev, char *vaddr, unsigned int len)
216 return busa + off; 213 return busa + off;
217} 214}
218 215
219static __u32 iommu_get_scsi_one_noflush(struct device *dev, char *vaddr, unsigned long len)
220{
221 return iommu_get_scsi_one(dev, vaddr, len);
222}
223
224static __u32 iommu_get_scsi_one_gflush(struct device *dev, char *vaddr, unsigned long len) 216static __u32 iommu_get_scsi_one_gflush(struct device *dev, char *vaddr, unsigned long len)
225{ 217{
226 flush_page_for_dma(0); 218 flush_page_for_dma(0);
@@ -238,19 +230,6 @@ static __u32 iommu_get_scsi_one_pflush(struct device *dev, char *vaddr, unsigned
238 return iommu_get_scsi_one(dev, vaddr, len); 230 return iommu_get_scsi_one(dev, vaddr, len);
239} 231}
240 232
241static void iommu_get_scsi_sgl_noflush(struct device *dev, struct scatterlist *sg, int sz)
242{
243 int n;
244
245 while (sz != 0) {
246 --sz;
247 n = (sg->length + sg->offset + PAGE_SIZE-1) >> PAGE_SHIFT;
248 sg->dma_address = iommu_get_one(dev, sg_page(sg), n) + sg->offset;
249 sg->dma_length = sg->length;
250 sg = sg_next(sg);
251 }
252}
253
254static void iommu_get_scsi_sgl_gflush(struct device *dev, struct scatterlist *sg, int sz) 233static void iommu_get_scsi_sgl_gflush(struct device *dev, struct scatterlist *sg, int sz)
255{ 234{
256 int n; 235 int n;
@@ -426,40 +405,36 @@ static void iommu_unmap_dma_area(struct device *dev, unsigned long busa, int len
426} 405}
427#endif 406#endif
428 407
429static char *iommu_lockarea(char *vaddr, unsigned long len) 408static const struct sparc32_dma_ops iommu_dma_gflush_ops = {
430{ 409 .get_scsi_one = iommu_get_scsi_one_gflush,
431 return vaddr; 410 .get_scsi_sgl = iommu_get_scsi_sgl_gflush,
432} 411 .release_scsi_one = iommu_release_scsi_one,
412 .release_scsi_sgl = iommu_release_scsi_sgl,
413#ifdef CONFIG_SBUS
414 .map_dma_area = iommu_map_dma_area,
415 .unmap_dma_area = iommu_unmap_dma_area,
416#endif
417};
433 418
434static void iommu_unlockarea(char *vaddr, unsigned long len) 419static const struct sparc32_dma_ops iommu_dma_pflush_ops = {
435{ 420 .get_scsi_one = iommu_get_scsi_one_pflush,
436} 421 .get_scsi_sgl = iommu_get_scsi_sgl_pflush,
422 .release_scsi_one = iommu_release_scsi_one,
423 .release_scsi_sgl = iommu_release_scsi_sgl,
424#ifdef CONFIG_SBUS
425 .map_dma_area = iommu_map_dma_area,
426 .unmap_dma_area = iommu_unmap_dma_area,
427#endif
428};
437 429
438void __init ld_mmu_iommu(void) 430void __init ld_mmu_iommu(void)
439{ 431{
440 viking_flush = (BTFIXUPVAL_CALL(flush_page_for_dma) == (unsigned long)viking_flush_page); 432 if (flush_page_for_dma_global) {
441 BTFIXUPSET_CALL(mmu_lockarea, iommu_lockarea, BTFIXUPCALL_RETO0);
442 BTFIXUPSET_CALL(mmu_unlockarea, iommu_unlockarea, BTFIXUPCALL_NOP);
443
444 if (!BTFIXUPVAL_CALL(flush_page_for_dma)) {
445 /* IO coherent chip */
446 BTFIXUPSET_CALL(mmu_get_scsi_one, iommu_get_scsi_one_noflush, BTFIXUPCALL_RETO0);
447 BTFIXUPSET_CALL(mmu_get_scsi_sgl, iommu_get_scsi_sgl_noflush, BTFIXUPCALL_NORM);
448 } else if (flush_page_for_dma_global) {
449 /* flush_page_for_dma flushes everything, no matter of what page is it */ 433 /* flush_page_for_dma flushes everything, no matter of what page is it */
450 BTFIXUPSET_CALL(mmu_get_scsi_one, iommu_get_scsi_one_gflush, BTFIXUPCALL_NORM); 434 sparc32_dma_ops = &iommu_dma_gflush_ops;
451 BTFIXUPSET_CALL(mmu_get_scsi_sgl, iommu_get_scsi_sgl_gflush, BTFIXUPCALL_NORM);
452 } else { 435 } else {
453 BTFIXUPSET_CALL(mmu_get_scsi_one, iommu_get_scsi_one_pflush, BTFIXUPCALL_NORM); 436 sparc32_dma_ops = &iommu_dma_pflush_ops;
454 BTFIXUPSET_CALL(mmu_get_scsi_sgl, iommu_get_scsi_sgl_pflush, BTFIXUPCALL_NORM);
455 } 437 }
456 BTFIXUPSET_CALL(mmu_release_scsi_one, iommu_release_scsi_one, BTFIXUPCALL_NORM);
457 BTFIXUPSET_CALL(mmu_release_scsi_sgl, iommu_release_scsi_sgl, BTFIXUPCALL_NORM);
458
459#ifdef CONFIG_SBUS
460 BTFIXUPSET_CALL(mmu_map_dma_area, iommu_map_dma_area, BTFIXUPCALL_NORM);
461 BTFIXUPSET_CALL(mmu_unmap_dma_area, iommu_unmap_dma_area, BTFIXUPCALL_NORM);
462#endif
463 438
464 if (viking_mxcc_present || srmmu_modtype == HyperSparc) { 439 if (viking_mxcc_present || srmmu_modtype == HyperSparc) {
465 dvma_prot = __pgprot(SRMMU_CACHE | SRMMU_ET_PTE | SRMMU_PRIV); 440 dvma_prot = __pgprot(SRMMU_CACHE | SRMMU_ET_PTE | SRMMU_PRIV);
diff --git a/arch/sparc/mm/leon_mm.c b/arch/sparc/mm/leon_mm.c
index 13c2169822a8..4c67ae6e5023 100644
--- a/arch/sparc/mm/leon_mm.c
+++ b/arch/sparc/mm/leon_mm.c
@@ -15,9 +15,23 @@
15#include <asm/leon.h> 15#include <asm/leon.h>
16#include <asm/tlbflush.h> 16#include <asm/tlbflush.h>
17 17
18#include "srmmu.h"
19
18int leon_flush_during_switch = 1; 20int leon_flush_during_switch = 1;
19int srmmu_swprobe_trace; 21int srmmu_swprobe_trace;
20 22
23static inline unsigned long leon_get_ctable_ptr(void)
24{
25 unsigned int retval;
26
27 __asm__ __volatile__("lda [%1] %2, %0\n\t" :
28 "=r" (retval) :
29 "r" (SRMMU_CTXTBL_PTR),
30 "i" (ASI_LEON_MMUREGS));
31 return (retval & SRMMU_CTX_PMASK) << 4;
32}
33
34
21unsigned long srmmu_swprobe(unsigned long vaddr, unsigned long *paddr) 35unsigned long srmmu_swprobe(unsigned long vaddr, unsigned long *paddr)
22{ 36{
23 37
@@ -33,10 +47,10 @@ unsigned long srmmu_swprobe(unsigned long vaddr, unsigned long *paddr)
33 if (srmmu_swprobe_trace) 47 if (srmmu_swprobe_trace)
34 printk(KERN_INFO "swprobe: trace on\n"); 48 printk(KERN_INFO "swprobe: trace on\n");
35 49
36 ctxtbl = srmmu_get_ctable_ptr(); 50 ctxtbl = leon_get_ctable_ptr();
37 if (!(ctxtbl)) { 51 if (!(ctxtbl)) {
38 if (srmmu_swprobe_trace) 52 if (srmmu_swprobe_trace)
39 printk(KERN_INFO "swprobe: srmmu_get_ctable_ptr returned 0=>0\n"); 53 printk(KERN_INFO "swprobe: leon_get_ctable_ptr returned 0=>0\n");
40 return 0; 54 return 0;
41 } 55 }
42 if (!_pfn_valid(PFN(ctxtbl))) { 56 if (!_pfn_valid(PFN(ctxtbl))) {
@@ -258,3 +272,80 @@ void leon_switch_mm(void)
258 if (leon_flush_during_switch) 272 if (leon_flush_during_switch)
259 leon_flush_cache_all(); 273 leon_flush_cache_all();
260} 274}
275
276static void leon_flush_cache_mm(struct mm_struct *mm)
277{
278 leon_flush_cache_all();
279}
280
281static void leon_flush_cache_page(struct vm_area_struct *vma, unsigned long page)
282{
283 leon_flush_pcache_all(vma, page);
284}
285
286static void leon_flush_cache_range(struct vm_area_struct *vma,
287 unsigned long start,
288 unsigned long end)
289{
290 leon_flush_cache_all();
291}
292
293static void leon_flush_tlb_mm(struct mm_struct *mm)
294{
295 leon_flush_tlb_all();
296}
297
298static void leon_flush_tlb_page(struct vm_area_struct *vma,
299 unsigned long page)
300{
301 leon_flush_tlb_all();
302}
303
304static void leon_flush_tlb_range(struct vm_area_struct *vma,
305 unsigned long start,
306 unsigned long end)
307{
308 leon_flush_tlb_all();
309}
310
311static void leon_flush_page_to_ram(unsigned long page)
312{
313 leon_flush_cache_all();
314}
315
316static void leon_flush_sig_insns(struct mm_struct *mm, unsigned long page)
317{
318 leon_flush_cache_all();
319}
320
321static void leon_flush_page_for_dma(unsigned long page)
322{
323 leon_flush_dcache_all();
324}
325
326void __init poke_leonsparc(void)
327{
328}
329
330static const struct sparc32_cachetlb_ops leon_ops = {
331 .cache_all = leon_flush_cache_all,
332 .cache_mm = leon_flush_cache_mm,
333 .cache_page = leon_flush_cache_page,
334 .cache_range = leon_flush_cache_range,
335 .tlb_all = leon_flush_tlb_all,
336 .tlb_mm = leon_flush_tlb_mm,
337 .tlb_page = leon_flush_tlb_page,
338 .tlb_range = leon_flush_tlb_range,
339 .page_to_ram = leon_flush_page_to_ram,
340 .sig_insns = leon_flush_sig_insns,
341 .page_for_dma = leon_flush_page_for_dma,
342};
343
344void __init init_leon(void)
345{
346 srmmu_name = "LEON";
347 sparc32_cachetlb_ops = &leon_ops;
348 poke_srmmu = poke_leonsparc;
349
350 leon_flush_during_switch = leon_flush_needed();
351}
diff --git a/arch/sparc/mm/loadmmu.c b/arch/sparc/mm/loadmmu.c
deleted file mode 100644
index c5bf2a6c3858..000000000000
--- a/arch/sparc/mm/loadmmu.c
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * loadmmu.c: This code loads up all the mm function pointers once the
3 * machine type has been determined. It also sets the static
4 * mmu values such as PAGE_NONE, etc.
5 *
6 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
7 * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
8 */
9
10#include <linux/kernel.h>
11#include <linux/mm.h>
12#include <linux/init.h>
13
14#include <asm/page.h>
15#include <asm/pgtable.h>
16#include <asm/mmu_context.h>
17#include <asm/oplib.h>
18
19struct ctx_list *ctx_list_pool;
20struct ctx_list ctx_free;
21struct ctx_list ctx_used;
22
23extern void ld_mmu_sun4c(void);
24extern void ld_mmu_srmmu(void);
25
26void __init load_mmu(void)
27{
28 switch(sparc_cpu_model) {
29 case sun4c:
30 case sun4:
31 ld_mmu_sun4c();
32 break;
33 case sun4m:
34 case sun4d:
35 case sparc_leon:
36 ld_mmu_srmmu();
37 break;
38 default:
39 prom_printf("load_mmu: %d unsupported\n", (int)sparc_cpu_model);
40 prom_halt();
41 }
42 btfixup();
43}
diff --git a/arch/sparc/mm/nosun4c.c b/arch/sparc/mm/nosun4c.c
deleted file mode 100644
index 4e62c27147c4..000000000000
--- a/arch/sparc/mm/nosun4c.c
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 * nosun4c.c: This file is a bunch of dummies for SMP compiles,
3 * so that it does not need sun4c and avoid ifdefs.
4 *
5 * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6 */
7
8#include <linux/kernel.h>
9#include <linux/mm.h>
10#include <linux/init.h>
11#include <asm/pgtable.h>
12
13static char shouldnothappen[] __initdata = "32bit SMP kernel only supports sun4m and sun4d\n";
14
15/* Dummies */
16struct sun4c_mmu_ring {
17 unsigned long xxx1[3];
18 unsigned char xxx2[2];
19 int xxx3;
20};
21struct sun4c_mmu_ring sun4c_kernel_ring;
22struct sun4c_mmu_ring sun4c_kfree_ring;
23unsigned long sun4c_kernel_faults;
24unsigned long *sun4c_memerr_reg;
25
26static void __init should_not_happen(void)
27{
28 prom_printf(shouldnothappen);
29 prom_halt();
30}
31
32unsigned long __init sun4c_paging_init(unsigned long start_mem, unsigned long end_mem)
33{
34 should_not_happen();
35 return 0;
36}
37
38void __init ld_mmu_sun4c(void)
39{
40 should_not_happen();
41}
42
43void sun4c_mapioaddr(unsigned long physaddr, unsigned long virt_addr, int bus_type, int rdonly)
44{
45}
46
47void sun4c_unmapioaddr(unsigned long virt_addr)
48{
49}
50
51void sun4c_complete_all_stores(void)
52{
53}
54
55pte_t *sun4c_pte_offset(pmd_t * dir, unsigned long address)
56{
57 return NULL;
58}
59
60pte_t *sun4c_pte_offset_kernel(pmd_t *dir, unsigned long address)
61{
62 return NULL;
63}
64
65void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
66{
67}
68
69void __init sun4c_probe_vac(void)
70{
71 should_not_happen();
72}
73
74void __init sun4c_probe_memerr_reg(void)
75{
76 should_not_happen();
77}
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index cbef74e793b8..8e97e0305b01 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -48,39 +48,37 @@
48#include <asm/turbosparc.h> 48#include <asm/turbosparc.h>
49#include <asm/leon.h> 49#include <asm/leon.h>
50 50
51#include <asm/btfixup.h> 51#include "srmmu.h"
52 52
53enum mbus_module srmmu_modtype; 53enum mbus_module srmmu_modtype;
54static unsigned int hwbug_bitmask; 54static unsigned int hwbug_bitmask;
55int vac_cache_size; 55int vac_cache_size;
56int vac_line_size; 56int vac_line_size;
57 57
58struct ctx_list *ctx_list_pool;
59struct ctx_list ctx_free;
60struct ctx_list ctx_used;
61
58extern struct resource sparc_iomap; 62extern struct resource sparc_iomap;
59 63
60extern unsigned long last_valid_pfn; 64extern unsigned long last_valid_pfn;
61 65
62extern unsigned long page_kernel;
63
64static pgd_t *srmmu_swapper_pg_dir; 66static pgd_t *srmmu_swapper_pg_dir;
65 67
68const struct sparc32_cachetlb_ops *sparc32_cachetlb_ops;
69
66#ifdef CONFIG_SMP 70#ifdef CONFIG_SMP
71const struct sparc32_cachetlb_ops *local_ops;
72
67#define FLUSH_BEGIN(mm) 73#define FLUSH_BEGIN(mm)
68#define FLUSH_END 74#define FLUSH_END
69#else 75#else
70#define FLUSH_BEGIN(mm) if((mm)->context != NO_CONTEXT) { 76#define FLUSH_BEGIN(mm) if ((mm)->context != NO_CONTEXT) {
71#define FLUSH_END } 77#define FLUSH_END }
72#endif 78#endif
73 79
74BTFIXUPDEF_CALL(void, flush_page_for_dma, unsigned long)
75#define flush_page_for_dma(page) BTFIXUP_CALL(flush_page_for_dma)(page)
76
77int flush_page_for_dma_global = 1; 80int flush_page_for_dma_global = 1;
78 81
79#ifdef CONFIG_SMP
80BTFIXUPDEF_CALL(void, local_flush_page_for_dma, unsigned long)
81#define local_flush_page_for_dma(page) BTFIXUP_CALL(local_flush_page_for_dma)(page)
82#endif
83
84char *srmmu_name; 82char *srmmu_name;
85 83
86ctxd_t *srmmu_ctx_table_phys; 84ctxd_t *srmmu_ctx_table_phys;
@@ -91,28 +89,6 @@ static DEFINE_SPINLOCK(srmmu_context_spinlock);
91 89
92static int is_hypersparc; 90static int is_hypersparc;
93 91
94/*
95 * In general all page table modifications should use the V8 atomic
96 * swap instruction. This insures the mmu and the cpu are in sync
97 * with respect to ref/mod bits in the page tables.
98 */
99static inline unsigned long srmmu_swap(unsigned long *addr, unsigned long value)
100{
101 __asm__ __volatile__("swap [%2], %0" : "=&r" (value) : "0" (value), "r" (addr));
102 return value;
103}
104
105static inline void srmmu_set_pte(pte_t *ptep, pte_t pteval)
106{
107 srmmu_swap((unsigned long *)ptep, pte_val(pteval));
108}
109
110/* The very generic SRMMU page table operations. */
111static inline int srmmu_device_memory(unsigned long x)
112{
113 return ((x & 0xF0000000) != 0);
114}
115
116static int srmmu_cache_pagetables; 92static int srmmu_cache_pagetables;
117 93
118/* these will be initialized in srmmu_nocache_calcsize() */ 94/* these will be initialized in srmmu_nocache_calcsize() */
@@ -129,145 +105,39 @@ void *srmmu_nocache_pool;
129void *srmmu_nocache_bitmap; 105void *srmmu_nocache_bitmap;
130static struct bit_map srmmu_nocache_map; 106static struct bit_map srmmu_nocache_map;
131 107
132static unsigned long srmmu_pte_pfn(pte_t pte)
133{
134 if (srmmu_device_memory(pte_val(pte))) {
135 /* Just return something that will cause
136 * pfn_valid() to return false. This makes
137 * copy_one_pte() to just directly copy to
138 * PTE over.
139 */
140 return ~0UL;
141 }
142 return (pte_val(pte) & SRMMU_PTE_PMASK) >> (PAGE_SHIFT-4);
143}
144
145static struct page *srmmu_pmd_page(pmd_t pmd)
146{
147
148 if (srmmu_device_memory(pmd_val(pmd)))
149 BUG();
150 return pfn_to_page((pmd_val(pmd) & SRMMU_PTD_PMASK) >> (PAGE_SHIFT-4));
151}
152
153static inline unsigned long srmmu_pgd_page(pgd_t pgd)
154{ return srmmu_device_memory(pgd_val(pgd))?~0:(unsigned long)__nocache_va((pgd_val(pgd) & SRMMU_PTD_PMASK) << 4); }
155
156
157static inline int srmmu_pte_none(pte_t pte)
158{ return !(pte_val(pte) & 0xFFFFFFF); }
159
160static inline int srmmu_pte_present(pte_t pte)
161{ return ((pte_val(pte) & SRMMU_ET_MASK) == SRMMU_ET_PTE); }
162
163static inline void srmmu_pte_clear(pte_t *ptep)
164{ srmmu_set_pte(ptep, __pte(0)); }
165
166static inline int srmmu_pmd_none(pmd_t pmd) 108static inline int srmmu_pmd_none(pmd_t pmd)
167{ return !(pmd_val(pmd) & 0xFFFFFFF); } 109{ return !(pmd_val(pmd) & 0xFFFFFFF); }
168 110
169static inline int srmmu_pmd_bad(pmd_t pmd)
170{ return (pmd_val(pmd) & SRMMU_ET_MASK) != SRMMU_ET_PTD; }
171
172static inline int srmmu_pmd_present(pmd_t pmd)
173{ return ((pmd_val(pmd) & SRMMU_ET_MASK) == SRMMU_ET_PTD); }
174
175static inline void srmmu_pmd_clear(pmd_t *pmdp) {
176 int i;
177 for (i = 0; i < PTRS_PER_PTE/SRMMU_REAL_PTRS_PER_PTE; i++)
178 srmmu_set_pte((pte_t *)&pmdp->pmdv[i], __pte(0));
179}
180
181static inline int srmmu_pgd_none(pgd_t pgd)
182{ return !(pgd_val(pgd) & 0xFFFFFFF); }
183
184static inline int srmmu_pgd_bad(pgd_t pgd)
185{ return (pgd_val(pgd) & SRMMU_ET_MASK) != SRMMU_ET_PTD; }
186
187static inline int srmmu_pgd_present(pgd_t pgd)
188{ return ((pgd_val(pgd) & SRMMU_ET_MASK) == SRMMU_ET_PTD); }
189
190static inline void srmmu_pgd_clear(pgd_t * pgdp)
191{ srmmu_set_pte((pte_t *)pgdp, __pte(0)); }
192
193static inline pte_t srmmu_pte_wrprotect(pte_t pte)
194{ return __pte(pte_val(pte) & ~SRMMU_WRITE);}
195
196static inline pte_t srmmu_pte_mkclean(pte_t pte)
197{ return __pte(pte_val(pte) & ~SRMMU_DIRTY);}
198
199static inline pte_t srmmu_pte_mkold(pte_t pte)
200{ return __pte(pte_val(pte) & ~SRMMU_REF);}
201
202static inline pte_t srmmu_pte_mkwrite(pte_t pte)
203{ return __pte(pte_val(pte) | SRMMU_WRITE);}
204
205static inline pte_t srmmu_pte_mkdirty(pte_t pte)
206{ return __pte(pte_val(pte) | SRMMU_DIRTY);}
207
208static inline pte_t srmmu_pte_mkyoung(pte_t pte)
209{ return __pte(pte_val(pte) | SRMMU_REF);}
210
211/*
212 * Conversion functions: convert a page and protection to a page entry,
213 * and a page entry and page directory to the page they refer to.
214 */
215static pte_t srmmu_mk_pte(struct page *page, pgprot_t pgprot)
216{ return __pte((page_to_pfn(page) << (PAGE_SHIFT-4)) | pgprot_val(pgprot)); }
217
218static pte_t srmmu_mk_pte_phys(unsigned long page, pgprot_t pgprot)
219{ return __pte(((page) >> 4) | pgprot_val(pgprot)); }
220
221static pte_t srmmu_mk_pte_io(unsigned long page, pgprot_t pgprot, int space)
222{ return __pte(((page) >> 4) | (space << 28) | pgprot_val(pgprot)); }
223
224/* XXX should we hyper_flush_whole_icache here - Anton */ 111/* XXX should we hyper_flush_whole_icache here - Anton */
225static inline void srmmu_ctxd_set(ctxd_t *ctxp, pgd_t *pgdp) 112static inline void srmmu_ctxd_set(ctxd_t *ctxp, pgd_t *pgdp)
226{ srmmu_set_pte((pte_t *)ctxp, (SRMMU_ET_PTD | (__nocache_pa((unsigned long) pgdp) >> 4))); } 113{ set_pte((pte_t *)ctxp, (SRMMU_ET_PTD | (__nocache_pa((unsigned long) pgdp) >> 4))); }
227 114
228static inline void srmmu_pgd_set(pgd_t * pgdp, pmd_t * pmdp) 115void pmd_set(pmd_t *pmdp, pte_t *ptep)
229{ srmmu_set_pte((pte_t *)pgdp, (SRMMU_ET_PTD | (__nocache_pa((unsigned long) pmdp) >> 4))); }
230
231static void srmmu_pmd_set(pmd_t *pmdp, pte_t *ptep)
232{ 116{
233 unsigned long ptp; /* Physical address, shifted right by 4 */ 117 unsigned long ptp; /* Physical address, shifted right by 4 */
234 int i; 118 int i;
235 119
236 ptp = __nocache_pa((unsigned long) ptep) >> 4; 120 ptp = __nocache_pa((unsigned long) ptep) >> 4;
237 for (i = 0; i < PTRS_PER_PTE/SRMMU_REAL_PTRS_PER_PTE; i++) { 121 for (i = 0; i < PTRS_PER_PTE/SRMMU_REAL_PTRS_PER_PTE; i++) {
238 srmmu_set_pte((pte_t *)&pmdp->pmdv[i], SRMMU_ET_PTD | ptp); 122 set_pte((pte_t *)&pmdp->pmdv[i], SRMMU_ET_PTD | ptp);
239 ptp += (SRMMU_REAL_PTRS_PER_PTE*sizeof(pte_t) >> 4); 123 ptp += (SRMMU_REAL_PTRS_PER_PTE*sizeof(pte_t) >> 4);
240 } 124 }
241} 125}
242 126
243static void srmmu_pmd_populate(pmd_t *pmdp, struct page *ptep) 127void pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep)
244{ 128{
245 unsigned long ptp; /* Physical address, shifted right by 4 */ 129 unsigned long ptp; /* Physical address, shifted right by 4 */
246 int i; 130 int i;
247 131
248 ptp = page_to_pfn(ptep) << (PAGE_SHIFT-4); /* watch for overflow */ 132 ptp = page_to_pfn(ptep) << (PAGE_SHIFT-4); /* watch for overflow */
249 for (i = 0; i < PTRS_PER_PTE/SRMMU_REAL_PTRS_PER_PTE; i++) { 133 for (i = 0; i < PTRS_PER_PTE/SRMMU_REAL_PTRS_PER_PTE; i++) {
250 srmmu_set_pte((pte_t *)&pmdp->pmdv[i], SRMMU_ET_PTD | ptp); 134 set_pte((pte_t *)&pmdp->pmdv[i], SRMMU_ET_PTD | ptp);
251 ptp += (SRMMU_REAL_PTRS_PER_PTE*sizeof(pte_t) >> 4); 135 ptp += (SRMMU_REAL_PTRS_PER_PTE*sizeof(pte_t) >> 4);
252 } 136 }
253} 137}
254 138
255static inline pte_t srmmu_pte_modify(pte_t pte, pgprot_t newprot)
256{ return __pte((pte_val(pte) & SRMMU_CHG_MASK) | pgprot_val(newprot)); }
257
258/* to find an entry in a top-level page table... */
259static inline pgd_t *srmmu_pgd_offset(struct mm_struct * mm, unsigned long address)
260{ return mm->pgd + (address >> SRMMU_PGDIR_SHIFT); }
261
262/* Find an entry in the second-level page table.. */
263static inline pmd_t *srmmu_pmd_offset(pgd_t * dir, unsigned long address)
264{
265 return (pmd_t *) srmmu_pgd_page(*dir) +
266 ((address >> PMD_SHIFT) & (PTRS_PER_PMD - 1));
267}
268
269/* Find an entry in the third-level page table.. */ 139/* Find an entry in the third-level page table.. */
270static inline pte_t *srmmu_pte_offset(pmd_t * dir, unsigned long address) 140pte_t *pte_offset_kernel(pmd_t * dir, unsigned long address)
271{ 141{
272 void *pte; 142 void *pte;
273 143
@@ -276,23 +146,6 @@ static inline pte_t *srmmu_pte_offset(pmd_t * dir, unsigned long address)
276 ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); 146 ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1));
277} 147}
278 148
279static unsigned long srmmu_swp_type(swp_entry_t entry)
280{
281 return (entry.val >> SRMMU_SWP_TYPE_SHIFT) & SRMMU_SWP_TYPE_MASK;
282}
283
284static unsigned long srmmu_swp_offset(swp_entry_t entry)
285{
286 return (entry.val >> SRMMU_SWP_OFF_SHIFT) & SRMMU_SWP_OFF_MASK;
287}
288
289static swp_entry_t srmmu_swp_entry(unsigned long type, unsigned long offset)
290{
291 return (swp_entry_t) {
292 (type & SRMMU_SWP_TYPE_MASK) << SRMMU_SWP_TYPE_SHIFT
293 | (offset & SRMMU_SWP_OFF_MASK) << SRMMU_SWP_OFF_SHIFT };
294}
295
296/* 149/*
297 * size: bytes to allocate in the nocache area. 150 * size: bytes to allocate in the nocache area.
298 * align: bytes, number to align at. 151 * align: bytes, number to align at.
@@ -325,7 +178,7 @@ static unsigned long __srmmu_get_nocache(int size, int align)
325 return (SRMMU_NOCACHE_VADDR + (offset << SRMMU_NOCACHE_BITMAP_SHIFT)); 178 return (SRMMU_NOCACHE_VADDR + (offset << SRMMU_NOCACHE_BITMAP_SHIFT));
326} 179}
327 180
328static unsigned long srmmu_get_nocache(int size, int align) 181unsigned long srmmu_get_nocache(int size, int align)
329{ 182{
330 unsigned long tmp; 183 unsigned long tmp;
331 184
@@ -337,7 +190,7 @@ static unsigned long srmmu_get_nocache(int size, int align)
337 return tmp; 190 return tmp;
338} 191}
339 192
340static void srmmu_free_nocache(unsigned long vaddr, int size) 193void srmmu_free_nocache(unsigned long vaddr, int size)
341{ 194{
342 int offset; 195 int offset;
343 196
@@ -429,15 +282,15 @@ static void __init srmmu_nocache_init(void)
429 282
430 while (vaddr < srmmu_nocache_end) { 283 while (vaddr < srmmu_nocache_end) {
431 pgd = pgd_offset_k(vaddr); 284 pgd = pgd_offset_k(vaddr);
432 pmd = srmmu_pmd_offset(__nocache_fix(pgd), vaddr); 285 pmd = pmd_offset(__nocache_fix(pgd), vaddr);
433 pte = srmmu_pte_offset(__nocache_fix(pmd), vaddr); 286 pte = pte_offset_kernel(__nocache_fix(pmd), vaddr);
434 287
435 pteval = ((paddr >> 4) | SRMMU_ET_PTE | SRMMU_PRIV); 288 pteval = ((paddr >> 4) | SRMMU_ET_PTE | SRMMU_PRIV);
436 289
437 if (srmmu_cache_pagetables) 290 if (srmmu_cache_pagetables)
438 pteval |= SRMMU_CACHE; 291 pteval |= SRMMU_CACHE;
439 292
440 srmmu_set_pte(__nocache_fix(pte), __pte(pteval)); 293 set_pte(__nocache_fix(pte), __pte(pteval));
441 294
442 vaddr += PAGE_SIZE; 295 vaddr += PAGE_SIZE;
443 paddr += PAGE_SIZE; 296 paddr += PAGE_SIZE;
@@ -447,7 +300,7 @@ static void __init srmmu_nocache_init(void)
447 flush_tlb_all(); 300 flush_tlb_all();
448} 301}
449 302
450static inline pgd_t *srmmu_get_pgd_fast(void) 303pgd_t *get_pgd_fast(void)
451{ 304{
452 pgd_t *pgd = NULL; 305 pgd_t *pgd = NULL;
453 306
@@ -462,21 +315,6 @@ static inline pgd_t *srmmu_get_pgd_fast(void)
462 return pgd; 315 return pgd;
463} 316}
464 317
465static void srmmu_free_pgd_fast(pgd_t *pgd)
466{
467 srmmu_free_nocache((unsigned long)pgd, SRMMU_PGD_TABLE_SIZE);
468}
469
470static pmd_t *srmmu_pmd_alloc_one(struct mm_struct *mm, unsigned long address)
471{
472 return (pmd_t *)srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE, SRMMU_PMD_TABLE_SIZE);
473}
474
475static void srmmu_pmd_free(pmd_t * pmd)
476{
477 srmmu_free_nocache((unsigned long)pmd, SRMMU_PMD_TABLE_SIZE);
478}
479
480/* 318/*
481 * Hardware needs alignment to 256 only, but we align to whole page size 319 * Hardware needs alignment to 256 only, but we align to whole page size
482 * to reduce fragmentation problems due to the buddy principle. 320 * to reduce fragmentation problems due to the buddy principle.
@@ -485,31 +323,19 @@ static void srmmu_pmd_free(pmd_t * pmd)
485 * Alignments up to the page size are the same for physical and virtual 323 * Alignments up to the page size are the same for physical and virtual
486 * addresses of the nocache area. 324 * addresses of the nocache area.
487 */ 325 */
488static pte_t * 326pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
489srmmu_pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
490{
491 return (pte_t *)srmmu_get_nocache(PTE_SIZE, PTE_SIZE);
492}
493
494static pgtable_t
495srmmu_pte_alloc_one(struct mm_struct *mm, unsigned long address)
496{ 327{
497 unsigned long pte; 328 unsigned long pte;
498 struct page *page; 329 struct page *page;
499 330
500 if ((pte = (unsigned long)srmmu_pte_alloc_one_kernel(mm, address)) == 0) 331 if ((pte = (unsigned long)pte_alloc_one_kernel(mm, address)) == 0)
501 return NULL; 332 return NULL;
502 page = pfn_to_page( __nocache_pa(pte) >> PAGE_SHIFT ); 333 page = pfn_to_page( __nocache_pa(pte) >> PAGE_SHIFT );
503 pgtable_page_ctor(page); 334 pgtable_page_ctor(page);
504 return page; 335 return page;
505} 336}
506 337
507static void srmmu_free_pte_fast(pte_t *pte) 338void pte_free(struct mm_struct *mm, pgtable_t pte)
508{
509 srmmu_free_nocache((unsigned long)pte, PTE_SIZE);
510}
511
512static void srmmu_pte_free(pgtable_t pte)
513{ 339{
514 unsigned long p; 340 unsigned long p;
515 341
@@ -560,8 +386,8 @@ static inline void free_context(int context)
560} 386}
561 387
562 388
563static void srmmu_switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, 389void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm,
564 struct task_struct *tsk, int cpu) 390 struct task_struct *tsk)
565{ 391{
566 if(mm->context == NO_CONTEXT) { 392 if(mm->context == NO_CONTEXT) {
567 spin_lock(&srmmu_context_spinlock); 393 spin_lock(&srmmu_context_spinlock);
@@ -590,8 +416,8 @@ static inline void srmmu_mapioaddr(unsigned long physaddr,
590 416
591 physaddr &= PAGE_MASK; 417 physaddr &= PAGE_MASK;
592 pgdp = pgd_offset_k(virt_addr); 418 pgdp = pgd_offset_k(virt_addr);
593 pmdp = srmmu_pmd_offset(pgdp, virt_addr); 419 pmdp = pmd_offset(pgdp, virt_addr);
594 ptep = srmmu_pte_offset(pmdp, virt_addr); 420 ptep = pte_offset_kernel(pmdp, virt_addr);
595 tmp = (physaddr >> 4) | SRMMU_ET_PTE; 421 tmp = (physaddr >> 4) | SRMMU_ET_PTE;
596 422
597 /* 423 /*
@@ -602,11 +428,11 @@ static inline void srmmu_mapioaddr(unsigned long physaddr,
602 tmp |= (bus_type << 28); 428 tmp |= (bus_type << 28);
603 tmp |= SRMMU_PRIV; 429 tmp |= SRMMU_PRIV;
604 __flush_page_to_ram(virt_addr); 430 __flush_page_to_ram(virt_addr);
605 srmmu_set_pte(ptep, __pte(tmp)); 431 set_pte(ptep, __pte(tmp));
606} 432}
607 433
608static void srmmu_mapiorange(unsigned int bus, unsigned long xpa, 434void srmmu_mapiorange(unsigned int bus, unsigned long xpa,
609 unsigned long xva, unsigned int len) 435 unsigned long xva, unsigned int len)
610{ 436{
611 while (len != 0) { 437 while (len != 0) {
612 len -= PAGE_SIZE; 438 len -= PAGE_SIZE;
@@ -624,14 +450,14 @@ static inline void srmmu_unmapioaddr(unsigned long virt_addr)
624 pte_t *ptep; 450 pte_t *ptep;
625 451
626 pgdp = pgd_offset_k(virt_addr); 452 pgdp = pgd_offset_k(virt_addr);
627 pmdp = srmmu_pmd_offset(pgdp, virt_addr); 453 pmdp = pmd_offset(pgdp, virt_addr);
628 ptep = srmmu_pte_offset(pmdp, virt_addr); 454 ptep = pte_offset_kernel(pmdp, virt_addr);
629 455
630 /* No need to flush uncacheable page. */ 456 /* No need to flush uncacheable page. */
631 srmmu_pte_clear(ptep); 457 __pte_clear(ptep);
632} 458}
633 459
634static void srmmu_unmapiorange(unsigned long virt_addr, unsigned int len) 460void srmmu_unmapiorange(unsigned long virt_addr, unsigned int len)
635{ 461{
636 while (len != 0) { 462 while (len != 0) {
637 len -= PAGE_SIZE; 463 len -= PAGE_SIZE;
@@ -647,10 +473,9 @@ static void srmmu_unmapiorange(unsigned long virt_addr, unsigned int len)
647 * pool. As a side effect we are putting a little too much pressure 473 * pool. As a side effect we are putting a little too much pressure
648 * on the gfp() subsystem. This setup also makes the logic of the 474 * on the gfp() subsystem. This setup also makes the logic of the
649 * iommu mapping code a lot easier as we can transparently handle 475 * iommu mapping code a lot easier as we can transparently handle
650 * mappings on the kernel stack without any special code as we did 476 * mappings on the kernel stack without any special code.
651 * need on the sun4c.
652 */ 477 */
653static struct thread_info *srmmu_alloc_thread_info_node(int node) 478struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
654{ 479{
655 struct thread_info *ret; 480 struct thread_info *ret;
656 481
@@ -664,7 +489,7 @@ static struct thread_info *srmmu_alloc_thread_info_node(int node)
664 return ret; 489 return ret;
665} 490}
666 491
667static void srmmu_free_thread_info(struct thread_info *ti) 492void free_thread_info(struct thread_info *ti)
668{ 493{
669 free_pages((unsigned long)ti, THREAD_INFO_ORDER); 494 free_pages((unsigned long)ti, THREAD_INFO_ORDER);
670} 495}
@@ -683,38 +508,6 @@ extern void tsunami_flush_tlb_range(struct vm_area_struct *vma, unsigned long st
683extern void tsunami_flush_tlb_page(struct vm_area_struct *vma, unsigned long page); 508extern void tsunami_flush_tlb_page(struct vm_area_struct *vma, unsigned long page);
684extern void tsunami_setup_blockops(void); 509extern void tsunami_setup_blockops(void);
685 510
686/*
687 * Workaround, until we find what's going on with Swift. When low on memory,
688 * it sometimes loops in fault/handle_mm_fault incl. flush_tlb_page to find
689 * out it is already in page tables/ fault again on the same instruction.
690 * I really don't understand it, have checked it and contexts
691 * are right, flush_tlb_all is done as well, and it faults again...
692 * Strange. -jj
693 *
694 * The following code is a deadwood that may be necessary when
695 * we start to make precise page flushes again. --zaitcev
696 */
697static void swift_update_mmu_cache(struct vm_area_struct * vma, unsigned long address, pte_t *ptep)
698{
699#if 0
700 static unsigned long last;
701 unsigned int val;
702 /* unsigned int n; */
703
704 if (address == last) {
705 val = srmmu_hwprobe(address);
706 if (val != 0 && pte_val(*ptep) != val) {
707 printk("swift_update_mmu_cache: "
708 "addr %lx put %08x probed %08x from %p\n",
709 address, pte_val(*ptep), val,
710 __builtin_return_address(0));
711 srmmu_flush_whole_tlb();
712 }
713 }
714 last = address;
715#endif
716}
717
718/* swift.S */ 511/* swift.S */
719extern void swift_flush_cache_all(void); 512extern void swift_flush_cache_all(void);
720extern void swift_flush_cache_mm(struct mm_struct *mm); 513extern void swift_flush_cache_mm(struct mm_struct *mm);
@@ -767,244 +560,6 @@ void swift_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
767 * with respect to cache coherency. 560 * with respect to cache coherency.
768 */ 561 */
769 562
770/* Cypress flushes. */
771static void cypress_flush_cache_all(void)
772{
773 volatile unsigned long cypress_sucks;
774 unsigned long faddr, tagval;
775
776 flush_user_windows();
777 for(faddr = 0; faddr < 0x10000; faddr += 0x20) {
778 __asm__ __volatile__("lda [%1 + %2] %3, %0\n\t" :
779 "=r" (tagval) :
780 "r" (faddr), "r" (0x40000),
781 "i" (ASI_M_DATAC_TAG));
782
783 /* If modified and valid, kick it. */
784 if((tagval & 0x60) == 0x60)
785 cypress_sucks = *(unsigned long *)(0xf0020000 + faddr);
786 }
787}
788
789static void cypress_flush_cache_mm(struct mm_struct *mm)
790{
791 register unsigned long a, b, c, d, e, f, g;
792 unsigned long flags, faddr;
793 int octx;
794
795 FLUSH_BEGIN(mm)
796 flush_user_windows();
797 local_irq_save(flags);
798 octx = srmmu_get_context();
799 srmmu_set_context(mm->context);
800 a = 0x20; b = 0x40; c = 0x60;
801 d = 0x80; e = 0xa0; f = 0xc0; g = 0xe0;
802
803 faddr = (0x10000 - 0x100);
804 goto inside;
805 do {
806 faddr -= 0x100;
807 inside:
808 __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
809 "sta %%g0, [%0 + %2] %1\n\t"
810 "sta %%g0, [%0 + %3] %1\n\t"
811 "sta %%g0, [%0 + %4] %1\n\t"
812 "sta %%g0, [%0 + %5] %1\n\t"
813 "sta %%g0, [%0 + %6] %1\n\t"
814 "sta %%g0, [%0 + %7] %1\n\t"
815 "sta %%g0, [%0 + %8] %1\n\t" : :
816 "r" (faddr), "i" (ASI_M_FLUSH_CTX),
817 "r" (a), "r" (b), "r" (c), "r" (d),
818 "r" (e), "r" (f), "r" (g));
819 } while(faddr);
820 srmmu_set_context(octx);
821 local_irq_restore(flags);
822 FLUSH_END
823}
824
825static void cypress_flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
826{
827 struct mm_struct *mm = vma->vm_mm;
828 register unsigned long a, b, c, d, e, f, g;
829 unsigned long flags, faddr;
830 int octx;
831
832 FLUSH_BEGIN(mm)
833 flush_user_windows();
834 local_irq_save(flags);
835 octx = srmmu_get_context();
836 srmmu_set_context(mm->context);
837 a = 0x20; b = 0x40; c = 0x60;
838 d = 0x80; e = 0xa0; f = 0xc0; g = 0xe0;
839
840 start &= SRMMU_REAL_PMD_MASK;
841 while(start < end) {
842 faddr = (start + (0x10000 - 0x100));
843 goto inside;
844 do {
845 faddr -= 0x100;
846 inside:
847 __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
848 "sta %%g0, [%0 + %2] %1\n\t"
849 "sta %%g0, [%0 + %3] %1\n\t"
850 "sta %%g0, [%0 + %4] %1\n\t"
851 "sta %%g0, [%0 + %5] %1\n\t"
852 "sta %%g0, [%0 + %6] %1\n\t"
853 "sta %%g0, [%0 + %7] %1\n\t"
854 "sta %%g0, [%0 + %8] %1\n\t" : :
855 "r" (faddr),
856 "i" (ASI_M_FLUSH_SEG),
857 "r" (a), "r" (b), "r" (c), "r" (d),
858 "r" (e), "r" (f), "r" (g));
859 } while (faddr != start);
860 start += SRMMU_REAL_PMD_SIZE;
861 }
862 srmmu_set_context(octx);
863 local_irq_restore(flags);
864 FLUSH_END
865}
866
867static void cypress_flush_cache_page(struct vm_area_struct *vma, unsigned long page)
868{
869 register unsigned long a, b, c, d, e, f, g;
870 struct mm_struct *mm = vma->vm_mm;
871 unsigned long flags, line;
872 int octx;
873
874 FLUSH_BEGIN(mm)
875 flush_user_windows();
876 local_irq_save(flags);
877 octx = srmmu_get_context();
878 srmmu_set_context(mm->context);
879 a = 0x20; b = 0x40; c = 0x60;
880 d = 0x80; e = 0xa0; f = 0xc0; g = 0xe0;
881
882 page &= PAGE_MASK;
883 line = (page + PAGE_SIZE) - 0x100;
884 goto inside;
885 do {
886 line -= 0x100;
887 inside:
888 __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
889 "sta %%g0, [%0 + %2] %1\n\t"
890 "sta %%g0, [%0 + %3] %1\n\t"
891 "sta %%g0, [%0 + %4] %1\n\t"
892 "sta %%g0, [%0 + %5] %1\n\t"
893 "sta %%g0, [%0 + %6] %1\n\t"
894 "sta %%g0, [%0 + %7] %1\n\t"
895 "sta %%g0, [%0 + %8] %1\n\t" : :
896 "r" (line),
897 "i" (ASI_M_FLUSH_PAGE),
898 "r" (a), "r" (b), "r" (c), "r" (d),
899 "r" (e), "r" (f), "r" (g));
900 } while(line != page);
901 srmmu_set_context(octx);
902 local_irq_restore(flags);
903 FLUSH_END
904}
905
906/* Cypress is copy-back, at least that is how we configure it. */
907static void cypress_flush_page_to_ram(unsigned long page)
908{
909 register unsigned long a, b, c, d, e, f, g;
910 unsigned long line;
911
912 a = 0x20; b = 0x40; c = 0x60; d = 0x80; e = 0xa0; f = 0xc0; g = 0xe0;
913 page &= PAGE_MASK;
914 line = (page + PAGE_SIZE) - 0x100;
915 goto inside;
916 do {
917 line -= 0x100;
918 inside:
919 __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
920 "sta %%g0, [%0 + %2] %1\n\t"
921 "sta %%g0, [%0 + %3] %1\n\t"
922 "sta %%g0, [%0 + %4] %1\n\t"
923 "sta %%g0, [%0 + %5] %1\n\t"
924 "sta %%g0, [%0 + %6] %1\n\t"
925 "sta %%g0, [%0 + %7] %1\n\t"
926 "sta %%g0, [%0 + %8] %1\n\t" : :
927 "r" (line),
928 "i" (ASI_M_FLUSH_PAGE),
929 "r" (a), "r" (b), "r" (c), "r" (d),
930 "r" (e), "r" (f), "r" (g));
931 } while(line != page);
932}
933
934/* Cypress is also IO cache coherent. */
935static void cypress_flush_page_for_dma(unsigned long page)
936{
937}
938
939/* Cypress has unified L2 VIPT, from which both instructions and data
940 * are stored. It does not have an onboard icache of any sort, therefore
941 * no flush is necessary.
942 */
943static void cypress_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr)
944{
945}
946
947static void cypress_flush_tlb_all(void)
948{
949 srmmu_flush_whole_tlb();
950}
951
952static void cypress_flush_tlb_mm(struct mm_struct *mm)
953{
954 FLUSH_BEGIN(mm)
955 __asm__ __volatile__(
956 "lda [%0] %3, %%g5\n\t"
957 "sta %2, [%0] %3\n\t"
958 "sta %%g0, [%1] %4\n\t"
959 "sta %%g5, [%0] %3\n"
960 : /* no outputs */
961 : "r" (SRMMU_CTX_REG), "r" (0x300), "r" (mm->context),
962 "i" (ASI_M_MMUREGS), "i" (ASI_M_FLUSH_PROBE)
963 : "g5");
964 FLUSH_END
965}
966
967static void cypress_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
968{
969 struct mm_struct *mm = vma->vm_mm;
970 unsigned long size;
971
972 FLUSH_BEGIN(mm)
973 start &= SRMMU_PGDIR_MASK;
974 size = SRMMU_PGDIR_ALIGN(end) - start;
975 __asm__ __volatile__(
976 "lda [%0] %5, %%g5\n\t"
977 "sta %1, [%0] %5\n"
978 "1:\n\t"
979 "subcc %3, %4, %3\n\t"
980 "bne 1b\n\t"
981 " sta %%g0, [%2 + %3] %6\n\t"
982 "sta %%g5, [%0] %5\n"
983 : /* no outputs */
984 : "r" (SRMMU_CTX_REG), "r" (mm->context), "r" (start | 0x200),
985 "r" (size), "r" (SRMMU_PGDIR_SIZE), "i" (ASI_M_MMUREGS),
986 "i" (ASI_M_FLUSH_PROBE)
987 : "g5", "cc");
988 FLUSH_END
989}
990
991static void cypress_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
992{
993 struct mm_struct *mm = vma->vm_mm;
994
995 FLUSH_BEGIN(mm)
996 __asm__ __volatile__(
997 "lda [%0] %3, %%g5\n\t"
998 "sta %1, [%0] %3\n\t"
999 "sta %%g0, [%2] %4\n\t"
1000 "sta %%g5, [%0] %3\n"
1001 : /* no outputs */
1002 : "r" (SRMMU_CTX_REG), "r" (mm->context), "r" (page & PAGE_MASK),
1003 "i" (ASI_M_MMUREGS), "i" (ASI_M_FLUSH_PROBE)
1004 : "g5");
1005 FLUSH_END
1006}
1007
1008/* viking.S */ 563/* viking.S */
1009extern void viking_flush_cache_all(void); 564extern void viking_flush_cache_all(void);
1010extern void viking_flush_cache_mm(struct mm_struct *mm); 565extern void viking_flush_cache_mm(struct mm_struct *mm);
@@ -1065,21 +620,21 @@ static void __init srmmu_early_allocate_ptable_skeleton(unsigned long start,
1065 620
1066 while(start < end) { 621 while(start < end) {
1067 pgdp = pgd_offset_k(start); 622 pgdp = pgd_offset_k(start);
1068 if(srmmu_pgd_none(*(pgd_t *)__nocache_fix(pgdp))) { 623 if (pgd_none(*(pgd_t *)__nocache_fix(pgdp))) {
1069 pmdp = (pmd_t *) __srmmu_get_nocache( 624 pmdp = (pmd_t *) __srmmu_get_nocache(
1070 SRMMU_PMD_TABLE_SIZE, SRMMU_PMD_TABLE_SIZE); 625 SRMMU_PMD_TABLE_SIZE, SRMMU_PMD_TABLE_SIZE);
1071 if (pmdp == NULL) 626 if (pmdp == NULL)
1072 early_pgtable_allocfail("pmd"); 627 early_pgtable_allocfail("pmd");
1073 memset(__nocache_fix(pmdp), 0, SRMMU_PMD_TABLE_SIZE); 628 memset(__nocache_fix(pmdp), 0, SRMMU_PMD_TABLE_SIZE);
1074 srmmu_pgd_set(__nocache_fix(pgdp), pmdp); 629 pgd_set(__nocache_fix(pgdp), pmdp);
1075 } 630 }
1076 pmdp = srmmu_pmd_offset(__nocache_fix(pgdp), start); 631 pmdp = pmd_offset(__nocache_fix(pgdp), start);
1077 if(srmmu_pmd_none(*(pmd_t *)__nocache_fix(pmdp))) { 632 if(srmmu_pmd_none(*(pmd_t *)__nocache_fix(pmdp))) {
1078 ptep = (pte_t *)__srmmu_get_nocache(PTE_SIZE, PTE_SIZE); 633 ptep = (pte_t *)__srmmu_get_nocache(PTE_SIZE, PTE_SIZE);
1079 if (ptep == NULL) 634 if (ptep == NULL)
1080 early_pgtable_allocfail("pte"); 635 early_pgtable_allocfail("pte");
1081 memset(__nocache_fix(ptep), 0, PTE_SIZE); 636 memset(__nocache_fix(ptep), 0, PTE_SIZE);
1082 srmmu_pmd_set(__nocache_fix(pmdp), ptep); 637 pmd_set(__nocache_fix(pmdp), ptep);
1083 } 638 }
1084 if (start > (0xffffffffUL - PMD_SIZE)) 639 if (start > (0xffffffffUL - PMD_SIZE))
1085 break; 640 break;
@@ -1096,21 +651,21 @@ static void __init srmmu_allocate_ptable_skeleton(unsigned long start,
1096 651
1097 while(start < end) { 652 while(start < end) {
1098 pgdp = pgd_offset_k(start); 653 pgdp = pgd_offset_k(start);
1099 if(srmmu_pgd_none(*pgdp)) { 654 if (pgd_none(*pgdp)) {
1100 pmdp = (pmd_t *)__srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE, SRMMU_PMD_TABLE_SIZE); 655 pmdp = (pmd_t *)__srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE, SRMMU_PMD_TABLE_SIZE);
1101 if (pmdp == NULL) 656 if (pmdp == NULL)
1102 early_pgtable_allocfail("pmd"); 657 early_pgtable_allocfail("pmd");
1103 memset(pmdp, 0, SRMMU_PMD_TABLE_SIZE); 658 memset(pmdp, 0, SRMMU_PMD_TABLE_SIZE);
1104 srmmu_pgd_set(pgdp, pmdp); 659 pgd_set(pgdp, pmdp);
1105 } 660 }
1106 pmdp = srmmu_pmd_offset(pgdp, start); 661 pmdp = pmd_offset(pgdp, start);
1107 if(srmmu_pmd_none(*pmdp)) { 662 if(srmmu_pmd_none(*pmdp)) {
1108 ptep = (pte_t *) __srmmu_get_nocache(PTE_SIZE, 663 ptep = (pte_t *) __srmmu_get_nocache(PTE_SIZE,
1109 PTE_SIZE); 664 PTE_SIZE);
1110 if (ptep == NULL) 665 if (ptep == NULL)
1111 early_pgtable_allocfail("pte"); 666 early_pgtable_allocfail("pte");
1112 memset(ptep, 0, PTE_SIZE); 667 memset(ptep, 0, PTE_SIZE);
1113 srmmu_pmd_set(pmdp, ptep); 668 pmd_set(pmdp, ptep);
1114 } 669 }
1115 if (start > (0xffffffffUL - PMD_SIZE)) 670 if (start > (0xffffffffUL - PMD_SIZE))
1116 break; 671 break;
@@ -1162,21 +717,21 @@ static void __init srmmu_inherit_prom_mappings(unsigned long start,
1162 start += SRMMU_PGDIR_SIZE; 717 start += SRMMU_PGDIR_SIZE;
1163 continue; 718 continue;
1164 } 719 }
1165 if(srmmu_pgd_none(*(pgd_t *)__nocache_fix(pgdp))) { 720 if (pgd_none(*(pgd_t *)__nocache_fix(pgdp))) {
1166 pmdp = (pmd_t *)__srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE, SRMMU_PMD_TABLE_SIZE); 721 pmdp = (pmd_t *)__srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE, SRMMU_PMD_TABLE_SIZE);
1167 if (pmdp == NULL) 722 if (pmdp == NULL)
1168 early_pgtable_allocfail("pmd"); 723 early_pgtable_allocfail("pmd");
1169 memset(__nocache_fix(pmdp), 0, SRMMU_PMD_TABLE_SIZE); 724 memset(__nocache_fix(pmdp), 0, SRMMU_PMD_TABLE_SIZE);
1170 srmmu_pgd_set(__nocache_fix(pgdp), pmdp); 725 pgd_set(__nocache_fix(pgdp), pmdp);
1171 } 726 }
1172 pmdp = srmmu_pmd_offset(__nocache_fix(pgdp), start); 727 pmdp = pmd_offset(__nocache_fix(pgdp), start);
1173 if(srmmu_pmd_none(*(pmd_t *)__nocache_fix(pmdp))) { 728 if(srmmu_pmd_none(*(pmd_t *)__nocache_fix(pmdp))) {
1174 ptep = (pte_t *) __srmmu_get_nocache(PTE_SIZE, 729 ptep = (pte_t *) __srmmu_get_nocache(PTE_SIZE,
1175 PTE_SIZE); 730 PTE_SIZE);
1176 if (ptep == NULL) 731 if (ptep == NULL)
1177 early_pgtable_allocfail("pte"); 732 early_pgtable_allocfail("pte");
1178 memset(__nocache_fix(ptep), 0, PTE_SIZE); 733 memset(__nocache_fix(ptep), 0, PTE_SIZE);
1179 srmmu_pmd_set(__nocache_fix(pmdp), ptep); 734 pmd_set(__nocache_fix(pmdp), ptep);
1180 } 735 }
1181 if(what == 1) { 736 if(what == 1) {
1182 /* 737 /*
@@ -1190,7 +745,7 @@ static void __init srmmu_inherit_prom_mappings(unsigned long start,
1190 start += SRMMU_REAL_PMD_SIZE; 745 start += SRMMU_REAL_PMD_SIZE;
1191 continue; 746 continue;
1192 } 747 }
1193 ptep = srmmu_pte_offset(__nocache_fix(pmdp), start); 748 ptep = pte_offset_kernel(__nocache_fix(pmdp), start);
1194 *(pte_t *)__nocache_fix(ptep) = __pte(prompte); 749 *(pte_t *)__nocache_fix(ptep) = __pte(prompte);
1195 start += PAGE_SIZE; 750 start += PAGE_SIZE;
1196 } 751 }
@@ -1231,13 +786,6 @@ static unsigned long __init map_spbank(unsigned long vbase, int sp_entry)
1231 return vstart; 786 return vstart;
1232} 787}
1233 788
1234static inline void memprobe_error(char *msg)
1235{
1236 prom_printf(msg);
1237 prom_printf("Halting now...\n");
1238 prom_halt();
1239}
1240
1241static inline void map_kernel(void) 789static inline void map_kernel(void)
1242{ 790{
1243 int i; 791 int i;
@@ -1249,8 +797,6 @@ static inline void map_kernel(void)
1249 for (i = 0; sp_banks[i].num_bytes != 0; i++) { 797 for (i = 0; sp_banks[i].num_bytes != 0; i++) {
1250 map_spbank((unsigned long)__va(sp_banks[i].base_addr), i); 798 map_spbank((unsigned long)__va(sp_banks[i].base_addr), i);
1251 } 799 }
1252
1253 BTFIXUPSET_SIMM13(user_ptrs_per_pgd, PAGE_OFFSET / SRMMU_PGDIR_SIZE);
1254} 800}
1255 801
1256/* Paging initialization on the Sparc Reference MMU. */ 802/* Paging initialization on the Sparc Reference MMU. */
@@ -1312,7 +858,7 @@ void __init srmmu_paging_init(void)
1312 srmmu_set_ctable_ptr((unsigned long)srmmu_ctx_table_phys); 858 srmmu_set_ctable_ptr((unsigned long)srmmu_ctx_table_phys);
1313#ifdef CONFIG_SMP 859#ifdef CONFIG_SMP
1314 /* Stop from hanging here... */ 860 /* Stop from hanging here... */
1315 local_flush_tlb_all(); 861 local_ops->tlb_all();
1316#else 862#else
1317 flush_tlb_all(); 863 flush_tlb_all();
1318#endif 864#endif
@@ -1326,8 +872,8 @@ void __init srmmu_paging_init(void)
1326 srmmu_allocate_ptable_skeleton(PKMAP_BASE, PKMAP_END); 872 srmmu_allocate_ptable_skeleton(PKMAP_BASE, PKMAP_END);
1327 873
1328 pgd = pgd_offset_k(PKMAP_BASE); 874 pgd = pgd_offset_k(PKMAP_BASE);
1329 pmd = srmmu_pmd_offset(pgd, PKMAP_BASE); 875 pmd = pmd_offset(pgd, PKMAP_BASE);
1330 pte = srmmu_pte_offset(pmd, PKMAP_BASE); 876 pte = pte_offset_kernel(pmd, PKMAP_BASE);
1331 pkmap_page_table = pte; 877 pkmap_page_table = pte;
1332 878
1333 flush_cache_all(); 879 flush_cache_all();
@@ -1359,7 +905,7 @@ void __init srmmu_paging_init(void)
1359 } 905 }
1360} 906}
1361 907
1362static void srmmu_mmu_info(struct seq_file *m) 908void mmu_info(struct seq_file *m)
1363{ 909{
1364 seq_printf(m, 910 seq_printf(m,
1365 "MMU type\t: %s\n" 911 "MMU type\t: %s\n"
@@ -1372,11 +918,7 @@ static void srmmu_mmu_info(struct seq_file *m)
1372 srmmu_nocache_map.used << SRMMU_NOCACHE_BITMAP_SHIFT); 918 srmmu_nocache_map.used << SRMMU_NOCACHE_BITMAP_SHIFT);
1373} 919}
1374 920
1375static void srmmu_update_mmu_cache(struct vm_area_struct * vma, unsigned long address, pte_t pte) 921void destroy_context(struct mm_struct *mm)
1376{
1377}
1378
1379static void srmmu_destroy_context(struct mm_struct *mm)
1380{ 922{
1381 923
1382 if(mm->context != NO_CONTEXT) { 924 if(mm->context != NO_CONTEXT) {
@@ -1474,6 +1016,20 @@ static void __cpuinit poke_hypersparc(void)
1474 clear = srmmu_get_fstatus(); 1016 clear = srmmu_get_fstatus();
1475} 1017}
1476 1018
1019static const struct sparc32_cachetlb_ops hypersparc_ops = {
1020 .cache_all = hypersparc_flush_cache_all,
1021 .cache_mm = hypersparc_flush_cache_mm,
1022 .cache_page = hypersparc_flush_cache_page,
1023 .cache_range = hypersparc_flush_cache_range,
1024 .tlb_all = hypersparc_flush_tlb_all,
1025 .tlb_mm = hypersparc_flush_tlb_mm,
1026 .tlb_page = hypersparc_flush_tlb_page,
1027 .tlb_range = hypersparc_flush_tlb_range,
1028 .page_to_ram = hypersparc_flush_page_to_ram,
1029 .sig_insns = hypersparc_flush_sig_insns,
1030 .page_for_dma = hypersparc_flush_page_for_dma,
1031};
1032
1477static void __init init_hypersparc(void) 1033static void __init init_hypersparc(void)
1478{ 1034{
1479 srmmu_name = "ROSS HyperSparc"; 1035 srmmu_name = "ROSS HyperSparc";
@@ -1482,118 +1038,13 @@ static void __init init_hypersparc(void)
1482 init_vac_layout(); 1038 init_vac_layout();
1483 1039
1484 is_hypersparc = 1; 1040 is_hypersparc = 1;
1485 1041 sparc32_cachetlb_ops = &hypersparc_ops;
1486 BTFIXUPSET_CALL(pte_clear, srmmu_pte_clear, BTFIXUPCALL_NORM);
1487 BTFIXUPSET_CALL(pmd_clear, srmmu_pmd_clear, BTFIXUPCALL_NORM);
1488 BTFIXUPSET_CALL(pgd_clear, srmmu_pgd_clear, BTFIXUPCALL_NORM);
1489 BTFIXUPSET_CALL(flush_cache_all, hypersparc_flush_cache_all, BTFIXUPCALL_NORM);
1490 BTFIXUPSET_CALL(flush_cache_mm, hypersparc_flush_cache_mm, BTFIXUPCALL_NORM);
1491 BTFIXUPSET_CALL(flush_cache_range, hypersparc_flush_cache_range, BTFIXUPCALL_NORM);
1492 BTFIXUPSET_CALL(flush_cache_page, hypersparc_flush_cache_page, BTFIXUPCALL_NORM);
1493
1494 BTFIXUPSET_CALL(flush_tlb_all, hypersparc_flush_tlb_all, BTFIXUPCALL_NORM);
1495 BTFIXUPSET_CALL(flush_tlb_mm, hypersparc_flush_tlb_mm, BTFIXUPCALL_NORM);
1496 BTFIXUPSET_CALL(flush_tlb_range, hypersparc_flush_tlb_range, BTFIXUPCALL_NORM);
1497 BTFIXUPSET_CALL(flush_tlb_page, hypersparc_flush_tlb_page, BTFIXUPCALL_NORM);
1498
1499 BTFIXUPSET_CALL(__flush_page_to_ram, hypersparc_flush_page_to_ram, BTFIXUPCALL_NORM);
1500 BTFIXUPSET_CALL(flush_sig_insns, hypersparc_flush_sig_insns, BTFIXUPCALL_NORM);
1501 BTFIXUPSET_CALL(flush_page_for_dma, hypersparc_flush_page_for_dma, BTFIXUPCALL_NOP);
1502
1503 1042
1504 poke_srmmu = poke_hypersparc; 1043 poke_srmmu = poke_hypersparc;
1505 1044
1506 hypersparc_setup_blockops(); 1045 hypersparc_setup_blockops();
1507} 1046}
1508 1047
1509static void __cpuinit poke_cypress(void)
1510{
1511 unsigned long mreg = srmmu_get_mmureg();
1512 unsigned long faddr, tagval;
1513 volatile unsigned long cypress_sucks;
1514 volatile unsigned long clear;
1515
1516 clear = srmmu_get_faddr();
1517 clear = srmmu_get_fstatus();
1518
1519 if (!(mreg & CYPRESS_CENABLE)) {
1520 for(faddr = 0x0; faddr < 0x10000; faddr += 20) {
1521 __asm__ __volatile__("sta %%g0, [%0 + %1] %2\n\t"
1522 "sta %%g0, [%0] %2\n\t" : :
1523 "r" (faddr), "r" (0x40000),
1524 "i" (ASI_M_DATAC_TAG));
1525 }
1526 } else {
1527 for(faddr = 0; faddr < 0x10000; faddr += 0x20) {
1528 __asm__ __volatile__("lda [%1 + %2] %3, %0\n\t" :
1529 "=r" (tagval) :
1530 "r" (faddr), "r" (0x40000),
1531 "i" (ASI_M_DATAC_TAG));
1532
1533 /* If modified and valid, kick it. */
1534 if((tagval & 0x60) == 0x60)
1535 cypress_sucks = *(unsigned long *)
1536 (0xf0020000 + faddr);
1537 }
1538 }
1539
1540 /* And one more, for our good neighbor, Mr. Broken Cypress. */
1541 clear = srmmu_get_faddr();
1542 clear = srmmu_get_fstatus();
1543
1544 mreg |= (CYPRESS_CENABLE | CYPRESS_CMODE);
1545 srmmu_set_mmureg(mreg);
1546}
1547
1548static void __init init_cypress_common(void)
1549{
1550 init_vac_layout();
1551
1552 BTFIXUPSET_CALL(pte_clear, srmmu_pte_clear, BTFIXUPCALL_NORM);
1553 BTFIXUPSET_CALL(pmd_clear, srmmu_pmd_clear, BTFIXUPCALL_NORM);
1554 BTFIXUPSET_CALL(pgd_clear, srmmu_pgd_clear, BTFIXUPCALL_NORM);
1555 BTFIXUPSET_CALL(flush_cache_all, cypress_flush_cache_all, BTFIXUPCALL_NORM);
1556 BTFIXUPSET_CALL(flush_cache_mm, cypress_flush_cache_mm, BTFIXUPCALL_NORM);
1557 BTFIXUPSET_CALL(flush_cache_range, cypress_flush_cache_range, BTFIXUPCALL_NORM);
1558 BTFIXUPSET_CALL(flush_cache_page, cypress_flush_cache_page, BTFIXUPCALL_NORM);
1559
1560 BTFIXUPSET_CALL(flush_tlb_all, cypress_flush_tlb_all, BTFIXUPCALL_NORM);
1561 BTFIXUPSET_CALL(flush_tlb_mm, cypress_flush_tlb_mm, BTFIXUPCALL_NORM);
1562 BTFIXUPSET_CALL(flush_tlb_page, cypress_flush_tlb_page, BTFIXUPCALL_NORM);
1563 BTFIXUPSET_CALL(flush_tlb_range, cypress_flush_tlb_range, BTFIXUPCALL_NORM);
1564
1565
1566 BTFIXUPSET_CALL(__flush_page_to_ram, cypress_flush_page_to_ram, BTFIXUPCALL_NORM);
1567 BTFIXUPSET_CALL(flush_sig_insns, cypress_flush_sig_insns, BTFIXUPCALL_NOP);
1568 BTFIXUPSET_CALL(flush_page_for_dma, cypress_flush_page_for_dma, BTFIXUPCALL_NOP);
1569
1570 poke_srmmu = poke_cypress;
1571}
1572
1573static void __init init_cypress_604(void)
1574{
1575 srmmu_name = "ROSS Cypress-604(UP)";
1576 srmmu_modtype = Cypress;
1577 init_cypress_common();
1578}
1579
1580static void __init init_cypress_605(unsigned long mrev)
1581{
1582 srmmu_name = "ROSS Cypress-605(MP)";
1583 if(mrev == 0xe) {
1584 srmmu_modtype = Cypress_vE;
1585 hwbug_bitmask |= HWBUG_COPYBACK_BROKEN;
1586 } else {
1587 if(mrev == 0xd) {
1588 srmmu_modtype = Cypress_vD;
1589 hwbug_bitmask |= HWBUG_ASIFLUSH_BROKEN;
1590 } else {
1591 srmmu_modtype = Cypress;
1592 }
1593 }
1594 init_cypress_common();
1595}
1596
1597static void __cpuinit poke_swift(void) 1048static void __cpuinit poke_swift(void)
1598{ 1049{
1599 unsigned long mreg; 1050 unsigned long mreg;
@@ -1617,6 +1068,20 @@ static void __cpuinit poke_swift(void)
1617 srmmu_set_mmureg(mreg); 1068 srmmu_set_mmureg(mreg);
1618} 1069}
1619 1070
1071static const struct sparc32_cachetlb_ops swift_ops = {
1072 .cache_all = swift_flush_cache_all,
1073 .cache_mm = swift_flush_cache_mm,
1074 .cache_page = swift_flush_cache_page,
1075 .cache_range = swift_flush_cache_range,
1076 .tlb_all = swift_flush_tlb_all,
1077 .tlb_mm = swift_flush_tlb_mm,
1078 .tlb_page = swift_flush_tlb_page,
1079 .tlb_range = swift_flush_tlb_range,
1080 .page_to_ram = swift_flush_page_to_ram,
1081 .sig_insns = swift_flush_sig_insns,
1082 .page_for_dma = swift_flush_page_for_dma,
1083};
1084
1620#define SWIFT_MASKID_ADDR 0x10003018 1085#define SWIFT_MASKID_ADDR 0x10003018
1621static void __init init_swift(void) 1086static void __init init_swift(void)
1622{ 1087{
@@ -1667,23 +1132,7 @@ static void __init init_swift(void)
1667 break; 1132 break;
1668 } 1133 }
1669 1134
1670 BTFIXUPSET_CALL(flush_cache_all, swift_flush_cache_all, BTFIXUPCALL_NORM); 1135 sparc32_cachetlb_ops = &swift_ops;
1671 BTFIXUPSET_CALL(flush_cache_mm, swift_flush_cache_mm, BTFIXUPCALL_NORM);
1672 BTFIXUPSET_CALL(flush_cache_page, swift_flush_cache_page, BTFIXUPCALL_NORM);
1673 BTFIXUPSET_CALL(flush_cache_range, swift_flush_cache_range, BTFIXUPCALL_NORM);
1674
1675
1676 BTFIXUPSET_CALL(flush_tlb_all, swift_flush_tlb_all, BTFIXUPCALL_NORM);
1677 BTFIXUPSET_CALL(flush_tlb_mm, swift_flush_tlb_mm, BTFIXUPCALL_NORM);
1678 BTFIXUPSET_CALL(flush_tlb_page, swift_flush_tlb_page, BTFIXUPCALL_NORM);
1679 BTFIXUPSET_CALL(flush_tlb_range, swift_flush_tlb_range, BTFIXUPCALL_NORM);
1680
1681 BTFIXUPSET_CALL(__flush_page_to_ram, swift_flush_page_to_ram, BTFIXUPCALL_NORM);
1682 BTFIXUPSET_CALL(flush_sig_insns, swift_flush_sig_insns, BTFIXUPCALL_NORM);
1683 BTFIXUPSET_CALL(flush_page_for_dma, swift_flush_page_for_dma, BTFIXUPCALL_NORM);
1684
1685 BTFIXUPSET_CALL(update_mmu_cache, swift_update_mmu_cache, BTFIXUPCALL_NORM);
1686
1687 flush_page_for_dma_global = 0; 1136 flush_page_for_dma_global = 0;
1688 1137
1689 /* 1138 /*
@@ -1816,26 +1265,25 @@ static void __cpuinit poke_turbosparc(void)
1816 srmmu_set_mmureg(mreg); 1265 srmmu_set_mmureg(mreg);
1817} 1266}
1818 1267
1268static const struct sparc32_cachetlb_ops turbosparc_ops = {
1269 .cache_all = turbosparc_flush_cache_all,
1270 .cache_mm = turbosparc_flush_cache_mm,
1271 .cache_page = turbosparc_flush_cache_page,
1272 .cache_range = turbosparc_flush_cache_range,
1273 .tlb_all = turbosparc_flush_tlb_all,
1274 .tlb_mm = turbosparc_flush_tlb_mm,
1275 .tlb_page = turbosparc_flush_tlb_page,
1276 .tlb_range = turbosparc_flush_tlb_range,
1277 .page_to_ram = turbosparc_flush_page_to_ram,
1278 .sig_insns = turbosparc_flush_sig_insns,
1279 .page_for_dma = turbosparc_flush_page_for_dma,
1280};
1281
1819static void __init init_turbosparc(void) 1282static void __init init_turbosparc(void)
1820{ 1283{
1821 srmmu_name = "Fujitsu TurboSparc"; 1284 srmmu_name = "Fujitsu TurboSparc";
1822 srmmu_modtype = TurboSparc; 1285 srmmu_modtype = TurboSparc;
1823 1286 sparc32_cachetlb_ops = &turbosparc_ops;
1824 BTFIXUPSET_CALL(flush_cache_all, turbosparc_flush_cache_all, BTFIXUPCALL_NORM);
1825 BTFIXUPSET_CALL(flush_cache_mm, turbosparc_flush_cache_mm, BTFIXUPCALL_NORM);
1826 BTFIXUPSET_CALL(flush_cache_page, turbosparc_flush_cache_page, BTFIXUPCALL_NORM);
1827 BTFIXUPSET_CALL(flush_cache_range, turbosparc_flush_cache_range, BTFIXUPCALL_NORM);
1828
1829 BTFIXUPSET_CALL(flush_tlb_all, turbosparc_flush_tlb_all, BTFIXUPCALL_NORM);
1830 BTFIXUPSET_CALL(flush_tlb_mm, turbosparc_flush_tlb_mm, BTFIXUPCALL_NORM);
1831 BTFIXUPSET_CALL(flush_tlb_page, turbosparc_flush_tlb_page, BTFIXUPCALL_NORM);
1832 BTFIXUPSET_CALL(flush_tlb_range, turbosparc_flush_tlb_range, BTFIXUPCALL_NORM);
1833
1834 BTFIXUPSET_CALL(__flush_page_to_ram, turbosparc_flush_page_to_ram, BTFIXUPCALL_NORM);
1835
1836 BTFIXUPSET_CALL(flush_sig_insns, turbosparc_flush_sig_insns, BTFIXUPCALL_NOP);
1837 BTFIXUPSET_CALL(flush_page_for_dma, turbosparc_flush_page_for_dma, BTFIXUPCALL_NORM);
1838
1839 poke_srmmu = poke_turbosparc; 1287 poke_srmmu = poke_turbosparc;
1840} 1288}
1841 1289
@@ -1850,6 +1298,20 @@ static void __cpuinit poke_tsunami(void)
1850 srmmu_set_mmureg(mreg); 1298 srmmu_set_mmureg(mreg);
1851} 1299}
1852 1300
1301static const struct sparc32_cachetlb_ops tsunami_ops = {
1302 .cache_all = tsunami_flush_cache_all,
1303 .cache_mm = tsunami_flush_cache_mm,
1304 .cache_page = tsunami_flush_cache_page,
1305 .cache_range = tsunami_flush_cache_range,
1306 .tlb_all = tsunami_flush_tlb_all,
1307 .tlb_mm = tsunami_flush_tlb_mm,
1308 .tlb_page = tsunami_flush_tlb_page,
1309 .tlb_range = tsunami_flush_tlb_range,
1310 .page_to_ram = tsunami_flush_page_to_ram,
1311 .sig_insns = tsunami_flush_sig_insns,
1312 .page_for_dma = tsunami_flush_page_for_dma,
1313};
1314
1853static void __init init_tsunami(void) 1315static void __init init_tsunami(void)
1854{ 1316{
1855 /* 1317 /*
@@ -1860,22 +1322,7 @@ static void __init init_tsunami(void)
1860 1322
1861 srmmu_name = "TI Tsunami"; 1323 srmmu_name = "TI Tsunami";
1862 srmmu_modtype = Tsunami; 1324 srmmu_modtype = Tsunami;
1863 1325 sparc32_cachetlb_ops = &tsunami_ops;
1864 BTFIXUPSET_CALL(flush_cache_all, tsunami_flush_cache_all, BTFIXUPCALL_NORM);
1865 BTFIXUPSET_CALL(flush_cache_mm, tsunami_flush_cache_mm, BTFIXUPCALL_NORM);
1866 BTFIXUPSET_CALL(flush_cache_page, tsunami_flush_cache_page, BTFIXUPCALL_NORM);
1867 BTFIXUPSET_CALL(flush_cache_range, tsunami_flush_cache_range, BTFIXUPCALL_NORM);
1868
1869
1870 BTFIXUPSET_CALL(flush_tlb_all, tsunami_flush_tlb_all, BTFIXUPCALL_NORM);
1871 BTFIXUPSET_CALL(flush_tlb_mm, tsunami_flush_tlb_mm, BTFIXUPCALL_NORM);
1872 BTFIXUPSET_CALL(flush_tlb_page, tsunami_flush_tlb_page, BTFIXUPCALL_NORM);
1873 BTFIXUPSET_CALL(flush_tlb_range, tsunami_flush_tlb_range, BTFIXUPCALL_NORM);
1874
1875 BTFIXUPSET_CALL(__flush_page_to_ram, tsunami_flush_page_to_ram, BTFIXUPCALL_NOP);
1876 BTFIXUPSET_CALL(flush_sig_insns, tsunami_flush_sig_insns, BTFIXUPCALL_NORM);
1877 BTFIXUPSET_CALL(flush_page_for_dma, tsunami_flush_page_for_dma, BTFIXUPCALL_NORM);
1878
1879 poke_srmmu = poke_tsunami; 1326 poke_srmmu = poke_tsunami;
1880 1327
1881 tsunami_setup_blockops(); 1328 tsunami_setup_blockops();
@@ -1886,7 +1333,7 @@ static void __cpuinit poke_viking(void)
1886 unsigned long mreg = srmmu_get_mmureg(); 1333 unsigned long mreg = srmmu_get_mmureg();
1887 static int smp_catch; 1334 static int smp_catch;
1888 1335
1889 if(viking_mxcc_present) { 1336 if (viking_mxcc_present) {
1890 unsigned long mxcc_control = mxcc_get_creg(); 1337 unsigned long mxcc_control = mxcc_get_creg();
1891 1338
1892 mxcc_control |= (MXCC_CTL_ECE | MXCC_CTL_PRE | MXCC_CTL_MCE); 1339 mxcc_control |= (MXCC_CTL_ECE | MXCC_CTL_PRE | MXCC_CTL_MCE);
@@ -1923,6 +1370,52 @@ static void __cpuinit poke_viking(void)
1923 srmmu_set_mmureg(mreg); 1370 srmmu_set_mmureg(mreg);
1924} 1371}
1925 1372
1373static struct sparc32_cachetlb_ops viking_ops = {
1374 .cache_all = viking_flush_cache_all,
1375 .cache_mm = viking_flush_cache_mm,
1376 .cache_page = viking_flush_cache_page,
1377 .cache_range = viking_flush_cache_range,
1378 .tlb_all = viking_flush_tlb_all,
1379 .tlb_mm = viking_flush_tlb_mm,
1380 .tlb_page = viking_flush_tlb_page,
1381 .tlb_range = viking_flush_tlb_range,
1382 .page_to_ram = viking_flush_page_to_ram,
1383 .sig_insns = viking_flush_sig_insns,
1384 .page_for_dma = viking_flush_page_for_dma,
1385};
1386
1387#ifdef CONFIG_SMP
1388/* On sun4d the cpu broadcasts local TLB flushes, so we can just
1389 * perform the local TLB flush and all the other cpus will see it.
1390 * But, unfortunately, there is a bug in the sun4d XBUS backplane
1391 * that requires that we add some synchronization to these flushes.
1392 *
1393 * The bug is that the fifo which keeps track of all the pending TLB
1394 * broadcasts in the system is an entry or two too small, so if we
1395 * have too many going at once we'll overflow that fifo and lose a TLB
1396 * flush resulting in corruption.
1397 *
1398 * Our workaround is to take a global spinlock around the TLB flushes,
1399 * which guarentees we won't ever have too many pending. It's a big
1400 * hammer, but a semaphore like system to make sure we only have N TLB
1401 * flushes going at once will require SMP locking anyways so there's
1402 * no real value in trying any harder than this.
1403 */
1404static struct sparc32_cachetlb_ops viking_sun4d_smp_ops = {
1405 .cache_all = viking_flush_cache_all,
1406 .cache_mm = viking_flush_cache_mm,
1407 .cache_page = viking_flush_cache_page,
1408 .cache_range = viking_flush_cache_range,
1409 .tlb_all = sun4dsmp_flush_tlb_all,
1410 .tlb_mm = sun4dsmp_flush_tlb_mm,
1411 .tlb_page = sun4dsmp_flush_tlb_page,
1412 .tlb_range = sun4dsmp_flush_tlb_range,
1413 .page_to_ram = viking_flush_page_to_ram,
1414 .sig_insns = viking_flush_sig_insns,
1415 .page_for_dma = viking_flush_page_for_dma,
1416};
1417#endif
1418
1926static void __init init_viking(void) 1419static void __init init_viking(void)
1927{ 1420{
1928 unsigned long mreg = srmmu_get_mmureg(); 1421 unsigned long mreg = srmmu_get_mmureg();
@@ -1933,10 +1426,6 @@ static void __init init_viking(void)
1933 viking_mxcc_present = 0; 1426 viking_mxcc_present = 0;
1934 msi_set_sync(); 1427 msi_set_sync();
1935 1428
1936 BTFIXUPSET_CALL(pte_clear, srmmu_pte_clear, BTFIXUPCALL_NORM);
1937 BTFIXUPSET_CALL(pmd_clear, srmmu_pmd_clear, BTFIXUPCALL_NORM);
1938 BTFIXUPSET_CALL(pgd_clear, srmmu_pgd_clear, BTFIXUPCALL_NORM);
1939
1940 /* 1429 /*
1941 * We need this to make sure old viking takes no hits 1430 * We need this to make sure old viking takes no hits
1942 * on it's cache for dma snoops to workaround the 1431 * on it's cache for dma snoops to workaround the
@@ -1944,84 +1433,28 @@ static void __init init_viking(void)
1944 * This is only necessary because of the new way in 1433 * This is only necessary because of the new way in
1945 * which we use the IOMMU. 1434 * which we use the IOMMU.
1946 */ 1435 */
1947 BTFIXUPSET_CALL(flush_page_for_dma, viking_flush_page, BTFIXUPCALL_NORM); 1436 viking_ops.page_for_dma = viking_flush_page;
1948 1437#ifdef CONFIG_SMP
1438 viking_sun4d_smp_ops.page_for_dma = viking_flush_page;
1439#endif
1949 flush_page_for_dma_global = 0; 1440 flush_page_for_dma_global = 0;
1950 } else { 1441 } else {
1951 srmmu_name = "TI Viking/MXCC"; 1442 srmmu_name = "TI Viking/MXCC";
1952 viking_mxcc_present = 1; 1443 viking_mxcc_present = 1;
1953
1954 srmmu_cache_pagetables = 1; 1444 srmmu_cache_pagetables = 1;
1955
1956 /* MXCC vikings lack the DMA snooping bug. */
1957 BTFIXUPSET_CALL(flush_page_for_dma, viking_flush_page_for_dma, BTFIXUPCALL_NOP);
1958 } 1445 }
1959 1446
1960 BTFIXUPSET_CALL(flush_cache_all, viking_flush_cache_all, BTFIXUPCALL_NORM); 1447 sparc32_cachetlb_ops = (const struct sparc32_cachetlb_ops *)
1961 BTFIXUPSET_CALL(flush_cache_mm, viking_flush_cache_mm, BTFIXUPCALL_NORM); 1448 &viking_ops;
1962 BTFIXUPSET_CALL(flush_cache_page, viking_flush_cache_page, BTFIXUPCALL_NORM);
1963 BTFIXUPSET_CALL(flush_cache_range, viking_flush_cache_range, BTFIXUPCALL_NORM);
1964
1965#ifdef CONFIG_SMP 1449#ifdef CONFIG_SMP
1966 if (sparc_cpu_model == sun4d) { 1450 if (sparc_cpu_model == sun4d)
1967 BTFIXUPSET_CALL(flush_tlb_all, sun4dsmp_flush_tlb_all, BTFIXUPCALL_NORM); 1451 sparc32_cachetlb_ops = (const struct sparc32_cachetlb_ops *)
1968 BTFIXUPSET_CALL(flush_tlb_mm, sun4dsmp_flush_tlb_mm, BTFIXUPCALL_NORM); 1452 &viking_sun4d_smp_ops;
1969 BTFIXUPSET_CALL(flush_tlb_page, sun4dsmp_flush_tlb_page, BTFIXUPCALL_NORM);
1970 BTFIXUPSET_CALL(flush_tlb_range, sun4dsmp_flush_tlb_range, BTFIXUPCALL_NORM);
1971 } else
1972#endif 1453#endif
1973 {
1974 BTFIXUPSET_CALL(flush_tlb_all, viking_flush_tlb_all, BTFIXUPCALL_NORM);
1975 BTFIXUPSET_CALL(flush_tlb_mm, viking_flush_tlb_mm, BTFIXUPCALL_NORM);
1976 BTFIXUPSET_CALL(flush_tlb_page, viking_flush_tlb_page, BTFIXUPCALL_NORM);
1977 BTFIXUPSET_CALL(flush_tlb_range, viking_flush_tlb_range, BTFIXUPCALL_NORM);
1978 }
1979
1980 BTFIXUPSET_CALL(__flush_page_to_ram, viking_flush_page_to_ram, BTFIXUPCALL_NOP);
1981 BTFIXUPSET_CALL(flush_sig_insns, viking_flush_sig_insns, BTFIXUPCALL_NOP);
1982 1454
1983 poke_srmmu = poke_viking; 1455 poke_srmmu = poke_viking;
1984} 1456}
1985 1457
1986#ifdef CONFIG_SPARC_LEON
1987
1988void __init poke_leonsparc(void)
1989{
1990}
1991
1992void __init init_leon(void)
1993{
1994
1995 srmmu_name = "LEON";
1996
1997 BTFIXUPSET_CALL(flush_cache_all, leon_flush_cache_all,
1998 BTFIXUPCALL_NORM);
1999 BTFIXUPSET_CALL(flush_cache_mm, leon_flush_cache_all,
2000 BTFIXUPCALL_NORM);
2001 BTFIXUPSET_CALL(flush_cache_page, leon_flush_pcache_all,
2002 BTFIXUPCALL_NORM);
2003 BTFIXUPSET_CALL(flush_cache_range, leon_flush_cache_all,
2004 BTFIXUPCALL_NORM);
2005 BTFIXUPSET_CALL(flush_page_for_dma, leon_flush_dcache_all,
2006 BTFIXUPCALL_NORM);
2007
2008 BTFIXUPSET_CALL(flush_tlb_all, leon_flush_tlb_all, BTFIXUPCALL_NORM);
2009 BTFIXUPSET_CALL(flush_tlb_mm, leon_flush_tlb_all, BTFIXUPCALL_NORM);
2010 BTFIXUPSET_CALL(flush_tlb_page, leon_flush_tlb_all, BTFIXUPCALL_NORM);
2011 BTFIXUPSET_CALL(flush_tlb_range, leon_flush_tlb_all, BTFIXUPCALL_NORM);
2012
2013 BTFIXUPSET_CALL(__flush_page_to_ram, leon_flush_cache_all,
2014 BTFIXUPCALL_NOP);
2015 BTFIXUPSET_CALL(flush_sig_insns, leon_flush_cache_all, BTFIXUPCALL_NOP);
2016
2017 poke_srmmu = poke_leonsparc;
2018
2019 srmmu_cache_pagetables = 0;
2020
2021 leon_flush_during_switch = leon_flush_needed();
2022}
2023#endif
2024
2025/* Probe for the srmmu chip version. */ 1458/* Probe for the srmmu chip version. */
2026static void __init get_srmmu_type(void) 1459static void __init get_srmmu_type(void)
2027{ 1460{
@@ -2052,22 +1485,15 @@ static void __init get_srmmu_type(void)
2052 break; 1485 break;
2053 case 0: 1486 case 0:
2054 case 2: 1487 case 2:
2055 /* Uniprocessor Cypress */
2056 init_cypress_604();
2057 break;
2058 case 10: 1488 case 10:
2059 case 11: 1489 case 11:
2060 case 12: 1490 case 12:
2061 /* _REALLY OLD_ Cypress MP chips... */
2062 case 13: 1491 case 13:
2063 case 14: 1492 case 14:
2064 case 15: 1493 case 15:
2065 /* MP Cypress mmu/cache-controller */
2066 init_cypress_605(mod_rev);
2067 break;
2068 default: 1494 default:
2069 /* Some other Cypress revision, assume a 605. */ 1495 prom_printf("Sparc-Linux Cypress support does not longer exit.\n");
2070 init_cypress_605(mod_rev); 1496 prom_halt();
2071 break; 1497 break;
2072 } 1498 }
2073 return; 1499 return;
@@ -2123,203 +1549,193 @@ static void __init get_srmmu_type(void)
2123 srmmu_is_bad(); 1549 srmmu_is_bad();
2124} 1550}
2125 1551
2126/* don't laugh, static pagetables */ 1552#ifdef CONFIG_SMP
2127static void srmmu_check_pgt_cache(int low, int high) 1553/* Local cross-calls. */
1554static void smp_flush_page_for_dma(unsigned long page)
2128{ 1555{
1556 xc1((smpfunc_t) local_ops->page_for_dma, page);
1557 local_ops->page_for_dma(page);
2129} 1558}
2130 1559
2131extern unsigned long spwin_mmu_patchme, fwin_mmu_patchme, 1560static void smp_flush_cache_all(void)
2132 tsetup_mmu_patchme, rtrap_mmu_patchme;
2133
2134extern unsigned long spwin_srmmu_stackchk, srmmu_fwin_stackchk,
2135 tsetup_srmmu_stackchk, srmmu_rett_stackchk;
2136
2137extern unsigned long srmmu_fault;
2138
2139#define PATCH_BRANCH(insn, dest) do { \
2140 iaddr = &(insn); \
2141 daddr = &(dest); \
2142 *iaddr = SPARC_BRANCH((unsigned long) daddr, (unsigned long) iaddr); \
2143 } while(0)
2144
2145static void __init patch_window_trap_handlers(void)
2146{ 1561{
2147 unsigned long *iaddr, *daddr; 1562 xc0((smpfunc_t) local_ops->cache_all);
2148 1563 local_ops->cache_all();
2149 PATCH_BRANCH(spwin_mmu_patchme, spwin_srmmu_stackchk);
2150 PATCH_BRANCH(fwin_mmu_patchme, srmmu_fwin_stackchk);
2151 PATCH_BRANCH(tsetup_mmu_patchme, tsetup_srmmu_stackchk);
2152 PATCH_BRANCH(rtrap_mmu_patchme, srmmu_rett_stackchk);
2153 PATCH_BRANCH(sparc_ttable[SP_TRAP_TFLT].inst_three, srmmu_fault);
2154 PATCH_BRANCH(sparc_ttable[SP_TRAP_DFLT].inst_three, srmmu_fault);
2155 PATCH_BRANCH(sparc_ttable[SP_TRAP_DACC].inst_three, srmmu_fault);
2156} 1564}
2157 1565
2158#ifdef CONFIG_SMP 1566static void smp_flush_tlb_all(void)
2159/* Local cross-calls. */
2160static void smp_flush_page_for_dma(unsigned long page)
2161{ 1567{
2162 xc1((smpfunc_t) BTFIXUP_CALL(local_flush_page_for_dma), page); 1568 xc0((smpfunc_t) local_ops->tlb_all);
2163 local_flush_page_for_dma(page); 1569 local_ops->tlb_all();
2164} 1570}
2165 1571
2166#endif 1572static void smp_flush_cache_mm(struct mm_struct *mm)
2167
2168static pte_t srmmu_pgoff_to_pte(unsigned long pgoff)
2169{ 1573{
2170 return __pte((pgoff << SRMMU_PTE_FILE_SHIFT) | SRMMU_FILE); 1574 if (mm->context != NO_CONTEXT) {
1575 cpumask_t cpu_mask;
1576 cpumask_copy(&cpu_mask, mm_cpumask(mm));
1577 cpumask_clear_cpu(smp_processor_id(), &cpu_mask);
1578 if (!cpumask_empty(&cpu_mask))
1579 xc1((smpfunc_t) local_ops->cache_mm, (unsigned long) mm);
1580 local_ops->cache_mm(mm);
1581 }
2171} 1582}
2172 1583
2173static unsigned long srmmu_pte_to_pgoff(pte_t pte) 1584static void smp_flush_tlb_mm(struct mm_struct *mm)
2174{ 1585{
2175 return pte_val(pte) >> SRMMU_PTE_FILE_SHIFT; 1586 if (mm->context != NO_CONTEXT) {
1587 cpumask_t cpu_mask;
1588 cpumask_copy(&cpu_mask, mm_cpumask(mm));
1589 cpumask_clear_cpu(smp_processor_id(), &cpu_mask);
1590 if (!cpumask_empty(&cpu_mask)) {
1591 xc1((smpfunc_t) local_ops->tlb_mm, (unsigned long) mm);
1592 if (atomic_read(&mm->mm_users) == 1 && current->active_mm == mm)
1593 cpumask_copy(mm_cpumask(mm),
1594 cpumask_of(smp_processor_id()));
1595 }
1596 local_ops->tlb_mm(mm);
1597 }
2176} 1598}
2177 1599
2178static pgprot_t srmmu_pgprot_noncached(pgprot_t prot) 1600static void smp_flush_cache_range(struct vm_area_struct *vma,
1601 unsigned long start,
1602 unsigned long end)
2179{ 1603{
2180 prot &= ~__pgprot(SRMMU_CACHE); 1604 struct mm_struct *mm = vma->vm_mm;
2181 1605
2182 return prot; 1606 if (mm->context != NO_CONTEXT) {
1607 cpumask_t cpu_mask;
1608 cpumask_copy(&cpu_mask, mm_cpumask(mm));
1609 cpumask_clear_cpu(smp_processor_id(), &cpu_mask);
1610 if (!cpumask_empty(&cpu_mask))
1611 xc3((smpfunc_t) local_ops->cache_range,
1612 (unsigned long) vma, start, end);
1613 local_ops->cache_range(vma, start, end);
1614 }
2183} 1615}
2184 1616
2185/* Load up routines and constants for sun4m and sun4d mmu */ 1617static void smp_flush_tlb_range(struct vm_area_struct *vma,
2186void __init ld_mmu_srmmu(void) 1618 unsigned long start,
1619 unsigned long end)
2187{ 1620{
2188 extern void ld_mmu_iommu(void); 1621 struct mm_struct *mm = vma->vm_mm;
2189 extern void ld_mmu_iounit(void);
2190 extern void ___xchg32_sun4md(void);
2191
2192 BTFIXUPSET_SIMM13(pgdir_shift, SRMMU_PGDIR_SHIFT);
2193 BTFIXUPSET_SETHI(pgdir_size, SRMMU_PGDIR_SIZE);
2194 BTFIXUPSET_SETHI(pgdir_mask, SRMMU_PGDIR_MASK);
2195
2196 BTFIXUPSET_SIMM13(ptrs_per_pmd, SRMMU_PTRS_PER_PMD);
2197 BTFIXUPSET_SIMM13(ptrs_per_pgd, SRMMU_PTRS_PER_PGD);
2198
2199 BTFIXUPSET_INT(page_none, pgprot_val(SRMMU_PAGE_NONE));
2200 PAGE_SHARED = pgprot_val(SRMMU_PAGE_SHARED);
2201 BTFIXUPSET_INT(page_copy, pgprot_val(SRMMU_PAGE_COPY));
2202 BTFIXUPSET_INT(page_readonly, pgprot_val(SRMMU_PAGE_RDONLY));
2203 BTFIXUPSET_INT(page_kernel, pgprot_val(SRMMU_PAGE_KERNEL));
2204 page_kernel = pgprot_val(SRMMU_PAGE_KERNEL);
2205 1622
2206 /* Functions */ 1623 if (mm->context != NO_CONTEXT) {
2207 BTFIXUPSET_CALL(pgprot_noncached, srmmu_pgprot_noncached, BTFIXUPCALL_NORM); 1624 cpumask_t cpu_mask;
2208#ifndef CONFIG_SMP 1625 cpumask_copy(&cpu_mask, mm_cpumask(mm));
2209 BTFIXUPSET_CALL(___xchg32, ___xchg32_sun4md, BTFIXUPCALL_SWAPG1G2); 1626 cpumask_clear_cpu(smp_processor_id(), &cpu_mask);
2210#endif 1627 if (!cpumask_empty(&cpu_mask))
2211 BTFIXUPSET_CALL(do_check_pgt_cache, srmmu_check_pgt_cache, BTFIXUPCALL_NOP); 1628 xc3((smpfunc_t) local_ops->tlb_range,
1629 (unsigned long) vma, start, end);
1630 local_ops->tlb_range(vma, start, end);
1631 }
1632}
2212 1633
2213 BTFIXUPSET_CALL(set_pte, srmmu_set_pte, BTFIXUPCALL_SWAPO0O1); 1634static void smp_flush_cache_page(struct vm_area_struct *vma, unsigned long page)
2214 BTFIXUPSET_CALL(switch_mm, srmmu_switch_mm, BTFIXUPCALL_NORM); 1635{
1636 struct mm_struct *mm = vma->vm_mm;
2215 1637
2216 BTFIXUPSET_CALL(pte_pfn, srmmu_pte_pfn, BTFIXUPCALL_NORM); 1638 if (mm->context != NO_CONTEXT) {
2217 BTFIXUPSET_CALL(pmd_page, srmmu_pmd_page, BTFIXUPCALL_NORM); 1639 cpumask_t cpu_mask;
2218 BTFIXUPSET_CALL(pgd_page_vaddr, srmmu_pgd_page, BTFIXUPCALL_NORM); 1640 cpumask_copy(&cpu_mask, mm_cpumask(mm));
1641 cpumask_clear_cpu(smp_processor_id(), &cpu_mask);
1642 if (!cpumask_empty(&cpu_mask))
1643 xc2((smpfunc_t) local_ops->cache_page,
1644 (unsigned long) vma, page);
1645 local_ops->cache_page(vma, page);
1646 }
1647}
2219 1648
2220 BTFIXUPSET_CALL(pte_present, srmmu_pte_present, BTFIXUPCALL_NORM); 1649static void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
2221 BTFIXUPSET_CALL(pte_clear, srmmu_pte_clear, BTFIXUPCALL_SWAPO0G0); 1650{
1651 struct mm_struct *mm = vma->vm_mm;
2222 1652
2223 BTFIXUPSET_CALL(pmd_bad, srmmu_pmd_bad, BTFIXUPCALL_NORM); 1653 if (mm->context != NO_CONTEXT) {
2224 BTFIXUPSET_CALL(pmd_present, srmmu_pmd_present, BTFIXUPCALL_NORM); 1654 cpumask_t cpu_mask;
2225 BTFIXUPSET_CALL(pmd_clear, srmmu_pmd_clear, BTFIXUPCALL_SWAPO0G0); 1655 cpumask_copy(&cpu_mask, mm_cpumask(mm));
1656 cpumask_clear_cpu(smp_processor_id(), &cpu_mask);
1657 if (!cpumask_empty(&cpu_mask))
1658 xc2((smpfunc_t) local_ops->tlb_page,
1659 (unsigned long) vma, page);
1660 local_ops->tlb_page(vma, page);
1661 }
1662}
2226 1663
2227 BTFIXUPSET_CALL(pgd_none, srmmu_pgd_none, BTFIXUPCALL_NORM); 1664static void smp_flush_page_to_ram(unsigned long page)
2228 BTFIXUPSET_CALL(pgd_bad, srmmu_pgd_bad, BTFIXUPCALL_NORM); 1665{
2229 BTFIXUPSET_CALL(pgd_present, srmmu_pgd_present, BTFIXUPCALL_NORM); 1666 /* Current theory is that those who call this are the one's
2230 BTFIXUPSET_CALL(pgd_clear, srmmu_pgd_clear, BTFIXUPCALL_SWAPO0G0); 1667 * who have just dirtied their cache with the pages contents
1668 * in kernel space, therefore we only run this on local cpu.
1669 *
1670 * XXX This experiment failed, research further... -DaveM
1671 */
1672#if 1
1673 xc1((smpfunc_t) local_ops->page_to_ram, page);
1674#endif
1675 local_ops->page_to_ram(page);
1676}
1677
1678static void smp_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr)
1679{
1680 cpumask_t cpu_mask;
1681 cpumask_copy(&cpu_mask, mm_cpumask(mm));
1682 cpumask_clear_cpu(smp_processor_id(), &cpu_mask);
1683 if (!cpumask_empty(&cpu_mask))
1684 xc2((smpfunc_t) local_ops->sig_insns,
1685 (unsigned long) mm, insn_addr);
1686 local_ops->sig_insns(mm, insn_addr);
1687}
1688
1689static struct sparc32_cachetlb_ops smp_cachetlb_ops = {
1690 .cache_all = smp_flush_cache_all,
1691 .cache_mm = smp_flush_cache_mm,
1692 .cache_page = smp_flush_cache_page,
1693 .cache_range = smp_flush_cache_range,
1694 .tlb_all = smp_flush_tlb_all,
1695 .tlb_mm = smp_flush_tlb_mm,
1696 .tlb_page = smp_flush_tlb_page,
1697 .tlb_range = smp_flush_tlb_range,
1698 .page_to_ram = smp_flush_page_to_ram,
1699 .sig_insns = smp_flush_sig_insns,
1700 .page_for_dma = smp_flush_page_for_dma,
1701};
1702#endif
2231 1703
2232 BTFIXUPSET_CALL(mk_pte, srmmu_mk_pte, BTFIXUPCALL_NORM); 1704/* Load up routines and constants for sun4m and sun4d mmu */
2233 BTFIXUPSET_CALL(mk_pte_phys, srmmu_mk_pte_phys, BTFIXUPCALL_NORM); 1705void __init load_mmu(void)
2234 BTFIXUPSET_CALL(mk_pte_io, srmmu_mk_pte_io, BTFIXUPCALL_NORM); 1706{
2235 BTFIXUPSET_CALL(pgd_set, srmmu_pgd_set, BTFIXUPCALL_NORM); 1707 extern void ld_mmu_iommu(void);
2236 BTFIXUPSET_CALL(pmd_set, srmmu_pmd_set, BTFIXUPCALL_NORM); 1708 extern void ld_mmu_iounit(void);
2237 BTFIXUPSET_CALL(pmd_populate, srmmu_pmd_populate, BTFIXUPCALL_NORM);
2238
2239 BTFIXUPSET_INT(pte_modify_mask, SRMMU_CHG_MASK);
2240 BTFIXUPSET_CALL(pmd_offset, srmmu_pmd_offset, BTFIXUPCALL_NORM);
2241 BTFIXUPSET_CALL(pte_offset_kernel, srmmu_pte_offset, BTFIXUPCALL_NORM);
2242
2243 BTFIXUPSET_CALL(free_pte_fast, srmmu_free_pte_fast, BTFIXUPCALL_NORM);
2244 BTFIXUPSET_CALL(pte_free, srmmu_pte_free, BTFIXUPCALL_NORM);
2245 BTFIXUPSET_CALL(pte_alloc_one_kernel, srmmu_pte_alloc_one_kernel, BTFIXUPCALL_NORM);
2246 BTFIXUPSET_CALL(pte_alloc_one, srmmu_pte_alloc_one, BTFIXUPCALL_NORM);
2247 BTFIXUPSET_CALL(free_pmd_fast, srmmu_pmd_free, BTFIXUPCALL_NORM);
2248 BTFIXUPSET_CALL(pmd_alloc_one, srmmu_pmd_alloc_one, BTFIXUPCALL_NORM);
2249 BTFIXUPSET_CALL(free_pgd_fast, srmmu_free_pgd_fast, BTFIXUPCALL_NORM);
2250 BTFIXUPSET_CALL(get_pgd_fast, srmmu_get_pgd_fast, BTFIXUPCALL_NORM);
2251
2252 BTFIXUPSET_HALF(pte_writei, SRMMU_WRITE);
2253 BTFIXUPSET_HALF(pte_dirtyi, SRMMU_DIRTY);
2254 BTFIXUPSET_HALF(pte_youngi, SRMMU_REF);
2255 BTFIXUPSET_HALF(pte_filei, SRMMU_FILE);
2256 BTFIXUPSET_HALF(pte_wrprotecti, SRMMU_WRITE);
2257 BTFIXUPSET_HALF(pte_mkcleani, SRMMU_DIRTY);
2258 BTFIXUPSET_HALF(pte_mkoldi, SRMMU_REF);
2259 BTFIXUPSET_CALL(pte_mkwrite, srmmu_pte_mkwrite, BTFIXUPCALL_ORINT(SRMMU_WRITE));
2260 BTFIXUPSET_CALL(pte_mkdirty, srmmu_pte_mkdirty, BTFIXUPCALL_ORINT(SRMMU_DIRTY));
2261 BTFIXUPSET_CALL(pte_mkyoung, srmmu_pte_mkyoung, BTFIXUPCALL_ORINT(SRMMU_REF));
2262 BTFIXUPSET_CALL(update_mmu_cache, srmmu_update_mmu_cache, BTFIXUPCALL_NOP);
2263 BTFIXUPSET_CALL(destroy_context, srmmu_destroy_context, BTFIXUPCALL_NORM);
2264
2265 BTFIXUPSET_CALL(sparc_mapiorange, srmmu_mapiorange, BTFIXUPCALL_NORM);
2266 BTFIXUPSET_CALL(sparc_unmapiorange, srmmu_unmapiorange, BTFIXUPCALL_NORM);
2267
2268 BTFIXUPSET_CALL(__swp_type, srmmu_swp_type, BTFIXUPCALL_NORM);
2269 BTFIXUPSET_CALL(__swp_offset, srmmu_swp_offset, BTFIXUPCALL_NORM);
2270 BTFIXUPSET_CALL(__swp_entry, srmmu_swp_entry, BTFIXUPCALL_NORM);
2271
2272 BTFIXUPSET_CALL(mmu_info, srmmu_mmu_info, BTFIXUPCALL_NORM);
2273
2274 BTFIXUPSET_CALL(alloc_thread_info_node, srmmu_alloc_thread_info_node, BTFIXUPCALL_NORM);
2275 BTFIXUPSET_CALL(free_thread_info, srmmu_free_thread_info, BTFIXUPCALL_NORM);
2276
2277 BTFIXUPSET_CALL(pte_to_pgoff, srmmu_pte_to_pgoff, BTFIXUPCALL_NORM);
2278 BTFIXUPSET_CALL(pgoff_to_pte, srmmu_pgoff_to_pte, BTFIXUPCALL_NORM);
2279 1709
1710 /* Functions */
2280 get_srmmu_type(); 1711 get_srmmu_type();
2281 patch_window_trap_handlers();
2282 1712
2283#ifdef CONFIG_SMP 1713#ifdef CONFIG_SMP
2284 /* El switcheroo... */ 1714 /* El switcheroo... */
1715 local_ops = sparc32_cachetlb_ops;
2285 1716
2286 BTFIXUPCOPY_CALL(local_flush_cache_all, flush_cache_all); 1717 if (sparc_cpu_model == sun4d || sparc_cpu_model == sparc_leon) {
2287 BTFIXUPCOPY_CALL(local_flush_cache_mm, flush_cache_mm); 1718 smp_cachetlb_ops.tlb_all = local_ops->tlb_all;
2288 BTFIXUPCOPY_CALL(local_flush_cache_range, flush_cache_range); 1719 smp_cachetlb_ops.tlb_mm = local_ops->tlb_mm;
2289 BTFIXUPCOPY_CALL(local_flush_cache_page, flush_cache_page); 1720 smp_cachetlb_ops.tlb_range = local_ops->tlb_range;
2290 BTFIXUPCOPY_CALL(local_flush_tlb_all, flush_tlb_all); 1721 smp_cachetlb_ops.tlb_page = local_ops->tlb_page;
2291 BTFIXUPCOPY_CALL(local_flush_tlb_mm, flush_tlb_mm);
2292 BTFIXUPCOPY_CALL(local_flush_tlb_range, flush_tlb_range);
2293 BTFIXUPCOPY_CALL(local_flush_tlb_page, flush_tlb_page);
2294 BTFIXUPCOPY_CALL(local_flush_page_to_ram, __flush_page_to_ram);
2295 BTFIXUPCOPY_CALL(local_flush_sig_insns, flush_sig_insns);
2296 BTFIXUPCOPY_CALL(local_flush_page_for_dma, flush_page_for_dma);
2297
2298 BTFIXUPSET_CALL(flush_cache_all, smp_flush_cache_all, BTFIXUPCALL_NORM);
2299 BTFIXUPSET_CALL(flush_cache_mm, smp_flush_cache_mm, BTFIXUPCALL_NORM);
2300 BTFIXUPSET_CALL(flush_cache_range, smp_flush_cache_range, BTFIXUPCALL_NORM);
2301 BTFIXUPSET_CALL(flush_cache_page, smp_flush_cache_page, BTFIXUPCALL_NORM);
2302 if (sparc_cpu_model != sun4d &&
2303 sparc_cpu_model != sparc_leon) {
2304 BTFIXUPSET_CALL(flush_tlb_all, smp_flush_tlb_all, BTFIXUPCALL_NORM);
2305 BTFIXUPSET_CALL(flush_tlb_mm, smp_flush_tlb_mm, BTFIXUPCALL_NORM);
2306 BTFIXUPSET_CALL(flush_tlb_range, smp_flush_tlb_range, BTFIXUPCALL_NORM);
2307 BTFIXUPSET_CALL(flush_tlb_page, smp_flush_tlb_page, BTFIXUPCALL_NORM);
2308 } 1722 }
2309 BTFIXUPSET_CALL(__flush_page_to_ram, smp_flush_page_to_ram, BTFIXUPCALL_NORM);
2310 BTFIXUPSET_CALL(flush_sig_insns, smp_flush_sig_insns, BTFIXUPCALL_NORM);
2311 BTFIXUPSET_CALL(flush_page_for_dma, smp_flush_page_for_dma, BTFIXUPCALL_NORM);
2312 1723
2313 if (poke_srmmu == poke_viking) { 1724 if (poke_srmmu == poke_viking) {
2314 /* Avoid unnecessary cross calls. */ 1725 /* Avoid unnecessary cross calls. */
2315 BTFIXUPCOPY_CALL(flush_cache_all, local_flush_cache_all); 1726 smp_cachetlb_ops.cache_all = local_ops->cache_all;
2316 BTFIXUPCOPY_CALL(flush_cache_mm, local_flush_cache_mm); 1727 smp_cachetlb_ops.cache_mm = local_ops->cache_mm;
2317 BTFIXUPCOPY_CALL(flush_cache_range, local_flush_cache_range); 1728 smp_cachetlb_ops.cache_range = local_ops->cache_range;
2318 BTFIXUPCOPY_CALL(flush_cache_page, local_flush_cache_page); 1729 smp_cachetlb_ops.cache_page = local_ops->cache_page;
2319 BTFIXUPCOPY_CALL(__flush_page_to_ram, local_flush_page_to_ram); 1730
2320 BTFIXUPCOPY_CALL(flush_sig_insns, local_flush_sig_insns); 1731 smp_cachetlb_ops.page_to_ram = local_ops->page_to_ram;
2321 BTFIXUPCOPY_CALL(flush_page_for_dma, local_flush_page_for_dma); 1732 smp_cachetlb_ops.sig_insns = local_ops->sig_insns;
1733 smp_cachetlb_ops.page_for_dma = local_ops->page_for_dma;
2322 } 1734 }
1735
1736 /* It really is const after this point. */
1737 sparc32_cachetlb_ops = (const struct sparc32_cachetlb_ops *)
1738 &smp_cachetlb_ops;
2323#endif 1739#endif
2324 1740
2325 if (sparc_cpu_model == sun4d) 1741 if (sparc_cpu_model == sun4d)
diff --git a/arch/sparc/mm/srmmu.h b/arch/sparc/mm/srmmu.h
new file mode 100644
index 000000000000..5703274ccf89
--- /dev/null
+++ b/arch/sparc/mm/srmmu.h
@@ -0,0 +1,4 @@
1/* srmmu.c */
2extern char *srmmu_name;
3
4extern void (*poke_srmmu)(void);
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
deleted file mode 100644
index 1cf4f198709a..000000000000
--- a/arch/sparc/mm/sun4c.c
+++ /dev/null
@@ -1,2166 +0,0 @@
1/* sun4c.c: Doing in software what should be done in hardware.
2 *
3 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
4 * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
5 * Copyright (C) 1996 Andrew Tridgell (Andrew.Tridgell@anu.edu.au)
6 * Copyright (C) 1997-2000 Anton Blanchard (anton@samba.org)
7 * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
8 */
9
10#define NR_TASK_BUCKETS 512
11
12#include <linux/kernel.h>
13#include <linux/mm.h>
14#include <linux/init.h>
15#include <linux/slab.h>
16#include <linux/bootmem.h>
17#include <linux/highmem.h>
18#include <linux/fs.h>
19#include <linux/seq_file.h>
20#include <linux/scatterlist.h>
21#include <linux/bitmap.h>
22
23#include <asm/sections.h>
24#include <asm/page.h>
25#include <asm/pgalloc.h>
26#include <asm/pgtable.h>
27#include <asm/vaddrs.h>
28#include <asm/idprom.h>
29#include <asm/machines.h>
30#include <asm/memreg.h>
31#include <asm/processor.h>
32#include <asm/auxio.h>
33#include <asm/io.h>
34#include <asm/oplib.h>
35#include <asm/openprom.h>
36#include <asm/mmu_context.h>
37#include <asm/highmem.h>
38#include <asm/btfixup.h>
39#include <asm/cacheflush.h>
40#include <asm/tlbflush.h>
41
42/* Because of our dynamic kernel TLB miss strategy, and how
43 * our DVMA mapping allocation works, you _MUST_:
44 *
45 * 1) Disable interrupts _and_ not touch any dynamic kernel
46 * memory while messing with kernel MMU state. By
47 * dynamic memory I mean any object which is not in
48 * the kernel image itself or a thread_union (both of
49 * which are locked into the MMU).
50 * 2) Disable interrupts while messing with user MMU state.
51 */
52
53extern int num_segmaps, num_contexts;
54
55extern unsigned long page_kernel;
56
57/* That's it, we prom_halt() on sun4c if the cache size is something other than 65536.
58 * So let's save some cycles and just use that everywhere except for that bootup
59 * sanity check.
60 */
61#define SUN4C_VAC_SIZE 65536
62
63#define SUN4C_KERNEL_BUCKETS 32
64
65/* Flushing the cache. */
66struct sun4c_vac_props sun4c_vacinfo;
67unsigned long sun4c_kernel_faults;
68
69/* Invalidate every sun4c cache line tag. */
70static void __init sun4c_flush_all(void)
71{
72 unsigned long begin, end;
73
74 if (sun4c_vacinfo.on)
75 panic("SUN4C: AIEEE, trying to invalidate vac while it is on.");
76
77 /* Clear 'valid' bit in all cache line tags */
78 begin = AC_CACHETAGS;
79 end = (AC_CACHETAGS + SUN4C_VAC_SIZE);
80 while (begin < end) {
81 __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
82 "r" (begin), "i" (ASI_CONTROL));
83 begin += sun4c_vacinfo.linesize;
84 }
85}
86
87static void sun4c_flush_context_hw(void)
88{
89 unsigned long end = SUN4C_VAC_SIZE;
90
91 __asm__ __volatile__(
92 "1: addcc %0, -4096, %0\n\t"
93 " bne 1b\n\t"
94 " sta %%g0, [%0] %2"
95 : "=&r" (end)
96 : "0" (end), "i" (ASI_HWFLUSHCONTEXT)
97 : "cc");
98}
99
100/* Must be called minimally with IRQs disabled. */
101static void sun4c_flush_segment_hw(unsigned long addr)
102{
103 if (sun4c_get_segmap(addr) != invalid_segment) {
104 unsigned long vac_size = SUN4C_VAC_SIZE;
105
106 __asm__ __volatile__(
107 "1: addcc %0, -4096, %0\n\t"
108 " bne 1b\n\t"
109 " sta %%g0, [%2 + %0] %3"
110 : "=&r" (vac_size)
111 : "0" (vac_size), "r" (addr), "i" (ASI_HWFLUSHSEG)
112 : "cc");
113 }
114}
115
116/* File local boot time fixups. */
117BTFIXUPDEF_CALL(void, sun4c_flush_page, unsigned long)
118BTFIXUPDEF_CALL(void, sun4c_flush_segment, unsigned long)
119BTFIXUPDEF_CALL(void, sun4c_flush_context, void)
120
121#define sun4c_flush_page(addr) BTFIXUP_CALL(sun4c_flush_page)(addr)
122#define sun4c_flush_segment(addr) BTFIXUP_CALL(sun4c_flush_segment)(addr)
123#define sun4c_flush_context() BTFIXUP_CALL(sun4c_flush_context)()
124
125/* Must be called minimally with interrupts disabled. */
126static void sun4c_flush_page_hw(unsigned long addr)
127{
128 addr &= PAGE_MASK;
129 if ((int)sun4c_get_pte(addr) < 0)
130 __asm__ __volatile__("sta %%g0, [%0] %1"
131 : : "r" (addr), "i" (ASI_HWFLUSHPAGE));
132}
133
134/* Don't inline the software version as it eats too many cache lines if expanded. */
135static void sun4c_flush_context_sw(void)
136{
137 unsigned long nbytes = SUN4C_VAC_SIZE;
138 unsigned long lsize = sun4c_vacinfo.linesize;
139
140 __asm__ __volatile__(
141 "add %2, %2, %%g1\n\t"
142 "add %2, %%g1, %%g2\n\t"
143 "add %2, %%g2, %%g3\n\t"
144 "add %2, %%g3, %%g4\n\t"
145 "add %2, %%g4, %%g5\n\t"
146 "add %2, %%g5, %%o4\n\t"
147 "add %2, %%o4, %%o5\n"
148 "1:\n\t"
149 "subcc %0, %%o5, %0\n\t"
150 "sta %%g0, [%0] %3\n\t"
151 "sta %%g0, [%0 + %2] %3\n\t"
152 "sta %%g0, [%0 + %%g1] %3\n\t"
153 "sta %%g0, [%0 + %%g2] %3\n\t"
154 "sta %%g0, [%0 + %%g3] %3\n\t"
155 "sta %%g0, [%0 + %%g4] %3\n\t"
156 "sta %%g0, [%0 + %%g5] %3\n\t"
157 "bg 1b\n\t"
158 " sta %%g0, [%1 + %%o4] %3\n"
159 : "=&r" (nbytes)
160 : "0" (nbytes), "r" (lsize), "i" (ASI_FLUSHCTX)
161 : "g1", "g2", "g3", "g4", "g5", "o4", "o5", "cc");
162}
163
164/* Don't inline the software version as it eats too many cache lines if expanded. */
165static void sun4c_flush_segment_sw(unsigned long addr)
166{
167 if (sun4c_get_segmap(addr) != invalid_segment) {
168 unsigned long nbytes = SUN4C_VAC_SIZE;
169 unsigned long lsize = sun4c_vacinfo.linesize;
170
171 __asm__ __volatile__(
172 "add %2, %2, %%g1\n\t"
173 "add %2, %%g1, %%g2\n\t"
174 "add %2, %%g2, %%g3\n\t"
175 "add %2, %%g3, %%g4\n\t"
176 "add %2, %%g4, %%g5\n\t"
177 "add %2, %%g5, %%o4\n\t"
178 "add %2, %%o4, %%o5\n"
179 "1:\n\t"
180 "subcc %1, %%o5, %1\n\t"
181 "sta %%g0, [%0] %6\n\t"
182 "sta %%g0, [%0 + %2] %6\n\t"
183 "sta %%g0, [%0 + %%g1] %6\n\t"
184 "sta %%g0, [%0 + %%g2] %6\n\t"
185 "sta %%g0, [%0 + %%g3] %6\n\t"
186 "sta %%g0, [%0 + %%g4] %6\n\t"
187 "sta %%g0, [%0 + %%g5] %6\n\t"
188 "sta %%g0, [%0 + %%o4] %6\n\t"
189 "bg 1b\n\t"
190 " add %0, %%o5, %0\n"
191 : "=&r" (addr), "=&r" (nbytes), "=&r" (lsize)
192 : "0" (addr), "1" (nbytes), "2" (lsize),
193 "i" (ASI_FLUSHSEG)
194 : "g1", "g2", "g3", "g4", "g5", "o4", "o5", "cc");
195 }
196}
197
198/* Don't inline the software version as it eats too many cache lines if expanded. */
199static void sun4c_flush_page_sw(unsigned long addr)
200{
201 addr &= PAGE_MASK;
202 if ((sun4c_get_pte(addr) & (_SUN4C_PAGE_NOCACHE | _SUN4C_PAGE_VALID)) ==
203 _SUN4C_PAGE_VALID) {
204 unsigned long left = PAGE_SIZE;
205 unsigned long lsize = sun4c_vacinfo.linesize;
206
207 __asm__ __volatile__(
208 "add %2, %2, %%g1\n\t"
209 "add %2, %%g1, %%g2\n\t"
210 "add %2, %%g2, %%g3\n\t"
211 "add %2, %%g3, %%g4\n\t"
212 "add %2, %%g4, %%g5\n\t"
213 "add %2, %%g5, %%o4\n\t"
214 "add %2, %%o4, %%o5\n"
215 "1:\n\t"
216 "subcc %1, %%o5, %1\n\t"
217 "sta %%g0, [%0] %6\n\t"
218 "sta %%g0, [%0 + %2] %6\n\t"
219 "sta %%g0, [%0 + %%g1] %6\n\t"
220 "sta %%g0, [%0 + %%g2] %6\n\t"
221 "sta %%g0, [%0 + %%g3] %6\n\t"
222 "sta %%g0, [%0 + %%g4] %6\n\t"
223 "sta %%g0, [%0 + %%g5] %6\n\t"
224 "sta %%g0, [%0 + %%o4] %6\n\t"
225 "bg 1b\n\t"
226 " add %0, %%o5, %0\n"
227 : "=&r" (addr), "=&r" (left), "=&r" (lsize)
228 : "0" (addr), "1" (left), "2" (lsize),
229 "i" (ASI_FLUSHPG)
230 : "g1", "g2", "g3", "g4", "g5", "o4", "o5", "cc");
231 }
232}
233
234/* The sun4c's do have an on chip store buffer. And the way you
235 * clear them out isn't so obvious. The only way I can think of
236 * to accomplish this is to read the current context register,
237 * store the same value there, then read an external hardware
238 * register.
239 */
240void sun4c_complete_all_stores(void)
241{
242 volatile int _unused;
243
244 _unused = sun4c_get_context();
245 sun4c_set_context(_unused);
246 _unused = get_auxio();
247}
248
249/* Bootup utility functions. */
250static inline void sun4c_init_clean_segmap(unsigned char pseg)
251{
252 unsigned long vaddr;
253
254 sun4c_put_segmap(0, pseg);
255 for (vaddr = 0; vaddr < SUN4C_REAL_PGDIR_SIZE; vaddr += PAGE_SIZE)
256 sun4c_put_pte(vaddr, 0);
257 sun4c_put_segmap(0, invalid_segment);
258}
259
260static inline void sun4c_init_clean_mmu(unsigned long kernel_end)
261{
262 unsigned long vaddr;
263 unsigned char savectx, ctx;
264
265 savectx = sun4c_get_context();
266 for (ctx = 0; ctx < num_contexts; ctx++) {
267 sun4c_set_context(ctx);
268 for (vaddr = 0; vaddr < 0x20000000; vaddr += SUN4C_REAL_PGDIR_SIZE)
269 sun4c_put_segmap(vaddr, invalid_segment);
270 for (vaddr = 0xe0000000; vaddr < KERNBASE; vaddr += SUN4C_REAL_PGDIR_SIZE)
271 sun4c_put_segmap(vaddr, invalid_segment);
272 for (vaddr = kernel_end; vaddr < KADB_DEBUGGER_BEGVM; vaddr += SUN4C_REAL_PGDIR_SIZE)
273 sun4c_put_segmap(vaddr, invalid_segment);
274 for (vaddr = LINUX_OPPROM_ENDVM; vaddr; vaddr += SUN4C_REAL_PGDIR_SIZE)
275 sun4c_put_segmap(vaddr, invalid_segment);
276 }
277 sun4c_set_context(savectx);
278}
279
280void __init sun4c_probe_vac(void)
281{
282 sun4c_disable_vac();
283
284 if ((idprom->id_machtype == (SM_SUN4C | SM_4C_SS1)) ||
285 (idprom->id_machtype == (SM_SUN4C | SM_4C_SS1PLUS))) {
286 /* PROM on SS1 lacks this info, to be super safe we
287 * hard code it here since this arch is cast in stone.
288 */
289 sun4c_vacinfo.num_bytes = 65536;
290 sun4c_vacinfo.linesize = 16;
291 } else {
292 sun4c_vacinfo.num_bytes =
293 prom_getintdefault(prom_root_node, "vac-size", 65536);
294 sun4c_vacinfo.linesize =
295 prom_getintdefault(prom_root_node, "vac-linesize", 16);
296 }
297 sun4c_vacinfo.do_hwflushes =
298 prom_getintdefault(prom_root_node, "vac-hwflush", 0);
299
300 if (sun4c_vacinfo.do_hwflushes == 0)
301 sun4c_vacinfo.do_hwflushes =
302 prom_getintdefault(prom_root_node, "vac_hwflush", 0);
303
304 if (sun4c_vacinfo.num_bytes != 65536) {
305 prom_printf("WEIRD Sun4C VAC cache size, "
306 "tell sparclinux@vger.kernel.org");
307 prom_halt();
308 }
309
310 switch (sun4c_vacinfo.linesize) {
311 case 16:
312 sun4c_vacinfo.log2lsize = 4;
313 break;
314 case 32:
315 sun4c_vacinfo.log2lsize = 5;
316 break;
317 default:
318 prom_printf("probe_vac: Didn't expect vac-linesize of %d, halting\n",
319 sun4c_vacinfo.linesize);
320 prom_halt();
321 }
322
323 sun4c_flush_all();
324 sun4c_enable_vac();
325}
326
327/* Patch instructions for the low level kernel fault handler. */
328extern unsigned long invalid_segment_patch1, invalid_segment_patch1_ff;
329extern unsigned long invalid_segment_patch2, invalid_segment_patch2_ff;
330extern unsigned long invalid_segment_patch1_1ff, invalid_segment_patch2_1ff;
331extern unsigned long num_context_patch1, num_context_patch1_16;
332extern unsigned long num_context_patch2_16;
333extern unsigned long vac_linesize_patch, vac_linesize_patch_32;
334extern unsigned long vac_hwflush_patch1, vac_hwflush_patch1_on;
335extern unsigned long vac_hwflush_patch2, vac_hwflush_patch2_on;
336
337#define PATCH_INSN(src, dst) do { \
338 daddr = &(dst); \
339 iaddr = &(src); \
340 *daddr = *iaddr; \
341 } while (0)
342
343static void __init patch_kernel_fault_handler(void)
344{
345 unsigned long *iaddr, *daddr;
346
347 switch (num_segmaps) {
348 case 128:
349 /* Default, nothing to do. */
350 break;
351 case 256:
352 PATCH_INSN(invalid_segment_patch1_ff,
353 invalid_segment_patch1);
354 PATCH_INSN(invalid_segment_patch2_ff,
355 invalid_segment_patch2);
356 break;
357 case 512:
358 PATCH_INSN(invalid_segment_patch1_1ff,
359 invalid_segment_patch1);
360 PATCH_INSN(invalid_segment_patch2_1ff,
361 invalid_segment_patch2);
362 break;
363 default:
364 prom_printf("Unhandled number of segmaps: %d\n",
365 num_segmaps);
366 prom_halt();
367 }
368 switch (num_contexts) {
369 case 8:
370 /* Default, nothing to do. */
371 break;
372 case 16:
373 PATCH_INSN(num_context_patch1_16,
374 num_context_patch1);
375 break;
376 default:
377 prom_printf("Unhandled number of contexts: %d\n",
378 num_contexts);
379 prom_halt();
380 }
381
382 if (sun4c_vacinfo.do_hwflushes != 0) {
383 PATCH_INSN(vac_hwflush_patch1_on, vac_hwflush_patch1);
384 PATCH_INSN(vac_hwflush_patch2_on, vac_hwflush_patch2);
385 } else {
386 switch (sun4c_vacinfo.linesize) {
387 case 16:
388 /* Default, nothing to do. */
389 break;
390 case 32:
391 PATCH_INSN(vac_linesize_patch_32, vac_linesize_patch);
392 break;
393 default:
394 prom_printf("Impossible VAC linesize %d, halting...\n",
395 sun4c_vacinfo.linesize);
396 prom_halt();
397 }
398 }
399}
400
401static void __init sun4c_probe_mmu(void)
402{
403 if ((idprom->id_machtype == (SM_SUN4C | SM_4C_SS1)) ||
404 (idprom->id_machtype == (SM_SUN4C | SM_4C_SS1PLUS))) {
405 /* Hardcode these just to be safe, PROM on SS1 does
406 * not have this info available in the root node.
407 */
408 num_segmaps = 128;
409 num_contexts = 8;
410 } else {
411 num_segmaps =
412 prom_getintdefault(prom_root_node, "mmu-npmg", 128);
413 num_contexts =
414 prom_getintdefault(prom_root_node, "mmu-nctx", 0x8);
415 }
416 patch_kernel_fault_handler();
417}
418
419volatile unsigned long __iomem *sun4c_memerr_reg = NULL;
420
421void __init sun4c_probe_memerr_reg(void)
422{
423 phandle node;
424 struct linux_prom_registers regs[1];
425
426 node = prom_getchild(prom_root_node);
427 node = prom_searchsiblings(prom_root_node, "memory-error");
428 if (!node)
429 return;
430 if (prom_getproperty(node, "reg", (char *)regs, sizeof(regs)) <= 0)
431 return;
432 /* hmm I think regs[0].which_io is zero here anyways */
433 sun4c_memerr_reg = ioremap(regs[0].phys_addr, regs[0].reg_size);
434}
435
436static inline void sun4c_init_ss2_cache_bug(void)
437{
438 if ((idprom->id_machtype == (SM_SUN4C | SM_4C_SS2)) ||
439 (idprom->id_machtype == (SM_SUN4C | SM_4C_IPX)) ||
440 (idprom->id_machtype == (SM_SUN4C | SM_4C_ELC))) {
441 /* Whee.. */
442 printk("SS2 cache bug detected, uncaching trap table page\n");
443 sun4c_flush_page((unsigned int) &_start);
444 sun4c_put_pte(((unsigned long) &_start),
445 (sun4c_get_pte((unsigned long) &_start) | _SUN4C_PAGE_NOCACHE));
446 }
447}
448
449/* Addr is always aligned on a page boundary for us already. */
450static int sun4c_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned long va,
451 unsigned long addr, int len)
452{
453 unsigned long page, end;
454
455 *pba = addr;
456
457 end = PAGE_ALIGN((addr + len));
458 while (addr < end) {
459 page = va;
460 sun4c_flush_page(page);
461 page -= PAGE_OFFSET;
462 page >>= PAGE_SHIFT;
463 page |= (_SUN4C_PAGE_VALID | _SUN4C_PAGE_DIRTY |
464 _SUN4C_PAGE_NOCACHE | _SUN4C_PAGE_PRIV);
465 sun4c_put_pte(addr, page);
466 addr += PAGE_SIZE;
467 va += PAGE_SIZE;
468 }
469
470 return 0;
471}
472
473static void sun4c_unmap_dma_area(struct device *dev, unsigned long busa, int len)
474{
475 /* Fortunately for us, bus_addr == uncached_virt in sun4c. */
476 /* XXX Implement this */
477}
478
479/* TLB management. */
480
481/* Don't change this struct without changing entry.S. This is used
482 * in the in-window kernel fault handler, and you don't want to mess
483 * with that. (See sun4c_fault in entry.S).
484 */
485struct sun4c_mmu_entry {
486 struct sun4c_mmu_entry *next;
487 struct sun4c_mmu_entry *prev;
488 unsigned long vaddr;
489 unsigned char pseg;
490 unsigned char locked;
491
492 /* For user mappings only, and completely hidden from kernel
493 * TLB miss code.
494 */
495 unsigned char ctx;
496 struct sun4c_mmu_entry *lru_next;
497 struct sun4c_mmu_entry *lru_prev;
498};
499
500static struct sun4c_mmu_entry mmu_entry_pool[SUN4C_MAX_SEGMAPS];
501
502static void __init sun4c_init_mmu_entry_pool(void)
503{
504 int i;
505
506 for (i=0; i < SUN4C_MAX_SEGMAPS; i++) {
507 mmu_entry_pool[i].pseg = i;
508 mmu_entry_pool[i].next = NULL;
509 mmu_entry_pool[i].prev = NULL;
510 mmu_entry_pool[i].vaddr = 0;
511 mmu_entry_pool[i].locked = 0;
512 mmu_entry_pool[i].ctx = 0;
513 mmu_entry_pool[i].lru_next = NULL;
514 mmu_entry_pool[i].lru_prev = NULL;
515 }
516 mmu_entry_pool[invalid_segment].locked = 1;
517}
518
519static inline void fix_permissions(unsigned long vaddr, unsigned long bits_on,
520 unsigned long bits_off)
521{
522 unsigned long start, end;
523
524 end = vaddr + SUN4C_REAL_PGDIR_SIZE;
525 for (start = vaddr; start < end; start += PAGE_SIZE)
526 if (sun4c_get_pte(start) & _SUN4C_PAGE_VALID)
527 sun4c_put_pte(start, (sun4c_get_pte(start) | bits_on) &
528 ~bits_off);
529}
530
531static inline void sun4c_init_map_kernelprom(unsigned long kernel_end)
532{
533 unsigned long vaddr;
534 unsigned char pseg, ctx;
535
536 for (vaddr = KADB_DEBUGGER_BEGVM;
537 vaddr < LINUX_OPPROM_ENDVM;
538 vaddr += SUN4C_REAL_PGDIR_SIZE) {
539 pseg = sun4c_get_segmap(vaddr);
540 if (pseg != invalid_segment) {
541 mmu_entry_pool[pseg].locked = 1;
542 for (ctx = 0; ctx < num_contexts; ctx++)
543 prom_putsegment(ctx, vaddr, pseg);
544 fix_permissions(vaddr, _SUN4C_PAGE_PRIV, 0);
545 }
546 }
547
548 for (vaddr = KERNBASE; vaddr < kernel_end; vaddr += SUN4C_REAL_PGDIR_SIZE) {
549 pseg = sun4c_get_segmap(vaddr);
550 mmu_entry_pool[pseg].locked = 1;
551 for (ctx = 0; ctx < num_contexts; ctx++)
552 prom_putsegment(ctx, vaddr, pseg);
553 fix_permissions(vaddr, _SUN4C_PAGE_PRIV, _SUN4C_PAGE_NOCACHE);
554 }
555}
556
557static void __init sun4c_init_lock_area(unsigned long start, unsigned long end)
558{
559 int i, ctx;
560
561 while (start < end) {
562 for (i = 0; i < invalid_segment; i++)
563 if (!mmu_entry_pool[i].locked)
564 break;
565 mmu_entry_pool[i].locked = 1;
566 sun4c_init_clean_segmap(i);
567 for (ctx = 0; ctx < num_contexts; ctx++)
568 prom_putsegment(ctx, start, mmu_entry_pool[i].pseg);
569 start += SUN4C_REAL_PGDIR_SIZE;
570 }
571}
572
573/* Don't change this struct without changing entry.S. This is used
574 * in the in-window kernel fault handler, and you don't want to mess
575 * with that. (See sun4c_fault in entry.S).
576 */
577struct sun4c_mmu_ring {
578 struct sun4c_mmu_entry ringhd;
579 int num_entries;
580};
581
582static struct sun4c_mmu_ring sun4c_context_ring[SUN4C_MAX_CONTEXTS]; /* used user entries */
583static struct sun4c_mmu_ring sun4c_ufree_ring; /* free user entries */
584static struct sun4c_mmu_ring sun4c_ulru_ring; /* LRU user entries */
585struct sun4c_mmu_ring sun4c_kernel_ring; /* used kernel entries */
586struct sun4c_mmu_ring sun4c_kfree_ring; /* free kernel entries */
587
588static inline void sun4c_init_rings(void)
589{
590 int i;
591
592 for (i = 0; i < SUN4C_MAX_CONTEXTS; i++) {
593 sun4c_context_ring[i].ringhd.next =
594 sun4c_context_ring[i].ringhd.prev =
595 &sun4c_context_ring[i].ringhd;
596 sun4c_context_ring[i].num_entries = 0;
597 }
598 sun4c_ufree_ring.ringhd.next = sun4c_ufree_ring.ringhd.prev =
599 &sun4c_ufree_ring.ringhd;
600 sun4c_ufree_ring.num_entries = 0;
601 sun4c_ulru_ring.ringhd.lru_next = sun4c_ulru_ring.ringhd.lru_prev =
602 &sun4c_ulru_ring.ringhd;
603 sun4c_ulru_ring.num_entries = 0;
604 sun4c_kernel_ring.ringhd.next = sun4c_kernel_ring.ringhd.prev =
605 &sun4c_kernel_ring.ringhd;
606 sun4c_kernel_ring.num_entries = 0;
607 sun4c_kfree_ring.ringhd.next = sun4c_kfree_ring.ringhd.prev =
608 &sun4c_kfree_ring.ringhd;
609 sun4c_kfree_ring.num_entries = 0;
610}
611
612static void add_ring(struct sun4c_mmu_ring *ring,
613 struct sun4c_mmu_entry *entry)
614{
615 struct sun4c_mmu_entry *head = &ring->ringhd;
616
617 entry->prev = head;
618 (entry->next = head->next)->prev = entry;
619 head->next = entry;
620 ring->num_entries++;
621}
622
623static inline void add_lru(struct sun4c_mmu_entry *entry)
624{
625 struct sun4c_mmu_ring *ring = &sun4c_ulru_ring;
626 struct sun4c_mmu_entry *head = &ring->ringhd;
627
628 entry->lru_next = head;
629 (entry->lru_prev = head->lru_prev)->lru_next = entry;
630 head->lru_prev = entry;
631}
632
633static void add_ring_ordered(struct sun4c_mmu_ring *ring,
634 struct sun4c_mmu_entry *entry)
635{
636 struct sun4c_mmu_entry *head = &ring->ringhd;
637 unsigned long addr = entry->vaddr;
638
639 while ((head->next != &ring->ringhd) && (head->next->vaddr < addr))
640 head = head->next;
641
642 entry->prev = head;
643 (entry->next = head->next)->prev = entry;
644 head->next = entry;
645 ring->num_entries++;
646
647 add_lru(entry);
648}
649
650static inline void remove_ring(struct sun4c_mmu_ring *ring,
651 struct sun4c_mmu_entry *entry)
652{
653 struct sun4c_mmu_entry *next = entry->next;
654
655 (next->prev = entry->prev)->next = next;
656 ring->num_entries--;
657}
658
659static void remove_lru(struct sun4c_mmu_entry *entry)
660{
661 struct sun4c_mmu_entry *next = entry->lru_next;
662
663 (next->lru_prev = entry->lru_prev)->lru_next = next;
664}
665
666static void free_user_entry(int ctx, struct sun4c_mmu_entry *entry)
667{
668 remove_ring(sun4c_context_ring+ctx, entry);
669 remove_lru(entry);
670 add_ring(&sun4c_ufree_ring, entry);
671}
672
673static void free_kernel_entry(struct sun4c_mmu_entry *entry,
674 struct sun4c_mmu_ring *ring)
675{
676 remove_ring(ring, entry);
677 add_ring(&sun4c_kfree_ring, entry);
678}
679
680static void __init sun4c_init_fill_kernel_ring(int howmany)
681{
682 int i;
683
684 while (howmany) {
685 for (i = 0; i < invalid_segment; i++)
686 if (!mmu_entry_pool[i].locked)
687 break;
688 mmu_entry_pool[i].locked = 1;
689 sun4c_init_clean_segmap(i);
690 add_ring(&sun4c_kfree_ring, &mmu_entry_pool[i]);
691 howmany--;
692 }
693}
694
695static void __init sun4c_init_fill_user_ring(void)
696{
697 int i;
698
699 for (i = 0; i < invalid_segment; i++) {
700 if (mmu_entry_pool[i].locked)
701 continue;
702 sun4c_init_clean_segmap(i);
703 add_ring(&sun4c_ufree_ring, &mmu_entry_pool[i]);
704 }
705}
706
707static void sun4c_kernel_unmap(struct sun4c_mmu_entry *kentry)
708{
709 int savectx, ctx;
710
711 savectx = sun4c_get_context();
712 for (ctx = 0; ctx < num_contexts; ctx++) {
713 sun4c_set_context(ctx);
714 sun4c_put_segmap(kentry->vaddr, invalid_segment);
715 }
716 sun4c_set_context(savectx);
717}
718
719static void sun4c_kernel_map(struct sun4c_mmu_entry *kentry)
720{
721 int savectx, ctx;
722
723 savectx = sun4c_get_context();
724 for (ctx = 0; ctx < num_contexts; ctx++) {
725 sun4c_set_context(ctx);
726 sun4c_put_segmap(kentry->vaddr, kentry->pseg);
727 }
728 sun4c_set_context(savectx);
729}
730
731#define sun4c_user_unmap(__entry) \
732 sun4c_put_segmap((__entry)->vaddr, invalid_segment)
733
734static void sun4c_demap_context(struct sun4c_mmu_ring *crp, unsigned char ctx)
735{
736 struct sun4c_mmu_entry *head = &crp->ringhd;
737 unsigned long flags;
738
739 local_irq_save(flags);
740 if (head->next != head) {
741 struct sun4c_mmu_entry *entry = head->next;
742 int savectx = sun4c_get_context();
743
744 flush_user_windows();
745 sun4c_set_context(ctx);
746 sun4c_flush_context();
747 do {
748 struct sun4c_mmu_entry *next = entry->next;
749
750 sun4c_user_unmap(entry);
751 free_user_entry(ctx, entry);
752
753 entry = next;
754 } while (entry != head);
755 sun4c_set_context(savectx);
756 }
757 local_irq_restore(flags);
758}
759
760static int sun4c_user_taken_entries; /* This is how much we have. */
761static int max_user_taken_entries; /* This limits us and prevents deadlock. */
762
763static struct sun4c_mmu_entry *sun4c_kernel_strategy(void)
764{
765 struct sun4c_mmu_entry *this_entry;
766
767 /* If some are free, return first one. */
768 if (sun4c_kfree_ring.num_entries) {
769 this_entry = sun4c_kfree_ring.ringhd.next;
770 return this_entry;
771 }
772
773 /* Else free one up. */
774 this_entry = sun4c_kernel_ring.ringhd.prev;
775 sun4c_flush_segment(this_entry->vaddr);
776 sun4c_kernel_unmap(this_entry);
777 free_kernel_entry(this_entry, &sun4c_kernel_ring);
778 this_entry = sun4c_kfree_ring.ringhd.next;
779
780 return this_entry;
781}
782
783/* Using this method to free up mmu entries eliminates a lot of
784 * potential races since we have a kernel that incurs tlb
785 * replacement faults. There may be performance penalties.
786 *
787 * NOTE: Must be called with interrupts disabled.
788 */
789static struct sun4c_mmu_entry *sun4c_user_strategy(void)
790{
791 struct sun4c_mmu_entry *entry;
792 unsigned char ctx;
793 int savectx;
794
795 /* If some are free, return first one. */
796 if (sun4c_ufree_ring.num_entries) {
797 entry = sun4c_ufree_ring.ringhd.next;
798 goto unlink_out;
799 }
800
801 if (sun4c_user_taken_entries) {
802 entry = sun4c_kernel_strategy();
803 sun4c_user_taken_entries--;
804 goto kunlink_out;
805 }
806
807 /* Grab from the beginning of the LRU list. */
808 entry = sun4c_ulru_ring.ringhd.lru_next;
809 ctx = entry->ctx;
810
811 savectx = sun4c_get_context();
812 flush_user_windows();
813 sun4c_set_context(ctx);
814 sun4c_flush_segment(entry->vaddr);
815 sun4c_user_unmap(entry);
816 remove_ring(sun4c_context_ring + ctx, entry);
817 remove_lru(entry);
818 sun4c_set_context(savectx);
819
820 return entry;
821
822unlink_out:
823 remove_ring(&sun4c_ufree_ring, entry);
824 return entry;
825kunlink_out:
826 remove_ring(&sun4c_kfree_ring, entry);
827 return entry;
828}
829
830/* NOTE: Must be called with interrupts disabled. */
831void sun4c_grow_kernel_ring(void)
832{
833 struct sun4c_mmu_entry *entry;
834
835 /* Prevent deadlock condition. */
836 if (sun4c_user_taken_entries >= max_user_taken_entries)
837 return;
838
839 if (sun4c_ufree_ring.num_entries) {
840 entry = sun4c_ufree_ring.ringhd.next;
841 remove_ring(&sun4c_ufree_ring, entry);
842 add_ring(&sun4c_kfree_ring, entry);
843 sun4c_user_taken_entries++;
844 }
845}
846
847/* 2 page buckets for task struct and kernel stack allocation.
848 *
849 * TASK_STACK_BEGIN
850 * bucket[0]
851 * bucket[1]
852 * [ ... ]
853 * bucket[NR_TASK_BUCKETS-1]
854 * TASK_STACK_BEGIN + (sizeof(struct task_bucket) * NR_TASK_BUCKETS)
855 *
856 * Each slot looks like:
857 *
858 * page 1 -- task struct + beginning of kernel stack
859 * page 2 -- rest of kernel stack
860 */
861
862union task_union *sun4c_bucket[NR_TASK_BUCKETS];
863
864static int sun4c_lowbucket_avail;
865
866#define BUCKET_EMPTY ((union task_union *) 0)
867#define BUCKET_SHIFT (PAGE_SHIFT + 1) /* log2(sizeof(struct task_bucket)) */
868#define BUCKET_SIZE (1 << BUCKET_SHIFT)
869#define BUCKET_NUM(addr) ((((addr) - SUN4C_LOCK_VADDR) >> BUCKET_SHIFT))
870#define BUCKET_ADDR(num) (((num) << BUCKET_SHIFT) + SUN4C_LOCK_VADDR)
871#define BUCKET_PTE(page) \
872 ((((page) - PAGE_OFFSET) >> PAGE_SHIFT) | pgprot_val(SUN4C_PAGE_KERNEL))
873#define BUCKET_PTE_PAGE(pte) \
874 (PAGE_OFFSET + (((pte) & SUN4C_PFN_MASK) << PAGE_SHIFT))
875
876static void get_locked_segment(unsigned long addr)
877{
878 struct sun4c_mmu_entry *stolen;
879 unsigned long flags;
880
881 local_irq_save(flags);
882 addr &= SUN4C_REAL_PGDIR_MASK;
883 stolen = sun4c_user_strategy();
884 max_user_taken_entries--;
885 stolen->vaddr = addr;
886 flush_user_windows();
887 sun4c_kernel_map(stolen);
888 local_irq_restore(flags);
889}
890
891static void free_locked_segment(unsigned long addr)
892{
893 struct sun4c_mmu_entry *entry;
894 unsigned long flags;
895 unsigned char pseg;
896
897 local_irq_save(flags);
898 addr &= SUN4C_REAL_PGDIR_MASK;
899 pseg = sun4c_get_segmap(addr);
900 entry = &mmu_entry_pool[pseg];
901
902 flush_user_windows();
903 sun4c_flush_segment(addr);
904 sun4c_kernel_unmap(entry);
905 add_ring(&sun4c_ufree_ring, entry);
906 max_user_taken_entries++;
907 local_irq_restore(flags);
908}
909
910static inline void garbage_collect(int entry)
911{
912 int start, end;
913
914 /* 32 buckets per segment... */
915 entry &= ~31;
916 start = entry;
917 for (end = (start + 32); start < end; start++)
918 if (sun4c_bucket[start] != BUCKET_EMPTY)
919 return;
920
921 /* Entire segment empty, release it. */
922 free_locked_segment(BUCKET_ADDR(entry));
923}
924
925static struct thread_info *sun4c_alloc_thread_info_node(int node)
926{
927 unsigned long addr, pages;
928 int entry;
929
930 pages = __get_free_pages(GFP_KERNEL, THREAD_INFO_ORDER);
931 if (!pages)
932 return NULL;
933
934 for (entry = sun4c_lowbucket_avail; entry < NR_TASK_BUCKETS; entry++)
935 if (sun4c_bucket[entry] == BUCKET_EMPTY)
936 break;
937 if (entry == NR_TASK_BUCKETS) {
938 free_pages(pages, THREAD_INFO_ORDER);
939 return NULL;
940 }
941 if (entry >= sun4c_lowbucket_avail)
942 sun4c_lowbucket_avail = entry + 1;
943
944 addr = BUCKET_ADDR(entry);
945 sun4c_bucket[entry] = (union task_union *) addr;
946 if(sun4c_get_segmap(addr) == invalid_segment)
947 get_locked_segment(addr);
948
949 /* We are changing the virtual color of the page(s)
950 * so we must flush the cache to guarantee consistency.
951 */
952 sun4c_flush_page(pages);
953 sun4c_flush_page(pages + PAGE_SIZE);
954
955 sun4c_put_pte(addr, BUCKET_PTE(pages));
956 sun4c_put_pte(addr + PAGE_SIZE, BUCKET_PTE(pages + PAGE_SIZE));
957
958#ifdef CONFIG_DEBUG_STACK_USAGE
959 memset((void *)addr, 0, PAGE_SIZE << THREAD_INFO_ORDER);
960#endif /* DEBUG_STACK_USAGE */
961
962 return (struct thread_info *) addr;
963}
964
965static void sun4c_free_thread_info(struct thread_info *ti)
966{
967 unsigned long tiaddr = (unsigned long) ti;
968 unsigned long pages = BUCKET_PTE_PAGE(sun4c_get_pte(tiaddr));
969 int entry = BUCKET_NUM(tiaddr);
970
971 /* We are deleting a mapping, so the flush here is mandatory. */
972 sun4c_flush_page(tiaddr);
973 sun4c_flush_page(tiaddr + PAGE_SIZE);
974
975 sun4c_put_pte(tiaddr, 0);
976 sun4c_put_pte(tiaddr + PAGE_SIZE, 0);
977
978 sun4c_bucket[entry] = BUCKET_EMPTY;
979 if (entry < sun4c_lowbucket_avail)
980 sun4c_lowbucket_avail = entry;
981
982 free_pages(pages, THREAD_INFO_ORDER);
983 garbage_collect(entry);
984}
985
986static void __init sun4c_init_buckets(void)
987{
988 int entry;
989
990 if (sizeof(union thread_union) != (PAGE_SIZE << THREAD_INFO_ORDER)) {
991 extern void thread_info_size_is_bolixed_pete(void);
992 thread_info_size_is_bolixed_pete();
993 }
994
995 for (entry = 0; entry < NR_TASK_BUCKETS; entry++)
996 sun4c_bucket[entry] = BUCKET_EMPTY;
997 sun4c_lowbucket_avail = 0;
998}
999
1000static unsigned long sun4c_iobuffer_start;
1001static unsigned long sun4c_iobuffer_end;
1002static unsigned long sun4c_iobuffer_high;
1003static unsigned long *sun4c_iobuffer_map;
1004static int iobuffer_map_size;
1005
1006/*
1007 * Alias our pages so they do not cause a trap.
1008 * Also one page may be aliased into several I/O areas and we may
1009 * finish these I/O separately.
1010 */
1011static char *sun4c_lockarea(char *vaddr, unsigned long size)
1012{
1013 unsigned long base, scan;
1014 unsigned long npages;
1015 unsigned long vpage;
1016 unsigned long pte;
1017 unsigned long apage;
1018 unsigned long high;
1019 unsigned long flags;
1020
1021 npages = (((unsigned long)vaddr & ~PAGE_MASK) +
1022 size + (PAGE_SIZE-1)) >> PAGE_SHIFT;
1023
1024 local_irq_save(flags);
1025 base = bitmap_find_next_zero_area(sun4c_iobuffer_map, iobuffer_map_size,
1026 0, npages, 0);
1027 if (base >= iobuffer_map_size)
1028 goto abend;
1029
1030 high = ((base + npages) << PAGE_SHIFT) + sun4c_iobuffer_start;
1031 high = SUN4C_REAL_PGDIR_ALIGN(high);
1032 while (high > sun4c_iobuffer_high) {
1033 get_locked_segment(sun4c_iobuffer_high);
1034 sun4c_iobuffer_high += SUN4C_REAL_PGDIR_SIZE;
1035 }
1036
1037 vpage = ((unsigned long) vaddr) & PAGE_MASK;
1038 for (scan = base; scan < base+npages; scan++) {
1039 pte = ((vpage-PAGE_OFFSET) >> PAGE_SHIFT);
1040 pte |= pgprot_val(SUN4C_PAGE_KERNEL);
1041 pte |= _SUN4C_PAGE_NOCACHE;
1042 set_bit(scan, sun4c_iobuffer_map);
1043 apage = (scan << PAGE_SHIFT) + sun4c_iobuffer_start;
1044
1045 /* Flush original mapping so we see the right things later. */
1046 sun4c_flush_page(vpage);
1047
1048 sun4c_put_pte(apage, pte);
1049 vpage += PAGE_SIZE;
1050 }
1051 local_irq_restore(flags);
1052 return (char *) ((base << PAGE_SHIFT) + sun4c_iobuffer_start +
1053 (((unsigned long) vaddr) & ~PAGE_MASK));
1054
1055abend:
1056 local_irq_restore(flags);
1057 printk("DMA vaddr=0x%p size=%08lx\n", vaddr, size);
1058 panic("Out of iobuffer table");
1059 return NULL;
1060}
1061
1062static void sun4c_unlockarea(char *vaddr, unsigned long size)
1063{
1064 unsigned long vpage, npages;
1065 unsigned long flags;
1066 int scan, high;
1067
1068 vpage = (unsigned long)vaddr & PAGE_MASK;
1069 npages = (((unsigned long)vaddr & ~PAGE_MASK) +
1070 size + (PAGE_SIZE-1)) >> PAGE_SHIFT;
1071
1072 local_irq_save(flags);
1073 while (npages != 0) {
1074 --npages;
1075
1076 /* This mapping is marked non-cachable, no flush necessary. */
1077 sun4c_put_pte(vpage, 0);
1078 clear_bit((vpage - sun4c_iobuffer_start) >> PAGE_SHIFT,
1079 sun4c_iobuffer_map);
1080 vpage += PAGE_SIZE;
1081 }
1082
1083 /* garbage collect */
1084 scan = (sun4c_iobuffer_high - sun4c_iobuffer_start) >> PAGE_SHIFT;
1085 while (scan >= 0 && !sun4c_iobuffer_map[scan >> 5])
1086 scan -= 32;
1087 scan += 32;
1088 high = sun4c_iobuffer_start + (scan << PAGE_SHIFT);
1089 high = SUN4C_REAL_PGDIR_ALIGN(high) + SUN4C_REAL_PGDIR_SIZE;
1090 while (high < sun4c_iobuffer_high) {
1091 sun4c_iobuffer_high -= SUN4C_REAL_PGDIR_SIZE;
1092 free_locked_segment(sun4c_iobuffer_high);
1093 }
1094 local_irq_restore(flags);
1095}
1096
1097/* Note the scsi code at init time passes to here buffers
1098 * which sit on the kernel stack, those are already locked
1099 * by implication and fool the page locking code above
1100 * if passed to by mistake.
1101 */
1102static __u32 sun4c_get_scsi_one(struct device *dev, char *bufptr, unsigned long len)
1103{
1104 unsigned long page;
1105
1106 page = ((unsigned long)bufptr) & PAGE_MASK;
1107 if (!virt_addr_valid(page)) {
1108 sun4c_flush_page(page);
1109 return (__u32)bufptr; /* already locked */
1110 }
1111 return (__u32)sun4c_lockarea(bufptr, len);
1112}
1113
1114static void sun4c_get_scsi_sgl(struct device *dev, struct scatterlist *sg, int sz)
1115{
1116 while (sz != 0) {
1117 --sz;
1118 sg->dma_address = (__u32)sun4c_lockarea(sg_virt(sg), sg->length);
1119 sg->dma_length = sg->length;
1120 sg = sg_next(sg);
1121 }
1122}
1123
1124static void sun4c_release_scsi_one(struct device *dev, __u32 bufptr, unsigned long len)
1125{
1126 if (bufptr < sun4c_iobuffer_start)
1127 return; /* On kernel stack or similar, see above */
1128 sun4c_unlockarea((char *)bufptr, len);
1129}
1130
1131static void sun4c_release_scsi_sgl(struct device *dev, struct scatterlist *sg, int sz)
1132{
1133 while (sz != 0) {
1134 --sz;
1135 sun4c_unlockarea((char *)sg->dma_address, sg->length);
1136 sg = sg_next(sg);
1137 }
1138}
1139
1140#define TASK_ENTRY_SIZE BUCKET_SIZE /* see above */
1141#define LONG_ALIGN(x) (((x)+(sizeof(long))-1)&~((sizeof(long))-1))
1142
1143struct vm_area_struct sun4c_kstack_vma;
1144
1145static void __init sun4c_init_lock_areas(void)
1146{
1147 unsigned long sun4c_taskstack_start;
1148 unsigned long sun4c_taskstack_end;
1149 int bitmap_size;
1150
1151 sun4c_init_buckets();
1152 sun4c_taskstack_start = SUN4C_LOCK_VADDR;
1153 sun4c_taskstack_end = (sun4c_taskstack_start +
1154 (TASK_ENTRY_SIZE * NR_TASK_BUCKETS));
1155 if (sun4c_taskstack_end >= SUN4C_LOCK_END) {
1156 prom_printf("Too many tasks, decrease NR_TASK_BUCKETS please.\n");
1157 prom_halt();
1158 }
1159
1160 sun4c_iobuffer_start = sun4c_iobuffer_high =
1161 SUN4C_REAL_PGDIR_ALIGN(sun4c_taskstack_end);
1162 sun4c_iobuffer_end = SUN4C_LOCK_END;
1163 bitmap_size = (sun4c_iobuffer_end - sun4c_iobuffer_start) >> PAGE_SHIFT;
1164 bitmap_size = (bitmap_size + 7) >> 3;
1165 bitmap_size = LONG_ALIGN(bitmap_size);
1166 iobuffer_map_size = bitmap_size << 3;
1167 sun4c_iobuffer_map = __alloc_bootmem(bitmap_size, SMP_CACHE_BYTES, 0UL);
1168 memset((void *) sun4c_iobuffer_map, 0, bitmap_size);
1169
1170 sun4c_kstack_vma.vm_mm = &init_mm;
1171 sun4c_kstack_vma.vm_start = sun4c_taskstack_start;
1172 sun4c_kstack_vma.vm_end = sun4c_taskstack_end;
1173 sun4c_kstack_vma.vm_page_prot = PAGE_SHARED;
1174 sun4c_kstack_vma.vm_flags = VM_READ | VM_WRITE | VM_EXEC;
1175 insert_vm_struct(&init_mm, &sun4c_kstack_vma);
1176}
1177
1178/* Cache flushing on the sun4c. */
1179static void sun4c_flush_cache_all(void)
1180{
1181 unsigned long begin, end;
1182
1183 flush_user_windows();
1184 begin = (KERNBASE + SUN4C_REAL_PGDIR_SIZE);
1185 end = (begin + SUN4C_VAC_SIZE);
1186
1187 if (sun4c_vacinfo.linesize == 32) {
1188 while (begin < end) {
1189 __asm__ __volatile__(
1190 "ld [%0 + 0x00], %%g0\n\t"
1191 "ld [%0 + 0x20], %%g0\n\t"
1192 "ld [%0 + 0x40], %%g0\n\t"
1193 "ld [%0 + 0x60], %%g0\n\t"
1194 "ld [%0 + 0x80], %%g0\n\t"
1195 "ld [%0 + 0xa0], %%g0\n\t"
1196 "ld [%0 + 0xc0], %%g0\n\t"
1197 "ld [%0 + 0xe0], %%g0\n\t"
1198 "ld [%0 + 0x100], %%g0\n\t"
1199 "ld [%0 + 0x120], %%g0\n\t"
1200 "ld [%0 + 0x140], %%g0\n\t"
1201 "ld [%0 + 0x160], %%g0\n\t"
1202 "ld [%0 + 0x180], %%g0\n\t"
1203 "ld [%0 + 0x1a0], %%g0\n\t"
1204 "ld [%0 + 0x1c0], %%g0\n\t"
1205 "ld [%0 + 0x1e0], %%g0\n"
1206 : : "r" (begin));
1207 begin += 512;
1208 }
1209 } else {
1210 while (begin < end) {
1211 __asm__ __volatile__(
1212 "ld [%0 + 0x00], %%g0\n\t"
1213 "ld [%0 + 0x10], %%g0\n\t"
1214 "ld [%0 + 0x20], %%g0\n\t"
1215 "ld [%0 + 0x30], %%g0\n\t"
1216 "ld [%0 + 0x40], %%g0\n\t"
1217 "ld [%0 + 0x50], %%g0\n\t"
1218 "ld [%0 + 0x60], %%g0\n\t"
1219 "ld [%0 + 0x70], %%g0\n\t"
1220 "ld [%0 + 0x80], %%g0\n\t"
1221 "ld [%0 + 0x90], %%g0\n\t"
1222 "ld [%0 + 0xa0], %%g0\n\t"
1223 "ld [%0 + 0xb0], %%g0\n\t"
1224 "ld [%0 + 0xc0], %%g0\n\t"
1225 "ld [%0 + 0xd0], %%g0\n\t"
1226 "ld [%0 + 0xe0], %%g0\n\t"
1227 "ld [%0 + 0xf0], %%g0\n"
1228 : : "r" (begin));
1229 begin += 256;
1230 }
1231 }
1232}
1233
1234static void sun4c_flush_cache_mm(struct mm_struct *mm)
1235{
1236 int new_ctx = mm->context;
1237
1238 if (new_ctx != NO_CONTEXT) {
1239 flush_user_windows();
1240
1241 if (sun4c_context_ring[new_ctx].num_entries) {
1242 struct sun4c_mmu_entry *head = &sun4c_context_ring[new_ctx].ringhd;
1243 unsigned long flags;
1244
1245 local_irq_save(flags);
1246 if (head->next != head) {
1247 struct sun4c_mmu_entry *entry = head->next;
1248 int savectx = sun4c_get_context();
1249
1250 sun4c_set_context(new_ctx);
1251 sun4c_flush_context();
1252 do {
1253 struct sun4c_mmu_entry *next = entry->next;
1254
1255 sun4c_user_unmap(entry);
1256 free_user_entry(new_ctx, entry);
1257
1258 entry = next;
1259 } while (entry != head);
1260 sun4c_set_context(savectx);
1261 }
1262 local_irq_restore(flags);
1263 }
1264 }
1265}
1266
1267static void sun4c_flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
1268{
1269 struct mm_struct *mm = vma->vm_mm;
1270 int new_ctx = mm->context;
1271
1272 if (new_ctx != NO_CONTEXT) {
1273 struct sun4c_mmu_entry *head = &sun4c_context_ring[new_ctx].ringhd;
1274 struct sun4c_mmu_entry *entry;
1275 unsigned long flags;
1276
1277 flush_user_windows();
1278
1279 local_irq_save(flags);
1280 /* All user segmap chains are ordered on entry->vaddr. */
1281 for (entry = head->next;
1282 (entry != head) && ((entry->vaddr+SUN4C_REAL_PGDIR_SIZE) < start);
1283 entry = entry->next)
1284 ;
1285
1286 /* Tracing various job mixtures showed that this conditional
1287 * only passes ~35% of the time for most worse case situations,
1288 * therefore we avoid all of this gross overhead ~65% of the time.
1289 */
1290 if ((entry != head) && (entry->vaddr < end)) {
1291 int octx = sun4c_get_context();
1292 sun4c_set_context(new_ctx);
1293
1294 /* At this point, always, (start >= entry->vaddr) and
1295 * (entry->vaddr < end), once the latter condition
1296 * ceases to hold, or we hit the end of the list, we
1297 * exit the loop. The ordering of all user allocated
1298 * segmaps makes this all work out so beautifully.
1299 */
1300 do {
1301 struct sun4c_mmu_entry *next = entry->next;
1302 unsigned long realend;
1303
1304 /* "realstart" is always >= entry->vaddr */
1305 realend = entry->vaddr + SUN4C_REAL_PGDIR_SIZE;
1306 if (end < realend)
1307 realend = end;
1308 if ((realend - entry->vaddr) <= (PAGE_SIZE << 3)) {
1309 unsigned long page = entry->vaddr;
1310 while (page < realend) {
1311 sun4c_flush_page(page);
1312 page += PAGE_SIZE;
1313 }
1314 } else {
1315 sun4c_flush_segment(entry->vaddr);
1316 sun4c_user_unmap(entry);
1317 free_user_entry(new_ctx, entry);
1318 }
1319 entry = next;
1320 } while ((entry != head) && (entry->vaddr < end));
1321 sun4c_set_context(octx);
1322 }
1323 local_irq_restore(flags);
1324 }
1325}
1326
1327static void sun4c_flush_cache_page(struct vm_area_struct *vma, unsigned long page)
1328{
1329 struct mm_struct *mm = vma->vm_mm;
1330 int new_ctx = mm->context;
1331
1332 /* Sun4c has no separate I/D caches so cannot optimize for non
1333 * text page flushes.
1334 */
1335 if (new_ctx != NO_CONTEXT) {
1336 int octx = sun4c_get_context();
1337 unsigned long flags;
1338
1339 flush_user_windows();
1340 local_irq_save(flags);
1341 sun4c_set_context(new_ctx);
1342 sun4c_flush_page(page);
1343 sun4c_set_context(octx);
1344 local_irq_restore(flags);
1345 }
1346}
1347
1348static void sun4c_flush_page_to_ram(unsigned long page)
1349{
1350 unsigned long flags;
1351
1352 local_irq_save(flags);
1353 sun4c_flush_page(page);
1354 local_irq_restore(flags);
1355}
1356
1357/* Sun4c cache is unified, both instructions and data live there, so
1358 * no need to flush the on-stack instructions for new signal handlers.
1359 */
1360static void sun4c_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr)
1361{
1362}
1363
1364/* TLB flushing on the sun4c. These routines count on the cache
1365 * flushing code to flush the user register windows so that we need
1366 * not do so when we get here.
1367 */
1368
1369static void sun4c_flush_tlb_all(void)
1370{
1371 struct sun4c_mmu_entry *this_entry, *next_entry;
1372 unsigned long flags;
1373 int savectx, ctx;
1374
1375 local_irq_save(flags);
1376 this_entry = sun4c_kernel_ring.ringhd.next;
1377 savectx = sun4c_get_context();
1378 flush_user_windows();
1379 while (sun4c_kernel_ring.num_entries) {
1380 next_entry = this_entry->next;
1381 sun4c_flush_segment(this_entry->vaddr);
1382 for (ctx = 0; ctx < num_contexts; ctx++) {
1383 sun4c_set_context(ctx);
1384 sun4c_put_segmap(this_entry->vaddr, invalid_segment);
1385 }
1386 free_kernel_entry(this_entry, &sun4c_kernel_ring);
1387 this_entry = next_entry;
1388 }
1389 sun4c_set_context(savectx);
1390 local_irq_restore(flags);
1391}
1392
1393static void sun4c_flush_tlb_mm(struct mm_struct *mm)
1394{
1395 int new_ctx = mm->context;
1396
1397 if (new_ctx != NO_CONTEXT) {
1398 struct sun4c_mmu_entry *head = &sun4c_context_ring[new_ctx].ringhd;
1399 unsigned long flags;
1400
1401 local_irq_save(flags);
1402 if (head->next != head) {
1403 struct sun4c_mmu_entry *entry = head->next;
1404 int savectx = sun4c_get_context();
1405
1406 sun4c_set_context(new_ctx);
1407 sun4c_flush_context();
1408 do {
1409 struct sun4c_mmu_entry *next = entry->next;
1410
1411 sun4c_user_unmap(entry);
1412 free_user_entry(new_ctx, entry);
1413
1414 entry = next;
1415 } while (entry != head);
1416 sun4c_set_context(savectx);
1417 }
1418 local_irq_restore(flags);
1419 }
1420}
1421
1422static void sun4c_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
1423{
1424 struct mm_struct *mm = vma->vm_mm;
1425 int new_ctx = mm->context;
1426
1427 if (new_ctx != NO_CONTEXT) {
1428 struct sun4c_mmu_entry *head = &sun4c_context_ring[new_ctx].ringhd;
1429 struct sun4c_mmu_entry *entry;
1430 unsigned long flags;
1431
1432 local_irq_save(flags);
1433 /* See commentary in sun4c_flush_cache_range(). */
1434 for (entry = head->next;
1435 (entry != head) && ((entry->vaddr+SUN4C_REAL_PGDIR_SIZE) < start);
1436 entry = entry->next)
1437 ;
1438
1439 if ((entry != head) && (entry->vaddr < end)) {
1440 int octx = sun4c_get_context();
1441
1442 sun4c_set_context(new_ctx);
1443 do {
1444 struct sun4c_mmu_entry *next = entry->next;
1445
1446 sun4c_flush_segment(entry->vaddr);
1447 sun4c_user_unmap(entry);
1448 free_user_entry(new_ctx, entry);
1449
1450 entry = next;
1451 } while ((entry != head) && (entry->vaddr < end));
1452 sun4c_set_context(octx);
1453 }
1454 local_irq_restore(flags);
1455 }
1456}
1457
1458static void sun4c_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
1459{
1460 struct mm_struct *mm = vma->vm_mm;
1461 int new_ctx = mm->context;
1462
1463 if (new_ctx != NO_CONTEXT) {
1464 int savectx = sun4c_get_context();
1465 unsigned long flags;
1466
1467 local_irq_save(flags);
1468 sun4c_set_context(new_ctx);
1469 page &= PAGE_MASK;
1470 sun4c_flush_page(page);
1471 sun4c_put_pte(page, 0);
1472 sun4c_set_context(savectx);
1473 local_irq_restore(flags);
1474 }
1475}
1476
1477static inline void sun4c_mapioaddr(unsigned long physaddr, unsigned long virt_addr)
1478{
1479 unsigned long page_entry, pg_iobits;
1480
1481 pg_iobits = _SUN4C_PAGE_PRESENT | _SUN4C_READABLE | _SUN4C_WRITEABLE |
1482 _SUN4C_PAGE_IO | _SUN4C_PAGE_NOCACHE;
1483
1484 page_entry = ((physaddr >> PAGE_SHIFT) & SUN4C_PFN_MASK);
1485 page_entry |= ((pg_iobits | _SUN4C_PAGE_PRIV) & ~(_SUN4C_PAGE_PRESENT));
1486 sun4c_put_pte(virt_addr, page_entry);
1487}
1488
1489static void sun4c_mapiorange(unsigned int bus, unsigned long xpa,
1490 unsigned long xva, unsigned int len)
1491{
1492 while (len != 0) {
1493 len -= PAGE_SIZE;
1494 sun4c_mapioaddr(xpa, xva);
1495 xva += PAGE_SIZE;
1496 xpa += PAGE_SIZE;
1497 }
1498}
1499
1500static void sun4c_unmapiorange(unsigned long virt_addr, unsigned int len)
1501{
1502 while (len != 0) {
1503 len -= PAGE_SIZE;
1504 sun4c_put_pte(virt_addr, 0);
1505 virt_addr += PAGE_SIZE;
1506 }
1507}
1508
1509static void sun4c_alloc_context(struct mm_struct *old_mm, struct mm_struct *mm)
1510{
1511 struct ctx_list *ctxp;
1512
1513 ctxp = ctx_free.next;
1514 if (ctxp != &ctx_free) {
1515 remove_from_ctx_list(ctxp);
1516 add_to_used_ctxlist(ctxp);
1517 mm->context = ctxp->ctx_number;
1518 ctxp->ctx_mm = mm;
1519 return;
1520 }
1521 ctxp = ctx_used.next;
1522 if (ctxp->ctx_mm == old_mm)
1523 ctxp = ctxp->next;
1524 remove_from_ctx_list(ctxp);
1525 add_to_used_ctxlist(ctxp);
1526 ctxp->ctx_mm->context = NO_CONTEXT;
1527 ctxp->ctx_mm = mm;
1528 mm->context = ctxp->ctx_number;
1529 sun4c_demap_context(&sun4c_context_ring[ctxp->ctx_number],
1530 ctxp->ctx_number);
1531}
1532
1533/* Switch the current MM context. */
1534static void sun4c_switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk, int cpu)
1535{
1536 struct ctx_list *ctx;
1537 int dirty = 0;
1538
1539 if (mm->context == NO_CONTEXT) {
1540 dirty = 1;
1541 sun4c_alloc_context(old_mm, mm);
1542 } else {
1543 /* Update the LRU ring of contexts. */
1544 ctx = ctx_list_pool + mm->context;
1545 remove_from_ctx_list(ctx);
1546 add_to_used_ctxlist(ctx);
1547 }
1548 if (dirty || old_mm != mm)
1549 sun4c_set_context(mm->context);
1550}
1551
1552static void sun4c_destroy_context(struct mm_struct *mm)
1553{
1554 struct ctx_list *ctx_old;
1555
1556 if (mm->context != NO_CONTEXT) {
1557 sun4c_demap_context(&sun4c_context_ring[mm->context], mm->context);
1558 ctx_old = ctx_list_pool + mm->context;
1559 remove_from_ctx_list(ctx_old);
1560 add_to_free_ctxlist(ctx_old);
1561 mm->context = NO_CONTEXT;
1562 }
1563}
1564
1565static void sun4c_mmu_info(struct seq_file *m)
1566{
1567 int used_user_entries, i;
1568
1569 used_user_entries = 0;
1570 for (i = 0; i < num_contexts; i++)
1571 used_user_entries += sun4c_context_ring[i].num_entries;
1572
1573 seq_printf(m,
1574 "vacsize\t\t: %d bytes\n"
1575 "vachwflush\t: %s\n"
1576 "vaclinesize\t: %d bytes\n"
1577 "mmuctxs\t\t: %d\n"
1578 "mmupsegs\t: %d\n"
1579 "kernelpsegs\t: %d\n"
1580 "kfreepsegs\t: %d\n"
1581 "usedpsegs\t: %d\n"
1582 "ufreepsegs\t: %d\n"
1583 "user_taken\t: %d\n"
1584 "max_taken\t: %d\n",
1585 sun4c_vacinfo.num_bytes,
1586 (sun4c_vacinfo.do_hwflushes ? "yes" : "no"),
1587 sun4c_vacinfo.linesize,
1588 num_contexts,
1589 (invalid_segment + 1),
1590 sun4c_kernel_ring.num_entries,
1591 sun4c_kfree_ring.num_entries,
1592 used_user_entries,
1593 sun4c_ufree_ring.num_entries,
1594 sun4c_user_taken_entries,
1595 max_user_taken_entries);
1596}
1597
1598/* Nothing below here should touch the mmu hardware nor the mmu_entry
1599 * data structures.
1600 */
1601
1602/* First the functions which the mid-level code uses to directly
1603 * manipulate the software page tables. Some defines since we are
1604 * emulating the i386 page directory layout.
1605 */
1606#define PGD_PRESENT 0x001
1607#define PGD_RW 0x002
1608#define PGD_USER 0x004
1609#define PGD_ACCESSED 0x020
1610#define PGD_DIRTY 0x040
1611#define PGD_TABLE (PGD_PRESENT | PGD_RW | PGD_USER | PGD_ACCESSED | PGD_DIRTY)
1612
1613static void sun4c_set_pte(pte_t *ptep, pte_t pte)
1614{
1615 *ptep = pte;
1616}
1617
1618static void sun4c_pgd_set(pgd_t * pgdp, pmd_t * pmdp)
1619{
1620}
1621
1622static void sun4c_pmd_set(pmd_t * pmdp, pte_t * ptep)
1623{
1624 pmdp->pmdv[0] = PGD_TABLE | (unsigned long) ptep;
1625}
1626
1627static void sun4c_pmd_populate(pmd_t * pmdp, struct page * ptep)
1628{
1629 if (page_address(ptep) == NULL) BUG(); /* No highmem on sun4c */
1630 pmdp->pmdv[0] = PGD_TABLE | (unsigned long) page_address(ptep);
1631}
1632
1633static int sun4c_pte_present(pte_t pte)
1634{
1635 return ((pte_val(pte) & (_SUN4C_PAGE_PRESENT | _SUN4C_PAGE_PRIV)) != 0);
1636}
1637static void sun4c_pte_clear(pte_t *ptep) { *ptep = __pte(0); }
1638
1639static int sun4c_pmd_bad(pmd_t pmd)
1640{
1641 return (((pmd_val(pmd) & ~PAGE_MASK) != PGD_TABLE) ||
1642 (!virt_addr_valid(pmd_val(pmd))));
1643}
1644
1645static int sun4c_pmd_present(pmd_t pmd)
1646{
1647 return ((pmd_val(pmd) & PGD_PRESENT) != 0);
1648}
1649
1650#if 0 /* if PMD takes one word */
1651static void sun4c_pmd_clear(pmd_t *pmdp) { *pmdp = __pmd(0); }
1652#else /* if pmd_t is a longish aggregate */
1653static void sun4c_pmd_clear(pmd_t *pmdp) {
1654 memset((void *)pmdp, 0, sizeof(pmd_t));
1655}
1656#endif
1657
1658static int sun4c_pgd_none(pgd_t pgd) { return 0; }
1659static int sun4c_pgd_bad(pgd_t pgd) { return 0; }
1660static int sun4c_pgd_present(pgd_t pgd) { return 1; }
1661static void sun4c_pgd_clear(pgd_t * pgdp) { }
1662
1663/*
1664 * The following only work if pte_present() is true.
1665 * Undefined behaviour if not..
1666 */
1667static pte_t sun4c_pte_mkwrite(pte_t pte)
1668{
1669 pte = __pte(pte_val(pte) | _SUN4C_PAGE_WRITE);
1670 if (pte_val(pte) & _SUN4C_PAGE_MODIFIED)
1671 pte = __pte(pte_val(pte) | _SUN4C_PAGE_SILENT_WRITE);
1672 return pte;
1673}
1674
1675static pte_t sun4c_pte_mkdirty(pte_t pte)
1676{
1677 pte = __pte(pte_val(pte) | _SUN4C_PAGE_MODIFIED);
1678 if (pte_val(pte) & _SUN4C_PAGE_WRITE)
1679 pte = __pte(pte_val(pte) | _SUN4C_PAGE_SILENT_WRITE);
1680 return pte;
1681}
1682
1683static pte_t sun4c_pte_mkyoung(pte_t pte)
1684{
1685 pte = __pte(pte_val(pte) | _SUN4C_PAGE_ACCESSED);
1686 if (pte_val(pte) & _SUN4C_PAGE_READ)
1687 pte = __pte(pte_val(pte) | _SUN4C_PAGE_SILENT_READ);
1688 return pte;
1689}
1690
1691/*
1692 * Conversion functions: convert a page and protection to a page entry,
1693 * and a page entry and page directory to the page they refer to.
1694 */
1695static pte_t sun4c_mk_pte(struct page *page, pgprot_t pgprot)
1696{
1697 return __pte(page_to_pfn(page) | pgprot_val(pgprot));
1698}
1699
1700static pte_t sun4c_mk_pte_phys(unsigned long phys_page, pgprot_t pgprot)
1701{
1702 return __pte((phys_page >> PAGE_SHIFT) | pgprot_val(pgprot));
1703}
1704
1705static pte_t sun4c_mk_pte_io(unsigned long page, pgprot_t pgprot, int space)
1706{
1707 return __pte(((page - PAGE_OFFSET) >> PAGE_SHIFT) | pgprot_val(pgprot));
1708}
1709
1710static unsigned long sun4c_pte_pfn(pte_t pte)
1711{
1712 return pte_val(pte) & SUN4C_PFN_MASK;
1713}
1714
1715static pte_t sun4c_pgoff_to_pte(unsigned long pgoff)
1716{
1717 return __pte(pgoff | _SUN4C_PAGE_FILE);
1718}
1719
1720static unsigned long sun4c_pte_to_pgoff(pte_t pte)
1721{
1722 return pte_val(pte) & ((1UL << PTE_FILE_MAX_BITS) - 1);
1723}
1724
1725
1726static inline unsigned long sun4c_pmd_page_v(pmd_t pmd)
1727{
1728 return (pmd_val(pmd) & PAGE_MASK);
1729}
1730
1731static struct page *sun4c_pmd_page(pmd_t pmd)
1732{
1733 return virt_to_page(sun4c_pmd_page_v(pmd));
1734}
1735
1736static unsigned long sun4c_pgd_page(pgd_t pgd) { return 0; }
1737
1738/* to find an entry in a page-table-directory */
1739static inline pgd_t *sun4c_pgd_offset(struct mm_struct * mm, unsigned long address)
1740{
1741 return mm->pgd + (address >> SUN4C_PGDIR_SHIFT);
1742}
1743
1744/* Find an entry in the second-level page table.. */
1745static pmd_t *sun4c_pmd_offset(pgd_t * dir, unsigned long address)
1746{
1747 return (pmd_t *) dir;
1748}
1749
1750/* Find an entry in the third-level page table.. */
1751pte_t *sun4c_pte_offset_kernel(pmd_t * dir, unsigned long address)
1752{
1753 return (pte_t *) sun4c_pmd_page_v(*dir) +
1754 ((address >> PAGE_SHIFT) & (SUN4C_PTRS_PER_PTE - 1));
1755}
1756
1757static unsigned long sun4c_swp_type(swp_entry_t entry)
1758{
1759 return (entry.val & SUN4C_SWP_TYPE_MASK);
1760}
1761
1762static unsigned long sun4c_swp_offset(swp_entry_t entry)
1763{
1764 return (entry.val >> SUN4C_SWP_OFF_SHIFT) & SUN4C_SWP_OFF_MASK;
1765}
1766
1767static swp_entry_t sun4c_swp_entry(unsigned long type, unsigned long offset)
1768{
1769 return (swp_entry_t) {
1770 (offset & SUN4C_SWP_OFF_MASK) << SUN4C_SWP_OFF_SHIFT
1771 | (type & SUN4C_SWP_TYPE_MASK) };
1772}
1773
1774static void sun4c_free_pte_slow(pte_t *pte)
1775{
1776 free_page((unsigned long)pte);
1777}
1778
1779static void sun4c_free_pgd_slow(pgd_t *pgd)
1780{
1781 free_page((unsigned long)pgd);
1782}
1783
1784static pgd_t *sun4c_get_pgd_fast(void)
1785{
1786 unsigned long *ret;
1787
1788 if ((ret = pgd_quicklist) != NULL) {
1789 pgd_quicklist = (unsigned long *)(*ret);
1790 ret[0] = ret[1];
1791 pgtable_cache_size--;
1792 } else {
1793 pgd_t *init;
1794
1795 ret = (unsigned long *)__get_free_page(GFP_KERNEL);
1796 memset (ret, 0, (KERNBASE / SUN4C_PGDIR_SIZE) * sizeof(pgd_t));
1797 init = sun4c_pgd_offset(&init_mm, 0);
1798 memcpy (((pgd_t *)ret) + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,
1799 (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
1800 }
1801 return (pgd_t *)ret;
1802}
1803
1804static void sun4c_free_pgd_fast(pgd_t *pgd)
1805{
1806 *(unsigned long *)pgd = (unsigned long) pgd_quicklist;
1807 pgd_quicklist = (unsigned long *) pgd;
1808 pgtable_cache_size++;
1809}
1810
1811
1812static inline pte_t *
1813sun4c_pte_alloc_one_fast(struct mm_struct *mm, unsigned long address)
1814{
1815 unsigned long *ret;
1816
1817 if ((ret = (unsigned long *)pte_quicklist) != NULL) {
1818 pte_quicklist = (unsigned long *)(*ret);
1819 ret[0] = ret[1];
1820 pgtable_cache_size--;
1821 }
1822 return (pte_t *)ret;
1823}
1824
1825static pte_t *sun4c_pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
1826{
1827 pte_t *pte;
1828
1829 if ((pte = sun4c_pte_alloc_one_fast(mm, address)) != NULL)
1830 return pte;
1831
1832 pte = (pte_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
1833 return pte;
1834}
1835
1836static pgtable_t sun4c_pte_alloc_one(struct mm_struct *mm, unsigned long address)
1837{
1838 pte_t *pte;
1839 struct page *page;
1840
1841 pte = sun4c_pte_alloc_one_kernel(mm, address);
1842 if (pte == NULL)
1843 return NULL;
1844 page = virt_to_page(pte);
1845 pgtable_page_ctor(page);
1846 return page;
1847}
1848
1849static inline void sun4c_free_pte_fast(pte_t *pte)
1850{
1851 *(unsigned long *)pte = (unsigned long) pte_quicklist;
1852 pte_quicklist = (unsigned long *) pte;
1853 pgtable_cache_size++;
1854}
1855
1856static void sun4c_pte_free(pgtable_t pte)
1857{
1858 pgtable_page_dtor(pte);
1859 sun4c_free_pte_fast(page_address(pte));
1860}
1861
1862/*
1863 * allocating and freeing a pmd is trivial: the 1-entry pmd is
1864 * inside the pgd, so has no extra memory associated with it.
1865 */
1866static pmd_t *sun4c_pmd_alloc_one(struct mm_struct *mm, unsigned long address)
1867{
1868 BUG();
1869 return NULL;
1870}
1871
1872static void sun4c_free_pmd_fast(pmd_t * pmd) { }
1873
1874static void sun4c_check_pgt_cache(int low, int high)
1875{
1876 if (pgtable_cache_size > high) {
1877 do {
1878 if (pgd_quicklist)
1879 sun4c_free_pgd_slow(sun4c_get_pgd_fast());
1880 if (pte_quicklist)
1881 sun4c_free_pte_slow(sun4c_pte_alloc_one_fast(NULL, 0));
1882 } while (pgtable_cache_size > low);
1883 }
1884}
1885
1886/* An experiment, turn off by default for now... -DaveM */
1887#define SUN4C_PRELOAD_PSEG
1888
1889void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
1890{
1891 unsigned long flags;
1892 int pseg;
1893
1894 if (vma->vm_mm->context == NO_CONTEXT)
1895 return;
1896
1897 local_irq_save(flags);
1898 address &= PAGE_MASK;
1899 if ((pseg = sun4c_get_segmap(address)) == invalid_segment) {
1900 struct sun4c_mmu_entry *entry = sun4c_user_strategy();
1901 struct mm_struct *mm = vma->vm_mm;
1902 unsigned long start, end;
1903
1904 entry->vaddr = start = (address & SUN4C_REAL_PGDIR_MASK);
1905 entry->ctx = mm->context;
1906 add_ring_ordered(sun4c_context_ring + mm->context, entry);
1907 sun4c_put_segmap(entry->vaddr, entry->pseg);
1908 end = start + SUN4C_REAL_PGDIR_SIZE;
1909 while (start < end) {
1910#ifdef SUN4C_PRELOAD_PSEG
1911 pgd_t *pgdp = sun4c_pgd_offset(mm, start);
1912 pte_t *ptep;
1913
1914 if (!pgdp)
1915 goto no_mapping;
1916 ptep = sun4c_pte_offset_kernel((pmd_t *) pgdp, start);
1917 if (!ptep || !(pte_val(*ptep) & _SUN4C_PAGE_PRESENT))
1918 goto no_mapping;
1919 sun4c_put_pte(start, pte_val(*ptep));
1920 goto next;
1921
1922 no_mapping:
1923#endif
1924 sun4c_put_pte(start, 0);
1925#ifdef SUN4C_PRELOAD_PSEG
1926 next:
1927#endif
1928 start += PAGE_SIZE;
1929 }
1930#ifndef SUN4C_PRELOAD_PSEG
1931 sun4c_put_pte(address, pte_val(*ptep));
1932#endif
1933 local_irq_restore(flags);
1934 return;
1935 } else {
1936 struct sun4c_mmu_entry *entry = &mmu_entry_pool[pseg];
1937
1938 remove_lru(entry);
1939 add_lru(entry);
1940 }
1941
1942 sun4c_put_pte(address, pte_val(*ptep));
1943 local_irq_restore(flags);
1944}
1945
1946extern void sparc_context_init(int);
1947extern unsigned long bootmem_init(unsigned long *pages_avail);
1948extern unsigned long last_valid_pfn;
1949
1950void __init sun4c_paging_init(void)
1951{
1952 int i, cnt;
1953 unsigned long kernel_end, vaddr;
1954 extern struct resource sparc_iomap;
1955 unsigned long end_pfn, pages_avail;
1956
1957 kernel_end = (unsigned long) &_end;
1958 kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end);
1959
1960 pages_avail = 0;
1961 last_valid_pfn = bootmem_init(&pages_avail);
1962 end_pfn = last_valid_pfn;
1963
1964 sun4c_probe_mmu();
1965 invalid_segment = (num_segmaps - 1);
1966 sun4c_init_mmu_entry_pool();
1967 sun4c_init_rings();
1968 sun4c_init_map_kernelprom(kernel_end);
1969 sun4c_init_clean_mmu(kernel_end);
1970 sun4c_init_fill_kernel_ring(SUN4C_KERNEL_BUCKETS);
1971 sun4c_init_lock_area(sparc_iomap.start, IOBASE_END);
1972 sun4c_init_lock_area(DVMA_VADDR, DVMA_END);
1973 sun4c_init_lock_areas();
1974 sun4c_init_fill_user_ring();
1975
1976 sun4c_set_context(0);
1977 memset(swapper_pg_dir, 0, PAGE_SIZE);
1978 memset(pg0, 0, PAGE_SIZE);
1979 memset(pg1, 0, PAGE_SIZE);
1980 memset(pg2, 0, PAGE_SIZE);
1981 memset(pg3, 0, PAGE_SIZE);
1982
1983 /* Save work later. */
1984 vaddr = VMALLOC_START;
1985 swapper_pg_dir[vaddr>>SUN4C_PGDIR_SHIFT] = __pgd(PGD_TABLE | (unsigned long) pg0);
1986 vaddr += SUN4C_PGDIR_SIZE;
1987 swapper_pg_dir[vaddr>>SUN4C_PGDIR_SHIFT] = __pgd(PGD_TABLE | (unsigned long) pg1);
1988 vaddr += SUN4C_PGDIR_SIZE;
1989 swapper_pg_dir[vaddr>>SUN4C_PGDIR_SHIFT] = __pgd(PGD_TABLE | (unsigned long) pg2);
1990 vaddr += SUN4C_PGDIR_SIZE;
1991 swapper_pg_dir[vaddr>>SUN4C_PGDIR_SHIFT] = __pgd(PGD_TABLE | (unsigned long) pg3);
1992 sun4c_init_ss2_cache_bug();
1993 sparc_context_init(num_contexts);
1994
1995 {
1996 unsigned long zones_size[MAX_NR_ZONES];
1997 unsigned long zholes_size[MAX_NR_ZONES];
1998 unsigned long npages;
1999 int znum;
2000
2001 for (znum = 0; znum < MAX_NR_ZONES; znum++)
2002 zones_size[znum] = zholes_size[znum] = 0;
2003
2004 npages = max_low_pfn - pfn_base;
2005
2006 zones_size[ZONE_DMA] = npages;
2007 zholes_size[ZONE_DMA] = npages - pages_avail;
2008
2009 npages = highend_pfn - max_low_pfn;
2010 zones_size[ZONE_HIGHMEM] = npages;
2011 zholes_size[ZONE_HIGHMEM] = npages - calc_highpages();
2012
2013 free_area_init_node(0, zones_size, pfn_base, zholes_size);
2014 }
2015
2016 cnt = 0;
2017 for (i = 0; i < num_segmaps; i++)
2018 if (mmu_entry_pool[i].locked)
2019 cnt++;
2020
2021 max_user_taken_entries = num_segmaps - cnt - 40 - 1;
2022
2023 printk("SUN4C: %d mmu entries for the kernel\n", cnt);
2024}
2025
2026static pgprot_t sun4c_pgprot_noncached(pgprot_t prot)
2027{
2028 prot |= __pgprot(_SUN4C_PAGE_IO | _SUN4C_PAGE_NOCACHE);
2029
2030 return prot;
2031}
2032
2033/* Load up routines and constants for sun4c mmu */
2034void __init ld_mmu_sun4c(void)
2035{
2036 extern void ___xchg32_sun4c(void);
2037
2038 printk("Loading sun4c MMU routines\n");
2039
2040 /* First the constants */
2041 BTFIXUPSET_SIMM13(pgdir_shift, SUN4C_PGDIR_SHIFT);
2042 BTFIXUPSET_SETHI(pgdir_size, SUN4C_PGDIR_SIZE);
2043 BTFIXUPSET_SETHI(pgdir_mask, SUN4C_PGDIR_MASK);
2044
2045 BTFIXUPSET_SIMM13(ptrs_per_pmd, SUN4C_PTRS_PER_PMD);
2046 BTFIXUPSET_SIMM13(ptrs_per_pgd, SUN4C_PTRS_PER_PGD);
2047 BTFIXUPSET_SIMM13(user_ptrs_per_pgd, KERNBASE / SUN4C_PGDIR_SIZE);
2048
2049 BTFIXUPSET_INT(page_none, pgprot_val(SUN4C_PAGE_NONE));
2050 PAGE_SHARED = pgprot_val(SUN4C_PAGE_SHARED);
2051 BTFIXUPSET_INT(page_copy, pgprot_val(SUN4C_PAGE_COPY));
2052 BTFIXUPSET_INT(page_readonly, pgprot_val(SUN4C_PAGE_READONLY));
2053 BTFIXUPSET_INT(page_kernel, pgprot_val(SUN4C_PAGE_KERNEL));
2054 page_kernel = pgprot_val(SUN4C_PAGE_KERNEL);
2055
2056 /* Functions */
2057 BTFIXUPSET_CALL(pgprot_noncached, sun4c_pgprot_noncached, BTFIXUPCALL_NORM);
2058 BTFIXUPSET_CALL(___xchg32, ___xchg32_sun4c, BTFIXUPCALL_NORM);
2059 BTFIXUPSET_CALL(do_check_pgt_cache, sun4c_check_pgt_cache, BTFIXUPCALL_NORM);
2060
2061 BTFIXUPSET_CALL(flush_cache_all, sun4c_flush_cache_all, BTFIXUPCALL_NORM);
2062
2063 if (sun4c_vacinfo.do_hwflushes) {
2064 BTFIXUPSET_CALL(sun4c_flush_page, sun4c_flush_page_hw, BTFIXUPCALL_NORM);
2065 BTFIXUPSET_CALL(sun4c_flush_segment, sun4c_flush_segment_hw, BTFIXUPCALL_NORM);
2066 BTFIXUPSET_CALL(sun4c_flush_context, sun4c_flush_context_hw, BTFIXUPCALL_NORM);
2067 } else {
2068 BTFIXUPSET_CALL(sun4c_flush_page, sun4c_flush_page_sw, BTFIXUPCALL_NORM);
2069 BTFIXUPSET_CALL(sun4c_flush_segment, sun4c_flush_segment_sw, BTFIXUPCALL_NORM);
2070 BTFIXUPSET_CALL(sun4c_flush_context, sun4c_flush_context_sw, BTFIXUPCALL_NORM);
2071 }
2072
2073 BTFIXUPSET_CALL(flush_tlb_mm, sun4c_flush_tlb_mm, BTFIXUPCALL_NORM);
2074 BTFIXUPSET_CALL(flush_cache_mm, sun4c_flush_cache_mm, BTFIXUPCALL_NORM);
2075 BTFIXUPSET_CALL(destroy_context, sun4c_destroy_context, BTFIXUPCALL_NORM);
2076 BTFIXUPSET_CALL(switch_mm, sun4c_switch_mm, BTFIXUPCALL_NORM);
2077 BTFIXUPSET_CALL(flush_cache_page, sun4c_flush_cache_page, BTFIXUPCALL_NORM);
2078 BTFIXUPSET_CALL(flush_tlb_page, sun4c_flush_tlb_page, BTFIXUPCALL_NORM);
2079 BTFIXUPSET_CALL(flush_tlb_range, sun4c_flush_tlb_range, BTFIXUPCALL_NORM);
2080 BTFIXUPSET_CALL(flush_cache_range, sun4c_flush_cache_range, BTFIXUPCALL_NORM);
2081 BTFIXUPSET_CALL(__flush_page_to_ram, sun4c_flush_page_to_ram, BTFIXUPCALL_NORM);
2082 BTFIXUPSET_CALL(flush_tlb_all, sun4c_flush_tlb_all, BTFIXUPCALL_NORM);
2083
2084 BTFIXUPSET_CALL(flush_sig_insns, sun4c_flush_sig_insns, BTFIXUPCALL_NOP);
2085
2086 BTFIXUPSET_CALL(set_pte, sun4c_set_pte, BTFIXUPCALL_STO1O0);
2087
2088 BTFIXUPSET_CALL(pte_pfn, sun4c_pte_pfn, BTFIXUPCALL_NORM);
2089#if 0 /* PAGE_SHIFT <= 12 */ /* Eek. Investigate. XXX */
2090 BTFIXUPSET_CALL(pmd_page, sun4c_pmd_page, BTFIXUPCALL_ANDNINT(PAGE_SIZE - 1));
2091#else
2092 BTFIXUPSET_CALL(pmd_page, sun4c_pmd_page, BTFIXUPCALL_NORM);
2093#endif
2094 BTFIXUPSET_CALL(pmd_set, sun4c_pmd_set, BTFIXUPCALL_NORM);
2095 BTFIXUPSET_CALL(pmd_populate, sun4c_pmd_populate, BTFIXUPCALL_NORM);
2096
2097 BTFIXUPSET_CALL(pte_present, sun4c_pte_present, BTFIXUPCALL_NORM);
2098 BTFIXUPSET_CALL(pte_clear, sun4c_pte_clear, BTFIXUPCALL_STG0O0);
2099
2100 BTFIXUPSET_CALL(pmd_bad, sun4c_pmd_bad, BTFIXUPCALL_NORM);
2101 BTFIXUPSET_CALL(pmd_present, sun4c_pmd_present, BTFIXUPCALL_NORM);
2102 BTFIXUPSET_CALL(pmd_clear, sun4c_pmd_clear, BTFIXUPCALL_STG0O0);
2103
2104 BTFIXUPSET_CALL(pgd_none, sun4c_pgd_none, BTFIXUPCALL_RETINT(0));
2105 BTFIXUPSET_CALL(pgd_bad, sun4c_pgd_bad, BTFIXUPCALL_RETINT(0));
2106 BTFIXUPSET_CALL(pgd_present, sun4c_pgd_present, BTFIXUPCALL_RETINT(1));
2107 BTFIXUPSET_CALL(pgd_clear, sun4c_pgd_clear, BTFIXUPCALL_NOP);
2108
2109 BTFIXUPSET_CALL(mk_pte, sun4c_mk_pte, BTFIXUPCALL_NORM);
2110 BTFIXUPSET_CALL(mk_pte_phys, sun4c_mk_pte_phys, BTFIXUPCALL_NORM);
2111 BTFIXUPSET_CALL(mk_pte_io, sun4c_mk_pte_io, BTFIXUPCALL_NORM);
2112
2113 BTFIXUPSET_INT(pte_modify_mask, _SUN4C_PAGE_CHG_MASK);
2114 BTFIXUPSET_CALL(pmd_offset, sun4c_pmd_offset, BTFIXUPCALL_NORM);
2115 BTFIXUPSET_CALL(pte_offset_kernel, sun4c_pte_offset_kernel, BTFIXUPCALL_NORM);
2116 BTFIXUPSET_CALL(free_pte_fast, sun4c_free_pte_fast, BTFIXUPCALL_NORM);
2117 BTFIXUPSET_CALL(pte_free, sun4c_pte_free, BTFIXUPCALL_NORM);
2118 BTFIXUPSET_CALL(pte_alloc_one_kernel, sun4c_pte_alloc_one_kernel, BTFIXUPCALL_NORM);
2119 BTFIXUPSET_CALL(pte_alloc_one, sun4c_pte_alloc_one, BTFIXUPCALL_NORM);
2120 BTFIXUPSET_CALL(free_pmd_fast, sun4c_free_pmd_fast, BTFIXUPCALL_NOP);
2121 BTFIXUPSET_CALL(pmd_alloc_one, sun4c_pmd_alloc_one, BTFIXUPCALL_RETO0);
2122 BTFIXUPSET_CALL(free_pgd_fast, sun4c_free_pgd_fast, BTFIXUPCALL_NORM);
2123 BTFIXUPSET_CALL(get_pgd_fast, sun4c_get_pgd_fast, BTFIXUPCALL_NORM);
2124
2125 BTFIXUPSET_HALF(pte_writei, _SUN4C_PAGE_WRITE);
2126 BTFIXUPSET_HALF(pte_dirtyi, _SUN4C_PAGE_MODIFIED);
2127 BTFIXUPSET_HALF(pte_youngi, _SUN4C_PAGE_ACCESSED);
2128 BTFIXUPSET_HALF(pte_filei, _SUN4C_PAGE_FILE);
2129 BTFIXUPSET_HALF(pte_wrprotecti, _SUN4C_PAGE_WRITE|_SUN4C_PAGE_SILENT_WRITE);
2130 BTFIXUPSET_HALF(pte_mkcleani, _SUN4C_PAGE_MODIFIED|_SUN4C_PAGE_SILENT_WRITE);
2131 BTFIXUPSET_HALF(pte_mkoldi, _SUN4C_PAGE_ACCESSED|_SUN4C_PAGE_SILENT_READ);
2132 BTFIXUPSET_CALL(pte_mkwrite, sun4c_pte_mkwrite, BTFIXUPCALL_NORM);
2133 BTFIXUPSET_CALL(pte_mkdirty, sun4c_pte_mkdirty, BTFIXUPCALL_NORM);
2134 BTFIXUPSET_CALL(pte_mkyoung, sun4c_pte_mkyoung, BTFIXUPCALL_NORM);
2135 BTFIXUPSET_CALL(update_mmu_cache, sun4c_update_mmu_cache, BTFIXUPCALL_NORM);
2136
2137 BTFIXUPSET_CALL(pte_to_pgoff, sun4c_pte_to_pgoff, BTFIXUPCALL_NORM);
2138 BTFIXUPSET_CALL(pgoff_to_pte, sun4c_pgoff_to_pte, BTFIXUPCALL_NORM);
2139
2140 BTFIXUPSET_CALL(mmu_lockarea, sun4c_lockarea, BTFIXUPCALL_NORM);
2141 BTFIXUPSET_CALL(mmu_unlockarea, sun4c_unlockarea, BTFIXUPCALL_NORM);
2142
2143 BTFIXUPSET_CALL(mmu_get_scsi_one, sun4c_get_scsi_one, BTFIXUPCALL_NORM);
2144 BTFIXUPSET_CALL(mmu_get_scsi_sgl, sun4c_get_scsi_sgl, BTFIXUPCALL_NORM);
2145 BTFIXUPSET_CALL(mmu_release_scsi_one, sun4c_release_scsi_one, BTFIXUPCALL_NORM);
2146 BTFIXUPSET_CALL(mmu_release_scsi_sgl, sun4c_release_scsi_sgl, BTFIXUPCALL_NORM);
2147
2148 BTFIXUPSET_CALL(mmu_map_dma_area, sun4c_map_dma_area, BTFIXUPCALL_NORM);
2149 BTFIXUPSET_CALL(mmu_unmap_dma_area, sun4c_unmap_dma_area, BTFIXUPCALL_NORM);
2150
2151 BTFIXUPSET_CALL(sparc_mapiorange, sun4c_mapiorange, BTFIXUPCALL_NORM);
2152 BTFIXUPSET_CALL(sparc_unmapiorange, sun4c_unmapiorange, BTFIXUPCALL_NORM);
2153
2154 BTFIXUPSET_CALL(__swp_type, sun4c_swp_type, BTFIXUPCALL_NORM);
2155 BTFIXUPSET_CALL(__swp_offset, sun4c_swp_offset, BTFIXUPCALL_NORM);
2156 BTFIXUPSET_CALL(__swp_entry, sun4c_swp_entry, BTFIXUPCALL_NORM);
2157
2158 BTFIXUPSET_CALL(alloc_thread_info_node, sun4c_alloc_thread_info_node, BTFIXUPCALL_NORM);
2159 BTFIXUPSET_CALL(free_thread_info, sun4c_free_thread_info, BTFIXUPCALL_NORM);
2160
2161 BTFIXUPSET_CALL(mmu_info, sun4c_mmu_info, BTFIXUPCALL_NORM);
2162
2163 /* These should _never_ get called with two level tables. */
2164 BTFIXUPSET_CALL(pgd_set, sun4c_pgd_set, BTFIXUPCALL_NOP);
2165 BTFIXUPSET_CALL(pgd_page_vaddr, sun4c_pgd_page, BTFIXUPCALL_RETO0);
2166}
diff --git a/arch/sparc/mm/ultra.S b/arch/sparc/mm/ultra.S
index b57a5942ba64..874162a11ceb 100644
--- a/arch/sparc/mm/ultra.S
+++ b/arch/sparc/mm/ultra.S
@@ -495,11 +495,11 @@ xcall_fetch_glob_regs:
495 stx %o7, [%g1 + GR_SNAP_O7] 495 stx %o7, [%g1 + GR_SNAP_O7]
496 stx %i7, [%g1 + GR_SNAP_I7] 496 stx %i7, [%g1 + GR_SNAP_I7]
497 /* Don't try this at home kids... */ 497 /* Don't try this at home kids... */
498 rdpr %cwp, %g2 498 rdpr %cwp, %g3
499 sub %g2, 1, %g7 499 sub %g3, 1, %g7
500 wrpr %g7, %cwp 500 wrpr %g7, %cwp
501 mov %i7, %g7 501 mov %i7, %g7
502 wrpr %g2, %cwp 502 wrpr %g3, %cwp
503 stx %g7, [%g1 + GR_SNAP_RPC] 503 stx %g7, [%g1 + GR_SNAP_RPC]
504 sethi %hi(trap_block), %g7 504 sethi %hi(trap_block), %g7
505 or %g7, %lo(trap_block), %g7 505 or %g7, %lo(trap_block), %g7
diff --git a/arch/sparc/mm/viking.S b/arch/sparc/mm/viking.S
index 6dfcc13d3100..bf8ee0613ae7 100644
--- a/arch/sparc/mm/viking.S
+++ b/arch/sparc/mm/viking.S
@@ -14,7 +14,6 @@
14#include <asm/page.h> 14#include <asm/page.h>
15#include <asm/pgtsrmmu.h> 15#include <asm/pgtsrmmu.h>
16#include <asm/viking.h> 16#include <asm/viking.h>
17#include <asm/btfixup.h>
18 17
19#ifdef CONFIG_SMP 18#ifdef CONFIG_SMP
20 .data 19 .data
diff --git a/arch/sparc/net/Makefile b/arch/sparc/net/Makefile
new file mode 100644
index 000000000000..1306a58ac541
--- /dev/null
+++ b/arch/sparc/net/Makefile
@@ -0,0 +1,4 @@
1#
2# Arch-specific network modules
3#
4obj-$(CONFIG_BPF_JIT) += bpf_jit_asm.o bpf_jit_comp.o
diff --git a/arch/sparc/net/bpf_jit.h b/arch/sparc/net/bpf_jit.h
new file mode 100644
index 000000000000..33d6b375ff12
--- /dev/null
+++ b/arch/sparc/net/bpf_jit.h
@@ -0,0 +1,68 @@
1#ifndef _BPF_JIT_H
2#define _BPF_JIT_H
3
4/* Conventions:
5 * %g1 : temporary
6 * %g2 : Secondary temporary used by SKB data helper stubs.
7 * %g3 : packet offset passed into SKB data helper stubs.
8 * %o0 : pointer to skb (first argument given to JIT function)
9 * %o1 : BPF A accumulator
10 * %o2 : BPF X accumulator
11 * %o3 : Holds saved %o7 so we can call helper functions without needing
12 * to allocate a register window.
13 * %o4 : skb->len - skb->data_len
14 * %o5 : skb->data
15 */
16
17#ifndef __ASSEMBLER__
18#define G0 0x00
19#define G1 0x01
20#define G3 0x03
21#define G6 0x06
22#define O0 0x08
23#define O1 0x09
24#define O2 0x0a
25#define O3 0x0b
26#define O4 0x0c
27#define O5 0x0d
28#define SP 0x0e
29#define O7 0x0f
30#define FP 0x1e
31
32#define r_SKB O0
33#define r_A O1
34#define r_X O2
35#define r_saved_O7 O3
36#define r_HEADLEN O4
37#define r_SKB_DATA O5
38#define r_TMP G1
39#define r_TMP2 G2
40#define r_OFF G3
41
42/* assembly code in arch/sparc/net/bpf_jit_asm.S */
43extern u32 bpf_jit_load_word[];
44extern u32 bpf_jit_load_half[];
45extern u32 bpf_jit_load_byte[];
46extern u32 bpf_jit_load_byte_msh[];
47extern u32 bpf_jit_load_word_positive_offset[];
48extern u32 bpf_jit_load_half_positive_offset[];
49extern u32 bpf_jit_load_byte_positive_offset[];
50extern u32 bpf_jit_load_byte_msh_positive_offset[];
51extern u32 bpf_jit_load_word_negative_offset[];
52extern u32 bpf_jit_load_half_negative_offset[];
53extern u32 bpf_jit_load_byte_negative_offset[];
54extern u32 bpf_jit_load_byte_msh_negative_offset[];
55
56#else
57#define r_SKB %o0
58#define r_A %o1
59#define r_X %o2
60#define r_saved_O7 %o3
61#define r_HEADLEN %o4
62#define r_SKB_DATA %o5
63#define r_TMP %g1
64#define r_TMP2 %g2
65#define r_OFF %g3
66#endif
67
68#endif /* _BPF_JIT_H */
diff --git a/arch/sparc/net/bpf_jit_asm.S b/arch/sparc/net/bpf_jit_asm.S
new file mode 100644
index 000000000000..9d016c7017f7
--- /dev/null
+++ b/arch/sparc/net/bpf_jit_asm.S
@@ -0,0 +1,205 @@
1#include <asm/ptrace.h>
2
3#include "bpf_jit.h"
4
5#ifdef CONFIG_SPARC64
6#define SAVE_SZ 176
7#define SCRATCH_OFF STACK_BIAS + 128
8#define BE_PTR(label) be,pn %xcc, label
9#else
10#define SAVE_SZ 96
11#define SCRATCH_OFF 72
12#define BE_PTR(label) be label
13#endif
14
15#define SKF_MAX_NEG_OFF (-0x200000) /* SKF_LL_OFF from filter.h */
16
17 .text
18 .globl bpf_jit_load_word
19bpf_jit_load_word:
20 cmp r_OFF, 0
21 bl bpf_slow_path_word_neg
22 nop
23 .globl bpf_jit_load_word_positive_offset
24bpf_jit_load_word_positive_offset:
25 sub r_HEADLEN, r_OFF, r_TMP
26 cmp r_TMP, 3
27 ble bpf_slow_path_word
28 add r_SKB_DATA, r_OFF, r_TMP
29 andcc r_TMP, 3, %g0
30 bne load_word_unaligned
31 nop
32 retl
33 ld [r_TMP], r_A
34load_word_unaligned:
35 ldub [r_TMP + 0x0], r_OFF
36 ldub [r_TMP + 0x1], r_TMP2
37 sll r_OFF, 8, r_OFF
38 or r_OFF, r_TMP2, r_OFF
39 ldub [r_TMP + 0x2], r_TMP2
40 sll r_OFF, 8, r_OFF
41 or r_OFF, r_TMP2, r_OFF
42 ldub [r_TMP + 0x3], r_TMP2
43 sll r_OFF, 8, r_OFF
44 retl
45 or r_OFF, r_TMP2, r_A
46
47 .globl bpf_jit_load_half
48bpf_jit_load_half:
49 cmp r_OFF, 0
50 bl bpf_slow_path_half_neg
51 nop
52 .globl bpf_jit_load_half_positive_offset
53bpf_jit_load_half_positive_offset:
54 sub r_HEADLEN, r_OFF, r_TMP
55 cmp r_TMP, 1
56 ble bpf_slow_path_half
57 add r_SKB_DATA, r_OFF, r_TMP
58 andcc r_TMP, 1, %g0
59 bne load_half_unaligned
60 nop
61 retl
62 lduh [r_TMP], r_A
63load_half_unaligned:
64 ldub [r_TMP + 0x0], r_OFF
65 ldub [r_TMP + 0x1], r_TMP2
66 sll r_OFF, 8, r_OFF
67 retl
68 or r_OFF, r_TMP2, r_A
69
70 .globl bpf_jit_load_byte
71bpf_jit_load_byte:
72 cmp r_OFF, 0
73 bl bpf_slow_path_byte_neg
74 nop
75 .globl bpf_jit_load_byte_positive_offset
76bpf_jit_load_byte_positive_offset:
77 cmp r_OFF, r_HEADLEN
78 bge bpf_slow_path_byte
79 nop
80 retl
81 ldub [r_SKB_DATA + r_OFF], r_A
82
83 .globl bpf_jit_load_byte_msh
84bpf_jit_load_byte_msh:
85 cmp r_OFF, 0
86 bl bpf_slow_path_byte_msh_neg
87 nop
88 .globl bpf_jit_load_byte_msh_positive_offset
89bpf_jit_load_byte_msh_positive_offset:
90 cmp r_OFF, r_HEADLEN
91 bge bpf_slow_path_byte_msh
92 nop
93 ldub [r_SKB_DATA + r_OFF], r_OFF
94 and r_OFF, 0xf, r_OFF
95 retl
96 sll r_OFF, 2, r_X
97
98#define bpf_slow_path_common(LEN) \
99 save %sp, -SAVE_SZ, %sp; \
100 mov %i0, %o0; \
101 mov r_OFF, %o1; \
102 add %fp, SCRATCH_OFF, %o2; \
103 call skb_copy_bits; \
104 mov (LEN), %o3; \
105 cmp %o0, 0; \
106 restore;
107
108bpf_slow_path_word:
109 bpf_slow_path_common(4)
110 bl bpf_error
111 ld [%sp + SCRATCH_OFF], r_A
112 retl
113 nop
114bpf_slow_path_half:
115 bpf_slow_path_common(2)
116 bl bpf_error
117 lduh [%sp + SCRATCH_OFF], r_A
118 retl
119 nop
120bpf_slow_path_byte:
121 bpf_slow_path_common(1)
122 bl bpf_error
123 ldub [%sp + SCRATCH_OFF], r_A
124 retl
125 nop
126bpf_slow_path_byte_msh:
127 bpf_slow_path_common(1)
128 bl bpf_error
129 ldub [%sp + SCRATCH_OFF], r_A
130 and r_OFF, 0xf, r_OFF
131 retl
132 sll r_OFF, 2, r_X
133
134#define bpf_negative_common(LEN) \
135 save %sp, -SAVE_SZ, %sp; \
136 mov %i0, %o0; \
137 mov r_OFF, %o1; \
138 call bpf_internal_load_pointer_neg_helper; \
139 mov (LEN), %o2; \
140 mov %o0, r_TMP; \
141 cmp %o0, 0; \
142 BE_PTR(bpf_error); \
143 restore;
144
145bpf_slow_path_word_neg:
146 sethi %hi(SKF_MAX_NEG_OFF), r_TMP
147 cmp r_OFF, r_TMP
148 bl bpf_error
149 nop
150 .globl bpf_jit_load_word_negative_offset
151bpf_jit_load_word_negative_offset:
152 bpf_negative_common(4)
153 andcc r_TMP, 3, %g0
154 bne load_word_unaligned
155 nop
156 retl
157 ld [r_TMP], r_A
158
159bpf_slow_path_half_neg:
160 sethi %hi(SKF_MAX_NEG_OFF), r_TMP
161 cmp r_OFF, r_TMP
162 bl bpf_error
163 nop
164 .globl bpf_jit_load_half_negative_offset
165bpf_jit_load_half_negative_offset:
166 bpf_negative_common(2)
167 andcc r_TMP, 1, %g0
168 bne load_half_unaligned
169 nop
170 retl
171 lduh [r_TMP], r_A
172
173bpf_slow_path_byte_neg:
174 sethi %hi(SKF_MAX_NEG_OFF), r_TMP
175 cmp r_OFF, r_TMP
176 bl bpf_error
177 nop
178 .globl bpf_jit_load_byte_negative_offset
179bpf_jit_load_byte_negative_offset:
180 bpf_negative_common(1)
181 retl
182 ldub [r_TMP], r_A
183
184bpf_slow_path_byte_msh_neg:
185 sethi %hi(SKF_MAX_NEG_OFF), r_TMP
186 cmp r_OFF, r_TMP
187 bl bpf_error
188 nop
189 .globl bpf_jit_load_byte_msh_negative_offset
190bpf_jit_load_byte_msh_negative_offset:
191 bpf_negative_common(1)
192 ldub [r_TMP], r_OFF
193 and r_OFF, 0xf, r_OFF
194 retl
195 sll r_OFF, 2, r_X
196
197bpf_error:
198 /* Make the JIT program return zero. The JIT epilogue
199 * stores away the original %o7 into r_saved_O7. The
200 * normal leaf function return is to use "retl" which
201 * would evalute to "jmpl %o7 + 8, %g0" but we want to
202 * use the saved value thus the sequence you see here.
203 */
204 jmpl r_saved_O7 + 8, %g0
205 clr %o0
diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c
new file mode 100644
index 000000000000..1a69244e785b
--- /dev/null
+++ b/arch/sparc/net/bpf_jit_comp.c
@@ -0,0 +1,802 @@
1#include <linux/moduleloader.h>
2#include <linux/workqueue.h>
3#include <linux/netdevice.h>
4#include <linux/filter.h>
5#include <linux/cache.h>
6
7#include <asm/cacheflush.h>
8#include <asm/ptrace.h>
9
10#include "bpf_jit.h"
11
12int bpf_jit_enable __read_mostly;
13
14static inline bool is_simm13(unsigned int value)
15{
16 return value + 0x1000 < 0x2000;
17}
18
19static void bpf_flush_icache(void *start_, void *end_)
20{
21#ifdef CONFIG_SPARC64
22 /* Cheetah's I-cache is fully coherent. */
23 if (tlb_type == spitfire) {
24 unsigned long start = (unsigned long) start_;
25 unsigned long end = (unsigned long) end_;
26
27 start &= ~7UL;
28 end = (end + 7UL) & ~7UL;
29 while (start < end) {
30 flushi(start);
31 start += 32;
32 }
33 }
34#endif
35}
36
37#define SEEN_DATAREF 1 /* might call external helpers */
38#define SEEN_XREG 2 /* ebx is used */
39#define SEEN_MEM 4 /* use mem[] for temporary storage */
40
41#define S13(X) ((X) & 0x1fff)
42#define IMMED 0x00002000
43#define RD(X) ((X) << 25)
44#define RS1(X) ((X) << 14)
45#define RS2(X) ((X))
46#define OP(X) ((X) << 30)
47#define OP2(X) ((X) << 22)
48#define OP3(X) ((X) << 19)
49#define COND(X) ((X) << 25)
50#define F1(X) OP(X)
51#define F2(X, Y) (OP(X) | OP2(Y))
52#define F3(X, Y) (OP(X) | OP3(Y))
53
54#define CONDN COND(0x0)
55#define CONDE COND(0x1)
56#define CONDLE COND(0x2)
57#define CONDL COND(0x3)
58#define CONDLEU COND(0x4)
59#define CONDCS COND(0x5)
60#define CONDNEG COND(0x6)
61#define CONDVC COND(0x7)
62#define CONDA COND(0x8)
63#define CONDNE COND(0x9)
64#define CONDG COND(0xa)
65#define CONDGE COND(0xb)
66#define CONDGU COND(0xc)
67#define CONDCC COND(0xd)
68#define CONDPOS COND(0xe)
69#define CONDVS COND(0xf)
70
71#define CONDGEU CONDCC
72#define CONDLU CONDCS
73
74#define WDISP22(X) (((X) >> 2) & 0x3fffff)
75
76#define BA (F2(0, 2) | CONDA)
77#define BGU (F2(0, 2) | CONDGU)
78#define BLEU (F2(0, 2) | CONDLEU)
79#define BGEU (F2(0, 2) | CONDGEU)
80#define BLU (F2(0, 2) | CONDLU)
81#define BE (F2(0, 2) | CONDE)
82#define BNE (F2(0, 2) | CONDNE)
83
84#ifdef CONFIG_SPARC64
85#define BNE_PTR (F2(0, 1) | CONDNE | (2 << 20))
86#else
87#define BNE_PTR BNE
88#endif
89
90#define SETHI(K, REG) \
91 (F2(0, 0x4) | RD(REG) | (((K) >> 10) & 0x3fffff))
92#define OR_LO(K, REG) \
93 (F3(2, 0x02) | IMMED | RS1(REG) | ((K) & 0x3ff) | RD(REG))
94
95#define ADD F3(2, 0x00)
96#define AND F3(2, 0x01)
97#define ANDCC F3(2, 0x11)
98#define OR F3(2, 0x02)
99#define SUB F3(2, 0x04)
100#define SUBCC F3(2, 0x14)
101#define MUL F3(2, 0x0a) /* umul */
102#define DIV F3(2, 0x0e) /* udiv */
103#define SLL F3(2, 0x25)
104#define SRL F3(2, 0x26)
105#define JMPL F3(2, 0x38)
106#define CALL F1(1)
107#define BR F2(0, 0x01)
108#define RD_Y F3(2, 0x28)
109#define WR_Y F3(2, 0x30)
110
111#define LD32 F3(3, 0x00)
112#define LD8 F3(3, 0x01)
113#define LD16 F3(3, 0x02)
114#define LD64 F3(3, 0x0b)
115#define ST32 F3(3, 0x04)
116
117#ifdef CONFIG_SPARC64
118#define LDPTR LD64
119#define BASE_STACKFRAME 176
120#else
121#define LDPTR LD32
122#define BASE_STACKFRAME 96
123#endif
124
125#define LD32I (LD32 | IMMED)
126#define LD8I (LD8 | IMMED)
127#define LD16I (LD16 | IMMED)
128#define LD64I (LD64 | IMMED)
129#define LDPTRI (LDPTR | IMMED)
130#define ST32I (ST32 | IMMED)
131
132#define emit_nop() \
133do { \
134 *prog++ = SETHI(0, G0); \
135} while (0)
136
137#define emit_neg() \
138do { /* sub %g0, r_A, r_A */ \
139 *prog++ = SUB | RS1(G0) | RS2(r_A) | RD(r_A); \
140} while (0)
141
142#define emit_reg_move(FROM, TO) \
143do { /* or %g0, FROM, TO */ \
144 *prog++ = OR | RS1(G0) | RS2(FROM) | RD(TO); \
145} while (0)
146
147#define emit_clear(REG) \
148do { /* or %g0, %g0, REG */ \
149 *prog++ = OR | RS1(G0) | RS2(G0) | RD(REG); \
150} while (0)
151
152#define emit_set_const(K, REG) \
153do { /* sethi %hi(K), REG */ \
154 *prog++ = SETHI(K, REG); \
155 /* or REG, %lo(K), REG */ \
156 *prog++ = OR_LO(K, REG); \
157} while (0)
158
159 /* Emit
160 *
161 * OP r_A, r_X, r_A
162 */
163#define emit_alu_X(OPCODE) \
164do { \
165 seen |= SEEN_XREG; \
166 *prog++ = OPCODE | RS1(r_A) | RS2(r_X) | RD(r_A); \
167} while (0)
168
169 /* Emit either:
170 *
171 * OP r_A, K, r_A
172 *
173 * or
174 *
175 * sethi %hi(K), r_TMP
176 * or r_TMP, %lo(K), r_TMP
177 * OP r_A, r_TMP, r_A
178 *
179 * depending upon whether K fits in a signed 13-bit
180 * immediate instruction field. Emit nothing if K
181 * is zero.
182 */
183#define emit_alu_K(OPCODE, K) \
184do { \
185 if (K) { \
186 unsigned int _insn = OPCODE; \
187 _insn |= RS1(r_A) | RD(r_A); \
188 if (is_simm13(K)) { \
189 *prog++ = _insn | IMMED | S13(K); \
190 } else { \
191 emit_set_const(K, r_TMP); \
192 *prog++ = _insn | RS2(r_TMP); \
193 } \
194 } \
195} while (0)
196
197#define emit_loadimm(K, DEST) \
198do { \
199 if (is_simm13(K)) { \
200 /* or %g0, K, DEST */ \
201 *prog++ = OR | IMMED | RS1(G0) | S13(K) | RD(DEST); \
202 } else { \
203 emit_set_const(K, DEST); \
204 } \
205} while (0)
206
207#define emit_loadptr(BASE, STRUCT, FIELD, DEST) \
208do { unsigned int _off = offsetof(STRUCT, FIELD); \
209 BUILD_BUG_ON(FIELD_SIZEOF(STRUCT, FIELD) != sizeof(void *)); \
210 *prog++ = LDPTRI | RS1(BASE) | S13(_off) | RD(DEST); \
211} while (0)
212
213#define emit_load32(BASE, STRUCT, FIELD, DEST) \
214do { unsigned int _off = offsetof(STRUCT, FIELD); \
215 BUILD_BUG_ON(FIELD_SIZEOF(STRUCT, FIELD) != sizeof(u32)); \
216 *prog++ = LD32I | RS1(BASE) | S13(_off) | RD(DEST); \
217} while (0)
218
219#define emit_load16(BASE, STRUCT, FIELD, DEST) \
220do { unsigned int _off = offsetof(STRUCT, FIELD); \
221 BUILD_BUG_ON(FIELD_SIZEOF(STRUCT, FIELD) != sizeof(u16)); \
222 *prog++ = LD16I | RS1(BASE) | S13(_off) | RD(DEST); \
223} while (0)
224
225#define __emit_load8(BASE, STRUCT, FIELD, DEST) \
226do { unsigned int _off = offsetof(STRUCT, FIELD); \
227 *prog++ = LD8I | RS1(BASE) | S13(_off) | RD(DEST); \
228} while (0)
229
230#define emit_load8(BASE, STRUCT, FIELD, DEST) \
231do { BUILD_BUG_ON(FIELD_SIZEOF(STRUCT, FIELD) != sizeof(u8)); \
232 __emit_load8(BASE, STRUCT, FIELD, DEST); \
233} while (0)
234
235#define emit_ldmem(OFF, DEST) \
236do { *prog++ = LD32I | RS1(FP) | S13(-(OFF)) | RD(DEST); \
237} while (0)
238
239#define emit_stmem(OFF, SRC) \
240do { *prog++ = LD32I | RS1(FP) | S13(-(OFF)) | RD(SRC); \
241} while (0)
242
243#ifdef CONFIG_SMP
244#ifdef CONFIG_SPARC64
245#define emit_load_cpu(REG) \
246 emit_load16(G6, struct thread_info, cpu, REG)
247#else
248#define emit_load_cpu(REG) \
249 emit_load32(G6, struct thread_info, cpu, REG)
250#endif
251#else
252#define emit_load_cpu(REG) emit_clear(REG)
253#endif
254
255#define emit_skb_loadptr(FIELD, DEST) \
256 emit_loadptr(r_SKB, struct sk_buff, FIELD, DEST)
257#define emit_skb_load32(FIELD, DEST) \
258 emit_load32(r_SKB, struct sk_buff, FIELD, DEST)
259#define emit_skb_load16(FIELD, DEST) \
260 emit_load16(r_SKB, struct sk_buff, FIELD, DEST)
261#define __emit_skb_load8(FIELD, DEST) \
262 __emit_load8(r_SKB, struct sk_buff, FIELD, DEST)
263#define emit_skb_load8(FIELD, DEST) \
264 emit_load8(r_SKB, struct sk_buff, FIELD, DEST)
265
266#define emit_jmpl(BASE, IMM_OFF, LREG) \
267 *prog++ = (JMPL | IMMED | RS1(BASE) | S13(IMM_OFF) | RD(LREG))
268
269#define emit_call(FUNC) \
270do { void *_here = image + addrs[i] - 8; \
271 unsigned int _off = (void *)(FUNC) - _here; \
272 *prog++ = CALL | (((_off) >> 2) & 0x3fffffff); \
273 emit_nop(); \
274} while (0)
275
276#define emit_branch(BR_OPC, DEST) \
277do { unsigned int _here = addrs[i] - 8; \
278 *prog++ = BR_OPC | WDISP22((DEST) - _here); \
279} while (0)
280
281#define emit_branch_off(BR_OPC, OFF) \
282do { *prog++ = BR_OPC | WDISP22(OFF); \
283} while (0)
284
285#define emit_jump(DEST) emit_branch(BA, DEST)
286
287#define emit_read_y(REG) *prog++ = RD_Y | RD(REG)
288#define emit_write_y(REG) *prog++ = WR_Y | IMMED | RS1(REG) | S13(0)
289
290#define emit_cmp(R1, R2) \
291 *prog++ = (SUBCC | RS1(R1) | RS2(R2) | RD(G0))
292
293#define emit_cmpi(R1, IMM) \
294 *prog++ = (SUBCC | IMMED | RS1(R1) | S13(IMM) | RD(G0));
295
296#define emit_btst(R1, R2) \
297 *prog++ = (ANDCC | RS1(R1) | RS2(R2) | RD(G0))
298
299#define emit_btsti(R1, IMM) \
300 *prog++ = (ANDCC | IMMED | RS1(R1) | S13(IMM) | RD(G0));
301
302#define emit_sub(R1, R2, R3) \
303 *prog++ = (SUB | RS1(R1) | RS2(R2) | RD(R3))
304
305#define emit_subi(R1, IMM, R3) \
306 *prog++ = (SUB | IMMED | RS1(R1) | S13(IMM) | RD(R3))
307
308#define emit_add(R1, R2, R3) \
309 *prog++ = (ADD | RS1(R1) | RS2(R2) | RD(R3))
310
311#define emit_addi(R1, IMM, R3) \
312 *prog++ = (ADD | IMMED | RS1(R1) | S13(IMM) | RD(R3))
313
314#define emit_alloc_stack(SZ) \
315 *prog++ = (SUB | IMMED | RS1(SP) | S13(SZ) | RD(SP))
316
317#define emit_release_stack(SZ) \
318 *prog++ = (ADD | IMMED | RS1(SP) | S13(SZ) | RD(SP))
319
320/* A note about branch offset calculations. The addrs[] array,
321 * indexed by BPF instruction, records the address after all the
322 * sparc instructions emitted for that BPF instruction.
323 *
324 * The most common case is to emit a branch at the end of such
325 * a code sequence. So this would be two instructions, the
326 * branch and it's delay slot.
327 *
328 * Therefore by default the branch emitters calculate the branch
329 * offset field as:
330 *
331 * destination - (addrs[i] - 8)
332 *
333 * This "addrs[i] - 8" is the address of the branch itself or
334 * what "." would be in assembler notation. The "8" part is
335 * how we take into consideration the branch and it's delay
336 * slot mentioned above.
337 *
338 * Sometimes we need to emit a branch earlier in the code
339 * sequence. And in these situations we adjust "destination"
340 * to accomodate this difference. For example, if we needed
341 * to emit a branch (and it's delay slot) right before the
342 * final instruction emitted for a BPF opcode, we'd use
343 * "destination + 4" instead of just plain "destination" above.
344 *
345 * This is why you see all of these funny emit_branch() and
346 * emit_jump() calls with adjusted offsets.
347 */
348
349void bpf_jit_compile(struct sk_filter *fp)
350{
351 unsigned int cleanup_addr, proglen, oldproglen = 0;
352 u32 temp[8], *prog, *func, seen = 0, pass;
353 const struct sock_filter *filter = fp->insns;
354 int i, flen = fp->len, pc_ret0 = -1;
355 unsigned int *addrs;
356 void *image;
357
358 if (!bpf_jit_enable)
359 return;
360
361 addrs = kmalloc(flen * sizeof(*addrs), GFP_KERNEL);
362 if (addrs == NULL)
363 return;
364
365 /* Before first pass, make a rough estimation of addrs[]
366 * each bpf instruction is translated to less than 64 bytes
367 */
368 for (proglen = 0, i = 0; i < flen; i++) {
369 proglen += 64;
370 addrs[i] = proglen;
371 }
372 cleanup_addr = proglen; /* epilogue address */
373 image = NULL;
374 for (pass = 0; pass < 10; pass++) {
375 u8 seen_or_pass0 = (pass == 0) ? (SEEN_XREG | SEEN_DATAREF | SEEN_MEM) : seen;
376
377 /* no prologue/epilogue for trivial filters (RET something) */
378 proglen = 0;
379 prog = temp;
380
381 /* Prologue */
382 if (seen_or_pass0) {
383 if (seen_or_pass0 & SEEN_MEM) {
384 unsigned int sz = BASE_STACKFRAME;
385 sz += BPF_MEMWORDS * sizeof(u32);
386 emit_alloc_stack(sz);
387 }
388
389 /* Make sure we dont leek kernel memory. */
390 if (seen_or_pass0 & SEEN_XREG)
391 emit_clear(r_X);
392
393 /* If this filter needs to access skb data,
394 * load %o4 and %o5 with:
395 * %o4 = skb->len - skb->data_len
396 * %o5 = skb->data
397 * And also back up %o7 into r_saved_O7 so we can
398 * invoke the stubs using 'call'.
399 */
400 if (seen_or_pass0 & SEEN_DATAREF) {
401 emit_load32(r_SKB, struct sk_buff, len, r_HEADLEN);
402 emit_load32(r_SKB, struct sk_buff, data_len, r_TMP);
403 emit_sub(r_HEADLEN, r_TMP, r_HEADLEN);
404 emit_loadptr(r_SKB, struct sk_buff, data, r_SKB_DATA);
405 }
406 }
407 emit_reg_move(O7, r_saved_O7);
408
409 switch (filter[0].code) {
410 case BPF_S_RET_K:
411 case BPF_S_LD_W_LEN:
412 case BPF_S_ANC_PROTOCOL:
413 case BPF_S_ANC_PKTTYPE:
414 case BPF_S_ANC_IFINDEX:
415 case BPF_S_ANC_MARK:
416 case BPF_S_ANC_RXHASH:
417 case BPF_S_ANC_CPU:
418 case BPF_S_ANC_QUEUE:
419 case BPF_S_LD_W_ABS:
420 case BPF_S_LD_H_ABS:
421 case BPF_S_LD_B_ABS:
422 /* The first instruction sets the A register (or is
423 * a "RET 'constant'")
424 */
425 break;
426 default:
427 /* Make sure we dont leak kernel information to the
428 * user.
429 */
430 emit_clear(r_A); /* A = 0 */
431 }
432
433 for (i = 0; i < flen; i++) {
434 unsigned int K = filter[i].k;
435 unsigned int t_offset;
436 unsigned int f_offset;
437 u32 t_op, f_op;
438 int ilen;
439
440 switch (filter[i].code) {
441 case BPF_S_ALU_ADD_X: /* A += X; */
442 emit_alu_X(ADD);
443 break;
444 case BPF_S_ALU_ADD_K: /* A += K; */
445 emit_alu_K(ADD, K);
446 break;
447 case BPF_S_ALU_SUB_X: /* A -= X; */
448 emit_alu_X(SUB);
449 break;
450 case BPF_S_ALU_SUB_K: /* A -= K */
451 emit_alu_K(SUB, K);
452 break;
453 case BPF_S_ALU_AND_X: /* A &= X */
454 emit_alu_X(AND);
455 break;
456 case BPF_S_ALU_AND_K: /* A &= K */
457 emit_alu_K(AND, K);
458 break;
459 case BPF_S_ALU_OR_X: /* A |= X */
460 emit_alu_X(OR);
461 break;
462 case BPF_S_ALU_OR_K: /* A |= K */
463 emit_alu_K(OR, K);
464 break;
465 case BPF_S_ALU_LSH_X: /* A <<= X */
466 emit_alu_X(SLL);
467 break;
468 case BPF_S_ALU_LSH_K: /* A <<= K */
469 emit_alu_K(SLL, K);
470 break;
471 case BPF_S_ALU_RSH_X: /* A >>= X */
472 emit_alu_X(SRL);
473 break;
474 case BPF_S_ALU_RSH_K: /* A >>= K */
475 emit_alu_K(SRL, K);
476 break;
477 case BPF_S_ALU_MUL_X: /* A *= X; */
478 emit_alu_X(MUL);
479 break;
480 case BPF_S_ALU_MUL_K: /* A *= K */
481 emit_alu_K(MUL, K);
482 break;
483 case BPF_S_ALU_DIV_K: /* A /= K */
484 emit_alu_K(MUL, K);
485 emit_read_y(r_A);
486 break;
487 case BPF_S_ALU_DIV_X: /* A /= X; */
488 emit_cmpi(r_X, 0);
489 if (pc_ret0 > 0) {
490 t_offset = addrs[pc_ret0 - 1];
491#ifdef CONFIG_SPARC32
492 emit_branch(BE, t_offset + 20);
493#else
494 emit_branch(BE, t_offset + 8);
495#endif
496 emit_nop(); /* delay slot */
497 } else {
498 emit_branch_off(BNE, 16);
499 emit_nop();
500#ifdef CONFIG_SPARC32
501 emit_jump(cleanup_addr + 20);
502#else
503 emit_jump(cleanup_addr + 8);
504#endif
505 emit_clear(r_A);
506 }
507 emit_write_y(G0);
508#ifdef CONFIG_SPARC32
509 /* The Sparc v8 architecture requires
510 * three instructions between a %y
511 * register write and the first use.
512 */
513 emit_nop();
514 emit_nop();
515 emit_nop();
516#endif
517 emit_alu_X(DIV);
518 break;
519 case BPF_S_ALU_NEG:
520 emit_neg();
521 break;
522 case BPF_S_RET_K:
523 if (!K) {
524 if (pc_ret0 == -1)
525 pc_ret0 = i;
526 emit_clear(r_A);
527 } else {
528 emit_loadimm(K, r_A);
529 }
530 /* Fallthrough */
531 case BPF_S_RET_A:
532 if (seen_or_pass0) {
533 if (i != flen - 1) {
534 emit_jump(cleanup_addr);
535 emit_nop();
536 break;
537 }
538 if (seen_or_pass0 & SEEN_MEM) {
539 unsigned int sz = BASE_STACKFRAME;
540 sz += BPF_MEMWORDS * sizeof(u32);
541 emit_release_stack(sz);
542 }
543 }
544 /* jmpl %r_saved_O7 + 8, %g0 */
545 emit_jmpl(r_saved_O7, 8, G0);
546 emit_reg_move(r_A, O0); /* delay slot */
547 break;
548 case BPF_S_MISC_TAX:
549 seen |= SEEN_XREG;
550 emit_reg_move(r_A, r_X);
551 break;
552 case BPF_S_MISC_TXA:
553 seen |= SEEN_XREG;
554 emit_reg_move(r_X, r_A);
555 break;
556 case BPF_S_ANC_CPU:
557 emit_load_cpu(r_A);
558 break;
559 case BPF_S_ANC_PROTOCOL:
560 emit_skb_load16(protocol, r_A);
561 break;
562#if 0
563 /* GCC won't let us take the address of
564 * a bit field even though we very much
565 * know what we are doing here.
566 */
567 case BPF_S_ANC_PKTTYPE:
568 __emit_skb_load8(pkt_type, r_A);
569 emit_alu_K(SRL, 5);
570 break;
571#endif
572 case BPF_S_ANC_IFINDEX:
573 emit_skb_loadptr(dev, r_A);
574 emit_cmpi(r_A, 0);
575 emit_branch(BNE_PTR, cleanup_addr + 4);
576 emit_nop();
577 emit_load32(r_A, struct net_device, ifindex, r_A);
578 break;
579 case BPF_S_ANC_MARK:
580 emit_skb_load32(mark, r_A);
581 break;
582 case BPF_S_ANC_QUEUE:
583 emit_skb_load16(queue_mapping, r_A);
584 break;
585 case BPF_S_ANC_HATYPE:
586 emit_skb_loadptr(dev, r_A);
587 emit_cmpi(r_A, 0);
588 emit_branch(BNE_PTR, cleanup_addr + 4);
589 emit_nop();
590 emit_load16(r_A, struct net_device, type, r_A);
591 break;
592 case BPF_S_ANC_RXHASH:
593 emit_skb_load32(rxhash, r_A);
594 break;
595
596 case BPF_S_LD_IMM:
597 emit_loadimm(K, r_A);
598 break;
599 case BPF_S_LDX_IMM:
600 emit_loadimm(K, r_X);
601 break;
602 case BPF_S_LD_MEM:
603 emit_ldmem(K * 4, r_A);
604 break;
605 case BPF_S_LDX_MEM:
606 emit_ldmem(K * 4, r_X);
607 break;
608 case BPF_S_ST:
609 emit_stmem(K * 4, r_A);
610 break;
611 case BPF_S_STX:
612 emit_stmem(K * 4, r_X);
613 break;
614
615#define CHOOSE_LOAD_FUNC(K, func) \
616 ((int)K < 0 ? ((int)K >= SKF_LL_OFF ? func##_negative_offset : func) : func##_positive_offset)
617
618 case BPF_S_LD_W_ABS:
619 func = CHOOSE_LOAD_FUNC(K, bpf_jit_load_word);
620common_load: seen |= SEEN_DATAREF;
621 emit_loadimm(K, r_OFF);
622 emit_call(func);
623 break;
624 case BPF_S_LD_H_ABS:
625 func = CHOOSE_LOAD_FUNC(K, bpf_jit_load_half);
626 goto common_load;
627 case BPF_S_LD_B_ABS:
628 func = CHOOSE_LOAD_FUNC(K, bpf_jit_load_byte);
629 goto common_load;
630 case BPF_S_LDX_B_MSH:
631 func = CHOOSE_LOAD_FUNC(K, bpf_jit_load_byte_msh);
632 goto common_load;
633 case BPF_S_LD_W_IND:
634 func = bpf_jit_load_word;
635common_load_ind: seen |= SEEN_DATAREF | SEEN_XREG;
636 if (K) {
637 if (is_simm13(K)) {
638 emit_addi(r_X, K, r_OFF);
639 } else {
640 emit_loadimm(K, r_TMP);
641 emit_add(r_X, r_TMP, r_OFF);
642 }
643 } else {
644 emit_reg_move(r_X, r_OFF);
645 }
646 emit_call(func);
647 break;
648 case BPF_S_LD_H_IND:
649 func = bpf_jit_load_half;
650 goto common_load_ind;
651 case BPF_S_LD_B_IND:
652 func = bpf_jit_load_byte;
653 goto common_load_ind;
654 case BPF_S_JMP_JA:
655 emit_jump(addrs[i + K]);
656 emit_nop();
657 break;
658
659#define COND_SEL(CODE, TOP, FOP) \
660 case CODE: \
661 t_op = TOP; \
662 f_op = FOP; \
663 goto cond_branch
664
665 COND_SEL(BPF_S_JMP_JGT_K, BGU, BLEU);
666 COND_SEL(BPF_S_JMP_JGE_K, BGEU, BLU);
667 COND_SEL(BPF_S_JMP_JEQ_K, BE, BNE);
668 COND_SEL(BPF_S_JMP_JSET_K, BNE, BE);
669 COND_SEL(BPF_S_JMP_JGT_X, BGU, BLEU);
670 COND_SEL(BPF_S_JMP_JGE_X, BGEU, BLU);
671 COND_SEL(BPF_S_JMP_JEQ_X, BE, BNE);
672 COND_SEL(BPF_S_JMP_JSET_X, BNE, BE);
673
674cond_branch: f_offset = addrs[i + filter[i].jf];
675 t_offset = addrs[i + filter[i].jt];
676
677 /* same targets, can avoid doing the test :) */
678 if (filter[i].jt == filter[i].jf) {
679 emit_jump(t_offset);
680 emit_nop();
681 break;
682 }
683
684 switch (filter[i].code) {
685 case BPF_S_JMP_JGT_X:
686 case BPF_S_JMP_JGE_X:
687 case BPF_S_JMP_JEQ_X:
688 seen |= SEEN_XREG;
689 emit_cmp(r_A, r_X);
690 break;
691 case BPF_S_JMP_JSET_X:
692 seen |= SEEN_XREG;
693 emit_btst(r_A, r_X);
694 break;
695 case BPF_S_JMP_JEQ_K:
696 case BPF_S_JMP_JGT_K:
697 case BPF_S_JMP_JGE_K:
698 if (is_simm13(K)) {
699 emit_cmpi(r_A, K);
700 } else {
701 emit_loadimm(K, r_TMP);
702 emit_cmp(r_A, r_TMP);
703 }
704 break;
705 case BPF_S_JMP_JSET_K:
706 if (is_simm13(K)) {
707 emit_btsti(r_A, K);
708 } else {
709 emit_loadimm(K, r_TMP);
710 emit_btst(r_A, r_TMP);
711 }
712 break;
713 }
714 if (filter[i].jt != 0) {
715 if (filter[i].jf)
716 t_offset += 8;
717 emit_branch(t_op, t_offset);
718 emit_nop(); /* delay slot */
719 if (filter[i].jf) {
720 emit_jump(f_offset);
721 emit_nop();
722 }
723 break;
724 }
725 emit_branch(f_op, f_offset);
726 emit_nop(); /* delay slot */
727 break;
728
729 default:
730 /* hmm, too complex filter, give up with jit compiler */
731 goto out;
732 }
733 ilen = (void *) prog - (void *) temp;
734 if (image) {
735 if (unlikely(proglen + ilen > oldproglen)) {
736 pr_err("bpb_jit_compile fatal error\n");
737 kfree(addrs);
738 module_free(NULL, image);
739 return;
740 }
741 memcpy(image + proglen, temp, ilen);
742 }
743 proglen += ilen;
744 addrs[i] = proglen;
745 prog = temp;
746 }
747 /* last bpf instruction is always a RET :
748 * use it to give the cleanup instruction(s) addr
749 */
750 cleanup_addr = proglen - 8; /* jmpl; mov r_A,%o0; */
751 if (seen_or_pass0 & SEEN_MEM)
752 cleanup_addr -= 4; /* add %sp, X, %sp; */
753
754 if (image) {
755 if (proglen != oldproglen)
756 pr_err("bpb_jit_compile proglen=%u != oldproglen=%u\n",
757 proglen, oldproglen);
758 break;
759 }
760 if (proglen == oldproglen) {
761 image = module_alloc(max_t(unsigned int,
762 proglen,
763 sizeof(struct work_struct)));
764 if (!image)
765 goto out;
766 }
767 oldproglen = proglen;
768 }
769
770 if (bpf_jit_enable > 1)
771 pr_err("flen=%d proglen=%u pass=%d image=%p\n",
772 flen, proglen, pass, image);
773
774 if (image) {
775 if (bpf_jit_enable > 1)
776 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_ADDRESS,
777 16, 1, image, proglen, false);
778 bpf_flush_icache(image, image + proglen);
779 fp->bpf_func = (void *)image;
780 }
781out:
782 kfree(addrs);
783 return;
784}
785
786static void jit_free_defer(struct work_struct *arg)
787{
788 module_free(NULL, arg);
789}
790
791/* run from softirq, we must use a work_struct to call
792 * module_free() from process context
793 */
794void bpf_jit_free(struct sk_filter *fp)
795{
796 if (fp->bpf_func != sk_run_filter) {
797 struct work_struct *work = (struct work_struct *)fp->bpf_func;
798
799 INIT_WORK(work, jit_free_defer);
800 schedule_work(work);
801 }
802}
diff --git a/arch/sparc/prom/Makefile b/arch/sparc/prom/Makefile
index 8287bbe88768..020300b18c0b 100644
--- a/arch/sparc/prom/Makefile
+++ b/arch/sparc/prom/Makefile
@@ -10,7 +10,6 @@ lib-$(CONFIG_SPARC32) += memory.o
10lib-y += misc_$(BITS).o 10lib-y += misc_$(BITS).o
11lib-$(CONFIG_SPARC32) += mp.o 11lib-$(CONFIG_SPARC32) += mp.o
12lib-$(CONFIG_SPARC32) += ranges.o 12lib-$(CONFIG_SPARC32) += ranges.o
13lib-$(CONFIG_SPARC32) += segment.o
14lib-y += console_$(BITS).o 13lib-y += console_$(BITS).o
15lib-y += printf.o 14lib-y += printf.o
16lib-y += tree_$(BITS).o 15lib-y += tree_$(BITS).o
diff --git a/arch/sparc/prom/segment.c b/arch/sparc/prom/segment.c
deleted file mode 100644
index 86a663f1d3c5..000000000000
--- a/arch/sparc/prom/segment.c
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * segment.c: Prom routine to map segments in other contexts before
3 * a standalone is completely mapped. This is for sun4 and
4 * sun4c architectures only.
5 *
6 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
7 */
8
9#include <linux/types.h>
10#include <linux/kernel.h>
11#include <linux/sched.h>
12#include <asm/openprom.h>
13#include <asm/oplib.h>
14
15extern void restore_current(void);
16
17/* Set physical segment 'segment' at virtual address 'vaddr' in
18 * context 'ctx'.
19 */
20void
21prom_putsegment(int ctx, unsigned long vaddr, int segment)
22{
23 unsigned long flags;
24 spin_lock_irqsave(&prom_lock, flags);
25 (*(romvec->pv_setctxt))(ctx, (char *) vaddr, segment);
26 restore_current();
27 spin_unlock_irqrestore(&prom_lock, flags);
28}
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 96033e2d6845..74239dd77e06 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -11,6 +11,7 @@ config TILE
11 select GENERIC_IRQ_PROBE 11 select GENERIC_IRQ_PROBE
12 select GENERIC_PENDING_IRQ if SMP 12 select GENERIC_PENDING_IRQ if SMP
13 select GENERIC_IRQ_SHOW 13 select GENERIC_IRQ_SHOW
14 select HAVE_SYSCALL_WRAPPERS if TILEGX
14 select SYS_HYPERVISOR 15 select SYS_HYPERVISOR
15 select ARCH_HAVE_NMI_SAFE_CMPXCHG 16 select ARCH_HAVE_NMI_SAFE_CMPXCHG
16 17
diff --git a/arch/tile/include/asm/pci.h b/arch/tile/include/asm/pci.h
index 5d5a635530bd..32e6cbe8dff3 100644
--- a/arch/tile/include/asm/pci.h
+++ b/arch/tile/include/asm/pci.h
@@ -47,8 +47,8 @@ struct pci_controller {
47 */ 47 */
48#define PCI_DMA_BUS_IS_PHYS 1 48#define PCI_DMA_BUS_IS_PHYS 1
49 49
50int __devinit tile_pci_init(void); 50int __init tile_pci_init(void);
51int __devinit pcibios_init(void); 51int __init pcibios_init(void);
52 52
53static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) {} 53static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) {}
54 54
diff --git a/arch/tile/include/asm/thread_info.h b/arch/tile/include/asm/thread_info.h
index bc4f562bd459..656c486e64fa 100644
--- a/arch/tile/include/asm/thread_info.h
+++ b/arch/tile/include/asm/thread_info.h
@@ -77,16 +77,14 @@ struct thread_info {
77 77
78#ifndef __ASSEMBLY__ 78#ifndef __ASSEMBLY__
79 79
80void arch_release_thread_info(struct thread_info *info);
81
80/* How to get the thread information struct from C. */ 82/* How to get the thread information struct from C. */
81register unsigned long stack_pointer __asm__("sp"); 83register unsigned long stack_pointer __asm__("sp");
82 84
83#define current_thread_info() \ 85#define current_thread_info() \
84 ((struct thread_info *)(stack_pointer & -THREAD_SIZE)) 86 ((struct thread_info *)(stack_pointer & -THREAD_SIZE))
85 87
86#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
87extern struct thread_info *alloc_thread_info_node(struct task_struct *task, int node);
88extern void free_thread_info(struct thread_info *info);
89
90/* Sit on a nap instruction until interrupted. */ 88/* Sit on a nap instruction until interrupted. */
91extern void smp_nap(void); 89extern void smp_nap(void);
92 90
@@ -100,9 +98,14 @@ extern void cpu_idle_on_new_stack(struct thread_info *old_ti,
100 98
101#else /* __ASSEMBLY__ */ 99#else /* __ASSEMBLY__ */
102 100
103/* how to get the thread information struct from ASM */ 101/*
102 * How to get the thread information struct from assembly.
103 * Note that we use different macros since different architectures
104 * have different semantics in their "mm" instruction and we would
105 * like to guarantee that the macro expands to exactly one instruction.
106 */
104#ifdef __tilegx__ 107#ifdef __tilegx__
105#define GET_THREAD_INFO(reg) move reg, sp; mm reg, zero, LOG2_THREAD_SIZE, 63 108#define EXTRACT_THREAD_INFO(reg) mm reg, zero, LOG2_THREAD_SIZE, 63
106#else 109#else
107#define GET_THREAD_INFO(reg) mm reg, sp, zero, LOG2_THREAD_SIZE, 31 110#define GET_THREAD_INFO(reg) mm reg, sp, zero, LOG2_THREAD_SIZE, 31
108#endif 111#endif
diff --git a/arch/tile/include/asm/topology.h b/arch/tile/include/asm/topology.h
index 6fdd0c860193..7a7ce390534f 100644
--- a/arch/tile/include/asm/topology.h
+++ b/arch/tile/include/asm/topology.h
@@ -78,32 +78,6 @@ static inline const struct cpumask *cpumask_of_node(int node)
78 .balance_interval = 32, \ 78 .balance_interval = 32, \
79} 79}
80 80
81/* sched_domains SD_NODE_INIT for TILE architecture */
82#define SD_NODE_INIT (struct sched_domain) { \
83 .min_interval = 16, \
84 .max_interval = 512, \
85 .busy_factor = 32, \
86 .imbalance_pct = 125, \
87 .cache_nice_tries = 1, \
88 .busy_idx = 3, \
89 .idle_idx = 1, \
90 .newidle_idx = 2, \
91 .wake_idx = 1, \
92 .flags = 1*SD_LOAD_BALANCE \
93 | 1*SD_BALANCE_NEWIDLE \
94 | 1*SD_BALANCE_EXEC \
95 | 1*SD_BALANCE_FORK \
96 | 0*SD_BALANCE_WAKE \
97 | 0*SD_WAKE_AFFINE \
98 | 0*SD_PREFER_LOCAL \
99 | 0*SD_SHARE_CPUPOWER \
100 | 0*SD_SHARE_PKG_RESOURCES \
101 | 1*SD_SERIALIZE \
102 , \
103 .last_balance = jiffies, \
104 .balance_interval = 128, \
105}
106
107/* By definition, we create nodes based on online memory. */ 81/* By definition, we create nodes based on online memory. */
108#define node_has_online_mem(nid) 1 82#define node_has_online_mem(nid) 1
109 83
diff --git a/arch/tile/kernel/Makefile b/arch/tile/kernel/Makefile
index b4dbc057baad..0d826faf8f35 100644
--- a/arch/tile/kernel/Makefile
+++ b/arch/tile/kernel/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5extra-y := vmlinux.lds head_$(BITS).o 5extra-y := vmlinux.lds head_$(BITS).o
6obj-y := backtrace.o entry.o init_task.o irq.o messaging.o \ 6obj-y := backtrace.o entry.o irq.o messaging.o \
7 pci-dma.o proc.o process.o ptrace.o reboot.o \ 7 pci-dma.o proc.o process.o ptrace.o reboot.o \
8 setup.o signal.o single_step.o stack.o sys.o sysfs.o time.o traps.o \ 8 setup.o signal.o single_step.o stack.o sys.o sysfs.o time.o traps.o \
9 intvec_$(BITS).o regs_$(BITS).o tile-desc_$(BITS).o 9 intvec_$(BITS).o regs_$(BITS).o tile-desc_$(BITS).o
diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c
index 77763ccd5a7d..cdef6e5ec022 100644
--- a/arch/tile/kernel/compat_signal.c
+++ b/arch/tile/kernel/compat_signal.c
@@ -403,19 +403,17 @@ int compat_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
403 * Set up registers for signal handler. 403 * Set up registers for signal handler.
404 * Registers that we don't modify keep the value they had from 404 * Registers that we don't modify keep the value they had from
405 * user-space at the time we took the signal. 405 * user-space at the time we took the signal.
406 * We always pass siginfo and mcontext, regardless of SA_SIGINFO,
407 * since some things rely on this (e.g. glibc's debug/segfault.c).
406 */ 408 */
407 regs->pc = ptr_to_compat_reg(ka->sa.sa_handler); 409 regs->pc = ptr_to_compat_reg(ka->sa.sa_handler);
408 regs->ex1 = PL_ICS_EX1(USER_PL, 1); /* set crit sec in handler */ 410 regs->ex1 = PL_ICS_EX1(USER_PL, 1); /* set crit sec in handler */
409 regs->sp = ptr_to_compat_reg(frame); 411 regs->sp = ptr_to_compat_reg(frame);
410 regs->lr = restorer; 412 regs->lr = restorer;
411 regs->regs[0] = (unsigned long) usig; 413 regs->regs[0] = (unsigned long) usig;
412 414 regs->regs[1] = ptr_to_compat_reg(&frame->info);
413 if (ka->sa.sa_flags & SA_SIGINFO) { 415 regs->regs[2] = ptr_to_compat_reg(&frame->uc);
414 /* Need extra arguments, so mark to restore caller-saves. */ 416 regs->flags |= PT_FLAGS_CALLER_SAVES;
415 regs->regs[1] = ptr_to_compat_reg(&frame->info);
416 regs->regs[2] = ptr_to_compat_reg(&frame->uc);
417 regs->flags |= PT_FLAGS_CALLER_SAVES;
418 }
419 417
420 /* 418 /*
421 * Notify any tracer that was single-stepping it. 419 * Notify any tracer that was single-stepping it.
diff --git a/arch/tile/kernel/init_task.c b/arch/tile/kernel/init_task.c
deleted file mode 100644
index 928b31870669..000000000000
--- a/arch/tile/kernel/init_task.c
+++ /dev/null
@@ -1,59 +0,0 @@
1/*
2 * Copyright 2010 Tilera Corporation. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation, version 2.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11 * NON INFRINGEMENT. See the GNU General Public License for
12 * more details.
13 */
14
15#include <linux/mm.h>
16#include <linux/fs.h>
17#include <linux/init_task.h>
18#include <linux/mqueue.h>
19#include <linux/module.h>
20#include <linux/start_kernel.h>
21#include <linux/uaccess.h>
22
23static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
24static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
25
26/*
27 * Initial thread structure.
28 *
29 * We need to make sure that this is THREAD_SIZE aligned due to the
30 * way process stacks are handled. This is done by having a special
31 * "init_task" linker map entry..
32 */
33union thread_union init_thread_union __init_task_data = {
34 INIT_THREAD_INFO(init_task)
35};
36
37/*
38 * Initial task structure.
39 *
40 * All other task structs will be allocated on slabs in fork.c
41 */
42struct task_struct init_task = INIT_TASK(init_task);
43EXPORT_SYMBOL(init_task);
44
45/*
46 * per-CPU stack and boot info.
47 */
48DEFINE_PER_CPU(unsigned long, boot_sp) =
49 (unsigned long)init_stack + THREAD_SIZE;
50
51#ifdef CONFIG_SMP
52DEFINE_PER_CPU(unsigned long, boot_pc) = (unsigned long)start_kernel;
53#else
54/*
55 * The variable must be __initdata since it references __init code.
56 * With CONFIG_SMP it is per-cpu data, which is exempt from validation.
57 */
58unsigned long __initdata boot_pc = (unsigned long)start_kernel;
59#endif
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S
index 5d56a1ef5ba5..6943515100f8 100644
--- a/arch/tile/kernel/intvec_32.S
+++ b/arch/tile/kernel/intvec_32.S
@@ -839,6 +839,18 @@ STD_ENTRY(interrupt_return)
839 FEEDBACK_REENTER(interrupt_return) 839 FEEDBACK_REENTER(interrupt_return)
840 840
841 /* 841 /*
842 * Use r33 to hold whether we have already loaded the callee-saves
843 * into ptregs. We don't want to do it twice in this loop, since
844 * then we'd clobber whatever changes are made by ptrace, etc.
845 * Get base of stack in r32.
846 */
847 {
848 GET_THREAD_INFO(r32)
849 movei r33, 0
850 }
851
852.Lretry_work_pending:
853 /*
842 * Disable interrupts so as to make sure we don't 854 * Disable interrupts so as to make sure we don't
843 * miss an interrupt that sets any of the thread flags (like 855 * miss an interrupt that sets any of the thread flags (like
844 * need_resched or sigpending) between sampling and the iret. 856 * need_resched or sigpending) between sampling and the iret.
@@ -848,9 +860,6 @@ STD_ENTRY(interrupt_return)
848 IRQ_DISABLE(r20, r21) 860 IRQ_DISABLE(r20, r21)
849 TRACE_IRQS_OFF /* Note: clobbers registers r0-r29 */ 861 TRACE_IRQS_OFF /* Note: clobbers registers r0-r29 */
850 862
851 /* Get base of stack in r32; note r30/31 are used as arguments here. */
852 GET_THREAD_INFO(r32)
853
854 863
855 /* Check to see if there is any work to do before returning to user. */ 864 /* Check to see if there is any work to do before returning to user. */
856 { 865 {
@@ -866,16 +875,18 @@ STD_ENTRY(interrupt_return)
866 875
867 /* 876 /*
868 * Make sure we have all the registers saved for signal 877 * Make sure we have all the registers saved for signal
869 * handling or single-step. Call out to C code to figure out 878 * handling, notify-resume, or single-step. Call out to C
870 * exactly what we need to do for each flag bit, then if 879 * code to figure out exactly what we need to do for each flag bit,
871 * necessary, reload the flags and recheck. 880 * then if necessary, reload the flags and recheck.
872 */ 881 */
873 push_extra_callee_saves r0
874 { 882 {
875 PTREGS_PTR(r0, PTREGS_OFFSET_BASE) 883 PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
876 jal do_work_pending 884 bnz r33, 1f
877 } 885 }
878 bnz r0, .Lresume_userspace 886 push_extra_callee_saves r0
887 movei r33, 1
8881: jal do_work_pending
889 bnz r0, .Lretry_work_pending
879 890
880 /* 891 /*
881 * In the NMI case we 892 * In the NMI case we
@@ -1180,10 +1191,12 @@ handle_syscall:
1180 add r20, r20, tp 1191 add r20, r20, tp
1181 lw r21, r20 1192 lw r21, r20
1182 addi r21, r21, 1 1193 addi r21, r21, 1
1183 sw r20, r21 1194 {
1195 sw r20, r21
1196 GET_THREAD_INFO(r31)
1197 }
1184 1198
1185 /* Trace syscalls, if requested. */ 1199 /* Trace syscalls, if requested. */
1186 GET_THREAD_INFO(r31)
1187 addi r31, r31, THREAD_INFO_FLAGS_OFFSET 1200 addi r31, r31, THREAD_INFO_FLAGS_OFFSET
1188 lw r30, r31 1201 lw r30, r31
1189 andi r30, r30, _TIF_SYSCALL_TRACE 1202 andi r30, r30, _TIF_SYSCALL_TRACE
@@ -1362,7 +1375,10 @@ handle_ill:
13623: 13753:
1363 /* set PC and continue */ 1376 /* set PC and continue */
1364 lw r26, r24 1377 lw r26, r24
1365 sw r28, r26 1378 {
1379 sw r28, r26
1380 GET_THREAD_INFO(r0)
1381 }
1366 1382
1367 /* 1383 /*
1368 * Clear TIF_SINGLESTEP to prevent recursion if we execute an ill. 1384 * Clear TIF_SINGLESTEP to prevent recursion if we execute an ill.
@@ -1370,7 +1386,6 @@ handle_ill:
1370 * need to clear it here and can't really impose on all other arches. 1386 * need to clear it here and can't really impose on all other arches.
1371 * So what's another write between friends? 1387 * So what's another write between friends?
1372 */ 1388 */
1373 GET_THREAD_INFO(r0)
1374 1389
1375 addi r1, r0, THREAD_INFO_FLAGS_OFFSET 1390 addi r1, r0, THREAD_INFO_FLAGS_OFFSET
1376 { 1391 {
diff --git a/arch/tile/kernel/intvec_64.S b/arch/tile/kernel/intvec_64.S
index 49d9d6621682..30ae76e50c44 100644
--- a/arch/tile/kernel/intvec_64.S
+++ b/arch/tile/kernel/intvec_64.S
@@ -647,6 +647,20 @@ STD_ENTRY(interrupt_return)
647 FEEDBACK_REENTER(interrupt_return) 647 FEEDBACK_REENTER(interrupt_return)
648 648
649 /* 649 /*
650 * Use r33 to hold whether we have already loaded the callee-saves
651 * into ptregs. We don't want to do it twice in this loop, since
652 * then we'd clobber whatever changes are made by ptrace, etc.
653 */
654 {
655 movei r33, 0
656 move r32, sp
657 }
658
659 /* Get base of stack in r32. */
660 EXTRACT_THREAD_INFO(r32)
661
662.Lretry_work_pending:
663 /*
650 * Disable interrupts so as to make sure we don't 664 * Disable interrupts so as to make sure we don't
651 * miss an interrupt that sets any of the thread flags (like 665 * miss an interrupt that sets any of the thread flags (like
652 * need_resched or sigpending) between sampling and the iret. 666 * need_resched or sigpending) between sampling and the iret.
@@ -656,9 +670,6 @@ STD_ENTRY(interrupt_return)
656 IRQ_DISABLE(r20, r21) 670 IRQ_DISABLE(r20, r21)
657 TRACE_IRQS_OFF /* Note: clobbers registers r0-r29 */ 671 TRACE_IRQS_OFF /* Note: clobbers registers r0-r29 */
658 672
659 /* Get base of stack in r32; note r30/31 are used as arguments here. */
660 GET_THREAD_INFO(r32)
661
662 673
663 /* Check to see if there is any work to do before returning to user. */ 674 /* Check to see if there is any work to do before returning to user. */
664 { 675 {
@@ -674,16 +685,18 @@ STD_ENTRY(interrupt_return)
674 685
675 /* 686 /*
676 * Make sure we have all the registers saved for signal 687 * Make sure we have all the registers saved for signal
677 * handling or single-step. Call out to C code to figure out 688 * handling or notify-resume. Call out to C code to figure out
678 * exactly what we need to do for each flag bit, then if 689 * exactly what we need to do for each flag bit, then if
679 * necessary, reload the flags and recheck. 690 * necessary, reload the flags and recheck.
680 */ 691 */
681 push_extra_callee_saves r0
682 { 692 {
683 PTREGS_PTR(r0, PTREGS_OFFSET_BASE) 693 PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
684 jal do_work_pending 694 bnez r33, 1f
685 } 695 }
686 bnez r0, .Lresume_userspace 696 push_extra_callee_saves r0
697 movei r33, 1
6981: jal do_work_pending
699 bnez r0, .Lretry_work_pending
687 700
688 /* 701 /*
689 * In the NMI case we 702 * In the NMI case we
@@ -968,11 +981,16 @@ handle_syscall:
968 shl16insli r20, r20, hw0(irq_stat + IRQ_CPUSTAT_SYSCALL_COUNT_OFFSET) 981 shl16insli r20, r20, hw0(irq_stat + IRQ_CPUSTAT_SYSCALL_COUNT_OFFSET)
969 add r20, r20, tp 982 add r20, r20, tp
970 ld4s r21, r20 983 ld4s r21, r20
971 addi r21, r21, 1 984 {
972 st4 r20, r21 985 addi r21, r21, 1
986 move r31, sp
987 }
988 {
989 st4 r20, r21
990 EXTRACT_THREAD_INFO(r31)
991 }
973 992
974 /* Trace syscalls, if requested. */ 993 /* Trace syscalls, if requested. */
975 GET_THREAD_INFO(r31)
976 addi r31, r31, THREAD_INFO_FLAGS_OFFSET 994 addi r31, r31, THREAD_INFO_FLAGS_OFFSET
977 ld r30, r31 995 ld r30, r31
978 andi r30, r30, _TIF_SYSCALL_TRACE 996 andi r30, r30, _TIF_SYSCALL_TRACE
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index a1bb59eecc18..b56d12bf5900 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -141,7 +141,7 @@ static int __devinit tile_init_irqs(int controller_id,
141 * 141 *
142 * Returns the number of controllers discovered. 142 * Returns the number of controllers discovered.
143 */ 143 */
144int __devinit tile_pci_init(void) 144int __init tile_pci_init(void)
145{ 145{
146 int i; 146 int i;
147 147
@@ -287,7 +287,7 @@ static void __devinit fixup_read_and_payload_sizes(void)
287 * The controllers have been set up by the time we get here, by a call to 287 * The controllers have been set up by the time we get here, by a call to
288 * tile_pci_init. 288 * tile_pci_init.
289 */ 289 */
290int __devinit pcibios_init(void) 290int __init pcibios_init(void)
291{ 291{
292 int i; 292 int i;
293 293
diff --git a/arch/tile/kernel/proc.c b/arch/tile/kernel/proc.c
index 7a9327046404..446a7f52cc11 100644
--- a/arch/tile/kernel/proc.c
+++ b/arch/tile/kernel/proc.c
@@ -146,7 +146,6 @@ static ctl_table unaligned_table[] = {
146 }, 146 },
147 {} 147 {}
148}; 148};
149#endif
150 149
151static struct ctl_path tile_path[] = { 150static struct ctl_path tile_path[] = {
152 { .procname = "tile" }, 151 { .procname = "tile" },
@@ -155,10 +154,9 @@ static struct ctl_path tile_path[] = {
155 154
156static int __init proc_sys_tile_init(void) 155static int __init proc_sys_tile_init(void)
157{ 156{
158#ifndef __tilegx__ /* FIXME: GX: no support for unaligned access yet */
159 register_sysctl_paths(tile_path, unaligned_table); 157 register_sysctl_paths(tile_path, unaligned_table);
160#endif
161 return 0; 158 return 0;
162} 159}
163 160
164arch_initcall(proc_sys_tile_init); 161arch_initcall(proc_sys_tile_init);
162#endif
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c
index 2d5ef617bb39..f572c19c4082 100644
--- a/arch/tile/kernel/process.c
+++ b/arch/tile/kernel/process.c
@@ -114,27 +114,10 @@ void cpu_idle(void)
114 } 114 }
115} 115}
116 116
117struct thread_info *alloc_thread_info_node(struct task_struct *task, int node)
118{
119 struct page *page;
120 gfp_t flags = GFP_KERNEL;
121
122#ifdef CONFIG_DEBUG_STACK_USAGE
123 flags |= __GFP_ZERO;
124#endif
125
126 page = alloc_pages_node(node, flags, THREAD_SIZE_ORDER);
127 if (!page)
128 return NULL;
129
130 return (struct thread_info *)page_address(page);
131}
132
133/* 117/*
134 * Free a thread_info node, and all of its derivative 118 * Release a thread_info structure
135 * data structures.
136 */ 119 */
137void free_thread_info(struct thread_info *info) 120void arch_release_thread_info(struct thread_info *info)
138{ 121{
139 struct single_step_state *step_state = info->step_state; 122 struct single_step_state *step_state = info->step_state;
140 123
@@ -169,8 +152,6 @@ void free_thread_info(struct thread_info *info)
169 */ 152 */
170 kfree(step_state); 153 kfree(step_state);
171 } 154 }
172
173 free_pages((unsigned long)info, THREAD_SIZE_ORDER);
174} 155}
175 156
176static void save_arch_state(struct thread_struct *t); 157static void save_arch_state(struct thread_struct *t);
@@ -567,6 +548,10 @@ struct task_struct *__sched _switch_to(struct task_struct *prev,
567 */ 548 */
568int do_work_pending(struct pt_regs *regs, u32 thread_info_flags) 549int do_work_pending(struct pt_regs *regs, u32 thread_info_flags)
569{ 550{
551 /* If we enter in kernel mode, do nothing and exit the caller loop. */
552 if (!user_mode(regs))
553 return 0;
554
570 if (thread_info_flags & _TIF_NEED_RESCHED) { 555 if (thread_info_flags & _TIF_NEED_RESCHED) {
571 schedule(); 556 schedule();
572 return 1; 557 return 1;
@@ -589,8 +574,7 @@ int do_work_pending(struct pt_regs *regs, u32 thread_info_flags)
589 return 1; 574 return 1;
590 } 575 }
591 if (thread_info_flags & _TIF_SINGLESTEP) { 576 if (thread_info_flags & _TIF_SINGLESTEP) {
592 if ((regs->ex1 & SPR_EX_CONTEXT_1_1__PL_MASK) == 0) 577 single_step_once(regs);
593 single_step_once(regs);
594 return 0; 578 return 0;
595 } 579 }
596 panic("work_pending: bad flags %#x\n", thread_info_flags); 580 panic("work_pending: bad flags %#x\n", thread_info_flags);
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c
index bff23f476110..98d80eb49ddb 100644
--- a/arch/tile/kernel/setup.c
+++ b/arch/tile/kernel/setup.c
@@ -61,6 +61,22 @@ unsigned long __initdata node_free_pfn[MAX_NUMNODES];
61 61
62static unsigned long __initdata node_percpu[MAX_NUMNODES]; 62static unsigned long __initdata node_percpu[MAX_NUMNODES];
63 63
64/*
65 * per-CPU stack and boot info.
66 */
67DEFINE_PER_CPU(unsigned long, boot_sp) =
68 (unsigned long)init_stack + THREAD_SIZE;
69
70#ifdef CONFIG_SMP
71DEFINE_PER_CPU(unsigned long, boot_pc) = (unsigned long)start_kernel;
72#else
73/*
74 * The variable must be __initdata since it references __init code.
75 * With CONFIG_SMP it is per-cpu data, which is exempt from validation.
76 */
77unsigned long __initdata boot_pc = (unsigned long)start_kernel;
78#endif
79
64#ifdef CONFIG_HIGHMEM 80#ifdef CONFIG_HIGHMEM
65/* Page frame index of end of lowmem on each controller. */ 81/* Page frame index of end of lowmem on each controller. */
66unsigned long __cpuinitdata node_lowmem_end_pfn[MAX_NUMNODES]; 82unsigned long __cpuinitdata node_lowmem_end_pfn[MAX_NUMNODES];
diff --git a/arch/tile/kernel/single_step.c b/arch/tile/kernel/single_step.c
index 9efbc1391b3c..89529c9f0605 100644
--- a/arch/tile/kernel/single_step.c
+++ b/arch/tile/kernel/single_step.c
@@ -346,12 +346,10 @@ void single_step_once(struct pt_regs *regs)
346 } 346 }
347 347
348 /* allocate a cache line of writable, executable memory */ 348 /* allocate a cache line of writable, executable memory */
349 down_write(&current->mm->mmap_sem); 349 buffer = (void __user *) vm_mmap(NULL, 0, 64,
350 buffer = (void __user *) do_mmap(NULL, 0, 64,
351 PROT_EXEC | PROT_READ | PROT_WRITE, 350 PROT_EXEC | PROT_READ | PROT_WRITE,
352 MAP_PRIVATE | MAP_ANONYMOUS, 351 MAP_PRIVATE | MAP_ANONYMOUS,
353 0); 352 0);
354 up_write(&current->mm->mmap_sem);
355 353
356 if (IS_ERR((void __force *)buffer)) { 354 if (IS_ERR((void __force *)buffer)) {
357 kfree(state); 355 kfree(state);
diff --git a/arch/tile/kernel/smpboot.c b/arch/tile/kernel/smpboot.c
index b949edcec200..84873fbe8f27 100644
--- a/arch/tile/kernel/smpboot.c
+++ b/arch/tile/kernel/smpboot.c
@@ -196,6 +196,8 @@ void __cpuinit online_secondary(void)
196 /* This must be done before setting cpu_online_mask */ 196 /* This must be done before setting cpu_online_mask */
197 wmb(); 197 wmb();
198 198
199 notify_cpu_starting(smp_processor_id());
200
199 /* 201 /*
200 * We need to hold call_lock, so there is no inconsistency 202 * We need to hold call_lock, so there is no inconsistency
201 * between the time smp_call_function() determines number of 203 * between the time smp_call_function() determines number of
@@ -220,7 +222,7 @@ void __cpuinit online_secondary(void)
220 cpu_idle(); 222 cpu_idle();
221} 223}
222 224
223int __cpuinit __cpu_up(unsigned int cpu) 225int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
224{ 226{
225 /* Wait 5s total for all CPUs for them to come online */ 227 /* Wait 5s total for all CPUs for them to come online */
226 static int timeout; 228 static int timeout;
diff --git a/arch/um/drivers/cow.h b/arch/um/drivers/cow.h
index dc36b222100b..6673508f3426 100644
--- a/arch/um/drivers/cow.h
+++ b/arch/um/drivers/cow.h
@@ -3,41 +3,6 @@
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5 5
6#if defined(__KERNEL__)
7
8# include <asm/byteorder.h>
9
10# if defined(__BIG_ENDIAN)
11# define ntohll(x) (x)
12# define htonll(x) (x)
13# elif defined(__LITTLE_ENDIAN)
14# define ntohll(x) be64_to_cpu(x)
15# define htonll(x) cpu_to_be64(x)
16# else
17# error "Could not determine byte order"
18# endif
19
20#else
21/* For the definition of ntohl, htonl and __BYTE_ORDER */
22#include <endian.h>
23#include <netinet/in.h>
24#if defined(__BYTE_ORDER)
25
26# if __BYTE_ORDER == __BIG_ENDIAN
27# define ntohll(x) (x)
28# define htonll(x) (x)
29# elif __BYTE_ORDER == __LITTLE_ENDIAN
30# define ntohll(x) bswap_64(x)
31# define htonll(x) bswap_64(x)
32# else
33# error "Could not determine byte order: __BYTE_ORDER uncorrectly defined"
34# endif
35
36#else /* ! defined(__BYTE_ORDER) */
37# error "Could not determine byte order: __BYTE_ORDER not defined"
38#endif
39#endif /* ! defined(__KERNEL__) */
40
41extern int init_cow_file(int fd, char *cow_file, char *backing_file, 6extern int init_cow_file(int fd, char *cow_file, char *backing_file,
42 int sectorsize, int alignment, int *bitmap_offset_out, 7 int sectorsize, int alignment, int *bitmap_offset_out,
43 unsigned long *bitmap_len_out, int *data_offset_out); 8 unsigned long *bitmap_len_out, int *data_offset_out);
diff --git a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c
index 9cbb426c0b91..0ee9cc6cc4c7 100644
--- a/arch/um/drivers/cow_user.c
+++ b/arch/um/drivers/cow_user.c
@@ -8,11 +8,10 @@
8 * that. 8 * that.
9 */ 9 */
10#include <unistd.h> 10#include <unistd.h>
11#include <byteswap.h>
12#include <errno.h> 11#include <errno.h>
13#include <string.h> 12#include <string.h>
14#include <arpa/inet.h> 13#include <arpa/inet.h>
15#include <asm/types.h> 14#include <endian.h>
16#include "cow.h" 15#include "cow.h"
17#include "cow_sys.h" 16#include "cow_sys.h"
18 17
@@ -214,8 +213,8 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
214 "header\n"); 213 "header\n");
215 goto out; 214 goto out;
216 } 215 }
217 header->magic = htonl(COW_MAGIC); 216 header->magic = htobe32(COW_MAGIC);
218 header->version = htonl(COW_VERSION); 217 header->version = htobe32(COW_VERSION);
219 218
220 err = -EINVAL; 219 err = -EINVAL;
221 if (strlen(backing_file) > sizeof(header->backing_file) - 1) { 220 if (strlen(backing_file) > sizeof(header->backing_file) - 1) {
@@ -246,10 +245,10 @@ int write_cow_header(char *cow_file, int fd, char *backing_file,
246 goto out_free; 245 goto out_free;
247 } 246 }
248 247
249 header->mtime = htonl(modtime); 248 header->mtime = htobe32(modtime);
250 header->size = htonll(*size); 249 header->size = htobe64(*size);
251 header->sectorsize = htonl(sectorsize); 250 header->sectorsize = htobe32(sectorsize);
252 header->alignment = htonl(alignment); 251 header->alignment = htobe32(alignment);
253 header->cow_format = COW_BITMAP; 252 header->cow_format = COW_BITMAP;
254 253
255 err = cow_write_file(fd, header, sizeof(*header)); 254 err = cow_write_file(fd, header, sizeof(*header));
@@ -301,8 +300,8 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
301 magic = header->v1.magic; 300 magic = header->v1.magic;
302 if (magic == COW_MAGIC) 301 if (magic == COW_MAGIC)
303 version = header->v1.version; 302 version = header->v1.version;
304 else if (magic == ntohl(COW_MAGIC)) 303 else if (magic == be32toh(COW_MAGIC))
305 version = ntohl(header->v1.version); 304 version = be32toh(header->v1.version);
306 /* No error printed because the non-COW case comes through here */ 305 /* No error printed because the non-COW case comes through here */
307 else goto out; 306 else goto out;
308 307
@@ -327,9 +326,9 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
327 "header\n"); 326 "header\n");
328 goto out; 327 goto out;
329 } 328 }
330 *mtime_out = ntohl(header->v2.mtime); 329 *mtime_out = be32toh(header->v2.mtime);
331 *size_out = ntohll(header->v2.size); 330 *size_out = be64toh(header->v2.size);
332 *sectorsize_out = ntohl(header->v2.sectorsize); 331 *sectorsize_out = be32toh(header->v2.sectorsize);
333 *bitmap_offset_out = sizeof(header->v2); 332 *bitmap_offset_out = sizeof(header->v2);
334 *align_out = *sectorsize_out; 333 *align_out = *sectorsize_out;
335 file = header->v2.backing_file; 334 file = header->v2.backing_file;
@@ -341,10 +340,10 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
341 "header\n"); 340 "header\n");
342 goto out; 341 goto out;
343 } 342 }
344 *mtime_out = ntohl(header->v3.mtime); 343 *mtime_out = be32toh(header->v3.mtime);
345 *size_out = ntohll(header->v3.size); 344 *size_out = be64toh(header->v3.size);
346 *sectorsize_out = ntohl(header->v3.sectorsize); 345 *sectorsize_out = be32toh(header->v3.sectorsize);
347 *align_out = ntohl(header->v3.alignment); 346 *align_out = be32toh(header->v3.alignment);
348 if (*align_out == 0) { 347 if (*align_out == 0) {
349 cow_printf("read_cow_header - invalid COW header, " 348 cow_printf("read_cow_header - invalid COW header, "
350 "align == 0\n"); 349 "align == 0\n");
@@ -366,16 +365,16 @@ int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg,
366 * this was used until Dec2005 - 64bits are needed to represent 365 * this was used until Dec2005 - 64bits are needed to represent
367 * 2038+. I.e. we can safely do this truncating cast. 366 * 2038+. I.e. we can safely do this truncating cast.
368 * 367 *
369 * Additionally, we must use ntohl() instead of ntohll(), since 368 * Additionally, we must use be32toh() instead of be64toh(), since
370 * the program used to use the former (tested - I got mtime 369 * the program used to use the former (tested - I got mtime
371 * mismatch "0 vs whatever"). 370 * mismatch "0 vs whatever").
372 * 371 *
373 * Ever heard about bug-to-bug-compatibility ? ;-) */ 372 * Ever heard about bug-to-bug-compatibility ? ;-) */
374 *mtime_out = (time32_t) ntohl(header->v3_b.mtime); 373 *mtime_out = (time32_t) be32toh(header->v3_b.mtime);
375 374
376 *size_out = ntohll(header->v3_b.size); 375 *size_out = be64toh(header->v3_b.size);
377 *sectorsize_out = ntohl(header->v3_b.sectorsize); 376 *sectorsize_out = be32toh(header->v3_b.sectorsize);
378 *align_out = ntohl(header->v3_b.alignment); 377 *align_out = be32toh(header->v3_b.alignment);
379 if (*align_out == 0) { 378 if (*align_out == 0) {
380 cow_printf("read_cow_header - invalid COW header, " 379 cow_printf("read_cow_header - invalid COW header, "
381 "align == 0\n"); 380 "align == 0\n");
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index e672bd6d43e3..88e466b159dc 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -22,6 +22,7 @@
22#include <linux/workqueue.h> 22#include <linux/workqueue.h>
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25#include <asm/switch_to.h>
25 26
26#include "init.h" 27#include "init.h"
27#include "irq_kern.h" 28#include "irq_kern.h"
@@ -704,6 +705,7 @@ static void stack_proc(void *arg)
704 struct task_struct *from = current, *to = arg; 705 struct task_struct *from = current, *to = arg;
705 706
706 to->thread.saved_task = from; 707 to->thread.saved_task = from;
708 rcu_switch_from(from);
707 switch_to(from, to, from); 709 switch_to(from, to, from);
708} 710}
709 711
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
index 8419f5cf2ac7..fff24352255d 100644
--- a/arch/um/include/asm/Kbuild
+++ b/arch/um/include/asm/Kbuild
@@ -1,3 +1,4 @@
1generic-y += bug.h cputime.h device.h emergency-restart.h futex.h hardirq.h 1generic-y += bug.h cputime.h device.h emergency-restart.h futex.h hardirq.h
2generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h sections.h topology.h xor.h 2generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h sections.h topology.h xor.h
3generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h 3generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h exec.h
4generic-y += switch_to.h
diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h
index 98d01bc4fa92..7827394a5b6c 100644
--- a/arch/um/include/asm/processor-generic.h
+++ b/arch/um/include/asm/processor-generic.h
@@ -68,8 +68,6 @@ struct thread_struct {
68 .request = { 0 } \ 68 .request = { 0 } \
69} 69}
70 70
71extern struct task_struct *alloc_task_struct_node(int node);
72
73static inline void release_thread(struct task_struct *task) 71static inline void release_thread(struct task_struct *task)
74{ 72{
75} 73}
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index 492bc4c1b62b..babe21826e3e 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
@@ -3,13 +3,14 @@
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
6CPPFLAGS_vmlinux.lds := -DSTART=$(LDS_START) \ 6CPPFLAGS_vmlinux.lds := -DSTART=$(LDS_START) \
7 -DELF_ARCH=$(LDS_ELF_ARCH) \ 7 -DELF_ARCH=$(LDS_ELF_ARCH) \
8 -DELF_FORMAT=$(LDS_ELF_FORMAT) 8 -DELF_FORMAT=$(LDS_ELF_FORMAT) \
9 $(LDS_EXTRA)
9extra-y := vmlinux.lds 10extra-y := vmlinux.lds
10clean-files := 11clean-files :=
11 12
12obj-y = config.o exec.o exitcode.o init_task.o irq.o ksyms.o mem.o \ 13obj-y = config.o exec.o exitcode.o irq.o ksyms.o mem.o \
13 physmem.o process.o ptrace.o reboot.o sigio.o \ 14 physmem.o process.o ptrace.o reboot.o sigio.o \
14 signal.o smp.o syscall.o sysrq.o time.o tlb.o trap.o \ 15 signal.o smp.o syscall.o sysrq.o time.o tlb.o trap.o \
15 um_arch.o umid.o skas/ 16 um_arch.o umid.o skas/
diff --git a/arch/um/kernel/init_task.c b/arch/um/kernel/init_task.c
deleted file mode 100644
index ddc9698b66ed..000000000000
--- a/arch/um/kernel/init_task.c
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,intel.linux}.com)
3 * Licensed under the GPL
4 */
5
6#include "linux/sched.h"
7#include "linux/init_task.h"
8#include "linux/fs.h"
9#include "linux/module.h"
10#include "linux/mqueue.h"
11#include "asm/uaccess.h"
12
13static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
15/*
16 * Initial task structure.
17 *
18 * All other task structs will be allocated on slabs in fork.c
19 */
20
21struct task_struct init_task = INIT_TASK(init_task);
22
23EXPORT_SYMBOL(init_task);
24
25/*
26 * Initial thread structure.
27 *
28 * We need to make sure that this is aligned due to the
29 * way process stacks are handled. This is done by having a special
30 * "init_task" linker map entry..
31 */
32
33union thread_union init_thread_union __init_task_data =
34 { INIT_THREAD_INFO(init_task) };
35
36union thread_union cpu0_irqstack
37 __attribute__((__section__(".data..init_irqstack"))) =
38 { INIT_THREAD_INFO(init_task) };
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index f386d04a84a5..2b73dedb44ca 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -88,11 +88,8 @@ static inline void set_current(struct task_struct *task)
88 88
89extern void arch_switch_to(struct task_struct *to); 89extern void arch_switch_to(struct task_struct *to);
90 90
91void *_switch_to(void *prev, void *next, void *last) 91void *__switch_to(struct task_struct *from, struct task_struct *to)
92{ 92{
93 struct task_struct *from = prev;
94 struct task_struct *to = next;
95
96 to->thread.prev_sched = from; 93 to->thread.prev_sched = from;
97 set_current(to); 94 set_current(to);
98 95
@@ -111,7 +108,6 @@ void *_switch_to(void *prev, void *next, void *last)
111 } while (current->thread.saved_task); 108 } while (current->thread.saved_task);
112 109
113 return current->thread.prev_sched; 110 return current->thread.prev_sched;
114
115} 111}
116 112
117void interrupt_end(void) 113void interrupt_end(void)
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c
index 4947b319f53a..0a49ef0c2bf4 100644
--- a/arch/um/kernel/skas/mmu.c
+++ b/arch/um/kernel/skas/mmu.c
@@ -103,7 +103,6 @@ int init_new_context(struct task_struct *task, struct mm_struct *mm)
103 103
104void uml_setup_stubs(struct mm_struct *mm) 104void uml_setup_stubs(struct mm_struct *mm)
105{ 105{
106 struct page **pages;
107 int err, ret; 106 int err, ret;
108 107
109 if (!skas_needs_stub) 108 if (!skas_needs_stub)
diff --git a/arch/um/kernel/smp.c b/arch/um/kernel/smp.c
index 6f588e160fb0..a02b7e9e6b94 100644
--- a/arch/um/kernel/smp.c
+++ b/arch/um/kernel/smp.c
@@ -140,7 +140,7 @@ void smp_prepare_boot_cpu(void)
140 set_cpu_online(smp_processor_id(), true); 140 set_cpu_online(smp_processor_id(), true);
141} 141}
142 142
143int __cpu_up(unsigned int cpu) 143int __cpu_up(unsigned int cpu, struct task_struct *tidle)
144{ 144{
145 cpu_set(cpu, smp_commenced_mask); 145 cpu_set(cpu, smp_commenced_mask);
146 while (!cpu_online(cpu)) 146 while (!cpu_online(cpu))
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index ba00eae45aad..4db8770906ca 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -10,6 +10,7 @@
10#include <linux/seq_file.h> 10#include <linux/seq_file.h>
11#include <linux/string.h> 11#include <linux/string.h>
12#include <linux/utsname.h> 12#include <linux/utsname.h>
13#include <linux/sched.h>
13#include <asm/pgtable.h> 14#include <asm/pgtable.h>
14#include <asm/processor.h> 15#include <asm/processor.h>
15#include <asm/setup.h> 16#include <asm/setup.h>
@@ -47,6 +48,10 @@ struct cpuinfo_um boot_cpu_data = {
47 .ipi_pipe = { -1, -1 } 48 .ipi_pipe = { -1, -1 }
48}; 49};
49 50
51union thread_union cpu0_irqstack
52 __attribute__((__section__(".data..init_irqstack"))) =
53 { INIT_THREAD_INFO(init_task) };
54
50unsigned long thread_saved_pc(struct task_struct *task) 55unsigned long thread_saved_pc(struct task_struct *task)
51{ 56{
52 /* FIXME: Need to look up userspace_pid by cpu */ 57 /* FIXME: Need to look up userspace_pid by cpu */
diff --git a/arch/unicore32/Makefile b/arch/unicore32/Makefile
index 6af4bc415f2b..b6f5c4c1eaf9 100644
--- a/arch/unicore32/Makefile
+++ b/arch/unicore32/Makefile
@@ -33,7 +33,6 @@ endif
33CHECKFLAGS += -D__unicore32__ 33CHECKFLAGS += -D__unicore32__
34 34
35head-y := arch/unicore32/kernel/head.o 35head-y := arch/unicore32/kernel/head.o
36head-y += arch/unicore32/kernel/init_task.o
37 36
38core-y += arch/unicore32/kernel/ 37core-y += arch/unicore32/kernel/
39core-y += arch/unicore32/mm/ 38core-y += arch/unicore32/mm/
diff --git a/arch/unicore32/kernel/Makefile b/arch/unicore32/kernel/Makefile
index aeb0f181568e..324010156958 100644
--- a/arch/unicore32/kernel/Makefile
+++ b/arch/unicore32/kernel/Makefile
@@ -29,4 +29,4 @@ obj-$(CONFIG_PUV3_NB0916) += puv3-nb0916.o
29head-y := head.o 29head-y := head.o
30obj-$(CONFIG_DEBUG_LL) += debug.o 30obj-$(CONFIG_DEBUG_LL) += debug.o
31 31
32extra-y := $(head-y) init_task.o vmlinux.lds 32extra-y := $(head-y) vmlinux.lds
diff --git a/arch/unicore32/kernel/init_task.c b/arch/unicore32/kernel/init_task.c
deleted file mode 100644
index a35a1e50e4f4..000000000000
--- a/arch/unicore32/kernel/init_task.c
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * linux/arch/unicore32/kernel/init_task.c
3 *
4 * Code specific to PKUnity SoC and UniCore ISA
5 *
6 * Copyright (C) 2001-2010 GUAN Xue-tao
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#include <linux/mm.h>
13#include <linux/module.h>
14#include <linux/fs.h>
15#include <linux/sched.h>
16#include <linux/init.h>
17#include <linux/init_task.h>
18#include <linux/mqueue.h>
19#include <linux/uaccess.h>
20
21#include <asm/pgtable.h>
22
23static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
24static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
25/*
26 * Initial thread structure.
27 *
28 * We need to make sure that this is 8192-byte aligned due to the
29 * way process stacks are handled. This is done by making sure
30 * the linker maps this in the .text segment right after head.S,
31 * and making head.S ensure the proper alignment.
32 *
33 * The things we do for performance..
34 */
35union thread_union init_thread_union __init_task_data = {
36 INIT_THREAD_INFO(init_task) };
37
38/*
39 * Initial task structure.
40 *
41 * All other task structs will be allocated on slabs in fork.c
42 */
43struct task_struct init_task = INIT_TASK(init_task);
44EXPORT_SYMBOL(init_task);
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 1d14cc6b79ad..7b383d8da7b9 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -40,7 +40,6 @@ config X86
40 select HAVE_FUNCTION_GRAPH_TRACER 40 select HAVE_FUNCTION_GRAPH_TRACER
41 select HAVE_FUNCTION_GRAPH_FP_TEST 41 select HAVE_FUNCTION_GRAPH_FP_TEST
42 select HAVE_FUNCTION_TRACE_MCOUNT_TEST 42 select HAVE_FUNCTION_TRACE_MCOUNT_TEST
43 select HAVE_FTRACE_NMI_ENTER if DYNAMIC_FTRACE
44 select HAVE_SYSCALL_TRACEPOINTS 43 select HAVE_SYSCALL_TRACEPOINTS
45 select HAVE_KVM 44 select HAVE_KVM
46 select HAVE_ARCH_KGDB 45 select HAVE_ARCH_KGDB
@@ -77,11 +76,13 @@ config X86
77 select GENERIC_CLOCKEVENTS_MIN_ADJUST 76 select GENERIC_CLOCKEVENTS_MIN_ADJUST
78 select IRQ_FORCED_THREADING 77 select IRQ_FORCED_THREADING
79 select USE_GENERIC_SMP_HELPERS if SMP 78 select USE_GENERIC_SMP_HELPERS if SMP
80 select HAVE_BPF_JIT if (X86_64 && NET) 79 select HAVE_BPF_JIT if X86_64
81 select CLKEVT_I8253 80 select CLKEVT_I8253
82 select ARCH_HAVE_NMI_SAFE_CMPXCHG 81 select ARCH_HAVE_NMI_SAFE_CMPXCHG
83 select GENERIC_IOMAP 82 select GENERIC_IOMAP
84 select DCACHE_WORD_ACCESS if !DEBUG_PAGEALLOC 83 select DCACHE_WORD_ACCESS
84 select GENERIC_SMP_IDLE_THREAD
85 select HAVE_ARCH_SECCOMP_FILTER
85 86
86config INSTRUCTION_DECODER 87config INSTRUCTION_DECODER
87 def_bool (KPROBES || PERF_EVENTS) 88 def_bool (KPROBES || PERF_EVENTS)
@@ -160,9 +161,6 @@ config RWSEM_GENERIC_SPINLOCK
160config RWSEM_XCHGADD_ALGORITHM 161config RWSEM_XCHGADD_ALGORITHM
161 def_bool X86_XADD 162 def_bool X86_XADD
162 163
163config ARCH_HAS_CPU_IDLE_WAIT
164 def_bool y
165
166config GENERIC_CALIBRATE_DELAY 164config GENERIC_CALIBRATE_DELAY
167 def_bool y 165 def_bool y
168 166
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 41a7237606a3..277418ff8b52 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -134,6 +134,9 @@ KBUILD_CFLAGS += $(call cc-option,-mno-avx,)
134KBUILD_CFLAGS += $(mflags-y) 134KBUILD_CFLAGS += $(mflags-y)
135KBUILD_AFLAGS += $(mflags-y) 135KBUILD_AFLAGS += $(mflags-y)
136 136
137archscripts:
138 $(Q)$(MAKE) $(build)=arch/x86/tools relocs
139
137### 140###
138# Syscall table generation 141# Syscall table generation
139 142
@@ -146,7 +149,6 @@ archheaders:
146head-y := arch/x86/kernel/head_$(BITS).o 149head-y := arch/x86/kernel/head_$(BITS).o
147head-y += arch/x86/kernel/head$(BITS).o 150head-y += arch/x86/kernel/head$(BITS).o
148head-y += arch/x86/kernel/head.o 151head-y += arch/x86/kernel/head.o
149head-y += arch/x86/kernel/init_task.o
150 152
151libs-y += arch/x86/lib/ 153libs-y += arch/x86/lib/
152 154
diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um
index 4be406abeefd..36b62bc52638 100644
--- a/arch/x86/Makefile.um
+++ b/arch/x86/Makefile.um
@@ -14,6 +14,9 @@ LINK-y += $(call cc-option,-m32)
14 14
15export LDFLAGS 15export LDFLAGS
16 16
17LDS_EXTRA := -Ui386
18export LDS_EXTRA
19
17# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y. 20# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y.
18include $(srctree)/arch/x86/Makefile_32.cpu 21include $(srctree)/arch/x86/Makefile_32.cpu
19 22
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index fd55a2ff3ad8..e398bb5d63bb 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -40,13 +40,12 @@ OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
40$(obj)/vmlinux.bin: vmlinux FORCE 40$(obj)/vmlinux.bin: vmlinux FORCE
41 $(call if_changed,objcopy) 41 $(call if_changed,objcopy)
42 42
43targets += vmlinux.bin.all vmlinux.relocs
43 44
44targets += vmlinux.bin.all vmlinux.relocs relocs 45CMD_RELOCS = arch/x86/tools/relocs
45hostprogs-$(CONFIG_X86_NEED_RELOCS) += relocs
46
47quiet_cmd_relocs = RELOCS $@ 46quiet_cmd_relocs = RELOCS $@
48 cmd_relocs = $(obj)/relocs $< > $@;$(obj)/relocs --abs-relocs $< 47 cmd_relocs = $(CMD_RELOCS) $< > $@;$(CMD_RELOCS) --abs-relocs $<
49$(obj)/vmlinux.relocs: vmlinux $(obj)/relocs FORCE 48$(obj)/vmlinux.relocs: vmlinux FORCE
50 $(call if_changed,relocs) 49 $(call if_changed,relocs)
51 50
52vmlinux.bin.all-y := $(obj)/vmlinux.bin 51vmlinux.bin.all-y := $(obj)/vmlinux.bin
diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S
index a0559930a180..c85e3ac99bba 100644
--- a/arch/x86/boot/compressed/head_32.S
+++ b/arch/x86/boot/compressed/head_32.S
@@ -33,6 +33,9 @@
33 __HEAD 33 __HEAD
34ENTRY(startup_32) 34ENTRY(startup_32)
35#ifdef CONFIG_EFI_STUB 35#ifdef CONFIG_EFI_STUB
36 jmp preferred_addr
37
38 .balign 0x10
36 /* 39 /*
37 * We don't need the return address, so set up the stack so 40 * We don't need the return address, so set up the stack so
38 * efi_main() can find its arugments. 41 * efi_main() can find its arugments.
@@ -41,12 +44,17 @@ ENTRY(startup_32)
41 44
42 call efi_main 45 call efi_main
43 cmpl $0, %eax 46 cmpl $0, %eax
44 je preferred_addr
45 movl %eax, %esi 47 movl %eax, %esi
46 call 1f 48 jne 2f
471: 491:
50 /* EFI init failed, so hang. */
51 hlt
52 jmp 1b
532:
54 call 3f
553:
48 popl %eax 56 popl %eax
49 subl $1b, %eax 57 subl $3b, %eax
50 subl BP_pref_address(%esi), %eax 58 subl BP_pref_address(%esi), %eax
51 add BP_code32_start(%esi), %eax 59 add BP_code32_start(%esi), %eax
52 leal preferred_addr(%eax), %eax 60 leal preferred_addr(%eax), %eax
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index 558d76ce23bc..87e03a13d8e3 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -200,18 +200,28 @@ ENTRY(startup_64)
200 * entire text+data+bss and hopefully all of memory. 200 * entire text+data+bss and hopefully all of memory.
201 */ 201 */
202#ifdef CONFIG_EFI_STUB 202#ifdef CONFIG_EFI_STUB
203 pushq %rsi 203 /*
204 * The entry point for the PE/COFF executable is 0x210, so only
205 * legacy boot loaders will execute this jmp.
206 */
207 jmp preferred_addr
208
209 .org 0x210
204 mov %rcx, %rdi 210 mov %rcx, %rdi
205 mov %rdx, %rsi 211 mov %rdx, %rsi
206 call efi_main 212 call efi_main
207 popq %rsi
208 cmpq $0,%rax
209 je preferred_addr
210 movq %rax,%rsi 213 movq %rax,%rsi
211 call 1f 214 cmpq $0,%rax
215 jne 2f
2121: 2161:
217 /* EFI init failed, so hang. */
218 hlt
219 jmp 1b
2202:
221 call 3f
2223:
213 popq %rax 223 popq %rax
214 subq $1b, %rax 224 subq $3b, %rax
215 subq BP_pref_address(%rsi), %rax 225 subq BP_pref_address(%rsi), %rax
216 add BP_code32_start(%esi), %eax 226 add BP_code32_start(%esi), %eax
217 leaq preferred_addr(%rax), %rax 227 leaq preferred_addr(%rax), %rax
diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c
index ed549767a231..24443a332083 100644
--- a/arch/x86/boot/tools/build.c
+++ b/arch/x86/boot/tools/build.c
@@ -205,8 +205,13 @@ int main(int argc, char ** argv)
205 put_unaligned_le32(file_sz, &buf[pe_header + 0x50]); 205 put_unaligned_le32(file_sz, &buf[pe_header + 0x50]);
206 206
207#ifdef CONFIG_X86_32 207#ifdef CONFIG_X86_32
208 /* Address of entry point */ 208 /*
209 put_unaligned_le32(i, &buf[pe_header + 0x28]); 209 * Address of entry point.
210 *
211 * The EFI stub entry point is +16 bytes from the start of
212 * the .text section.
213 */
214 put_unaligned_le32(i + 16, &buf[pe_header + 0x28]);
210 215
211 /* .text size */ 216 /* .text size */
212 put_unaligned_le32(file_sz, &buf[pe_header + 0xb0]); 217 put_unaligned_le32(file_sz, &buf[pe_header + 0xb0]);
@@ -217,9 +222,11 @@ int main(int argc, char ** argv)
217 /* 222 /*
218 * Address of entry point. startup_32 is at the beginning and 223 * Address of entry point. startup_32 is at the beginning and
219 * the 64-bit entry point (startup_64) is always 512 bytes 224 * the 64-bit entry point (startup_64) is always 512 bytes
220 * after. 225 * after. The EFI stub entry point is 16 bytes after that, as
226 * the first instruction allows legacy loaders to jump over
227 * the EFI stub initialisation
221 */ 228 */
222 put_unaligned_le32(i + 512, &buf[pe_header + 0x28]); 229 put_unaligned_le32(i + 528, &buf[pe_header + 0x28]);
223 230
224 /* .text size */ 231 /* .text size */
225 put_unaligned_le32(file_sz, &buf[pe_header + 0xc0]); 232 put_unaligned_le32(file_sz, &buf[pe_header + 0xc0]);
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index d511d951a052..07b3a68d2d29 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -119,9 +119,7 @@ static void set_brk(unsigned long start, unsigned long end)
119 end = PAGE_ALIGN(end); 119 end = PAGE_ALIGN(end);
120 if (end <= start) 120 if (end <= start)
121 return; 121 return;
122 down_write(&current->mm->mmap_sem); 122 vm_brk(start, end - start);
123 do_brk(start, end - start);
124 up_write(&current->mm->mmap_sem);
125} 123}
126 124
127#ifdef CORE_DUMP 125#ifdef CORE_DUMP
@@ -296,8 +294,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs)
296 294
297 /* OK, This is the point of no return */ 295 /* OK, This is the point of no return */
298 set_personality(PER_LINUX); 296 set_personality(PER_LINUX);
299 set_thread_flag(TIF_IA32); 297 set_personality_ia32(false);
300 current->mm->context.ia32_compat = 1;
301 298
302 setup_new_exec(bprm); 299 setup_new_exec(bprm);
303 300
@@ -332,9 +329,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs)
332 pos = 32; 329 pos = 32;
333 map_size = ex.a_text+ex.a_data; 330 map_size = ex.a_text+ex.a_data;
334 331
335 down_write(&current->mm->mmap_sem); 332 error = vm_brk(text_addr & PAGE_MASK, map_size);
336 error = do_brk(text_addr & PAGE_MASK, map_size);
337 up_write(&current->mm->mmap_sem);
338 333
339 if (error != (text_addr & PAGE_MASK)) { 334 if (error != (text_addr & PAGE_MASK)) {
340 send_sig(SIGKILL, current, 0); 335 send_sig(SIGKILL, current, 0);
@@ -373,9 +368,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs)
373 if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) { 368 if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) {
374 loff_t pos = fd_offset; 369 loff_t pos = fd_offset;
375 370
376 down_write(&current->mm->mmap_sem); 371 vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data);
377 do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data);
378 up_write(&current->mm->mmap_sem);
379 bprm->file->f_op->read(bprm->file, 372 bprm->file->f_op->read(bprm->file,
380 (char __user *)N_TXTADDR(ex), 373 (char __user *)N_TXTADDR(ex),
381 ex.a_text+ex.a_data, &pos); 374 ex.a_text+ex.a_data, &pos);
@@ -385,26 +378,22 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs)
385 goto beyond_if; 378 goto beyond_if;
386 } 379 }
387 380
388 down_write(&current->mm->mmap_sem); 381 error = vm_mmap(bprm->file, N_TXTADDR(ex), ex.a_text,
389 error = do_mmap(bprm->file, N_TXTADDR(ex), ex.a_text,
390 PROT_READ | PROT_EXEC, 382 PROT_READ | PROT_EXEC,
391 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | 383 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE |
392 MAP_EXECUTABLE | MAP_32BIT, 384 MAP_EXECUTABLE | MAP_32BIT,
393 fd_offset); 385 fd_offset);
394 up_write(&current->mm->mmap_sem);
395 386
396 if (error != N_TXTADDR(ex)) { 387 if (error != N_TXTADDR(ex)) {
397 send_sig(SIGKILL, current, 0); 388 send_sig(SIGKILL, current, 0);
398 return error; 389 return error;
399 } 390 }
400 391
401 down_write(&current->mm->mmap_sem); 392 error = vm_mmap(bprm->file, N_DATADDR(ex), ex.a_data,
402 error = do_mmap(bprm->file, N_DATADDR(ex), ex.a_data,
403 PROT_READ | PROT_WRITE | PROT_EXEC, 393 PROT_READ | PROT_WRITE | PROT_EXEC,
404 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | 394 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE |
405 MAP_EXECUTABLE | MAP_32BIT, 395 MAP_EXECUTABLE | MAP_32BIT,
406 fd_offset + ex.a_text); 396 fd_offset + ex.a_text);
407 up_write(&current->mm->mmap_sem);
408 if (error != N_DATADDR(ex)) { 397 if (error != N_DATADDR(ex)) {
409 send_sig(SIGKILL, current, 0); 398 send_sig(SIGKILL, current, 0);
410 return error; 399 return error;
@@ -476,9 +465,7 @@ static int load_aout_library(struct file *file)
476 error_time = jiffies; 465 error_time = jiffies;
477 } 466 }
478#endif 467#endif
479 down_write(&current->mm->mmap_sem); 468 vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
480 do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
481 up_write(&current->mm->mmap_sem);
482 469
483 file->f_op->read(file, (char __user *)start_addr, 470 file->f_op->read(file, (char __user *)start_addr,
484 ex.a_text + ex.a_data, &pos); 471 ex.a_text + ex.a_data, &pos);
@@ -490,12 +477,10 @@ static int load_aout_library(struct file *file)
490 goto out; 477 goto out;
491 } 478 }
492 /* Now use mmap to map the library into memory. */ 479 /* Now use mmap to map the library into memory. */
493 down_write(&current->mm->mmap_sem); 480 error = vm_mmap(file, start_addr, ex.a_text + ex.a_data,
494 error = do_mmap(file, start_addr, ex.a_text + ex.a_data,
495 PROT_READ | PROT_WRITE | PROT_EXEC, 481 PROT_READ | PROT_WRITE | PROT_EXEC,
496 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_32BIT, 482 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_32BIT,
497 N_TXTOFF(ex)); 483 N_TXTOFF(ex));
498 up_write(&current->mm->mmap_sem);
499 retval = error; 484 retval = error;
500 if (error != start_addr) 485 if (error != start_addr)
501 goto out; 486 goto out;
@@ -503,9 +488,7 @@ static int load_aout_library(struct file *file)
503 len = PAGE_ALIGN(ex.a_text + ex.a_data); 488 len = PAGE_ALIGN(ex.a_text + ex.a_data);
504 bss = ex.a_text + ex.a_data + ex.a_bss; 489 bss = ex.a_text + ex.a_data + ex.a_bss;
505 if (bss > len) { 490 if (bss > len) {
506 down_write(&current->mm->mmap_sem); 491 error = vm_brk(start_addr + len, bss - len);
507 error = do_brk(start_addr + len, bss - len);
508 up_write(&current->mm->mmap_sem);
509 retval = error; 492 retval = error;
510 if (error != start_addr + len) 493 if (error != start_addr + len)
511 goto out; 494 goto out;
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index a69245ba27e3..0b3f2354f6aa 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -67,6 +67,10 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
67 switch (from->si_code >> 16) { 67 switch (from->si_code >> 16) {
68 case __SI_FAULT >> 16: 68 case __SI_FAULT >> 16:
69 break; 69 break;
70 case __SI_SYS >> 16:
71 put_user_ex(from->si_syscall, &to->si_syscall);
72 put_user_ex(from->si_arch, &to->si_arch);
73 break;
70 case __SI_CHLD >> 16: 74 case __SI_CHLD >> 16:
71 if (ia32) { 75 if (ia32) {
72 put_user_ex(from->si_utime, &to->si_utime); 76 put_user_ex(from->si_utime, &to->si_utime);
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index d85410171260..eaff4790ed96 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -138,6 +138,11 @@ static inline void native_apic_msr_write(u32 reg, u32 v)
138 wrmsr(APIC_BASE_MSR + (reg >> 4), v, 0); 138 wrmsr(APIC_BASE_MSR + (reg >> 4), v, 0);
139} 139}
140 140
141static inline void native_apic_msr_eoi_write(u32 reg, u32 v)
142{
143 wrmsr(APIC_BASE_MSR + (APIC_EOI >> 4), APIC_EOI_ACK, 0);
144}
145
141static inline u32 native_apic_msr_read(u32 reg) 146static inline u32 native_apic_msr_read(u32 reg)
142{ 147{
143 u64 msr; 148 u64 msr;
@@ -351,6 +356,14 @@ struct apic {
351 /* apic ops */ 356 /* apic ops */
352 u32 (*read)(u32 reg); 357 u32 (*read)(u32 reg);
353 void (*write)(u32 reg, u32 v); 358 void (*write)(u32 reg, u32 v);
359 /*
360 * ->eoi_write() has the same signature as ->write().
361 *
362 * Drivers can support both ->eoi_write() and ->write() by passing the same
363 * callback value. Kernel can override ->eoi_write() and fall back
364 * on write for EOI.
365 */
366 void (*eoi_write)(u32 reg, u32 v);
354 u64 (*icr_read)(void); 367 u64 (*icr_read)(void);
355 void (*icr_write)(u32 low, u32 high); 368 void (*icr_write)(u32 low, u32 high);
356 void (*wait_icr_idle)(void); 369 void (*wait_icr_idle)(void);
@@ -426,6 +439,11 @@ static inline void apic_write(u32 reg, u32 val)
426 apic->write(reg, val); 439 apic->write(reg, val);
427} 440}
428 441
442static inline void apic_eoi(void)
443{
444 apic->eoi_write(APIC_EOI, APIC_EOI_ACK);
445}
446
429static inline u64 apic_icr_read(void) 447static inline u64 apic_icr_read(void)
430{ 448{
431 return apic->icr_read(); 449 return apic->icr_read();
@@ -450,6 +468,7 @@ static inline u32 safe_apic_wait_icr_idle(void)
450 468
451static inline u32 apic_read(u32 reg) { return 0; } 469static inline u32 apic_read(u32 reg) { return 0; }
452static inline void apic_write(u32 reg, u32 val) { } 470static inline void apic_write(u32 reg, u32 val) { }
471static inline void apic_eoi(void) { }
453static inline u64 apic_icr_read(void) { return 0; } 472static inline u64 apic_icr_read(void) { return 0; }
454static inline void apic_icr_write(u32 low, u32 high) { } 473static inline void apic_icr_write(u32 low, u32 high) { }
455static inline void apic_wait_icr_idle(void) { } 474static inline void apic_wait_icr_idle(void) { }
@@ -463,9 +482,7 @@ static inline void ack_APIC_irq(void)
463 * ack_APIC_irq() actually gets compiled as a single instruction 482 * ack_APIC_irq() actually gets compiled as a single instruction
464 * ... yummie. 483 * ... yummie.
465 */ 484 */
466 485 apic_eoi();
467 /* Docs say use 0 for future compatibility */
468 apic_write(APIC_EOI, 0);
469} 486}
470 487
471static inline unsigned default_get_apic_id(unsigned long x) 488static inline unsigned default_get_apic_id(unsigned long x)
diff --git a/arch/x86/include/asm/apicdef.h b/arch/x86/include/asm/apicdef.h
index 134bba00df09..c46bb99d5fb2 100644
--- a/arch/x86/include/asm/apicdef.h
+++ b/arch/x86/include/asm/apicdef.h
@@ -37,7 +37,7 @@
37#define APIC_ARBPRI_MASK 0xFFu 37#define APIC_ARBPRI_MASK 0xFFu
38#define APIC_PROCPRI 0xA0 38#define APIC_PROCPRI 0xA0
39#define APIC_EOI 0xB0 39#define APIC_EOI 0xB0
40#define APIC_EIO_ACK 0x0 40#define APIC_EOI_ACK 0x0 /* Docs say 0 for future compat. */
41#define APIC_RRR 0xC0 41#define APIC_RRR 0xC0
42#define APIC_LDR 0xD0 42#define APIC_LDR 0xD0
43#define APIC_LDR_MASK (0xFFu << 24) 43#define APIC_LDR_MASK (0xFFu << 24)
diff --git a/arch/x86/include/asm/boot.h b/arch/x86/include/asm/boot.h
index 5e1a2eef3e7c..b13fe63bdc59 100644
--- a/arch/x86/include/asm/boot.h
+++ b/arch/x86/include/asm/boot.h
@@ -19,7 +19,7 @@
19#ifdef CONFIG_X86_64 19#ifdef CONFIG_X86_64
20#define MIN_KERNEL_ALIGN_LG2 PMD_SHIFT 20#define MIN_KERNEL_ALIGN_LG2 PMD_SHIFT
21#else 21#else
22#define MIN_KERNEL_ALIGN_LG2 (PAGE_SHIFT + THREAD_ORDER) 22#define MIN_KERNEL_ALIGN_LG2 (PAGE_SHIFT + THREAD_SIZE_ORDER)
23#endif 23#endif
24#define MIN_KERNEL_ALIGN (_AC(1, UL) << MIN_KERNEL_ALIGN_LG2) 24#define MIN_KERNEL_ALIGN (_AC(1, UL) << MIN_KERNEL_ALIGN_LG2)
25 25
diff --git a/arch/x86/include/asm/cmpxchg.h b/arch/x86/include/asm/cmpxchg.h
index b3b733262909..99480e55973d 100644
--- a/arch/x86/include/asm/cmpxchg.h
+++ b/arch/x86/include/asm/cmpxchg.h
@@ -43,7 +43,7 @@ extern void __add_wrong_size(void)
43 switch (sizeof(*(ptr))) { \ 43 switch (sizeof(*(ptr))) { \
44 case __X86_CASE_B: \ 44 case __X86_CASE_B: \
45 asm volatile (lock #op "b %b0, %1\n" \ 45 asm volatile (lock #op "b %b0, %1\n" \
46 : "+r" (__ret), "+m" (*(ptr)) \ 46 : "+q" (__ret), "+m" (*(ptr)) \
47 : : "memory", "cc"); \ 47 : : "memory", "cc"); \
48 break; \ 48 break; \
49 case __X86_CASE_W: \ 49 case __X86_CASE_W: \
@@ -173,7 +173,7 @@ extern void __add_wrong_size(void)
173 switch (sizeof(*(ptr))) { \ 173 switch (sizeof(*(ptr))) { \
174 case __X86_CASE_B: \ 174 case __X86_CASE_B: \
175 asm volatile (lock "addb %b1, %0\n" \ 175 asm volatile (lock "addb %b1, %0\n" \
176 : "+m" (*(ptr)) : "ri" (inc) \ 176 : "+m" (*(ptr)) : "qi" (inc) \
177 : "memory", "cc"); \ 177 : "memory", "cc"); \
178 break; \ 178 break; \
179 case __X86_CASE_W: \ 179 case __X86_CASE_W: \
diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h
index d6805798d6fc..fedf32b73e65 100644
--- a/arch/x86/include/asm/compat.h
+++ b/arch/x86/include/asm/compat.h
@@ -229,7 +229,7 @@ static inline void __user *arch_compat_alloc_user_space(long len)
229 sp = task_pt_regs(current)->sp; 229 sp = task_pt_regs(current)->sp;
230 } else { 230 } else {
231 /* -128 for the x32 ABI redzone */ 231 /* -128 for the x32 ABI redzone */
232 sp = percpu_read(old_rsp) - 128; 232 sp = this_cpu_read(old_rsp) - 128;
233 } 233 }
234 234
235 return (void __user *)round_down(sp - len, 16); 235 return (void __user *)round_down(sp - len, 16);
diff --git a/arch/x86/include/asm/current.h b/arch/x86/include/asm/current.h
index 4d447b732d82..9476c04ee635 100644
--- a/arch/x86/include/asm/current.h
+++ b/arch/x86/include/asm/current.h
@@ -11,7 +11,7 @@ DECLARE_PER_CPU(struct task_struct *, current_task);
11 11
12static __always_inline struct task_struct *get_current(void) 12static __always_inline struct task_struct *get_current(void)
13{ 13{
14 return percpu_read_stable(current_task); 14 return this_cpu_read_stable(current_task);
15} 15}
16 16
17#define current get_current() 17#define current get_current()
diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
index e95822d683f4..8bf1c06070d5 100644
--- a/arch/x86/include/asm/desc.h
+++ b/arch/x86/include/asm/desc.h
@@ -6,6 +6,7 @@
6#include <asm/mmu.h> 6#include <asm/mmu.h>
7 7
8#include <linux/smp.h> 8#include <linux/smp.h>
9#include <linux/percpu.h>
9 10
10static inline void fill_ldt(struct desc_struct *desc, const struct user_desc *info) 11static inline void fill_ldt(struct desc_struct *desc, const struct user_desc *info)
11{ 12{
diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h
index 4fa88154e4de..75f4c6d6a331 100644
--- a/arch/x86/include/asm/fpu-internal.h
+++ b/arch/x86/include/asm/fpu-internal.h
@@ -290,14 +290,14 @@ static inline int __thread_has_fpu(struct task_struct *tsk)
290static inline void __thread_clear_has_fpu(struct task_struct *tsk) 290static inline void __thread_clear_has_fpu(struct task_struct *tsk)
291{ 291{
292 tsk->thread.fpu.has_fpu = 0; 292 tsk->thread.fpu.has_fpu = 0;
293 percpu_write(fpu_owner_task, NULL); 293 this_cpu_write(fpu_owner_task, NULL);
294} 294}
295 295
296/* Must be paired with a 'clts' before! */ 296/* Must be paired with a 'clts' before! */
297static inline void __thread_set_has_fpu(struct task_struct *tsk) 297static inline void __thread_set_has_fpu(struct task_struct *tsk)
298{ 298{
299 tsk->thread.fpu.has_fpu = 1; 299 tsk->thread.fpu.has_fpu = 1;
300 percpu_write(fpu_owner_task, tsk); 300 this_cpu_write(fpu_owner_task, tsk);
301} 301}
302 302
303/* 303/*
@@ -344,7 +344,7 @@ typedef struct { int preload; } fpu_switch_t;
344 */ 344 */
345static inline int fpu_lazy_restore(struct task_struct *new, unsigned int cpu) 345static inline int fpu_lazy_restore(struct task_struct *new, unsigned int cpu)
346{ 346{
347 return new == percpu_read_stable(fpu_owner_task) && 347 return new == this_cpu_read_stable(fpu_owner_task) &&
348 cpu == new->thread.fpu.last_cpu; 348 cpu == new->thread.fpu.last_cpu;
349} 349}
350 350
diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h
index 268c783ab1c0..18d9005d9e4f 100644
--- a/arch/x86/include/asm/ftrace.h
+++ b/arch/x86/include/asm/ftrace.h
@@ -34,6 +34,7 @@
34 34
35#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
36extern void mcount(void); 36extern void mcount(void);
37extern int modifying_ftrace_code;
37 38
38static inline unsigned long ftrace_call_adjust(unsigned long addr) 39static inline unsigned long ftrace_call_adjust(unsigned long addr)
39{ 40{
@@ -50,6 +51,8 @@ struct dyn_arch_ftrace {
50 /* No extra data needed for x86 */ 51 /* No extra data needed for x86 */
51}; 52};
52 53
54int ftrace_int3_handler(struct pt_regs *regs);
55
53#endif /* CONFIG_DYNAMIC_FTRACE */ 56#endif /* CONFIG_DYNAMIC_FTRACE */
54#endif /* __ASSEMBLY__ */ 57#endif /* __ASSEMBLY__ */
55#endif /* CONFIG_FUNCTION_TRACER */ 58#endif /* CONFIG_FUNCTION_TRACER */
diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
index 382f75d735f3..d3895dbf4ddb 100644
--- a/arch/x86/include/asm/hardirq.h
+++ b/arch/x86/include/asm/hardirq.h
@@ -35,14 +35,15 @@ DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
35 35
36#define __ARCH_IRQ_STAT 36#define __ARCH_IRQ_STAT
37 37
38#define inc_irq_stat(member) percpu_inc(irq_stat.member) 38#define inc_irq_stat(member) this_cpu_inc(irq_stat.member)
39 39
40#define local_softirq_pending() percpu_read(irq_stat.__softirq_pending) 40#define local_softirq_pending() this_cpu_read(irq_stat.__softirq_pending)
41 41
42#define __ARCH_SET_SOFTIRQ_PENDING 42#define __ARCH_SET_SOFTIRQ_PENDING
43 43
44#define set_softirq_pending(x) percpu_write(irq_stat.__softirq_pending, (x)) 44#define set_softirq_pending(x) \
45#define or_softirq_pending(x) percpu_or(irq_stat.__softirq_pending, (x)) 45 this_cpu_write(irq_stat.__softirq_pending, (x))
46#define or_softirq_pending(x) this_cpu_or(irq_stat.__softirq_pending, (x))
46 47
47extern void ack_bad_irq(unsigned int irq); 48extern void ack_bad_irq(unsigned int irq);
48 49
diff --git a/arch/x86/include/asm/ia32.h b/arch/x86/include/asm/ia32.h
index ee52760549f0..b04cbdb138cd 100644
--- a/arch/x86/include/asm/ia32.h
+++ b/arch/x86/include/asm/ia32.h
@@ -144,6 +144,12 @@ typedef struct compat_siginfo {
144 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 144 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
145 int _fd; 145 int _fd;
146 } _sigpoll; 146 } _sigpoll;
147
148 struct {
149 unsigned int _call_addr; /* calling insn */
150 int _syscall; /* triggering system call number */
151 unsigned int _arch; /* AUDIT_ARCH_* of syscall */
152 } _sigsys;
147 } _sifields; 153 } _sifields;
148} compat_siginfo_t; 154} compat_siginfo_t;
149 155
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h
index 2c4943de5150..73d8c5398ea9 100644
--- a/arch/x86/include/asm/io_apic.h
+++ b/arch/x86/include/asm/io_apic.h
@@ -5,7 +5,7 @@
5#include <asm/mpspec.h> 5#include <asm/mpspec.h>
6#include <asm/apicdef.h> 6#include <asm/apicdef.h>
7#include <asm/irq_vectors.h> 7#include <asm/irq_vectors.h>
8 8#include <asm/x86_init.h>
9/* 9/*
10 * Intel IO-APIC support for SMP and UP systems. 10 * Intel IO-APIC support for SMP and UP systems.
11 * 11 *
@@ -21,15 +21,6 @@
21#define IO_APIC_REDIR_LEVEL_TRIGGER (1 << 15) 21#define IO_APIC_REDIR_LEVEL_TRIGGER (1 << 15)
22#define IO_APIC_REDIR_MASKED (1 << 16) 22#define IO_APIC_REDIR_MASKED (1 << 16)
23 23
24struct io_apic_ops {
25 void (*init) (void);
26 unsigned int (*read) (unsigned int apic, unsigned int reg);
27 void (*write) (unsigned int apic, unsigned int reg, unsigned int value);
28 void (*modify)(unsigned int apic, unsigned int reg, unsigned int value);
29};
30
31void __init set_io_apic_ops(const struct io_apic_ops *);
32
33/* 24/*
34 * The structure of the IO-APIC: 25 * The structure of the IO-APIC:
35 */ 26 */
@@ -156,7 +147,6 @@ struct io_apic_irq_attr;
156extern int io_apic_set_pci_routing(struct device *dev, int irq, 147extern int io_apic_set_pci_routing(struct device *dev, int irq,
157 struct io_apic_irq_attr *irq_attr); 148 struct io_apic_irq_attr *irq_attr);
158void setup_IO_APIC_irq_extra(u32 gsi); 149void setup_IO_APIC_irq_extra(u32 gsi);
159extern void ioapic_and_gsi_init(void);
160extern void ioapic_insert_resources(void); 150extern void ioapic_insert_resources(void);
161 151
162int io_apic_setup_irq_pin_once(unsigned int irq, int node, struct io_apic_irq_attr *attr); 152int io_apic_setup_irq_pin_once(unsigned int irq, int node, struct io_apic_irq_attr *attr);
@@ -185,12 +175,29 @@ extern void mp_save_irq(struct mpc_intsrc *m);
185 175
186extern void disable_ioapic_support(void); 176extern void disable_ioapic_support(void);
187 177
178extern void __init native_io_apic_init_mappings(void);
179extern unsigned int native_io_apic_read(unsigned int apic, unsigned int reg);
180extern void native_io_apic_write(unsigned int apic, unsigned int reg, unsigned int val);
181extern void native_io_apic_modify(unsigned int apic, unsigned int reg, unsigned int val);
182
183static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg)
184{
185 return x86_io_apic_ops.read(apic, reg);
186}
187
188static inline void io_apic_write(unsigned int apic, unsigned int reg, unsigned int value)
189{
190 x86_io_apic_ops.write(apic, reg, value);
191}
192static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned int value)
193{
194 x86_io_apic_ops.modify(apic, reg, value);
195}
188#else /* !CONFIG_X86_IO_APIC */ 196#else /* !CONFIG_X86_IO_APIC */
189 197
190#define io_apic_assign_pci_irqs 0 198#define io_apic_assign_pci_irqs 0
191#define setup_ioapic_ids_from_mpc x86_init_noop 199#define setup_ioapic_ids_from_mpc x86_init_noop
192static const int timer_through_8259 = 0; 200static const int timer_through_8259 = 0;
193static inline void ioapic_and_gsi_init(void) { }
194static inline void ioapic_insert_resources(void) { } 201static inline void ioapic_insert_resources(void) { }
195#define gsi_top (NR_IRQS_LEGACY) 202#define gsi_top (NR_IRQS_LEGACY)
196static inline int mp_find_ioapic(u32 gsi) { return 0; } 203static inline int mp_find_ioapic(u32 gsi) { return 0; }
@@ -212,6 +219,10 @@ static inline int restore_ioapic_entries(void)
212 219
213static inline void mp_save_irq(struct mpc_intsrc *m) { }; 220static inline void mp_save_irq(struct mpc_intsrc *m) { };
214static inline void disable_ioapic_support(void) { } 221static inline void disable_ioapic_support(void) { }
222#define native_io_apic_init_mappings NULL
223#define native_io_apic_read NULL
224#define native_io_apic_write NULL
225#define native_io_apic_modify NULL
215#endif 226#endif
216 227
217#endif /* _ASM_X86_IO_APIC_H */ 228#endif /* _ASM_X86_IO_APIC_H */
diff --git a/arch/x86/include/asm/irq_regs.h b/arch/x86/include/asm/irq_regs.h
index 77843225b7ea..d82250b1debb 100644
--- a/arch/x86/include/asm/irq_regs.h
+++ b/arch/x86/include/asm/irq_regs.h
@@ -15,7 +15,7 @@ DECLARE_PER_CPU(struct pt_regs *, irq_regs);
15 15
16static inline struct pt_regs *get_irq_regs(void) 16static inline struct pt_regs *get_irq_regs(void)
17{ 17{
18 return percpu_read(irq_regs); 18 return this_cpu_read(irq_regs);
19} 19}
20 20
21static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs) 21static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs)
@@ -23,7 +23,7 @@ static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs)
23 struct pt_regs *old_regs; 23 struct pt_regs *old_regs;
24 24
25 old_regs = get_irq_regs(); 25 old_regs = get_irq_regs();
26 percpu_write(irq_regs, new_regs); 26 this_cpu_write(irq_regs, new_regs);
27 27
28 return old_regs; 28 return old_regs;
29} 29}
diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h
index 47d99934580f..5fb9bbbd2f14 100644
--- a/arch/x86/include/asm/irq_remapping.h
+++ b/arch/x86/include/asm/irq_remapping.h
@@ -1,45 +1,101 @@
1#ifndef _ASM_X86_IRQ_REMAPPING_H 1/*
2#define _ASM_X86_IRQ_REMAPPING_H 2 * Copyright (C) 2012 Advanced Micro Devices, Inc.
3 * Author: Joerg Roedel <joerg.roedel@amd.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published
7 * by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * This header file contains the interface of the interrupt remapping code to
19 * the x86 interrupt management code.
20 */
3 21
4#define IRTE_DEST(dest) ((x2apic_mode) ? dest : dest << 8) 22#ifndef __X86_IRQ_REMAPPING_H
23#define __X86_IRQ_REMAPPING_H
24
25#include <asm/io_apic.h>
5 26
6#ifdef CONFIG_IRQ_REMAP 27#ifdef CONFIG_IRQ_REMAP
7static void irq_remap_modify_chip_defaults(struct irq_chip *chip); 28
8static inline void prepare_irte(struct irte *irte, int vector, 29extern int irq_remapping_enabled;
9 unsigned int dest) 30
31extern void setup_irq_remapping_ops(void);
32extern int irq_remapping_supported(void);
33extern int irq_remapping_prepare(void);
34extern int irq_remapping_enable(void);
35extern void irq_remapping_disable(void);
36extern int irq_remapping_reenable(int);
37extern int irq_remap_enable_fault_handling(void);
38extern int setup_ioapic_remapped_entry(int irq,
39 struct IO_APIC_route_entry *entry,
40 unsigned int destination,
41 int vector,
42 struct io_apic_irq_attr *attr);
43extern int set_remapped_irq_affinity(struct irq_data *data,
44 const struct cpumask *mask,
45 bool force);
46extern void free_remapped_irq(int irq);
47extern void compose_remapped_msi_msg(struct pci_dev *pdev,
48 unsigned int irq, unsigned int dest,
49 struct msi_msg *msg, u8 hpet_id);
50extern int msi_alloc_remapped_irq(struct pci_dev *pdev, int irq, int nvec);
51extern int msi_setup_remapped_irq(struct pci_dev *pdev, unsigned int irq,
52 int index, int sub_handle);
53extern int setup_hpet_msi_remapped(unsigned int irq, unsigned int id);
54
55#else /* CONFIG_IRQ_REMAP */
56
57#define irq_remapping_enabled 0
58
59static inline void setup_irq_remapping_ops(void) { }
60static inline int irq_remapping_supported(void) { return 0; }
61static inline int irq_remapping_prepare(void) { return -ENODEV; }
62static inline int irq_remapping_enable(void) { return -ENODEV; }
63static inline void irq_remapping_disable(void) { }
64static inline int irq_remapping_reenable(int eim) { return -ENODEV; }
65static inline int irq_remap_enable_fault_handling(void) { return -ENODEV; }
66static inline int setup_ioapic_remapped_entry(int irq,
67 struct IO_APIC_route_entry *entry,
68 unsigned int destination,
69 int vector,
70 struct io_apic_irq_attr *attr)
71{
72 return -ENODEV;
73}
74static inline int set_remapped_irq_affinity(struct irq_data *data,
75 const struct cpumask *mask,
76 bool force)
10{ 77{
11 memset(irte, 0, sizeof(*irte)); 78 return 0;
12
13 irte->present = 1;
14 irte->dst_mode = apic->irq_dest_mode;
15 /*
16 * Trigger mode in the IRTE will always be edge, and for IO-APIC, the
17 * actual level or edge trigger will be setup in the IO-APIC
18 * RTE. This will help simplify level triggered irq migration.
19 * For more details, see the comments (in io_apic.c) explainig IO-APIC
20 * irq migration in the presence of interrupt-remapping.
21 */
22 irte->trigger_mode = 0;
23 irte->dlvry_mode = apic->irq_delivery_mode;
24 irte->vector = vector;
25 irte->dest_id = IRTE_DEST(dest);
26 irte->redir_hint = 1;
27} 79}
28static inline bool irq_remapped(struct irq_cfg *cfg) 80static inline void free_remapped_irq(int irq) { }
81static inline void compose_remapped_msi_msg(struct pci_dev *pdev,
82 unsigned int irq, unsigned int dest,
83 struct msi_msg *msg, u8 hpet_id)
29{ 84{
30 return cfg->irq_2_iommu.iommu != NULL;
31} 85}
32#else 86static inline int msi_alloc_remapped_irq(struct pci_dev *pdev, int irq, int nvec)
33static void prepare_irte(struct irte *irte, int vector, unsigned int dest)
34{ 87{
88 return -ENODEV;
35} 89}
36static inline bool irq_remapped(struct irq_cfg *cfg) 90static inline int msi_setup_remapped_irq(struct pci_dev *pdev, unsigned int irq,
91 int index, int sub_handle)
37{ 92{
38 return false; 93 return -ENODEV;
39} 94}
40static inline void irq_remap_modify_chip_defaults(struct irq_chip *chip) 95static inline int setup_hpet_msi_remapped(unsigned int irq, unsigned int id)
41{ 96{
97 return -ENODEV;
42} 98}
43#endif 99#endif /* CONFIG_IRQ_REMAP */
44 100
45#endif /* _ASM_X86_IRQ_REMAPPING_H */ 101#endif /* __X86_IRQ_REMAPPING_H */
diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h
index 734c3767cfac..183922e13de1 100644
--- a/arch/x86/include/asm/kvm_para.h
+++ b/arch/x86/include/asm/kvm_para.h
@@ -170,6 +170,9 @@ static inline int kvm_para_available(void)
170 unsigned int eax, ebx, ecx, edx; 170 unsigned int eax, ebx, ecx, edx;
171 char signature[13]; 171 char signature[13];
172 172
173 if (boot_cpu_data.cpuid_level < 0)
174 return 0; /* So we don't blow up on old processors */
175
173 cpuid(KVM_CPUID_SIGNATURE, &eax, &ebx, &ecx, &edx); 176 cpuid(KVM_CPUID_SIGNATURE, &eax, &ebx, &ecx, &edx);
174 memcpy(signature + 0, &ebx, 4); 177 memcpy(signature + 0, &ebx, 4);
175 memcpy(signature + 4, &ecx, 4); 178 memcpy(signature + 4, &ecx, 4);
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h
index 69021528b43c..cdbf36776106 100644
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -25,8 +25,8 @@ void destroy_context(struct mm_struct *mm);
25static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 25static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
26{ 26{
27#ifdef CONFIG_SMP 27#ifdef CONFIG_SMP
28 if (percpu_read(cpu_tlbstate.state) == TLBSTATE_OK) 28 if (this_cpu_read(cpu_tlbstate.state) == TLBSTATE_OK)
29 percpu_write(cpu_tlbstate.state, TLBSTATE_LAZY); 29 this_cpu_write(cpu_tlbstate.state, TLBSTATE_LAZY);
30#endif 30#endif
31} 31}
32 32
@@ -37,8 +37,8 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
37 37
38 if (likely(prev != next)) { 38 if (likely(prev != next)) {
39#ifdef CONFIG_SMP 39#ifdef CONFIG_SMP
40 percpu_write(cpu_tlbstate.state, TLBSTATE_OK); 40 this_cpu_write(cpu_tlbstate.state, TLBSTATE_OK);
41 percpu_write(cpu_tlbstate.active_mm, next); 41 this_cpu_write(cpu_tlbstate.active_mm, next);
42#endif 42#endif
43 cpumask_set_cpu(cpu, mm_cpumask(next)); 43 cpumask_set_cpu(cpu, mm_cpumask(next));
44 44
@@ -56,8 +56,8 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
56 } 56 }
57#ifdef CONFIG_SMP 57#ifdef CONFIG_SMP
58 else { 58 else {
59 percpu_write(cpu_tlbstate.state, TLBSTATE_OK); 59 this_cpu_write(cpu_tlbstate.state, TLBSTATE_OK);
60 BUG_ON(percpu_read(cpu_tlbstate.active_mm) != next); 60 BUG_ON(this_cpu_read(cpu_tlbstate.active_mm) != next);
61 61
62 if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next))) { 62 if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next))) {
63 /* We were in lazy tlb mode and leave_mm disabled 63 /* We were in lazy tlb mode and leave_mm disabled
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index ccb805966f68..957ec87385af 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -134,6 +134,8 @@
134#define MSR_AMD64_IBSFETCHCTL 0xc0011030 134#define MSR_AMD64_IBSFETCHCTL 0xc0011030
135#define MSR_AMD64_IBSFETCHLINAD 0xc0011031 135#define MSR_AMD64_IBSFETCHLINAD 0xc0011031
136#define MSR_AMD64_IBSFETCHPHYSAD 0xc0011032 136#define MSR_AMD64_IBSFETCHPHYSAD 0xc0011032
137#define MSR_AMD64_IBSFETCH_REG_COUNT 3
138#define MSR_AMD64_IBSFETCH_REG_MASK ((1UL<<MSR_AMD64_IBSFETCH_REG_COUNT)-1)
137#define MSR_AMD64_IBSOPCTL 0xc0011033 139#define MSR_AMD64_IBSOPCTL 0xc0011033
138#define MSR_AMD64_IBSOPRIP 0xc0011034 140#define MSR_AMD64_IBSOPRIP 0xc0011034
139#define MSR_AMD64_IBSOPDATA 0xc0011035 141#define MSR_AMD64_IBSOPDATA 0xc0011035
@@ -141,8 +143,11 @@
141#define MSR_AMD64_IBSOPDATA3 0xc0011037 143#define MSR_AMD64_IBSOPDATA3 0xc0011037
142#define MSR_AMD64_IBSDCLINAD 0xc0011038 144#define MSR_AMD64_IBSDCLINAD 0xc0011038
143#define MSR_AMD64_IBSDCPHYSAD 0xc0011039 145#define MSR_AMD64_IBSDCPHYSAD 0xc0011039
146#define MSR_AMD64_IBSOP_REG_COUNT 7
147#define MSR_AMD64_IBSOP_REG_MASK ((1UL<<MSR_AMD64_IBSOP_REG_COUNT)-1)
144#define MSR_AMD64_IBSCTL 0xc001103a 148#define MSR_AMD64_IBSCTL 0xc001103a
145#define MSR_AMD64_IBSBRTARGET 0xc001103b 149#define MSR_AMD64_IBSBRTARGET 0xc001103b
150#define MSR_AMD64_IBS_REG_COUNT_MAX 8 /* includes MSR_AMD64_IBSBRTARGET */
146 151
147/* Fam 15h MSRs */ 152/* Fam 15h MSRs */
148#define MSR_F15H_PERF_CTL 0xc0010200 153#define MSR_F15H_PERF_CTL 0xc0010200
diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h
index fd3f9f18cf3f..0e3793b821ef 100644
--- a/arch/x86/include/asm/nmi.h
+++ b/arch/x86/include/asm/nmi.h
@@ -27,6 +27,8 @@ void arch_trigger_all_cpu_backtrace(void);
27enum { 27enum {
28 NMI_LOCAL=0, 28 NMI_LOCAL=0,
29 NMI_UNKNOWN, 29 NMI_UNKNOWN,
30 NMI_SERR,
31 NMI_IO_CHECK,
30 NMI_MAX 32 NMI_MAX
31}; 33};
32 34
@@ -35,8 +37,24 @@ enum {
35 37
36typedef int (*nmi_handler_t)(unsigned int, struct pt_regs *); 38typedef int (*nmi_handler_t)(unsigned int, struct pt_regs *);
37 39
38int register_nmi_handler(unsigned int, nmi_handler_t, unsigned long, 40struct nmiaction {
39 const char *); 41 struct list_head list;
42 nmi_handler_t handler;
43 unsigned long flags;
44 const char *name;
45};
46
47#define register_nmi_handler(t, fn, fg, n) \
48({ \
49 static struct nmiaction fn##_na = { \
50 .handler = (fn), \
51 .name = (n), \
52 .flags = (fg), \
53 }; \
54 __register_nmi_handler((t), &fn##_na); \
55})
56
57int __register_nmi_handler(unsigned int, struct nmiaction *);
40 58
41void unregister_nmi_handler(unsigned int, const char *); 59void unregister_nmi_handler(unsigned int, const char *);
42 60
diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h
index ade619ff9e2a..ef17af013475 100644
--- a/arch/x86/include/asm/page_32_types.h
+++ b/arch/x86/include/asm/page_32_types.h
@@ -15,8 +15,8 @@
15 */ 15 */
16#define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL) 16#define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL)
17 17
18#define THREAD_ORDER 1 18#define THREAD_SIZE_ORDER 1
19#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) 19#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
20 20
21#define STACKFAULT_STACK 0 21#define STACKFAULT_STACK 0
22#define DOUBLEFAULT_STACK 1 22#define DOUBLEFAULT_STACK 1
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h
index 7639dbf5d223..320f7bb95f76 100644
--- a/arch/x86/include/asm/page_64_types.h
+++ b/arch/x86/include/asm/page_64_types.h
@@ -1,8 +1,8 @@
1#ifndef _ASM_X86_PAGE_64_DEFS_H 1#ifndef _ASM_X86_PAGE_64_DEFS_H
2#define _ASM_X86_PAGE_64_DEFS_H 2#define _ASM_X86_PAGE_64_DEFS_H
3 3
4#define THREAD_ORDER 1 4#define THREAD_SIZE_ORDER 1
5#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) 5#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
6#define CURRENT_MASK (~(THREAD_SIZE - 1)) 6#define CURRENT_MASK (~(THREAD_SIZE - 1))
7 7
8#define EXCEPTION_STACK_ORDER 0 8#define EXCEPTION_STACK_ORDER 0
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
index 7a11910a63c4..d9b8e3f7f42a 100644
--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -46,7 +46,7 @@
46 46
47#ifdef CONFIG_SMP 47#ifdef CONFIG_SMP
48#define __percpu_prefix "%%"__stringify(__percpu_seg)":" 48#define __percpu_prefix "%%"__stringify(__percpu_seg)":"
49#define __my_cpu_offset percpu_read(this_cpu_off) 49#define __my_cpu_offset this_cpu_read(this_cpu_off)
50 50
51/* 51/*
52 * Compared to the generic __my_cpu_offset version, the following 52 * Compared to the generic __my_cpu_offset version, the following
@@ -351,23 +351,15 @@ do { \
351}) 351})
352 352
353/* 353/*
354 * percpu_read() makes gcc load the percpu variable every time it is 354 * this_cpu_read() makes gcc load the percpu variable every time it is
355 * accessed while percpu_read_stable() allows the value to be cached. 355 * accessed while this_cpu_read_stable() allows the value to be cached.
356 * percpu_read_stable() is more efficient and can be used if its value 356 * this_cpu_read_stable() is more efficient and can be used if its value
357 * is guaranteed to be valid across cpus. The current users include 357 * is guaranteed to be valid across cpus. The current users include
358 * get_current() and get_thread_info() both of which are actually 358 * get_current() and get_thread_info() both of which are actually
359 * per-thread variables implemented as per-cpu variables and thus 359 * per-thread variables implemented as per-cpu variables and thus
360 * stable for the duration of the respective task. 360 * stable for the duration of the respective task.
361 */ 361 */
362#define percpu_read(var) percpu_from_op("mov", var, "m" (var)) 362#define this_cpu_read_stable(var) percpu_from_op("mov", var, "p" (&(var)))
363#define percpu_read_stable(var) percpu_from_op("mov", var, "p" (&(var)))
364#define percpu_write(var, val) percpu_to_op("mov", var, val)
365#define percpu_add(var, val) percpu_add_op(var, val)
366#define percpu_sub(var, val) percpu_add_op(var, -(val))
367#define percpu_and(var, val) percpu_to_op("and", var, val)
368#define percpu_or(var, val) percpu_to_op("or", var, val)
369#define percpu_xor(var, val) percpu_to_op("xor", var, val)
370#define percpu_inc(var) percpu_unary_op("inc", var)
371 363
372#define __this_cpu_read_1(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 364#define __this_cpu_read_1(pcp) percpu_from_op("mov", (pcp), "m"(pcp))
373#define __this_cpu_read_2(pcp) percpu_from_op("mov", (pcp), "m"(pcp)) 365#define __this_cpu_read_2(pcp) percpu_from_op("mov", (pcp), "m"(pcp))
@@ -512,7 +504,11 @@ static __always_inline int x86_this_cpu_constant_test_bit(unsigned int nr,
512{ 504{
513 unsigned long __percpu *a = (unsigned long *)addr + nr / BITS_PER_LONG; 505 unsigned long __percpu *a = (unsigned long *)addr + nr / BITS_PER_LONG;
514 506
515 return ((1UL << (nr % BITS_PER_LONG)) & percpu_read(*a)) != 0; 507#ifdef CONFIG_X86_64
508 return ((1UL << (nr % BITS_PER_LONG)) & __this_cpu_read_8(*a)) != 0;
509#else
510 return ((1UL << (nr % BITS_PER_LONG)) & __this_cpu_read_4(*a)) != 0;
511#endif
516} 512}
517 513
518static inline int x86_this_cpu_variable_test_bit(int nr, 514static inline int x86_this_cpu_variable_test_bit(int nr,
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index 2291895b1836..588f52ea810e 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -158,6 +158,7 @@ struct x86_pmu_capability {
158#define IBS_CAPS_OPCNT (1U<<4) 158#define IBS_CAPS_OPCNT (1U<<4)
159#define IBS_CAPS_BRNTRGT (1U<<5) 159#define IBS_CAPS_BRNTRGT (1U<<5)
160#define IBS_CAPS_OPCNTEXT (1U<<6) 160#define IBS_CAPS_OPCNTEXT (1U<<6)
161#define IBS_CAPS_RIPINVALIDCHK (1U<<7)
161 162
162#define IBS_CAPS_DEFAULT (IBS_CAPS_AVAIL \ 163#define IBS_CAPS_DEFAULT (IBS_CAPS_AVAIL \
163 | IBS_CAPS_FETCHSAM \ 164 | IBS_CAPS_FETCHSAM \
@@ -170,21 +171,28 @@ struct x86_pmu_capability {
170#define IBSCTL_LVT_OFFSET_VALID (1ULL<<8) 171#define IBSCTL_LVT_OFFSET_VALID (1ULL<<8)
171#define IBSCTL_LVT_OFFSET_MASK 0x0F 172#define IBSCTL_LVT_OFFSET_MASK 0x0F
172 173
173/* IbsFetchCtl bits/masks */ 174/* ibs fetch bits/masks */
174#define IBS_FETCH_RAND_EN (1ULL<<57) 175#define IBS_FETCH_RAND_EN (1ULL<<57)
175#define IBS_FETCH_VAL (1ULL<<49) 176#define IBS_FETCH_VAL (1ULL<<49)
176#define IBS_FETCH_ENABLE (1ULL<<48) 177#define IBS_FETCH_ENABLE (1ULL<<48)
177#define IBS_FETCH_CNT 0xFFFF0000ULL 178#define IBS_FETCH_CNT 0xFFFF0000ULL
178#define IBS_FETCH_MAX_CNT 0x0000FFFFULL 179#define IBS_FETCH_MAX_CNT 0x0000FFFFULL
179 180
180/* IbsOpCtl bits */ 181/* ibs op bits/masks */
182/* lower 4 bits of the current count are ignored: */
183#define IBS_OP_CUR_CNT (0xFFFF0ULL<<32)
181#define IBS_OP_CNT_CTL (1ULL<<19) 184#define IBS_OP_CNT_CTL (1ULL<<19)
182#define IBS_OP_VAL (1ULL<<18) 185#define IBS_OP_VAL (1ULL<<18)
183#define IBS_OP_ENABLE (1ULL<<17) 186#define IBS_OP_ENABLE (1ULL<<17)
184#define IBS_OP_MAX_CNT 0x0000FFFFULL 187#define IBS_OP_MAX_CNT 0x0000FFFFULL
185#define IBS_OP_MAX_CNT_EXT 0x007FFFFFULL /* not a register bit mask */ 188#define IBS_OP_MAX_CNT_EXT 0x007FFFFFULL /* not a register bit mask */
189#define IBS_RIP_INVALID (1ULL<<38)
186 190
191#ifdef CONFIG_X86_LOCAL_APIC
187extern u32 get_ibs_caps(void); 192extern u32 get_ibs_caps(void);
193#else
194static inline u32 get_ibs_caps(void) { return 0; }
195#endif
188 196
189#ifdef CONFIG_PERF_EVENTS 197#ifdef CONFIG_PERF_EVENTS
190extern void perf_events_lapic_init(void); 198extern void perf_events_lapic_init(void);
diff --git a/arch/x86/include/asm/posix_types.h b/arch/x86/include/asm/posix_types.h
index 3427b7798dbc..7ef7c3020e5c 100644
--- a/arch/x86/include/asm/posix_types.h
+++ b/arch/x86/include/asm/posix_types.h
@@ -7,9 +7,9 @@
7#else 7#else
8# ifdef __i386__ 8# ifdef __i386__
9# include "posix_types_32.h" 9# include "posix_types_32.h"
10# elif defined(__LP64__) 10# elif defined(__ILP32__)
11# include "posix_types_64.h"
12# else
13# include "posix_types_x32.h" 11# include "posix_types_x32.h"
12# else
13# include "posix_types_64.h"
14# endif 14# endif
15#endif 15#endif
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 4fa7dcceb6c0..ccbb1ea99ccb 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -974,8 +974,6 @@ extern bool cpu_has_amd_erratum(const int *);
974#define cpu_has_amd_erratum(x) (false) 974#define cpu_has_amd_erratum(x) (false)
975#endif /* CONFIG_CPU_SUP_AMD */ 975#endif /* CONFIG_CPU_SUP_AMD */
976 976
977void cpu_idle_wait(void);
978
979extern unsigned long arch_align_stack(unsigned long sp); 977extern unsigned long arch_align_stack(unsigned long sp);
980extern void free_init_pages(char *what, unsigned long begin, unsigned long end); 978extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
981 979
diff --git a/arch/x86/include/asm/sigcontext.h b/arch/x86/include/asm/sigcontext.h
index 4a085383af27..5ca71c065eef 100644
--- a/arch/x86/include/asm/sigcontext.h
+++ b/arch/x86/include/asm/sigcontext.h
@@ -257,7 +257,7 @@ struct sigcontext {
257 __u64 oldmask; 257 __u64 oldmask;
258 __u64 cr2; 258 __u64 cr2;
259 struct _fpstate __user *fpstate; /* zero when no FPU context */ 259 struct _fpstate __user *fpstate; /* zero when no FPU context */
260#ifndef __LP64__ 260#ifdef __ILP32__
261 __u32 __fpstate_pad; 261 __u32 __fpstate_pad;
262#endif 262#endif
263 __u64 reserved1[8]; 263 __u64 reserved1[8];
diff --git a/arch/x86/include/asm/siginfo.h b/arch/x86/include/asm/siginfo.h
index fc1aa5535646..34c47b3341c0 100644
--- a/arch/x86/include/asm/siginfo.h
+++ b/arch/x86/include/asm/siginfo.h
@@ -2,7 +2,13 @@
2#define _ASM_X86_SIGINFO_H 2#define _ASM_X86_SIGINFO_H
3 3
4#ifdef __x86_64__ 4#ifdef __x86_64__
5# define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) 5# ifdef __ILP32__ /* x32 */
6typedef long long __kernel_si_clock_t __attribute__((aligned(4)));
7# define __ARCH_SI_CLOCK_T __kernel_si_clock_t
8# define __ARCH_SI_ATTRIBUTES __attribute__((aligned(8)))
9# else /* x86-64 */
10# define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
11# endif
6#endif 12#endif
7 13
8#include <asm-generic/siginfo.h> 14#include <asm-generic/siginfo.h>
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index 0434c400287c..f48394513c37 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -62,6 +62,8 @@ DECLARE_EARLY_PER_CPU(int, x86_cpu_to_logical_apicid);
62/* Static state in head.S used to set up a CPU */ 62/* Static state in head.S used to set up a CPU */
63extern unsigned long stack_start; /* Initial stack pointer address */ 63extern unsigned long stack_start; /* Initial stack pointer address */
64 64
65struct task_struct;
66
65struct smp_ops { 67struct smp_ops {
66 void (*smp_prepare_boot_cpu)(void); 68 void (*smp_prepare_boot_cpu)(void);
67 void (*smp_prepare_cpus)(unsigned max_cpus); 69 void (*smp_prepare_cpus)(unsigned max_cpus);
@@ -70,7 +72,7 @@ struct smp_ops {
70 void (*stop_other_cpus)(int wait); 72 void (*stop_other_cpus)(int wait);
71 void (*smp_send_reschedule)(int cpu); 73 void (*smp_send_reschedule)(int cpu);
72 74
73 int (*cpu_up)(unsigned cpu); 75 int (*cpu_up)(unsigned cpu, struct task_struct *tidle);
74 int (*cpu_disable)(void); 76 int (*cpu_disable)(void);
75 void (*cpu_die)(unsigned int cpu); 77 void (*cpu_die)(unsigned int cpu);
76 void (*play_dead)(void); 78 void (*play_dead)(void);
@@ -113,9 +115,9 @@ static inline void smp_cpus_done(unsigned int max_cpus)
113 smp_ops.smp_cpus_done(max_cpus); 115 smp_ops.smp_cpus_done(max_cpus);
114} 116}
115 117
116static inline int __cpu_up(unsigned int cpu) 118static inline int __cpu_up(unsigned int cpu, struct task_struct *tidle)
117{ 119{
118 return smp_ops.cpu_up(cpu); 120 return smp_ops.cpu_up(cpu, tidle);
119} 121}
120 122
121static inline int __cpu_disable(void) 123static inline int __cpu_disable(void)
@@ -152,7 +154,7 @@ void cpu_disable_common(void);
152void native_smp_prepare_boot_cpu(void); 154void native_smp_prepare_boot_cpu(void);
153void native_smp_prepare_cpus(unsigned int max_cpus); 155void native_smp_prepare_cpus(unsigned int max_cpus);
154void native_smp_cpus_done(unsigned int max_cpus); 156void native_smp_cpus_done(unsigned int max_cpus);
155int native_cpu_up(unsigned int cpunum); 157int native_cpu_up(unsigned int cpunum, struct task_struct *tidle);
156int native_cpu_disable(void); 158int native_cpu_disable(void);
157void native_cpu_die(unsigned int cpu); 159void native_cpu_die(unsigned int cpu);
158void native_play_dead(void); 160void native_play_dead(void);
@@ -162,6 +164,7 @@ int wbinvd_on_all_cpus(void);
162 164
163void native_send_call_func_ipi(const struct cpumask *mask); 165void native_send_call_func_ipi(const struct cpumask *mask);
164void native_send_call_func_single_ipi(int cpu); 166void native_send_call_func_single_ipi(int cpu);
167void x86_idle_thread_init(unsigned int cpu, struct task_struct *idle);
165 168
166void smp_store_cpu_info(int id); 169void smp_store_cpu_info(int id);
167#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) 170#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
@@ -188,11 +191,11 @@ extern unsigned disabled_cpus __cpuinitdata;
188 * from the initial startup. We map APIC_BASE very early in page_setup(), 191 * from the initial startup. We map APIC_BASE very early in page_setup(),
189 * so this is correct in the x86 case. 192 * so this is correct in the x86 case.
190 */ 193 */
191#define raw_smp_processor_id() (percpu_read(cpu_number)) 194#define raw_smp_processor_id() (this_cpu_read(cpu_number))
192extern int safe_smp_processor_id(void); 195extern int safe_smp_processor_id(void);
193 196
194#elif defined(CONFIG_X86_64_SMP) 197#elif defined(CONFIG_X86_64_SMP)
195#define raw_smp_processor_id() (percpu_read(cpu_number)) 198#define raw_smp_processor_id() (this_cpu_read(cpu_number))
196 199
197#define stack_smp_processor_id() \ 200#define stack_smp_processor_id() \
198({ \ 201({ \
diff --git a/arch/x86/include/asm/stackprotector.h b/arch/x86/include/asm/stackprotector.h
index b5d9533d2c38..6a998598f172 100644
--- a/arch/x86/include/asm/stackprotector.h
+++ b/arch/x86/include/asm/stackprotector.h
@@ -75,9 +75,9 @@ static __always_inline void boot_init_stack_canary(void)
75 75
76 current->stack_canary = canary; 76 current->stack_canary = canary;
77#ifdef CONFIG_X86_64 77#ifdef CONFIG_X86_64
78 percpu_write(irq_stack_union.stack_canary, canary); 78 this_cpu_write(irq_stack_union.stack_canary, canary);
79#else 79#else
80 percpu_write(stack_canary.canary, canary); 80 this_cpu_write(stack_canary.canary, canary);
81#endif 81#endif
82} 82}
83 83
diff --git a/arch/x86/include/asm/stat.h b/arch/x86/include/asm/stat.h
index e0b1d9bbcbc6..7b3ddc348585 100644
--- a/arch/x86/include/asm/stat.h
+++ b/arch/x86/include/asm/stat.h
@@ -25,6 +25,12 @@ struct stat {
25 unsigned long __unused5; 25 unsigned long __unused5;
26}; 26};
27 27
28/* We don't need to memset the whole thing just to initialize the padding */
29#define INIT_STRUCT_STAT_PADDING(st) do { \
30 st.__unused4 = 0; \
31 st.__unused5 = 0; \
32} while (0)
33
28#define STAT64_HAS_BROKEN_ST_INO 1 34#define STAT64_HAS_BROKEN_ST_INO 1
29 35
30/* This matches struct stat64 in glibc2.1, hence the absolutely 36/* This matches struct stat64 in glibc2.1, hence the absolutely
@@ -63,6 +69,12 @@ struct stat64 {
63 unsigned long long st_ino; 69 unsigned long long st_ino;
64}; 70};
65 71
72/* We don't need to memset the whole thing just to initialize the padding */
73#define INIT_STRUCT_STAT64_PADDING(st) do { \
74 memset(&st.__pad0, 0, sizeof(st.__pad0)); \
75 memset(&st.__pad3, 0, sizeof(st.__pad3)); \
76} while (0)
77
66#else /* __i386__ */ 78#else /* __i386__ */
67 79
68struct stat { 80struct stat {
@@ -87,6 +99,15 @@ struct stat {
87 unsigned long st_ctime_nsec; 99 unsigned long st_ctime_nsec;
88 long __unused[3]; 100 long __unused[3];
89}; 101};
102
103/* We don't need to memset the whole thing just to initialize the padding */
104#define INIT_STRUCT_STAT_PADDING(st) do { \
105 st.__pad0 = 0; \
106 st.__unused[0] = 0; \
107 st.__unused[1] = 0; \
108 st.__unused[2] = 0; \
109} while (0)
110
90#endif 111#endif
91 112
92/* for 32bit emulation and 32 bit kernels */ 113/* for 32bit emulation and 32 bit kernels */
diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h
index 386b78686c4d..1ace47b62592 100644
--- a/arch/x86/include/asm/syscall.h
+++ b/arch/x86/include/asm/syscall.h
@@ -13,9 +13,11 @@
13#ifndef _ASM_X86_SYSCALL_H 13#ifndef _ASM_X86_SYSCALL_H
14#define _ASM_X86_SYSCALL_H 14#define _ASM_X86_SYSCALL_H
15 15
16#include <linux/audit.h>
16#include <linux/sched.h> 17#include <linux/sched.h>
17#include <linux/err.h> 18#include <linux/err.h>
18#include <asm/asm-offsets.h> /* For NR_syscalls */ 19#include <asm/asm-offsets.h> /* For NR_syscalls */
20#include <asm/thread_info.h> /* for TS_COMPAT */
19#include <asm/unistd.h> 21#include <asm/unistd.h>
20 22
21extern const unsigned long sys_call_table[]; 23extern const unsigned long sys_call_table[];
@@ -88,6 +90,12 @@ static inline void syscall_set_arguments(struct task_struct *task,
88 memcpy(&regs->bx + i, args, n * sizeof(args[0])); 90 memcpy(&regs->bx + i, args, n * sizeof(args[0]));
89} 91}
90 92
93static inline int syscall_get_arch(struct task_struct *task,
94 struct pt_regs *regs)
95{
96 return AUDIT_ARCH_I386;
97}
98
91#else /* CONFIG_X86_64 */ 99#else /* CONFIG_X86_64 */
92 100
93static inline void syscall_get_arguments(struct task_struct *task, 101static inline void syscall_get_arguments(struct task_struct *task,
@@ -212,6 +220,25 @@ static inline void syscall_set_arguments(struct task_struct *task,
212 } 220 }
213} 221}
214 222
223static inline int syscall_get_arch(struct task_struct *task,
224 struct pt_regs *regs)
225{
226#ifdef CONFIG_IA32_EMULATION
227 /*
228 * TS_COMPAT is set for 32-bit syscall entry and then
229 * remains set until we return to user mode.
230 *
231 * TIF_IA32 tasks should always have TS_COMPAT set at
232 * system call time.
233 *
234 * x32 tasks should be considered AUDIT_ARCH_X86_64.
235 */
236 if (task_thread_info(task)->status & TS_COMPAT)
237 return AUDIT_ARCH_I386;
238#endif
239 /* Both x32 and x86_64 are considered "64-bit". */
240 return AUDIT_ARCH_X86_64;
241}
215#endif /* CONFIG_X86_32 */ 242#endif /* CONFIG_X86_32 */
216 243
217#endif /* _ASM_X86_SYSCALL_H */ 244#endif /* _ASM_X86_SYSCALL_H */
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index ad6df8ccd715..3c9aebc00d39 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -155,24 +155,6 @@ struct thread_info {
155 155
156#define PREEMPT_ACTIVE 0x10000000 156#define PREEMPT_ACTIVE 0x10000000
157 157
158/* thread information allocation */
159#ifdef CONFIG_DEBUG_STACK_USAGE
160#define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
161#else
162#define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK)
163#endif
164
165#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
166
167#define alloc_thread_info_node(tsk, node) \
168({ \
169 struct page *page = alloc_pages_node(node, THREAD_FLAGS, \
170 THREAD_ORDER); \
171 struct thread_info *ret = page ? page_address(page) : NULL; \
172 \
173 ret; \
174})
175
176#ifdef CONFIG_X86_32 158#ifdef CONFIG_X86_32
177 159
178#define STACK_WARN (THREAD_SIZE/8) 160#define STACK_WARN (THREAD_SIZE/8)
@@ -222,7 +204,7 @@ DECLARE_PER_CPU(unsigned long, kernel_stack);
222static inline struct thread_info *current_thread_info(void) 204static inline struct thread_info *current_thread_info(void)
223{ 205{
224 struct thread_info *ti; 206 struct thread_info *ti;
225 ti = (void *)(percpu_read_stable(kernel_stack) + 207 ti = (void *)(this_cpu_read_stable(kernel_stack) +
226 KERNEL_STACK_OFFSET - THREAD_SIZE); 208 KERNEL_STACK_OFFSET - THREAD_SIZE);
227 return ti; 209 return ti;
228} 210}
@@ -282,8 +264,7 @@ static inline bool is_ia32_task(void)
282 264
283#ifndef __ASSEMBLY__ 265#ifndef __ASSEMBLY__
284extern void arch_task_cache_init(void); 266extern void arch_task_cache_init(void);
285extern void free_thread_info(struct thread_info *ti);
286extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); 267extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
287#define arch_task_cache_init arch_task_cache_init 268extern void arch_release_task_struct(struct task_struct *tsk);
288#endif 269#endif
289#endif /* _ASM_X86_THREAD_INFO_H */ 270#endif /* _ASM_X86_THREAD_INFO_H */
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
index c0e108e08079..1620d23f14d7 100644
--- a/arch/x86/include/asm/tlbflush.h
+++ b/arch/x86/include/asm/tlbflush.h
@@ -156,8 +156,8 @@ DECLARE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate);
156 156
157static inline void reset_lazy_tlbstate(void) 157static inline void reset_lazy_tlbstate(void)
158{ 158{
159 percpu_write(cpu_tlbstate.state, 0); 159 this_cpu_write(cpu_tlbstate.state, 0);
160 percpu_write(cpu_tlbstate.active_mm, &init_mm); 160 this_cpu_write(cpu_tlbstate.active_mm, &init_mm);
161} 161}
162 162
163#endif /* SMP */ 163#endif /* SMP */
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index b9676ae37ada..095b21507b6a 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -92,44 +92,6 @@ extern void setup_node_to_cpumask_map(void);
92 92
93#define pcibus_to_node(bus) __pcibus_to_node(bus) 93#define pcibus_to_node(bus) __pcibus_to_node(bus)
94 94
95#ifdef CONFIG_X86_32
96# define SD_CACHE_NICE_TRIES 1
97# define SD_IDLE_IDX 1
98#else
99# define SD_CACHE_NICE_TRIES 2
100# define SD_IDLE_IDX 2
101#endif
102
103/* sched_domains SD_NODE_INIT for NUMA machines */
104#define SD_NODE_INIT (struct sched_domain) { \
105 .min_interval = 8, \
106 .max_interval = 32, \
107 .busy_factor = 32, \
108 .imbalance_pct = 125, \
109 .cache_nice_tries = SD_CACHE_NICE_TRIES, \
110 .busy_idx = 3, \
111 .idle_idx = SD_IDLE_IDX, \
112 .newidle_idx = 0, \
113 .wake_idx = 0, \
114 .forkexec_idx = 0, \
115 \
116 .flags = 1*SD_LOAD_BALANCE \
117 | 1*SD_BALANCE_NEWIDLE \
118 | 1*SD_BALANCE_EXEC \
119 | 1*SD_BALANCE_FORK \
120 | 0*SD_BALANCE_WAKE \
121 | 1*SD_WAKE_AFFINE \
122 | 0*SD_PREFER_LOCAL \
123 | 0*SD_SHARE_CPUPOWER \
124 | 0*SD_POWERSAVINGS_BALANCE \
125 | 0*SD_SHARE_PKG_RESOURCES \
126 | 1*SD_SERIALIZE \
127 | 0*SD_PREFER_SIBLING \
128 , \
129 .last_balance = jiffies, \
130 .balance_interval = 1, \
131}
132
133extern int __node_distance(int, int); 95extern int __node_distance(int, int);
134#define node_distance(a, b) __node_distance(a, b) 96#define node_distance(a, b) __node_distance(a, b)
135 97
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
index 8be5f54d9360..e0544597cfe7 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -557,6 +557,8 @@ struct __large_struct { unsigned long buf[100]; };
557 557
558extern unsigned long 558extern unsigned long
559copy_from_user_nmi(void *to, const void __user *from, unsigned long n); 559copy_from_user_nmi(void *to, const void __user *from, unsigned long n);
560extern __must_check long
561strncpy_from_user(char *dst, const char __user *src, long count);
560 562
561/* 563/*
562 * movsl can be slow when source and dest are not both 8-byte aligned 564 * movsl can be slow when source and dest are not both 8-byte aligned
diff --git a/arch/x86/include/asm/uaccess_32.h b/arch/x86/include/asm/uaccess_32.h
index 566e803cc602..8084bc73b18c 100644
--- a/arch/x86/include/asm/uaccess_32.h
+++ b/arch/x86/include/asm/uaccess_32.h
@@ -213,11 +213,6 @@ static inline unsigned long __must_check copy_from_user(void *to,
213 return n; 213 return n;
214} 214}
215 215
216long __must_check strncpy_from_user(char *dst, const char __user *src,
217 long count);
218long __must_check __strncpy_from_user(char *dst,
219 const char __user *src, long count);
220
221/** 216/**
222 * strlen_user: - Get the size of a string in user space. 217 * strlen_user: - Get the size of a string in user space.
223 * @str: The string to measure. 218 * @str: The string to measure.
diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
index 1c66d30971ad..fcd4b6f3ef02 100644
--- a/arch/x86/include/asm/uaccess_64.h
+++ b/arch/x86/include/asm/uaccess_64.h
@@ -208,10 +208,6 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
208 } 208 }
209} 209}
210 210
211__must_check long
212strncpy_from_user(char *dst, const char __user *src, long count);
213__must_check long
214__strncpy_from_user(char *dst, const char __user *src, long count);
215__must_check long strnlen_user(const char __user *str, long n); 211__must_check long strnlen_user(const char __user *str, long n);
216__must_check long __strnlen_user(const char __user *str, long n); 212__must_check long __strnlen_user(const char __user *str, long n);
217__must_check long strlen_user(const char __user *str); 213__must_check long strlen_user(const char __user *str);
diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h
index 37cdc9d99bb1..4437001d8e3d 100644
--- a/arch/x86/include/asm/unistd.h
+++ b/arch/x86/include/asm/unistd.h
@@ -63,10 +63,10 @@
63#else 63#else
64# ifdef __i386__ 64# ifdef __i386__
65# include <asm/unistd_32.h> 65# include <asm/unistd_32.h>
66# elif defined(__LP64__) 66# elif defined(__ILP32__)
67# include <asm/unistd_64.h>
68# else
69# include <asm/unistd_x32.h> 67# include <asm/unistd_x32.h>
68# else
69# include <asm/unistd_64.h>
70# endif 70# endif
71#endif 71#endif
72 72
diff --git a/arch/x86/include/asm/word-at-a-time.h b/arch/x86/include/asm/word-at-a-time.h
index 6fe6767b7124..e58f03b206c3 100644
--- a/arch/x86/include/asm/word-at-a-time.h
+++ b/arch/x86/include/asm/word-at-a-time.h
@@ -43,4 +43,37 @@ static inline unsigned long has_zero(unsigned long a)
43 return ((a - REPEAT_BYTE(0x01)) & ~a) & REPEAT_BYTE(0x80); 43 return ((a - REPEAT_BYTE(0x01)) & ~a) & REPEAT_BYTE(0x80);
44} 44}
45 45
46/*
47 * Load an unaligned word from kernel space.
48 *
49 * In the (very unlikely) case of the word being a page-crosser
50 * and the next page not being mapped, take the exception and
51 * return zeroes in the non-existing part.
52 */
53static inline unsigned long load_unaligned_zeropad(const void *addr)
54{
55 unsigned long ret, dummy;
56
57 asm(
58 "1:\tmov %2,%0\n"
59 "2:\n"
60 ".section .fixup,\"ax\"\n"
61 "3:\t"
62 "lea %2,%1\n\t"
63 "and %3,%1\n\t"
64 "mov (%1),%0\n\t"
65 "leal %2,%%ecx\n\t"
66 "andl %4,%%ecx\n\t"
67 "shll $3,%%ecx\n\t"
68 "shr %%cl,%0\n\t"
69 "jmp 2b\n"
70 ".previous\n"
71 _ASM_EXTABLE(1b, 3b)
72 :"=&r" (ret),"=&c" (dummy)
73 :"m" (*(unsigned long *)addr),
74 "i" (-sizeof(unsigned long)),
75 "i" (sizeof(unsigned long)-1));
76 return ret;
77}
78
46#endif /* _ASM_WORD_AT_A_TIME_H */ 79#endif /* _ASM_WORD_AT_A_TIME_H */
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
index baaca8defec8..c090af10ac7d 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -188,13 +188,19 @@ struct x86_msi_ops {
188 void (*restore_msi_irqs)(struct pci_dev *dev, int irq); 188 void (*restore_msi_irqs)(struct pci_dev *dev, int irq);
189}; 189};
190 190
191struct x86_io_apic_ops {
192 void (*init) (void);
193 unsigned int (*read) (unsigned int apic, unsigned int reg);
194 void (*write) (unsigned int apic, unsigned int reg, unsigned int value);
195 void (*modify)(unsigned int apic, unsigned int reg, unsigned int value);
196};
197
191extern struct x86_init_ops x86_init; 198extern struct x86_init_ops x86_init;
192extern struct x86_cpuinit_ops x86_cpuinit; 199extern struct x86_cpuinit_ops x86_cpuinit;
193extern struct x86_platform_ops x86_platform; 200extern struct x86_platform_ops x86_platform;
194extern struct x86_msi_ops x86_msi; 201extern struct x86_msi_ops x86_msi;
195 202extern struct x86_io_apic_ops x86_io_apic_ops;
196extern void x86_init_noop(void); 203extern void x86_init_noop(void);
197extern void x86_init_uint_noop(unsigned int unused); 204extern void x86_init_uint_noop(unsigned int unused);
198extern void x86_default_fixup_cpu_id(struct cpuinfo_x86 *c, int node);
199 205
200#endif 206#endif
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 532d2e090e6f..56ebd1f98447 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5extra-y := head_$(BITS).o head$(BITS).o head.o init_task.o vmlinux.lds 5extra-y := head_$(BITS).o head$(BITS).o head.o vmlinux.lds
6 6
7CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE) 7CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE)
8 8
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index a415b1f44365..7c439fe4941b 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -593,7 +593,7 @@ void __init acpi_set_irq_model_ioapic(void)
593#ifdef CONFIG_ACPI_HOTPLUG_CPU 593#ifdef CONFIG_ACPI_HOTPLUG_CPU
594#include <acpi/processor.h> 594#include <acpi/processor.h>
595 595
596static void __cpuinitdata acpi_map_cpu2node(acpi_handle handle, int cpu, int physid) 596static void __cpuinit acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
597{ 597{
598#ifdef CONFIG_ACPI_NUMA 598#ifdef CONFIG_ACPI_NUMA
599 int nid; 599 int nid;
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 103b6ab368d3..146a49c763a4 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -24,6 +24,10 @@ unsigned long acpi_realmode_flags;
24static char temp_stack[4096]; 24static char temp_stack[4096];
25#endif 25#endif
26 26
27asmlinkage void acpi_enter_s3(void)
28{
29 acpi_enter_sleep_state(3, wake_sleep_flags);
30}
27/** 31/**
28 * acpi_suspend_lowlevel - save kernel state 32 * acpi_suspend_lowlevel - save kernel state
29 * 33 *
diff --git a/arch/x86/kernel/acpi/sleep.h b/arch/x86/kernel/acpi/sleep.h
index 416d4be13fef..d68677a2a010 100644
--- a/arch/x86/kernel/acpi/sleep.h
+++ b/arch/x86/kernel/acpi/sleep.h
@@ -3,12 +3,16 @@
3 */ 3 */
4 4
5#include <asm/trampoline.h> 5#include <asm/trampoline.h>
6#include <linux/linkage.h>
6 7
7extern unsigned long saved_video_mode; 8extern unsigned long saved_video_mode;
8extern long saved_magic; 9extern long saved_magic;
9 10
10extern int wakeup_pmode_return; 11extern int wakeup_pmode_return;
11 12
13extern u8 wake_sleep_flags;
14extern asmlinkage void acpi_enter_s3(void);
15
12extern unsigned long acpi_copy_wakeup_routine(unsigned long); 16extern unsigned long acpi_copy_wakeup_routine(unsigned long);
13extern void wakeup_long64(void); 17extern void wakeup_long64(void);
14 18
diff --git a/arch/x86/kernel/acpi/wakeup_32.S b/arch/x86/kernel/acpi/wakeup_32.S
index 13ab720573e3..72610839f03b 100644
--- a/arch/x86/kernel/acpi/wakeup_32.S
+++ b/arch/x86/kernel/acpi/wakeup_32.S
@@ -74,9 +74,7 @@ restore_registers:
74ENTRY(do_suspend_lowlevel) 74ENTRY(do_suspend_lowlevel)
75 call save_processor_state 75 call save_processor_state
76 call save_registers 76 call save_registers
77 pushl $3 77 call acpi_enter_s3
78 call acpi_enter_sleep_state
79 addl $4, %esp
80 78
81# In case of S3 failure, we'll emerge here. Jump 79# In case of S3 failure, we'll emerge here. Jump
82# to ret_point to recover 80# to ret_point to recover
diff --git a/arch/x86/kernel/acpi/wakeup_64.S b/arch/x86/kernel/acpi/wakeup_64.S
index 8ea5164cbd04..014d1d28c397 100644
--- a/arch/x86/kernel/acpi/wakeup_64.S
+++ b/arch/x86/kernel/acpi/wakeup_64.S
@@ -71,9 +71,7 @@ ENTRY(do_suspend_lowlevel)
71 movq %rsi, saved_rsi 71 movq %rsi, saved_rsi
72 72
73 addq $8, %rsp 73 addq $8, %rsp
74 movl $3, %edi 74 call acpi_enter_s3
75 xorl %eax, %eax
76 call acpi_enter_sleep_state
77 /* in case something went wrong, restore the machine status and go on */ 75 /* in case something went wrong, restore the machine status and go on */
78 jmp resume_point 76 jmp resume_point
79 77
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 11544d8f1e97..39a222e094af 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -35,6 +35,7 @@
35#include <linux/smp.h> 35#include <linux/smp.h>
36#include <linux/mm.h> 36#include <linux/mm.h>
37 37
38#include <asm/irq_remapping.h>
38#include <asm/perf_event.h> 39#include <asm/perf_event.h>
39#include <asm/x86_init.h> 40#include <asm/x86_init.h>
40#include <asm/pgalloc.h> 41#include <asm/pgalloc.h>
@@ -1325,11 +1326,13 @@ void __cpuinit setup_local_APIC(void)
1325 acked); 1326 acked);
1326 break; 1327 break;
1327 } 1328 }
1328 if (cpu_has_tsc) { 1329 if (queued) {
1329 rdtscll(ntsc); 1330 if (cpu_has_tsc) {
1330 max_loops = (cpu_khz << 10) - (ntsc - tsc); 1331 rdtscll(ntsc);
1331 } else 1332 max_loops = (cpu_khz << 10) - (ntsc - tsc);
1332 max_loops--; 1333 } else
1334 max_loops--;
1335 }
1333 } while (queued && max_loops > 0); 1336 } while (queued && max_loops > 0);
1334 WARN_ON(max_loops <= 0); 1337 WARN_ON(max_loops <= 0);
1335 1338
@@ -1441,8 +1444,8 @@ void __init bsp_end_local_APIC_setup(void)
1441 * Now that local APIC setup is completed for BP, configure the fault 1444 * Now that local APIC setup is completed for BP, configure the fault
1442 * handling for interrupt remapping. 1445 * handling for interrupt remapping.
1443 */ 1446 */
1444 if (intr_remapping_enabled) 1447 if (irq_remapping_enabled)
1445 enable_drhd_fault_handling(); 1448 irq_remap_enable_fault_handling();
1446 1449
1447} 1450}
1448 1451
@@ -1517,7 +1520,7 @@ void enable_x2apic(void)
1517int __init enable_IR(void) 1520int __init enable_IR(void)
1518{ 1521{
1519#ifdef CONFIG_IRQ_REMAP 1522#ifdef CONFIG_IRQ_REMAP
1520 if (!intr_remapping_supported()) { 1523 if (!irq_remapping_supported()) {
1521 pr_debug("intr-remapping not supported\n"); 1524 pr_debug("intr-remapping not supported\n");
1522 return -1; 1525 return -1;
1523 } 1526 }
@@ -1528,7 +1531,7 @@ int __init enable_IR(void)
1528 return -1; 1531 return -1;
1529 } 1532 }
1530 1533
1531 return enable_intr_remapping(); 1534 return irq_remapping_enable();
1532#endif 1535#endif
1533 return -1; 1536 return -1;
1534} 1537}
@@ -1537,10 +1540,13 @@ void __init enable_IR_x2apic(void)
1537{ 1540{
1538 unsigned long flags; 1541 unsigned long flags;
1539 int ret, x2apic_enabled = 0; 1542 int ret, x2apic_enabled = 0;
1540 int dmar_table_init_ret; 1543 int hardware_init_ret;
1544
1545 /* Make sure irq_remap_ops are initialized */
1546 setup_irq_remapping_ops();
1541 1547
1542 dmar_table_init_ret = dmar_table_init(); 1548 hardware_init_ret = irq_remapping_prepare();
1543 if (dmar_table_init_ret && !x2apic_supported()) 1549 if (hardware_init_ret && !x2apic_supported())
1544 return; 1550 return;
1545 1551
1546 ret = save_ioapic_entries(); 1552 ret = save_ioapic_entries();
@@ -1556,7 +1562,7 @@ void __init enable_IR_x2apic(void)
1556 if (x2apic_preenabled && nox2apic) 1562 if (x2apic_preenabled && nox2apic)
1557 disable_x2apic(); 1563 disable_x2apic();
1558 1564
1559 if (dmar_table_init_ret) 1565 if (hardware_init_ret)
1560 ret = -1; 1566 ret = -1;
1561 else 1567 else
1562 ret = enable_IR(); 1568 ret = enable_IR();
@@ -1637,9 +1643,11 @@ static int __init apic_verify(void)
1637 mp_lapic_addr = APIC_DEFAULT_PHYS_BASE; 1643 mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
1638 1644
1639 /* The BIOS may have set up the APIC at some other address */ 1645 /* The BIOS may have set up the APIC at some other address */
1640 rdmsr(MSR_IA32_APICBASE, l, h); 1646 if (boot_cpu_data.x86 >= 6) {
1641 if (l & MSR_IA32_APICBASE_ENABLE) 1647 rdmsr(MSR_IA32_APICBASE, l, h);
1642 mp_lapic_addr = l & MSR_IA32_APICBASE_BASE; 1648 if (l & MSR_IA32_APICBASE_ENABLE)
1649 mp_lapic_addr = l & MSR_IA32_APICBASE_BASE;
1650 }
1643 1651
1644 pr_info("Found and enabled local APIC!\n"); 1652 pr_info("Found and enabled local APIC!\n");
1645 return 0; 1653 return 0;
@@ -1657,13 +1665,15 @@ int __init apic_force_enable(unsigned long addr)
1657 * MSR. This can only be done in software for Intel P6 or later 1665 * MSR. This can only be done in software for Intel P6 or later
1658 * and AMD K7 (Model > 1) or later. 1666 * and AMD K7 (Model > 1) or later.
1659 */ 1667 */
1660 rdmsr(MSR_IA32_APICBASE, l, h); 1668 if (boot_cpu_data.x86 >= 6) {
1661 if (!(l & MSR_IA32_APICBASE_ENABLE)) { 1669 rdmsr(MSR_IA32_APICBASE, l, h);
1662 pr_info("Local APIC disabled by BIOS -- reenabling.\n"); 1670 if (!(l & MSR_IA32_APICBASE_ENABLE)) {
1663 l &= ~MSR_IA32_APICBASE_BASE; 1671 pr_info("Local APIC disabled by BIOS -- reenabling.\n");
1664 l |= MSR_IA32_APICBASE_ENABLE | addr; 1672 l &= ~MSR_IA32_APICBASE_BASE;
1665 wrmsr(MSR_IA32_APICBASE, l, h); 1673 l |= MSR_IA32_APICBASE_ENABLE | addr;
1666 enabled_via_apicbase = 1; 1674 wrmsr(MSR_IA32_APICBASE, l, h);
1675 enabled_via_apicbase = 1;
1676 }
1667 } 1677 }
1668 return apic_verify(); 1678 return apic_verify();
1669} 1679}
@@ -2172,8 +2182,8 @@ static int lapic_suspend(void)
2172 local_irq_save(flags); 2182 local_irq_save(flags);
2173 disable_local_APIC(); 2183 disable_local_APIC();
2174 2184
2175 if (intr_remapping_enabled) 2185 if (irq_remapping_enabled)
2176 disable_intr_remapping(); 2186 irq_remapping_disable();
2177 2187
2178 local_irq_restore(flags); 2188 local_irq_restore(flags);
2179 return 0; 2189 return 0;
@@ -2189,7 +2199,7 @@ static void lapic_resume(void)
2189 return; 2199 return;
2190 2200
2191 local_irq_save(flags); 2201 local_irq_save(flags);
2192 if (intr_remapping_enabled) { 2202 if (irq_remapping_enabled) {
2193 /* 2203 /*
2194 * IO-APIC and PIC have their own resume routines. 2204 * IO-APIC and PIC have their own resume routines.
2195 * We just mask them here to make sure the interrupt 2205 * We just mask them here to make sure the interrupt
@@ -2209,10 +2219,12 @@ static void lapic_resume(void)
2209 * FIXME! This will be wrong if we ever support suspend on 2219 * FIXME! This will be wrong if we ever support suspend on
2210 * SMP! We'll need to do this as part of the CPU restore! 2220 * SMP! We'll need to do this as part of the CPU restore!
2211 */ 2221 */
2212 rdmsr(MSR_IA32_APICBASE, l, h); 2222 if (boot_cpu_data.x86 >= 6) {
2213 l &= ~MSR_IA32_APICBASE_BASE; 2223 rdmsr(MSR_IA32_APICBASE, l, h);
2214 l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr; 2224 l &= ~MSR_IA32_APICBASE_BASE;
2215 wrmsr(MSR_IA32_APICBASE, l, h); 2225 l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr;
2226 wrmsr(MSR_IA32_APICBASE, l, h);
2227 }
2216 } 2228 }
2217 2229
2218 maxlvt = lapic_get_maxlvt(); 2230 maxlvt = lapic_get_maxlvt();
@@ -2239,8 +2251,8 @@ static void lapic_resume(void)
2239 apic_write(APIC_ESR, 0); 2251 apic_write(APIC_ESR, 0);
2240 apic_read(APIC_ESR); 2252 apic_read(APIC_ESR);
2241 2253
2242 if (intr_remapping_enabled) 2254 if (irq_remapping_enabled)
2243 reenable_intr_remapping(x2apic_mode); 2255 irq_remapping_reenable(x2apic_mode);
2244 2256
2245 local_irq_restore(flags); 2257 local_irq_restore(flags);
2246} 2258}
diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c
index 359b6899a36c..0e881c46e8c8 100644
--- a/arch/x86/kernel/apic/apic_flat_64.c
+++ b/arch/x86/kernel/apic/apic_flat_64.c
@@ -227,6 +227,7 @@ static struct apic apic_flat = {
227 227
228 .read = native_apic_mem_read, 228 .read = native_apic_mem_read,
229 .write = native_apic_mem_write, 229 .write = native_apic_mem_write,
230 .eoi_write = native_apic_mem_write,
230 .icr_read = native_apic_icr_read, 231 .icr_read = native_apic_icr_read,
231 .icr_write = native_apic_icr_write, 232 .icr_write = native_apic_icr_write,
232 .wait_icr_idle = native_apic_wait_icr_idle, 233 .wait_icr_idle = native_apic_wait_icr_idle,
@@ -386,6 +387,7 @@ static struct apic apic_physflat = {
386 387
387 .read = native_apic_mem_read, 388 .read = native_apic_mem_read,
388 .write = native_apic_mem_write, 389 .write = native_apic_mem_write,
390 .eoi_write = native_apic_mem_write,
389 .icr_read = native_apic_icr_read, 391 .icr_read = native_apic_icr_read,
390 .icr_write = native_apic_icr_write, 392 .icr_write = native_apic_icr_write,
391 .wait_icr_idle = native_apic_wait_icr_idle, 393 .wait_icr_idle = native_apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/apic_noop.c b/arch/x86/kernel/apic/apic_noop.c
index 634ae6cdd5c9..a6e4c6e06c08 100644
--- a/arch/x86/kernel/apic/apic_noop.c
+++ b/arch/x86/kernel/apic/apic_noop.c
@@ -181,6 +181,7 @@ struct apic apic_noop = {
181 181
182 .read = noop_apic_read, 182 .read = noop_apic_read,
183 .write = noop_apic_write, 183 .write = noop_apic_write,
184 .eoi_write = noop_apic_write,
184 .icr_read = noop_apic_icr_read, 185 .icr_read = noop_apic_icr_read,
185 .icr_write = noop_apic_icr_write, 186 .icr_write = noop_apic_icr_write,
186 .wait_icr_idle = noop_apic_wait_icr_idle, 187 .wait_icr_idle = noop_apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c
index 899803e03214..6ec6d5d297c3 100644
--- a/arch/x86/kernel/apic/apic_numachip.c
+++ b/arch/x86/kernel/apic/apic_numachip.c
@@ -207,8 +207,11 @@ static void __init map_csrs(void)
207 207
208static void fixup_cpu_id(struct cpuinfo_x86 *c, int node) 208static void fixup_cpu_id(struct cpuinfo_x86 *c, int node)
209{ 209{
210 c->phys_proc_id = node; 210
211 per_cpu(cpu_llc_id, smp_processor_id()) = node; 211 if (c->phys_proc_id != node) {
212 c->phys_proc_id = node;
213 per_cpu(cpu_llc_id, smp_processor_id()) = node;
214 }
212} 215}
213 216
214static int __init numachip_system_init(void) 217static int __init numachip_system_init(void)
@@ -292,6 +295,7 @@ static struct apic apic_numachip __refconst = {
292 295
293 .read = native_apic_mem_read, 296 .read = native_apic_mem_read,
294 .write = native_apic_mem_write, 297 .write = native_apic_mem_write,
298 .eoi_write = native_apic_mem_write,
295 .icr_read = native_apic_icr_read, 299 .icr_read = native_apic_icr_read,
296 .icr_write = native_apic_icr_write, 300 .icr_write = native_apic_icr_write,
297 .wait_icr_idle = native_apic_wait_icr_idle, 301 .wait_icr_idle = native_apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c
index 0cdec7065aff..31fbdbfbf960 100644
--- a/arch/x86/kernel/apic/bigsmp_32.c
+++ b/arch/x86/kernel/apic/bigsmp_32.c
@@ -248,6 +248,7 @@ static struct apic apic_bigsmp = {
248 248
249 .read = native_apic_mem_read, 249 .read = native_apic_mem_read,
250 .write = native_apic_mem_write, 250 .write = native_apic_mem_write,
251 .eoi_write = native_apic_mem_write,
251 .icr_read = native_apic_icr_read, 252 .icr_read = native_apic_icr_read,
252 .icr_write = native_apic_icr_write, 253 .icr_write = native_apic_icr_write,
253 .wait_icr_idle = native_apic_wait_icr_idle, 254 .wait_icr_idle = native_apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/es7000_32.c b/arch/x86/kernel/apic/es7000_32.c
index e42d1d3b9134..db4ab1be3c79 100644
--- a/arch/x86/kernel/apic/es7000_32.c
+++ b/arch/x86/kernel/apic/es7000_32.c
@@ -678,6 +678,7 @@ static struct apic __refdata apic_es7000_cluster = {
678 678
679 .read = native_apic_mem_read, 679 .read = native_apic_mem_read,
680 .write = native_apic_mem_write, 680 .write = native_apic_mem_write,
681 .eoi_write = native_apic_mem_write,
681 .icr_read = native_apic_icr_read, 682 .icr_read = native_apic_icr_read,
682 .icr_write = native_apic_icr_write, 683 .icr_write = native_apic_icr_write,
683 .wait_icr_idle = native_apic_wait_icr_idle, 684 .wait_icr_idle = native_apic_wait_icr_idle,
@@ -742,6 +743,7 @@ static struct apic __refdata apic_es7000 = {
742 743
743 .read = native_apic_mem_read, 744 .read = native_apic_mem_read,
744 .write = native_apic_mem_write, 745 .write = native_apic_mem_write,
746 .eoi_write = native_apic_mem_write,
745 .icr_read = native_apic_icr_read, 747 .icr_read = native_apic_icr_read,
746 .icr_write = native_apic_icr_write, 748 .icr_write = native_apic_icr_write,
747 .wait_icr_idle = native_apic_wait_icr_idle, 749 .wait_icr_idle = native_apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index e88300d8e80a..ffdc152e507d 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -68,23 +68,21 @@
68#define for_each_irq_pin(entry, head) \ 68#define for_each_irq_pin(entry, head) \
69 for (entry = head; entry; entry = entry->next) 69 for (entry = head; entry; entry = entry->next)
70 70
71static void __init __ioapic_init_mappings(void); 71#ifdef CONFIG_IRQ_REMAP
72 72static void irq_remap_modify_chip_defaults(struct irq_chip *chip);
73static unsigned int __io_apic_read (unsigned int apic, unsigned int reg); 73static inline bool irq_remapped(struct irq_cfg *cfg)
74static void __io_apic_write (unsigned int apic, unsigned int reg, unsigned int val); 74{
75static void __io_apic_modify(unsigned int apic, unsigned int reg, unsigned int val); 75 return cfg->irq_2_iommu.iommu != NULL;
76 76}
77static struct io_apic_ops io_apic_ops = { 77#else
78 .init = __ioapic_init_mappings, 78static inline bool irq_remapped(struct irq_cfg *cfg)
79 .read = __io_apic_read, 79{
80 .write = __io_apic_write, 80 return false;
81 .modify = __io_apic_modify, 81}
82}; 82static inline void irq_remap_modify_chip_defaults(struct irq_chip *chip)
83
84void __init set_io_apic_ops(const struct io_apic_ops *ops)
85{ 83{
86 io_apic_ops = *ops;
87} 84}
85#endif
88 86
89/* 87/*
90 * Is the SiS APIC rmw bug present ? 88 * Is the SiS APIC rmw bug present ?
@@ -313,21 +311,6 @@ static void free_irq_at(unsigned int at, struct irq_cfg *cfg)
313 irq_free_desc(at); 311 irq_free_desc(at);
314} 312}
315 313
316static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg)
317{
318 return io_apic_ops.read(apic, reg);
319}
320
321static inline void io_apic_write(unsigned int apic, unsigned int reg, unsigned int value)
322{
323 io_apic_ops.write(apic, reg, value);
324}
325
326static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned int value)
327{
328 io_apic_ops.modify(apic, reg, value);
329}
330
331 314
332struct io_apic { 315struct io_apic {
333 unsigned int index; 316 unsigned int index;
@@ -349,14 +332,14 @@ static inline void io_apic_eoi(unsigned int apic, unsigned int vector)
349 writel(vector, &io_apic->eoi); 332 writel(vector, &io_apic->eoi);
350} 333}
351 334
352static unsigned int __io_apic_read(unsigned int apic, unsigned int reg) 335unsigned int native_io_apic_read(unsigned int apic, unsigned int reg)
353{ 336{
354 struct io_apic __iomem *io_apic = io_apic_base(apic); 337 struct io_apic __iomem *io_apic = io_apic_base(apic);
355 writel(reg, &io_apic->index); 338 writel(reg, &io_apic->index);
356 return readl(&io_apic->data); 339 return readl(&io_apic->data);
357} 340}
358 341
359static void __io_apic_write(unsigned int apic, unsigned int reg, unsigned int value) 342void native_io_apic_write(unsigned int apic, unsigned int reg, unsigned int value)
360{ 343{
361 struct io_apic __iomem *io_apic = io_apic_base(apic); 344 struct io_apic __iomem *io_apic = io_apic_base(apic);
362 345
@@ -370,7 +353,7 @@ static void __io_apic_write(unsigned int apic, unsigned int reg, unsigned int va
370 * 353 *
371 * Older SiS APIC requires we rewrite the index register 354 * Older SiS APIC requires we rewrite the index register
372 */ 355 */
373static void __io_apic_modify(unsigned int apic, unsigned int reg, unsigned int value) 356void native_io_apic_modify(unsigned int apic, unsigned int reg, unsigned int value)
374{ 357{
375 struct io_apic __iomem *io_apic = io_apic_base(apic); 358 struct io_apic __iomem *io_apic = io_apic_base(apic);
376 359
@@ -379,29 +362,6 @@ static void __io_apic_modify(unsigned int apic, unsigned int reg, unsigned int v
379 writel(value, &io_apic->data); 362 writel(value, &io_apic->data);
380} 363}
381 364
382static bool io_apic_level_ack_pending(struct irq_cfg *cfg)
383{
384 struct irq_pin_list *entry;
385 unsigned long flags;
386
387 raw_spin_lock_irqsave(&ioapic_lock, flags);
388 for_each_irq_pin(entry, cfg->irq_2_pin) {
389 unsigned int reg;
390 int pin;
391
392 pin = entry->pin;
393 reg = io_apic_read(entry->apic, 0x10 + pin*2);
394 /* Is the remote IRR bit set? */
395 if (reg & IO_APIC_REDIR_REMOTE_IRR) {
396 raw_spin_unlock_irqrestore(&ioapic_lock, flags);
397 return true;
398 }
399 }
400 raw_spin_unlock_irqrestore(&ioapic_lock, flags);
401
402 return false;
403}
404
405union entry_union { 365union entry_union {
406 struct { u32 w1, w2; }; 366 struct { u32 w1, w2; };
407 struct IO_APIC_route_entry entry; 367 struct IO_APIC_route_entry entry;
@@ -1361,77 +1321,13 @@ static void ioapic_register_intr(unsigned int irq, struct irq_cfg *cfg,
1361 fasteoi ? "fasteoi" : "edge"); 1321 fasteoi ? "fasteoi" : "edge");
1362} 1322}
1363 1323
1364
1365static int setup_ir_ioapic_entry(int irq,
1366 struct IR_IO_APIC_route_entry *entry,
1367 unsigned int destination, int vector,
1368 struct io_apic_irq_attr *attr)
1369{
1370 int index;
1371 struct irte irte;
1372 int ioapic_id = mpc_ioapic_id(attr->ioapic);
1373 struct intel_iommu *iommu = map_ioapic_to_ir(ioapic_id);
1374
1375 if (!iommu) {
1376 pr_warn("No mapping iommu for ioapic %d\n", ioapic_id);
1377 return -ENODEV;
1378 }
1379
1380 index = alloc_irte(iommu, irq, 1);
1381 if (index < 0) {
1382 pr_warn("Failed to allocate IRTE for ioapic %d\n", ioapic_id);
1383 return -ENOMEM;
1384 }
1385
1386 prepare_irte(&irte, vector, destination);
1387
1388 /* Set source-id of interrupt request */
1389 set_ioapic_sid(&irte, ioapic_id);
1390
1391 modify_irte(irq, &irte);
1392
1393 apic_printk(APIC_VERBOSE, KERN_DEBUG "IOAPIC[%d]: "
1394 "Set IRTE entry (P:%d FPD:%d Dst_Mode:%d "
1395 "Redir_hint:%d Trig_Mode:%d Dlvry_Mode:%X "
1396 "Avail:%X Vector:%02X Dest:%08X "
1397 "SID:%04X SQ:%X SVT:%X)\n",
1398 attr->ioapic, irte.present, irte.fpd, irte.dst_mode,
1399 irte.redir_hint, irte.trigger_mode, irte.dlvry_mode,
1400 irte.avail, irte.vector, irte.dest_id,
1401 irte.sid, irte.sq, irte.svt);
1402
1403 memset(entry, 0, sizeof(*entry));
1404
1405 entry->index2 = (index >> 15) & 0x1;
1406 entry->zero = 0;
1407 entry->format = 1;
1408 entry->index = (index & 0x7fff);
1409 /*
1410 * IO-APIC RTE will be configured with virtual vector.
1411 * irq handler will do the explicit EOI to the io-apic.
1412 */
1413 entry->vector = attr->ioapic_pin;
1414 entry->mask = 0; /* enable IRQ */
1415 entry->trigger = attr->trigger;
1416 entry->polarity = attr->polarity;
1417
1418 /* Mask level triggered irqs.
1419 * Use IRQ_DELAYED_DISABLE for edge triggered irqs.
1420 */
1421 if (attr->trigger)
1422 entry->mask = 1;
1423
1424 return 0;
1425}
1426
1427static int setup_ioapic_entry(int irq, struct IO_APIC_route_entry *entry, 1324static int setup_ioapic_entry(int irq, struct IO_APIC_route_entry *entry,
1428 unsigned int destination, int vector, 1325 unsigned int destination, int vector,
1429 struct io_apic_irq_attr *attr) 1326 struct io_apic_irq_attr *attr)
1430{ 1327{
1431 if (intr_remapping_enabled) 1328 if (irq_remapping_enabled)
1432 return setup_ir_ioapic_entry(irq, 1329 return setup_ioapic_remapped_entry(irq, entry, destination,
1433 (struct IR_IO_APIC_route_entry *)entry, 1330 vector, attr);
1434 destination, vector, attr);
1435 1331
1436 memset(entry, 0, sizeof(*entry)); 1332 memset(entry, 0, sizeof(*entry));
1437 1333
@@ -1588,7 +1484,7 @@ static void __init setup_timer_IRQ0_pin(unsigned int ioapic_idx,
1588{ 1484{
1589 struct IO_APIC_route_entry entry; 1485 struct IO_APIC_route_entry entry;
1590 1486
1591 if (intr_remapping_enabled) 1487 if (irq_remapping_enabled)
1592 return; 1488 return;
1593 1489
1594 memset(&entry, 0, sizeof(entry)); 1490 memset(&entry, 0, sizeof(entry));
@@ -1674,7 +1570,7 @@ __apicdebuginit(void) print_IO_APIC(int ioapic_idx)
1674 1570
1675 printk(KERN_DEBUG ".... IRQ redirection table:\n"); 1571 printk(KERN_DEBUG ".... IRQ redirection table:\n");
1676 1572
1677 if (intr_remapping_enabled) { 1573 if (irq_remapping_enabled) {
1678 printk(KERN_DEBUG " NR Indx Fmt Mask Trig IRR" 1574 printk(KERN_DEBUG " NR Indx Fmt Mask Trig IRR"
1679 " Pol Stat Indx2 Zero Vect:\n"); 1575 " Pol Stat Indx2 Zero Vect:\n");
1680 } else { 1576 } else {
@@ -1683,7 +1579,7 @@ __apicdebuginit(void) print_IO_APIC(int ioapic_idx)
1683 } 1579 }
1684 1580
1685 for (i = 0; i <= reg_01.bits.entries; i++) { 1581 for (i = 0; i <= reg_01.bits.entries; i++) {
1686 if (intr_remapping_enabled) { 1582 if (irq_remapping_enabled) {
1687 struct IO_APIC_route_entry entry; 1583 struct IO_APIC_route_entry entry;
1688 struct IR_IO_APIC_route_entry *ir_entry; 1584 struct IR_IO_APIC_route_entry *ir_entry;
1689 1585
@@ -2050,7 +1946,7 @@ void disable_IO_APIC(void)
2050 * IOAPIC RTE as well as interrupt-remapping table entry). 1946 * IOAPIC RTE as well as interrupt-remapping table entry).
2051 * As this gets called during crash dump, keep this simple for now. 1947 * As this gets called during crash dump, keep this simple for now.
2052 */ 1948 */
2053 if (ioapic_i8259.pin != -1 && !intr_remapping_enabled) { 1949 if (ioapic_i8259.pin != -1 && !irq_remapping_enabled) {
2054 struct IO_APIC_route_entry entry; 1950 struct IO_APIC_route_entry entry;
2055 1951
2056 memset(&entry, 0, sizeof(entry)); 1952 memset(&entry, 0, sizeof(entry));
@@ -2074,7 +1970,7 @@ void disable_IO_APIC(void)
2074 * Use virtual wire A mode when interrupt remapping is enabled. 1970 * Use virtual wire A mode when interrupt remapping is enabled.
2075 */ 1971 */
2076 if (cpu_has_apic || apic_from_smp_config()) 1972 if (cpu_has_apic || apic_from_smp_config())
2077 disconnect_bsp_APIC(!intr_remapping_enabled && 1973 disconnect_bsp_APIC(!irq_remapping_enabled &&
2078 ioapic_i8259.pin != -1); 1974 ioapic_i8259.pin != -1);
2079} 1975}
2080 1976
@@ -2390,71 +2286,6 @@ ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
2390 return ret; 2286 return ret;
2391} 2287}
2392 2288
2393#ifdef CONFIG_IRQ_REMAP
2394
2395/*
2396 * Migrate the IO-APIC irq in the presence of intr-remapping.
2397 *
2398 * For both level and edge triggered, irq migration is a simple atomic
2399 * update(of vector and cpu destination) of IRTE and flush the hardware cache.
2400 *
2401 * For level triggered, we eliminate the io-apic RTE modification (with the
2402 * updated vector information), by using a virtual vector (io-apic pin number).
2403 * Real vector that is used for interrupting cpu will be coming from
2404 * the interrupt-remapping table entry.
2405 *
2406 * As the migration is a simple atomic update of IRTE, the same mechanism
2407 * is used to migrate MSI irq's in the presence of interrupt-remapping.
2408 */
2409static int
2410ir_ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
2411 bool force)
2412{
2413 struct irq_cfg *cfg = data->chip_data;
2414 unsigned int dest, irq = data->irq;
2415 struct irte irte;
2416
2417 if (!cpumask_intersects(mask, cpu_online_mask))
2418 return -EINVAL;
2419
2420 if (get_irte(irq, &irte))
2421 return -EBUSY;
2422
2423 if (assign_irq_vector(irq, cfg, mask))
2424 return -EBUSY;
2425
2426 dest = apic->cpu_mask_to_apicid_and(cfg->domain, mask);
2427
2428 irte.vector = cfg->vector;
2429 irte.dest_id = IRTE_DEST(dest);
2430
2431 /*
2432 * Atomically updates the IRTE with the new destination, vector
2433 * and flushes the interrupt entry cache.
2434 */
2435 modify_irte(irq, &irte);
2436
2437 /*
2438 * After this point, all the interrupts will start arriving
2439 * at the new destination. So, time to cleanup the previous
2440 * vector allocation.
2441 */
2442 if (cfg->move_in_progress)
2443 send_cleanup_vector(cfg);
2444
2445 cpumask_copy(data->affinity, mask);
2446 return 0;
2447}
2448
2449#else
2450static inline int
2451ir_ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
2452 bool force)
2453{
2454 return 0;
2455}
2456#endif
2457
2458asmlinkage void smp_irq_move_cleanup_interrupt(void) 2289asmlinkage void smp_irq_move_cleanup_interrupt(void)
2459{ 2290{
2460 unsigned vector, me; 2291 unsigned vector, me;
@@ -2552,6 +2383,29 @@ static void ack_apic_edge(struct irq_data *data)
2552atomic_t irq_mis_count; 2383atomic_t irq_mis_count;
2553 2384
2554#ifdef CONFIG_GENERIC_PENDING_IRQ 2385#ifdef CONFIG_GENERIC_PENDING_IRQ
2386static bool io_apic_level_ack_pending(struct irq_cfg *cfg)
2387{
2388 struct irq_pin_list *entry;
2389 unsigned long flags;
2390
2391 raw_spin_lock_irqsave(&ioapic_lock, flags);
2392 for_each_irq_pin(entry, cfg->irq_2_pin) {
2393 unsigned int reg;
2394 int pin;
2395
2396 pin = entry->pin;
2397 reg = io_apic_read(entry->apic, 0x10 + pin*2);
2398 /* Is the remote IRR bit set? */
2399 if (reg & IO_APIC_REDIR_REMOTE_IRR) {
2400 raw_spin_unlock_irqrestore(&ioapic_lock, flags);
2401 return true;
2402 }
2403 }
2404 raw_spin_unlock_irqrestore(&ioapic_lock, flags);
2405
2406 return false;
2407}
2408
2555static inline bool ioapic_irqd_mask(struct irq_data *data, struct irq_cfg *cfg) 2409static inline bool ioapic_irqd_mask(struct irq_data *data, struct irq_cfg *cfg)
2556{ 2410{
2557 /* If we are moving the irq we need to mask it */ 2411 /* If we are moving the irq we need to mask it */
@@ -2699,7 +2553,7 @@ static void irq_remap_modify_chip_defaults(struct irq_chip *chip)
2699 chip->irq_eoi = ir_ack_apic_level; 2553 chip->irq_eoi = ir_ack_apic_level;
2700 2554
2701#ifdef CONFIG_SMP 2555#ifdef CONFIG_SMP
2702 chip->irq_set_affinity = ir_ioapic_set_affinity; 2556 chip->irq_set_affinity = set_remapped_irq_affinity;
2703#endif 2557#endif
2704} 2558}
2705#endif /* CONFIG_IRQ_REMAP */ 2559#endif /* CONFIG_IRQ_REMAP */
@@ -2912,7 +2766,7 @@ static inline void __init check_timer(void)
2912 * 8259A. 2766 * 8259A.
2913 */ 2767 */
2914 if (pin1 == -1) { 2768 if (pin1 == -1) {
2915 if (intr_remapping_enabled) 2769 if (irq_remapping_enabled)
2916 panic("BIOS bug: timer not connected to IO-APIC"); 2770 panic("BIOS bug: timer not connected to IO-APIC");
2917 pin1 = pin2; 2771 pin1 = pin2;
2918 apic1 = apic2; 2772 apic1 = apic2;
@@ -2945,7 +2799,7 @@ static inline void __init check_timer(void)
2945 clear_IO_APIC_pin(0, pin1); 2799 clear_IO_APIC_pin(0, pin1);
2946 goto out; 2800 goto out;
2947 } 2801 }
2948 if (intr_remapping_enabled) 2802 if (irq_remapping_enabled)
2949 panic("timer doesn't work through Interrupt-remapped IO-APIC"); 2803 panic("timer doesn't work through Interrupt-remapped IO-APIC");
2950 local_irq_disable(); 2804 local_irq_disable();
2951 clear_IO_APIC_pin(apic1, pin1); 2805 clear_IO_APIC_pin(apic1, pin1);
@@ -3169,7 +3023,7 @@ void destroy_irq(unsigned int irq)
3169 irq_set_status_flags(irq, IRQ_NOREQUEST|IRQ_NOPROBE); 3023 irq_set_status_flags(irq, IRQ_NOREQUEST|IRQ_NOPROBE);
3170 3024
3171 if (irq_remapped(cfg)) 3025 if (irq_remapped(cfg))
3172 free_irte(irq); 3026 free_remapped_irq(irq);
3173 raw_spin_lock_irqsave(&vector_lock, flags); 3027 raw_spin_lock_irqsave(&vector_lock, flags);
3174 __clear_irq_vector(irq, cfg); 3028 __clear_irq_vector(irq, cfg);
3175 raw_spin_unlock_irqrestore(&vector_lock, flags); 3029 raw_spin_unlock_irqrestore(&vector_lock, flags);
@@ -3198,54 +3052,34 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq,
3198 dest = apic->cpu_mask_to_apicid_and(cfg->domain, apic->target_cpus()); 3052 dest = apic->cpu_mask_to_apicid_and(cfg->domain, apic->target_cpus());
3199 3053
3200 if (irq_remapped(cfg)) { 3054 if (irq_remapped(cfg)) {
3201 struct irte irte; 3055 compose_remapped_msi_msg(pdev, irq, dest, msg, hpet_id);
3202 int ir_index; 3056 return err;
3203 u16 sub_handle; 3057 }
3204
3205 ir_index = map_irq_to_irte_handle(irq, &sub_handle);
3206 BUG_ON(ir_index == -1);
3207
3208 prepare_irte(&irte, cfg->vector, dest);
3209
3210 /* Set source-id of interrupt request */
3211 if (pdev)
3212 set_msi_sid(&irte, pdev);
3213 else
3214 set_hpet_sid(&irte, hpet_id);
3215
3216 modify_irte(irq, &irte);
3217 3058
3059 if (x2apic_enabled())
3060 msg->address_hi = MSI_ADDR_BASE_HI |
3061 MSI_ADDR_EXT_DEST_ID(dest);
3062 else
3218 msg->address_hi = MSI_ADDR_BASE_HI; 3063 msg->address_hi = MSI_ADDR_BASE_HI;
3219 msg->data = sub_handle;
3220 msg->address_lo = MSI_ADDR_BASE_LO | MSI_ADDR_IR_EXT_INT |
3221 MSI_ADDR_IR_SHV |
3222 MSI_ADDR_IR_INDEX1(ir_index) |
3223 MSI_ADDR_IR_INDEX2(ir_index);
3224 } else {
3225 if (x2apic_enabled())
3226 msg->address_hi = MSI_ADDR_BASE_HI |
3227 MSI_ADDR_EXT_DEST_ID(dest);
3228 else
3229 msg->address_hi = MSI_ADDR_BASE_HI;
3230 3064
3231 msg->address_lo = 3065 msg->address_lo =
3232 MSI_ADDR_BASE_LO | 3066 MSI_ADDR_BASE_LO |
3233 ((apic->irq_dest_mode == 0) ? 3067 ((apic->irq_dest_mode == 0) ?
3234 MSI_ADDR_DEST_MODE_PHYSICAL: 3068 MSI_ADDR_DEST_MODE_PHYSICAL:
3235 MSI_ADDR_DEST_MODE_LOGICAL) | 3069 MSI_ADDR_DEST_MODE_LOGICAL) |
3236 ((apic->irq_delivery_mode != dest_LowestPrio) ? 3070 ((apic->irq_delivery_mode != dest_LowestPrio) ?
3237 MSI_ADDR_REDIRECTION_CPU: 3071 MSI_ADDR_REDIRECTION_CPU:
3238 MSI_ADDR_REDIRECTION_LOWPRI) | 3072 MSI_ADDR_REDIRECTION_LOWPRI) |
3239 MSI_ADDR_DEST_ID(dest); 3073 MSI_ADDR_DEST_ID(dest);
3074
3075 msg->data =
3076 MSI_DATA_TRIGGER_EDGE |
3077 MSI_DATA_LEVEL_ASSERT |
3078 ((apic->irq_delivery_mode != dest_LowestPrio) ?
3079 MSI_DATA_DELIVERY_FIXED:
3080 MSI_DATA_DELIVERY_LOWPRI) |
3081 MSI_DATA_VECTOR(cfg->vector);
3240 3082
3241 msg->data =
3242 MSI_DATA_TRIGGER_EDGE |
3243 MSI_DATA_LEVEL_ASSERT |
3244 ((apic->irq_delivery_mode != dest_LowestPrio) ?
3245 MSI_DATA_DELIVERY_FIXED:
3246 MSI_DATA_DELIVERY_LOWPRI) |
3247 MSI_DATA_VECTOR(cfg->vector);
3248 }
3249 return err; 3083 return err;
3250} 3084}
3251 3085
@@ -3288,33 +3122,6 @@ static struct irq_chip msi_chip = {
3288 .irq_retrigger = ioapic_retrigger_irq, 3122 .irq_retrigger = ioapic_retrigger_irq,
3289}; 3123};
3290 3124
3291/*
3292 * Map the PCI dev to the corresponding remapping hardware unit
3293 * and allocate 'nvec' consecutive interrupt-remapping table entries
3294 * in it.
3295 */
3296static int msi_alloc_irte(struct pci_dev *dev, int irq, int nvec)
3297{
3298 struct intel_iommu *iommu;
3299 int index;
3300
3301 iommu = map_dev_to_ir(dev);
3302 if (!iommu) {
3303 printk(KERN_ERR
3304 "Unable to map PCI %s to iommu\n", pci_name(dev));
3305 return -ENOENT;
3306 }
3307
3308 index = alloc_irte(iommu, irq, nvec);
3309 if (index < 0) {
3310 printk(KERN_ERR
3311 "Unable to allocate %d IRTE for PCI %s\n", nvec,
3312 pci_name(dev));
3313 return -ENOSPC;
3314 }
3315 return index;
3316}
3317
3318static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int irq) 3125static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int irq)
3319{ 3126{
3320 struct irq_chip *chip = &msi_chip; 3127 struct irq_chip *chip = &msi_chip;
@@ -3345,7 +3152,6 @@ int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
3345 int node, ret, sub_handle, index = 0; 3152 int node, ret, sub_handle, index = 0;
3346 unsigned int irq, irq_want; 3153 unsigned int irq, irq_want;
3347 struct msi_desc *msidesc; 3154 struct msi_desc *msidesc;
3348 struct intel_iommu *iommu = NULL;
3349 3155
3350 /* x86 doesn't support multiple MSI yet */ 3156 /* x86 doesn't support multiple MSI yet */
3351 if (type == PCI_CAP_ID_MSI && nvec > 1) 3157 if (type == PCI_CAP_ID_MSI && nvec > 1)
@@ -3359,7 +3165,7 @@ int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
3359 if (irq == 0) 3165 if (irq == 0)
3360 return -1; 3166 return -1;
3361 irq_want = irq + 1; 3167 irq_want = irq + 1;
3362 if (!intr_remapping_enabled) 3168 if (!irq_remapping_enabled)
3363 goto no_ir; 3169 goto no_ir;
3364 3170
3365 if (!sub_handle) { 3171 if (!sub_handle) {
@@ -3367,23 +3173,16 @@ int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
3367 * allocate the consecutive block of IRTE's 3173 * allocate the consecutive block of IRTE's
3368 * for 'nvec' 3174 * for 'nvec'
3369 */ 3175 */
3370 index = msi_alloc_irte(dev, irq, nvec); 3176 index = msi_alloc_remapped_irq(dev, irq, nvec);
3371 if (index < 0) { 3177 if (index < 0) {
3372 ret = index; 3178 ret = index;
3373 goto error; 3179 goto error;
3374 } 3180 }
3375 } else { 3181 } else {
3376 iommu = map_dev_to_ir(dev); 3182 ret = msi_setup_remapped_irq(dev, irq, index,
3377 if (!iommu) { 3183 sub_handle);
3378 ret = -ENOENT; 3184 if (ret < 0)
3379 goto error; 3185 goto error;
3380 }
3381 /*
3382 * setup the mapping between the irq and the IRTE
3383 * base index, the sub_handle pointing to the
3384 * appropriate interrupt remap table entry.
3385 */
3386 set_irte_irq(irq, iommu, index, sub_handle);
3387 } 3186 }
3388no_ir: 3187no_ir:
3389 ret = setup_msi_irq(dev, msidesc, irq); 3188 ret = setup_msi_irq(dev, msidesc, irq);
@@ -3501,15 +3300,8 @@ int arch_setup_hpet_msi(unsigned int irq, unsigned int id)
3501 struct msi_msg msg; 3300 struct msi_msg msg;
3502 int ret; 3301 int ret;
3503 3302
3504 if (intr_remapping_enabled) { 3303 if (irq_remapping_enabled) {
3505 struct intel_iommu *iommu = map_hpet_to_ir(id); 3304 if (!setup_hpet_msi_remapped(irq, id))
3506 int index;
3507
3508 if (!iommu)
3509 return -1;
3510
3511 index = alloc_irte(iommu, irq, 1);
3512 if (index < 0)
3513 return -1; 3305 return -1;
3514 } 3306 }
3515 3307
@@ -3888,8 +3680,8 @@ void __init setup_ioapic_dest(void)
3888 else 3680 else
3889 mask = apic->target_cpus(); 3681 mask = apic->target_cpus();
3890 3682
3891 if (intr_remapping_enabled) 3683 if (irq_remapping_enabled)
3892 ir_ioapic_set_affinity(idata, mask, false); 3684 set_remapped_irq_affinity(idata, mask, false);
3893 else 3685 else
3894 ioapic_set_affinity(idata, mask, false); 3686 ioapic_set_affinity(idata, mask, false);
3895 } 3687 }
@@ -3931,12 +3723,7 @@ static struct resource * __init ioapic_setup_resources(int nr_ioapics)
3931 return res; 3723 return res;
3932} 3724}
3933 3725
3934void __init ioapic_and_gsi_init(void) 3726void __init native_io_apic_init_mappings(void)
3935{
3936 io_apic_ops.init();
3937}
3938
3939static void __init __ioapic_init_mappings(void)
3940{ 3727{
3941 unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0; 3728 unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0;
3942 struct resource *ioapic_res; 3729 struct resource *ioapic_res;
diff --git a/arch/x86/kernel/apic/numaq_32.c b/arch/x86/kernel/apic/numaq_32.c
index 00d2422ca7c9..f00a68cca37a 100644
--- a/arch/x86/kernel/apic/numaq_32.c
+++ b/arch/x86/kernel/apic/numaq_32.c
@@ -530,6 +530,7 @@ static struct apic __refdata apic_numaq = {
530 530
531 .read = native_apic_mem_read, 531 .read = native_apic_mem_read,
532 .write = native_apic_mem_write, 532 .write = native_apic_mem_write,
533 .eoi_write = native_apic_mem_write,
533 .icr_read = native_apic_icr_read, 534 .icr_read = native_apic_icr_read,
534 .icr_write = native_apic_icr_write, 535 .icr_write = native_apic_icr_write,
535 .wait_icr_idle = native_apic_wait_icr_idle, 536 .wait_icr_idle = native_apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
index ff2c1b9aac4d..1b291da09e60 100644
--- a/arch/x86/kernel/apic/probe_32.c
+++ b/arch/x86/kernel/apic/probe_32.c
@@ -142,6 +142,7 @@ static struct apic apic_default = {
142 142
143 .read = native_apic_mem_read, 143 .read = native_apic_mem_read,
144 .write = native_apic_mem_write, 144 .write = native_apic_mem_write,
145 .eoi_write = native_apic_mem_write,
145 .icr_read = native_apic_icr_read, 146 .icr_read = native_apic_icr_read,
146 .icr_write = native_apic_icr_write, 147 .icr_write = native_apic_icr_write,
147 .wait_icr_idle = native_apic_wait_icr_idle, 148 .wait_icr_idle = native_apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/summit_32.c b/arch/x86/kernel/apic/summit_32.c
index fea000b27f07..659897c00755 100644
--- a/arch/x86/kernel/apic/summit_32.c
+++ b/arch/x86/kernel/apic/summit_32.c
@@ -546,6 +546,7 @@ static struct apic apic_summit = {
546 546
547 .read = native_apic_mem_read, 547 .read = native_apic_mem_read,
548 .write = native_apic_mem_write, 548 .write = native_apic_mem_write,
549 .eoi_write = native_apic_mem_write,
549 .icr_read = native_apic_icr_read, 550 .icr_read = native_apic_icr_read,
550 .icr_write = native_apic_icr_write, 551 .icr_write = native_apic_icr_write,
551 .wait_icr_idle = native_apic_wait_icr_idle, 552 .wait_icr_idle = native_apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
index 48f3103b3c93..ff35cff0e1a7 100644
--- a/arch/x86/kernel/apic/x2apic_cluster.c
+++ b/arch/x86/kernel/apic/x2apic_cluster.c
@@ -260,6 +260,7 @@ static struct apic apic_x2apic_cluster = {
260 260
261 .read = native_apic_msr_read, 261 .read = native_apic_msr_read,
262 .write = native_apic_msr_write, 262 .write = native_apic_msr_write,
263 .eoi_write = native_apic_msr_eoi_write,
263 .icr_read = native_x2apic_icr_read, 264 .icr_read = native_x2apic_icr_read,
264 .icr_write = native_x2apic_icr_write, 265 .icr_write = native_x2apic_icr_write,
265 .wait_icr_idle = native_x2apic_wait_icr_idle, 266 .wait_icr_idle = native_x2apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c
index 8a778db45e3a..c17e982db275 100644
--- a/arch/x86/kernel/apic/x2apic_phys.c
+++ b/arch/x86/kernel/apic/x2apic_phys.c
@@ -24,6 +24,12 @@ static int x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
24{ 24{
25 if (x2apic_phys) 25 if (x2apic_phys)
26 return x2apic_enabled(); 26 return x2apic_enabled();
27 else if ((acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID) &&
28 (acpi_gbl_FADT.flags & ACPI_FADT_APIC_PHYSICAL) &&
29 x2apic_enabled()) {
30 printk(KERN_DEBUG "System requires x2apic physical mode\n");
31 return 1;
32 }
27 else 33 else
28 return 0; 34 return 0;
29} 35}
@@ -166,6 +172,7 @@ static struct apic apic_x2apic_phys = {
166 172
167 .read = native_apic_msr_read, 173 .read = native_apic_msr_read,
168 .write = native_apic_msr_write, 174 .write = native_apic_msr_write,
175 .eoi_write = native_apic_msr_eoi_write,
169 .icr_read = native_x2apic_icr_read, 176 .icr_read = native_x2apic_icr_read,
170 .icr_write = native_x2apic_icr_write, 177 .icr_write = native_x2apic_icr_write,
171 .wait_icr_idle = native_x2apic_wait_icr_idle, 178 .wait_icr_idle = native_x2apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 87bfa69e216e..c6d03f7a4401 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -404,6 +404,7 @@ static struct apic __refdata apic_x2apic_uv_x = {
404 404
405 .read = native_apic_msr_read, 405 .read = native_apic_msr_read,
406 .write = native_apic_msr_write, 406 .write = native_apic_msr_write,
407 .eoi_write = native_apic_msr_eoi_write,
407 .icr_read = native_x2apic_icr_read, 408 .icr_read = native_x2apic_icr_read,
408 .icr_write = native_x2apic_icr_write, 409 .icr_write = native_x2apic_icr_write,
409 .wait_icr_idle = native_x2apic_wait_icr_idle, 410 .wait_icr_idle = native_x2apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 459e78cbf61e..07b0c0db466c 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -2401,7 +2401,7 @@ static void __exit apm_exit(void)
2401 * (pm_idle), Wait for all processors to update cached/local 2401 * (pm_idle), Wait for all processors to update cached/local
2402 * copies of pm_idle before proceeding. 2402 * copies of pm_idle before proceeding.
2403 */ 2403 */
2404 cpu_idle_wait(); 2404 kick_all_cpus_sync();
2405 } 2405 }
2406 if (((apm_info.bios.flags & APM_BIOS_DISENGAGED) == 0) 2406 if (((apm_info.bios.flags & APM_BIOS_DISENGAGED) == 0)
2407 && (apm_info.connection_version > 0x0100)) { 2407 && (apm_info.connection_version > 0x0100)) {
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 0a44b90602b0..146bb6218eec 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -26,7 +26,8 @@
26 * contact AMD for precise details and a CPU swap. 26 * contact AMD for precise details and a CPU swap.
27 * 27 *
28 * See http://www.multimania.com/poulot/k6bug.html 28 * See http://www.multimania.com/poulot/k6bug.html
29 * http://www.amd.com/K6/k6docs/revgd.html 29 * and section 2.6.2 of "AMD-K6 Processor Revision Guide - Model 6"
30 * (Publication # 21266 Issue Date: August 1998)
30 * 31 *
31 * The following test is erm.. interesting. AMD neglected to up 32 * The following test is erm.. interesting. AMD neglected to up
32 * the chip setting when fixing the bug but they also tweaked some 33 * the chip setting when fixing the bug but they also tweaked some
@@ -94,7 +95,6 @@ static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c)
94 "system stability may be impaired when more than 32 MB are used.\n"); 95 "system stability may be impaired when more than 32 MB are used.\n");
95 else 96 else
96 printk(KERN_CONT "probably OK (after B9730xxxx).\n"); 97 printk(KERN_CONT "probably OK (after B9730xxxx).\n");
97 printk(KERN_INFO "Please see http://membres.lycos.fr/poulot/k6bug.html\n");
98 } 98 }
99 99
100 /* K6 with old style WHCR */ 100 /* K6 with old style WHCR */
@@ -353,10 +353,11 @@ static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)
353 node = per_cpu(cpu_llc_id, cpu); 353 node = per_cpu(cpu_llc_id, cpu);
354 354
355 /* 355 /*
356 * If core numbers are inconsistent, it's likely a multi-fabric platform, 356 * On multi-fabric platform (e.g. Numascale NumaChip) a
357 * so invoke platform-specific handler 357 * platform-specific handler needs to be called to fixup some
358 * IDs of the CPU.
358 */ 359 */
359 if (c->phys_proc_id != node) 360 if (x86_cpuinit.fixup_cpu_id)
360 x86_cpuinit.fixup_cpu_id(c, node); 361 x86_cpuinit.fixup_cpu_id(c, node);
361 362
362 if (!node_online(node)) { 363 if (!node_online(node)) {
@@ -579,6 +580,24 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
579 } 580 }
580 } 581 }
581 582
583 /* re-enable TopologyExtensions if switched off by BIOS */
584 if ((c->x86 == 0x15) &&
585 (c->x86_model >= 0x10) && (c->x86_model <= 0x1f) &&
586 !cpu_has(c, X86_FEATURE_TOPOEXT)) {
587 u64 val;
588
589 if (!rdmsrl_amd_safe(0xc0011005, &val)) {
590 val |= 1ULL << 54;
591 wrmsrl_amd_safe(0xc0011005, val);
592 rdmsrl(0xc0011005, val);
593 if (val & (1ULL << 54)) {
594 set_cpu_cap(c, X86_FEATURE_TOPOEXT);
595 printk(KERN_INFO FW_INFO "CPU: Re-enabling "
596 "disabled Topology Extensions Support\n");
597 }
598 }
599 }
600
582 cpu_detect_cache_sizes(c); 601 cpu_detect_cache_sizes(c);
583 602
584 /* Multi core CPU? */ 603 /* Multi core CPU? */
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 67e258362a3d..82f29e70d058 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1163,15 +1163,6 @@ static void dbg_restore_debug_regs(void)
1163#endif /* ! CONFIG_KGDB */ 1163#endif /* ! CONFIG_KGDB */
1164 1164
1165/* 1165/*
1166 * Prints an error where the NUMA and configured core-number mismatch and the
1167 * platform didn't override this to fix it up
1168 */
1169void __cpuinit x86_default_fixup_cpu_id(struct cpuinfo_x86 *c, int node)
1170{
1171 pr_err("NUMA core number %d differs from configured core number %d\n", node, c->phys_proc_id);
1172}
1173
1174/*
1175 * cpu_init() initializes state that is per-CPU. Some data is already 1166 * cpu_init() initializes state that is per-CPU. Some data is already
1176 * initialized (naturally) in the bootstrap process, such as the GDT 1167 * initialized (naturally) in the bootstrap process, such as the GDT
1177 * and IDT. We reload them nevertheless, this function acts as a 1168 * and IDT. We reload them nevertheless, this function acts as a
@@ -1194,7 +1185,7 @@ void __cpuinit cpu_init(void)
1194 oist = &per_cpu(orig_ist, cpu); 1185 oist = &per_cpu(orig_ist, cpu);
1195 1186
1196#ifdef CONFIG_NUMA 1187#ifdef CONFIG_NUMA
1197 if (cpu != 0 && percpu_read(numa_node) == 0 && 1188 if (cpu != 0 && this_cpu_read(numa_node) == 0 &&
1198 early_cpu_to_node(cpu) != NUMA_NO_NODE) 1189 early_cpu_to_node(cpu) != NUMA_NO_NODE)
1199 set_numa_node(early_cpu_to_node(cpu)); 1190 set_numa_node(early_cpu_to_node(cpu));
1200#endif 1191#endif
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 73d08ed98a64..b8f3653dddbc 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -433,14 +433,14 @@ int amd_set_l3_disable_slot(struct amd_northbridge *nb, int cpu, unsigned slot,
433 /* check if @slot is already used or the index is already disabled */ 433 /* check if @slot is already used or the index is already disabled */
434 ret = amd_get_l3_disable_slot(nb, slot); 434 ret = amd_get_l3_disable_slot(nb, slot);
435 if (ret >= 0) 435 if (ret >= 0)
436 return -EINVAL; 436 return -EEXIST;
437 437
438 if (index > nb->l3_cache.indices) 438 if (index > nb->l3_cache.indices)
439 return -EINVAL; 439 return -EINVAL;
440 440
441 /* check whether the other slot has disabled the same index already */ 441 /* check whether the other slot has disabled the same index already */
442 if (index == amd_get_l3_disable_slot(nb, !slot)) 442 if (index == amd_get_l3_disable_slot(nb, !slot))
443 return -EINVAL; 443 return -EEXIST;
444 444
445 amd_l3_disable_index(nb, cpu, slot, index); 445 amd_l3_disable_index(nb, cpu, slot, index);
446 446
@@ -468,8 +468,8 @@ static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf,
468 err = amd_set_l3_disable_slot(this_leaf->base.nb, cpu, slot, val); 468 err = amd_set_l3_disable_slot(this_leaf->base.nb, cpu, slot, val);
469 if (err) { 469 if (err) {
470 if (err == -EEXIST) 470 if (err == -EEXIST)
471 printk(KERN_WARNING "L3 disable slot %d in use!\n", 471 pr_warning("L3 slot %d in use/index already disabled!\n",
472 slot); 472 slot);
473 return err; 473 return err;
474 } 474 }
475 return count; 475 return count;
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index d086a09c087d..297edb1b1fb3 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -583,7 +583,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
583 struct mce m; 583 struct mce m;
584 int i; 584 int i;
585 585
586 percpu_inc(mce_poll_count); 586 this_cpu_inc(mce_poll_count);
587 587
588 mce_gather_info(&m, NULL); 588 mce_gather_info(&m, NULL);
589 589
@@ -945,9 +945,10 @@ struct mce_info {
945 atomic_t inuse; 945 atomic_t inuse;
946 struct task_struct *t; 946 struct task_struct *t;
947 __u64 paddr; 947 __u64 paddr;
948 int restartable;
948} mce_info[MCE_INFO_MAX]; 949} mce_info[MCE_INFO_MAX];
949 950
950static void mce_save_info(__u64 addr) 951static void mce_save_info(__u64 addr, int c)
951{ 952{
952 struct mce_info *mi; 953 struct mce_info *mi;
953 954
@@ -955,6 +956,7 @@ static void mce_save_info(__u64 addr)
955 if (atomic_cmpxchg(&mi->inuse, 0, 1) == 0) { 956 if (atomic_cmpxchg(&mi->inuse, 0, 1) == 0) {
956 mi->t = current; 957 mi->t = current;
957 mi->paddr = addr; 958 mi->paddr = addr;
959 mi->restartable = c;
958 return; 960 return;
959 } 961 }
960 } 962 }
@@ -1015,7 +1017,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
1015 1017
1016 atomic_inc(&mce_entry); 1018 atomic_inc(&mce_entry);
1017 1019
1018 percpu_inc(mce_exception_count); 1020 this_cpu_inc(mce_exception_count);
1019 1021
1020 if (!banks) 1022 if (!banks)
1021 goto out; 1023 goto out;
@@ -1130,7 +1132,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
1130 mce_panic("Fatal machine check on current CPU", &m, msg); 1132 mce_panic("Fatal machine check on current CPU", &m, msg);
1131 if (worst == MCE_AR_SEVERITY) { 1133 if (worst == MCE_AR_SEVERITY) {
1132 /* schedule action before return to userland */ 1134 /* schedule action before return to userland */
1133 mce_save_info(m.addr); 1135 mce_save_info(m.addr, m.mcgstatus & MCG_STATUS_RIPV);
1134 set_thread_flag(TIF_MCE_NOTIFY); 1136 set_thread_flag(TIF_MCE_NOTIFY);
1135 } else if (kill_it) { 1137 } else if (kill_it) {
1136 force_sig(SIGBUS, current); 1138 force_sig(SIGBUS, current);
@@ -1179,7 +1181,13 @@ void mce_notify_process(void)
1179 1181
1180 pr_err("Uncorrected hardware memory error in user-access at %llx", 1182 pr_err("Uncorrected hardware memory error in user-access at %llx",
1181 mi->paddr); 1183 mi->paddr);
1182 if (memory_failure(pfn, MCE_VECTOR, MF_ACTION_REQUIRED) < 0) { 1184 /*
1185 * We must call memory_failure() here even if the current process is
1186 * doomed. We still need to mark the page as poisoned and alert any
1187 * other users of the page.
1188 */
1189 if (memory_failure(pfn, MCE_VECTOR, MF_ACTION_REQUIRED) < 0 ||
1190 mi->restartable == 0) {
1183 pr_err("Memory error not recovered"); 1191 pr_err("Memory error not recovered");
1184 force_sig(SIGBUS, current); 1192 force_sig(SIGBUS, current);
1185 } 1193 }
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index bb8e03407e18..e049d6da0183 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -484,9 +484,6 @@ static int __x86_pmu_event_init(struct perf_event *event)
484 484
485 /* mark unused */ 485 /* mark unused */
486 event->hw.extra_reg.idx = EXTRA_REG_NONE; 486 event->hw.extra_reg.idx = EXTRA_REG_NONE;
487
488 /* mark not used */
489 event->hw.extra_reg.idx = EXTRA_REG_NONE;
490 event->hw.branch_reg.idx = EXTRA_REG_NONE; 487 event->hw.branch_reg.idx = EXTRA_REG_NONE;
491 488
492 return x86_pmu.hw_config(event); 489 return x86_pmu.hw_config(event);
@@ -1186,8 +1183,6 @@ int x86_pmu_handle_irq(struct pt_regs *regs)
1186 int idx, handled = 0; 1183 int idx, handled = 0;
1187 u64 val; 1184 u64 val;
1188 1185
1189 perf_sample_data_init(&data, 0);
1190
1191 cpuc = &__get_cpu_var(cpu_hw_events); 1186 cpuc = &__get_cpu_var(cpu_hw_events);
1192 1187
1193 /* 1188 /*
@@ -1222,7 +1217,7 @@ int x86_pmu_handle_irq(struct pt_regs *regs)
1222 * event overflow 1217 * event overflow
1223 */ 1218 */
1224 handled++; 1219 handled++;
1225 data.period = event->hw.last_period; 1220 perf_sample_data_init(&data, 0, event->hw.last_period);
1226 1221
1227 if (!x86_perf_event_set_period(event)) 1222 if (!x86_perf_event_set_period(event))
1228 continue; 1223 continue;
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 95e7fe1c5f0b..65652265fffd 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -134,8 +134,13 @@ static u64 amd_pmu_event_map(int hw_event)
134 134
135static int amd_pmu_hw_config(struct perf_event *event) 135static int amd_pmu_hw_config(struct perf_event *event)
136{ 136{
137 int ret = x86_pmu_hw_config(event); 137 int ret;
138 138
139 /* pass precise event sampling to ibs: */
140 if (event->attr.precise_ip && get_ibs_caps())
141 return -ENOENT;
142
143 ret = x86_pmu_hw_config(event);
139 if (ret) 144 if (ret)
140 return ret; 145 return ret;
141 146
@@ -205,10 +210,8 @@ static void amd_put_event_constraints(struct cpu_hw_events *cpuc,
205 * when we come here 210 * when we come here
206 */ 211 */
207 for (i = 0; i < x86_pmu.num_counters; i++) { 212 for (i = 0; i < x86_pmu.num_counters; i++) {
208 if (nb->owners[i] == event) { 213 if (cmpxchg(nb->owners + i, event, NULL) == event)
209 cmpxchg(nb->owners+i, event, NULL);
210 break; 214 break;
211 }
212 } 215 }
213} 216}
214 217
diff --git a/arch/x86/kernel/cpu/perf_event_amd_ibs.c b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
index 3b8a2d30d14e..da9bcdcd9856 100644
--- a/arch/x86/kernel/cpu/perf_event_amd_ibs.c
+++ b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
@@ -9,6 +9,7 @@
9#include <linux/perf_event.h> 9#include <linux/perf_event.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/pci.h> 11#include <linux/pci.h>
12#include <linux/ptrace.h>
12 13
13#include <asm/apic.h> 14#include <asm/apic.h>
14 15
@@ -16,36 +17,591 @@ static u32 ibs_caps;
16 17
17#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD) 18#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD)
18 19
19static struct pmu perf_ibs; 20#include <linux/kprobes.h>
21#include <linux/hardirq.h>
22
23#include <asm/nmi.h>
24
25#define IBS_FETCH_CONFIG_MASK (IBS_FETCH_RAND_EN | IBS_FETCH_MAX_CNT)
26#define IBS_OP_CONFIG_MASK IBS_OP_MAX_CNT
27
28enum ibs_states {
29 IBS_ENABLED = 0,
30 IBS_STARTED = 1,
31 IBS_STOPPING = 2,
32
33 IBS_MAX_STATES,
34};
35
36struct cpu_perf_ibs {
37 struct perf_event *event;
38 unsigned long state[BITS_TO_LONGS(IBS_MAX_STATES)];
39};
40
41struct perf_ibs {
42 struct pmu pmu;
43 unsigned int msr;
44 u64 config_mask;
45 u64 cnt_mask;
46 u64 enable_mask;
47 u64 valid_mask;
48 u64 max_period;
49 unsigned long offset_mask[1];
50 int offset_max;
51 struct cpu_perf_ibs __percpu *pcpu;
52 u64 (*get_count)(u64 config);
53};
54
55struct perf_ibs_data {
56 u32 size;
57 union {
58 u32 data[0]; /* data buffer starts here */
59 u32 caps;
60 };
61 u64 regs[MSR_AMD64_IBS_REG_COUNT_MAX];
62};
63
64static int
65perf_event_set_period(struct hw_perf_event *hwc, u64 min, u64 max, u64 *hw_period)
66{
67 s64 left = local64_read(&hwc->period_left);
68 s64 period = hwc->sample_period;
69 int overflow = 0;
70
71 /*
72 * If we are way outside a reasonable range then just skip forward:
73 */
74 if (unlikely(left <= -period)) {
75 left = period;
76 local64_set(&hwc->period_left, left);
77 hwc->last_period = period;
78 overflow = 1;
79 }
80
81 if (unlikely(left < (s64)min)) {
82 left += period;
83 local64_set(&hwc->period_left, left);
84 hwc->last_period = period;
85 overflow = 1;
86 }
87
88 /*
89 * If the hw period that triggers the sw overflow is too short
90 * we might hit the irq handler. This biases the results.
91 * Thus we shorten the next-to-last period and set the last
92 * period to the max period.
93 */
94 if (left > max) {
95 left -= max;
96 if (left > max)
97 left = max;
98 else if (left < min)
99 left = min;
100 }
101
102 *hw_period = (u64)left;
103
104 return overflow;
105}
106
107static int
108perf_event_try_update(struct perf_event *event, u64 new_raw_count, int width)
109{
110 struct hw_perf_event *hwc = &event->hw;
111 int shift = 64 - width;
112 u64 prev_raw_count;
113 u64 delta;
114
115 /*
116 * Careful: an NMI might modify the previous event value.
117 *
118 * Our tactic to handle this is to first atomically read and
119 * exchange a new raw count - then add that new-prev delta
120 * count to the generic event atomically:
121 */
122 prev_raw_count = local64_read(&hwc->prev_count);
123 if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
124 new_raw_count) != prev_raw_count)
125 return 0;
126
127 /*
128 * Now we have the new raw value and have updated the prev
129 * timestamp already. We can now calculate the elapsed delta
130 * (event-)time and add that to the generic event.
131 *
132 * Careful, not all hw sign-extends above the physical width
133 * of the count.
134 */
135 delta = (new_raw_count << shift) - (prev_raw_count << shift);
136 delta >>= shift;
137
138 local64_add(delta, &event->count);
139 local64_sub(delta, &hwc->period_left);
140
141 return 1;
142}
143
144static struct perf_ibs perf_ibs_fetch;
145static struct perf_ibs perf_ibs_op;
146
147static struct perf_ibs *get_ibs_pmu(int type)
148{
149 if (perf_ibs_fetch.pmu.type == type)
150 return &perf_ibs_fetch;
151 if (perf_ibs_op.pmu.type == type)
152 return &perf_ibs_op;
153 return NULL;
154}
155
156/*
157 * Use IBS for precise event sampling:
158 *
159 * perf record -a -e cpu-cycles:p ... # use ibs op counting cycle count
160 * perf record -a -e r076:p ... # same as -e cpu-cycles:p
161 * perf record -a -e r0C1:p ... # use ibs op counting micro-ops
162 *
163 * IbsOpCntCtl (bit 19) of IBS Execution Control Register (IbsOpCtl,
164 * MSRC001_1033) is used to select either cycle or micro-ops counting
165 * mode.
166 *
167 * The rip of IBS samples has skid 0. Thus, IBS supports precise
168 * levels 1 and 2 and the PERF_EFLAGS_EXACT is set. In rare cases the
169 * rip is invalid when IBS was not able to record the rip correctly.
170 * We clear PERF_EFLAGS_EXACT and take the rip from pt_regs then.
171 *
172 */
173static int perf_ibs_precise_event(struct perf_event *event, u64 *config)
174{
175 switch (event->attr.precise_ip) {
176 case 0:
177 return -ENOENT;
178 case 1:
179 case 2:
180 break;
181 default:
182 return -EOPNOTSUPP;
183 }
184
185 switch (event->attr.type) {
186 case PERF_TYPE_HARDWARE:
187 switch (event->attr.config) {
188 case PERF_COUNT_HW_CPU_CYCLES:
189 *config = 0;
190 return 0;
191 }
192 break;
193 case PERF_TYPE_RAW:
194 switch (event->attr.config) {
195 case 0x0076:
196 *config = 0;
197 return 0;
198 case 0x00C1:
199 *config = IBS_OP_CNT_CTL;
200 return 0;
201 }
202 break;
203 default:
204 return -ENOENT;
205 }
206
207 return -EOPNOTSUPP;
208}
20 209
21static int perf_ibs_init(struct perf_event *event) 210static int perf_ibs_init(struct perf_event *event)
22{ 211{
23 if (perf_ibs.type != event->attr.type) 212 struct hw_perf_event *hwc = &event->hw;
213 struct perf_ibs *perf_ibs;
214 u64 max_cnt, config;
215 int ret;
216
217 perf_ibs = get_ibs_pmu(event->attr.type);
218 if (perf_ibs) {
219 config = event->attr.config;
220 } else {
221 perf_ibs = &perf_ibs_op;
222 ret = perf_ibs_precise_event(event, &config);
223 if (ret)
224 return ret;
225 }
226
227 if (event->pmu != &perf_ibs->pmu)
24 return -ENOENT; 228 return -ENOENT;
229
230 if (config & ~perf_ibs->config_mask)
231 return -EINVAL;
232
233 if (hwc->sample_period) {
234 if (config & perf_ibs->cnt_mask)
235 /* raw max_cnt may not be set */
236 return -EINVAL;
237 if (!event->attr.sample_freq && hwc->sample_period & 0x0f)
238 /*
239 * lower 4 bits can not be set in ibs max cnt,
240 * but allowing it in case we adjust the
241 * sample period to set a frequency.
242 */
243 return -EINVAL;
244 hwc->sample_period &= ~0x0FULL;
245 if (!hwc->sample_period)
246 hwc->sample_period = 0x10;
247 } else {
248 max_cnt = config & perf_ibs->cnt_mask;
249 config &= ~perf_ibs->cnt_mask;
250 event->attr.sample_period = max_cnt << 4;
251 hwc->sample_period = event->attr.sample_period;
252 }
253
254 if (!hwc->sample_period)
255 return -EINVAL;
256
257 /*
258 * If we modify hwc->sample_period, we also need to update
259 * hwc->last_period and hwc->period_left.
260 */
261 hwc->last_period = hwc->sample_period;
262 local64_set(&hwc->period_left, hwc->sample_period);
263
264 hwc->config_base = perf_ibs->msr;
265 hwc->config = config;
266
25 return 0; 267 return 0;
26} 268}
27 269
270static int perf_ibs_set_period(struct perf_ibs *perf_ibs,
271 struct hw_perf_event *hwc, u64 *period)
272{
273 int overflow;
274
275 /* ignore lower 4 bits in min count: */
276 overflow = perf_event_set_period(hwc, 1<<4, perf_ibs->max_period, period);
277 local64_set(&hwc->prev_count, 0);
278
279 return overflow;
280}
281
282static u64 get_ibs_fetch_count(u64 config)
283{
284 return (config & IBS_FETCH_CNT) >> 12;
285}
286
287static u64 get_ibs_op_count(u64 config)
288{
289 u64 count = 0;
290
291 if (config & IBS_OP_VAL)
292 count += (config & IBS_OP_MAX_CNT) << 4; /* cnt rolled over */
293
294 if (ibs_caps & IBS_CAPS_RDWROPCNT)
295 count += (config & IBS_OP_CUR_CNT) >> 32;
296
297 return count;
298}
299
300static void
301perf_ibs_event_update(struct perf_ibs *perf_ibs, struct perf_event *event,
302 u64 *config)
303{
304 u64 count = perf_ibs->get_count(*config);
305
306 /*
307 * Set width to 64 since we do not overflow on max width but
308 * instead on max count. In perf_ibs_set_period() we clear
309 * prev count manually on overflow.
310 */
311 while (!perf_event_try_update(event, count, 64)) {
312 rdmsrl(event->hw.config_base, *config);
313 count = perf_ibs->get_count(*config);
314 }
315}
316
317static inline void perf_ibs_enable_event(struct perf_ibs *perf_ibs,
318 struct hw_perf_event *hwc, u64 config)
319{
320 wrmsrl(hwc->config_base, hwc->config | config | perf_ibs->enable_mask);
321}
322
323/*
324 * Erratum #420 Instruction-Based Sampling Engine May Generate
325 * Interrupt that Cannot Be Cleared:
326 *
327 * Must clear counter mask first, then clear the enable bit. See
328 * Revision Guide for AMD Family 10h Processors, Publication #41322.
329 */
330static inline void perf_ibs_disable_event(struct perf_ibs *perf_ibs,
331 struct hw_perf_event *hwc, u64 config)
332{
333 config &= ~perf_ibs->cnt_mask;
334 wrmsrl(hwc->config_base, config);
335 config &= ~perf_ibs->enable_mask;
336 wrmsrl(hwc->config_base, config);
337}
338
339/*
340 * We cannot restore the ibs pmu state, so we always needs to update
341 * the event while stopping it and then reset the state when starting
342 * again. Thus, ignoring PERF_EF_RELOAD and PERF_EF_UPDATE flags in
343 * perf_ibs_start()/perf_ibs_stop() and instead always do it.
344 */
345static void perf_ibs_start(struct perf_event *event, int flags)
346{
347 struct hw_perf_event *hwc = &event->hw;
348 struct perf_ibs *perf_ibs = container_of(event->pmu, struct perf_ibs, pmu);
349 struct cpu_perf_ibs *pcpu = this_cpu_ptr(perf_ibs->pcpu);
350 u64 period;
351
352 if (WARN_ON_ONCE(!(hwc->state & PERF_HES_STOPPED)))
353 return;
354
355 WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE));
356 hwc->state = 0;
357
358 perf_ibs_set_period(perf_ibs, hwc, &period);
359 set_bit(IBS_STARTED, pcpu->state);
360 perf_ibs_enable_event(perf_ibs, hwc, period >> 4);
361
362 perf_event_update_userpage(event);
363}
364
365static void perf_ibs_stop(struct perf_event *event, int flags)
366{
367 struct hw_perf_event *hwc = &event->hw;
368 struct perf_ibs *perf_ibs = container_of(event->pmu, struct perf_ibs, pmu);
369 struct cpu_perf_ibs *pcpu = this_cpu_ptr(perf_ibs->pcpu);
370 u64 config;
371 int stopping;
372
373 stopping = test_and_clear_bit(IBS_STARTED, pcpu->state);
374
375 if (!stopping && (hwc->state & PERF_HES_UPTODATE))
376 return;
377
378 rdmsrl(hwc->config_base, config);
379
380 if (stopping) {
381 set_bit(IBS_STOPPING, pcpu->state);
382 perf_ibs_disable_event(perf_ibs, hwc, config);
383 WARN_ON_ONCE(hwc->state & PERF_HES_STOPPED);
384 hwc->state |= PERF_HES_STOPPED;
385 }
386
387 if (hwc->state & PERF_HES_UPTODATE)
388 return;
389
390 /*
391 * Clear valid bit to not count rollovers on update, rollovers
392 * are only updated in the irq handler.
393 */
394 config &= ~perf_ibs->valid_mask;
395
396 perf_ibs_event_update(perf_ibs, event, &config);
397 hwc->state |= PERF_HES_UPTODATE;
398}
399
28static int perf_ibs_add(struct perf_event *event, int flags) 400static int perf_ibs_add(struct perf_event *event, int flags)
29{ 401{
402 struct perf_ibs *perf_ibs = container_of(event->pmu, struct perf_ibs, pmu);
403 struct cpu_perf_ibs *pcpu = this_cpu_ptr(perf_ibs->pcpu);
404
405 if (test_and_set_bit(IBS_ENABLED, pcpu->state))
406 return -ENOSPC;
407
408 event->hw.state = PERF_HES_UPTODATE | PERF_HES_STOPPED;
409
410 pcpu->event = event;
411
412 if (flags & PERF_EF_START)
413 perf_ibs_start(event, PERF_EF_RELOAD);
414
30 return 0; 415 return 0;
31} 416}
32 417
33static void perf_ibs_del(struct perf_event *event, int flags) 418static void perf_ibs_del(struct perf_event *event, int flags)
34{ 419{
420 struct perf_ibs *perf_ibs = container_of(event->pmu, struct perf_ibs, pmu);
421 struct cpu_perf_ibs *pcpu = this_cpu_ptr(perf_ibs->pcpu);
422
423 if (!test_and_clear_bit(IBS_ENABLED, pcpu->state))
424 return;
425
426 perf_ibs_stop(event, PERF_EF_UPDATE);
427
428 pcpu->event = NULL;
429
430 perf_event_update_userpage(event);
35} 431}
36 432
37static struct pmu perf_ibs = { 433static void perf_ibs_read(struct perf_event *event) { }
38 .event_init= perf_ibs_init, 434
39 .add= perf_ibs_add, 435static struct perf_ibs perf_ibs_fetch = {
40 .del= perf_ibs_del, 436 .pmu = {
437 .task_ctx_nr = perf_invalid_context,
438
439 .event_init = perf_ibs_init,
440 .add = perf_ibs_add,
441 .del = perf_ibs_del,
442 .start = perf_ibs_start,
443 .stop = perf_ibs_stop,
444 .read = perf_ibs_read,
445 },
446 .msr = MSR_AMD64_IBSFETCHCTL,
447 .config_mask = IBS_FETCH_CONFIG_MASK,
448 .cnt_mask = IBS_FETCH_MAX_CNT,
449 .enable_mask = IBS_FETCH_ENABLE,
450 .valid_mask = IBS_FETCH_VAL,
451 .max_period = IBS_FETCH_MAX_CNT << 4,
452 .offset_mask = { MSR_AMD64_IBSFETCH_REG_MASK },
453 .offset_max = MSR_AMD64_IBSFETCH_REG_COUNT,
454
455 .get_count = get_ibs_fetch_count,
41}; 456};
42 457
458static struct perf_ibs perf_ibs_op = {
459 .pmu = {
460 .task_ctx_nr = perf_invalid_context,
461
462 .event_init = perf_ibs_init,
463 .add = perf_ibs_add,
464 .del = perf_ibs_del,
465 .start = perf_ibs_start,
466 .stop = perf_ibs_stop,
467 .read = perf_ibs_read,
468 },
469 .msr = MSR_AMD64_IBSOPCTL,
470 .config_mask = IBS_OP_CONFIG_MASK,
471 .cnt_mask = IBS_OP_MAX_CNT,
472 .enable_mask = IBS_OP_ENABLE,
473 .valid_mask = IBS_OP_VAL,
474 .max_period = IBS_OP_MAX_CNT << 4,
475 .offset_mask = { MSR_AMD64_IBSOP_REG_MASK },
476 .offset_max = MSR_AMD64_IBSOP_REG_COUNT,
477
478 .get_count = get_ibs_op_count,
479};
480
481static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs)
482{
483 struct cpu_perf_ibs *pcpu = this_cpu_ptr(perf_ibs->pcpu);
484 struct perf_event *event = pcpu->event;
485 struct hw_perf_event *hwc = &event->hw;
486 struct perf_sample_data data;
487 struct perf_raw_record raw;
488 struct pt_regs regs;
489 struct perf_ibs_data ibs_data;
490 int offset, size, check_rip, offset_max, throttle = 0;
491 unsigned int msr;
492 u64 *buf, *config, period;
493
494 if (!test_bit(IBS_STARTED, pcpu->state)) {
495 /*
496 * Catch spurious interrupts after stopping IBS: After
497 * disabling IBS there could be still incomming NMIs
498 * with samples that even have the valid bit cleared.
499 * Mark all this NMIs as handled.
500 */
501 return test_and_clear_bit(IBS_STOPPING, pcpu->state) ? 1 : 0;
502 }
503
504 msr = hwc->config_base;
505 buf = ibs_data.regs;
506 rdmsrl(msr, *buf);
507 if (!(*buf++ & perf_ibs->valid_mask))
508 return 0;
509
510 config = &ibs_data.regs[0];
511 perf_ibs_event_update(perf_ibs, event, config);
512 perf_sample_data_init(&data, 0, hwc->last_period);
513 if (!perf_ibs_set_period(perf_ibs, hwc, &period))
514 goto out; /* no sw counter overflow */
515
516 ibs_data.caps = ibs_caps;
517 size = 1;
518 offset = 1;
519 check_rip = (perf_ibs == &perf_ibs_op && (ibs_caps & IBS_CAPS_RIPINVALIDCHK));
520 if (event->attr.sample_type & PERF_SAMPLE_RAW)
521 offset_max = perf_ibs->offset_max;
522 else if (check_rip)
523 offset_max = 2;
524 else
525 offset_max = 1;
526 do {
527 rdmsrl(msr + offset, *buf++);
528 size++;
529 offset = find_next_bit(perf_ibs->offset_mask,
530 perf_ibs->offset_max,
531 offset + 1);
532 } while (offset < offset_max);
533 ibs_data.size = sizeof(u64) * size;
534
535 regs = *iregs;
536 if (check_rip && (ibs_data.regs[2] & IBS_RIP_INVALID)) {
537 regs.flags &= ~PERF_EFLAGS_EXACT;
538 } else {
539 instruction_pointer_set(&regs, ibs_data.regs[1]);
540 regs.flags |= PERF_EFLAGS_EXACT;
541 }
542
543 if (event->attr.sample_type & PERF_SAMPLE_RAW) {
544 raw.size = sizeof(u32) + ibs_data.size;
545 raw.data = ibs_data.data;
546 data.raw = &raw;
547 }
548
549 throttle = perf_event_overflow(event, &data, &regs);
550out:
551 if (throttle)
552 perf_ibs_disable_event(perf_ibs, hwc, *config);
553 else
554 perf_ibs_enable_event(perf_ibs, hwc, period >> 4);
555
556 perf_event_update_userpage(event);
557
558 return 1;
559}
560
561static int __kprobes
562perf_ibs_nmi_handler(unsigned int cmd, struct pt_regs *regs)
563{
564 int handled = 0;
565
566 handled += perf_ibs_handle_irq(&perf_ibs_fetch, regs);
567 handled += perf_ibs_handle_irq(&perf_ibs_op, regs);
568
569 if (handled)
570 inc_irq_stat(apic_perf_irqs);
571
572 return handled;
573}
574
575static __init int perf_ibs_pmu_init(struct perf_ibs *perf_ibs, char *name)
576{
577 struct cpu_perf_ibs __percpu *pcpu;
578 int ret;
579
580 pcpu = alloc_percpu(struct cpu_perf_ibs);
581 if (!pcpu)
582 return -ENOMEM;
583
584 perf_ibs->pcpu = pcpu;
585
586 ret = perf_pmu_register(&perf_ibs->pmu, name, -1);
587 if (ret) {
588 perf_ibs->pcpu = NULL;
589 free_percpu(pcpu);
590 }
591
592 return ret;
593}
594
43static __init int perf_event_ibs_init(void) 595static __init int perf_event_ibs_init(void)
44{ 596{
45 if (!ibs_caps) 597 if (!ibs_caps)
46 return -ENODEV; /* ibs not supported by the cpu */ 598 return -ENODEV; /* ibs not supported by the cpu */
47 599
48 perf_pmu_register(&perf_ibs, "ibs", -1); 600 perf_ibs_pmu_init(&perf_ibs_fetch, "ibs_fetch");
601 if (ibs_caps & IBS_CAPS_OPCNT)
602 perf_ibs_op.config_mask |= IBS_OP_CNT_CTL;
603 perf_ibs_pmu_init(&perf_ibs_op, "ibs_op");
604 register_nmi_handler(NMI_LOCAL, perf_ibs_nmi_handler, 0, "perf_ibs");
49 printk(KERN_INFO "perf: AMD IBS detected (0x%08x)\n", ibs_caps); 605 printk(KERN_INFO "perf: AMD IBS detected (0x%08x)\n", ibs_caps);
50 606
51 return 0; 607 return 0;
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 26b3e2fef104..166546ec6aef 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -1027,8 +1027,6 @@ static int intel_pmu_handle_irq(struct pt_regs *regs)
1027 u64 status; 1027 u64 status;
1028 int handled; 1028 int handled;
1029 1029
1030 perf_sample_data_init(&data, 0);
1031
1032 cpuc = &__get_cpu_var(cpu_hw_events); 1030 cpuc = &__get_cpu_var(cpu_hw_events);
1033 1031
1034 /* 1032 /*
@@ -1082,7 +1080,7 @@ again:
1082 if (!intel_pmu_save_and_restart(event)) 1080 if (!intel_pmu_save_and_restart(event))
1083 continue; 1081 continue;
1084 1082
1085 data.period = event->hw.last_period; 1083 perf_sample_data_init(&data, 0, event->hw.last_period);
1086 1084
1087 if (has_branch_stack(event)) 1085 if (has_branch_stack(event))
1088 data.br_stack = &cpuc->lbr_stack; 1086 data.br_stack = &cpuc->lbr_stack;
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 7f64df19e7dd..5a3edc27f6e5 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -316,8 +316,7 @@ int intel_pmu_drain_bts_buffer(void)
316 316
317 ds->bts_index = ds->bts_buffer_base; 317 ds->bts_index = ds->bts_buffer_base;
318 318
319 perf_sample_data_init(&data, 0); 319 perf_sample_data_init(&data, 0, event->hw.last_period);
320 data.period = event->hw.last_period;
321 regs.ip = 0; 320 regs.ip = 0;
322 321
323 /* 322 /*
@@ -564,8 +563,7 @@ static void __intel_pmu_pebs_event(struct perf_event *event,
564 if (!intel_pmu_save_and_restart(event)) 563 if (!intel_pmu_save_and_restart(event))
565 return; 564 return;
566 565
567 perf_sample_data_init(&data, 0); 566 perf_sample_data_init(&data, 0, event->hw.last_period);
568 data.period = event->hw.last_period;
569 567
570 /* 568 /*
571 * We use the interrupt regs as a base because the PEBS record 569 * We use the interrupt regs as a base because the PEBS record
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c
index a2dfacfd7103..47124a73dd73 100644
--- a/arch/x86/kernel/cpu/perf_event_p4.c
+++ b/arch/x86/kernel/cpu/perf_event_p4.c
@@ -1005,8 +1005,6 @@ static int p4_pmu_handle_irq(struct pt_regs *regs)
1005 int idx, handled = 0; 1005 int idx, handled = 0;
1006 u64 val; 1006 u64 val;
1007 1007
1008 perf_sample_data_init(&data, 0);
1009
1010 cpuc = &__get_cpu_var(cpu_hw_events); 1008 cpuc = &__get_cpu_var(cpu_hw_events);
1011 1009
1012 for (idx = 0; idx < x86_pmu.num_counters; idx++) { 1010 for (idx = 0; idx < x86_pmu.num_counters; idx++) {
@@ -1034,10 +1032,12 @@ static int p4_pmu_handle_irq(struct pt_regs *regs)
1034 handled += overflow; 1032 handled += overflow;
1035 1033
1036 /* event overflow for sure */ 1034 /* event overflow for sure */
1037 data.period = event->hw.last_period; 1035 perf_sample_data_init(&data, 0, hwc->last_period);
1038 1036
1039 if (!x86_perf_event_set_period(event)) 1037 if (!x86_perf_event_set_period(event))
1040 continue; 1038 continue;
1039
1040
1041 if (perf_event_overflow(event, &data, regs)) 1041 if (perf_event_overflow(event, &data, regs))
1042 x86_pmu_stop(event, 0); 1042 x86_pmu_stop(event, 0);
1043 } 1043 }
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index c9a281f272fd..32ff36596ab1 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -24,40 +24,21 @@
24#include <trace/syscall.h> 24#include <trace/syscall.h>
25 25
26#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
27#include <asm/kprobes.h>
27#include <asm/ftrace.h> 28#include <asm/ftrace.h>
28#include <asm/nops.h> 29#include <asm/nops.h>
29#include <asm/nmi.h>
30
31 30
32#ifdef CONFIG_DYNAMIC_FTRACE 31#ifdef CONFIG_DYNAMIC_FTRACE
33 32
34/*
35 * modifying_code is set to notify NMIs that they need to use
36 * memory barriers when entering or exiting. But we don't want
37 * to burden NMIs with unnecessary memory barriers when code
38 * modification is not being done (which is most of the time).
39 *
40 * A mutex is already held when ftrace_arch_code_modify_prepare
41 * and post_process are called. No locks need to be taken here.
42 *
43 * Stop machine will make sure currently running NMIs are done
44 * and new NMIs will see the updated variable before we need
45 * to worry about NMIs doing memory barriers.
46 */
47static int modifying_code __read_mostly;
48static DEFINE_PER_CPU(int, save_modifying_code);
49
50int ftrace_arch_code_modify_prepare(void) 33int ftrace_arch_code_modify_prepare(void)
51{ 34{
52 set_kernel_text_rw(); 35 set_kernel_text_rw();
53 set_all_modules_text_rw(); 36 set_all_modules_text_rw();
54 modifying_code = 1;
55 return 0; 37 return 0;
56} 38}
57 39
58int ftrace_arch_code_modify_post_process(void) 40int ftrace_arch_code_modify_post_process(void)
59{ 41{
60 modifying_code = 0;
61 set_all_modules_text_ro(); 42 set_all_modules_text_ro();
62 set_kernel_text_ro(); 43 set_kernel_text_ro();
63 return 0; 44 return 0;
@@ -90,134 +71,6 @@ static unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
90 return calc.code; 71 return calc.code;
91} 72}
92 73
93/*
94 * Modifying code must take extra care. On an SMP machine, if
95 * the code being modified is also being executed on another CPU
96 * that CPU will have undefined results and possibly take a GPF.
97 * We use kstop_machine to stop other CPUS from exectuing code.
98 * But this does not stop NMIs from happening. We still need
99 * to protect against that. We separate out the modification of
100 * the code to take care of this.
101 *
102 * Two buffers are added: An IP buffer and a "code" buffer.
103 *
104 * 1) Put the instruction pointer into the IP buffer
105 * and the new code into the "code" buffer.
106 * 2) Wait for any running NMIs to finish and set a flag that says
107 * we are modifying code, it is done in an atomic operation.
108 * 3) Write the code
109 * 4) clear the flag.
110 * 5) Wait for any running NMIs to finish.
111 *
112 * If an NMI is executed, the first thing it does is to call
113 * "ftrace_nmi_enter". This will check if the flag is set to write
114 * and if it is, it will write what is in the IP and "code" buffers.
115 *
116 * The trick is, it does not matter if everyone is writing the same
117 * content to the code location. Also, if a CPU is executing code
118 * it is OK to write to that code location if the contents being written
119 * are the same as what exists.
120 */
121
122#define MOD_CODE_WRITE_FLAG (1 << 31) /* set when NMI should do the write */
123static atomic_t nmi_running = ATOMIC_INIT(0);
124static int mod_code_status; /* holds return value of text write */
125static void *mod_code_ip; /* holds the IP to write to */
126static const void *mod_code_newcode; /* holds the text to write to the IP */
127
128static unsigned nmi_wait_count;
129static atomic_t nmi_update_count = ATOMIC_INIT(0);
130
131int ftrace_arch_read_dyn_info(char *buf, int size)
132{
133 int r;
134
135 r = snprintf(buf, size, "%u %u",
136 nmi_wait_count,
137 atomic_read(&nmi_update_count));
138 return r;
139}
140
141static void clear_mod_flag(void)
142{
143 int old = atomic_read(&nmi_running);
144
145 for (;;) {
146 int new = old & ~MOD_CODE_WRITE_FLAG;
147
148 if (old == new)
149 break;
150
151 old = atomic_cmpxchg(&nmi_running, old, new);
152 }
153}
154
155static void ftrace_mod_code(void)
156{
157 /*
158 * Yes, more than one CPU process can be writing to mod_code_status.
159 * (and the code itself)
160 * But if one were to fail, then they all should, and if one were
161 * to succeed, then they all should.
162 */
163 mod_code_status = probe_kernel_write(mod_code_ip, mod_code_newcode,
164 MCOUNT_INSN_SIZE);
165
166 /* if we fail, then kill any new writers */
167 if (mod_code_status)
168 clear_mod_flag();
169}
170
171void ftrace_nmi_enter(void)
172{
173 __this_cpu_write(save_modifying_code, modifying_code);
174
175 if (!__this_cpu_read(save_modifying_code))
176 return;
177
178 if (atomic_inc_return(&nmi_running) & MOD_CODE_WRITE_FLAG) {
179 smp_rmb();
180 ftrace_mod_code();
181 atomic_inc(&nmi_update_count);
182 }
183 /* Must have previous changes seen before executions */
184 smp_mb();
185}
186
187void ftrace_nmi_exit(void)
188{
189 if (!__this_cpu_read(save_modifying_code))
190 return;
191
192 /* Finish all executions before clearing nmi_running */
193 smp_mb();
194 atomic_dec(&nmi_running);
195}
196
197static void wait_for_nmi_and_set_mod_flag(void)
198{
199 if (!atomic_cmpxchg(&nmi_running, 0, MOD_CODE_WRITE_FLAG))
200 return;
201
202 do {
203 cpu_relax();
204 } while (atomic_cmpxchg(&nmi_running, 0, MOD_CODE_WRITE_FLAG));
205
206 nmi_wait_count++;
207}
208
209static void wait_for_nmi(void)
210{
211 if (!atomic_read(&nmi_running))
212 return;
213
214 do {
215 cpu_relax();
216 } while (atomic_read(&nmi_running));
217
218 nmi_wait_count++;
219}
220
221static inline int 74static inline int
222within(unsigned long addr, unsigned long start, unsigned long end) 75within(unsigned long addr, unsigned long start, unsigned long end)
223{ 76{
@@ -238,26 +91,7 @@ do_ftrace_mod_code(unsigned long ip, const void *new_code)
238 if (within(ip, (unsigned long)_text, (unsigned long)_etext)) 91 if (within(ip, (unsigned long)_text, (unsigned long)_etext))
239 ip = (unsigned long)__va(__pa(ip)); 92 ip = (unsigned long)__va(__pa(ip));
240 93
241 mod_code_ip = (void *)ip; 94 return probe_kernel_write((void *)ip, new_code, MCOUNT_INSN_SIZE);
242 mod_code_newcode = new_code;
243
244 /* The buffers need to be visible before we let NMIs write them */
245 smp_mb();
246
247 wait_for_nmi_and_set_mod_flag();
248
249 /* Make sure all running NMIs have finished before we write the code */
250 smp_mb();
251
252 ftrace_mod_code();
253
254 /* Make sure the write happens before clearing the bit */
255 smp_mb();
256
257 clear_mod_flag();
258 wait_for_nmi();
259
260 return mod_code_status;
261} 95}
262 96
263static const unsigned char *ftrace_nop_replace(void) 97static const unsigned char *ftrace_nop_replace(void)
@@ -334,6 +168,336 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
334 return ret; 168 return ret;
335} 169}
336 170
171int modifying_ftrace_code __read_mostly;
172
173/*
174 * A breakpoint was added to the code address we are about to
175 * modify, and this is the handle that will just skip over it.
176 * We are either changing a nop into a trace call, or a trace
177 * call to a nop. While the change is taking place, we treat
178 * it just like it was a nop.
179 */
180int ftrace_int3_handler(struct pt_regs *regs)
181{
182 if (WARN_ON_ONCE(!regs))
183 return 0;
184
185 if (!ftrace_location(regs->ip - 1))
186 return 0;
187
188 regs->ip += MCOUNT_INSN_SIZE - 1;
189
190 return 1;
191}
192
193static int ftrace_write(unsigned long ip, const char *val, int size)
194{
195 /*
196 * On x86_64, kernel text mappings are mapped read-only with
197 * CONFIG_DEBUG_RODATA. So we use the kernel identity mapping instead
198 * of the kernel text mapping to modify the kernel text.
199 *
200 * For 32bit kernels, these mappings are same and we can use
201 * kernel identity mapping to modify code.
202 */
203 if (within(ip, (unsigned long)_text, (unsigned long)_etext))
204 ip = (unsigned long)__va(__pa(ip));
205
206 return probe_kernel_write((void *)ip, val, size);
207}
208
209static int add_break(unsigned long ip, const char *old)
210{
211 unsigned char replaced[MCOUNT_INSN_SIZE];
212 unsigned char brk = BREAKPOINT_INSTRUCTION;
213
214 if (probe_kernel_read(replaced, (void *)ip, MCOUNT_INSN_SIZE))
215 return -EFAULT;
216
217 /* Make sure it is what we expect it to be */
218 if (memcmp(replaced, old, MCOUNT_INSN_SIZE) != 0)
219 return -EINVAL;
220
221 if (ftrace_write(ip, &brk, 1))
222 return -EPERM;
223
224 return 0;
225}
226
227static int add_brk_on_call(struct dyn_ftrace *rec, unsigned long addr)
228{
229 unsigned const char *old;
230 unsigned long ip = rec->ip;
231
232 old = ftrace_call_replace(ip, addr);
233
234 return add_break(rec->ip, old);
235}
236
237
238static int add_brk_on_nop(struct dyn_ftrace *rec)
239{
240 unsigned const char *old;
241
242 old = ftrace_nop_replace();
243
244 return add_break(rec->ip, old);
245}
246
247static int add_breakpoints(struct dyn_ftrace *rec, int enable)
248{
249 unsigned long ftrace_addr;
250 int ret;
251
252 ret = ftrace_test_record(rec, enable);
253
254 ftrace_addr = (unsigned long)FTRACE_ADDR;
255
256 switch (ret) {
257 case FTRACE_UPDATE_IGNORE:
258 return 0;
259
260 case FTRACE_UPDATE_MAKE_CALL:
261 /* converting nop to call */
262 return add_brk_on_nop(rec);
263
264 case FTRACE_UPDATE_MAKE_NOP:
265 /* converting a call to a nop */
266 return add_brk_on_call(rec, ftrace_addr);
267 }
268 return 0;
269}
270
271/*
272 * On error, we need to remove breakpoints. This needs to
273 * be done caefully. If the address does not currently have a
274 * breakpoint, we know we are done. Otherwise, we look at the
275 * remaining 4 bytes of the instruction. If it matches a nop
276 * we replace the breakpoint with the nop. Otherwise we replace
277 * it with the call instruction.
278 */
279static int remove_breakpoint(struct dyn_ftrace *rec)
280{
281 unsigned char ins[MCOUNT_INSN_SIZE];
282 unsigned char brk = BREAKPOINT_INSTRUCTION;
283 const unsigned char *nop;
284 unsigned long ftrace_addr;
285 unsigned long ip = rec->ip;
286
287 /* If we fail the read, just give up */
288 if (probe_kernel_read(ins, (void *)ip, MCOUNT_INSN_SIZE))
289 return -EFAULT;
290
291 /* If this does not have a breakpoint, we are done */
292 if (ins[0] != brk)
293 return -1;
294
295 nop = ftrace_nop_replace();
296
297 /*
298 * If the last 4 bytes of the instruction do not match
299 * a nop, then we assume that this is a call to ftrace_addr.
300 */
301 if (memcmp(&ins[1], &nop[1], MCOUNT_INSN_SIZE - 1) != 0) {
302 /*
303 * For extra paranoidism, we check if the breakpoint is on
304 * a call that would actually jump to the ftrace_addr.
305 * If not, don't touch the breakpoint, we make just create
306 * a disaster.
307 */
308 ftrace_addr = (unsigned long)FTRACE_ADDR;
309 nop = ftrace_call_replace(ip, ftrace_addr);
310
311 if (memcmp(&ins[1], &nop[1], MCOUNT_INSN_SIZE - 1) != 0)
312 return -EINVAL;
313 }
314
315 return probe_kernel_write((void *)ip, &nop[0], 1);
316}
317
318static int add_update_code(unsigned long ip, unsigned const char *new)
319{
320 /* skip breakpoint */
321 ip++;
322 new++;
323 if (ftrace_write(ip, new, MCOUNT_INSN_SIZE - 1))
324 return -EPERM;
325 return 0;
326}
327
328static int add_update_call(struct dyn_ftrace *rec, unsigned long addr)
329{
330 unsigned long ip = rec->ip;
331 unsigned const char *new;
332
333 new = ftrace_call_replace(ip, addr);
334 return add_update_code(ip, new);
335}
336
337static int add_update_nop(struct dyn_ftrace *rec)
338{
339 unsigned long ip = rec->ip;
340 unsigned const char *new;
341
342 new = ftrace_nop_replace();
343 return add_update_code(ip, new);
344}
345
346static int add_update(struct dyn_ftrace *rec, int enable)
347{
348 unsigned long ftrace_addr;
349 int ret;
350
351 ret = ftrace_test_record(rec, enable);
352
353 ftrace_addr = (unsigned long)FTRACE_ADDR;
354
355 switch (ret) {
356 case FTRACE_UPDATE_IGNORE:
357 return 0;
358
359 case FTRACE_UPDATE_MAKE_CALL:
360 /* converting nop to call */
361 return add_update_call(rec, ftrace_addr);
362
363 case FTRACE_UPDATE_MAKE_NOP:
364 /* converting a call to a nop */
365 return add_update_nop(rec);
366 }
367
368 return 0;
369}
370
371static int finish_update_call(struct dyn_ftrace *rec, unsigned long addr)
372{
373 unsigned long ip = rec->ip;
374 unsigned const char *new;
375
376 new = ftrace_call_replace(ip, addr);
377
378 if (ftrace_write(ip, new, 1))
379 return -EPERM;
380
381 return 0;
382}
383
384static int finish_update_nop(struct dyn_ftrace *rec)
385{
386 unsigned long ip = rec->ip;
387 unsigned const char *new;
388
389 new = ftrace_nop_replace();
390
391 if (ftrace_write(ip, new, 1))
392 return -EPERM;
393 return 0;
394}
395
396static int finish_update(struct dyn_ftrace *rec, int enable)
397{
398 unsigned long ftrace_addr;
399 int ret;
400
401 ret = ftrace_update_record(rec, enable);
402
403 ftrace_addr = (unsigned long)FTRACE_ADDR;
404
405 switch (ret) {
406 case FTRACE_UPDATE_IGNORE:
407 return 0;
408
409 case FTRACE_UPDATE_MAKE_CALL:
410 /* converting nop to call */
411 return finish_update_call(rec, ftrace_addr);
412
413 case FTRACE_UPDATE_MAKE_NOP:
414 /* converting a call to a nop */
415 return finish_update_nop(rec);
416 }
417
418 return 0;
419}
420
421static void do_sync_core(void *data)
422{
423 sync_core();
424}
425
426static void run_sync(void)
427{
428 int enable_irqs = irqs_disabled();
429
430 /* We may be called with interrupts disbled (on bootup). */
431 if (enable_irqs)
432 local_irq_enable();
433 on_each_cpu(do_sync_core, NULL, 1);
434 if (enable_irqs)
435 local_irq_disable();
436}
437
438void ftrace_replace_code(int enable)
439{
440 struct ftrace_rec_iter *iter;
441 struct dyn_ftrace *rec;
442 const char *report = "adding breakpoints";
443 int count = 0;
444 int ret;
445
446 for_ftrace_rec_iter(iter) {
447 rec = ftrace_rec_iter_record(iter);
448
449 ret = add_breakpoints(rec, enable);
450 if (ret)
451 goto remove_breakpoints;
452 count++;
453 }
454
455 run_sync();
456
457 report = "updating code";
458
459 for_ftrace_rec_iter(iter) {
460 rec = ftrace_rec_iter_record(iter);
461
462 ret = add_update(rec, enable);
463 if (ret)
464 goto remove_breakpoints;
465 }
466
467 run_sync();
468
469 report = "removing breakpoints";
470
471 for_ftrace_rec_iter(iter) {
472 rec = ftrace_rec_iter_record(iter);
473
474 ret = finish_update(rec, enable);
475 if (ret)
476 goto remove_breakpoints;
477 }
478
479 run_sync();
480
481 return;
482
483 remove_breakpoints:
484 ftrace_bug(ret, rec ? rec->ip : 0);
485 printk(KERN_WARNING "Failed on %s (%d):\n", report, count);
486 for_ftrace_rec_iter(iter) {
487 rec = ftrace_rec_iter_record(iter);
488 remove_breakpoint(rec);
489 }
490}
491
492void arch_ftrace_update_code(int command)
493{
494 modifying_ftrace_code++;
495
496 ftrace_modify_all_code(command);
497
498 modifying_ftrace_code--;
499}
500
337int __init ftrace_dyn_arch_init(void *data) 501int __init ftrace_dyn_arch_init(void *data)
338{ 502{
339 /* The return code is retured via data */ 503 /* The return code is retured via data */
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 7734bcbb5a3a..f250431fb505 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -88,7 +88,7 @@ void kernel_fpu_begin(void)
88 __thread_clear_has_fpu(me); 88 __thread_clear_has_fpu(me);
89 /* We do 'stts()' in kernel_fpu_end() */ 89 /* We do 'stts()' in kernel_fpu_end() */
90 } else { 90 } else {
91 percpu_write(fpu_owner_task, NULL); 91 this_cpu_write(fpu_owner_task, NULL);
92 clts(); 92 clts();
93 } 93 }
94} 94}
@@ -235,6 +235,7 @@ int init_fpu(struct task_struct *tsk)
235 if (tsk_used_math(tsk)) { 235 if (tsk_used_math(tsk)) {
236 if (HAVE_HWFP && tsk == current) 236 if (HAVE_HWFP && tsk == current)
237 unlazy_fpu(tsk); 237 unlazy_fpu(tsk);
238 tsk->thread.fpu.last_cpu = ~0;
238 return 0; 239 return 0;
239 } 240 }
240 241
diff --git a/arch/x86/kernel/init_task.c b/arch/x86/kernel/init_task.c
deleted file mode 100644
index 43e9ccf44947..000000000000
--- a/arch/x86/kernel/init_task.c
+++ /dev/null
@@ -1,42 +0,0 @@
1#include <linux/mm.h>
2#include <linux/module.h>
3#include <linux/sched.h>
4#include <linux/init.h>
5#include <linux/init_task.h>
6#include <linux/fs.h>
7#include <linux/mqueue.h>
8
9#include <asm/uaccess.h>
10#include <asm/pgtable.h>
11#include <asm/desc.h>
12
13static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
15
16/*
17 * Initial thread structure.
18 *
19 * We need to make sure that this is THREAD_SIZE aligned due to the
20 * way process stacks are handled. This is done by having a special
21 * "init_task" linker map entry..
22 */
23union thread_union init_thread_union __init_task_data =
24 { INIT_THREAD_INFO(init_task) };
25
26/*
27 * Initial task structure.
28 *
29 * All other task structs will be allocated on slabs in fork.c
30 */
31struct task_struct init_task = INIT_TASK(init_task);
32EXPORT_SYMBOL(init_task);
33
34/*
35 * per-CPU TSS segments. Threads are completely 'soft' on Linux,
36 * no more per-task TSS's. The TSS size is kept cacheline-aligned
37 * so they are allowed to end up in the .data..cacheline_aligned
38 * section. Since TSS's are completely CPU-local, we want them
39 * on exact cacheline boundaries, to eliminate cacheline ping-pong.
40 */
41DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss) = INIT_TSS;
42
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 58b7f27cb3e9..344faf8d0d62 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -127,8 +127,8 @@ void __cpuinit irq_ctx_init(int cpu)
127 return; 127 return;
128 128
129 irqctx = page_address(alloc_pages_node(cpu_to_node(cpu), 129 irqctx = page_address(alloc_pages_node(cpu_to_node(cpu),
130 THREAD_FLAGS, 130 THREADINFO_GFP,
131 THREAD_ORDER)); 131 THREAD_SIZE_ORDER));
132 memset(&irqctx->tinfo, 0, sizeof(struct thread_info)); 132 memset(&irqctx->tinfo, 0, sizeof(struct thread_info));
133 irqctx->tinfo.cpu = cpu; 133 irqctx->tinfo.cpu = cpu;
134 irqctx->tinfo.preempt_count = HARDIRQ_OFFSET; 134 irqctx->tinfo.preempt_count = HARDIRQ_OFFSET;
@@ -137,8 +137,8 @@ void __cpuinit irq_ctx_init(int cpu)
137 per_cpu(hardirq_ctx, cpu) = irqctx; 137 per_cpu(hardirq_ctx, cpu) = irqctx;
138 138
139 irqctx = page_address(alloc_pages_node(cpu_to_node(cpu), 139 irqctx = page_address(alloc_pages_node(cpu_to_node(cpu),
140 THREAD_FLAGS, 140 THREADINFO_GFP,
141 THREAD_ORDER)); 141 THREAD_SIZE_ORDER));
142 memset(&irqctx->tinfo, 0, sizeof(struct thread_info)); 142 memset(&irqctx->tinfo, 0, sizeof(struct thread_info));
143 irqctx->tinfo.cpu = cpu; 143 irqctx->tinfo.cpu = cpu;
144 irqctx->tinfo.addr_limit = MAKE_MM_SEG(0); 144 irqctx->tinfo.addr_limit = MAKE_MM_SEG(0);
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index b8ba6e4a27e4..e554e5ad2fe8 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -79,7 +79,6 @@ struct kvm_task_sleep_node {
79 u32 token; 79 u32 token;
80 int cpu; 80 int cpu;
81 bool halted; 81 bool halted;
82 struct mm_struct *mm;
83}; 82};
84 83
85static struct kvm_task_sleep_head { 84static struct kvm_task_sleep_head {
@@ -126,9 +125,7 @@ void kvm_async_pf_task_wait(u32 token)
126 125
127 n.token = token; 126 n.token = token;
128 n.cpu = smp_processor_id(); 127 n.cpu = smp_processor_id();
129 n.mm = current->active_mm;
130 n.halted = idle || preempt_count() > 1; 128 n.halted = idle || preempt_count() > 1;
131 atomic_inc(&n.mm->mm_count);
132 init_waitqueue_head(&n.wq); 129 init_waitqueue_head(&n.wq);
133 hlist_add_head(&n.link, &b->list); 130 hlist_add_head(&n.link, &b->list);
134 spin_unlock(&b->lock); 131 spin_unlock(&b->lock);
@@ -161,9 +158,6 @@ EXPORT_SYMBOL_GPL(kvm_async_pf_task_wait);
161static void apf_task_wake_one(struct kvm_task_sleep_node *n) 158static void apf_task_wake_one(struct kvm_task_sleep_node *n)
162{ 159{
163 hlist_del_init(&n->link); 160 hlist_del_init(&n->link);
164 if (!n->mm)
165 return;
166 mmdrop(n->mm);
167 if (n->halted) 161 if (n->halted)
168 smp_send_reschedule(n->cpu); 162 smp_send_reschedule(n->cpu);
169 else if (waitqueue_active(&n->wq)) 163 else if (waitqueue_active(&n->wq))
@@ -207,7 +201,7 @@ again:
207 * async PF was not yet handled. 201 * async PF was not yet handled.
208 * Add dummy entry for the token. 202 * Add dummy entry for the token.
209 */ 203 */
210 n = kmalloc(sizeof(*n), GFP_ATOMIC); 204 n = kzalloc(sizeof(*n), GFP_ATOMIC);
211 if (!n) { 205 if (!n) {
212 /* 206 /*
213 * Allocation failed! Busy wait while other cpu 207 * Allocation failed! Busy wait while other cpu
@@ -219,7 +213,6 @@ again:
219 } 213 }
220 n->token = token; 214 n->token = token;
221 n->cpu = smp_processor_id(); 215 n->cpu = smp_processor_id();
222 n->mm = NULL;
223 init_waitqueue_head(&n->wq); 216 init_waitqueue_head(&n->wq);
224 hlist_add_head(&n->link, &b->list); 217 hlist_add_head(&n->link, &b->list);
225 } else 218 } else
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 73465aab28f8..8a2ce8fd41c0 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -82,11 +82,6 @@ static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
82{ 82{
83 struct cpuinfo_x86 *c = &cpu_data(cpu); 83 struct cpuinfo_x86 *c = &cpu_data(cpu);
84 84
85 if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) {
86 pr_warning("CPU%d: family %d not supported\n", cpu, c->x86);
87 return -1;
88 }
89
90 csig->rev = c->microcode; 85 csig->rev = c->microcode;
91 pr_info("CPU%d: patch_level=0x%08x\n", cpu, csig->rev); 86 pr_info("CPU%d: patch_level=0x%08x\n", cpu, csig->rev);
92 87
@@ -380,6 +375,13 @@ static struct microcode_ops microcode_amd_ops = {
380 375
381struct microcode_ops * __init init_amd_microcode(void) 376struct microcode_ops * __init init_amd_microcode(void)
382{ 377{
378 struct cpuinfo_x86 *c = &cpu_data(0);
379
380 if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) {
381 pr_warning("AMD CPU family 0x%x not supported\n", c->x86);
382 return NULL;
383 }
384
383 patch = (void *)get_zeroed_page(GFP_KERNEL); 385 patch = (void *)get_zeroed_page(GFP_KERNEL);
384 if (!patch) 386 if (!patch)
385 return NULL; 387 return NULL;
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index 87a0f8688301..c9bda6d6035c 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -419,10 +419,8 @@ static int mc_device_add(struct device *dev, struct subsys_interface *sif)
419 if (err) 419 if (err)
420 return err; 420 return err;
421 421
422 if (microcode_init_cpu(cpu) == UCODE_ERROR) { 422 if (microcode_init_cpu(cpu) == UCODE_ERROR)
423 sysfs_remove_group(&dev->kobj, &mc_attr_group);
424 return -EINVAL; 423 return -EINVAL;
425 }
426 424
427 return err; 425 return err;
428} 426}
@@ -528,11 +526,11 @@ static int __init microcode_init(void)
528 microcode_ops = init_intel_microcode(); 526 microcode_ops = init_intel_microcode();
529 else if (c->x86_vendor == X86_VENDOR_AMD) 527 else if (c->x86_vendor == X86_VENDOR_AMD)
530 microcode_ops = init_amd_microcode(); 528 microcode_ops = init_amd_microcode();
531 529 else
532 if (!microcode_ops) {
533 pr_err("no support for this CPU vendor\n"); 530 pr_err("no support for this CPU vendor\n");
531
532 if (!microcode_ops)
534 return -ENODEV; 533 return -ENODEV;
535 }
536 534
537 microcode_pdev = platform_device_register_simple("microcode", -1, 535 microcode_pdev = platform_device_register_simple("microcode", -1,
538 NULL, 0); 536 NULL, 0);
diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c
index 3ca42d0e43a2..0327e2b3c408 100644
--- a/arch/x86/kernel/microcode_intel.c
+++ b/arch/x86/kernel/microcode_intel.c
@@ -147,12 +147,6 @@ static int collect_cpu_info(int cpu_num, struct cpu_signature *csig)
147 147
148 memset(csig, 0, sizeof(*csig)); 148 memset(csig, 0, sizeof(*csig));
149 149
150 if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
151 cpu_has(c, X86_FEATURE_IA64)) {
152 pr_err("CPU%d not a capable Intel processor\n", cpu_num);
153 return -1;
154 }
155
156 csig->sig = cpuid_eax(0x00000001); 150 csig->sig = cpuid_eax(0x00000001);
157 151
158 if ((c->x86_model >= 5) || (c->x86 > 6)) { 152 if ((c->x86_model >= 5) || (c->x86 > 6)) {
@@ -463,6 +457,14 @@ static struct microcode_ops microcode_intel_ops = {
463 457
464struct microcode_ops * __init init_intel_microcode(void) 458struct microcode_ops * __init init_intel_microcode(void)
465{ 459{
460 struct cpuinfo_x86 *c = &cpu_data(0);
461
462 if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
463 cpu_has(c, X86_FEATURE_IA64)) {
464 pr_err("Intel CPU family 0x%x not supported\n", c->x86);
465 return NULL;
466 }
467
466 return &microcode_intel_ops; 468 return &microcode_intel_ops;
467} 469}
468 470
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index 47acaf319165..a1faed5ac6a2 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -31,14 +31,6 @@
31#include <asm/nmi.h> 31#include <asm/nmi.h>
32#include <asm/x86_init.h> 32#include <asm/x86_init.h>
33 33
34#define NMI_MAX_NAMELEN 16
35struct nmiaction {
36 struct list_head list;
37 nmi_handler_t handler;
38 unsigned int flags;
39 char *name;
40};
41
42struct nmi_desc { 34struct nmi_desc {
43 spinlock_t lock; 35 spinlock_t lock;
44 struct list_head head; 36 struct list_head head;
@@ -54,6 +46,14 @@ static struct nmi_desc nmi_desc[NMI_MAX] =
54 .lock = __SPIN_LOCK_UNLOCKED(&nmi_desc[1].lock), 46 .lock = __SPIN_LOCK_UNLOCKED(&nmi_desc[1].lock),
55 .head = LIST_HEAD_INIT(nmi_desc[1].head), 47 .head = LIST_HEAD_INIT(nmi_desc[1].head),
56 }, 48 },
49 {
50 .lock = __SPIN_LOCK_UNLOCKED(&nmi_desc[2].lock),
51 .head = LIST_HEAD_INIT(nmi_desc[2].head),
52 },
53 {
54 .lock = __SPIN_LOCK_UNLOCKED(&nmi_desc[3].lock),
55 .head = LIST_HEAD_INIT(nmi_desc[3].head),
56 },
57 57
58}; 58};
59 59
@@ -84,7 +84,7 @@ __setup("unknown_nmi_panic", setup_unknown_nmi_panic);
84 84
85#define nmi_to_desc(type) (&nmi_desc[type]) 85#define nmi_to_desc(type) (&nmi_desc[type])
86 86
87static int notrace __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2b) 87static int __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2b)
88{ 88{
89 struct nmi_desc *desc = nmi_to_desc(type); 89 struct nmi_desc *desc = nmi_to_desc(type);
90 struct nmiaction *a; 90 struct nmiaction *a;
@@ -107,11 +107,14 @@ static int notrace __kprobes nmi_handle(unsigned int type, struct pt_regs *regs,
107 return handled; 107 return handled;
108} 108}
109 109
110static int __setup_nmi(unsigned int type, struct nmiaction *action) 110int __register_nmi_handler(unsigned int type, struct nmiaction *action)
111{ 111{
112 struct nmi_desc *desc = nmi_to_desc(type); 112 struct nmi_desc *desc = nmi_to_desc(type);
113 unsigned long flags; 113 unsigned long flags;
114 114
115 if (!action->handler)
116 return -EINVAL;
117
115 spin_lock_irqsave(&desc->lock, flags); 118 spin_lock_irqsave(&desc->lock, flags);
116 119
117 /* 120 /*
@@ -120,6 +123,8 @@ static int __setup_nmi(unsigned int type, struct nmiaction *action)
120 * to manage expectations 123 * to manage expectations
121 */ 124 */
122 WARN_ON_ONCE(type == NMI_UNKNOWN && !list_empty(&desc->head)); 125 WARN_ON_ONCE(type == NMI_UNKNOWN && !list_empty(&desc->head));
126 WARN_ON_ONCE(type == NMI_SERR && !list_empty(&desc->head));
127 WARN_ON_ONCE(type == NMI_IO_CHECK && !list_empty(&desc->head));
123 128
124 /* 129 /*
125 * some handlers need to be executed first otherwise a fake 130 * some handlers need to be executed first otherwise a fake
@@ -133,8 +138,9 @@ static int __setup_nmi(unsigned int type, struct nmiaction *action)
133 spin_unlock_irqrestore(&desc->lock, flags); 138 spin_unlock_irqrestore(&desc->lock, flags);
134 return 0; 139 return 0;
135} 140}
141EXPORT_SYMBOL(__register_nmi_handler);
136 142
137static struct nmiaction *__free_nmi(unsigned int type, const char *name) 143void unregister_nmi_handler(unsigned int type, const char *name)
138{ 144{
139 struct nmi_desc *desc = nmi_to_desc(type); 145 struct nmi_desc *desc = nmi_to_desc(type);
140 struct nmiaction *n; 146 struct nmiaction *n;
@@ -157,61 +163,16 @@ static struct nmiaction *__free_nmi(unsigned int type, const char *name)
157 163
158 spin_unlock_irqrestore(&desc->lock, flags); 164 spin_unlock_irqrestore(&desc->lock, flags);
159 synchronize_rcu(); 165 synchronize_rcu();
160 return (n);
161} 166}
162
163int register_nmi_handler(unsigned int type, nmi_handler_t handler,
164 unsigned long nmiflags, const char *devname)
165{
166 struct nmiaction *action;
167 int retval = -ENOMEM;
168
169 if (!handler)
170 return -EINVAL;
171
172 action = kzalloc(sizeof(struct nmiaction), GFP_KERNEL);
173 if (!action)
174 goto fail_action;
175
176 action->handler = handler;
177 action->flags = nmiflags;
178 action->name = kstrndup(devname, NMI_MAX_NAMELEN, GFP_KERNEL);
179 if (!action->name)
180 goto fail_action_name;
181
182 retval = __setup_nmi(type, action);
183
184 if (retval)
185 goto fail_setup_nmi;
186
187 return retval;
188
189fail_setup_nmi:
190 kfree(action->name);
191fail_action_name:
192 kfree(action);
193fail_action:
194
195 return retval;
196}
197EXPORT_SYMBOL_GPL(register_nmi_handler);
198
199void unregister_nmi_handler(unsigned int type, const char *name)
200{
201 struct nmiaction *a;
202
203 a = __free_nmi(type, name);
204 if (a) {
205 kfree(a->name);
206 kfree(a);
207 }
208}
209
210EXPORT_SYMBOL_GPL(unregister_nmi_handler); 167EXPORT_SYMBOL_GPL(unregister_nmi_handler);
211 168
212static notrace __kprobes void 169static __kprobes void
213pci_serr_error(unsigned char reason, struct pt_regs *regs) 170pci_serr_error(unsigned char reason, struct pt_regs *regs)
214{ 171{
172 /* check to see if anyone registered against these types of errors */
173 if (nmi_handle(NMI_SERR, regs, false))
174 return;
175
215 pr_emerg("NMI: PCI system error (SERR) for reason %02x on CPU %d.\n", 176 pr_emerg("NMI: PCI system error (SERR) for reason %02x on CPU %d.\n",
216 reason, smp_processor_id()); 177 reason, smp_processor_id());
217 178
@@ -236,11 +197,15 @@ pci_serr_error(unsigned char reason, struct pt_regs *regs)
236 outb(reason, NMI_REASON_PORT); 197 outb(reason, NMI_REASON_PORT);
237} 198}
238 199
239static notrace __kprobes void 200static __kprobes void
240io_check_error(unsigned char reason, struct pt_regs *regs) 201io_check_error(unsigned char reason, struct pt_regs *regs)
241{ 202{
242 unsigned long i; 203 unsigned long i;
243 204
205 /* check to see if anyone registered against these types of errors */
206 if (nmi_handle(NMI_IO_CHECK, regs, false))
207 return;
208
244 pr_emerg( 209 pr_emerg(
245 "NMI: IOCK error (debug interrupt?) for reason %02x on CPU %d.\n", 210 "NMI: IOCK error (debug interrupt?) for reason %02x on CPU %d.\n",
246 reason, smp_processor_id()); 211 reason, smp_processor_id());
@@ -263,7 +228,7 @@ io_check_error(unsigned char reason, struct pt_regs *regs)
263 outb(reason, NMI_REASON_PORT); 228 outb(reason, NMI_REASON_PORT);
264} 229}
265 230
266static notrace __kprobes void 231static __kprobes void
267unknown_nmi_error(unsigned char reason, struct pt_regs *regs) 232unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
268{ 233{
269 int handled; 234 int handled;
@@ -305,7 +270,7 @@ unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
305static DEFINE_PER_CPU(bool, swallow_nmi); 270static DEFINE_PER_CPU(bool, swallow_nmi);
306static DEFINE_PER_CPU(unsigned long, last_nmi_rip); 271static DEFINE_PER_CPU(unsigned long, last_nmi_rip);
307 272
308static notrace __kprobes void default_do_nmi(struct pt_regs *regs) 273static __kprobes void default_do_nmi(struct pt_regs *regs)
309{ 274{
310 unsigned char reason = 0; 275 unsigned char reason = 0;
311 int handled; 276 int handled;
diff --git a/arch/x86/kernel/nmi_selftest.c b/arch/x86/kernel/nmi_selftest.c
index 2c39dcd510fa..ff3698625081 100644
--- a/arch/x86/kernel/nmi_selftest.c
+++ b/arch/x86/kernel/nmi_selftest.c
@@ -13,6 +13,7 @@
13#include <linux/cpumask.h> 13#include <linux/cpumask.h>
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/percpu.h>
16 17
17#include <asm/apic.h> 18#include <asm/apic.h>
18#include <asm/nmi.h> 19#include <asm/nmi.h>
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index ab137605e694..9ce885996fd7 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -241,16 +241,16 @@ static DEFINE_PER_CPU(enum paravirt_lazy_mode, paravirt_lazy_mode) = PARAVIRT_LA
241 241
242static inline void enter_lazy(enum paravirt_lazy_mode mode) 242static inline void enter_lazy(enum paravirt_lazy_mode mode)
243{ 243{
244 BUG_ON(percpu_read(paravirt_lazy_mode) != PARAVIRT_LAZY_NONE); 244 BUG_ON(this_cpu_read(paravirt_lazy_mode) != PARAVIRT_LAZY_NONE);
245 245
246 percpu_write(paravirt_lazy_mode, mode); 246 this_cpu_write(paravirt_lazy_mode, mode);
247} 247}
248 248
249static void leave_lazy(enum paravirt_lazy_mode mode) 249static void leave_lazy(enum paravirt_lazy_mode mode)
250{ 250{
251 BUG_ON(percpu_read(paravirt_lazy_mode) != mode); 251 BUG_ON(this_cpu_read(paravirt_lazy_mode) != mode);
252 252
253 percpu_write(paravirt_lazy_mode, PARAVIRT_LAZY_NONE); 253 this_cpu_write(paravirt_lazy_mode, PARAVIRT_LAZY_NONE);
254} 254}
255 255
256void paravirt_enter_lazy_mmu(void) 256void paravirt_enter_lazy_mmu(void)
@@ -267,7 +267,7 @@ void paravirt_start_context_switch(struct task_struct *prev)
267{ 267{
268 BUG_ON(preemptible()); 268 BUG_ON(preemptible());
269 269
270 if (percpu_read(paravirt_lazy_mode) == PARAVIRT_LAZY_MMU) { 270 if (this_cpu_read(paravirt_lazy_mode) == PARAVIRT_LAZY_MMU) {
271 arch_leave_lazy_mmu_mode(); 271 arch_leave_lazy_mmu_mode();
272 set_ti_thread_flag(task_thread_info(prev), TIF_LAZY_MMU_UPDATES); 272 set_ti_thread_flag(task_thread_info(prev), TIF_LAZY_MMU_UPDATES);
273 } 273 }
@@ -289,7 +289,7 @@ enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
289 if (in_interrupt()) 289 if (in_interrupt())
290 return PARAVIRT_LAZY_NONE; 290 return PARAVIRT_LAZY_NONE;
291 291
292 return percpu_read(paravirt_lazy_mode); 292 return this_cpu_read(paravirt_lazy_mode);
293} 293}
294 294
295void arch_flush_lazy_mmu_mode(void) 295void arch_flush_lazy_mmu_mode(void)
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 1d92a5ab6e8b..8040b752ee4f 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -27,6 +27,15 @@
27#include <asm/debugreg.h> 27#include <asm/debugreg.h>
28#include <asm/nmi.h> 28#include <asm/nmi.h>
29 29
30/*
31 * per-CPU TSS segments. Threads are completely 'soft' on Linux,
32 * no more per-task TSS's. The TSS size is kept cacheline-aligned
33 * so they are allowed to end up in the .data..cacheline_aligned
34 * section. Since TSS's are completely CPU-local, we want them
35 * on exact cacheline boundaries, to eliminate cacheline ping-pong.
36 */
37DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss) = INIT_TSS;
38
30#ifdef CONFIG_X86_64 39#ifdef CONFIG_X86_64
31static DEFINE_PER_CPU(unsigned char, is_idle); 40static DEFINE_PER_CPU(unsigned char, is_idle);
32static ATOMIC_NOTIFIER_HEAD(idle_notifier); 41static ATOMIC_NOTIFIER_HEAD(idle_notifier);
@@ -67,10 +76,9 @@ void free_thread_xstate(struct task_struct *tsk)
67 fpu_free(&tsk->thread.fpu); 76 fpu_free(&tsk->thread.fpu);
68} 77}
69 78
70void free_thread_info(struct thread_info *ti) 79void arch_release_task_struct(struct task_struct *tsk)
71{ 80{
72 free_thread_xstate(ti->task); 81 free_thread_xstate(tsk);
73 free_pages((unsigned long)ti, THREAD_ORDER);
74} 82}
75 83
76void arch_task_cache_init(void) 84void arch_task_cache_init(void)
@@ -377,7 +385,7 @@ static inline void play_dead(void)
377#ifdef CONFIG_X86_64 385#ifdef CONFIG_X86_64
378void enter_idle(void) 386void enter_idle(void)
379{ 387{
380 percpu_write(is_idle, 1); 388 this_cpu_write(is_idle, 1);
381 atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL); 389 atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL);
382} 390}
383 391
@@ -516,26 +524,6 @@ void stop_this_cpu(void *dummy)
516 } 524 }
517} 525}
518 526
519static void do_nothing(void *unused)
520{
521}
522
523/*
524 * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
525 * pm_idle and update to new pm_idle value. Required while changing pm_idle
526 * handler on SMP systems.
527 *
528 * Caller must have changed pm_idle to the new value before the call. Old
529 * pm_idle value will not be used by any CPU after the return of this function.
530 */
531void cpu_idle_wait(void)
532{
533 smp_mb();
534 /* kick all the CPUs so that they exit out of pm_idle */
535 smp_call_function(do_nothing, NULL, 1);
536}
537EXPORT_SYMBOL_GPL(cpu_idle_wait);
538
539/* Default MONITOR/MWAIT with no hints, used for default C1 state */ 527/* Default MONITOR/MWAIT with no hints, used for default C1 state */
540static void mwait_idle(void) 528static void mwait_idle(void)
541{ 529{
@@ -594,9 +582,17 @@ int mwait_usable(const struct cpuinfo_x86 *c)
594{ 582{
595 u32 eax, ebx, ecx, edx; 583 u32 eax, ebx, ecx, edx;
596 584
585 /* Use mwait if idle=mwait boot option is given */
597 if (boot_option_idle_override == IDLE_FORCE_MWAIT) 586 if (boot_option_idle_override == IDLE_FORCE_MWAIT)
598 return 1; 587 return 1;
599 588
589 /*
590 * Any idle= boot option other than idle=mwait means that we must not
591 * use mwait. Eg: idle=halt or idle=poll or idle=nomwait
592 */
593 if (boot_option_idle_override != IDLE_NO_OVERRIDE)
594 return 0;
595
600 if (c->cpuid_level < MWAIT_INFO) 596 if (c->cpuid_level < MWAIT_INFO)
601 return 0; 597 return 0;
602 598
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index ae6847303e26..01d8d40ccaf6 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -302,7 +302,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
302 302
303 switch_fpu_finish(next_p, fpu); 303 switch_fpu_finish(next_p, fpu);
304 304
305 percpu_write(current_task, next_p); 305 this_cpu_write(current_task, next_p);
306 306
307 return prev_p; 307 return prev_p;
308} 308}
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 733ca39f367e..28e810255a0a 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -237,7 +237,7 @@ start_thread_common(struct pt_regs *regs, unsigned long new_ip,
237 current->thread.usersp = new_sp; 237 current->thread.usersp = new_sp;
238 regs->ip = new_ip; 238 regs->ip = new_ip;
239 regs->sp = new_sp; 239 regs->sp = new_sp;
240 percpu_write(old_rsp, new_sp); 240 this_cpu_write(old_rsp, new_sp);
241 regs->cs = _cs; 241 regs->cs = _cs;
242 regs->ss = _ss; 242 regs->ss = _ss;
243 regs->flags = X86_EFLAGS_IF; 243 regs->flags = X86_EFLAGS_IF;
@@ -359,11 +359,11 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
359 /* 359 /*
360 * Switch the PDA and FPU contexts. 360 * Switch the PDA and FPU contexts.
361 */ 361 */
362 prev->usersp = percpu_read(old_rsp); 362 prev->usersp = this_cpu_read(old_rsp);
363 percpu_write(old_rsp, next->usersp); 363 this_cpu_write(old_rsp, next->usersp);
364 percpu_write(current_task, next_p); 364 this_cpu_write(current_task, next_p);
365 365
366 percpu_write(kernel_stack, 366 this_cpu_write(kernel_stack,
367 (unsigned long)task_stack_page(next_p) + 367 (unsigned long)task_stack_page(next_p) +
368 THREAD_SIZE - KERNEL_STACK_OFFSET); 368 THREAD_SIZE - KERNEL_STACK_OFFSET);
369 369
@@ -423,6 +423,7 @@ void set_personality_ia32(bool x32)
423 current_thread_info()->status |= TS_COMPAT; 423 current_thread_info()->status |= TS_COMPAT;
424 } 424 }
425} 425}
426EXPORT_SYMBOL_GPL(set_personality_ia32);
426 427
427unsigned long get_wchan(struct task_struct *p) 428unsigned long get_wchan(struct task_struct *p)
428{ 429{
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 685845cf16e0..13b1990c7c58 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1480,7 +1480,11 @@ long syscall_trace_enter(struct pt_regs *regs)
1480 regs->flags |= X86_EFLAGS_TF; 1480 regs->flags |= X86_EFLAGS_TF;
1481 1481
1482 /* do the secure computing check first */ 1482 /* do the secure computing check first */
1483 secure_computing(regs->orig_ax); 1483 if (secure_computing(regs->orig_ax)) {
1484 /* seccomp failures shouldn't expose any additional code. */
1485 ret = -1L;
1486 goto out;
1487 }
1484 1488
1485 if (unlikely(test_thread_flag(TIF_SYSCALL_EMU))) 1489 if (unlikely(test_thread_flag(TIF_SYSCALL_EMU)))
1486 ret = -1L; 1490 ret = -1L;
@@ -1505,6 +1509,7 @@ long syscall_trace_enter(struct pt_regs *regs)
1505 regs->dx, regs->r10); 1509 regs->dx, regs->r10);
1506#endif 1510#endif
1507 1511
1512out:
1508 return ret ?: regs->orig_ax; 1513 return ret ?: regs->orig_ax;
1509} 1514}
1510 1515
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 1a2901562059..7e67c5a71061 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1012,7 +1012,8 @@ void __init setup_arch(char **cmdline_p)
1012 init_cpu_to_node(); 1012 init_cpu_to_node();
1013 1013
1014 init_apic_mappings(); 1014 init_apic_mappings();
1015 ioapic_and_gsi_init(); 1015 if (x86_io_apic_ops.init)
1016 x86_io_apic_ops.init();
1016 1017
1017 kvm_guest_init(); 1018 kvm_guest_init();
1018 1019
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 71f4727da373..5a98aa272184 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -185,10 +185,22 @@ void __init setup_per_cpu_areas(void)
185#endif 185#endif
186 rc = -EINVAL; 186 rc = -EINVAL;
187 if (pcpu_chosen_fc != PCPU_FC_PAGE) { 187 if (pcpu_chosen_fc != PCPU_FC_PAGE) {
188 const size_t atom_size = cpu_has_pse ? PMD_SIZE : PAGE_SIZE;
189 const size_t dyn_size = PERCPU_MODULE_RESERVE + 188 const size_t dyn_size = PERCPU_MODULE_RESERVE +
190 PERCPU_DYNAMIC_RESERVE - PERCPU_FIRST_CHUNK_RESERVE; 189 PERCPU_DYNAMIC_RESERVE - PERCPU_FIRST_CHUNK_RESERVE;
190 size_t atom_size;
191 191
192 /*
193 * On 64bit, use PMD_SIZE for atom_size so that embedded
194 * percpu areas are aligned to PMD. This, in the future,
195 * can also allow using PMD mappings in vmalloc area. Use
196 * PAGE_SIZE on 32bit as vmalloc space is highly contended
197 * and large vmalloc area allocs can easily fail.
198 */
199#ifdef CONFIG_X86_64
200 atom_size = PMD_SIZE;
201#else
202 atom_size = PAGE_SIZE;
203#endif
192 rc = pcpu_embed_first_chunk(PERCPU_FIRST_CHUNK_RESERVE, 204 rc = pcpu_embed_first_chunk(PERCPU_FIRST_CHUNK_RESERVE,
193 dyn_size, atom_size, 205 dyn_size, atom_size,
194 pcpu_cpu_distance, 206 pcpu_cpu_distance,
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 6e1e406038c2..433529e29be4 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -76,20 +76,8 @@
76/* State of each CPU */ 76/* State of each CPU */
77DEFINE_PER_CPU(int, cpu_state) = { 0 }; 77DEFINE_PER_CPU(int, cpu_state) = { 0 };
78 78
79/* Store all idle threads, this can be reused instead of creating
80* a new thread. Also avoids complicated thread destroy functionality
81* for idle threads.
82*/
83#ifdef CONFIG_HOTPLUG_CPU 79#ifdef CONFIG_HOTPLUG_CPU
84/* 80/*
85 * Needed only for CONFIG_HOTPLUG_CPU because __cpuinitdata is
86 * removed after init for !CONFIG_HOTPLUG_CPU.
87 */
88static DEFINE_PER_CPU(struct task_struct *, idle_thread_array);
89#define get_idle_for_cpu(x) (per_cpu(idle_thread_array, x))
90#define set_idle_for_cpu(x, p) (per_cpu(idle_thread_array, x) = (p))
91
92/*
93 * We need this for trampoline_base protection from concurrent accesses when 81 * We need this for trampoline_base protection from concurrent accesses when
94 * off- and onlining cores wildly. 82 * off- and onlining cores wildly.
95 */ 83 */
@@ -97,20 +85,16 @@ static DEFINE_MUTEX(x86_cpu_hotplug_driver_mutex);
97 85
98void cpu_hotplug_driver_lock(void) 86void cpu_hotplug_driver_lock(void)
99{ 87{
100 mutex_lock(&x86_cpu_hotplug_driver_mutex); 88 mutex_lock(&x86_cpu_hotplug_driver_mutex);
101} 89}
102 90
103void cpu_hotplug_driver_unlock(void) 91void cpu_hotplug_driver_unlock(void)
104{ 92{
105 mutex_unlock(&x86_cpu_hotplug_driver_mutex); 93 mutex_unlock(&x86_cpu_hotplug_driver_mutex);
106} 94}
107 95
108ssize_t arch_cpu_probe(const char *buf, size_t count) { return -1; } 96ssize_t arch_cpu_probe(const char *buf, size_t count) { return -1; }
109ssize_t arch_cpu_release(const char *buf, size_t count) { return -1; } 97ssize_t arch_cpu_release(const char *buf, size_t count) { return -1; }
110#else
111static struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ;
112#define get_idle_for_cpu(x) (idle_thread_array[(x)])
113#define set_idle_for_cpu(x, p) (idle_thread_array[(x)] = (p))
114#endif 98#endif
115 99
116/* Number of siblings per CPU package */ 100/* Number of siblings per CPU package */
@@ -315,59 +299,90 @@ void __cpuinit smp_store_cpu_info(int id)
315 identify_secondary_cpu(c); 299 identify_secondary_cpu(c);
316} 300}
317 301
318static void __cpuinit link_thread_siblings(int cpu1, int cpu2) 302static bool __cpuinit
303topology_sane(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o, const char *name)
319{ 304{
320 cpumask_set_cpu(cpu1, cpu_sibling_mask(cpu2)); 305 int cpu1 = c->cpu_index, cpu2 = o->cpu_index;
321 cpumask_set_cpu(cpu2, cpu_sibling_mask(cpu1)); 306
322 cpumask_set_cpu(cpu1, cpu_core_mask(cpu2)); 307 return !WARN_ONCE(cpu_to_node(cpu1) != cpu_to_node(cpu2),
323 cpumask_set_cpu(cpu2, cpu_core_mask(cpu1)); 308 "sched: CPU #%d's %s-sibling CPU #%d is not on the same node! "
324 cpumask_set_cpu(cpu1, cpu_llc_shared_mask(cpu2)); 309 "[node: %d != %d]. Ignoring dependency.\n",
325 cpumask_set_cpu(cpu2, cpu_llc_shared_mask(cpu1)); 310 cpu1, name, cpu2, cpu_to_node(cpu1), cpu_to_node(cpu2));
326} 311}
327 312
313#define link_mask(_m, c1, c2) \
314do { \
315 cpumask_set_cpu((c1), cpu_##_m##_mask(c2)); \
316 cpumask_set_cpu((c2), cpu_##_m##_mask(c1)); \
317} while (0)
318
319static bool __cpuinit match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
320{
321 if (cpu_has(c, X86_FEATURE_TOPOEXT)) {
322 int cpu1 = c->cpu_index, cpu2 = o->cpu_index;
323
324 if (c->phys_proc_id == o->phys_proc_id &&
325 per_cpu(cpu_llc_id, cpu1) == per_cpu(cpu_llc_id, cpu2) &&
326 c->compute_unit_id == o->compute_unit_id)
327 return topology_sane(c, o, "smt");
328
329 } else if (c->phys_proc_id == o->phys_proc_id &&
330 c->cpu_core_id == o->cpu_core_id) {
331 return topology_sane(c, o, "smt");
332 }
333
334 return false;
335}
336
337static bool __cpuinit match_llc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
338{
339 int cpu1 = c->cpu_index, cpu2 = o->cpu_index;
340
341 if (per_cpu(cpu_llc_id, cpu1) != BAD_APICID &&
342 per_cpu(cpu_llc_id, cpu1) == per_cpu(cpu_llc_id, cpu2))
343 return topology_sane(c, o, "llc");
344
345 return false;
346}
347
348static bool __cpuinit match_mc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
349{
350 if (c->phys_proc_id == o->phys_proc_id)
351 return topology_sane(c, o, "mc");
352
353 return false;
354}
328 355
329void __cpuinit set_cpu_sibling_map(int cpu) 356void __cpuinit set_cpu_sibling_map(int cpu)
330{ 357{
331 int i; 358 bool has_mc = boot_cpu_data.x86_max_cores > 1;
359 bool has_smt = smp_num_siblings > 1;
332 struct cpuinfo_x86 *c = &cpu_data(cpu); 360 struct cpuinfo_x86 *c = &cpu_data(cpu);
361 struct cpuinfo_x86 *o;
362 int i;
333 363
334 cpumask_set_cpu(cpu, cpu_sibling_setup_mask); 364 cpumask_set_cpu(cpu, cpu_sibling_setup_mask);
335 365
336 if (smp_num_siblings > 1) { 366 if (!has_smt && !has_mc) {
337 for_each_cpu(i, cpu_sibling_setup_mask) {
338 struct cpuinfo_x86 *o = &cpu_data(i);
339
340 if (cpu_has(c, X86_FEATURE_TOPOEXT)) {
341 if (c->phys_proc_id == o->phys_proc_id &&
342 per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i) &&
343 c->compute_unit_id == o->compute_unit_id)
344 link_thread_siblings(cpu, i);
345 } else if (c->phys_proc_id == o->phys_proc_id &&
346 c->cpu_core_id == o->cpu_core_id) {
347 link_thread_siblings(cpu, i);
348 }
349 }
350 } else {
351 cpumask_set_cpu(cpu, cpu_sibling_mask(cpu)); 367 cpumask_set_cpu(cpu, cpu_sibling_mask(cpu));
352 } 368 cpumask_set_cpu(cpu, cpu_llc_shared_mask(cpu));
353 369 cpumask_set_cpu(cpu, cpu_core_mask(cpu));
354 cpumask_set_cpu(cpu, cpu_llc_shared_mask(cpu));
355
356 if (__this_cpu_read(cpu_info.x86_max_cores) == 1) {
357 cpumask_copy(cpu_core_mask(cpu), cpu_sibling_mask(cpu));
358 c->booted_cores = 1; 370 c->booted_cores = 1;
359 return; 371 return;
360 } 372 }
361 373
362 for_each_cpu(i, cpu_sibling_setup_mask) { 374 for_each_cpu(i, cpu_sibling_setup_mask) {
363 if (per_cpu(cpu_llc_id, cpu) != BAD_APICID && 375 o = &cpu_data(i);
364 per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) { 376
365 cpumask_set_cpu(i, cpu_llc_shared_mask(cpu)); 377 if ((i == cpu) || (has_smt && match_smt(c, o)))
366 cpumask_set_cpu(cpu, cpu_llc_shared_mask(i)); 378 link_mask(sibling, cpu, i);
367 } 379
368 if (c->phys_proc_id == cpu_data(i).phys_proc_id) { 380 if ((i == cpu) || (has_mc && match_llc(c, o)))
369 cpumask_set_cpu(i, cpu_core_mask(cpu)); 381 link_mask(llc_shared, cpu, i);
370 cpumask_set_cpu(cpu, cpu_core_mask(i)); 382
383 if ((i == cpu) || (has_mc && match_mc(c, o))) {
384 link_mask(core, cpu, i);
385
371 /* 386 /*
372 * Does this new cpu bringup a new core? 387 * Does this new cpu bringup a new core?
373 */ 388 */
@@ -398,8 +413,7 @@ const struct cpumask *cpu_coregroup_mask(int cpu)
398 * For perf, we return last level cache shared map. 413 * For perf, we return last level cache shared map.
399 * And for power savings, we return cpu_core_map 414 * And for power savings, we return cpu_core_map
400 */ 415 */
401 if ((sched_mc_power_savings || sched_smt_power_savings) && 416 if (!(cpu_has(c, X86_FEATURE_AMD_DCM)))
402 !(cpu_has(c, X86_FEATURE_AMD_DCM)))
403 return cpu_core_mask(cpu); 417 return cpu_core_mask(cpu);
404 else 418 else
405 return cpu_llc_shared_mask(cpu); 419 return cpu_llc_shared_mask(cpu);
@@ -618,22 +632,6 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
618 return (send_status | accept_status); 632 return (send_status | accept_status);
619} 633}
620 634
621struct create_idle {
622 struct work_struct work;
623 struct task_struct *idle;
624 struct completion done;
625 int cpu;
626};
627
628static void __cpuinit do_fork_idle(struct work_struct *work)
629{
630 struct create_idle *c_idle =
631 container_of(work, struct create_idle, work);
632
633 c_idle->idle = fork_idle(c_idle->cpu);
634 complete(&c_idle->done);
635}
636
637/* reduce the number of lines printed when booting a large cpu count system */ 635/* reduce the number of lines printed when booting a large cpu count system */
638static void __cpuinit announce_cpu(int cpu, int apicid) 636static void __cpuinit announce_cpu(int cpu, int apicid)
639{ 637{
@@ -660,58 +658,31 @@ static void __cpuinit announce_cpu(int cpu, int apicid)
660 * Returns zero if CPU booted OK, else error code from 658 * Returns zero if CPU booted OK, else error code from
661 * ->wakeup_secondary_cpu. 659 * ->wakeup_secondary_cpu.
662 */ 660 */
663static int __cpuinit do_boot_cpu(int apicid, int cpu) 661static int __cpuinit do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
664{ 662{
665 unsigned long boot_error = 0; 663 unsigned long boot_error = 0;
666 unsigned long start_ip; 664 unsigned long start_ip;
667 int timeout; 665 int timeout;
668 struct create_idle c_idle = {
669 .cpu = cpu,
670 .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done),
671 };
672
673 INIT_WORK_ONSTACK(&c_idle.work, do_fork_idle);
674 666
675 alternatives_smp_switch(1); 667 alternatives_smp_switch(1);
676 668
677 c_idle.idle = get_idle_for_cpu(cpu); 669 idle->thread.sp = (unsigned long) (((struct pt_regs *)
678 670 (THREAD_SIZE + task_stack_page(idle))) - 1);
679 /* 671 per_cpu(current_task, cpu) = idle;
680 * We can't use kernel_thread since we must avoid to
681 * reschedule the child.
682 */
683 if (c_idle.idle) {
684 c_idle.idle->thread.sp = (unsigned long) (((struct pt_regs *)
685 (THREAD_SIZE + task_stack_page(c_idle.idle))) - 1);
686 init_idle(c_idle.idle, cpu);
687 goto do_rest;
688 }
689
690 schedule_work(&c_idle.work);
691 wait_for_completion(&c_idle.done);
692 672
693 if (IS_ERR(c_idle.idle)) {
694 printk("failed fork for CPU %d\n", cpu);
695 destroy_work_on_stack(&c_idle.work);
696 return PTR_ERR(c_idle.idle);
697 }
698
699 set_idle_for_cpu(cpu, c_idle.idle);
700do_rest:
701 per_cpu(current_task, cpu) = c_idle.idle;
702#ifdef CONFIG_X86_32 673#ifdef CONFIG_X86_32
703 /* Stack for startup_32 can be just as for start_secondary onwards */ 674 /* Stack for startup_32 can be just as for start_secondary onwards */
704 irq_ctx_init(cpu); 675 irq_ctx_init(cpu);
705#else 676#else
706 clear_tsk_thread_flag(c_idle.idle, TIF_FORK); 677 clear_tsk_thread_flag(idle, TIF_FORK);
707 initial_gs = per_cpu_offset(cpu); 678 initial_gs = per_cpu_offset(cpu);
708 per_cpu(kernel_stack, cpu) = 679 per_cpu(kernel_stack, cpu) =
709 (unsigned long)task_stack_page(c_idle.idle) - 680 (unsigned long)task_stack_page(idle) -
710 KERNEL_STACK_OFFSET + THREAD_SIZE; 681 KERNEL_STACK_OFFSET + THREAD_SIZE;
711#endif 682#endif
712 early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu); 683 early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu);
713 initial_code = (unsigned long)start_secondary; 684 initial_code = (unsigned long)start_secondary;
714 stack_start = c_idle.idle->thread.sp; 685 stack_start = idle->thread.sp;
715 686
716 /* start_ip had better be page-aligned! */ 687 /* start_ip had better be page-aligned! */
717 start_ip = trampoline_address(); 688 start_ip = trampoline_address();
@@ -813,12 +784,10 @@ do_rest:
813 */ 784 */
814 smpboot_restore_warm_reset_vector(); 785 smpboot_restore_warm_reset_vector();
815 } 786 }
816
817 destroy_work_on_stack(&c_idle.work);
818 return boot_error; 787 return boot_error;
819} 788}
820 789
821int __cpuinit native_cpu_up(unsigned int cpu) 790int __cpuinit native_cpu_up(unsigned int cpu, struct task_struct *tidle)
822{ 791{
823 int apicid = apic->cpu_present_to_apicid(cpu); 792 int apicid = apic->cpu_present_to_apicid(cpu);
824 unsigned long flags; 793 unsigned long flags;
@@ -851,7 +820,7 @@ int __cpuinit native_cpu_up(unsigned int cpu)
851 820
852 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; 821 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
853 822
854 err = do_boot_cpu(apicid, cpu); 823 err = do_boot_cpu(apicid, cpu, tidle);
855 if (err) { 824 if (err) {
856 pr_debug("do_boot_cpu failed %d\n", err); 825 pr_debug("do_boot_cpu failed %d\n", err);
857 return -EIO; 826 return -EIO;
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index ff9281f16029..92d5756d85fc 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -50,6 +50,7 @@
50#include <asm/processor.h> 50#include <asm/processor.h>
51#include <asm/debugreg.h> 51#include <asm/debugreg.h>
52#include <linux/atomic.h> 52#include <linux/atomic.h>
53#include <asm/ftrace.h>
53#include <asm/traps.h> 54#include <asm/traps.h>
54#include <asm/desc.h> 55#include <asm/desc.h>
55#include <asm/i387.h> 56#include <asm/i387.h>
@@ -303,8 +304,13 @@ gp_in_kernel:
303} 304}
304 305
305/* May run on IST stack. */ 306/* May run on IST stack. */
306dotraplinkage void __kprobes do_int3(struct pt_regs *regs, long error_code) 307dotraplinkage void __kprobes notrace do_int3(struct pt_regs *regs, long error_code)
307{ 308{
309#ifdef CONFIG_DYNAMIC_FTRACE
310 /* ftrace must be first, everything else may cause a recursive crash */
311 if (unlikely(modifying_ftrace_code) && ftrace_int3_handler(regs))
312 return;
313#endif
308#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP 314#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
309 if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, 315 if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP,
310 SIGTRAP) == NOTIFY_STOP) 316 SIGTRAP) == NOTIFY_STOP)
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index f386dc49f988..7515cf0e1805 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -216,9 +216,9 @@ bool emulate_vsyscall(struct pt_regs *regs, unsigned long address)
216 current_thread_info()->sig_on_uaccess_error = 1; 216 current_thread_info()->sig_on_uaccess_error = 1;
217 217
218 /* 218 /*
219 * 0 is a valid user pointer (in the access_ok sense) on 32-bit and 219 * NULL is a valid user pointer (in the access_ok sense) on 32-bit and
220 * 64-bit, so we don't need to special-case it here. For all the 220 * 64-bit, so we don't need to special-case it here. For all the
221 * vsyscalls, 0 means "don't write anything" not "write it at 221 * vsyscalls, NULL means "don't write anything" not "write it at
222 * address 0". 222 * address 0".
223 */ 223 */
224 ret = -EFAULT; 224 ret = -EFAULT;
@@ -247,7 +247,7 @@ bool emulate_vsyscall(struct pt_regs *regs, unsigned long address)
247 247
248 ret = sys_getcpu((unsigned __user *)regs->di, 248 ret = sys_getcpu((unsigned __user *)regs->di,
249 (unsigned __user *)regs->si, 249 (unsigned __user *)regs->si,
250 0); 250 NULL);
251 break; 251 break;
252 } 252 }
253 253
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index e9f265fd79ae..35c5e543f550 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -18,6 +18,7 @@
18#include <asm/e820.h> 18#include <asm/e820.h>
19#include <asm/time.h> 19#include <asm/time.h>
20#include <asm/irq.h> 20#include <asm/irq.h>
21#include <asm/io_apic.h>
21#include <asm/pat.h> 22#include <asm/pat.h>
22#include <asm/tsc.h> 23#include <asm/tsc.h>
23#include <asm/iommu.h> 24#include <asm/iommu.h>
@@ -93,7 +94,6 @@ struct x86_init_ops x86_init __initdata = {
93struct x86_cpuinit_ops x86_cpuinit __cpuinitdata = { 94struct x86_cpuinit_ops x86_cpuinit __cpuinitdata = {
94 .early_percpu_clock_init = x86_init_noop, 95 .early_percpu_clock_init = x86_init_noop,
95 .setup_percpu_clockev = setup_secondary_APIC_clock, 96 .setup_percpu_clockev = setup_secondary_APIC_clock,
96 .fixup_cpu_id = x86_default_fixup_cpu_id,
97}; 97};
98 98
99static void default_nmi_init(void) { }; 99static void default_nmi_init(void) { };
@@ -120,3 +120,10 @@ struct x86_msi_ops x86_msi = {
120 .teardown_msi_irqs = default_teardown_msi_irqs, 120 .teardown_msi_irqs = default_teardown_msi_irqs,
121 .restore_msi_irqs = default_restore_msi_irqs, 121 .restore_msi_irqs = default_restore_msi_irqs,
122}; 122};
123
124struct x86_io_apic_ops x86_io_apic_ops = {
125 .init = native_io_apic_init_mappings,
126 .read = native_io_apic_read,
127 .write = native_io_apic_write,
128 .modify = native_io_apic_modify,
129};
diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c
index 173df38dbda5..2e88438ffd83 100644
--- a/arch/x86/kvm/pmu.c
+++ b/arch/x86/kvm/pmu.c
@@ -459,17 +459,17 @@ void kvm_pmu_cpuid_update(struct kvm_vcpu *vcpu)
459 pmu->available_event_types = ~entry->ebx & ((1ull << bitmap_len) - 1); 459 pmu->available_event_types = ~entry->ebx & ((1ull << bitmap_len) - 1);
460 460
461 if (pmu->version == 1) { 461 if (pmu->version == 1) {
462 pmu->global_ctrl = (1 << pmu->nr_arch_gp_counters) - 1; 462 pmu->nr_arch_fixed_counters = 0;
463 return; 463 } else {
464 pmu->nr_arch_fixed_counters = min((int)(entry->edx & 0x1f),
465 X86_PMC_MAX_FIXED);
466 pmu->counter_bitmask[KVM_PMC_FIXED] =
467 ((u64)1 << ((entry->edx >> 5) & 0xff)) - 1;
464 } 468 }
465 469
466 pmu->nr_arch_fixed_counters = min((int)(entry->edx & 0x1f), 470 pmu->global_ctrl = ((1 << pmu->nr_arch_gp_counters) - 1) |
467 X86_PMC_MAX_FIXED); 471 (((1ull << pmu->nr_arch_fixed_counters) - 1) << X86_PMC_IDX_FIXED);
468 pmu->counter_bitmask[KVM_PMC_FIXED] = 472 pmu->global_ctrl_mask = ~pmu->global_ctrl;
469 ((u64)1 << ((entry->edx >> 5) & 0xff)) - 1;
470 pmu->global_ctrl_mask = ~(((1 << pmu->nr_arch_gp_counters) - 1)
471 | (((1ull << pmu->nr_arch_fixed_counters) - 1)
472 << X86_PMC_IDX_FIXED));
473} 473}
474 474
475void kvm_pmu_init(struct kvm_vcpu *vcpu) 475void kvm_pmu_init(struct kvm_vcpu *vcpu)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index ad85adfef843..4ff0ab9bc3c8 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2210,9 +2210,12 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
2210 msr = find_msr_entry(vmx, msr_index); 2210 msr = find_msr_entry(vmx, msr_index);
2211 if (msr) { 2211 if (msr) {
2212 msr->data = data; 2212 msr->data = data;
2213 if (msr - vmx->guest_msrs < vmx->save_nmsrs) 2213 if (msr - vmx->guest_msrs < vmx->save_nmsrs) {
2214 preempt_disable();
2214 kvm_set_shared_msr(msr->index, msr->data, 2215 kvm_set_shared_msr(msr->index, msr->data,
2215 msr->mask); 2216 msr->mask);
2217 preempt_enable();
2218 }
2216 break; 2219 break;
2217 } 2220 }
2218 ret = kvm_set_msr_common(vcpu, msr_index, data); 2221 ret = kvm_set_msr_common(vcpu, msr_index, data);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 4044ce0bf7c1..185a2b823a2d 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6336,13 +6336,11 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
6336 if (npages && !old.rmap) { 6336 if (npages && !old.rmap) {
6337 unsigned long userspace_addr; 6337 unsigned long userspace_addr;
6338 6338
6339 down_write(&current->mm->mmap_sem); 6339 userspace_addr = vm_mmap(NULL, 0,
6340 userspace_addr = do_mmap(NULL, 0,
6341 npages * PAGE_SIZE, 6340 npages * PAGE_SIZE,
6342 PROT_READ | PROT_WRITE, 6341 PROT_READ | PROT_WRITE,
6343 map_flags, 6342 map_flags,
6344 0); 6343 0);
6345 up_write(&current->mm->mmap_sem);
6346 6344
6347 if (IS_ERR((void *)userspace_addr)) 6345 if (IS_ERR((void *)userspace_addr))
6348 return PTR_ERR((void *)userspace_addr); 6346 return PTR_ERR((void *)userspace_addr);
@@ -6366,10 +6364,8 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
6366 if (!user_alloc && !old.user_alloc && old.rmap && !npages) { 6364 if (!user_alloc && !old.user_alloc && old.rmap && !npages) {
6367 int ret; 6365 int ret;
6368 6366
6369 down_write(&current->mm->mmap_sem); 6367 ret = vm_munmap(old.userspace_addr,
6370 ret = do_munmap(current->mm, old.userspace_addr,
6371 old.npages * PAGE_SIZE); 6368 old.npages * PAGE_SIZE);
6372 up_write(&current->mm->mmap_sem);
6373 if (ret < 0) 6369 if (ret < 0)
6374 printk(KERN_WARNING 6370 printk(KERN_WARNING
6375 "kvm_vm_ioctl_set_memory_region: " 6371 "kvm_vm_ioctl_set_memory_region: "
@@ -6585,6 +6581,7 @@ void kvm_arch_async_page_present(struct kvm_vcpu *vcpu,
6585 kvm_inject_page_fault(vcpu, &fault); 6581 kvm_inject_page_fault(vcpu, &fault);
6586 } 6582 }
6587 vcpu->arch.apf.halted = false; 6583 vcpu->arch.apf.halted = false;
6584 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
6588} 6585}
6589 6586
6590bool kvm_arch_can_inject_async_page_present(struct kvm_vcpu *vcpu) 6587bool kvm_arch_can_inject_async_page_present(struct kvm_vcpu *vcpu)
diff --git a/arch/x86/lib/insn.c b/arch/x86/lib/insn.c
index 25feb1ae71c5..b1e6c4b2e8eb 100644
--- a/arch/x86/lib/insn.c
+++ b/arch/x86/lib/insn.c
@@ -379,8 +379,8 @@ err_out:
379 return; 379 return;
380} 380}
381 381
382/* Decode moffset16/32/64 */ 382/* Decode moffset16/32/64. Return 0 if failed */
383static void __get_moffset(struct insn *insn) 383static int __get_moffset(struct insn *insn)
384{ 384{
385 switch (insn->addr_bytes) { 385 switch (insn->addr_bytes) {
386 case 2: 386 case 2:
@@ -397,15 +397,19 @@ static void __get_moffset(struct insn *insn)
397 insn->moffset2.value = get_next(int, insn); 397 insn->moffset2.value = get_next(int, insn);
398 insn->moffset2.nbytes = 4; 398 insn->moffset2.nbytes = 4;
399 break; 399 break;
400 default: /* opnd_bytes must be modified manually */
401 goto err_out;
400 } 402 }
401 insn->moffset1.got = insn->moffset2.got = 1; 403 insn->moffset1.got = insn->moffset2.got = 1;
402 404
405 return 1;
406
403err_out: 407err_out:
404 return; 408 return 0;
405} 409}
406 410
407/* Decode imm v32(Iz) */ 411/* Decode imm v32(Iz). Return 0 if failed */
408static void __get_immv32(struct insn *insn) 412static int __get_immv32(struct insn *insn)
409{ 413{
410 switch (insn->opnd_bytes) { 414 switch (insn->opnd_bytes) {
411 case 2: 415 case 2:
@@ -417,14 +421,18 @@ static void __get_immv32(struct insn *insn)
417 insn->immediate.value = get_next(int, insn); 421 insn->immediate.value = get_next(int, insn);
418 insn->immediate.nbytes = 4; 422 insn->immediate.nbytes = 4;
419 break; 423 break;
424 default: /* opnd_bytes must be modified manually */
425 goto err_out;
420 } 426 }
421 427
428 return 1;
429
422err_out: 430err_out:
423 return; 431 return 0;
424} 432}
425 433
426/* Decode imm v64(Iv/Ov) */ 434/* Decode imm v64(Iv/Ov), Return 0 if failed */
427static void __get_immv(struct insn *insn) 435static int __get_immv(struct insn *insn)
428{ 436{
429 switch (insn->opnd_bytes) { 437 switch (insn->opnd_bytes) {
430 case 2: 438 case 2:
@@ -441,15 +449,18 @@ static void __get_immv(struct insn *insn)
441 insn->immediate2.value = get_next(int, insn); 449 insn->immediate2.value = get_next(int, insn);
442 insn->immediate2.nbytes = 4; 450 insn->immediate2.nbytes = 4;
443 break; 451 break;
452 default: /* opnd_bytes must be modified manually */
453 goto err_out;
444 } 454 }
445 insn->immediate1.got = insn->immediate2.got = 1; 455 insn->immediate1.got = insn->immediate2.got = 1;
446 456
457 return 1;
447err_out: 458err_out:
448 return; 459 return 0;
449} 460}
450 461
451/* Decode ptr16:16/32(Ap) */ 462/* Decode ptr16:16/32(Ap) */
452static void __get_immptr(struct insn *insn) 463static int __get_immptr(struct insn *insn)
453{ 464{
454 switch (insn->opnd_bytes) { 465 switch (insn->opnd_bytes) {
455 case 2: 466 case 2:
@@ -462,14 +473,17 @@ static void __get_immptr(struct insn *insn)
462 break; 473 break;
463 case 8: 474 case 8:
464 /* ptr16:64 is not exist (no segment) */ 475 /* ptr16:64 is not exist (no segment) */
465 return; 476 return 0;
477 default: /* opnd_bytes must be modified manually */
478 goto err_out;
466 } 479 }
467 insn->immediate2.value = get_next(unsigned short, insn); 480 insn->immediate2.value = get_next(unsigned short, insn);
468 insn->immediate2.nbytes = 2; 481 insn->immediate2.nbytes = 2;
469 insn->immediate1.got = insn->immediate2.got = 1; 482 insn->immediate1.got = insn->immediate2.got = 1;
470 483
484 return 1;
471err_out: 485err_out:
472 return; 486 return 0;
473} 487}
474 488
475/** 489/**
@@ -489,7 +503,8 @@ void insn_get_immediate(struct insn *insn)
489 insn_get_displacement(insn); 503 insn_get_displacement(insn);
490 504
491 if (inat_has_moffset(insn->attr)) { 505 if (inat_has_moffset(insn->attr)) {
492 __get_moffset(insn); 506 if (!__get_moffset(insn))
507 goto err_out;
493 goto done; 508 goto done;
494 } 509 }
495 510
@@ -517,16 +532,20 @@ void insn_get_immediate(struct insn *insn)
517 insn->immediate2.nbytes = 4; 532 insn->immediate2.nbytes = 4;
518 break; 533 break;
519 case INAT_IMM_PTR: 534 case INAT_IMM_PTR:
520 __get_immptr(insn); 535 if (!__get_immptr(insn))
536 goto err_out;
521 break; 537 break;
522 case INAT_IMM_VWORD32: 538 case INAT_IMM_VWORD32:
523 __get_immv32(insn); 539 if (!__get_immv32(insn))
540 goto err_out;
524 break; 541 break;
525 case INAT_IMM_VWORD: 542 case INAT_IMM_VWORD:
526 __get_immv(insn); 543 if (!__get_immv(insn))
544 goto err_out;
527 break; 545 break;
528 default: 546 default:
529 break; 547 /* Here, insn must have an immediate, but failed */
548 goto err_out;
530 } 549 }
531 if (inat_has_second_immediate(insn->attr)) { 550 if (inat_has_second_immediate(insn->attr)) {
532 insn->immediate2.value = get_next(char, insn); 551 insn->immediate2.value = get_next(char, insn);
diff --git a/arch/x86/lib/usercopy.c b/arch/x86/lib/usercopy.c
index 97be9cb54483..2e4e4b02c37a 100644
--- a/arch/x86/lib/usercopy.c
+++ b/arch/x86/lib/usercopy.c
@@ -7,6 +7,8 @@
7#include <linux/highmem.h> 7#include <linux/highmem.h>
8#include <linux/module.h> 8#include <linux/module.h>
9 9
10#include <asm/word-at-a-time.h>
11
10/* 12/*
11 * best effort, GUP based copy_from_user() that is NMI-safe 13 * best effort, GUP based copy_from_user() that is NMI-safe
12 */ 14 */
@@ -41,3 +43,100 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
41 return len; 43 return len;
42} 44}
43EXPORT_SYMBOL_GPL(copy_from_user_nmi); 45EXPORT_SYMBOL_GPL(copy_from_user_nmi);
46
47/*
48 * Do a strncpy, return length of string without final '\0'.
49 * 'count' is the user-supplied count (return 'count' if we
50 * hit it), 'max' is the address space maximum (and we return
51 * -EFAULT if we hit it).
52 */
53static inline long do_strncpy_from_user(char *dst, const char __user *src, long count, unsigned long max)
54{
55 long res = 0;
56
57 /*
58 * Truncate 'max' to the user-specified limit, so that
59 * we only have one limit we need to check in the loop
60 */
61 if (max > count)
62 max = count;
63
64 while (max >= sizeof(unsigned long)) {
65 unsigned long c, mask;
66
67 /* Fall back to byte-at-a-time if we get a page fault */
68 if (unlikely(__get_user(c,(unsigned long __user *)(src+res))))
69 break;
70 mask = has_zero(c);
71 if (mask) {
72 mask = (mask - 1) & ~mask;
73 mask >>= 7;
74 *(unsigned long *)(dst+res) = c & mask;
75 return res + count_masked_bytes(mask);
76 }
77 *(unsigned long *)(dst+res) = c;
78 res += sizeof(unsigned long);
79 max -= sizeof(unsigned long);
80 }
81
82 while (max) {
83 char c;
84
85 if (unlikely(__get_user(c,src+res)))
86 return -EFAULT;
87 dst[res] = c;
88 if (!c)
89 return res;
90 res++;
91 max--;
92 }
93
94 /*
95 * Uhhuh. We hit 'max'. But was that the user-specified maximum
96 * too? If so, that's ok - we got as much as the user asked for.
97 */
98 if (res >= count)
99 return res;
100
101 /*
102 * Nope: we hit the address space limit, and we still had more
103 * characters the caller would have wanted. That's an EFAULT.
104 */
105 return -EFAULT;
106}
107
108/**
109 * strncpy_from_user: - Copy a NUL terminated string from userspace.
110 * @dst: Destination address, in kernel space. This buffer must be at
111 * least @count bytes long.
112 * @src: Source address, in user space.
113 * @count: Maximum number of bytes to copy, including the trailing NUL.
114 *
115 * Copies a NUL-terminated string from userspace to kernel space.
116 *
117 * On success, returns the length of the string (not including the trailing
118 * NUL).
119 *
120 * If access to userspace fails, returns -EFAULT (some data may have been
121 * copied).
122 *
123 * If @count is smaller than the length of the string, copies @count bytes
124 * and returns @count.
125 */
126long
127strncpy_from_user(char *dst, const char __user *src, long count)
128{
129 unsigned long max_addr, src_addr;
130
131 if (unlikely(count <= 0))
132 return 0;
133
134 max_addr = current_thread_info()->addr_limit.seg;
135 src_addr = (unsigned long)src;
136 if (likely(src_addr < max_addr)) {
137 unsigned long max = max_addr - src_addr;
138 return do_strncpy_from_user(dst, src, count, max);
139 }
140 return -EFAULT;
141}
142EXPORT_SYMBOL(strncpy_from_user);
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c
index d9b094ca7aaa..ef2a6a5d78e3 100644
--- a/arch/x86/lib/usercopy_32.c
+++ b/arch/x86/lib/usercopy_32.c
@@ -33,93 +33,6 @@ static inline int __movsl_is_ok(unsigned long a1, unsigned long a2, unsigned lon
33 __movsl_is_ok((unsigned long)(a1), (unsigned long)(a2), (n)) 33 __movsl_is_ok((unsigned long)(a1), (unsigned long)(a2), (n))
34 34
35/* 35/*
36 * Copy a null terminated string from userspace.
37 */
38
39#define __do_strncpy_from_user(dst, src, count, res) \
40do { \
41 int __d0, __d1, __d2; \
42 might_fault(); \
43 __asm__ __volatile__( \
44 " testl %1,%1\n" \
45 " jz 2f\n" \
46 "0: lodsb\n" \
47 " stosb\n" \
48 " testb %%al,%%al\n" \
49 " jz 1f\n" \
50 " decl %1\n" \
51 " jnz 0b\n" \
52 "1: subl %1,%0\n" \
53 "2:\n" \
54 ".section .fixup,\"ax\"\n" \
55 "3: movl %5,%0\n" \
56 " jmp 2b\n" \
57 ".previous\n" \
58 _ASM_EXTABLE(0b,3b) \
59 : "=&d"(res), "=&c"(count), "=&a" (__d0), "=&S" (__d1), \
60 "=&D" (__d2) \
61 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \
62 : "memory"); \
63} while (0)
64
65/**
66 * __strncpy_from_user: - Copy a NUL terminated string from userspace, with less checking.
67 * @dst: Destination address, in kernel space. This buffer must be at
68 * least @count bytes long.
69 * @src: Source address, in user space.
70 * @count: Maximum number of bytes to copy, including the trailing NUL.
71 *
72 * Copies a NUL-terminated string from userspace to kernel space.
73 * Caller must check the specified block with access_ok() before calling
74 * this function.
75 *
76 * On success, returns the length of the string (not including the trailing
77 * NUL).
78 *
79 * If access to userspace fails, returns -EFAULT (some data may have been
80 * copied).
81 *
82 * If @count is smaller than the length of the string, copies @count bytes
83 * and returns @count.
84 */
85long
86__strncpy_from_user(char *dst, const char __user *src, long count)
87{
88 long res;
89 __do_strncpy_from_user(dst, src, count, res);
90 return res;
91}
92EXPORT_SYMBOL(__strncpy_from_user);
93
94/**
95 * strncpy_from_user: - Copy a NUL terminated string from userspace.
96 * @dst: Destination address, in kernel space. This buffer must be at
97 * least @count bytes long.
98 * @src: Source address, in user space.
99 * @count: Maximum number of bytes to copy, including the trailing NUL.
100 *
101 * Copies a NUL-terminated string from userspace to kernel space.
102 *
103 * On success, returns the length of the string (not including the trailing
104 * NUL).
105 *
106 * If access to userspace fails, returns -EFAULT (some data may have been
107 * copied).
108 *
109 * If @count is smaller than the length of the string, copies @count bytes
110 * and returns @count.
111 */
112long
113strncpy_from_user(char *dst, const char __user *src, long count)
114{
115 long res = -EFAULT;
116 if (access_ok(VERIFY_READ, src, 1))
117 __do_strncpy_from_user(dst, src, count, res);
118 return res;
119}
120EXPORT_SYMBOL(strncpy_from_user);
121
122/*
123 * Zero Userspace 36 * Zero Userspace
124 */ 37 */
125 38
diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
index b7c2849ffb66..0d0326f388c0 100644
--- a/arch/x86/lib/usercopy_64.c
+++ b/arch/x86/lib/usercopy_64.c
@@ -9,55 +9,6 @@
9#include <asm/uaccess.h> 9#include <asm/uaccess.h>
10 10
11/* 11/*
12 * Copy a null terminated string from userspace.
13 */
14
15#define __do_strncpy_from_user(dst,src,count,res) \
16do { \
17 long __d0, __d1, __d2; \
18 might_fault(); \
19 __asm__ __volatile__( \
20 " testq %1,%1\n" \
21 " jz 2f\n" \
22 "0: lodsb\n" \
23 " stosb\n" \
24 " testb %%al,%%al\n" \
25 " jz 1f\n" \
26 " decq %1\n" \
27 " jnz 0b\n" \
28 "1: subq %1,%0\n" \
29 "2:\n" \
30 ".section .fixup,\"ax\"\n" \
31 "3: movq %5,%0\n" \
32 " jmp 2b\n" \
33 ".previous\n" \
34 _ASM_EXTABLE(0b,3b) \
35 : "=&r"(res), "=&c"(count), "=&a" (__d0), "=&S" (__d1), \
36 "=&D" (__d2) \
37 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \
38 : "memory"); \
39} while (0)
40
41long
42__strncpy_from_user(char *dst, const char __user *src, long count)
43{
44 long res;
45 __do_strncpy_from_user(dst, src, count, res);
46 return res;
47}
48EXPORT_SYMBOL(__strncpy_from_user);
49
50long
51strncpy_from_user(char *dst, const char __user *src, long count)
52{
53 long res = -EFAULT;
54 if (access_ok(VERIFY_READ, src, 1))
55 return __strncpy_from_user(dst, src, count);
56 return res;
57}
58EXPORT_SYMBOL(strncpy_from_user);
59
60/*
61 * Zero Userspace 12 * Zero Userspace
62 */ 13 */
63 14
diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c
index 53489ff6bf82..871dd8868170 100644
--- a/arch/x86/mm/numa_emulation.c
+++ b/arch/x86/mm/numa_emulation.c
@@ -339,9 +339,11 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
339 } else { 339 } else {
340 unsigned long n; 340 unsigned long n;
341 341
342 n = simple_strtoul(emu_cmdline, NULL, 0); 342 n = simple_strtoul(emu_cmdline, &emu_cmdline, 0);
343 ret = split_nodes_interleave(&ei, &pi, 0, max_addr, n); 343 ret = split_nodes_interleave(&ei, &pi, 0, max_addr, n);
344 } 344 }
345 if (*emu_cmdline == ':')
346 emu_cmdline++;
345 347
346 if (ret < 0) 348 if (ret < 0)
347 goto no_emu; 349 goto no_emu;
@@ -418,7 +420,9 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
418 int physj = emu_nid_to_phys[j]; 420 int physj = emu_nid_to_phys[j];
419 int dist; 421 int dist;
420 422
421 if (physi >= numa_dist_cnt || physj >= numa_dist_cnt) 423 if (get_option(&emu_cmdline, &dist) == 2)
424 ;
425 else if (physi >= numa_dist_cnt || physj >= numa_dist_cnt)
422 dist = physi == physj ? 426 dist = physi == physj ?
423 LOCAL_DISTANCE : REMOTE_DISTANCE; 427 LOCAL_DISTANCE : REMOTE_DISTANCE;
424 else 428 else
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index d6c0418c3e47..3804471db104 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -61,10 +61,10 @@ static DEFINE_PER_CPU_READ_MOSTLY(int, tlb_vector_offset);
61 */ 61 */
62void leave_mm(int cpu) 62void leave_mm(int cpu)
63{ 63{
64 if (percpu_read(cpu_tlbstate.state) == TLBSTATE_OK) 64 if (this_cpu_read(cpu_tlbstate.state) == TLBSTATE_OK)
65 BUG(); 65 BUG();
66 cpumask_clear_cpu(cpu, 66 cpumask_clear_cpu(cpu,
67 mm_cpumask(percpu_read(cpu_tlbstate.active_mm))); 67 mm_cpumask(this_cpu_read(cpu_tlbstate.active_mm)));
68 load_cr3(swapper_pg_dir); 68 load_cr3(swapper_pg_dir);
69} 69}
70EXPORT_SYMBOL_GPL(leave_mm); 70EXPORT_SYMBOL_GPL(leave_mm);
@@ -152,8 +152,8 @@ void smp_invalidate_interrupt(struct pt_regs *regs)
152 * BUG(); 152 * BUG();
153 */ 153 */
154 154
155 if (f->flush_mm == percpu_read(cpu_tlbstate.active_mm)) { 155 if (f->flush_mm == this_cpu_read(cpu_tlbstate.active_mm)) {
156 if (percpu_read(cpu_tlbstate.state) == TLBSTATE_OK) { 156 if (this_cpu_read(cpu_tlbstate.state) == TLBSTATE_OK) {
157 if (f->flush_va == TLB_FLUSH_ALL) 157 if (f->flush_va == TLB_FLUSH_ALL)
158 local_flush_tlb(); 158 local_flush_tlb();
159 else 159 else
@@ -322,7 +322,7 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long va)
322static void do_flush_tlb_all(void *info) 322static void do_flush_tlb_all(void *info)
323{ 323{
324 __flush_tlb_all(); 324 __flush_tlb_all();
325 if (percpu_read(cpu_tlbstate.state) == TLBSTATE_LAZY) 325 if (this_cpu_read(cpu_tlbstate.state) == TLBSTATE_LAZY)
326 leave_mm(smp_processor_id()); 326 leave_mm(smp_processor_id());
327} 327}
328 328
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index ed2835e148b5..fc09c2754e08 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -9,11 +9,11 @@
9 9
10struct pci_root_info { 10struct pci_root_info {
11 struct acpi_device *bridge; 11 struct acpi_device *bridge;
12 char *name; 12 char name[16];
13 unsigned int res_num; 13 unsigned int res_num;
14 struct resource *res; 14 struct resource *res;
15 struct list_head *resources;
16 int busnum; 15 int busnum;
16 struct pci_sysdata sd;
17}; 17};
18 18
19static bool pci_use_crs = true; 19static bool pci_use_crs = true;
@@ -245,13 +245,6 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
245 return AE_OK; 245 return AE_OK;
246} 246}
247 247
248static bool resource_contains(struct resource *res, resource_size_t point)
249{
250 if (res->start <= point && point <= res->end)
251 return true;
252 return false;
253}
254
255static void coalesce_windows(struct pci_root_info *info, unsigned long type) 248static void coalesce_windows(struct pci_root_info *info, unsigned long type)
256{ 249{
257 int i, j; 250 int i, j;
@@ -272,10 +265,7 @@ static void coalesce_windows(struct pci_root_info *info, unsigned long type)
272 * our resources no longer match the ACPI _CRS, but 265 * our resources no longer match the ACPI _CRS, but
273 * the kernel resource tree doesn't allow overlaps. 266 * the kernel resource tree doesn't allow overlaps.
274 */ 267 */
275 if (resource_contains(res1, res2->start) || 268 if (resource_overlaps(res1, res2)) {
276 resource_contains(res1, res2->end) ||
277 resource_contains(res2, res1->start) ||
278 resource_contains(res2, res1->end)) {
279 res1->start = min(res1->start, res2->start); 269 res1->start = min(res1->start, res2->start);
280 res1->end = max(res1->end, res2->end); 270 res1->end = max(res1->end, res2->end);
281 dev_info(&info->bridge->dev, 271 dev_info(&info->bridge->dev,
@@ -287,7 +277,8 @@ static void coalesce_windows(struct pci_root_info *info, unsigned long type)
287 } 277 }
288} 278}
289 279
290static void add_resources(struct pci_root_info *info) 280static void add_resources(struct pci_root_info *info,
281 struct list_head *resources)
291{ 282{
292 int i; 283 int i;
293 struct resource *res, *root, *conflict; 284 struct resource *res, *root, *conflict;
@@ -311,53 +302,74 @@ static void add_resources(struct pci_root_info *info)
311 "ignoring host bridge window %pR (conflicts with %s %pR)\n", 302 "ignoring host bridge window %pR (conflicts with %s %pR)\n",
312 res, conflict->name, conflict); 303 res, conflict->name, conflict);
313 else 304 else
314 pci_add_resource(info->resources, res); 305 pci_add_resource(resources, res);
315 } 306 }
316} 307}
317 308
309static void free_pci_root_info_res(struct pci_root_info *info)
310{
311 kfree(info->res);
312 info->res = NULL;
313 info->res_num = 0;
314}
315
316static void __release_pci_root_info(struct pci_root_info *info)
317{
318 int i;
319 struct resource *res;
320
321 for (i = 0; i < info->res_num; i++) {
322 res = &info->res[i];
323
324 if (!res->parent)
325 continue;
326
327 if (!(res->flags & (IORESOURCE_MEM | IORESOURCE_IO)))
328 continue;
329
330 release_resource(res);
331 }
332
333 free_pci_root_info_res(info);
334
335 kfree(info);
336}
337static void release_pci_root_info(struct pci_host_bridge *bridge)
338{
339 struct pci_root_info *info = bridge->release_data;
340
341 __release_pci_root_info(info);
342}
343
318static void 344static void
319get_current_resources(struct acpi_device *device, int busnum, 345probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device,
320 int domain, struct list_head *resources) 346 int busnum, int domain)
321{ 347{
322 struct pci_root_info info;
323 size_t size; 348 size_t size;
324 349
325 info.bridge = device; 350 info->bridge = device;
326 info.res_num = 0; 351 info->res_num = 0;
327 info.resources = resources;
328 acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_resource, 352 acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_resource,
329 &info); 353 info);
330 if (!info.res_num) 354 if (!info->res_num)
331 return; 355 return;
332 356
333 size = sizeof(*info.res) * info.res_num; 357 size = sizeof(*info->res) * info->res_num;
334 info.res = kmalloc(size, GFP_KERNEL); 358 info->res_num = 0;
335 if (!info.res) 359 info->res = kmalloc(size, GFP_KERNEL);
360 if (!info->res)
336 return; 361 return;
337 362
338 info.name = kasprintf(GFP_KERNEL, "PCI Bus %04x:%02x", domain, busnum); 363 sprintf(info->name, "PCI Bus %04x:%02x", domain, busnum);
339 if (!info.name)
340 goto name_alloc_fail;
341 364
342 info.res_num = 0;
343 acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource, 365 acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource,
344 &info); 366 info);
345
346 if (pci_use_crs) {
347 add_resources(&info);
348
349 return;
350 }
351
352 kfree(info.name);
353
354name_alloc_fail:
355 kfree(info.res);
356} 367}
357 368
358struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root) 369struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root)
359{ 370{
360 struct acpi_device *device = root->device; 371 struct acpi_device *device = root->device;
372 struct pci_root_info *info = NULL;
361 int domain = root->segment; 373 int domain = root->segment;
362 int busnum = root->secondary.start; 374 int busnum = root->secondary.start;
363 LIST_HEAD(resources); 375 LIST_HEAD(resources);
@@ -389,17 +401,14 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root)
389 if (node != -1 && !node_online(node)) 401 if (node != -1 && !node_online(node))
390 node = -1; 402 node = -1;
391 403
392 /* Allocate per-root-bus (not per bus) arch-specific data. 404 info = kzalloc(sizeof(*info), GFP_KERNEL);
393 * TODO: leak; this memory is never freed. 405 if (!info) {
394 * It's arguable whether it's worth the trouble to care.
395 */
396 sd = kzalloc(sizeof(*sd), GFP_KERNEL);
397 if (!sd) {
398 printk(KERN_WARNING "pci_bus %04x:%02x: " 406 printk(KERN_WARNING "pci_bus %04x:%02x: "
399 "ignored (out of memory)\n", domain, busnum); 407 "ignored (out of memory)\n", domain, busnum);
400 return NULL; 408 return NULL;
401 } 409 }
402 410
411 sd = &info->sd;
403 sd->domain = domain; 412 sd->domain = domain;
404 sd->node = node; 413 sd->node = node;
405 /* 414 /*
@@ -413,22 +422,32 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root)
413 * be replaced by sd. 422 * be replaced by sd.
414 */ 423 */
415 memcpy(bus->sysdata, sd, sizeof(*sd)); 424 memcpy(bus->sysdata, sd, sizeof(*sd));
416 kfree(sd); 425 kfree(info);
417 } else { 426 } else {
418 get_current_resources(device, busnum, domain, &resources); 427 probe_pci_root_info(info, device, busnum, domain);
419 428
420 /* 429 /*
421 * _CRS with no apertures is normal, so only fall back to 430 * _CRS with no apertures is normal, so only fall back to
422 * defaults or native bridge info if we're ignoring _CRS. 431 * defaults or native bridge info if we're ignoring _CRS.
423 */ 432 */
424 if (!pci_use_crs) 433 if (pci_use_crs)
434 add_resources(info, &resources);
435 else {
436 free_pci_root_info_res(info);
425 x86_pci_root_bus_resources(busnum, &resources); 437 x86_pci_root_bus_resources(busnum, &resources);
438 }
439
426 bus = pci_create_root_bus(NULL, busnum, &pci_root_ops, sd, 440 bus = pci_create_root_bus(NULL, busnum, &pci_root_ops, sd,
427 &resources); 441 &resources);
428 if (bus) 442 if (bus) {
429 bus->subordinate = pci_scan_child_bus(bus); 443 bus->subordinate = pci_scan_child_bus(bus);
430 else 444 pci_set_host_bridge_release(
445 to_pci_host_bridge(bus->bridge),
446 release_pci_root_info, info);
447 } else {
431 pci_free_resource_list(&resources); 448 pci_free_resource_list(&resources);
449 __release_pci_root_info(info);
450 }
432 } 451 }
433 452
434 /* After the PCI-E bus has been walked and all devices discovered, 453 /* After the PCI-E bus has been walked and all devices discovered,
@@ -445,9 +464,6 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root)
445 } 464 }
446 } 465 }
447 466
448 if (!bus)
449 kfree(sd);
450
451 if (bus && node != -1) { 467 if (bus && node != -1) {
452#ifdef CONFIG_ACPI_NUMA 468#ifdef CONFIG_ACPI_NUMA
453 if (pxm >= 0) 469 if (pxm >= 0)
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
index 0567df3890e1..5aed49bff058 100644
--- a/arch/x86/pci/amd_bus.c
+++ b/arch/x86/pci/amd_bus.c
@@ -32,6 +32,27 @@ static struct pci_hostbridge_probe pci_probes[] __initdata = {
32 32
33#define RANGE_NUM 16 33#define RANGE_NUM 16
34 34
35static struct pci_root_info __init *find_pci_root_info(int node, int link)
36{
37 struct pci_root_info *info;
38
39 /* find the position */
40 list_for_each_entry(info, &pci_root_infos, list)
41 if (info->node == node && info->link == link)
42 return info;
43
44 return NULL;
45}
46
47static void __init set_mp_bus_range_to_node(int min_bus, int max_bus, int node)
48{
49#ifdef CONFIG_NUMA
50 int j;
51
52 for (j = min_bus; j <= max_bus; j++)
53 set_mp_bus_to_node(j, node);
54#endif
55}
35/** 56/**
36 * early_fill_mp_bus_to_node() 57 * early_fill_mp_bus_to_node()
37 * called before pcibios_scan_root and pci_scan_bus 58 * called before pcibios_scan_root and pci_scan_bus
@@ -41,7 +62,6 @@ static struct pci_hostbridge_probe pci_probes[] __initdata = {
41static int __init early_fill_mp_bus_info(void) 62static int __init early_fill_mp_bus_info(void)
42{ 63{
43 int i; 64 int i;
44 int j;
45 unsigned bus; 65 unsigned bus;
46 unsigned slot; 66 unsigned slot;
47 int node; 67 int node;
@@ -50,7 +70,6 @@ static int __init early_fill_mp_bus_info(void)
50 int def_link; 70 int def_link;
51 struct pci_root_info *info; 71 struct pci_root_info *info;
52 u32 reg; 72 u32 reg;
53 struct resource *res;
54 u64 start; 73 u64 start;
55 u64 end; 74 u64 end;
56 struct range range[RANGE_NUM]; 75 struct range range[RANGE_NUM];
@@ -86,7 +105,6 @@ static int __init early_fill_mp_bus_info(void)
86 if (!found) 105 if (!found)
87 return 0; 106 return 0;
88 107
89 pci_root_num = 0;
90 for (i = 0; i < 4; i++) { 108 for (i = 0; i < 4; i++) {
91 int min_bus; 109 int min_bus;
92 int max_bus; 110 int max_bus;
@@ -99,19 +117,11 @@ static int __init early_fill_mp_bus_info(void)
99 min_bus = (reg >> 16) & 0xff; 117 min_bus = (reg >> 16) & 0xff;
100 max_bus = (reg >> 24) & 0xff; 118 max_bus = (reg >> 24) & 0xff;
101 node = (reg >> 4) & 0x07; 119 node = (reg >> 4) & 0x07;
102#ifdef CONFIG_NUMA 120 set_mp_bus_range_to_node(min_bus, max_bus, node);
103 for (j = min_bus; j <= max_bus; j++)
104 set_mp_bus_to_node(j, node);
105#endif
106 link = (reg >> 8) & 0x03; 121 link = (reg >> 8) & 0x03;
107 122
108 info = &pci_root_info[pci_root_num]; 123 info = alloc_pci_root_info(min_bus, max_bus, node, link);
109 info->bus_min = min_bus;
110 info->bus_max = max_bus;
111 info->node = node;
112 info->link = link;
113 sprintf(info->name, "PCI Bus #%02x", min_bus); 124 sprintf(info->name, "PCI Bus #%02x", min_bus);
114 pci_root_num++;
115 } 125 }
116 126
117 /* get the default node and link for left over res */ 127 /* get the default node and link for left over res */
@@ -134,16 +144,10 @@ static int __init early_fill_mp_bus_info(void)
134 link = (reg >> 4) & 0x03; 144 link = (reg >> 4) & 0x03;
135 end = (reg & 0xfff000) | 0xfff; 145 end = (reg & 0xfff000) | 0xfff;
136 146
137 /* find the position */ 147 info = find_pci_root_info(node, link);
138 for (j = 0; j < pci_root_num; j++) { 148 if (!info)
139 info = &pci_root_info[j];
140 if (info->node == node && info->link == link)
141 break;
142 }
143 if (j == pci_root_num)
144 continue; /* not found */ 149 continue; /* not found */
145 150
146 info = &pci_root_info[j];
147 printk(KERN_DEBUG "node %d link %d: io port [%llx, %llx]\n", 151 printk(KERN_DEBUG "node %d link %d: io port [%llx, %llx]\n",
148 node, link, start, end); 152 node, link, start, end);
149 153
@@ -155,13 +159,8 @@ static int __init early_fill_mp_bus_info(void)
155 } 159 }
156 /* add left over io port range to def node/link, [0, 0xffff] */ 160 /* add left over io port range to def node/link, [0, 0xffff] */
157 /* find the position */ 161 /* find the position */
158 for (j = 0; j < pci_root_num; j++) { 162 info = find_pci_root_info(def_node, def_link);
159 info = &pci_root_info[j]; 163 if (info) {
160 if (info->node == def_node && info->link == def_link)
161 break;
162 }
163 if (j < pci_root_num) {
164 info = &pci_root_info[j];
165 for (i = 0; i < RANGE_NUM; i++) { 164 for (i = 0; i < RANGE_NUM; i++) {
166 if (!range[i].end) 165 if (!range[i].end)
167 continue; 166 continue;
@@ -214,16 +213,10 @@ static int __init early_fill_mp_bus_info(void)
214 end <<= 8; 213 end <<= 8;
215 end |= 0xffff; 214 end |= 0xffff;
216 215
217 /* find the position */ 216 info = find_pci_root_info(node, link);
218 for (j = 0; j < pci_root_num; j++) {
219 info = &pci_root_info[j];
220 if (info->node == node && info->link == link)
221 break;
222 }
223 if (j == pci_root_num)
224 continue; /* not found */
225 217
226 info = &pci_root_info[j]; 218 if (!info)
219 continue;
227 220
228 printk(KERN_DEBUG "node %d link %d: mmio [%llx, %llx]", 221 printk(KERN_DEBUG "node %d link %d: mmio [%llx, %llx]",
229 node, link, start, end); 222 node, link, start, end);
@@ -291,14 +284,8 @@ static int __init early_fill_mp_bus_info(void)
291 * add left over mmio range to def node/link ? 284 * add left over mmio range to def node/link ?
292 * that is tricky, just record range in from start_min to 4G 285 * that is tricky, just record range in from start_min to 4G
293 */ 286 */
294 for (j = 0; j < pci_root_num; j++) { 287 info = find_pci_root_info(def_node, def_link);
295 info = &pci_root_info[j]; 288 if (info) {
296 if (info->node == def_node && info->link == def_link)
297 break;
298 }
299 if (j < pci_root_num) {
300 info = &pci_root_info[j];
301
302 for (i = 0; i < RANGE_NUM; i++) { 289 for (i = 0; i < RANGE_NUM; i++) {
303 if (!range[i].end) 290 if (!range[i].end)
304 continue; 291 continue;
@@ -309,20 +296,16 @@ static int __init early_fill_mp_bus_info(void)
309 } 296 }
310 } 297 }
311 298
312 for (i = 0; i < pci_root_num; i++) { 299 list_for_each_entry(info, &pci_root_infos, list) {
313 int res_num;
314 int busnum; 300 int busnum;
301 struct pci_root_res *root_res;
315 302
316 info = &pci_root_info[i];
317 res_num = info->res_num;
318 busnum = info->bus_min; 303 busnum = info->bus_min;
319 printk(KERN_DEBUG "bus: [%02x, %02x] on node %x link %x\n", 304 printk(KERN_DEBUG "bus: [%02x, %02x] on node %x link %x\n",
320 info->bus_min, info->bus_max, info->node, info->link); 305 info->bus_min, info->bus_max, info->node, info->link);
321 for (j = 0; j < res_num; j++) { 306 list_for_each_entry(root_res, &info->resources, list)
322 res = &info->res[j]; 307 printk(KERN_DEBUG "bus: %02x %pR\n",
323 printk(KERN_DEBUG "bus: %02x index %x %pR\n", 308 busnum, &root_res->res);
324 busnum, j, res);
325 }
326 } 309 }
327 310
328 return 0; 311 return 0;
diff --git a/arch/x86/pci/broadcom_bus.c b/arch/x86/pci/broadcom_bus.c
index f3a7c569a403..614392ced7d6 100644
--- a/arch/x86/pci/broadcom_bus.c
+++ b/arch/x86/pci/broadcom_bus.c
@@ -22,19 +22,15 @@
22static void __init cnb20le_res(u8 bus, u8 slot, u8 func) 22static void __init cnb20le_res(u8 bus, u8 slot, u8 func)
23{ 23{
24 struct pci_root_info *info; 24 struct pci_root_info *info;
25 struct pci_root_res *root_res;
25 struct resource res; 26 struct resource res;
26 u16 word1, word2; 27 u16 word1, word2;
27 u8 fbus, lbus; 28 u8 fbus, lbus;
28 int i;
29
30 info = &pci_root_info[pci_root_num];
31 pci_root_num++;
32 29
33 /* read the PCI bus numbers */ 30 /* read the PCI bus numbers */
34 fbus = read_pci_config_byte(bus, slot, func, 0x44); 31 fbus = read_pci_config_byte(bus, slot, func, 0x44);
35 lbus = read_pci_config_byte(bus, slot, func, 0x45); 32 lbus = read_pci_config_byte(bus, slot, func, 0x45);
36 info->bus_min = fbus; 33 info = alloc_pci_root_info(fbus, lbus, 0, 0);
37 info->bus_max = lbus;
38 34
39 /* 35 /*
40 * Add the legacy IDE ports on bus 0 36 * Add the legacy IDE ports on bus 0
@@ -86,8 +82,8 @@ static void __init cnb20le_res(u8 bus, u8 slot, u8 func)
86 res.flags = IORESOURCE_BUS; 82 res.flags = IORESOURCE_BUS;
87 printk(KERN_INFO "CNB20LE PCI Host Bridge (domain 0000 %pR)\n", &res); 83 printk(KERN_INFO "CNB20LE PCI Host Bridge (domain 0000 %pR)\n", &res);
88 84
89 for (i = 0; i < info->res_num; i++) 85 list_for_each_entry(root_res, &info->resources, list)
90 printk(KERN_INFO "host bridge window %pR\n", &info->res[i]); 86 printk(KERN_INFO "host bridge window %pR\n", &root_res->res);
91} 87}
92 88
93static int __init broadcom_postcore_init(void) 89static int __init broadcom_postcore_init(void)
diff --git a/arch/x86/pci/bus_numa.c b/arch/x86/pci/bus_numa.c
index fd3f65510e9d..306579f7d0fd 100644
--- a/arch/x86/pci/bus_numa.c
+++ b/arch/x86/pci/bus_numa.c
@@ -4,35 +4,38 @@
4 4
5#include "bus_numa.h" 5#include "bus_numa.h"
6 6
7int pci_root_num; 7LIST_HEAD(pci_root_infos);
8struct pci_root_info pci_root_info[PCI_ROOT_NR];
9 8
10void x86_pci_root_bus_resources(int bus, struct list_head *resources) 9static struct pci_root_info *x86_find_pci_root_info(int bus)
11{ 10{
12 int i;
13 int j;
14 struct pci_root_info *info; 11 struct pci_root_info *info;
15 12
16 if (!pci_root_num) 13 if (list_empty(&pci_root_infos))
17 goto default_resources; 14 return NULL;
18 15
19 for (i = 0; i < pci_root_num; i++) { 16 list_for_each_entry(info, &pci_root_infos, list)
20 if (pci_root_info[i].bus_min == bus) 17 if (info->bus_min == bus)
21 break; 18 return info;
22 } 19
20 return NULL;
21}
23 22
24 if (i == pci_root_num) 23void x86_pci_root_bus_resources(int bus, struct list_head *resources)
24{
25 struct pci_root_info *info = x86_find_pci_root_info(bus);
26 struct pci_root_res *root_res;
27
28 if (!info)
25 goto default_resources; 29 goto default_resources;
26 30
27 printk(KERN_DEBUG "PCI: root bus %02x: hardware-probed resources\n", 31 printk(KERN_DEBUG "PCI: root bus %02x: hardware-probed resources\n",
28 bus); 32 bus);
29 33
30 info = &pci_root_info[i]; 34 list_for_each_entry(root_res, &info->resources, list) {
31 for (j = 0; j < info->res_num; j++) {
32 struct resource *res; 35 struct resource *res;
33 struct resource *root; 36 struct resource *root;
34 37
35 res = &info->res[j]; 38 res = &root_res->res;
36 pci_add_resource(resources, res); 39 pci_add_resource(resources, res);
37 if (res->flags & IORESOURCE_IO) 40 if (res->flags & IORESOURCE_IO)
38 root = &ioport_resource; 41 root = &ioport_resource;
@@ -53,11 +56,32 @@ default_resources:
53 pci_add_resource(resources, &iomem_resource); 56 pci_add_resource(resources, &iomem_resource);
54} 57}
55 58
59struct pci_root_info __init *alloc_pci_root_info(int bus_min, int bus_max,
60 int node, int link)
61{
62 struct pci_root_info *info;
63
64 info = kzalloc(sizeof(*info), GFP_KERNEL);
65
66 if (!info)
67 return info;
68
69 INIT_LIST_HEAD(&info->resources);
70 info->bus_min = bus_min;
71 info->bus_max = bus_max;
72 info->node = node;
73 info->link = link;
74
75 list_add_tail(&info->list, &pci_root_infos);
76
77 return info;
78}
79
56void __devinit update_res(struct pci_root_info *info, resource_size_t start, 80void __devinit update_res(struct pci_root_info *info, resource_size_t start,
57 resource_size_t end, unsigned long flags, int merge) 81 resource_size_t end, unsigned long flags, int merge)
58{ 82{
59 int i;
60 struct resource *res; 83 struct resource *res;
84 struct pci_root_res *root_res;
61 85
62 if (start > end) 86 if (start > end)
63 return; 87 return;
@@ -69,11 +93,11 @@ void __devinit update_res(struct pci_root_info *info, resource_size_t start,
69 goto addit; 93 goto addit;
70 94
71 /* try to merge it with old one */ 95 /* try to merge it with old one */
72 for (i = 0; i < info->res_num; i++) { 96 list_for_each_entry(root_res, &info->resources, list) {
73 resource_size_t final_start, final_end; 97 resource_size_t final_start, final_end;
74 resource_size_t common_start, common_end; 98 resource_size_t common_start, common_end;
75 99
76 res = &info->res[i]; 100 res = &root_res->res;
77 if (res->flags != flags) 101 if (res->flags != flags)
78 continue; 102 continue;
79 103
@@ -93,14 +117,15 @@ void __devinit update_res(struct pci_root_info *info, resource_size_t start,
93addit: 117addit:
94 118
95 /* need to add that */ 119 /* need to add that */
96 if (info->res_num >= RES_NUM) 120 root_res = kzalloc(sizeof(*root_res), GFP_KERNEL);
121 if (!root_res)
97 return; 122 return;
98 123
99 res = &info->res[info->res_num]; 124 res = &root_res->res;
100 res->name = info->name; 125 res->name = info->name;
101 res->flags = flags; 126 res->flags = flags;
102 res->start = start; 127 res->start = start;
103 res->end = end; 128 res->end = end;
104 res->child = NULL; 129
105 info->res_num++; 130 list_add_tail(&root_res->list, &info->resources);
106} 131}
diff --git a/arch/x86/pci/bus_numa.h b/arch/x86/pci/bus_numa.h
index 804a4b40c31a..226a466b2b2b 100644
--- a/arch/x86/pci/bus_numa.h
+++ b/arch/x86/pci/bus_numa.h
@@ -4,22 +4,24 @@
4 * sub bus (transparent) will use entres from 3 to store extra from 4 * sub bus (transparent) will use entres from 3 to store extra from
5 * root, so need to make sure we have enough slot there. 5 * root, so need to make sure we have enough slot there.
6 */ 6 */
7#define RES_NUM 16 7struct pci_root_res {
8 struct list_head list;
9 struct resource res;
10};
11
8struct pci_root_info { 12struct pci_root_info {
13 struct list_head list;
9 char name[12]; 14 char name[12];
10 unsigned int res_num; 15 struct list_head resources;
11 struct resource res[RES_NUM];
12 int bus_min; 16 int bus_min;
13 int bus_max; 17 int bus_max;
14 int node; 18 int node;
15 int link; 19 int link;
16}; 20};
17 21
18/* 4 at this time, it may become to 32 */ 22extern struct list_head pci_root_infos;
19#define PCI_ROOT_NR 4 23struct pci_root_info *alloc_pci_root_info(int bus_min, int bus_max,
20extern int pci_root_num; 24 int node, int link);
21extern struct pci_root_info pci_root_info[PCI_ROOT_NR];
22
23extern void update_res(struct pci_root_info *info, resource_size_t start, 25extern void update_res(struct pci_root_info *info, resource_size_t start,
24 resource_size_t end, unsigned long flags, int merge); 26 resource_size_t end, unsigned long flags, int merge);
25#endif 27#endif
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 323481e06ef8..0ad990a20d4a 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -11,6 +11,7 @@
11#include <linux/dmi.h> 11#include <linux/dmi.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13 13
14#include <asm-generic/pci-bridge.h>
14#include <asm/acpi.h> 15#include <asm/acpi.h>
15#include <asm/segment.h> 16#include <asm/segment.h>
16#include <asm/io.h> 17#include <asm/io.h>
@@ -229,6 +230,14 @@ static int __devinit assign_all_busses(const struct dmi_system_id *d)
229} 230}
230#endif 231#endif
231 232
233static int __devinit set_scan_all(const struct dmi_system_id *d)
234{
235 printk(KERN_INFO "PCI: %s detected, enabling pci=pcie_scan_all\n",
236 d->ident);
237 pci_add_flags(PCI_SCAN_ALL_PCIE_DEVS);
238 return 0;
239}
240
232static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = { 241static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = {
233#ifdef __i386__ 242#ifdef __i386__
234/* 243/*
@@ -420,6 +429,13 @@ static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = {
420 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL585 G2"), 429 DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL585 G2"),
421 }, 430 },
422 }, 431 },
432 {
433 .callback = set_scan_all,
434 .ident = "Stratus/NEC ftServer",
435 .matches = {
436 DMI_MATCH(DMI_SYS_VENDOR, "ftServer"),
437 },
438 },
423 {} 439 {}
424}; 440};
425 441
@@ -430,9 +446,7 @@ void __init dmi_check_pciprobe(void)
430 446
431struct pci_bus * __devinit pcibios_scan_root(int busnum) 447struct pci_bus * __devinit pcibios_scan_root(int busnum)
432{ 448{
433 LIST_HEAD(resources);
434 struct pci_bus *bus = NULL; 449 struct pci_bus *bus = NULL;
435 struct pci_sysdata *sd;
436 450
437 while ((bus = pci_find_next_bus(bus)) != NULL) { 451 while ((bus = pci_find_next_bus(bus)) != NULL) {
438 if (bus->number == busnum) { 452 if (bus->number == busnum) {
@@ -441,28 +455,10 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum)
441 } 455 }
442 } 456 }
443 457
444 /* Allocate per-root-bus (not per bus) arch-specific data. 458 return pci_scan_bus_on_node(busnum, &pci_root_ops,
445 * TODO: leak; this memory is never freed. 459 get_mp_bus_to_node(busnum));
446 * It's arguable whether it's worth the trouble to care.
447 */
448 sd = kzalloc(sizeof(*sd), GFP_KERNEL);
449 if (!sd) {
450 printk(KERN_ERR "PCI: OOM, not probing PCI bus %02x\n", busnum);
451 return NULL;
452 }
453
454 sd->node = get_mp_bus_to_node(busnum);
455
456 printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
457 x86_pci_root_bus_resources(busnum, &resources);
458 bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
459 if (!bus) {
460 pci_free_resource_list(&resources);
461 kfree(sd);
462 }
463
464 return bus;
465} 460}
461
466void __init pcibios_set_cache_line_size(void) 462void __init pcibios_set_cache_line_size(void)
467{ 463{
468 struct cpuinfo_x86 *c = &boot_cpu_data; 464 struct cpuinfo_x86 *c = &boot_cpu_data;
@@ -656,6 +652,7 @@ struct pci_bus * __devinit pci_scan_bus_on_node(int busno, struct pci_ops *ops,
656 } 652 }
657 sd->node = node; 653 sd->node = node;
658 x86_pci_root_bus_resources(busno, &resources); 654 x86_pci_root_bus_resources(busno, &resources);
655 printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busno);
659 bus = pci_scan_root_bus(NULL, busno, ops, sd, &resources); 656 bus = pci_scan_root_bus(NULL, busno, ops, sd, &resources);
660 if (!bus) { 657 if (!bus) {
661 pci_free_resource_list(&resources); 658 pci_free_resource_list(&resources);
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 831971e731f7..dd8ca6f7223b 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -57,7 +57,7 @@ static struct pcibios_fwaddrmap *pcibios_fwaddrmap_lookup(struct pci_dev *dev)
57{ 57{
58 struct pcibios_fwaddrmap *map; 58 struct pcibios_fwaddrmap *map;
59 59
60 WARN_ON(!spin_is_locked(&pcibios_fwaddrmap_lock)); 60 WARN_ON_SMP(!spin_is_locked(&pcibios_fwaddrmap_lock));
61 61
62 list_for_each_entry(map, &pcibios_fwaddrmappings, list) 62 list_for_each_entry(map, &pcibios_fwaddrmappings, list)
63 if (map->dev == dev) 63 if (map->dev == dev)
diff --git a/arch/x86/platform/geode/net5501.c b/arch/x86/platform/geode/net5501.c
index 66d377e334f7..646e3b5b4bb6 100644
--- a/arch/x86/platform/geode/net5501.c
+++ b/arch/x86/platform/geode/net5501.c
@@ -63,7 +63,7 @@ static struct gpio_led net5501_leds[] = {
63 .name = "net5501:1", 63 .name = "net5501:1",
64 .gpio = 6, 64 .gpio = 6,
65 .default_trigger = "default-on", 65 .default_trigger = "default-on",
66 .active_low = 1, 66 .active_low = 0,
67 }, 67 },
68}; 68};
69 69
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
index e0a37233c0af..e31bcd8f2eee 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
@@ -805,7 +805,7 @@ void intel_scu_devices_create(void)
805 } else 805 } else
806 i2c_register_board_info(i2c_bus[i], i2c_devs[i], 1); 806 i2c_register_board_info(i2c_bus[i], i2c_devs[i], 1);
807 } 807 }
808 intel_scu_notifier_post(SCU_AVAILABLE, 0L); 808 intel_scu_notifier_post(SCU_AVAILABLE, NULL);
809} 809}
810EXPORT_SYMBOL_GPL(intel_scu_devices_create); 810EXPORT_SYMBOL_GPL(intel_scu_devices_create);
811 811
@@ -814,7 +814,7 @@ void intel_scu_devices_destroy(void)
814{ 814{
815 int i; 815 int i;
816 816
817 intel_scu_notifier_post(SCU_DOWN, 0L); 817 intel_scu_notifier_post(SCU_DOWN, NULL);
818 818
819 for (i = 0; i < ipc_next_dev; i++) 819 for (i = 0; i < ipc_next_dev; i++)
820 platform_device_del(ipc_devs[i]); 820 platform_device_del(ipc_devs[i]);
diff --git a/arch/x86/platform/visws/visws_quirks.c b/arch/x86/platform/visws/visws_quirks.c
index c7abf13a213f..94d8a39332ec 100644
--- a/arch/x86/platform/visws/visws_quirks.c
+++ b/arch/x86/platform/visws/visws_quirks.c
@@ -445,7 +445,7 @@ static void ack_cobalt_irq(struct irq_data *data)
445 445
446 spin_lock_irqsave(&cobalt_lock, flags); 446 spin_lock_irqsave(&cobalt_lock, flags);
447 disable_cobalt_irq(data); 447 disable_cobalt_irq(data);
448 apic_write(APIC_EOI, APIC_EIO_ACK); 448 apic_write(APIC_EOI, APIC_EOI_ACK);
449 spin_unlock_irqrestore(&cobalt_lock, flags); 449 spin_unlock_irqrestore(&cobalt_lock, flags);
450} 450}
451 451
diff --git a/arch/x86/tools/.gitignore b/arch/x86/tools/.gitignore
new file mode 100644
index 000000000000..be0ed065249b
--- /dev/null
+++ b/arch/x86/tools/.gitignore
@@ -0,0 +1 @@
relocs
diff --git a/arch/x86/tools/Makefile b/arch/x86/tools/Makefile
index d511aa97533a..733057b435b0 100644
--- a/arch/x86/tools/Makefile
+++ b/arch/x86/tools/Makefile
@@ -36,3 +36,7 @@ HOSTCFLAGS_insn_sanity.o := -Wall -I$(objtree)/arch/x86/lib/ -I$(srctree)/arch/x
36$(obj)/test_get_len.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c 36$(obj)/test_get_len.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c
37 37
38$(obj)/insn_sanity.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c 38$(obj)/insn_sanity.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c
39
40HOST_EXTRACFLAGS += -I$(srctree)/tools/include
41hostprogs-y += relocs
42relocs: $(obj)/relocs
diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/tools/relocs.c
index fb7117a4ade1..b43cfcd9bf40 100644
--- a/arch/x86/boot/compressed/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -18,6 +18,8 @@ static void die(char *fmt, ...);
18static Elf32_Ehdr ehdr; 18static Elf32_Ehdr ehdr;
19static unsigned long reloc_count, reloc_idx; 19static unsigned long reloc_count, reloc_idx;
20static unsigned long *relocs; 20static unsigned long *relocs;
21static unsigned long reloc16_count, reloc16_idx;
22static unsigned long *relocs16;
21 23
22struct section { 24struct section {
23 Elf32_Shdr shdr; 25 Elf32_Shdr shdr;
@@ -28,52 +30,86 @@ struct section {
28}; 30};
29static struct section *secs; 31static struct section *secs;
30 32
33enum symtype {
34 S_ABS,
35 S_REL,
36 S_SEG,
37 S_LIN,
38 S_NSYMTYPES
39};
40
41static const char * const sym_regex_kernel[S_NSYMTYPES] = {
31/* 42/*
32 * Following symbols have been audited. There values are constant and do 43 * Following symbols have been audited. There values are constant and do
33 * not change if bzImage is loaded at a different physical address than 44 * not change if bzImage is loaded at a different physical address than
34 * the address for which it has been compiled. Don't warn user about 45 * the address for which it has been compiled. Don't warn user about
35 * absolute relocations present w.r.t these symbols. 46 * absolute relocations present w.r.t these symbols.
36 */ 47 */
37static const char abs_sym_regex[] = 48 [S_ABS] =
38 "^(xen_irq_disable_direct_reloc$|" 49 "^(xen_irq_disable_direct_reloc$|"
39 "xen_save_fl_direct_reloc$|" 50 "xen_save_fl_direct_reloc$|"
40 "VDSO|" 51 "VDSO|"
41 "__crc_)"; 52 "__crc_)",
42static regex_t abs_sym_regex_c;
43static int is_abs_reloc(const char *sym_name)
44{
45 return !regexec(&abs_sym_regex_c, sym_name, 0, NULL, 0);
46}
47 53
48/* 54/*
49 * These symbols are known to be relative, even if the linker marks them 55 * These symbols are known to be relative, even if the linker marks them
50 * as absolute (typically defined outside any section in the linker script.) 56 * as absolute (typically defined outside any section in the linker script.)
51 */ 57 */
52static const char rel_sym_regex[] = 58 [S_REL] =
53 "^_end$"; 59 "^(__init_(begin|end)|"
54static regex_t rel_sym_regex_c; 60 "__x86_cpu_dev_(start|end)|"
55static int is_rel_reloc(const char *sym_name) 61 "(__parainstructions|__alt_instructions)(|_end)|"
62 "(__iommu_table|__apicdrivers|__smp_locks)(|_end)|"
63 "_end)$"
64};
65
66
67static const char * const sym_regex_realmode[S_NSYMTYPES] = {
68/*
69 * These are 16-bit segment symbols when compiling 16-bit code.
70 */
71 [S_SEG] =
72 "^real_mode_seg$",
73
74/*
75 * These are offsets belonging to segments, as opposed to linear addresses,
76 * when compiling 16-bit code.
77 */
78 [S_LIN] =
79 "^pa_",
80};
81
82static const char * const *sym_regex;
83
84static regex_t sym_regex_c[S_NSYMTYPES];
85static int is_reloc(enum symtype type, const char *sym_name)
56{ 86{
57 return !regexec(&rel_sym_regex_c, sym_name, 0, NULL, 0); 87 return sym_regex[type] &&
88 !regexec(&sym_regex_c[type], sym_name, 0, NULL, 0);
58} 89}
59 90
60static void regex_init(void) 91static void regex_init(int use_real_mode)
61{ 92{
62 char errbuf[128]; 93 char errbuf[128];
63 int err; 94 int err;
64 95 int i;
65 err = regcomp(&abs_sym_regex_c, abs_sym_regex, 96
66 REG_EXTENDED|REG_NOSUB); 97 if (use_real_mode)
67 if (err) { 98 sym_regex = sym_regex_realmode;
68 regerror(err, &abs_sym_regex_c, errbuf, sizeof errbuf); 99 else
69 die("%s", errbuf); 100 sym_regex = sym_regex_kernel;
70 }
71 101
72 err = regcomp(&rel_sym_regex_c, rel_sym_regex, 102 for (i = 0; i < S_NSYMTYPES; i++) {
73 REG_EXTENDED|REG_NOSUB); 103 if (!sym_regex[i])
74 if (err) { 104 continue;
75 regerror(err, &rel_sym_regex_c, errbuf, sizeof errbuf); 105
76 die("%s", errbuf); 106 err = regcomp(&sym_regex_c[i], sym_regex[i],
107 REG_EXTENDED|REG_NOSUB);
108
109 if (err) {
110 regerror(err, &sym_regex_c[i], errbuf, sizeof errbuf);
111 die("%s", errbuf);
112 }
77 } 113 }
78} 114}
79 115
@@ -154,6 +190,10 @@ static const char *rel_type(unsigned type)
154 REL_TYPE(R_386_RELATIVE), 190 REL_TYPE(R_386_RELATIVE),
155 REL_TYPE(R_386_GOTOFF), 191 REL_TYPE(R_386_GOTOFF),
156 REL_TYPE(R_386_GOTPC), 192 REL_TYPE(R_386_GOTPC),
193 REL_TYPE(R_386_8),
194 REL_TYPE(R_386_PC8),
195 REL_TYPE(R_386_16),
196 REL_TYPE(R_386_PC16),
157#undef REL_TYPE 197#undef REL_TYPE
158 }; 198 };
159 const char *name = "unknown type rel type name"; 199 const char *name = "unknown type rel type name";
@@ -189,7 +229,7 @@ static const char *sym_name(const char *sym_strtab, Elf32_Sym *sym)
189 name = sym_strtab + sym->st_name; 229 name = sym_strtab + sym->st_name;
190 } 230 }
191 else { 231 else {
192 name = sec_name(secs[sym->st_shndx].shdr.sh_name); 232 name = sec_name(sym->st_shndx);
193 } 233 }
194 return name; 234 return name;
195} 235}
@@ -472,7 +512,7 @@ static void print_absolute_relocs(void)
472 * Before warning check if this absolute symbol 512 * Before warning check if this absolute symbol
473 * relocation is harmless. 513 * relocation is harmless.
474 */ 514 */
475 if (is_abs_reloc(name) || is_rel_reloc(name)) 515 if (is_reloc(S_ABS, name) || is_reloc(S_REL, name))
476 continue; 516 continue;
477 517
478 if (!printed) { 518 if (!printed) {
@@ -496,7 +536,8 @@ static void print_absolute_relocs(void)
496 printf("\n"); 536 printf("\n");
497} 537}
498 538
499static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym)) 539static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym),
540 int use_real_mode)
500{ 541{
501 int i; 542 int i;
502 /* Walk through the relocations */ 543 /* Walk through the relocations */
@@ -521,30 +562,67 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym))
521 Elf32_Rel *rel; 562 Elf32_Rel *rel;
522 Elf32_Sym *sym; 563 Elf32_Sym *sym;
523 unsigned r_type; 564 unsigned r_type;
565 const char *symname;
566 int shn_abs;
567
524 rel = &sec->reltab[j]; 568 rel = &sec->reltab[j];
525 sym = &sh_symtab[ELF32_R_SYM(rel->r_info)]; 569 sym = &sh_symtab[ELF32_R_SYM(rel->r_info)];
526 r_type = ELF32_R_TYPE(rel->r_info); 570 r_type = ELF32_R_TYPE(rel->r_info);
527 /* Don't visit relocations to absolute symbols */ 571
528 if (sym->st_shndx == SHN_ABS && 572 shn_abs = sym->st_shndx == SHN_ABS;
529 !is_rel_reloc(sym_name(sym_strtab, sym))) { 573
530 continue;
531 }
532 switch (r_type) { 574 switch (r_type) {
533 case R_386_NONE: 575 case R_386_NONE:
534 case R_386_PC32: 576 case R_386_PC32:
577 case R_386_PC16:
578 case R_386_PC8:
535 /* 579 /*
536 * NONE can be ignored and and PC relative 580 * NONE can be ignored and and PC relative
537 * relocations don't need to be adjusted. 581 * relocations don't need to be adjusted.
538 */ 582 */
539 break; 583 break;
584
585 case R_386_16:
586 symname = sym_name(sym_strtab, sym);
587 if (!use_real_mode)
588 goto bad;
589 if (shn_abs) {
590 if (is_reloc(S_ABS, symname))
591 break;
592 else if (!is_reloc(S_SEG, symname))
593 goto bad;
594 } else {
595 if (is_reloc(S_LIN, symname))
596 goto bad;
597 else
598 break;
599 }
600 visit(rel, sym);
601 break;
602
540 case R_386_32: 603 case R_386_32:
541 /* Visit relocations that need to be adjusted */ 604 symname = sym_name(sym_strtab, sym);
605 if (shn_abs) {
606 if (is_reloc(S_ABS, symname))
607 break;
608 else if (!is_reloc(S_REL, symname))
609 goto bad;
610 } else {
611 if (use_real_mode &&
612 !is_reloc(S_LIN, symname))
613 break;
614 }
542 visit(rel, sym); 615 visit(rel, sym);
543 break; 616 break;
544 default: 617 default:
545 die("Unsupported relocation type: %s (%d)\n", 618 die("Unsupported relocation type: %s (%d)\n",
546 rel_type(r_type), r_type); 619 rel_type(r_type), r_type);
547 break; 620 break;
621 bad:
622 symname = sym_name(sym_strtab, sym);
623 die("Invalid %s %s relocation: %s\n",
624 shn_abs ? "absolute" : "relative",
625 rel_type(r_type), symname);
548 } 626 }
549 } 627 }
550 } 628 }
@@ -552,13 +630,19 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym))
552 630
553static void count_reloc(Elf32_Rel *rel, Elf32_Sym *sym) 631static void count_reloc(Elf32_Rel *rel, Elf32_Sym *sym)
554{ 632{
555 reloc_count += 1; 633 if (ELF32_R_TYPE(rel->r_info) == R_386_16)
634 reloc16_count++;
635 else
636 reloc_count++;
556} 637}
557 638
558static void collect_reloc(Elf32_Rel *rel, Elf32_Sym *sym) 639static void collect_reloc(Elf32_Rel *rel, Elf32_Sym *sym)
559{ 640{
560 /* Remember the address that needs to be adjusted. */ 641 /* Remember the address that needs to be adjusted. */
561 relocs[reloc_idx++] = rel->r_offset; 642 if (ELF32_R_TYPE(rel->r_info) == R_386_16)
643 relocs16[reloc16_idx++] = rel->r_offset;
644 else
645 relocs[reloc_idx++] = rel->r_offset;
562} 646}
563 647
564static int cmp_relocs(const void *va, const void *vb) 648static int cmp_relocs(const void *va, const void *vb)
@@ -568,23 +652,41 @@ static int cmp_relocs(const void *va, const void *vb)
568 return (*a == *b)? 0 : (*a > *b)? 1 : -1; 652 return (*a == *b)? 0 : (*a > *b)? 1 : -1;
569} 653}
570 654
571static void emit_relocs(int as_text) 655static int write32(unsigned int v, FILE *f)
656{
657 unsigned char buf[4];
658
659 put_unaligned_le32(v, buf);
660 return fwrite(buf, 1, 4, f) == 4 ? 0 : -1;
661}
662
663static void emit_relocs(int as_text, int use_real_mode)
572{ 664{
573 int i; 665 int i;
574 /* Count how many relocations I have and allocate space for them. */ 666 /* Count how many relocations I have and allocate space for them. */
575 reloc_count = 0; 667 reloc_count = 0;
576 walk_relocs(count_reloc); 668 walk_relocs(count_reloc, use_real_mode);
577 relocs = malloc(reloc_count * sizeof(relocs[0])); 669 relocs = malloc(reloc_count * sizeof(relocs[0]));
578 if (!relocs) { 670 if (!relocs) {
579 die("malloc of %d entries for relocs failed\n", 671 die("malloc of %d entries for relocs failed\n",
580 reloc_count); 672 reloc_count);
581 } 673 }
674
675 relocs16 = malloc(reloc16_count * sizeof(relocs[0]));
676 if (!relocs16) {
677 die("malloc of %d entries for relocs16 failed\n",
678 reloc16_count);
679 }
582 /* Collect up the relocations */ 680 /* Collect up the relocations */
583 reloc_idx = 0; 681 reloc_idx = 0;
584 walk_relocs(collect_reloc); 682 walk_relocs(collect_reloc, use_real_mode);
683
684 if (reloc16_count && !use_real_mode)
685 die("Segment relocations found but --realmode not specified\n");
585 686
586 /* Order the relocations for more efficient processing */ 687 /* Order the relocations for more efficient processing */
587 qsort(relocs, reloc_count, sizeof(relocs[0]), cmp_relocs); 688 qsort(relocs, reloc_count, sizeof(relocs[0]), cmp_relocs);
689 qsort(relocs16, reloc16_count, sizeof(relocs16[0]), cmp_relocs);
588 690
589 /* Print the relocations */ 691 /* Print the relocations */
590 if (as_text) { 692 if (as_text) {
@@ -593,58 +695,83 @@ static void emit_relocs(int as_text)
593 */ 695 */
594 printf(".section \".data.reloc\",\"a\"\n"); 696 printf(".section \".data.reloc\",\"a\"\n");
595 printf(".balign 4\n"); 697 printf(".balign 4\n");
596 for (i = 0; i < reloc_count; i++) { 698 if (use_real_mode) {
597 printf("\t .long 0x%08lx\n", relocs[i]); 699 printf("\t.long %lu\n", reloc16_count);
700 for (i = 0; i < reloc16_count; i++)
701 printf("\t.long 0x%08lx\n", relocs16[i]);
702 printf("\t.long %lu\n", reloc_count);
703 for (i = 0; i < reloc_count; i++) {
704 printf("\t.long 0x%08lx\n", relocs[i]);
705 }
706 } else {
707 /* Print a stop */
708 printf("\t.long 0x%08lx\n", (unsigned long)0);
709 for (i = 0; i < reloc_count; i++) {
710 printf("\t.long 0x%08lx\n", relocs[i]);
711 }
598 } 712 }
713
599 printf("\n"); 714 printf("\n");
600 } 715 }
601 else { 716 else {
602 unsigned char buf[4]; 717 if (use_real_mode) {
603 /* Print a stop */ 718 write32(reloc16_count, stdout);
604 fwrite("\0\0\0\0", 4, 1, stdout); 719 for (i = 0; i < reloc16_count; i++)
605 /* Now print each relocation */ 720 write32(relocs16[i], stdout);
606 for (i = 0; i < reloc_count; i++) { 721 write32(reloc_count, stdout);
607 put_unaligned_le32(relocs[i], buf); 722
608 fwrite(buf, 4, 1, stdout); 723 /* Now print each relocation */
724 for (i = 0; i < reloc_count; i++)
725 write32(relocs[i], stdout);
726 } else {
727 /* Print a stop */
728 write32(0, stdout);
729
730 /* Now print each relocation */
731 for (i = 0; i < reloc_count; i++) {
732 write32(relocs[i], stdout);
733 }
609 } 734 }
610 } 735 }
611} 736}
612 737
613static void usage(void) 738static void usage(void)
614{ 739{
615 die("relocs [--abs-syms |--abs-relocs | --text] vmlinux\n"); 740 die("relocs [--abs-syms|--abs-relocs|--text|--realmode] vmlinux\n");
616} 741}
617 742
618int main(int argc, char **argv) 743int main(int argc, char **argv)
619{ 744{
620 int show_absolute_syms, show_absolute_relocs; 745 int show_absolute_syms, show_absolute_relocs;
621 int as_text; 746 int as_text, use_real_mode;
622 const char *fname; 747 const char *fname;
623 FILE *fp; 748 FILE *fp;
624 int i; 749 int i;
625 750
626 regex_init();
627
628 show_absolute_syms = 0; 751 show_absolute_syms = 0;
629 show_absolute_relocs = 0; 752 show_absolute_relocs = 0;
630 as_text = 0; 753 as_text = 0;
754 use_real_mode = 0;
631 fname = NULL; 755 fname = NULL;
632 for (i = 1; i < argc; i++) { 756 for (i = 1; i < argc; i++) {
633 char *arg = argv[i]; 757 char *arg = argv[i];
634 if (*arg == '-') { 758 if (*arg == '-') {
635 if (strcmp(argv[1], "--abs-syms") == 0) { 759 if (strcmp(arg, "--abs-syms") == 0) {
636 show_absolute_syms = 1; 760 show_absolute_syms = 1;
637 continue; 761 continue;
638 } 762 }
639 763 if (strcmp(arg, "--abs-relocs") == 0) {
640 if (strcmp(argv[1], "--abs-relocs") == 0) {
641 show_absolute_relocs = 1; 764 show_absolute_relocs = 1;
642 continue; 765 continue;
643 } 766 }
644 else if (strcmp(argv[1], "--text") == 0) { 767 if (strcmp(arg, "--text") == 0) {
645 as_text = 1; 768 as_text = 1;
646 continue; 769 continue;
647 } 770 }
771 if (strcmp(arg, "--realmode") == 0) {
772 use_real_mode = 1;
773 continue;
774 }
648 } 775 }
649 else if (!fname) { 776 else if (!fname) {
650 fname = arg; 777 fname = arg;
@@ -655,6 +782,7 @@ int main(int argc, char **argv)
655 if (!fname) { 782 if (!fname) {
656 usage(); 783 usage();
657 } 784 }
785 regex_init(use_real_mode);
658 fp = fopen(fname, "r"); 786 fp = fopen(fname, "r");
659 if (!fp) { 787 if (!fp) {
660 die("Cannot open %s: %s\n", 788 die("Cannot open %s: %s\n",
@@ -673,6 +801,6 @@ int main(int argc, char **argv)
673 print_absolute_relocs(); 801 print_absolute_relocs();
674 return 0; 802 return 0;
675 } 803 }
676 emit_relocs(as_text); 804 emit_relocs(as_text, use_real_mode);
677 return 0; 805 return 0;
678} 806}
diff --git a/arch/x86/um/asm/barrier.h b/arch/x86/um/asm/barrier.h
new file mode 100644
index 000000000000..7d01b8c56c00
--- /dev/null
+++ b/arch/x86/um/asm/barrier.h
@@ -0,0 +1,75 @@
1#ifndef _ASM_UM_BARRIER_H_
2#define _ASM_UM_BARRIER_H_
3
4#include <asm/asm.h>
5#include <asm/segment.h>
6#include <asm/cpufeature.h>
7#include <asm/cmpxchg.h>
8#include <asm/nops.h>
9
10#include <linux/kernel.h>
11#include <linux/irqflags.h>
12
13/*
14 * Force strict CPU ordering.
15 * And yes, this is required on UP too when we're talking
16 * to devices.
17 */
18#ifdef CONFIG_X86_32
19
20#define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2)
21#define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2)
22#define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM)
23
24#else /* CONFIG_X86_32 */
25
26#define mb() asm volatile("mfence" : : : "memory")
27#define rmb() asm volatile("lfence" : : : "memory")
28#define wmb() asm volatile("sfence" : : : "memory")
29
30#endif /* CONFIG_X86_32 */
31
32#define read_barrier_depends() do { } while (0)
33
34#ifdef CONFIG_SMP
35
36#define smp_mb() mb()
37#ifdef CONFIG_X86_PPRO_FENCE
38#define smp_rmb() rmb()
39#else /* CONFIG_X86_PPRO_FENCE */
40#define smp_rmb() barrier()
41#endif /* CONFIG_X86_PPRO_FENCE */
42
43#ifdef CONFIG_X86_OOSTORE
44#define smp_wmb() wmb()
45#else /* CONFIG_X86_OOSTORE */
46#define smp_wmb() barrier()
47#endif /* CONFIG_X86_OOSTORE */
48
49#define smp_read_barrier_depends() read_barrier_depends()
50#define set_mb(var, value) do { (void)xchg(&var, value); } while (0)
51
52#else /* CONFIG_SMP */
53
54#define smp_mb() barrier()
55#define smp_rmb() barrier()
56#define smp_wmb() barrier()
57#define smp_read_barrier_depends() do { } while (0)
58#define set_mb(var, value) do { var = value; barrier(); } while (0)
59
60#endif /* CONFIG_SMP */
61
62/*
63 * Stop RDTSC speculation. This is needed when you need to use RDTSC
64 * (or get_cycles or vread that possibly accesses the TSC) in a defined
65 * code region.
66 *
67 * (Could use an alternative three way for this if there was one.)
68 */
69static inline void rdtsc_barrier(void)
70{
71 alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC);
72 alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
73}
74
75#endif
diff --git a/arch/x86/um/asm/system.h b/arch/x86/um/asm/system.h
deleted file mode 100644
index a459fd9b7598..000000000000
--- a/arch/x86/um/asm/system.h
+++ /dev/null
@@ -1,135 +0,0 @@
1#ifndef _ASM_X86_SYSTEM_H_
2#define _ASM_X86_SYSTEM_H_
3
4#include <asm/asm.h>
5#include <asm/segment.h>
6#include <asm/cpufeature.h>
7#include <asm/cmpxchg.h>
8#include <asm/nops.h>
9
10#include <linux/kernel.h>
11#include <linux/irqflags.h>
12
13/* entries in ARCH_DLINFO: */
14#ifdef CONFIG_IA32_EMULATION
15# define AT_VECTOR_SIZE_ARCH 2
16#else
17# define AT_VECTOR_SIZE_ARCH 1
18#endif
19
20extern unsigned long arch_align_stack(unsigned long sp);
21
22void default_idle(void);
23
24/*
25 * Force strict CPU ordering.
26 * And yes, this is required on UP too when we're talking
27 * to devices.
28 */
29#ifdef CONFIG_X86_32
30/*
31 * Some non-Intel clones support out of order store. wmb() ceases to be a
32 * nop for these.
33 */
34#define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2)
35#define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2)
36#define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM)
37#else
38#define mb() asm volatile("mfence":::"memory")
39#define rmb() asm volatile("lfence":::"memory")
40#define wmb() asm volatile("sfence" ::: "memory")
41#endif
42
43/**
44 * read_barrier_depends - Flush all pending reads that subsequents reads
45 * depend on.
46 *
47 * No data-dependent reads from memory-like regions are ever reordered
48 * over this barrier. All reads preceding this primitive are guaranteed
49 * to access memory (but not necessarily other CPUs' caches) before any
50 * reads following this primitive that depend on the data return by
51 * any of the preceding reads. This primitive is much lighter weight than
52 * rmb() on most CPUs, and is never heavier weight than is
53 * rmb().
54 *
55 * These ordering constraints are respected by both the local CPU
56 * and the compiler.
57 *
58 * Ordering is not guaranteed by anything other than these primitives,
59 * not even by data dependencies. See the documentation for
60 * memory_barrier() for examples and URLs to more information.
61 *
62 * For example, the following code would force ordering (the initial
63 * value of "a" is zero, "b" is one, and "p" is "&a"):
64 *
65 * <programlisting>
66 * CPU 0 CPU 1
67 *
68 * b = 2;
69 * memory_barrier();
70 * p = &b; q = p;
71 * read_barrier_depends();
72 * d = *q;
73 * </programlisting>
74 *
75 * because the read of "*q" depends on the read of "p" and these
76 * two reads are separated by a read_barrier_depends(). However,
77 * the following code, with the same initial values for "a" and "b":
78 *
79 * <programlisting>
80 * CPU 0 CPU 1
81 *
82 * a = 2;
83 * memory_barrier();
84 * b = 3; y = b;
85 * read_barrier_depends();
86 * x = a;
87 * </programlisting>
88 *
89 * does not enforce ordering, since there is no data dependency between
90 * the read of "a" and the read of "b". Therefore, on some CPUs, such
91 * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb()
92 * in cases like this where there are no data dependencies.
93 **/
94
95#define read_barrier_depends() do { } while (0)
96
97#ifdef CONFIG_SMP
98#define smp_mb() mb()
99#ifdef CONFIG_X86_PPRO_FENCE
100# define smp_rmb() rmb()
101#else
102# define smp_rmb() barrier()
103#endif
104#ifdef CONFIG_X86_OOSTORE
105# define smp_wmb() wmb()
106#else
107# define smp_wmb() barrier()
108#endif
109#define smp_read_barrier_depends() read_barrier_depends()
110#define set_mb(var, value) do { (void)xchg(&var, value); } while (0)
111#else
112#define smp_mb() barrier()
113#define smp_rmb() barrier()
114#define smp_wmb() barrier()
115#define smp_read_barrier_depends() do { } while (0)
116#define set_mb(var, value) do { var = value; barrier(); } while (0)
117#endif
118
119/*
120 * Stop RDTSC speculation. This is needed when you need to use RDTSC
121 * (or get_cycles or vread that possibly accesses the TSC) in a defined
122 * code region.
123 *
124 * (Could use an alternative three way for this if there was one.)
125 */
126static inline void rdtsc_barrier(void)
127{
128 alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC);
129 alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
130}
131
132extern void *_switch_to(void *prev, void *next, void *last);
133#define switch_to(prev, next, last) prev = _switch_to(prev, next, last)
134
135#endif
diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile
index add2c2d729ce..96ab2c09cb68 100644
--- a/arch/x86/xen/Makefile
+++ b/arch/x86/xen/Makefile
@@ -20,5 +20,5 @@ obj-$(CONFIG_EVENT_TRACING) += trace.o
20obj-$(CONFIG_SMP) += smp.o 20obj-$(CONFIG_SMP) += smp.o
21obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o 21obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o
22obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o 22obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o
23obj-$(CONFIG_XEN_DOM0) += vga.o 23obj-$(CONFIG_XEN_DOM0) += apic.o vga.o
24obj-$(CONFIG_SWIOTLB_XEN) += pci-swiotlb-xen.o 24obj-$(CONFIG_SWIOTLB_XEN) += pci-swiotlb-xen.o
diff --git a/arch/x86/xen/apic.c b/arch/x86/xen/apic.c
new file mode 100644
index 000000000000..ec57bd3818a4
--- /dev/null
+++ b/arch/x86/xen/apic.c
@@ -0,0 +1,33 @@
1#include <linux/init.h>
2
3#include <asm/x86_init.h>
4#include <asm/apic.h>
5#include <asm/xen/hypercall.h>
6
7#include <xen/xen.h>
8#include <xen/interface/physdev.h>
9
10unsigned int xen_io_apic_read(unsigned apic, unsigned reg)
11{
12 struct physdev_apic apic_op;
13 int ret;
14
15 apic_op.apic_physbase = mpc_ioapic_addr(apic);
16 apic_op.reg = reg;
17 ret = HYPERVISOR_physdev_op(PHYSDEVOP_apic_read, &apic_op);
18 if (!ret)
19 return apic_op.value;
20
21 /* fallback to return an emulated IO_APIC values */
22 if (reg == 0x1)
23 return 0x00170020;
24 else if (reg == 0x0)
25 return apic << 24;
26
27 return 0xfd;
28}
29
30void __init xen_init_apic(void)
31{
32 x86_io_apic_ops.read = xen_io_apic_read;
33}
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 4f51bebac02c..c0f5facdb10c 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -63,6 +63,7 @@
63#include <asm/stackprotector.h> 63#include <asm/stackprotector.h>
64#include <asm/hypervisor.h> 64#include <asm/hypervisor.h>
65#include <asm/mwait.h> 65#include <asm/mwait.h>
66#include <asm/pci_x86.h>
66 67
67#ifdef CONFIG_ACPI 68#ifdef CONFIG_ACPI
68#include <linux/acpi.h> 69#include <linux/acpi.h>
@@ -261,7 +262,8 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
261 262
262static bool __init xen_check_mwait(void) 263static bool __init xen_check_mwait(void)
263{ 264{
264#ifdef CONFIG_ACPI 265#if defined(CONFIG_ACPI) && !defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) && \
266 !defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE)
265 struct xen_platform_op op = { 267 struct xen_platform_op op = {
266 .cmd = XENPF_set_processor_pminfo, 268 .cmd = XENPF_set_processor_pminfo,
267 .u.set_pminfo.id = -1, 269 .u.set_pminfo.id = -1,
@@ -349,7 +351,6 @@ static void __init xen_init_cpuid_mask(void)
349 /* Xen will set CR4.OSXSAVE if supported and not disabled by force */ 351 /* Xen will set CR4.OSXSAVE if supported and not disabled by force */
350 if ((cx & xsave_mask) != xsave_mask) 352 if ((cx & xsave_mask) != xsave_mask)
351 cpuid_leaf1_ecx_mask &= ~xsave_mask; /* disable XSAVE & OSXSAVE */ 353 cpuid_leaf1_ecx_mask &= ~xsave_mask; /* disable XSAVE & OSXSAVE */
352
353 if (xen_check_mwait()) 354 if (xen_check_mwait())
354 cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT % 32)); 355 cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT % 32));
355} 356}
@@ -809,9 +810,40 @@ static void xen_io_delay(void)
809} 810}
810 811
811#ifdef CONFIG_X86_LOCAL_APIC 812#ifdef CONFIG_X86_LOCAL_APIC
813static unsigned long xen_set_apic_id(unsigned int x)
814{
815 WARN_ON(1);
816 return x;
817}
818static unsigned int xen_get_apic_id(unsigned long x)
819{
820 return ((x)>>24) & 0xFFu;
821}
812static u32 xen_apic_read(u32 reg) 822static u32 xen_apic_read(u32 reg)
813{ 823{
814 return 0; 824 struct xen_platform_op op = {
825 .cmd = XENPF_get_cpuinfo,
826 .interface_version = XENPF_INTERFACE_VERSION,
827 .u.pcpu_info.xen_cpuid = 0,
828 };
829 int ret = 0;
830
831 /* Shouldn't need this as APIC is turned off for PV, and we only
832 * get called on the bootup processor. But just in case. */
833 if (!xen_initial_domain() || smp_processor_id())
834 return 0;
835
836 if (reg == APIC_LVR)
837 return 0x10;
838
839 if (reg != APIC_ID)
840 return 0;
841
842 ret = HYPERVISOR_dom0_op(&op);
843 if (ret)
844 return 0;
845
846 return op.u.pcpu_info.apic_id << 24;
815} 847}
816 848
817static void xen_apic_write(u32 reg, u32 val) 849static void xen_apic_write(u32 reg, u32 val)
@@ -849,6 +881,8 @@ static void set_xen_basic_apic_ops(void)
849 apic->icr_write = xen_apic_icr_write; 881 apic->icr_write = xen_apic_icr_write;
850 apic->wait_icr_idle = xen_apic_wait_icr_idle; 882 apic->wait_icr_idle = xen_apic_wait_icr_idle;
851 apic->safe_wait_icr_idle = xen_safe_apic_wait_icr_idle; 883 apic->safe_wait_icr_idle = xen_safe_apic_wait_icr_idle;
884 apic->set_apic_id = xen_set_apic_id;
885 apic->get_apic_id = xen_get_apic_id;
852} 886}
853 887
854#endif 888#endif
@@ -1362,11 +1396,15 @@ asmlinkage void __init xen_start_kernel(void)
1362 xen_start_info->console.domU.mfn = 0; 1396 xen_start_info->console.domU.mfn = 0;
1363 xen_start_info->console.domU.evtchn = 0; 1397 xen_start_info->console.domU.evtchn = 0;
1364 1398
1399 xen_init_apic();
1400
1365 /* Make sure ACS will be enabled */ 1401 /* Make sure ACS will be enabled */
1366 pci_request_acs(); 1402 pci_request_acs();
1367 } 1403 }
1368 1404#ifdef CONFIG_PCI
1369 1405 /* PCI BIOS service won't work from a PV guest. */
1406 pci_probe &= ~PCI_PROBE_BIOS;
1407#endif
1370 xen_raw_console_write("about to get started...\n"); 1408 xen_raw_console_write("about to get started...\n");
1371 1409
1372 xen_setup_runstate_info(0); 1410 xen_setup_runstate_info(0);
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index b8e279479a6b..3506cd4f9a43 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -353,8 +353,13 @@ static pteval_t pte_mfn_to_pfn(pteval_t val)
353{ 353{
354 if (val & _PAGE_PRESENT) { 354 if (val & _PAGE_PRESENT) {
355 unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; 355 unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT;
356 unsigned long pfn = mfn_to_pfn(mfn);
357
356 pteval_t flags = val & PTE_FLAGS_MASK; 358 pteval_t flags = val & PTE_FLAGS_MASK;
357 val = ((pteval_t)mfn_to_pfn(mfn) << PAGE_SHIFT) | flags; 359 if (unlikely(pfn == ~0))
360 val = flags & ~_PAGE_PRESENT;
361 else
362 val = ((pteval_t)pfn << PAGE_SHIFT) | flags;
358 } 363 }
359 364
360 return val; 365 return val;
@@ -1859,7 +1864,6 @@ pgd_t * __init xen_setup_kernel_pagetable(pgd_t *pgd,
1859#endif /* CONFIG_X86_64 */ 1864#endif /* CONFIG_X86_64 */
1860 1865
1861static unsigned char dummy_mapping[PAGE_SIZE] __page_aligned_bss; 1866static unsigned char dummy_mapping[PAGE_SIZE] __page_aligned_bss;
1862static unsigned char fake_ioapic_mapping[PAGE_SIZE] __page_aligned_bss;
1863 1867
1864static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot) 1868static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
1865{ 1869{
@@ -1900,7 +1904,7 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
1900 * We just don't map the IO APIC - all access is via 1904 * We just don't map the IO APIC - all access is via
1901 * hypercalls. Keep the address in the pte for reference. 1905 * hypercalls. Keep the address in the pte for reference.
1902 */ 1906 */
1903 pte = pfn_pte(PFN_DOWN(__pa(fake_ioapic_mapping)), PAGE_KERNEL); 1907 pte = pfn_pte(PFN_DOWN(__pa(dummy_mapping)), PAGE_KERNEL);
1904 break; 1908 break;
1905#endif 1909#endif
1906 1910
@@ -2065,7 +2069,6 @@ void __init xen_init_mmu_ops(void)
2065 pv_mmu_ops = xen_mmu_ops; 2069 pv_mmu_ops = xen_mmu_ops;
2066 2070
2067 memset(dummy_mapping, 0xff, PAGE_SIZE); 2071 memset(dummy_mapping, 0xff, PAGE_SIZE);
2068 memset(fake_ioapic_mapping, 0xfd, PAGE_SIZE);
2069} 2072}
2070 2073
2071/* Protected by xen_reservation_lock. */ 2074/* Protected by xen_reservation_lock. */
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 5fac6919b957..3700945ed0d5 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -178,6 +178,7 @@ static void __init xen_fill_possible_map(void)
178static void __init xen_filter_cpu_maps(void) 178static void __init xen_filter_cpu_maps(void)
179{ 179{
180 int i, rc; 180 int i, rc;
181 unsigned int subtract = 0;
181 182
182 if (!xen_initial_domain()) 183 if (!xen_initial_domain())
183 return; 184 return;
@@ -192,8 +193,22 @@ static void __init xen_filter_cpu_maps(void)
192 } else { 193 } else {
193 set_cpu_possible(i, false); 194 set_cpu_possible(i, false);
194 set_cpu_present(i, false); 195 set_cpu_present(i, false);
196 subtract++;
195 } 197 }
196 } 198 }
199#ifdef CONFIG_HOTPLUG_CPU
200 /* This is akin to using 'nr_cpus' on the Linux command line.
201 * Which is OK as when we use 'dom0_max_vcpus=X' we can only
202 * have up to X, while nr_cpu_ids is greater than X. This
203 * normally is not a problem, except when CPU hotplugging
204 * is involved and then there might be more than X CPUs
205 * in the guest - which will not work as there is no
206 * hypercall to expand the max number of VCPUs an already
207 * running guest has. So cap it up to X. */
208 if (subtract)
209 nr_cpu_ids = nr_cpu_ids - subtract;
210#endif
211
197} 212}
198 213
199static void __init xen_smp_prepare_boot_cpu(void) 214static void __init xen_smp_prepare_boot_cpu(void)
@@ -250,18 +265,8 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
250 set_cpu_possible(cpu, false); 265 set_cpu_possible(cpu, false);
251 } 266 }
252 267
253 for_each_possible_cpu (cpu) { 268 for_each_possible_cpu(cpu)
254 struct task_struct *idle;
255
256 if (cpu == 0)
257 continue;
258
259 idle = fork_idle(cpu);
260 if (IS_ERR(idle))
261 panic("failed fork for CPU %d", cpu);
262
263 set_cpu_present(cpu, true); 269 set_cpu_present(cpu, true);
264 }
265} 270}
266 271
267static int __cpuinit 272static int __cpuinit
@@ -331,9 +336,8 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
331 return 0; 336 return 0;
332} 337}
333 338
334static int __cpuinit xen_cpu_up(unsigned int cpu) 339static int __cpuinit xen_cpu_up(unsigned int cpu, struct task_struct *idle)
335{ 340{
336 struct task_struct *idle = idle_task(cpu);
337 int rc; 341 int rc;
338 342
339 per_cpu(current_task, cpu) = idle; 343 per_cpu(current_task, cpu) = idle;
@@ -547,10 +551,10 @@ static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus)
547 xen_init_lock_cpu(0); 551 xen_init_lock_cpu(0);
548} 552}
549 553
550static int __cpuinit xen_hvm_cpu_up(unsigned int cpu) 554static int __cpuinit xen_hvm_cpu_up(unsigned int cpu, struct task_struct *tidle)
551{ 555{
552 int rc; 556 int rc;
553 rc = native_cpu_up(cpu); 557 rc = native_cpu_up(cpu, tidle);
554 WARN_ON (xen_smp_intr_init(cpu)); 558 WARN_ON (xen_smp_intr_init(cpu));
555 return rc; 559 return rc;
556} 560}
diff --git a/arch/x86/xen/xen-asm.S b/arch/x86/xen/xen-asm.S
index 79d7362ad6d1..3e45aa000718 100644
--- a/arch/x86/xen/xen-asm.S
+++ b/arch/x86/xen/xen-asm.S
@@ -96,7 +96,7 @@ ENTRY(xen_restore_fl_direct)
96 96
97 /* check for unmasked and pending */ 97 /* check for unmasked and pending */
98 cmpw $0x0001, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_pending 98 cmpw $0x0001, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_pending
99 jz 1f 99 jnz 1f
1002: call check_events 1002: call check_events
1011: 1011:
102ENDPATCH(xen_restore_fl_direct) 102ENDPATCH(xen_restore_fl_direct)
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index b095739ccd4c..45c0c0667bd9 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -92,11 +92,15 @@ struct dom0_vga_console_info;
92 92
93#ifdef CONFIG_XEN_DOM0 93#ifdef CONFIG_XEN_DOM0
94void __init xen_init_vga(const struct dom0_vga_console_info *, size_t size); 94void __init xen_init_vga(const struct dom0_vga_console_info *, size_t size);
95void __init xen_init_apic(void);
95#else 96#else
96static inline void __init xen_init_vga(const struct dom0_vga_console_info *info, 97static inline void __init xen_init_vga(const struct dom0_vga_console_info *info,
97 size_t size) 98 size_t size)
98{ 99{
99} 100}
101static inline void __init xen_init_apic(void)
102{
103}
100#endif 104#endif
101 105
102/* Declare an asm function, along with symbols needed to make it 106/* Declare an asm function, along with symbols needed to make it
diff --git a/arch/xtensa/configs/common_defconfig b/arch/xtensa/configs/common_defconfig
index b90038e40dd3..a182a4e6d688 100644
--- a/arch/xtensa/configs/common_defconfig
+++ b/arch/xtensa/configs/common_defconfig
@@ -333,11 +333,6 @@ CONFIG_XT2000_SONIC=y
333# CONFIG_S2IO is not set 333# CONFIG_S2IO is not set
334 334
335# 335#
336# Token Ring devices
337#
338# CONFIG_TR is not set
339
340#
341# Wireless LAN (non-hamradio) 336# Wireless LAN (non-hamradio)
342# 337#
343CONFIG_NET_RADIO=y 338CONFIG_NET_RADIO=y
diff --git a/arch/xtensa/include/asm/hardirq.h b/arch/xtensa/include/asm/hardirq.h
index 26664cef8f11..91695a135498 100644
--- a/arch/xtensa/include/asm/hardirq.h
+++ b/arch/xtensa/include/asm/hardirq.h
@@ -11,9 +11,6 @@
11#ifndef _XTENSA_HARDIRQ_H 11#ifndef _XTENSA_HARDIRQ_H
12#define _XTENSA_HARDIRQ_H 12#define _XTENSA_HARDIRQ_H
13 13
14void ack_bad_irq(unsigned int irq);
15#define ack_bad_irq ack_bad_irq
16
17#include <asm-generic/hardirq.h> 14#include <asm-generic/hardirq.h>
18 15
19#endif /* _XTENSA_HARDIRQ_H */ 16#endif /* _XTENSA_HARDIRQ_H */
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index d04cd3a625fa..4beb43c087d3 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -14,6 +14,7 @@
14#ifdef __KERNEL__ 14#ifdef __KERNEL__
15#include <asm/byteorder.h> 15#include <asm/byteorder.h>
16#include <asm/page.h> 16#include <asm/page.h>
17#include <linux/bug.h>
17#include <linux/kernel.h> 18#include <linux/kernel.h>
18 19
19#include <linux/types.h> 20#include <linux/types.h>
diff --git a/arch/xtensa/kernel/Makefile b/arch/xtensa/kernel/Makefile
index 2d2728b3e862..59fc3fe15572 100644
--- a/arch/xtensa/kernel/Makefile
+++ b/arch/xtensa/kernel/Makefile
@@ -6,7 +6,7 @@ extra-y := head.o vmlinux.lds
6 6
7obj-y := align.o entry.o irq.o coprocessor.o process.o ptrace.o \ 7obj-y := align.o entry.o irq.o coprocessor.o process.o ptrace.o \
8 setup.o signal.o syscall.o time.o traps.o vectors.o platform.o \ 8 setup.o signal.o syscall.o time.o traps.o vectors.o platform.o \
9 pci-dma.o init_task.o io.o 9 pci-dma.o io.o
10 10
11obj-$(CONFIG_KGDB) += xtensa-stub.o 11obj-$(CONFIG_KGDB) += xtensa-stub.o
12obj-$(CONFIG_PCI) += pci.o 12obj-$(CONFIG_PCI) += pci.o
diff --git a/arch/xtensa/kernel/init_task.c b/arch/xtensa/kernel/init_task.c
deleted file mode 100644
index cd122fb7e48a..000000000000
--- a/arch/xtensa/kernel/init_task.c
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * arch/xtensa/kernel/init_task.c
3 *
4 * Xtensa Processor version.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2007 Tensilica Inc.
11 *
12 * Chris Zankel <chris@zankel.net>
13 */
14
15#include <linux/mm.h>
16#include <linux/fs.h>
17#include <linux/init.h>
18#include <linux/init_task.h>
19#include <linux/module.h>
20#include <linux/mqueue.h>
21
22#include <asm/uaccess.h>
23
24static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
25static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
26union thread_union init_thread_union __init_task_data =
27 { INIT_THREAD_INFO(init_task) };
28
29struct task_struct init_task = INIT_TASK(init_task);
30
31EXPORT_SYMBOL(init_task);
diff --git a/arch/xtensa/kernel/signal.c b/arch/xtensa/kernel/signal.c
index b69b000349fc..d78869a00b11 100644
--- a/arch/xtensa/kernel/signal.c
+++ b/arch/xtensa/kernel/signal.c
@@ -496,6 +496,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
496 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 496 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
497 497
498 if (signr > 0) { 498 if (signr > 0) {
499 int ret;
499 500
500 /* Are we from a system call? */ 501 /* Are we from a system call? */
501 502